function toId(S)
{
var S=S.toLowerCase()
S=S.replace(/[áàãâä]/g,'a')
S=S.replace(/[éèêë&]/g,'e')
S=S.replace(/[íìîï]/g,'i')
S=S.replace(/[óòõôö]/g,'o')
S=S.replace(/[úùûü]/g,'u')
S=S.replace(/[ç]/g,'c')
for(var i=0;i<S.length;i++){if(' _0123456789abcdefghijklmnopqrstuvwxyz'.indexOf(S.charAt(i))==-1)S=S.replace(S.charAt(i),' ')}
S=S.replace(/[ ]/g,'')
S=S.replace(/[.]/g,'')
return S
}


function trocaID(target,menu)
{
	if(target.className == 'menu-'+menu+'-off') target.className = 'menu-'+menu+'-over';
	else target.className = 'menu-'+menu+'-off'
}

function navega(target,local)
{
	if(document.getElementById('submenu-'+target))
	{
		if(document.getElementById('submenu-'+target).style.display == 'block') document.getElementById('submenu-'+target).style.display = 'none';
		else document.getElementById('submenu-'+target).style.display = 'block';
	} else {
		var strend = location.href;
		var registros;
        registros = strend.search("c");
		//alert(registros)
		if(local == "home"){
		location.href = '/site_novo/content/'+target;
		}else{
		location.href = '/site_novo/content/'+target;
		}
	}
	
}

// PRESS RELEASE
function PressReleaseNews()
{
	document.getElementById('prForm').style.display = 'block';
	document.getElementById('prClick').style.display = 'none';
}

// DOWNLOAD
function ShowWallSample(source)
{
	document.getElementById('wallsample').innerHTML = '<img src="img/'+source+'.jpg" width="363" height="272" alt="Pré-Visualização" alt="Pré-Visualização" border="0" />'
}

// EXTRANET
function postit(f)
{
	var mycookie="BAPIUID=" + ch.U.value + "; PATH=/";
	document.cookie=mycookie;
	f.submit();
}

// LINHA DO TEMPO
function EscondeLinha()
{
	for (i in linha)
	{
		var linhaSplited = linha[i].split("|");
		eval("anoTarget = 'ano"+linhaSplited[0]+"'");
		document.getElementById(anoTarget).style.display = 'none';
		
		eval("setaTarget = 'seta"+linhaSplited[0]+"'");
		document.getElementById(setaTarget).className = 'box-bullet';
	}
}

function MontaLinha()
{
	for (i in linha)
	{
		var linhaSplited = linha[i].split("|");
		document.write('<div id="seta'+linhaSplited[0]+'" class="box-bullet"><a href="javascript:MostraLinha(\'seta'+linhaSplited[0]+'\',\'ano'+linhaSplited[0]+'\')">'+linhaSplited[0]+'</a></div>');
		document.write('<div id="ano'+linhaSplited[0]+'" class="linhadotempo-info">'+linhaSplited[1]+'</div>');
	}
	EscondeLinha();	
}

function MostraLinha(seta,ano)
{
	if(document.getElementById(ano).style.display != 'block')
	{ 
		EscondeLinha();
		document.getElementById(ano).style.display = 'block';
		document.getElementById(seta).className = 'box-bullet-baixo';
	} else {
		document.getElementById(seta).className = 'box-bullet';
		document.getElementById(ano).style.display = 'none';
	}
}

/* DÚVIDAS FREQÜENTES */

function EscondeDuvidas()
{
	for (i in Duvidas)
	{
		eval("Target = '"+toId(Duvidas[i])+"'");
		document.getElementById(Target).style.display = 'none';
		
		eval("setaTarget = 'seta"+toId(Duvidas[i])+"'");
		document.getElementById(setaTarget).className = 'box-bullet-dark';
	}
}

function MontaDuvidas()
{
	for (i in Duvidas)
	{
		document.write('<div id="seta'+toId(Duvidas[i])+'" class="box-bullet-dark"><a href="javascript:MostraDuvidas(\'seta'+toId(Duvidas[i])+'\',\''+toId(Duvidas[i])+'\')"><strong>'+Duvidas[i]+'</strong></a></div>');
		document.write('<div id="'+toId(Duvidas[i])+'" class="box-bullet-dark"><a href="javascript:MostraDuvidas(\'seta'+toId(Duvidas[i])+'\',\''+toId(Duvidas[i])+'\')"><strong>'+Duvidas[i]+'</strong></a></div>');
	}
	EscondeDuvidas();	
}

function MostraDuvidas(seta,tgt)
{
	if(document.getElementById(tgt).style.display != 'block')
	{ 
		EscondeDuvidas();
		document.getElementById(tgt).style.display = 'block';
		document.getElementById(seta).className = 'box-bullet-dark-baixo';
	} else {
		document.getElementById(seta).className = 'box-bullet-dark';
		document.getElementById(tgt).style.display = 'none';
	}
	
	eval("target = '"+tgt+"Conteudo'");
	var Conteudo = document.getElementById(target).innerHTML
	document.getElementById(tgt).innerHTML = Conteudo;
	
}

// DIRETRIZES
function EscondeDiretrizes()
{
	for (i in Diretrizes)
	{
		var DiretrizesSplited = Diretrizes[i].split("|");
		eval("anoTarget = 'ano"+DiretrizesSplited[0]+"'");
		document.getElementById(anoTarget).style.display = 'none';
		
		eval("setaTarget = 'seta"+DiretrizesSplited[0]+"'");
		document.getElementById(setaTarget).className = 'box-bullet';
	}
}

