/* JS Document */

var selected;

function celOverEffect(object, id_evento) {
	if (object.className == 'sel')
		object.className = 'sel_mouse_over';
	document.getElementById('evento_' + id_evento).style.display = 'block';
}

function celOutEffect(object, id_evento) {
	if (object.className == 'sel_mouse_over')
		object.className = 'sel';
	document.getElementById('evento_' + id_evento).style.display = 'none';
}

function abrirAtividade(data) 
{
    document.location = "../DivulgarAgenda/Atividade?data=" + data;
}

function editarAtividade(data, id) 
{
    document.location = "../DivulgarAgenda/Atividade?data=" + data + "&id=" + id + "&act=1";
}

function excluirAtividade(data, id) 
{
    document.location = "../DivulgarAgenda/Atividade?data=" + data + "&id=" + id + "&act=2";
}

function editarComunicado(id) 
{
    document.location = "../ManterComunicacao/Comunicado?id=" + id + "&act=1";
}

function editarDocumento(id) 
{
    document.location = "../CompartilharDocumentos/Documento?id=" + id + "&act=1";
}

function excluirComunicado(id) 
{
    document.location = "../ManterComunicacao/Comunicado?id=" + id + "&act=2";
}

function editarPostIt(id) 
{
    document.location = "../EscreverPostIt/PostIt?id=" + id;
}

function dropMenuOn(link1, link2) {
	document.getElementById(link1).style.display = 'block';
	document.getElementById(link2).style.display = 'block';
}

function dropMenuOut(link1, link2) {
	document.getElementById(link1).style.display = 'none';
	document.getElementById(link2).style.display = 'none';
}

function popupFoto(foto) {
	window.open('http://beta.causaganha.com.br/dis/popup_foto.php?foto='+foto,'popupFoto','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function popupWindow(url) {
	window.open('http://beta.causaganha.com.br/dis/'+url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=400,screenX=50,screenY=50,top=50,left=50')
}

function editarConteudo(url, id) {
	window.open(url + '?id=' + id,'novaJanela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=400,screenX=50,screenY=50,top=50,left=50');
}

function abrirJanela(url) {
	window.open(url,'novaJanela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=400,screenX=50,screenY=50,top=50,left=50');
}
		
var i=0;
function resize() {
  if (navigator.appName == 'Netscape') i=40;
  if (document.images[0]) window.resizeTo(document.images[0].width, document.images[0].height+130-i);
  self.focus();
}

function refreshParent() 
{
    window.opener.location.href = window.opener.location.href;

    if (window.opener.progressWindow)
    {
        window.opener.progressWindow.close()
    }
    
    window.close();
}

 function refresh()
 {
    window.opener.location.href = window.opener.location.href;
 }

function GerarSWF($arquivo,$altura,$largura,$id){
    //document.writeln('<div style="z-index:10;">');
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + $largura + '" height="' + $altura + '" id="' + $id + '" name="' + $id + '">');
    document.writeln('        <param name="movie" value="' + $arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    document.writeln('        <param name="bgcolor" value="#ffffff" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="tl" />');
    document.writeln('        <param name="scale" value="noscale" />');
    document.writeln('        <param name="wmode" value="opaque" />');
    document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high" salign="tl" scale="noscale" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
    ///document.writeln('</div>');
}

function avancarSubGaleria(galeriaFoto, subGaleriaAtual, qtTotalSubGaleria, btAvancar, btVoltar)
{
    total = Number(document.getElementById(qtTotalSubGaleria).value);
    atual = Number(document.getElementById(subGaleriaAtual).value);
    avancar = document.getElementById(btAvancar);
    voltar = document.getElementById(btVoltar);
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual  + '_sf1') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1').style.display = 'none';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2') != null)
    document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2').style.display = 'none';
    
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3').style.display = 'none';
     
    atual += 1;
        
    if(atual >= total)
        avancar.style.display = 'none';
    else
        avancar.style.display = 'inline';
        
    if(atual > 1)
        voltar.style.display = 'inline';
    else
        voltar.style.display = 'none';
    
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1').style.display = 'inline';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2').style.display = 'inline';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3').style.display = 'inline';    
        
    document.getElementById(subGaleriaAtual).value = atual;    
}

function voltarSubGaleria(galeriaFoto, subGaleriaAtual, qtTotalSubGaleria, btAvancar, btVoltar)
{
    total = Number(document.getElementById(qtTotalSubGaleria).value);
    atual = Number(document.getElementById(subGaleriaAtual).value);
    avancar = document.getElementById(btAvancar);
    voltar = document.getElementById(btVoltar);
    
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1').style.display = 'none';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2').style.display = 'none';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3').style.display = 'none';   
    
    atual -= 1;
    
    if(atual >= total)
        avancar.style.display = 'none';
    else
        avancar.style.display = 'inline';
        
    if(atual > 1)
        voltar.style.display = 'inline';
    else
        voltar.style.display = 'none';
    
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf1').style.display = 'inline';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf2').style.display = 'inline';
        
    if(document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3') != null)
        document.getElementById(galeriaFoto + '_UCFotos' + atual + '_sf3').style.display = 'inline';      
        
    document.getElementById(subGaleriaAtual).value = atual;  
}

var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10;
    StopTheClock();
    StartTheTimer();
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        document.location = document.location + '&act=1';
    }
    else
    {
        self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout('StartTheTimer()', delay);
    }
}

function Confirmar(texto)
{
    if(confirm(texto))
    {
        return true;
    }
    else
    {
        return false;
    }
}




