function navegar(n) { browser_mozilla = /firefox/.test(navigator.userAgent.toLowerCase()); var i=document.createElement("a");browser_mozilla||typeof i.click=="undefined"?top.location.href=n:(i.href=n,i.target="_parent",document.body.appendChild(i),i.click()) } function cargarContactarListado(event, id, codigo) { if (!event) var event = window.event; event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); $.fancybox({ 'type' : "ajax", 'href' : "/helpers/widgets/contact_listado.php?id=" + id, 'ajax' : { dataType : 'html', headers : { 'X-fancyBox': 'true' } }, afterShow: function() { ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'ver_telefono_popup', eventLabel: codigo }); } }); } function pruebaFancy(id, codigo) { $.fancybox({ 'type' : "ajax", 'href' : "/helpers/widgets/contact_listado.php?id=" + id, 'ajax' : { dataType : 'html', headers : { 'X-fancyBox': 'true' } } }); } function cargarTelefonoMovil(id, codigo) { $.ajax({ type: 'POST', url: '/cargador_telefonos.php', data: 'id='+id+'&listado=1', async: false, success: function(data) { ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'ver_telefono', eventLabel: codigo }); } }); } function anadirFavoritosListado(id, img) { var tmp_e; var jsv_t; tmp_e = document.getElementById('jsv_t'); if(tmp_e) jsv_t = tmp_e.value; $.ajax({ type: 'POST', url: "/insertar_favoritos.php", data: {'idfavoritolistado':id, 'idcookie': jsv_t}, async : false, }).done(function(data) { document.getElementById("li_favoritos").innerHTML = "<"+"a href='/tus_favoritos.php' rel='nofollow'> "+ data +""; $("#corazon_"+ id).removeClass( "div_icono_favorito" ).addClass( "div_icono_favorito_ok" ); }); } function anadirFavoritosFicha(id) { var tmp_e; var jsv_t; tmp_e = document.getElementById('jsv_t'); if(tmp_e) jsv_t = tmp_e.value; $.ajax({ type: 'POST', url: "/insertar_favoritos.php", data: {'idfavoritolistado':id, 'idcookie':jsv_t}, async : false, }).done(function(data) { document.getElementById("li_favoritos").innerHTML = "<"+"a href='/tus_favoritos.php' rel='nofollow'> "+ data +""; }); } function toglearCapa(cual) { $('#'+cual).slideToggle(); } function cambioCheck(cual) { if (document.getElementById("fl_"+ cual).checked) { document.getElementById("img_check_"+ cual).src = "/assets/img/check_si.gif" } else { document.getElementById("img_check_"+ cual).src = "/assets/img/check_no.gif" } } var mapaVisible = false; var mapaGoogleVisible = false; mapaGoogleCargado = false; function mostrarMapa() { var tmp_e; var jsv_valorZonaArray_PHP, jsv_valorZonaId_PHP, jsv_dirURL; tmp_e = document.getElementById('jsv_valorZonaArray_PHP'); if(tmp_e) jsv_valorZonaArray_PHP = tmp_e.value; tmp_e = document.getElementById('jsv_valorZonaId_PHP'); if(tmp_e) jsv_valorZonaId_PHP = tmp_e.value; tmp_e = document.getElementById('jsv_dirURL'); if(tmp_e) jsv_dirURL = tmp_e.value; if(mapaVisible) { ocultarMapa(); } else { mapaVisible = true; $('html, body').animate({scrollTop: 0}, 100, function() { $('#map').animate({height: "336px"}, 500, function() { google.maps.event.trigger(map, "resize"); // Animation complete. $('#capa_mapa_map').fadeIn(500,function() { /*$('#contenido_ver_mapa').html('Ocultar mapa')*/ if (mapa_mostrado==0) { $.ajax({ type: 'POST', url: "/ajax_mapa_listado.php", data: {'a': jsv_valorZonaArray_PHP, 'b': jsv_valorZonaId_PHP, 'c': jsv_dirURL}, async : false, }).done(function(data) { $('#capa_mapa_map').html(""); mapa_mostrado = 1 mapa_mostrado2 = 1 $('#cvi_mapa').maphilight(); setTimeout(mostrarCapaMapa,500) }); } }); }); }); } } function mostrarMapaGoogle() { var tmp_e; var jsv_valorZonaArray_PHP, jsv_valorZonaId_PHP, jsv_dirURL; tmp_e = document.getElementById('jsv_valorZonaArray_PHP'); if(tmp_e) jsv_valorZonaArray_PHP = tmp_e.value; tmp_e = document.getElementById('jsv_valorZonaId_PHP'); if(tmp_e) jsv_valorZonaId_PHP = tmp_e.value; tmp_e = document.getElementById('jsv_dirURL'); if(tmp_e) jsv_dirURL = tmp_e.value; if(mapaGoogleVisible) { ocultarMapaGoogle(); } else { mapaGoogleVisible = true; if (mapaGoogleCargado==false) { $('html, body').animate({scrollTop: 0}, 100); /*$('#capa_fija_filtro_mapa').html('
');*/ $('#capa_fija_filtro_mapa').html('
'); $('#contenido_ver_mapa').html('Ocultar mapa') downloadJSAtOnload(); mapaGoogleCargado = true } } } function mostrarCapaMapa() { $('#capa_mapa_map_mapa').fadeIn(); } function ocultarMapa() { mapaVisible = false; $('#capa_mapa_map').fadeOut(); $('#map').animate({height: "200px"}) /*$('#contenido_ver_mapa').html('Ver mapa de zonas')*/ mapa_mostrado2 = 0 } function ocultarMapaGoogle() { mapaGoogleVisible = false; $('#capa_fija_filtro_mapa').hide(); $('#contenido_ver_mapa').html('Ver mapa') } function mostrarMapaGoogleCargado() { mapaGoogleVisible = true; $('#capa_fija_filtro_mapa').show(); $('#contenido_ver_mapa').html('Ocultar mapa') } function formFiltros(obj) { var tmp_e; var jsv_a, jsv_b; tmp_e = document.getElementById('jsv_a'); if(tmp_e) jsv_a = tmp_e.value; tmp_e = document.getElementById('jsv_b'); if(tmp_e) jsv_b = tmp_e.value; var fsup, fdor, fbanm, fpde, fpha, ffecha; fsup=0; fdor=0; fban=0; fpde=0; fpha=0, ffecha=0; if(obj.substr(0, 14)=='fl_superficie_') { fsup = obj.substr(14, 3); } else { if($("#fl_superficie_0").is(':checked')) fsup=0; else if($("#fl_superficie_40").is(':checked')) fsup=40; else if($("#fl_superficie_60").is(':checked')) fsup=60; else if($("#fl_superficie_80").is(':checked')) fsup=80; else if($("#fl_superficie_100").is(':checked')) fsup=100; else if($("#fl_superficie_140").is(':checked')) fsup=140; else if($("#fl_superficie_200").is(':checked')) fsup=200; else if($("#fl_superficie_400").is(':checked')) fsup=400; } if(obj.substr(0, 15)=='fl_dormitorios_') { fdor = obj.substr(15, 1); } else if(obj.substr(0, 15)=='ln_dormitorios_') { fdor = obj.substr(15, 1); } else { if($("#fl_dormitorios_0").is(':checked')) fdor=0; else if($("#fl_dormitorios_1").is(':checked')) fdor=1; else if($("#fl_dormitorios_2").is(':checked')) fdor=2; else if($("#fl_dormitorios_3").is(':checked')) fdor=3; else if($("#fl_dormitorios_4").is(':checked')) fdor=4; else if($("#fl_dormitorios_5").is(':checked')) fdor=5; } if(obj.substr(0, 9)=='fl_fecha_') { ffecha = obj.substr(9, 1); } else if(obj.substr(0, 9)=='ln_fecha_') { ffecha = obj.substr(9, 1); } else { if($("#fl_fecha_0").is(':checked')) ffecha=0; else if($("#fl_fecha_1").is(':checked')) ffecha=1; else if($("#fl_fecha_2").is(':checked')) ffecha=2; else if($("#fl_fecha_3").is(':checked')) ffecha=3; } if(obj.substr(0, 9)=='fl_banos_') { fban = obj.substr(9, 1); } else { if($("#fl_banos_0").is(':checked')) fban=0; else if($("#fl_banos_1").is(':checked')) fban=1; else if($("#fl_banos_2").is(':checked')) fban=2; else if($("#fl_banos_3").is(':checked')) fban=3; else if($("#fl_banos_4").is(':checked')) fban=4; else if($("#fl_banos_5").is(':checked')) fban=5; } tmp = document.getElementById('fl_precio_desde'); fpde = tmp.value.replace("precio-desde-", ""); tmp = document.getElementById('fl_precio_hasta'); fpha = tmp.value.replace("precio-hasta-", ""); c = new Array(); tmp2 = jsv_a.split("/"); tmp3 = tmp2[0].split("-"); for (var i=0; i < tmp2.length; i++) { c[c.length] = tmp2[i]; } c_tmp = tmp3[0]; nuevotipo = ''; if(obj.substr(0, 13)=='fl_tipologia_') { ftip = obj.substr(13, 2); switch(ftip) { case '0': c[0] = c_tmp+'-viviendas'; nuevotipo = '*'; break; case '1': c[0] = c_tmp+'-viviendas'; nuevotipo = 'aticos'; break; case '2': c[0] = c_tmp+'-viviendas'; nuevotipo = 'pisos'; break; case '3': c[0] = c_tmp+'-viviendas'; nuevotipo = 'estudios'; break; case '4': c[0] = c_tmp+'-viviendas'; nuevotipo = 'duplex'; break; case '5': c[0] = c_tmp+'-viviendas'; nuevotipo = 'chalets'; break; case '9': c[0] = c_tmp+'-oficinas'; nuevotipo = '*'; break; case '10': c[0] = c_tmp+'-garajes'; nuevotipo = '*'; break; case '11': c[0] = c_tmp+'-terrenos'; nuevotipo = '*'; break; case '12': c[0] = c_tmp+'-locales'; nuevotipo = '*'; break; case '13': c[0] = c_tmp+'-habitaciones';nuevotipo = '*'; break; } } zona=''; for(i=0;i < c.length;i++) { zona=zona+c[i]+'/'; } ftipo = ''; switch(jsv_b) { case '1': ftipo='aticos'; break; case '2': ftipo='pisos'; break; case '3': ftipo='estudios'; break; case '4': ftipo='duplex'; break; case '5#6#7#8': ftipo='chalets'; break; } if(nuevotipo!="") { if(nuevotipo!="*") { ftipo = nuevotipo; } else { ftipo = ""; } } ford = ''; ford = document.getElementById('fl_ordenado').value; fil = new Array(); if(fsup!=0) { fil[fil.length] = 'metros-cuadrados-mas-de-'+fsup; } if(fdor!=0) { if(fdor==1) fil[fil.length] = '1-dormitorio'; else fil[fil.length] = fdor+'-dormitorios'; } if(fban!=0) { if(fban==1) fil[fil.length] = '1-bano'; else fil[fil.length] = fban+'-banos'; } if(fpde!=0) { fil[fil.length] = 'precio-desde-'+fpde; } if(fpha!=0) { fil[fil.length] = 'precio-hasta-'+fpha; } if(ffecha!=0) { if(ffecha==1) fil[fil.length] = 'ultima-semana'; if(ffecha==2) fil[fil.length] = 'ultimo-mes'; if(ffecha==3) fil[fil.length] = 'destacados'; } if(obj=='ln_ascensor') { fil[fil.length] = 'ascensor'; } else { if($("#fl_ascensor").is(':checked')) fil[fil.length] = 'ascensor'; } if(obj=='ln_terraza') { fil[fil.length] = 'terraza'; } else { if($("#fl_terraza").is(':checked')) fil[fil.length] = 'terraza'; } if(obj=='ln_exterior') { fil[fil.length] = 'exterior'; } else { if($("#fl_exterior").is(':checked')) fil[fil.length] = 'exterior'; } if(obj=='ln_tendedero') { fil[fil.length] = 'tendedero'; } else { if($("#fl_tendedero").is(':checked')) fil[fil.length] = 'tendedero'; } if(obj=='ln_cocina_equipada') { fil[fil.length] = 'cocina-equipada'; } else { if($("#fl_cocina_equipada").is(':checked')) fil[fil.length] = 'cocina-equipada'; } if(obj=='ln_piscina') { fil[fil.length] = 'piscina'; } else { if($("#fl_piscina").is(':checked')) fil[fil.length] = 'piscina'; } if(obj=='ln_trastero') { fil[fil.length] = 'trastero'; } else { if($("#fl_trastero").is(':checked')) fil[fil.length] = 'trastero'; } if(obj=='ln_armarios') { fil[fil.length] = 'armarios'; } else { if($("#fl_armarios").is(':checked')) fil[fil.length] = 'armarios'; } if(ftipo!="") { u = zona + ftipo; if(fil.length>0 || ford!="") { u = u + '-con-'; } } else { u = zona; if(fil.length>0 || ford!="") { u = u + 'con-'; } } if(fil.length>0) { for(i=0;i < fil.length;i++) { u = u + fil[i]; if(i<(fil.length-1)) u = u + ','; } } if(ford!="") { if(fil.length>0) { u = u + ',ordenado-por_' + ford; } else { u = u + 'ordenado-por_' + ford; } } if(fil.length>0 || ford!="" || ftipo!="") { u = u + '/'; } navegar('/' + u); } function redireccionSinTipo(obj) { var tmp_e; tmp_e = document.getElementById('jsv_tft').value; if (obj!="") { if (tmp_e!="") { enlace = obj.replace("/con-","/"+ tmp_e +"-con"); } else { enlace = obj; } navegar(enlace); } } var jsv_c, jsv_d, jsv_e, jsv_e2, jsv_f; function cargarSubzonasCombo() { var tmp_e; tmp_e = document.getElementById('jsv_c'); if(tmp_e) jsv_c = tmp_e.value; tmp_e = document.getElementById('jsv_d'); if(tmp_e) jsv_d = tmp_e.value; tmp_e = document.getElementById('jsv_e'); if(tmp_e) jsv_e = tmp_e.value; jsv_e2 = jsv_e.split("|"); tmp_e = document.getElementById('jsv_f'); if(tmp_e) jsv_f = tmp_e.value; //carga otros li despues del li con la clase zona_seleccionada valor = jsv_c; $.ajax({ type: 'POST', url: "/cargador_subzonas.php", data: {'zonas':valor,'pre':jsv_f,'post':jsv_d}, async : false, }).done(function(data) { if(jsv_e2[0]==1) { $(data).insertAfter( ".zona_seleccionada" ); } else if(jsv_e2[1]==1) { $(data).insertAfter( ".subzona_seleccionada" ); } }); } var combo1Cargado = 0; function cargarZonasCombo1(totales) { /*alert("aaab") $('#comboZona01 .capa_combo .options').css({ "max-height": "300px", "min-height": "300px", "overflow": "auto" });*/ if (combo1Cargado==0) { var tmp_e; tmp_e = document.getElementById('jsv_z1'); if(tmp_e) jsv_z1 = tmp_e.value; //carga los li en el combo valor = jsv_z1; $.ajax({ type: 'POST', url: "/cargador_inner_combo.php", data: {'zonas':valor, 'totales':totales}, async : false, }).done(function(data) { $('#combo_zona_01').html(data) combo1Cargado = 1 $("#comboZona01 .clickOculto input, #comboZona02 .clickOculto input, #comboZona03 .clickOculto input").click(function(e) { e.preventDefault(); cargarEnlaceZona($(this).val()); }); }); } } var combo2Cargado = 0; function cargarZonasCombo2(totales) { if (combo2Cargado==0) { var tmp_e; tmp_e = document.getElementById('jsv_z2'); if(tmp_e) jsv_z2 = tmp_e.value; //carga los li en el combo valor = jsv_z2; $.ajax({ type: 'POST', url: "/cargador_inner_combo.php", data: {'zonas':valor, 'totales':totales}, async : false, }).done(function(data) { $('#combo_zona_02').html(data) combo2Cargado = 1 $("#comboZona01 .clickOculto input, #comboZona02 .clickOculto input, #comboZona03 .clickOculto input").click(function(e) { e.preventDefault(); cargarEnlaceZona($(this).val()); }); }); } } var combo3Cargado = 0; function cargarZonasCombo3(totales) { if (combo3Cargado==0) { var tmp_e; tmp_e = document.getElementById('jsv_z3'); if(tmp_e) jsv_z3 = tmp_e.value; //carga los li en el combo valor = jsv_z3; $.ajax({ type: 'POST', url: "/cargador_inner_combo.php", data: {'zonas':valor, 'totales':totales}, async : false, }).done(function(data) { $('#combo_zona_03').html(data) combo3Cargado = 1 $("#comboZona01 .clickOculto input, #comboZona02 .clickOculto input, #comboZona03 .clickOculto input").click(function(e) { e.preventDefault(); cargarEnlaceZona($(this).val()); }); }); } } function cargarExplorarzonasCombo() { var tmp_e; var jsv_j, jsv_p; tmp_e = document.getElementById('jsv_j'); if(tmp_e) jsv_j = tmp_e.value; var jsv_k, jsv_e, jsv_l; tmp_e = document.getElementById('jsv_k'); if(tmp_e) jsv_k = tmp_e.value; jsv_k2 = jsv_k.split("|"); tmp_e = document.getElementById('jsv_e'); if(tmp_e) jsv_e = tmp_e.value; jsv_e2 = jsv_e.split("|"); tmp_e = document.getElementById('jsv_l'); if(tmp_e) jsv_l = tmp_e.value; jsv_l2 = jsv_l.split("|"); tmp_e = document.getElementById('jsv_ll'); if(tmp_e) jsv_ll = tmp_e.value; jsv_ll2 = jsv_ll.split("|"); var jsv_a, jsv_b; tmp_e = document.getElementById('jsv_p'); if(tmp_e) jsv_p = tmp_e.value; if(jsv_k2[2]=="1") { zona=''; for(i=0;i < jsv_l2.length;i++) { zona=zona+jsv_l2[i]+'/'; } $.ajax({ type: 'POST', url: "/cargador_explorar.php", data: {'u': zona}, async : false, }).done(function(data) { $("#explorar2").html(data); }); } if(jsv_k2[3]=="1") { zona=''; for(i=0;i < jsv_ll2.length;i++) { zona=zona+jsv_ll2[i]+'/'; } $.ajax({ type: 'POST', url: "/cargador_explorar.php", data: {'u': zona}, async : false, }).done(function(data) { $("#explorar1").html(data); }); } } function abrirFancyboxmv(capa) { $.fancybox({ href: capa, type: 'inline' }); } function abrirFancyboxAjaxmv(url) { $.fancybox({ href: url, type: 'ajax' }); } function InitPropertyCarousel() { $('.carousel.property .content li img').on({ click: function(e) { var src = $(this).attr('src'); var img = $(this).closest('.carousel.property').find('.preview img'); img.attr('src', src); $('.carousel.property .content li').each(function() { $(this).removeClass('active'); }); $(this).closest('li').addClass('active'); } }) } function InitTabs() { $('.tabs a').click(function (e) { e.preventDefault(); $(this).tab('show'); }); } function InitAccordion() { $('.accordion').on('show', function (e) { $(e.target).prev('.accordion-heading').find('.accordion-toggle').addClass('active'); }); $('.accordion').on('hide', function (e) { $(this).find('.accordion-toggle').not($(e.target)).removeClass('active'); }); } function InitEzmark() { $('input[type="checkbox",class!="noformateado"]').ezMark(); $('input[type="radio",class!="noformateado"]').ezMark(); } function InitChosen() { $("select[class!='noformateado']").chosen({ disable_search_threshold: 10, no_results_text: "No hemos encontrado nada para" }); } function InitOffCanvasNavigation() { $('#btn-nav').on({ click: function() { $('body').toggleClass('nav-open'); } }) } function resicear() { $('#main .carousel .content ul').carouFredSel({ scroll: { items: 1 }, align: "center", auto: false, next: { button: '#main .carousel-next', key: 'right' }, prev: { button: '#main .carousel-prev', key: 'left' } }); } function mostrarSub(cual) { estado = $("#submenu_"+ cual).css('display') if (estado == "none") { $('#submenu_precio').show(); $("#menu_"+ cual).removeClass( "sinenlace" ).addClass( "selected" ); } else { $('#submenu_precio').hide(); $("#menu_"+ cual).removeClass( "selected" ).addClass( "sinenlace" ); } } function InitCarousel() { setTimeout(resicear,200); $('.carousel-wrapper .content ul').carouFredSel({ scroll: { items: 1 }, auto: false, next: { button: '.carousel-wrapper .carousel-next', key: 'right' }, prev: { button: '.carousel-wrapper .carousel-prev', key: 'left' } }); } function leeCookie(nombre) { var cookies=document.cookie; if(!cookies) return false; var comienzo=cookies.indexOf(nombre); if(comienzo==-1) return false; comienzo=comienzo+nombre.length+1; cantidad=cookies.indexOf("; ", comienzo)-comienzo; if(cantidad<=0) cantidad=cookies.length; return cookies.substr(comienzo, cantidad); } function validacionContactoFoot(){ if (document.getElementById('foot_contactoName').value == ""){ alert("El nombre es un campo obligatorio"); return(false); } if (document.getElementById('foot_contactotMsg').value == ""){ alert("El mensaje es un campo obligatorio"); return(false); } if (document.getElementById('foot_contactotEmail').value == ""){ alert("Tu email es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('foot_contactotEmail').value) ){ alert("Error: La dirección de correo " + document.getElementById('foot_contactotEmail').value + " es incorrecta."); return(false); } } document.getElementById('formContactofoot').submit(); } function revisarCampos(){ if (document.getElementById('inputName').value == ""){ alert("El nombre es un campo obligatorio"); return(false); } if (document.getElementById('inputEmail').value == "" && document.getElementById('inputPhone').value == ""){ alert("Debes insertar un Email o un telefono"); return(false); }else{ if (document.getElementById('inputEmail').value != ""){ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('inputEmail').value) ){ alert("Error: La dirección de correo " + document.getElementById('inputEmail').value + " es incorrecta."); return(false); } } } document.getElementById('formularioContacto').submit(); } function revisarCamposRegistroAnuncio(){ mensaje_alerta=""; if (document.getElementById('inputRegisterFirstName').value == "" && document.getElementById('tipo').value == 1){ mensaje_alerta += "
   • El nombre es un campo obligatorio."; $( "#inputRegisterFirstName" ).addClass( "alerta"); //alert("El nombre es un campo obligatorio"); //return(false); } else { $( "#inputRegisterFirstName" ).removeClass( "alerta" ) } if (document.getElementById('inputRegisterApellidos').value == "" && document.getElementById('tipo').value == 1){ //alert("Los apellidos es un campo obligatorio"); mensaje_alerta += "
   • Los apellidos es un campo obligatorio."; $( "#inputRegisterApellidos" ).addClass( "alerta"); //return(false); } else { $( "#inputRegisterApellidos" ).removeClass( "alerta" ) } if (document.getElementById('inputRegisterEmail').value == ""){ mensaje_alerta += "
   • Tu email es un campo obligatorio."; $( "#inputRegisterEmail" ).addClass( "alerta"); }else{ $( "#inputRegisterEmail" ).removeClass( "alerta" ) expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('inputRegisterEmail').value) ){ mensaje_alerta += "
   • La dirección de correo tiene formato incorrecto ."; $( "#inputRegisterEmail" ).addClass( "alerta"); } else { $( "#inputRegisterEmail" ).removeClass( "alerta" ) //error='no'; $.ajax({ type: 'GET', url: 'ajax_verificar_email.php?email='+document.getElementById('inputRegisterEmail').value, data: $(this).serialize(), async: false, // Mostramos un mensaje con la respuesta de PHP success: function(data) { //alert(data) error=data if ( error=='si' ){ mensaje_alerta += "
   • La dirección de correo ya existe en nuestra base de datos ."; // alert(mensaje_alerta) $( "#inputRegisterEmail" ).addClass( "alerta"); } else { $( "#inputRegisterEmail" ).removeClass( "alerta" ) } } }); } } if (document.getElementById('inputRegisterPassword').value != document.getElementById('inputRegisterRetype').value){ mensaje_alerta += "
   • Contraseñas deben coincidir."; $( "#inputRegisterPassword" ).addClass( "alerta"); }else{ if (document.getElementById('inputRegisterPassword').value != ""){ $( "#inputRegisterPassword" ).removeClass( "alerta" ) campo=document.getElementById('inputRegisterPassword'); var RegExPattern = /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/; var errorMessage = 'Recuerde la contraseña debe tener Mayúsculas, Minúsculas y Números, y un mínimo de 8 caracteres'; if ((campo.value.match(RegExPattern)) && (campo.value!='')) { $( "#inputRegisterPassword" ).removeClass( "alerta" ) $( "#inputRegisterRetype" ).removeClass( "alerta" ) } else { mensaje_alerta += "
   • Recuerde la contraseña debe tener Mayúsculas, Minúsculas y Números, y un mínimo de 8 caracteres."; $( "#inputRegisterPassword" ).addClass( "alerta"); $( "#inputRegisterRetype" ).addClass( "alerta"); } }else{ mensaje_alerta += "
   • Debes insertar una contraseña."; $( "#inputRegisterPassword" ).addClass( "alerta"); } } if(mensaje_alerta!=''){ $('html, body').stop().animate({ scrollTop: jQuery('#ancla').offset().top }, 1000); $('#capaMensajeError').show(); $('#mensajeError').html("Datos incorrectos:" + mensaje_alerta); return false }else{ $('#capaMensajeError').hide(); $('#mensajeError').html(''); } //return true document.getElementById('registro').submit(); } function revisarCampos2(){ if (document.getElementById('inputName2').value == ""){ alert("El nombre es un campo obligatorio"); return(false); } if (document.getElementById('inputEmail2').value == "" && document.getElementById('inputPhone2').value == ""){ alert("El email es un campo obligatorio"); return(false); }else{ if (document.getElementById('inputEmail2').value == ""){ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('inputEmail2').value) ){ alert("Error: La dirección de correo " + document.getElementById('inputEmail2').value + " es incorrecta."); return(false); } } } document.getElementById('formularioContactoOculto').submit(); } function validacionerror(){ if (document.getElementById('error_mensaje').value == ""){ alert("El mensaje es un campo obligatorio"); return(false); } if (document.getElementById('error_email').value == ""){ alert("Tu email es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('error_email').value) ){ alert("Error: La dirección de correo " + document.getElementById('error_email').value + " es incorrecta."); return(false); } } document.getElementById('formError').submit(); } function validacioncontacto(){ if (document.getElementById('inputContactName').value == ""){ alert("El Nombre es un campo obligatorio"); return(false); } if (document.getElementById('inputContactTelefono').value == ""){ alert("El teléfono es un campo obligatorio"); return(false); } if (document.getElementById('inputContactMessage').value == ""){ alert("El mensaje es un campo obligatorio"); return(false); } if (document.getElementById('inputContactEmail').value == ""){ alert("Tu email es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('inputContactEmail').value) ){ alert("Error: La dirección de correo " + document.getElementById('inputContactEmail').value + " es incorrecta."); return(false); } } document.getElementById('formContacto').submit(); } function validarAltaAnuncio(f) { mensaje_alerta = ""; if (f.nombre.value=="") {mensaje_alerta += "
   • Debe insertar un nombre de contacto."; $( "#nombre" ).addClass( "alerta" );} else {$( "#nombre" ).removeClass( "alerta" );} if (f.email.value=="") { mensaje_alerta += "
   • Debe insertar un email de contacto."; $( "#email" ).addClass( "alerta" ); } else { $( "#email" ).removeClass( "alerta" ); expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(f.email.value) ){ mensaje_alerta += "
   • Formato de email incorrecto."; $( "#email" ).addClass( "alerta" ); } else { $( "#email" ).removeClass( "alerta" ); } } if (f.dic_inmo_tipoinmueble.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de inmueble."; $( "#dic_inmo_tipoinmueble_chzn" ).addClass( "alerta" ); } else if (f.dic_inmo_tipoinmueble.value=="0") { $( "#dic_inmo_tipoinmueble_chzn" ).removeClass( "alerta" ); if (f.dic_inmo_tipoinmueble2.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de casa o piso."; $( "#dic_inmo_tipoinmueble2_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_tipoinmueble2_chzn" ).removeClass( "alerta" ); } } else { $( "#dic_inmo_tipoinmueble_chzn" ).removeClass( "alerta" ); } if (f.operacion.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de operación del anuncio."; $( "#operacion_chzn" ).addClass( "alerta" ); } else { $( "#operacion_chzn" ).removeClass( "alerta" ); } if (f.m2construidos.value=="") { mensaje_alerta += "
   • Debe indicar la superficie del inmueble."; $( "#m2construidos" ).addClass( "alerta" ); } else if (formatoNumerico(f.m2construidos.value)) { //alert("La superficie debe ser un campo numérico"); f.m2construidos.focus(); return false; mensaje_alerta += "
   • La superficie debe ser un campo numérico."; $( "#m2construidos" ).addClass( "alerta" ); } else { $( "#m2construidos" ).removeClass( "alerta" ); } if (formatoNumerico(f.gastoscomunidad.value)) { mensaje_alerta += "
   • El Gasto Comunidad debe ser un campo numérico."; $( "#gastoscomunidad" ).addClass( "alerta" ); } else { $( "#gastoscomunidad" ).removeClass( "alerta" ); } if (formatoNumerico(f.m2utiles.value)) { //alert("La superficie debe ser un campo numérico"); f.m2construidos.focus(); return false; mensaje_alerta += "
   • La superficie debe ser un campo numérico."; $( "#m2utiles" ).addClass( "alerta" ); } else { $( "#m2utiles" ).removeClass( "alerta" ); } if (f.precio.value=="") { mensaje_alerta += "
   • Debe indicar el precio del inmueble."; $( "#precio" ).addClass( "alerta" ); } else if (formatoNumerico(f.precio.value)) { mensaje_alerta += "
   • El precio debe ser un campo numérico."; $( "#precio" ).addClass( "alerta" ); } else { $( "#precio" ).removeClass( "alerta" ); } if (f.dic_inmo_tipoinmueble.value=="0") { if (f.dormitorios.value=="") { mensaje_alerta += "
   • Debe indicar las habitaciones del inmueble."; $( "#dormitorios" ).addClass( "alerta" ); } else if (isNaN(f.dormitorios.value)) { mensaje_alerta += "
   • Las habitaciones debe ser un campo numérico."; $( "#dormitorios" ).addClass( "alerta" ); } else { $( "#dormitorios" ).removeClass( "alerta" ); } } else { $( "#dormitorios" ).removeClass( "alerta" ); } if (f.dic_inmo_tipoinmueble.value=="0" || f.dic_inmo_tipoinmueble.value=="9" || f.dic_inmo_tipoinmueble.value=="12") { if (f.banos.value=="") { mensaje_alerta += "
   • Debe indicar los baños del inmueble."; $( "#banos" ).addClass( "alerta" ); } else if (isNaN(f.banos.value)) { mensaje_alerta += "
   • Los baños debe ser un campo numérico."; $( "#banos" ).addClass( "alerta" ); } else { $( "#banos" ).removeClass( "alerta" ); } } else { $( "#banos" ).removeClass( "alerta" ); } //validacion CP que sea de madrid var isnum = /^\d\d\d$/.test(f.cp.value.substring(2, 5)); if(f.cp.value.length!=5 || f.cp.value.substring(0, 2)!='28' || !isnum) { mensaje_alerta += "
   • Debe indicar un código postal de Madrid."; $( "#cp" ).addClass( "alerta" ); } else { $( "#cp" ).removeClass( "alerta" ); } if (f.barrio.value=="" || f.latitud.value=="" || f.longitud.value=="") { mensaje_alerta += "
   • Debe validar la dirección del inmueble."; } if (f.dic_inmo_estado.value=="") { mensaje_alerta += "
   • Debe seleccionar el estado del inmueble."; $( "#dic_inmo_estado_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_estado_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_suelo.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de suelo."; $( "#dic_inmo_suelo_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_suelo_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_plazasgaraje.value=="") { mensaje_alerta += "
   • Debe seleccionar las plazas de garaje."; $( "#dic_inmo_plazasgaraje_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_plazasgaraje_chzn" ).removeClass( "alerta" ); } if(f.dic_inmo_tipoinmueble.value!="11") { if (f.new_exterior.value=="") { mensaje_alerta += "
   • Debe seleccionar si es interior o exterior."; $( "#new_exterior_chzn" ).addClass( "alerta" ); } else { $( "#new_exterior_chzn" ).removeClass( "alerta" ); } if (f.new_ascensor.value=="") { mensaje_alerta += "
   • Debe seleccionar el ascensor."; $( "#new_ascensor_chzn" ).addClass( "alerta" ); } else { $( "#new_ascensor_chzn" ).removeClass( "alerta" ); } } if (f.dic_inmo_planta.value=="") { mensaje_alerta += "
   • Debe seleccionar la planta."; $( "#dic_inmo_planta_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_planta_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_aireacondicionado.value=="") { mensaje_alerta += "
   • Debe seleccionar el aire acondicionado."; $( "#dic_inmo_aireacondicionado_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_aireacondicionado_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_calefaccion.value=="") { mensaje_alerta += "
   • Debe seleccionar la calefacción."; $( "#dic_inmo_calefaccion_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_calefaccion_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_calefaccion_tipo.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de calefacción."; $( "#dic_inmo_calefaccion_tipo_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_calefaccion_tipo_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_aguacaliente.value=="") { mensaje_alerta += "
   • Debe seleccionar el agua caliente."; $( "#dic_inmo_aguacaliente_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_aguacaliente_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_aguacaliente_tipo.value=="") { mensaje_alerta += "
   • Debe seleccionar el tipo de agua caliente."; $( "#dic_inmo_aguacaliente_tipo_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_aguacaliente_tipo_chzn" ).removeClass( "alerta" ); } if (f.dic_inmo_terraza.value=="") { mensaje_alerta += "
   • Debe seleccionar la terraza."; $( "#dic_inmo_terraza_chzn" ).addClass( "alerta" ); } else { $( "#dic_inmo_terraza_chzn" ).removeClass( "alerta" ); } if (f.new_trastero.value=="") { mensaje_alerta += "
   • Debe seleccionar el trastero."; $( "#new_trastero_chzn" ).addClass( "alerta" ); } else { $( "#new_trastero_chzn" ).removeClass( "alerta" ); } if (f.new_piscina.value=="") { mensaje_alerta += "
   • Debe seleccionar la piscina."; $( "#new_piscina_chzn" ).addClass( "alerta" ); } else { $( "#new_piscina_chzn" ).removeClass( "alerta" ); } if (mensaje_alerta=="") { $('#dic_inmo_tipovia').prop('disabled', false).trigger("liszt:updated"); $('#nombrevia').prop('disabled',false); $('#numero').prop('disabled',false); $('#cp').prop('disabled',false); f.precio.value = f.precio.value.replace(".",""); f.precio.value = f.precio.value.replace(",","."); f.gastoscomunidad.value = f.gastoscomunidad.value.replace(".",""); f.gastoscomunidad.value = f.gastoscomunidad.value.replace(",","."); return true } else { $('html, body').stop().animate({ scrollTop: jQuery('#ancla').offset().top }, 1000); $('#capaMensajeError').show(); $('#mensajeError').html("Datos incorrectos:" + mensaje_alerta); return false } } function comprobarCP() { codigo_postal = document.getElementById("cp").value //validacion CP que sea de madrid if (codigo_postal.length>4) { var isnum = /^\d\d\d$/.test(codigo_postal.substring(2, 5)); if(codigo_postal.length!=5 || codigo_postal.substring(0, 2)!='28' || !isnum) { $( "#cp" ).addClass( "alerta" ); $("#capa_aviso_cp").slideDown(); $("#capa_listado_calles").slideUp(); } else { //todo bien, cargamos calles $("#capa_listado_calles_2").html("Cargando calles..."); $("#capa_aviso_dire").slideUp(); document.getElementById("nombrevia").value = "" document.getElementById("direccion_auto2").value = "" $.ajax({ type: 'GET', url: 'cargador_calles.php?cp='+ codigo_postal, data: $(this).serialize(), async: false, // Mostramos un mensaje con la respuesta de PHP success: function(data) { if (data=="no") { $("#capa_listado_calles_2").html('No se encontraron calles para ese código postal. Rellena los siguientes campos:'); $('#capa_direccion_manual').slideDown(); } else { $("#capa_listado_calles_2").html(data); $("#direccion_auto").chosen(); $("#capa_aviso_dire").slideDown(); $('#capa_direccion_manual').slideUp(); } } }); $("#capa_listado_calles").slideDown(); $("#capa_aviso_cp").slideUp(); } } else { $( "#cp" ).removeClass( "alerta" ); $("#capa_aviso_cp").slideUp(); $("#capa_listado_calles").slideUp(); } } function mostrarAvisoDire(cual) { if (cual.value=="") { $("#capa_aviso_dire").slideDown(); document.getElementById("direccion_auto2").value = "" } else { $("#capa_aviso_dire").slideUp(); document.getElementById("nombrevia").value = "" document.getElementById("direccion_auto2").value = cual.value } } function comprobarDireccion() { es_alta = document.getElementById("alta").value valor_direccion = document.getElementById("direccion_auto") valor_tipo = document.getElementById("dic_inmo_tipovia") valor_nombre = document.getElementById("nombrevia") valor_numero = document.getElementById("numero") valor_cp = document.getElementById("cp") var isnum = /^\d\d\d$/.test(valor_cp.value.substring(2, 5)); if (valor_cp.value=="") { alert("Debe indicar el código postal") } else if(valor_cp.value.length!=5 || valor_cp.value.substring(0, 2)!='28' || !isnum) { //validacion CP que sea de madrid alert("Debe indicar un código postal de Madrid"); } else if (valor_numero.value=="") { alert("Debe indicar el número de la vía") } else { direccion_ok = ""; tipo_via_ok = "0"; if (valor_direccion) { if (valor_direccion.value !="") { direccion_ok = valor_direccion.value } else { if (valor_tipo.value=="") { alert("Debe seleccionar una dirección") } else if (valor_nombre.value=="") { alert("Debe seleccionar una dirección") } else { tipo_via_ok = valor_tipo.value; direccion_ok = valor_nombre.value; } } } else { if (valor_tipo.value=="") { alert("Debe seleccionar el tipo de vía") } else if (valor_nombre.value=="") { alert("Debe indicar el nombre de la vía") } else { tipo_via_ok = valor_tipo.value; direccion_ok = valor_nombre.value; } } if (direccion_ok!="") { //geolocalizamos $('#direccion_auto').prop('disabled', true).trigger("liszt:updated"); $('#dic_inmo_tipovia').prop('disabled', true).trigger("liszt:updated"); $('#nombrevia').prop('disabled',true); $('#numero').prop('disabled',true); if (es_alta=="1") { $('#cp').prop('disabled',true); } $("#capa_btn_validar").html('
validando dirección.. Un momento, por favor..
'); $.ajax({ type: 'GET', url: 'localizar_direccion.php?tipo='+ tipo_via_ok +'&direccion=' + direccion_ok +'&numero=' + valor_numero.value +'&cp=' + valor_cp.value, data: $(this).serialize(), // Mostramos un mensaje con la respuesta de PHP success: function(data) { if (data=="no") { $("#capa_btn_validar").html('
No se ha podido localizar la dirección insertada. Por favor vuelva a intentarlo.
  Validar dirección'); } else { // alert(data) separacion = data.split("|"); barrio = separacion[0]; latitud = separacion[1]; longitud = separacion[2]; document.getElementById("barrio").value = barrio document.getElementById("latitud").value = latitud document.getElementById("longitud").value = longitud var myLatlng = new google.maps.LatLng(latitud,longitud); var mapOptions = { center: myLatlng, zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false }; var map = new google.maps.Map(document.getElementById("mapa-alta"), mapOptions); var image = 'images/beachflag.png'; var marker = new google.maps.Marker({ position: myLatlng, map: map }); $("#capa_mapa").slideDown(); $("#capa_btn_validar").html('  Cambiar dirección'); } } }); } } } function resetearDireccion() { es_alta = document.getElementById("alta").value //ponemos que se pueda modificar el codigo postal es_alta = "1" $('#direccion_auto').prop('disabled', false).trigger("liszt:updated"); $('#dic_inmo_tipovia').prop('disabled', false).trigger("liszt:updated"); $('#nombrevia').prop('disabled',false); $('#numero').prop('disabled',false); if (es_alta=="1") { $('#cp').prop('disabled',false); } valor_nombre = document.getElementById("nombrevia") valor_numero = document.getElementById("numero") valor_cp = document.getElementById("cp") $('#direccion_auto').val(""); $('#direccion_auto').trigger("liszt:updated"); $('#capa_aviso_dire').slideDown(); $('#dic_inmo_tipovia').val(""); $('#dic_inmo_tipovia').trigger("liszt:updated"); valor_nombre.value = "" valor_numero.value = "" if (es_alta=="1") { valor_cp.value = "" } if (es_alta=="1") { $("#capa_listado_calles").slideUp(); } if (es_alta=="1") { $("#capa_direccion_manual").slideUp(); } document.getElementById("barrio").value = "" document.getElementById("latitud").value = "" document.getElementById("longitud").value = "" document.getElementById("direccion_auto2").value = "" $("#capa_btn_validar").html('  Validar dirección'); } function validarModAnuncio(f) { mensaje_alerta = ""; if (f.nombre.value=="") {mensaje_alerta += "\n • Debe insertar un nombre de contacto."; $( "#nombre" ).addClass( "alerta" );} else {$( "#nombre" ).removeClass( "alerta" );} if (f.email.value=="") { mensaje_alerta += "
   • Debe insertar un email de contacto."; $( "#email" ).addClass( "alerta" ); } else { $( "#email" ).removeClass( "alerta" ); expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(f.email.value) ){ mensaje_alerta += "
   • Formato de email incorrecto."; $( "#email" ).addClass( "alerta" ); } else { $( "#email" ).removeClass( "alerta" ); } } if (f.m2construidos.value=="") { mensaje_alerta += "
   • Debe indicar la superficie del inmueble."; $( "#m2construidos" ).addClass( "alerta" ); } else if (formatoNumerico(f.m2construidos.value)) { alert("La superficie debe ser un campo numérico"); f.m2construidos.focus(); return false; mensaje_alerta += "
   • La superficie debe ser un campo numérico."; $( "#m2construidos" ).addClass( "alerta" ); } else { $( "#m2construidos" ).removeClass( "alerta" ); } if (formatoNumerico(f.gastoscomunidad.value)) { mensaje_alerta += "
   • El Gasto Comunidad debe ser un campo numérico."; $( "#gastoscomunidad" ).addClass( "alerta" ); } else { $( "#gastoscomunidad" ).removeClass( "alerta" ); } if (formatoNumerico(f.m2utiles.value)) { //alert("La superficie debe ser un campo numérico"); f.m2construidos.focus(); return false; mensaje_alerta += "
   • La superficie debe ser un campo numérico."; $( "#m2utiles" ).addClass( "alerta" ); } else { $( "#m2utiles" ).removeClass( "alerta" ); } if (f.precio.value=="") { mensaje_alerta += "
   • Debe indicar el precio del inmueble."; $( "#precio" ).addClass( "alerta" ); } else if (formatoNumerico(f.precio.value)) { mensaje_alerta += "
   • El precio debe ser un campo numérico."; $( "#precio" ).addClass( "alerta" ); } else { $( "#precio" ).removeClass( "alerta" ); } if (f.dic_inmo_tipoinmueble.value=="0") { if (f.dormitorios.value=="") { mensaje_alerta += "
   • Debe indicar las habitaciones del inmueble."; $( "#dormitorios" ).addClass( "alerta" ); } else if (isNaN(f.dormitorios.value)) { mensaje_alerta += "
   • Las habitaciones debe ser un campo numérico."; $( "#dormitorios" ).addClass( "alerta" ); } else { $( "#dormitorios" ).removeClass( "alerta" ); } } else { $( "#dormitorios" ).removeClass( "alerta" ); } if (f.dic_inmo_tipoinmueble.value=="0" || f.dic_inmo_tipoinmueble.value=="9" || f.dic_inmo_tipoinmueble.value=="12") { if (f.banos.value=="") { mensaje_alerta += "
   • Debe indicar los baños del inmueble."; $( "#banos" ).addClass( "alerta" ); } else if (isNaN(f.banos.value)) { mensaje_alerta += "
   • Los baños debe ser un campo numérico."; $( "#banos" ).addClass( "alerta" ); } else { $( "#banos" ).removeClass( "alerta" ); } } else { $( "#banos" ).removeClass( "alerta" ); } if (mensaje_alerta=="") { $('#dic_inmo_tipovia').prop('disabled', false).trigger("liszt:updated"); $('#nombrevia').prop('disabled',false); $('#numero').prop('disabled',false); f.precio.value = f.precio.value.replace(".",""); f.precio.value = f.precio.value.replace(",","."); f.gastoscomunidad.value = f.gastoscomunidad.value.replace(".",""); f.gastoscomunidad.value = f.gastoscomunidad.value.replace(",","."); return true } else { $('html, body').stop().animate({ scrollTop: jQuery('#ancla').offset().top }, 1000); $('#capaMensajeError').show(); $('#mensajeError').html("Datos incorrectos:" + mensaje_alerta); return false } } function validarModAnuncioDireccion(f) { mensaje_alerta = ""; //validacion CP que sea de madrid var isnum = /^\d\d\d$/.test(f.cp.value.substring(2, 5)); if(f.cp.value.length!=5 || f.cp.value.substring(0, 2)!='28' || !isnum) { mensaje_alerta += "
   • Debe indicar un código postal de Madrid."; $( "#cp" ).addClass( "alerta" ); } else { $( "#cp" ).removeClass( "alerta" ); } if (f.barrio.value=="" || f.latitud.value=="" || f.longitud.value=="") { mensaje_alerta += "
   • Debe validar la dirección del inmueble."; } if (mensaje_alerta=="") { $('#dic_inmo_tipovia').prop('disabled', false).trigger("liszt:updated"); $('#nombrevia').prop('disabled',false); $('#numero').prop('disabled',false); return true } else { $('html, body').stop().animate({ scrollTop: jQuery('#ancla').offset().top }, 1000); $('#capaMensajeError').show(); $('#mensajeError').html("Datos incorrectos:" + mensaje_alerta); return false } } function validarAcceso(f) { mensaje_alerta = ""; if (f.inputLoginPassword.value=="") {mensaje_alerta += "\n • Debes insertar la contraseña."; $( "#inputLoginPassword" ).addClass( "alerta" );} else {$( "#inputLoginPassword" ).removeClass( "alerta" );} if (mensaje_alerta=="") { return true } else { $('html, body').stop().animate({ scrollTop: jQuery('#ancla').offset().top }, 1000); $('#capaMensajeError').show(); $('#mensajeError').html("Datos incorrectos:" + mensaje_alerta); return false } } function formatoNumerico(valor){ valor = valor.replace(".",""); valor = valor.replace(",","."); if (isNaN(valor)){ if (valor==""){ return false; }else{ return true; } }else{ return false; } } function revisarCamposNovedades(f) { if (f.email.value == ""){ alert("Tu email es un campo obligatorio"); return false; }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(f.email.value) ){ alert("Error: La dirección de correo " + f.email.value + " es incorrecta."); return false; } } return true } function validacionavisar(codigo) { var tmp_e; var jsv_g; tmp_e = document.getElementById('jsv_g'); if(tmp_e) jsv_g = tmp_e.value; if (document.getElementById('precio_email').value == ""){ alert("Tu email es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('precio_email').value) ){ alert("Error: La dirección de correo " + document.getElementById('precio_email').value + " es incorrecta."); return(false); } } document.getElementById('formPrecio').submit(); if(jsv_g=='r') { ga('send', 'event', { eventCategory: 'formularios', eventAction: 'aviso_bajada_precio', eventLabel: codigo }); } } function validacionamigo(){ var tmp_e; var jsv_h; tmp_e = document.getElementById('jsv_h'); if(tmp_e) jsv_h = tmp_e.value; if (document.getElementById('amigo_mensaje').value == ""){ alert("El mensaje es un campo obligatorio"); return(false); } if (document.getElementById('amigo_email1').value == ""){ alert("Tu email es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('amigo_email1').value) ){ alert("Error: La dirección de correo " + document.getElementById('amigo_email1').value + " es incorrecta."); return(false); } } if (document.getElementById('amigo_email2').value == ""){ alert("El email destino es un campo obligatorio"); return(false); }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(document.getElementById('amigo_email2').value) ){ alert("Error: La dirección de correo " + document.getElementById('amigo_email2').value + " es incorrecta."); return(false); } } ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'enviar_amigo', eventLabel: jsv_h }); document.getElementById('formAmigo').submit(); } function GooIrA(dire, codigo) { document.location = 'https://www.madridvivienda.com/' + dire; ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'listado_mapa', eventLabel: codigo }); } function cargaJSmapas2() { var element = document.createElement("script"); element.src = "/assets/js/gmap3.infobox.min.js"; document.body.appendChild(element); } function cargaJSmapas1() { var element = document.createElement("script"); element.src = "/assets/js/gmap3.min.js"; document.body.appendChild(element); } // Add a script element as a child of the body function downloadJSAtOnload() { var element = document.createElement("script"); element.src = "http://maps.googleapis.com/maps/api/js?v=3&sensor=true&callback=cargaJSmapas1"; document.body.appendChild(element); } function validarFiltroMapaListado(){ var tmp_e; var jsv_i; tmp_e = document.getElementById('jsv_i'); if(tmp_e) jsv_i = tmp_e.value; zona = document.getElementById('combo_zona').value; subzona = document.getElementById('combo_subzona_'+zona).value; if (subzona!=""){ zona = subzona; } if(jsv_i=="V") { cadOp = 'venta'; } if(jsv_i=="A") { cadOp = 'alquiler'; } cadTipologia = document.getElementById('combo_tipologia').value; cadTipologia2 = ""; if(cadTipologia=='pisos') { cadTipologia = "viviendas"; cadTipologia2 = "pisos/"; } if(cadTipologia=='aticos') { cadTipologia = "viviendas"; cadTipologia2 = "aticos/"; } if(cadTipologia=='estudios') { cadTipologia = "viviendas"; cadTipologia2 = "estudios/"; } if(cadTipologia=='duplex') { cadTipologia = "viviendas"; cadTipologia2 = "duplex/"; } if(cadTipologia=='chalets') { cadTipologia = "viviendas"; cadTipologia2 = "chalets/"; } document.location.href='/'+cadOp+'-'+cadTipologia+'/'+zona+"/" + cadTipologia2; } function cambiarZonaComboListado(valor){ $("#capaCombo_madrid").hide(); $("#capaCombo_zona-norte").hide(); $("#capaCombo_zona-noroeste").hide(); $("#capaCombo_zona-noreste").hide(); $("#capaCombo_zona-sur").hide(); $("#capaCombo_zona-sureste").hide(); $("#capaCombo_zona-suroeste").hide(); $("#capaCombo_" + valor).show(); } function createCookieLey() { days = 364; name = 'ley_cookies_aceptadas'; value = 'si'; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function documentReadyListado() { /*$('#comboZona01 .capa_combo .options').css({ "max-height": "0px", "overflow": "hidden" });*/ $(".clickable").click(function() { window.location.href = $(this).find('.clickablelink').attr('href'); }); $("#capa_boton_mostrar_mapa").click(function() { mostrarMapa(); }); $("#comboZona01 .clickOculto input, #comboZona02 .clickOculto input, #comboZona03 .clickOculto input").click(function(e) { e.preventDefault(); cargarEnlaceZona($(this).val()); }); $("#contenido_ver_mapa").click(function() { mostrarMapaGoogle(); }); $(".clickform,#btn_frm_caracteristicas,#btn_frm_precio").click(function() { formFiltros($(this).attr('id')); }); $('.enlacetipologia').click(function(e) { e.preventDefault(); formFiltros($(this).attr('id')); }); $('.enlacedormitorios').click(function(e) { e.preventDefault(); formFiltros($(this).attr('id')); }); $('.enlacecaracteristica').click(function(e) { e.preventDefault(); formFiltros($(this).attr('id')); }); $('.enlacefechapub').click(function(e) { e.preventDefault(); formFiltros($(this).attr('id')); }); $('#desplegadorf').click(function(e) { e.preventDefault(); $('#capa_filtros_mb').slideToggle(); }); // hide #back-top first $("#back-top").hide(); // fade in #back-top $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#back-top').fadeIn(); } else { $('#back-top').fadeOut(); } }); // scroll body to 0px on click $('#back-top a').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); }); /*$( "body" ).mousemove(function( event ) { if (mousemovido==0) { mousemovido = 1 downloadJSAtOnload() } });*/ $('#ul_tipologias').css( "visibility", "" ); if(leeCookie('ley_cookies_aceptadas')=='si') { AlturaListados = 0; } else { AlturaListados = 30; } var tmp_e; var jsv_j, jsv_p; tmp_e = document.getElementById('jsv_j'); if(tmp_e) jsv_j = tmp_e.value; var jsv_k, jsv_e, jsv_l; tmp_e = document.getElementById('jsv_k'); if(tmp_e) jsv_k = tmp_e.value; jsv_k2 = jsv_k.split("|"); tmp_e = document.getElementById('jsv_e'); if(tmp_e) jsv_e = tmp_e.value; jsv_e2 = jsv_e.split("|"); tmp_e = document.getElementById('jsv_l'); if(tmp_e) jsv_l = tmp_e.value; jsv_l2 = jsv_l.split("|"); var jsv_a, jsv_b; tmp_e = document.getElementById('jsv_p'); if(tmp_e) jsv_p = tmp_e.value; cadT = ""; if(jsv_j!='p') { cadT = jsv_k2[1]; } if(jsv_k2[0]!="" || jsv_k2[1]!="") { $.ajax({ type: 'POST', url: "/stat.php", data: {'u': jsv_k2[0], 'v': cadT}, async : false, }).done(function(data) {}); } if(jsv_e2[0]=="1" && 1==2) { $( "#comboZona01" ).mouseover(function() { if (comboZona01Movido==0) { /*cargarSubzonasCombo();*/ /*cargarExplorarzonasCombo();*/ comboZona01Movido = 1; } }); } /* $( "#comboZona01 .current" ).mouseover(function() { cargarZonasCombo1('si'); });*/ if(jsv_e2[1]=="1" && 1==2) { $( "#comboZona02" ).mouseover(function() { if (comboZona02Movido==0) { /*cargarSubzonasCombo();*/ /*cargarExplorarzonasCombo();*/ comboZona02Movido = 1; } }); } /* $( "#comboZona02" ).mouseover(function() { cargarZonasCombo2('si'); });*/ /*$( "#comboZona03" ).mouseover(function() { cargarZonasCombo3('si'); });*/ /*if(jsv_k2[2]=="1") { zona=''; for(i=0;i < jsv_l2.length;i++) { zona=zona+jsv_l2[i]+'/'; } $.ajax({ type: 'POST', url: "/cargador_explorar.php", data: {'u': zona}, async : false, }).done(function(data) { $("#explorar2").html(data); }); }*/ var miAncho = $(window).width(); //alert(miAncho); var miAlto = $(document).height(); //alert(miAlto) if(jsv_j=='c' && parseInt(miAncho)>640 && miAlto>1600) { $(window).scroll(function() { //alert(jsv_p); if( $(this).scrollTop() > (396-AlturaListados) ) { if( !fixed ) { fixed = true; $('#capa_titulo_h1').css({height:'31px', overflow:'hidden'}); $('#capa_fija_filtro').css({position:'fixed', top:'55px'}); $('#capa_fija_filtro_4').css({position:'fixed', top:'-116px'}); $('#pestanasTipoOperacion').css({display:'none'}); $('#capa_fija_filtro_mapa').css({position:'relative', top:'-340px', height:'170px'}); if (mapa_mostrado2==1) { $('#capa_mapa_map').hide(); } } } else { if( (jsv_p=='0' && fixed && $(this).scrollTop()<20) || (jsv_p!='0' && fixed) ) { fixed = false; $('#capa_titulo_h1').css({height:'inherit', overflow:'inherit'}); $('#capa_fija_filtro').css({position:'inherit', top:'inherit'}); $('#capa_fija_filtro_4').css({position:'inherit', top:'inherit'}); $('#pestanasTipoOperacion').css({display:'block'}); $('#capa_fija_filtro_mapa').css({position:'relative', top:'0px',height:'100%'}); if (mapa_mostrado2==1) { $('#capa_mapa_map').show(); } } } if(jsv_p!='0') { if( $(this).scrollTop() > 1000 ) { $('#capa_fija_filtro_5').css({position:'fixed', top:'100px', maxWidth:'300px'}); $('#capa_bajo_filtro_5').css({margin:'240px 0px 0px'}); }else{ $('#capa_fija_filtro_5').css({position:'inherit', top:'inherit', maxWidth:'100%'}); $('#capa_bajo_filtro_5').css({margin:'20px 0px 0px'}); } } }); } else { $('.navigation-wrapper .navigation .nav li span').not('#menu_precio').click(function(e) { e.preventDefault(); /*$('.navigation-wrapper .navigation .nav li ul').slideToggle();*/ $(this).next().slideToggle(); }); } } function cargarEnlaceZona(cual) { var jsv_f, jsv_d tmp_e = document.getElementById('jsv_f'); if(tmp_e) jsv_f = tmp_e.value; tmp_e = document.getElementById('jsv_d'); if(tmp_e) jsv_d = tmp_e.value; var zonaCarga = cual.substring(0, 1); var mapaCarga = cual.substring(1, 2); var restoCarga = cual.substring(2); $.ajax({ type: "GET", url: "/comprobar_zona_combos.php?tipo="+ zonaCarga + "&id_zona=" + restoCarga }) .done(function( msg ) { if (msg=="ko") { document.location = "/" } else { cadena_url = jsv_f + msg if (mapaCarga==1) { cadena_url = cadena_url + "mapa" } else { cadena_url = cadena_url + jsv_d } //alert(cadena_url) document.location = cadena_url } }); } var map; function LoadMap() { //estamos en ficha, porque hay jsv_h (codigo) if( document.getElementById('jsv_h')) { //LoadMapFicha(); return true; } var jsv_m, jsv_m2, jsv_n2, jsv_o, jsv_o2, jsv_j, tmp_e; tmp_e = document.getElementById('jsv_m'); if(tmp_e) jsv_m = tmp_e.value; jsv_m2 = jsv_m.split('|'); tmp_e = document.getElementById('jsv_n'); if(tmp_e) jsv_n = tmp_e.value; jsv_n2 = jsv_n.split('|'); tmp_e = document.getElementById('jsv_o'); if(tmp_e) jsv_o = tmp_e.value; jsv_o2 = jsv_o.split('|'); tmp_e = document.getElementById('jsv_j'); if(tmp_e) jsv_j = tmp_e.value; $.cookie("ultimo_listado", jsv_m2[0], {expires:45,path:'/'}); $.cookie("ultimo_listado_titulo", jsv_m2[1], {expires:45,path:'/'}); $.cookie("ultimo_listado_nivel", jsv_m2[2], {expires:45,path:'/'}); $.cookie("ultimo_listado_id_zona", jsv_m2[3], {expires:45,path:'/'}); $.cookie("ultimo_listado_id_tipo", jsv_m2[4], {expires:45,path:'/'}); $.cookie("ultimo_listado_operacion", jsv_m2[5], {expires:45,path:'/'}); $.cookie("ultimo_listado_cond", jsv_m2[6], {expires:45,path:'/'}); if(jsv_m2[7].length>0) { $.cookie("mark_ultimo_listado", jsv_m2[7], {expires:45,path:'/'}); } var locations = new Array(); for(var i=0; i< jsv_n2.length; i++) { locations[locations.length] = jsv_n2[i].split(','); } var es_draggable = true; if(jsv_j!='c') es_draggable = false; var markers = new Array(); var mapOptions = { center: new google.maps.LatLng(jsv_o2[0], jsv_o2[1]), zoom: parseInt(jsv_o2[2]), mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false, draggable: es_draggable }; map = new google.maps.Map(document.getElementById('map'), mapOptions); var styles = [ { "stylers": [ { "saturation": -63 }, { "lightness": 14 }, { "gamma": 0.8 } ] } ]; map.setOptions({styles: styles}); $.each(locations, function(index, location) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(location[0], location[1]), map: map, icon: '/assets/img/marker-transparent.png', title: location[2] }); google.maps.event.addListener(marker, 'click', mandarAnuncio); function mandarAnuncio() { var jsv_o, jsv_o2, tmp_e; tmp_e = document.getElementById('jsv_o'); if(tmp_e) jsv_o = tmp_e.value; jsv_o2 = jsv_o.split('|'); $('html, body').animate({ scrollTop: $('[name="ancla_' + location[2] + '"]').offset().top -250 }, 500); var arr1 = jsv_o2[3].split('/'); var arr2 = jsv_o2[4].split('/'); $.each(arr1, function( index, value ) { if (value=="capa_anuncio_" + location[2]) { $("#" + value).css( "-webkit-box-shadow", "-2px 0px 0px 0px rgba(213,47,21,1)" ); $("#" + value).css( "-moz-box-shadow", "-2px 0px 0px 0px rgba(213,47,21,1)" ); $("#" + value).css( "box-shadow", "-2px 0px 0px 0px rgba(213,47,21,1)" ); $("#" + value).css( "margin-bottom", "5px" ); } else { $("#" + value).css( "-webkit-box-shadow", "0px 1px 1px rgba(255,0,0,0.1)" ); $("#" + value).css( "-moz-box-shadow", "0px 1px 1px rgba(255,0,0,0.1)" ); $("#" + value).css( "box-shadow", "0px 1px 1px rgba(255,0,0,0.1)" ); $("#" + value).css( "margin-bottom", "10px" ); } }); $.each(arr2, function( index, value ) { if (value=="capa_subir_anuncio_" + location[2]) { $("#" + value).css( "display", "block" ); } else { $("#" + value).css( "display", "none" ); } }); } var myOptions = { content: '

'+location[2]+'

', disableAutoPan: false, maxWidth: 0, pixelOffset: new google.maps.Size(-146, -190), zIndex: null, closeBoxURL: "", infoBoxClearance: new google.maps.Size(1, 1), position: new google.maps.LatLng(location[0], location[1]), isHidden: false, pane: "floatPane", enableEventPropagation: false }; marker.infobox = new InfoBox(myOptions); marker.infobox.isOpen = false; var myOptions = { draggable: true, content: '
', disableAutoPan: true, pixelOffset: new google.maps.Size(-21, -58), position: new google.maps.LatLng(location[0], location[1]), closeBoxURL: "", isHidden: false, enableEventPropagation: true }; marker.marker = new InfoBox(myOptions); marker.marker.open(map, marker); markers.push(marker); }); } function capaCookies(pagina,device) { var ref = document.referrer; if (leeCookie("ley_cookies_aceptadas")=="si") { } else if(ref.match(/^https?:\/\/([^\/]+\.)?madridvivienda\.com(\/|$)/i)) { //cookies aceptadas createCookieLey(); } else { setTimeout(createCookieLey, 5000); cadena = '
boton cerrar' cadena += '
' cadena += '

  nuestro sitio web utiliza cookies para proporcionarte un mejor servicio. si continúas, significa que estás de acuerdo. en nuestra política de cookies, puedes ver cómo rechazarlas

' cadena += '
' cadena += '
' $('body').prepend(cadena); } } function validarFiltroMapaNew(){ var jsv_j; tmp_e = document.getElementById('jsv_j'); if(tmp_e) jsv_j = tmp_e.value; if (jsv_j!="p") { valorOper = document.getElementById('combo_operacion').value; combo_tipologia = "combo_tipologia1"; if(valorOper=='alquiler') { combo_tipologia = "combo_tipologia2"; } valorTipologia = document.getElementById(combo_tipologia).value valor_zona = document.getElementById("combo_buscador_zona_oculta").value; if (valor_zona=="") { valor_zona2 = document.getElementById("combo_buscador_zona").value; if (valor_zona2=="") { cadena_url = "/" +valorOper +"-"+ document.getElementById(combo_tipologia).value +"/madrid-provincia-madrid/" if (valorTipologia=="aticos" || valorTipologia=="pisos" || valorTipologia=="estudios" || valorTipologia=="duplex" || valorTipologia=="chalets") { cadena_url = "/" +valorOper +"-viviendas/madrid-provincia-madrid/" + valorTipologia +"/" } document.location = cadena_url } else { //si lo han puesto a mano miramos que exista $.ajax({ type: "GET", url: "/comprobar_zona_new.php?txt=" + valor_zona2 }) .done(function( msg ) { if (msg=="ko") { alert("No encontramos la zona que nos indicas") } else { arrMsg = msg.split("|"); if (arrMsg.length==3) { valorMsg0 = arrMsg[0]; valorMsg1 = arrMsg[1]; valorMsg2 = arrMsg[2]; if (valorMsg0!="viviendas" && valorMsg0!="terrenos" && valorMsg0!="garajes" && valorMsg0!="oficinas" && valorMsg0!="locales") { valorMsg0 = document.getElementById(combo_tipologia).value; valorMsg2 = ""; } if (valorMsg0=="terrenos" && valorMsg0=="garajes" && valorMsg0=="oficinas" && valorMsg0=="locales") { valorMsg2 = ""; } if (valorMsg2!="pisos/" && valorMsg2!="chalets/" && valorMsg2!="aticos/" && valorMsg2!="estudios/" && valorMsg2!="duplex/") { valorMsg2 = ""; } valorMsg1 = valorMsg1.replace("/mapa","/") cadena_url = "/" + valorOper +"-"+ valorMsg0 +"/" + valorMsg1 + valorMsg2; } else { cadena_url = "/" +valorOper +"-"+ document.getElementById(combo_tipologia).value +"/" + msg if (valorTipologia=="aticos" || valorTipologia=="pisos" || valorTipologia=="estudios" || valorTipologia=="duplex" || valorTipologia=="chalets") { cadena_url = "/" +valorOper +"-viviendas/" + msg + valorTipologia +"/" cadena_url = cadena_url.replace("/mapa","/") } } document.location = cadena_url } }); } } else { cadena_url = "/" +valorOper +"-"+ document.getElementById(combo_tipologia).value +"/" + valor_zona if (valorTipologia=="aticos" || valorTipologia=="pisos" || valorTipologia=="estudios" || valorTipologia=="duplex" || valorTipologia=="chalets") { cadena_url = "/" +valorOper +"-viviendas/" + valor_zona +valorTipologia +"/" cadena_url = cadena_url.replace('/mapa','/') } document.location = cadena_url } } else { subzona = document.getElementById('combo_subzona_madrid-provincia').value; valorOper = document.getElementById('combo_operacion').value; subzona = subzona.replace("--","/"); combo_tipologia = "combo_tipologia1"; if(valorOper=='alquiler') { combo_tipologia = "combo_tipologia2"; } subzona = subzona.replace("/mapa","/") document.location.href='/'+ valorOper +'-'+document.getElementById(combo_tipologia).value+'/'+subzona; } } function cambiarZonaCombo(valor){ $("#capaCombo_madrid-madrid--mapa").hide(); $("#capaCombo_zona-norte-madrid--mapa").hide(); $("#capaCombo_zona-noroeste-madrid--mapa").hide(); $("#capaCombo_zona-noreste-madrid--mapa").hide(); $("#capaCombo_zona-sur-madrid--mapa").hide(); $("#capaCombo_zona-sureste-madrid--mapa").hide(); $("#capaCombo_zona-suroeste-madrid--mapa").hide(); $("#capaCombo_madrid-provincia-madrid--mapa").hide(); $("#capaCombo_" + valor).show(); } function cambiaComboOperacion(obj) { if(obj.value=='venta') { $("#capaCombo_tipologiaV").show(); $("#capaCombo_tipologiaA").hide(); } else { $("#capaCombo_tipologiaV").hide(); $("#capaCombo_tipologiaA").show(); } } function buscarReferencia() { valor_refe = document.getElementById("buscador_referencia").value; if (valor_refe=="") { alert("Debes insertar una referencia") } else { $("#btnBuscarReferencia").attr("disabled", "disabled"); $.ajax({ type: "GET", url: "/comprobar_referencia.php?cod=" + valor_refe }) .done(function( msg ) { if (msg=="ok") { document.location = "/venta-piso-madrid-"+ valor_refe +"/" } else { alert("Referencia no encontrada") $("#btnBuscarReferencia").removeAttr("disabled"); } }); } } function documentReadyHomeMapa() { var tmp_e; var jsv_i, jsv_q; tmp_e = document.getElementById('jsv_i'); if(tmp_e) jsv_i = tmp_e.value; tmp_e = document.getElementById('jsv_q'); if(tmp_e) jsv_q = tmp_e.value; $.cookie("mark_ultimo_listado", " 1=1 AND local.activo = 1 AND provincia.id_provincia = 32 AND local.operacion = '" + jsv_i + "' AND ( local.dic_inmo_tipoinmueble = 2 OR local.dic_inmo_tipoinmueble = 1 OR local.dic_inmo_tipoinmueble = 3 OR local.dic_inmo_tipoinmueble = 4 OR local.dic_inmo_tipoinmueble = 5 OR local.dic_inmo_tipoinmueble = 6 OR local.dic_inmo_tipoinmueble = 7 OR local.dic_inmo_tipoinmueble = 8)", { expires : 45, //expires in 10 days path : '/', //The value of the path attribute of the cookie //(default: path of page that created the cookie). }); if(jsv_q=='1') { $('#combo_buscador_zona').autocomplete({ lookup: direcciones, minChars: 3, onSelect: function (suggestion) { document.getElementById("combo_buscador_zona_oculta").value = suggestion.data valor = suggestion.value.split("|") $("#combo_buscador_zona").val(valor[0]); validarFiltroMapaNew(); }, formatResult: function (suggestion,currentValue) { valor = suggestion.value.split("|"); valorbueno = valor[0]; var regex = new RegExp( '(' + currentValue + ')', 'gi' ); valorbueno = valorbueno.replace( regex, "$1" ); //valorbueno = valorbueno.replace(currentValue,""+ currentValue +"") return valorbueno }, onInvalidateSelection: function () { mostradasZonas = 0; } }); $('#combo_buscador_zona').keyup(function(e){ if(e.keyCode == 13) { validarFiltroMapaNew(); } }); } $("#btnBuscarReferencia").click(function() { buscarReferencia() }); $("#comboZona01 .clickOculto input, #comboZona02 .clickOculto input, #comboZona03 .clickOculto input").click(function(e) { e.preventDefault(); cargarEnlaceZona($(this).val()); }); $( "#comboZona01" ).mouseover(function() { cargarZonasCombo1('no'); }); $( "#comboZona02" ).mouseover(function() { cargarZonasCombo2('no'); }); } function documentReadyTodos() { /*loadCSS("/assets/css/all-css_01.css");*/ //reemplazo div.mvlink -> a $("div.mvlink").each(function (index) { cadena_reemplazo = '640) { $(window).scroll(function() { if( $(this).scrollTop() > 230 ) { $('#capa_superior_ficha').fadeIn(); } else { $('#capa_superior_ficha').fadeOut(); } if( $(this).scrollTop() > 150 ) { $('.widget.contact.ficha').css( "top", "80px" ); $('.widget.contact.ficha').css( "position", "fixed" ); $('.widget.contact.ficha').css( "width", "300px" ); } else { $('.widget.contact.ficha').removeAttr( "style" ); //$('.widget.contact.ficha').css( "border", "2px solid #D32F13" ); } }); } $('.fancyboxCompleto').fancybox({ 'padding' : 0, 'width' : "100%", 'margin' : [0, 0, 0, 0], 'closeBtn' : false }); var valoralto = $(window).height(); var valorancho = $(window).width(); var jsf_foto; tmp_e = document.getElementById('jsf_foto'); if(tmp_e) jsf_foto = tmp_e.value; if (jsf_foto!="" && jsf_foto!="0") { if(parseInt(miAncho)<640) { $.fancybox({ 'type' : 'ajax', 'href' : '/cargador_galeria_fotos.php?id='+ inm +'&alto='+ valoralto +'&ancho='+ valorancho +'&cual='+ jsf_foto, 'padding' : 0, 'margin' : [0, 0, 0, 0], 'autoSize' : false, 'width' : valorancho, 'height' : valoralto, 'closeBtn' : false, 'modal' : true, afterLoad: function(current, previous) { mostrando_fotos = 1 }, afterClose: function() { mostrando_fotos = 0 } }); } else { $.fancybox({ 'type' : 'ajax', 'href' : '/cargador_galeria_fotos.php?id='+ inm +'&alto='+ valoralto +'&ancho='+ valorancho +'&cual='+ jsf_foto, 'padding' : 0, 'autoSize' : false, 'width' : valorancho, 'height' : valoralto, 'closeBtn' : false, 'modal' : true, afterLoad: function(current, previous) { mostrando_fotos = 1 }, afterClose: function() { mostrando_fotos = 0 } }); } } var jsv_s, jsv_s2; tmp_e = document.getElementById('jsv_s'); if(tmp_e) jsv_s = tmp_e.value; jsv_s2 = jsv_s.split('|'); if(parseInt(miAncho)<640) { altoMapaCargado = 330; } else { altoMapaCargado = 600; } $('#bAM').fancybox({ 'type' : 'iframe', 'href' : '/cargador_mapa.php?id='+ inm + "&lat=" + jsv_s2[0] + "&lon="+ jsv_s2[1] +"&exacta="+ jsv_s2[2], 'padding' : 0, 'autoSize' : false, 'height' : altoMapaCargado }); $(".ver_telefonos").click(function() { cargarTelefonos(); }); $(".enlace_avisos").click(function() { abrirFancyboxmv('#capa_recibir_avisos'); }); $("#btnFavoritos").click(function() { anadirFavoritosFicha(jsv_r); }); $("#btnAmigo").click(function() { abrirFancyboxmv('#amigo'); }); $("#btnPrecio,#btnPrecio2").click(function() { abrirFancyboxmv('#preciobaje'); }); $("#btnPrint").click(function() { window.location.href='?imprimir=1'; }); $("#btnError").click(function() { abrirFancyboxmv('#error'); }); $("#btnSolicitar").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r); }); $("#btnSolicitar2").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+'&msg=distribucion'); }); $("#btnSolicitar3").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+'&msg=descripcion'); }); $("#btnSolicitar4").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+'&msg=caracteristicas'); }); $("#btnSolicitar5").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+'&msg=certificado'); }); $("#btnSolicitarDireccion").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+''); }); $("#btnSolicitarMovil").click(function() { abrirFancyboxAjaxmv('/helpers/widgets/contact_listado.php?id='+jsv_r+''); }); contenidoNegroFicha = '
'; if (($("#enlacesesion").length > 0)){ enlacetemp = $("#enlacesesion").attr('href'); textotemp = $("#enlacesesion").text(); trozo = textotemp.substring(0,7) if (""+trozo==" Volver") { contenidoNegroFicha += 'boton volver' } } tituTemp = $("h1").text(); precioTemp = $(".precio_ficha").text(); contenidoNegroFicha += tituTemp +'  '+ precioTemp if (($("#enlacesesion").length > 0)){ enlacetemp = $("#enlacesesion").attr('href'); textotemp = $("#enlacesesion").text(); contenidoNegroFicha += '
btn volver  '+ textotemp +'' } contenidoNegroFicha += '
' tmp_metros = $("#d_01").text() contenidoNegroFicha += '
superficie '+ tmp_metros +' m2' if (($("#d_02").length > 0)){ contenidoNegroFicha += '  separador  dormitorios '+ $("#d_02").text() } if (($("#d_03").length > 0)){ contenidoNegroFicha += '  separador  baños '+ $("#d_03").text() } if (($("#d_04").length > 0)){ contenidoNegroFicha += '  separador  '+ $("#d_04").text() } if (($("#d_05").length > 0)){ contenidoNegroFicha += '
' } if (($("#d_06").length > 0)){ contenidoNegroFicha += '
' } contenidoNegroFicha += '
' $("#capa_superior_ficha").html(contenidoNegroFicha) $( window ).resize(function() { var valoralto = $(window).height(); var valorancho = $(window).width(); if (mostrando_fotos==1) { $.fancybox({ 'type' : 'ajax', 'href' : '/cargador_galeria.php?id='+jsv_r+'&alto='+ valoralto +'&ancho='+ valorancho, 'padding' : 0, 'margin' : [0, 0, 0, 0], 'autoSize' : false, 'width' : valorancho, 'height' : valoralto, 'closeBtn' : false }); } }); } function verImagenAnterior() { //recorremos los li para ver cual es el que está activo activo = 0; contador = 0; $('.carousel.property .content ul li').each(function(indice, elemento) { if ($( elemento ).hasClass( "active" )) { activo = contador } contador ++ }); nuevoactivo = activo - 1; if (nuevoactivo<0) { nuevoactivo = contador } else { nuevoactivo ++ } $( ".carousel.property .content li:nth-child("+ nuevoactivo +") img" ).click(); } function verImagenSiguiente() { //recorremos los li para ver cual es el que está activo activo = 0; contador = 0; $('.carousel.property .content ul li').each(function(indice, elemento) { if ($( elemento ).hasClass( "active" )) { activo = contador } contador ++ }); nuevoactivo = activo; nuevoactivo ++; if (nuevoactivo==contador) { nuevoactivo = 1 } else { nuevoactivo ++ } $( ".carousel.property .content li:nth-child("+ nuevoactivo +") img" ).click(); } function EsTelefonoFijo(tel) { telefono = tel telefono = telefono.split(' ').join('_') telefono = telefono.split('(').join('_') telefono = telefono.split(')').join('_') telefono = telefono.split('+').join('_') telefono = telefono.split('_').join('') telefono = Number(telefono) if(isNaN(telefono)) { return false; } else { telefono = telefono.toString() if (telefono.length>8 && telefono.length<12) { return true } else { return false } } } function revisarCamposFicha(cual){ f = document.getElementById(cual) if (f.inputEmail.value == ""){ if (f.inputPhone.value == ""){ alert("Debe insertar un email o un teléfono"); } else { if (EsTelefonoFijo(f.inputPhone.value)==false) { } } }else{ expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( !expr.test(f.inputEmail.value) ){ alert("Error: La dirección de correo " + document.getElementById('inputEmail').value + " es incorrecta."); } } f.submit(); } function cargarContactarListadoFicha(id, codigo) { $.fancybox({ 'type' : "ajax", 'href' : "/helpers/widgets/contact_listado.php?id=" + id, 'ajax' : { dataType : 'html', headers : { 'X-fancyBox': 'true' } }, afterClose: function() { ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'ver_telefono_popup', eventLabel: codigo }); } }); } function cargarTelefonos() { var tmp_e; var jsv_h, jsv_r; tmp_e = document.getElementById('jsv_h'); if(tmp_e) jsv_h = tmp_e.value; tmp_e = document.getElementById('jsv_r'); if(tmp_e) jsv_r = tmp_e.value; $("#contenedor_tlf").html('Cargando...'); $.ajax({ type: 'POST', url: '/cargador_telefonos.php', data: 'id=' + jsv_r, async: false, // Mostramos un mensaje con la respuesta de PHP success: function(data) { if (data=="no") { $("#contenedor_tlf").html('Error al intentar cargar el teléfono.'); } else { ga('send', 'event', { eventCategory: 'enlaces', eventAction: 'ver_telefono', eventLabel: jsv_h }); $("#contenedor_tlf").html(data); } } }); } function visitarUrlExterna(tipo) { var tmp_e; var jsv_r; tmp_e = document.getElementById('jsv_r'); if(tmp_e) jsv_r = tmp_e.value; $.ajax({ type: 'POST', url: "/url_externa.php", data: {'id':jsv_r, 'tipo': tipo}, async : true, }).done(function(data) { }); } function cargaJSmapas2() { var element = document.createElement("script"); element.src = "/assets/js/gmap3.infobox.min.js"; document.body.appendChild(element); } function cargaJSmapas1() { var element = document.createElement("script"); element.src = "/assets/js/gmap3.min.js"; document.body.appendChild(element); } function LoadMapFicha() { var jsv_s, jsv_s2, tmp_e, jsv_j; tmp_e = document.getElementById('jsv_s'); if(tmp_e) jsv_s = tmp_e.value; jsv_s2 = jsv_s.split('|'); tmp_e = document.getElementById('jsv_j'); if(tmp_e) jsv_j = tmp_e.value; if(jsv_s2[0]!='') { var locations = new Array( [jsv_s2[0], jsv_s2[1]] ); var markers = new Array(); var es_draggable = true; if(jsv_j=='p') es_draggable=false; var mapOptions = { center: new google.maps.LatLng(jsv_s2[0], jsv_s2[1]), zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false, draggable: es_draggable }; var map = new google.maps.Map(document.getElementById('property-map'), mapOptions); $.each(locations, function(index, location) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(location[0], location[1]), map: map, icon: '/assets/img/marker-transparent.png' }); var cad_content; if(jsv_s2[2]=='SI') cad_content ='
'; else cad_content = '
'; var myOptions = { draggable: true, content: cad_content, disableAutoPan: true, pixelOffset: new google.maps.Size(-21, -58), position: new google.maps.LatLng(location[0], location[1]), closeBoxURL: "", isHidden: false, enableEventPropagation: true }; marker.marker = new InfoBox(myOptions); marker.marker.open(map, marker); markers.push(marker); google.maps.event.addListener(marker, "click", function (e) { var curMarker = this; $.each(markers, function (index, marker) { // if marker is not the clicked marker, close the marker if (marker !== curMarker) { marker.infobox.close(); marker.infobox.isOpen = false; } }); if(curMarker.infobox.isOpen === false) { curMarker.infobox.open(map, this); curMarker.infobox.isOpen = true; map.panTo(curMarker.getPosition()); } else { curMarker.infobox.close(); curMarker.infobox.isOpen = false; } }); }); } } function loadCSS( href, before, media ){ "use strict"; var ss = window.document.createElement( "link" ); var ref = before || window.document.getElementsByTagName( "script" )[ 0 ]; var sheets = window.document.styleSheets; ss.rel = "stylesheet"; ss.href = href; ss.media = "only x"; ref.parentNode.insertBefore( ss, ref ); function toggleMedia(){ var defined; for( var i = 0; i < sheets.length; i++ ){ if( sheets[ i ].href && sheets[ i ].href.indexOf( href ) > -1 ){ defined = true; } } if( defined ){ ss.media = media || "all"; } else { setTimeout( toggleMedia ); } } toggleMedia(); return ss; } tmp_pub_jsv_g = document.getElementById('jsv_g').value tmp_pub_jsv_pa = document.getElementById('jsv_pa').value tmp_pub_jsv_spa = document.getElementById('jsv_spa').value tmp_pub_jsv_i = document.getElementById('jsv_i').value tmp_pub_jsv_targ = document.getElementById('jsv_targ').value if (tmp_pub_jsv_g=="R" || tmp_pub_jsv_g=="r") { var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); if (tmp_pub_jsv_pa=="LISTADOS" || tmp_pub_jsv_pa=="MAPAS") { if (tmp_pub_jsv_pa=="LISTADOS") { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/1042229/mv_v_listado_interno', [728, 90], 'div-gpt-ad-1414153684587-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { //alert(arrTrg[cad1] +" - "+ arrTrg2[0] + ": " + arrTrg2[1]) anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1414153684587-0'); }); if (tmp_pub_jsv_i=="V") { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_v_listado', [300, 250], 'div-gpt-ad-1410770687081-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410770687081-0'); }); } else { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_a_listado', [300, 250], 'div-gpt-ad-1410449770009-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410449770009-0'); }); } } if (tmp_pub_jsv_pa=="MAPAS") { if (tmp_pub_jsv_spa=="LISTADO") { if (tmp_pub_jsv_i=="V") { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_v_muni', [300, 250], 'div-gpt-ad-1410772262991-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410772262991-0'); }); } else { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_a_muni', [300, 250], 'div-gpt-ad-1410772178694-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410772178694-0'); }); } } else { if (tmp_pub_jsv_i=="V") { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_v_mapa', [300, 250], 'div-gpt-ad-1410771192581-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410771192581-0'); }); } else { googletag.cmd.push(function() { var anuncio = googletag.defineSlot('/' + '1042229/mv_a_mapa', [300, 250], 'div-gpt-ad-1410771360654-0'); if (tmp_pub_jsv_targ!="") { arrTrg = tmp_pub_jsv_targ.split("##"); for (var cad1 in arrTrg) { if (cad1!="") { if (arrTrg[cad1]!="") { arrTrg2 = arrTrg[cad1].split("|"); if (arrTrg2.length==2) { anuncio.setTargeting(arrTrg2[0], [arrTrg2[1]]); } } } } } anuncio.addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-gpt-ad-1410771360654-0'); }); } } } } }