function validate_form() {
	if(document.frmEmail.msgFirstName.value==null||document.frmEmail.msgFirstName.value==""){
	 alert("Please Enter Your First Name.");
	 document.frmEmail.msgFirstName.focus();
	 return false;
	}
	if(document.frmEmail.msgLastName.value==null||document.frmEmail.msgLastName.value==""){
	 alert("Please Enter Your Last Name.");
	 document.frmEmail.msgLastName.focus();
	 return false;
	}
    if(document.frmEmail.msgEmail.value==null||document.frmEmail.msgEmail.value==""){
	 alert("Please Enter Your Email Address.");
	 document.frmEmail.msgEmail.focus();
	 return false;
	} else {
		var msgEmail = document.frmEmail.msgEmail.value;
		if (!(echeck(msgEmail))) {
			return false;
		}
    }

    if(document.frmEmail.msgphone.value==null||document.frmEmail.msgphone.value==""){
	 alert("Please Enter Your Phone Number.");
	 document.frmEmail.msgphone.focus();
	 return false;
	}
	if(document.frmEmail.msgBody.value==null||document.frmEmail.msgBody.value==""){
	 alert("Please Provide A Message With Your Inquiry.");
	 document.frmEmail.msgBody.focus();
	 return false;
	}	
document.frmEmail.action = "/forms/emailparser.php";
alert("Thank you for contacting Reiniger Jewelers!n\ We'll be in touch with you shortly.");
return true;
}


function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		 } 
         if (str.indexOf(dot,(lat+2))==-1){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		 } 
         if (str.indexOf(" ")!=-1){
		  alert("Invalid Email Address")
		  document.frmEmail.msgEmail.focus();
		  return false
		 } return true
	}
