// JavaScript Document
Hoje = new Date() 
  
Data = Hoje.getDate() 
  
Dia = Hoje.getDay() 
  
Mes = Hoje.getMonth() 
  
Ano = Hoje.getYear() 
  
// 
  
if (Data<10) { 
  
Data = "0" + Data} 
  
if (Ano < 2000) { 
  
Ano = "19" + Ano} 
  
// 
  
NomeDia = new Array(7) 
  
NomeDia[0] = "Domingo" 
  
NomeDia[1] = "Segunda-feira" 
  
NomeDia[2] = "Terça-feira" 
  
NomeDia[3] = "Quarta-feira" 
  
NomeDia[4] = "Quinta-feira" 
  
NomeDia[5] = "Sexta-feira" 
  
NomeDia[6] = "Sábado" 
  
// 
  
NomeMes = new Array(12) 
  
NomeMes[0] = "Janeiro" 
  
NomeMes[1] = "Fevereiro" 
  
NomeMes[2] = "Março" 
  
NomeMes[3] = "Abril" 
  
NomeMes[4] = "Maio" 
  
NomeMes[5] = "Junho" 
  
NomeMes[6] = "Julho" 
  
NomeMes[7] = "Agosto" 
  
NomeMes[8] = "Setembro" 
  
NomeMes[9] = "Outubro" 
  
NomeMes[10] = "Novembro" 
  
NomeMes[11] = "Dezembro" 
  
 
  
  
 function MostrarData() { 
  
document.write ("<font color='black' face='verdana,tahoma' size=1><b>" + NomeDia[Dia] + ", " + Data + " de " + NomeMes[Mes] + " de " + Ano + "</b></font>") 
  
 } 
  
  var hellotext=" CONSULTORIA - ANÁLISE - DESENVOLVIMENTO - Consulte-nos pelo Fone (19) 3541-2458"
     var thetext=""
     var started=false 
     var step=0
     var times=1 
     function welcometext()
     {
     times--
     if (times==0)
     {
          if (started==false) 
     { 
     started = true;
     window.status = hellotext; 
     setTimeout("anim()",1);
     }
     thetext = hellotext;
     }
     }
     function showstatustext(txt) 
     {
     thetext = txt;
     setTimeout("welcometext()",4000) 
     times++ 
     }
     function anim() 
    {
     step++
     if (step==12) {step=1}
     if (step==1) {window.status='>>=========='+thetext+'==========<<'} 
     if (step==2) {window.status='=>>========='+thetext+'=========<<='} 
     if (step==3) {window.status='==>>========'+thetext+'========<<=='} 
     if (step==4) {window.status='===>>======='+thetext+'=======<<==='} 
     if (step==5) {window.status='====>>======'+thetext+'======<<===='} 
     if (step==6) {window.status='=====>>====='+thetext+'=====<<====='} 
     if (step==7) {window.status='======>>===='+thetext+'====<<======'} 
     if (step==8) {window.status='=======>>==='+thetext+'===<<======='} 
     if (step==9) {window.status='========>>=='+thetext+'==<<========'} 
     if (step==10) {window.status='=========>>='+thetext+'=<<========='} 
     if (step==11) {window.status='==========>>'+thetext+'<<=========='} 

     setTimeout("anim()",100); 
     } 
welcometext(); 
function mclk(src) {
  if(event.srcElement.tagName=='TD') {
    src.children.tags('A')[0].click();
  }
}

function mOut(src,cor) {
        if (!src.contains(event.toElement)) {
         src.style.cursor = 'default';
         src.bgColor = cor;
        }
}

function mOvr(src,cor) {
 if (!src.contains(event.fromElement)) {
         src.style.cursor = 'hand';
         src.bgColor = cor;
	     }
}


