function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  window.status=msgStr;
  document.MM_returnValue = true;
}

function setPhoto(photo,caption) {
	
	var ns = (document.layers ? true : false);
	var ie = (document.all ? true : false);
	var gk = (navigator.userAgent.indexOf("Mozilla/5")>=0 ? true : false);

	document.mainPhoto.src = photo;
	caption = unescape(caption);
	
	if (ie) {
		document.all["captionText"].innerHTML = caption;
	} else if (gk)  {
		document.getElementById("captionText").innerHTML = caption;
	} else {
		document.layers["captionText"].document.open();
		document.layers["captionText"].document.writeln(caption);
		document.layers["captionText"].document.close();
	}

}

function backPhoto(photoArray) {
	
	currentPhoto = document.mainPhoto.src;
	photoLength = photoArray.length-1;
	for(i=0;i<photoLength;i++) {
		
		if(currentPhoto.indexOf(photoArray[i][0])!=-1) {
			
			if (i==0) {
				setPhoto(photoArray[photoLength-1][0],photoArray[photoLength-1][1]);
			} else {
				setPhoto(photoArray[i-1][0],photoArray[i-1][1]);				
			}
			
		}
	}
	
}

function nextPhoto(photoArray) {
	
	currentPhoto = document.mainPhoto.src;
	photoLength = photoArray.length-1;
	for(i=0;i<photoLength;i++) {
		
		if(currentPhoto.indexOf(photoArray[i][0])!=-1) {

			if (i==photoLength-1) {
				setPhoto(photoArray[0][0],photoArray[0][1]);
			} else {
				setPhoto(photoArray[i+1][0],photoArray[i+1][1]);				
			}


		}
		
	}	
}