$(document).ready(function() { $('#preloading').fadeOut(); $('.boton').click(function() { $('.boton').removeClass('boton-on'); $(this).addClass('boton-on'); }); $('.boton').mouseover(function() { $(this).addClass('boton-over'); }); $('.boton').mouseout(function() { $(this).removeClass('boton-over'); }); cargarClimaDefault(); }); function cargarLugar(campo, valor) { if (valor == 56) { document.getElementById("form_" + campo).value = ""; $('#' + campo).animate( { width : 54 }, 'fast', function() { $('#form_' + campo).fadeIn(); }); } else { $('#form_' + campo).fadeOut(function() { $('#' + campo).animate( { width : 154 }, 'fast'); document.getElementById("form_" + campo).value = valor; }); } } function cargarContenido(seccion) { $('#divContenido').slideUp(); $('#preloading').fadeIn(); document.getElementById('divContenido').innerHTML = ""; setTimeout(function() { var conn = new Ext.data.Connection(); conn.request( { url : 'cargarContenido.php', method : 'POST', params : { "seccion" : seccion }, success : function(responseObject) { $('#preloading').fadeOut(); document.getElementById('divContenido').innerHTML = responseObject.responseText; $('#divContenido').slideDown(); } }); }, 200); } function validarContacto() { var regex = new RegExp("^[^@ ]+@([a-zA-Z0-9-]+.)+([a-zA-Z0-9-]{2}|net|com|gov|mil|org|edu|int|biz|info|name|pro)$"); var faltan = ""; var email = document.getElementById('contact_email'); if (regex.test(email.value) == false) { faltan = " - Email
"; email.className = 'cajaContactoError'; email.onclick = function() { this.className = 'cajaContacto'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; var campos = new Array("nombre", "apellido", "telefono", "comentario", "movil", "prov", "direccion"); var obligatorios = new Array("Nombre", "Apellido", "Teléfono", "Comentario", "", "", ""); for (i = 0; i < campos.length; i++) { campo = document.getElementById('contact_' + campos[i]); if (campo.value == "" && obligatorios[i] != "") { faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaContactoError'; campo.onclick = function() { this.className = 'cajaContacto'; }; } pars += campos[i] + "=" + campo.value + "&"; } if (faltan != "") { // Dialog document.getElementById('divError').innerHTML = '*Por favor complete todos los campos obligatorios!'; } else { document.getElementById('divContenido').innerHTML = '
'; var conn = new Ext.data.Connection(); conn.request( { url : 'enviarContacto.php', method : 'POST', params : pars, success : function(responseObject) { document.getElementById('divContenido').innerHTML = responseObject.responseText; } }); } } function validarEspeciales() { var regex = new RegExp("^[^@ ]+@([a-zA-Z0-9-]+.)+([a-zA-Z0-9-]{2}|net|com|gov|mil|org|edu|int|biz|info|name|pro)$"); var faltan = ""; var email = document.getElementById('especiales_email'); if (regex.test(email.value) == false) { faltan = " - Email
"; email.className = 'cajaEspecialesError'; email.onclick = function() { this.className = 'cajaEspeciales'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; var campos = new Array("nombre", "apellido", "dias", "comentario"); var obligatorios = new Array("Nombre", "Apellido", "Teléfono", "Comentario"); for (i = 0; i < campos.length; i++) { campo = document.getElementById('especiales_' + campos[i]); if (campo.value == "" && obligatorios[i] != "") { faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaEspecialesError'; campo.onclick = function() { this.className = 'cajaEspeciales'; }; } pars += campos[i] + "=" + campo.value + "&"; } if (faltan != "") { // Dialog document.getElementById('divErrorEspeciales').innerHTML = '*Por favor complete todos los campos obligatorios!'; } else { document.getElementById('divEspeciales').innerHTML = '
'; var conn = new Ext.data.Connection(); conn.request( { url : 'enviarEspeciales.php', method : 'POST', params : pars, success : function(responseObject) { document.getElementById('divEspeciales').innerHTML = responseObject.responseText; } }); } } function formValidar() { var regex = new RegExp("^[^@ ]+@([a-zA-Z0-9-]+.)+([a-zA-Z0-9-]{2}|net|com|gov|mil|org|edu|int|biz|info|name|pro)$"); var faltan = ""; var email = document.getElementById('form_email'); if (regex.test(email.value) == false) { faltan = " - Email
"; email.className = 'cajaFormError'; email.onclick = function() { this.className = 'cajaForm'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; var campos = new Array("idAutoCategoria", "retiroLugar", "retiroFecha", "retiroHora", "retiroMin", "entregaLugar", "entregaFecha", "entregaHora", "entregaMin", "nombre", "apellido", "edad", "nroPasajeros", "telefono", "pais", "formaPago", "comentario"); var obligatorios = new Array("idAutoCategoria", "retiroLugar", "retiroFecha", "retiroHora", "retiroMin", "entregaLugar", "entregaFecha", "entregaHora", "entregaMin", "nombre", "apellido", "edad", "nroPasajeros", "telefono", "pais", "formaPago", "comentario"); document.getElementById('divError1').innerHTML = ''; document.getElementById('divError2').innerHTML = ''; document.getElementById('divError3').innerHTML = ''; document.getElementById('divError4').innerHTML = ''; for (i = 0; i < campos.length; i++) { campo = document.getElementById('form_' + campos[i]); if (campo.value == "" && obligatorios[i] != "") { if (i == 0) { document.getElementById('divError1').innerHTML = '*Por favor seleccione una categoria!'; } else if (i <= 4) { document.getElementById('divError2').innerHTML = '*Por favor complete todos los campos obligatorios!'; } else if (i <= 8) { document.getElementById('divError3').innerHTML = '*Por favor complete todos los campos obligatorios!'; } else if (i < 100) { document.getElementById('divError4').innerHTML = '*Por favor complete todos los campos obligatorios!'; } if (i == 1) { document.getElementById('retiroLugar').className = 'cajaFormError'; document.getElementById('retiroLugar').onclick = function() { this.className = 'cajaForm'; }; } if (i == 5) { document.getElementById('entregaLugar').className = 'cajaFormError'; document.getElementById('entregaLugar').onclick = function() { this.className = 'cajaForm'; }; } if (i == 3) { document.getElementById('form_retiroHora').className = 'cajaFormError'; document.getElementById('form_retiroHora').onclick = function() { this.className = 'cajaForm'; }; } if (i == 4) { document.getElementById('form_retiroMin').className = 'cajaFormError'; document.getElementById('form_retiroMin').onclick = function() { this.className = 'cajaForm'; }; } if (i == 7) { document.getElementById('form_entregaHora').className = 'cajaFormError'; document.getElementById('form_entregaHora').onclick = function() { this.className = 'cajaForm'; }; } if (i == 8) { document.getElementById('form_entregaMin').className = 'cajaFormError'; document.getElementById('form_entregaMin').onclick = function() { this.className = 'cajaForm'; }; } faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaFormError'; campo.onclick = function() { this.className = 'cajaForm'; }; } pars += campos[i] + "=" + campo.value + "&"; } var conn = new Ext.data.Connection(); conn.request( { url : 'captchademo.php', method : 'POST', params : { "tmptxt" : document.getElementById('form_captcha').value }, success : function(responseObject) { campo = document.getElementById('form_captcha'); if (responseObject.responseText == "Error") { document.getElementById('divError4').innerHTML = '*Por favor complete todos los campos obligatorios!'; faltan += " Error"; campo.className = 'cajaFormError'; campo.onclick = function() { this.className = 'cajaForm'; }; } if (faltan == "") { $('#form_retiroLugar').fadeIn(); $('#form_entregaLugar').fadeIn(); document.getElementById('divForm').innerHTML = '
'; var conn = new Ext.data.Connection(); conn.request( { url : 'enviarForm.php', method : 'POST', params : pars, success : function(responseObject) { document.getElementById('divForm').innerHTML = responseObject.responseText; } }); } } }); } function formAnimar(divFormActivar) { $('#divForm').animate( { scrollLeft : ((divFormActivar - 1) * 664) }, 'fast'); } function cargarClimaDefault() { var conn = new Ext.data.Connection(); conn.request( { url : 'climaGet.php', method : 'POST', success : function(responseObject) { document.getElementById('climaDefault').innerHTML = responseObject.responseText; }, failure : function() { document.getElementById('climaDefault').innerHTML = 'No Data'; } }); }