$(document).ready(function(){$("#"+prefix+"form input").each(function(){if($(this).attr('type')=='text'&&$(this).attr('name')!=prefix+'captcha'){$(this).prev().prev().hide();$(this).val($(this).attr('title'));}});$("#"+prefix+"form select").each(function(){$(this).find("option").removeAttr("selected");$(this).prev().prev().hide();});if(centre!=''){$("#"+prefix+"centreOfInterest option[value="+centre+"]").attr("selected","selected");}
$(".clickClear").focus(function(){if($(this).val()==$(this).attr("title")){$(this).val('');}});$(".clickClear").blur(function(){if($(this).val()==''){$(this).val($(this).attr("title"));}});$("."+prefix+"captcha").remove();$("#"+prefix+"centreOfInterest,#"+prefix+"productOfInterest,#"+prefix+"requestACallback").find("option").removeAttr("selected");$("#"+prefix+"centreOfInterest").prepend($("<option>Centre of Interest..</option>").attr("class","label").attr("value","Centre of Interest.."));$("#"+prefix+"productOfInterest").prepend($("<option>Product of Interest..</option>").attr("class","label").attr("value","Product of Interest.."));$("#"+prefix+"requestACallback").prepend($("<option>Request a Callback?</option>").attr("class","label").attr("value","Request a Callback?"));$("#"+prefix+"centreOfInterest .label,#"+prefix+"productOfInterest .label,#"+prefix+"requestACallback .label").attr("selected","selected");$("#"+prefix+"centreOfInterest,#"+prefix+"productOfInterest,#"+prefix+"requestACallback").change(function(objEvent){$(this).find(".label").remove();});});function validateGetInTouchForm(){var errors=false;$("#"+prefix+"form input").each(function(){if($(this).attr('type')=='text'&&$(this).attr('name')!=prefix+'captcha'&&$(this).attr('name')!=prefix+'telephone'&&$(this).attr('name')!=prefix+'company'&&$(this).attr('name')!=prefix+'email'){if($(this).val()==''||$(this).val()==$(this).attr('title')){$(this).prev().html('Please enter a valid '+$(this).attr('name').replace(prefix,''));errors=true;}
else{$(this).prev().html('');}}});if($("#"+prefix+"requestACallback").val()!='no'&&$("#"+prefix+"requestACallback").val()!='Request a Callback?'){if(!validate_phone($('#'+prefix+'telephone').val())){$('#'+prefix+'telephone').prev().html('Please enter a valid telephone');errors=true;}else{$('#'+prefix+'telephone').prev().html('');}}else{$('#'+prefix+'telephone').prev().html('');}
if($("#"+prefix+"requestACallback").val()=='no'||$("#"+prefix+"requestACallback").val()=='Request a Callback?'){if(!isValidEmail($("#"+prefix+"email").val())){$("#"+prefix+"email").prev().html('Please enter a valid email address').css('display','block');errors=true;}else{$("#"+prefix+"email").prev().html('');}}else{$("#"+prefix+"email").prev().html('');}
if(errors){return false;}
else{pageTracker._trackPageview('/form-submission');otherTracker._trackPageview('/form-submission');return true;}}
function isValidEmail(str){return/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(str);}
function isInteger(s){var i;for(i=0;i<s.length;i++){var c=s.charAt(i);if(((c<"0")||(c>"9")))return false;}
return true;}
function trim(s){var i;var returnString="";for(i=0;i<s.length;i++){var c=s.charAt(i);if(c!=" ")returnString+=c;}
return returnString;}
function stripCharsInBag(s,bag){var i;var returnString="";for(i=0;i<s.length;i++){var c=s.charAt(i);if(bag.indexOf(c)==-1)returnString+=c;}
return returnString;}
var phoneNumberDelimiters="()- ";var validWorldPhoneChars=phoneNumberDelimiters+"+";var minDigitsInIPhoneNumber=7;function validate_phone(strPhone){var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1)return false
if(strPhone.indexOf("-")!=-1){bracket=bracket+1;}
if(strPhone.indexOf("(")!=-1&&strPhone.indexOf("(")>bracket){return false;}
var brchr=strPhone.indexOf("(");if(strPhone.indexOf("(")!=-1&&strPhone.charAt(brchr+2)!=")"){return false;}
if(strPhone.indexOf("(")==-1&&strPhone.indexOf(")")!=-1){return false;}
s=stripCharsInBag(strPhone,validWorldPhoneChars);return(isInteger(s)&&s.length>=minDigitsInIPhoneNumber);}
