function callPrev() {	
	document.getElementById('closeLink').onclick();
	window.setTimeout(aspettaunsecondoPrecedente, 300);	 
}
		
function callNext() {
	document.getElementById('closeLink').onclick();
	window.setTimeout(aspettaunsecondoProssima, 300);
}

function aspettaunsecondoProssima() {
	var swf = swfobject.getObjectById("collezioneswf");
	swf.myFunctionNext();
}

function aspettaunsecondoPrecedente() {
	var swf = swfobject.getObjectById("collezioneswf");
	swf.myFunctionPrev();
}


function callBig(who) {
	String(who).split(',');
	var imgNumber = who[0];
	var imgFolder = who[1];
	var imgDidascalia = who[2];
	//alert(imgDidascalia);
	document.getElementById('hslink').href="images/collezioni/"+imgFolder+"/zoom/"+imgNumber+"";
	
	var myImage = new Image();
	myImage.name = imgNumber;
	myImage.onload = getWidthAndHeight;
	myImage.onerror = loadFailure;
	myImage.src = "http://lab/Web/ciainternationalnew/http/images/collezioni/"+imgFolder+"/zoom/"+imgNumber+"";

	
	if(imgDidascalia) {
		  var div = document.getElementById('didascalia') || hs.clones['didascalia'];
		  //alert(div);
		  if (div) div.innerHTML = imgDidascalia;
		  
	} else {
		  var div2 = document.getElementById('didascalia') || hs.clones['didascalia'];
		  //alert(div2);
		  if (div2) div2.innerHTML = "";
	}

    //alert(theImg.height);
	
	document.getElementById('hslink').onclick();
}


function loadFailure() {
	   //alert("'" + this.name + "' failed to load.");
	   return true;
}

function getWidthAndHeight() {
	  // alert("'" + this.name + "' is " + this.width + " by " + this.height + " pixels in size.");

	
	   var myheight = this.height/2;
	   myheight += 80;
	   
	   var mywidth = this.width;
		
	   //window.setTimeout(changeWidthAndHeight, 500, [myheight]);
	   
	   return true;
	  
	}

function changeWidthAndHeight(he) {
	
	 //String(hewi).split(',');
	
	 var nextButton = document.getElementById('nextButton') || hs.clones['nextButton'];
	 var prevButton = document.getElementById('prevButton') || hs.clones['prevButton'];
	/* if (nextButton) { 
		 nextButton.style.marginTop = "-"+he+"px"; 
	 }
	 
	 if (prevButton) { 
		 prevButton.style.marginTop = "-"+he+"px"; 
	 }
	 */
	   
}

