function tBienes()
{
	// Propiedades
	this.fotos = new Array();
	this.precios = new Array();
	this.superficies = new Array();
	this.habitaciones = new Array();
	this.banos = new Array();
	this.nombresZonas = new Array();
	this.idsTipoBien = new Array();
	this.nombresTiposBien = new Array();
	this.poblaciones = new Array();
	this.zonas = new Array();
	this.contratos = new Array();
	this.idsbien = new Array();
	this.destacados = new Array();
	this.idsLocalizacion = new Array();
	this.fechasModificacion = new Array();
	this.bienesZona = new Array();
	this.preciosAnteriores = new Array();	
	this.aPosiciones = new Array();
	this.aCaracAleatorias = new Array();
	this.aDirecciones = new Array();
	this.aCaracteristicasLargas = new Array();
	this.aCaracteristicasCortas = new Array();
	this.aDV = new Array();
	this.aX = new Array();
	this.aY = new Array();
	this.s = '';
	
	this.inicializaPosiciones = function()
	{
		for (i = 1; i <= this.longitud; i++)
			this.aPosiciones[i] = i;	
	}
	
	this.init = function ()
	{
		this.posicion = 0;								// Posición de entre todos los objetos.			
		this.inicializaPosiciones();
		this.longitud = 0;								// Número de bienes entre todos los objetos.
		this.longitudBusqueda = 0;		
		this.bienesZona.splice(0, this.bienesZona.length)
		this.bienesZona.length = 0
		this.idsbien.splice(0, this.idsbien.length)
		this.idsbien.length = 0
	}
	
	this.init();
	
	this.ordenar = function(orden){}
	
	this.ComprobarPosicion = function (pos)
	{
		this.posicion = pos;
		return (pos <= this.longitud);
	}
	
	this.anyadir = function(objeto, inicio)
	{
		this.posicion = this.longitud
		var j = 0
		var i = 0
		for (j = 0; j < objeto.recordcount; j++)
		{			
			i = inicio + j;
			try{
				this.fotos[i] = objeto.data.fotos[j].toString();
				this.precios[i] = objeto.data.precio[j].toString();
				this.superficies[i] = objeto.data.superficie[j].toString();
				this.habitaciones[i] = objeto.data.habitaciones[j].toString();
				this.banos[i] = objeto.data.banos[j].toString();
				
				this.s = objeto.data.nombrezona[j].toString()
				if (!isNaN(this.s) && (this.s.length <= 3) && (this.s != ''))
					this.s = objeto.data.nombrezona[this.s.valueOf()].toString();
				this.nombresZonas[i] = this.s;
				
				this.s = objeto.data.id_tipo_bien[j].toString();
				if (this.s.length  < 4)
					this.s = objeto.data.id_tipo_bien[this.s.valueOf()].toString();
				this.idsTipoBien[i] = this.s;
				
				this.nombresTiposBien[i] = aTiposBien[this.idsTipoBien[i]];
				
				this.s = objeto.data.zona[j].toString();
	
				if (!isNaN(this.s) && (this.s.length < 5))
					this.s = objeto.data.zona[this.s.valueOf()].toString();
				this.zonas[i] = this.s;

				this.idsbien[i] = objeto.data.id_bien[j].toString();
				this.destacados[i] = objeto.data.lider[j].toString();
				
				this.s = objeto.data.id_localizacion[j].toString();
				if (this.s.length  < 6)
					this.s = objeto.data.id_localizacion[this.s.valueOf()].toString();
				this.idsLocalizacion[i] = this.s;
	
				this.s = objeto.data.nombrepoblacion[j];
				if (!isNaN(this.s))
					this.s = objeto.data.nombrepoblacion[this.s.valueOf()].toString();
				this.poblaciones[i] = this.s;
				if (objeto.data.contrato)
					this.contratos[i] = objeto.data.contrato[j].toString();
				if (typeof(objeto.data.bieneszona) != 'undefined')
					this.bienesZona[i] = objeto.data.bieneszona[j].toString();
				else
					this.bienesZona[i] = 0;
				
				this.s = objeto.data.caracaleatoria[j].toString();
				if (!isNaN(this.s))
					this.s = objeto.data.caracaleatoria[this.s.valueOf()].toString();
				this.aCaracAleatorias[i] = this.s;
				
				this.aDirecciones[i] = objeto.data.direccion[j].toString();
				try{				
					this.aCaracteristicasCortas[i] = unescape(objeto.data.caracteristicas[j].toString());
					this.aCaracteristicasLargas[i] = '';
				}catch(e){this.aCaracteristicasCortas[i] = '';this.aCaracteristicasLargas[i] = '';}
				try{
				this.aDV[i] = objeto.data.dv[j].toString();
				this.aX[i] = objeto.data.x_g[j].toString();
				this.aY[i] = objeto.data.y_g[j].toString();
				}catch(e){}	
				this.aPosiciones[i] = i;
			}catch(e){alert(e)}
		}
		this.longitud = this.idsbien.length - 1;
	}
	
	this.anyadirPreciosAnteriores = function(obj)
	{
		var j = 0;
		for(i = 0; i < obj.recordcount; i++)
		{
			j = 1;
			while (j <= this.length())
			{
				if (this.idsbien[j] == obj.data.id[i])
				{
					this.preciosAnteriores[j] = obj.data.pa[i];
					break;
				}
				else j++;
			}
		}
	}
	
	this.dameFoto = function(pos)
	{		
		return (this.ComprobarPosicion(pos))?this.fotos[pos]:'';
	}
	
	this.damePrecio = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.s = this.precios[pos]:'';
	}
	
	this.damePrecioAnt = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.s = this.preciosAnteriores[pos]:'';
	}
	
	this.damePrecio2 = function(id)
	{
		for(var i = 1; i <= this.longitud; i++)
		{
			if (this.idsbien[i] == id)
			{
				return this.precios[i]	
			}
		}
	}
	
	this.dameSuperficie = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.superficies[pos]:'';
	}
	
	this.dameHabitaciones = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.habitaciones[pos]:'';
	}
	
	this.dameBanos = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.banos[pos]:'';
	}
	
	this.dameNombreZona = function(pos)
	{		
		return (this.ComprobarPosicion(pos))?this.nombresZonas[pos]:'';
	}
	
	this.dameNombrePoblacion = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.poblaciones[pos]:'';
	}
	
	this.dameIdTipoBien = function (pos)
	{
		return (this.ComprobarPosicion(pos))?this.idsTipoBien[pos]:'';
	}
	
	this.dameNombreTipoBien = function (pos)
	{		
		return (this.ComprobarPosicion(pos))?this.nombresTiposBien[pos]:'';
	}
	
	this.dameZona = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.zonas[pos]:'';
	}
	
	this.dameContrato = function(pos)
	{		
		return (this.ComprobarPosicion(pos))?this.contratos[pos]:'';
	}
	
	this.dameIdBien = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.idsbien[pos]:'';
	}
	
	this.dameDestacado = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.s = this.destacados[pos]:'';
	}
	
	this.dameIdLocalizacion = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.idsLocalizacion[pos]:'';
	}
	
	this.damePosicion = function(id_bien)
	{
		r = -1;
		for(i = 0; (i < this.idsbien.length) && (r == -1); i++)
			(id_bien == this.idsbien[i])?r = i:'';
		return r;
	}	
	
	this.dameFechaModificacion = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.fechasModificacion[pos]:'';
	}
	
	this.dameCaracAleatoria = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aCaracAleatorias[pos]:'';
	}
	
	this.dameDireccion = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aDirecciones[pos]:'';
	}
	
	this.length = function()
	{
		return this.fechasModificacion.length	
	}
	
	this.hueco = function(posicion)
	{
		return (typeof(this.idsbien[posicion]) == 'undefined')
	}
	
	this.dameCaracteristicasLargas = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aCaracteristicasLargas[pos]:'';
	}
	
	this.dameCaracteristicasCortas = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aCaracteristicasCortas[pos]:'';
	}
	
	this.ponCaracteristicasLargas = function(pos, s)
	{
		this.aCaracteristicasLargas[pos] = s;
	}
	
	this.dameDV = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aDV[pos]:'';
	}
	
	this.dameX = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aX[pos]:'';
	}
	
	this.dameY = function(pos)
	{
		return (this.ComprobarPosicion(pos))?this.aY[pos]:'';
	}	
}