function openGalleryEntry(tabNr, imgNr, width, height, slideshow) {	var docURL = document.URL;	var pos = docURL.indexOf("?OpenDocument");	if(pos != "-1") {		docURL = docURL.substring(0, pos);	}	var entryURL = docURL + "?OpenDocument&tab=" + tabNr + "&img=" + imgNr;	if (slideshow) entryURL += "&slideshow";	var windowWidth =  width + 30;	var windowHeight = height + 130;	var windowX = (screen.width - windowWidth) / 2;	var windowY = (screen.height - windowHeight) / 2;	var parameters = "width=" + windowWidth + ", height=" + windowHeight + ", left=" + windowX + ", top=" + windowY + ", location=no, status=no, toolbar=no, menubar=no, dependent=yes";	var entryWindow = window.open(entryURL, "entry", parameters);	if (entryWindow) entryWindow.focus();		}function openGalleryEntryEdit(nr, width, height, slideshow) {	var entryURL= "web/" + refUNID + "?OpenDocument&nr=" + nr;		var windowWidth =  width + 20;	var windowHeight = height + 130;	var windowX = (screen.width - windowWidth) / 2;	var windowY = (screen.height - windowHeight) / 2;	var parameters = "width=" + windowWidth + ", height=" + windowHeight + ", left=" + windowX + ", top=" + windowY + ", location=no, status=no, toolbar=no, menubar=no, dependent=yes";	var entryWindow = window.open(entryURL, "entry", parameters);	if(entryWindow) entryWindow.focus();	}function openZip(title) {	var docURL = document.URL;	var pos = docURL.indexOf("?OpenDocument");	if(pos != "-1") {		docURL = docURL.substring(0, pos);	}	var entryURL = docURL + "/$file/" + title;	window.location.href = entryURL;}function resizeWindow(width, height) {	var windowWidth = width + 30;	var windowHeight = height + 130;	window.resizeTo(windowWidth, windowHeight);	/*alert(window.outerHeight);	alert(window.innerHeight);	alert(document.documentElement.clientHeight);		alert(document.body.clientHeight);	alert(document.body.offsetHeight);		self.resizeTo(width, height);alert(self.document.body.clientWidth);alert(self.innerWidth);alert(self.document.body.clientHeight);	alert(self.window.innerHeight);	alert(width - self.document.body.clientWidth + 10);	alert(height - self.document.body.clientHeight + 110);				self.resizeBy(width - self.document.body.clientWidth + 10, height - self.document.body.clientHeight + 110);	*/}function resizeMoveWindow(width, height) {	//alert(document.images["imgend"].offsetTop);	var windowWidth =  width + 30;	var windowHeight = height + 130;	//alert(windowHeight);	//alert(windowHeight);	//alert(document.images["imgend"].offsetTop);		if(document.images["imgend"].offsetTop) {		while(document.images["imgend"].offsetTop + 50 > windowHeight) {			windowHeight += 10;		}	}	//alert(windowHeight);	var windowX = (screen.width - windowWidth) / 2;	var windowY = (screen.height - windowHeight) / 2;	window.resizeTo(windowWidth, windowHeight);	window.moveTo(windowX, windowY);	}//Slideshowvar slideshowTimer;var isSlideshowRunning;var slideshowNextURL;var tabBegin;var tabPrev;var tabNext;var tabEnd;var imgBegin;var imgPrev;var imgNext;var imgEnd;var slideshowTimeout;function galleryGoto(dest) {	switch (dest) {	case "begin":		tabNr = tabBegin;		imgNr = imgBegin;		break;	case "prev":		tabNr = tabPrev;		imgNr = imgPrev;		break;	case "next":		tabNr = tabNext;		imgNr = imgNext;		break;	case "end":		tabNr = tabEnd;		imgNr = imgEnd;		break;	}	var docURL = document.URL;	var pos = docURL.indexOf("&tab");	if(pos != "-1") {		docURL = docURL.substring(0, pos);	}	var entryURL = docURL + "&tab=" + tabNr + "&img=" + imgNr;		self.location.href = entryURL;}function slideshowNext() {	var docURL = document.URL;	var pos = docURL.indexOf("&tab");	if(pos != "-1") {		docURL = docURL.substring(0, pos);	}	var entryURL = docURL + "&tab=" + tabNext + "&img=" + imgNext +"&slideshow";	if(imgNext != '') self.location.href = entryURL;	}function continueSlideshow() {		slideshowTimer = window.setTimeout("slideshowNext()", slideshowTimeout);}function startStopSlideshow() {	if(isSlideshowRunning) {		window.clearTimeout(slideshowTimer);		document.getElementById("startstop").innerHTML = startLabel;	}	else {			slideshowTimer = window.setTimeout("slideshowNext()", slideshowTimeout);		document.getElementById("startstop").innerHTML = stopLabel;	}	isSlideshowRunning = !isSlideshowRunning;}function startSlideshow() {	openGalleryEntry(1, 1, 640, 480, true);}