function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);field.select();return false;}
else {return true}
}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (value==null||value=="")
   {return true;}
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);field.select();return false;}
else {return true;}
}
}

function validate_numeric(field,alerttxt)
{
with (field)
{

var str = value
var vallength = value.length

if (value==null||value=="")
   {return true;}
else
for (var i = 0; i < vallength; i++)
{
if (str.charAt(i) >= 0 && str.charAt(i) <= 9)	
   loop 
else
   {alert(alerttxt);field.select();return false;}
} 
}
}


function validate_form(thisform)
{
with (thisform)
{

if (validate_numeric(ContactNumber,"[Contact Number] Please make sure entries are numbers only !")==false)
  {ContactNumber.focus();return false;}

if (validate_numeric(EN1ContactNumber,"[Contact Number] Please make sure entries are numbers only !")==false)
  {EN1ContactNumber.focus();return false;}

if (validate_numeric(EN2ContactNumber,"[Contact Number] Please make sure entries are numbers only !")==false)
  {EN2ContactNumber.focus();return false;}

if (validate_numeric(EN3ContactNumber,"[Contact Number] Please make sure entries are numbers only !")==false)
  {EN3ContactNumber.focus();return false;}

}
}