function Abre_Janela(url, nome_janela, w, h, resize, status, rolagem, menus, toolbar){
	if (w==0){ w = (screen.width) -200 };
	if (h==0){ h = (screen.height)-200 };
	
	var wLeft = (screen.width  - w) / 2;
	var wTop  = (screen.height - h) / 2 - 50;
	
	propriedades =  'height='		+ h 	  +
					',width='		+ w 	  +
					',top='			+ wTop 	  +
					',left='		+ wLeft   +
					',resizable='	+ resize  +
					',status='		+ status  +
					',scrollbars='	+ rolagem +
					',menubar='		+ menus	  +
					',toolbar='		+ toolbar;
	restrito = window.open(url, nome_janela, propriedades);

	if (restrito == null){
		alert("Seu navegador impediu a abertura dessa janela! \nDesabilite o bloqueador de pop-up para.");
	}else{
		if (parseInt(navigator.appVersion) >= 4){ restrito.focus(); } 
	}
}

function Check(formulario, checkbox){ 
	var check = document.getElementById("checkAll");
	if(check.checked == 0){
		CheckAll(formulario, checkbox);
	}
	if(check.checked == 1){
		unCheckAll(formulario, checkbox);
	}
}

function CheckAll(formulario, checkbox){
	var oForm = document.getElementById(formulario);
	for (i=0;i<oForm.elements.length;i++) {
		if(oForm.elements[i].type == "checkbox" &&  oForm.elements[i].name == checkbox ) {
			oForm.elements[i].checked=1 ;
		}
	} 
}

function SoNumero(e){
	var key;
	var keychar;
	var reg;
	if(window.event){
		key = e.keyCode;
	}
	else if(e.which){
		key = e.which;
	}else{
		return true;
	}

	keychar = String.fromCharCode(key);
	reg = /\D/;
	return !reg.test(keychar);
}

function unCheckAll(formulario, checkbox){
	var oForm = document.getElementById(formulario);
	for (i=0;i<oForm.elements.length;i++) {
		if(oForm.elements[i].type == "checkbox" &&  oForm.elements[i].name == checkbox ) {
			oForm.elements[i].checked=0; 
		}
	} 
}

function validaLogin(){
	var Login	=	document.getElementById("txt_login");
	var Senha	=	document.getElementById("txt_Senha");
	var Acao	=	document.getElementById("txt_acao");
	
	if (Login.value == ""){
		alert("Por favor, preencha o campo ('LOGIN')");
		Login.focus();
		return false;
	}
	if(Senha.value == ""){
		alert("Por favor, preencha o campo ('SENHA')");
		Senha.focus();
		return false;
	}
	if (Senha.value.length <= 3){
		alert("O campo 'SENHA' deve ter mais de 3 caracteres!");
		Senha.focus();
		return false;
	}else{
		return true
	}
	
}


