// JavaScript Document
function hiddenConteudo() {
	document.getElementById('conteudo').style.display = 'none';	
}

function showConteudo() {
	document.getElementById('conteudo').style.display = 'block';	
}

function pre_show(DIV,type) { 
	if (type == 1) document.getElementById(DIV).style.display = "";
	else document.getElementById(DIV).style.display = "none";
}

function sel(id){
	var obj;

	for(var i=0; i < 8; i++){
		try{
			obj = eval("document.getElementById('op0" + i + "')");
			obj.className = "liAzul";
			hideHtmlElement('DADOS-0' + i);
		}catch(e){
		}
	}
	
	obj = eval("document.getElementById('op0" + id + "')");
	obj.className = "liVermelho";
	showHtmlElement('DADOS-0' + id);
}

function showHtmlElement(id){
	document.getElementById(id).style.display = '';
}

function hideHtmlElement(id){
	document.getElementById(id).style.display = 'none';
}

function abrirLocalizacao(id){
	var intID = id;
	var newID = "";
	var achouNaoZero = false;

	if (intID == '0000') newID = '0';
	else {
		for (var j = 0; j < intID.length; j++) {
			if ((intID.substring(j, j+ 1) != '0') && (achouNaoZero == false)) achouNaoZero = true;
			if (achouNaoZero == true) 					newID += intID.substring(j, j + 1);
			else if (intID.substring(j, j + 1) != '0') 	newID += intID.substring(j,j + 1);
		}
	}
	achouNaoZero = false;
	window.open('http://www.apontador.com.br/ext/casasbahia/bussola/mapa.php3?filial_id='+newID,'Apontador','scrollbars=yes,status=yes,width=680,height=600');		
	
	s.pageName="Loja";
	s.channel="Institucional";
	s.prop6 = newID;
	var s_code=s.t();if(s_code)document.write(s_code);
}

function abrirJanela(url, w, h, l, t, title, scr){
	var j;
	var titulo;
	
	if (title==undefined) {
		title = '';
	}
	
	if (title == '') {
		titulo = '_OpenWin';
	} else {
		titulo = title;
	}

	if (scr == undefined) {
		j = open(url,titulo,'location=no,resize=no, width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',maximized=0,scrollbars=auto');
	} else {
		j = open(url,titulo,'location=no,resize=no, width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',maximized=1,scrollbars=1');
	}

	j.focus();
}

/* Curriculo */
function cancelaCurriculo() {
	var retorno = confirm('Deseja realmente cancelar?');
	if(retorno == true) {
		window.location = '/rh.do';
	}
}

function confirmaCurriculo() {
	var form = document.curriculoForm;
	form.submit();
}

function habilitaSelecaoDeficiencia(opcao){
	var form = document.curriculoForm;
	for (var j = 0; j < form.tipoDeficiencia.length; j++){
		if (opcao == "S") {
			form.tipoDeficiencia[j].disabled = false;
		}else{
			form.tipoDeficiencia[j].disabled = true;
			form.tipoDeficiencia[j].checked = false;
		}
	}
	
	if (opcao == "S"){
		form.acessorio[0].disabled = false;
		form.acessorio[1].disabled = false;			
	}else{
		form.acessorio[0].disabled = true;
		form.acessorio[1].disabled = true;	
		form.acessorio[0].checked = false;		
		form.acessorio[1].checked = false;	
		form.tipoAcessorio.disabled = true;
		form.outrasDeficiencias.value = "";
		form.outrasDeficiencias.disabled = true;
		form.tipoAcessorio.value = "";
	}
}

function fctOutrasDefic(){
	var form = document.forms[0];
	
	if (form.tipoDeficiencia[5].checked == true){
		form.outrasDeficiencias.disabled = false;
		form.outrasDeficiencias.focus();
	}else{
		form.outrasDeficiencias.value = "";
		form.outrasDeficiencias.disabled = true;
	}
}

function fctHabilita(acao){
	if(acao=='S'){
		document.forms[0].tipoAcessorio.disabled=false;
		document.forms[0].tipoAcessorio.focus();
	}else{
		document.forms[0].tipoAcessorio.value='';
		document.forms[0].tipoAcessorio.disabled=true;
	}
}

/* pop-up dhtml */
function abrirDHTML(){
	try{
		document.getElementById('BannerDhtml').style.left = '400px';
		document.getElementById('BannerDhtml').style.display = 'block';
		setTimeout("fecharAutoDiv()", 20000);
	}catch(e){}
}
function fecharAutoDiv(){
	try{
		document.getElementById('BannerDhtml').style.display = 'none';
	}catch(e){}
}
function fechardhtml(){
	try{
		document.getElementById('BannerDhtml').style.display = 'none';
	}catch(e){}
}
