   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 excluir_foto(id, url, op){

    //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;
			if (op = true)
			{
			//	document.getElementById("tabela_fotos").innerHTML = "";
			}else{
				//alert('x');
			}
        }
    }

    //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\" />";

	var previneCache = new Date().getTime(); 
	url=url+"&previnecache="+previneCache;
    //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)
}


function excluir_logotipo(id, url){

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

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

	var previneCache = new Date().getTime(); 
	url=url+"&previnecache="+previneCache;

    //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 excluir_fachada(id, url){

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

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

	var previneCache = new Date().getTime(); 
	url=url+"&previnecache="+previneCache;

    //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 busca_usuario_sub(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("subdominio").value

	url = url + "&usuario="+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)
}

function busca_usuario_sub_edit(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.form1.id_imob.value;

	url = url + "&id_imob="+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)
}




function mostra_tipo_artigo(id, url){

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

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

	valor = document.getElementById("tipo_artigo").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)
}
