/* Scripts da Index */
	// Função que abre o Teste de CFC
	function OpenTeste(janela){
		self.name = "";
		window.open(janela,"principal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=650,height=450,left=10,top=10")
	}
	
	// Função que abre o popup do Newsletter
	function abreNews(janela){
		window.open(janela,"abre","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=200,left=0,top=0")
	}
	
	function validaLoginElearning() {
		with(document.formElearning) {
			if(txtLogin.value == "Login") txtLogin.value = "";
			if(txtSenha.value == "Senha") txtSenha.value = "";
			
			if(txtLogin.value == "" && txtSenha.value == "") return false;
			if(txtLogin.value == "") {
				alert("Por favor preencha corretamente o campo de Login.");
				txtLogin.focus();
				return false;
			}
			if(txtSenha.value == "") {
				alert("Por favor preencha corretamente o campo de Senha.");
				txtSenha.focus();
				return false;
			}
			return true;
		}
	}
/* Fim de Scripts da Index */

// Função que abre link em nova janela
function abre(janela) {
	window.open(janela,"abre", "resizable=yes, menubar=yes, status=yes, toolbar=yes, scrollbars=yes, location=yes")
}
// Função que abre popup
function informativosNews(janela){
window.open(janela,"informativosNews","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=330,height=216,left=0,top=0")
}

// Função que abre o popup do Newsletter
function abreNewsletter(janela){
	window.open(janela,"abre","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=200,left=0,top=0")
}
// Função que valida o Campo Marca
function validaFormCarro() {
if (formAnunCarros.txtMarca.value == "#") {
	alert("Desculpe! Mas é preciso selecionar a marca do Automóvel.")
	formAnunCarros.txtMarca.focus();
	return false;
} else if (document.formAnunCarros.txtModelo.value == "Modelo"){
	formAnunCarros.txtModelo.value = "";
	return true;
}
	return true;
}


function validaContato() {
with(document.form) {
	if(txtNome.value == "") {
		alert("O campo Nome não pode ficar em branco.");
		txtNome.focus();
		return false;
	}
	if(txtEmail.value == "") {
		alert("O campo Email não pode ficar em branco.");
		txtEmail.focus();
		return false;
	}
	if(txtEmail.value.indexOf("@") == -1 || txtEmail.value.indexOf(".") == -1) {
		alert("O Email digitado é inválido.");
		txtEmail.focus();
		return false;
	}
	if(txtFone.value == "") {
		alert("O campo Telefone não pode ficar em branco.");
		txtFone.focus();
		return false;
	}
	if(txtFone.value.length < 10) {
		alert("Por favor coloque o DDD e o Telefone no campo de Telefone.\n\nexemplo: xx xxxx-xxxx");
		txtFone.focus();
		return false;
	}
	if(txtCidade.value == "") {
		alert("O campo Cidade não pode ficar em branco.");
		txtCidade.focus();
		return false;
	}
	if(txtUF.value == "") {
		alert("O campo Estado não pode ficar em branco.");
		txtUF.focus();
		return false;
	}
	if(txtComent.value == "") {
		alert("O campo Comentários não pode ficar em branco.");
		txtComent.focus();
		return false;
	}
}
return true;
}

function validaFormCaminhoes() {
if (formAnunCaminhao.txtMarca.value == "#") {
	alert("Desculpe! Mas é preciso selecionar a marca do Caminhão.")
	formAnunCaminhao.txtMarca.focus();
	return false;
} else if (document.formAnunCaminhao.txtModelo.value == "Modelo"){
	formAnunCaminhao.txtModelo.value = "";
	return true;
}
	return true;
}

function validaFormImoveis() {
if (formAnunImoveis.txtRegiao.value == "#") {
	alert("Desculpe! Mas é preciso selecionar a cidade do Imóvel.")
	formAnunImoveis.txtRegiao.focus();
	return false;
}
	return true;
}

// Função que abre o Teste de CFC
function principal(janela){
	window.open(janela,"principal","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=650,height=450,left=10,top=10")
}

function mostraSubmenu(elemento){
	var x = document.getElementById(elemento);
	x.style.display = "";
}

function someSubmenu(elemento){
	document.getElementById(elemento).style.display = "none";
}

function abreBanner(){
	document.getElementById("bannerRich").innerHTML = "<object class='banner' data='bannerElearning/banner.swf' type='application/x-shockwave-flash' codetype='application/x-shockwave-flash' width='392' height='240'><param name='movie' value='bannerElearning/banner.swf' /><param name='wmode' value='transparent' /><param name='quality' value='high' /><embed src='bannerElearning/banner.swf' width='392' height='240' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed></object>"
}

function fechaBanner(){
	document.getElementById("bannerRich").innerHTML = "";
}

function openChat(url){
	window.open(url,'atendimento','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,width=550,height=400,left=25,top=25');
}

/*
//Função que abre o Popup automaticamente
function Remote() {
	var remote = null;
	remote = window.open('popup/popupContatoPub/index.htm','mensagem','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,width=300,height=271,left=20,top=20');
}
*/