//-----------------------------variables globales---------------------------
var xmlventa,xmlarrendados,xmlcompartidos,xmlgarajes,xmllocales,xmlcorto;
var ventafotos,arrfotos,comfotos,localfotos,garajefotos,cortofotos;
var safariventa,safariarrendados,safaricompartidos,safarigarajes,safarilocales;
var safaricorto,safariarrfotos,safaricomfotos,safariventafotos,safarilocalfotos,safarigarajefotos,safaricortofotos;
//-----------------------------checkea tipo de browser-----------------------
BrowserDetect.init();
if (BrowserDetect.browser=="Safari"){safari=true;crearxmlsafari();}
 else
  if (BrowserDetect.browser=="Firefox" || BrowserDetect.browser=="Mozilla" || BrowserDetect.browser=="Netscape" || BrowserDetect.browser=="Opera" ){ moz=true;crearxmlmozilla();}
   else
    if (BrowserDetect.browser=="Explorer" ){ie=true;crearxmlexplorer();}
//----------------------------------------------------


function StringBuffer() { this.buffer = []; } 
StringBuffer.prototype.append = function(string) 
{ 
this.buffer.push(string); 
return this; 
} 

StringBuffer.prototype.toString = function()
{ 
return this.buffer.join(""); 
}

// Clears the string buffer
StringBuffer.prototype.clear = function ()
{
    this.strings.length = 1;
}

function crearxmlmozilla()
 {
 xmlventa=document.implementation.createDocument("", "", null);
 xmlarrendados=document.implementation.createDocument("", "", null);
 xmlcompartidos=document.implementation.createDocument("", "", null);
 xmlgarajes=document.implementation.createDocument("", "", null);
 xmllocales=document.implementation.createDocument("", "", null);
 xmlcorto=document.implementation.createDocument("", "", null);
 ventafotos=document.implementation.createDocument("", "", null);
 arrfotos=document.implementation.createDocument("", "", null);
 comfotos=document.implementation.createDocument("", "", null);
 localfotos=document.implementation.createDocument("", "", null);
 garajefotos=document.implementation.createDocument("", "", null);
 cortofotos=document.implementation.createDocument("", "", null);
 }

function crearxmlexplorer()
 {
 xmlventa=new ActiveXObject("Microsoft.XMLDOM");
 xmlarrendados=new ActiveXObject("Microsoft.XMLDOM");
 xmlcompartidos=new ActiveXObject("Microsoft.XMLDOM");
 xmlgarajes=new ActiveXObject("Microsoft.XMLDOM");
 xmllocales=new ActiveXObject("Microsoft.XMLDOM");
 xmlcorto=new ActiveXObject("Microsoft.XMLDOM");
 ventafotos=new ActiveXObject("Microsoft.XMLDOM");
 arrfotos=new ActiveXObject("Microsoft.XMLDOM");
 comfotos=new ActiveXObject("Microsoft.XMLDOM");
 localfotos=new ActiveXObject("Microsoft.XMLDOM");
 garajefotos=new ActiveXObject("Microsoft.XMLDOM");
 cortofotos=new ActiveXObject("Microsoft.XMLDOM");
 }
 function crearxmlsafari()
 {
   safariventa = new XMLHttpRequest();
   safariarrendados = new XMLHttpRequest();
   safaricompartidos = new XMLHttpRequest();
   safarigarajes = new XMLHttpRequest();
   safarilocales = new XMLHttpRequest();
   safaricorto = new XMLHttpRequest();
   safariarrfotos = new XMLHttpRequest();
   safaricomfotos = new XMLHttpRequest();
   safariventafotos = new XMLHttpRequest();
   safarilocalfotos = new XMLHttpRequest();
   safarigarajefotos = new XMLHttpRequest();
   safaricortofotos = new XMLHttpRequest();
 }
if(moz||ie){
 xmlventa.async=false;
 xmlarrendados.async=false;
 xmlcompartidos.async=false;
 xmlgarajes.async=false;
 xmllocales.async=false;
 xmlcorto.async=false;
 ventafotos.async=false;
 arrfotos.async=false;
 comfotos.async=false;
 localfotos.async=false;
 garajefotos.async=false;
 cortofotos.async=false;
 }
 
 var textos = new StringBuffer();

function printscreen()
{
document.favoritos.submit();
document.getElementById('texto').value=textos;

// document.favoritos.texto.value=textos;
     var aux="<A HREF='javascript:printscreen()'><img src='http://www.arriendopiso.com/pics/printer.gif' border='0' width='40' height='40'></A><font class='naranja11'>Imprimir</font>";
     document.getElementById("printer").innerHTML=aux;
//window.open('http://www.arriendopiso.com/imprimir/imprimir.asp', null, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=450,left=300,top=200');
}

