	function showdiv(id)
	{
		document.getElementById(id).style.height = 'auto';
		document.getElementById(id).style.visibility = 'visible';
	}

	function hidediv(id)
	{
		document.getElementById(id).style.height = 1;
		document.getElementById(id).style.visibility = 'hidden';
	}
	
	function Enable(node, btnSubmit)
	{
		if(node.checked)
			document.getElementById(btnSubmit).disabled = false;
		else
			document.getElementById(btnSubmit).disabled = true;
	}	
	
	function PopImage(imgID)
	{
		newwin = window.open("ShowImage.php?id="+imgID,'','status=yes,scrollbars=yes, width=500,height=600');
	
	}
	function PopFileImage(imgID)
	{
		newwin = window.open("ShowSWFFileImage.php?id="+imgID,'','status=yes,scrollbars=yes, width=500,height=600');
	
	}
	function PopImage2(imgID)
	{
		newwin = window.open("ShowImage.php?id="+imgID,'','status=yes,scrollbars=yes, width=500,height=600');
	
	}
	
	var htmlTags = new Array();
		htmlTags['bold'] = new Array("<b>","</b>");
		htmlTags['italic'] = new Array("<em>","</em>");
	
function SelectText(elem, tag)
{
	var txtarea;
	txtarea = document.getElementById(elem);

	if (document.selection  && document.selection.createRange) { // IE/Opera

		//save window scroll position
		if (document.documentElement && document.documentElement.scrollTop)
			var winScroll = document.documentElement.scrollTop
		else if (document.body)
			var winScroll = document.body.scrollTop;
		//get current selection  
		txtarea.focus();
		var range = document.selection.createRange();
		selText = range.text;
		
		if(selText.length>0)
		{
			range.text = htmlTags[tag][0]+selText+htmlTags[tag][1];
		}
		//restore window scroll position
		if (document.documentElement && document.documentElement.scrollTop)
			document.documentElement.scrollTop = winScroll
		else if (document.body)
			document.body.scrollTop = winScroll;

	} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla

		//save textarea scroll position
		var textScroll = txtarea.scrollTop;
		//get current selection
		txtarea.focus();
		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		selText = txtarea.value.substring(startPos, endPos);
		
		if(selText.length>0)
		{
			txtarea.value = txtarea.value.substring(0, startPos) + htmlTags[tag][0]
						    + selText + htmlTags[tag][1] + txtarea.value.substring(endPos, txtarea.value.length);
		}
		txtarea.scrollTop = textScroll;
		//insert tags
	} 
	
//	alert(selText);

}
// JavaScript Document
