
function validate_email(email){
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}
function verify(frmVal,result_id) {

this.result_id = result_id;	
var themessage = "You are required to complete the following fields: ";
var msgFlds = ""
	if (document.contact_us.name1.value=="") {
		msgFlds = msgFlds + " - Name";
	}	
	if (document.contact_us.email.value=="") {
		msgFlds = msgFlds + " - E-Mail";
	}else{	
		if(!validate_email(document.contact_us.email.value)){
			msgFlds = msgFlds + " - Please enter a valid e-mail";		
		}else{
			msgFlds = msgFlds + "";
		}
	}	

 r = document.getElementById( this.result_id);
 var g=eval(frmVal);
	 if (msgFlds!==""){
      	r.innerHTML = "<SPAN STYLE=\color:blue\>" + themessage + msgFlds + "</span>"; 
		return false;
   	}else{
		r.innerHTML = "";		 
   		g.method="get";
		g.action="send_mail.asp";
		g.submit();

		 return true;
		// window.location = "send_mail.asp"
	}

}


