// JavaScript Document


// FUNÇÃO - CAMPOS OBRIGATÓRIOS
function valida_campos_contato(frm_contato){
	
	// VARIAVEIS 
	var nome 			= document.frm_contato.txt_nome.value;
	var ddd_tel 		= document.frm_contato.txt_ddd_tel.value;	
	var telefone 		= document.frm_contato.txt_telefone.value;
	var ddd_cel 		= document.frm_contato.txt_ddd_cel.value;
	var celular 		= document.frm_contato.txt_celular.value;
	var email 			= document.frm_contato.txt_email.value;	
	var cidade 			= document.frm_contato.txt_cidade.value;
	var ramo		 	= document.frm_contato.txt_ramo.value;
	var uso_pessoal		= document.frm_contato.int_para1;
	var uso_comercial	= document.frm_contato.int_para2;
	var mensagem		= document.frm_contato.mensagem.value;	

	// VALIDAÇÃO NOME
		if(nome == null || nome == ""){
		alert("O NOME e de preechimento obrigatorio");
		frm_contato.txt_nome.focus();
		return false;
	}
	  
	// VALIDAÇÃO DDD TELEFONE
		if(ddd_tel == null || ddd_tel == ""){
		alert("O DDD e de preechimento obrigatorio");
		frm_contato.txt_ddd_tel.focus();
		return false;
	}
	
		if(ddd_tel.length < 2){
		alert("O DDD esta incompleto");
		frm_contato.txt_ddd_tel.focus();
		return false;
	}


	// VALIDAÇÃO  TELEFONE
		if(telefone == null || telefone == ""){
		alert("O TELEFONE e de preechimento obrigatorio");
		frm_contato.txt_telefone.focus();
		return false;
	}
	
		if(telefone.length < 7){
		alert("O TELEFONE esta incompleto");
		frm_contato.txt_telefone.focus();
		return false;
	}


		// VALIDAÇÃO DDD CELULAR
		if (ddd_cel.length!=0 && ddd_cel.length < 2){
		alert("O DDD esta incompleto");
		frm_contato.txt_ddd_cel.focus();
		return false;
	}
		// VALIDAÇÃO CELULAR
		if (celular.length!=0 && celular.length < 8){
		alert("O CELULAR esta incompleto");
		frm_contato.txt_celular.focus();
		return false;
	}
	


		//VALIDAÇÃO D0 CELULAR E DDD DO CELULAR
		if(ddd_cel.length!=0 && celular.length==0 ){
		alert("Por Favor, preencha o numero do CELULAR");
		frm_contato.txt_celular.focus();
		return false;
	}
	
	
		if(ddd_cel.length==0 && celular.length!=0){
		alert("Por Favor, preencha o DDD DO CELULAR");
		frm_contato.txt_ddd_cel.focus();
		return false;
	}



	// VALIDAÇÃO E-MAIL
		if(email == null || email == ""){
		alert("O E-MAIL e de preechimento obrigatorio");
		frm_contato.txt_email.focus();
		return false;
	}
	
		if ((email.length != 0 && email.indexOf("@") < 1)||email.indexOf('.') < 7)  {
		alert("E-MAIL incorreto");
		frm_contato.txt_email.focus();
		return false;	
	  }


		// VALIDAÇÃO CIDADE
		if(cidade == null || cidade == ""){
		alert("A CIDADE e de preechimento obrigatorio");
		frm_contato.txt_cidade.focus();
		return false;
	}
	
		// VALIDAÇÃO RAMO
		if(ramo == null || ramo == ""){
		alert("O RAMO DE ATIVIDADE e de preechimento obrigatorio");
		frm_contato.txt_ramo.focus();
		return false;
	}	
	
	
		// VALIDAÇÃO AREA DE INTERESSE
		if(!(uso_pessoal.checked || uso_comercial.checked)){
		alert("A AREA DE INTERESSE e de preechimento obrigatorio");
		return false;
		}
		
		// VALIDAÇÃO CONFIRMAÇÃO DE MENSAGEM
		if(mensagem == null || mensagem == ""){
		alert("A MENSAGEM e de preechimento obrigatorio");
		frm_contato.mensagem.focus();
		return false;
	}

	return true;
	}
	
		// BLOQUEIA LETRAS
		function IsNumber(evt)
		{
			var charCode = (evt.which) ? evt.which : event.keyCode;
			return (charCode>=48 && charCode<=57 || charCode<20);
      	}
	  
		// BLOQUEIA NUMEROS
		function IsLetter(evt){
		var charCode = (evt.which) ? evt.which : event.keyCode;
      	return (charCode >= 65 && charCode <= 90 || charCode >= 61 && charCode <= 122 || charCode == 32 || charCode == 08 || charCode == 13 || charCode == 132);
      	}	  
		