
//--------------------------------------- Função para banner dinâmico ----------------------------------------------- //

var contador = 45;

function sites() {
	contador = 45
}

function sistemas() {
	contador = 30
}

function emailmkt() {
	contador = 15
}

function conta() {
document.getElementById('tempo').innerHTML=contador;
	
	if(contador <= 45 && contador > 30 ) {
		document.getElementById('destaque01').className = ("ligado");
	}
	
	if(contador <= 30 ) {
		document.getElementById('destaque01').className = ("desligado");
	}
	
	if(contador <= 45 && contador > 30 ) {
		document.getElementById('sites').className = ("ativa");
	}
	
	if(contador <= 30 ) {
		document.getElementById('sites').className = ("desativa");
	}
	
	if(contador <= 30 && contador > 15) {
		document.getElementById('destaque02').className = ("ligado");
	}
	
	if(contador <= 15 || contador > 30 ) {
		document.getElementById('destaque02').className = ("desligado");
	}
	
	if(contador <= 30 && contador > 15) {
		document.getElementById('sistemas').className = ("ativa");
	}
	
	if(contador <= 15 || contador > 30 ) {
		document.getElementById('sistemas').className = ("desativa");
	}
	
	if(contador <= 15 && contador > 0 ) {
		document.getElementById('destaque03').className = ("ligado");
	}
	
	if(contador > 15 ) {
		document.getElementById('destaque03').className = ("desligado");
	}
	
	if(contador <= 15 && contador > 0 ) {
		document.getElementById('emailmkt').className = ("ativa");
	}
	
	if(contador > 15 ) {
		document.getElementById('emailmkt').className = ("desativa");
	}

	if (contador == 0){
		contador = 46;
	}
	if (contador != 0){
		contador = contador-1;
		contatempo = setTimeout("conta()", 1000);
	}
}

function pausa(){
	clearTimeout(contatempo);
}

//-------------------------------------------------------------------------------------------------------------------- //


//--------------------------------------- Função para checagem de formulário ---------------------------------------- //


	function checaCampos() {
	var nome = document.getElementById('nome');
	var telefone = document.getElementById('telefone');
	var msg = document.getElementById('msg');
	var erro = "";
	var count = 0;
	
		if (nome.value == "") {
			erro += "\nPreencha o campo Nome";
			count ++;
			}
		if (telefone.value == "" || telefone.value.search(/[A-Za-z]/) >= 0) {
			erro += "\nPreencha o campo Telefone";
			count ++;
			}
		if (msg.value == "") {
		erro += "\nPreencha o campo Mensagem";
		count ++;
		}
		if (count > 0) {
			alert("Os seguintes erros foram encontrados:\n" + erro);
			return false
		}else{
			alert("Seus dados foram enviados com sucesso" + erro);
			}
		}
 
	function validaNome(){
		if(document.getElementById('nome').value.length < 2){
			document.getElementById('nome').style.background = "#FF0000"
			document.getElementById('nome').style.color = "#FFFFFF"
			document.getElementById('nomeErro').innerHTML = " O nome deve ser preenchido";
			return 1;
		}else{
			document.getElementById('nome').style.background = "#87CEFA"
			document.getElementById('nome').style.color = "#000000"
			document.getElementById('nomeErro').innerHTML = "";
		}
	}
	
	function validaTelefone(){
		if(document.getElementById('telefone').value.search(/[A-Za-z]/) >= 0){
			document.getElementById('telefone').style.background = "#FF0000"
			document.getElementById('telefone').style.color = "#FFFFFF"
			document.getElementById('telefoneErro').innerHTML = " O telefone só pode conter números";
			return 1;
		}
		if(document.getElementById('telefone').value.length == 0){
			document.getElementById('telefone').style.background = "#FF0000"
			document.getElementById('telefone').style.color = "#FFFFFF"
			document.getElementById('telefoneErro').innerHTML = " O telefone deve ser preenchido";
			return 1;
		}else{
		document.getElementById('telefone').style.background = "#87CEFA";
		document.getElementById('telefone').style.color = "#000000";
		document.getElementById('telefoneErro').innerHTML = "";
		}
	}
	
	function validaCelular(){
		if(document.getElementById('celular').value.search(/[A-Za-z]/) >= 0){
			document.getElementById('celular').style.background = "#FF0000"
			document.getElementById('celular').style.color = "#FFFFFF"
			document.getElementById('celularErro').innerHTML = "O celular só pode conter números";
			return 1;
		}
		if(document.getElementById('celular').value.length == 0){
			document.getElementById('celular').style.background = "#FF0000"
			document.getElementById('celular').style.color = "#FFFFFF"
			document.getElementById('celularErro').innerHTML = "O celular deve ser preenchido";
			return 1;
		}else{
		document.getElementById('celular').style.background = "#87CEFA";
		document.getElementById('celular').style.color = "#000000";
		document.getElementById('celularErro').innerHTML = "";
		}
	}
	
	function validaMail(){
		if(document.getElementById('mail').value.length < 4){
			document.getElementById('mail').style.background = "#FF0000"
			document.getElementById('mail').style.color = "#FFFFFF"
			document.getElementById('mailErro').innerHTML = " O e-mail deve ser preenchido";
			return 1;
		}else{
			document.getElementById('mail').style.background = "#87CEFA"
			document.getElementById('mail').style.color = "#000000"
			document.getElementById('mailErro').innerHTML = "";
		}
	}
	
	function validaMsg(){
		if(document.getElementById('msg').value.length < 4){
			document.getElementById('msg').style.background = "#FF0000"
			document.getElementById('msg').style.color = "#FFFFFF"
			document.getElementById('msgErro').innerHTML = " Por Favor, deixe sua mensagem";
			return 1;
		}else{
			document.getElementById('msg').style.background = "#87CEFA"
			document.getElementById('msg').style.color = "#000000"
			document.getElementById('msgErro').innerHTML = "";
		}
	}
		
//-------------------------------------------------------------------------------------------------------------------- //


function checaPromo() {
	var promo = document.getElementById('promo');
	var erro = "";
	var count = 0;
	
		if (promo.value != "NITEROI20" && promo.value.length != 0) {
			count ++;
			}
		if (count > 0) {
			alert("O código promocional digitado não existe." + erro);
			return false
		}else{
			alert("Seus dados foram enviados com sucesso" + erro);
			}
		}


//--------------------------------------- Tira controle de Active X ------------------------------------------------- //

function flash(arqflash,largura,altura) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + largura + '" height="' + altura + '">');
document.write('<param name="movie" value="' + arqflash + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<embed src="' + arqflash + '" width="' + largura + '" height="' + altura + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>');
document.write('</object>');
}

function AbreJanela(url) {
          window.open(url);
}

//-------------------------------------------------------------------------------------------------------------------- //
