Sunteți pe pagina 1din 13

function isset(variable_name){try{if(typeof(eval(variable_name))!

='undefined')if(eval(variable_name)!=null)return true;}catch(e){}return false;}


function ponval(vari,valor){if(isset(document.getElementById(vari)))
{document.getElementById(vari).value=valor;}}

function newAjax() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}

try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch ( e ) {}

try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch ( e ) {}

return false;
}

function prepvari() {
var res = '';
var va = ['desde', 'hasta', 'dias', 'demanda', 'orden', 'dormd', 'dormh',
'banosd', 'banosh', 'm2d', 'm2h', 'playa', 'vendedor', 'm2', 'marca', 'modelo',
'anod', 'anoh', 'ccd', 'cch', 'color', 'kms', 'combustible', 'eslorad', 'eslorah',
'memoria', 'discoduro', 'operador', 'talla', 'cajacambio', 'concv', 'tipog',
'puertas', 'provincia_origen', 'provincia_destino', 'origen_provincia_id',
'origen_provincia', 'origen_localidad_id', 'origen_localidad', 'origen_zona_id',
'origen_zona', 'destino_provincia_id', 'destino_provincia', 'destino_localidad_id',
'destino_localidad', 'destino_zona_id', 'destino_zona', 'regularidad',
'numero_plazas', 'fecha_compartir_coche','potencia', 'geox', 'geoy', 'geodist'];
for (var i = 0; i < va.length; i++) {
if ((document.getElementById(va[i])) &&
(document.getElementById(va[i]).value != '') &&
(document.getElementById(va[i]).value != 'hasta') &&
(document.getElementById(va[i]).value != 'desde') &&
(document.getElementById(va[i]).value != 'modelo')) {
if (res != '')res = res + '&';
res = res + va[i] + '=' +
unescape(encodeURIComponent(document.getElementById(va[i]).value));
}
}
if (res != "")res = '?' + res;
if (document.getElementById('palabras') &&
(document.getElementById('palabras').value != 'modelo')) res =
cabb(document.getElementById('palabras').value) + res;
return res;
}
function findMe(callback) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(callback, function() {alert("No ha
sido posible localizarte")});
}
}
function cabb(busq){
busq = busq.toLowerCase();
var re =/[^áéíóúñüäëïöü@\._ça-z0-9]/gi;
busq = busq.replace(re, " ");re = / +/g;
busq = busq.replace(re, "-");re = /^-/;
busq = busq.replace(re, "");re = /-$/;
busq = busq.replace(re, "");
if (busq == " ")busq = "";
if (busq != '') busq = busq +'.htm';
return busq;
}
function cabc(dire){
document.getElementById('categoria').value=dire;
if((dire=='inmobiliaria')||(dire.substr(0,9)=='traspasos'))cabu();else
cargagen('/buscadores/camcat3.php?v2&cat='+dire,'busgen');
}
function cargagen(direc, spanid) {
var ajax = newAjax();
ajax.open("GET", direc, true);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4) {
var o = document.getElementById(spanid);
o.innerHTML = ajax.responseText;
var arr = o.getElementsByTagName("script");
for (var n = 0; n < arr.length; n++)
eval(arr[n].innerHTML);

if (document.getElementById('palabrasAdBoxSingle')) {
document.getElementById('palabrasAdBoxSingle').value =
document.getElementById('palabras').value;
document.getElementById('palabrasAdBoxSingle').id = 'palabras';
}

if ((typeof _isSearchAdBoxVisible !== 'undefined') &&


_isSearchAdBoxVisible) {
document.getElementById("searchAdBox").style.display = "block";
document.getElementById("searchAdBoxSingle").style.display =
"none";

if (document.getElementById('palabras')) {
var freeTextValue = document.getElementById('palabras').value;
document.getElementById('palabras').id = 'palabrasAdBoxSingle';
if (document.getElementById('palabras')) {
document.getElementById('palabras').value = freeTextValue;
}
}

if (document.getElementById('protmp')) {
var province = document.getElementById('protmp').value;
document.getElementById('protmp').id = 'protmpAdBoxSingle';
if (document.getElementById('protmp').value) {
document.getElementById('protmp').value = province;
}
}

document.getElementById("searchAdBoxAdvanced").style.display =
"block";
document.getElementById('searchAdBoxType').innerHTML = 'OCULTAR
FILTROS';
}
}
};
ajax.send(null);
}

