/*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
	var isAberto = (document.getElementById(abrir).style.display == '');

	for (var i=0; i<allLinks.length; i++) { // iterate through all those links
		allLinks[i].className = ""; // and assign their class names to nothing
		if(allLinks[i].lang != ''){
			document.getElementById(allLinks[i].lang).style.display='none';
		}
	}
	if (!isAberto){
		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*/

/*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 = '';
	}

	// CONTROLE DOS BANNERS

//	var banner_index	= document.getElementById('banner_home');
	//var banner_home		= document.getElementById('banner_internas');


//	banner_index.style.display = (ativo == "btn_0")?'block':'none';
//	banner_home.style.display  = (ativo != "btn_0")?'block':'none';
}
/*Botão Ativo - 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( '100%','110%','120%','130%','140%','150%' );
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*/

function barraLateral(ativo){
	if(ativo == 'S'){
		document.getElementById('conteudo_lateral').style.display = '';
	} else {
		document.getElementById('conteudo_lateral').style.display = 'none';
	}
}

/* CAD_CURRICULO */
var GTR_CAD_CURRICULO_ABA_ATIVA = 1;
function ativaAbaCuriculo(tab_id, valida) {
	if (typeof valida == 'undefined') valida = true;

	if (valida && !ativaAbaCuriculo(GTR_CAD_CURRICULO_ABA_ATIVA)) {
		return false;
	}

	GTR_CAD_CURRICULO_ABA_ATIVA = parseInt(tab_id.replace('tab_step', ''));

	var tabs = document.getElementById('abas').getElementsByTagName("a");
	var tab_conteudo_id;
	for(var i = 0; i < tabs.length; i++) {
		var tab = tabs[i];
		if (HasClassName(tab, "ativo")) {
			RemoveClassName(tab, "ativo");
			tab_conteudo_id = tab.id.substr(4,5);
			document.getElementById(tab_conteudo_id).style.display = "none";
		}
	}

	var tab_ativa = document.getElementById(tab_id);
	AddClassName(tab_ativa, "ativo");
	tab_conteudo_id = tab_ativa.id.substr(4,5);
	document.getElementById(tab_conteudo_id).style.display = "block";
	parent.scrollTop();

	return false;
}

function validaAbaCurriculo(tab_id){
	if (tab_id == 1){
		return validaAbaNum1Curriculo();
	}
	if (tab_id == 2){
		return validaAbaNum2Curriculo();
	}

	if (tab_id == 3){
		return validaAbaNum3Curriculo();
	}

	if (tab_id == 4){
		return validaAbaNum4Curriculo();
	}

	return true;
}

function ValidaCadCurriculo(){
	if (validaAbaNum1Curriculo() == false){
		ativaAbaCuriculo('tab_step1', false);
		return false;
	}
	if (validaAbaNum2Curriculo() == false){
		ativaAbaCuriculo('tab_step2', false);
		return false;
	}
	if (validaAbaNum3Curriculo() == false){
		ativaAbaCuriculo('tab_step3', false);
		return false;
	}
	if (validaAbaNum4Curriculo() == false){
		ativaAbaCuriculo('tab_step4', false);
		return false;
	}

	return true;
}

