  function Hilite(name,over)
  {
	  if(window.document.images) 
	  {
		  if (over)
			  window.document.images[name].src = "images/" + name + "a.gif";
		  else
			  window.document.images[name].src =  "images/" + name + ".gif";
	  }
  }

	function trim(inputString) {
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") {
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") {
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1){
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
	}
	return retValue;
	}

	function CompareStartDateEndDate(startDate, endDate){

		if(startDate.value.indexOf('-') > 0){
			var arrStartDate = startDate.value.split('-')
		}

		else{
			var arrStartDate = startDate.value.split('/')
		}
		
		var dtStartMonth = parseInt(arrStartDate[0],10);
		var dtStartDay = parseInt(arrStartDate[1],10);
		var dtStartYear = parseInt(arrStartDate[2],10);
		
		if (dtStartYear <= 50 && dtStartYear >= 0){
			dtStartYear = 2000 + dtStartYear;
		}

		else if (dtStartYear > 50 && dtStartYear < 100){
			dtStartYear = 1900 + dtStartYear;
		}

		var dtStartDate = dtStartMonth + '/' + dtStartDay + '/' + dtStartYear
		startDate.value = dtStartDate

		if(endDate.value.indexOf('-') > 0){
			var arrEndDate = endDate.value.split('-')
		}

		else{
			var arrEndDate = endDate.value.split('/')
		}
		
		var dtEndMonth = parseInt(arrEndDate[0],10);
		var dtEndDay = parseInt(arrEndDate[1],10);
		var dtEndYear = parseInt(arrEndDate[2],10);

		if (dtEndYear <= 50 && dtEndYear >= 0){
			dtEndYear = 2000 + dtEndYear;
		}
		else if (dtEndYear > 50 && dtEndYear < 100){
			dtEndYear = 1900 + dtEndYear;
		}
		
		var dtEndDate = dtEndMonth + '/' + dtEndDay + '/' + dtEndYear
		endDate.value = dtEndDate
		
		if (dtStartYear > dtEndYear){
			alert("The End Date is not greater than the Start Date.\nPlease change one or the other.");
			return false;
		}
		else if(dtStartYear == dtEndYear){
			
			if(dtStartMonth > dtEndMonth){
				alert("The End Date is not greater than the Start Date.\nPlease change one or the other.");
				return false;
			}
			
			else if(dtStartMonth == dtEndMonth){
				
				if(dtStartDay >= dtEndDay){
					alert("The End Date is not greater than the Start Date.\nPlease change one or the other.");
					return false;
				}
			}
		}
		return true;
	}

	function isLeapYear (Year) {
	    if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
	        return (true);
	    }
	    else {
	        return (false);
	    }
	}
	
	/*  Assumes format of Month/Day/Year.  
	**  Month and Day may be one or two digits.
	**  Year may be 2 or 4 digits.
	**  Seperator may be dashes (-) or slashes (/)
	*/
	function IsDate(strValue) {  
		blnBad = false;
		strValid = "0123456789/-";
		blnDashes = false;
		blnSlashes = false;
		iNumSeperators = 0;
		strMonth = "";
		strDay = "";
		strYear = "";
		aDaysInMonths=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
		
		if (strValue.length == 0)
			return true;
		else {
			//Test for valid characters
			for (var i=0; i < strValue.length; i++) {
				cTest = strValue.substring(i, i+1);
				if (cTest == "/") { 
					blnSlashes = true;
					iNumSeperators++;
				}
				else if (cTest == "-") {
					blnDashes = true;
					iNumSeperators++;
				}
					
				blnBad = (strValid.indexOf(cTest) < 0);
				if (blnBad) 
					break;
			}
			//There must be 2 Seperators, and they both must be the same character.
			
			// This line caught multiple seperators but didn't break
			// blnBad = (blnBad) && (iNumSeperators != 2);
			
			if (iNumSeperators != 2) { return false }
			
			if ((blnSlashes && blnDashes) || (!blnSlashes && !blnDashes))
				blnBad = true;
			
			if (!blnBad) { //Characters fall in valid set. Parse for individual values.
				cSeperator = "/";
				if (blnDashes)
					cSeperator = "-";
				cSection = "M";  //start with Month
				for (var i=0; i < strValue.length; i++) {
					c = strValue.substring(i, i+1);
					if (c == cSeperator) {
						if (cSection == "M")
							cSection = "D";
						else if (cSection == "D")
							cSection = "Y";
					}
					else {
						if (cSection == "M")
							strMonth += c;
						else if (cSection == "D")
							strDay += c;
						else if (cSection == "Y")
							strYear += c;
					}
				}
			}
			//Date values have been parsed.  Check that the values are proper length.
			blnBad = (strMonth.length != 2 && strMonth.length != 1) || (strDay.length != 2 && strDay.length != 1) || ((strYear.length != 2) && (strYear.length != 4));
				
			if (!blnBad) {
				iMonth = parseInt(strMonth,10);
				iDay = parseInt(strDay,10);
				iYear = parseInt(strYear,10);
				
				//Convert a 2 digit year to 4 digits - 50 year window.
				if (strYear.length == 2) {
				    var now = new Date();
				    iCurrentYear = now.getYear() + 1900;
					iYear += 1900;
					if (iCurrentYear - iYear >= 50 )
						iYear += 100;
				}
				
				//min/max test
				var now = new Date()
				iMaxYear = now.getYear() + 300
				iMinYear = now.getYear() - 300
				if (iYear < iMinYear || iYear > iMaxYear)
					return false;
				
				
				//other tests
				blnBad = ((iMonth < 1) || (iDay < 1));
				if ((iMonth == 2) && (isLeapYear(iYear)))
					blnBad = ((blnBad) || (iDay > 29));
				else
					blnBad = ((blnBad) || (iMonth > 12) || (iDay > aDaysInMonths[iMonth-1]));
			}								
			return !blnBad;
		}
	}
	
	function IsTime(value) {
		var hasMeridian = false;
		var re = /^\d{1,2}[:]\d{2}([:]\d{2})?( [aApP][mM]?)?$/;
		if (!re.test(value)) { return false; }
		if (value.toLowerCase().indexOf("p") != -1) { hasMeridian = true; }
		if (value.toLowerCase().indexOf("a") != -1) { hasMeridian = true; }
		var values = value.split(":");
		if ( (parseFloat(values[0]) < 0) || (parseFloat(values[0]) > 23) ) { return false; }
		if (hasMeridian) {
			if ( (parseFloat(values[0]) < 1) || (parseFloat(values[0]) > 12) ) { return false; }
		}
		if ( (parseFloat(values[1]) < 0) || (parseFloat(values[1]) > 59) ) { return false; }
		if (values.length > 2) {
			if ( (parseFloat(values[2]) < 0) || (parseFloat(values[2]) > 59) ) { return false; }
		}
		return true;
	}

	/*Returns the right portion of an input string of length n.*/
	function Right(str, n){
		if (n <= 0)
		   return "";
		else if (n > String(str).length)
		   return str;
		else {
		   var iLen = String(str).length;
		   return String(str).substring(iLen, iLen - n);
		}
	}

	/*regular expression email validator*/
	function chkForEmail(value){
		var objRegExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
		if (objRegExp.test(value)) return true;
		return false;
	}
	
	/*file type validator*/
	function filterFileType(value, ext){
		var flag = true;		
		if (value.indexOf('.' + ext) == -1){
			flag = false;
		}
		if (Right(value, 3) != ext){
			flag = false;
		}
		return flag;
	}

	function checkAllSearchJobs(field){
		//if only one checkbox exists, it is not an array
		if(typeof(field.length) == "undefined")
		{
			field.checked = true;
		}
		else
		{
			for (i = 0; i < field.length; i++)
				field[i].checked = true ;
		}
	}
	
	function uncheckAllSearchJobs(field){
		//if only one checkbox exists, it is not an array
		if(typeof(field.length) == "undefined")
		{
			field.checked = false;
		}
		else
		{
			for (i = 0; i < field.length; i++)
				field[i].checked = false ;
		}
	}

	<!--
  function validatePlaceOrder(theForm){
	  if (trim(theForm.FirstName.value) == "")
	   {
			alert("Please enter your first name.");
			theForm.FirstName.value = "";
			theForm.FirstName.focus();
			return false;
	  }
	  
	  if (trim(theForm.LastName.value) == "")
	  {
			alert("Please enter your last name.");
			theForm.LastName.value = "";
			theForm.LastName.focus();
			return false;
	  }
	  
	  if (trim(theForm.Email.value) == "")
	  {
			alert("Please enter your email address.");
			theForm.Email.value = ""
			theForm.Email.focus();
			return false;
	  }
	  
	  if (! chkForEmail(theForm.Email.value))
	  {
			alert("Please enter a valid email address.");
			theForm.Email.focus();
			return false;
	  }

	  if (trim(theForm.CompanyName.value) == "")
	  {
			alert("Please enter your company name.");
			theForm.CompanyName.value = "";
			theForm.CompanyName.focus();
			return false;
	  }
	  
	  if (trim(theForm.PositionTitle.value) == "")
	  {
			alert("Please enter a position title.");
			theForm.PositionTitle.value = "";
			theForm.PositionTitle.focus();
			return false;
	  }
	  
		selection = -1;
		for (i=0; i<theForm.Region.length; i++) {
			if (theForm.Region[i].checked) {
				selection = i;
			}
		}
	
		if (selection == -1) {
			alert("Please select a region.");
			return false;
		}

	  if (trim(theForm.StartDate.value) == "")
	  {
			alert("Please enter a start date.");
			theForm.StartDate.value = "";
			theForm.StartDate.focus();
			return false;
	  }  		  								

	  if (!IsDate(theForm.StartDate.value))
	  {
			alert("Please enter a valid start date.");
			theForm.StartDate.focus();
			return false;
	  }  		  								

	  if (theForm.Description.value.length > 1000) 
	  {
		alert('Please limit job description to 1000 characters or less. Please remove '+(theForm.Description.value.length - 1000)+ ' characters');
		return false;
	  }							
	}
	//-->
		
		/*validates the contactus.asp page*/
  	<!--
	function validateContactUs(theForm)
		{
		  if (trim(theForm.topic.value) == "")
			{
				alert("Please select a topic!");
				theForm.topic.focus();
				return false;
			}
		  if (trim(theForm.yourname.value) == "")
			{
				alert("Please enter your name!");
				theForm.yourname.focus();
				return false;
			}
		  if (trim(theForm.Email.value) == "")
			{
				alert("Please enter your email address!");
				theForm.Email.focus();
				return false;
			}
		  if (! chkForEmail(trim(theForm.Email.value)))
			{
				alert("Please enter a valid email address!");
				theForm.Email.focus();
				return false;
			}
		}
	//-->

	function validateNumericLength(objField, strLength)
    {
        eval("var pattern = /\\d{" + strLength + "}/;")
        if(pattern.test(objField.value) == false)
        {
	        return false;
        }
        else{return true;}
	}

	<!--
	function validateQuickApp(PreQual){
	   if (trim(PreQual.FirstName.value) == ""){
			alert("Please enter your first name.");
			PreQual.FirstName.value = "";
			PreQual.FirstName.focus();
			return false;
		}
		
	   if (trim(PreQual.LastName.value) == ""){
			alert("Please enter your last name.");
			PreQual.LastName.value = "";
			PreQual.LastName.focus();
			return false;
		}

	   if (trim(PreQual.Address.value) == "")
		{
			 alert("Please enter your address.");
			 PreQual.Address.value = "";
			 PreQual.Address.focus();
			 return false;
		}

	   if (trim(PreQual.City.value) == "")
		{
			 alert("Please enter your City.");
			 PreQual.City.value = "";
			 PreQual.City.focus();
			 return false;
		}

	   if (PreQual.States.value == "")
		{
			 alert("Please enter your state.");
			 PreQual.States.focus();
			 return false;
		}


	   if (trim(PreQual.Phone1.value) == "")
	    {
			alert("Please enter your phone number.");
			PreQual.Phone1.focus();
			return false;
		}

	   if (trim(PreQual.Phone2.value) == "")
	    {
			alert("Please enter your phone number.");
			PreQual.Phone2.focus();
			return false;
		}

	   if (trim(PreQual.Phone3.value) == "")
	    {
			alert("Please enter your phone number.");
			PreQual.Phone3.focus();
			return false;
		}

	   if (!validateNumericLength(PreQual.Phone1, 3))
	    {
			alert("Please enter a valid phone number.");
			PreQual.Phone1.focus();
			return false;
		}

	   if (!validateNumericLength(PreQual.Phone2, 3))
	    {
			alert("Please enter a valid phone number.");
			PreQual.Phone2.focus();
			return false;
		}

	   if (!validateNumericLength(PreQual.Phone3, 4))
	    {
			alert("Please enter a valid phone number.");
			PreQual.Phone3.focus();
			return false;
		}

	   if (trim(PreQual.Email.value) == "")
		{
			alert("Please enter your email address.");
			PreQual.Email.value = "";
			PreQual.Email.focus();
			return false;
		}

	   if (! chkForEmail(PreQual.Email.value))
		{
			alert("Please enter a valid email address.");
			PreQual.Email.focus();
			return false;
		}

	   if (trim(PreQual.Salary.value) == "") 
		{
			alert('Please enter your salary requirements');
			PreQual.Salary.value = "";
			PreQual.Salary.focus();
			return false;
		}

	   if (PreQual.IfYes.value.length > 500) 
		{
			alert('Please limit the first question to 500 characters. Please remove '+(PreQual.IfYes.value.length - 500)+ ' characters');
			return false;
		}

       if (PreQual.Positions.value.length > 250) 
		{
			alert('Please limit the second question to 250 characters. Please remove '+(PreQual.Positions.value.length - 250)+ ' characters');
			return false;
		}	

       if (PreQual.Explain.value.length > 500) 
		{
			alert('Please limit the third question to 500 characters. Please remove '+(PreQual.Explain.value.length - 500)+ ' characters');
			return false;
		}

       if (PreQual.Referral.value.length > 50) 
		{
			alert('Please limit the fourth question to 50 characters. Please remove '+(PreQual.Referral.value.length - 50)+ ' characters');
			return false;
		}
		
		PreQual.StateName.value = document.PreQual.States.options[document.PreQual.States.selectedIndex].text;
		return true;
	}
	//-->