function cabf(){
var cate=document.getElementById('categoria').value;
var prov=document.getElementById('provincia').value;
var dir='anuncios';if(cate!='')dir=cate;
if(prov != ''){
if(prov.indexOf('_cerca') == -1)
dir += '-en-' + prov;
else dir += '-en-' + prov.substr(0, prov.length - 6);
}
if(cate!='inmobiliaria'){
var url = '/'+dir+'/'+prepvari();
if(prov.indexOf('_cerca') != -1)
url += ((url.indexOf('?') == -1) ? '?' : '&') + 'cerca=s';
document.location=url;
}else{document.location='/'+dir+'/';}}

function caca(dire){document.getElementById('categoria').value = dire;cabf();}

function camodel(este){
if(este=='otros'){

document.getElementById('categoria').value=document.getElementById('marca2').value;
document.getElementById('modelin').innerHTML = '<input
onkeydown="if(event.keyCode==13) cabu();" type=text
onfocus="if(this.value==\'modelo\')this.value=\'\';" id="palabras" maxlength="30"
size=11 class="imputs" value="modelo" tabindex="6" style="width:86%">';
}else if(este==''){

document.getElementById('categoria').value=document.getElementById('marca2').value;
cabu();
}else if(este!=''){
document.getElementById('categoria').value=este;
cabu();
}
}
function tienecadenalarga(cad){
var contz = 0;
var eslargo = false;
var longi = cad.length;
for(var k = 0; k < longi; k++){
if (cad.substring(k,k+1)==' ') contz = 0;else contz ++;
if (contz > 21) eslargo = true;
}
return eslargo;
}
function getCookie(sName){
var aCookie = document.cookie.split("; ");
for (var i=0; i < aCookie.length; i++)
{
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
}
return null;
}
function estaencookie(ide) {
var cook = getCookie('favoritos');
if (cook != null) {
var aCookie = cook.split(" ");
for (var i=0; i < aCookie.length; i++){
if (aCookie[i] == ide) return true;
}
}
return false;
}
function poncookie(ide){
ide = ide + '';
if (getCookie('favoritos') == null) {
//noinspection JSValidateTypes
document.cookie = 'favoritos=' + ide + '; expires=Thu, 2 Aug 2019 20:47:11
UTC; path=/';
}
else {
//noinspection JSValidateTypes
document.cookie = 'favoritos=' + getCookie('favoritos') + ' ' + ide + ';
expires=Thu, 2 Aug 2019 20:47:11 UTC; path=/';
}
}
function quitacookie(ide){
ide = ide + '';

var cook = getCookie('favoritos');


if (cook != null) {
var quitada = '';
var aCookie = cook.split(" ");
for (var i=0; i < aCookie.length; i++){ if (aCookie[i] != ide) quitada =
quitada + aCookie[i] +" ";}
//noinspection JSValidateTypes
document.cookie = 'favoritos=' + quitada + '; expires=Thu, 2 Aug 2019
20:47:11 UTC; path=/';
}
}

function of(ide, mobile){


ide += '';

var favBaseClass = mobile ? 'pagAnuFavMobileButton' : 'pagAnuFavButton' ;


var poner = (document.getElementById("fav"+ide).className == favBaseClass + ' '
+ 'pagAnuFavButtonOff');

var ajax = newAjax();


ajax.open("POST", ("/cmd/?comando=" + (poner ? "addfavorito" :
"quitafavorito")) + "&id=" + ide, true);

ajax.onreadystatechange=function(){
if(ajax.readyState==4){

switch (ajax.responseText){
case 'ok':
// operación realizada correctamente (guardado en bbdd)... nada
más que hacer
break;
case 'error':
alert('Ha ocurrido un error. Inténtelo de nuevo más tarde.');
break;
default:
// usuario no logueado
if (poner){
poncookie(ide);
}else{
quitacookie(ide);
}
break;
}
if (ajax.response != 'error')
document.getElementById('fav' + ide).className = (poner ?
favBaseClass + ' ' + 'pagAnuFavButtonOn' : favBaseClass + ' ' +
'pagAnuFavButtonOff');
}
};

ajax.send(null);
}