function sinresultados()
{
 var aux="<TABLE border='0' width='700' cellspacing='0' cellpadding='0'>";
 aux=aux+"<tr><td class ='tablatop' bgcolor='#F4EEFA' height='5'></td></tr><tr><td style='border-top: 1px solid #D3C5F0;border-right: 1px solid #D3C5F0;' align='center' height='20'><font class='cabecera'>No tienes ninguna propiedad seleccionada como Favorita.</font></td></tr>";
 aux=aux+"<TR><TD class='tablabottom' width=700 height='5'></TD></TR></table>";
 document.getElementById('datos').innerHTML=aux;
}

function encuentrafoto(idpropiedad,id)
 {
   var auxid,resultado;
   if (id=="V")
   {
   var cuerpo=ventafotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
   if (id=="A")
   {
   var cuerpo=arrfotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
   if (id=="C")
   {
   var cuerpo=comfotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
   if (id=="L")
   {
   var cuerpo=localfotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
   if (id=="G")
   {
   var cuerpo=garajefotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
   if (id=="S")
   {
   var cuerpo=cortofotos.getElementsByTagName('body'); 
   var numerocuerpos = cuerpo.length;
   }
     resultado="";
     for (var i = 0; i < numerocuerpos;i++)
       {
        auxid=cuerpo[i].getElementsByTagName('id');
        auxid=auxid[0].childNodes[0].nodeValue;
         if(idpropiedad==auxid)
          {
	   resultado = cuerpo[i].getElementsByTagName('foto');
           resultado=resultado[0].childNodes[0].nodeValue;
           break;
	  }
      }
   return resultado;
}

function managefavoritos(id)
{
 var auxid
 auxid=id.substring(0,1);
 if(moz || ie){
 if (auxid=="V")
  {
   xmlventa.load("http://www.arriendopiso.com/venta/venta.xml");
   ventafotos.load("http://www.arriendopiso.com/xml/fotosventa.xml");
   creatabla(xmlventa,ventafotos,"V",id);
  }
 if (auxid=="A")
  {
   xmlarrendados.load("http://www.arriendopiso.com/alquilados/alquilados.xml");
   arrfotos.load("http://www.arriendopiso.com/xml/fotosarr.xml");
   creatabla(xmlarrendados,arrfotos,"A",id);
  }
 if (auxid=="C")
  {
   xmlcompartidos.load("http://www.arriendopiso.com/compartidos/compartidos.xml");
   comfotos.load("http://www.arriendopiso.com/xml/fotoscom.xml");
   creatabla(xmlcompartidos,comfotos,"C",id);
  }
 if (auxid=="L")
  {
   xmllocales.load("http://www.arriendopiso.com/locales/locales.xml");
   localfotos.load("http://www.arriendopiso.com/xml/fotolocal.xml");
   creatabla(xmllocales,localfotos,"L",id);
  }
 if (auxid=="G")
  {
    xmlgarajes.load("http://www.arriendopiso.com/garajes/garajes.xml");
    garajefotos.load("http://www.arriendopiso.com/xml/fotogaraje.xml");
    creatabla(xmlgarajes,garajefotos,"G",id);
  }
 if (auxid=="S")
  {
    xmlcorto.load("http://www.arriendopiso.com/cortoperiodo/corto.xml");
    cortofotos.load("http://www.arriendopiso.com/xml/fotoscorto.xml");
    creatabla(xmlcorto,cortofotos,"S",id);
  }
  }
  else
  if (safari)
  {
   if (auxid=="V")
  {
   safariventa.open("GET","http://www.arriendopiso.com/venta/venta.xml",false);
   safariventa.send("");
   //xmlventa=safariventa.responseXML;
   safariventafotos.open("GET","http://www.arriendopiso.com/xml/fotosventa.xml",false);
   safariventafotos.send("");
   //ventafotos=safariventafotos.responseXML;
   creatabla(safariventa,safariventafotos,"V",id);
  }
 if (auxid=="A")
  {
   safariarrendados.open("GET","http://www.arriendopiso.com/alquilados/alquilados.xml",false);
   safariarrendados.send("");
  // xmlarrendados=safariarrendados.responseXML;
   safariarrfotos.open("GET","http://www.arriendopiso.com/xml/fotosarr.xml",false);
   safariarrfotos.send("");
  // arrfotos=safariarrfotos.responseXML;
   creatabla(safariarrendados,safariarrfotos,"A",id);
  }
 if (auxid=="C")
  {
   safaricompartidos.open("GET","http://www.arriendopiso.com/compartidos/compartidos.xml",false);
   safaricompartidos.send("");
  // xmlcompartidos=safaricompartidos.responseXML;
   safaricomfotos.open("GET","http://www.arriendopiso.com/xml/fotoscom.xml",false);
   safaricomfotos.send("");
   //comfotos=safaricomfotos.responseXML;
   creatabla(safaricompartidos,safaricomfotos,"C",id);
  }
 if (auxid=="L")
  {
   safarilocales.open("GET","http://www.arriendopiso.com/locales/locales.xml",false);
   safarilocales.send("");
   //xmllocales=safarilocales.responseXML;
   safarilocalfotos.open("GET","http://www.arriendopiso.com/xml/fotolocal.xml",false);
   safarilocalfotos.send("");
   //localfotos=safarilocalfotos.responseXML;
   creatabla(safarilocales,safarilocalfotos,"L",id);
  }
 if (auxid=="G")
  {
   safarigarajes.open("GET","http://www.arriendopiso.com/garajes/garajes.xml",false);
   safarigarajes.send("");
   //xmlgarajes=safarigarajes.responseXML;
   safarigarajefotos.open("GET","http://www.arriendopiso.com/xml/fotogaraje.xml",false);
   safarigarajefotos.send("");
   //garajefotos=safarigarajefotos.responseXML;
   creatabla(safarigarajes,safarigarajefotos,"G",id);
  }
 if (auxid=="S")
  {
   safaricorto.open("GET","http://www.arriendopiso.com/cortoperiodo/corto.xml",false);
   safaricorto.send("");
   //xmlcorto=safaricorto.responseXML;
   safaricortofotos.open("GET","http://www.arriendopiso.com/xml/fotoscorto.xml",false);
   safaricortofotos.send("");
   //cortofotos=safaricortofotos.responseXML;
   creatabla(safaricorto,safaricortofotos,"S",id);
  }
 }
}

function cogefavoritos()
{
   var idxprimero,idxsegundo,auxstr,auxstring,compara;
   var str=favoritos;
   var longitud=str.length;
   auxstring="";
   auxstr="";
   texto="";
   if(longitud!=0)
     {
      for(var j=0;j<longitud;j++)
       {
        idxprimero=str.indexOf("+")+1;
        auxstr=str.substring(idxprimero,str.length);
        idxsegundo=auxstr.indexOf("+")+1;
        if(idxsegundo==0){idxsegundo=str.length+1}
         compara=str.substring(idxprimero,idxsegundo);

         managefavoritos(compara)

         str=str.substring(idxsegundo,str.length+1);
         longitud=str.length;
         j=0;
       }
     document.getElementById("datos").innerHTML=textos;
    }
    else{sinresultados();}
}


	  
function creatabla(xml,fotos,tipo,id)
{ 
  if (moz) {xml.onload = creatablaaux(xml,fotos,tipo,id);}  
   else if (ie) 
    { 
    if(xml.readyState=="4"){creatablaaux(xml,fotos,tipo,id);}
     else
      xml.onreadystatechange = function () {if (xml.readyState == 4) creatablaaux(xml,fotos,tipo,id)};
    }
    else
    if(safari){
    
     if(xml.readyState==4){xml=xml.responseXML;creatablaaux(xml,fotos,tipo,id);}
     else
      xml.onreadystatechange = function () {if (xml.readyState == 4) xml=xml.responseXML;creatablaaux(xml,fotos,tipo,id)};
       
    }
}
function creatablaaux(xml,fotos,tipo,id)
{

  if (moz) {fotos.onload = creartabla(xml,tipo,id);} 
   else if (ie) 
   { 
   if(fotos.readyState=="4"){ creartabla(xml,tipo,id);}
      else
          fotos.onreadystatechange = function () {if (fotos.readyState == 4) creartabla(xml,tipo,id)};
   }
   else if(safari){
   
     if(fotos.readyState==4){fotos=fotos.responseXML; creartabla(xml,tipo,id);}
    else
      fotos.onreadystatechange = function () {if (fotos.readyState == 4){ fotos=fotos.responseXML;creartabla(xml,tipo,id);}};
    }
}

function creartabla(xml,tipo,id)
{
 var total,cuerpo;
 cuerpo="";
 total="";
 
 if (tipo=="V")
  {
  
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
      
	  creaventa(i,cuerpo);
          break;
        }
     }
  }
 if (tipo=="A")
  {
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
	  creaarrendado(i,cuerpo);
          break;
        }
     }
  }
 if (tipo=="C")
  {
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
	  creacompartido(i,cuerpo);
          break;
        }
     }
  }
 if (tipo=="L")
  {
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
	  crealocal(i,cuerpo);
          break;
        }
     }
  }
 if (tipo=="G")
  {
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
	  creagaraje(i,cuerpo);
          break;
        }
     }
  }
 if (tipo=="S")
  {
  cuerpo=xml.getElementsByTagName('body');
  total=cuerpo.length;
  for (var i = 0; i < total; i++)
     {
       idpropiedad=cuerpo[i].getElementsByTagName('id');
       idpropiedad=idpropiedad[0].childNodes[0].nodeValue;	
       if (id==idpropiedad)
        {
	  creacorto(i,cuerpo);
          break;
        }
     }
  }
}




