// JavaScript Document

function novoIdioma(idioma) {
	window.location.href = "scripts/mudaIdioma.php?idioma=" + idioma + "&pagina=" + window.location.href;
}

function novoCaptcha() {
	document.getElementById("imgCaptcha").src = document.getElementById("imgCaptcha").src + "1";
	document.getElementById("txtCaptcha").value = "";
	document.getElementById("txtCaptcha").focus();
}

function lembrarSenha() {
	c1 = "chkLembrarEmail";
	c2 = "chkLembrarSenha";
	if (document.getElementById(c2).checked == false) {
		document.getElementById(c1).disabled = false;
		document.getElementById(c1).checked = false;
	} else {
		document.getElementById(c1).checked = "checked";
		document.getElementById(c1).disabled = "disabled";
	}
}

//Validação

function preValidacao(obj, evento) {
	valor = document.getElementById(obj).value;
	switch(obj) {
		case "txtUsuario":
			ER_tamanho = /^.{4,32}$/;
			ER_caracteres = /^[^ @]*$/;
			e_tamanho = ER_tamanho.test(valor);
			e_caracteres = ER_caracteres.test(valor);
			break;
	}
	document.getElementById("spanErroTxtUsuario").innerHTML = "";
	if(!e_tamanho) {
		document.getElementById("spanErroTxtUsuario").innerHTML += "Utilize de 4 a 32 caracteres.<br />";
	}
	if(!e_caracteres) {
		document.getElementById("spanErroTxtUsuario").innerHTML += "N&atilde;o utilize espa&ccedil;o ou @.<br />";
	}
	
}
