//Autor: Jesús Manel TORRES i DURAN

//Varible glogal nom del pop up
var WindowCataleg=window;

function ObrirTancar(){ 
	
	if(WindowCataleg != null)
	{			
		WindowCataleg.close();
	}
				
	WindowCataleg=window.open("../../../../cataleg_RedirectPag.aspx","WindowCataleg","resizable=yes,status=yes,width=" + (screen.availWidth - 11) + ", height=" + (screen.availHeight - 58) + ",top=0,left=0");

}

function Tancar_WindowCataleg()
{
	
	if(WindowCataleg != null)
	{			
		WindowCataleg.close();
	}
}


//FUNCIÓ PER AJUSTAR EL POPUP OBERT AL CENTRE DE LA PANTALLA
function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
        }
        w = fixedW + diffW;
        h = fixedH + diffH;
        if (h >= screen.availHeight) w += 16;
        if (w >= screen.availWidth)  h += 16;
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}