// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Função para inserir barras
      function NumeroBarras(String){
        var Posicao=0, cont;
        for(cont=0;cont<=String.value.length;cont++){
          if(String.value.substr(cont,1)=='/')
            Posicao++;
        }
        return Posicao;
      }

      function Data_onkeydown(Controle) {
        //Backspace(8), Tab(9), Esc(27), End(35), Home(36), Esq(37), Dir(39), Del(46), Barra[/](111, 193, 223)
        if 
        (
          (isNaN(String.fromCharCode(event.keyCode)))
          &&
          ((event.keyCode<96)||(event.keyCode>105))
          &&
          ((event.keyCode != 8)&&(event.keyCode != 27)&&(event.keyCode != 35)&&(event.keyCode != 36)&&(event.keyCode != 37)&&(event.keyCode != 39)&&(event.keyCode != 46)&&(event.keyCode != 111)&&(event.keyCode != 193)&&(event.keyCode != 223))
        )
          event.returnValue = false;
        else
          if ((event.keyCode != 111)&&(event.keyCode != 193)&&(event.keyCode != 223)){
            if (((Controle.value.length == 2)||(Controle.value.length == 5))&&(event.keyCode != 8)&&(event.keyCode != 9))
              Controle.value = Controle.value + '/';
          }
          else{
            if((Controle.value.length==0)||(Controle.value.substr(Controle.value.length-1,1)=='/')||(NumeroBarras(Controle)>=2))
              event.returnValue = false;
            else
              if (!((Controle.value.length == 2)||(Controle.value.length == 5)||(Controle.value.length >= 10)))
                Controle.value = Controle.value.substring(0,Controle.value.length-1) + '0' + Controle.value.substring(Controle.value.length-1, Controle.value.length)
          }
      }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	MM_reloadPage(true);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	function MM_showHideLayers() { //v6.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
		obj.visibility=v; }
	}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	function MudaCorMenu(src, cor){
		src.className=cor;
	}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

	function novo(url, largura, altura)
	{
		var topo, left
		topo = (window.screen.height / 2) - (altura / 2);
		iLeft = (window.screen.width / 2) - (largura / 2);
		window.open(url, "Form", "width="+ largura +", height="+ altura +", left="+ left +", top=" + topo);
	}	
	
	function mudaStatus(codigo, status, tabela){
		
	document.location.href = "index.php?codigo="+codigo+"&status="+status+"&tabela="+tabela+"&acao=status";
	
	}
	
	function excluir(codigo, tabela){
	document.location.href = "index.php?codigo="+codigo+"&tabela="+tabela+"&acao=excluir";
	}

	function excluirAnexo(codigo, tabela, codigo_referencia, codigo_sessao){
	document.location.href = "exibe_anexos.php?codigo="+codigo_referencia+"&codigo_anexo="+codigo+"&codigo_sessao="+codigo_sessao+"&tabela="+tabela+"&action=excluir";
	}

	function buscar(tipo){
	var chave = document.cBusca_Novo.cChave.value;
	var campo = document.cBusca_Novo.cCampo.value;
	document.location.href = "index.php?TipoBusca="+tipo+"&cChave="+chave+"&cCampo="+campo;
	}
	
	function selecionaEstado(sigla){
	for(x=1;x<=27;x++){
		if(document.getElementById(x).value == sigla){
		document.getElementById(x).selected = "selected";	
		}
	}
	}