//onsubmit="return checkWholeForm(contact);" - Place into form

function checkWholeForm(metalform) {
    var why = "";
    why += checkemail(metalform.email.value);
    why += isEmpty1(metalform.firstname.value);
    why += isEmpty2(metalform.lastname.value);    
    why += isEmpty4(metalform.company.value);
    why += isEmpty5(metalform.address.value);
    why += isEmpty6(metalform.city.value);
    why += regionDropdown(metalform.region.selectedIndex);
    why += countryDropdown(metalform.country.selectedIndex);
    why += stateDropdown(metalform.state.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Text Fields _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Firstname Check

function isEmpty1(strng) {
var error = "";
  if (strng.length == 0) {
     error = "You did not enter your first name.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Lastname Check

function isEmpty2(strng) {
var error = "";
  if (strng.length == 0) {
     error = "You did not enter your last name.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Title Check

function isEmpty3(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your title.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Company Check

function isEmpty4(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please provide your company name.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Address Check

function isEmpty5(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your address.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- City Check

function isEmpty6(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your city.\n"
  }
return error;     
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Email Check

function checkemail (strng) {
var error="";
if (strng == "") {
   error = "Please enter your email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "This is not a true email address.\n";
       }
    }
return error;    
}

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Select Fields _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Region Select

function regionDropdown(choice) {
    var error = "";
    if (choice == 0) {
       error = "Please select your region.\n";
    }    
return error;
}  

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Country Select

function countryDropdown(choice) {
    var error = "";
    if (choice == 0) {
       error = "Please select your country.\n";
    }    
return error;
} 

// _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- State Select


function stateDropdown(choice) {
    var error = "";
    if (choice == "") {
       error = "Please select your state.\n";
    }    
return error;
}