function validaAbaNum1Curriculo(){
	var form						= document.getElementById('formulario0');
	var nn_desnome					= form.nn_desnome.value;
	var nn_datnascimento_Dia		= form.nn_datnascimento_Dia.value;
	var nn_datnascimento_Mes		= form.nn_datnascimento_Mes.value;
	var nn_datnascimento_Ano		= form.nn_datnascimento_Ano.value;
	var nn_codcurriculo_estadocivil	= form.nn_codcurriculo_estadocivil.value;
	var nn_desprofissao_conjuge		= form.nn_desprofissao_conjuge.value;
	//var nn_desnome_mae				= form.nn_desnome_mae.value;
	//var nn_desnome_pai				= form.nn_desnome_pai.value;
	var nn_sonfilho					= form.nn_sonfilho.value;
	var nn_intqtdefilho				= form.nn_intqtdefilho.value;
	var nn_desnaturalidade			= form.nn_desnaturalidade.value;
	//var nn_desrg					= form.nn_desrg.value;
	//var nn_datrgexpedicao_Dia		= form.nn_datrgexpedicao_Dia.value;
	//var nn_datrgexpedicao_Mes		= form.nn_datrgexpedicao_Mes.value;
	//var nn_datrgexpedicao_Ano		= form.nn_datrgexpedicao_Ano.value;
	//var nn_cpfcpf					= form.nn_cpfcpf.value;
	//var nn_codcurriculo_habilitacao	= form.nn_codcurriculo_habilitacao.value;
	var nn_desendereco				= form.nn_desendereco.value;
	var nn_cepcep					= form.nn_cepcep.value;
	var nn_codpais					= form.nn_codpais.value;
	var nu_codestado				= form.nu_codestado.value;
	var nu_codcidade				= form.nu_codcidade.value;
	var nu_desestado_out			= form.nu_desestado_out.value;
	var nu_descidade_out			= form.nu_descidade_out.value;
	var nn_sonmudarcidade			= form.nn_sonmudarcidade.value;
	var nn_emlemail					= form.nn_emlemail.value;
	var nn_dessenha					= form.nn_dessenha.value;
	var nn_dessenha_conf			= form.nn_dessenha_conf.value;

	if (nn_desnome == ''){
		alert('Preencha o Nome Completo!');
		return false;
	}

	if (TestaDataDividida(form.nn_datnascimento_Dia, form.nn_datnascimento_Mes, form.nn_datnascimento_Ano, "Data de Nascimento") == false){
		return false;
	}

	if (nn_codcurriculo_estadocivil == ''){
		alert('Preencha o Estado Civil!');
		return false;
	}
	/*
	if (nn_desnome_mae == ''){
		alert('Preencha o Nome da Mãe!');
		return false;
	}

	if (nn_desnome_pai == ''){
		alert('Preencha o Nome do Pai!');
		return false;
	}
	*/
	if (nn_desprofissao_conjuge == ''){
		alert('Preencha a Profissão do Conjuge!');
		return false;
	}
	if (nn_sonfilho == ''){
		alert('Preencha se Possui Filhos!');
		return false;
	}else{
		if (nn_sonfilho == 'SIM' && nn_intqtdefilho == ''){
			alert('Preencha a Quantidade de filhos!');
			return false;
		}
	}

	if (nn_desnaturalidade == ''){
		alert('Preencha Naturalidade/Estado!');
		return false;
	}
	/*
	if (nn_desrg == ''){
		alert('Preencha RG!');
		return false;
	}

	if (TestaDataDividida(form.nn_datrgexpedicao_Dia, form.nn_datrgexpedicao_Mes, form.nn_datrgexpedicao_Ano, "Data Expedição") == false){
		return false;
	}

	if(nn_cpfcpf == ""){
		alert('Preencha seu CPF!');
		return false;
	}else{
		if (ValidaCPF(nn_cpfcpf) == false){
			alert('CPF inválido!');
			return false;
		}
	}

	if (nn_codcurriculo_habilitacao == ''){
		alert('Preencha Carteira de Habilitação!');
		return false;
	}
	*/
	if (nn_desendereco == ''){
		alert('Preencha Endereço!');
		return false;
	}

	if (ChecaCep(form.nn_cepcep, 2) == false){
		return false;
	}

	if (nn_codpais == ''){
		alert('Preencha País!');
		return false;
	}else{
		if (nn_codpais == 1){
			if (nu_codestado == ''){
				alert('Preencha Estado!');
				return false;
			}

			if (nu_codcidade == ''){
				alert('Preencha Cidade!');
				return false;
			}
		}else if (nn_codpais == 2){
			if (nu_desestado_out == ''){
				alert('Preencha Estado!');
				return false;
			}

			if (nu_descidade_out == ''){
				alert('Preencha Cidade!');
				return false;
			}
		}
	}

	if (nn_sonmudarcidade == ''){
		alert('Preencha Disponibilidade para mudar de Cidade!');
		return false;
	}

	if (ChecaEmail(nn_emlemail, 'Email') == false){
		return false;
	}

	if (nn_dessenha == ''){
		alert('Preencha sua senha!');
		return false;
	}else{
		if (nn_dessenha != nn_dessenha_conf){
			alert('Preenchasua Confirmação senha corretamente!');
			return false;
		}
	}

	return true;
}

function validaAbaNum2Curriculo(){
	// Mínimo de 1 obrigatório
	var linhas = document.getElementById('tblEscola').rows.length;
	if (linhas <= 0){
		alert('Escolaridade deve ter no mínimo uma informação!');
		return false;
	}

	return true;
}

