
function menu_over(id){
	document.getElementById(id).className='item_menu_over';
}
function menu_out(id){
	document.getElementById(id).className='item_menu';
}

function votar() {
					var f = document.frm_enquete;
						f.resposta.value = 0;
						if (f.respostaSel.length != undefined) {
							for (var i = 0; i < f.respostaSel.length; i++) {
								if (f.respostaSel[i].checked) { f.resposta.value = f.respostaSel[i].value; }
							}
						} else {
						f.resposta.value = f.respostaSel.value;
						}
					if(f.resposta.value != 0) {
					var resp      = f.resposta.value;
					var ipval     = f.ip_usuario.value;
					var idenquete = f.id_enquete.value;
					var oHTTPRequest = createXMLHTTP();
					divWrite("<br /><br /><img src='img/barra_loading.gif' width='151' height='11' /><br />Aguarde...<br /><br />", "box_enquete");
				    oHTTPRequest.open("post", "vota_enquete.asp", true);
				    oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				    oHTTPRequest.onreadystatechange=function(){
				    if (oHTTPRequest.readyState==4){
				         document.getElementById("box_enquete").innerHTML = oHTTPRequest.responseText;}}
				         oHTTPRequest.send("resposta=" + resp + "&ip_usuario=" + ipval + "&id_enquete=" + idenquete);
					} else {
					alert("Escolha uma resposta!");
					}
} 

	function resultado(idenquete) {
	  var oHTTPRequest = createXMLHTTP();
	  divWrite("<br /><br /><img src='img/barra_loading.gif' width='151' height='11' /><br />Aguarde...<br /><br />", "box_enquete");
	  oHTTPRequest.open("post", "vota_enquete.asp", true);
	  oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	  oHTTPRequest.onreadystatechange=function(){
	  if (oHTTPRequest.readyState==4){
	     document.getElementById("box_enquete").innerHTML = oHTTPRequest.responseText;}}
	  oHTTPRequest.send("resultado=OK&id_enquete=" + idenquete);
}
	
//###############################################################################
//
//
//		INICIO DO MOTION PACK !!!
//
//
//###############################################################################
var timerlen = 5;
var slideAniLen = 250;

var timerID = new Array();
var startTime = new Array();
var obj = new Array();
var endHeight = new Array();
var moving = new Array();
var dir = new Array();

function slidedown(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display != "none")
                return; // cannot slide down something that is already visible

        moving[objname] = true;
        dir[objname] = "down";
        startslide(objname);
}

function slideup(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display == "none")
                return; // cannot slide up something that is already hidden

        moving[objname] = true;
        dir[objname] = "up";
        startslide(objname);
}

function startslide(objname){
        obj[objname] = document.getElementById(objname);

        endHeight[objname] = parseInt(obj[objname].style.height);
        startTime[objname] = (new Date()).getTime();

        if(dir[objname] == "down"){
                obj[objname].style.height = "1px";
        }

        obj[objname].style.display = "block";

        timerID[objname] = setInterval('slidetick(\'' + objname + '\');',timerlen);
}

function slidetick(objname){
        var elapsed = (new Date()).getTime() - startTime[objname];

        if (elapsed > slideAniLen)
                endSlide(objname)
        else {
                var d =Math.round(elapsed / slideAniLen * endHeight[objname]);
                if(dir[objname] == "up")
                        d = endHeight[objname] - d;

                obj[objname].style.height = d + "px";
        }

        return;
}

function endSlide(objname){
        clearInterval(timerID[objname]);

        if(dir[objname] == "up")
                obj[objname].style.display = "none";

        obj[objname].style.height = endHeight[objname] + "px";

        delete(moving[objname]);
        delete(timerID[objname]);
        delete(startTime[objname]);
        delete(endHeight[objname]);
        delete(obj[objname]);
        delete(dir[objname]);

        return;
}

function toggleSlide(objname){
  if(document.getElementById(objname).style.display == "none"){
    slidedown(objname);
  }else{
    slideup(objname);
  }
}
//###############################################################################
//
//
//		FIM DO MOTION PACK !!!
//
//
//###############################################################################

function GerarSWF($arquivo,$largura,$altura,$id,$bg){
    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" />');
    if ($bg=="S") { document.writeln('        <param name="wmode" value="transparent" />'); }
    document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"');
	if ($bg=="S") { document.writeln(' wmode="transparent" '); }
	document.writeln(' 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>');
}

//###############################################################################
//
//
//		PAGINAÇÃO !!!
//
//
//###############################################################################


function navegar(pag) {
		var nPags = parseInt(document.forms[1].nPaginas.value)
		if (pag < 1) { alert('Você já está na primeira página!'); return true }
		if (pag > nPags) { alert('Você já está na última página!'); return true }
		document.forms[1].pagina.value=pag
		document.forms[1].submit()
	}

	function ordenar(f, t) {
		document.forms[1].ordemField.value=f
		document.forms[1].ordemType.value=t
		document.forms[1].submit()
	}
	
//###############################################################################
//
//
//		FIM DA PAGINAÇÃO !!!
//
//
//###############################################################################

//###############################################################################
//
//
//		FUNÇÃO PARA AUMENTAR A FONTE !!!
//
//
//###############################################################################

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'font','div','p','span' );
//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 1;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 4 ) sz = 4;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0; i < tgs.length; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0; j < cTags.length; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}

