function validateComments(frm) {
	var allowSubmit=true;
	if(frm.captcha){
		if (frm.captcha.value=='0') {
			allowSubmit = false;
			
			document.getElementById("captchaAlertLabel").style.display="block";
		}
		else {
			document.getElementById("captchaAlertLabel").style.display="none";
		}
	}
	else {
		allowSubmit = false;
		document.getElementById("captchaAlertLabel").style.display="block";
	}
	if (frm.author) {
		if (frm.author.value.length<2) {
			document.getElementById("formNameLabel").style.color="#FF0000";
			allowSubmit= false;
		}
		else {
			document.getElementById("formNameLabel").style.color="#000000";
		}
	}
		
	if (frm.email) {
		if (frm.email.value.length<2 || !echeck(frm.email.value)) {
			document.getElementById("formEmailLabel").style.color="#FF0000";
			allowSubmit= false;
		}
		else {
			document.getElementById("formEmailLabel").style.color="#000000";
		}
	}
	
	if (frm.comment.value.length<2) {
		document.getElementById("formCommentLabel").style.color="#FF0000";
		allowSubmit= false;
	}
	else {
		document.getElementById("formCommentLabel").style.color="#000000";
	}
	
	if (!allowSubmit) {
		document.getElementById("formAlertLabel").style.display="";
	}
	
	return allowSubmit;
}

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){
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false;
	 }

	 if (str.substring(str.indexOf(dot,(lat+2)), str.length).length<3) {
		return false;
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false;
	 }

	 return true;				
}