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_required(FullName,"[Full Name] must be filled out !")==false)
  {FullName.focus();return false;}

if (validate_required(Country,"[Country] must be filled out !")==false)
  {Country.focus();return false;}

if (validate_required(ContactNumber,"[Contact Number] must be filled out !")==false)
  {ContactNumber.focus();return false;}

if (validate_numeric(ContactNumber,"[Contact Number] Please make sure entries are numbers only !")==false)
  {ContactNumber.focus();return false;}

if (validate_email(EmailAddress,"[Email Address] not a valid e-mail address !")==false)
  {EmailAddress.focus();return false;}

if (validate_required(Comment,"[Comments] must be filled out !")==false)
  {Comment.focus();return false;}


}
}