		var miemail="";
		var minombre="";

		var bounds;
		var funcionCallBack="";
		var time;
		var transparency = 0;
		var time2;
		var transparency2 = 0;
		var propiedadEmail=0;
		var propiedadGuardarFavorito=0;
                var pantalla="";
                var blnVacio=true;

		var intMicrositio = 0;

		var sesion="false";
                var usuadmin=0;
                
		var pagina=1;
		var pags=0;
		var propsescritas=0;
		var propsescritasCon=0;
		var propsescritasSin=0;
		var blnTrabajando=true;
		var indicefoto=1;
		var muestraPaginacionPopup=false;
		var intListenerCliente=0;
		var reqs = new Array;
		var idPropiedadPopUp;
		var sorted="match";

		var reqAdmin;
                var reqOper;
		var reqTipo;
		var reqUbi;
		var reqFoto;
		var reqPV;
		var reqPR;
		var reqT;
		var reqC;
		var reqTipoCambio;
		var reqRegistro;
		var reqGuardar;
		var reqFavs;
                var reqEdit;
                var reqPwd;

		var maxLon=0;
		var minLon=0;
		var maxLat=0;
		var minLat=0;

        var divEncabezado;
        var divZona;
        var divMenu;
        var divCargando;
        var divResultados;
        var divMapContainer;
        var divBody;
        var divIntro;
      
        var spanBanner2;
        var divPaginacion;
        var divPaginacion2;
        var divInmuebles;
        var txtBuscar;
        var map;
        var mapita;
        var height;
        var width;
        var divPie;
        var req;
        var arrResults;
        var AInmuebles = new Array;
        var arrFavoritos = new Array;

        var divFiltros1;
        var divFiltrosOperacion;
        var divFiltrosTipo;
        var divFiltrosUbicacion;
        var divFiltrosAvanzados;
        var TipoCambio;

		var mouseX=0;
		var mouseY=0;
		var blnEsperandoPopUp=false;
		var blnEsperandoAyuda=false;

//filtros
        var fil_uso = "";//1
        var fil_tipo = "";//2
        var fil_pai_cve = "";//3
        var fil_est_cve = "";//4
        var fil_del_cve = "";//5
        var fil_col_cve = "";//6
        var fil_y1 = "";//7.1
        var fil_y2 = "";//7.2
        var fil_x1 = "";//7.3
        var fil_x2 = "";//7.4
        var fil_precio_venta_min = "";//8.1
        var fil_precio_venta_max = "";//8.2
        var fil_precio_renta_min = "";//9.1
        var fil_precio_renta_max = "";//9.2
        var fil_m2_terreno_min = "";//10.1
        var fil_m2_terreno_max = "";//10.2
        var fil_m2_construccion_min = "";//11.1
        var fil_m2_construccion_max = "";//11.2
		var fil_operacion="";
		var fil_favoritos="";
                
                var arrHistory = new Array;

        function Inmueble(id){
            this.Id = id;
            this.Tipo='';
            this.Uso='';
            this.UsoSuelo='';
            this.Cargado = false;
            this.Thumb = '';
            this.Logo = '';
            this.Fotos = new Array;
            this.Videos = new Array;
            this.Documentos = new Array;
            this.Amenidades = new Array;
            this.Unidades = new Array;
            this.Pin=null;
            this.Anuncio=null;
            this.Vendedor=null;
            this.ContactoInmueble=null;
            this.totalfotos=0;
            this.Direccion = '';
            this.NumExt = '';
            this.NumInt = '';
            this.Zona = '';
            this.Colonia = '';
            this.CP = '';
            this.Delegacion = '';
            this.Estado = '';
            this.Pais = '';
            this.Ref1 = '';
            this.Ref2 = '';
            this.RefExterna = '';
            this.Mensaje1 ='';
            this.Mensaje2 ='';
            this.PrecioVenta = '';
            this.PrecioRenta = '';
            this.PrecioMant = '';
            this.FechaEntrega = '';
            this.Nombre = '';
            this.SuperficieTerreno = '';
            this.SuperficieConstruccion = '';
            this.Frente='';
            this.Fondo='';
            this.SuperficieJardin='';
            this.SuperficieTerraza='';
            this.Niveles='';
            this.Cuartos = '';
            this.Banios = '';
            this.MediosBanios = '';
            this.Estacionamientos = '';
            this.Edad = '';
            this.CuartoTV = '';
            this.EstadoConservacion='';
            this.Estilo='';
            this.Acabados='';
            this.NumDeptos='';
            this.NivelDepto='';
            this.CuartoServ='';
            this.Instalaciones='';
            this.AreasComunes='';
            this.Calificacion='';
            this.Condiciones='';
            this.Observaciones = '';
            this.Traspaso = 0;
            this.Venta = 0;
            this.Renta = 0;
            this.PreVenta = 0;
            this.Moneda='';
            this.MonedaRenta='';
            this.Lat = 0;
            this.Lng = 0;
            this.LatReal = 0;
            this.LngReal = 0;
            this.Error = 0;
            this.PDF='';
            this.Descripcion='';
            this.Estatus='';
            this.FechaFin='';
            this.MotivoRechazo='';
            
             this.iduso=0;
             this.idtipo=0;
             this.idetl=0;
             this.idest=0;
             this.iddel=0;
             this.idcol=0;

        }//Inmueble

        function ServerDocument(url){
            this.Id=0;
            this.URL=url;
            this.FotoPrincipal=false;
            this.Uploaded=false;
            this.Descripcion='';
        }//ServerDocument
        
		function Vendedor(){
			this.Id = 0;
			this.Nombre='';
			this.Foto='';
			this.Tel1='';
			this.Tel2='';
			this.Celular='';
			this.EMail1='';
			this.EMail2='';
			this.Empresa='';
			this.Logo='';
			this.www='';
			this.Sexo='M';
		}//Vendedor

		function ContactoInmueble(){
			this.www='';
			this.EMail1='';
			this.EMail2='';
			this.Tel1='';
			this.Tel2='';
			this.NombreContacto='';
		}//ContactoInmueble

                
                function FiltroHistoria(){
                  this.fil_favoritos = '';
                  this.txtBuscar =  '';
                  this.fil_uso =  '';
                  this.fil_tipo =  '';
                  this.fil_pai_cve =  '';
                  this.fil_est_cve =  '';
                  this.fil_del_cve =  '';
                  this.fil_col_cve =  '';
                  this.intMicrositio =  '';
                  this.fil_y1 =  '';
                  this.fil_y2 =  '';
                  this.fil_x1 =  '';
                  this.fil_x2 =  '';
                  this.fil_precio_venta_min =  '';
                  this.fil_precio_venta_max =  '';
                  this.fil_precio_renta_min =  '';
                  this.fil_precio_renta_max =  '';
                  this.fil_m2_terreno_min =  '';
                  this.fil_m2_terreno_max =  '';
                  this.fil_m2_construccion_min =  '';
                  this.fil_m2_construccion_max =  '';
                  //this.TipoCambio =  '';
                  this.pagina =  '';
                  this.xcenter =  '';
                  this.ycenter =  '';
                }//FiltroHistoria
                

        function Favorito(id, comentario){
		    this.Id = id;
            this.Comentario=comentario;
        }//Favorito

        function Amenidad(id, icono, descripcion){
            this.Id = id;
            if ((icono=='') || (icono=='null')){
                    this.Icono = 'ico/ame/caract_otros.gif';
            } else {
                    this.Icono = icono;
            }

            this.Descripcion = descripcion;
          }//Amenidad

        function Documento(id, tipo, descripcion, url){
            this.Id = id;
            this.Tipo = tipo;
            this.Descripcion = descripcion;
            this.Url = url;
            this.Uploaded=false;
        }//Documento


        function Unidad(id, tipo, disp, m2c, m2t, precio, moneda, recs, bans, medbans, estac){
            this.Id = id;
            this.Tipo = tipo;
            this.Disponibles = disp;
            this.M2C = m2c;
            this.M2T = m2t;
            this.Precio = precio;
            this.Moneda = moneda;
            this.Recamaras = recs;
            this.Banios = bans;
            this.MediosBanios = medbans;
            this.Estacionamientos = estac;
		}//Unidad


        function Anuncio(){
            this.EstatusAnuncio = ''; //VIGENTE, NO VIGENTE, CANCELADO
            this.EstatusPropiedad = ''; //DISPONIBLE, VENDIDA/RENTADA, DESCONOCIDO
            this.NumVisitas = 0;
            this.FechaAlta = '';
            this.FechaUltimaPublicacion = '';
            this.FechaUltimaModif = '';
		}//Anuncio


	String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g,'') }
	Array.prototype.remove = function(from, to) {
	  var rest = this.slice((to || from) + 1 || this.length);
	  this.length = from < 0 ? this.length + from : from;
	  return this.push.apply(this, rest);
	};
        
        String.prototype.reverse = function(){
        splitext = this.split("");
        revertext = splitext.reverse();
        reversed = revertext.join("");
        return reversed;
        }

 	function sqr(val) { return val * val }
	function getWindowWidthReal(){var temp;if(window.innerWidth) {temp= window.innerWidth;}else if(document.documentElement && document.documentElement.clientWidth){temp = document.documentElement.clientWidth;}else if(document.body && document.body.clientWidth){temp = document.body.clientWidth;}else {temp= 0;}if (temp>950){return temp;}else{return temp;}}//getWindowWidth
	function getWindowWidth(){var temp;if(window.innerWidth) {temp= window.innerWidth;}else if(document.documentElement && document.documentElement.clientWidth){temp = document.documentElement.clientWidth;}else if(document.body && document.body.clientWidth){temp = document.body.clientWidth;}else {temp= 0;}if (temp>950){return temp;}else{return 950;}}//getWindowWidth
	function getWindowHeight(){var temp;if(window.innerHeight) {temp = window.innerHeight;}else if(document.documentElement && document.documentElement.clientHeight){temp =document.documentElement.clientHeight;}else if(document.body && document.body.clientHeight){temp =document.body.clientHeight;}else {temp =0;}if (temp>500){return temp;}else{return 500;}}//getWindowHeight
        function init() {var reqTemp;if (window.XMLHttpRequest) {reqTemp = new XMLHttpRequest();if (reqTemp.overrideMimeType) {reqTemp.overrideMimeType('text/xml');}} else if (window.ActiveXObject) {try {reqTemp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {reqTemp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}var url = "mdiServlet";reqTemp.open("POST", url, true);reqTemp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");return reqTemp;}//init
        function initUpload() {var reqTemp;if (window.XMLHttpRequest) {reqTemp = new XMLHttpRequest();if (reqTemp.overrideMimeType) {reqTemp.overrideMimeType('text/xml');}} else if (window.ActiveXObject) {try {reqTemp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {reqTemp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}var url = "ServletUpload";reqTemp.open("POST", url, true);return reqTemp;}//initUpload
	//function onhover(row){row.style.backgroundColor = 'rgb(52,121,205)';row.style.color = '#ffffff';}//onhover
	function onhover(row){row.style.backgroundColor = 'rgb(158,207,64)';row.style.color = '#ffffff';}//onhover

	//function offhover(row){row.style.backgroundColor = 'rgb(230,237,250)';row.style.color = '#000000';}//offhover
	function offhover(row){row.style.backgroundColor = 'rgb(255,255,255)';row.style.color = 'rgb(0,0,255)';}//offhover
	//function HoverTabla(tabla){table = document.getElementById(tabla);for(var i = 0; i < table.rows.length; i++){table.rows[i].onmouseover = function(){onhover(this)};table.rows[i].onmouseout = function(){offhover(this)};table.rows[i].style.backgroundColor = 'rgb(230,237,250)';table.rows[i].color = '#000000';table.rows[i].style.cursor = 'pointer';}}//HoverTabla
	function HoverTabla(tabla){table = document.getElementById(tabla);for(var i = 0; i < table.rows.length; i++){table.rows[i].onmouseover = function(){onhover(this)};table.rows[i].onmouseout = function(){offhover(this)};table.rows[i].style.backgroundColor = 'rgb(255,255,255)';table.rows[i].style.color = 'rgb(0,0,255)';table.rows[i].style.cursor = 'pointer';}}//HoverTabla

	function Minusculas(inicio){strfinal = "";inicio = inicio.toLowerCase();primera = inicio.substring(0,1);primera = primera.toUpperCase();resto = inicio.substring(1);strfinal = primera  + resto;return strfinal.trim();}//Minusculas
	function Mayusculas(inicio){strfinal = "";inicio = inicio.toUpperCase();primera = inicio.substring(0,1);primera = primera.toUpperCase();resto = inicio.substring(1);strfinal = primera  + resto;return strfinal.trim();}//Mayusculas
	function MinusMayus(inicio){strfinal = "";inicio_arr = inicio.split(" ");for(i=0; i<(inicio_arr.length); i++){strfinal = strfinal + Minusculas(inicio_arr[i]) + " ";}return strfinal.trim();}//MinusMayus
	function sinAcentos(texto){
		var rExps=[ /[\xC0-\xC4]/g, /[\xE0-\xE4]/g,
		/[\xC8-\xCB]/g, /[\xE8-\xEB]/g,
		/[\xCC-\xCF]/g, /[\xEC-\xEF]/g,
		/[\xD2-\xD6]/g, /[\xF2-\xF6]/g,
		/[\xD9-\xDC]/g, /[\xF9-\xFC]/g,
		/[\xD1]/g, /[\xF1]/g, /[\x26]/g, /[\x25]/g ];

		var repChar=['A','a','E','e','I','i','O','o','U','u','###','###','###-#', '###-##'];
		for(var i=0; i<rExps.length; i++){
                    texto= texto.replace(rExps[i],repChar[i]);
		}
		return texto;
	}//sinAcentos

        function RemplazaString(source, pattern, replace){return source.replace(pattern,replace);}//RemplazaString
        function MarcaAmarillo(strTexto1, strBuscado){var strTexto = strTexto1; var arrnegocios = strBuscado.split(" ");for (iarrnegocios=0;iarrnegocios<arrnegocios.length;iarrnegocios++){strTexto = RemplazaString(strTexto, arrnegocios[iarrnegocios],"<B><font style=\"background-color: rgb(255,255,128); color: rgb(0,0,0);\">" + arrnegocios[iarrnegocios] + "</font></B>");}return strTexto;}//MarcaAmarillo

        
	function IconoMime(MimeType){
		var strUrlIco = '';
		if (MimeType=='DOC'){
			strUrlIco = 'filetypes32/doc.gif';
		} else if (MimeType=='DOCX'){
			strUrlIco = 'filetypes32/doc.gif';
		} else if (MimeType=='XLS'){
			strUrlIco = 'filetypes32/xls.gif';
		} else if (MimeType=='XLSX'){
			strUrlIco = 'filetypes32/xls.gif';
		} else if (MimeType=='MDB'){
			strUrlIco = 'filetypes32/mdb.gif';
		} else if (MimeType=='ACCDB'){
			strUrlIco = 'filetypes32/mdb.gif';
		} else if (MimeType=='CSV'){
			strUrlIco = 'filetypes32/csv.gif';
		} else if (MimeType=='PPS'){
			strUrlIco = 'filetypes32/ppt.gif';
		} else if (MimeType=='PPT'){
			strUrlIco = 'filetypes32/ppt.gif';
		} else if (MimeType=='PPTX'){
			strUrlIco = 'filetypes32/ppt.gif';
		} else if (MimeType=='TXT'){
			strUrlIco = 'filetypes32/txt.gif';
		} else if (MimeType=='PDF'){
			strUrlIco = 'filetypes32/pdf.gif';
		} else if (MimeType=='BMP'){
			strUrlIco = 'filetypes32/bmp.gif';
		} else if (MimeType=='GIF'){
			strUrlIco = 'filetypes32/gif.gif';
		} else if (MimeType=='JPG'){
			strUrlIco = 'filetypes32/jpg.gif';
		} else if (MimeType=='JPEG'){
			strUrlIco = 'filetypes32/jpg.gif';
		} else if (MimeType=='PNG'){
			strUrlIco = 'filetypes32/png.gif';
		} else if (MimeType=='MPEG'){
			strUrlIco = 'filetypes32/mpeg.gif';
		} else if (MimeType=='WMV'){
			strUrlIco = 'filetypes32/wmv.gif';
		} else if (MimeType=='AVI'){
			strUrlIco = 'filetypes32/avi.gif';
		} else if (MimeType=='EXE'){
			strUrlIco = 'filetypes32/exe.gif';
		} else if (MimeType=='ZIP'){
			strUrlIco = 'filetypes32/zip.gif';
		} else if (MimeType=='MPG'){
			strUrlIco = 'filetypes32/mpg.gif';
		} else if (MimeType=='MP3'){
			strUrlIco = 'filetypes32/mp3.gif';
		} else if (MimeType=='MP4'){
			strUrlIco = 'filetypes32/mp4.gif';
		} else if (MimeType=='ODF'){
			strUrlIco = 'filetypes32/odf.gif';
		} else if (MimeType=='ODG'){
			strUrlIco = 'filetypes32/odg.gif';
		} else if (MimeType=='ODP'){
			strUrlIco = 'filetypes32/odp.gif';
		} else if (MimeType=='ODS'){
			strUrlIco = 'filetypes32/ods.gif';
		} else if (MimeType=='ODT'){
			strUrlIco = 'filetypes32/odt.gif';
		} else if (MimeType=='PSD'){
			strUrlIco = 'filetypes32/psd.gif';
		} else if (MimeType=='RTF'){
			strUrlIco = 'filetypes32/rtf.gif';
		} else if (MimeType=='TIF'){
			strUrlIco = 'filetypes32/tif.gif';
		} else if (MimeType=='TIFF'){
			strUrlIco = 'filetypes32/tiff.gif';
		} else if (MimeType=='XML'){
			strUrlIco = 'filetypes32/xml.gif';
		} else if (MimeType=='SWF'){
			strUrlIco = 'filetypes32/swf.gif';
		} else {
			strUrlIco = 'filetypes32/_default.gif';
		}

		return strUrlIco;
	}//IconoMime

        
	function MarcoTabla(strContenido){
		var sH = "<table border='0' cellpadding='0' cellspacing='0'>";
		sH = sH + "<tr>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_01.gif);background-repeat: no-repeat' width='7' height='7'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_02.gif);background-repeat: repeat-x' height='7'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_03.gif);background-repeat: no-repeat' width='7' height='7'></td>";
		sH = sH + "</tr>";
		sH = sH + "<tr height='5px'>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_04.gif);background-repeat: repeat-y' width='7' rowspan=2></td>";
		sH = sH + "<td STYLE='background-color: #ffffff' valign='bottom'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_06.gif);background-repeat: repeat-y'  width='7' rowspan=2></td>";
		sH = sH + "</tr>";
		sH = sH + "<tr>";
		sH = sH + " <td STYLE='background-color: #ffffff; font-size:8pt;'valign=top>";
		sH = sH + strContenido;
		sH = sH + "</td>";
		sH = sH + "<tr>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_07.gif);background-repeat: no-repeat' width='7'  height='7'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_08.gif);background-repeat: repeat-x' height='7'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/white_09.gif);background-repeat: no-repeat'  width='7' height='7'></td>";
		sH = sH + "</tr>";
		sH = sH + "</table>";
		return sH;
	}//MarcoTabla

	function MarcoFoto(strContenido){
		var sH = "<table border='0' cellpadding='0' cellspacing='0'>";
		sH = sH + "<tr>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto1.gif);background-repeat: no-repeat' width='13' height='12'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto2.gif);background-repeat: repeat-x' height='12'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto3.gif);background-repeat: no-repeat' width='17' height='12'></td>";
		sH = sH + "</tr>";
		sH = sH + "<tr height='5px'>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto4.gif);background-repeat: repeat-y' width='13' rowspan=2></td>";
		sH = sH + "<td STYLE='background-color: #ffffff' valign='bottom'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto6.gif);background-repeat: repeat-y'  width='17' rowspan=2></td>";
		sH = sH + "</tr>";
		sH = sH + "<tr>";
		sH = sH + " <td STYLE='background-color: #ffffff; font-size:8pt;'valign=top>";
		sH = sH + strContenido;
		sH = sH + "</td>";
		sH = sH + "<tr>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto7.gif);background-repeat: no-repeat' width='13'  height='28'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto8.gif);background-repeat: repeat-x' height='28'></td>";
		sH = sH + "<td STYLE='background-image: url(imgs/foto9.gif);background-repeat: no-repeat'  width='17' height='28'></td>";
		sH = sH + "</tr>";
		sH = sH + "</table>";
		return sH;
	}//MarcoFoto

	function RegresaValor(xml, strCampo){
		var strValor="";
		try {
			var r = xml.getElementsByTagName("ROW")[0];
			strValor = r.getElementsByTagName(strCampo)[0].childNodes[0].nodeValue;
			if (strValor=="null"){
				strValor="";
			}
		} catch(err){}

		return strValor;
	}//RegresaValor

	function RegresaValorLista(xml, strCampo, indice){
		var strValor="";
		try {
			var r = xml.getElementsByTagName("ROW")[indice];
			strValor = r.getElementsByTagName(strCampo)[0].childNodes[0].nodeValue;
			if (strValor=="null"){
				strValor="";
			}
		} catch(err){}

		return strValor;
	}//RegresaValorLista

	function RegresaAtributo(xmlNode, intAtributo){
		if(xmlNode.nodeType == 1){
			return xmlNode.attributes[intAtributo].nodeValue;
		}
		else if(xmlNode.nodeType == 3){
			return 'nodo tipo 3';
		} else {
                    return '';
                }

	}//RegresaAtributo

	function e(idElemento){
		return document.getElementById(idElemento);
	}//e

	function NewWindow(mypage,myname,w,h,scroll,pos){if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';win=window.open(mypage,myname,settings);}//NewWindow

        function IniciaVariables(){
                divEncabezado = e("divEncabezado");
                divMenu = e("divMenu");
                divCargando= e("divCargando");
                divResultados = e("divResultados");
                divBody = e("divBody");
                divMapa = e("map");
                divMapContainer= e("map");
                divZona= e("divZona");
                //divIntro=e("divIntro");
                //divPie= e("divPie");
                //spanBanner2= e("spanBanner2");
                divPaginacion= e("divPaginacion");
                divPaginacion2= e("divPaginacion2");
                divInmuebles= e("divInmuebles");
                
                txtBuscar =e("txtBuscar");

        		divFiltros1 =e("divFiltros1");
        		divFiltrosOperacion =e("divFiltrosOperacion");
        		divFiltrosTipo =e("divFiltrosTipo");
        		divFiltrosUbicacion =e("divFiltrosUbicacion");
        		divFiltrosAvanzados =e("divFiltrosAvanzados");
				

				var micrositio = e("micrositio");
				if (micrositio.value!= "null" ){
					intMicrositio = micrositio.value;
				}



        }//IniciaVariables
        
 function ValidaSesionInicial(){
   funcionCallBack="";
    var strMDILog = readCookie('MDILog');
    var strMDIPwd = readCookie('MDIPwd');

    if ((strMDILog != null) && (strMDILog != "null") && (strMDILog != "")){
      if (strMDIPwd != "null"){
          Login(strMDILog,strMDIPwd);
      }
    } else {      
      ValidaSesion();
    }

}//ValidaSesionInicial

 
 function LimpiaPrecios(){
             var txtPrecioMinimo = e("txtPrecioMinimo");
            var txtPrecioMaximo = e("txtPrecioMaximo");
            txtPrecioMinimo.value = "";
            txtPrecioMaximo.value = "";
}//LimpiaPrecios
 

       function Inicia(iniciarMapa){
           
           
           pantalla="mdi";
           arrHistory = new Array;
           
           var favsObj = e("favs");
           var favs = favsObj.value;
           
           var aAtras = e("aAtras");
           aAtras.style.visibility = "hidden";
           
            ValidaSesionInicial();
            unscrollit();
            //resizeApp();
            
            LimpiaPrecios();
            //divIntro.style.visibility="visible";
            divResultados.style.visibility="hidden";
            divPaginacion.style.visibility="hidden";
            divPaginacion2.style.visibility="hidden";
            divInmuebles.style.visibility="hidden";
            divMapContainer.style.visibility="hidden";
            divZona.style.visibility="hidden";


			var tdPrecioVenta = e("tdPrecioVenta");
			var tdPrecioRenta = e("tdPrecioRenta");
			var tdTerreno = e("tdTerreno");
			var tdConstruccion = e("tdConstruccion");
			var Accordion5Content = e("Accordion5Content");
			var Accordion6Content = e("Accordion6Content");

			var divFiltrosTipoContenido=e("divFiltrosTipoContenido");
			var divFiltrosUbicacionContenido=e("divFiltrosUbicacionContenido")

			tdPrecioVenta.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			tdPrecioRenta.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			tdTerreno.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			tdConstruccion.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";

			divFiltrosTipoContenido.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			Accordion5Content.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			//ver2 Accordion6Content.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";
			divFiltrosUbicacionContenido.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Obteniendo Informaci&oacute;n...";

			txtBuscar.value="";
			quitaFiltros();

			 document.onmousemove = function(oEvent) {
					var offset = getScrollXY();
					if(!oEvent) oEvent = window.event;
					mouseX = oEvent.clientX + offset[0];
					mouseY = oEvent.clientY + offset[1];
				}

			var Accordion1Content = e("Accordion1Content");
			var Accordion2Content = e("Accordion2Content");
			var Accordion3Content = e("Accordion3Content");
			var Accordion4Content = e("Accordion4Content");
			//var Accordion5Content = e("Accordion5Content");
			//var Accordion6Content = e("Accordion6Content");


			Accordion1Content.style.display = 'block';
			Accordion2Content.style.display = 'block';
			Accordion3Content.style.display = 'block';
			Accordion4Content.style.display = 'block';
			Accordion5Content.style.display = 'block';
			Accordion6Content.style.display = 'block';

			Accordion1Content.style.height="89px";
			Accordion2Content.style.height="0px";
			Accordion3Content.style.height="0px";
			Accordion4Content.style.height="0px";
			Accordion5Content.style.height="121px";
			Accordion6Content.style.height="0px";

			openAccordion = "Accordion1Content";
			openAccordion2 = "Accordion5Content";

			//Banner();
			
			if (iniciarMapa==true){
                                EscribeAyuda();
                            
           			reqTipoCambio = init();
				reqTipoCambio.onreadystatechange = TipoCambioListener;
				reqTipoCambio.send("TipoCambio=1");
			} else {
                            if (favs!="1"){
                            
                            	reqPV = init();
				reqPV.onreadystatechange = FiltroPrecioVentaListener;
				reqPV.send("FiltroPrecioVenta=" + TipoCambio.innerHTML + "@@@" + intMicrositio);


				reqPR = init();
				reqPR.onreadystatechange = FiltroPrecioRentaListener;
				reqPR.send("FiltroPrecioRenta=" + TipoCambio.innerHTML + "@@@" + intMicrositio);
                            }
			}

                         if (favs!="1"){
                            reqOper = init();
                            reqOper.onreadystatechange = FiltroOperacionListener;
                            reqOper.send("FiltroOperacion=" + intMicrositio);

                            reqTipo = init();
                            reqTipo.onreadystatechange = FiltroTipoListener;
                            reqTipo.send("FiltroTipo="+ intMicrositio);

                            reqUbi = init();
                            reqUbi.onreadystatechange = FiltroUbicacionListener;
                            reqUbi.send("FiltroUbicacion="+ intMicrositio);

                            reqT = init();
                            reqT.onreadystatechange = FiltroTerrenoListener;
                            reqT.send("FiltroTerreno="+ intMicrositio);

                            reqC = init();
                            reqC.onreadystatechange = FiltroConstruccionListener;
                            reqC.send("FiltroConstruccion="+ intMicrositio);
                         }

            if (iniciarMapa==true){
				try {
					if (GBrowserIsCompatible()) {

							map = new GMap2(e("map"));
                                                        map.addMapType(G_PHYSICAL_MAP);
                                                        //map.setMapType(G_PHYSICAL_MAP);
							map.addControl(new GLargeMapControl());
							map.addControl(new GMenuMapTypeControl());
							map.addControl(new GScaleControl());
							map.addControl(new GOverviewMapControl(new GSize(150,150)));
							map.enableScrollWheelZoom();

							var point = new GLatLng(19.42661072109788, -99.15229797363281);
							map.setCenter(point, 4);
							bounds = new GLatLngBounds();

							var icon1 = new GIcon();
							icon1.image = "/imgs/markers/casa_marker.png";
							icon1.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
							icon1.iconSize = new GSize(30, 46);
							icon1.shadowSize = new GSize(22, 20);
							icon1.iconAnchor = new GPoint(30/2, 46/2);
							icon1.infoWindowAnchor = new GPoint(5, 0);
							var marker = new GMarker(point, {icon: icon1});

							GEvent.addListener(marker, "click", function() {
								var sH ="<br><table width='250'><tr><td><img src='/imgs/question.gif' border=0>&nbsp;&iquest;Tienes una propiedad que vendes o rentas y a&uacute;n no la has publicado?<br><br><center><a  href='admin.jsp'>&iexcl;Reg&iacute;strala GRATIS!</a>&nbsp;</center><br></td></tr></table>";
								marker.openInfoWindowHtml(sH);
							});
							map.addOverlay(marker);
							var sH ="<br><table width='250'><tr><td><img src='/imgs/question.gif' border=0>&nbsp;&iquest;Tienes una propiedad que vendes o rentas y a&uacute;n no la has publicado?<br><br><center><a  href='admin.jsp'>&iexcl;Reg&iacute;strala GRATIS!</a>&nbsp;</center><br></td></tr></table>";
							marker.openInfoWindowHtml(sH);
					}
				}catch(err){ divZona.style.visibility="hidden"; divMapContainer.innerHTML = "<center><br><br><b style='color:rgb(80,80,80)'>Lo sentimos. No se ha podido cargar el Mapa.<br>Revise su conexi&oacute;n a internet e intente de nuevo.</b></center>"; }
            } else {
				try {
					map.clearOverlays();
					bounds = new GLatLngBounds();
					map.setCenter(new GLatLng(19.42661072109788, -99.15229797363281), 4);
				} catch(err){}

				divInmuebles.innerHTML = "<br><br><center><b>Bienvenido(a)!!</b><br><br>Realiza una busqueda para visualizar las propiedades.</center>";

				var bResultados = e("bResultados");
				bResultados.innerHTML = "Resultados";
				var bResultados2 = e("bResultados2");
				bResultados2.innerHTML = "Resultados";
				pags=0;
				MostrarPaginacion('');
				MostrarPaginacion('2');

				var centerPaginacion = e("centerPaginacion");
				centerPaginacion.innerHTML = "<center>P&aacute;gina 0 de 0</center>";

			}

			divCargando.style.visibility="hidden";
                        
                          //txtBuscar.select();
                          //txtBuscar.focus();
                            txtBuscar_lostfocus();
                            
                        if (favs=="1"){
                            MisFavoritos();
                        }
        }//Inicia

	function FiltroOperacionListener(){
		if (reqOper.readyState == 4) {
				if (reqOper.status == 200) {
						var sH="";
						try {
							var indexObj = reqOper.responseXML.getElementsByTagName("rs")[0];
							var total = RegresaAtributo(indexObj,0);

							var filtro = reqOper.responseXML.getElementsByTagName("f")[0];

							var i;
							if (total>1){
								sH="   <table id='tblFiltrosOperacion' width='120' cellspacing=0> ";
							}
							for (i=0;i<total;i++){
								var renglon = reqOper.responseXML.getElementsByTagName("r")[i];
								var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
								var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
								var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

								if (total==1){
									if (tot==1){
										sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
									} else {
										sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
									}
								} else {
									sH= sH+ "<tr onclick='filtrar(\"operacion\",1," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
								}


							}
							if (total>1){
								sH= sH+ "</table>";
							}
						} catch(err){sH = "";}
					var Accordion5Content = e("Accordion5Content");
					Accordion5Content.innerHTML = sH;
					try { HoverTabla('tblFiltrosOperacion'); } catch(err){}

			}
		}

	}//FiltroOperacionListener

	function FiltroTipoListener(){
		if (reqTipo.readyState == 4) {
			if (reqTipo.status == 200) {
				var sH="";
				try {
					var indexObj = reqTipo.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);
					var i;
					var filtro = reqTipo.responseXML.getElementsByTagName("f")[0];
					var nivel =""; try { nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					if (total>1){
						sH="   <table id='tblFiltrosTipo' width='155' cellspacing=0> ";
					}
					for (i=0;i<total;i++){
						var renglon = reqTipo.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
							}
						} else {
							sH= sH+ "<tr onclick='filtrar(\"tipo\"," + nivel + "," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}

					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}

				var divFiltrosTipoContenido = e("divFiltrosTipoContenido");
				divFiltrosTipoContenido.innerHTML = sH;
				try { HoverTabla('tblFiltrosTipo'); } catch(err){}
			}
		}
	}//FiltroTipoListener

	function FiltroUbicacionListener(){
		if (reqUbi.readyState == 4) {
			if (reqUbi.status == 200) {
				var sH="";
				try {
					var indexObj = reqUbi.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);

					var filtro = reqUbi.responseXML.getElementsByTagName("f")[0];
					var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					var i;
					if (total>1){
						sH="   <table id='tblFiltrosUbicacion' width='165' cellspacing=0> ";
					}
					for (i=0;i<total;i++){
						var renglon = reqUbi.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
							}
						} else {
							sH= sH+ "<tr onclick='filtrar(\"ubicacion\"," + nivel + "," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}
					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}

				var divFiltrosUbicacionContenido = e("divFiltrosUbicacionContenido");
				divFiltrosUbicacionContenido.innerHTML = sH;
				try { HoverTabla('tblFiltrosUbicacion'); } catch(err){}
			}
		}
	}//FiltroUbicacionListener


	function FiltroPrecioVentaListener(){
		if (reqPV.readyState == 4) {
			if (reqPV.status == 200) {
				var sH="";
				try {

					var indexObj = reqPV.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);

					//var filtro = reqPV.responseXML.getElementsByTagName("f")[0];
					//var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					var i;
					if (total>1){
						sH="   <table id='tblFiltrosPrecioVenta' width='250' cellspacing=0> ";
					}
					for (i=0;i<total;i++){

						var renglon = reqPV.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						var rango = new Array; rango = clave.split(",");
						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
							}
						} else {

							//sH= sH+ "<tr onclick='filtrar(\"precioventa\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
							sH= sH+ "<tr onclick='filtrar(\"precioventa\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>$ " + FormatNumber(rango[0],0,true, true, true) + "</td><td>&nbsp;a&nbsp;</td><td align=right>$ " + FormatNumber(rango[1],0,true, true, true) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}
					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}
				var tdPrecioVenta = e("tdPrecioVenta");
				tdPrecioVenta.innerHTML = sH;
				try { HoverTabla('tblFiltrosPrecioVenta'); } catch(err){}
			}
		}
	}//FiltroPrecioVentaListener


	function FiltroPrecioRentaListener(){
		if (reqPR.readyState == 4) {
			if (reqPR.status == 200) {
				var sH="";
				try {

					var indexObj = reqPR.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);

					//var filtro = reqPV.responseXML.getElementsByTagName("f")[0];
					//var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					var i;
					if (total>1){
						sH="   <table id='tblFiltrosPrecioRenta' width='250' cellspacing=0> ";
					}
					for (i=0;i<total;i++){

						var renglon = reqPR.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						var rango = new Array; rango = clave.split(",");
						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
							}
						} else {
							//sH= sH+ "<tr onclick='filtrar(\"preciorenta\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
							sH= sH+ "<tr onclick='filtrar(\"preciorenta\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>$ " + FormatNumber(rango[0],0,true, true, true) + "</td><td>&nbsp;a&nbsp;</td><td align=right>$ " + FormatNumber(rango[1],0,true, true, true) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}
					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}
				var tdPrecioRenta = e("tdPrecioRenta");
				tdPrecioRenta.innerHTML = sH;
				try { HoverTabla('tblFiltrosPrecioRenta'); } catch(err){}
			}
		}
	}//FiltroPrecioRentaListener


	function FiltroTerrenoListener(){
		if (reqT.readyState == 4) {
			if (reqT.status == 200) {
				var sH="";
				try {

					var indexObj = reqT.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);

					//var filtro = reqPV.responseXML.getElementsByTagName("f")[0];
					//var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					var i;
					if (total>1){
						sH="   <table id='tblFiltrosTerreno' width='250' cellspacing=0> ";
					}
					for (i=0;i<total;i++){

						var renglon = reqT.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						var rango = new Array; rango = clave.split(",");
						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
							}
						} else {
							//sH= sH+ "<tr onclick='filtrar(\"terreno\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
							sH= sH+ "<tr onclick='filtrar(\"terreno\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2;</td><td>&nbsp;a&nbsp;</td><td align=right>" + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}
					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}
				var tdTerreno = e("tdTerreno");
				tdTerreno.innerHTML = sH;
				try { HoverTabla('tblFiltrosTerreno'); } catch(err){}
			}
		}
	}//FiltroTerrenoListener


	function FiltroConstruccionListener(){
		if (reqC.readyState == 4) {
			if (reqC.status == 200) {
				var sH="";
				try {

					var indexObj = reqC.responseXML.getElementsByTagName("rs")[0];
					var total = RegresaAtributo(indexObj,0);

					//var filtro = reqPV.responseXML.getElementsByTagName("f")[0];
					//var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

					var i;
					if (total>1){
						sH="   <table id='tblFiltrosConstruccion' width='250' cellspacing=0> ";
					}
					for (i=0;i<total;i++){

						var renglon = reqC.responseXML.getElementsByTagName("r")[i];
						var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
						var desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue;
						var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

						var rango = new Array; rango = clave.split(",");
						if (total==1){
							if (tot==1){
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
							} else {
								sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
							}
						} else {
							//sH= sH+ "<tr onclick='filtrar(\"construccion\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
							sH= sH+ "<tr onclick='filtrar(\"construccion\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2;</td><td>&nbsp;a&nbsp;</td><td align=right>" + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</td><td align=right valign=top >(" + tot + ")</td></tr>";
						}
					}
					if (total>1){
						sH= sH+ "</table>";
					}
				} catch(err){sH = "";}
				var tdConstruccion = e("tdConstruccion");
				tdConstruccion.innerHTML = sH;
				try { HoverTabla('tblFiltrosConstruccion'); } catch(err){}
			}
		}
	}//FiltroConstruccionListener

	function Banner(){
		var sH = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		sH = sH + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0"';
		sH = sH + ' id="anunciate" width="505" height="95">';
		sH = sH + ' <param name="movie" value="/imgs/anunciate.swf">';
		sH = sH + ' <param name="quality" value="high">';
		sH = sH + ' <param name="bgcolor" value="#FFFFFF">';
		sH = sH + '   <embed name="anunciate" src="/imgs/anunciate.swf"';
		sH = sH + '    quality="high" bgcolor="#FFFFFF" swLiveConnect="true"';
		sH = sH + '    width="505" height="95"';
		sH = sH + '    type="application/x-shockwave-flash"';
		sH = sH + '    pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		sH = sH + ' </object>';
		var spanBanner2 = e("spanBanner2");
		spanBanner2.innerHTML = sH;
	}//Banner

	function resizeApp(){
            height = getWindowHeight();
            width = getWindowWidth();
            divMapContainer.style.position="absolute";
            divZona.style.position="absolute";
            divMapContainer.style.width = (width - 550) + "px";

            var divfading = e("divfading");
            var divFondoFiltros = e("divFondoFiltros");
            
           
            divfading.style.width = (width) + "px";
            
            //divPie.style.width = (width) + "px";
            //divMenu.style.width = (width) + "px";
            //divEncabezado.style.width = (width) + "px";
            divFondoFiltros.style.width = (width) + "px";
            //divFiltros1.style.width = (width) + "px";
            divZona.style.left = (width - 230) + "px";
            var divPreferencias = e("divPreferencias");
            divPreferencias.style.left = (width - 255) + "px";
            //divIntro.style.width = (width - 35) + "px";
	}//resizeApp

        function OcultaIntro(){
            		divIntro.style.visibility="hidden";
		divResultados.style.visibility="visible";
		divPaginacion.style.visibility="visible";
		divPaginacion2.style.visibility="visible";
		divInmuebles.style.visibility="visible";
		divMapContainer.style.visibility="visible";
		divZona.style.visibility="visible";

        }//OcultaIntro
        
	function Buscar(){

                var strBuscar = "";
                if (blnVacio==true){
                    strBuscar = "";
                } else {
                    strBuscar = txtBuscar.value;
                }
		//divIntro.style.visibility="hidden";
		divResultados.style.visibility="visible";
		divPaginacion.style.visibility="visible";
		divPaginacion2.style.visibility="visible";
		divInmuebles.style.visibility="visible";
		divMapContainer.style.visibility="visible";
		divZona.style.visibility="visible";
                divBody.style.visibility="hidden"

		divInmuebles.innerHTML = "<center><br><img src='/imgs/loading.gif'><b>&nbsp;Realizando b&uacute;squeda...</b><br><br>Por favor espere un momento...</center>";

		if (blnTrabajando){
			var divFiltrosTipoContenido = e("divFiltrosTipoContenido");
			divFiltrosTipoContenido.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Realizando b&uacute;squeda...";

			var divFiltrosUbicacionContenido = e("divFiltrosUbicacionContenido");
			divFiltrosUbicacionContenido.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Realizando b&uacute;squeda...";

			var Accordion5Content = e("Accordion5Content");
			Accordion5Content.innerHTML = "<br>&nbsp;&nbsp;&nbsp;<img src='/imgs/loading.gif'>&nbsp;Realizando b&uacute;squeda...";

			var tdPrecioVenta = e("tdPrecioVenta");
			var tdPrecioRenta = e("tdPrecioRenta");
			var tdConstruccion = e("tdConstruccion");
			var tdTerreno = e("tdTerreno");
			tdPrecioVenta.innerHTML = Accordion5Content.innerHTML;
			tdPrecioRenta.innerHTML = Accordion5Content.innerHTML;
			tdConstruccion.innerHTML = Accordion5Content.innerHTML;
			tdTerreno.innerHTML = Accordion5Content.innerHTML;
		}

		var coords = "";
		if (fil_y1!=""){
			coords = fil_y1 + "," + fil_y2 + "," + fil_x1 + "," + fil_x2;
		}

		var precio_venta=fil_precio_venta_min + ";" + fil_precio_venta_max;
		var precio_renta=fil_precio_renta_min + ";" + fil_precio_renta_max;
		var m2_terreno=fil_m2_terreno_min + ";" + fil_m2_terreno_max;
		var m2_construccion=fil_m2_construccion_min + ";" + fil_m2_construccion_max;

		var xcenter = 19.42661072109788;
		var ycenter = -99.15229797363281;
		try {
			var pointCenter = map.getCenter();
			xcenter = pointCenter.lat();
			ycenter = pointCenter.lng();
		}catch(err){}

            
            
                var objHistory = new FiltroHistoria();
                objHistory.fil_favoritos = fil_favoritos;
                objHistory.txtBuscar = strBuscar;
                objHistory.fil_uso = fil_uso;
                objHistory.fil_tipo = fil_tipo;
                objHistory.fil_pai_cve = fil_pai_cve;
                objHistory.fil_est_cve = fil_est_cve;
                objHistory.fil_del_cve = fil_del_cve;
                objHistory.fil_col_cve = fil_col_cve;
                objHistory.intMicrositio = intMicrositio;
                objHistory.fil_y1 = fil_y1;
                objHistory.fil_y2 = fil_y2;
                objHistory.fil_x1 = fil_x1;
                objHistory.fil_x2 = fil_x2;
                objHistory.fil_precio_venta_min = fil_precio_venta_min;
                objHistory.fil_precio_venta_max = fil_precio_venta_max;
                objHistory.fil_precio_renta_min = fil_precio_renta_min;
                objHistory.fil_precio_renta_max = fil_precio_renta_max;
                objHistory.fil_m2_terreno_min = fil_m2_terreno_min;
                objHistory.fil_m2_terreno_max = fil_m2_terreno_max;
                objHistory.fil_m2_construccion_min = fil_m2_construccion_min;
                objHistory.fil_m2_construccion_max = fil_m2_construccion_max;
                //objHistory.TipoCambio = TipoCambio.innerHTML;
                objHistory.pagina = pagina;
                objHistory.xcenter = xcenter;
                objHistory.ycenter = ycenter;
                arrHistory.push(objHistory);
                
                var aAtras = e("aAtras");
                aAtras.style.visibility = "visible";
            
		req = init();
		req.onreadystatechange = BuscarListener;
		if (fil_favoritos==""){
                req.send("Buscar=" + sinAcentos(strBuscar.toUpperCase()) + "@@@" + fil_uso + "@@@" + fil_tipo + "@@@" + fil_pai_cve + "@@@" + fil_est_cve + "@@@" + fil_del_cve + "@@@" + fil_col_cve + "@@@" + coords + "@@@" + precio_venta + "@@@" + precio_renta + "@@@" + m2_terreno + "@@@" + m2_construccion + "@@@" + intMicrositio + "@@@" + fil_operacion + "@@@" +  TipoCambio.innerHTML + "@@@" + pagina + "@@@" + sorted + "@@@" + xcenter + "@@@" + ycenter + "@@@false");
		} else{
			req.send("Buscar=FAVORITOS@@@" + fil_uso + "@@@" + fil_tipo + "@@@" + fil_pai_cve + "@@@" + fil_est_cve + "@@@" + fil_del_cve + "@@@" + fil_col_cve + "@@@" + coords + "@@@" + precio_venta + "@@@" + precio_renta + "@@@" + m2_terreno + "@@@" + m2_construccion + "@@@" + intMicrositio + "@@@" + fil_operacion + "@@@" +  TipoCambio.innerHTML + "@@@" + pagina + "@@@" + sorted + "@@@" + xcenter + "@@@" + ycenter + "@@@false");
		}

	}//Buscar
        
        function MouseOutAtras(){var imgAtras = e("imgAtras"); imgAtras.src='/imgs/iratras.gif';	}//MouseOutAtras
	function MouseOverAtras(){var imgAtras = e("imgAtras"); imgAtras.src='/imgs/iratrashover.gif';}//MouseOverAtras
        
  function txtBuscar_lostfocus(){
    if ((txtBuscar.value.length==0) || (txtBuscar.value == "  ¿Qué estás buscando?") ) {
        blnVacio=true;
        txtBuscar.value = "  ¿Qué estás buscando?";
        txtBuscar.style.color="rgb(150,150,150)";
        txtBuscar.style.fontSize="10pt";
    } else {
        blnVacio=false;
    }
}//txtBuscar_lostfocus

