$(document).ready(function() {
	/* nav1stLevel Hover (nur bei zentraler Seite) */
	$("body.zentrale #nav1stLevel li:eq(1)").addClass("colour01");
	$("body.zentrale #nav1stLevel li:eq(2)").addClass("colour02");
	$("body.zentrale #nav1stLevel li:eq(3)").addClass("colour03");
	$("body.zentrale #nav1stLevel li:eq(4)").addClass("colour04");
	$("body.zentrale #nav1stLevel li:eq(5)").addClass("colour05");
	$("body.zentrale #nav1stLevel li:eq(6)").addClass("colour06");
	$("body.zentrale #nav1stLevel li:eq(7)").addClass("colour07");			
	/* Intranet-Login */
	$("#intranetLogin form").css("display","none");	
	$("#intranetLogin").css("margin-bottom","0px");	
	$("#intranetLogin").addClass("jsEnabled");
	$("#intranetLoginLink").click(function () {
		$('#quickloginform').slideToggle(100);
		return false;
	});
	$("#intranetLogoutLink").click(function () {
		$('#quickloginform').slideToggle(100);
		return false;
	});
	/* Tooltips */
	$("a.tooltip").tooltip({ 
		delay: 600, 
		positionLeft: true, 
		showURL: false,
		track: false,
		top: 18
	});
	/* Footer */
	$("#footer").css("bottom","21px"); /* Bugfix fuer IE6 */
	$(".footerCategoryLink").click(function () {
		$(this).parent().siblings().find("ul").hide();
		$(this).parent().siblings().find("a").removeClass("expanded");
		$(this).toggleClass("expanded");
		$(this).next().slideToggle(100);
		return false;
	});
	/* DGS-Video */
	$("#dgsVideoLink").css("display","block");
	$("#dgsVideoContainer").css("display","none");
	$(".videoLink").click(function () {
    	$(".videoLink").toggle();
		return false;
	});	
	$("#dgsVideoShow").click(function () {
  		$("#dgsVideoContainer").slideDown(300);
  		$("#dgsVideoContainer").queue(function () {
			$("#dgsVideoContainer object").fadeIn("def");
			$("#footer").css("position","absolute");
    		$(this).dequeue();
  		});
		return false;
	});
	$("#dgsVideoHide").click(function () {
  		$("#dgsVideoContainer object").fadeOut("def");
  		$("#dgsVideoContainer object").queue(function () {
			$("#dgsVideoContainer").slideUp(300);
    		$(this).dequeue();
  		});      		
		return false;
	});
});
/* Unobtrusive script for smooth scrolling */
$(document).ready(function() {
	function filterPath(string) {
		return string
		.replace(/^\//,'')
		.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
		.replace(/\/$/,'');
	}
	var locationPath = filterPath(location.pathname);
	$('a[href*=#]').each(function() {
		var thisPath = filterPath(this.pathname) || locationPath;
		if (  locationPath == thisPath
		&& (location.hostname == this.hostname || !this.hostname)
		&& this.hash.replace(/#/,'') ) {
			var $target = $(this.hash), target = this.hash;
			if (target) {
				var targetOffset = $target.offset().top;
				$(this).click(function(event) {
					event.preventDefault();
					$('html, body').animate({scrollTop: targetOffset}, 600, function() {
						location.hash = target;
					});
				});
			}
		}
	});
});