

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//valida formulario Contato
function ValidaForm_Contato(form){
	if(form.nome_contato.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome_contato.focus();
		return false;
	}
	var str_email = form.email_contato.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' )){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email_contato.focus();
    	return false;
	}
	if(form.senha.value.length<=1){
		alert("O campo senha deve estar preenchido corretamente.");
		form.senha.focus();
		return false;
	}
	if(form.consenha.value.length<=1){
		alert("O campo Confirmar Senha deve estar selecionado corretamente.");
		form.consenha.focus();
		return false;
	}
	if(form.telefone_contato.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone_contato.focus();
		return false;
	}
	if(form.cidade_contato.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade_contato.focus();
		return false;
	}
	if(form.estado_contato.value.length<=1){
		alert("O campo Estado deve estar selecionado corretamente.");
		form.estado_contato.focus();
		return false;
	}
	if(form.mensagem_contato.value.length<=1){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem_contato.focus();
		return false;
	}
	if(form.cod.value.length<=1){
		alert("O campo Código de Segurança deve estar preenchido corretamente.");
		form.cod.focus();
		return false;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Funcao da Mascara
function fnMascara(objeto,evt,mask){ 
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';	
	var Numeros = '0123456789';
	var Fixos  = '().-:/ ';
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";
	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if(evt){
		var ntecla = (evt.which) ? evt.which : evt.keyCode;
		tecla = Charset.substr(ntecla - 32, 1);
		if(ntecla < 32) return true;
		var tamanho = value.length;
		if(tamanho >= mask.length) return false;
		var pos = mask.substr(tamanho,1);
		while(Fixos.indexOf(pos) != -1){
 	 		value += pos;
 	 		tamanho = value.length;
 	 		if(tamanho >= mask.length) return false;
 	 		pos = mask.substr(tamanho,1);
		}
		switch(pos){
   			case '#': if(Numeros.indexOf(tecla) == -1) return false; break;
   			case 'A': if(LetrasU.indexOf(tecla) == -1) return false; break;
   			case 'a': if(LetrasL.indexOf(tecla) == -1) return false; break;
   			case 'Z': if(Letras.indexOf(tecla) == -1) return false; break;
   			case '*': objeto.value = value; return true; break;
   			default: return false; break;
 		}
	}
	objeto.value = value;
	return true;
}


