   var xmlhttp = false;
   try {
     xmlhttp = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         xmlhttp = false;
       }  
     }
   }

   if (!xmlhttp)
     alert("Error initializing XMLHttpRequest!");	
	
	//A variable used to distinguish whether to open or close the calendar.
function mostra_foto(id, url, id_galeria, legenda){

    //Obtém o objeto HTML
//    objetoHTML=document.getElementById(id);

//    objetoHTML.innerHTML="<img src=\"img/ajax-loader.gif\" />";


  
    //Abre a conexão
    xmlhttp.open("GET",url, true);

    //Função para tratamento do retorno
    xmlhttp.onreadystatechange=function() {

        if (xmlhttp.readyState==4){
            //Mostra o HTML recebido

			retorno=unescape(xmlhttp.responseText.replace(/\+/g," "))

/*
if (id_galeria == 'principal')
			{
				nome_arquivo = "galeria_fotos/principal/"+retorno;
			}else{
				nome_arquivo = "galeria_fotos/"+id_galeria+"/"+retorno;
			}

            objetoHTML.src=nome_arquivo;
*/			
		    document.getElementById("dadosX").innerHTML=retorno;
			
        }
    }

    //Executa
    xmlhttp.send(null)
}

function muda_destaque(id, url){

    //Obtém o objeto HTML
    objetoHTML=document.getElementById(id);

    //Exibe "Carregando..."
   objetoHTML.innerHTML="<img src=\"img/loading.gif\" />";

    //Abre a conexão
    xmlhttp.open("GET",url, true);

    //Função para tratamento do retorno
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            //Mostra o HTML recebido

			retorno=unescape(xmlhttp.responseText.replace(/\+/g," "))
            objetoHTML.innerHTML=retorno;
        }
    }

    //Executa
    xmlhttp.send(null)
}

function muda_destaque(id, url){

    //Obtém o objeto HTML
    objetoHTML=document.getElementById(id);

    //Exibe "Carregando..."
   objetoHTML.innerHTML="<img src=\"img/loading.gif\" />";

    //Abre a conexão
    xmlhttp.open("GET",url, true);

    //Função para tratamento do retorno
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            //Mostra o HTML recebido

			retorno=unescape(xmlhttp.responseText.replace(/\+/g," "))
            objetoHTML.innerHTML=retorno;
        }
    }

    //Executa
    xmlhttp.send(null)
}


function mostra_empresa_usuario(id, url){

    //Obtém o objeto HTML
    objetoHTML=document.getElementById(id);

    //Exibe "Carregando..."
   objetoHTML.innerHTML="<label>&nbsp;</label><img src=\"img/loading_barra.gif\" />";

	valor = document.getElementById("autorizacao").value

	url = url + "&valor="+valor;
	
    //Abre a conexão
    xmlhttp.open("GET",url, true);

    //Função para tratamento do retorno
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            //Mostra o HTML recebido

			retorno=unescape(xmlhttp.responseText.replace(/\+/g," "))
            objetoHTML.innerHTML=retorno;
        }
    }

    //Executa
    xmlhttp.send(null)
}
