');
$('#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 = '
'
cadena = '
'
cadena += ''
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