﻿function checkWholeForm(contactreply) {
    var why = "";
    why += isEmpty1(contactreply.name.value);
    why += isEmpty2(contactreply.company.value);    
    why += isEmpty3(contactreply.state.value);
    why += isEmpty4(contactreply.zip.value);
    why += isEmpty5(contactreply.country.value);
    why += isEmpty6(contactreply.address1.value);
    why += isEmpty7(contactreply.phone.value);
    why += isEmpty8(contactreply.city.value);
    why += checkEmail(contactreply.email.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

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

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

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

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

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

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

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

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

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Please enter a Email Address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid Email Address.\n";
    }
    else {

       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "This is not a true Email Address.\n";
       }
    }
return error;    
}
