/* GZIP by Raccoon Framework */ /** * @author elalecs * @version 2.0, July 2009 */ /** * @var F Nombre corto para Frontend */ var F = {}; (function(F) { // Constructor $(function() { F.browser(); }); F.utils = { 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]$/ }; F.alert = function(message, callback) { $.blockUI({ message: "" + "
" + "

"+message+"

" + "" + "

" }); $("div.alert_window button.btn").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(); } }); }; F.confirm = function(message, callback) { $.blockUI({ message: "" + "
" + "

"+message+"

" + "" + "" + "

" }); $("div.alert_window button#btn_ok").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(true); } }); $("div.alert_window button#btn_cancel").click(function(){ $.unblockUI(); if (typeof callback === 'function') { callback(false); } }); }; F.loading = function(message) { if (!message || message === "" || message === null || message === false) { message = "Procesando...."; } $.modalAlert({ message: "" + "

"+message+"

" + "" }); }; F.numbers = function(e) { var keynum = window.event ? window.event.keyCode : e.which; if (keynum == 8) { return true; } return (/\d/.test(String.fromCharCode(keynum))); }; F.browser = function() { // IE 6 o inferior if ($.browser.msie && $.browser.version.match(/^[0-6]/)) { window.location.href = RCN.url + '/ie'; } }; F.load = function(url) { $.ajax({ url: url, success: function(html) { $("body").append(html); } }); }; F.booking = function(lang) { var inicio = $('#from').val(); var salida = $('#to').val(); var adultos = $('#adultos').val(); var ninos = $('#ninos').val(); var mensaje = "

La revision de disponibilidad ha sido realizada con exito.

Pronto nos pondremos en contacto para hacerte llegar los resultados.

"; var error1 = "Por favor ingrese una dirección de correo electronico válida"; var error2 = 'Por favor ingresa tu nombre'; var error3 = 'Por favor ingresa tu apellido'; var error4 = 'Por favor ingresa tu telefono'; var error5 = 'Por favor ingresa tu ciudad'; var error6 = 'Error al enviar el correo, intente más tarde.'; if(lang == "es") { $('#reservacion').modal(); } else { $('#reservation').modal(); mensaje = "

Your data has been sent

Soon we will contact you.

"; error1 = "Please enter a valid email address"; error2 = 'Please enter your name'; error3 = 'Please enter your lastname'; error4 = 'Please enter your phone number'; error5 = 'Please enter your city'; error6 = 'There was an error while sending your data, please try again later.'; } $('#btn_cancel:first').click(function(){ $('#error_msg').html(''); $.modal.close(); }); $('#btn_ok:first').click(function() { var correo = $('#registry_email').val(); var nombre = $('#registry_fistname').val(); var apellido = $('#registry_lastname').val(); var casatel = $('#registry_home_phone').val(); var ciudad = $('#registry_city').val(); if(!correo.match(F.utils.mail_regexp)) { $('#error_msg').html(error1); return false; } if (nombre == "") { $('#error_msg').html(error2); return false; } if (apellido == "") { $('#error_msg').html(error3); return false; } if (casatel == "") { $('#error_msg').html(error4); return false; } if (ciudad == "") { $('#error_msg').html(error5); return false; } $('#error_msg').html('Procesando...'); $.post("index.php/mode,json/control,Contact.booking/", { email : correo, firstname : nombre, lastname :apellido, phone_home : casatel, city : ciudad, inicio : inicio, salida : salida, adultos : adultos, ninos : ninos },function(json) { if (json.status == "201") { $.modal.close(); $.modal("

"+mensaje+"OK"); } else { var status_message = json.status_message.toLowerCase(); if (status_message.indexOf("mailer error") >= 0) { $('#registry #registry_error_msg').html(error6); } else { $('#registry #registry_error_msg').html('Error desconocido.'); } } }, "json"); }); }; F.Contact = function(lang) { var company = $('#company').val(); var firstname = $('#name').val(); var lastname = $('#lastname').val(); var email = $('#contact_email').val(); var telefono = $('#company').val(); var direccion = $('#direccion').val(); var cp = $('#cp').val(); var ciudad = $('#ciudad').val(); var estado = $('#estado').val(); var comentarios = $('#contact_comments').val(); var mensaje = "

Tu mensaje ha sido enviado con éxito.

Gracias por tus comentarios.

"; var error1 = "Por favor ingrese una dirección de correo electronico válida"; var error2 = 'Por favor ingresa tu nombre'; var error3 = 'Por favor ingresa tu apellido'; var error6 = 'Error al enviar el correo, intente más tarde.'; if(lang == "en") { mensaje = "

Your message has been sent

Thank you for your comments.

"; error1 = "Please enter a valid email address"; error2 = 'Please enter your name'; error3 = 'Please enter your lastname'; error6 = 'There was an error while sending your data, please try again later.'; } if(!email.match(F.utils.mail_regexp)) { $.modal("

"+error1+"OK"); return false; } if (firstname == "") { $.modal("

"+error2+"OK"); return false; } if (lastname == "") { $.modal("

"+error3+"OK"); return false; } $('#error_msg').html('Procesando...'); $.post("index.php/mode,json/control,Contact.sendContact/", { email : email, firstname : firstname, lastname :lastname, telefono : telefono, ciudad : ciudad, estado : estado, company : company, cp : cp, comentarios : comentarios },function(json) { if (json.status == "201") { $.modal.close(); $.modal("

"+mensaje+"OK"); } else { var status_message = json.status_message.toLowerCase(); if (status_message.indexOf("mailer error") >= 0) { $('#registry #registry_error_msg').html(error6); } else { $('#registry #registry_error_msg').html('Error desconocido.'); } } }, "json"); } })(F);