

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 




function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 




function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(textfield,"Full name is required !")==false) {textfield.focus(); return false;}
if (emailvalidation(textfield2,"Please provide with your valid Email Address !")==false) {textfield2.focus(); return false;}
if (emptyvalidation(textfield3,"Contact number is required !")==false) {textfield3.focus(); return false;}
if (emptyvalidation(textfield4,"Your Message !")==false) {textfield4.focus(); return false;}



//if (emailvalidation(email,"Error ! Please provide with your valid Email Address !")==false) {email.focus(); return false;}


else
{
	document.thisform.mail_sent();
}

}
} 




