<!--

function openWin(sURL,sWindowName,w,h) {

	oWin = window.open(sURL, sWindowName, 'toolbar=yes, location=0, directories=0, status=0, menubar=yes, scrollbars=yes, resizable=yes, width='+w+', height='+h);
	oWin.focus();
	oWin.resizeTo(w,h);
}


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 " +  replaceCharacters(whichForm.elements[a].name,'_',' ')  + " field.";
				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 " +  replaceCharacters(whichForm.elements[a].name,'_',' ')  + " field.";
				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);
}

// -->