 
function Abre_Jan(janela) {
  window.open(janela,'','location=no,toolbar=yes,status=yes,resizable=yes,menubar=no,scrollbars=yes,height=500,width=750,left=0,screenX=0,top=0,screenY=0');
}

function efetuaLogin( usuario, senha ) {
	var msg = '';
	if(usuario=="") {
		msg += 'Digite um Usuario\n';
	}
	
	if(senha=="") {
		msg += 'Digite sua Senha\n';
	}
	
	if(!msg) {
		ajaxForm('retornoLogin', 'formLogin');
	} else {
		alert(msg);
	}
	return false;
}

function buscaCEP( cep, id ) {
	ajaxLink('buscaCEP', 'buscaCEP.php?CEP='+cep+'&campos='+id);
}

function setEnderecoCEP(id, endereco, bairro, cidade, uf) {
	document.getElementById('endereco'+id).value = endereco;
	document.getElementById('bairro'+id).value = bairro;
	document.getElementById('cidade'+id).value = cidade;
	document.getElementById('uf'+id).value = uf;
}

function addUsuario() {
	var msg = "";
	
	if(document.getElementById('nome').value == "") {
		msg += "- Nome\r\n";
	}
	
	if(document.getElementById('login').value == "") {
		msg += "- Login\r\n";
	}
	
	if(document.getElementById('senha').value == "") {
		msg += "- Senha\r\n";
	} else if(document.getElementById('senha').value != document.getElementById('confirm_senha').value) {
		msg = "- A Senha e a Confirmação de Senha NÃO SÃO IGUAIS!\r\n" + msg;
	}
	
	if(document.getElementById('email').value == "") {
		msg += "- E-mail\r\n";
	} else if(document.getElementById('email').value != document.getElementById('confirm_email').value) {
		msg = "- O E-mail e a Confirmação de E-mail NÃO SÃO IGUAIS!\r\n" + msg;
	}
	
	if(document.getElementById('data_nascimento').value == "") {
		msg += "- Data de Nascimento\r\n";
	}
	
	if(document.getElementById('cep').value == "") {
		msg += "- CEP\r\n";
	}
	
	if(document.getElementById('endereco').value == "") {
		msg += "- Endereço\r\n";
	}
	
	if(document.getElementById('numero').value == "") {
		msg += "- Número\r\n";
	}
	
	if(document.getElementById('bairro').value == "") {
		msg += "- Bairro\r\n";
	}
	
	if(document.getElementById('cidade').value == "") {
		msg += "- Cidade\r\n";
	}
	
	if(document.getElementById('uf').value == "") {
		msg += "- UF\r\n";
	}
	if( msg ) {
		alert("Os campos abaixo são de Preenchimento Obrigatórios e Não podem estar Vazios:\r\n\r\n" + msg);
		return false;
	} else {
		ajaxForm( 'conteudo', 'formAddUsuario' );
	}
}

function checkUsuario( divtarget, tipo, valor ) {
	ajaxLink( divtarget , 'checkUsuario.php?tp=' + tipo + '&vlr=' + valor );
}

function redir( URL ) {
	window.location = URL;	
}
