function changeColor(id, tipo) {
	if (tipo == "on") {
		document.getElementById(id).className = "menuLinkOn";
		//document.getElementById(id).backgroundColor = "#3260a4";
	}
	if (tipo == "out") {
		//document.getElementById(id).style.backgroundColor = "transparent";
		document.getElementById(id).className = "menuLink";
	}
}
function validarLogin() {
	var passou = true;
	var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

	if (document.formLogin.user.value == "") {
		passou = false; alerta += "- E-mail preenchido incorretamente.\n";
	}else{
		if (!validarEmail(document.formLogin.user.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
		}
	}
  	if (document.getElementById("pass").value == "") {
		passou = false; alerta += "- Senha preenchido incorretamente.\n";
  	}
  
	if (passou == true) { return true; }
  	else { alert(alerta); return false; }
}

function validarContato() {
	var passou = true;
	var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

	if (document.getElementById("nome").value == "") {
		passou = false; alerta += "- Nome preenchido incorretamente.\n";
  	}
  	if (document.getElementById("empresa").value == "") {
		passou = false; alerta += "- Empresa preenchido incorretamente.\n";
  	}
	if (document.getElementById("assunto").value == "") {
		passou = false; alerta += "- Assunto preenchido incorretamente.\n";
  	}
	if (document.contato.email.value == "") {
		passou = false; alerta += "- E-mail preenchido incorretamente.\n";
	}else{
		if (!validarEmail(document.contato.email.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
		}
	}
  	if (document.getElementById("cidade").value == "") {
		passou = false; alerta += "- Cidade preenchido incorretamente.\n";
  	}
	if (document.getElementById("estado").value == "") {
		passou = false; alerta += "- Estado preenchido incorretamente.\n";
  	}
  	if (document.getElementById("telefone").value == "") {
		passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  	}
	if (document.getElementById("mensagem").value == "") {
		passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  	}
  
	if (passou == true) { return true; }
  	else { alert(alerta); return false; }
}

function validarEmail(email)
{
	var s = email;
	var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
	return true;
	else
	return false;
}
