function printFlash(src, movie, width, height, version, quality, menu, bgcolor, flashvars)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+",0,0,0' width='" +width+ "' height='" +height+ "' id='" +movie+ "'>");
	document.write("<param name='movie' value='" +src+ "' />");
	document.write("<param name='FlashVars' value='" +flashvars+ "'>");
	document.write("<param name='quality' value='" +quality+ "' />");
	document.write("<param name='menu' value='" +menu+ "' />");
	document.write("<param name='bgcolor' value='" +bgcolor+ "' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='" +src+ "' swLiveConnect='true' menu='" +menu+ "' FlashVars='" +flashvars+ "' quality='" +quality+ "' bgcolor='" +bgcolor+ "' width='" +width+ "' height='" +height+ "' name='" +movie+ "' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />");
	document.write("</object>");
}

function setFontSize(pxNum) {
	var bodyStyle = document.getElementsByTagName("body")[0].style;
	bodyStyle.fontSize = pxNum + "px";
	
	
	var d = new Date();
	var expire = d.getTime() + (365 * 24 * 60 * 60 * 1000);
	d.setTime(expire);
	document.cookie = "GuWFontSize=" + pxNum + "; expires=" + d.toGMTString();
}

function calcFontSize(up) {
	var bodyStyle = document.getElementsByTagName("body")[0].style;
	var fontSize = bodyStyle.fontSize ? parseInt(bodyStyle.fontSize) : 11;
	fontSize += up ? 1 : -1;
	fontSize = Math.min(20, Math.max(fontSize, 9));
	return fontSize;
}

function increaseFontSize() {
	setFontSize(calcFontSize(true));
}

function decreaseFontSize() {
	setFontSize(calcFontSize(false));
}

function dedon() {
	var breite = 1000;
	var hoehe = 700;
	var language = 'de' // possible values de,en
	var jump = "micro";
	var seite = (screen.availWidth - breite) / 2;
	var oben = (screen.availHeight - hoehe) / 2;
	var sStatus = "resizable=no,scrollbars=no,location=no,menubar=no,status=no,width=" + breite + ",height=" + hoehe + ",left=" + seite + ",top=" + oben;
	window.open("http://www.dedon.de/main.php?myLan=" + language + "&directJump=" + jump, "dedon", sStatus);
}

function openThumbnails(id) {
	for (var i = 0; i < gallerys.length; i++) {
		if (gallerys[i] == id && !$(gallerys[i]).visible()) {
			Effect.BlindDown(id);
		}
		else if ($(gallerys[i]).visible()) {
			Effect.BlindUp(gallerys[i]);
		}
	}
}

var maxLeft = 0;
var direction = 0;
var scrollElement;
var to = 0;
var speed = 2;

function slideLeft(btn) {
	scrollElement = btn.up("div").down(".thumbs-container");
	var w = scrollElement.scrollWidth;
	if (navigator.userAgent.indexOf("Firefox") != -1) {
		w = 0;
		var imgs = scrollElement.getElementsByTagName("img");
		for (var i = 0; i < imgs.length; i++) {
			w += imgs[i].width;
		}
	}
	maxLeft = (w - btn.up("div").getWidth()) * -1;
	direction = -1;
	slide();
}

function slideRight(btn) {
	scrollElement = btn.up("div").down(".thumbs-container");
	direction = 1;
	slide();
}

function slide() {
	clearTimeout(to);
	var l = scrollElement.style.left.replace("px", "");
	if (!l) l = 0;
	var x = parseInt(l) + direction * speed;
	x = Math.max(maxLeft, Math.min(x, 0));
	scrollElement.style.left = x + "px";
	to = setTimeout("slide()", 20);
}

function stopSlide() {
	clearTimeout(to);
}

function initGallery() {
	for (var i = 0; i < gallerys.length; i++) {
		$(gallerys[i]).hide();
	}
	$$(".shift-left").each(function(btn) {
		btn.hover(
			function() {
				slideRight(btn);
			},
			function() {
				stopSlide();
			}
		);
	}); 
	$$(".shift-right").each(function(btn) {
		btn.hover(
			function() {
				slideLeft(btn);
			},
			function() {
				stopSlide();
			}
		);
	}); 
}