/// Funcoes do menu ///

		tms=new Array()

	// Mostra o submenu no mouseover
		function over(n){
			if(typeof(tms[n])!="undefined")clearTimeout(tms[n])
			document.getElementById("s"+n).style.visibility="visible"
		}

	// Esconde o submenu no mouseout
		function out(n){
			tms[n]=setTimeout('document.getElementById("s'+n+'").style.visibility="hidden"',50)
		}

///

/// Diversos ///

	// Funcao abrir pop up em noticias//
		function jornalismo(url) {
			window.open('http://www.integrativa.com.br/malamarketing/jornalista/integrativa.htm','jornalismo','width=640,height=550,location=0,menubar=0,resizable=0,scrollbars=yes,status=0,toolbar=0');
		}


	// Escreve chamada no site //
		function echamada(){ 
			var chamada = '<a href="http://www.pmcg.pb.gov.br" title="prefeitura municipal de campina grande" target="_blank"><img src="../saojoao/imagens/banners/campina.gif" width="120" height="60" alt="prefeitura municipal de campina grande" /></a>';
				document.write(chamada);
		}
	
	// Funcao abrir pop up //
		function clientes(url) {
			window.open(url,'clientes','width=400,height=275,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
		}

    function openWindow(page, len, hei) {
      var rdm = new Date();

      var num = rdm.getTime();// + ((Math.random()*100) % 100);

      winconfig = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+len+",height="+hei;
      window.open(page, 'foto'+num, winconfig);
    }

///

 // FUNCOES PARA VALIDACAO DOS FORMULARIOS //
 
 // funcao enviar //
function enviar() {
	if (navigator.appName == "Netscape") document.mainform.submit();
	   else document.forms["mainform"].submit();       
	}

// funcao que valida o formulario de trabalhe conosco //
function valida_trabalhe() {
	if (document.mainform.nome.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.nome.focus();
    document.mainform.alerta.value= 'Preencha o campo NOME.';
    return false;
  }

  if (!checkMail(document.mainform.email.value)) { return false; }
	
	if(document.mainform.ddd.value == "") {  
    document.mainform.alerta.focus();
    document.mainform.ddd.focus();
    document.mainform.alerta.value= 'Informe o DDD.';
    return false;
  }

//	if (!validaDdd(document.mainform.ddd.value)) { return false; }

	if(document.mainform.telefone.value == "") {  
    document.mainform.alerta.focus();
    document.mainform.telefone.focus();
    document.mainform.alerta.value= 'Preencha o campo TELEFONE.';
    return false;
  }

//	if (!validaFone(document.mainform.telefone.value)) { return false; }
	
  if (document.mainform.cidade.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.cidade.focus();
    document.mainform.alerta.value= 'Preencha o campo CIDADE.';
    return false;
  }

  if (document.mainform.estado.selectedIndex=="0") {
    document.mainform.alerta.focus();
    document.mainform.estado.focus();
    document.mainform.alerta.value= 'Selecione o ESTADO.';
    return false;
  }

  if (document.mainform.interesse.selectedIndex=="0") {
    document.mainform.alerta.focus();
    document.mainform.interesse.focus();
    document.mainform.alerta.value= 'Selecione a ÁREA DE INTERESSE.';
    return false;
  }
	
  if (document.mainform.contrato.selectedIndex=="0") {
    document.mainform.alerta.focus();
    document.mainform.contrato.focus();
    document.mainform.alerta.value= 'Selecione a TIPO DE CONTRATO.';
    return false;
  }

	if(document.mainform.remuneracao.value == "") {  
    document.mainform.alerta.focus();
    document.mainform.remuneracao.focus();
    document.mainform.alerta.value= 'Preencha o campo REMUNERAÇÃO.';
    return false;
  }

	if (!validaSalario(document.mainform.remuneracao.value)) { return false; }

	if (document.mainform.curriculo.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.curriculo.focus();
    document.mainform.alerta.value= 'Cole o seu CURRÍCULO.';
    return false;
  }


  else {return true;}

  document.mainform.alerta.value= 'enviando...';
}

// funcao que valida o formulario de fale conosco //
function valida_fale() {
	if (document.mainform.nome.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.nome.focus();
    document.mainform.alerta.value= 'Preencha o campo NOME.';
    return false;
  }

  if (!checkMail(document.mainform.email.value)) { return false; }

	if(document.mainform.ddd.value == "") {  
    document.mainform.alerta.focus();
    document.mainform.ddd.focus();
    document.mainform.alerta.value= 'Informe o DDD.';
    return false;
  }

//	if (!validaDdd(document.mainform.ddd.value)) { return false; }

	if(document.mainform.telefone.value == "") {  
    document.mainform.alerta.focus();
    document.mainform.telefone.focus();
    document.mainform.alerta.value= 'Preencha o campo TELEFONE.';
    return false;
  }

//	if (!validaFone(document.mainform.telefone.value)) { return false; }

  if (document.mainform.cidade.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.cidade.focus();
    document.mainform.alerta.value= 'Preencha o campo CIDADE.';
    return false;
  }

  if (document.mainform.estado.selectedIndex=="0") {
    document.mainform.alerta.focus();
    document.mainform.estado.focus();
    document.mainform.alerta.value= 'Selecione o ESTADO.';
    return false;
  }

	if (document.mainform.mensagem.value=="") {  
		document.mainform.alerta.focus();
    document.mainform.mensagem.focus();
    document.mainform.alerta.value= 'Preencha o campo MENSAGEM.';
    return false;
  }

  else {return true;}

  document.mainform.alerta.value= 'enviando...';
}

// Função que valida campo Telefone
function validaFone(x) {
	
	var entrada = x.value;
	//var valido = true;
	
	if (x.length == 8) {
		return true;
	}
	if (x.length != 8) {
		document.mainform.alerta.focus();
    document.mainform.telefone.focus();
    document.mainform.alerta.value= 'Preencha corretamente o campo telefone ex: 000-0000';
		return false;
	}
	for (var i = 8; i < 9; i++) {
		var caracter = entrada.substring(i,i+1);
		if (caracter != "-") {
			document.mainform.alerta.focus();
  	  document.mainform.telefone.focus();
    	document.mainform.alerta.value= 'Isso não parece ser um número de telefone.';
			return false;
		}
	}
	return true;
}

//Função que valida campo ddd
function validaDdd(x) {
	var entrada = x.value;

	if (x.length == 2) {
		return true;
	}
	if (x.length != 2) {
		document.mainform.alerta.focus();
    document.mainform.ddd.focus();
    document.mainform.alerta.value= 'Informe o DDD com apenas dois dígitos ex: 00';
		return false;
	}
	return true;
}

// Função que valida campo Salario
function validaSalario() {
	valor = document.mainform.remuneracao.value;
	if (isNaN(valor)) {
		document.mainform.remuneracao.focus();
		document.mainform.alerta.value= 'Digite apenas valores numéricos! ex: 1500.00'; 
		return false;
		}
	return true;
}

// funcao que checa se o e-mail e valido //
function checkMail(x) {
    var y = 0;
    if (document.mainform.email.value=="") {  
        document.mainform.email.focus();
        document.mainform.alerta.value= 'O campo E-MAIL deve ser preenchido.';
        return false;
    }
    if (x.substring(x.length -1, x.length) != '.' && x.substring(x.length -1, x.length) != '@') {
        if (x.indexOf("@") != -1) { 
            if (x.indexOf(".") != -1) { 
                y = 1;
            }
        }
    }
    if (y == 0) {                                                                               
        document.mainform.email.focus();                                                        
        document.mainform.alerta.value= ' Verifique se o e-mail está correto.';    
        return false;                                                                            
    }                                                                                           
return true
}

// funcao que nao deixa editar o campo alerta //
function sai() {
   document.mainform.nome.focus();  
}	