function criaXMLHttpRequest()
{
var XMLHTTPREQUEST_IE = new Array(
  "Msxml2.XMLHTTP.6.0",
  "Msxml2.XMLHTTP.5.0",
  "Msxml2.XMLHTTP.4.0",
  "Msxml2.XMLHTTP.3.0",
  "Msxml2.XMLHTTP",
  "Microsoft.XMLHTTP"
);
  var oXMLhttp = null;

  // Cria o HttpRequest para o respectivo navegador.
  if (window.XMLHttpRequest != null)
    oXMLhttp = new window.XMLHttpRequest();
  else if (window.ActiveXObject != null)
  {
    // Percorre no IE a procura do objeto ActiveX na biblioteca mais recente
    var bCriado = false;
    for (var ind = 0;
         ind < XMLHTTPREQUEST_IE.length && ! bCriado; ind++)		
    {
      try
      {
        oXMLhttp = new ActiveXObject(XMLHTTPREQUEST_IE[ind]);
        bCriado = true;
      }
      catch (ex)
      {}
    }
  }

  // Tratamento de erro caso não encontre nenhum.
  if (oXMLhttp == null)
    alert("Falha no HttpRequest():\n\n"
      + "Objeto XMLHttpRequest não foi criado.");

  // Retorna o objeto instanciado ou não
  return oXMLhttp;
}

//#########################################################################



function requisicao(){
   if(window.XMLHttpRequest){
      req = new XMLHttpRequest();
   }else if(window.ActiveXObject){
      req = new ActiveXObject("Microsoft.XMLHTTP");
   }

   return req;
}

function atualiza(nome_div,url){
   document.getElementById(nome_div).innerHTML = "<BR><BR><BR><BR><p align=center><b><font face=Verdana><font color=#D5BF28 size=2>Carregando...</font></font></b></p><p align=center><img src=carregando/04.gif></p>";
   req = requisicao();
   req.open("GET", url, true);
   req.onreadystatechange = function(){
       if(req.readyState == 4){
           if(req.status == 200){
            var texto = req.responseText
            document.getElementById(nome_div).innerHTML = texto
           }
       }
   }
   req.send(null);
}



// ##########################################################################################

function mostra(pri,sec) {
var d = document.getElementById(pri);
var f = document.getElementById(sec);
if (d.style.display=='none') {
 d.style.display='';
} else {
 d.style.display='none'
}
}

function fecha(pri,sec) {
var d = document.getElementById(pri);
var f = document.getElementById(sec);
if (d.style.display=='') {
 d.style.display='none';
} else {
 d.style.display='none'
}
}


// Popup

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


function abrir(pagina,largura,altura) {

//pega a resolução do visitante
w = screen.width;
h = screen.height;

//divide a resolução por 2, obtendo o centro do monitor
meio_w = w/2;
meio_h = h/2;

//diminui o valor da metade da resolução pelo tamanho da janela, fazendo com q ela fique centralizada
altura2 = altura/2;
largura2 = largura/2;
meio1 = meio_h-altura2;
meio2 = meio_w-largura2;

//abre a nova janela, já com a sua devida posição
window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+''); 
}




	function limpa()
	{
	

	
		if (document.book.senha.value== " senha")
		{
		document.book.senha.value=""
		document.book.senha.focus();
		}
		
		
		
	}