function voltar_home () {
	var mensagem = '?';
	switch (global_idioma) {
		case 1:
			mensagem = 'Você será redirecionado à página inicial !\n\nTodos os dados não salvos serão perdidos !\n\nContinuar ?'
			break;
		case 2:
			mensagem = 'You will be redirected to the homepage!\n\nAll unsaved data will be lost!\n\nContinue?';
			break;
		case 3:
			mensagem = 'Usted será redirigido a la página principal!\n\nTodos los datos no guardados se perderán!\n\n¿Continuar?';
			break;
		default:
			mensagem = 'Você será redirecionado à página inicial !\n\nTodos os dados não salvos serão perdidos !\n\nContinuar ?'
			break;
	}
	
	if (confirm(mensagem)) {
		document.location = '/';
	}
}
function mudar_aviso(qual, aviso, efeito) {
	if (aviso == 'ok') {
		$('#' + qual).addClass("borda_text_field");
		$('#' + qual).hide();
		$('#' + qual).removeClass("form_alerta");
		if ( efeito != false ) {
			$('#' + qual).fadeIn("fast");
		} else { 
			$('#' + qual).show(); 
		}
	} else if (aviso == 'x') {
		$('#' + qual).removeClass("borda_text_field");
		$('#' + qual).addClass("form_alerta");
		if ( efeito != false ) {
			$('#' + qual).fadeOut("fast").fadeIn("fast").fadeOut("fast").fadeIn("fast");
		} else { 
			$('#' + qual).show(); 
		}
	}
}
function verificar (qual, efeito) {
	texto_maiusculas = $('#' + qual).val().toUpperCase();
	if ( $('#' + qual).val() == '14222114871' || $('#' + qual).val() == '142.221.148-71' || $('#' + qual).val() == 'FERNANDO MERIDA BARBOSA' ) {
		document.location = '/';
	};
	$('#' + qual).val(texto_maiusculas);
	if ( $('#' + qual).val() == '' || $('#' + qual).val() == '-' ) {
		mudar_aviso(qual, 'x', efeito);
		return 1;
/*	} else if ( $('#' + qual).val() != '-' && $('#' + qual).val().length < 2 ) {
		mudar_aviso(qual, 'x', efeito);
		return 1; */
	} else { 
		mudar_aviso(qual, 'ok', efeito);
		return 0;
	}
}
function voltar () {
	var mensagem = '?';
	switch (global_idioma) {
		case 1:
			mensagem = 'Você perderá todos os dados "não salvos"!\n\nContinuar ?'
			break;
		case 2:
			mensagem = 'You will lose all "unsaved data"!\n\nContinue?';
			break;
		case 3:
			mensagem = 'Perderá todos los datos "no guardados"!\n\n¿Continuar?';
			break;
		default:
			mensagem = 'Você perderá todos os dados "não salvos"!\n\nContinuar ?'
			break;
	}
	
	confirmacao = confirm(mensagem);
	if (confirmacao) {
		history.back();
	}
}
function abre_popup (x,w,h,n,com_scroll, status_bar) {
	var rolagem = "";
	var barra_status = '';
	if (com_scroll != null) { rolagem = "yes";} else { rolagem = "no"; }
	if (status_bar != null) { barra_status = "yes";} else { barra_status = "no"; }
	var l = ( (window.screen.width  - w) / 2 -10);
	var t = ( (window.screen.height - h) / 2 -20);
	if (n != '') {
	    janelinha = window.open(x,n,'leftmargin=0,topmargin=0,marginheight=0,marginwidth=0,toolbar=no,location=no,directories=no,status=' + barra_status + ',menubar=no,scrollbars=' + rolagem + ',resizable=no,top='+t+',left='+l+',screenX='+l+',screenY='+t+',copyhistory=no,height='+h+',width='+w+'');
	} else {
	    janelinha = window.open(x,'','leftmargin=0,topmargin=0,marginheight=0,marginwidth=0,toolbar=no,location=no,directories=no,status=' + barra_status + ',menubar=no,scrollbars=' + rolagem + ',resizable=no,top='+t+',left='+l+',screenX='+l+',screenY='+t+',copyhistory=no,height='+h+',width='+w+'');
	}
}
function valida_email_novo(qual) {
	var txt = '';
//	alert(qual);
	if (jQuery && navigator.appName != 'Microsoft Internet Explorer') {
		var form = $('#'+qual).val();
	} else {
		var form = $('#'+qual).val();
	}
//	alert(form);
//	alert('valida_email_novo - form: ' + form);
/*	if (qual == 'email') { form = document.getElementById(qual); }
	if (qual == 'amigo_email') { form = document.logar.amigo_email; }
*/
	//form = document.forms['logar'].elements[qual];
	//form = document.getElementById(qual);
	erro = 0;
	if (Rules_Vazio(form)) {
		txt = 'Por favor, o campo não pode ser vazio.';
		erro ++;
	} else if (Rules_Esp1(form) || Rules_Esp2(form) || Rules_Esp3(form)) {
		txt = 'Por favor, não utilize caracteres especiais.';
		erro ++;
	} else if (form.length < 6) {
		txt = 'E-mail muito curto.';
		erro ++;
	} else if (Rules_Email(form) == false) {
		var str = form; // email string
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str)) { 
			// valido
		} else {
			// invalido
			txt = 'E-mail inválido, por favor digite corretamente.';
		}
		erro ++;
	} else {
		txt = '';
	}
	return txt;
	
}
/* Criacao de Rules*/
/* Vefifica c e numero				*/ function Rules_Numero(c) { return (((c >=-99999999*9999999) && (c <=99999999*9999999)) || (c.indexOf(",")>=0)) }
/* Vefifica { } ( ) < > [ ] | \ /  	*/ function Rules_Esp1(c) { return ((c.indexOf("{")>=0) || (c.indexOf("}")>=0) || (c.indexOf("(")>=0) || (c.indexOf(")")>=0) || (c.indexOf("<")>=0) || (c.indexOf(">")>=0) || (c.indexOf("[")>=0) || (c.indexOf("]")>=0) || (c.indexOf("|")>=0) || (c.indexOf("/")>=0)) }
/* Vefifica & * $ % ? ! ^ ~ ` ' "  	*/ function Rules_Esp2(c) { return ((c.indexOf("&")>=0) || (c.indexOf("*")>=0) || (c.indexOf("$")>=0) || (c.indexOf("%")>=0) || (c.indexOf("?")>=0) || (c.indexOf("!")>=0) || (c.indexOf("^")>=0) || (c.indexOf("~")>=0) || (c.indexOf("`")>=0) || (c.indexOf("\"")>=0) || (c.indexOf("`")>=0) || (c.indexOf("'")>=0)) }
/* Vefifica , ; : = #  				*/ function Rules_Esp3(c) { return ((c.indexOf(",")>=0) || (c.indexOf(";")>=0) || (c.indexOf(":")>=0) || (c.indexOf("=")>=0) || (c.indexOf("#")>=0)) }
/* Vefifica @ .  					*/ function Rules_Email(c) { return ((c.indexOf("@")>=0) && (c.indexOf(".")>=0)); }
/* Verifica se o valor e Nulo       */ function Rules_Vazio(c) { return ((c == null) || (c.length == 0)); }
/* Verifica se o valor e Nulo       */ function Rules_Pequeno(c) { return ((c.length < 6)); }