jQuery(document).ready(function($){$('form#contact-form').submit(function(){$('form#contact-form .error').remove();var hasError=false;$('.requiredField').each(function(){if(jQuery.trim($(this).val())==''){var labelText=$(this).prev('label').text();$(this).parent().append('<span class="error">Required</span>');$(this).addClass('inputError');hasError=true;}else if($(this).hasClass('email')){var emailReg=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;if(!emailReg.test(jQuery.trim($(this).val()))){var labelText=$(this).prev('label').text();$(this).parent().append('<span class="error">Invalid</span>');$(this).addClass('inputError');hasError=true;}}});if(!hasError){$('form#contact-form input.submit').fadeOut('normal',function(){$(this).parent().append('');});var formInput=$(this).serialize();$.post($(this).attr('action'),formInput,function(data){$('form#contact-form').slideUp("fast",function(){$(this).before('<div class="success overline"><h2>Thanks!</h2></div><p>Your email was successfully sent. We will contact you as soon as possible.</p>');});});}
return false;});});jQuery(document).ready(function($){$('form#comment-form').submit(function(){$('form#comment-form .error').remove();var hasError=false;$('.requiredField').each(function(){if(jQuery.trim($(this).val())==''){var labelText=$(this).prev('label').text();$(this).parent().append('<span class="error">Required</span>');$(this).addClass('inputError');hasError=true;}else if($(this).hasClass('email')){var emailReg=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;if(!emailReg.test(jQuery.trim($(this).val()))){var labelText=$(this).prev('label').text();$(this).parent().append('<span class="error">Invalid</span>');$(this).addClass('inputError');hasError=true;}}});if(!hasError){$('form#comment-form input.submit').fadeOut('normal',function(){$(this).parent().append('');});var formInput=$(this).serialize();$.post($(this).attr('action'),formInput,function(data){$('form#comment-form').slideUp("fast",function(){$(this).before('<div class="success overline"><h2>Thanks!</h2></div><p>Your comment was successfully sent.</p>');});});}
return false;});});
