﻿<!--
var ListName=new String('');
var newLocation=new String('');

function findPosX(obj)
{
	var curleft=0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop=0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

//function ShowList(tbName,lstName)
//{
//    try
//    {
//        HideList(1);
//        SetListName(lstName);
//        var cLeft=0,cTop=0;
//	    var obj=document.getElementById(tbName);
//	    var h=obj.offsetHeight;
//	    var w=obj.offsetWidth;
//	    if (obj.offsetParent)
//	    {
//		    while (obj.offsetParent)
//		    {
//			    cLeft+=obj.offsetLeft
//			    obj=obj.offsetParent;
//		    }
//	    }
//	    else if (obj.x) curleft+=obj.x;
//	    obj=document.getElementById(tbName);
//        if (obj.offsetParent)
//	    {
//		    while (obj.offsetParent)
//		    {
//			    cTop+=obj.offsetTop
//			    obj=obj.offsetParent;
//		    }
//	    }
//	    else if (obj.y) cTop+=obj.y;
//	    var lst=document.getElementById(lstName);
//	    lst.style.width=w+20;
//        lst.style.left=cLeft;
//        lst.style.top=cTop+h-1;
//        lst.style.display='inline';
//       
//        if(lst.offsetHeight>300) lst.style.height=300;
//        if (lst.clientHeight<=15) lst.style.display='none';
//        
//    }
//    catch(e)
//    {
//        alert(e.description);
//    }
//}

function ShowList(tbName,lstName)
{
    try
    {
        HideList(1,null);
        SetListName(lstName);
        var obj=document.getElementById(tbName);
        var cLeft=0,cTop=0;
	    var h=obj.offsetHeight;
	    var w=obj.offsetWidth;
	    if (obj.offsetParent)
	    {
		    while (obj.offsetParent)
		    {
			    cLeft+=obj.offsetLeft
			    obj=obj.offsetParent;
		    }
	    }
	    else if (obj.x) curleft+=obj.x;
	    obj=document.getElementById(tbName);
        if (obj.offsetParent)
	    {
		    while (obj.offsetParent)
		    {
			    cTop+=obj.offsetTop
			    obj=obj.offsetParent;
		    }
	    }
	    else if (obj.y) cTop+=obj.y;
	    
	    var lst=document.getElementById(lstName);
	    lst.style.width=(w+20)+'px';
	    lst.style.left=cLeft+'px';
	    lst.style.display='inline';
	    var b=125+cTop+h+lst.offsetHeight-1;
	    if (b>document.body.offsetHeight && cTop-lst.offsetHeight > 0 ) lst.style.top=(cTop-lst.offsetHeight)+'px';
	    else lst.style.top=(cTop+h-1)+'px';
        if (lst.clientHeight<=15) lst.style.display='none';
    }
    catch(e)
    {
        alert(e.toString());
    }
}

function HideList(FromCode)
{
    try
    {
        if (FromCode==1)
        {
            document.getElementById(ListName).style.display='none';
            return -1;
        }
        if (event.srcElement.id.indexOf('img')>=0) return -1;
        document.getElementById(ListName).style.display='none';
    }
    catch (e)
    {
        //NOP
    }
}

function SetListName(NewName)
{
    ListName=NewName;
}

function MostrarDetallesInmueble(CodigoProducto)
{
    try
    {
        window.location='DetallesInmueble.aspx?c=' + CodigoProducto + '&h=' + history.length;
    }
    catch(ex)
    {
        //NOP
    }
}

function MostrarBuscador(p)
{
    try
    {
        history.back(p-history.length);
        return false;
    }
    catch(ex)
    {
        //NOP
    }
}

function MostrarResultadosVacaciones(Ref)
{
    try
    {
        var s=new String('');
        var pEl=document.getElementById('tbCodiPoblacionVacaciones');
        var hEl=document.getElementById('tbCodiHabVacaciones');
        var tEl=document.getElementById('tbCodiTipoVacaciones');
        if (pEl.value!='-1') s+='p='+pEl.value;
        if (hEl.value!='-1') s+=(s==''?'':'&')+'h='+hEl.value;
        if (tEl.value!='-1') s+=(s==''?'':'&')+'t='+tEl.value;
        if (Ref!='') s+=(s==''?'r=':'&r=')+Ref;
        window.location='ResultadosVacaciones.aspx'+(s==''?'':'?'+s);
        return false;
    }
    catch(e)
    {
        alert(e.toString());
    }
}

function FichaMostrarFotos(ImgSrc)
{
    try
    {
        if (ImgSrc!='') document.getElementById('imgPrincipal').src=ImgSrc;
        else document.getElementById('imgPrincipal').src=document.getElementById('lstImagenes_ctl00_imgApartamento').src;
        document.getElementById('DivFotos').style.display='inline';
        document.getElementById('DivDetalles').style.display='none';
        document.getElementById('DivPaginas').style.display='none';
    }
    catch(ex)
    {
        alert(ex.description);
        //NOP;
    }
}

function FichaMostrarDatos()
{
    try
    {
        document.getElementById('DivDetalles').style.display='inline';
        document.getElementById('DivFotos').style.display='none';
        document.getElementById('DivPaginas').style.display='none';
    }
    catch(ex)
    {
        alert(ex.description);
    }
}

function FichaMostrarPagina(Pg)
{
    try
    {
        document.getElementById('DivPaginas').style.display='inline';
        document.getElementById('DivDetalles').style.display='none';
        document.getElementById('DivFotos').style.display='none';
        if (Pg!='') document.getElementById('frmPrincipal').src=Pg;
    }
    catch(ex)
    {
        alert(ex.description);
    }
}

function Imprimir(pg)
{
    try
    {        
        window.open(pg,'','height=700,width=570,resizable=1,scrollbars=1');
    }
    catch(ex)
    {
        alert(ex.description);
    }
}

function ImprimirProducto()
{
    try
    {
        window.print();
        return false;
    }
    catch(ex)
    {
        //NOP
    }
}

function ImprimirFichaProducto()
{
	var imp;
	imp=window.open("","printer","width=817,height=550,scrollbars=1,resizable=0,left=0,top=0",true);
	imp.document.write('<html><head><title>ImmoPrestige - Imprimir</title>');
	imp.document.write('<link href="css/default.css" type="text/css" rel="stylesheet">');
	imp.document.write('</head><body onload="javascript:window.print();">');
	imp.document.write('<table cellpadding=0 cellspacing=0 border=0 width=800 align="center">');
	imp.document.write('  <tr>');
	imp.document.write('    <td height=26 colspan=2 style="background-image:url(images/3top.gif);background-repeat:repeat-x;">&nbsp;</td>');
	imp.document.write('  </tr>');
	imp.document.write('  <tr>');
	imp.document.write('    <td height=85 colspan=2 style="background-image:url(images/5head.gif);background-repeat:repeat-x;"><img src="images/logoweb.jpg"></td>');
	imp.document.write('  </tr>');
	imp.document.write('  <tr><td colspan=2>&nbsp;</td></tr>');
	imp.document.write("  <tr><td colspan=2 style='padding-bottom:4px;padding-left:10px;'>" + document.getElementById('TituloProducto').innerHTML + "<hr class='hrSeparator' /></td></tr>");
	imp.document.write('  <tr>');
	imp.document.write("    <td valign='top'>");
	imp.document.write("        <table cellspacing=0 cellpadding=5 border=0 align='center'>" + document.getElementById('DetallesProducto').innerHTML + "</table><br>");
	imp.document.write("        <table cellspacing=0 cellpadding=5 border=0 align='center' width='630px'><tr><td><hr style='border-top:1px solid rgb(209,222,235);text-align:left;width:500px;' /></td></tr></table><br>");
	imp.document.write("        <table cellspacing=0 cellpadding=5 border=0 align='center'>" + document.getElementById('PrecioProducto').innerHTML + "</table>");
	imp.document.write("    </td>");
	imp.document.write("    <td><div>" + document.getElementById('FotosProducto').innerHTML + "</div></td>");
	imp.document.write('  </tr>');
	imp.document.write('</table>');
	imp.document.write('</body></html>');
	imp.location.reload(false);
}

function Enlarge(srcEl)
{
    try
    {
        window.open(srcEl.src,'','height=500px,width=700px,resizable=1');
    }
    catch(ex)
    {
        //NOP;
    }
}
-->
