function checkformfields(myform){commaSeparatedValueList="#email_to_label,#full_name_label,#email_from_label,#subject_label,#message_label,#email_to,#full_name,#email_from,#subject,#message";
clearErrors(commaSeparatedValueList);
errorExists=false;why="";
focusfield="";if(isWhitespace(myform.email_to.value)){$("#email_to_label,#email_to").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="email_to";
}}if(isWhitespace(myform.full_name.value)){$("#full_name_label,#full_name").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="full_name";
}}if(isWhitespace(myform.email_from.value)||!isEmail(myform.email_from.value)){$("#email_from_label,#email_from").addClass("error");
errorExists=true;why+="\n and ensure your email address is valid";
if(focusfield==""){focusfield="email_from";
}}if(isWhitespace(myform.subject.value)){$("#subject_label,#subject").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="subject";
}}if(isWhitespace(myform.message.value)){$("#message_label,#message").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="message";
}}if(errorExists==true){$("#contact_us_form_message").html('<div class="alertNotice"><div class="messageText">Please fill in the compulsory fields'+why+'.</div><div class="clear"></div></div>');
if(focusfield!=""){focusfield="myform."+focusfield+".focus();";
eval(focusfield);}return false;
}else{return true;}}var options={dataType:"json",async:true,cache:false,url:"site/master.cfm?fuseaction=site-ajax.processEmail",type:"POST",beforeSubmit:function(formArray,qForm){if(checkformfields(qForm[0])){contact_form_lock();
return true;}else{moveTop();
return false;}},success:function(response){if(response.retcode=="OK"){$("#contact_us_form_wrapper").html('<div class="alertSuccess"><div class="messageText">'+response.retmessage+'</div><div class="clear"></div></div>');
pageTracker._trackPageview("/contact-us-success");
}else{$("#contact_us_form_message").html('<div class="alertFail"><div class="messageText">'+response.retmessage+'</div><div class="clear"></div></div>');
contact_form_unlock();
}moveTop();},error:function(XMLHttpRequest,textStatus,errorThrown){$("#contact_us_form_message").html('<div class="alertFail"><div class="messageText">An error occured, please try again ('+textStatus+')</div><div class="clear"></div></div>');
contact_form_unlock();
moveTop();}};$(document).ready(function(){$("#contact_us_form").ajaxForm(options);
contact_form_unlock();
});function contact_form_submit(){$("#contact_us_form").ajaxSubmit(options);
return false;}function contact_form_lock(){$("#contact_us_pre").html('<div id ="loader" class="preloader_dark_16"></div>');
$("#contact_us_pre").animate({opacity:"show"},{queue:"false",duration:100,easing:"linear"});
$("#contact_us_form #submit").unbind();
$("#contact_us_form #submit").unbind("mouseover").unbind("mouseout");
}function contact_form_unlock(){$("#contact_us_pre").animate({opacity:"hide"},{queue:"false",duration:0,easing:"linear"});
$("#contact_us_form #submit").bind("click",contact_form_submit);
$("#contact_us_form #submit").hoverClass2("submitBtnHover","submitBtnOut");
}