<!--
function checkcampos() {
var erro_string = "";
if (window.document.frm1.fuser.value == ""){ erro_string += "Campo usuário não pode ser nulo \n"; }
if (window.document.frm1.fpass.value == ""){ erro_string += "Campo senha não pode ser nulo \n"; }
if (window.document.frm1.fpass.value != window.document.frm1.fpass2.value){ erro_string += "Senha digitadas são diferentes \n"; }
if (erro_string == "") { return true; } else { alert(erro_string); return false; }
}
function perguntarsj(link){ if(confirm('Apagar Registro')){ window.location = link ; } }
function ir(form) { form.submit(); }

var xmlhttp
var destino

function loadXMLDoc(url)
{ xmlhttp=null  
  if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest() }
  else if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") }
  if (xmlhttp!=null)
  { xmlhttp.onreadystatechange=state_Change
    xmlhttp.open("GET",url,true)
    xmlhttp.send(null)
  } else { alert("Your browser does not support XMLHTTP.") }
}

function state_Change()
{ if (xmlhttp.readyState==4) // if xmlhttp shows "loaded"
  { if (xmlhttp.status==200) // if "OK"
    { 
      monta();    
    } else { alert("Problem retrieving XML data:" + xmlhttp.statusText) }
  } else if (xmlhttp.readyState==1) { destino.options[0] = new Option("carregando ...","0"); }
}

function monta()
{     var response = xmlhttp.responseXML.documentElement;       
      txt="<table border='1'>"
      x=response.getElementsByTagName("registro");
      for (i=0;i<x.length;i++)
      { xx=x[i].getElementsByTagName("label");
        xy=x[i].getElementsByTagName("codigo");
        destino.options[i] = new Option(xx[0].firstChild.data,xy[0].firstChild.data);
      }      
}

function buscar2(tb,dest,rel)
{ 
  if (rel > 0)
  { destino = dest;  
    var url = "";    
    url = "buscar.php?tb="+ tb + "&rel=" + rel;  
    loadXMLDoc(url);    
  }  
}

function zerar(temp,tabela)
{ tabela = 'Selecione ' + tabela;
  for (m=temp.options.length;m>=0;m--) { temp.options[m]=null }
  temp.options[0] = new Option(tabela,'0');  	
}

//-->
