<!--

/* FUNCTION VALIDA CAMPO EM BRANCO */

function CampoObrigatorio(objParam){
	if(objParam.value==''){
		return false;
	}else{
		return true;
	}
}



/* FUNCTION VALIDA E-MAIL */

function ValidaEmail(objParam){
	var invalid, s;
	invalid = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	var s;
	if(!CampoObrigatorio(objParam)){
		return false;
	}
	else if (invalid.test(objParam.value) == false){
		return false;
	}
	else{
		return true;
	}
}



/* FUNCTION VALIDA SELECT */

function Select(objParam){
	if(objParam.value==0){
		return false;
	}else{
		return true;
	}
}



/* FUNCTION VALIDA NÚMERO OBRIGATÓRIO */

function NumeroObrigatorio(objParam){
	if(!CampoObrigatorio(objParam)){
		return false;
	}else if(isNaN(objParam.value)){
		return false;
	}else{
		return true;
	}
}



/* FUNCTION VALIDA NÚMERO */

function NumeroOk(objParam){
	if(!isNaN(objParam.value)){
		return false;
	}else{
		return true;
	}
}



/* FUNCTION VALIDA GERAL FORMULÁRIO DE CONTATO */

function ValidaGeral(f){
	if(!CampoObrigatorio(f.nome)){
		alert("O seu NOME não foi preenchido");
		f.nome.style.backgroundColor = "#ffffcc";
		f.nome.focus();
		f.nome.value = '';
		f.nome.style.color = "#cc6666";
		return false;
	}
	else if(!ValidaEmail(f.email)){
		f.nome.style.backgroundColor = "#ffffcc";
		f.nome.style.color = "#cc9999";
		alert("O E-MAIL não foi preenchido corretamente");
		f.email.style.backgroundColor = "#ffffcc";
		f.email.focus();
		f.email.value = '';
	    f.email.style.color = "#cc6666";
		return false;
	}
	else if(!NumeroObrigatorio(f.prefixo_tel)){
		f.email.style.backgroundColor = "#ffffcc";
		f.email.style.color = "#cc9999";
		alert("O campo PREFIXO do telefone deve ser preenchido somente com números");
		f.prefixo_tel.style.backgroundColor = "#ffffcc";
		f.prefixo_tel.focus();
		f.prefixo_tel.value = '';
		f.prefixo_tel.style.color = "#cc6666";		
		return false;
	}
	else if(!NumeroObrigatorio(f.telefone)){
		f.prefixo_tel.style.backgroundColor = "#ffffcc";
		f.prefixo_tel.style.color = "#cc9999";	
		alert("O campo TELEFONE deve ser preenchido somente com números");
		f.telefone.style.backgroundColor = "#ffffcc";
		f.telefone.focus();
		f.telefone.value = '';
		f.telefone.style.color = "#cc6666";		
		return false;	
	}
	else if(NumeroOk(f.prefixo_cel)){
		f.telefone.style.backgroundColor = "#ffffcc";
		f.telefone.style.color = "#cc9999";			
		alert("O campo PREFIXO do celular deve ser preenchido somente com números");
		f.prefixo_cel.style.backgroundColor = "#ffffcc";
		f.prefixo_cel.focus();
		f.prefixo_cel.value = '';
		f.prefixo_cel.style.color = "#cc6666";		
		return false;
	}
	else if(NumeroOk(f.celular)){
		f.prefixo_cel.style.backgroundColor = "#ffffcc";
		f.prefixo_cel.style.color = "#cc9999";	
		alert("O campo CELULAR deve ser preenchido somente com números");
		f.celular.style.backgroundColor = "#ffffcc";
		f.celular.focus();
		f.celular.value = '';
		f.celular.style.color = "#cc6666";		
		return false;			
	}
	else if(!Select(f.assunto)){
		f.celular.style.backgroundColor = "#ffffcc";
		f.celular.style.color = "#cc9999";			
		alert("Selecione um assunto");
		f.assunto.style.backgroundColor = "#ffffcc";
		f.assunto.focus();
		f.assunto.value = '0';
		f.assunto.style.color = "#cc6666";
		return false;			
	}
	else{
		f.celular.style.backgroundColor = "#ffffcc";
		f.celular.style.color = "#cc9999";			
		f.assunto.style.backgroundColor = "#ffffcc";
		f.assunto.style.color = "#cc9999";		
		return true;		
	}
}

-->