$(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","dias","categoria" ); 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 = 'cajaTexto'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; //var idauto = document.getElementById('form_idAutoCategoria').value; //alert(idauto); var campos = new Array("idAutoCategoria","retiroLugar","retiroFecha","retiroHora","retiroMin","entregaLugar","entregaFecha","entregaHora","entregaMin","nombre", "apellido","telefono", "pais", "formaPago","edad", "nroPasajeros", "comentario"); var obligatorios = new Array("idAutoCategoria" ,"retiroLugar","retiroFecha","retiroHora","retiroMin","entregaLugar","entregaFecha","entregaHora","entregaMin","nombre", "apellido","telefono", "pais", "formaPago","edad", "nroPasajeros", "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 <= 100) { document.getElementById('divError3').innerHTML = '*Por favor complete todos los campos obligatorios!'; } if (i == 1) { document.getElementById('retiroLugar').className = 'cajaFormError'; document.getElementById('retiroLugar').onclick = function() { this.className = 'cajaTexto'; }; } if (i == 2) { document.getElementById('form_retiroFecha').className = 'cajaFormError'; document.getElementById('form_retiroFecha').onclick = function() { this.className = 'cajaTexto'; }; } if (i == 3) { document.getElementById('form_retiroHora').className = 'cajaFormError'; document.getElementById('form_retiroHora').onclick = function() { this.className = 'cajaTexto'; }; } if (i == 4) { document.getElementById('form_retiroMin').className = 'cajaFormError'; document.getElementById('form_retiroMin').onclick = function() { this.className = 'cajaTexto'; }; } if (i == 5) { document.getElementById('entregaLugar').className = 'cajaFormError'; document.getElementById('entregaLugar').onclick = function() { this.className = 'cajaTexto'; }; } 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'; }; } if (i == 9) { document.getElementById('form_pais').className = 'cajaFormError'; document.getElementById('form_pais').onclick = function() { this.className = 'cajaForm'; }; } if (i == 10) { document.getElementById('form_formaPago').className = 'cajaFormError'; document.getElementById('form_formaPago').onclick = function() { this.className = 'cajaForm'; }; } if (i == 13) { document.getElementById('form_nroPasajeros').className = 'cajaFormError'; document.getElementById('form_nroPasajeros').onclick = function() { this.className = 'cajaTexto'; }; } faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaFormError'; campo.onclick = function() { this.className = 'cajaTexto'; }; } pars += campos[i] + "=" + campo.value + "&"; } 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 formValidarSide() { 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_emailS'); if (regex.test(email.value) == false) { faltan = " - Email
"; email.className = 'cajaFormError'; email.onclick = function() { this.className = 'cajaTexto'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; var campos = new Array("nombreS", "apellidoS","telefonoS","diasS","categoriaS","retiroFechaS","entregaFechaS","comentarioS"); var obligatorios = new Array("nombreS", "apellidoS","telefonoS","diasS","categoriaS","retiroFechaS","entregaFechaS","comentarioS"); document.getElementById('divError5').innerHTML = ''; for (i = 0; i < campos.length; i++) { campo = document.getElementById('form_' + campos[i]); if (campo.value == "" && obligatorios[i] != "") { if (i == 0) { document.getElementById('divError5').innerHTML = '*Por favor complete todos los campos obligatorios!'; } if (i == 5) { document.getElementById('form_categoriaS').className = 'cajaFormError'; document.getElementById('form_categoriaS').onclick = function() { this.className = 'cajaTexto'; }; } faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaFormError'; campo.onclick = function() { this.className = 'cajaTexto'; }; } // alert(faltan); pars += campos[i] + "=" + campo.value + "&"; } if (faltan == "") { // alert(i); // $('#form_retiroLugar').fadeIn(); // $('#form_entregaLugar').fadeIn(); document.getElementById('divFormSide').innerHTML = '
'; var conn = new Ext.data.Connection(); conn.request( { url : 'enviarFormS.php', method : 'POST', params : pars, success : function(responseObject) { document.getElementById('divFormSide').innerHTML = responseObject.responseText; } }); } } function contactoValidar() { 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 = 'cajaTexto'; }; } var pars = "tipo=contacto&email=" + email.value + "&"; var campos = new Array("nombre", "apellido","telefono","comentario","retiroFecha","entregaFecha","dias","categoria"); var obligatorios = new Array("nombre", "apellido","telefono","comentario","","","",""); document.getElementById('divError5').innerHTML = ''; for (i = 0; i < campos.length; i++) { campo = document.getElementById('form_' + campos[i]); if (campo.value == "" && obligatorios[i] != "") { if (i == 0) { document.getElementById('divError').innerHTML = '*Por favor complete todos los campos obligatorios!'; } faltan += " - " + obligatorios[i] + "
"; campo.className = 'cajaFormError'; campo.onclick = function() { this.className = 'cajaTexto'; }; } // alert(faltan); pars += campos[i] + "=" + campo.value + "&"; } if (faltan == "") { document.getElementById('divForm').innerHTML = '
'; var conn = new Ext.data.Connection(); conn.request( { url : 'enviarFormC.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'; } }); }