//----------------------------------------------------EN VENTA --------------------------

function creaventa(i,cuerpo)
{
   var descrip,idpiso;
   var tabla,aux,auxiliar,auxtipo;
   var direccion,descripcion,provincia,municipio,zona,precio,habitaciones,telefono,email,contacto,metros;
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";
   direccion = cuerpo[i].getElementsByTagName('address');
   direccion=direccion[0].childNodes[0].nodeValue;
   descripcion=cuerpo[i].getElementsByTagName('descrip');
   descripcion=descripcion[0].childNodes[0].nodeValue;
   provincia=cuerpo[i].getElementsByTagName('provincia');
   provincia=provincia[0].childNodes[0].nodeValue;
   municipio=cuerpo[i].getElementsByTagName('municipio');
   municipio=municipio[0].childNodes[0].nodeValue;
   zona=cuerpo[i].getElementsByTagName('barrio');
   zona=zona[0].childNodes[0].nodeValue;
   precio=cuerpo[i].getElementsByTagName('precio');
   precio=precio[0].childNodes[0].nodeValue;
   habitaciones=cuerpo[i].getElementsByTagName('numhabitat');
   habitaciones=habitaciones[0].childNodes[0].nodeValue;
   telefono=cuerpo[i].getElementsByTagName('telefono');
   telefono=telefono[0].childNodes[0].nodeValue;
   email=cuerpo[i].getElementsByTagName('email');
   email=email[0].childNodes[0].nodeValue;
   contacto=cuerpo[i].getElementsByTagName('contacto');
   contacto=contacto[0].childNodes[0].nodeValue;
   idpiso=cuerpo[i].getElementsByTagName('id');
   idpiso=idpiso[0].childNodes[0].nodeValue;
   metros=cuerpo[i].getElementsByTagName('metros');
   metros=metros[0].childNodes[0].nodeValue;
   tipo=cuerpo[i].getElementsByTagName('tipo');
   tipo=tipo[0].childNodes[0].nodeValue;
   if (tipo=="1"){tipo="Piso/Apartamento - En Venta."}
		if (tipo=="2"){tipo="Atico/Duplex/Loft - En Venta."}
		if (tipo=="3"){tipo="Rustica - En Venta -"}
		if (tipo=="4"){tipo="Casa/Chalet/Torre - En Venta."}
		if (tipo=="5"){tipo="Obra Nueva - En Venta."}  
		if (tipo=="6"){tipo="Terreno/Parcela - En Venta.";auxtipo=6;}  
        //border superiores redondeados
        aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idpiso+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=220 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div style='background-color:#f3f3f3;'><div class=ladoright><div class=inferior><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  if (auxtipo!=6){
		  aux=aux+"<td width=80 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Habitaciones<br><font class=morado11b>"+habitaciones+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  }
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Superficie<br><font class=morado11b>"+metros+"&nbsp;"+"m&#178.</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idpiso);
		   if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idpiso+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
	aux=pie(aux,idpiso,telefono,email,contacto);
	aux=tabla+aux+"</table>";
	textos.append(aux);
}
//-----------------------------------------------------------
//--------------------------------------------------------ARRENDADOS----------------------
//-----------------------------------------------------------
function creaarrendado(i,cuerpo)
{
   var descrip,idpiso;
   var tabla,aux,auxiliar;
   var direccion,descripcion,provincia,municipio,zona,precio,habitaciones,telefono,email,contacto,metros,fecha;
  
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";
   direccion = cuerpo[i].getElementsByTagName('address');
   direccion=direccion[0].childNodes[0].nodeValue;
   descripcion=cuerpo[i].getElementsByTagName('descrip');
   descripcion=descripcion[0].childNodes[0].nodeValue;
   provincia=cuerpo[i].getElementsByTagName('provincia');
   provincia=provincia[0].childNodes[0].nodeValue;
   municipio=cuerpo[i].getElementsByTagName('municipio');
   municipio=municipio[0].childNodes[0].nodeValue;
   zona=cuerpo[i].getElementsByTagName('barrio');
   zona=zona[0].childNodes[0].nodeValue;
   precio=cuerpo[i].getElementsByTagName('precio');
   precio=precio[0].childNodes[0].nodeValue;
   habitaciones=cuerpo[i].getElementsByTagName('numhabitat');
   habitaciones=habitaciones[0].childNodes[0].nodeValue;
   telefono=cuerpo[i].getElementsByTagName('telefono');
   telefono=telefono[0].childNodes[0].nodeValue;
   email=cuerpo[i].getElementsByTagName('email');
   email=email[0].childNodes[0].nodeValue;
   contacto=cuerpo[i].getElementsByTagName('contacto');
   contacto=contacto[0].childNodes[0].nodeValue;
   idpiso=cuerpo[i].getElementsByTagName('id');
   idpiso=idpiso[0].childNodes[0].nodeValue;
   metros=cuerpo[i].getElementsByTagName('metros');
   metros=metros[0].childNodes[0].nodeValue;
   fecha=cuerpo[i].getElementsByTagName('fecha');
   fecha=fecha[0].childNodes[0].nodeValue;
   tipo=cuerpo[i].getElementsByTagName('tipo');
   tipo=tipo[0].childNodes[0].nodeValue;
   if (tipo=="1"){tipo="Piso/Apartamento - En Alquiler."}
		if (tipo=="2"){tipo="Atico/Duplex/Loft - En Alquiler."}
		if (tipo=="3"){tipo="Rustica - En Alquiler."}
		if (tipo=="4"){tipo="Casa/Chalet/Torre - En Alquiler."}
		if (tipo=="5"){tipo="Obra Nueva - En Alquiler."}
       
        aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idpiso+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=220 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div style='background-color:#f3f3f3;'><div class=ladoright><div class=inferior><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  
		  aux=aux+"<td width=80 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Habitaciones<br><font class=morado11b>"+habitaciones+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Superficie<br><font class=morado11b>"+metros+"&nbsp;"+"m&#178.</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=85 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Disponible el<br><font class=morado11b>"+fecha+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idpiso);
		    if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idpiso+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
		aux=pie(aux,idpiso,telefono,email,contacto);
		aux=tabla+aux+"</table>";
		textos.append(aux);
}
//-----------------------------------------------------------
//-----------------------------------------------------------COMPARTIDOS -------------------
//-----------------------------------------------------------
function creacompartido(i,cuerpo)
{
   var descrip,idpiso;
   var tabla,aux,auxiliar;
   var direccion,descripcion,provincia,municipio,zona,precio,periodo,telefono,email,contacto,sexo,fecha;
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";
        
                direccion = cuerpo[i].getElementsByTagName('address');
                direccion=direccion[0].childNodes[0].nodeValue;
		descripcion=cuerpo[i].getElementsByTagName('descrip');
                descripcion=descripcion[0].childNodes[0].nodeValue;
		provincia=cuerpo[i].getElementsByTagName('provincia');
                provincia=provincia[0].childNodes[0].nodeValue;
		municipio=cuerpo[i].getElementsByTagName('municipio');
                municipio=municipio[0].childNodes[0].nodeValue;
		zona=cuerpo[i].getElementsByTagName('barrio');
                zona=zona[0].childNodes[0].nodeValue;
		precio=cuerpo[i].getElementsByTagName('precio');
                precio=precio[0].childNodes[0].nodeValue;
		periodo=cuerpo[i].getElementsByTagName('periodo');
                periodo=periodo[0].childNodes[0].nodeValue;
		telefono=cuerpo[i].getElementsByTagName('telefono');
                telefono=telefono[0].childNodes[0].nodeValue;
		email=cuerpo[i].getElementsByTagName('email');
                email=email[0].childNodes[0].nodeValue;
		contacto=cuerpo[i].getElementsByTagName('contacto');
                contacto=contacto[0].childNodes[0].nodeValue;
		idpiso=cuerpo[i].getElementsByTagName('id');
                idpiso=idpiso[0].childNodes[0].nodeValue;
		sexo=cuerpo[i].getElementsByTagName('sexo');
                sexo=sexo[0].childNodes[0].nodeValue;
		fecha=cuerpo[i].getElementsByTagName('fecha');
                fecha=fecha[0].childNodes[0].nodeValue;
		tipo=cuerpo[i].getElementsByTagName('tipo');
		tipo=tipo[0].childNodes[0].nodeValue;
		if (tipo=="1"){tipo="Se comparte habitaci&#0243;n sencilla"}
		if (tipo=="2"){tipo="Se comparte habitaci&#0243;n doble con una cama"}
		if (tipo=="3"){tipo="Se comparte habitaci&#0243;n doble con dos camas"}
		if (tipo=="4"){tipo="Se comparte Suit"}
		if (sexo=="h")
		{sexo="Hombre";}
		 else
		if (sexo=="m")
		{sexo="Mujer";}
		 else
		  {sexo=sexo="No expecifica";}
		  
		   aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idpiso+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=220 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Para compartir<br><font class=morado11b>"+periodo+" meses.</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=95 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Preferible<br><font class=morado11b>"+sexo+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=85 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Disponible el<br><font class=morado11b>"+fecha+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idpiso);
		    if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idpiso+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
	aux=pie(aux,idpiso,telefono,email,contacto);
	aux=tabla+aux+"</table>";
	textos.append(aux);
}
//-----------------------------------------------------------
//----------------------------------------------------LOCALES --------------------------
//-----------------------------------------------------------
function crealocal(i,cuerpo)
{
   
   var RootElement,descrip,idlocal;
   var tabla,aux,auxiliar;
   var direccion,descripcion,provincia,municipio,zona,precio,estado,telefono,email,contacto,metros;
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";
 
                direccion = cuerpo[i].getElementsByTagName('address');
                direccion=direccion[0].childNodes[0].nodeValue;
		descripcion=cuerpo[i].getElementsByTagName('descrip');
                descripcion=descripcion[0].childNodes[0].nodeValue;
		provincia=cuerpo[i].getElementsByTagName('provincia');
                provincia=provincia[0].childNodes[0].nodeValue;
		municipio=cuerpo[i].getElementsByTagName('municipio');
                municipio=municipio[0].childNodes[0].nodeValue;
		zona=cuerpo[i].getElementsByTagName('barrio');
                zona=zona[0].childNodes[0].nodeValue;
		precio=cuerpo[i].getElementsByTagName('precio');
                precio=precio[0].childNodes[0].nodeValue;
		estado=cuerpo[i].getElementsByTagName('estado');
                estado=estado[0].childNodes[0].nodeValue;
		telefono=cuerpo[i].getElementsByTagName('telefono');
                telefono=telefono[0].childNodes[0].nodeValue;
		email=cuerpo[i].getElementsByTagName('email');
                email=email[0].childNodes[0].nodeValue;
		contacto=cuerpo[i].getElementsByTagName('contacto');
                contacto=contacto[0].childNodes[0].nodeValue;
		idlocal=cuerpo[i].getElementsByTagName('id');
                idlocal=idlocal[0].childNodes[0].nodeValue;
		metros=cuerpo[i].getElementsByTagName('metros');
                metros=metros[0].childNodes[0].nodeValue;
 		tipo=cuerpo[i].getElementsByTagName('tipo');
   		tipo=tipo[0].childNodes[0].nodeValue;
   		if(estado=="1") {estado="- En Alquiler.";}
                if(estado=="2") {estado="- En venta.";}
                if(estado=="3") {estado="- Traspaso.";}
                if (tipo=="1"){tipo="Oficina"+"&nbsp;"+estado}
                if (tipo=="2"){tipo="Local"+"&nbsp;"+estado}
                if (tipo=="3"){tipo="Nave"+"&nbsp;"+estado}
                if (tipo=="4"){tipo="Terreno"+"&nbsp;"+estado}
                if (tipo=="5"){tipo="Obra Nueva"+"&nbsp;"+estado} 
         aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idlocal+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=220 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Superficie<br><font class=morado11b>"+metros+"&nbsp m&#178.</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=80>"
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=80>"
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idlocal);
		  if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idlocal+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
	aux=pie(aux,idlocal,telefono,email,contacto);
	aux=tabla+aux+"</table>";
	textos.append(aux);
}
//-----------------------------------------------------------
//-----------------------------------------------------GARAJES -------------------------
//-----------------------------------------------------------
function creagaraje(i,cuerpo)
{
   
   var RootElement,descrip,idgaraje;
   var tabla,aux,auxiliar;
   var direccion,descripcion,provincia,municipio,zona,precio,estado,telefono,email,contacto,metros,plazas;
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";

                direccion = cuerpo[i].getElementsByTagName('address');
                direccion=direccion[0].childNodes[0].nodeValue;
		descripcion=cuerpo[i].getElementsByTagName('descrip');
                descripcion=descripcion[0].childNodes[0].nodeValue;
		provincia=cuerpo[i].getElementsByTagName('provincia');
                provincia=provincia[0].childNodes[0].nodeValue;
		municipio=cuerpo[i].getElementsByTagName('municipio');
                municipio=municipio[0].childNodes[0].nodeValue;
		zona=cuerpo[i].getElementsByTagName('barrio');
                zona=zona[0].childNodes[0].nodeValue;
		precio=cuerpo[i].getElementsByTagName('precio');
                precio=precio[0].childNodes[0].nodeValue;
		estado=cuerpo[i].getElementsByTagName('estado');
                estado=estado[0].childNodes[0].nodeValue;
		telefono=cuerpo[i].getElementsByTagName('telefono');
                telefono=telefono[0].childNodes[0].nodeValue;
		email=cuerpo[i].getElementsByTagName('email');
                email=email[0].childNodes[0].nodeValue;
		contacto=cuerpo[i].getElementsByTagName('contacto');
                contacto=contacto[0].childNodes[0].nodeValue;
		idgaraje=cuerpo[i].getElementsByTagName('id');
                idgaraje=idgaraje[0].childNodes[0].nodeValue;
		metros=cuerpo[i].getElementsByTagName('metros');
                metros=metros[0].childNodes[0].nodeValue;
		tipo=cuerpo[i].getElementsByTagName('tipo');
                tipo=tipo[0].childNodes[0].nodeValue;
		plazas=cuerpo[i].getElementsByTagName('plazas');
                plazas=plazas[0].childNodes[0].nodeValue;
        if(estado=="1") {estado="&nbsp;"+"- En Alquiler.";}
        if(estado=="2") {estado="&nbsp;"+"- En Venta.";}
        if (tipo=="1"){tipo="Garaje plaza Individual"+estado}
		if (tipo=="2"){tipo="Garaje plaza Colectiva"+estado}
		if (tipo=="3"){tipo="Garaje Obra Nueva"+estado}
		if(plazas=="10") {plazas="<img src='http://www.arriendopiso.com/pics/coche.gif'/>";}
		if(plazas=="20") {plazas="<img src='http://www.arriendopiso.com/pics/coche.gif'/><img src='http://www.arriendopiso.com/pics/coche.gif'/>";}
		if(plazas=="01") {plazas="<img src='http://www.arriendopiso.com/pics/moto.gif'/>";}
		if(plazas=="02") {plazas="<img src='http://www.arriendopiso.com/pics/moto.gif'/><img src='http://www.arriendopiso.com/pics/moto.gif'/>";}
		if(plazas=="11") {plazas="<img src='http://www.arriendopiso.com/pics/coche.gif'/><img src='http://www.arriendopiso.com/pics/moto.gif'/>";}
		if(plazas=="12") {plazas="<img src='http://www.arriendopiso.com/pics/coche.gif'/><img src='http://www.arriendopiso.com/pics/moto.gif'/><img src='http://www.arriendopiso.com/pics/moto.gif'/>";}
		
		  aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idgaraje+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=230 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Superficie<br><font class=morado11b>"+metros+"&nbsp m&#178.</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Plaza para<br>"+plazas;
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  		  
		  aux=aux+"<td width=80>"
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idgaraje);
		  if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idgaraje+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