function txtBuscar_gotfocus(){
    
    if (blnVacio==true){
        txtBuscar.value = "";
        txtBuscar.style.color="rgb(50,50,50)";
        txtBuscar.style.fontSize="12pt";
    }
}//txtBuscar_gotfocus

         function Atras(){
          
          if (arrHistory.length<2){
              Inicia(false);
          }
          else {
            
              arrHistory.remove(arrHistory.length-1);
             
		
                var objHistory = arrHistory[arrHistory.length-1];
                fil_favoritos = objHistory.fil_favoritos;
                txtBuscar.value = objHistory.txtBuscar;
                txtBuscar_lostfocus();
                
                fil_uso = objHistory.fil_uso;
                fil_tipo = objHistory.fil_tipo;
                fil_pai_cve = objHistory.fil_pai_cve;
                fil_est_cve = objHistory.fil_est_cve;
                fil_del_cve = objHistory.fil_del_cve;
                fil_col_cve = objHistory.fil_col_cve;
                intMicrositio = objHistory.intMicrositio;
                fil_y1 = objHistory.fil_y1;
                fil_y2 = objHistory.fil_y2;
                fil_x1 = objHistory.fil_x1;
                fil_x2 = objHistory.fil_x2;
                fil_precio_venta_min = objHistory.fil_precio_venta_min;
                fil_precio_venta_max = objHistory.fil_precio_venta_max;
                fil_precio_renta_min = objHistory.fil_precio_renta_min;
                fil_precio_renta_max = objHistory.fil_precio_renta_max;
                fil_m2_terreno_min = objHistory.fil_m2_terreno_min;
                fil_m2_terreno_max = objHistory.fil_m2_terreno_max;
                fil_m2_construccion_min = objHistory.fil_m2_construccion_min;
                fil_m2_construccion_max = objHistory.fil_m2_construccion_max;
                //TipoCambio.innerHTML = objHistory.TipoCambio;
                pagina = objHistory.pagina;
                var xcenter;
                var ycenter;
                xcenter = objHistory.xcenter;
                ycenter = objHistory.ycenter;
                
                try {
                     map.setCenter(new GLatLng(xcenter, ycenter));
		}catch(err){}
                 
                arrHistory.remove(arrHistory.length-1);

                Buscar();  
            
          }
            
        }//Atras

	function BuscarListener(){
			var reqI;
			try {
					if (req.readyState == 4) {
							if (req.status == 200) {


									//filtros ubicacion
									var sH="";
									try {
										var indexObj = req.responseXML.getElementsByTagName("fu")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("fu")[0].getElementsByTagName("f")[0];
										var nivel =""; try { nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosUbicacion' width='165' cellspacing=0> ";
										}
										for (i=0;i<total;i++){
											var renglon = req.responseXML.getElementsByTagName("fu")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
												}
											} else {
												sH= sH+ "<tr onclick='filtrar(\"ubicacion\"," + nivel + "," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}
										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}

									var divFiltrosUbicacionContenido = e("divFiltrosUbicacionContenido");
									divFiltrosUbicacionContenido.innerHTML = sH;
									try {HoverTabla('tblFiltrosUbicacion');} catch(err){}

									//filtros tipo
									var sH="";
									try {
										var indexObj = req.responseXML.getElementsByTagName("ft")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("ft")[0].getElementsByTagName("f")[0];
										var nivel =""; try { var nivel = filtro.getElementsByTagName("n")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosTipo' width='155' cellspacing=0> ";
										}
										for (i=0;i<total;i++){
											var renglon = req.responseXML.getElementsByTagName("ft")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
												}
											} else {
												sH= sH+ "<tr onclick='filtrar(\"tipo\"," + nivel + "," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}

										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}

									var divFiltrosTipoContenido = e("divFiltrosTipoContenido");
									divFiltrosTipoContenido.innerHTML = sH;
									try { HoverTabla('tblFiltrosTipo'); } catch(err){}

									//filtros operacion
										var sH="";
										try {
											var indexObj = req.responseXML.getElementsByTagName("fo")[0].getElementsByTagName("rs")[0];
											var total = RegresaAtributo(indexObj,0);

											var filtro = req.responseXML.getElementsByTagName("fo")[0].getElementsByTagName("f")[0];

											var i;
											if (total>1){
												sH="   <table id='tblFiltrosOperacion' width='120' cellspacing=0> ";
											}
											for (i=0;i<total;i++){
												var renglon = req.responseXML.getElementsByTagName("fo")[0].getElementsByTagName("r")[i];
												var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
												var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
												var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

												if (total==1){
													if (tot==1){
														sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrado en <b>" + MinusMayus(desc) + "</b></span>";
													} else {
														sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles encontrados en <b>" + MinusMayus(desc) + "</b></span>";
													}
												} else {
													sH= sH+ "<tr onclick='filtrar(\"operacion\",1," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
												}

											}
											if (total>1){
												sH= sH+ "</table>";
											}
										} catch(err){sH = "";}
									var Accordion5Content = e("Accordion5Content");
									Accordion5Content.innerHTML = sH;
									try { HoverTabla('tblFiltrosOperacion'); } catch(err){}


									//filtro construccion
									var sH="";
									try {

										var indexObj = req.responseXML.getElementsByTagName("fc")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("fc")[0].getElementsByTagName("f")[0];
										var txtConstruccionMin = e("txtConstruccionMin");
										var txtConstruccionMax = e("txtConstruccionMax");

										try { txtConstruccionMin.value = filtro.getElementsByTagName("min")[0].childNodes[0].nodeValue; } catch(err){}
										try { txtConstruccionMax.value = filtro.getElementsByTagName("max")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosConstruccion' width='250' cellspacing=0> ";
										}
										for (i=0;i<total;i++){

											var renglon = req.responseXML.getElementsByTagName("fc")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											var rango = new Array; rango = clave.split(",");
											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
												}
											} else {
												//sH= sH+ "<tr onclick='filtrar(\"construccion\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
												sH= sH+ "<tr onclick='filtrar(\"construccion\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2;</td><td>&nbsp;a&nbsp;</td><td align=right>" + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}
										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}
									var tdConstruccion = e("tdConstruccion");
									tdConstruccion.innerHTML = sH;
									try { HoverTabla('tblFiltrosConstruccion'); } catch(err){}


									//filtro terreno
									var sH="";
									try {

										var indexObj = req.responseXML.getElementsByTagName("fterr")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("fterr")[0].getElementsByTagName("f")[0];
										var txtTerrenoMin = e("txtTerrenoMin");
										var txtTerrenoMax = e("txtTerrenoMax");

										try { txtTerrenoMin.value = filtro.getElementsByTagName("min")[0].childNodes[0].nodeValue; } catch(err){}
										try { txtTerrenoMax.value = filtro.getElementsByTagName("max")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosTerreno' width='250' cellspacing=0> ";
										}
										for (i=0;i<total;i++){

											var renglon = req.responseXML.getElementsByTagName("fterr")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											var rango = new Array; rango = clave.split(",");
											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2; a " + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</b></span>";
												}
											} else {
												//sH= sH+ "<tr onclick='filtrar(\"terreno\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
												sH= sH+ "<tr onclick='filtrar(\"terreno\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>" + FormatNumber(rango[0],0,true, true, true) + " m&sup2;</td><td>&nbsp;a&nbsp;</td><td align=right>" + FormatNumber(rango[1],0,true, true, true) + " m&sup2;</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}
										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}
									var tdTerreno = e("tdTerreno");
									tdTerreno.innerHTML = sH;
									try { HoverTabla('tblFiltrosTerreno'); } catch(err){}


									//filtro precio venta
									var sH="";
									try {

										var indexObj = req.responseXML.getElementsByTagName("fpv")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("fpv")[0].getElementsByTagName("f")[0];
										var txtPrecioVentaMin = e("txtPrecioVentaMin");
										var txtPrecioVentaMax = e("txtPrecioVentaMax");

										try { txtPrecioVentaMin.value = filtro.getElementsByTagName("min")[0].childNodes[0].nodeValue; } catch(err){}
										try { txtPrecioVentaMax.value = filtro.getElementsByTagName("max")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosPrecioVenta' width='250' cellspacing=0> ";
										}
										for (i=0;i<total;i++){

											var renglon = req.responseXML.getElementsByTagName("fpv")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											var rango = new Array; rango = clave.split(",");
											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
												}
											} else {
												//sH= sH+ "<tr onclick='filtrar(\"precioventa\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
												sH= sH+ "<tr onclick='filtrar(\"precioventa\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>$ " + FormatNumber(rango[0],0,true, true, true) + "</td><td>&nbsp;a&nbsp;</td><td align=right>$ " + FormatNumber(rango[1],0,true, true, true) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}
										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}
									var tdPrecioVenta = e("tdPrecioVenta");
									tdPrecioVenta.innerHTML = sH;
									try { HoverTabla('tblFiltrosPrecioVenta'); } catch(err){}


									//filtro precio renta
									var sH="";
									try {

										var indexObj = req.responseXML.getElementsByTagName("fpr")[0].getElementsByTagName("rs")[0];
										var total = RegresaAtributo(indexObj,0);

										var filtro = req.responseXML.getElementsByTagName("fpr")[0].getElementsByTagName("f")[0];
										var txtPrecioRentaMin = e("txtPrecioRentaMin");
										var txtPrecioRentaMax = e("txtPrecioRentaMax");

										try { txtPrecioRentaMin.value = filtro.getElementsByTagName("min")[0].childNodes[0].nodeValue; } catch(err){}
										try { txtPrecioRentaMax.value = filtro.getElementsByTagName("max")[0].childNodes[0].nodeValue; } catch(err){}

										var i;
										if (total>1){
											sH="   <table id='tblFiltrosPrecioRenta' width='250' cellspacing=0> ";
										}
										for (i=0;i<total;i++){

											var renglon = req.responseXML.getElementsByTagName("fpr")[0].getElementsByTagName("r")[i];
											var clave = renglon.getElementsByTagName("c")[0].childNodes[0].nodeValue;
											var desc = ""; try { desc = renglon.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
											var tot = renglon.getElementsByTagName("t")[0].childNodes[0].nodeValue;

											var rango = new Array; rango = clave.split(",");
											if (total==1){
												if (tot==1){
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
												} else {
													sH= sH+ "<span style='font-size:8pt;color:rgb(118,155,45)'><b>" + tot + "</b> inmuebles en el rango <b>$ " + FormatNumber(rango[0],0,true, true, true) + " a $ " + FormatNumber(rango[1],0,true, true, true) + "</b></span>";
												}
											} else {
												//sH= sH+ "<tr onclick='filtrar(\"preciorenta\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;" + MinusMayus(desc) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
												sH= sH+ "<tr onclick='filtrar(\"preciorenta\"," + clave + ")'><td ><img src='/imgs/flecha.gif' border=0>&nbsp;</td><td align=right>$ " + FormatNumber(rango[0],0,true, true, true) + "</td><td>&nbsp;a&nbsp;</td><td align=right>$ " + FormatNumber(rango[1],0,true, true, true) + "</td><td align=right valign=top >(" + tot + ")</td></tr>";
											}
										}
										if (total>1){
											sH= sH+ "</table>";
										}
									} catch(err){sH = "";}
									var tdPrecioRenta = e("tdPrecioRenta");
									tdPrecioRenta.innerHTML = sH;
									try { HoverTabla('tblFiltrosPrecioRenta'); } catch(err){}

                                                                        
									//resultados
									var strInmuebles=""; try { strInmuebles = req.responseXML.getElementsByTagName("ids")[0].childNodes[0].nodeValue; } catch(err){}
									arrResults = strInmuebles.split(",");
									var tot="0"; try { tot = req.responseXML.getElementsByTagName("tot")[0].childNodes[0].nodeValue; } catch(err){}
									if (pagina==1){
										var pag="0"; try { pag = req.responseXML.getElementsByTagName("pag")[0].childNodes[0].nodeValue; } catch(err){}
										pags="0"; try { pags = req.responseXML.getElementsByTagName("pags")[0].childNodes[0].nodeValue; } catch(err){}

										var bResultados = e("bResultados");
										bResultados.innerHTML = tot + " Resultados";
										var bResultados2 = e("bResultados2");
										bResultados2.innerHTML = "1 a " + arrResults.length + " de " + tot + " Resultados";

										var centerPaginacion = e("centerPaginacion");
                                                                                var centerPaginacion2 = e("centerPaginacion2");
										if (pags==0){
											centerPaginacion.innerHTML = "<center>P&aacute;gina " + pag + " de " + pags + "</center>";
											centerPaginacion2.innerHTML = "<center>P&aacute;gina " + pag + " de " + pags + "</center>";
										} else {
											centerPaginacion.innerHTML = "<center>P&aacute;gina <a href='javascript: IrAPag();' style='color:rgb(255,255,255);text-decoration:underline;'><b >&nbsp;" + pag + "&nbsp;<b></a> de " + pags + "</center>";
											centerPaginacion2.innerHTML = "<center>P&aacute;gina <a href='javascript: IrAPag();' style='color:rgb(255,255,255);text-decoration:underline;'><b >&nbsp;" + pag + "&nbsp;<b></a> de " + pags + "</center>";
										}
									} else {
                                                                            var bResultados = e("bResultados");
                                                                            var bResultados2 = e("bResultados2");
                                                                            bResultados2.innerHTML = ((pagina-1)*25 + 1) + " a " + ((pagina-1)*25 + arrResults.length) + " de " + bResultados.innerHTML;

                                                                        }

									var sH = "";
									sH = sH + "<table>";
									if (arrResults[0]!=""){
										for (iA=0;iA<arrResults.length;iA++){

											sH = sH + "<tr><td>";

											var spanGuardar="";
											var strComentarios="";
											var strColor ="";
											var strColorFont="";
											if (esFavorito(arrResults[iA])) {
												spanGuardar = "<img src='/imgs/icon_heart.gif' border=0 >&nbsp;<b>Guardado</b> (<a class='linkMenu' href='javascript: QuitarFavorito(" + arrResults[iA] + ")' title='Quitar de Mis Favoritos'><img src='/imgs/icon_x.gif' border=0 alt='Quitar de Mis Favoritos'>&nbsp;Quitar de Favoritos</a>)";
												strComentarios = "<table width=100%><tr><td><textarea id='txtComments" + arrResults[iA] + "' value='' rows='2' cols='40' style='font-size:8pt;background-color:rgb(255,255,195);'>" + TraeComentario(arrResults[iA])  + "</textarea></td><td><img src='/imgs/comments.gif'>&nbsp;Mis Comentarios<br><input type=button value='Guardar' onclick='GuardarComentariosFavoritos(" + arrResults[iA] + ")'></td></tr></table>";
												strColor="rgb(158,207,64)";
												strColorFont="rgb(255,255,255)";
											} else {
												strColor="rgb(216,239,167)";
												strColorFont="rgb(0,0,0)";
												spanGuardar = "<a style='color:" + strColorFont + ";'class='linkMenu' href='javascript: GuardarFavorito(" + arrResults[iA] + ")' title='Guardar en Mis Favoritos'><img src='/imgs/save.gif' border=0 alt='Guardar en Mis Favoritos'>&nbsp;Guardar en Favoritos</a>";
											}

											var strTabla = "<table width=460px style='border:1px solid rgb(150,150,150);' onmouseout ='this.style.border=\"1px solid rgb(150,150,150)\"' onmouseover ='this.style.border=\"1px solid rgb(255,150,9)\"'>";
											strTabla = strTabla + "<tr><td style='background-Color:rgb(255,255,255);color:rgb(100,100,100);' valign=top width=80 align=left>Clave:&nbsp;<b style='font-size:10pt;color:rgb(138,187,44);'>" + arrResults[iA] + "</b></td><td style='background-Color:" + strColor + ";color:" + strColorFont + ";' valign=top width=380>&nbsp;&nbsp;&nbsp;&nbsp; <span id='spanGuardar" + arrResults[iA] + "'>" + spanGuardar + "</span> &nbsp;&nbsp;&nbsp; <a  class='linkMenu' style='color:" + strColorFont + ";' href='javascript: Email(" + arrResults[iA] + ")' title='Enviar por E-mail'><img src='/imgs/email.gif' border=0 alt='Enviar por E-mail'>&nbsp;Enviar</a><span id='spanPDF" + arrResults[iA] + "'>&nbsp;</span></td></tr>";
											strTabla = strTabla + "<tr height=77><td colspan=2><span id='spanID" + arrResults[iA] + "'><img src='/imgs/loading.gif'>&nbsp;Consultando Informaci&oacute;n...</span></td></tr>";
											strTabla = strTabla + "<tr><td id='tdDetallesID" + arrResults[iA] + "'  colspan=2><ul class='detailsToolbar'><li class='mas'><a href='javascript: VistaPrevia(" + arrResults[iA] + ")'>Vista Previa&nbsp;</a>&nbsp;&nbsp;&nbsp;<span id='spanMicrodatos" + arrResults[iA] + "' style='font-size:8pt;color:rgb(100,100,100);'></span></li></ul></td></tr>";
											strTabla = strTabla + "</table>";
											strTabla = strTabla + "<span id='spanComentsContainer" + arrResults[iA] + "'>" + strComentarios + "</span>";
											sH = sH +  strTabla;
											sH = sH + "</td></tr>";
										}
									} else {
										sH = sH + "<tr><td align=center>";
										sH = sH + "<br><img src='/imgs/sorry.gif'><b style='font-size:10pt;color:rgb(118,155,45)'>Ooops... Lo sentimos!</b><br><br>No se ha encontrado ning&uacute;n inmueble que cumpla con las caracter&iacute;sticas seleccionadas.<br><br>Por favor revise los criterios de b&uacute;squeda e intente nuevamente.<br><br><table width=100%><tr><td width=40%>&nbsp;</td><td width=30%><a class='button2' href='javascript: Inicia(false)'>Inicio</a></td><td width=30%>&nbsp;</td></tr></table>";
										sH = sH + "</td></tr>";
									}
									sH = sH + "</table>";
									divInmuebles.innerHTML = sH;

									try { map.clearOverlays(); bounds = new GLatLngBounds(); }catch(err){}

									maxLon=0;
									minLon=0;
									maxLat=0;
									minLat=0;

									propsescritas=0;
									propsescritasCon=0;
									propsescritasSin=0;
									MostrarPaginacion('');
									MostrarPaginacion('2');
									for (iA=0;iA<arrResults.length;iA++){
										MuestraInmueble(arrResults[iA]);
									}


							}
					}
			} catch(err){}
	}//BuscarListener

	function scrollit() {
		var browser=navigator.appName;
		if (browser=='Opera'){
			return;
		}

		var offset = getScrollXY();
		if (offset[1]<100){
			for (I=offset[1]; I<=100; I++){
				self.scroll(offset[0],I)
			}
	   }
	}//scrollit

	function unscrollit() {
		var browser=navigator.appName;
		if (browser=='Opera'){
			return;
		}
		var offset = getScrollXY();
		for (I=offset[1]; I>=0; I--){
			self.scroll(offset[0],I)
	   }
	}//unscrollit

    function getScrollXY() {
      var scrOfX = 0, scrOfY = 0;
      if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
      } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }
      return [ scrOfX, scrOfY ];
    }//getScrollXY

	function AgregaRequest(rq){
		reqs.push(rq);
		intListenerCliente++;
	}//AgregaRequest

	function ListenerGeneral(){
                try {
                        for (ridx=0;ridx<reqs.length;ridx++){
                                if (reqs[ridx]!=null){
                                        if (reqs[ridx].readyState == 4) {
                                                if (reqs[ridx].status == 200) {
                                                    intListenerCliente--;


			                                        var inmID =""; try {  inmID = reqs[ridx].responseXML.getElementsByTagName("id")[0].childNodes[0].nodeValue; } catch(err){}
			                                        var inmTipo =""; try {  inmTipo = reqs[ridx].responseXML.getElementsByTagName("tipo")[0].childNodes[0].nodeValue; } catch(err){}
			                                        var inmUso =""; try {  inmUso = reqs[ridx].responseXML.getElementsByTagName("uso")[0].childNodes[0].nodeValue; } catch(err){}
			                                        var inmUsoSuelo =""; try {  inmUsoSuelo = reqs[ridx].responseXML.getElementsByTagName("us")[0].childNodes[0].nodeValue; } catch(err){}

                                                    var inmDir =""; try {  inmDir = reqs[ridx].responseXML.getElementsByTagName("d")[0].childNodes[0].nodeValue; } catch(err){}
                                                    var inmNumExt =""; try {  inmNumExt = reqs[ridx].responseXML.getElementsByTagName("ne")[0].childNodes[0].nodeValue; } catch(err){}
                                                    var inmNumInt =""; try {  inmNumInt = reqs[ridx].responseXML.getElementsByTagName("ni")[0].childNodes[0].nodeValue; } catch(err){}

                                                    var inmFoto =""; try { inmFoto = reqs[ridx].responseXML.getElementsByTagName("f")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmLogo =""; try { inmLogo = reqs[ridx].responseXML.getElementsByTagName("lg")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmCol =""; try { inmCol = reqs[ridx].responseXML.getElementsByTagName("c")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmZona =""; try { inmZona = reqs[ridx].responseXML.getElementsByTagName("zon")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmCP =""; try { inmCP = reqs[ridx].responseXML.getElementsByTagName("cp")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmDel =""; try { inmDel = reqs[ridx].responseXML.getElementsByTagName("del")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmEst =""; try { inmEst = reqs[ridx].responseXML.getElementsByTagName("est")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmPai =""; try { inmPai = reqs[ridx].responseXML.getElementsByTagName("p")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmPV1 =""; try { inmPV1 = reqs[ridx].responseXML.getElementsByTagName("pv1")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmPR1 =""; try { inmPR1 = reqs[ridx].responseXML.getElementsByTagName("pr1")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmMantenim =""; try { inmMantenim = reqs[ridx].responseXML.getElementsByTagName("mant")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmMon =""; try { inmMon = reqs[ridx].responseXML.getElementsByTagName("mon")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmFechaEntrega =""; try { inmFechaEntrega = reqs[ridx].responseXML.getElementsByTagName("fent")[0].childNodes[0].nodeValue } catch(err){};


                                                    var inmNombre =""; try { inmNombre = reqs[ridx].responseXML.getElementsByTagName("n")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmST =""; try { inmST = reqs[ridx].responseXML.getElementsByTagName("st")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmSC =""; try { inmSC = reqs[ridx].responseXML.getElementsByTagName("sc")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmRec =""; try { inmRec = reqs[ridx].responseXML.getElementsByTagName("rec")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmBan =""; try { inmBan = reqs[ridx].responseXML.getElementsByTagName("ban")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmEstac =""; try { inmEstac = reqs[ridx].responseXML.getElementsByTagName("estac")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmTras =""; try { inmTras = reqs[ridx].responseXML.getElementsByTagName("t")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmRta =""; try { inmRta = reqs[ridx].responseXML.getElementsByTagName("rta")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmVta =""; try { inmVta = reqs[ridx].responseXML.getElementsByTagName("vta")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmPreVta =""; try { inmPreVta = reqs[ridx].responseXML.getElementsByTagName("prevta")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmMon =""; try { inmMon = reqs[ridx].responseXML.getElementsByTagName("mon")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmMonR =""; try { inmMonR = reqs[ridx].responseXML.getElementsByTagName("monr")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmLat =""; try { inmLat = reqs[ridx].responseXML.getElementsByTagName("x")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmLng =""; try { inmLng = reqs[ridx].responseXML.getElementsByTagName("y")[0].childNodes[0].nodeValue } catch(err){};

                                                    var inmPDF =""; try { inmPDF = reqs[ridx].responseXML.getElementsByTagName("pdf")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmError =""; try { inmError = reqs[ridx].responseXML.getElementsByTagName("err")[0].childNodes[0].nodeValue } catch(err){};
                                                    
                                                    var inmEstatus =""; try { inmEstatus = reqs[ridx].responseXML.getElementsByTagName("pro_ess")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmFechaFin =""; try { inmFechaFin = reqs[ridx].responseXML.getElementsByTagName("pro_fec_fin")[0].childNodes[0].nodeValue } catch(err){};
                                                    var inmMotivoRechazo =""; try { inmMotivoRechazo = reqs[ridx].responseXML.getElementsByTagName("pro_motivo_rechazo")[0].childNodes[0].nodeValue } catch(err){};
                                                    
                                

													var inmVendedor = new Vendedor();
													inmVendedor.Id = ''; 	try { inmVendedor.Id = reqs[ridx].responseXML.getElementsByTagName("v_id")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Nombre=''; 	try { inmVendedor.Nombre = reqs[ridx].responseXML.getElementsByTagName("v_n")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Foto=''; 	try { inmVendedor.Foto = reqs[ridx].responseXML.getElementsByTagName("v_f")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Tel1=''; 	try { inmVendedor.Tel1 = reqs[ridx].responseXML.getElementsByTagName("v_t1")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Tel2=''; 	try { inmVendedor.Tel2 = reqs[ridx].responseXML.getElementsByTagName("v_t2")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Celular=''; try { inmVendedor.Celular = reqs[ridx].responseXML.getElementsByTagName("v_c")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.EMail1=''; 	try { inmVendedor.EMail1 = reqs[ridx].responseXML.getElementsByTagName("v_e1")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.EMail2=''; 	try { inmVendedor.EMail2 = reqs[ridx].responseXML.getElementsByTagName("v_e2")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Empresa=''; try { inmVendedor.Empresa = reqs[ridx].responseXML.getElementsByTagName("v_e")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Logo=''; 	try { inmVendedor.Logo = reqs[ridx].responseXML.getElementsByTagName("v_l")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.www=''; 	try { inmVendedor.www = reqs[ridx].responseXML.getElementsByTagName("v_w")[0].childNodes[0].nodeValue } catch(err){};
													inmVendedor.Sexo=''; 	try { inmVendedor.Sexo = reqs[ridx].responseXML.getElementsByTagName("v_s")[0].childNodes[0].nodeValue } catch(err){};

                                                    inmDir =QuitaNull(inmDir);
                                                    inmNumExt =QuitaNull(inmNumExt);
                                                    inmNumInt =QuitaNull(inmNumInt);
                                                    inmFoto =QuitaNull(inmFoto);
                                                    inmLogo =QuitaNull(inmLogo);
                                                    inmZona =QuitaNull(inmZona);
                                                    inmCol =QuitaNull(inmCol);
                                                    inmCP =QuitaNull(inmCP);
                                                    inmDel =QuitaNull(inmDel);
                                                    inmEst =QuitaNull(inmEst);
                                                    inmPai =QuitaNull(inmPai);
                                                    inmPV1 =QuitaNull(inmPV1);
                                                    inmPR1 =QuitaNull(inmPR1);
                                                    inmMantenim =QuitaNull(inmMantenim);
                                                    inmFechaEntrega =QuitaNull(inmFechaEntrega);
                                                    inmMon =QuitaNull(inmMon);
                                                    inmNombre =QuitaNull(inmNombre);
                                                    inmST =QuitaNull(inmST);
                                                    inmSC =QuitaNull(inmSC);
                                                    inmRec =QuitaNull(inmRec);
                                                    inmBan =QuitaNull(inmBan);
                                                    inmEstac =QuitaNull(inmEstac);
                                                    inmTras =QuitaNull(inmTras);
                                                    inmRta =QuitaNull(inmRta);
                                                    inmVta =QuitaNull(inmVta);
                                                    inmPreVta =QuitaNull(inmPreVta);
                                                    inmLat =QuitaNull(inmLat);
                                                    inmLng =QuitaNull(inmLng);
                                                    inmMon =QuitaNull(inmMon);
                                                    inmMonR =QuitaNull(inmMonR);
                                                    inmTipo =QuitaNull(inmTipo);
                                                    inmUso =QuitaNull(inmUso);
                                                    inmUsoSuelo=QuitaNull(inmUsoSuelo);
                                                    inmPDF =QuitaNull(inmPDF);
                                                    inmError =QuitaNull(inmError);
                                                    inmEstatus=QuitaNull(inmEstatus);
                                                    inmFechaFin=QuitaNull(inmFechaFin);
                                                    inmMotivoRechazo=QuitaNull(inmMotivoRechazo);

													inmVendedor.Id  =QuitaNull(inmVendedor.Id);
													inmVendedor.Nombre =QuitaNull(inmVendedor.Nombre);
													inmVendedor.Foto =QuitaNull(inmVendedor.Foto);
													inmVendedor.Tel1 =QuitaNull(inmVendedor.Tel1);
													inmVendedor.Tel2 =QuitaNull(inmVendedor.Tel2);
													inmVendedor.Celular =QuitaNull(inmVendedor.Celular);
													inmVendedor.EMail1 =QuitaNull(inmVendedor.EMail1);
													inmVendedor.EMail2 =QuitaNull(inmVendedor.EMail2);
													inmVendedor.Empresa =QuitaNull(inmVendedor.Empresa);
													inmVendedor.Logo =QuitaNull(inmVendedor.Logo);
													inmVendedor.www =QuitaNull(inmVendedor.www);
													inmVendedor.Sexo =QuitaNull(inmVendedor.Sexo);

                                                    reqs[ridx]=null;
													for(var i=0; i<AInmuebles.length; i++){
														if (AInmuebles[i].Id==inmID){
																AInmuebles[i].Cargado=true;
																AInmuebles[i].Tipo=MinusMayus(inmTipo);
																AInmuebles[i].Uso=MinusMayus(inmUso);
																AInmuebles[i].UsoSuelo=MinusMayus(inmUsoSuelo);
																AInmuebles[i].Thumb=inmFoto;
																AInmuebles[i].Logo=inmLogo;
																AInmuebles[i].Direccion=MinusMayus(inmDir);
																AInmuebles[i].NumExt=MinusMayus(inmNumExt);
																AInmuebles[i].NumInt=MinusMayus(inmNumInt);
																AInmuebles[i].Colonia=MinusMayus(inmCol);
																AInmuebles[i].Zona=inmZona;
																AInmuebles[i].CP=inmCP;
																AInmuebles[i].Delegacion=MinusMayus(inmDel);
																AInmuebles[i].Estado=MinusMayus(inmEst);
																AInmuebles[i].Pais=MinusMayus(inmPai);
																AInmuebles[i].PrecioVenta=inmPV1;
																AInmuebles[i].PrecioRenta=inmPR1;
																AInmuebles[i].PrecioMant=inmMantenim;
																AInmuebles[i].FechaEntrega=inmFechaEntrega;
																AInmuebles[i].Nombre = MinusMayus(inmNombre);
																AInmuebles[i].SuperficieTerreno = inmST;
																AInmuebles[i].SuperficieConstruccion = inmSC;
																AInmuebles[i].Cuartos = inmRec;
																AInmuebles[i].Banios = inmBan;
																AInmuebles[i].Estacionamientos = inmEstac;
																AInmuebles[i].Traspaso = inmTras;
																AInmuebles[i].Venta = inmVta;
																AInmuebles[i].Renta = inmRta;
																AInmuebles[i].PreVenta = inmPreVta;
																AInmuebles[i].Moneda = inmMon;
																AInmuebles[i].MonedaRenta = inmMonR;
                                                                                                                                AInmuebles[i].Estatus = inmEstatus;
                                                                                                                                AInmuebles[i].FechaFin = inmFechaFin;
                                                                                                                                AInmuebles[i].MotivoRechazo = inmMotivoRechazo;
                                                                                                                                
                                                                                                                                
																var erroraleatoriox=0.0;
																var erroraleatorioy=0.0;
																if (inmError==1){
																	erroraleatoriox = (Math.random() - 0.5)/400;
																	if (Math.random()>0.5){
																		erroraleatorioy = Math.sqrt(sqr(0.5/400) - sqr(erroraleatoriox)) ;
																	} else {
																		erroraleatorioy = 0 - Math.sqrt(sqr(0.5/400) - sqr(erroraleatoriox)) ;
																	}

																}
																AInmuebles[i].LatReal = inmLat;
																AInmuebles[i].LngReal = inmLng;

																var inmLat1 = parseFloat(inmLat);
																var inmLng1 = parseFloat(inmLng);

																AInmuebles[i].Lat = parseFloat(inmLat1) + parseFloat(erroraleatoriox);
																AInmuebles[i].Lng = parseFloat(inmLng1) + parseFloat(erroraleatorioy);
																AInmuebles[i].PDF = 'MapaDeInmueblesPropiedad-' + AInmuebles[i].Id + '.pdf';
																AInmuebles[i].Error = inmError;
																AInmuebles[i].Vendedor = inmVendedor;

														}
													}

                                                                                                        if (pantalla=="admin"){
                                                                                                            EscribePropiedadUsuario(inmID);
                                                                                                        } else {
                                                                                                            EscribePropiedad(inmID);
                                                                                                        }
													

                                                }//if 200
                                        }//if 4
                                }//if null
                        }//for
                } catch(err){reqs = new Array;intListenerCliente=0;}
	}//ListenerGeneral

	function Marco(strTexto,idPropiedad){
		var strMarco="";
		strMarco = "<table height='54px' width='74px' cellspacing='0' cellpadding='1' style='border:1px solid rgb(150,150,150)' onmouseout ='this.style.border=\"1px solid rgb(150,150,150)\";OcultaPopUp();' onmouseover ='this.style.border=\"1px solid rgb(255,150,9)\";MuestraPopUp(" + idPropiedad + ");' onclick='blnEsperandoPopUp=true;MuestraPopUpClick(" + idPropiedad + ");'><tr><td><div style='top:0px; left:0px;'>" + strTexto;
		strMarco = strMarco + "</div></td></tr></table>";
		return strMarco;
	}//Marco

	function Marquito(strTexto){
		var strMarco="";
		strMarco = "<table bgcolor=white height='54px' width='74px' cellspacing='0' cellpadding='1' style='border:1px solid rgb(150,150,150)' onmouseout ='this.style.border=\"1px solid rgb(150,150,150)\";' onmouseover ='this.style.border=\"1px solid rgb(255,150,9)\";'><tr><td><div style='top:0px; left:0px;'>" + strTexto;
		strMarco = strMarco + "</div></td></tr></table>";
		return strMarco;
	}//Marquito

	function VistaPrevia(idInm){
		var inmuebleResp =RegresaInmueble(idInm);

			var strCorredor = "";

			var strDatos = "";
			if (inmuebleResp.Vendedor.Nombre  != ''){
				strDatos = strDatos + '<img src="/imgs/corredor.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Nombre + "<br>";
			}
			if (inmuebleResp.Vendedor.Tel1  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Tel1 + "<br>";
			}
			if (inmuebleResp.Vendedor.Tel2  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Tel2 + "<br>";
			}
			if (inmuebleResp.Vendedor.Celular  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Celular + "<br>";
			}
			if (inmuebleResp.Vendedor.EMail1  != ''){
				strDatos = strDatos + '<img src="/imgs/emailvendedor.gif" border=0>&nbsp;<a href="mailto:' + inmuebleResp.Vendedor.EMail1 + '">' + inmuebleResp.Vendedor.EMail1 + '</a><br>';
			}
			if (inmuebleResp.Vendedor.EMail2  != ''){
				strDatos = strDatos + '<img src="/imgs/emailvendedor.gif" border=0>&nbsp;<a href="mailto:' + inmuebleResp.Vendedor.EMail2 + '">' + inmuebleResp.Vendedor.EMail2 + '</a><br>';
			}
			if (inmuebleResp.Vendedor.www  != ''){
				strDatos = strDatos + '<img src="/imgs/website.gif" border=0>&nbsp;&nbsp;' + inmuebleResp.Vendedor.www + "<br>";
			}

			if (inmuebleResp.Vendedor.Logo  != ''){
				if (inmuebleResp.Vendedor.Empresa != ''){
					strCorredor = "<a href='javascript: DetallesVendedor(" + inmuebleResp.Id + ")' title='Ver detalles del Vendedor (" + inmuebleResp.Vendedor.Empresa + ")'><img src='" + inmuebleResp.Vendedor.Logo + "' border=0 alt='" + inmuebleResp.Vendedor.Empresa + "'></a>";
				} else {
					strCorredor = "<a href='javascript: DetallesVendedor(" + inmuebleResp.Id + ")' title='Ver detalles del Vendedor'><img src='" + inmuebleResp.Vendedor.Logo + "' border=0></a>";
				}

			} else if (inmuebleResp.Vendedor.Foto  != ''){
				strCorredor = "<table><tr><td><img src='" + inmuebleResp.Vendedor.Foto + "' border=0></td><td>" + strDatos + "</td></tr></table>";
			} else {
				if (inmuebleResp.Vendedor.Sexo=='F'){
					strCorredor = "<table><tr><td><img src='/imgs/mujer.jpg' border=0></td><td>" + strDatos + "</td></tr></table>";
				} else {
					strCorredor = "<table><tr><td><img src='/imgs/hombre.jpg' border=0></td><td>" + strDatos + "</td></tr></table>";
				}
			}


			var strCaract = "";
			strCaract = strCaract +  "<table width=100%><tr><td valign=top><b><img src='/imgs/datos.gif' border=0>&nbsp;Caracter&iacute;sticas:</b><td valign=top width=140px><b><img src='/imgs/corredor.gif' border=0>&nbsp;Vendedor:</b></td></tr>";
			strCaract = strCaract +  "<tr><td  style='background-color:rgb(237,246,217)'><table><tr><td align=right><b>" + inmuebleResp.Cuartos + "</b></td><td>Cuartos</td></tr>";
			strCaract = strCaract +  "<tr><td align=right><b>" + inmuebleResp.Banios + "</b></td><td>Ba&ntilde;os</td></tr>";
			strCaract = strCaract +  "<tr><td align=right><b>" + inmuebleResp.Estacionamientos + "</b></td><td>Estacionamientos</td></tr>";
			strCaract = strCaract +  "<tr><td align=right><b>" + inmuebleResp.SuperficieTerreno + "</b></td><td>m&sup2; Terreno</td></tr>";
			strCaract = strCaract +  "<tr><td align=right><b>" + inmuebleResp.SuperficieConstruccion + "</b></td><td>m&sup2; Construcc.</td></tr></table>  </td>";
			strCaract = strCaract +  "<td style='background-color:rgb(237,246,217)' align=center valign=center>" + strCorredor + "</td></tr>";
			strCaract = strCaract +  "</table>";

		var strUbicacion = "";
		if (inmuebleResp.Lat != 0){
			strUbicacion  = "&nbsp;&nbsp;<a class='linkMenu3' title='Ver Ubicaci&oacute;n en Mapa' href='javascript: VerDetallesEnMapa(" + idInm + ")'><img src='/imgs/ubicacion.gif' border=0 alt='Ver Ubicaci&oacute;n en Mapa'>&nbsp;Ubicaci&oacute;n</a>";
		}

		var tdDetallesID = e("tdDetallesID" + idInm);
		var sH = "<ul class='detailsToolbar'><li class='menos'><a href='javascript: OcultarDetalles(" + idInm  + ")'>Ocultar Vista Previa</a></li></ul>";
		sH = sH + "<table width='450'><tr><td width='300'>" + strCaract + "<hr><a class='linkMenu3' title='Ver Detalles Completos del Inmueble' href='javascript: VerDetalles(" + idInm + ")'><img src='/imgs/details.gif' border=0 alt='Ver Detalles Completos del Inmueble'>&nbsp;Detalles</a>" + strUbicacion + "</td><td width='150'><div style='border: 1px solid rgb(158,207,64);width:150px;height:150px;' id='divMapita" + idInm + "'><img src='/imgs/loading.gif' border=0>Obteniendo informaci&oacute;n</div></td></tr></table>"
		sH = sH + "";
		tdDetallesID.innerHTML = sH;

		if (inmuebleResp.Lat==0){
			var mimapita = e("divMapita" + idInm);
			mimapita.innerHTML = "<img src='/imgs/desconocida.jpg' border=0 alt='Se desconoce la ubicaci&oacute;n exacta de este inmueble'>";
		} else {
			CrearMapitaGoogle(idInm,inmuebleResp.Lat,inmuebleResp.Lng);
		}


	}//VistaPrevia

	function VerVideo(claveVideo){
            
		var spanVideosDetails = e("spanVideosDetails");

		var strContenido="";
		strContenido = strContenido + ' <object width="310" height="265">';
		strContenido = strContenido + ' <param name="movie" value="http://www.youtube.com/v/' + claveVideo + '&rel=0&color1=0xffffff&color2=0xffffff&border=0&hl=es&fs=1"></param>';
		strContenido = strContenido + ' <param name="wmode" value="transparent"></param>';
                strContenido = strContenido + '<param name="allowFullScreen" value="true"></param>';
		strContenido = strContenido + ' <embed src="http://www.youtube.com/v/' + claveVideo + '&rel=0&color1=0xffffff&color2=0xffffff&border=0&hl=es&fs=1" type="application/x-shockwave-flash" wmode="transparent" allowfullscreen="true"  width="310" height="265"></embed>';
		strContenido = strContenido + ' </object>';
		spanVideosDetails.innerHTML = strContenido;

	}//VerVideo

	function VerDetalles(idInm){
		if (intMicrositio>0){
			NewWindow("propiedades.jsp?ms=" + intMicrositio + "&propiedad="+idInm,"details"+Math.random().toString().substring(2),970,getWindowHeight(),"yes","center");
		} else {
			NewWindow("propiedades.jsp?propiedad="+idInm,"details"+Math.random().toString().substring(2),970,getWindowHeight(),"yes","center");
		}

	}//VerDetalles

	function OcultarDetalles(idInm){
		var tdDetallesID = e("tdDetallesID" + idInm);
		tdDetallesID.innerHTML = "<ul class='detailsToolbar'><li class='mas'><a href='javascript: VistaPrevia(" + idInm+ ")'>Vista Previa&nbsp;</a>&nbsp;&nbsp;&nbsp;<span id='spanMicrodatos" + idInm + "' style='font-size:8pt;color:rgb(100,100,100);'></span></li></ul>";

		var inmuebleRespectivo = RegresaInmueble(idInm);
		var spanMicrodatos = e("spanMicrodatos" + inmuebleRespectivo.Id);
		spanMicrodatos.innerHTML = "<b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Cuartos +  "</b> Ctos., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Banios + "</b> Ba&ntilde;os, <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Estacionamientos + "</b> Estacionam., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.SuperficieTerreno + "</b> m&sup2; Terr., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.SuperficieConstruccion + "</b> m&sup2; Constr.";

	}//OcultarDetalles

	function CrearMapitaGoogle(idNeg,x,y){
		try {
			if (GBrowserIsCompatible()) {
				var mapita = new GMap2(document.getElementById("divMapita" + idNeg));
                                mapita.addControl(new GSmallMapControl());
				mapita.setCenter(new GLatLng(x, y), 15);
				var point1 = new GLatLng(x, y);
				//var marker1 = new GMarker(point1);
					var icon1 = new GIcon();
					icon1.image = "/imgs/markers/casa_marker.png";
					icon1.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
					icon1.iconSize = new GSize(30, 46);
					icon1.shadowSize = new GSize(22, 20);
					icon1.iconAnchor = new GPoint(30/2, 46/2);
					icon1.infoWindowAnchor = new GPoint(5, 0);

					var marker1 = new GMarker(point1, {icon: icon1});

				mapita.addOverlay(marker1);
			}
		} catch(err){
			var divMapita = e("divMapita" + idNeg);
			divMapita.innerHTML = "<img src='/imgs/desconocida.jpg' border=0 alt='Se desconoce la ubicaci&oacute;n exacta de este inmueble'>";
		}

	}//CrearMapitaGoogle

	function handleKeyPress(ek){
            var min=0;
            var max=0;
		var key=ek.keyCode || ek.which;
		if (key==13){
			var divfading=e("divfading");
			if (divfading.style.visibility=="hidden"){
                            
                            var txtPrecioMinimo = e("txtPrecioMinimo");
                            var txtPrecioMaximo = e("txtPrecioMaximo");

                            if (txtPrecioMinimo.value!='') {
                              txtPrecioMinimo.value = RemplazaString(txtPrecioMinimo.value,",","");
                              txtPrecioMinimo.value = RemplazaString(txtPrecioMinimo.value,"$","");
                              if (parseInt(txtPrecioMinimo.value)=='NaN') {
                                  alert('El Precio Mínimo es inválido!');
                                  return;
                              } else {

                                  min = parseInt(txtPrecioMinimo.value);

                                  if (txtPrecioMaximo.value!='') {
                                    txtPrecioMaximo.value = RemplazaString(txtPrecioMaximo.value,",","");
                                    txtPrecioMaximo.value = RemplazaString(txtPrecioMaximo.value,"$","");
                                    if (parseInt(txtPrecioMaximo.value)=='NaN') {
                                        alert('El Precio Máximo es inválido');
                                        return;
                                    } else {
                                        max = parseInt(txtPrecioMaximo.value);
                                    }
                                  } else {
                                      max = 999999999;
                                  }
                            
                              }
                            } else {
                                if (txtPrecioMaximo.value!='') {
                                    
                                  txtPrecioMaximo.value = RemplazaString(txtPrecioMaximo.value,",","");
                                  txtPrecioMaximo.value = RemplazaString(txtPrecioMaximo.value,"$","");
                                  if (parseInt(txtPrecioMaximo.value)=='NaN') {
                                      alert('El Precio Máximo es inválido');
                                      return;
                                  } else {
                                      min = 0;
                                      max = parseInt(txtPrecioMaximo.value);
                                  }
				} 
                                
                                
                            }

                                txtBuscar_lostfocus();
				BuscarTexto(min,max);
                                txtBuscar_gotfocus();
			}
		}
	}//handleKeyPress

	function handleKeyPressPag(e){
		var key=e.keyCode || e.which;
		if (key==13){
				EnterPagina();
		}
	}//handleKeyPressPag

	function handleKeyPressEmail(e){
		var key=e.keyCode || e.which;
		if (key==13){
				EnterEmail();
		}
	}//handleKeyPressEmail

	function handleKeyPressReset(ek){
		var key=ek.keyCode || ek.which;
		if (key==13){
			ResetPassword();
		}
	}//handleKeyPressReset


	function MuestraInmueble(idPropiedad){

		var existe=false;
		for(var i=0; i<AInmuebles.length; i++){
			if (AInmuebles[i].Id==idPropiedad){
				existe=true;
				if (AInmuebles[i].Cargado){
					EscribePropiedad(idPropiedad);
					return;
				} else {
					reqI = init();
					reqI.onreadystatechange = ListenerGeneral;
					reqI.send("Detalle=" + idPropiedad + "@@@" + intMicrositio);
					AgregaRequest(reqI);
					return;
				}
			}
		}
		if (existe==false){
			var inmNuevo = new Inmueble(idPropiedad);
			AInmuebles.push(inmNuevo);

			reqI = init();
			reqI.onreadystatechange = ListenerGeneral;
			reqI.send("Detalle=" + idPropiedad  + "@@@" + intMicrositio);
			AgregaRequest(reqI);
		}

		return existe;
	}//MuestraInmueble

	function EscribePropiedad(idPropiedad){
		var spanX = e("spanID" + idPropiedad);
		if (spanX != "undefined"){
			var sH="";
			var inmuebleRespectivo = RegresaInmueble(idPropiedad);

			var strTitulo="";
			var strLineaOpc="";
			if ((inmuebleRespectivo.Nombre=="")) {
				strTitulo=inmuebleRespectivo.Direccion;
				if (inmuebleRespectivo.NumExt != ''){
					strTitulo = strTitulo + ' ' + inmuebleRespectivo.NumExt;
				}
				if (inmuebleRespectivo.NumInt != ''){
					strTitulo = strTitulo +  ' ' + inmuebleRespectivo.NumInt;
				}
			} else {
				strTitulo=inmuebleRespectivo.Nombre;

				strLineaOpc= "<br>" + inmuebleRespectivo.Direccion;
				if (inmuebleRespectivo.NumExt != ''){
					strLineaOpc = strLineaOpc + ' ' + inmuebleRespectivo.NumExt;
				}
				if (inmuebleRespectivo.NumInt != ''){
					strLineaOpc = strLineaOpc +  ' ' + inmuebleRespectivo.NumInt;
				}
			}


			if (inmuebleRespectivo.PDF != ''){
				var spanPDF = e("spanPDF" + idPropiedad);

				if (esFavorito(inmuebleRespectivo.Id)==false){
					spanPDF.innerHTML = "&nbsp;&nbsp;&nbsp; <a  class='linkMenu' style='color:rgb(0,0,0);' href='javascript: PDF(" + idPropiedad + ")' title='Descargar Ficha T&eacute;cnica como PDF'><img src='/imgs/pdf.gif' border=0 alt='Descargar Ficha T&eacute;cnica como PDF'>&nbsp;Descargar</a><g:plusone size='medium' href='http://www.mapadeinmuebles.com/propiedades.jsp?propiedad=" + idPropiedad  + "'></g:plusone>";
				} else {
					spanPDF.innerHTML = "&nbsp;&nbsp;&nbsp; <a  class='linkMenu' href='javascript: PDF(" + idPropiedad + ")' title='Descargar Ficha T&eacute;cnica como PDF'><img src='/imgs/pdf.gif' border=0 alt='Descargar Ficha T&eacute;cnica como PDF'>&nbsp;Descargar</a><g:plusone size='medium' href='http://www.mapadeinmuebles.com/propiedades.jsp?propiedad=" + idPropiedad  + "'></g:plusone>";
				}

			}

			var strTraspaso="";
			if (inmuebleRespectivo.Traspaso){
				strTraspaso="(Traspaso)";
			}

			var strFoto ="";
			if (inmuebleRespectivo.Thumb==""){
				strFoto = Marco("<img id='img" + idPropiedad + "' src='/imgs/loading.gif' border=0  style='cursor:pointer;'>",0);
			} else {
				strFoto = Marco("<img id='img" + idPropiedad + "' src='/imgs/loading.gif' border=0  style='cursor:pointer;'>",idPropiedad);
			}

			var strTituloProp="";
			if (inmuebleRespectivo.Lat==0){
				strTituloProp="<b style='color:rgb(30,30,30);'>" + strTitulo + "</b>";
			} else {
				strTituloProp="<b style='color:rgb(0,0,255);'><a class='liga' title='Ver Ubicaci&oacute;n en Mapa' href='javascript: VerDetallesEnMapa("  + idPropiedad +")'>" + strTitulo + "</a></b>";
			}

			var strZona = "";
			if (inmuebleRespectivo.Zona != ""){
				strZona = "<b style='background-color:rgb(76,158,234);color:rgb(255,255,255);font-size:10pt;'>&nbsp;" + inmuebleRespectivo.Zona  + "&nbsp;</b><br>";
			}

			var strDir = "";

			if (inmuebleRespectivo.Logo == ""){
				strDir = strZona + strTituloProp + strLineaOpc;
				if ((inmuebleRespectivo.Colonia != "") || (inmuebleRespectivo.Delegacion != "")){
					strDir = strDir + "<br>";
					if (inmuebleRespectivo.Colonia != ""){
						strDir = strDir + inmuebleRespectivo.Colonia ;
						if (inmuebleRespectivo.Delegacion != ""){
							strDir = strDir + ", " + inmuebleRespectivo.Delegacion;
						}
					} else {
						strDir = strDir + inmuebleRespectivo.Delegacion ;
					}
				}


				if ((inmuebleRespectivo.CP != "") || (inmuebleRespectivo.Estado != "")){
					strDir = strDir + "<br>";
					if (inmuebleRespectivo.CP != ""){
						strDir = strDir + inmuebleRespectivo.CP ;
						if (inmuebleRespectivo.Estado != ""){
							strDir = strDir + " " + inmuebleRespectivo.Estado;
						}
					} else {
						strDir = strDir + inmuebleRespectivo.Estado ;
					}
				}
			} else {
				strDir = strZona + strTituloProp + "<br><hr><img src='" + inmuebleRespectivo.Logo + "' border=0><hr>";
			}

				var strPrecios ;
				strPrecios = "<table>";
				if (inmuebleRespectivo.Venta==1){

					var strPesos="";
					var strDolares="";
					if (inmuebleRespectivo.Moneda=='MXP'){
						strPesos="$ ";
						strDolares="";
					} else if (inmuebleRespectivo.Moneda=='USD'){
						strPesos="";
						strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleRespectivo.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
					}

					if (isNaN(parseInt(inmuebleRespectivo.PrecioVenta))==false) {
							strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleRespectivo.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
					} else {
						strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
					}
				}

				if (inmuebleRespectivo.PreVenta==1){

					var strPesos="";
					var strDolares="";
					if (inmuebleRespectivo.Moneda=='MXP'){
						strPesos="$ ";
						strDolares="";
					} else if (inmuebleRespectivo.Moneda=='USD'){
						strPesos="";
						strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleRespectivo.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
					}

					if (isNaN(parseInt(inmuebleRespectivo.PrecioVenta))==false) {
							strPrecios = strPrecios + "<tr><td valign=top>Pre-Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleRespectivo.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
					} else {
						strPrecios = strPrecios + "<tr><td valign=top>Pre-Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
					}
				}

				if (inmuebleRespectivo.Renta==1){

					var strPesos="";
					var strDolares="";
					if (inmuebleRespectivo.MonedaRenta=='MXP'){
						strPesos="$ ";
						strDolares="";
					} else if (inmuebleRespectivo.MonedaRenta=='USD'){
						strPesos="";
						strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleRespectivo.PrecioRenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
					}

					if (isNaN(parseInt(inmuebleRespectivo.PrecioRenta))==false) {
							strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleRespectivo.PrecioRenta,0,true, true, true) + strDolares + "</b></td></tr>";
					} else {
						strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
					}
				}
				strPrecios = strPrecios + "</table>";


			var strCaract = "<b>" + inmuebleRespectivo.Tipo + "</b>";
			var strDescripcion = "<table width=165px><tr><td valign=top><img src='/imgs/precio.gif' border=0></td><td valign=top>   " + strPrecios + "   </td></tr><tr><td  valign=top><img src='/imgs/caract.gif' border=0></td><td  valign=top colspan=2>Tipo:&nbsp;&nbsp;" + strCaract + "</td></tr></table>";
                        var strLinkDetalle = "&nbsp;&nbsp;(&nbsp;" + "<a class='linkMenu3' title='Ver Detalles Completos del Inmueble' href='javascript: VerDetalles(" + idPropiedad + ")'><img src='/imgs/details.gif' border=0 alt='Ver Detalles Completos del Inmueble'>&nbsp;Detalles</a>" + "&nbsp;)";
			sH = sH + "<table width=460px cellspacing=0 cellpadding=0 ><tr height=77 >";
			sH = sH + "<td width=85px align=center>" + strFoto + "</td>";
			sH = sH + "<td width=210px>" + strDir + "</td>";
			sH = sH + "<td width=165px>" + strLinkDetalle + "<br>" + strDescripcion + "</td>";
			sH = sH + "</tr></table>";
			spanX.innerHTML = sH;
			var imgFoto = e("img" + idPropiedad);
			if (inmuebleRespectivo.Thumb==""){
				imgFoto.src='/imgs/sf.jpg';
			}
			else {
				imgFoto.src=inmuebleRespectivo.Thumb;
                                imgFoto.height=50;
			}


			if (inmuebleRespectivo.Lat != 0){
				try {
					var point = new GLatLng(inmuebleRespectivo.Lat, inmuebleRespectivo.Lng);
					inmuebleRespectivo.Pin = createMarker(point,inmuebleRespectivo);
					map.addOverlay(inmuebleRespectivo.Pin);
					bounds.extend(point);
				}catch(err){}

				if (maxLon==0){
					maxLon =inmuebleRespectivo.Lng;
					minLon =inmuebleRespectivo.Lng;
					maxLat =inmuebleRespectivo.Lat;
					minLat =inmuebleRespectivo.Lat;
				} else {
					if (inmuebleRespectivo.Lng>maxLon){
						maxLon = inmuebleRespectivo.Lng;
					}
					if (inmuebleRespectivo.Lng<minLon){
						minLon = inmuebleRespectivo.Lng;
					}
					if (inmuebleRespectivo.Lat>maxLat){
						maxLat = inmuebleRespectivo.Lat;
					}
					if (inmuebleRespectivo.Lat<minLat){
						minLat = inmuebleRespectivo.Lat;
					}

				}
				propsescritasCon++;
			} else {
				propsescritasSin++;
			}

			propsescritas= propsescritasCon + propsescritasSin;
			if (propsescritas==arrResults.length){
				try {

					if (propsescritasCon>0){

						if (fil_y1==""){
							//var sw = new GLatLng(minLat, maxLon);
							//var ne = new GLatLng(maxLat, minLon);
							//var bounds = new GLatLngBounds(sw, ne);
							//var level  = map.getBoundsZoomLevel(bounds);
							//map.setCenter(new GLatLng(0.5*minLat+0.5*maxLat, 0.5*maxLon+0.5*minLon), level);
                                                    
                                                    if (sorted=='mapcenter'){
                                                        
                                                        var pointCenter = map.getCenter();
                                                        Circulo(pointCenter);
                                                        map.setCenter(pointCenter, 13);           
                                                        
                                                    } else {
                                                        map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
                                                    }
						} else {
                                                        var pointCenter = map.getCenter();
                                                        Circulo(pointCenter);

                                                }

					} else {
						if (fil_y1==""){
							map.setCenter(new GLatLng(19.42661072109788, -99.15229797363281), 4);
						}
					}

				} catch(err){}
			}

			var spanMicrodatos = e("spanMicrodatos" + inmuebleRespectivo.Id);
			spanMicrodatos.innerHTML = "<b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Cuartos +  "</b> Ctos., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Banios + "</b> Ba&ntilde;os, <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.Estacionamientos + "</b> Estacionam., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.SuperficieTerreno + "</b> m&sup2; Terr., <b style='color:rgb(204,102,0);'>" + inmuebleRespectivo.SuperficieConstruccion + "</b> m&sup2; Constr.";

		}
	}//EscribePropiedad

      function Circulo(pnt){

              var givenRad = '5'*1;
              var givenQuality = '40'*1;
              var centre = pnt || map.getCenter();
              drawCircle(centre, 1, 20);
              drawCircle(centre, 5, 20);
              drawCircle(centre, 10, 30);
              drawCircle(centre, 15, 40);
      }//Circulo

      function drawCircle(center2, radius, nodes, liColor, liWidth, liOpa, fillColor, fillOpa)
      {
      // Esa 2006
              //calculating km/degree
              var latConv = center2.distanceFrom(new GLatLng(center2.lat()+0.1, center2.lng()))/100;
              var lngConv = center2.distanceFrom(new GLatLng(center2.lat(), center2.lng()+0.1))/100;

              //Loop 
              var points = [];
              var step = parseInt(360/nodes)||10;
              for(var i=0; i<=360; i+=step)
              {
              var pint = new GLatLng(center2.lat() + (radius/latConv * Math.cos(i * Math.PI/180)), center2.lng() + 
              (radius/lngConv * Math.sin(i * Math.PI/180)));
              points.push(pint);

              }
              points.push(points[0]); // Closes the circle, thanks Martin
              fillColor = fillColor||liColor||"#0055ff";
              liWidth = liWidth||2;
              var poly = new GPolygon(points,liColor,liWidth,liOpa,fillColor,fillOpa);
              map.addOverlay(poly);

              GEvent.addListener(poly, "click", function() {
                      map.closeInfoWindow();
              });


      }//DrawCircle

	function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
	/**********************************************************************
		IN:
			NUM - the number to format
			decimalNum - the number of decimal places to format the number to
			bolLeadingZero - true / false - display a leading zero for
											numbers between -1 and 1
			bolParens - true / false - use parenthesis around negative numbers
			bolCommas - put commas as number separators.

		RETVAL:
			The formatted number!
	 **********************************************************************/
	{
	        if (isNaN(parseInt(num))) return "NaN";

		var tmpNum = num;
		var iSign = num < 0 ? -1 : 1;		// Get sign of number

		// Adjust number so only the specified number of numbers after
		// the decimal point are shown.
		tmpNum *= Math.pow(10,decimalNum);
		tmpNum = Math.round(Math.abs(tmpNum))
		tmpNum /= Math.pow(10,decimalNum);
		tmpNum *= iSign;					// Readjust for sign


		// Create a string object to do our formatting on
		var tmpNumStr = new String(tmpNum);

		// See if we need to strip out the leading zero or not.
		if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
			if (num > 0)
				tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
			else
				tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);

		// See if we need to put in the commas
		if (bolCommas && (num >= 1000 || num <= -1000)) {
			var iStart = tmpNumStr.indexOf(".");
			if (iStart < 0)
				iStart = tmpNumStr.length;

			iStart -= 3;
			while (iStart >= 1) {
				tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
				iStart -= 3;
			}
		}

		// See if we need to use parenthesis
		if (bolParens && num < 0)
			tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

		return tmpNumStr;		// Return our formatted string!
	}//FormatNumber



	function createMarker(point, inmuebleResp) {

		var strFoto="";
		var idPropiedadFoto=0;
		if (inmuebleResp.Thumb==""){
			strFoto='/imgs/sf.jpg';
			idPropiedadFoto=0;
		}
		else {
			strFoto=inmuebleResp.Thumb;
			idPropiedadFoto=inmuebleResp.Id;
		}

		var strID= "";
		strID = inmuebleResp.Id;


			var strTitulo="";
			var strLineaOpc="";
			if ((inmuebleResp.Nombre=="")) {
				strTitulo=inmuebleResp.Direccion;
				if (inmuebleResp.NumExt != ''){
					strTitulo = strTitulo + ' ' + inmuebleResp.NumExt;
				}
				if (inmuebleResp.NumInt != ''){
					strTitulo = strTitulo +  ' ' + inmuebleResp.NumInt;
				}
			} else {
				strTitulo=inmuebleResp.Nombre;

				strLineaOpc= "<br>" + inmuebleResp.Direccion;
				if (inmuebleResp.NumExt != ''){
					strLineaOpc = strLineaOpc + ' ' + inmuebleResp.NumExt;
				}
				if (inmuebleResp.NumInt != ''){
					strLineaOpc = strLineaOpc +  ' ' + inmuebleResp.NumInt;
				}
			}


		var strZona = "";
		if (inmuebleResp.Zona != ""){
			strZona = "<b style='background-color:rgb(87,168,204);color:rgb(255,255,255);font-size:10pt;'>&nbsp;" + inmuebleResp.Zona  + "&nbsp;</b><br>";
		}

		var strTitulo2 ="";
		strTitulo2 = strZona + "<a class='liga' href='javascript: VerDetalles("  + inmuebleResp.Id +")' title='Ver detalles completos de este inmueble'>" + strTitulo + "</a>";

		var strTipo = inmuebleResp.Tipo;

		var icon1 = new GIcon();
		icon1.image = "/imgs/markers/casa_marker.png";
		icon1.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		icon1.iconSize = new GSize(30, 46);
		icon1.shadowSize = new GSize(22, 20);
		icon1.iconAnchor = new GPoint(30/2, 46/2);
		icon1.infoWindowAnchor = new GPoint(5, 0);

		var marker = new GMarker(point, {icon: icon1, title: strTitulo});



		var strPrecios ;
		strPrecios = "<table>";
		if (inmuebleResp.Venta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.Moneda=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.Moneda=='USD'){
				strPesos=""; 
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioVenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}

		if (inmuebleResp.PreVenta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.Moneda=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.Moneda=='USD'){
				strPesos="";
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioVenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Pre-Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Pre-Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}

		if (inmuebleResp.Renta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.MonedaRenta=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.MonedaRenta=='USD'){
				strPesos="";
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioRenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioRenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioRenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}
		strPrecios = strPrecios + "</table>";

		var strPrecio = "<table><tr><td valign=top><img src='/imgs/precio.gif' ></td><td valign=top>" + strPrecios + "</td></tr></table>";

		//var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {

			var botonGuardar="";
			if (esFavorito(inmuebleResp.Id)==false){
				botonGuardar = "<a class='linkMenu' href='javascript: GuardarFavorito(" + strID + ")' title='Guardar en Mis Favoritos'><img src='/imgs/save.gif' border=0 alt='Guardar en Mis Favoritos'></a> &nbsp;&nbsp;&nbsp; ";
			}

			var sH ="";
			sH = sH + "<table width=250px>";
			if (inmuebleResp.Logo != ""){
				sH = sH + "<tr><td colspan=2><hr><img src='" + inmuebleResp.Logo + "' border=0><hr></td></tr>";
			}
			sH = sH + "<tr height=77><td width=85px align=top>" + Marco("<img src='" + strFoto + "' border=0 height=50 style='cursor:pointer;'>", idPropiedadFoto) + "</td>";
			sH = sH + " <td width=150px valign=top><BR><B>" + strTitulo2 + "</B>" + strLineaOpc + "<BR>" + strPrecio + "<img src='/imgs/caract.gif'>&nbsp;" + strTipo + "</td>";
			sH = sH + " </tr>";
			sH = sH + " <tr><td colspan=2 style='background-Color:rgb(158,207,64);color:rgb(255,255,255);' valign=top align=center> <a class='linkMenu' title='Ver Detalles' href='javascript: VerDetalles(" + strID + ")'><img src='/imgs/details.gif' border=0 alt='Ver Detalles'>&nbsp;Ver Detalles</a> &nbsp;&nbsp;&nbsp; " + botonGuardar + "<a  class='linkMenu' href='javascript: Email(" + strID + ")' title='Enviar por E-mail'><img src='/imgs/email.gif' border=0 alt='Enviar por E-mail'></a>&nbsp;&nbsp;&nbsp; <a  class='linkMenu' href='javascript: PDF(" + strID + ")' title='Descargar Ficha T&eacute;cnica como PDF'><img src='/imgs/pdf.gif' border=0 alt='Descargar Ficha T&eacute;cnica como PDF'></a></td></tr>";
			if (inmuebleResp.Error==1){
				sH = sH + " </tr><tr><td colspan=2 style='background-Color:rgb(240,240,240);color:rgb(255,0,0);font-weight: lighter;' valign=top align=center>De manera intencional, el anunciante no muestra la ubicaci&oacute;n exacta, sin embargo se presenta una ubicaci&oacute;n aproximada</td>";
			}

                        sH = sH + "<tr><td colspan=2><hr>Buscar cerca de aqu&iacute;:&nbsp;<input type=text id='txtBuscarCerca' onkeypress='handleKeyPressBuscarCerca(event," + inmuebleResp.Lat + "," + inmuebleResp.Lng + ")'>&nbsp;<input type=button value='Buscar' onclick='pagina=1;blnTrabajando=true;sorted=\"mapcenter\";map.setCenter(new GLatLng(" + inmuebleResp.Lat +  ", " + inmuebleResp.Lng + "));var txtBuscarCerca = e(\"txtBuscarCerca\");txtBuscar.value = txtBuscarCerca.value;txtBuscar_lostfocus();LimpiaPrecios();Buscar();'></td></tr>";
                        sH = sH + " </tr></table>";
			marker.openInfoWindowHtml(sH);
		});
		return marker;

	}//createMarker
        
        function handleKeyPressBuscarCerca(ev,lat,lng){
                var key=ev.keyCode || ev.which;
                if (key==13){
                    LimpiaPrecios();
                    var txtBuscarCerca = e("txtBuscarCerca");
                    txtBuscar.value = txtBuscarCerca.value;
                    txtBuscar_lostfocus();
                    pagina=1;
                    blnTrabajando=true;
                    sorted='mapcenter';
                    map.setCenter(new GLatLng(lat,lng));
                    Buscar();
                }
        }//handleKeyPressBuscarCerca

	function VerDetallesEnMapa(idPropiedad){
			var inmuebleResp =RegresaInmueble(idPropiedad);

			var strFoto="";
			var idPropiedadFoto=0;
			if (inmuebleResp.Thumb==""){
				strFoto='/imgs/sf.jpg';
				idPropiedadFoto=0;
			}
			else {
				strFoto=inmuebleResp.Thumb;
				idPropiedadFoto=inmuebleResp.Id;
			}

			var strID= "";
			strID = inmuebleResp.Id;

			var strTitulo="";
			var strLineaOpc="";
			if ((inmuebleResp.Nombre=="")) {
				strTitulo=inmuebleResp.Direccion;
				if (inmuebleResp.NumExt != ''){
					strTitulo = strTitulo + ' ' + inmuebleResp.NumExt;
				}
				if (inmuebleResp.NumInt != ''){
					strTitulo = strTitulo +  ' ' + inmuebleResp.NumInt;
				}
			} else {
				strTitulo=inmuebleResp.Nombre;

				strLineaOpc= "<br>" + inmuebleResp.Direccion;
				if (inmuebleResp.NumExt != ''){
					strLineaOpc = strLineaOpc + ' ' + inmuebleResp.NumExt;
				}
				if (inmuebleResp.NumInt != ''){
					strLineaOpc = strLineaOpc +  ' ' + inmuebleResp.NumInt;
				}
			}


		var strZona = "";
		if (inmuebleResp.Zona != ""){
			strZona = "<b style='background-color:rgb(87,168,204);color:rgb(255,255,255);font-size:10pt;'>&nbsp;" + inmuebleResp.Zona  + "&nbsp;</b><br>";
		}

		var strTitulo2 ="";
		strTitulo2 = strZona + "<a class='liga' href='javascript: VerDetalles("  + inmuebleResp.Id +")' title ='Ver detalles completos de este inmueble'>" + strTitulo + "</a>";

		var strPrecio = FormatNumber(inmuebleResp.PrecioVenta,0,true, true, true);
		var strTipo = inmuebleResp.Tipo;




		var strPrecios ;
		strPrecios = "<table>";
		if (inmuebleResp.Venta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.Moneda=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.Moneda=='USD'){
				strPesos="";
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioVenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}

		if (inmuebleResp.PreVenta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.Moneda=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.Moneda=='USD'){
				strPesos="";
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioVenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioVenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioVenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Venta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}

		if (inmuebleResp.Renta==1){

			var strPesos="";
			var strDolares="";
			if (inmuebleResp.MonedaRenta=='MXP'){
				strPesos="$ ";
				strDolares="";
			} else if (inmuebleResp.MonedaRenta=='USD'){
				strPesos="";
				strDolares=" usd<br><span style='font-size:8pt;color:rgb(100,100,100)'>(Aprox. $ " + FormatNumber(inmuebleResp.PrecioRenta * TipoCambio.innerHTML,0,true, true, true) + " pesos)</span>";
			}

			if (isNaN(parseInt(inmuebleResp.PrecioRenta))==false) {
					strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:10pt;'>" + strPesos + FormatNumber(inmuebleResp.PrecioRenta,0,true, true, true) + strDolares + "</b></td></tr>";
			} else {
				strPrecios = strPrecios + "<tr><td valign=top>Renta:</td><td valign=top align=right><b style='font-size:8pt;'>No Disponible</b></td></tr>";
			}
		}
		strPrecios = strPrecios + "</table>";

		var strPrecio = "<table><tr><td valign=top><img src='/imgs/precio.gif' ></td><td valign=top>" + strPrecios + "</td></tr></table>";

			var botonGuardar="";
			if (esFavorito(inmuebleResp.Id)==false){
				botonGuardar = "<a class='linkMenu' href='javascript: GuardarFavorito(" + strID + ")' title='Guardar en Mis Favoritos'><img src='/imgs/save.gif' border=0 alt='Guardar en Mis Favoritos'></a> &nbsp;&nbsp;&nbsp; ";
			}

			var sH ="";
			sH = sH + "<table width=250px>";
			if (inmuebleResp.Logo != ""){
				sH = sH + "<tr><td colspan=2><hr><img src='" + inmuebleResp.Logo + "' border=0><hr></td></tr>";
			}
			sH = sH + "<tr height=77><td width=85px align=top>" + Marco("<img src='" + strFoto + "' border=0 height=50 style='cursor:pointer;'>", idPropiedadFoto) + "</td>";
			sH = sH + " <td width=150px valign=top><BR><B>" + strTitulo2 + "</B>" + strLineaOpc + "<BR>" + strPrecio + "<img src='/imgs/caract.gif'>&nbsp;" + strTipo + "</td>";
			sH = sH + " </tr>";
			sH = sH + " <tr><td colspan=2 style='background-Color:rgb(158,207,64);color:rgb(255,255,255);' valign=top align=center> <a class='linkMenu' title='Ver Detalles' href='javascript: VerDetalles(" + strID + ")'><img src='/imgs/details.gif' border=0 alt='Ver Detalles'>&nbsp;Ver Detalles</a> &nbsp;&nbsp;&nbsp;  " + botonGuardar + "<a  class='linkMenu' href='javascript: Email(" + strID + ")' title='Enviar por E-mail'><img src='/imgs/email.gif' border=0 alt='Enviar por E-mail'></a>&nbsp;&nbsp;&nbsp; <a  class='linkMenu' href='javascript: PDF(" + strID + ")' title='Descargar Ficha T&eacute;cnica como PDF'><img src='/imgs/pdf.gif' border=0 alt='Descargar Ficha T&eacute;cnica como PDF'></a></td></tr>";
			if (inmuebleResp.Error==1){
				sH = sH + " </tr><tr><td colspan=2 style='background-Color:rgb(240,240,240);color:rgb(255,0,0);font-weight: lighter;' valign=top align=center>De manera intencional, el anunciante no muestra la ubicaci&oacute;n exacta, sin embargo se presenta una ubicaci&oacute;n aproximada</td>";
			}
                        sH = sH + "<tr><td colspan=2><hr>Buscar cerca de aqu&iacute;:&nbsp;<input type=text id='txtBuscarCerca' onkeypress='handleKeyPressBuscarCerca(event," + inmuebleResp.Lat + "," + inmuebleResp.Lng + ")'>&nbsp;<input type=button value='Buscar' onclick='blnTrabajando=true;sorted=\"mapcenter\";map.setCenter(new GLatLng(" + inmuebleResp.Lat +  ", " + inmuebleResp.Lng + "));Buscar();'></td></tr>";
			sH = sH + " </tr></table>";
			try {
				inmuebleResp.Pin.openInfoWindowHtml(sH);
				map.setCenter(new GLatLng(inmuebleResp.Lat, inmuebleResp.Lng), 15);
			} catch(err){}

			return;
	}//VerDetallesEnMapa

	function filtrar(ptipo,pnivel,pclave){
		if (ptipo=="tipo"){
			if (pnivel==1){
				fil_uso = pclave;
			} else if (pnivel==2){
				fil_tipo = pclave;
			}
		} else if (ptipo=="ubicacion"){
			if (pnivel==1){
				fil_pai_cve = pclave;
			} else if (pnivel==2){
				fil_est_cve = pclave;
			} else if (pnivel==3){
				fil_del_cve = pclave;
			} else if (pnivel==4){
				fil_col_cve = pclave;
			}
		} else if (ptipo=="operacion"){
			fil_operacion = pclave;
		} else if (ptipo=="precioventa"){
			fil_precio_venta_min = pnivel;
			fil_precio_venta_max = pclave;
		} else if (ptipo=="preciorenta"){
			fil_precio_renta_min = pnivel;
			fil_precio_renta_max = pclave;
		} else if (ptipo=="terreno"){
			fil_m2_terreno_min = pnivel;
			fil_m2_terreno_max = pclave;
		} else if (ptipo=="construccion"){
			fil_m2_construccion_min = pnivel;
			fil_m2_construccion_max = pclave;
		}
		blnTrabajando=true;
		pagina=1;
		Buscar();
	}//filtrar

	function quitaFiltros(){
		fil_uso = "";//1
		fil_tipo = "";//2
		fil_pai_cve = "";//3
		fil_est_cve = "";//4
		fil_del_cve = "";//5
		fil_col_cve = "";//6
		fil_y1 = "";//7.1
		fil_y2 = "";//7.2
		fil_x1 = "";//7.3
		fil_x2 = "";//7.4
		fil_precio_venta_min = "";//8.1
		fil_precio_venta_max = "";//8.2
		fil_precio_renta_min = "";//9.1
		fil_precio_renta_max = "";//9.2
		fil_m2_terreno_min = "";//10.1
		fil_m2_terreno_max = "";//10.2
		fil_m2_construccion_min = "";//11.1
		fil_m2_construccion_max = "";//11.2
		fil_operacion = "";
		fil_favoritos="";

		var txtPrecioVentaMin = e("txtPrecioVentaMin");
		var txtPrecioVentaMax = e("txtPrecioVentaMax");
		var txtPrecioRentaMin = e("txtPrecioRentaMin");
		var txtPrecioRentaMax = e("txtPrecioRentaMax");
		var txtConstruccionMin = e("txtConstruccionMin");
		var txtConstruccionMax = e("txtConstruccionMax");
		var txtTerrenoMin = e("txtTerrenoMin");
		var txtTerrenoMax = e("txtTerrenoMax");

		txtPrecioVentaMin.value="";
		txtPrecioVentaMax.value="";
		txtPrecioRentaMin.value="";
		txtPrecioRentaMax.value="";
		txtConstruccionMin.value="";
		txtConstruccionMax.value="";
		txtTerrenoMin.value="";
		txtTerrenoMax.value="";

	}//quitaFiltros

	function BuscarTexto(min, max){
                var cboSort = e("cboSort");
                sorted = cboSort.options[cboSort.selectedIndex].value;

		quitaFiltros();
		blnTrabajando=true;
		pagina=1;
                
                if (max>0){
                    if (max>200000){
                        fil_precio_venta_min = min;
                        fil_precio_venta_max = max;
                    } else {
                        fil_precio_renta_min = min;
                        fil_precio_renta_max = max;
                    }
                } 
		Buscar();
		scrollit();
	}//BuscarTexto

	function MuestraPopUp(idPropiedad){

		var divPopUp = e("divPopUp");
                if (divPopUp==null){return;}
		if ((divPopUp.style.visibility=="visible") && muestraPaginacionPopup) {
			return;
		}

		var divPaginacionPopUp = e("divPaginacionPopUp");
		divPaginacionPopUp.style.visibility="hidden";
		var divCierraPopUp= e("divCierraPopUp");
		divCierraPopUp.style.visibility="hidden";
		var divMensajePopUp = e("divMensajePopUp");
		divMensajePopUp.style.visibility="hidden";

		idPropiedadPopUp = idPropiedad;
		if (idPropiedadPopUp != 0 ) {

			var fotoPopUp = e("fotoPopUp");
			var inmuebleResp =RegresaInmueble(idPropiedad);

			if (inmuebleResp.Fotos.length==0){
				fotoPopUp.src = "/imgs/loading.gif";

				reqFoto = init();
				reqFoto.onreadystatechange = FotoGrandeListener;
				reqFoto.send("FotoGrande=" + idPropiedad);

			} else {
                            
                                fotoPopUp.src = "/imgs/loading.gif";
				fotoPopUp.src = inmuebleResp.Fotos[0].URL;
				PrimerFoto();

			}

			blnEsperandoPopUp=true;
			window.setTimeout(MuestraPopUpYa, 500);
		}
	}//MuestraPopUp

	function MuestraPopUpYa(){
		if (blnEsperandoPopUp==false){
			return;
		}

		var divPopUp = e("divPopUp");
                if (divPopUp==null){return;}
		if (divPopUp.style.visibility=="hidden"){

			var offset = getScrollXY();

			if ((mouseX + 510)< getWindowWidthReal() ){
				divPopUp.style.left = (mouseX  + 10) + "px";
			} else if ((mouseX - 510)>0) {
				divPopUp.style.left = (mouseX - 510)+ "px";
                        } else {
				divPopUp.style.left = "10px";
			}

			if (mouseY - offset[1] > 440){
				divPopUp.style.top = (mouseY - 420) + "px";
			} else if ((mouseY + 410) < getWindowHeight()) {
				divPopUp.style.top = (mouseY) + "px";
			} else {
				divPopUp.style.top = (offset[1] + 10) + "px";
                            
                        }

			divPopUp.style.visibility="visible";
			if (muestraPaginacionPopup){
				var divMensajePopUp = e("divMensajePopUp");
				divMensajePopUp.style.visibility="hidden";
			} else {
				var divMensajePopUp = e("divMensajePopUp");
				divMensajePopUp.style.visibility="visible";
			}
		}
	}//MuestraPopUpYa

	function MuestraPopUpClick(idPropiedad){
		if (idPropiedad==0){return;}
                
		var divPopUp = e("divPopUp");
                if (divPopUp==null){return;}
		if ((divPopUp.style.visibility=="visible") && muestraPaginacionPopup){
			CierraPopUpYa();
			MuestraPopUp(idPropiedad);
			MuestraPopUpClick(idPropiedad);
			//MuestraPopUpClick();
			return;
		}

		idPropiedadPopUp=idPropiedad;
		muestraPaginacionPopup=true;
		var divPaginacionPopUp = e("divPaginacionPopUp");
		divPaginacionPopUp.style.visibility="visible";
		var divCierraPopUp= e("divCierraPopUp");
		divCierraPopUp.style.visibility="visible";
		var divMensajePopUp = e("divMensajePopUp");
		divMensajePopUp.style.visibility="hidden";

		Obscurece();
		MuestraPopUpYa();
	}//MuestraPopUpClick


	function OcultaPopUp(){
		var divPopUp = e("divPopUp");
                if (divPopUp==null){return;}
		if ((divPopUp.style.visibility=="visible") && muestraPaginacionPopup) {
			return;
		}
		blnEsperandoPopUp=false;
		divPopUp.style.visibility="hidden";
		muestraPaginacionPopup=false;
		var divPaginacionPopUp = e("divPaginacionPopUp");
		divPaginacionPopUp.style.visibility="hidden";
		var divCierraPopUp= e("divCierraPopUp");
		divCierraPopUp.style.visibility="hidden";
		var divMensajePopUp = e("divMensajePopUp");
		divMensajePopUp.style.visibility="hidden";

	}//OcultaPopUp

	function CierraPopUpYa(){
		muestraPaginacionPopup=false;
		var divPaginacionPopUp = e("divPaginacionPopUp");
		divPaginacionPopUp.style.visibility="hidden";
		var divCierraPopUp= e("divCierraPopUp");
		divCierraPopUp.style.visibility="hidden";
		var divMensajePopUp = e("divMensajePopUp");
		divMensajePopUp.style.visibility="hidden";


		var divPopUp = e("divPopUp");
		blnEsperandoPopUp=false;
		divPopUp.style.visibility="hidden";

		Aclara();
	}//CierraPopUpYa

	function TipoCambioListener(){
		if (reqTipoCambio.readyState == 4) {
			if (reqTipoCambio.status == 200) {
				try {
					var tc = RegresaValor(reqTipoCambio.responseXML,"tipocambio");
					var tcf = RegresaValor(reqTipoCambio.responseXML,"dol_fec");
					TipoCambio.innerHTML = FormatNumber(tc,2,true, true, true);
					var tdActualizaTC = e("tdActualizaTC");
					tdActualizaTC.innerHTML = 'Actualizado: ' + tcf;

					reqPV = init();
					reqPV.onreadystatechange = FiltroPrecioVentaListener;
					reqPV.send("FiltroPrecioVenta=" + TipoCambio.innerHTML + "@@@" + intMicrositio);


					reqPR = init();
					reqPR.onreadystatechange = FiltroPrecioRentaListener;
					reqPR.send("FiltroPrecioRenta=" + TipoCambio.innerHTML + "@@@" + intMicrositio);

				} catch(err){}
			}
		}
	}//TipoCambioListener


	function FotoGrandeListener(){
		if (reqFoto.readyState == 4) {
			if (reqFoto.status == 200) {
				try {

					var idProp = reqFoto.responseXML.getElementsByTagName("DATA")[0].childNodes[0].nodeValue;
					var totalfotos=0;


					var totalObj = reqFoto.responseXML.getElementsByTagName("TOTAL")[0];
					totalfotos = RegresaAtributo(totalObj,0);

					if (totalfotos==0) {
						var fotoPopUp = e("fotoPopUp");
                                                fotoPopUp.src = "/imgs/loading.gif";
						fotoPopUp.src = "/imgs/sf.jpg";
					} else {

						for(var i=0; i<AInmuebles.length; i++){
							if (AInmuebles[i].Id==idProp){

								for(var j=0; j<totalfotos; j++){
									var foto = RegresaValorLista(reqFoto.responseXML,"img_path", j);
									AInmuebles[i].Fotos.push(new ServerDocument(foto));
								}

								AInmuebles[i].totalfotos=totalfotos;

								var fotoPopUp = e("fotoPopUp");
                                                                fotoPopUp.src = "/imgs/loading.gif";
								fotoPopUp.src = AInmuebles[i].Fotos[0].URL;
								break;
							}
						}

						PrimerFoto();

					}
				} catch(err){}
			}
		}
	}//FotoGrandeListener

	function RegresaInmueble(idInm){
			var inmuebleResp1;
			for(var i=0; i<AInmuebles.length; i++){
				if (AInmuebles[i].Id==idInm){
					inmuebleResp1 =AInmuebles[i];
					break;
				}
			}
			return inmuebleResp1;
	}//RegresaInmueble

	function MostrarAyuda(){
		var spanAyuda = e("spanAyuda");
		spanAyuda.innerHTML = "<img src='/imgs/loading.gif'>";
		blnEsperandoAyuda=true;
		window.setTimeout(MostrarAyudaYa, 500);
	}//MostrarAyuda

	function MostrarAyudaYa(){
		var spanAyuda = e("spanAyuda");
		spanAyuda.innerHTML = "&nbsp;";

		if (blnEsperandoAyuda==false){
			return;
		}
		var divAyuda = e("divAyuda");
		if (divAyuda.style.visibility=="hidden"){
			divAyuda.style.left = (mouseX + 15) + "px";
			divAyuda.style.top = (mouseY - 50) + "px";
			divAyuda.style.visibility="visible";
		}
	}//MostrarAyudaYa

	function OcultarAyuda(){
		var spanAyuda = e("spanAyuda");
		spanAyuda.innerHTML = "&nbsp;";

		var divAyuda = e("divAyuda");
		divAyuda.style.visibility="hidden";
		blnEsperandoAyuda=false;
	}//OcultarAyuda

	function EscribeAyuda(){
		var divAyuda = e("divAyuda");

		var sH="";
		sH=sH + "<table width=220>";
		sH=sH + "<tr><td align=left colspan=2 valign=top><img src='/imgs/icon_lightbulb.gif' border=0><b>TIP:</b>&nbsp;&nbsp;Puede localizar los inmuebles escribiendo:</td></tr>";
		sH=sH + "<tr><td align=left colspan=2 valign=top><hr></td></tr>";
		sH=sH + "<tr><td align=left valign=top>&nbsp;-&nbsp;</td><td align=left valign=top><b>Direcci&oacute;n</b> (Estado, Delegaci&oacute;n, C&oacute;digo Postal, Colonia o Calle)</td></tr>";
		sH=sH + "<tr><td align=left valign=top>&nbsp;-&nbsp;</td><td align=left valign=top><b>ID</b> de Propiedad &oacute; <b>Nombre</b> del Desarrollo o Conjunto</td></tr>";
		sH=sH + "<tr><td align=left valign=top>&nbsp;-&nbsp;</td><td align=left valign=top><b>Operaci&oacute;n</b> (Venta, Renta &oacute; Traspaso)</td></tr>";
		sH=sH + "<tr><td align=left valign=top>&nbsp;-&nbsp;</td><td align=left valign=top><b>Tipo</b> de Inmueble (Casa, Bodega, Departamento, Terreno, Oficina, etc.)</td></tr>";
		sH=sH + "<tr><td align=left colspan=2 valign=top>&nbsp;</td></tr>";
  		sH=sH + "</table>";
                sH=sH + "<table width=100%><tr><td align=right><img src='/imgs/usa.gif' border=0>&nbsp;<b style='color:rgb(204,102,0)'>1</b><span style='font-size:6pt;'> usd </span>=&nbsp;<img src='/imgs/mex.gif' border=0>&nbsp;<b style='color:rgb(204,102,0)' id='TipoCambio'><img src='/imgs/loading.gif'></b> <span style='font-size:6pt;'>mxn</span></td><Td width=15></td></tr><tr><td align=center colspan=2 id='tdActualizaTC' style='color:rgb(100,100,100);font-size:6pt;font-weight:lighter;'>&nbsp;</td></tr></table>";
		divAyuda.innerHTML = MarcoTabla(sH);
                TipoCambio = e("TipoCambio");
                
            var divFotoPopUp = e("divFotoPopUp");
            divFotoPopUp.innerHTML = MarcoFoto(divFotoPopUp.innerHTML);
	}//EscribeAyuda

	function SiguienteFoto(){
		indicefoto++;
		MostrarFoto();
	}//SiguienteFoto

	function UltimaFoto(){
		var inmuebleResp =RegresaInmueble(idPropiedadPopUp);
		indicefoto = inmuebleResp.totalfotos;
		MostrarFoto();
	}//UltimaFoto

	function PrimerFoto(){
			indicefoto=1;
			MostrarFoto();
	}//PrimerFoto

	function AnteriorFoto(){
			indicefoto--;
			MostrarFoto();
	}//AnteriorFoto

	function MostrarFoto(){
			var inmuebleResp =RegresaInmueble(idPropiedadPopUp);
			var fotoPopUp = e("fotoPopUp");
                        fotoPopUp.src = "/imgs/loading.gif";
			fotoPopUp.src = inmuebleResp.Fotos[indicefoto -1 ].URL;

			var imgPrimerFoto=e("imgPrimerFoto");
			var imgAnteriorFoto=e("imgAnteriorFoto");
			var imgSiguienteFoto=e("imgSiguienteFoto");
			var imgUltimaFoto=e("imgUltimaFoto");
			var spanFotos=e("spanFotos");
			spanFotos.innerHTML = "Foto " + indicefoto + " de " + inmuebleResp.totalfotos;

			if (indicefoto==1){
				imgPrimerFoto.src='/imgs/FirstPage_unavailable.gif';
				imgPrimerFoto.onclick=function(){return false;};
				imgPrimerFoto.style.cursor = "default";
				imgPrimerFoto.alt='';

				imgAnteriorFoto.src='/imgs/PreviousPage_unavailable.gif';
				imgAnteriorFoto.onclick= function(){return false;};
				imgAnteriorFoto.style.cursor = "default";
				imgAnteriorFoto.alt='';
			} else {
				imgPrimerFoto.src='/imgs/FirstPage.gif';
				imgPrimerFoto.onclick=PrimerFoto;
				imgPrimerFoto.style.cursor = "pointer";
				imgPrimerFoto.alt='Ver Primer Foto';

				imgAnteriorFoto.src='/imgs/PreviousPage.gif';
				imgAnteriorFoto.onclick= AnteriorFoto;
				imgAnteriorFoto.style.cursor = "pointer";
				imgAnteriorFoto.alt='Ver Foto Anterior';
			}

			if (indicefoto==inmuebleResp.totalfotos){

				imgSiguienteFoto.src='/imgs/NextPage_unavailable.gif';
				imgSiguienteFoto.onclick=function(){return false;};
				imgSiguienteFoto.style.cursor = "default";
				imgSiguienteFoto.alt='';

				imgUltimaFoto.src='/imgs/LastPage_unavailable.gif';
				imgUltimaFoto.onclick=function(){return false;};
				imgUltimaFoto.style.cursor = "default";
				imgUltimaFoto.alt='';

			} else {

				imgSiguienteFoto.src='/imgs/NextPage.gif';
				imgSiguienteFoto.onclick=SiguienteFoto;
				imgSiguienteFoto.style.cursor = "pointer";
				imgSiguienteFoto.alt='Ver Siguiente Foto';

				imgUltimaFoto.src='/imgs/LastPage.gif';
				imgUltimaFoto.onclick=UltimaFoto;
				imgUltimaFoto.style.cursor = "pointer";
				imgUltimaFoto.alt='Ver Ultima Foto';
			}
	}//MostrarFoto

	function QuitaNull(texto){
		if (texto=='null'){
			return '';
		} else if (texto=='NULL'){
			return '';
		} else {
			return texto.trim();
		}
	}//QuitaNull

	function FiltraPrecioVenta(){
		var txtPrecioVentaMin = e("txtPrecioVentaMin");
		var txtPrecioVentaMax = e("txtPrecioVentaMax");

		if (txtPrecioVentaMin.value.trim().length > 0){
			if (isNaN(parseInt(txtPrecioVentaMin.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		if (txtPrecioVentaMax.value.trim().length > 0){
			if (isNaN(parseInt(txtPrecioVentaMax.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		fil_precio_venta_min = txtPrecioVentaMin.value;
		fil_precio_venta_max = txtPrecioVentaMax.value;
		blnTrabajando=true;
		pagina=1;
		Buscar();
	}//FiltraPrecioVenta

	function FiltraPrecioRenta(){
		var txtPrecioRentaMin = e("txtPrecioRentaMin");
		var txtPrecioRentaMax = e("txtPrecioRentaMax");

		if (txtPrecioRentaMin.value.trim().length > 0){
			if (isNaN(parseInt(txtPrecioRentaMin.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		if (txtPrecioRentaMax.value.trim().length > 0){
			if (isNaN(parseInt(txtPrecioRentaMax.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}


		fil_precio_renta_min = txtPrecioRentaMin.value;
		fil_precio_renta_max = txtPrecioRentaMax.value;
		blnTrabajando=true;
		pagina=1;
		Buscar();
	}//FiltraPrecioRenta

	function FiltraConstruccion(){
		var txtConstruccionMin = e("txtConstruccionMin");
		var txtConstruccionMax = e("txtConstruccionMax");

		if (txtConstruccionMin.value.trim().length > 0){
			if (isNaN(parseInt(txtConstruccionMin.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		if (txtConstruccionMax.value.trim().length > 0){
			if (isNaN(parseInt(txtConstruccionMax.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		fil_m2_construccion_min = txtConstruccionMin.value;
		fil_m2_construccion_max = txtConstruccionMax.value;
		blnTrabajando=true;
		pagina=1;
		Buscar();
	}//FiltraConstruccion

	function FiltraTerreno(){
		var txtTerrenoMin = e("txtTerrenoMin");
		var txtTerrenoMax = e("txtTerrenoMax");

		if (txtTerrenoMin.value.trim().length > 0){
			if (isNaN(parseInt(txtTerrenoMin.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}


		if (txtTerrenoMax.value.trim.length > 0){
			if (isNaN(parseInt(txtTerrenoMax.value))) {
				alert('El valor introducido no es correcto!');
				return;
			}
		}

		fil_m2_terreno_min = txtTerrenoMin.value;
		fil_m2_terreno_max = txtTerrenoMax.value;
		blnTrabajando=true;
		pagina=1;
		Buscar();
	}//FiltraTerreno

	function EnterPrecioVenta(e){
		var key=e.keyCode || e.which;
		if (key==13){
			FiltraPrecioVenta();
		}
	}//EnterPrecioVenta

	function EnterPrecioRenta(e){
		var key=e.keyCode || e.which;
		if (key==13){
				FiltraPrecioRenta();
		}
	}//EnterPrecioRenta


	function EnterTerreno(e){
		var key=e.keyCode || e.which;
		if (key==13){
				FiltraTerreno();
		}
	}//EnterTerreno

	function EnterConstruccion(e){
		var key=e.keyCode || e.which;
		if (key==13){
				FiltraConstruccion();
		}
	}//EnterConstruccion

	function PrimerPagina(){
		if (pags==0){return;}
		blnTrabajando=false;
		pagina=1;
		Buscar();
	}//PrimerPagina

	function AnteriorPagina(){
		if (pags==0){return;}
		blnTrabajando=false;
		pagina--;
		Buscar();
	}//AnteriorPagina

	function SiguientePagina(){
		if (pags==0){return;}
		blnTrabajando=false;
		pagina++;
		Buscar();
	}//SiguientePagina

	function UltimaPagina(){
		if (pags==0){return;}
		blnTrabajando=false;
		pagina=pags;
		Buscar();
	}//UltimaPagina


	function OcultaIrAPag(){
		var divPag = e("divPag");
		divPag.style.visibility="hidden";
		Aclara();
	}//OcultaIrAPag

	function IrAPag(){

		var sH = "<span style='font-size:8pt;color:rgb(100,100,100);'><img src='/imgs/seleccion.gif'>&nbsp;Seleccione el n&uacute;mero de p&aacute;gina<br>al que desea ir:<br><br><center><b>P&aacute;gina:</b>&nbsp;<input type='text' id='txtNuevaPag' value='' onkeypress='handleKeyPressPag(event)' size=3 style='font-size:8pt;'><br><br><input type=button value='Aceptar' onclick='EnterPagina()'><input type=button value='Cancelar' onclick='OcultaIrAPag()'><br></center></span>";

		var divPag = e("divPag");
		divPag.style.left = (mouseX + 15) + "px";
		divPag.style.top = (mouseY - 50) + "px";
		divPag.innerHTML = MarcoTabla(sH);
		divPag.style.visibility="visible";

		var txtNuevaPag = e("txtNuevaPag");
		txtNuevaPag.select();
		txtNuevaPag.focus();
		Obscurece();
	}//IrAPag

	function EnterPagina(){

			var txtNuevaPag = e("txtNuevaPag");
			var irpagina = txtNuevaPag.value;
			OcultaIrAPag();
			if (pags==0){
				alert('No hay resultados');
				return;
			}
			if (isNaN(parseInt(irpagina))) {
				alert('La Pag. no existe.');
				return;
			}
			if (parseInt(irpagina)> pags ) {
				alert('La Pag. no existe.');
				return;
			}
			if (parseInt(irpagina)<1 ) {
				alert('La Pag. no existe.');
				return;
			}

			blnTrabajando=false;
			pagina=irpagina;
			Buscar();
	}//EnterPagina

	function MostrarPaginacion(strBarra){
			var imgPrimerPagina=e("imgPrimerPagina" + strBarra);
			var imgAnteriorPagina=e("imgAnteriorPagina" + strBarra);
			var imgSiguientePagina=e("imgSiguientePagina" + strBarra);
			var imgUltimaPagina=e("imgUltimaPagina" + strBarra);

                        if (pags>0){
				var centerPaginacion = e("centerPaginacion" + strBarra);
				centerPaginacion.innerHTML = "<center>P&aacute;gina <a href='javascript: IrAPag();' style='color:rgb(255,255,255);text-decoration:underline;'><b>&nbsp;" + pagina + "&nbsp;<b></a> de " + pags + "</center>";
			} else {
				imgPrimerPagina.src='/imgs/FirstPage_unavailable.gif';
				imgPrimerPagina.onclick=function(){return false;};
				imgPrimerPagina.style.cursor = "default";
				imgPrimerPagina.alt='';

				imgAnteriorPagina.src='/imgs/PreviousPage_unavailable.gif';
				imgAnteriorPagina.onclick= function(){return false;};
				imgAnteriorPagina.style.cursor = "default";
				imgAnteriorPagina.alt='';

				imgSiguientePagina.src='/imgs/NextPage_unavailable.gif';
				imgSiguientePagina.onclick=function(){return false;};
				imgSiguientePagina.style.cursor = "default";
				imgSiguientePagina.alt='';

				imgUltimaPagina.src='/imgs/LastPage_unavailable.gif';
				imgUltimaPagina.onclick=function(){return false;};
				imgUltimaPagina.style.cursor = "default";
				imgUltimaPagina.alt='';
				return;
			}

			if (pagina==1){
				imgPrimerPagina.src='/imgs/FirstPage_unavailable.gif';
				imgPrimerPagina.onclick=function(){return false;};
				imgPrimerPagina.style.cursor = "default";
				imgPrimerPagina.alt='';

				imgAnteriorPagina.src='/imgs/PreviousPage_unavailable.gif';
				imgAnteriorPagina.onclick= function(){return false;};
				imgAnteriorPagina.style.cursor = "default";
				imgAnteriorPagina.alt='';
			} else {
				imgPrimerPagina.src='/imgs/FirstPage.gif';
				imgPrimerPagina.onclick=PrimerPagina;
				imgPrimerPagina.style.cursor = "pointer";
				imgPrimerPagina.alt='Ver Primer Pag.';

				imgAnteriorPagina.src='/imgs/PreviousPage.gif';
				imgAnteriorPagina.onclick= AnteriorPagina;
				imgAnteriorPagina.style.cursor = "pointer";
				imgAnteriorPagina.alt='Ver Pag. Anterior';
			}

			if (pagina==pags){

				imgSiguientePagina.src='/imgs/NextPage_unavailable.gif';
				imgSiguientePagina.onclick=function(){return false;};
				imgSiguientePagina.style.cursor = "default";
				imgSiguientePagina.alt='';

				imgUltimaPagina.src='/imgs/LastPage_unavailable.gif';
				imgUltimaPagina.onclick=function(){return false;};
				imgUltimaPagina.style.cursor = "default";
				imgUltimaPagina.alt='';

			} else {

				imgSiguientePagina.src='/imgs/NextPage.gif';
				imgSiguientePagina.onclick=SiguientePagina;
				imgSiguientePagina.style.cursor = "pointer";
				imgSiguientePagina.alt='Ver Siguiente Pag.';

				imgUltimaPagina.src='/imgs/LastPage.gif';
				imgUltimaPagina.onclick=UltimaPagina;
				imgUltimaPagina.style.cursor = "pointer";
				imgUltimaPagina.alt='Ver Ultima Pag.';
			}

	}//MostrarPaginacion

	function SortResultados(criterio){
		sorted= criterio;
		if (pags>0){
			blnTrabajando=true;
			pagina=1;
			Buscar();
		}
	}//SortResultados


	function ValidaSesion(){
		reqEdit = init();
		reqEdit.onreadystatechange = ValidaSesionListener;
		reqEdit.send("ValidaSesion=1");
	}//ValidaSesion

	function ValidaSesionListener(){
		if (reqEdit.readyState == 4) {
			if (reqEdit.status == 200) {
					sesion = reqEdit.responseXML.getElementsByTagName("SESSION")[0].childNodes[0].nodeValue;
					var spanWelcome = e("spanWelcome");
					var tdSesion = e("tdSesion");
					var divLogin = e("divLogin");

					if (sesion=="false"){

						spanWelcome.innerHTML = "<b>Bienvenido(a)!</b>";
						tdSesion.innerHTML = "<a href='javascript: PantallaLogin()' title='Usuario ya registrado?' class='linkazul'>Inicia Sesi&oacute;n&nbsp;<img src='/imgs/locked_owner.gif' border=0></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript: NuevoUsuario()' title='Usuario Nuevo?'  class='linkazul'>Reg&iacute;strate!&nbsp;<img src='/imgs/icon_registro.gif' border=0></a>&nbsp;&nbsp;";
						try {
							var aFavoritos=e("aFavoritos");
							aFavoritos.style.visibility="hidden";
						} catch(err){}

						if (divLogin.style.visibility=="visible"){
							var lblError = e("lblError");
							lblError.style.visibility="visible";
						} else {
                                                    try {
                                                      var lblError = e("lblError");
                                                      lblError.style.visibility="hidden";
                                                    } catch(err){}
                                                }

                                                if (funcionCallBack=='PropiedadesUsuario'){
                                                        var divAdministracion = e("divAdministracion");
                                                       divAdministracion.style.visibility="hidden";
                                                      var divRenglones = e("divRenglones");
                                                      divRenglones.innerHTML="";
                                                  PantallaLogin();
                                                }
					} else {
                                                
                                                    try {
                                                      var lblError = e("lblError");
                                                      lblError.style.visibility="hidden";
                                                    } catch(err){}
                                                
						spanWelcome.innerHTML = "<b>Bienvenido(a) </b>" + MinusMayus(sesion) + "<b> !</b>";
						tdSesion.innerHTML = "<a href='javascript: CierraSesion()' title='Cerrar Sesi&oacute;n' class='linkazul'>Cerrar Sesi&oacute;n&nbsp;<img src='/imgs/locked.gif' border=0></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript: Preferencias();' title='Mi Cuenta'  class='linkazul'>Mi Cuenta&nbsp;<img src='/imgs/preferencias.gif' border=0></a>&nbsp;&nbsp;";

						if (funcionCallBack !=""){
							if (funcionCallBack=='Email'){
								var divLogin = e("divLogin");
                                                                divLogin.innerHTML="";
								divLogin.style.visibility="hidden";
								funcionCallBack="";
								Email(propiedadEmail);

							} else if (funcionCallBack=='GuardarFavorito'){
								var divLogin = e("divLogin");
                                                                divLogin.style.visibility="hidden";
								funcionCallBack="";
								GuardarFavorito(propiedadGuardarFavorito);
								CierraPantallaLogin();
							} else if (funcionCallBack=='PropiedadesUsuario'){
                                                            
                                                                ValidaAdmin();
							}
						} else {
							CierraPantallaLogin();
						}
						LeerMisFavoritos();

					}
				}
			}
	}//ValidaSesionListener
        
        function ValidaAdmin(){
                reqAdmin = init();
		reqAdmin.onreadystatechange = ValidaAdminListener;
		reqAdmin.send("ValidaAdmin=1");
        }//ValidaAdmin
        function ValidaAdminListener(){
              if (reqAdmin.readyState == 4) {
                  if (reqAdmin.status == 200) {
                      
                    var totalFavs=0;
                    var totalObj = reqAdmin.responseXML.getElementsByTagName("TOTAL")[0];
                    totalFavs = RegresaAtributo(totalObj,0);

                    for(var j=0; j<totalFavs; j++){
                            usuadmin = RegresaValorLista(reqAdmin.responseXML,"usu_admin", j);
                    }
                    var divLogin = e("divLogin");
                    divLogin.style.visibility="hidden";
                    CierraPantallaLogin();				
                    PropiedadesUsuario();
                  }
              }
        }//ValidaAdminListener
        

	function CierraSesion(){
		arrFavoritos = new Array;

		reqEdit = init();
		reqEdit.onreadystatechange = ValidaSesionListener;
		reqEdit.send("Login=false@@@false");
	}//CierraSesion

	function PantallaLogin(){
		var divLogin = e("divLogin");
		var tablaLogin="";
		tablaLogin = tablaLogin + "<table>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2 align=right><a href='javascript: CierraPantallaLogin();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2><b style='color:rgb(80,80,80)'>Por favor incia sesi&oacute;n</b></td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">E-mail:</td><td><input type=text size=20 maxlength=40 id='txtUsuario' onkeypress=\"handleKeyPressLogin(event)\"></td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Password:</td><td><input type=password size=20 maxlength=12 id='txtPassword' onkeypress=\"handleKeyPressLogin(event)\"></td></tr>";
                
                tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><input type='checkbox' id='chkDatos' value='Recordar mis datos en este equipo' /><span style='font-size:8pt;color:rgb(50,50,50);'>&nbsp;Recordar mis datos en este equipo</span></td></tr>";
                tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><a id='aForget' href='javascript: Forget();' style='font-size:8pt;visibility:hidden;'>Olvidar mis datos</a></td></tr>";

		tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><a href='javascript: EnviaLogin();'class='button'>OK</a></td></tr>";
		tablaLogin = tablaLogin + "<tr><td colspan=2 align=center><br><a href='javascript: Reset();' style='font-size:8pt; color:rgb(120,120,120);'>&iquest;Olvidaste tu password?</a></td></tr>";
		if (funcionCallBack !=""){
			tablaLogin = tablaLogin + "<tr><td colspan=2 align=center><br><a href='javascript: NuevoUsuario();' style='font-size:8pt; color:rgb(0,0,255);'>&iquest;Nuevo Usuario?</a></td></tr>";
		}
		tablaLogin = tablaLogin + "</table>";
		tablaLogin = tablaLogin + "<br><span id='lblError' style='color:rgb(255,0,0);visibility:hidden; font-size:8pt;'>El usuario o password es incorrecto!</span>";
		divLogin.innerHTML= MarcoTabla(tablaLogin);

		var offset = getScrollXY();

            
		if ((mouseX + 270)< getWindowWidthReal() ){
			divLogin.style.left = (mouseX - 50) + "px";
		} else {
			divLogin.style.left = (mouseX - 100)+ "px";
		}

		if (mouseY - offset[1] > 260){
			divLogin.style.top = (mouseY - 200) + "px";
		} else {
			divLogin.style.top = (mouseY + 15) + "px";
		}

                if (funcionCallBack=='PropiedadesUsuario'){
                    divLogin.style.left = (100) + "px";
                    divLogin.style.top = (200) + "px";
                }
            
		divLogin.style.visibility="visible";
		var txtUsuario = e("txtUsuario");
		txtUsuario.select();
		txtUsuario.focus();
		Obscurece();
                
                  var strMDILog = readCookie('MDILog');
                  var strMDIPwd = readCookie('MDIPwd');
                  
                  var txtPassword = e("txtPassword");
                  var chkDatos = e("chkDatos");
                  var aForget=e("aForget");

                  if ((strMDILog != null) && (strMDILog != "null") && (strMDILog != "")){
                      chkDatos.checked=true;
                      aForget.style.visibility="visible";
                      txtUsuario.value = strMDILog;
                      if (strMDIPwd != "null"){
                          txtPassword.value = strMDIPwd;
                      }
                  }
                  
	}//PantallaLogin
        
        function createCookie(name,value,days) {
        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=/";
        }//createCookie

        function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
        }//readCookie

        function eraseCookie(name) {
        createCookie(name,"",-1);
        }//eraseCookie
        
        
    function IsNumeric(sText)
    {
     var ValidChars = "0123456789.";
     var IsNumber=true;
     var Char;

     for (var i = 0; i < sText.length && IsNumber == true; i++) 
        { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) 
           {
           IsNumber = false;
           }
        }
     return IsNumber;
     }

        function Forget(){
            eraseCookie('MDILog');
            eraseCookie('MDIPwd');
            var txtUsuario = e("txtUsuario");
            var txtPassword = e("txtPassword");
            var chkDatos = e("chkDatos");
            var aForget = e("aForget");
            
            txtUsuario.value="";
            txtPassword.value="";
            chkDatos.checked=false;
            aForget.style.visibility="hidden";
            alert('Datos borrados correctamente del equipo!');
        }//Forget

	function CierraPantallaLogin(){
		if (funcionCallBack!=""){
                    if (funcionCallBack=='PropiedadesUsuario'){
                        //nada
                    } else {
                        funcionCallBack="";
                    }
		}

		var divLogin = e("divLogin");
                divLogin.innerHTML="";
		divLogin.style.visibility="hidden";

		Aclara();
	}//CierraPantallaLogin

	function EnviaLogin(){
		var txtUsuario = e("txtUsuario");
		var txtPassword = e("txtPassword");

                var chkDatos = e("chkDatos");
                
                if (chkDatos.checked){
                  createCookie('MDILog',txtUsuario.value,365);
                  createCookie('MDIPwd',txtPassword.value,365);
                } else {
                  eraseCookie('MDILog');
                  eraseCookie('MDIPwd');
                }
                
		Login(txtUsuario.value, txtPassword.value);
	}//EnviaLogin

	function Login(mail, passw){
            
                miemail = mail;
		reqEdit = init();
		reqEdit.onreadystatechange = ValidaSesionListener;
		reqEdit.send("Login=" + mail + "@@@" + passw + "@@@false");
	}//Login

	function handleKeyPressLogin(e){
		var key=e.keyCode || e.which;
		if (key==13){
			EnviaLogin();
		}
	}//handleKeyPressLogin
        
        function handleKeyPressLoginCP(e){
		var key=e.keyCode || e.which;
		if (key==13){
			GuardaPassword();
		}
	}//handleKeyPressLoginCP

	function NuevoUsuario(){
		var divLogin = e("divLogin");
				var tablaLogin="";

				tablaLogin = tablaLogin + "<table width=510 >";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt; color:rgb(80,80,80)\" align=left><b><u>REGISTRO DE USUARIO</u></b></td><td STYLE=\"background-color: #ffffff; font-size:8pt;\"align=right><a href='javascript: CierraPantallaLogin();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2><b style='color:rgb(80,80,80)'><img src='/imgs/icon_pencil.gif'>&nbsp;Por favor, Introduzca la siguiente Informaci&oacute;n</b></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Nombre:</td><td><input type=text size=40 maxlength=100 id='txtInsertaNombre'></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Tel&eacute;fono:</td><td><input type=text size=20 maxlength=40 id='txtInsertaTelefono'></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">E-mail:</td><td><input type=text size=30 maxlength=40 id='txtInsertaEmail'></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Password:</td><td><input type=password size=20 maxlength=12 id='txtInsertaPassword'></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Confirme Password:</td><td><input type=password size=20 maxlength=12 id='txtInsertaPasswordConfirm'></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2>Cu&aacute;l de las siguientes describe mejor su perfil:</td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">&nbsp;</td><td style='color:rgb(80,80,80)'><form name=fperfiles><input type=radio  name='optPerfil' value='1'>Comprador<br><input type=radio  name='optPerfil' value='2'>Vendedor<br><input type=radio name='optPerfil' value='3'>Comprador y Vendedor<br><input type=radio  name='optPerfil' value='4'>Empresa Inmobiliaria<br><input type=radio  name='optPerfil' value='5'>Profesional Inmobiliario</form></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">T&eacute;rminos y Condiciones:</td><td><textarea id=txtContrato value='' rows='5' cols='50' style='font-size:8pt;'></textarea></td></tr>";
				tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">&nbsp;</td><td style='font-size:8pt;'><input type=checkbox id='chkLeer' readonly >&nbsp;Acepto los t&eacute;rminos y condiciones</td></tr>";
				tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><a href='javascript: InsertaRegistro();'class='button'>Registrarme</a></td></tr>";
				tablaLogin = tablaLogin + "</table>";
				divLogin.innerHTML= MarcoTabla(tablaLogin);

				var offset = getScrollXY();

				if ((mouseX + 500)< getWindowWidthReal() ){
					divLogin.style.left = (mouseX - 150) + "px";
				} else {
					divLogin.style.left = (mouseX - 450)+ "px";
				}

				if (mouseY  < offset[1] + getWindowHeight() - 500 ){
					divLogin.style.top = (mouseY + 20) + "px";
				} else {
					divLogin.style.top = (offset[1] + 100) + "px";
				}


			divLogin.style.visibility="visible";
			var txtInsertaNombre = e("txtInsertaNombre");
			txtInsertaNombre.select();
			txtInsertaNombre.focus();
			Contrato();
			Obscurece();
	}//NuevoUsuario

	function Contrato(){
		var txtContrato=e("txtContrato");

		var sH = "";
		sH = sH + "Contrato de servicio de mapadeinmuebles.com";
		sH = sH + "\n		";
		sH = sH + "\nGRACIAS POR ELEGIR mapadeinmuebles.com!";
		sH = sH + "\n";
		sH = sH + "\n1. Ambito de cobertura del contrato.";
		sH = sH + "\nEl presente documento es un contrato entre usted (el Usuario) y la compania TECNLOGIA EN INFORMACION INMOBILIARIA. En este documento se hace referencia a la citada compania TECNLOGIA EN INFORMACION INMOBILIARIA con las expresiones 'mapadeinmuebles.com', 'nosotros' o 'nuestro'. Este contrato se aplica a cualquier software o servicio de mapadeinmuebles.com, incluidas sus actualizaciones, que usted utilice durante la vigencia del presente contrato. En el se hace referencia a todo software o servicio con el termino 'servicio'.";
		sH = sH + "\n";
		sH = sH + "\nTenga en cuenta que el servicio se proporciona con ciertas exclusiones de garantia y limitaciones de responsabilidad. Estas condiciones se encuentran especificadas en las clausulas siguientes, que le pedimos que lea atentamente.";
		sH = sH + "\n";
		sH = sH + "\n2. Cuando podra usted utilizar el servicio.";
		sH = sH + "\nUsted puede comenzar a utilizar el servicio tan pronto como haya finalizado el proceso de inscripci�n. No ser� de aplicaci�n al Servicio ning�n derecho de anulaci�n ni periodo de 'enfriamiento' alguno y el usuario renuncia a cualquier periodo de enfriamiento aplicable, salvo en los casos en que la ley exija un periodo de 'enfriamiento' a pesar de su renuncia e incluso en el caso de que un servicio se inicie con caracter inmediato.";
		sH = sH + "\n";
		sH = sH + "\n3. C�mo puede utilizar el servicio.";
		sH = sH + "\nAl utilizar este servicio, usted debera: ";
		sH = sH + "\n";
		sH = sH + "\ncumplir la ley; ";
		sH = sH + "\natenerse a los c�digos de conducta o a otros avisos que le proporcionemos; ";
		sH = sH + "\nrespetar la Directiva contra el correo electr�nico no deseado de mapadeinmuebles.com";
		sH = sH + "\nmantener en secreto la contrase�a de su cuenta de servicio; y ";
		sH = sH + "\nnotificarnos inmediatamente si conoce la existencia de un problema de seguridad relacionado con el servicio. ";
		sH = sH + "\n";
		sH = sH + "\n4. Como no puede utilizar el servicio.";
		sH = sH + "\nAl utilizar el servicio, usted no est� autorizado a: ";
		sH = sH + "\n";
		sH = sH + "\nusarlo de manera alguna que pueda perjudicar a nuestras filiales, comerciales, distribuidores y/o proveedores (denominados colectivamente 'Entidades mapadeinmuebles.com'), o a cualquier cliente de alguna de las Entidades mapadeinmuebles.com; ";
		sH = sH + "\npracticar, facilitar o favorecer cualquier comportamiento ilegal;";
		sH = sH + "\nusar ninguna parte del servicio como destino vinculado desde mensajes de correo electr�nico masivo o mensajes comerciales no solicitados ('spam'); ";
		sH = sH + "\nusar cualquier proceso o servicio autom�tico para obtener acceso al servicio y/o utilizarlo (como el software de tipo robot (BOT) los rastreadores web, el almacenamiento peri�dico en cach� de la informaci�n almacenada por mapadeinmuebles.com, o la 'metab�squeda'); ";
		sH = sH + "\nutilizar cualquier medio no autorizado para modificar o redireccionar el servicio, o intentar hacerlo; ";
		sH = sH + "\nda�ar, deshabilitar, sobrecargar o dificultar el servicio (o la red o las redes conectadas al servicio), o interferir en el uso y disfrute del servicio por parte de cualquier persona; o bien ";
		sH = sH + "\ncomercializar o redistribuir el servicio o parte del mismo. ";
		sH = sH + "\n";
		sH = sH + "\n5.El Usuario es responsable de su cuenta de servicio.";
		sH = sH + "\nS�lo usted est� autorizado a usar su cuenta de servicio. Para determinados componentes del servicio es posible que le notifiquemos que puede configurar cuentas de miembro adicionales dependientes de su cuenta ('cuentas asociadas'). Usted es responsable de todas las actividades que se realicen con su cuenta de servicio o con una cuenta asociada. Usted no puede dar autorizaci�n a terceros para obtener acceso al servicio y/o para utilizar el servicio en su nombre.";
		sH = sH + "\n";
		sH = sH + "\n6. Si usted es usuario de una cuenta asociada.";
		sH = sH + "\nSi es usted usuario de una cuenta asociada, el titular de la cuenta de servicio tiene total control sobre su cuenta asociada. Este control incluye el derecho a finalizar el servicio, a cerrar o a modificar su cuenta asociada en cualquier momento y, en algunos casos, a solicitar y recibir informaci�n relativa al uso de los equipos y servicios relacionada con su cuenta asociada. ";
		sH = sH + "\n";
		sH = sH + "\n7. Informacion";
		sH = sH + "\n mapadeinmuebles.com no se hace responsable de la informacion que haya sido proporcionada por usted y no garantiza que la veracidad de la informacion publicada empleando el sitio";
		sH = sH + "\n mapadeinmuebles.com se reserva el derecho de publicar o no anuncios, asi como el hacer uso de la informacion que le ha sido";
		sH = sH + "\n";
		txtContrato.value = sH;
	}//Contrato

	function InsertaRegistro(){
		var chkLeer=e("chkLeer");
		if (chkLeer.checked){
			var txtInsertaNombre=e("txtInsertaNombre");
			var txtInsertaTelefono=e("txtInsertaTelefono");
			var txtInsertaEmail=e("txtInsertaEmail");
			var txtInsertaPassword=e("txtInsertaPassword");
			var txtInsertaPasswordConfirm=e("txtInsertaPasswordConfirm");

			if (txtInsertaNombre.value == ""){
				alert('Debe introducir su nombre');
				return;
			}
			if (txtInsertaTelefono.value == ""){
				alert('Debe introducir su telefono');
				return;
			}
			if (txtInsertaEmail.value == ""){
				alert('Debe introducir su Email');
				return;
			}
			if (echeck(txtInsertaEmail.value)==false){
				return;
			}

			if (txtInsertaPassword.value.length < 5){
				alert('El password debe tener entre 5 y 12 caracteres');
				return;
			}
			if (txtInsertaPassword.value != txtInsertaPasswordConfirm.value){
				alert('El Password no coincide');
				return;
			}

			var tipoUsuario="";
			 for (var i=0;i<document.fperfiles.optPerfil.length;i++){
			       if (document.fperfiles.optPerfil[i].checked) {
					   tipoUsuario = document.fperfiles.optPerfil[i].value;
					   break;
				   }
			    }

    		if (tipoUsuario==""){
				alert('Por favor seleccione el perfil que mas se asemeje');
				return;
			}

			sH = "NuevoUsuario=" + txtInsertaNombre.value;
			sH = sH + "@@@" + txtInsertaTelefono.value;
			sH = sH + "@@@" + txtInsertaEmail.value;
			sH = sH + "@@@" + txtInsertaPassword.value;
			sH = sH + "@@@" + tipoUsuario;
			sH = sH + "@@@false@@@";

			reqRegistro = init();
			reqRegistro.onreadystatechange = RegistroListener;
			reqRegistro.send(sH);

		} else {
			alert('Debe leer y aceptar los Terminos y Condiciones para poder continuar');
		}

	}//InsertaRegistro

	function RegistroListener(){
		if (reqRegistro.readyState == 4) {
			if (reqRegistro.status == 200) {
				var indexObj2 = reqRegistro.responseXML.getElementsByTagName("total")[0];
				var rows2 = RegresaAtributo(indexObj2,0);
				var cols2 = RegresaAtributo(indexObj2,1);
				if (rows2>0){
					alert('El Email ya fue registrado previamente. Por favor accese con su Email y Password en la opcion INICIAR SESION.');
				} else {
					var txtInsertaEmail=e("txtInsertaEmail");
					var txtInsertaPassword=e("txtInsertaPassword");


					Login(txtInsertaEmail.value,txtInsertaPassword.value)

				}
			}
		}
	}//RegistroListener

	function fadeIn() {
		transparency = transparency + 10;
 		if (transparency == 50) {
			clearInterval(time);
		}

		obj = document.getElementById('divfading');
		if (document.all){
			obj.style.filter = 'alpha(opacity='+transparency+')';
		}else{
			obj.style.opacity = transparency /100;
			obj.style.MozOpacity = transparency /100;
			obj.style.KHTMLOpacity = transparency /100;
		}
	}//fadeIn

	function fadeOut() {
		transparency2 = transparency2 - 10;

		obj = document.getElementById('divfading');
		if (document.all){
			obj.style.filter = 'alpha(opacity='+transparency2+')';
		}else{
			obj.style.opacity = transparency2 /100;
			obj.style.MozOpacity = transparency2 /100;
			obj.style.KHTMLOpacity = transparency2 /100;
		}

 		if (transparency2 == 0) {
			clearInterval(time2);
			var divfading=e("divfading");
			divfading.style.visibility="hidden";
		}

	}//fadeOut


	function Obscurece(){
		try {
			var divFotosDetails = e("divFotosDetails");
			var divInmueblesSimilares = e("divInmueblesSimilares");
			divFotosDetails.style.visibility="hidden";
			divInmueblesSimilares.style.visibility="hidden";
		} catch(err){}

		var browser=navigator.appName;
		if (browser=='Opera'){
			return;
		}

		clearInterval(time2);
		transparency = 0;
		obj = document.getElementById('divfading');

		if (document.all){
			obj.style.filter = 'alpha(opacity='+transparency+')';
		}else{
			obj.style.opacity = transparency /100;
			obj.style.MozOpacity = transparency /100;
			obj.style.KHTMLOpacity = transparency /100;
		}

		var divfading=e("divfading");
		divfading.style.visibility="visible";
		time = setInterval('fadeIn()',25);
	}//Obscurece

	function Aclara(){
		try {
			var divFotosDetails = e("divFotosDetails");
			var divInmueblesSimilares = e("divInmueblesSimilares");
			divFotosDetails.style.visibility="visible";
			divInmueblesSimilares.style.visibility="visible";
		} catch(err){}

		var browser=navigator.appName;
		if (browser=='Opera'){
			return;
		}

		clearInterval(time);
		var divfading=e("divfading");
		if (divfading.style.visibility=="visible"){
			transparency2 = 50;
			obj = document.getElementById('divfading');
			if (document.all){
				obj.style.filter = 'alpha(opacity='+transparency2+')';
			}else{
				obj.style.opacity = transparency2 /100;
				obj.style.MozOpacity = transparency2 /100;
				obj.style.KHTMLOpacity = transparency2 /100;
			}
			time2 = setInterval('fadeOut()',25);
		}
	}//Aclara


	function Email(idPropiedad){

		propiedadEmail = idPropiedad;
		if (sesion=="false"){
			funcionCallBack='Email';
			PantallaLogin();
		} else {
			MuestraEmail();
		}

	}//Email

	function EnviaEmail(){
		var txtEmail = e("txtEmail");
		var reqEmail = init();
		reqEmail.send("Email=" + sesion + "@@@" + txtEmail.value + "@@@" + propiedadEmail + "@@@false@@@");
		OcultaEmail();
		alert('Propiedad enviada por e-mail correctamente!');
	}//EnviaEmail

	function OcultaEmail(){
		var divEmail = e("divEmail");
		divEmail.style.visibility="hidden";
		Aclara();
	}//OcultaEmail

	function MuestraEmail(){

		var sH = "<span style='font-size:8pt;color:rgb(100,100,100);'><img src='/imgs/icon_pencil.gif'>&nbsp;Introduzca la direcci&oacute;n de Email<br>a la que desea enviar esta propiedad:<br><br><center><b style='color:rgb(0,0,0);'><img src='/imgs/emailvendedor.gif'>&nbsp;Email:</b>&nbsp;&nbsp;<input type='text' id='txtEmail' value='' onkeypress='handleKeyPressEmail(event)' size=30 style='font-size:8pt;'><br><br><input type=button value='Aceptar' onclick='EnterEmail()'><input type=button value='Cancelar' onclick='OcultaEmail()'><br></center></span>";

		var divEmail = e("divEmail");

		var offset = getScrollXY();

		if ((mouseX + 270)< getWindowWidthReal() ){
			divEmail.style.left = (mouseX + 15) + "px";
		} else {
			divEmail.style.left = (mouseX - 290)+ "px";
		}

		if (mouseY  < offset[1] + getWindowHeight() - 200 ){
			divEmail.style.top = (mouseY + 20) + "px";
		} else {
			divEmail.style.top = (mouseY - 100) + "px";
		}

		divEmail.innerHTML = MarcoTabla(sH);
		divEmail.style.visibility="visible";

		var txtEmail = e("txtEmail");
		txtEmail.select();
		txtEmail.focus();

		Obscurece();
	}//MuestraEmail

	function EnterEmail(){
			var txtEmail = e("txtEmail");
			if (echeck(txtEmail.value)){
				EnviaEmail();
			}
	}//EnterEmail


	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		    return false;
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("La direccion de Email no parece correcta. Favor de revisar e intentar de nuevo.");
		    return false;
		 }

 		 return true;
	}//echeck

	function GuardarFavorito(idPropFav){
		propiedadGuardarFavorito = idPropFav;
		if (sesion=="false"){
			funcionCallBack='GuardarFavorito';
			PantallaLogin();
		} else {

			if (esFavorito(idPropFav)){
				alert('Propiedad previamente guardada en favoritos!');
				return;
			}

			reqGuardar = init();
			reqGuardar.send("GuardarFavorito=" + propiedadGuardarFavorito + "@@@@@@false@@@");

			var inmFavorito = new Favorito(propiedadGuardarFavorito, "");
			arrFavoritos.push(inmFavorito);

			var spanGuardar=e("spanGuardar" + propiedadGuardarFavorito);
                        if (spanGuardar==null){
                            alert('Propiedad Guardada En Mis Favoritos Correctamente!');
                            return;
                        }
			var spanComentsContainer = e("spanComentsContainer"+ propiedadGuardarFavorito);
			var strComentarios="";
			if (esFavorito(propiedadGuardarFavorito)) {
				spanGuardar.innerHTML = "<img src='/imgs/icon_heart.gif' border=0 >&nbsp;<b>Guardado</b> (<a class='linkMenu' style='color:rgb(0,0,0);' href='javascript: QuitarFavorito(" + propiedadGuardarFavorito + ")' title='Quitar de Mis Favoritos'><img src='/imgs/icon_x.gif' border=0 alt='Quitar de Mis Favoritos'>&nbsp;Quitar de Favoritos</a>)";
				spanComentsContainer.innerHTML = "<table width=100%><tr><td><textarea id='txtComments" + propiedadGuardarFavorito + "' value='' rows='2' cols='40' style='font-size:8pt;background-color:rgb(255,255,195);'></textarea></td><td><img src='/imgs/comments.gif'>&nbsp;Mis Comentarios<br><input type=button value='Guardar' onclick='GuardarComentariosFavoritos(" + propiedadGuardarFavorito + ")'></td></tr></table>";
			} else {
				spanGuardar.innerHTML = "<a class='linkMenu' style='color:rgb(0,0,0);' href='javascript: GuardarFavorito(" + propiedadGuardarFavorito + ")' title='Guardar en Mis Favoritos'><img src='/imgs/save.gif' border=0 alt='Guardar en Mis Favoritos'>&nbsp;Guardar en Favoritos</a>";
				spanComentsContainer.innerHTML = "";
			}


			RefrescaLinkFavoritos();
			alert('Propiedad Guardada En Mis Favoritos Correctamente!');
		}
	}//GuardarFavorito

	function MisFavoritos(){
		quitaFiltros();
		blnTrabajando=true;
		pagina=1;
		fil_favoritos="FAVORITOS";
		Buscar();
		scrollit();
	}//MisFavoritos

	function LeerMisFavoritos(){
		arrFavoritos = new Array;
		reqFavs = init();
		reqFavs.onreadystatechange = LeerMisFavoritosListener;
		reqFavs.send("LeerMisFavoritos=1");
	}//LeerMisFavoritos

	function LeerMisFavoritosListener(){
		if (reqFavs.readyState == 4) {
			if (reqFavs.status == 200) {
				try {

					var totalFavs=0;
					var totalObj = reqFavs.responseXML.getElementsByTagName("TOTAL")[0];
					totalFavs = RegresaAtributo(totalObj,0);

					for(var j=0; j<totalFavs; j++){
						var idProp = RegresaValorLista(reqFavs.responseXML,"pro_cve", j);
						var coments = RegresaValorLista(reqFavs.responseXML,"fav_des", j);

						var inmFavorito = new Favorito(idProp, coments);
						arrFavoritos.push(inmFavorito);
					}

					RefrescaLinkFavoritos();
				} catch(err){}
			}
		}
	}//LeerMisFavoritosListener

	function RefrescaLinkFavoritos(){
		try {
			var aFavoritos = e("aFavoritos");
			aFavoritos.style.visibility="visible";
			//aFavoritos.innerHTML = "Ver Mis Favoritos (" + arrFavoritos.length + ")&nbsp;<img src='/imgs/icon_heart.gif' border=0>";
			if (arrFavoritos.length==0){
				aFavoritos.title = "No tiene propiedades guardadas en Mis Favoritos";
			} else {
				aFavoritos.title = "Consultar las " + arrFavoritos.length + " propiedades guardadas en Mis Favoritos";
			}
		} catch(err){}
	}//RefrescaLinkFavoritos

	function Zona(){
		txtBuscar.value="";
                txtBuscar_lostfocus();
		quitaFiltros();
		blnTrabajando=true;
		pagina=1;

		var bounds = map.getBounds();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var lon1 = southWest.lng();
		var lon2 = northEast.lng();
		var lat1 = northEast.lat();
		var lat2 = southWest.lat();

		fil_y1=lon1;
		fil_y2=lon2;
		fil_x1=lat1;
		fil_x2=lat2;
                sorted='mapcenter';
		Buscar();
		scrollit();
	}//Zona

	function esFavorito(idProp){
		for(var i=0; i<arrFavoritos.length; i++){
			if (arrFavoritos[i].Id==idProp){
					return true;
			}
		}
		return false;
	}//esFavorito

	function TraeComentario(idProp){
		for(var i=0; i<arrFavoritos.length; i++){
			if (arrFavoritos[i].Id==idProp){
					return arrFavoritos[i].Comentario;
			}
		}
		return '';
	}//TraeComentario

	function Reset(){
		var divLogin = e("divLogin");
		var txtUsuario = e("txtUsuario");

		var tablaLogin="";
		tablaLogin = tablaLogin + "<table width=230>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2 align=right><a href='javascript: CierraPantallaLogin();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;color:rgb(80,80,80);\"colspan=2><b style='color:rgb(40,40,40)'>&iquest;Tiene problemas para acceder a su cuenta?</b><br><br>&iquest;Olvid&oacute; su password?<br>Ingrese su e-mail a continuaci&oacute;n. Nosotros le enviaremos un email con un link para reiniciar su password.</td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">E-mail:</td><td><input type=text size=20 maxlength=40 id='txtEmailReset' onkeypress=\"handleKeyPressReset(event)\" value='" + txtUsuario.value + "'></td></tr>";
		tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><a href='javascript: ResetPassword();'class='button'>Reiniciar</a></td></tr>";
		tablaLogin = tablaLogin + "</table>";
		divLogin.innerHTML= MarcoTabla(tablaLogin);


	}//Reset

	function ResetPassword(){
		var txtEmailReset = e("txtEmailReset");

		if (echeck(txtEmailReset.value)==false){
			return;
		}

		req = init();
		req.send("Reset=" + txtEmailReset.value)

		var divLogin = e("divLogin");
		var tablaLogin="";
		tablaLogin = tablaLogin + "<table  width=230>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2 align=right><a href='javascript: CierraPantallaLogin();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2><b style='color:rgb(80,80,80)'>Su password ha sido reiniciado.</td></tr>";
		tablaLogin = tablaLogin + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\"colspan=2><b style='color:rgb(80,80,80)'><BR>En unos momentos recibir&aacute; un email con instrucciones para acceder a su cuenta.</td></tr>";
		tablaLogin = tablaLogin + "<tr><td>&nbsp;</td><td><br><a href='javascript: CierraPantallaLogin();'class='button'>Continuar</a></td></tr>";
		tablaLogin = tablaLogin + "</table>";
		divLogin.innerHTML= MarcoTabla(tablaLogin);

	}//ResetPassword

	function GuardarComentariosFavoritos(idProp){
		var coment = e("txtComments" + idProp);
		for(var i=0; i<arrFavoritos.length; i++){
			if (arrFavoritos[i].Id==idProp){
					arrFavoritos[i].Comentario = coment.value;
					break;
			}
		}

		reqGuardar = init();
		reqGuardar.send("GuardarComentariosFavoritos=" + idProp + "@@@" + sinAcentos(coment.value) + "@@@false@@@");
		alert('Comentario Guardado Correctamente!');
	}//GuardarComentariosFavoritos

	function QuitarFavorito(idProp){
		reqGuardar = init();
		reqGuardar.send("QuitarFavorito=" + idProp);

		for(var i=0; i<arrFavoritos.length; i++){
			if (arrFavoritos[i].Id==idProp){
					arrFavoritos.remove(i);
			}
		}

		var spanGuardar=e("spanGuardar" + idProp);
		var spanComentsContainer = e("spanComentsContainer"+ idProp);
		var strComentarios="";
		if (esFavorito(idProp)) {
			spanGuardar.innerHTML = "<img src='/imgs/icon_heart.gif' border=0 >&nbsp;<b>Guardado</b> (<a class='linkMenu' href='javascript: QuitarFavorito(" + idProp + ")' title='Quitar de Mis Favoritos'><img src='/imgs/icon_x.gif' border=0 alt='Quitar de Mis Favoritos'>&nbsp;Quitar de Favoritos</a>)";
			spanComentsContainer.innerHTML = "<table width=100%><tr><td><textarea id='txtComments" + idProp + "' value='' rows='2' cols='40' style='font-size:8pt;background-color:rgb(255,255,195);'></textarea></td><td><img src='/imgs/comments.gif'>&nbsp;Mis Comentarios<br><input type=button value='Guardar' onclick='GuardarComentariosFavoritos(" + propiedadGuardarFavorito + ")'></td></tr></table>";
		} else {
			spanGuardar.innerHTML = "<a class='linkMenu' href='javascript: GuardarFavorito(" + idProp + ")' title='Guardar en Mis Favoritos'><img src='/imgs/save.gif' border=0 alt='Guardar en Mis Favoritos'>&nbsp;Guardar en Favoritos</a>";
			spanComentsContainer.innerHTML = "";
		}

		RefrescaLinkFavoritos();
		alert('Propiedad Eliminada de Mis Favoritos Correctamente!');
	}//QuitarFavorito

	function PDF(idProp){
		var inmuebleResp =RegresaInmueble(idProp);
		NewWindow(inmuebleResp.PDF,"pdf"+Math.random().toString().substring(2),900,getWindowHeight(),"yes","center");
	}//PDF

	function QuienesSomos(){
		NewWindow('presentacion/PresentacionMapaDeInmuebles.htm',"quienessomos",600,600,"yes","center");
	}//QuienesSomos

	function DetallesVendedor(idProp){

			var inmuebleResp =RegresaInmueble(idProp);

			var strDatos = "";
			var strFoto = "";
			if (inmuebleResp.Vendedor.Foto  != ''){
				strFoto = inmuebleResp.Vendedor.Foto;
			} else {
				if (inmuebleResp.Vendedor.Sexo=='F'){
					strFoto = "/imgs/mujer.jpg";
				} else {
					strFoto = "/imgs/hombre.jpg";
				}
			}

			if (inmuebleResp.Vendedor.Empresa  != ''){
				strDatos = strDatos + inmuebleResp.Vendedor.Empresa + "<br>";
			}
			if (inmuebleResp.Vendedor.Logo  != ''){
				strDatos = strDatos + "<img src='" + inmuebleResp.Vendedor.Logo + "' border=0><br><hr>";
			}
			strDatos = strDatos + "<img src='" + strFoto + "' border=0><br>";
			if (inmuebleResp.Vendedor.Nombre  != ''){
				strDatos = strDatos + '<img src="/imgs/corredor.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Nombre + "<br>";
			}
			if (inmuebleResp.Vendedor.Tel1  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Tel1 + "<br>";
			}
			if (inmuebleResp.Vendedor.Tel2  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Tel2 + "<br>";
			}
			if (inmuebleResp.Vendedor.Celular  != ''){
				strDatos = strDatos + '<img src="/imgs/telefono.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.Celular + "<br>";
			}
			if (inmuebleResp.Vendedor.EMail1  != ''){
				strDatos = strDatos + '<img src="/imgs/emailvendedor.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.EMail1 + "<br>";
			}
			if (inmuebleResp.Vendedor.EMail2  != ''){
				strDatos = strDatos + '<img src="/imgs/emailvendedor.gif" border=0>&nbsp;' + inmuebleResp.Vendedor.EMail2 + "<br>";
			}
			if (inmuebleResp.Vendedor.www  != ''){
				strDatos = strDatos + '<img src="/imgs/website.gif" border=0>&nbsp;<a href="http://' + inmuebleResp.Vendedor.www + '">' + inmuebleResp.Vendedor.www + "<br>";
			}

			var sH = "";
			sH = sH + "<table>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" align=right><a href='javascript: OcultaDetallesVendedor();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">" + strDatos + "</td></tr>";
			sH = sH + "</table>";

			var divVendedor = e("divVendedor");
			divVendedor.style.left = (mouseX + 15) + "px";
			divVendedor.style.top = (mouseY - 180) + "px";
			divVendedor.innerHTML = MarcoTabla(sH);
			divVendedor.style.visibility="visible";

			Obscurece();

	}//DetallesVendedor

	function OcultaDetallesVendedor(){
		var divVendedor = e("divVendedor");
		divVendedor.style.visibility="hidden";
		Aclara();
	}//OcultaDetallesVendedor

	function Contacto(posicion){

			var sH = "";
			sH = sH + "<table>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=right><a href='javascript: OcultaContacto();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center><b style='color:rgb(80,80,80)'><img src='/imgs/seleccion.gif' border=0>&nbsp;GRACIAS POR EL INTER&Eacute;S EN MAPADEINMUEBLES.COM</b><hr></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=left><img src='/imgs/icon_pencil.gif' border=0>&nbsp;Por favor introduzca la siguiente informaci&oacute;n:</td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Nombre:</td><td><input id='txtNombreContacto' type=text size=50></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Email:</td><td><input  id='txtEMailContacto' type=text></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Asunto:</td><td><input  id='txtAsuntoContacto' type=text size=50></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\">Comentarios:</td><td><textarea id='txtComentarioContacto' id='txtComentarios' value='' rows='5' cols='40' style='font-size:8pt;'></textarea></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center><input type=button value='Enviar Comentario' onclick='EnviaComentario()'><input type=button value='Cancelar' onclick='OcultaContacto()'></td></tr>";
			sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center>&nbsp;</td></tr>";
			sH = sH + "</table>";

			var divContacto = e("divContacto");
			if (posicion==0){
				divContacto.style.left = (mouseX + 15) + "px";
				divContacto.style.top = (mouseY + 15) + "px";
			} else if (posicion==1){
				divContacto.style.left = (mouseX - 310) + "px";
				divContacto.style.top = (mouseY - 310) + "px";
			} else if (posicion==2){
				divContacto.style.left = (mouseX + 15) + "px";
				divContacto.style.top = (mouseY - 250) + "px";
			} else if (posicion==3){
				divContacto.style.left = (mouseX - 310) + "px";
				divContacto.style.top = (mouseY - 200) + "px";
			}

			divContacto.innerHTML = MarcoTabla(sH);
			divContacto.style.visibility="visible";

			var txtNombreContacto = e("txtNombreContacto");
			txtNombreContacto.value = minombre;
			var txtEMailContacto = e("txtEMailContacto");
			txtEMailContacto.value = miemail;

			Obscurece();
	}//Contacto

	function OcultaContacto(){
		var divContacto = e("divContacto");
		divContacto.style.visibility="hidden";
		Aclara();
	}//OcultaContacto

	function EnviaComentario(){
		var txtNombreContacto = e("txtNombreContacto");
		var txtEMailContacto = e("txtEMailContacto");
		var txtAsuntoContacto = e("txtAsuntoContacto");
		var txtComentarioContacto = e("txtComentarioContacto");
		if (echeck(txtEMailContacto.value)==false){
			return;
		}
		if (txtComentarioContacto.value==""){
			alert("Por favor introduzca los comentarios.");
			return;
		}

		req = init();
		req.send("EnviaComentario="+ sinAcentos(txtNombreContacto.value.toUpperCase()) + "@@@" + txtEMailContacto.value + "@@@" + sinAcentos(txtAsuntoContacto.value.toUpperCase()) + "@@@" + sinAcentos(txtComentarioContacto.value.toUpperCase()) + "@@@false@@@");

		var sH = "";
		sH = sH + "<table>";
		sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=right><a href='javascript: OcultaContacto();' title='Cerrar'><img src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
		sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center><b style='color:rgb(80,80,80)'><hr><img src='/imgs/seleccion.gif' border=0>&nbsp;MUCHAS GRACIAS POR SUS COMENTARIOS</b><hr></td></tr>";
		sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center><input type=button value='Cerrar' onclick='OcultaContacto()'></td></tr>";
		sH = sH + "<tr><td STYLE=\"background-color: #ffffff; font-size:8pt;\" colspan=2 align=center>&nbsp;</td></tr>";
		sH = sH + "</table>";
		var divContacto = e("divContacto");
		divContacto.innerHTML = MarcoTabla(sH);
	}//EnviaComentario


	function EnviaComentarioPaty(){
		var txtNombreContacto = e("txtNombreContacto");
		var txtEMailContacto = e("txtEMailContacto");
		var txtAsuntoContacto = e("txtAsuntoContacto");
		var txtComentarioContacto = e("txtComentarioContacto");
		if (echeck(txtEMailContacto.value)==false){
			return;
		}
		if (txtComentarioContacto.value==""){
			alert("Por favor introduzca los comentarios.");
			return;
		}

		req = init();
		req.send("EnviaComentarioPaty="+ sinAcentos(txtNombreContacto.value.toUpperCase()) + "@@@" + txtEMailContacto.value + "@@@" + sinAcentos(txtAsuntoContacto.value.toUpperCase()) + "@@@" + sinAcentos(txtComentarioContacto.value.toUpperCase()) + "@@@false@@@");

		txtNombreContacto.value = '';
		txtEMailContacto.value = '';
		txtAsuntoContacto.value = '';
		txtComentarioContacto.value = '';
		alert('MUCHAS GRACIAS POR SUS COMENTARIOS');

	}//EnviaComentarioPaty

        function Preferencias(){
           var divPreferencias = e("divPreferencias");
           var sH = "<table width=200>";
           sH = sH + "<tr><td align=right valign=top><a href='javascript: CierraPreferencias();' title='Cerrar'><img alt = 'Cerrar' src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
           sH = sH + "<tr><td><span style='color:rgb(50,50,50);'>Mi Cuenta</span><hr></td></tr>";
           sH = sH + "<tr><td>" + "<a href='javascript: CambiaPassword();' style='font-size:8pt; color: rgb(100,100,100);'><img src='/imgs/locked_owner.gif' border=0>&nbsp;Cambiar mi password</a><span id='spanPrefPassword'>" + "</td></tr>";
           //sH = sH + "<tr><td>" + "<a href='javascript: CambiaDatos();' style='font-size:8pt; color: rgb(100,100,100);'>Cambiar mis datos personales</a>" + "</td></tr>";
           if (pantalla=="mdi"){
             sH = sH + "<tr><td>" + "<a href='javascript: CierraPreferencias();MisFavoritos();' style='font-size:8pt; color: rgb(100,100,100);'><img src='/imgs/icon_heart.gif' border=0>&nbsp;Ver mis favoritos</a>" + "</td></tr>";
           } else {
                //if (intMicrositio>0){
                //  sH = sH + "<tr><td>" + "<a href='mdi.jsp?ms=" + intMicrositio + "&favs=1&' style='font-size:8pt; color: rgb(100,100,100);'><img src='/imgs/icon_heart.gif' border=0>&nbsp;Ver mis favoritos</a>" + "</td></tr>";
                //} else {
                //  sH = sH + "<tr><td>" + "<a href='mdi.jsp?favs=1' style='font-size:8pt; color: rgb(100,100,100);'><img src='/imgs/icon_heart.gif' border=0>&nbsp;Ver mis favoritos</a>" + "</td></tr>";
                //}
           }
           if (pantalla!="admin"){
            sH = sH + "<tr><td>" + "<a href='javascript: CierraPreferencias();AdminPropiedades();' style='font-size:8pt; color: rgb(100,100,100);'><img src='/imgs/caract.gif' border=0>&nbsp;Administrar mis anuncios</a>" + "</td></tr>";
           }
           //sH = sH + "<tr><td>" + "<a href='javascript: AdminPropiedades();' style='font-size:8pt; color: rgb(100,100,100);'>Mis Clientes Interesados</a>" + "</td></tr>";
           sH = sH + "</table>";
           divPreferencias.innerHTML = MarcoTabla(sH);
           divPreferencias.style.visibility='visible';
           Obscurece();
        }//Preferencias
        
        function CierraPreferencias(){
            var divPreferencias = e("divPreferencias");
            divPreferencias.style.visibility='hidden';
            Aclara();
        }//CierraPreferencias
        
        function CambiaPassword(){
          var spanPrefPassword = e("spanPrefPassword");
          var sH = "<br><table><tr><td style='background-color:rgb(240,240,240);'><table>";
          sH = sH + "<tr><td STYLE=\"font-size:8pt; color:rgb(50,50,50); \">Password Anterior:</td><td><input type=password size=16 maxlength=12 id='txtPasswordAnt' onkeypress=\"handleKeyPressLoginCP(event)\"></td></tr>";
          sH = sH + "<tr><td STYLE=\"font-size:8pt; color:rgb(50,50,50); \">Nuevo Password:</td><td><input type=password size=16 maxlength=12 id='txtPasswordNuevo' onkeypress=\"handleKeyPressLoginCP(event)\"></td></tr>";
          sH = sH + "<tr><td STYLE=\"font-size:8pt; color:rgb(50,50,50); \">Confirme Nuevo Password:</td><td><input type=password size=16 maxlength=12 id='txtPasswordConf' onkeypress=\"handleKeyPressLoginCP(event)\"></td></tr>";
          sH = sH + "<tr><td><input type=button value=Cancelar onclick='CancelarCambioPwd()'></td><td><input type=button value='Cambiar' onclick='GuardaPassword()'></td></tr>";
          sH = sH + "</table></td></tr></table><br>";
          spanPrefPassword.innerHTML = sH;
        }//CambiaPassword
        
        function CancelarCambioPwd(){
          var spanPrefPassword = e("spanPrefPassword");
          spanPrefPassword.innerHTML = "";
        }//CancelarCambioPwd
        
        
        function AdminPropiedades(){
            window.location = 'admin.jsp';
        }//AdminPropiedades
        
        function GuardaPassword(){
            
          var txtPasswordAnt = e("txtPasswordAnt");
          var txtPasswordNuevo = e("txtPasswordNuevo");
          var txtPasswordConf = e("txtPasswordConf");
          
          if (txtPasswordNuevo.value != txtPasswordConf.value){
              alert('El password nuevo no coincide!');
              return;
          }   

          if (txtPasswordNuevo.value.length < 5){
              alert('El password debe tener entre 5 y 12 caracteres');
              return;
          }

           reqPwd = init();
           reqPwd.onreadystatechange = CambiaPasswordListener;
           reqPwd.send("CambiaPassword="+ txtPasswordAnt.value + "@@@" + txtPasswordNuevo.value);
        }//GuardaPassword
        
        function CambiaPasswordListener(){
            if (reqPwd.readyState == 4) {
			if (reqPwd.status == 200) {
                            
                            var resultPwd = RegresaValorLista(reqPwd.responseXML,"result", 0);
                            if (resultPwd=='OK'){
                                alert('Password Modificado Correctamente!');
                                CancelarCambioPwd();
                            } else {
                                alert(resultPwd);
                            }
			}
		}            
        }//CambiaPasswordListener
        

        function CondicionesGratis(){
        
           var offset = getScrollXY();
           var divCondicionesGratis = e("divCondicionesGratis");
           var sH = "<table width=200>";
           sH = sH + "<tr><td align=right valign=top><a href='javascript: CierraCondicionesGratis();' title='Cerrar'><img alt = 'Cerrar' src='/imgs/btnicon_close_off.gif' border=0></a></td></tr>";
           sH = sH + "<tr><td><span style='color:rgb(50,50,50);'>Condiciones</span><hr></td></tr>";
           sH = sH + "<tr><td>* Promoci&oacute;n v&aacute;lida por tiempo limitado</td></tr>";
           sH = sH + "</table>";
           
          if ((mouseX + 270)< getWindowWidthReal() ){
                  divCondicionesGratis.style.left = mouseX + "px";
          } else {
                  divCondicionesGratis.style.left = (mouseX - 290)+ "px";
          }

          if (mouseY - offset[1] > 160){
                  divCondicionesGratis.style.top = (mouseY - 100) + "px";
          } else {
                  divCondicionesGratis.style.top = (mouseY + 20) + "px";
          }
                        
           divCondicionesGratis.innerHTML = MarcoTabla(sH);
           divCondicionesGratis.style.visibility='visible';
           Obscurece();
           
        }//CondicionesGratis
        
        function CierraCondicionesGratis(){
            var divCondicionesGratis = e("divCondicionesGratis");
            divCondicionesGratis.style.visibility='hidden';
            Aclara();
        }//CierraCondicionesGratis

        function mCarousel_itemLoadCallback(carousel, state)
        {
            alert("Wepale !");
            // Check if the requested items already exist
            if (carousel.has(carousel.first, carousel.last)) {
                return;
            }

            jQuery.get(
                'dynamic_ajax_php.php',
                {
                    idr: carousel.first,
                    last: carousel.last
                },
                function(xml) {
                    mCarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
                },
                'xml'
            );
        };

        function mCarousel_itemAddCallback(carousel, first, last, xml)
        {
            // Set the size of the carousel
            carousel.size(parseInt(jQuery('total', xml).text()));

            jQuery('image', xml).each(function(i) {
                carousel.add(first + i, jQuery(this).text());
            });
        };

