/*
Copyright 2009 by Christian Arth:
http://www.christianarth.de
Free for non-commercial use
*/

function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
        $('#' + this.id + ' .expandfirst').next().show();
	});
	$('ul.menu li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('expandfirst')) {
				$(this).next().show('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	);
}
$(document).ready(function() {
		$("#flash > img").hide();
		$("#flash > img").fadeIn("slow");
   $('.menue div').hide();
   if($('.menue div.expandfirst a.active').hasClass('active')) {
        $('.menue div.expandfirst').show();
   }else{
        $('.menue div.expandfirst').slideDown('normal');
    }
});
