function formvalidator(checkform){

var validchar = "abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+=-`{}|\][;':,./?><* ";
var Invalidchar = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+=-`{}|\][;':,./?><*";
var ValidEmail = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@-._";
var validnum = "0123456789";
var ValidNAME = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";


if (checkform["company"].value == ""){
	alert('Please enter your company name.');
	checkform["company"].focus();
	return false;
	}

if (checkform["address"].value == ""){
	alert('Please enter your address.');
	checkform["address"].focus();
	return false;
	}
	
if (checkform["city"].value == ""){
	alert('Please enter your city.');
	checkform["city"].focus();
	return false;
	}
	
if (checkform["state"].value == ""){
	alert('Please enter your state.');
	checkform["state"].focus();
	return false;
	}
	
if (checkform["zip"].value == ""){
	alert('Please enter your postal code.');
	checkform["zip"].focus();
	return false;
	}

if (checkform["first_nm"].value == ""){
	alert('Please enter your name.');
	checkform["first_nm"].focus();
	return false;
	}

if (checkform["last_nm"].value == ""){
	alert('Please enter your name.');
	checkform["last_nm"].focus();
	return false;
	}
	
if (checkform["tel"].value == ""){
	alert('Please enter your telephone number.');
	checkform["tel"].focus();
	return false;
	}

if (checkform.email.value == ""){
	alert('Please enter your email address.');
	checkform.email.focus();
	return false;
	}
	
if (checkform.email.value != ""){
if (!IsValidEmail(checkform.email.value)){
	alert('Please enter a valid email address.');
	checkform.email.focus();
	return false;
	}
}


return true;
}


function IsValidEmail(str){
  var filter=/^.+@.+\..{2,3}$/
  return (filter.test(str))
}


function applicationvalidator(checkform){

var validchar = "abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+=-`{}|\][;':,./?><* ";
var Invalidchar = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+=-`{}|\][;':,./?><*";
var ValidEmail = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@-._";
var validnum = "0123456789";
var ValidNAME = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";


if (checkform["name"].value == ""){
	alert('Please enter your name.');
	checkform["name"].focus();
	return false;
	}

if (checkform["nic"].value == ""){
	alert('Please enter your NRIC No.');
	checkform["nic"].focus();
	return false;
	}
	
if (checkform["tel"].value == ""){
	alert('Please enter your contact no.');
	checkform["tel"].focus();
	return false;
	}
	
if (checkform["address"].value == ""){
	alert('Please enter your address.');
	checkform["address"].focus();
	return false;
	}
	

if (checkform.email.value == ""){
	alert('Please enter your email address.');
	checkform.email.focus();
	return false;
	}
	
if (checkform.email.value != ""){
if (!IsValidEmail(checkform.email.value)){
	alert('Please enter a valid email address.');
	checkform.email.focus();
	return false;
	}
}


return true;
}
