//Aqui ficam os scripts gerais para todo o site

var aberto = ""
var paiAberto = ""
function mostraDiv(abreDiv){
	if(aberto.length > 0){
		if(paiAberto != ""){
			document.getElementById(paiAberto).style.backgroundImage = "url(/area_atuacao/images/seta_fechada.gif)";
		}
		esconde_conteudo(aberto);
	}

	aberto = abreDiv;
	paiAberto = "pai_"+abreDiv;
	document.getElementById("pai_"+abreDiv).style.backgroundImage = "url(/area_atuacao/images/seta_aberta.gif)";
	document.getElementById(abreDiv).style.display = "block";
	document.getElementById('scroll').scrollTop = 0 +'px';
}

//Script para o menu interno de Áreas de Atuação
var ultima = "";
function mostra_conteudo(abreDiv){
	if (ultima.length > 0)
		esconde_conteudo(ultima);
		
	ultima = abreDiv;
	document.getElementById(abreDiv).style.display = "block";
	document.getElementById('scroll').scrollTop = 0 +'px';
	links = document.getElementById("menuInterno").getElementsByTagName("li");
	for (x = 0; x < links.length; x++){		
		if(links[x].innerHTML.indexOf(abreDiv) > - 1)
			links[x].firstChild.className = "marcado";
		else
			links[x].firstChild.className = "";
	}	
}

function esconde_conteudo(fechaDiv){
	document.getElementById(fechaDiv).style.display = "none";	
}

//FUNÇÃO PARA OVER DO FORMULARIO
function overForm(){
	elemento = document.form1.elements;	
	for (x = 0; x < elemento.length; x++){		
		elemento[x].onfocus = function(){
			this.style.backgroundColor = "#DADADA";			
		}
		
		elemento[x].onblur = function(){
			this.style.backgroundColor = "#9CBACD";
		}
	}
}

//mostrarConteudo(): torna um conteudo visível
//	- id: id do conteudo a monstrar
function mostrarConteudo(id){			
	document.getElementById(id).style.display = 'block';
}

//esconderConteudo(): esconde um conteudo
//	- id: id do conteudo a esconder
function esconderConteudo(id){
	document.getElementById(id).style.display = 'none';
}

//trocarConteudo(): troca um conteudo visível por outro
//	-id: id do conteudo a trocar
var visivel = '';
function trocarConteudo(id){
	if(visivel.length > 0) 
		esconderConteudo(visivel);
	mostrarConteudo(id);
	visivel = id;
}


/* TIRA A BORDA DOS FLASHS
Copyright 2006 Adobe Systems, Inc. All rights reserved.
Versão compacta, alterada por Renato Herculano
	- src, width e height são obrigatórios
	- os demais parametros são opcionais
*/
function flash(src, width, height, id, flashVars, wmode, menu, scale){
	var ret = GetArgumentos(src, width, height, id, flashVars, wmode, menu, scale);
	var str = '<object ';
	for (var i in ret.objAttrs)
		str += i + '="' + ret.objAttrs[i] + '" ';
		str += '>';
	for (var i in ret.params)
		str += '<param name="' + i + '" value="' + ret.params[i] + '" /> ';
		str += '</object>';
	document.write(str);
}


function GetArgumentos(src, w, h, id, flashVars, wmode, menu, scale){
	var ret = new Object();
	ret.params = new Object();
	ret.objAttrs = new Object();

	ret.objAttrs['data'] = ret.params["movie"] = src;
	ret.objAttrs['width'] = w;
	ret.objAttrs['height'] = h;
	ret.params['quality'] = 'high';
	ret.objAttrs['type'] = 'application/x-shockwave-flash';
	ret.params['menu'] = 'false';
	
	if(id) ret.objAttrs['id'] = id;
	
	if(flashVars) ret.params['flashVars'] = flashVars;
	
	ret.params['wmode'] = (wmode)? wmode : 'transparent';
	ret.params['scale'] = (scale)? scale : 'exactfit';
	ret.params['menu'] = (menu)? menu : 'false';
	
	return ret;
}
