function setFocus()
{
document.forms[0].elements[5].click();
document.forms[0].elements[0].focus();

}

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 emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 

function checkinteger(entered,alertbox)
{
with (entered)
{
checkvalue=parseInt(value);

if (value!=checkvalue)
{
if (alertbox) {alert(alertbox);} return false;}
else {return true;}


}
}


function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(first,"Name cannot be empty")==false) {first.focus(); return false;};
if (emptyvalidation(Country,"Country cannot be empty")==false) {Country.focus(); return false;};
if (checkinteger(cell,"Enter a valid mobile number")==false) {cell.focus(); return false;};
if (emailvalidation(Email,"E-mail required")==false) {Email.focus(); return false;};
if (emptyvalidation(message,"message cannot be empty")==false) {message.focus(); return false;};

}
}
