function numero_rnd(quanto_rnd){  
  
      return Math.floor(Math.random()*quanto_rnd)  
 }  

function createXMLHTTP() {


	try {
		ajax = new XMLHttpRequest();
		 return ajax;
		} 
	catch(e){
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(ex){
			   try{
					ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
					}
			   catch(exc){
						   alert("Esse browser não tem recursos para uso do Ajax");
							ajax = null;
						  }
					}
      }
	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 recuperarInfo(tag, modo,campo,tipo){
// Criação do objeto XMLHTTP

		document.getElementById('1').className = "menu_compras"
		document.getElementById('2').className = "menu_compras"
		document.getElementById('3').className = "menu_compras"
		document.getElementById('4').className = "menu_compras"
		document.getElementById('5').className = "menu_compras"
     	document.getElementById(tipo).className = "menu_comprasc"
	
document.getElementById(tag).innerHTML='<div align=center><img src="ajax-loader.gif"> <b>Carregando...</b></div>'


var oHTTPRequest = createXMLHTTP();



// A função abaixo é executada sempre que o estado do objeto muda (onreadystatechange)

if(modo == 'get') 
{
	oHTTPRequest.open('get', campo+'&'+numero_rnd(999), 'true');
} else
{        
	oHTTPRequest.open('post', campo+'&'+numero_rnd(999), 'true');
	oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; 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() {
	// O valor 4 significa que o objeto já completou a solicitação
	if (oHTTPRequest.readyState==4){
		// Abaixo o texto é gerado no arquivo del_result.asp e colocado no div
		document.getElementById(tag).innerHTML = oHTTPRequest.responseText;
	 }
}
// Abaixo é enviada a solicitação. Note que a configuração
// do evento onreadystatechange deve ser feita antes do send.
oHTTPRequest.send(null);
}
/*
function creeateXMLHTTP(){
	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 numero_rnd(quanto_rnd){  
  
      return Math.floor(Math.random()*quanto_rnd)  
 }  

function recuperarInfo(tag, method, arq, campo){
// Criação do objeto XMLHTTP
// campo: input q recebe o valor a ser processado
// div: div q recebera o resultado
// method: recebe "GET" ou "POST"
// arq: no do arquivo que vai processar a informação do campo
// Cria a opcao carregando 
		
		document.getElementById('1').className = "menu_compras"
		document.getElementById('2').className = "menu_compras"
		document.getElementById('3').className = "menu_compras"
		document.getElementById('4').className = "menu_compras"
		document.getElementById('5').className = "menu_compras"
     	document.getElementById(campo).className = "menu_comprasc"
	
//document.getElementById(tag).innerHTML='<span>carregando...</span>'
document.getElementById(tag).innerHTML='<div align=center><img src="ajax-loader.gif"> <b>Carregando...</b></div>'


var oHTTPRequest = createXMLHTTP(); 
// Abrindo a solicitação HTTP. O primeiro parâmetro informa o método post/get
// O segundo parâmetro informa o arquivo solicitado que pode ser asp, php, txt, xml, etc.
// O terceiro parametro informa que a solicitacao nao assincrona,
// Para solicitação síncrona, o parâmetro deve ser false

oHTTPRequest.open(method, arq+'&'+numero_rnd(999), true);


	oHTTPRequest.onreadystatechange=function() {
		if (oHTTPRequest.readyState==4){
		document.getElementById(tag).innerHTML = oHTTPRequest.responseText;
		 }
	}

oHTTPRequest.send(null);
}
*/

//}
// JavaScript Document

function IEHoverPseudo() {

    var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
    
    for (var i=0; i<navItems.length; i++) {
        if(navItems[i].className == "menuparent") {
            navItems[i].onmouseover=function() { this.className += " over"; }
            navItems[i].onmouseout=function() { this.className = "menuparent"; }
        }
    }

}
window.onload = IEHoverPseudo;


//Função da Caixa de Email
function expandcollapse (postid) { 

var abert = document.getElementById("abert"); 
var term = document.getElementById("term"); 
var canc = document.getElementById("canc"); 
	if(postid=="abert"){
		   if (abert.className=="esconde") { 
			  abert.className="mostra"; 
			   term.className="esconde"; 
			  canc.className="esconde"; 
			
		   }
		  
	}
	else{
	if(postid=="term"){
		  if (term.className=="esconde") { 
		
			  term.className="mostra"; 
			   abert.className="esconde"; 
			  canc.className="esconde"; 
		   } 
	}
	else{
		  if (canc.className=="esconde") { 
			  canc.className="mostra"; 
			   abert.className="esconde"; 
			  term.className="esconde"; 
			 
		   } 
		
		}
	}
} 

	function mudar(menu) {
	
     	document.getElementById('1').className = "menu_compras"
		document.getElementById('2').className = "menu_compras"
		document.getElementById('3').className = "menu_compras"
		document.getElementById('4').className = "menu_compras"
		document.getElementById('5').className = "menu_compras"
      
		document.getElementById(menu).className = "menu_comprasc"
} 