<!-- Hide from non-JavaScript Browsers

function hidediv(strDivName) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(strDivName).style.display = 'none'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
			eval("document." + strDivName + ".display = 'none';");  
		} 
		else { // IE 4 
			eval("document.all." + strDivName + ".style.display = 'none'; ");
		} 
	} 
} 

function showdiv(strDivName) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(strDivName).style.display = 'inline'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
		eval("document." + strDivName + ".display = 'inline';"); 
		} 
		else { // IE 4 
		eval("document.all." + strDivName + ".style.display = 'inline'; ");
		} 
	} 
} 



window.onload = function() {
	if (document.getElementById) {
		var allInputs = document.getElementsByTagName("input");
		for (var i = 0; i < allInputs.length; i++) {
			if ((allInputs[i].type == 'text') || (allInputs[i].type == 'password')){
							allInputs[i].onfocus = function() { 
								this.style.backgroundColor = '#DEDEDE';
								this.style.color = '#000000';
								this.style.border = 'solid 1 #000000';
							}
							allInputs[i].onblur = function() { this.style.cssText = ''; }
			}

		}
		allInputs = document.getElementsByTagName("select");
		for (var i = 0; i < allInputs.length; i++) {
			allInputs[i].onfocus = function() { 
				this.style.backgroundColor = '#DEDEDE';
				this.style.color = '#000000';
			}
			allInputs[i].onblur = function() { this.style.cssText = ''; }	
		}
		
		allInputs = document.getElementsByTagName("tr");
		for (var i = 0; i < allInputs.length; i++) {
			if (allInputs[i].className == 'trHover') {
				allInputs[i].onmouseover = function() { this.className = 'trHoverOn'; }
				allInputs[i].onmouseout = function() { this.className = 'trHover'; }
			}

		}
	}
}


function clearField(voWhichElement) {
	voWhichElement.value = "";
}


function openWin(vsURL,vsWindowName,vnWidth,vnHeight) {
	var loWin;
	loWin = window.open(vsURL, vsWindowName, 'toolbar=0, location=0, directories=0, status=0, menubar=no, scrollbars=yes, resizable=yes, width='+vnWidth+', height='+vnHeight);
	loWin.focus();
	loWin.resizeTo(vnWidth,vnHeight);
}

function previewImage(vsHttpPath,vsImagePath) {
	var lsUrl;
	lsUrl = vsHttpPath+vsImagePath;
	imageWin = window.open(lsUrl,'','width=700,height=500,scrollbars=yes,resizable=yes, status=yes,titlebar=0');
	
}


function validateForm(voWhichForm) {
//	form elements can have req=true, num, truenum
var lsMsg="";
var lnWhichone = -1;
	for (a=0; a<voWhichForm.elements.length; a++) {
		if ((voWhichForm.elements[a].req == "num")|(voWhichForm.elements[a].req == "truenum")) {
			if (!(validateNumeric(voWhichForm.elements[a].value))&(voWhichForm.elements[a].value!="")) {
				if (lnWhichone == -1 ) {
					lnWhichone = a;
				}
				lsMsg  = "Oops. You seem to have entered a non numerical amount.\n";
				lsMsg += "Please only enter a number in the field, " +  replaceCharacters(voWhichForm.elements[a].name,'_',' ')  + ".";
				break;
			}
		}
		if ((voWhichForm.elements[a].req == "true")|(voWhichForm.elements[a].req == "truenum")) {
			if (voWhichForm.elements[a].value == "") {
				if (lnWhichone == -1 ) {
					lnWhichone = a;
				}
				lsMsg  = "Oops. You seem to have left out some required information.\n";
				lsMsg += "Please fill in the field, " +  replaceCharacters(voWhichForm.elements[a].name,'_',' ')  + ".";
				break;
		   }
		}
	}
	if (lsMsg == "") {
		return;
	}

	voWhichForm.elements[lnWhichone].focus();
	alert(lsMsg);
	return false;
}

function  validateNumeric( vsString ) {
	var loRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
	return loRegExp.test(vsString);
}

function replaceCharacters( vsSource, vsMatchPattern, vsReplaceString ) {
/************************************************
DESCRIPTION: Removes characters from a source string
  based upon matches of the supplied pattern and replaces with something else.

PARAMETERS:
  vsSource - source string
  vsMatchPattern - pattern to replace
  strReplaceString - replacement characters

RETURNS: String modified with characters matching search pattern removed

USAGE:  strNoSpaces = replaceCharacters( ' sfdf  dfd', '\s*', '')
*************************************************/
 var loRegExp =  new RegExp( vsMatchPattern, 'gi' );

 //replace passed pattern matches with replacement string
  return vsSource.replace(loRegExp,vsReplaceString);
}

//Done Hiding -->