//====================================================================================================
// FUNCAO PARA ADICIONAR ENDEREÇO AO FAVORITOS
//====================================================================================================
	function AddFavoritos()
	{
		if(navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3.0)
			alert('Pressione <CRTL>+D para adicionar ao favoritos');
		else
			window.external.AddFavorite("http://www.gestorpublico.com");
	}

//====================================================================================================
// FUNCAO PARA EXIBIR MENU
//====================================================================================================
	function fu_showMenu(opcao,menu)
	{
		menu.style.top = 151 + opcao.scrollHeight;
		menu.style.left = opcao.offsetLeft;
		menu.style.visibility = "visible";
	}

//====================================================================================================
// FUNCAO PARA EXIBIR SUBMENU
//====================================================================================================
	function fu_showSubMenu(opcao,menu,cel)
	{
		menu.style.top = opcao.offsetTop + cel.offsetTop;
		var_top = menu.offsetHeight + (menu.offsetTop + opcao.offsetTop + 30);
		if (var_top > screen.availHeight)
		{
			menu.style.top = parseInt(menu.style.top) - (var_top - screen.availHeight);
		}				
		menu.style.left = opcao.offsetLeft + 140;
		menu.style.visibility = "visible";
	}

//====================================================================================================
// FUNCAO PARA OCULTAR MENUS
//====================================================================================================
	function fu_hideMenu()
	{
		mnu1.style.visibility = "hidden";
		mnu2.style.visibility = "hidden";
		mnu3.style.visibility = "hidden";
		mnu4.style.visibility = "hidden";
		mnu5.style.visibility = "hidden";
		mnu6.style.visibility = "hidden";
		mnu7.style.visibility = "hidden";
		mnu8.style.visibility = "hidden";
		mnu9.style.visibility = "hidden";
		mnu11.style.visibility = "hidden";
		mnu12.style.visibility = "hidden";
		mnu13.style.visibility = "hidden";
		mnu14.style.visibility = "hidden";
		mnu15.style.visibility = "hidden";
		mnu16.style.visibility = "hidden";
		mnu17.style.visibility = "hidden";
		mnu18.style.visibility = "hidden";
		mnu19.style.visibility = "hidden";
		mnu20.style.visibility = "hidden";
	}
			
//====================================================================================================
// FUNCAO PARA MODIFICAR COR DE OBJETOS
//====================================================================================================
	function fu_changeColor(cel,link,cor)
	{
		if (cor == 1)
		{
			cel.bgColor = "#FFFFFF";
			link.style.color = "#3000FF";
			cel.style.border = "solid 1px #3000FF";
		}
		else
		{
			cel.bgColor = "#FFFFFF";
			link.style.color = "#29166F";
			cel.style.border = "solid 1px #29166F";
		}
	}
			
//====================================================================================================
// FUNCAO PARA MODIFICAR SETAS NO MENU
//====================================================================================================
	function fu_changeSeta(seta,acao)
	{
		if (acao == 1)
		{
			seta.src = "../images/seta1.gif";
		}
		else
		{
			seta.src = "../images/seta1.gif";
		}
				
	}

//====================================================================================================
// FUNCAO PARA ABRIR JANELA POPUP
//====================================================================================================
	function fu_PopUp(pagina)
	{
		comp = (screen.width - 700) / 2;
		alt = (screen.height - 500) / 2;
		configurar="toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes,resizable=no,width=700,height=400,top=" + alt + ",left=" + comp;
		detalhe = window.open(pagina,"",configurar);
	}
	
function popimg(pagina,wd,ht)
	{
		comp = (screen.width - 700) / 2;
		alt = (screen.height - 500) / 2;
		configurar="toolbar=no,location=no,status=no,menubar=yes,scrollbars=no,resizable=no,width=" + wd + ",height=" + ht + ",top=" + alt + ",left=" + comp;
		detalhe = window.open(pagina,"",configurar);
	}

function fu_PopUp47(pagina)
	{
		comp = (screen.width - 780) / 2;
		alt = (screen.height - 500) / 2;
		configurar="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=400,top=" + alt + ",left=" + comp;
		detalhe = window.open(pagina,"",configurar);
	}

//====================================================================================================
// FUNCAO PARA MUDAR FOCO DE OBJETOS AUTOMATICAMENTE
//====================================================================================================
	function fu_mudar_foco(valor,comp,campo)
	{
		if (valor == comp)
		{
			campo.focus();
		}
	}

//====================================================================================================
// FUNCAO PARA VALIDAR CARACTERES
//====================================================================================================
	function fu_ver_char(valor,campo)
	{
		//alert (campo.value);
		// pega a posição atual do caracter dentro do array
		for ( vlcont = 0 ; vlcont <= 20 ; vlcont++ )
		{
			if (valor.charAt(vlcont) == "")
			{
				var vlposatual = vlcont-1;
				break;
			}
		}
		var vlchar = valor.charAt(vlposatual);						// pega caracter digitado
		var vaaux1 = ( (vlchar >= "0") && (vlchar <= "9") );    // define range de valores permitidos

		// se não estiver dentro do range de valores permitidos
		if( ! vaaux1 )
		{
			var vlnewchar = ""

			// guarda os valores validos que foram digitados
			for ( vlcont = 0 ; vlcont <= vlposatual ; vlcont++ )
			{
				if ( vlcont != vlposatual )
				{
					vlnewchar = vlnewchar + valor.charAt(vlcont);
				}
			}
				
			campo.value = vlnewchar;
				
			return false;
		}
		return true;
	}

//====================================================================================================
// FUNCAO PARA PESQUISAR TEXTOS NO SITE
//====================================================================================================
	function fu_Pesquisar()
	{
		if (document.all.txt_search.value.length == 0)
		{
			alert("Para realizar a pesquisa, digite o texto a ser procurado!");
			document.all.txt_search.focus();
		}
		else
		{
			document.location = "../asp/pesquisa.asp?criterio=" + document.all.txt_search.value;
		}
	}

//====================================================================================================
// FUNCAO PARA POSICIONAR OS BANNERS
//====================================================================================================

	var currentY = 0;
	var lastScrollY = 0;
	var moveY = true;
	var diffRod = 340; //USADO PARA POSICIONAR O ELEMENTO ACIMA DO RODAPE
	var diffTop = 155; //USADO PARA POSICIONAR O ELEMENTO ABAIXO DO TOPO

	function fu_PosicionaBanners()
	{
		diffY = document.body.scrollTop;
		totY = document.body.scrollHeight - diffTop;
			
		if((diffY != lastScrollY) && moveY)
		{
			percent = .1 * (diffY - lastScrollY);
			percent = (percent > 0) ? Math.ceil(percent) : Math.floor(percent);

			if((Banners.style.pixelTop + percent + diffRod) <= totY)
			{
				Banners.style.pixelTop += percent;
				lastScrollY += percent;
			}
		}
	}
//

// Limitando o nº de caracteres em um campo de texto (textarea)
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
