function ImageOff(imgName)
{
	imgOff=eval(imgName + "_off.src");
    document[imgName].src=imgOff;
}

function ImageOn(imgName)
{
	imgOn=eval(imgName + "_on.src");
	document[imgName].src=imgOn;
}

function TrOn(WhichColor,Val)
{
	if (WhichColor == 'Blue') Color = '#D6DCF5';
	else if (WhichColor == 'Blue2') Color = '#EEF1FF';
	else if (WhichColor == 'Gray') Color = '#E0E0E0';
	else if (WhichColor == 'Green') Color = 	'#CCF5C7';	
	else if (WhichColor == 'White') Color = 	'#E8E8E8';	
	else if (WhichColor == 'Orange') Color = 	'#FFFFFF';	
	else Color = WhichColor;
	Val.style.backgroundColor = Color;
}

function TrBOn(WhichColor,Val)
{
	Val.style.border = "1px solid "+WhichColor;
}

function TrBOff(Val)
{
	Val.style.border = "0px";
}

function TrOff(WhichColor,Val)
{
	if (WhichColor == 'Blue') Color = '#EFF2FF';
	else if (WhichColor == 'Blue2') Color = '#FFFFFF';
	else if (WhichColor == 'Gray') Color = '#F1F1F1';
	else if (WhichColor == 'Green') Color = '#EBFFEE';	
	else if (WhichColor == 'White') Color = '#ffffff';	
	else if (WhichColor == 'Orange') Color = 	'#FF6600';	
	else Color = WhichColor;
	Val.style.backgroundColor = Color;
}

function newWindow(file,popW,popH) 
{
	var w = 0, h = 0;
	if (document.all || document.layers) 
	{
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	features = "height="+popH+", width="+popW+", top="+topPos+", left="+leftPos+", toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no";
	msgWindow=open(file,"newWin",features);
}

function newModalWindow(file,popW,popH) 
{
	Arg = "dialogWidth:"+popW+"px; dialogHeight:"+popH+"px; center:yes; resizable:no; edge:raised; help:no; scroll:no; status:no;";
	window.showModalDialog(file, window, Arg);
}

function newModalWindowS(file,popW,popH) 
{
	Arg = "dialogWidth:"+popW+"px; dialogHeight:"+popH+"px; center:yes; resizable:yes; edge:raised; help:no; scroll:yes; status:no;";
	window.showModalDialog(file, window, Arg);
}

function newModelessWindow(file,popW,popH) 
{
	Arg = "dialogWidth:"+popW+"px; dialogHeight:"+popH+"px; center:yes; resizable:no; edge:raised; help:no; scroll:no; status:no;";
	window.showModelessDialog(file, window, Arg);
}

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"
function FloatTopDiv(topY)
{
	var startX = 0,
		startY = 5;
	if (topY != null) startY = topY;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;

	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else
		{
			el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
			el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop")
		{
			var pY = ns ? pageYOffset : document.body.scrollTop;
			ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else
		{
			var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
			ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		
		if (topY != null) 
		{
			sLoc = document.body.scrollTop;
			if (sLoc >= topY) ftlObj.y = (ftlObj.y - (Math.round((topY/10),0)+5));
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
		
		
	}
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
}

//Proper Case
function PCase(STRING)
{
	var strReturn_Value = "";
	var iTemp = STRING.length;
	if(iTemp==0) return "";
	var UcaseNext = false;
	strReturn_Value += STRING.charAt(0).toUpperCase();
	for(var iCounter=1;iCounter < iTemp;iCounter++)
	{
		if(UcaseNext == true)
		{
			strReturn_Value += STRING.charAt(iCounter).toUpperCase();
		}
		else
		{
			strReturn_Value += STRING.charAt(iCounter).toLowerCase();
		}
		var iChar = STRING.charCodeAt(iCounter);
		if(iChar == 32 || iChar == 45 || iChar == 46)
		{
			UcaseNext = true;
		}
		else
		{
			UcaseNext = false
		}
		if(iChar == 99 || iChar == 67)
		{
			if(STRING.charCodeAt(iCounter-1)==77 || STRING.charCodeAt(iCounter-1)==109)
			{
				UcaseNext = true;
			}
		}
	} //End For
	return strReturn_Value;
}

function getRadioValue(Val)
{
	Length = eval("document.forms[0]."+Val+".length");
	for (i=0; i<Length; i++)
	{
		Checked = eval("document.forms[0]."+Val+"[i].checked");
		Value   = eval("document.forms[0]."+Val+"[i].value");
		if (Checked) return Value;
	}
}

function promptBox(Title, Val)
{
	newModelessWindow('promptbox.php?Title='+Title+"&Val="+Val, '300', '110');
}