function validaAbaNum3Curriculo(){
	// Não é obrigatório nenhuma empresa
	var form					= document.getElementById('formulario0');
	var nn_sonprimeiro_emprego	= form.nn_sonprimeiro_emprego.value;
	var linhas					= document.getElementById('tblEmprego').rows.length;

	if (nn_sonprimeiro_emprego == 'NAO'){
		if (linhas <= 0){
			alert('Informe sua experiência profissional!');
			return false;
		}
	}

	return true;
}

function validaAbaNum4Curriculo(){
	var form = document.getElementById('formulario0');
	var codcurriculo_cargo = form.nn_codcurriculo_cargo.value;

	if (codcurriculo_cargo == ''){
		alert('Preencha o campo Cargo Pretendido!');
		return false;
	}

	return true;
}



GTR_CurriculoAddEmprego = function (){
	var form		= document.getElementById("formulario0");
	var empresa		= form.nu_desempresa.value;
	//var estado		= form.nu_codestadoempresa.value;
	//var cidade		= form.nu_codcidadeempresa.value;
	//var telefone	= form.nu_telefone.value;
	var cargo		= form.nu_cargo.value;
	var datai_d		= form.nu_datperiodode_Dia.value;
	var datai_m		= form.nu_datperiodode_Mes.value;
	var datai_a		= form.nu_datperiodode_Ano.value;
	var dataf_d		= form.nu_datperiodoate_Dia.value;
	var dataf_m		= form.nu_datperiodoate_Mes.value;
	var dataf_a		= form.nu_datperiodoate_Ano.value;
	//var motivosaida	= form.nu_motivosaida.value;
	var descricao	= form.nu_texdescricao.value;

	if(empresa.length <= 0){
		alert("Informe o nome da Empresa");
		form.nu_desempresa.focus();
		return false;
	}

	/*if(estado == "") {
		alert("Informe o Estado");
		form.nu_codestadoempresa.focus();
		return false;
	}

	if(cidade == "") {
		alert("Informe a Cidade");
		form.nu_codcidadeempresa.focus();
		return false;
	}

	if(telefone.length != 13){
		alert("Informe o Telefone");
		form.nu_telefone.focus();
		return false;
	}*/

	if(cargo == "") {
		alert("Informe o cargo");
		form.nu_cargo.focus();
		return false;
	}

	if (TestaDataDividida(form.nu_datperiodode_Dia, form.nu_datperiodode_Mes, form.nu_datperiodode_Ano, "Data Entrada") == false){
		return false;
	}

	datai = new Date(datai_a, parseInt(datai_m) - 1, datai_d, 0, 0, 1);
	dataa = new Date();

	if (datai > dataa) {
		alert("A data de entrada é maior que a data atual");
		form.nu_datperiodode_Dia.focus();
		return false;
	}

	if (dataf_d != '' || dataf_m != '' || dataf_a != ''){
		if (TestaDataDividida(form.nu_datperiodoate_Dia, form.nu_datperiodoate_Mes, form.nu_datperiodoate_Ano, "Data Saída") == false){
			return false;
		}

		dataf = new Date(dataf_a, parseInt(dataf_m) - 1, dataf_d, 0, 0, 1);
		if (datai > dataf) {
			alert("A data de entrada é maior que a data de saida");
			form.nu_datperiodode_Dia.focus();
			return false;
		}

		/*if(motivosaida == "") {
			alert("Informe o Motivo da saída");
			form.nu_motivosaida.focus();
			return false;
		}*/
	}


	if(descricao.length <= 0){
		alert("Informe a descrição das suas atividades nessa Empresa");
		form.nu_texdescricao.focus();
		return false;
	}



	var tabela = "tblEmprego";
	var linha = document.getElementById(tabela).insertRow(document.getElementById(tabela).rows.length);

	// limpa caracteres
	empresa.replace("'", "");
	cargo.replace("'", "");
	//motivosaida.replace("'", "");
	descricao.replace("'", "");



	var cmpEmpresa		= "<input type='hidden' name='nu_emprego_empresa[]' value='"+empresa+"'>";
	//var cmpEstado		= "<input type='hidden' name='nu_emprego_estado[]' value='"+estado+"'>";
	//var cmpCidade		= "<input type='hidden' name='nu_emprego_cidade[]' value='"+cidade+"'>";
	//var cmpTelefone	= "<input type='hidden' name='nu_emprego_telefone[]' value='"+telefone+"'>";
	var cmpCargo		= "<input type='hidden' name='nu_emprego_cargo[]' value='"+cargo+"'>";
	var cmpDataI_Dia	= "<input type='hidden' name='nu_emprego_datai_Dia[]' value='"+datai_d+"'>";
	var cmpDataI_Mes	= "<input type='hidden' name='nu_emprego_datai_Mes[]' value='"+datai_m+"'>";
	var cmpDataI_Ano	= "<input type='hidden' name='nu_emprego_datai_Ano[]' value='"+datai_a+"'>";
	var cmpDataF_Dia	= "<input type='hidden' name='nu_emprego_dataf_Dia[]' value='"+dataf_d+"'>";
	var cmpDataF_Mes	= "<input type='hidden' name='nu_emprego_dataf_Mes[]' value='"+dataf_m+"'>";
	var cmpDataF_Ano	= "<input type='hidden' name='nu_emprego_dataf_Ano[]' value='"+dataf_a+"'>";
	//var cmpMotivo		= "<input type='hidden' name='nu_emprego_motivo[]' value='"+motivosaida+"'>";
	var cmpDescricao	= "<input type='hidden' name='nu_emprego_descricao[]' value='"+descricao+"'>";

	var camposOcultos	=  cmpEmpresa + cmpCargo;
	camposOcultos		+= cmpDataI_Dia + cmpDataI_Mes + cmpDataI_Ano;
	camposOcultos		+= cmpDataF_Dia + cmpDataF_Mes + cmpDataF_Ano;
	camposOcultos		+= cmpDescricao;//+ cmpEstado + cmpCidade + cmpTelefone + cmpMotivo

	var HTML = "<strong>Empresa: " + empresa + "<a href='javascript: void(0);' onClick='GTR_CurriculoDel(this.parentNode.parentNode.rowIndex);'><img src='img/btn/btn_fechar.gif' alt='Excluir' border='0' /></a></strong>";
	HTML += "<ul>";
	//HTML += "<li>&raquo; Estado: " + form.nu_codestadoempresa.options[form.nu_codestadoempresa.selectedIndex].text + "</li>";
	//HTML += "<li>&raquo; Cidade: " + form.nu_codcidadeempresa.options[form.nu_codcidadeempresa.selectedIndex].text + "</li>";
	//HTML += "<li>&raquo; Telefone: " + telefone + "</li>";
	HTML += "<li>&raquo; Cargo: " + cargo + "</li>";
	HTML += "<li>&raquo; Data de entrada: " + datai_d + "/" + datai_m + "/" + datai_a + "</li>";

	var dataSaida = ""
	if (dataf_d != ''){
		dataSaida = dataf_d + "/" + dataf_m + "/" + dataf_a;
	}

	HTML += "<li>&raquo; Data de saída: " + dataSaida + "</li>";
	//HTML += "<li>&raquo; Motivo da saída: " + motivosaida + "</li>";
	HTML += "<li>&raquo; Descrição das atividades: " + descricao + "</li>";
	HTML += "</ul>";

	var col = linha.insertCell(0);
	col.innerHTML	= HTML;

	col = linha.insertCell(1);
	col.innerHTML = camposOcultos;
	col.valing = "top";

	form.nu_desempresa.value		= "";
	form.nu_cargo.value				= "";
	form.nu_datperiodode_Dia.value	= "";
	form.nu_datperiodode_Mes.value	= "";
	form.nu_datperiodode_Ano.value	= "";
	form.nu_datperiodoate_Dia.value	= "";
	form.nu_datperiodoate_Mes.value	= "";
	form.nu_datperiodoate_Ano.value	= "";
	form.nu_texdescricao.value		= "";
	//form.nu_codestadoempresa.selectedIndex = 0;
	//form.nu_codcidadeempresa.selectedIndex = 0;
	//form.nu_telefone.value = "";
	//form.nu_motivosaida.value = "";
}

