// how to call:
// <form method="POST" action="demo.html" name="myForm" onSubmit="return validate()">
function chk_referal(){
	with(document.referal_Form){
		var emailPat = /^([a-zA-Z_0-9-.]+)@([a-zA-Z_0-9-.]+)\.([a-z]{2,4})$/;
		if(from_name.value==""){
			alert("Please provide the sender's name.");
			from_name.focus();
			return false;
		}
		if(!from_mail.value.match(emailPat)){
			alert("Please complete the sender's email address.");
			from_mail.focus();
			return false;
		}
		if(to_name.value==""){
			alert("Please provide the recipient's name.");
			to_name.focus();
			return false;
		}
		if(!to_mail.value.match(emailPat)){
			alert("Please complete the recipient's email address.");
			to_mail.focus();
			return false;
		}
		return true;
	}// end with
}
//-->