		/* Benoetigte Daten laden */
		var product_image = new Image();
		var img_width;
		var img_height;
		
		
		function get_size() {
			var windowWidth, windowHeight;
			if (document.documentElement && document.documentElement.clientHeight) {
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (window.innerHeight) {
				windowWidth = window.innerWidth;
				windowHeight = window.innerHeight;
			}
	
			var pageWidth, pageHeight;
			if (window.innerHeight && window.scrollMaxY) {	
				pageWidth = document.body.scrollWidth;
				pageHeight = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){
				pageWidth = document.body.scrollWidth;
				pageHeight = document.body.scrollHeight;
			} else {
				pageWidth = document.body.offsetWidth;
				pageHeight = document.body.offsetHeight;
			}
			pageWidth = pageWidth + 32;		//+ left-, right-margin
			pageHeight = pageHeight + 20;	//+ bottom-margin
			
			var xScroll, yScroll;
			if (window.pageYOffset) {
				xScroll = window.pageXOffset;
				yScroll = window.pageYOffset;
			} else if (document.documentElement.scrollTop) {
				xScroll = document.documentElement.scrollLeft;
				yScroll = document.documentElement.scrollTop;
			} else if (document.body) {
				xScroll = document.body.scrollLeft;
				yScroll = document.body.scrollTop;
			}
			
			size = new Array();
				size["windowWidth"] = windowWidth;
				size["windowHeight"] = windowHeight;
				size["pageWidth"] = pageWidth;
				size["pageHeight"] = pageHeight;
				size["xScroll"] = xScroll;
				size["yScroll"] = yScroll;				
				
			return size;
		}
		
		function ani(width, height) {
			if(document.pimage.width < img_width) {
				document.pimage.width += width;
				document.pimage.height += height;
				window.setTimeout("ani(" + width + ", " + height + ")",10);
			}
			else {
				var left_arrow = document.getElementById("left_arrow");
				var right_arrow = document.getElementById("right_arrow");
				left_arrow.style.visibility = "visible";
				right_arrow.style.visibility = "visible";				
			}
		}

		function load_image(url) {
			var box = document.getElementById("overlay");
			var left_arrow = document.getElementById("left_arrow");
			var right_arrow = document.getElementById("right_arrow");
			var loading = document.getElementById("loading");
			var images = get_images();
			var size = get_size();
			var a = images.length - 1;
			
						
			// Schwarzes DIV anzeigen
			box.style.width = size["windowWidth"] + "px";
			box.style.height = size["pageHeight"] + "px";
			box.style.visibility = "visible";
			
			// Ladeanzeige
			var loading_top, loading_left;
			loading_top = Math.round(size["windowHeight"] / 2) - 16;
			loading_left = Math.round(size["windowWidth"] / 2) - 16;
			loading.style.top = loading_top + "px";
			loading.style.left = loading_left + "px";
			loading.style.visibility = "visible";
			

			// Produkt Bild laden 
			product_image.src = url;
			
			if(url.indexOf("media/actionshots/") == -1) {	//Wenn kein Actionbild dann Pfeile anzeigen
				//Pfeile erstellen
				if(product_image.src == images[0]) {
					left_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/left_arrow_grey.gif\" alt=\"left_arrow\">";
				} else {
					left_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/left_arrow.gif\" alt=\"left_arrow\" onclick=\"javascript:void(prev_image());\" style=\"cursor: pointer;\">";
				}
				if(product_image.src == images[a]) {
					right_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/right_arrow_grey.gif\" alt=\"right_arrow\">";
				} else {
					right_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/right_arrow.gif\" alt=\"right_arrow\" onclick=\"javascript:void(next_image());\" style=\"cursor: pointer;\">";
				}
			} else {		//Sonst Pfeile entfernen
				left_arrow.innerHTML = "";
				right_arrow.innerHTML = "";
			}

			// Bildgroesse ermitteln
			product_image.onload = function () {
				img_width = product_image.width;
				img_height = product_image.height;
				show_image();
			};
		}
		
		function show_image() {
			var box = document.getElementById("overlay");
			var img = document.getElementById("image_box");
			var left_arrow = document.getElementById("left_arrow");
			var right_arrow = document.getElementById("right_arrow");
			var loading = document.getElementById("loading");
			var size = get_size();
			var images = get_images();
						
			// Anzeigebereich zu klein?
			if(size["windowWidth"] < img_width || size["windowHeight"] < img_height) {
				img_width = img_width  * 0.75;
				img_height = img_height * 0.75;
			}
			if(size["windowWidth"] < img_width || size["windowHeight"] < img_height) {
				img_width = img_width / 0.75 * 0.5;
				img_height = img_height / 0.75 * 0.5;
			}

			// Mitte berechnen
			var start_top, start_left;
			start_top = Math.round((size["windowHeight"] / 2) - (img_height / 2)) + size["yScroll"];
			start_left = Math.round((size["windowWidth"] / 2) - (img_width / 2)) + size["xScroll"];
			
			// Pfeile
			var posi = Math.round(img_height / 2) - 25;
			left_arrow.style.height = img_height + "px";
			right_arrow.style.height = img_height + "px";
			left_arrow.style.lineHeight = posi + "px";
			right_arrow.style.lineHeight = posi + "px";
			if(images.length > 1) {
				left_arrow.style.visibility = "visible";
				right_arrow.style.visibility = "visible";
			}
					
			// Bild anzeigen
			img.style.left = start_left + "px";
			img.style.top = start_top + "px";
			img.style.width = img_width + "px";
			img.style.height = img_height + "px";
			document.pimage.src = product_image.src;
			document.pimage.width = img_width;
			document.pimage.height = img_height;
			loading.style.visibility = "hidden";
			img.style.visibility = "visible";
		}
		
		function next_image() {
			var images = get_images();
			var a = images.length - 1;
			var left_arrow = document.getElementById("left_arrow");
			var right_arrow = document.getElementById("right_arrow");
			var loading = document.getElementById("loading");
			loading.style.visibility = "visible";
			for (i=0; images.length > i; i++) {
				if(images[i] == product_image.src) {
					i += 1;
					product_image.src = images[i];
					if(i == a)
						right_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/right_arrow_grey.gif\" alt=\"right_arrow\">";
					if(i > 0)
						left_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/left_arrow.gif\" alt=\"left_arrow\" onclick=\"javascript:void(prev_image());\" style=\"cursor: pointer;\">";
				}
			}
		}
		
		function prev_image() {
			var images = get_images();
			var a = images.length - 1;
			var left_arrow = document.getElementById("left_arrow");
			var right_arrow = document.getElementById("right_arrow");
			var loading = document.getElementById("loading");
			loading.style.visibility = "visible";
			for (i=0; images.length > i; i++) {
				if(images[i] == product_image.src) {
					i -= 1;
					product_image.src = images[i];
					if(i < a)
						right_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/right_arrow.gif\" alt=\"right_arrow\" onclick=\"javascript:void(next_image());\" style=\"cursor: pointer;\">";
					if(i == 0)
						left_arrow.innerHTML = "<br /><img src=\"templates/ix-tech/img/left_arrow_grey.gif\" alt=\"left_arrow\">";
				}
			}
		}
		
		function close_image() {
			var box = document.getElementById("overlay");
			var img = document.getElementById("image_box");
			var left_arrow = document.getElementById("left_arrow");
			var right_arrow = document.getElementById("right_arrow");
			left_arrow.style.visibility = "hidden";
			right_arrow.style.visibility = "hidden";	
			box.style.visibility = "hidden";
			img.style.visibility = "hidden";
			box.style.width = "0px";
			box.style.height = "0px";
			img.style.width = "0px";
			img.style.height = "0px";
			document.pimage.src = 'templates/ix-tech/img/1x1-white.png';
		}
		
		
		function check_size() {
			alert('ff like: '+window.innerWidth+' / '+window.innerHeight);
			alert('ie like: '+document.body.clientWidth+' / '+document.body.clientHeight);
			alert('kp like: '+document.documentElement.clientWidth+' / '+document.documentElement.clientHeight);
		}
