didaArray = new Array();
colorArray = new Array();
dimArray = new Array();
codeArray = new Array();    
dimensArray = new Array();

urlArray = new Array();
totalePagine = 0;
paginaCorrente = 0;
contatoreFoto = 0;
function evidenziaVoce(obj){elementi = obj.parentNode.parentNode.parentNode.getElementsByTagName('a');for(i=0;i<elementi.length;i++){elementi[i].className='pulsante_scheda';}obj.className = 'pulsante_scheda_strong';}
    function thisMovie(movieName) {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];

    }
    function makeCall(str) {

        thisMovie("fotoContainer").loadImage(str);

    }
function openImageLow(ilPercorso,ilPrefisso,ilContatore,tipo){

	dxPath = '/luce_img/buttons/freccia_dx_scura.gif';
	sxPath = '/luce_img/buttons/freccia_sx_scura.gif';

	if(tipo == 'big'){
		dxPath = '/luce_img/'+specificPath+'buttons/freccia_dx_scura_big.gif';
		sxPath = '/luce_img/'+specificPath+'buttons/freccia_sx_scura_big.gif';
	}

	if(document.getElementById("laImmagine") != null){
		document.getElementById("laImmagine").src = ilPrefisso+ilPercorso;
	}
	if(document.getElementById("laImmagineHigh") != null){

		document.getElementById("laImmagineHigh").style.background =  'url('+ilPrefisso+ilPercorso+') no-repeat center center';
		//makeCall(ilPrefisso+ilPercorso);

	//	alert(ilPrefisso+ilPercorso)
	}

	if(document.getElementById("laDidascalia") != null){
		if(didaArray != null)
			if(didaArray[ilContatore] != null)
				document.getElementById("laDidascalia").innerHTML = didaArray[ilContatore];
	}
	if(document.getElementById("leDimensioni") != null){
	
		if(dimensArray != null)
			if(dimensArray[ilContatore] != null)
				document.getElementById("leDimensioni").innerHTML = dimensArray[ilContatore];
	}
	if(document.getElementById('prevImage') != null){
		if(ilContatore>0){
			document.getElementById('prevImage').innerHTML = '<a href="#" onclick="return prevImg()"><img src="'+sxPath+'" alt="Precedente"   border="0"></a>';

			if(ilContatore == urlArray.length-1){
				document.getElementById('nextImage').innerHTML = '';
			}else{
				document.getElementById('nextImage').innerHTML = '<a href="#" onclick="return nextImg()"><img src="'+dxPath+'" alt="Successivo"  border="0"></a>';
			}

		}else{
		if(ilContatore==0)
			document.getElementById('prevImage').innerHTML = '';
			if(urlArray.length>0){
				document.getElementById('nextImage').innerHTML = '<a href="#" onclick="return nextImg()"><img src="'+dxPath+'" alt="Successivo"   border="0"></a>';
			}
		}
	}
	contatoreFoto = ilContatore;
	return true
}


function openImageLowNew(ilPercorso,ilPrefisso,ilContatore,tipo){

	dxPath = '/luce_img/buttons/freccia_dx_scura.gif';
	sxPath = '/luce_img/buttons/freccia_sx_scura.gif';

	if(tipo == 'big'){
		dxPath = '/luce_img/'+specificPath+'buttons/freccia_dx_scura_big.gif';
		sxPath = '/luce_img/'+specificPath+'buttons/freccia_sx_scura_big.gif';
	}
	if(document.getElementById("laImmagine") != null){
		document.getElementById("laImmagine").src = ilPrefisso+ilPercorso;
	}
	if(document.getElementById("laImmagineHigh") != null){

		document.getElementById("laImmagineHigh").style.background =  'url('+ilPrefisso+ilPercorso+') no-repeat center center';
		//makeCall(ilPrefisso+ilPercorso);

	//	alert(ilPrefisso+ilPercorso)
	}

	if(document.getElementById("didaSpace") != null){
		if(didaArray != null)
			if(didaArray[ilContatore] != null)
				document.getElementById("didaSpace").innerHTML = didaArray[ilContatore];
	}
	if(document.getElementById("dimSpace") != null){
		if(dimArray != null)
			if(dimArray[ilContatore] != null)
				document.getElementById("dimSpace").innerHTML = dimArray[ilContatore];
	}
	if(document.getElementById("colorSpace") != null){
		if(colorArray != null)
			if(colorArray[ilContatore] != null)
				document.getElementById("colorSpace").innerHTML = colorArray[ilContatore];
	}	
	
	if(document.getElementById("codeSpace") != null){
		if(codeArray != null)
			if(codeArray[ilContatore] != null)
				document.getElementById("codeSpace").innerHTML = codeArray[ilContatore];
	}	
	
	
	if(document.getElementById('prevImage') != null){
		if(ilContatore>0){
			document.getElementById('prevImage').innerHTML = '<a href="#" onclick="return prevImg()"><img src="'+sxPath+'" alt="Precedente"   border="0"></a>';

			if(ilContatore == urlArray.length-1){
				document.getElementById('nextImage').innerHTML = '';
			}else{
				document.getElementById('nextImage').innerHTML = '<a href="#" onclick="return nextImg()"><img src="'+dxPath+'" alt="Successivo"  border="0"></a>';
			}

		}else{
		if(ilContatore==0)
			document.getElementById('prevImage').innerHTML = '';
			if(urlArray.length>0){
				document.getElementById('nextImage').innerHTML = '<a href="#" onclick="return nextImg()"><img src="'+dxPath+'" alt="Successivo"   border="0"></a>';
			}
		}
	}
	contatoreFoto = ilContatore;
	return true
}



