	var timerActive = false;
	var timerVal = defTimerVal;
	var testex = /\?timer\=(\d+)/;
	var pagetimer;

	// preload images
	var imgPlus = new Array();
	imgPlus[0] = new Image(); imgPlus[0].src = "../inc/1/button_plus01.gif";
	imgPlus[1] = new Image(); imgPlus[1].src = "../inc/1/button_plus02.gif";
	var imgMinus = new Array();
	imgMinus[0] = new Image(); imgMinus[0].src = "../inc/1/button_minus01.gif";
	imgMinus[1] = new Image(); imgMinus[1].src = "../inc/1/button_minus02.gif";
	var imgPlay = new Array();
	imgPlay[0] = new Image(); imgPlay[0].src = "../inc/1/button_play01.gif";
	imgPlay[1] = new Image(); imgPlay[1].src = "../inc/1/button_play02.gif";
	var imgPause = new Array();
	imgPause[0] = new Image(); imgPause[0].src = "../inc/1/button_stop01.gif";
	imgPause[1] = new Image(); imgPause[1].src = "../inc/1/button_stop02.gif";
	
	// do not modify this line - !!!new style!!!

	if (testex.test(window.location.search)) {
		testex.exec(window.location.search);
		if (parseInt(RegExp.$1) > 0) {
			timerActive = true;
			timerVal = parseInt(RegExp.$1);
		}
	}

	function initTimer() {
		if (timerActive) {
			startIt();
		}
	}
	
	function initControl() {
		if(document.getElementById) {
			document.getElementById("timerValue").firstChild.nodeValue = timerVal + timerPostfix;
			if (!timerActive) {
				document.getElementById("timerControl").style.visibility = "hidden";
				document.getElementById("timerInfoButton").src = imgPlay[1].src;
				document.getElementById("timerInfoText").firstChild.nodeValue = "automatisch abspielen";
			} else {
				document.getElementById("timerControl").style.visibility = "visible";
				document.getElementById("timerInfoButton").src = imgPause[1].src;
				document.getElementById("timerInfoText").firstChild.nodeValue = "diashow stoppen";
			}
		}
	}

	function toggleControl() {
		if(document.getElementById) {
			if (document.getElementById("timerControl").style.visibility == "visible") {
				document.getElementById("timerControl").style.visibility = "hidden";
				pauseIt();
				document.getElementById("timerInfoButton").src = imgPlay[1].src;
				document.getElementById("timerInfoText").firstChild.nodeValue = "automatisch abspielen";
			} else {
				document.getElementById("timerControl").style.visibility = "visible";
				startIt();
				document.getElementById("timerInfoButton").src = imgPause[1].src;
				document.getElementById("timerInfoText").firstChild.nodeValue = "diashow stoppen";
			}
		}
	}
	
	function setTimer(mode) {
		pauseIt();
		if(document.getElementById) {
			switch (mode) {
				case "inc":
					if (timerVal < 99) timerVal += 1;
					break;
				case "dec":
					if (timerVal > 0) timerVal -= 1;
					break;
				default:
					break;
			}
			document.getElementById("timerValue").firstChild.nodeValue = timerVal + timerPostfix;
		}
		startIt();
	}
	
	function startIt() {
		clearTimeout(pagetimer);
		pagetimer = setTimeout("pageNav('next', '?timer=' + timerVal)", timerVal * 1000);
		timerActive = true;
	}
	
	function pauseIt() {
		clearTimeout(pagetimer);
		timerActive = false;
	}
	
	function pageNav(dir, qs) {
		var query = (typeof qs != "undefined") ? qs : "";
		switch (dir) {
			case "prev":
				window.location.href = prevPage + query;
				break;
			case "next":
			default:
				window.location.href = nextPage + query;
				break;
		}
	}
	
	function swapImage(imgid, swapimg) {
		if(document.getElementById) {
			document.getElementById(imgid).src = swapimg.src;
		}
	}
	
	function swapInfo(eid, evt) {
		if(document.getElementById) {
			if (timerActive) {
				if ((document.getElementById(eid + 'Button').src != imgPause[evt].src) && (imgPause[evt].complete)) {
					document.getElementById(eid + 'Button').src = imgPause[evt].src;
				}
			} else {
				if ((document.getElementById(eid + 'Button').src != imgPlay[evt].src) && (imgPlay[evt].complete)) {
					document.getElementById(eid + 'Button').src = imgPlay[evt].src;
				}
			}
		}
	}

	function openLeft() {
	  if (window.parent.location==window.location) {
	  	window.resizeTo(755,650); // stand-alone dia page (no thumbnail navigation)
	  } else {
	    if (window.location.pathname.indexOf(firstPage) > -1) {
	  	  window.parent.thumbnailFrame.location.replace(thumbPage);
	  	}
	  }
	}  
	
	function openRight() {
	  if (window.parent.location==window.location) {
	  } else {
	    if (window.location.pathname.indexOf(firstPage) > -1) {
	  	  window.parent.rightFrame.location.replace("http://pixcentral.tele.net/dotcom_right.asp?category="+masterId);
	  	}
	  }
	}  

