function abrir(url, nome) {
    var pos_x = (screen.availWidth / 2) - (abrir_largura / 2);
    var pos_y = 30;

    if (pos_y < 0)
        pos_y = 0; 
    if (pos_x < 0)
        pos_x = 0; 

    if (!nome) {
        var tempo = new Date();
        nome = String(tempo.getHours()) + String(tempo.getMinutes()) + String(tempo.getSeconds());
    }
    
    if ( window.eu && window.eu.aoAbrir )
        eu.aoAbrir[nome] = new Array;
    janela = window.open(url,nome,"left="+pos_x+",top="+pos_y+",width="+abrir_largura+",height="+abrir_altura+",scrollbars=no,status=no,dependent=yes")
    if (janela.opener == null) {
        janela.opener = self;
    }
    
    janela.altura = abrir_altura;
    janela.largura = abrir_largura;
}

function dialogo(l, a, url, rolagem, resize, nome) {
    if (!rolagem)
        rolagem = "yes";
        
    if (!resize)
        resize = 'no';
    
    if ( isNaN(l) ) {
        var res = l.match(/(\d+)%$/);
        if ( res )
            l = (res[1]/100) * screen.availWidth;
    }
    
    if ( isNaN(a) ) {
        res = a.match(/(\d+)%$/);
        if ( res )
            a = (res[1]/100) * screen.availHeight;
    }
    
    var pos_x = (screen.availWidth / 2) - (l / 2);
    var pos_y = (screen.availHeight / 2) - (a / 2);

    if (pos_y < 0)
        pos_y = 0; 
    if (pos_x < 0)
        pos_x = 0; 
    
    var tempo = new Date();

    if (!nome)
        nome = String(tempo.getHours()) + String(tempo.getMinutes()) + String(tempo.getSeconds());
     
    window.open(url,nome,"left="+pos_x+",top="+pos_y+",width="+l+",height="+a+",scrollbars="+rolagem+",status=no,dependent=no"+",resizable="+resize+",location=1");
}

function dialogoCascata(l, a, url, rolagem, nome) {
    if (!rolagem)
        rolagem = "yes";

    var pos_x = window.screenX + 30;
    var pos_y = window.screenY + 30;

    if (pos_y < 0)
        pos_y = 0; 
    if (pos_x < 0)
        pos_x = 0; 
    
    if (!nome) {
        var tempo = new Date();
        nome = String(tempo.getHours()) + String(tempo.getMinutes()) + String(tempo.getSeconds());
    }
     
    window.open(url,nome,"left="+pos_x+",top="+pos_y+",width="+l+",height="+a+",scrollbars="+rolagem+",status=no,dependent=no");
}
