
(function($) {

	$.fn.dynamItDrop = function() {

		return this.each(function() {

			$(this).children('li').children('ul.dd').addClass('opened');

			var to;
			var $shutDown = null;
			$(this).children('li').children('a').mouseover(function() {

				clearTimeout(to);
				$('ul.opened').hide().siblings('a').removeClass('over');

				$(this).addClass('over');
				$shutDown = $(this).siblings('ul.dd').show();
			}).mouseout(function() {
				$shutDown = $(this).siblings('ul.dd');
				to = setTimeout(function() {
					closeme($shutDown);
				}, 1000);
			});

			$('ul.opened').mouseover(function() {
				clearTimeout(to);
			}).mouseout(function() {
				$shutDown = $(this);
				to = setTimeout(function() {
					closeme($shutDown);
				}, 1000);
			});

		});

	};

	function closeme(o) {
		o.hide();
		o.siblings('a').removeClass('over');
	}

})(jQuery);