// JavaScript Document
function cadastrar () { 
	  if (document.cadastro.empresa.value.length < 1)
	  {
		alert("Preencha o campo \"Empresa\".");
		document.cadastro.empresa.focus();
		return (false);
				
	  }
		  if (document.cadastro.contato.value.length < 1)
	  {
		alert("Preencha o campo \"Contato\".");
		document.cadastro.contato.focus();
		return (false);
				
	  }
	  if (document.cadastro.email.value.length < 1)
	  {
		alert("Preencha o campo \"Seu E-mail\".");
		document.cadastro.email.focus();
		return (false);
	
	  }
		if (document.cadastro.email.value.indexOf("@") < 0) {
		msg = "";
		msg += "@ não encontrado no campo Seu e-mail!.\n";
		alert(msg + "\n\n");
		
		return false;
		
	}
		if (document.cadastro.email.value.indexOf(".com") < 0) {
		msg = "";
		msg += "(.com) não encontrado no campo Seu e-mail!.\n";
		alert(msg + "\n\n");
		
		return false;
	}
		  if (document.cadastro.telefone.value.length < 1)
	  {
		alert("Preencha o campo \"Telefone\".");
		document.cadastro.telefone.focus();
		return (false);
				
	  }
	  if (document.cadastro.estado.value == 'X')
	  {
		alert(" Favor Escolher o Estado!!! ");
		document.cadastro.estado.focus();
		return (false);
		 }
		  if (document.cadastro.mensagem.value.length < 1)
	  {
		alert("Preencha o campo \"Mensagem\".");
		document.cadastro.mensagem.focus();
		return (false);
				
	  }
	return true;
	
}
// -->

function cadas () {
	  if (document.form2.cargo.value == 'X')
	  {
		alert(" Favor Escolher Cargo Pretendido!!! ");
		document.form2.cargo.focus();
		return (false);
		 }
	  if (document.form2.nome.value.length < 1)
	  {
		alert("Preencha o campo \"Nome\".");
		document.form2.nome.focus();
		return (false);
				
	  }
		  if (document.form2.endereco.value.length < 1)
	  {
		alert("Preencha o campo \"Endereço\".");
		document.form2.endereco.focus();
		return (false);
				
	  }
		  if (document.form2.bairro.value.length < 1)
	  {
		alert("Preencha o campo \"Bairro\".");
		document.form2.bairro.focus();
		return (false);
				
	  }
	  if (document.form2.email.value.length < 1)
	  {
		alert("Preencha o campo \"Seu E-mail\".");
		document.form2.email.focus();
		return (false);
	
	  }
		if (document.form2.email.value.indexOf("@") < 0) {
		msg = "";
		msg += "@ não encontrado no campo Seu e-mail!.\n";
		alert(msg + "\n\n");
		
		return false;
		
	}
		if (document.form2.email.value.indexOf(".com") < 0) {
		msg = "";
		msg += "(.com) não encontrado no campo Seu e-mail!.\n";
		alert(msg + "\n\n");
		
		return false;
	}
		  if (document.form2.telefone.value.length < 1)
	  {
		alert("Preencha o campo \"Telefone\".");
		document.form2.telefone.focus();
		return (false);
				
	  }
		  if (document.form2.idade.value.length < 1)
	  {
		alert("Preencha o campo \"Idade\".");
		document.form2.idade.focus();
		return (false);
	  }
		  if (document.form2.esc.value.length < 1)
	  {
		alert("Preencha o campo \"Escolaridade\".");
		document.form2.esc.focus();
		return (false);
	  }
		  if (document.form2.salario.value.length < 1)
	  {
		alert("Preencha o campo \"Pretenção Salarial\".");
		document.form2.salario.focus();
		return (false);
	  }
		  if (document.form2.exper.value.length < 1)
	  {
		alert("Preencha o campo \"Experiências\".");
		document.form2.exper.focus();
		return (false);
	  }
	return true;
	
}
// -->
function fone(obj) {
switch (obj.value.length) {
    case 1:
        obj.value = "(" + obj.value;
        break;
    case 3:
        obj.value = obj.value + ") ";
        break;    
    case 9:
        obj.value = obj.value + "-";
        break;    
    case 14:
        document.getElementById("cidade").focus();
        break;
}
}
// -->

