//CÓDIGO PARA MENU NÃO PISCAR
var timerID = null;
var timerOn = false;
var timecount = 1;

function startTime(combo) {
	if (timerOn == false) {
  	timerID=setTimeout("MM_showHideLayers('" +combo+ "','','hide')" , timecount);
    timerOn = true;
	}
}
function ContaCaracteres(oid,conta_caracteres,max_caracteres){
	// oid = elemento a ser tratado
	// conta_caracteres = campo que mostra o número de caracteres ainda disponíveis
	// max_caracteres ===> número máximo de caracteres permitidos no campo
	intCaracteres = max_caracteres - document.getElementById(oid).value.length;
	if (intCaracteres > 0) {
		document.getElementById(conta_caracteres).value = intCaracteres;
		return true;
	} else {
		document.getElementById(conta_caracteres).value = 0;
		document.getElementById(oid).value = document.getElementById(oid).value.substr(0,max_caracteres);
		return false;
	}
}

function stopTime() {
	if (timerOn) {
  	clearTimeout(timerID);
    timerID = null;
    timerOn = false;
	}
}

function showHideCombo(combo) {
	for (i=0; i<4; i++) {
		combo_aux = 'combo' + i;
		if (combo_aux == combo)
			MM_showHideLayers(combo_aux,'','show');
		else
			MM_showHideLayers(combo_aux,'','hide');
	}
}

function layerShowHideCombo(estilo) {
// Esconde combo que está dentro da div_combo para mostrar os submenus das abas
	try {
		var isIE=document.all?true:false;
		if(!isIE)return; 

		var layerAux = isIE?document.all.div_combo:null;
		layerAux.style.visibility = estilo; 
	}
	catch(e) {
		return;
	}
}	


//JAVASCRIPT USADO PARA ROTINA DE SCROLL DE IMAGENS
function MM_swapImgRestore() { //v3.0
  	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
   	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);

}

function abre(linkurl,w,h){
	window.status = "AGUARDE, ABRINDO JANELA...";
	window.open(linkurl,"linkurl","width="+w+",height="+h+",scrollbars=auto");
	window.status = "";
}
function abreMapa(linkurl,w,h){
	window.open(linkurl,"linkurl","width="+w+",height="+h+",scrollbars=yes,top=98, left=144");
}

function AgendaPopUp(url,nome){
	window.open(url,nome,"scrollbars=yes,width=480,height=350");
}

//FUNÇÃO PARA ABRIR JANELAS DE EXIBIÇÃO DE IMAGENS :MARCELO
function OpenWin(img,w,h){
	window.status="AGUARDE, CARREGANDO IMAGEM";
	if(w > 800 && h > 600){
		if(w / 800 > h / 600){h = h / w * 800; w = 800;}else{w = w / h * 600; h = 600}
	}else if(w < 800 && h > 600){
		w = w / h * 600; h = 600;
	}else if(w > 800 && h < 600){
		h = h / w * 800; w = 800;
	}
	var x = (window.screen.availWidth - w) / 2;
	var y = (window.screen.availHeight - h) / 2;

	w = parseInt(w,10); h = parseInt(h,10);
	x = parseInt(x,10); y = parseInt(y,10);

	var win = window.open("","ViewImg","scrollbars,height="+h+",width="+w+",left="+x+",top="+y);
	win.document.open();
	win.document.write("<html><head><title>Imagens</title></head><body style='margin:0px' ");
	win.document.write("bgcolor='white'><a align='center' href='javascript:window.close()'>");
	win.document.write("<img height='"+h+"' width='"+(w-20)+"' src='"+img+"' border='0'>");
	win.document.write("</a><br></body></html>");
	win.document.close();
	window.status="";
}




//FUNÇÃO PARA ABRIR JANELAS DE EXIBIÇÃO DE IMAGENS
function OpenWin_capa(img,w,h){
	window.status="AGUARDE, CARREGANDO IMAGEM";
	if(w > 800 && h > 600){
		if(w / 800 > h / 600){h = h / w * 800; w = 800;}else{w = w / h * 600; h = 600}
	}else if(w < 800 && h > 600){
		w = w / h * 600; h = 600;
	}else if(w > 800 && h < 600){
		h = h / w * 800; w = 800;
	}
	var x = (window.screen.availWidth - w) / 2;
	var y = (window.screen.availHeight - h) / 2;

	w = parseInt(w,10); h = parseInt(h,10);
	x = parseInt(x,10); y = parseInt(y,10);

	var win = window.open("","ViewImg","scrollbars,height="+h+",width="+w+",left="+x+",top="+y);
	win.document.open();
	win.document.write("<html><head><title>Imagens</title></head><body style='margin:0px' ");
	win.document.write("bgcolor='white'><a align='center' href='javascript:window.close()'>");
	win.document.write("<img src='"+img+"' border='0'>");
	win.document.write("</a><br></body></html>");
	win.document.close();
	window.status="";
}

