function validate_required(field,alerttxt)
  {
  with (field)
  {
   if (value==null||value=="")
     {alert(alerttxt);return false;}
   else {return true}
   }
 }

function validate_required2(field,alerttxt)
  {
  with (field)
  {
   if (value=="ST65")
     {return true}
   else {alert(alerttxt);return false;}
   }
 }

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
} 

function drop_hotmail(field,alerttxt)
{
var temp = new Array();

with (field)
{
temp = value.split('@');
temp[1]=temp[1].toUpperCase(); 

if (temp[1] == "HOTMAIL.COM") 
  {alert(alerttxt);return false;}
else {return true;}
}
} 


function drop_code(field,alerttxt)
{
var temp = new Array();
var loc1;

with (field)
 {
 temp = field.value.toUpperCase();
 loc1 = temp.indexOf("HTTP:");

 if (loc1 > -1) 
  {alert(alerttxt);return false;}
 else {return true;}
 }
} 



function validate_form(thisform)
{
with (thisform)
 {
if (validate_email(ContactEmail,"Please enter a valid Email address.")==false)
  {ContactEmail.focus();return false;}
if (validate_required(ContactName,"Contact Name must be completed")==false)
  {ContactName.focus();return false;}
if (validate_required(ContactPhone,"Phone number cannot be blank")==false)
  {ContactPhone.focus();return false;}
if (validate_required2(AntiSpamChk,"AntiSpam code is wrong. Please try again: Check Caps.")==false)
  {AntiSpamChk.focus();return false;}
if (drop_hotmail(ContactEmail,"Sorry for security reasons we do not accept email from Hotmail accounts. Please use another email account - Alternatively please call us on Dublin +353 1 8365614")==false) 
{ContactEmail.focus();return false;}
if (drop_code(Details,"Sorry for security reasons please remove all http: references")==false) 
{Details.focus();return false;}
 }
}

