function show(valor, nextObj, post, uf){
	if(valor=="**" && nextObj=='CIDADECURSO'){
		eval('document.getElementById(\''+nextObj+'\').style.display="none"');
		eval('document.getElementById(\''+nextObj+'\').value="**"');
		eval('document.getElementById(\'ESCOLACURSO\').style.display="none"');
		eval('document.getElementById(\'ESCOLACURSO\').value="**"');
		eval('document.getElementById(\'CONCLUSAOCURSO\').style.display="none"');
		eval('document.getElementById(\'CONCLUSAOCURSO\').value=""');
	}
	else if(valor=="**" && nextObj=='ESCOLACURSO'){
		eval('document.getElementById(\''+nextObj+'\').style.display="none"');
		eval('document.getElementById(\''+nextObj+'\').value="**"');
		eval('document.getElementById(\'CONCLUSAOCURSO\').style.display="none"');
		eval('document.getElementById(\'CONCLUSAOCURSO\').value=""');
	}
	else if(valor=="**" && nextObj=='CONCLUSAOCURSO'){
		eval('document.getElementById(\''+nextObj+'\').style.display="none"');
		eval('document.getElementById(\''+nextObj+'\').value=""');
	}
	else{
		eval('document.getElementById(\''+nextObj+'\').style.display="block"');
		if(nextObj=='CIDADECURSO'){
				xajax_controlaCidade(valor,post);
				eval('document.getElementById(\''+nextObj+'\').style.display="block"');
				eval('document.getElementById(\''+nextObj+'\').value="**"');
				eval('document.getElementById(\'ESCOLACURSO\').style.display="none"');
				eval('document.getElementById(\'ESCOLACURSO\').value="**"');
				eval('document.getElementById(\'CONCLUSAOCURSO\').style.display="none"');
		}
		else if(nextObj=='ESCOLACURSO'){
				
				xajax_controlaEscola(valor,post,uf);
				eval('document.getElementById(\''+nextObj+'\').style.display="block"');
				eval('document.getElementById(\''+nextObj+'\').value="**"');
				eval('document.getElementById(\'CONCLUSAOCURSO\').style.display="none"');
		}
		else if(nextObj=='CONCLUSAOCURSO'){
			eval('document.getElementById(\''+nextObj+'\').style.display="block"');
		}
	}
}

function endereco(v,obj,tipo){
	
	campo = Array('CEP','ENDERE','NUMERO','COMPLE','BAIRRO','CIDADE','FONE','DESTIN');
	corres = 'CORRES';
	
	if(v=='ok'){
		eval('document.getElementById(\''+obj+'\').value="no"');
		
		/*recebendo valores*/
		for(i=0;i<8;i++){
			if(i!=5){
				eval('document.getElementById(\''+campo[i]+tipo+'\').readOnly=true');
				eval('document.getElementById(\''+campo[i]+tipo+'\').style.backgroundColor="#CCCCCC"');
			}
			eval('document.getElementById(\''+campo[i]+tipo+'\').value=document.getElementById(\''+campo[i]+corres+'\').value');
		}
		
	}
	if(v=='no'){
		eval('document.getElementById(\''+obj+'\').value="ok"');
		
		/*zerando valores*/
		for(i=0;i<8;i++){
			if(i!=5){
				eval('document.getElementById(\''+campo[i]+tipo+'\').readOnly=false');
				eval('document.getElementById(\''+campo[i]+tipo+'\').style.backgroundColor="#FFFFFF"');
			}
			eval('document.getElementById(\''+campo[i]+tipo+'\').value=""');
		}
	}
}


function digitaCEP(Campo,teclapres){
	var tecla=teclapres.keyCode;
	vr=Campo.value;
	vr=vr.replace(".","");
	vr=vr.replace("/","");
	vr=vr.replace("/","");
	tam=vr.length+1;

	if(tecla !=6){
		if(tam>=6 && tam<7)
			Campo.value=vr.substr(0,tam-1)+'-';

	}
}

function TeclaNum(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if ((charCode<48)||(charCode>57)){ // Internet Explorer
		if(charCode==8) return true
		else return false;
	}
}


function TeclaNumFone(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if ((charCode<48)||(charCode>57)){ // Internet Explorer
		if(charCode==8||charCode==40||charCode==41||charCode==45) return true
		else return false;
	}
}



function msgErroCEP(tipo){
		if(tipo=='correspondencia'){
			alert('CEP DE CORRESPONDENCIA INVÁLIDO!\nPor favor, digite novamente.\n\nOBS: Se o CEP digitado estiver correto e mesmo assim você está recebendo\nesta mensagem, então a solicitação de matrícula deverá ser efetuada através do telefone 0800 34 1212.');
			document.getElementById('CEPCORRES').value = "";
			document.getElementById('CEPCORRES').focus();
		}
		else if(tipo=='cobranca'){
			alert('CEP DE COBRANÇA INVÁLIDO!\nPor favor, digite novamente.\n\nOBS: Se o CEP digitado estiver correto e mesmo assim você está recebendo\nesta mensagem, então a solicitação de matrícula deverá ser efetuada através do telefone 0800 34 1212.');
			document.getElementById('CEPCOBRAN').value = "";
			document.getElementById('CEPCOBRAN').focus();
		}
		else if(tipo=='comercial'){
			alert('CEP COMERCIAL INVÁLIDO!\nPor favor, digite novamente.');
			document.getElementById('CEPCOMER').value = "";
			document.getElementById('CEPCOMER').focus();
		}


}



function carregar(){
	document.getElementById('carregando').style.visibility = 'visible';
}

function descarregar(){
	document.getElementById('carregando').style.visibility = 'hidden';
}

function msgSaudacao(nome){
	alert('Olá '+nome+'!\n\nSua solicitação de matrícula na Pós-Graduação já foi registrada.\nSiga os passos a seguir para a finalização da matrícula.');
}

function prenchaCorretamente(){
	alert('Preencha, corretamente, o formulário de matrícula!');
}


function tamanhoInvalidoCPF(){
	descarregar();
	alert("CPF inválido!");
	document.getElementById('enterCPF').value="";
	document.getElementById('enterCPF').focus();
	document.getElementById('corpo').style.display = 'none';
	document.getElementById('CPF').value ="";
}


function validaEmail(){
		prim = document.formulario.EMAIL.value.indexOf("@")
		if(prim < 2) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("@",prim + 1) != -1) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(".") < 1) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(" ") != -1) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("zipmeil.com") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("hotmeil.com") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(".@") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("@.") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(".com.br.") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("/") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(";") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("[") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("]") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("(") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf(")") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
		if(document.formulario.EMAIL.value.indexOf("..") > 0) {
			alert("E-mail inválido. Por favor, verifique !");
			document.formulario.EMAIL.focus();
			document.formulario.EMAIL.select();
			return false;
		}
}


function msgErroDePendencia(tipo){
	if(tipo=='assessoria'){
		alert('Matrícula não poderá ser efetivada!!!\nProcure a assessoria finaceira.');
	}
	else if(tipo=='biblioteca'){
		alert('Matrícula não poderá ser efetivada!!!\n Você possui pendências com a Biblioteca - Livros a devolver.');
	}
}


/*function exibirErro(vet){
	document.getElementById('erro').style.display='block';
	for (i=0;i<vet.length;i++){
		alert(vet[i]);
		eval('document.getElementById(\''+vet[i]+'\').style.backgroundColor="#FFFF00"');
	}
}*/