jQuery(document).ready(function(){jQuery('#form-content .left, #form-content input, #form-content textarea, #form-content select').focus(function(){jQuery(this).parents('.row').addClass('over');}).blur(function(){jQuery(this).parents('.row').removeClass('over');});var ContactUs=window.ContactUs=new Object;ContactUs.initialize=function(){jQuery('input#name').bind('blur',ContactUs.verify.name);jQuery('input#email').bind('blur',ContactUs.verify.email);jQuery('textarea#comments').bind('blur',ContactUs.verify.comments);jQuery('input#formsubmitbutton').bind('click',ContactUs.submit);};ContactUs.submit=function(){if(ContactUs.verify())
ContactUs.sendAjax();return false;};ContactUs.verify=function(){var verifies=ContactUs.verify.name();verifies=ContactUs.verify.email()&&verifies;verifies=ContactUs.verify.comments()&&verifies;return verifies;};ContactUs.verify.name=function(){var failed=jQuery.trim(jQuery('input#name').val()).length==0;jQuery('label[for="name"]').css('color',(failed?'red':''));return!failed;};ContactUs.verify.email=function(){var failed=!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(jQuery('input#email').val());jQuery('label[for="email"]').css('color',(failed?'red':''));return!failed;};ContactUs.verify.comments=function(){var failed=jQuery.trim(jQuery('textarea#comments').val()).length==0;jQuery('label[for="comments"]').css('color',(failed?'red':''));return!failed;};ContactUs.sendAjax=function(){jQuery.post('/ajax/contact/',{name:jQuery('input#name').val(),email:jQuery('input#email').val(),phone:jQuery('input#phone').val(),contactby:jQuery('input[id="contactby"]:checked').val()||'',besttime:jQuery('input#besttime').val(),comments:jQuery('textarea#comments').val()},ContactUs.sendAjax.callback,'json');};ContactUs.sendAjax.callback=function(json){if(!json)
alert('There was an issue while processing your request.\n\nPlease try again later.');else if(json.success)
ContactUs.sendAjax.success();else if(json.fields){if(json.fields.name)
jQuery('label[for="name"]').css('color','red');if(json.fields.email)
jQuery('label[for="email"]').css('color','red');if(json.fields.comments)
jQuery('label[for="comments"]').css('color','red');}else
alert('There was an issue while processing your request.\n\nPlease try again later.');};ContactUs.sendAjax.success=function(){jQuery('div#contact-container').css('height',jQuery('div#contact-container').height()+'px');jQuery('div.general-content, div#form-content').fadeOut('slow',function(){jQuery('div.thank-you-content').fadeIn('slow');});};ContactUs.initialize();});