function checkformfields(myform){commaSeparatedValueList="#name_label,#email_from_label,#phone_label,#staff_to_label,#postal_address_label,#name,#phone,#email_from,#postal_address,#staff_to";
clearErrors(commaSeparatedValueList);
errorExists=false;why="";
focusfield="";if(isWhitespace(myform.name.value)){$("#name_label,#name").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="name";
}}if(isWhitespace(myform.email_from.value)||!isEmail(myform.email_from.value)){$("#email_from_label,#phone").addClass("error");
errorExists=true;why+="\n and ensure you've entered a valid email address";
if(focusfield==""){focusfield="email_from";
}}if(isWhitespace(myform.phone.value)){$("#phone_label,#email_from").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="phone";
}}if(isWhitespace(myform.staff_to.value)){$("#staff_to_label,#staff_to").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="staff_to";
}}if(isWhitespace(myform.postal_address.value)){$("#postal_address_label,#postal_address").addClass("error");
errorExists=true;why+="";
if(focusfield==""){focusfield="postal_address";
}}if(errorExists==true){$("#appraisals_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])){appraisals_form_lock();
return true;}else{moveTop();
return false;}},success:function(response){if(response.retcode=="OK"){$("#appraisals_form_wrapper").html('<div class="alertSuccess"><div class="messageText">'+response.retmessage+'</div><div class="clear"></div></div>');
}else{$("#appraisals_form_message").html('<div class="alertFail"><div class="messageText">'+response.retmessage+'</div><div class="clear"></div></div>');
appraisals_form_unlock();
}moveTop();},error:function(XMLHttpRequest,textStatus,errorThrown){$("#appraisals_form_message").html('<div class="alertFail"><div class="messageText">An error occured, please try again ('+textStatus+')</div><div class="clear"></div></div>');
appraisals_form_unlock();
moveTop();}};$(document).ready(function(){$("#appraisals_form").ajaxForm(options);
appraisals_form_unlock();
});function appraisals_form_submit(){$("#appraisals_form").ajaxSubmit(options);
return false;}function appraisals_form_lock(){$("#appraisals_pre").html('<div id ="loader" class="preloader_dark_16"></div>');
$("#appraisals_pre").animate({opacity:"show"},{queue:"false",duration:100,easing:"linear"});
$("#appraisals_form #submit").unbind();
$("#appraisals_form #submit").unbind("mouseover").unbind("mouseout");
}function appraisals_form_unlock(){$("#appraisals_pre").animate({opacity:"hide"},{queue:"false",duration:0,easing:"linear"});
$("#appraisals_form #submit").bind("click",appraisals_form_submit);
$("#appraisals_form #submit").hoverClass2("submitBtnHover","submitBtnOut");
}