function MontaDiretrizes()
{
	for (i in Diretrizes)
	{
		var DiretrizesSplited = Diretrizes[i].split("|");
		document.write('<div id="seta'+DiretrizesSplited[0]+'" class="box-bullet"><a href="javascript:MostraDiretrizes(\'seta'+DiretrizesSplited[0]+'\',\'ano'+DiretrizesSplited[0]+'\')">'+DiretrizesSplited[0]+'</a></div>');
		document.write('<div id="ano'+DiretrizesSplited[0]+'" class="linhadotempo-info">'+DiretrizesSplited[1]+'</div>');
	}
	EscondeDiretrizes();	
}

function MostraDiretrizes(seta,ano)
{
	if(document.getElementById(ano).style.display != 'block')
	{ 
		EscondeDiretrizes();
		document.getElementById(ano).style.display = 'block';
		document.getElementById(seta).className = 'box-bullet-baixo';
	} else {
		document.getElementById(seta).className = 'box-bullet';
		document.getElementById(ano).style.display = 'none';
	}
}



/* PRODUTOS */
function ShowProduto(target)
{

	if(document.getElementById(target).style.display == 'block')
	{
		document.getElementById(target).style.display = 'none';
	} else {
		document.getElementById('dadosTec').style.display = 'none';
		document.getElementById('atributos').style.display = 'none';
		document.getElementById(target).style.display = 'block';		
	}
}

/* DÚVIDAS FREQÜENTES */

function EscondeProdutos()
{
	for (i in Produtos)
	{
		eval("Target = '"+toId(Produtos[i])+"'");
		document.getElementById(Target).style.display = 'none';
		
		eval("setaTarget = 'seta"+toId(Produtos[i])+"'");
		document.getElementById(setaTarget).className = 'box-bullet';
	}
}

function MontaProdutos()
{
	for (i in Produtos)
	{
		document.write('<div id="seta'+toId(Produtos[i])+'" class="box-bullet-dark"><a href="javascript:MostraProdutos(\'seta'+toId(Produtos[i])+'\',\''+toId(Produtos[i])+'\')"><strong>'+Produtos[i]+'</strong></a></div>');
		document.write('<div id="'+toId(Produtos[i])+'"></div>');
	}
	EscondeProdutos();	
}

function MostraProdutos(seta,tgt)
{
	if(document.getElementById(tgt).style.display != 'block')
	{ 
		EscondeProdutos();
		document.getElementById(tgt).style.display = 'block';
		document.getElementById(seta).className = 'box-bullet-baixo';
	} else {
		document.getElementById(seta).className = 'box-bullet';
		document.getElementById(tgt).style.display = 'none';
	}
	
	eval("target = '"+tgt+"Conteudo'");
	var Conteudo = document.getElementById(target).innerHTML
	document.getElementById(tgt).innerHTML = Conteudo;
	
}

/* TRABALHE CONOSCO */
function ShowForm(target)
{

	if(document.getElementById('CV'+target).style.display == 'block')
	{
		document.getElementById('CV'+target).style.display = 'none';
		document.getElementById('SETA'+target).className = 'box-bullet';
	} else {
	
		document.getElementById('CVdadospessoais').style.display = 'none';
		document.getElementById('CVendereco').style.display = 'none';
		document.getElementById('CVinteresse').style.display = 'none';
		document.getElementById('CVescolaridade').style.display = 'none';
		document.getElementById('CVidiomas').style.display = 'none';
		document.getElementById('CVinformatica').style.display = 'none';
		document.getElementById('CVexperiencias').style.display = 'none';
		document.getElementById('CVoutroscursos').style.display = 'none';
		document.getElementById('SETAdadospessoais').className = 'box-bullet';
		document.getElementById('SETAendereco').className = 'box-bullet';
		document.getElementById('SETAinteresse').className = 'box-bullet';
		document.getElementById('SETAescolaridade').className = 'box-bullet';
		document.getElementById('SETAidiomas').className = 'box-bullet';
		document.getElementById('SETAinformatica').className = 'box-bullet';
		document.getElementById('SETAexperiencias').className = 'box-bullet';
		document.getElementById('SETAoutroscursos').className = 'box-bullet';
		document.getElementById('SETA'+target).className = 'box-bullet-baixo';
		document.getElementById('CV'+target).style.display = 'block';
		location.href = '#'+target;
	}
}

// INITS
function Empresa()
{
	document.getElementById('submenu-empresa').style.display = 'block'
}

function Produtos()
{
	document.getElementById('submenu-produtos').style.display = 'block'
}


function Contato()
{
	document.getElementById('submenu-contato').style.display = 'block'
}


// REVENDAS
function FillIframe(estado)
	
{
	document.getElementById('revendasIframe').src = "revendas_busca.asp?Estado="+estado;
}

// PRODUTOS

function submitSelect(form)
{
var onde = form.selectedIndex
if (form.options[onde].value != 1)
window.open(form.options[onde].value,"_top")
}

function ShowEndereco(pais)
{
	paisID = toId(pais);
	var HTML = document.getElementById(paisID).innerHTML;
	document.getElementById('enderecoBox').innerHTML = HTML;
	document.getElementById('migalhaAtual').innerHTML = pais;
}

function Show(target)
{
	if(document.getElementById(target).style.display == 'block') document.getElementById(target).style.display = 'none';
	else document.getElementById(target).style.display = 'block';

}

function Hide(target)
{
	if(document.getElementById(target).style.display == 'none') document.getElementById(target).style.display = 'block';
	else document.getElementById(target).style.display = 'none';
}

function NewWindow(file)
{
	window.open(file);
}

function Enviar(form)
{
	checkForm(form);
}

function popupCentered(mypage,myname,w,h,features) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	var win = window.open(mypage,myname,settings);
	win.window.focus();
}
