/* GZIP by Raccoon Framework */ var _ = {}; _.extend = jQuery.extend; _.extend({ mail_regexp: /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/, alert: function(message, callback){ $.blockUI({ message: "" + "
" + "

" + message + "

" + "" + "

" }); $("div.alert_window button#btn_ok").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(); } }); }, loading: function(message) { if (!message || message === "" || message === null || message === false) { message = "Cargando..."; } $.blockUI({ message: "" + "

"+message+"

" + "" }); }, showProduct: function(id,lang){ _.loading(); $("#product").load("index.php/page,producto/lang,"+lang+"/id," + id, "", function(){ $.blockUI({ message: $('#product'), css: { width: 900 + 'px', height: 500 + 'px', top: ($(window).height() - 500) / 2 + 'px', left: ($(window).width() - 900) / 2 + 'px' } }); }); }, closeProduct: function(){ $.unblockUI(); }, changeProduct: function(id){ $(".presentacion_on").attr("class","presentacion_off"); $("#producto"+id).attr("class","presentacion_on"); }, showContact: function(id){ $.blockUI({ message: $('#contact'), css: { width: 900 + 'px', height: 500 + 'px', top: ($(window).height() - 500) / 2 + 'px', left: ($(window).width() - 900) / 2 + 'px' } }); $('#contact #btn_cancel').click(function(){ $('#contact #registry_error_msg').html(''); $.unblockUI(); }); $('#contact #tache').click(function(){ $('#contact #registry_error_msg').html(''); $.unblockUI(); }); $('#contact #btn_ok').click(function(){ var contact_dpto = $("#contact_form #contact_dpto").val(); var contact_name = $("#contact_form #contact_name").val(); var contact_email = $("#contact_form #contact_email").val(); var contact_phone = $("#contact_form #contact_phone").val(); var contact_city = $("#contact_form #contact_city").val(); var contact_comments = $("#contact_form #contact_comments").val(); if (!contact_email.match(_.mail_regexp)) { alert("Por favor ingresa una cuenta de correo vĂ¡lida."); return false; } if (contact_name == "") { alert("Ingresa tu nombre"); return false; } if (contact_comments == "") { alert("Ingresa tus comentarios"); return false; } $.post("index.php/mode,json/control,Contact.index/", { contact_name: contact_name, contact_email: contact_email, contact_comments: contact_comments, contact_dpto: contact_dpto, contact_phone: contact_phone, contact_city: contact_city }, function(json){ if (json.status == 201) { _.alert("Su forma de contacto ha sido enviada.
Gracias.", function(){ $("#contact_form #contact_btn").get(0).disabled = true; $("#contact_form #contact_btn").css("border", "1px solid #999"); $("#contact_form #contact_btn").css("color", "#999"); }); } else { alert("Ha ocurrido un error, por favor intente mas tarde"); } }, "json"); }); }, showContactEn: function(id){ $.blockUI({ message: $('#contact_en'), css: { width: 900 + 'px', height: 500 + 'px', top: ($(window).height() - 500) / 2 + 'px', left: ($(window).width() - 900) / 2 + 'px' } }); $('#contact_en #btn_cancel').click(function(){ $('#contact_en #registry_error_msg').html(''); $.unblockUI(); }); $('#contact_en #tache').click(function(){ $('#contact #registry_error_msg').html(''); $.unblockUI(); }); $('#contact_en #btn_ok').click(function(){ var contact_dpto = $("#contact_en_form #contact_dpto").val(); var contact_name = $("#contact_en_form #contact_name").val(); var contact_email = $("#contact_en_form #contact_email").val(); var contact_phone = $("#contact_en_form #contact_phone").val(); var contact_city = $("#contact_en_form #contact_city").val(); var contact_comments = $("#contact_en_form #contact_comments").val(); if (!contact_email.match(_.mail_regexp)) { alert("Please enter a valid email."); return false; } if (contact_name == "") { alert("Enter your name"); return false; } if (contact_comments == "") { alert("Enter your comments"); return false; } $.post("index.php/mode,json/control,Contact.index/", { contact_name: contact_name, contact_email: contact_email, contact_comments: contact_comments, contact_dpto: contact_dpto, contact_phone: contact_phone, contact_city: contact_city }, function(json){ if (json.status == 201) { _.alert("your contact form has been sent.
Thank you.", function(){ $("#contact_en_form #contact_btn").get(0).disabled = true; $("#contact_en_form #contact_btn").css("border", "1px solid #999"); $("#contact_en_form #contact_btn").css("color", "#999"); }); } else { alert("Please try again later."); } }, "json"); }); }, centrar: function(){ $("#flash").css({ left: ($(window).width() / 2) - (950 / 2), top: ($(window).height() / 2) - (680 / 2) }); } }); $(_.centrar) $(window).resize(function(){ $(_.centrar) });