﻿// JScript File

//OpenWindow
function OpenWindow(url, height, width, scrollbars)
{
    var win;
    win = window.open(url, "UNICEUBPOPUP", "height="+height+",width="+width+",scrollbars="+scrollbars+",status=yes,toolbar=no,menubar=no,location=no"); 
    if(win == null) 
        alert("A janela foi bloqueada, por favor desabilite a bloqueador de popup!"); 
}

function OpenWindowScreenCenter(url, height, width, scrollbars)
{
	try
	{
		var str="height="+height;
			str+=",width="+width;
		if (window.screen) {
			var ah=screen.availHeight-30;
			var aw=screen.availWidth-10;

			var xc=(aw-width)/2;
			var yc=(ah-height)/2;

			str+=",left="+xc+",screenX="+xc;
			str+=",top="+yc+",screenY="+yc;
		}
		str+=",scrollbars="+scrollbars+", statusbar=yes";
		str+=",resizable=yes";
		
		win = window.open(url,'UNICEUBPOPUP',str);
		if(win == null)
		{
            alert("A janela foi bloqueada, por favor desabilite a bloqueador de popup!");
            return win;
        }
            
		win.focus();
		return win;
	}
	catch(e)
	{
		alert('Ocorreu um erro de script durante a tentativa de abrir uma pop-up.');
	}
}

// It opens the window temporarily.
// Delay in seconds. 10s = 1000
function OpenWindowTemp(url, height, width, scrollbars, seconds)
{
    var win;
    var delay = parseInt(seconds * 1000);
    win = window.open(url, "UNICEUBPOPUP", "height="+height+",width="+width+",scrollbars="+scrollbars+",status=yes,toolbar=no,menubar=no,location=no"); 
    if(win == null) 
        alert("A janela foi bloqueada, por favor desabilite a bloqueador de popup!");
    else
        setTimeout('CloseWindow(win)', delay);
}

function CloseWindow(win) {
    win.close();
 }