﻿function IsValidEmail(NForm){
        NForm.email.focus();
        var str = NForm.email.value; 
        var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid 
        var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/; // valid 
        if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid 
                return true; 
        }else{ 
                return false; 
        } 
}

function validate_contactus(nform){
	if(!nform.fname.value){
		alert("Please enter your First Name");
		nform.fname.focus();
		return false; 
	}
	if(!nform.lname.value){
		alert("Please enter your Last Name");
		nform.lname.focus();
		return false; 
	}
	if(!nform.company.value){
		alert("Please enter your Company");
		nform.company.focus();
		return false; 
	}
	if(!nform.tel.value){
		alert("Please enter your Telephone Number");
		nform.tel.focus();
		return false; 
	}
	if(!IsValidEmail(nform)){
		alert("Please enter a valid Email");
		nform.email.focus();
		return false;
	}
	return true; 
}