// jQuery Document Ready Funktion
$(document).ready(function() {

	// fontResize
	var $container = $("#contentContainer");
	var defaultSize = $container.css("fontSize");
	if ($.cookie("fontSize")) {
		$container.css("fontSize", $.cookie("fontSize") + "px");
	}
	var $sub_header = $("div#headerRight");
	var ul_fontResize = $('<ul id="fontResize"><li id="fontResize_label" class="textReplace">Schriftgröße ändern:</li><li><a href="#" title="Schrift vergrößern" id="switcher_large" class="textReplace">Schrift vergrößern</a></li><li><a href="#" title="Schrift zurücksetzen" id="switcher_default" class="textReplace">Schrift zurücksetzen</a></li><li><a href="#" title="Schrift verkleinern" id="switcher_small" class="textReplace">Schrift verkleinern</a></li></ul>');
	$sub_header.append(ul_fontResize);
	$("#fontResize a").click(function() {
		var num = parseFloat($container.css("fontSize"), 10);
		switch (this.id) {
			case "switcher_large":
			num *= 1.1;
			break;
			case "switcher_small":
			num /= 1.1;
			break;
			default:
			num = parseFloat(defaultSize, 10);
		}

		if (num < 16 && num > 8) {
			$container.css("fontSize", num + "px");
		}
		$.cookie("fontSize", null);
		$.cookie("fontSize", num, { path: "/", expires: 7 });
		return false;
	});	

	// Animiertes Scrollen
	//$('.top').click(function(){
	//	$('html, body').animate({scrollTop:0}, 'fast');
	//	return false;
	//});
	
	$('a.back-link').show();
	

});


//Mootools Menu

window.addEvent("domready", function() {

	$$("#mainNav a").each(function(el, i) {
		el.set("morph", {
			transition: "elastic:out",
			duration: 2000
		});
		var width = el.getSize().x;
		el.addEvents({
			"mouseenter": function() {
				this.morph({
					width: width + 50,
					"font-size": 22
				});
			},
			"mouseleave": function() {
				this.morph({
					width: width - 30,
					"font-size": 14
				});
			},
			
			"focus": function() {
				this.morph({
					width: width + 50,
					"font-size": 22
				});
			},
			"blur": function() {
				this.morph({
					width: width - 30,
					"font-size": 14
				});
			}
		});
	});
	
});