function fotoPlayer(/* int */physDoc,/*string*/theDb,/*string*/ section,/*string*/theId){
	percorso = "/archivioluce/jsp/schede/fotoPlayer.jsp";
	percorso += "?doc="+physDoc;percorso += "&db="+theDb;percorso += "&index="+(contatoreFoto+1);
	percorso += "&id="+theId+"&section="+section;
	theFotoPlayer = window.open(percorso,'theFotoPlayer','scrollbars=auto,toolbar=no,location=no,width=760,height=710,resizable=no');
	theFotoPlayer.moveTo(0,0);
	theFotoPlayer.focus();
	return true;
}
function settaImgPage(numeroPagine){
	totalePagine = numeroPagine;
}
function nextImg(){
	openImageHigh(contatoreFoto+1);
}
function prevImg(){
	openImageHigh(contatoreFoto-1);
}
function openImageHigh(theId){
 	openImageLow(urlArray[theId],'',theId,'big')
}
function nextImgPage(){
	if(paginaCorrente+1<totalePagine){
		eval('theObj = document.getElementById(\'paginaFoto'+paginaCorrente+'\')')
		if(theObj != null){
			theObj.style.display = 'none';
			//theObj.style.visibility = 'hidden';
		}

		paginaCorrente++;

		eval('theObj2 = document.getElementById(\'paginaFoto'+paginaCorrente+'\')')
		
		if(theObj2 != null){
			theObj2.style.display = '';
			//theObj.style.visibility = 'visible';
		}
	}
 
}
function prevImgPage(){
	if(paginaCorrente>0){
		paginaCorrente--;
		eval('theObj = document.getElementById(\'paginaFoto'+paginaCorrente+'\')')
		if(theObj != null)
			theObj.style.display = ''
		eval('theObj = document.getElementById(\'paginaFoto'+(paginaCorrente+1)+'\')')
		if(theObj != null)
			theObj.style.display = 'none'
	}
}
function evidenziaVoce(obj){
	elementi = obj.parentNode.getElementsByTagName('a');
	for(i=0;i<elementi.length;i++){elementi[i].className='pulsante_scheda';}
	obj.className = 'pulsante_scheda_strong';
}

function setPageDim(/*string*/ action){
	if(action == 'grow'){
		document.getElementById('testoSchedaBreve').style.display='none';
		document.getElementById('testoSchedaLungo').style.display='';
		document.getElementById('scheda_iFrame').style.display='none';
		evidenziaVoce(document.getElementById('hiddenAnchor'));
	}
	else{
		if(document.getElementById('testoSchedaBreve').style.display=='none'){
			document.getElementById('testoSchedaLungo').style.display='none';
			document.getElementById('testoSchedaBreve').style.display='';
			document.getElementById('scheda_iFrame').style.display='';
		}
	}
}

function openTabUnder(obj){
	padre = obj.parentNode.parentNode.parentNode;
	
	eleArray = padre.getElementsByTagName('SPAN');
	eleArrayTD = padre.getElementsByTagName('TD');
	
	for(i=0;i<eleArrayTD.length;i++){
 		eleArrayTD[i].className = 'titoli_gray';
 	}

	for(i=0;i<eleArray.length;i++){
		theId = eleArray[i].id;
		if(theId.indexOf("show")==0){
			eleArray[i].style.display = 'none';
		}else if(theId.indexOf("hide")==0){
			eleArray[i].style.display = '';
		}
	} 
	
	(obj.parentNode.parentNode).className = "titoli_section";
	eleArray = (obj.parentNode.parentNode).getElementsByTagName('SPAN');
	for(i=0;i<eleArray.length;i++){
		theId = eleArray[i].id;
		if(theId.indexOf("show")==0){
			eleArray[i].style.display = '';
		}else if(theId.indexOf("hide")==0){
			eleArray[i].style.display = 'none';
		}
	} 
 
	
return true;
}

