﻿// JScript File

function AbrirJanela(endereco, titulo, largura, altura, top, left, scroll)
{
    var myWin = window.open(endereco, 'titulo','width='+largura+', height='+altura+', top='+top+', left='+left+', location=1,fullscreen=no,scrollbars='+scroll); 
    myWin.focus();
}

function del()
{
    return confirm('Deseja realmente excluir este registro?');
}

//Função chamada pelos pops de tipos, botao de ok
function send(fecha)
{
    if (fecha)
        window.opener.location.replace(window.opener.location);
    self.close();
}

//MontaFlash
function MontaFlash(arquivo, largura, altura, variaveis, transparente)
{
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">\n');
    document.write('<param name="movie" value="'+arquivo+'" />\n');
    document.write('<param name="quality" value="high" />\n');
    if(transparente)
    {
        document.write('<param name="wmode" value="transparent" />\n');
    }
    document.write('<param name="flashvars" value="'+variaveis+'">\n');
    document.write('<embed src="'+arquivo+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" wmode="transparent" flashvars="'+variaveis+'"></embed>\n');
    document.write('</object>\n');
}

function MontaCaixa(parte)
{
    if(parte=="abre")
    {
        document.write('<table width="100%" cellpadding="0" cellspacing="0" border="0">\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/Box_1.gif" /><br></td>\n');
        document.write('<td width="100%" background="Img/Layout/Box_2.gif"></td>\n');
        document.write('<td><img src="Img/Layout/Box_3.gif" /><br></td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td background="Img/Layout/Box_4.gif"><br></td>\n');
        document.write('<td bgcolor="#FFFFFF">');
    }
    else if(parte=="fecha")
    {
        document.write('</td>\n');
        document.write('<td background="Img/Layout/Box_5.gif"></td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/Box_6.gif" /><br></td>\n');
        document.write('<td background="Img/Layout/Box_7.gif"></td>\n');
        document.write('<td><img src="Img/Layout/Box_8.gif" /><br></td>\n');
        document.write('</tr>\n');
        document.write('</table>\n');
    }
    else if(parte=="abreint")
    {
        document.write('<table width="577" cellpadding="0" cellspacing="0" border="0">\n');
        document.write('<tr>\n');
        document.write('<td colspan="3">\n');
        document.write('<div style="position:absolute;width:586px;"><table width="100%" cellpadding="0" cellspacing="0" border="0">\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/Boxint_1.gif" /></td>\n');
        document.write('<td background="Img/Layout/Boxint_2.gif">\n');
    }
    else if(parte=="meioint")
    {
        document.write('</td>');
        document.write('<td><img src="Img/Layout/Boxint_3.gif" /></td>');
        document.write('<td width="100%" background="Img/Layout/Boxint_4.gif">&nbsp;</td>');
        document.write('<td><img src="Img/Layout/Boxint_5.gif" /></td>');
        document.write('<tr>');
        document.write('</table></div>');
        Espaco(27);        
        document.write('</td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td background="Img/Layout/Box_4.gif">&nbsp;</td>\n');
        document.write('<td width="100%" bgcolor="#FFFFFF">');
    }
    else if(parte=="fechaint")
    {
        document.write('</td>\n');
        document.write('<td background="Img/Layout/Box_5.gif">&nbsp;</td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/Box_6.gif" /></td>\n');
        document.write('<td width="100%" background="Img/Layout/Box_7.gif">&nbsp;</td>\n');
        document.write('<td><img src="Img/Layout/Box_8.gif" /></td>\n');
        document.write('</tr>\n');
        document.write('</table>\n');
    }
}

function MontaBordaFoto(parte)
{
    if (parte=="abre")
    {
        document.write('<table cellpadding="0" cellspacing="0" style="font-size:1px;">\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/BoxFoto_1.gif" border="0" /></td>\n');
        document.write('<td background="Img/Layout/BoxFoto_2.gif" style="background-repeat:repeat-x;"></td>\n');
        document.write('<td><img src="Img/Layout/BoxFoto_3.gif" border="0" /></td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td background="Img/Layout/BoxFoto_4.gif" style="background-repeat:repeat-y;"></td>\n');
        document.write('<td><div style="border:solid #CCCCCC 1px;">\n');        
    }
    else if(parte=="fecha")
    {
        document.write('</div></td>\n');
        document.write('<td background="Img/Layout/BoxFoto_5.gif" style="background-repeat:repeat-y;"></td>\n');
        document.write('</tr>\n');
        document.write('<tr>\n');
        document.write('<td><img src="Img/Layout/BoxFoto_6.gif" border="0" /></td>\n');
        document.write('<td background="Img/Layout/BoxFoto_7.gif" style="background-repeat:repeat-x;"></td>\n');
        document.write('<td><img src="Img/Layout/BoxFoto_8.gif" border="0" /></td>\n');
        document.write('</tr>\n');
        document.write('</table>\n');    
    }
}

function Espaco(tamanho)
{
    document.write('<br /><font style="font-size:'+ tamanho +'px;">&nbsp;</font><br />');
}

//Contorna proble dos Enters em textbox
function clickButton(e, buttonid){
     var bt = document.getElementById(buttonid);
     if (typeof bt == 'object'){
           if(navigator.appName.indexOf("Netscape")>(-1)){
                 if (e.keyCode == 13){
                       bt.click();
                       return false;
                 }
           }
           if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
                 if (event.keyCode == 13){
                       bt.click();
                       return false;
                 }
           }
     }
}

//Cancela enter em textbox indesejado
function HandleEnter (field, event) {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        return false;
    } 
    else {
        return true;
    }
}

//Botao voltar
function MontaVoltar()
{
    Espaco(18);
    document.write('<div align="right">');
    document.write('<a href="JavaScript:history.go(-1);"><img src="Img/Layout/bt_Voltar.gif" alt="Voltar" border="0" /></a>');
    document.write('</div>');
}

/*
function escondeCal()
{
    document.all.getElementById('divCal').style.display='none'";
}*/

/*function mostraCal()
{
    document.all.getElementById('divCal').style.display='block'";
}*/
