function trocaEstilo(obj){
	switch(obj.className){
		case 'spanTexto':
			obj.className='spanTexto2';
		break;
		case 'spanTexto2':
			obj.className='spanTexto';
		break;
		case 'spanTextoAcesse':
			obj.className='spanTextoAcesse2';
		break;
		case 'spanTextoAcesse2':
			obj.className='spanTextoAcesse';
		break;
	}
}
function avisoCreditos(){
	alert("Você não possui créditos suficientes para utilizar esse recurso.\nPor favor, preencha o formulário a seguir para solicitar mais créditos.");
	contratar();
}
function displayConteudo(tipo, openclose){
	switch(tipo){
		case "duvidas_conteudo":
			if(openclose==1){ // abre opções
				document.getElementById('trDuvidasConteudo1').style.display = 'none';
				document.getElementById('trDuvidasConteudo2').style.display = 'none';
				document.getElementById('trDuvidasConteudo3').style.display = '';
				document.getElementById('trDuvidasConteudo4').style.display = '';
			}else{ // fecha opções
				document.getElementById('trDuvidasConteudo3').style.display = 'none';
				document.getElementById('trDuvidasConteudo4').style.display = 'none';
				document.getElementById('trDuvidasConteudo1').style.display = '';
				document.getElementById('trDuvidasConteudo2').style.display = '';
			}
			document.getElementById('trSuporteTecnologico1').style.display = '';
			document.getElementById('trSuporteTecnologico2').style.display = 'none';
			document.getElementById('trSuporteTecnologico3').style.display = 'none';
			if(openclose==1)
				try{
					document.body.scrollTop = 104;
				}catch(e){
				}
		break;
		case "suporte_tecnologico":
			if(openclose==1){ // abre opções
				document.getElementById('trSuporteTecnologico1').style.display = 'none';
				document.getElementById('trSuporteTecnologico2').style.display = 'none';
				document.getElementById('trSuporteTecnologico3').style.display = '';
			}else{ // fecha opções
				document.getElementById('trSuporteTecnologico3').style.display = 'none';
				document.getElementById('trSuporteTecnologico1').style.display = '';
				document.getElementById('trSuporteTecnologico2').style.display = '';
			}
			document.getElementById('trDuvidasConteudo3').style.display = 'none';
			document.getElementById('trDuvidasConteudo4').style.display = 'none';
			document.getElementById('trDuvidasConteudo1').style.display = '';
			document.getElementById('trDuvidasConteudo2').style.display = '';
			if(openclose==1)
				try{
					document.body.scrollTop = 363;
				}catch(e){
				}
		break;
	}
}
function escolha(opt){
	document.formCAF.opcao.value = opt;
	document.formCAF.submit();
}
function criaXMLHTTP(){
	var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
	"MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
	"Microsoft.XMLHTTP"];
	var retorno = false;
	try{
		return new XMLHttpRequest();
	}catch(ee){
		try{
			for (var i=0; !retorno && i < arrSignatures.length; i++) {
				try {
					retorno = new ActiveXObject(arrSignatures[i]);
				} catch (oError) {
					retorno = false;
				}
			}
		}catch(e){
			return false;
		}
	}
	return retorno;
}
var xevt;
function carregar(tipo,torig){
	xmlhttp = criaXMLHTTP();
	switch(tipo){
		case 'saldo':
			divR = document.getElementById('spanSaldo');
			url = App.BaseURL+'caf/caf.php?carregar=1&saldo=1&secaoOrigem='+torig;
			conteudoDiv = '@conteudo@ crédito(s).';
			break;
		case 'direito':
			divR = document.getElementById('spanDireito');
			url = App.BaseURL+'caf/caf.php?carregar=1&direito=1&secaoOrigem='+torig;
			conteudoDiv = '@conteudo@';
			break;
	}
	/*
	if(divR.style.display==''){
		divR.style.display='none';
		return;
	}*/

	//Abre a conexão
	xmlhttp.open("GET",url);
	xmlhttp.setRequestHeader("Cache-Control", "no-cache");
	xmlhttp.setRequestHeader("Pragma", "no-cache");

	// para solicitacoes utilizando o metodo post deve ser acrescentado 
	// oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

	//Função para tratamento do retorno
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			conteudo = xmlhttp.responseText;
			//Mostra o HTML recebido
			divR.style.display = '';
			divR.innerHTML = conteudoDiv.split('@conteudo@').join(conteudo);
		}
	}
	//Executa
	xmlhttp.send(null);
}
function contratar(torig){
	largura = 400;
	altura = 500;
	centroTop = screen.height/2 - altura/2;
	centroLeft = screen.width/2 - largura/2;
	janContratar = window.open(App.BaseURL+'caf/caf.php?carregar=1&contratar=1&secaoOrigem='+torig, 'janContrat', 'status=0, resizable=0, location=0, toolbar=0, scrollbars=1, width='+largura+', height='+altura+', directories=0, menubar=0, titlebar=0, top='+centroTop+',left='+centroLeft)
}
function formcontratar(){
	largura = 400;
	altura = 500;
	centroTop = screen.height/2 - altura/2;
	centroLeft = screen.width/2 - largura/2;
	janContratar = window.open(App.BaseURL+'caf/form_contratar.php', 'janContrat', 'status=0, resizable=0, location=0, toolbar=0, scrollbars=1, width='+largura+', height='+altura+', directories=0, menubar=0, titlebar=0, top='+centroTop+',left='+centroLeft)
}
function exemplos(){
	largura = 640;
	altura = 350;
	centroTop = screen.height/2 - altura/2;
	centroLeft = screen.width/2 - largura/2;
	janContratar = window.open(App.BaseURL+'caf/exemplos.php', 'janContrat', 'status=0, resizable=0, location=0, toolbar=0, scrollbars=1, width='+largura+', height='+altura+', directories=0, menubar=0, titlebar=0, top='+centroTop+',left='+centroLeft)
}
function extrato(){
	/*
	try{
		janela = window.opener.top.location;
		window.opener.top.location = App.BaseURL+'/caf/extrato.php';
	}catch(e){
		window.opener.location = App.BaseURL+'/caf/extrato.php';
	}
	window.opener.focus();
	*/
	location = App.BaseURL+'caf/extrato.php?v=1';
}
function plantaoOnLine(){
	try{
		janela = window.opener.top.location;
		window.opener.focus();
		window.opener.top.location = App.BaseURL+'plantao/';
	}catch(e){
		try{
			window.opener.focus();
			window.opener.location = App.BaseURL+'plantao/';
		}catch(e){
			parametrosJan = '';
			try{
				w1 = window.screen.width;
				h1 = window.screen.height;
				parametrosJan = 'top=0, left=0, width='+w1+', height='+h1;
			}catch(e){
				erro = 1;
			}
			window.open(App.BaseURL+'plantao/','janPlantao',parametrosJan);
		}
	}
	window.opener.focus();
}

function msgSemDireito(){
	alert('Para utilizar estas opções de contato com os consultores você primeiramente deve possuir uma licença que dê direito aos serviços da CAF.\nPara maiores informações preencha o formulário a seguir.');
	contratar();
}

function msgDeslogado(){
	alert('Para utilizar estas opções de contato com os consultores você primeiramente deve estar logado e \npossuir uma licença que dê direito aos serviços da CAF.');
}

function msgDeslogado2(){
	alert('Para utilizar esta opção de contato você primeiramente deve estar logado.');
}
