/*FAQ*/
function applySelectedTo(link, abrir) {
	var ul = document.getElementById("sanfona"); // get the first ul tag on the page
	var allLinks = ul.getElementsByTagName("h3"); // get all the links within that ul
	
	for (var i=0; i<allLinks.length; i++) { // iterate through all those links
		allLinks[i].className = ""; // and assign their class names to nothing
		document.getElementById(allLinks[i].lang).style.display='none';
	}
	link.className = "ativo";  // finally, assign class="selected" to our chosen link
	document.getElementById(abrir).style.display='';
}
/*FAQ - Fim*/

/*Favoritos*/
function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}else if(document.all)// ie
		window.external.AddFavorite(url, title);
}
/*Favoritos - Fim*/

/*Voltar ao Topo*/
function scrollTop() {
	window.scroll(0,0); 
}
/*Voltar ao Topo - Fim*/

/*Voltar*/
function voltaBack() {
	history.back();
}
/*Voltar - Fim*/

/*Modulo Indique*/
ModuloIndique = function (pagina) {
	if (typeof pagina == 'undefined') pagina = '';
	novoBox('modulos/indique/cadIndique.php?pagina='+escape(pagina), '', 400, 320);	
}
/*Modulo Indique - Fim*/

/*Aumentar Fonte*/
// Para usar coloque o comando: "javascript:mudaTamanho('tag_ou_id_alvo', -1);" para diminuir
// e o comando "javascript:mudaTamanho('tag_ou_id_alvo', +1);" para aumentar
 
// Especificando os possíveis tamanhos de fontes, poderia ser: x-small, small...
var tamanhos = new Array( '120%','130%','140%','150%','160%','170%' );
var tamanhoInicial = 0;
 
function mudaTamanho( idAlvo,acao ){
  if (!document.getElementById) return
  var selecionados = null,tamanho = tamanhoInicial,i,j,tagsAlvo;
  tamanho += acao;
  if ( tamanho < 0 ) tamanho = 0;
  if ( tamanho > 4 ) tamanho = 4;
  tamanhoInicial = tamanho;
  if ( !( selecionados = document.getElementById( idAlvo ) ) ) selecionados = document.getElementsByTagName( idAlvo )[ 0 ];
  
	dives	= document.getElementsByTagName('div');
	for (i=0;i<dives.length;i++)  {
		if (dives[i].id==idAlvo)  {
			dives[i].style.fontSize = tamanhos[ tamanho ];
		}
	}
}
/*Aumentar Fonte - Fim*/

/*Botão Ativo*/
function botaoAtivo(ativo) {
	
	// CONTROLE DOS BOTÕES
	var num_botoes = document.getElementsByName("menu_top").length;
	for (i = 0; i < num_botoes; i++){
		if (ativo == document.getElementsByName("menu_top")[i].id)
			document.getElementsByName("menu_top")[i].className = 'ativo';
		else
			document.getElementsByName("menu_top")[i].className = '';
	}
	
}
/*Botão Ativo - Fim*/

function muda_mascara(valor){
	if(valor == 1){ // Pessoa Física
		document.getElementById('nn_descpfcnpj').setAttribute("onkeypress","maskIt(this,event,'###.###.###-##')");
		document.getElementById('nn_descpfcnpj').setAttribute("onkeyup","maskIt(this,event,'###.###.###-##')");
		document.getElementById('nn_descpfcnpj').setAttribute("maxlength","14");
		document.getElementById('nn_descpfcnpj').select();
	} else if(valor == 2){ // Pessoa Jurídica
		document.getElementById('nn_descpfcnpj').setAttribute("onkeypress","maskIt(this,event,'##.###.###/####-##')");
		document.getElementById('nn_descpfcnpj').setAttribute("onkeyup","maskIt(this,event,'##.###.###/####-##')");
		document.getElementById('nn_descpfcnpj').setAttribute("maxlength","18");
		document.getElementById('nn_descpfcnpj').select();
	} else {
		document.getElementById('nn_descpfcnpj').setAttribute("onkeypress","");
		document.getElementById('nn_descpfcnpj').setAttribute("onkeyup","");
		document.getElementById('nn_descpfcnpj').setAttribute("maxlength","60");
		document.getElementById('nn_descpfcnpj').select();
	}
}
