
/*validates the contactus.asp page*/
function validateContactUs(theForm)<!--
	{
	  if (theForm.topic.value == "")
		{
		  alert("Please select a topic.");
		  theForm.topic.focus();
			return false;
		}
	  if (theForm.location.value == "")
		{
		  alert("Please select a location to send your information.");
		  theForm.location.focus();
			return false;
		}

	  if (theForm.yourname.value == "")
		{
		  alert("Please enter your name.");
		  theForm.yourname.focus();
			return false;
		}

	  if (theForm.Email.value == "")
		{
		  alert("Please enter your email address.");
		  theForm.Email.focus();
			return false;
		}

	  if (!chkForEmail(theForm.Email.value))
		{
		  alert("Please enter a valid email address.");
		  theForm.Email.focus();
			return false;
		}
	  
      if (theForm.content.value.length > 500) 
		{
      alert('Please limit job description to 500 characters or less. Please remove '+(theForm.content.value.length - 1000)+ ' characters.');
      return false;
		}							
	}
	//-->
	
	/*validates the contactus.asp page*/
function validateApplyForm(theForm)<!--
	{
	  if (theForm.Region.value == "")
		{
		  alert("Please select a region.");
		  theForm.Region.focus();
			return false;
		}
	  if (theForm.FirstName.value == "")
		{
		  alert("Please enter your first name.");
		  theForm.FirstName.focus();
			return false;
		}
	  if (theForm.LastName.value == "")
		{
		  alert("Please enter your last name.");
		  theForm.LastName.focus();
			return false;
		}
	  if (theForm.Address.value == "")
		{
		  alert("Please enter your address.");
		  theForm.Address.focus();
			return false;
		}
	  if ((PreQual.Phone1.value == "") || (PreQual.Phone2.value == "") || (PreQual.Phone3.value == ""))
	    {
		  alert("Please enter your phone number.");
		    return false;
		}
	  if (theForm.Email.value == "")
		{
		  alert("Please enter your email address.");
		  theForm.Email.focus();
			return false;
		}
		
		if (!chkForEmail(theForm.Email.value))
		{
		  alert("Please enter a valid email address.");
		  theForm.Email.focus();
			return false;
		}

		if (theForm.Salary.value == ""){
			alert("Please enter salary requirements.");
			return false;
		} 

      if (theForm.IfYes.value.length > 500){
		  alert('Please limit employment length to 500 characters or less. Please remove '+(theForm.IfYes.value.length - 500)+ ' characters.');
		  return false;
		}

	  if (theForm.Positions.value.length > 500) 
		{
      alert('Please limit positions to 500 characters or less. Please remove '+(theForm.Positions.value.length - 500)+ ' characters.');
      return false;
		}
	  if (theForm.Explain.value.length > 1000) 
		{
      alert('Please limit work experience to 1000 characters or less. Please remove '+(theForm.Explain.value.length - 1000)+ ' characters.');
      return false;
		}
	}
	//-->
var DontShowAlertDialogBox = 0;
//confirm delete for the forms page (forms.asp)
function confirmDeleteForms(msg) 
	{
		var agree=confirm(msg);
		if (agree)
		  {
		  deleteIT = 1;
			return true;
			}
		else
			return false;
	}
			
/********** Validates forms.asp  *************/
function validateFormInput(theForm)
{
	if (theForm.tbLinkName.value == "")
  	{
	 	alert("Please enter a link name.");
	 	theForm.tbLinkName.style.backgroundColor = '#FFFFCC';
	 	theForm.tbLinkName.focus();
		return false;
	}
	else
	{
	    theForm.tbLinkName.style.backgroundColor = '#F0F0F0';
	}
	
	if (theForm.tbOrderNumber.value == "")
  	{
	 	alert("Please enter a order number.");
	 	theForm.tbOrderNumber.style.backgroundColor = '#FFFFCC';
	 	theForm.tbOrderNumber.focus();
		return false;
	}
	else
	{
	    theForm.tbOrderNumber.style.backgroundColor = '#F0F0F0';
	}
	
  if(DontShowAlertDialogBox != 1)
	{	
		if (!chkUploadExt(theForm.image.value))
			{  	
		 	alert("Please upload only doc, pdf, rtf or txt files");
		 	theForm.image.style.backgroundColor = '#FFFFCC';
		 	theForm.image.focus();	 	 		 	
			return false;
		}
		else
		{
		    
		    theForm.image.style.backgroundColor = '#F0F0F0';	    
		}
	}	
	
	selection = -1;
	for (i=0; i<theForm.rbActive.length; i++)
	{
	    if (theForm.rbActive[i].checked)
	    {
	        selection = i;
  	    }
	}
	if (selection == -1)
	{
		alert('Please select if you want the form displayed or not.')
		return false;
	}
}
		
	//-->
	
/********** Validates clientForms.asp  *************/
function validateLogin()
{
	if (document.FormLogin.tbUserName.value == "")
  	{
	 	alert("Please enter your user name.");
		document.FormLogin.tbUserName.style.backgroundColor = '#FFFFCC';
		document.FormLogin.tbUserName.focus();
		return false;
	}
	else
	{
		document.FormLogin.tbUserName.style.backgroundColor = '#F0F0F0';
	}
	
	if (document.FormLogin.tbPWD.value == "")
  	{
	 	alert("Please enter your password.");
		document.FormLogin.tbPWD.style.backgroundColor = '#FFFFCC';
		document.FormLogin.tbPWD.focus();
		return false;
	}
	else
	{
		document.FormLogin.tbPWD.style.backgroundColor = '#F0F0F0';
	}	
}

function chkUploadExt(filename) 
{
var extension = new Array();
extension[0] = ".doc";
extension[1] = ".pdf";
extension[2] = ".rtf";
extension[3] = ".txt";
var thisext = filename.substr(filename.lastIndexOf('.'));
	for(var i = 0; i < extension.length; i++) 
	{
		if(thisext == extension[i]) 
		{ 
		return true; 
		}
	}
return false;
}
	
	//-->
	
	