function tmpof(ide){
ide += '';

var favouriteElement = document.getElementById('fav' + ide);


var poner = favouriteElement.className.indexOf('i1') !== -1;

var ajax = newAjax();


ajax.open("POST", ("/cmd/?comando=" + (poner ? "addfavorito" :
"quitafavorito")) + "&id=" + ide, true);

ajax.onreadystatechange=function(){
if(ajax.readyState==4){

switch (ajax.responseText){
case 'ok':
// operación realizada correctamente (guardado en bbdd)... nada
más que hacer
break;
case 'error':
alert('Ha ocurrido un error. Inténtelo de nuevo más tarde.');
break;
default:
// usuario no logueado
if (poner){
poncookie(ide);
}else{
quitacookie(ide);
}
break;
}
if (ajax.response != 'error') {
if (poner) {
favouriteElement.className =
favouriteElement.className.replace('i1', 'i2');
favouriteElement.className =
favouriteElement.className.replace('icon-favourite', 'icon-favourite-fill');
} else {
favouriteElement.className =
favouriteElement.className.replace('i2', 'i1');
favouriteElement.className =
favouriteElement.className.replace('icon-favourite-fill', 'icon-favourite');
}
}
}
};

ajax.send(null);
}

function renderImages(ide, pos, mufo, svr, svrFotos, thumbnail){


ide = ide + '';mufo = mufo + '';
var oculta = false;pos = parseInt(pos);if (pos == 0) {pos = 1; oculta = true;}
var ie = oculta ? 'ie':'ee';
var numf=''; if(mufo.length>1)numf='<br><div class="mini-overlay-
superior">'+mufo.length+' fotos</div>';
document.getElementById('f'+ide).innerHTML='<a
href="javascript:openImageDialog(\''+ide+"',"+pos+",'"+mufo+"','"+svr+"/','"+svrFot
os+"');"+'"><img class='+ie+' src="'+thumbnail+'" onmousedown="return false"
oncontextmenu="return false" oncopy="return false">'+numf+'</a>';
}

function openImageDialog(ide,pos,mufo,svr,svrFotos){
document.getElementById('wind').innerHTML = '<div id=popf
onclick="cerrarw()"></div><div id=popw><div
id=imgw></div></div>';renderBigPicture(ide,pos,mufo,svr,svrFotos);pospop(640);
}

function renderBigPicture(ide,pos,multifoto,svr){
pos = sanitizePosition(pos,multifoto);
var sig = pos + 1;
ide = ide + '';multifoto = multifoto + '';
var images = ImageStore.getImagesBy(ide);
var sal = createGalleryHeader(multifoto, ide, pos, svr, images);
var varspan = document.getElementById('imgw');
if(varspan == null) varspan = document.getElementById('imgg');
varspan.innerHTML=sal;
// console.log(multifoto.substring(sig-1,sig));
// console.log(sig-1);
// console.log(sig);
// if(sig<=multifoto.length) setTimeout(function(){var i=new
Image();i.src=images[multifoto.substring(sig-1,sig)]}, 100);
}

