$(document).ready(function(){$("#refresh").click(function(){refreshCaptcha()});$.preloadImages("ajax-loader.gif")});function refreshCaptcha(){var A="#captcha";$.getJSON("/response",{request:"captcha"},function(B){$(A).attr("src",B["captcha"])})}function resetMe(A){var A="#"+A;$(A).css("background","white")}function checkVal(A,C){var C="#"+C;var B=$.trim($(C).val());switch(A){case"empty":(B!="")?goodField(C):badField(C);break;case"email":/^[\w-+\.]+@([\w-]+\.)+[\w-]{2,}$/i.test(B)?goodField(C):badField(C);break;case"spam":((B.length>=5)&&(B.length<=8))?goodField(C):badField(C);break;default:}}function goodField(A){$(A).css("background","#ABFFB8")}function badField(B){var A=100;$(B).css("background","#FFC3C3");$("#ready").val("false")}function checkForm(){$("#ready").val("true");checkVal("empty","eName");checkVal("email","eEmail");checkVal("empty","eCaptcha");checkVal("empty","eMess");if($("#ready").val()=="true"){sendForm()}}function sendForm(){vals=new Array($("#eName").val(),$("#eEmail").val(),$("#eCaptcha").val(),$("#eMess").val(),$("#eSubject").val(),$("#captchaCheck").val());$("#contact-response").hide();$("#emailForm").fadeOut(1300,function(){$("#loader").wait(0.3).then.show()});$.post("http://tivate.com/wp-content/themes/tivate/lib/sendForm.php",{name:vals[0],email:vals[1],captcha:vals[2],message:vals[3],subject:vals[4],captchaCheck:vals[5]},function(A){showResponse(A)})}function showResponse(B){var A=Math.round((5*Math.random())+2);if(/successfully/.test(B)){$("#contact-response").css("background-color","#ABFFB8")}$("#loader").wait(A).then.fadeOut(1000,function(){if(!(/successfully/.test(B))){$("#emailForm").fadeIn(1000)}$("#contact-response").html(B).fadeIn(1000);if(/captcha/.test(B)){badField("#eCaptcha")}})}
