<!--


// www.avalonscreens.com  UA-7709345-2
var gs_google_analytics = "UA-7709345-2";


function showscreen(strdivname) {
	hidediv("screen1");
	hidediv("screen2");
	hidediv("screen3");
	showdiv(strdivname);
}

function hidediv(strDivName) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(strDivName).style.visibility = 'hidden'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
			eval("document." + strDivName + ".visibility = 'hidden';");  
		} 
		else { // IE 4 
			eval("document.all." + strDivName + ".style.visibility = 'hidden'; ");
		} 
	} 
} 

function showdiv(strDivName) { 
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById(strDivName).style.visibility = 'visible'; 
	} 
	else { 
		if (document.layers) { // Netscape 4 
		eval("document." + strDivName + ".visibility = 'visible';"); 
		} 
		else { // IE 4 
		eval("document.all." + strDivName + ".style.visibility = 'visible'; ");
		} 
	} 
} 

function confirmAction(vsMsg)
{
	answer = confirm(vsMsg);

	if (answer == 0) 	{
		return false;
		}
	else {
		return true;
	}

}

function validateForm(whichForm) {
//	form elements can have req=true, num, truenum
var sMsg="";
var whichone = -1;
	for (a=0; a<whichForm.elements.length; a++) {
		if ((whichForm.elements[a].req == "num")|(whichForm.elements[a].req == "truenum")) {
			if (!(validateNumeric(whichForm.elements[a].value))&(whichForm.elements[a].value!="")) {
				if (whichone == -1 ) {
					whichone = a;
				}
				sMsg  = "Oops. You seem to have entered a non numerical amount.\n";
				sMsg += "Please only enter a number in the field, " +  replaceCharacters(whichForm.elements[a].name,'_',' ')  + ".";
				break;
			}
		}
		if ((whichForm.elements[a].req == "true")|(whichForm.elements[a].req == "truenum")) {
			if (whichForm.elements[a].value == "") {
				if (whichone == -1 ) {
					whichone = a;
				}
				sMsg  = "Oops. You seem to have left out some required information.\n";
				sMsg += "Please fill in the field, " +  replaceCharacters(whichForm.elements[a].name,'_',' ')  + ".";
				break;
		   }
		}
	}
	if (sMsg == "") {
		return;
	}

	whichForm.elements[whichone].focus();
	alert(sMsg);
	return false;
}

function  validateNumeric( strValue ) {
	var oRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
	return oRegExp.test(strValue);
}

function replaceCharacters( strValue, strMatchPattern, strReplaceString ) {
/************************************************
DESCRIPTION: Removes characters from a source string
  based upon matches of the supplied pattern and replaces with something else.

PARAMETERS:
  strValue - source string
  strReplaceString - replacement characters

RETURNS: String modified with characters
  matching search pattern removed

USAGE:  strNoSpaces = removeCharacters( ' sfdf  dfd',
                                '\s*')
*************************************************/
 var objRegExp =  new RegExp( strMatchPattern, 'gi' );

 //replace passed pattern matches with blanks
  return strValue.replace(objRegExp,strReplaceString);
}


/* End of search engine scripts */
// -->
