// Navigation

var arrId = new Array();

function initMenus() {
	//$('ul.menu ul.collapsed').hide('slow');
	
	$.each($('ul.menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show('slow');
	});
	
	$('ul.menu li a').hoverIntent(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('slow');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('slow');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('slow');
				checkElement.slideDown('slow');
				return false;
			}
		}
		, function(){}
	);
	
}

//suche
	function lookup(query_string) {
		if(query_string.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("./suche/autocomplete.php", {queryString: ""+query_string+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup

	function fill(thisValue) {
		$('#query_string').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
		if(thisValue!='' && thisValue != 'Suchbegriff eingeben'){
			document.forms['form_suche'].submit();
		}
	}
