/* +++++++++++++++++++++++ ++++++++++++++++++++++++++++   PIANO    */


function hidegals(bgimg){
	
prendi('box_a').style.display="none";
prendi('box_b').style.display="none";	
prendi('box_c').style.display="block";

prendi('uppiano').style.backgroundImage="url(_img/"+bgimg+")";
	
}

function showgals(){

prendi('box_c').style.display="none";		
prendi('box_a').style.display="block";
prendi('box_b').style.display="block";	
	
prendi('uppiano').style.backgroundImage="";	
	
}


/* +++++++++++++++++++++++ ++++++++++++++++++++++++++++   GALLERY  */


function disablebody(){

document.body.style.overflow="hidden";	
	
	
}


var limit="";
var currentimg="";





function showgallery (urlo,cimg,dida,tito){


	
scroll(0,0);

prendi('currentfoto').src="http://www.museotaranto.org/web/gal/loader.gif";

document.body.style.position="relative";	
document.body.style.overflow="hidden";

prendi('fV').style.display="block";
prendi('fC').style.display="block";


var loadingimg=prendi('currentfoto');
prendi('currentfoto').src="_img/"+urlo;
		
		currentimg=cimg;	

		// safari appendchild problem
		var ua = navigator.userAgent.toLowerCase();
		if (ua.indexOf('safari/') != -1){
		
	      var ndida = unescape(dida);
		   prendi('fD').innerHTML=ndida;	
		
		} else {
			
			
		   var ndida = document.createTextNode(unescape(dida));
		   prendi('fD').appendChild(ndida);	
		   
			
		}
		
		
		// FRECCINE
		
		if(currentimg<="1" ){
			
			prendi('didaleft').src="gal/gallery_left_no.gif";
			
		} else {
		
			prendi('didaleft').src="gal/gallery_left.gif";
		}
		
		
		if(currentimg<parseInt(limit)){
			
			prendi('didaright').src="gal/gallery_right.gif";
			
		} else 	if(currentimg>=limit){
		
			prendi('didaright').src="gal/gallery_right_no.gif";
		}
	
}

function hidegallery (){
	
scroll(0,0);
document.body.style.position="static";
document.body.style.overflow="visible";
    
prendi('fV').style.display="none";
prendi('fC').style.display="none";

prendi('currentfoto').src="http://www.museotaranto.org/web/gal/loader.gif";



		var ua = navigator.userAgent.toLowerCase();
		if (ua.indexOf('safari/') != -1){
		
	        var elemento = prendi('fD');
		   prendi('fD').innerHTML="";	
		
		} else {
			
			
		   var elemento = prendi('fD');
				while (elemento.firstChild) {
 					 elemento.removeChild(elemento.firstChild);
					}
		   
			
		}


		
	
}


function gotoimg(where){
	
	if(where=='fwd' && currentimg<limit){
				
		prendi('currentfoto').src="http://www.museotaranto.org/web/gal/loader.gif";
		
		currentimg++;
		var imgurl=eval('foto'+(currentimg));
		var newdida=eval('dida'+(currentimg));
		var newtito=eval('tito'+(currentimg));
	
	
		var element = prendi('fD');
		while (element.firstChild) {
 			 element.removeChild(element.firstChild);
		}
		
	
		showgallery(imgurl,currentimg,newdida,newtito);	
		
	}
	
	if(where=='rwd' && currentimg>1){
	
		prendi('currentfoto').src="http://www.museotaranto.org/web/gal/loader.gif";
		
		currentimg--;
		var imgurl=eval('foto'+(currentimg));
		var newdida=eval('dida'+(currentimg));
		var newtito=eval('tito'+(currentimg));
		
		if(currentimg<=1 ){
			
			prendi('didaleft').src="gal/gallery_left_no.gif";
			
		} else {
		
			prendi('didaleft').src="gal/gallery_left.gif";
		}
		
	
		var element = prendi('fD');
		while (element.firstChild) {
 			 element.removeChild(element.firstChild);
		}
		
		
		
		showgallery(imgurl,currentimg,newdida,newtito);	
		
		
	}
	
}


function StripAll(StripAllBlanks)
   {
   return StripAllBlanks.replace(/\r\n+/," ");
   }
