var mnAc = '#97D340';
var mnPr = '#5F81E2';
var mnMd = '#DC771D';

function validar () {

	if (Vazio(document.cadastroUsuario.nome)) {
		alert ('Favor informar seu nome!');
		return false;
	}
	else
	if (Vazio(document.cadastroUsuario.dtnascimento)) {
		alert ('Favor informar sua data de nascimento!');
		return false;
	}
	/*else
	if ((Vazio(document.cadastroUsuario.senha)) ||
		(document.cadastroUsuario.senha.value != document.cadastroUsuario.confSenha.value)) {
		alert ('Senha informada não é a mesma da digitada no campo de confirmação de senha!');
		return false;
	}*/
		
	//document.cadastroUsuario.submit();

	RegistrisesSucesso();
}

/*function RegistrisesSucesso()
{
    var url = "mm_home/inserirUsuario.php?";
	var div = document.getElementById('homeCentro');
		
	httpRegistrise = null;
	var httpRegistrise = new Http();
	url = url + "code=" + escape(document.cadastroUsuario.code.value);
	url = url + "&email=" + escape(document.cadastroUsuario.email.value);
	url = url + "&nome=" + escape(document.cadastroUsuario.nome.value);
	url = url + "&sexo=" + escape(document.cadastroUsuario.sexo.value);
	url = url + "&dtnascimento=" + escape(document.cadastroUsuario.dtnascimento.value);
	url = url + "&time=" + new Date();
	
	httpRegistrise.xmlhttp.open("GET", url, true);
	httpRegistrise.xmlhttp.onreadystatechange = function(){
									div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpRegistrise.xmlhttp.readyState == 4){
										if(httpRegistrise.xmlhttp.status == 200){
		                                    div.innerHTML = httpRegistrise.xmlhttp.responseText;
										 }
									 }
								  };
	httpRegistrise.xmlhttp.send(null);
}*/

function validarReset() {

	if (Vazio(document.resetUsuario.email)) {
		alert ('Favor informar seu e-mail!');
		return false;
	}
	ResetSucesso();
}

function ResetSucesso()
{
    var url = "mm_home/resetarUsuario.php?";
	/*var div = document.getElementById('homeCentro');*/
    var div = document.getElementById('ErrorReset');
	
	httpRegistrise = null;
	var httpRegistrise = new Http();
	url = url + "code=" + escape(document.resetUsuario.code.value);
	url = url + "&email=" + escape(document.resetUsuario.email.value);
	url = url + "&time=" + new Date();
	
	httpRegistrise.xmlhttp.open("GET", url, true);
	httpRegistrise.xmlhttp.onreadystatechange = function(){
									div.innerHTML = 'Carregando...<br /><img src="img/carregando.gif" /><br />';
									if(httpRegistrise.xmlhttp.readyState == 4){
										if(httpRegistrise.xmlhttp.status == 200){
		                                    div.innerHTML = httpRegistrise.xmlhttp.responseText;
										 }
									 }
								  };
	httpRegistrise.xmlhttp.send(null);
}

function validarCompleto () {

	if (Vazio(document.cadastroUsuarioCompleto.nome)) {
		alert ('Favor informar seu nome!');
		return false;
	}
	else
	if (Vazio(document.cadastroUsuarioCompleto.dtnascimento)) {
		alert ('Favor informar sua data de nascimento!');
		return false;
	}
	else
	if ((Vazio(document.cadastroUsuarioCompleto.senha)) ||
		(document.cadastroUsuarioCompleto.senha.value != document.cadastroUsuarioCompleto.confSenha.value)) {
		alert ('Senha informada não é a mesma da digitada no campo de confirmação de senha!');
		return false;
	}	
		
	document.cadastroUsuarioCompleto.submit();	
}

function destacaMenu (id,novaCor) {	
	var obj = document.getElementById(id);
	obj.style.fonSize = "15pt";
	obj.style.fontWeight = "bold";
	obj.style.color = novaCor;
}


function normalizaMenu (id) {	
	var obj = document.getElementById(id);
	obj.style.fonSize = "11pt";
	obj.style.fontWeight = "";
	obj.style.color = "#969594";	
}


function LimitaTexto(campo, contador, limite) {
	Rotulo = document.getElementById(contador);
    
	if (campo.value.length > limite) { 
		campo.value = campo.value.substring(0, limite); 
	} 
	else  { 
		Rotulo.innerHTML = '(' + campo.value.length + '/' + limite + ')';
	}         
} 


function ConsisteValor(campo) {
	var VQtd = 0;
	var Validos = ',0123456789';
	var VTecla = campo.value.substring((campo.value.length-1),campo.value.length);

	if (Validos.indexOf(VTecla) == -1)
		campo.value = campo.value.substring(0, (campo.value.length-1));    

	// Apenas uma vírgula pode ser utilizada no campo tipo valor
	if (VTecla == ',') {
		var VStrAux = campo.value;
		var VLocalizar = VStrAux.indexOf(VTecla);

		while (VLocalizar >= 0) {
			VQtd++;
			VStrAux = VStrAux.substring((VLocalizar + 1),campo.value.length)
			VLocalizar = VStrAux.indexOf(VTecla);
		}

		if (VQtd > 1)
			campo.value = campo.value.substring(0, (campo.value.length-1));
	}
}


function ConsisteInteiro(campo) {
    var Validos = '0123456789';
    var VTecla = campo.value.substring((campo.value.length-1),campo.value.length);
    if (Validos.indexOf(VTecla) == -1)
        campo.value = campo.value.substring(0, (campo.value.length-1));    
}

function Formatar2Casas (valor) {
	var aValor = new Array();
	var aNovoValor;

	aValor = valor.split(",");
	if (valor.indexOf(',') < 0)
		aNovoValor = valor + ',00';
	else {
		aNovoValor = aValor[1];
		for (var i=aValor[1].length; i<2 ; i++) {
			aNovoValor+= '0';
		}
		aNovoValor = aValor[0] + ',' + aNovoValor;
	}

return aNovoValor;
}

function Vazio(campo) {
    var val = campo.value;

	if ((val==null) || (val == '00/0000'))
       return true;

	for (var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r"))
		    return false;
	}

	return true;
}

function aumentaFrame () {
	var frm = top.document.getElementById("icentro");
	frm.style.width = '830px';
	frm.style.zIndex = 5;

	var divBanner = top.document.getElementById("divBanners");
	divBanner.style.display = 'none';
	
}

function ajustaLeft () {
	if (screen.width < 1024) { //diminui em 80px as coordenadas left das divs da página principal quando a resolução do monitor for menor que 1024
		document.getElementById ("divEspiral").style.left = '21px';
		document.getElementById ("divMenuPanel").style.left = '0px';
		document.getElementById ("divHomeLogo").style.left = '245px';
		document.getElementById ("divPesquisa").style.left = '919px';
		document.getElementById ("divAtalhos").style.left = '740px';
		document.getElementById ("divLogin").style.left = '919px';
		document.getElementById ("icentro").style.left = '282px';
		document.getElementById ("divBanners").style.left = '919px';
		document.getElementById ("divMenuAcademico").style.left = '112px';
		document.getElementById ("divMenuProfissional").style.left = '112px';
		document.getElementById ("divMenuMundo").style.left = '112px';
		document.getElementById ("divAtalhos").style.left = '740px';

	}	
}

function barra(objeto)
{
  if (objeto.value.length == 2 || objeto.value.length == 5 )
  {
    objeto.value = objeto.value+"/";
  }

}

