function AbreJanela(snippet, subitem, largura, altura){
    ArgValues = Array();
    ArgValues['window'] = window;
    opcao = 0;
    url = 'index.php?snippet='+snippet+'&subitem='+subitem;
    window.showModalDialog(url,ArgValues,'dialogHeight: ' + altura + 'px; dialogWidth: '+ largura +'px; dialogTop: 50px; dialogLeft: 50px; edge: Raised; scroll: no; unadorned: Yes; center: No; help: No; resizable: No; status: No;');
}
function AbreJanelaNormal(snippet, subitem, largura, altura){
    url = 'index.php?snippet='+snippet+'&subitem='+subitem;
    janWindow = window.open(url,'janWindow','height=' + altura + '; width=' + largura + '; top=50; left=50; scrollbars=auto');
}
function AbrePaginas(pagina, largura, altura){
    url = pagina;
    janWindow = window.open(url,'janWindow','height=' + altura + '; width=' + largura + '; top=50; left=50; scrollbars=yes');
}
function AbreBoleto(id_cliente){
	url = 'boleto.php?id_cliente='+id_cliente;
    janBoleto = window.open(url,'janBoleto','height=600; width=680; top=50; left=50; scrollbars=yes');
}
function VerDadosJunta(protocolo){
    ArgValues = Array();
    ArgValues['window'] = window;
	opcao = 0;
	url = 'http://www.jucergs.rs.gov.br/servico/andamento/juc-srv-a_3.asp?nProtocolo='+protocolo;
    window.showModalDialog(url,ArgValues,'dialogHeight: 350px; dialogWidth: 500px; dialogTop: 200px; dialogLeft: 200px; edge: Raised; scroll: No; unadorned: Yes; center: No; help: No; resizable: No; status: No;');
}
function AbreDivBox(id) {
	var snum = 2;
	var obj = document.getElementById("box" + snum);
	while (obj)
	{
		if (obj.id == id) obj.style.display = "";
		else obj.style.display = "none";
		obj = document.getElementById("box" + snum--);
	}
}

//Colocar essa função tanto no evento onKeyup quanto no onKeydown
function contaCaracter(texto, contador, maximo) {
			  field = document.getElementById(texto);
			  txt_field = document.getElementById(contador);
			  txt_field.innerHTML = field.value.length;
			  if(field.value.length >= parseInt(maximo))
				field.value = field.value.substring(0, parseInt(maximo));
			}



/* Ajax */
function ajax(id_bib){
	theDiv = eval('BibConteudo');
	theDiv.innerHTML = mensagemDeEspera();
	url = "?snippet=int_biblioteca_mostra&bib="+id_bib;
	try{
	    xmlhttp = new XMLHttpRequest();
	}
    catch(ee){
	    try{
	        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    }
        catch(e){
	        try{
	            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }
            catch(E){
	            xmlhttp = false;
	        }
	    }
	}
	xmlhttp.open("GET", url, true);
	xmlhttp.onreadystatechange=function() {
	    if (xmlhttp.readyState==4){
			theDiv.innerHTML = xmlhttp.responseText;
	    }
	}
	xmlhttp.send(null);
}
function mensagemDeEspera(){
	txt = "Aguarde...\n";
	return txt;
}
/* Fim: Ajax */










