/* insertTab Function Found At http://pallieter.org/Projects/insertTab/ */
function insertTab(o, e) {
	var kC = e.keyCode ? e.keyCode : e.charCode ? e.charCode : e.which;
	if (kC == 9 && !e.shiftKey && !e.ctrlKey && !e.altKey)
	{
		var oS = o.scrollTop;
		if (o.setSelectionRange)
		{
			var sS = o.selectionStart;
			var sE = o.selectionEnd;
			o.value = o.value.substring(0, sS) + "\t" + o.value.substr(sE);
			o.setSelectionRange(sS + 1, sS + 1);
			o.focus();
		}
		else if (o.createTextRange)
		{
			document.selection.createRange().text = "\t";
			e.returnValue = false;
		}
		o.scrollTop = oS;
		if (e.preventDefault)
		{
			e.preventDefault();
		}
		return false;
	}
	return true;
}

function min_max(a,b) {
	aObj=document.getElementById(a);
	if(b.innerHTML=="[Restore]") {
		aObj.style.position="relative";
		aObj.style.top="0";
		aObj.style.bottom="0";
		aObj.style.left="0";
		aObj.style.right="0";
		aObj.style.height=aObj.height;
		aObj.style.width=aObj.width;
		b.style.position="relative";
		b.style.bottom="0";
		b.style.right="0";
		b.style.fontWeight="normal";
	} else {
		aObj.style.position="absolute";
		aObj.style.top="4%";
		aObj.style.bottom="1%";
		aObj.style.left="1%";
		aObj.style.right="1%";
		aObj.height=(aObj.style.height);
		aObj.width=(aObj.style.width);
		aObj.style.height="94%";
		aObj.style.width="98%";
		b.style.position="absolute";
		b.style.bottom="1px";
		b.style.left="1px";
		b.style.fontWeight="bold";
		b.style.zIndex="101";
	}
	b.innerHTML=(b.innerHTML=="[Restore]")?"[Maximize]":"[Restore]";
}
function add_option(fid,iname,itype,ival,adt) {
	elem = document.getElementById(fid);
	elem.style.display = "block";
	if(elem.innerHTML=="&nbsp;")
		elem.innerHTML = "<input type=\""+itype+"\" name=\""+iname+"\" value=\""+ival+"\" />";
	else
		elem.innerHTML += "<input type=\""+itype+"\" name=\""+iname+"\" value=\""+ival+"\" />";
	if(adt!==false)
		elem.innerHTML += adt;
}