aux=pie(aux,idgaraje,telefono,email,contacto);
aux=tabla+aux+"</table>";
textos.append(aux);
}
//-----------------------------------------------------------
//-------------------------------------------------------CORTO PERIODO-----------------------
//-----------------------------------------------------------
function creacorto(i,cuerpo)
{
   var descrip,idcorto;
   var tabla,aux,auxiliar;
   var direccion,descripcion,provincia,municipio,zona,precio,telefono,email,contacto,persona,fecha;
   tabla="<TABLE border='0' width='700' cellspacing='0' cellpadding='0' > ";
   aux="";
                direccion = cuerpo[i].getElementsByTagName('address');
                direccion=direccion[0].childNodes[0].nodeValue;
		descripcion=cuerpo[i].getElementsByTagName('descrip');
                descripcion=descripcion[0].childNodes[0].nodeValue;
		provincia=cuerpo[i].getElementsByTagName('provincia');
                provincia=provincia[0].childNodes[0].nodeValue;
		municipio=cuerpo[i].getElementsByTagName('municipio');
                municipio=municipio[0].childNodes[0].nodeValue;
		zona=cuerpo[i].getElementsByTagName('barrio');
                zona=zona[0].childNodes[0].nodeValue;
		precio=cuerpo[i].getElementsByTagName('precio');
                precio=precio[0].childNodes[0].nodeValue;
		telefono=cuerpo[i].getElementsByTagName('telefono');
                telefono=telefono[0].childNodes[0].nodeValue;
		email=cuerpo[i].getElementsByTagName('email');
                email=email[0].childNodes[0].nodeValue;
		contacto=cuerpo[i].getElementsByTagName('contacto');
                contacto=contacto[0].childNodes[0].nodeValue;
		idcorto=cuerpo[i].getElementsByTagName('id');
                idcorto=idcorto[0].childNodes[0].nodeValue;
		persona=cuerpo[i].getElementsByTagName('personas');
                persona=persona[0].childNodes[0].nodeValue;
		fecha=cuerpo[i].getElementsByTagName('fecha');
                fecha=fecha[0].childNodes[0].nodeValue;
                tipo=cuerpo[i].getElementsByTagName('tipo');
                tipo=tipo[0].childNodes[0].nodeValue;
        if (tipo=="1"){tipo="Casa Rural."}
		if (tipo=="2"){tipo="Apartamento."}
		if (tipo=="3"){tipo="Villa."}

var auxpersona="";
if (persona<5)
 {
  for(j=1;j<=persona;j++)
   {
    auxpersona=auxpersona+"<img src='http://www.arriendopiso.com/pics/hombre.gif' width='12' height='15'>";
   }
  persona=auxpersona;
 }
 else
  {persona=persona+"+<img src='http://www.arriendopiso.com/pics/hombre.gif' width='12' height='15'>";}
    aux=aux+"<tr><td colspan=2 class=tablatop height=2></td></tr>";
        aux=aux+"<TR bgcolor=#f8f7f7 ><TD style='border-left: 1px solid #F4EEFA'>";
        
        if(zona!="0") {var descrip="<font class='cabecera'>&nbsp;&nbsp;"+direccion+" - "+zona+", "+municipio+" ("+provincia+")</font></td>";} else
        {var descrip="<font class='cabecera'>"+direccion+" , "+municipio+" ("+provincia+")</font></td>";}
		  aux=aux+descrip+"<TD height='25' align='center' style='border-right: 1px solid #D3C5F0;'><div id='"+idcorto+"'>"+"&nbsp;"+"</div></td></tr>";
          aux=aux+"<TR valign='top'><TD style='border-left: 1px solid #F4EEFA' width='600'height='100' class='cuerpo'>";
		  aux=aux+"<table width=600 border='0' cellpadding='0' cellspacing='0'><tr><td height=30 width=230 valign=top style='border-top: 1px solid #d3c5f0'>";
		  
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11b align=center style='padding:5px 0px 5px 0px;'>";
		  aux=aux+tipo;
		  aux=aux+"</div></div></div></div></div></div>";
		  
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=70 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  if (precio !=0){aux=aux+"Precio<br><font class=morado11b>"+precio+"&#128</font>";} else {aux=aux+"Precio<br><font class=morado11b>Consultar</font>";}
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";	
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Acomoda<br>"+persona;
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  
		  aux=aux+"<td width=90 style='border-top: 1px solid #d3c5f0'>"
		  aux=aux+"<div class=ladoright><div class=inferior><div class=ladoleft><div class=bottomleft><div class=bottomright><div class=morado11 align=center style='padding:0px 0px 5px 0px'>";
		  aux=aux+"Disponible el<br><font class=morado11b>"+fecha+"</font>";
		  aux=aux+"</div></div></div></div></div></div>";
		  aux=aux+"</td>";
		  		  
		  aux=aux+"<td width=80>"
		  aux=aux+"</td>";
		  
		  aux=aux+"</tr></table>";
		  descrip=descripcion;
          aux=aux+descrip;
//-----------------carga la imagen----------------------------------
          aux=aux+"<TD style='border-right: 1px solid #D3C5F0;' width=100 >";
		  descrip=encuentrafoto(idcorto);
		  if(descrip!="")
		{ 
		    auxiliar="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+idcorto+"' target='_blank'><img border=0 style='cursor:pointer' alt='Ver Detalles' src='"+descrip+"' width='100' height='100' border='0'></img></a></br>";
		}
		else{auxiliar="&nbsp";}
              aux=aux+auxiliar+"</TD></TR>";
//---------------pie de la tabla-------------------------------------------
aux=pie(aux,idcorto,telefono,email,contacto);
aux=tabla+aux+"</table>";
textos.append(aux);
}