function cadastra () {
	  if (document.cadastras.cliente.value.length < 1)
	  {
		alert("Preencha o campo \"Cliente\".");
		document.cadastras.cliente.focus();
		return (false);
				
	  }
		  if (document.cadastras.pedido.value.length < 1)
	  {
		alert("Preencha o campo \"Número do Pedido\".");
		document.cadastras.pedido.focus();
		return (false);
				
	  }
		  if (document.cadastras.nfatura.value.length < 1)
	  {
		alert("Preencha o campo \"Nº da Nota Fiscal\".");
		document.cadastras.nfatura.focus();
		return (false);
				
	  }
	  if (document.cadastras.valor.value.length < 1)
	  {
		alert("Preencha o campo \"Valor da Nota Fiscal\".");
		document.cadastras.valor.focus();
		return (false);
	
	  }
		  if (document.cadastras.par.value.length < 1)
	  {
		alert("Preencha o campo \"Nº de Pares\".");
		document.cadastras.par.focus();
		return (false);
				
	  }
		  if (document.cadastras.data.value.length < 10)
	  {
		alert("Preencha o campo \"Data\".");
		document.cadastras.data.focus();
		return (false);
	  }
		  if (document.cadastras.transporte.value.length < 1)
	  {
		alert("Preencha o campo \"Transportadora\".");
		document.cadastras.transporte.focus();
		return (false);
	  }
	return true;
	
}
// -->
   function mascaraData(campoData){
              var data = campoData.value;
              if (data.length == 2){
                  data = data + '/';
                  document.forms[0].data.value = data;
      return true;              
              }
              if (data.length == 5){
                  data = data + '/';
                  document.forms[0].data.value = data;
                  return true;
              }
         }
//-->
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
}
//-->
function FormataCNPJ(cnpj, teclapres){

   if(window.event){
    var tecla = teclapres.keyCode;
   }else  tecla = teclapres.which;

   var vr = new String(cnpj.value);
   vr = vr.replace(".", "");
   vr = vr.replace(".", "");
   vr = vr.replace("/", "");
   vr = vr.replace("-", "");

   tam = vr.length + 1;

   
   if (tecla != 9 && tecla != 8){
      if (tam > 2 && tam < 6)
         cnpj.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
      if (tam >= 6 && tam < 9)
         cnpj.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
      if (tam >= 9 && tam < 13)
         cnpj.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
      if (tam >= 13 && tam < 15)
         cnpj.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
      }
}
// -->
   function mascaraDatanasc(campoData){
              var idade = campoData.value;
              if (idade.length == 2){
                  idade = idade + '/';
                  document.forms[0].idade.value = idade;
      return true;              
              }
              if (idade.length == 5){
                  idade = idade + '/';
                  document.forms[0].idade.value = idade;
                  return true;
              }
         }
//-->
function referencia(){
var txt = document.getElementById("referencias").value + '\n ' + document.getElementById("ref").value +'-' + document.getElementById("contato_ref").value +'-' + document.getElementById("telefone_ref").value;
document.getElementById("ref").value ='';
document.getElementById("contato_ref").value ='';
document.getElementById("telefone_ref").value ='';
document.getElementById("referencias").value = txt; 

}
function cursos(){
var txt1 = document.getElementById("curso").value + '\n ' + document.getElementById("ocursos").value +'-' + document.getElementById("local").value +'-' + document.getElementById("ano").value;
document.getElementById("ocursos").value ='';
document.getElementById("local").value ='';
document.getElementById("ano").value ='';
document.getElementById("curso").value = txt1; 

}
function fabtrab(){
var txt2 = document.getElementById("fabricas").value + '\n ' + document.getElementById("fabricatra").value +'-' + document.getElementById("cont").value +'-' + document.getElementById("tel_fab").value;
document.getElementById("fabricatra").value ='';
document.getElementById("cont").value ='';
document.getElementById("tel_fab").value ='';
document.getElementById("fabricas").value = txt2; 

}
function referencia_vend(){
var txt3 = document.getElementById("referencias_ven").value + '\n ' + document.getElementById("ref_ven").value +'-' + document.getElementById("contato_ref_ven").value +'-' + document.getElementById("telefone_ref_ven").value;
document.getElementById("ref_ven").value ='';
document.getElementById("contato_ref_ven").value ='';
document.getElementById("telefone_ref_ven").value ='';
document.getElementById("referencias_ven").value = txt3; 

}
function cursos_vend(){
var txt4 = document.getElementById("curso_ven").value + '\n ' + document.getElementById("ocursos_ven").value +'-' + document.getElementById("local_ven").value +'-' + document.getElementById("ano_ven").value;
document.getElementById("ocursos_ven").value ='';
document.getElementById("local_ven").value ='';
document.getElementById("ano_ven").value ='';
document.getElementById("curso_ven").value = txt4; 

}