GTR_CurriculoDel = function (i){
	document.getElementById('tblEmprego').deleteRow(i)
}

GTR_CurriculoAddFilhoIdade = function (){
	var form		= document.getElementById("formulario0");
	var idade		= form.nu_desidade.value;

	if(idade.length <= 0){
		alert("Informe a Idade do Filho");
		form.nu_desidade.focus();
		return false;
	}

	form.nu_desidade.value	= "";
	form.nu_desidade.focus();


	var tabela = "tblFilhoIdade";
	var linha = document.getElementById(tabela).insertRow(document.getElementById(tabela).rows.length);
	var indice_linha_nova = parseInt(document.getElementById(tabela).rows.length,10);
	// limpa caracteres
	idade.replace("'", "");

	var cmpIdade		= "<input type='hidden' name='nu_filho_idade[]' value='"+idade+"'>";
	var camposOcultos	= cmpIdade;

	var col = linha.insertCell(0);
	var HTML = "<strong>Filho <span id='filho_"+indice_linha_nova+"'>"+indice_linha_nova+"</span>: " + idade + " anos<a href='javascript: void(0);' onClick='GTR_CurriculoDelFilhoIdade(this.parentNode.parentNode.parentNode.rowIndex);'><img src='img/btn/btn_fechar.gif' alt='Excluir' border='0' /></a></strong>";

	col.innerHTML	= HTML;

	col = linha.insertCell(1);
	col.innerHTML = camposOcultos;
	col.valign = "top";
}
GTR_CurriculoDelFilhoIdade = function (i){
	document.getElementById('tblFilhoIdade').deleteRow(i);
}


