function NewWindow(mypage, myname, w, h, scroll, size) 
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,scrollbars='+scroll+',dependent=NO,location=0,status=0,menubar=0,resizable='+size+''
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}

// used for forms
function FormToWindow(myform, windowname, w, h, scroll, size)
	{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=0,scrollbars='+scroll+',dependent=YES,location=0,status=YES,menubar=0,resizable='+size+''
	if (! window.focus)return true;
	window.open('', windowname, winprops);
	myform.target=windowname;
	return true;
	}

function noenter(e) 
	{
	var key;

	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape

	if (key == 13) return false;
	}

function decimalsandenter(e)
	{
	var key;
	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape
	if (key == 13) return false;	// return
	if (key == 47) return false;	// forward slash
	if (key > 31 && (key < 46 || key > 57)) return false;
	}

function intandenter(e)
	{
	var key;
	if(window.event) key = window.event.keyCode;     //IE
	else key = e.which;     //firefox & netscape
	if (key == 13) return false;	// return
	if (key > 31 && (key < 48 || key > 57)) return false;
	}

function Trim(TRIM_VALUE)
	{
	if(TRIM_VALUE.length < 1)	{ return""; }
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
		{ return ""; }
	else
		{ return TRIM_VALUE; }
	} 

function RTrim(VALUE)
	{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0) { return ""; }
	var iTemp = v_length -1;

	while(iTemp > -1)
		{
		if(VALUE.charAt(iTemp) != w_space)
			{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
			}
		iTemp = iTemp-1;
		} 
	return strTemp;
	}

function LTrim(VALUE)
	{
	var w_space = String.fromCharCode(32);
	if(v_length < 1) { return ""; }
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;

	while(iTemp < v_length)
		{
		if(VALUE.charAt(iTemp) != w_space)
			{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
			}
		iTemp = iTemp + 1;
		} 
	return strTemp;
	}

function TextCheck(obj, description, length)
	{
	if (Trim(obj.value) == "" || obj.value == null)
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

function SelectCheck(obj, description, length)
	{
	if (obj.value <= 0)
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

function turn(whichOne, state) 
	{
	if (state == 'on')
		{ document.getElementById(whichOne).style.display = ''; }
	else
		{ document.getElementById(whichOne).style.display = 'none'; }
	}

function highlight(object, length) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffff33; width: "+length+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffff33; width: "+length+"px;"); } 
	}

function clean(object, length) 
	{ 
	if(object.style.setAttribute) // IE
		{ object.style.setAttribute("cssText", "background-color: #ffffff; width: "+length+"px;"); } 
	else { object.setAttribute("style", "background-color: #ffffff; width: "+length+"px;"); } 
	}

function emailCheck(obj, description, length)
	{
	var cleanemail = Trim(obj.value);
	if ((cleanemail.indexOf('@') < 0) || ((cleanemail.charAt(cleanemail.length-4) != '.') && (cleanemail.charAt(cleanemail.length-3) != '.')))
		{ 
		highlight(obj, length);
		return(" - " + description + "\n"); 
		}
	return('');
	}

