function createXMLHTTP() 
{
try 
{
           ajax = new ActiveXObject("Microsoft.XMLHTTP");
} 
catch(e) 
{
           try 
           {
           ajax = new ActiveXObject("Msxml2.XMLHTTP");
           alert(ajax);
           }
           catch(ex) 
           {
           try 
           {
           ajax = new XMLHttpRequest();
           }
           catch(exc) 
           {
			alert("Esse browser não tem recursos para uso do Ajax");
			ajax = null;
           }
           }
           return ajax;
}


   var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
   "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
   "Microsoft.XMLHTTP"];
   for (var i=0; i < arrSignatures.length; i++) {
  try {
 var oRequest = new ActiveXObject(arrSignatures[i]);
 return oRequest;
  } catch (oError) {
  }
  }

  throw new Error("MSXML is not installed on your system.");
}         


function mostra_class()
           {
		   document.all.divclass.innerHTML = "Atualizando..."
           var oHTTPRequest = createXMLHTTP(); 
		   oHTTPRequest.open("POST", "/painel_competidor_class.asp", true);
           oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		   oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
   		   oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		   oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divclass.innerHTML = oHTTPRequest.responseText;
    		       }
		   			else
		   			{
		  			 document.all.divclass.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
           }
           oHTTPRequest.send(null);
           }


function mostra_dados()
           {
           var oHTTPRequest = createXMLHTTP(); 
		   Nick = document.form1.nick.value;
           oHTTPRequest.open("GET", "/painel_competidor_espiao_preenche.asp?nick=" + Nick, true);
           oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		   oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		   oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		   oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divresposta.innerHTML = oHTTPRequest.responseText;
    		       }
		   			else
		   			{
		  			 document.all.divresposta.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
           }
           oHTTPRequest.send(null);
           }


function insere_espiao(id_competidor)
           {
  var oHTTPRequest = createXMLHTTP(); 
  oHTTPRequest.open("GET", "/painel_competidor_espiao_insere.asp?id_competidor=" + id_competidor, true);
           oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		   oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		   oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		   oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divresposta.innerHTML = oHTTPRequest.responseText;
			   mostra_class();
				    }
		   			else
		   			{
		  			 //document.all.divresposta.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
					
           }
           oHTTPRequest.send(null);
		   
           }



function exclui_espiao(id_c)
           {
  var oHTTPRequest = createXMLHTTP(); 
 		 oHTTPRequest.open("GET", "/painel_competidor_espiao_exclui.asp?id_competidor=" + id_c, true);
         oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		 oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
   	     oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		 oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divresposta.innerHTML = oHTTPRequest.responseText;
			mostra_class();	
				
				   }
		   			else
		   			{
		  			 //document.all.divresposta.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
					
           }   
 
			oHTTPRequest.send(null);
	    
           }


function pesquisa_ranking_anual()
           {
           var oHTTPRequest = createXMLHTTP(); 
		   Nick = document.form1.nick.value;
           oHTTPRequest.open("GET", "/ranking_pesquisa_anual.asp?nick=" + Nick, true);
           oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		   oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		   oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		   oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divresposta.innerHTML = oHTTPRequest.responseText;
    		       }
		   			else
		   			{
		  			 document.all.divresposta.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
           }
           oHTTPRequest.send(null);
           }

function pesquisa_ranking()
           {
           var oHTTPRequest = createXMLHTTP(); 
		   Nick = document.form1.nick.value;
           oHTTPRequest.open("GET", "/ranking_pesquisa_geral.asp?nick=" + Nick, true);
           oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		   oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1"); 
		   oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		   oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); 
		   oHTTPRequest.setRequestHeader("Pragma", "no-cache");

           oHTTPRequest.onreadystatechange=function() {
    	       	if (oHTTPRequest.readyState==4){
	        	   document.all.divresposta.innerHTML = oHTTPRequest.responseText;
    		       }
		   			else
		   			{
		  			 document.all.divresposta.innerHTML = "<img src='/img/ajax-loader.gif'>"
					}
           }
           oHTTPRequest.send(null);
           }