function VerImagem(img,w,h,titulo,descricao,imagemdownload,ft){
	window.status="Aguarde, carregando imagem";
	h=h+30;
	if(h>520)
		h = 520;

	var win = window.open("","ViewImg","scrollbars=yes,height="+h+",width="+w);
	win.document.open();


	win.document.write("<html><head>");
	
	win.document.write('<sc'+'ript language="javaScript">');
	win.document.write('function vaiDown() {');
	win.document.write("window.opener.parent.conteudo.contaVimag('Download Fotos');");
	win.document.write('}');
	win.document.write('</scr'+'ipt>');
			
	win.document.write('<link rel="STYLESHEET" type="text/css" href="estilos.css">');
	win.document.write("<title>Fotografias</title></head>\n");

	win.document.write('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="imagens/img_07d.gif" vlink="#018531">\n ');
	win.document.write('');

	win.document.write("<p align='right' onclick='vaiDown()' class='busca'><br>[<a href='governo/download.php?arq=" + imagemdownload + "'>");
	win.document.write(" Executar download desta imagem</a> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>");

	
	win.document.write("<center><img src='"+img+"' border=0>");
	win.document.write("<table border='0' width='100%'>");


	win.document.write('<tr><td  align="right" class="busca">');
	win.document.write("</td></tr>");

	win.document.write("<tr><td class='titulo02'>"+titulo+"</td></tr>");
	win.document.write("<tr><td class='resumo'>"+descricao+"</td></tr></table></center>");
	win.document.write("</body></html>");
	win.document.close();
	window.status="";
}

// ===========================================================================
// Função para exibir imagem para ser utilizada no link no recurso Multimeios
// ===========================================================================
// Parâmetros: - cod_noticia
//             - imagem: se deve ser utilizado o campo imagem, ou ser realizado 
//                       um select em cod_foto (0 - false,1 - true)
function exibirImagemMultiMeios(cod_noticia,imagem){
	window.status="Aguarde, carregando imagem";
	
	var win = window.open("noticias/exibe_imagem.php?cod_noticia=" + cod_noticia + "&exibir_imagem_detalhes=" + imagem,"JExibirImagem","scrollbars=yes,toolbar=no,menubar=no");
	
	window.status="";
}

//FUNCAO QUE SUBMETE UM ARQUIVO DE UM COMBO A UMA NOVA JANELA: GUSTAVO
function OpenNewWindow(obj){
	var idx = obj.selectedIndex;
	if(idx!=0 && obj.options[idx].value!="")
		window.open(obj.options[idx].value);
}

// Função que verifica a existência de comandos como:
// <script>, <iframe>, etc no conteúdo
function checkHTMLCommands(texto){
var comandos = new Array("</script>","</iframe>","<script>","<iframe>");
var texto2 = texto;        
var existe = false;
var i = 0;

// Retira os espaços em branco
for (i = 0; i < texto2.length-1; i++) {
   texto2 = texto2.replace(" ","");
}

texto2 = texto2.toLowerCase();

// Verifica se existe algum comando da lista no 
// texto
for (i = 0; i < comandos.length-1; i++) {
   if (texto2.indexOf(comandos[i]) >= 0) {
     existe = true;
     break;
   }  
}

return existe;
}

// CÓDIGO ESPECÍFICO PARA O MENU DINÂMICO (NÃO ALTERAR)
// RESP. Marcelo S. Pereira
/*
var MSP_flag = false;
HM_PG_MenuWidth = 160;
HM_PG_FontFamily = "Verdana,Tahoma,Arial,sans-serif";
HM_PG_FontSize = 8;
HM_PG_FontBold = false;
HM_PG_FontItalic = 0;
HM_PG_FontColor = "white";
HM_PG_FontColorOver = "black";
HM_PG_BGColor = "#006699";
HM_PG_BGColorOver = "#ff9900";
HM_PG_ItemPadding = 4;

HM_PG_BorderWidth = 1;
HM_PG_BorderColor = "#ff9900";
HM_PG_BorderStyle = "solid";
HM_PG_SeparatorSize = 1;
HM_PG_SeparatorColor = "#ff9900";

HM_PG_ImageSrc = "funcoes/menu/HM_More_white_right.gif";
HM_PG_ImageSrcLeft = "funcoes/menu/HM_More_white_left.gif";
HM_PG_ImageSrcOver = "funcoes/menu/HM_More_black_right.gif";
HM_PG_ImageSrcLeftOver = "funcoes/menu/HM_More_black_left.gif";
HM_PG_ImageSize = 5;
HM_PG_ImageHorizSpace = 0;
HM_PG_ImageVertSpace = 2;

HM_PG_KeepHilite = true; 
HM_PG_ClickStart = 0;
HM_PG_ClickKill = false;
HM_PG_ChildOverlap = 0;
HM_PG_ChildOffset = 0;
HM_PG_ChildPerCentOver = null;
HM_PG_TopSecondsVisible = .5;
HM_PG_StatusDisplayBuild = 0;
HM_PG_StatusDisplayLink = 0;
HM_PG_UponDisplay = null;
HM_PG_UponHide = null;
HM_PG_RightToLeft = 0;

HM_PG_CreateTopOnly = 0;
HM_PG_ShowLinkCursor = 1;
HM_PG_NSFontOver = true;

HM_PG_ScrollEnabled = true;
HM_PG_ScrollBarHeight = 14;
HM_PG_ScrollBarColor = "#009da4";
HM_PG_ScrollImgSrcTop = "funcoes/menu/HM_More_white_top.gif";
HM_PG_ScrollImgSrcBot = "funcoes/menu/HM_More_white_bot.gif";
HM_PG_ScrollImgWidth = 9;
HM_PG_ScrollImgHeight = 5;

//HM_a_TreesToBuild = [3];
if(document.location.href.indexOf("principal.php")!=-1)
	document.write("<SCR"+"IPT LANGUAGE='JavaScript' SRC='funcoes/menu/HM_especial.js' TYPE='text/javascript'></SCR"+"IPT>");

//CÓDIGO PARA O MENU DINÂMICO
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};
popUp = HM_f_PopUp;
popDown = HM_f_PopDown;
	
*/