function pie(texto,id,telefono,email,contacto)
{

		var aux=texto+"<TR class=gradient4><TD class='morado12'>";
		auxiliar="";
		if(telefono!="*"){auxiliar="<img src='http://www.arriendopiso.com/pics/telefonop.gif' width='16' height='16'>"+telefono;}
        if(email!="*"){auxiliar=auxiliar+"&nbsp;&nbsp;<img src='http://www.arriendopiso.com/pics/emailp.gif' width='16' height='16'>"+email;}
	    if(contacto!="*"){auxiliar=auxiliar+"&nbsp;&nbsp;<img src='http://www.arriendopiso.com/pics/contactop.gif' width='16' height='16'>"+contacto;}
	    aux=aux+auxiliar+"</TD><TD align='center'>";
                descrip="<a href='http://www.arriendopiso.com/detalles/detalles.asp?id="+id+"' target='_blank' class='a2'>Ver detalles</a>";
	    aux=aux+descrip+"</TD></TR>";
	    aux=aux+"<TR><TD colspan=2 class=tablabottom width=700 height='5'></TD></TR><TR><TD colspan=2 width=700 height='20'></TD></TR></tr></table>";
        
        
        return(aux);
 }
        
function redondea()
{
if(!NiftyCheck())
return;
RoundedTop("td.tablatop","#FFF","#ebebec","small");
RoundedBottom("td.tablabottom","#FFF","#ebebec");
}


