function validateForm() {

    if(document.dataCapture.firstName.value == "") {
    document.dataCapture.firstName.focus();
    window.alert ("Please enter a First Name.");
    return false; }
    if(document.dataCapture.lastName.value == "" ) {
    document.dataCapture.lastName.focus();
     window.alert ("Please enter a Last Name.");
     return false; }
    if(document.dataCapture.email.value == ""  ) {
    document.dataCapture.email.focus();
     window.alert ("Please enter an Email Address.");
     return false; }
    if((document.dataCapture.email.value.indexOf("@") < 0) || (document.dataCapture.email.value.indexOf(".") < 0) ) {
      document.dataCapture.email.focus();
      window.alert ("Please enter an valid Email Address.");
     return false; } 
         if(document.dataCapture.companyName.value == "" ) {
         document.dataCapture.companyName.focus();
          window.alert ("Please enter a Business Name.");
          return false; }
         if(document.dataCapture.address1.value == "" ) {
         document.dataCapture.address1.focus();
          window.alert ("Please enter a Business Address 1 value.");
          return false; }
         if(document.dataCapture.city.value == "" ) {
         document.dataCapture.city.focus();
          window.alert ("Please enter a City.");
          return false; }
         if(document.dataCapture.state.value == "" ) {
          document.dataCapture.state.focus();
          window.alert ("Please select a State.");
          return false; }
         if(document.dataCapture.zip.value == "" ) {
         document.dataCapture.zip.focus();
          window.alert ("Please enter a Zip Code.");
          return false; } else {
            if(!(/^\d{5}$/.test(document.dataCapture.zip.value))) {
               document.dataCapture.zip.focus();
              window.alert ("Please enter a valid 5-digit Zip Code.");
              return false;
           }
         }
         if(document.dataCapture.telephoneArea.value == "" ) {
         document.dataCapture.telephoneArea.focus();
          window.alert ("Please enter an Area Code.");
          return false; }
         if(!IsNumeric(document.dataCapture.telephoneArea.value)) {
         document.dataCapture.telephoneArea.focus();
          window.alert ("Please enter a valid Area Code.");
          return false; }     
         if(document.dataCapture.telephonePrefix.value == "" ) {
         document.dataCapture.telephonePrefix.focus();
          window.alert ("Please enter a Business Phone Number.");
          return false; }     
         if(!IsNumeric(document.dataCapture.telephonePrefix.value)) {
         document.dataCapture.telephonePrefix.focus();
          window.alert ("Please enter a valid Business Phone Number.");
          return false; }     
         if(document.dataCapture.telephoneNumber.value == "" ) {
         document.dataCapture.telephoneNumber.focus();
          window.alert ("Please enter a Business Phone Number.");
          return false; }
         if(!IsNumeric(document.dataCapture.telephoneNumber.value)) {
         document.dataCapture.telephoneNumber.focus();
          window.alert ("Please enter a valid Business Phone Number.");
          return false; }  
             if(document.dataCapture.productModels.value == "" ) {
         document.dataCapture.productModels.focus();
          window.alert ("Please select a Product Model.");
          return false; }
     
     return true;
   }

   
var phone_field_length=0;
function TabNext(obj,event,len,next_field) {
	if (event == "down") {
		phone_field_length=obj.value.length;
		}
	else if (event == "up") {
		if (obj.value.length != phone_field_length) {
			phone_field_length=obj.value.length;
			if (phone_field_length == len) {
				next_field.focus();
				}
			}
		}
	}
	
	function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function setFocus() {
  document.dataCapture.firstName.focus();
}

function getCookie(NameOfCookie)
{

     if (document.cookie.length > 0) 
     { 

          begin = document.cookie.indexOf(NameOfCookie+"="); 
          if (begin != -1) // Note: != means "is not equal to"
          { 

                begin += NameOfCookie.length+1; 
                end = document.cookie.indexOf(";", begin);
                if (end == -1) end = document.cookie.length;
                return unescape(document.cookie.substring(begin, end)); } 
          }
          return null; 

}