$(document).ready(function(){$("#contact-form input.contact, #contact-form a.contact").click(function(a){a.preventDefault();$.get("../contactus/data/contact.php",function(b){$(b).modal({closeHTML:"<a href='#' title='Close' class='modal-close'>x</a>",position:["15%"],overlayId:"contact-overlay",containerId:"contact-container",onOpen:contact.open,onShow:contact.show,onClose:contact.close})})});$(["cancel.png","form_bottom.gif","form_top.gif","loading.gif","send.png"]).each(function(){(new Image).src=
"img/contact/"+this})});
var contact={message:null,open:function(a){$.browser.mozilla&&$("#contact-container .contact-button").css({"padding-bottom":"2px"});$.browser.safari&&$("#contact-container .contact-input").css({"font-size":".9em"});var b=280;if($("#contact-subject").length)b+=26;if($("#contact-cc").length)b+=22;var c=$("#contact-container .contact-title").html();$("#contact-container .contact-title").html("Loading...");a.overlay.fadeIn(200,function(){a.container.fadeIn(200,function(){a.data.fadeIn(200,function(){$("#contact-container .contact-content").animate({height:b},
function(){$("#contact-container .contact-title").html(c);$("#contact-container form").fadeIn(200,function(){$("#contact-container #contact-name").focus();$("#contact-container .contact-cc").click(function(){var d=$("#contact-container #contact-cc");d.is(":checked")?d.attr("checked",""):d.attr("checked","checked")});$.browser.msie&&$.browser.version<7&&$("#contact-container .contact-button").each(function(){if($(this).css("backgroundImage").match(/^url[("']+(.*\.png)[)"']+$/i)){var d=RegExp.$1;$(this).css({backgroundImage:"none",
filter:'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+d+'", sizingMethod="crop")'})}})})})})})})},show:function(){$("#contact-container .contact-send").click(function(a){a.preventDefault();if(contact.validate()){var b=$("#contact-container .contact-message");b.fadeOut(function(){b.removeClass("contact-error").empty()});$("#contact-container .contact-title").html("Sending...");$("#contact-container form").fadeOut(200);$("#contact-container .contact-content").animate({height:"80px"},function(){$("#contact-container .contact-loading").fadeIn(200,
function(){$.ajax({url:"../contactus/data/contact.php",data:$("#contact-container form").serialize()+"&action=send",type:"post",cache:false,dataType:"html",success:function(c){$("#contact-container .contact-loading").fadeOut(200,function(){$("#contact-container .contact-title").html("Thank you!");b.html(c).fadeIn(200)})},error:contact.error})})})}else if($("#contact-container .contact-message:visible").length>0){b=$("#contact-container .contact-message div");b.fadeOut(200,function(){b.empty();contact.showError();
b.fadeIn(200)})}else $("#contact-container .contact-message").animate({height:"30px"},contact.showError)})},close:function(a){$("#contact-container .contact-message").fadeOut();$("#contact-container .contact-title").html("Goodbye...");$("#contact-container form").fadeOut(200);$("#contact-container .contact-content").animate({height:40},function(){a.data.fadeOut(200,function(){a.container.fadeOut(200,function(){a.overlay.fadeOut(200,function(){$.modal.close()})})})})},error:function(a){alert(a.statusText)},
validate:function(){contact.message="";$("#contact-container #contact-name").val()||(contact.message+="Name is required. ");var a=$("#contact-container #contact-email").val();if(a)contact.validateEmail(a)||(contact.message+="Email is invalid. ");else contact.message+="Email is required. ";$("#contact-container #contact-message").val()||(contact.message+="Message is required.");return contact.message.length>0?false:true},validateEmail:function(a){var b=a.lastIndexOf("@");if(b<1||b+1===a.length)return false;
if(/(\.{2,})/.test(a))return false;var c=a.substring(0,b);a=a.substring(b+1);if(c.length<1||c.length>64||a.length<4||a.length>255)return false;if(/(^\.|\.$)/.test(c)||/(^\.|\.$)/.test(a))return false;if(!/^"(.+)"$/.test(c))if(!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(c))return false;if(!/^[-a-zA-Z0-9\.]*$/.test(a)||a.indexOf(".")===-1)return false;return true},showError:function(){$("#contact-container .contact-message").html($('<div class="contact-error"></div>').append(contact.message)).fadeIn(200)}};
