function validateContact(){
/* this comes out of uk_contact.tpl.php */
var myformValidator = new Validator("myform");
myformValidator.addValidation("contactfname","req","Please enter the your first name (or names).");
myformValidator.addValidation("contactname","req","Please enter the your surname.");
myformValidator.addValidation("address1","req","Please enter your home address.");
myformValidator.addValidation("town","req","Please enter your town.");
myformValidator.addValidation("county","req","Please enter county.");
myformValidator.addValidation("postcode","req","Please enter your postcode.");
myformValidator.addValidation("email","req","Please enter your email adress");
myformValidator.addValidation("email","email","Please enter a correct email adress");
myformValidator.addValidation("email2","eqelmnt=email","Please check your email address and confirmation");
myformValidator.addValidation("tel","req","Please supply a daytime telephone number.");
myformValidator.setAddnlValidationFunction("otherContactValidation");
}

/* this comes out of uk_contact.tpl.php */
function otherContactValidation()
{
  var frm = document.forms["myform"];
  if(frm.howheard.value == "other")
  {
    if(frm.other.value =="If Other, please specify")
    {
    alert('Please let us know how you heard about us');
    return false;
    }
    else
    {
    return true
    }
  }
  else
  {
    return true;
  }
}

function addEventSimple(obj,evt,fn) {
	if (obj.addEventListener)
    obj.addEventListener(evt,fn,false);
	else if (obj.attachEvent)
	obj.attachEvent('on'+evt,fn);
}

addEventSimple(window,"load",validateContact);