GTR_CurriculoAddEscola = function (){
	var form		= document.getElementById("formulario0");
	var entidade	= form.nu_desentidade.value;
	var curso		= form.nu_descurso.value;
	var graduacao	= form.nu_graduacao.value;
	var ano			= form.nu_intano.value;

	if(entidade.length <= 0){
		alert("Informe o nome da Entidade");
		form.nu_desentidade.focus();
		return false;
	}

	if(curso == "") {
		alert("Informe o curso");
		form.nu_descurso.focus();
		return false;
	}


	if(graduacao.length <= 0){
		alert("Informe a graduação");
		form.nu_graduacao.focus();
		return false;
	}

	if(ano.length <= 0){
		alert("Informe a o ano da conclusão");
		form.nu_intano.focus();
		return false;
	}

	if(ano.length < 4){
		alert("O ano da conclusão deve conter 4 digitos");
		form.nu_intano.focus();
		return false;
	}

	form.nu_desentidade.value	= "";
	form.nu_descurso.value		= "";
	form.nu_graduacao.value		= "";
	form.nu_intano.value		= "";

	var tabela = "tblEscola";
	var linha = document.getElementById(tabela).insertRow(document.getElementById(tabela).rows.length);

	// limpa caracteres
	entidade.replace("'", "");
	curso.replace("'", "");
	graduacao.replace("'", "");
	ano.replace("'", "");

	var cmpEntidade		= "<input type='hidden' name='nu_escola_entidade[]' value='"+entidade+"'>";
	var cmpCurso		= "<input type='hidden' name='nu_escola_curso[]' value='"+curso+"'>";
	var cmpGraduacao	= "<input type='hidden' name='nu_escola_graduacao[]' value='"+graduacao+"'>";
	var cmpAno			= "<input type='hidden' name='nu_escola_ano[]' value='"+ano+"'>";
	var camposOcultos	= cmpEntidade + cmpCurso + cmpGraduacao + cmpAno;

	var col = linha.insertCell(0);
	var HTML = "<strong>Entidade: " + entidade + "<a href='javascript: void(0);' onClick='GTR_CurriculoDelEscola(this.parentNode.parentNode.rowIndex);'><img src='img/btn/btn_fechar.gif' alt='Excluir' border='0' /></a></strong>";
	HTML += "<ul>";
	HTML += "<li>&raquo; Curso: " + curso + "</li>";
	HTML += "<li>&raquo; Graduação: " + graduacao + "</li>";
	HTML += "<li>&raquo; Ano de Conclusão: " + ano + "</li>";
	HTML += "</ul>";

	col.innerHTML	= HTML;

	col = linha.insertCell(1);
	col.innerHTML = camposOcultos;
	col.valign = "top";
}

GTR_CurriculoDelEscola = function (i){
	document.getElementById('tblEscola').deleteRow(i)
}

function ativaAba(tab_id, valida) {
	if (typeof valida == 'undefined') valida = true;

	if (valida && !validaAba(GTR_CAD_CLIENTE_ABA_ATIVA)) {
		return false;
	}

	GTR_CAD_CLIENTE_ABA_ATIVA = parseInt(tab_id.replace('tab_step', ''));

	var tabs = document.getElementById('abas').getElementsByTagName("a");
	for(var i = 0; i < tabs.length; i++) {
		var tab = tabs[i];
		if (HasClassName(tab, "ativo")) {
			RemoveClassName(tab, "ativo");
			tab_conteudo_id = tab.id.substr(4,5);
			document.getElementById(tab_conteudo_id).style.display = "none";
		}
	}

	tab_ativa = document.getElementById(tab_id);
	AddClassName(tab_ativa, "ativo");
	tab_conteudo_id = tab_ativa.id.substr(4,5);
	document.getElementById(tab_conteudo_id).style.display = "block";
	parent.scrollTop();

	return false;
}
/* FIM CAD_CURRICULO */

