﻿/// <reference path="jquery/jquery.js" />

$(document).ready
(
	function() {
		var menuBarBehaviour;
		menuBarBehaviour = function() {
			var waitTime = 500;
			var hideMethod = function(panel) { panel.slideUp(); };
			var showMethod = function(panel) { panel.slideDown(); };

			$("a.more").hover
			(
				function() {
					var panel = $(this).next();
					$("a.more").next().hide();
					panel.timeout = setTimeout(function() { showMethod(panel); }, 0);
				}
				, function() {
					var panel = $(this).next();
					panel.timeout = setTimeout(function() { hideMethod(panel); }, waitTime);
					panel.hover
					(
						function() {
							clearTimeout(panel.timeout);
						}
						, function() {
							panel.timeout = setTimeout(function() { hideMethod(panel); }, waitTime);
						}
					);
				}
			);
		};

		menuBarBehaviour();
	}
);