function tBienesVacacional(){this.fotos=new Array();this.color=new Array();this.superficies=new Array();this.banos=new Array();this.habitaciones=new Array();this.nombresZonas=new Array();this.idsTipoBien=new Array();this.nombresTiposBien=new Array();this.provincias=new Array();this.poblaciones=new Array();this.zonas=new Array();this.idsbien=new Array();this.destacados=new Array();this.idsLocalizacion=new Array();this.bienesZona=new Array();this.aCaracAleatorias=new Array();this.fechasModificacion=new Array();this.preciosMinimos=new Array();this.preciosMaximos=new Array();this.fi=new Array();this.ff=new Array();this.titulos=new Array();this.ocupaciones=new Array();this.pensiones=new Array();this.ids_bien=new Array();this.precios=new Array();this.colores=new Array();this.aCaracteristicasLargas=new Array();this.aCaracteristicasCortas=new Array();this.aDV=new Array();this.aX=new Array();this.aY=new Array();this.aPosiciones=new Array();this.inicializaPrecios=function(){for(i=1;i<=this.longitud;i++){this.preciosMinimos[i]=999999;this.preciosMaximos[i]=-999999}};this.inicializaPosiciones=function(){for(i=1;i<=this.longitud;i++){this.aPosiciones[i]=i}};this.init=function(){this.inicializaPosiciones();this.inicializaPrecios();this.posicion=0;this.posicionPeriodos=0;this.longitud=0;this.s=""};this.init();this.ordenar=function(b){if(b=="precio asc"){b="a";objArray=this.precios}else{if(b=="precio desc"){b="d";objArray=this.precios}else{if(b=="superficie asc"){b="a";objArray=this.superficies}else{if(b=="superficie desc"){b="d";objArray=this.superficies}else{if(b=="fecha_modif asc"){b="a";objArray=this.fechasModificacion}else{if(b=="fecha_modif desc"){b="d";objArray=this.fechasModificacion}}}}}}this.inicializaPosiciones();a=new Array();for(i=0;i<this.longitud;i++){a[i]=parseInt(objArray[i])}this.procesoQS(a,b,0,a.length-1)};this.procesoQS=function(b,h,d,l){var g=d;var e=l;var f;var k=b[Math.floor((g+e)/2)];do{if(h=="a"){while((g<l)&&(k>b[g])){g++}while((e>d)&&(k<b[e])){e--}}else{while((g<l)&&(k<b[g])){g++}while((e>d)&&(k>b[e])){e--}}if(g<e){f=b[g];b[g]=b[e];b[e]=f;f=this.aPosiciones[g];this.aPosiciones[g]=this.aPosiciones[e];this.aPosiciones[e]=f}if(g<=e){g++;e--}}while(g<=e);(d<e)?this.procesoQS(b,h,d,e):"";(g<l)?this.procesoQS(b,h,g,l):""};this.ComprobarPosicion=function(b){this.posicion=b;return(b<=this.longitud)};this.anyadir=function(d,e){this.posicion=this.longitud;var b=0;var c=0;for(b=0;b<d.recordcount;b++){c=e+b;this.fotos[c]=d.data.fotos[b].toString();this.banos[c]=d.data.banos[b].toString();this.superficies[c]=d.data.superficie[b].toString();this.habitaciones[c]=d.data.habitaciones[b].toString();this.s=d.data.nombrezona[b].toString();if(!isNaN(this.s)&&(this.s.length<=3)&&(this.s!="")){this.s=d.data.nombrezona[this.s.valueOf()].toString()}this.nombresZonas[c]=this.s;this.s=d.data.id_tipo_bien[b].toString();if(this.s.length<4){this.s=d.data.id_tipo_bien[this.s.valueOf()].toString()}this.idsTipoBien[c]=this.s;this.nombresTiposBien[c]=aTiposBien[this.idsTipoBien[c]];this.zonas[c]=d.data.zona[b].toString();this.idsbien[c]=d.data.id_bien[b].toString();this.idsbien[c]=d.data.id_bien[b].toString();this.destacados[c]=d.data.lider[b].toString();this.s=d.data.id_localizacion[b].toString();if(this.s.length<8){this.s=d.data.id_localizacion[this.s.valueOf()].toString()}this.idsLocalizacion[c]=this.s;this.s=d.data.nombrepoblacion[b];if(!isNaN(this.s)){this.s=d.data.nombrepoblacion[this.s.valueOf()].toString()}this.poblaciones[c]=this.s;if(typeof(d.data.bieneszona)!="undefined"){this.bienesZona[c]=d.data.bieneszona[b].toString()}this.s=d.data.caracaleatoria[b].toString();if((this.s!="")&&!isNaN(this.s)){this.s=d.data.caracaleatoria[this.s.valueOf()].toString()}this.aCaracAleatorias[c]=this.s;this.aCaracteristicasCortas[c]=unescape(d.data.caracteristicas[b].toString());this.aCaracteristicasLargas[c]="";this.aDV[c]=d.data.dv[b].toString();this.aX[c]=d.data.x_g[b].toString();this.aY[c]=d.data.y_g[b].toString()}this.longitud=this.idsbien.length-1};this.anyadirPreciosPeriodos=function(d,e){this.posicionPeriodos=this.longitud;var b=0;var c=0;for(b=0;b<d.recordcount;b++){c=e+b;this.s=d.data.id_bien[b].toString();if(!isNaN(this.s)&&(this.s.length<=3)&&(this.s!="")){this.s=d.data.id_bien[this.s.valueOf()].toString()}this.ids_bien[c]=this.s;pos=this.damePosicion(this.ids_bien[c]);precio=d.data.pp[b].toString();this.precios[c]=d.data.pp[b].toString();if(isNaN(this.preciosMinimos[pos])){this.preciosMinimos[pos]=999999}if(isNaN(this.preciosMaximos[pos])){this.preciosMaximos[pos]=-999999}if(precio<this.preciosMinimos[pos]){this.preciosMinimos[pos]=precio}if(precio>this.preciosMaximos[pos]){this.preciosMaximos[pos]=precio}this.s=d.data.fi[b].toString();if(!isNaN(this.s)){this.s=d.data.fi[this.s.valueOf()].toString()}this.fi[c]=this.s;this.s=d.data.ff[b].toString();if(!isNaN(this.s)){this.s=d.data.ff[this.s.valueOf()].toString()}this.ff[c]=this.s;this.s=d.data.ti[b].toString();if(!isNaN(this.s)){this.s=d.data.ti[this.s.valueOf()].toString()}this.titulos[c]=this.s;this.ocupaciones[c]=d.data.oc[b].toString();this.s=d.data.pe[b].toString();if(!isNaN(this.s)){this.s=d.data.pe[this.s.valueOf()].toString()}this.pensiones[c]=this.s;this.s=d.data.co[b].toString();if(this.s.length<3){this.s=d.data.co[this.s.valueOf()].toString()}this.colores[c]=this.s}};this.dameFoto=function(b){return(this.ComprobarPosicion(b))?this.fotos[b]:""};this.damePrecioMinimo=function(b){return(this.ComprobarPosicion(b))?this.s=this.preciosMinimos[b]:""};this.damePrecioMaximo=function(b){return(this.ComprobarPosicion(b))?this.s=this.preciosMaximos[b]:""};this.dameBanos=function(b){return(this.ComprobarPosicion(b))?this.banos[b]:""};this.dameHabitaciones=function(b){return(this.ComprobarPosicion(b))?this.habitaciones[b]:""};this.dameNombreZona=function(b){return(this.ComprobarPosicion(b))?this.nombresZonas[b]:""};this.dameIdTipoBien=function(b){return(this.ComprobarPosicion(b))?this.idsTipoBien[b]:""};this.dameNombreTipoBien=function(b){return(this.ComprobarPosicion(b))?this.nombresTiposBien[b]:""};this.dameZona=function(b){return(this.ComprobarPosicion(b))?this.zonas[b]:""};this.dameIdBien=function(b){return(this.ComprobarPosicion(b))?this.idsbien[b]:""};this.dameDestacado=function(b){return(this.ComprobarPosicion(b))?this.s=this.destacados[b]:""};this.dameIdLocalizacion=function(b){return(this.ComprobarPosicion(b))?this.idsLocalizacion[b]:""};this.damePeriodos=function(b){return(this.ComprobarPosicion(b))?this.periodos[b]:""};this.dameNombrePoblacion=function(b){return(this.ComprobarPosicion(b))?this.poblaciones[b]:""};this.damePosicion=function(b){r=-1;for(i=0;(i<this.idsbien.length)&&(r==-1);i++){(b==this.idsbien[i])?r=i:""}return r};this.dameCaracAleatoria=function(b){return(this.ComprobarPosicion(b))?this.aCaracAleatorias[b]:""};this.buscarInicioFinal=function(b){var e=999999;var d=-999999;var c=0;for(c=0;c<this.ids_bien.length;c++){if(this.ids_bien[c]==b){if(c<e){e=c}if(c>d){d=c}}}return e+","+d};this.hueco=function(b){return(typeof(this.idsbien[b])=="undefined")};this.dameCaracteristicasLargas=function(b){return(this.ComprobarPosicion(b))?this.aCaracteristicasLargas[b]:""};this.dameCaracteristicasCortas=function(b){return(this.ComprobarPosicion(b))?this.aCaracteristicasCortas[b]:""};this.ponCaracteristicasLargas=function(c,b){this.aCaracteristicasLargas[c]=b};this.dameDV=function(b){return(this.ComprobarPosicion(b))?this.aDV[b]:""};this.dameX=function(b){return(this.ComprobarPosicion(b))?this.aX[b]:""};this.dameY=function(b){return(this.ComprobarPosicion(b))?this.aY[b]:""};this.dameSuperficie=function(b){return(this.ComprobarPosicion(b))?this.superficies[b]:""};this.dameFechaModificacion=function(b){return(this.ComprobarPosicion(b))?this.fechasModificacion[b]:""}};