	
	// id's of menu divs
	var menuDivs = new Array();
	
	// images
	imgs = new Array();
	
	//thumbs
	var thumbId = 0;
	
	var currImg = null;
	
	var imgShown = false;
	
	FastInit.addOnLoad(initialize);
	
	
	
	
	function initialize() {
		if (ex == 0) { 
			document.getElementById("inhalt").innerHTML = "";
		} else {
			document.getElementById("inhalt").style.display = "block";
		}
        // initialize the DHTML History
        // framework
        dhtmlHistory.initialize();
        
        // subscribe to DHTML history change
        // events
        dhtmlHistory.addListener(historyChange);
        
        if (dhtmlHistory.isFirstLoad()) {
        	
        }
    }
	
	function historyChange(newLocation, historyData) {
		if (historyData != null && !dhtmlHistory.isFirstLoad()){
	        popDiv(historyData[0],historyData[1],historyData[2],historyData[3],historyData[4],historyData[5],ex,true);
        } else {
        	if (imgShown && ex != 0) {
        		hidePic(true);
        	}
        	
        }
      }
      
	registerImg = function (theURL, theCap, theUid, theIndex, w, h){
		if(imgs[theUid+""] == undefined){
			imgs[theUid+""] = new Array();
		}
		if (imgs[theUid+""][theIndex] == undefined){
			imgs[theUid+""][theIndex] = new Array(theURL, theCap, w, h);
		}
	}
	
	// define id for thumbnails
	function defineId(id){
		thumbId = id;
	}
	
	
		
			  
		  var htmlStore = null;
		  
		  function popDiv(theURL, theCap, theUid, theIndex, w, h, ex, historyMode){
		  	
		  	
		  	if(ex == 0){
				var div = document.getElementById("showWork");
		  	} else {
			  	var div = document.getElementById("showPic");
		  	}
		  	
		  	imgShown = true;
		  	var wCap = "";
		  	if(theCap != ""){
		  		wCap = "<!-- Leiko Ikemura: -->" + theCap + "<br />";
		  	}
		  	var pnClass = "prevNextRel";
		  	if(ex == 1){
		  		pnClass = "prevNextAbs";
		  	}
		  	var htm  = "<div id='prevNext' class='"+pnClass+"'><div id='prevImg'></div>";
		  	if(ex != 0){
			  	htm += "<a href='javascript:hidePic();' class='schliessen'><img src='fileadmin/user/leiko_ikemura/templates/grafik/x.gif' border='0' alt='weiter'/></a>";
			} else {
				htm += "<div class='noschliessen'></div>";
			}
		  	htm += "<div id='nextImg'></div></div><table cellpaddin='0' cellspacing='0'><tr><td class='img'>";
		    
		    // add img link to next
		    var nIndex = 0;
		    if((theIndex + 1) < imgs[theUid].length){
		      nIndex = theIndex + 1;
		    }
		  	var nURL = imgs[theUid][nIndex][0];
		  	var nCap = imgs[theUid][nIndex][1];
		  	var nw = imgs[theUid][nIndex][2];
		  	var nh = imgs[theUid][nIndex][3];
		  	
		  	htm+= "<a href=\"javascript:popDiv('"+ nURL+"', '"+ nCap+"', '"+theUid+"', "+nIndex+", "+nw+", "+nh+", "+ex+");\">";

		  	htm+= "<img border='0' src='" + theURL + "'width='"+w+"' height='"+h+"'/></td></tr><tr><td class='caption'>"+wCap+"</td></tr></table>";
		  	htm+= "</a>";

			div.innerHTML = htm;
			
		  	if(htmlStore == null) htmlStore = document.getElementById("contentContainer").innerHTML;

		  	div.style.display = "block";
			
			if(ex != 0){
			  	document.getElementById("contentContainer").innerHTML = "";
			} else {
				document.getElementById("inhalt").style.display = "none";
			}
		  	document.getElementById("prevNext").style.display = "block";
		  	
		  	
		  	if (theIndex > 0){
		  		writePrevNext(theUid, theIndex-1, "prevImg", "<img src='fileadmin/user/leiko_ikemura/templates/grafik/pfeil_links.gif' border='0' alt='zurück'/>");
		  	}
		  	
		  	if (historyMode == undefined || historyMode != true){
				var dat = new Array(theURL, theCap, theUid, theIndex, w, h, historyMode);
				dhtmlHistory.add(theUid + "_" +theIndex, dat);
			}
		  	
		  	if((theIndex + 1) < imgs[theUid].length){
		  		writePrevNext(theUid, theIndex+1, "nextImg", "<img src='fileadmin/user/leiko_ikemura/templates/grafik/pfeil_rechts.gif' border='0' alt='weiter'/>");
		  	}
		  	

		  	
		  	
		  }
		  
		  function hidePic(historyMode){
			  var div = document.getElementById("showPic");
			  div.innerHTML = "";
			  div.style.display = "none";
			  document.getElementById("contentContainer").innerHTML = htmlStore;
			  if(!historyMode){
			  	dhtmlHistory.add("art", null);
			  }
		  }


		  function writePrevNext(theUid, theIndex, direction, theString){
		  	var s = document.getElementById(direction);
		  	if(imgs[theUid][theIndex] == undefined) return;
		  	var theURL = imgs[theUid][theIndex][0];
		  	var theCap = imgs[theUid][theIndex][1];
		  	var w = imgs[theUid][theIndex][2];
		  	var h = imgs[theUid][theIndex][3];
		  	
		  	s.innerHTML="<a href=\"javascript:popDiv('"+ theURL+"', '"+ theCap+"', '"+theUid+"', "+theIndex+", "+w+", "+h+", "+ex+");\">"+theString+"</a>";
		  }
		  
		  


