function validate(){
	if(document.frmContact.name.value==""){
		document.getElementById("txtmsg").innerHTML="Please enter your full name.";
		document.getElementById('n1').style.borderColor='red';
		document.getElementById('n2').style.borderColor='';
		document.getElementById('n3').style.borderColor='';
		document.frmContact.name.focus();
		return false;
	}
	if (echeck(document.frmContact.email.value)==false){
		document.frmContact.email.value="";
		document.frmContact.email.focus();
		document.getElementById('n1').style.borderColor='';
		document.getElementById('n2').style.borderColor='red';
		document.getElementById('n3').style.borderColor='';
		return false
   	}
	if(document.frmContact.message.value==""){
		document.getElementById("txtmsg").innerHTML="Cannot submit with empty message.";
		document.getElementById('n3').style.borderColor='red';
		document.getElementById('n2').style.borderColor='';
		document.getElementById('n1').style.borderColor='';
		document.frmContact.message.focus();
		return false;
	}
}

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){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.indexOf(at,(lat+1))!=-1){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.indexOf(dot,(lat+2))==-1){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	
	if (str.indexOf(" ")!=-1){
		document.getElementById("txtmsg").innerHTML="Invalid E-mail ID.";
		return false
	}
	return true
}