$(document).ready(function(){$("#btn_secretproject").click(function(b){b.preventDefault();$.ajax({type:"POST",url:CI.base_url+"index.php/modal/indexJs",data:{action:"",action:"modal"},success:function(c){$(c).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})}})});var a=["cancel.png","form_bottom.gif","form_top.gif","loading.gif","send.png"];$(a).each(function(){var b=new Image();b.src=CI.base_url+"system/application/resources/images/frontend/modal/"+this})});var contact={message:null,open:function(a){var b=370;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();if($.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(a){$("#contact-container .contact-send").click(function(b){b.preventDefault();if(contact.validate()){var c=$("#contact-container .contact-message");c.fadeOut(function(){c.removeClass("contact-error").empty()});$("#contact-container .contact-title").html("Sending...");$("#contact-container form").fadeOut(200);$("#contact-container").animate({height:"180px"},1000);$("#contact-container").css({"background-color":"#000"});$("#contact-container .contact-content").animate({height:"80px"},function(){$("#contact-container .contact-loading").fadeIn(200,function(){$.ajax({url:CI.base_url+"index.php/modal/indexJs",data:$("#contact-container form").serialize()+"&action=send",type:"post",cache:false,success:function(d){$("#contact-container .contact-loading").fadeOut(200,function(){$("#contact-container .contact-title").html("Thank you!");c.html(d).fadeIn(200)})},error:contact.error})})})}else{if($("#contact-container .contact-message:visible").length>0){var c=$("#contact-container .contact-message div");c.fadeOut(200,function(){c.empty();contact.showError();c.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="";if(!$("#contact-container #contact-name").val()){contact.message+="Name is required. "}var a=$("#contact-container #contact-email").val();if(!a){contact.message+="Email is required. "}else{if(!contact.validateEmail(a)){contact.message+="Email is invalid. "}}if(!$("#contact-container #contact-bussines").val()){contact.message+="Bussines Type is required."}if(contact.message.length>0){return false}else{return true}},validateEmail:function(b){var a=b.lastIndexOf("@");if(a<1||(a+1)===b.length){return false}if(/(\.{2,})/.test(b)){return false}var c=b.substring(0,a);var d=b.substring(a+1);if(c.length<1||c.length>64||d.length<4||d.length>255){return false}if(/(^\.|\.$)/.test(c)||/(^\.|\.$)/.test(d)){return false}if(!/^"(.+)"$/.test(c)){if(!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(c)){return false}}if(!/^[-a-zA-Z0-9\.]*$/.test(d)||d.indexOf(".")===-1){return false}return true},showError:function(){$("#contact-container .contact-message").html($('<div class="contact-error"></div>').append(contact.message)).fadeIn(200)}};
