﻿function $(id) {
    var el = document.getElementById(id);
    if (el != null)
        return el;
    var lst = document.getElementsByName(id);
    if (lst.length > 0)
        return lst[0];
    return null;
}

function voltarPG() {
    parent.window.history.back();
}

//inicio janela(s)
function abreJanela(pagina, nome, larg, alt, barra, modal) {
    var esq = (screen.width) ? (screen.width - larg) / 2 : 0;
    var topo = (screen.height) ? (screen.height - alt) / 2 : 0;
    var config = null;
    var janela = null;
    if (modal) {
        config = ('center:yes; dialogWidth:' + larg + 'px; dialogHeight:' + alt + 'px; dialogTop: px; dialogLeft: px; resizable:no; help:no;status=no;');
        janela = window.showModalDialog(pagina, 0, config);
        /*if (janela == 1)
        {
        self.location.reload();
        }*/
    }
    else {
        config = ('toolbar=no,location=no,status=no,menubar=no,scrollbars=' + barra + ',width=' + larg + ',height=' + alt + ',top=' + topo + ',left=' + esq + ',resizable=no');
        janela = window.open(pagina, nome, config);
    }

    if (janela.window.focus) {
        janela.window.focus();
    }
}

/* BANNER FLASH */
function montarSWF(flash, largura, altura) {
    var objeto = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + largura + '" height="' + altura + '">';
    objeto += '<param name="wmode" value="transparent">';
    objeto += '  <param name="movie" value="' + flash + '">';
    objeto += '    <param name="quality" value="high">';
    objeto += '    <embed src="' + flash + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '">';
    objeto += '    </embed>';
    objeto += '  </object>';
    document.write(objeto);
}