';
html_tags += '
';
html_tags += 'Se ';
if (data.paginacion[i]['keyacci']==1) html_tags += 'vende ';
else if (data.paginacion[i]['keyacci']==2) html_tags += 'alquila ';
else if (data.paginacion[i]['keyacci']==3) html_tags += 'traspasa ';
else if (data.paginacion[i]['keyacci']==4) html_tags += 'vende y alquila ';
html_tags += data.paginacion[i]['nbtipo'].toLowerCase();
html_tags += ' en ';
html_tags += data.paginacion[i]['ciudad']+' ';
html_tags += '
';
html_tags += '
';
if (data.paginacion[i]['keyacci']==1) html_tags += formatMoney(data.paginacion[i]['precioinmo'].toFixed(0))+'€';
else if (data.paginacion[i]['keyacci']==2) html_tags += formatMoney(data.paginacion[i]['precioalq'].toFixed(0))+'€';
else html_tags += 'A consultar';
html_tags += '
';
html_tags += '
';
html_tags += 'Poblacion: ';
html_tags += data.paginacion[i]['ciudad'];
html_tags += '
';
html_tags += 'Tipo: ';
html_tags += data.paginacion[i]['nbtipo'];
html_tags += '
';
if(data.paginacion[i]['m_uties']!==undefined)
{
html_tags += 'Metros: ';
html_tags += data.paginacion[i]['m_uties']+'m²';
html_tags += '
';
}
html_tags += '
';
html_tags += '
';
html_tags += '';
}
$(".busqueda").append(html_tags);
loading = false;
},
error: function(data){
console.log("makeApiRequest error",data);
},
abort: function(data){
console.log("makeApiRequest abort",data);
}
});
}
}
});
}
if(seccion=="ficha"){
$(window).scrollTop($("#sidebar").offset().top -50 );
}
});
/* Buscador*/
function buscar(){
//var modalidad = $("#modalidad li.selected").attr("data-value");
//var zona = $("#zona li.selected").attr("data-value");
//var estado = $("#estado li.selected").attr("data-value");
//var tipo = $("#tipo li.selected").attr("data-value");
var modalidad = $("#modalidad").val();
var zona = $("#zona").val();
var tipo = $("#tipo").val();
//window.location = "/buscador/"+modalidad+"/"+zona+"/"+estado+"/"+tipo;
window.location = "/buscador/" + modalidad + "/" + zona + "/" + tipo;
return false;
}
/* Busqueda */
function verficha(id){
window.location = "/ficha/"+id;
return false;
}
/* Contacto */
function mostrar_contacto(){
$("#formulario-contacto").fadeIn(750);
}
function cerrar_contacto(){
$("#formulario-contacto").fadeOut(750);
}
function Activar_boton(){
if (document.getElementById("switchBox").checked==1){
$("#botonenviar").addClass("enabled").removeClass("disabled")
document.getElementById("botonenviar").disabled = false;
//document.getElementById("botonenviar").style.background = "#1b3a59";
//document.getElementById("botonenviar").style.cursor = "pointer";
}
else{
$("#botonenviar").removeClass("enabled").addClass("disabled");
document.getElementById("botonenviar").disabled = true;
//document.getElementById("botonenviar").style.background = "#547ba2";
}
};
function enviar_contacto(){
if (document.getElementById('switchBox').checked==1){
var name = $("#name").val();
var email = $("#email").val();
var telefono = $("#telefono").val();
var asunto = $("#asunto").val();
var descr = $("#descr").val();
if (email=="" || telefono == "" || descr == ""){
$("#formulario_contacto-after").html("Por favor rellena todos los camps");
}
else if(false){
$("#formulario_contacto-after").html("Gracias por rellenar el formulario. Contactaremos con usted lo antes posible.");
}
else{
var requestParams = {
"name" : name,
"email" : email,
"telefono" : telefono,
"asunto" : asunto,
"descr" : descr
};
jQuery.ajax({
type: "POST",
url: "contacto/send",
data: requestParams,
dataType: "json",
success: function(data){2
$("#name").val("");
$("#email").val("");
$("#telefono").val("");
$("#asunto").val("");
$("#descr").val("");
$("#formulario_contacto-after").html("Gracias por rellenar el formulario. Contactaremos con usted lo antes posible.");
console.log("makeApiRequest success",data);
},
error: function(data){
console.log("makeApiRequest error",data);
},
abort: function(data){
console.log("makeApiRequest abort",data);
}
});
}
}
};
function formatMoney(n, c, d, t) {
var c = isNaN(c = Math.abs(c)) ? 0 : c,
d = d == undefined ? "," : d,
t = t == undefined ? "." : t,
s = n < 0 ? "-" : "",
i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};