	function isTextFieldValNaN(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(isNaN(strCont)) {
			alert(Description + " must be a number.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function isTextFieldValCurrency(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		strCont = strCont.replace("$", "")
		strCont = strCont.replace(",", "")
		if(isNaN(strCont) && "$".replace("$", "") == "") {
			alert(Description + " must be currency.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}

	function TextFieldVal(formname,fieldname,Description) {
		var strCont
		strCont = eval("document." + formname + "." + fieldname + ".value");
		if(strCont == "") {
			alert(Description + " is a required field.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;
		} else {
			return true;
		}
	}
	
	function ValidEmail(formname,fieldname,Description) {
		var strEmail
		strEmail = eval("document." + formname + "." + fieldname + ".value");	
		if(strEmail.indexOf("@") == -1 || strEmail.indexOf(".") == -1 || strEmail.indexOf(" ") > -1) {
			alert("Please enter a valid E-Mail Address.\nFor example: johndoe@domain.com\nAlso, there should be no spaces\nin your E-Mail Address.");
			eval("document." + formname + "." + fieldname + ".focus()");
			return false;		
		} else {
			return true;
		}
	
	}
	
  function CheckLength(myForm, myelement, myDescription, mLength) {
	var intLen;
	var strContents = eval("document." + myForm + "." + myelement + ".value");
	intLen = strContents.length;
	if(intLen > mLength) {
	   strReplace = strContents.substring(0,mLength);
	   TargetElement= eval("document." + myForm + "." + myelement)
	   TargetElement.value = strReplace;
	   alert("The text you have just entered for " + myDescription + " is too long.\nThis field must contain no more than " + mLength + " characters.\nThe field currently contains " + intLen + " characters.\n\nYour text has been truncated to fit within " + mLength + " characters.");
	   eval("document." + myForm + "." + myelement + ".focus()");
	   return false;
	}  else {
		return true;
	}
  }	
  
  function checkdate(tYear, tMonth, tDay) {
	tMonth = tMonth - 1
	var testdate = new Date(tYear,tMonth,tDay)
  	var endmonth=testdate.getMonth();
	
	if(tMonth != endmonth) {
		alert("Please enter a valid date.");
		return false;
	} else {
		return true;
	}

  }
  
  
 function MandatoryCheckBox(formname, fieldname, Description) {
 /* This functions role in life is to determine whether or not at least one checkbox or radio button,
	has been selected out of a series of checkboxes or radio buttons. */
	var arrLength = eval("document." + formname + "." + fieldname + ".length")-1;
	for(i=0; i<=arrLength; i++) {
		if(eval("document." + formname + "." + fieldname + "[" + i + "].checked") == true) {
			return true;
		}
	}
	alert("Please select at least one " + Description);
	eval("document." + formname + "." + fieldname + "[0].focus()");
	return false;
 }
 
 
 