//###############################################################################
//
//
//		FIM DA FUNÇÃO PARA AUMENTAR A FONTE !!!
//
//
//###############################################################################

function agenda(mesSel,anoSel) {
	
	function CriaArray (n) { 
		this.length = n
	} 

		NomeMes = new CriaArray(12) 
		NomeMes[1] = "Janeiro" 
		NomeMes[2] = "Fevereiro" 
		NomeMes[3] = "Março" 
		NomeMes[4] = "Abril" 
		NomeMes[5] = "Maio" 
		NomeMes[6] = "Junho" 
		NomeMes[7] = "Julho" 
		NomeMes[8] = "Agosto" 
		NomeMes[9] = "Setembro" 
		NomeMes[10] = "Outubro" 
		NomeMes[11] = "Novembro" 
		NomeMes[12] = "Dezembro"
	
	
	var f = document.all;
	if ( parseInt(mesSel)>1 && parseInt(mesSel)<12){
		var mesPassado  = parseInt(mesSel)-1;
		var mesSeguinte = parseInt(mesSel)+1;
		var anoPassado  = parseInt(anoSel);
		var anoSeguinte = parseInt(anoSel);
	}else{
		if ( parseInt(mesSel)==1 ) { 
		var mesPassado  = 12;
		var mesSeguinte = parseInt(mesSel)+1;
		var anoPassado  = parseInt(anoSel)-1;
		var anoSeguinte = parseInt(anoSel);
		}
		
		if ( parseInt(mesSel)==12 ) { 
		var mesSeguinte = 1; 
		var mesPassado  = parseInt(mesSel)-1; 
		var anoPassado  = parseInt(anoSel);
		var anoSeguinte = parseInt(anoSel)+1;
		}
	}
	
	var mesCorrente = mesSel;
	var oHTTPRequest = createXMLHTTP();
	divWrite("<br /><br /><img src='img/barra_loading.gif' width='151' height='11' /><br />Aguarde...<br /><br />", "dias");
	oHTTPRequest.open("post", "monta_agenda.asp", true);
	oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	oHTTPRequest.onreadystatechange=function(){
	if (oHTTPRequest.readyState==4){
		 document.getElementById("dias").innerHTML = oHTTPRequest.responseText;
		 document.getElementById("mes_passado").innerHTML = "<a class=\"lnk_Mais_Noticias\" href=\"javascript:agenda('" + mesPassado + "', '" + anoPassado + "');\">" + NomeMes[mesPassado] + "</a>";
		 document.getElementById("mes_seguinte").innerHTML = "<a class=\"lnk_Mais_Noticias\" href=\"javascript:agenda('" + mesSeguinte + "', '" + anoSeguinte + "');\">" + NomeMes[mesSeguinte] + "</a>";
		 document.getElementById("tit_agenda").innerHTML = "Agenda de Eventos - " + anoSel;
		 document.getElementById("nome_mes_corrente").innerHTML = NomeMes[mesCorrente];
	  }
	 }
	 oHTTPRequest.send("mes_corrente=" + mesSel + "&ano_corrente=" + anoSel);
	
} 
function limpa(form_name) {
	document.getElementById(form_name).reset();	
}
function envia(form_name) {
	document.getElementById(form_name).submit();	
}

function divWrite(text, divDestino) {
		var divMain;
		if (document.getElementById) {
			divMain = document.getElementById(divDestino);
			divMain.innerHTML = text;
		} else if (document.all) {
			divMain = document.all[divDestino];
			divMain.innerHTML = text;
		} else if (document.layers) {
			divMain = document.layers[divDestino];
			divMain.document.open();
			divMain.document.write(text);
			divMain.document.close();
		};
		ExtraiScript(text);
	};

    function ExtraiScript(texto){
        var ini, pos_src, fim, codigo;
        var objScript = null;
        ini = texto.indexOf('<script', 0)
        while (ini!=-1){
            var objScript = document.createElement("script");
            //Busca se tem algum src a partir do inicio do script
            pos_src = texto.indexOf(' src', ini)
            ini = texto.indexOf('>', ini) + 1;

            //Verifica se este e um bloco de script ou include para um arquivo de scripts
            if (pos_src < ini && pos_src >=0){//Se encontrou um "src" dentro da tag script, esta e um include de um arquivo script
                //Marca como sendo o inicio do nome do arquivo para depois do src
                ini = pos_src + 4;
                //Procura pelo ponto do nome da extencao do arquivo e marca para depois dele
                fim = texto.indexOf('.', ini)+4;
                //Pega o nome do arquivo
                codigo = texto.substring(ini,fim);
                //Elimina do nome do arquivo os caracteres que possam ter sido pegos por engano
                codigo = codigo.replace("=","").replace(" ","").replace("\"","").replace("\"","").replace("\'","").replace("\'","").replace(">","");
                // Adiciona o arquivo de script ao objeto que sera adicionado ao documento
                objScript.src = codigo;
            }else{//Se nao encontrou um "src" dentro da tag script, esta e um bloco de codigo script
                // Procura o final do script
                fim = texto.indexOf('</script>', ini);
                // Extrai apenas o script
                codigo = texto.substring(ini,fim);
                // Adiciona o bloco de script ao objeto que sera adicionado ao documento
                objScript.text = codigo;
            }

            //Adiciona o script ao documento
            document.body.appendChild(objScript);
            // Procura a proxima tag de <script
            

            //Limpa o objeto de script
            objScript = null;
        }
}

-->