function validate() {
	var error='';
	var myForm = window.document.commentform;
	
	if (myForm.author.value == '') error = 'Please fill ( Name ) that is a required field. \n';
	//email
	if (emailverify(myForm.email.value) != 'success')  error +=  emailverify(myForm.email.value) + '\n';
	//comment
	if (myForm.comment.value == '') error += 'Please type a comment.';
	
	if (error) {
		alert (error);
		return false;
	} else {
		return true;
	}	
}

function emailverify(obj){
	var email = obj;
	var passed;
	var blnRetval, intAtSign, intDot, intComma, intSpace, intLastDot, intDomain, intStrLen;
	intAtSign=email.indexOf("@");
	intDot=email.indexOf(".",intAtSign);
	intComma=email.indexOf(",");
	intSpace=email.indexOf(" ");
	intLastDot=email.lastIndexOf(".");
	intDomain=intDot-intAtSign;
	intStrLen=email.length;
	// *** CHECK FOR BLANK EMAIL VALUE
	
	if (email == ""){
		passed = 'Please fill ( Email ) that is a required field.';
	}else if (intAtSign == -1){
		passed = "Your email address is missing the \"@\".";
	}else if (intComma != -1){
		passed = 'Email address cannot contain a comma.';
	}else if (intSpace != -1){
		passed = 'Email address cannot contain spaces.';
	}else if ((intDot <= 2) || (intDomain <= 1)  || (intStrLen-(intLastDot+1) < 2)){
		passed = 'Please enter a valid Email address.';
	}else{
		passed = 'success';
	}
	
	return passed;
}