/*
'********************************************************************************
'	Desenvolvido em:	16/05/2006  	Autor:    		RAFAEL FORTE
'********************************************************************************
*/

/*# VERIFICAR #*/
function contatoVerificar() {
	erroVC		= '';

	if (document.contatoFRM.nomeVC.value.length == 0) {
	 	erroVC	= erroVC + '- Digite o NOME.\n';
	}
		
	if (document.contatoFRM.emailVC.value.length != 0) {
		invalidChars	= "/:,;!?<>*&^%$#(){}|~`"
		atPos			= document.contatoFRM.emailVC.value.indexOf("@",1)
		periodPos		= document.contatoFRM.emailVC.value.indexOf(".",atPos)
		
		for (i=0; i<invalidChars.lenght; i++) {
			badChar		= invalidChars.charAt(i)
			
			if (document.contatoFRM.emailVC.value.length.indexOf(badChar,0) > -1) {
			 	erroVC = '- O E-MAIL digitado é inválido.\n';
			}
		}
		if (atPos == -1) {
			 erroVC	= '- O E-MAIL digitado é inválido.\n';
		}
		if(document.contatoFRM.emailVC.value.indexOf("@",atPos+1) > -1) {
			 erroVC	= '- O E-MAIL digitado é inválido.\n';
		}
		if (periodPos == -1) {
			 erroVC	= '- O E-MAIL digitado é inválido.\n';
		}
		if ((periodPos+3) > document.contatoFRM.emailVC.value.length) {
			 erroVC	= '- O E-MAIL digitado é inválido.\n';
		}
	} else {
			 erroVC	= erroVC + '- Digite o E-MAIL.\n';
	}
		
	if (document.contatoFRM.mensagemVC.value.length == 0) {
	 	erroVC	= erroVC + '- Digite a MENSAGEM.\n';
	}
	
	if (erroVC.length == 0) {
		document.contatoFRM.enviarBT.value		= 'aguarde';
		document.contatoFRM.enviarBT.disabled	= true;
		document.contatoFRM.submit();
	} else {
		alert('ATENÇÃO!\n\n' + erroVC);
		return false;
	}
}