function createGalleryHeader(multifoto, ide, pos, svr, images) {


var nextImage = (multifoto.length > 1) ? nextLinkImage(ide, pos + 1, multifoto,
svr) : '';
var beforeImage = (multifoto.length > 1) ? nextLinkImage(ide, pos + -1,
multifoto, svr) : '';
var sal = '<div style="min-width:230px;font:bold 21px verdana"><div
style="float:left">';
sal += beforeImage ? createGalleryLink(beforeImage, '<<') : '';
sal += ' <b> &nbsp; ' + pos + ' / ' + multifoto.length + '</b> ';
sal += nextImage ? createGalleryLink(nextImage, '>>') : '';
sal += '</div><div style="position:absolute;right:-18px;top:-13px;*position:
inherit" onclick="cerrarw()"><img src="' + svr + 'imagenes/overlay_close.png"
width="36" height="36"/></div>';
sal += '<div style="clear:both; padding-top:2px; text-align:center; min-height:
100px; background: url(' + svr + 'imagenes/waiting.gif) no-repeat center center
#FFF">';
var nextImageClickImage = (multifoto.length > 1) && ('ontouchstart' in
document.documentElement)
? ' ontouchstart="event.preventDefault()" ontouchend="' + nextImage + '"'
: ' onclick="' + nextImage + '"';
sal+='<img style="max-width:100%" src="' + images[pos-1]+ '"
onmousedown="return false" oncontextmenu="return false" oncopy="return
false"'+nextImageClickImage+'>';
sal+='</div></div>';
return sal;
}

function createGalleryLink(link, text) {


return '<a href="'+link+'" class="botim">&nbsp;' + text + '&nbsp;</a>';
}

function nextLinkImage(ide, pos, multifoto, svr) {


return
'javascript:renderBigPicture(\''+ide+'\','+pos+',\''+multifoto+'\',\''+svr+'\')';
}

function sanitizePosition(pos, multifoto) {


if(pos>multifoto.length)pos=1;
if(pos<1||pos==0)pos=multifoto.length;
pos += '';
return parseInt(pos);
}

function solonumeros(e){
if (navigator.appName=="Microsoft Internet Explorer"){
var codigo=e.keyCode;
return !((codigo > 58) || (codigo < 47));
}}

function qcero(c){
var i = c.length-1;
var s = false;
var h;
do{
var ch = c.substring(i, i + 1 );
if (ch == ".") h = i;
if ((ch != "0")&&(ch != ".")) s = true;
i--;
}while((i>0) && !(s));
h++;
return h;
}