// ----------------------------------------------------------------------------
// HasClassName
//
// Description : returns boolean indicating whether the object has the class name
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function HasClassName(objElement, strClass) {

	// if there is a class
	if ( objElement.className ) {

		// the classes are just a space separated list, so first get the list
		var arrList = objElement.className.split(' ');

		// get uppercase class for comparison purposes
		var strClassUpper = strClass.toUpperCase();

		// find all instances and remove them
		for ( var i = 0; i < arrList.length; i++ ) {
			// if class found
			if ( arrList[i].toUpperCase() == strClassUpper ) {
				// we found it
				return true;
			}
		}

	}

	// if we got here then the class name is not there
	return false;

}
//
// HasClassName
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function AddClassName(objElement, strClass, blnMayAlreadyExist) {

	// if there is a class
	if ( objElement.className ) {

		// the classes are just a space separated list, so first get the list
		var arrList = objElement.className.split(' ');

		// if the new class name may already exist in list
		if ( blnMayAlreadyExist ) {

			// get uppercase class for comparison purposes
			var strClassUpper = strClass.toUpperCase();

			// find all instances and remove them
			for ( var i = 0; i < arrList.length; i++ ) {
				// if class found
				if ( arrList[i].toUpperCase() == strClassUpper) {
					// remove array item
					arrList.splice(i, 1);
					// decrement loop counter as we have adjusted the array's contents
					i--;
				}
			}
		}

		// add the new class to end of list
		arrList[arrList.length] = strClass;

		// add the new class to beginning of list
		//arrList.splice(0, 0, strClass);

		// assign modified class name attribute
		objElement.className = arrList.join(' ');

	} else {
		// if there was no class

		// assign modified class name attribute
		objElement.className = strClass;
	}
}
//
// AddClassName
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// RemoveClassName
//
// Description : removes a class from the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to remove
//
function RemoveClassName(objElement, strClass) {

	// if there is a class
	if ( objElement.className ) {

		// the classes are just a space separated list, so first get the list
		var arrList = objElement.className.split(' ');

		// get uppercase class for comparison purposes
		var strClassUpper = strClass.toUpperCase();

		// find all instances and remove them
		for ( var i = 0; i < arrList.length; i++ ) {
			// if class found
			if ( arrList[i].toUpperCase() == strClassUpper ) {
				// remove array item
				arrList.splice(i, 1);
				// decrement loop counter as we have adjusted the array's contents
				i--;
			}
		}

		// assign modified class name attribute
		objElement.className = arrList.join(' ');

	}
	// if there was no class
	// there is nothing to remove
}
//
// RemoveClassName
// ----------------------------------------------------------------------------

function abre_filial(elem){
	var estado = elem.id;
	var filho = document.getElementById('fil_'+estado);
	if(filho.style.display == 'none'){
		filho.style.display = '';
		elem.className = 'ativo';
	} else {
		filho.style.display = 'none';
		elem.className = '';
	}
}

function boxAtivo(arr_box){
	var boxes = arr_box.split(',');
	for(i=0;i<boxes.length;i++){
		document.getElementById('box_conteudo_'+boxes[i]).style.display = '';
	}
}
function movimento(para) {
	escondeContato(1);
	$j('html,body').animate(
	{scrollTop: $j("#"+para).offset().top}
	, 500);
}

function escondeContato(status){
	if(typeof(document.getElementById('box_contato')) != 'undefined'){
		if(status == 0){
			document.getElementById('box_contato').style.display = 'none';
		} else {
			document.getElementById('box_contato').style.display = 'block';
		}
	}
}

function seoContato(codprograma){
    $j('#nu_xxx_seo').val(codprograma);
}

function curriculo_alterar_senha(){
	document.getElementById('cmp_senha').style.display = '';
	document.getElementById('cmp_senha_confirm').style.display = '';
	document.getElementById('nn_dessenha').value = '';
	document.getElementById('GTR_confirmacao_senha').value = '';
	document.getElementById('nn_dessenha').focus();
}


function ContatoPrograma(codsisemail){
	document.formulario0.nn_codsisemail.value = codsisemail;
	movimento('box_contato');
}

function BoxHome(){
	$j('#list_item>div').bind("mouseenter mouseleave", function(e){
        $j(this).toggleClass("ativo");
    });
}
