// password - between 6-8 chars, uppercase, lowercase, and numeral

function checkPassword (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a password.\n";
}

    var illegalChars = /[\W_]/; // allow only letters and numbers
    
    if ((strng.length < 6) || (strng.length > 8)) {
       error = "The password is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The password contains illegal characters.\n";
    } 
    else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/)))) {
       error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.\n";
    }  
return error;    
}    

function botCheckInfo() {
	alert("To prevent automatic programs (bots) from submitting spam through this form, we have added a simple validation check to the form. You must enter these 4 digits in the box provided in order to submit the form.");
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an 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 = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkName (strng) {
var error="";
if (strng == "") {
   error = "Please enter your full name.\n";
}
return error;  
}

function checkUserName (strng) {
var error="";
if (strng == "") {
   error = "Please enter a user name.\n";
}
return error;  
}

function checkUserComments (strng) {
var error="";
if (strng == "") {
   error = "Please enter your project location and type of project in the enquiry box.\n";
}
return error;  
}

function checkContactComments (strng) {
var error="";
if (strng == "") {
   error = "Please enter your enquiry or comments in large box provided.\n";
}
return error;  
}

function checkUserEnquiry (strng) {
var error="";
if (strng == "") {
   error = "Please enter your requirements the enquiry box.\n";
}
return error;  
}

function checkQuantity (strng) {
  for (var i = 0; i < checkQuantity.length(strng); i++) {
    if (checkQuantity[i].value == "") {
      error = "Please enter a Quantity";
       allInputs[i].focus();
    }
	 return error;
  }
}

function checkProjectLocation (strng) {
var error="";
if (strng == "") {
   error = "Please enter the delivery location.\n";
}
return error;  
}
	
 function checkBusiness (strng) {
var error="";
if (strng == "") {
   error = "Please enter the name of your organisation.\n";
}
return error;  
}

 function checkAddress (strng) {
var error="";
if (strng == "") {
   error = "Please enter your street number and street name.\n";
}
return error;  
}
 
 function checkBusinessLocation (strng) {
var error="";
if (strng == "") {
   error = "Please enter your city or town name.\n";
}
return error; 
} 

 function checkCountry (strng) {
var error="";
if (strng == "") {
   error = "Because we export worldwide, please enter your country name.\n";
}
return error;
}
	 
 function checkTelephone (strng) {
var error="";
if (strng == "") {
   error = "In case we need to discuss particular requirements, please enter your telephone number.\n";
}
return error;  
}
