function validateFields(b){var a=document.getElementById("comments");if($F("name")==""){alert("Please enter your name.");$("name").focus();b.stop();return false}else{if($F("email")==""){alert("Please enter your email address.");$("email").focus();b.stop();return false}else{if(!validateEmail($F("email"))){alert("Please enter your email address.");$("email").focus();b.stop();return false}else{if($F("subject")==""){alert("Please select a subject.");b.stop();return false}}}}if($F("_form_type")=="addmyco"){if($F("website")==""){alert("Please enter your site's address.");$("website").focus();b.stop();return false}else{sendPosEmail($F("_form_type"));b.stop();return true}}else{if($F("_form_type")=="contact"){var c=/^[\s]+$/;if(a.value==""||c.test(a.value)){alert("You're trying to send an empty email. Please type something in the comment section.");a.focus();b.stop();return false}else{if($F("type")=="employer"&&$F("company_name")==""){alert("Please provide a company name.");$("company_name").focus();b.stop();return false}else{sendPosEmail($F("_form_type"));b.stop();return true}}}}b.stop();return false}function prepareForm(a){switch(a){case"employer":$("employerSection").show();document.getElementById("type").value="employer";document.getElementById("contactForm").subject.options[5]=new Option("Posting a Job","postajob");document.getElementById("contactForm").subject.options[6]=new Option("Advertising With Us","advertise");document.getElementById("contactForm").subject.options[7]=new Option("Add Site","addsite");document.getElementById("contactForm").subject.options[8]=new Option("Remove Site","removefromindex");break;case"recruiter":$("employerSection").show();document.getElementById("type").value="contact";document.getElementById("contactForm").subject.options[5]=new Option("Recruitment Lead Search Engine","rse");document.getElementById("contactForm").subject.options[6]=new Option("Posting a Job","postajob");document.getElementById("contactForm").subject.options[7]=null;document.getElementById("contactForm").subject.options[8]=null;break;case"jobseeker":case"advertiser":case"journalist":$("employerSection").hide();document.getElementById("type").value="contact";document.getElementById("contactForm").subject.options[5]=null;document.getElementById("contactForm").subject.options[6]=null;document.getElementById("contactForm").subject.options[7]=null;document.getElementById("contactForm").subject.options[8]=null;break}}function sendPosEmail(a){var b="/includes/contact-xmlHttp.php?contact=true&xml=true";$("statustext").update("Sending Email...");$("statustext").show();new Ajax.Request(b,{parameters:$("contactForm").serialize(),onSuccess:function(d){var c=d.responseText.evalJSON();$("statustext").update("<strong>"+c.message+"</strong>");if(c.status=="OK"){$("formContainer").hide()}}})}Event.observe(window,"load",function(){$("contactForm").observe("submit",validateFields)});