function visu(c) {
var h = qcero(c);
var j=0;
var x = (c=='0.0.0.0') ? 0 : 30;
if(typeof m != "undefined"){
for (var i=0;i<m.length;i++){
if ( (c.substring(0, h ) == m[i].substring(0, h )) && (c != m[i]) ) {
setTimeout("document.getElementById('"+m[i]+"').style.display =
'';",x*j);
j++;
}
}
for (i=0;i<n.length;i++){
var o = n[i];
if (o != c) {
h = qcero(o);
var k=0;
for (l=0;l<m.length;l++){
if ( (o.substring(0, h ) == m[l].substring(0, h )) &&
(o.substring(0, h ) != sel.substring(0, h )) && (o != m[l]) ) {
setTimeout("document.getElementById('"+m[l]+"').style.display =
'none';",x*k);
k++;
}
}

}
}
}
}

function getX(){var scrOfX = 0;


if(typeof(window.pageYOffset)=='number'){scrOfX = window.pageXOffset;
} else if(document.body && document.body.scrollLeft){scrOfX =
document.body.scrollLeft;
} else if(document.documentElement && document.documentElement.scrollLeft){scrOfX
= document.documentElement.scrollLeft;
}return scrOfX;
}

function getY() {var scrOfY = 0;


if(typeof(window.pageYOffset)=='number'){scrOfY = window.pageYOffset;
}else if( document.body && document.body.scrollTop){scrOfY =
document.body.scrollTop;
}else if(document.documentElement && document.documentElement.scrollTop){scrOfY =
document.documentElement.scrollTop;
}return scrOfY;
}

function getWinW(){var myWidth = 0;


if( typeof( window.innerWidth ) == 'number' ){myWidth = window.innerWidth;
}else if(document.documentElement && document.documentElement.clientWidth){myWidth
= document.documentElement.clientWidth;
}else if( document.body && document.body.clientWidth ){myWidth =
document.body.clientWidth;
}return myWidth;
}

function getDocH(){
var db = document.body;var dde = document.documentElement;
return Math.max(db.scrollHeight, dde.scrollHeight, db.offsetHeight,
dde.offsetHeight, db.clientHeight, dde.clientHeight)
}

function getDocW(){
var db = document.body;var dde = document.documentElement;
return Math.max(db.scrollWidth, dde.scrollWidth, db.offsetWidth, dde.offsetWidth,
db.clientWidth, dde.clientWidth)
}

function posit(n){if(n<0)n=0;return n;}


function pospop(iw) {
if (getWinW()<680) {
document.getElementById('popw').style.top = (getY()
+25)+"px";document.getElementById('popw').style.left =
"8%";document.getElementById('popw').style.right =
"8%";document.getElementById('popf').style.top=0;document.getElementById('popf').st
yle.bottom=0;document.getElementById('popf').style.left=0;document.getElementById('
popf').style.right=0
} else {
document.getElementById('popw').style.top = (getY()
+25)+"px";document.getElementById('popw').style.left = posit(((getWinW()-
iw)/2)+getX())+"px";document.getElementById('popf').style.height=getDocH()
+"px";document.getElementById('popf').style.width=getDocW()+"px";
}
}
function cf(id,color){document.getElementById(id).style.background = color;}
function chche() {var chconta=document.getElementById('chconta');chconta.checked =
chconta.checked != true;}
function busfac(){var urlcont =
'/anuncios/';if(document.getElementById('busfac').value=='Ej.: bmw airbag madrid')
{alert('Escribe las palabras a buscar en el recuadro');}else{document.location =
urlcont+cabb(document.getElementById('busfac').value);}}
function ventana(pag,id){
var htmwin = '<div id=popf onclick="cerrarw()"></div><div id=popw style="text-
align:right"><a href="javascript:cerrarw()" class=cerrarw>Cerrar [X]</a><br>';
var renewedHeight = pag.indexOf('renovar/') === 0 ? '500px' : '440px';
if(getWinW()<680){
document.getElementById('wind').innerHTML = htmwin+"<iframe
src=\"-/"+pag+id+"\" frameborder=\"0\" id=ifrw
style=\"width:100%;height:"+renewedHeight+"\"></iframe></div>";
document.getElementById('ifrw').src="/"+pag+id;pospop(0); if(!
(isset(document.getElementById('ifrw'))&&
document.getElementById('ifrw').offsetHeight > 50)) window.location="/"+pag+id;
}
else {
document.getElementById('wind').innerHTML = htmwin+"<iframe
src=\"/"+pag+id+"\" frameborder=\"0\" id=ifrw
style=\"width:380px;height:"+renewedHeight+"\"></iframe></div>";
document.getElementById('ifrw').src="/"+pag+id;pospop(320); if(!
(isset(document.getElementById('ifrw'))&&
document.getElementById('ifrw').offsetHeight > 50)) window.location="/"+pag+id;
}
}

esfuncion = function(func){ return typeof window[func] === "function"};

function cerrarw(){document.getElementById('wind').innerHTML='';}
function od(id, usePhoneProxy){ventana("datos-contacto/?usePhoneProxy=" +
usePhoneProxy + "&id=",id);}
function op(id){ventana("email/enviar_a_un_amigo.php?id=",id);}
function ox(id){ventana("denunciar/marcar.php?id=",id);}
function om (ide){window.open('/mapa/?id='+ide, '', 'toolbar=no, scrollbars=no,
width=670, height=470');}
function mueveba(d){var j=0;var x=30;for (var i=0;i<20;i++)
{setTimeout("document.getElementById('dbus').scrollLeft =
document.getElementById('dbus').scrollLeft"+d+";",x*j);j++;}}
function cn (nombre){document.getElementById('pr').value = nombre;}
function abre(dir){document.location = "/"+dir;}
function addToFavorites() {
var parser = document.createElement('a');
parser.href = location.href;
var url = "http://" + parser.hostname;
var name = parser.hostname;
if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox < 23
window.sidebar.addPanel(name, url, "");
} else if (window.external && window.external.AddFavorite) { // IE
window.external.AddFavorite(url, name);
} else if (window.opera && window.print) {
window.external.AddFavorite(url, name);
}else alert("Pulsa ctrl+D para añadir " + parser.hostname.replace("www.", "") +
" a tus favoritos");
}
function cpr(q){
var patt = /\d\d\d\d\d\d\d\d.htm/i;
var sel = 'part';
var urlp = top.location.href;
if(q==1) sel = 'prof';
if(! patt.test(urlp)){
if(urlp.indexOf('?') > 20){
urlp = urlp+'&vendedor='+sel;
}else{
urlp = urlp+'?vendedor='+sel;
}
top.location.href = urlp;
}
}

function isValidDate(date) {
var matches = /^(\d{2})[-\/](\d{2})[-\/](\d{4})$/.exec(date);
if (matches == null) return false;
var d = matches[1];
var m = matches[2] - 1;
var y = matches[3];
var composedDate = new Date(y, m, d);
return composedDate.getDate() == d &&
composedDate.getMonth() == m &&
composedDate.getFullYear() == y;
}

function removeChildren(element) {
while (element.hasChildNodes()){
element.removeChild(element.lastChild);
}
}

function selectChanged(value, wrapper, targetValueHolderId, targetValueHolderText,


preffix) {

removeChildren(document.getElementById('lista_ajax_list'));

if(value > 0 && value < 53 && value != 'df'){


document.getElementById(wrapper).className = '';
}
else {
document.getElementById(wrapper).className = 'oculto';
}

document.getElementById(preffix + "_" + targetValueHolderId).value = null;


document.getElementById(preffix + "_" + targetValueHolderText).value = null;
document.getElementById(preffix + "_" + targetValueHolderText).focus();
document.getElementById(preffix + "_zona").value=null;
document.getElementById(preffix + "_zona_id").value=null;
}

function onEnter(e, localidadElementId, provincia, targetValueHolderId, type,


preffix, canSkip){
e = e || event;

if ((e.keyCode || e.which || e.charCode) == 13) {


e.preventDefault();
ajaxSearchLoc(localidadElementId, provincia, targetValueHolderId, type,
preffix, canSkip);
}
}

function setLocValueFromAjaxList(targetValueHolderId, value_id, localzona_element,


value_text, type, preffix, canSkip){
document.getElementById(preffix + "_" + targetValueHolderId).value = value_id;
document.getElementById(preffix + "_" + localzona_element).value = value_text;
document.getElementById('popupwrapper_lista_ajax').style.display = 'none';

switch (type) {
default:
case 'zona':
document.getElementById(preffix + "_div_zona").className = '';
break;
case 'localidad':
document.getElementById(preffix + "_div_zona").className = 'oculto';
var zona = document.getElementById(preffix + '_zona')
zona.value = '';
var zona_id = document.getElementById(preffix + '_zona_id')
zona_id.value = '';
ajaxSearchLoc(targetValueHolderId, null, 'zona_id', 'zona', preffix,
canSkip);
break;
}
}

function ajaxSearchLoc(localzona_id, provincia, targetValueHolderId, type, preffix,


canSkip){
var localzona = document.getElementById(preffix + "_" + localzona_id);
if ((localzona.value.length < 3 && preffix == 'localidad') || (preffix ==
'zona' && localzona.value == ''))
return;
var popupwrapper_lista_ajax =
document.getElementById('popupwrapper_lista_ajax');
var lista_ajax_list = document.getElementById('lista_ajax_list');
var ajax = newAjax();
var canSkip = canSkip;

switch (type) {
default:
case 'localidad':
var ajaxUrl = '/autocomplete/buscaLocalidad.php?provincia=' + provincia
+ '&localidad=' + localzona.value;
break;
case 'zona':
var ajaxUrl = '/autocomplete/buscaZonas.php?idloc=' + localzona.value;
break;
}
localTargetValueHolderId = targetValueHolderId;
ajax.open("GET", ajaxUrl, false);
ajax.onreadystatechange=function() {
if (ajax.readyState == 4) {
removeChildren(lista_ajax_list);
if (ajax.responseText.length > 0) {
var rows = ajax.responseText.split('\n');
if(rows.length == 1) {
var loc = rows[0].split(';');
setLocValueFromAjaxList(targetValueHolderId, loc[0], type,
loc[1] , type, preffix, canSkip);
}
else {

document.getElementById(preffix + "_div_zona").className =
'oculto';
var zona = document.getElementById(preffix + '_zona')
zona.value = '';
var zona_id = document.getElementById(preffix + '_zona_id')
zona_id.value = '';

var title = document.createElement('span');


title.innerHTML = "Seleccione " + type;
title.style.fontWeight = 'bold';

lista_ajax_list.appendChild(title);
lista_ajax_list.appendChild(document.createElement('br'));
lista_ajax_list.appendChild(document.createElement('br'));

if (canSkip && type == 'zona'){


var skipButton = document.createElement('label');
skipButton.innerHTML = "Cualquiera";
skipButton.setAttribute('onclick',
'setLocValueFromAjaxList(\'' + targetValueHolderId + '\', \'\', \'' + type +
'\', \'\', \'' + type + '\', \'' + preffix + '\', ' + canSkip + ')');
skipButton.className = 'lista_ajax_option';
lista_ajax_list.appendChild(skipButton);
lista_ajax_list.appendChild(document.createElement('br'));
}

for (i = 0; i < rows.length; i++) {


var loc = rows[i].split(';');
var label = document.createElement('label');
label.innerHTML = loc[1];
label.setAttribute('onclick', 'setLocValueFromAjaxList(\''
+ targetValueHolderId + '\', ' + loc[0] + ', \'' + type + '\', \'' + loc[1] +
'\', \'' + type + '\', \'' + preffix + '\', ' + canSkip + ')');
label.className = 'lista_ajax_option';
lista_ajax_list.appendChild(label);
lista_ajax_list.appendChild(document.createElement('br'));
}
popupwrapper_lista_ajax.style.display = "table";
}
}else{
if (type == 'localidad')
alert('No se ha encontrado ninguna localidad con ese nombre.
Revise el texto y escriba el nombre de la localidad correctamente.');
}
}
};
ajax.send(null);
}

function processAjaxCarModels(carModels){
if (document.getElementById('carmodels')) {
document.getElementById('carmodels').innerHTML = carModels;
}
}

function getCarModels(carBrand){
document.getElementById('categoria').value=carBrand;
var urlc = '/buscadores/movil/getCarModels.php?carBrand=' +
encodeURIComponent(carBrand);
var ajax = newAjax();
ajax.open("GET", urlc, true);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4) {
processAjaxCarModels(ajax.responseText);
}
};
ajax.send(null);
}

function setCarModel(carModel){
if(carModel=='otros'){

document.getElementById('categoria').value=document.getElementById('marca2').value;
document.getElementById('modelin').innerHTML = '<input
onkeydown="if(event.keyCode==13) cabu();" type=text
onfocus="if(this.value==\'modelo\')this.value=\'\';" id="palabras"
placeholder="modelo" maxlength=30 class="imputs" value="modelo" tabindex="6"
style="width:94%">';
}else if(carModel==''){

document.getElementById('categoria').value=document.getElementById('marca2').value;
}else if(carModel!=''){
document.getElementById('categoria').value=carModel;
}
}

function toggleExtraDescription(id) {
var splitId = id.split("-");

if (document.getElementById("readMoreTx-" + splitId[1]).className ==
"readMoreHidden") {
document.getElementById("readMoreTx-" + splitId[1]).className =
"readMoreShown";
document.getElementById(id).innerHTML = " Leer menos";
}
else {
document.getElementById("readMoreTx-" + splitId[1]).className =
"readMoreHidden";
document.getElementById(id).innerHTML = " ... Leer más";
}
}

S-ar putea să vă placă și