/*
 * contactable 1.2.1 - jQuery Ajax contact form
 *
 * Copyright (c) 2009 Philip Beel (http://www.theodin.co.uk/)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Revision: $Id: jquery.contactable.js 2010-01-18 $
 *
 */
(function(a){a.fn.contactable=function(c){var b={name:"Nombre",email:"Email",message:"Mensaje",phone:"Telefono",company:"Empresa",subject:"",buttonTitle:"Enviar",recievedMsg:"Gracias por tu mensaje",notRecievedMsg:"Lo sentimos pero tu mensaje no pudo enviarse, intenta mas tarde",disclaimer:"Please feel free to get in touch, we value your feedback",hideOnSubmit:true};c=a.extend(b,c);return this.each(function(){a(this).html('<div id="contactable"></div><form id="contactForm" method="" action=""><div id="loading"></div><div id="callback"></div><div class="holder"><p><label for="name">'+
b.name+' <span class="red"> * </span></label><br /><input id="name" class="contact" name="name" /></p><p><label for="email">'+b.email+' <span class="red"> * </span></label><br /><input id="email" class="contact" name="email" /></p><p><label for="company">'+b.company+' </label><br /><input id="company" class="contact" name="company" /></p><p><label for="phone">'+b.phone+' </label><br /><input id="phone" class="contact" name="phone" /></p><p><label for="comment">'+b.message+' <span class="red"> * </span></label><br /><textarea id="comment" name="comment" class="comment" rows="4" cols="30" ></textarea></p><p><input class="submit" type="submit" value="'+
b.buttonTitle+'"/></p><p class="disclaimer">'+b.disclaimer+"</p></div></form>");a("div#contactable").toggle(function(){a("#overlay").css({display:"block"});a(this).animate({marginLeft:"-=5px"},"fast");a("#contactForm").animate({marginLeft:"-=0px"},"fast");a(this).animate({marginLeft:"+=387px"},"slow");a("#contactForm").animate({marginLeft:"+=390px"},"slow")},function(){a("#contactForm").animate({marginLeft:"-=390px"},"slow");a(this).animate({marginLeft:"-=387px"},"slow").animate({marginLeft:"+=5px"},
"fast");a("#overlay").css({display:"none"})});a("#contactForm").validate({rules:{name:{required:true,minlength:2},email:{required:true,email:true},comment:{required:true}},messages:{name:"",email:"",phone:"",company:"",comment:""},submitHandler:function(){a(".holder").hide();a("#loading").show();a.post(baseUrl + "Contact/Index",{subject:b.subject,name:a("#name").val(),email:a("#email").val(),comment:a("#comment").val(),company:a("#company").val(),phone:a("#phone").val()},function(d){a("#loading").css({display:"none"});
if(d=="success"){a("#callback").show().append(b.recievedMsg);if(b.hideOnSubmit==true){a("#contactForm").animate({dummy:1},2E3).animate({marginLeft:"-=450px"},"slow");a("div#contactable").animate({dummy:1},2E3).animate({marginLeft:"-=447px"},"slow").animate({marginLeft:"+=5px"},"fast");a("#overlay").css({display:"none"})}}else a("#callback").show().append(b.notRecievedMsg)})}})})}})(jQuery);
