1-888-429-1002
(function ($)
{
$(document).ready(function()
{
$('#1contactform input').focus(function()
{
$(this).removeClass('fielderror');
});
$('#1contactform textarea').focus(function() {
$(this).removeClass('fielderror');
});
$("#1contactform #1submit").click(function(){
var subjectVal = $("#1subject").val(),
messageVal = $("#1message").val(),
nameVal = $("#1name").val(),
hasError = false,
email_regex = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/,
emailToVal = $("#1emailTo").val(),
emailFromVal = $("#1emailFrom").val().toLowerCase();
$("#1contactform_wrap .error").slideUp();
emailToVal=emailToVal.replace('#','@');
if(emailToVal == '')
{
$("#1emailTo").addClass('fielderror');
hasError = true;
}
else if( !email_regex.test(emailToVal) )
{
$("#1emailTo").addClass('fielderror');
hasError = true;
}
if(emailFromVal == '')
{
$("#1emailFrom").addClass('fielderror');
hasError = true;
}
else if( !email_regex.test(emailFromVal) )
{
$("#1emailFrom").addClass('fielderror');
hasError = true;
}
if(messageVal == '')
{
$("#1message").addClass('fielderror');
hasError = true;
}
if(nameVal == '')
{
$("#1name").addClass('fielderror');
hasError = true;
}
if(hasError == false)
{
$.post('http://pghwebfx.com/wp-content/themes/Tersus/lib/inc/contact-send.php',$("#1contactform").serialize(),function(data)
{
$("#1contactform_wrap .error").slideUp();
$('#1contactform .field').val('');
$("#1contactform_wrap .success").slideDown(function()
{
$(this).delay(5000).slideUp('slow');
});
});
}
else if(hasError == true)
{
$("#1contactform_wrap .error").slideDown();
}
return false;
});
});
})(jQuery);