try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function carrega(tipo, id, idCat,idSubCat,desc) {
    //Exibe o texto carregando no div conteúdo
//    var conteudo=document.getElementById("mostraQuantidadeLista")
//    conteudo.innerHTML='--'

    //Abre a url
	
	if (tipo == 'ALBUM_CATEGORIA') {
		xmlhttp.open("GET", "album_categoria.asp?cat="+id+"&subcat="+idCat+"&id="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				album_categoria.innerHTML=texto
				carrega('ALBUM_SUBCATEGORIA','','',idSubCat);
				
			}
	    }
    }
	if (tipo == 'ALBUM_SUBCATEGORIA') {
		xmlhttp.open("GET", "album_subcategoria.asp?cat="+id+"&subcat="+idCat+"&id="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				album_subcategoria.innerHTML=texto
				carrega('ALBUM_MINIATURA',id,'',idSubCat);
			}
			
	    }
    }
	if (tipo == 'ALBUM_MINIATURA') {
		xmlhttp.open("GET", "album_miniatura.asp?cat="+id+"&subcat="+idCat+"&id="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				album_miniatura.innerHTML=texto
				if (idSubCat=='0') {
					carrega('ALBUM_COMENTARIO',id,'','');
				}
			}
			
	    }
    }
	if (tipo == 'ALBUM_COMENTARIO') {
		xmlhttp.open("GET", "album_comentarios.asp?cat="+id+"&subcat="+idCat+"&id="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				comentarios.innerHTML=texto
				carrega('ALBUM_COMENTARIO_FORM',id,'','');
			}
			
	    }
    }
	if (tipo == 'ALBUM_COMENTARIO_FORM') {
		xmlhttp.open("GET", "album_comentarios_form.asp?cat="+id+"&subcat="+idCat+"&id="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				div1.innerHTML=texto
			}
			
	    }
    }
    if (tipo == 'PACOTE_DETALHES') {
		xmlhttp.open("GET", "detalhesPacoteEscolhido.asp?id="+id+"&cat="+idCat+"&subcat="+idSubCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				window.scroll(0,325)
				pacotesDetalhes.innerHTML=texto	
			}
		}
    }
	if (tipo == 'PACOTE_DESCRICAO') {
		xmlhttp.open("GET", "descricao_pacote.asp?id="+id+"&cat="+idCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				pacote_detalhes.innerHTML=texto
				carrega('PACOTE_DETALHES',id,idCat,'0');
			}
			
	    }
    }
		if (tipo == 'PACOTE_VOLTAR') {
		xmlhttp.open("GET", "descricao_pacote.asp?id="+id+"&cat="+idCat+"&back=sim",true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				pacote_detalhes.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'MOSTRA_IMG') {
		xmlhttp.open("GET", "mostraImg.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				mostraImg.innerHTML=texto
			}		
	    }
		troca(id);
    }
	if (tipo == 'PACOTE_FORM') {
		xmlhttp.open("GET", "pacoteForm.asp?cod="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				form.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'EMAIL_CONTATO') {
		xmlhttp.open("GET", "enviarEmailsContatos.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				email_teste.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'EMAIL_TESTE') {
		xmlhttp.open("GET", "enviarEmailTeste.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				email_teste.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'NEWSLETTER') {
		if (id=='1') {
			xmlhttp.open("GET", "newsletterBancoImg.asp?id="+id,true);
		}
		if (id=='2') {
			if (idCat=='1') {
			xmlhttp.open("GET", "controlarContatos.asp?id="+idSubCat,true);
			}
			if (idCat=='2') {
				xmlhttp.open("GET", "controlarGrupos.asp?id="+idSubCat,true);
			}
		}
		if (id=='3') {
			if (idCat=='1') {
			xmlhttp.open("GET", "newsletterEdicaoEmails.asp?id="+idSubCat,true);
			}
			if (idCat=='2') {
			xmlhttp.open("GET", "newsletterEdicaoEmails.asp?id="+idSubCat,true);
			}
			if (idCat=='3') {
			xmlhttp.open("GET", "validarNovoEmail.asp?id="+idSubCat,true);
			}
			if (idCat=='4') {
			xmlhttp.open("GET", "controlarContatosLetra.asp?letra="+idSubCat,true);
			}
		}
		if (id=='4') {
			xmlhttp.open("GET", "newsletterEnvioEmails.asp?id="+id,true);
		}
		if (id=='5') {
			xmlhttp.open("GET", "newsletterSistema.asp?id="+id,true);
		}
		if (id=='6') {
			xmlhttp.open("GET", "newsletterUsuarios.asp?id="+id,true);
		}
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				document.getElementById('newsletter').innerHTML=texto
				if (id=='1') {
				carrega('MOSTRA_IMG','2','');
				}
			}	
	    }
    }
	if (tipo == 'DETALHES_UTEIS') {
		xmlhttp.open("GET", "detalhesUteis.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				uteis.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_CLIENTES') {
		xmlhttp.open("GET", "formClientes.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_clientes.innerHTML=texto
				carrega('PACOTE',id,idCat);
			}		
	    }
    }
	if (tipo == 'CADASTRO_CIDADE') {
		xmlhttp.open("GET", "formCidade.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_cidade.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_ENQUETE') {
		xmlhttp.open("GET", "formEnquete.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_enquete.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_PACOTES') {

		$("#cadastro_pacotes").html("<img src='../img/ajax_loader2.gif' alt='carregando...' />");

			xmlhttp.open("GET", "formPacotes.asp?id="+id,true);
			xmlhttp.onreadystatechange=function() {
				if (xmlhttp.readyState==4){
					var texto=xmlhttp.responseText
					texto=texto.replace(/\+/g," ")
					texto=unescape(texto)
					$("#cadastro_pacotes").show("slow", function() {
						$("#addPacote").show();
						cadastro_pacotes.innerHTML=texto
						//$("#cadastro_pacotes").html = texto;
					});

				}		
			}
		
    }
	if (tipo == 'INTERNA_CLENTES') {
		xmlhttp.open("GET", "internaClientes.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				internaClientes.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_HOTEIS') {
		xmlhttp.open("GET", "formHoteis.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				formHoteis.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_UTEIS') {
		xmlhttp.open("GET", "formUteis.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_uteis.innerHTML=texto
			}		
	    }
    }
	
	if (tipo == 'CADASTRO_DICAS') {
		xmlhttp.open("GET", "formDicas.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_dicas.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'CADASTRO_USUARIO') {
		xmlhttp.open("GET", "formUsuarios.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				cadastro_usuario.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'MANDA_RECADO') {
		xmlhttp.open("GET", "formRecados.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				formRecados.innerHTML=texto
			}		
	    }
    }
	
	if (tipo == 'ABRE_RECADO') {

		xmlhttp.open("GET", "mostraRecado.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				document.getElementById('recado'+id).innerHTML = texto
				carrega('ALTERA_TITULO',id)
			}		
	    }
    }
	
	if (tipo == 'ALTERA_TITULO') {
		xmlhttp.open("GET", "tituloRecado.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				document.getElementById('titulos'+id).innerHTML = texto
			}		
	    }
    }
	
	if (tipo == 'UTEIS') {
		xmlhttp.open("GET", "descricaoUteis.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				uteis.innerHTML=texto
			}		
	    }
    }
	
	if (tipo == 'DEPOIMENTOS') {
		xmlhttp.open("GET", "listaDepoimentos.asp",true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				depoimentos.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'PACOTE') {
		xmlhttp.open("GET", "carregaPacote.asp?id="+id+"&cat="+idCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				pacote.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'HOTEIS') {
		xmlhttp.open("GET", "carregaHoteis.asp?id="+id,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				hoteis.innerHTML=texto
			}		
	    }
    }
	if (tipo == 'LISTA_DEPOIMENTOS') {
		xmlhttp.open("GET", "formDepoimentos.asp?id="+id+"&txtDepoimento="+idCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
				depoimentos.innerHTML=texto
				carrega('EDITA_DEPOIMENTOS',id,idCat)
			}		
	    }
    }
	if (tipo == 'EDITA_DEPOIMENTOS') {
		
		xmlhttp.open("GET", "editaDepoimentos.asp?id="+id+"&txtDepoimento="+idCat,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4){
				var texto=xmlhttp.responseText
				texto=texto.replace(/\+/g," ")
				texto=unescape(texto)
			}		
	    }
    }
xmlhttp.send(null)
}


//if(xmlhttp)window.onload=carrega
