
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

var contentar;

function carrega(n,p,q,m,im,imp){
   //alert(n+' - '+p+' - '+q+' - '+m+' - '+im+' - '+imp);

	document.getElementById('n1').style.display="none";
	document.getElementById('n2').style.display="none";
	arr_pos	= ['',60,165,'','','',''];

	arr_anos = new Array();

	document.getElementById('home').style.display='none';
    

    
	for(i=0; i<=arr_tit[0].length-1;i++){
		document.getElementById('m'+(i+1)).style.color='#aaa';
	}
    


	serie_atual = m;

	document.getElementById('m'+m).style.color='#E63FA1';
    
 

	var contentar=document.getElementById(n);
    contentar.innerHTML='<div id="loader"><img src="js/loader.gif" /> carregando...</div>'


    
   xmlhttp.open("GET",p+q+'&img='+im+'&num='+ Math.random()*1000,true);
  



    //Executada quando o navegador obtiver o código
    xmlhttp.onreadystatechange=function() {
           if (xmlhttp.readyState==4){
    
            //Lê o texto
            var texto=xmlhttp.responseText

            //Desfaz o urlencode
            texto=texto.replace(/\+/g," ")
            texto=unescape(texto)

 			var contentar2=document.getElementById(n);
            contentar2.innerHTML=texto;

			if(m==1){
				for(h=0;h<arr_anos.length;h++){ //limpa o array com os anos do link Sonia Madruga
					arr_anos.pop();
				}
				arr_anos.push(document.getElementById('ano_ini').innerHTML);
				document.getElementById("exp_atual").innerHTML = document.getElementById('ano_ini').innerHTML;
				//show_ano(document.getElementById('ano_ini').innerHTML);
			}
            
            
			document.getElementById('link_home').style.display="block";
            //alert("p= "+p+" - imp= "+imp);
			if(imp!=undefined){
				if(p=='imprensa.asp?id=') carrega_img('show_img_imp','show_img_imp.asp?id='+imp,'7');
                if(p=='fotos.asp?id=') carrega_img('show_img_imp','show_fotos_imp.asp?id='+imp,'7');
                //if(p=='aquarelas.asp?id=') carrega_img('show_img_imp','aquarelas.asp?id='+imp,'7');
				//alert('show_img_imp','show_fotos_imp.asp?id='+imp);
			}
            
            if(q==1){
                show_ano(im);
                //alert('exposicao em ' + im);
            }
            
        }
    }
    xmlhttp.send(null);
}

function fncShowImage(titulo, tecnica, data, disponibilidade, dimensoes, suporte, imagemId) {
	document.getElementById('div_imagem').src = 'http://www.soniamadruga.com.br/painel/aquarelas/' + imagemId + '.jpg';
	document.getElementById('infoTecnica').innerHTML = tecnica;
	document.getElementById('infoImage').innerHTML = titulo + ' / ' + data + '<br>' + dimensoes + ' - ' + suporte + '<br>' + disponibilidade;
	//document.getElementById('div_imagem').style.background-image = 'http://www.soniamadruga.com.br/painel/aquarelas/' + imagemId + '.jpg';
	//alert(titulo + '\n' + tecnica + '\n' + data + '\n' + disponibilidade + '\n' + dimensoes + '\n' + suporte + '\n' + imagemId);
}

function carrega_img(n,p,q){
    //alert(n + p + q);

	contentar = document.getElementById(n);
	
	contentar.innerHTML='<div id="loader"><img src="js/loader.gif" /> carregando...</div>'
	
	document.getElementById("show_img_transp").style.display="block";
	
	//alert(p+'&num='+ Math.random()*1000+'&box_id='+q);
	xmlhttp.open("GET",p+'&num='+ Math.random()*1000+'&box_id='+q,true);

    //Executada quando o navegador obtiver o código
    xmlhttp.onreadystatechange=function() {

        if (xmlhttp.readyState==4){
				for(i=1;i<=document.getElementById("cont_box").innerHTML; i++){
					document.getElementById("box_"+i).style.display="block";
				}
				document.getElementById("show_img_imp").style.display="block";
				//document.getElementById("box_"+q).style.display="none";

				//Lê o texto
				var texto=xmlhttp.responseText

				//Desfaz o urlencode
				texto = texto.replace(/\+/g," ")
				texto = unescape(texto)

				//Exibe o texto no div conteúdo
				contentar.innerHTML = texto;
        }
    }
    xmlhttp.send(null)
}