// Call jQuery in noConflict-Mode, so it doesn't conflict with other Libraries. Change the $-call to a $j-call.
var $j = jQuery.noConflict();
// Variables for the Navigation to show/hide the first and second level.
var activeClass = "active";
var hideTime = 375;
var hideTimer = 0;
var hoverClass = "hover";
var initialActiveClass = "initActive";
var showTime = 500;
var showTimer = 0;
// Functions for the Navigation to show/hide the first and second level.
function hideLevels(id) {
	unsetHover(id);
	setActive(id);
	stopHideTimer();
}
function unsetActive(id) {
	$j("#"+id).parent().parent().find("a."+activeClass+", ul."+activeClass).removeClass(activeClass).addClass(initialActiveClass);
}
function unsetHover(id) {
	$j("#"+id).parent().parent().find("a."+hoverClass+", ul."+hoverClass).removeClass(hoverClass);
}
function setActive(id) {
	$j("#"+id).parent().parent().find("a."+initialActiveClass+", ul."+initialActiveClass).removeClass(initialActiveClass).addClass(activeClass);
}
function setHover(id) {
	$j("#"+id).addClass(hoverClass);
	$j("#"+id).parent().children().addClass(hoverClass);
}
function showLevels(id) {
	hideLevels(id);
	unsetActive(id);
	setHover(id);
}
function startHideTimer(id) {
	hideTimer = setTimeout(function() {
		hideLevels(id);
	}, hideTime);
}
function startShowTimer(id) {
	showTimer = setTimeout(function() {
		showLevels(id);
	}, showTime);
}
function stopHideTimer() {
	clearTimeout(hideTimer);
}
function stopShowTimer() {
	clearTimeout(showTimer);
}
