/*
'********************************************************************************
'	Desenvolvido em:	05/02/2007  		Autor:    		RONI COSTA
'	Atualizado em  :	22/03/2007			Autor:			RONI COSTA
'********************************************************************************
*/

/*# VERIFICAR #*/
function comentarioVerificar() {
	erroVC		= '';

	if (document.comentarioFRM.emailVC.value.length != 0) {
		invalidChars	= "/:,;!?<>*&^%$#(){}|~`"
		atPos			= document.comentarioFRM.emailVC.value.indexOf("@",1)
		periodPos		= document.comentarioFRM.emailVC.value.indexOf(".",atPos)
		
		for (i=0; i<invalidChars.lenght; i++) {
			badChar		= invalidChars.charAt(i)
			
			if (document.comentarioFRM.emailVC.value.length.indexOf(badChar,0) > -1) {
			 	erroVC = '- Invalid E-MAIL.\n';
			}
		}
		if (atPos == -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		if(document.comentarioFRM.emailVC.value.indexOf("@",atPos+1) > -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		if (periodPos == -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		if ((periodPos+3) > document.comentarioFRM.emailVC.value.length) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
	} else {
		erroVC		= erroVC + '- Type your E-MAIL.\n';
	}

	if (document.comentarioFRM.textoVC.value.length == 0) {
	 	erroVC	= erroVC + '- Type your COMMENTS.\n';
	}
	
	if (erroVC.length == 0) {
		document.getElementById("enviarBT_off").style.display	= 'inline';
		document.getElementById("enviarBT_on").style.display	= 'none';
		document.getElementById("comentarioFRM").submit();
} else {
		alert('ATTENTION!\n\n' + erroVC);
		return false;
	}
}

/*# VALIDAR EMAIL - VERIFICA SE O EMAIL CADASTRADO OU NÃO #*/
function validarEmail(vc_email){
	
	if (vc_email.length > 0) {
		var erroVC	= '';
		
		invalidChars	= "/:,;!?<>*&^%$#(){}|~`"
		atPos			= vc_email.indexOf("@",1)
		periodPos		= vc_email.indexOf(".",atPos)
		
		for (i=0; i<invalidChars.lenght; i++) {
			badChar		= invalidChars.charAt(i)
			
			if (vc_email.length.indexOf(badChar,0) > -1) {
				erroVC = '- Invalid E-MAIL.\n';
			}
		}
		if (atPos == -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		if(vc_email.indexOf("@",atPos+1) > -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		if (periodPos == -1) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		
		if ((periodPos+3) > vc_email.length) {
			 erroVC	= '- Invalid E-MAIL.\n';
		}
		
		if (erroVC.length > 0){
			alert('ATTENTION!\n\n' + erroVC);
			comentarioFRM.emailVC.value	=	'';
			comentarioFRM.emailVC.focus();
			return false;
		}else{
			iframe_virtual('codigos/validar_email.asp?emailVC='+vc_email);
		}
	}
	
}
