// JavaScript Document
function getNomeArq(cod) {
  limparBuffer();
  http.open("GET", "interna_edt.php?comando=carregarNomeArq&codigo="+cod, true);
  http.onreadystatechange = handleHttpResponseArq;
  http.send(null);
}

function getConcurso(cod) {
  limparBuffer();
  http.open("GET", "interna_edt.php?comando=carregarConcursos&codigo="+cod, true);
  http.onreadystatechange = handleHttpResponseCon;
  http.send(null);
}

function getCargo(cod) {
  limparBuffer();
  http.open("GET", "interna_edt.php?comando=carregarCargos&codigo="+cod, true);
  http.onreadystatechange = handleHttpResponseCarg;
  http.send(null);
}

function handleHttpResponse()
{
  campo_select = document.formCur.curso;
  if (http.readyState == 4) {
    campo_select.options.length = 0;
    results = http.responseText.split(",");
    for( i = 0; i < results.length; i++ )
    { 
      string = results[i].split( "|" );
      campo_select.options[i] = new Option( string[0], string[1] );
    }
  }
}

function handleHttpResponseCon()
{
  campo_select = document.formEdt.concurso;
  if (http.readyState == 4) {
    campo_select.options.length = 0;
    results = http.responseText.split(",");
    for( i = 0; i < results.length; i++ )
    { 
      string = results[i].split( "|" );
      campo_select.options[i] = new Option( string[0], string[1] );
    }
  }
}

function handleHttpResponseCarg()
{
  campo_select = document.formEdt.cargo;
  if (http.readyState == 4) {
    campo_select.options.length = 0;
    results = http.responseText.split(",");
    for( i = 0; i < results.length; i++ )
    { 
      string = results[i].split( "|" );
      campo_select.options[i] = new Option( string[0], string[1] );
    }
  }
}

function handleHttpResponseArq()
{
  campo_select = document.formOut.nome_arq;
  if (http.readyState == 4) {
    campo_select.options.length = 0;
    results = http.responseText.split(",");
    for( i = 0; i < results.length; i++ )
    { 
      string = results[i].split( "|" );
      campo_select.options[i] = new Option( string[0], string[1] );
    }
  }
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();
function limparBuffer() { 
	try{ 
		if (document.all) { 
		// IE clear HTTP Authentication 
		document.execCommand("ClearAuthenticationCache"); 
		} else { 
		netscape.security.PrivilegeManager. 
		enablePrivilege("UniversalXPConnect"); 
		authenticationManager = Components.classes["@mozilla.org/network/http-auth-manager;1"]. getService(Components.interfaces.nsIHttpAuthManager); 
		authenticationManager.clearAll(); 
		}
	} catch(e) { 
	// Si no se puede realizar no hay problema 
	} 
}
function confirmar(cod) {
   document.formLoja.codigoPedido.value = cod;
	document.formLoja.submit();
}
