"https:"!=document.location.protocol&&(document.location="https://"+document.location.hostname+document.location.pathname+document.location.search+document.location.hash);
function setupContactPopup(){$("#x_contactPopup")[0]||($("body").append('
'),$("#x_contactPopup .close, #x_contactSuccess .button").click(function(){$("#x_contactPopup").hide();
$("html,body").removeClass("popupShown");$("html").removeClass("noscroll");g_disableScroll=!1}))}function showContactPopup(){clearContactSignupErrors();$("#x_contactPopup").fadeIn("fast");$("html,body").addClass("popupShown");$("html").addClass("noscroll");$("#x_contactName").focus();g_disableScroll=!0}
$(document).ready(function(){setupContactPopup();$("#x_contactSuccess .button").click(function(){$(".popup").fadeOut("fast",function(){$("html,body").removeClass("popupShown");$("html").removeClass("noscroll");g_disableScroll=!1})});$("#x_contactSend").click(function(){if($(this).hasClass("disabled"))return!1;clearContactSignupErrors();var a=$("#x_contactName").val(),b=$("#x_contactEmail").val(),c=$("#x_contactContent").val();if(0==a.length)return $("#x_contactNameError").text("Please enter your first and last name.").show(),
$("#x_contactName").addClass("error").focus(),!1;if(!isValidEmail(b))return $("#x_contactEmailError").text("Please enter a valid email address.").show(),$("#x_contactEmail").addClass("error").focus(),!1;if(0==c.length)return $("#x_contactContentError").text("Please enter an email message.").show(),$("#x_contactContent").addClass("error").focus(),!1;$("#x_contactName").attr("disabled",!0);$("#x_contactEmail").attr("disabled",!0);$("#x_contactContent").attr("disabled",!0);$("#x_contactSend").addClass("disabled");
sendContactEmail(a,b,c,function(a){a?($("#x_contact").hide(),$("#x_contactSuccess").show(),$("#x_contactSuccessStatus").html("We've received your request and a member of our team will respond as soon as possible.").show()):($("#x_contactContentError").html("Error during request. Please check your connection and try again.").css("display","inline-block"),$("#x_contactName").removeAttr("disabled"),$("#x_contactEmail").removeAttr("disabled"),$("#x_contactContent").removeAttr("disabled"),$("#x_contactSend").removeClass("disabled"))})});
"#contact"==window.location.hash&&showContactPopup()});function sendContactEmail(a,b,c,d){$.post("/api/user/0.1/index.php/contact/",{email:b,name:a,message:c},function(){d(!0)},"xml").fail(function(){d(!1)})}
function clearContactSignupErrors(){$(".popup input").removeClass("error");$("#x_contactNameError").hide();$("#x_contactEmailError").hide();$("#x_contactContentError").hide();$("#x_contactName").removeAttr("disabled");$("#x_contactEmail").removeAttr("disabled");$("#x_contactContent").removeAttr("disabled");$("#x_contactSend").removeClass("disabled");$("#x_contact").show();$("#x_contactSuccess").hide()};