/**************** The code below is for Job Portal *****************/

<!-- Begin
	function checkAll(field){
		//if only one checkbox exists, it is not an array
		if(typeof(field.length) == "undefined")
		{
			field.checked = true;
		}
		else
		{
			for (i = 0; i < field.length; i++)
				field[i].checked = true ;
		}
	}
		
	function uncheckAll(field){
		//if only one checkbox exists, it is not an array
		if(typeof(field.length) == "undefined")
		{
			field.checked = false;
		}
		else
		{
			for (i = 0; i < field.length; i++)
				field[i].checked = false ;
		}
	}

	function confirmSubmit() 
		{
			var agree=confirm("Are you sure you would like to delete these jobs?");
			if (agree)
				return true;
			else
				return false;
		}	
	//-->
	
	<!--
	function validateJPPostJobs(theForm)
	{
	  if ((theForm.SystemID.value == "") || (theForm.JobTitle.value == "") || (theForm.JobDescription.value == "") || (theForm.Compensation.value == "") || (theForm.Notes.value == ""))
	  {
	    alert("Please complete all fields.");
		  return false;
	  }
		if ((theForm.Region.value == "0") || (theForm.JobTerm.value == "0"))
		{
		  alert("Please answer each question.");
			return false;
		}										
    if (theForm.Notes.value.length > 500) 
		{
      alert('Please limit notes to 500 characters or less. Please remove '+(theForm.Notes.value.length - 500)+ ' characters');
      return false;
		}
		
	selection = -1;
		  for (i=0; i<theForm.rbNewJob.length; i++) {
		  if (theForm.rbNewJob[i].checked) {
		  selection = i;
		  }
  			}
				if (selection == -1) {
				alert("Please select whether the job should be marked as \"New\".");
				  return false;
			}			
	}
	//-->
		
