jQuery.noConflict();

jQuery(document).ready(function($){

var over_flyout = false;
var over_button = false;
var current_item_index;
var hover_time = 50;

// button hover								
	$('.subcat_list li').hover(
		function() {
			over_button = true;
			$('.list').hide();
			$(this).children('a').css('margin-left', '14px');
			current_item_index = $(this).prevAll().length;
			window.setTimeout(
				function() {
					$('#functions').css('top', current_item_index * 44 + 159 + 'px');
					$('#functions > div:eq(' + current_item_index + ')').add('#functions').show();
				},
				hover_time
			);
		},
		function() {
			over_button = false;
			$(this).children('a').css('margin-left', '0');
			window.setTimeout(
				function() {
					if (!over_flyout) {
						$('#functions > div').add('#functions').hide();
					}
				},
				hover_time
			);
		}
	);

// flyout hover
	$('#functions').hover(
		function() {
			over_flyout = true;
			$('.subcat_list li:eq(' + current_item_index + ') a').css('margin-left', '14px');
		},
		function() {
			over_flyout = false;
			$('.subcat_list li:eq(' + current_item_index + ') a').css('margin-left', '0');
			window.setTimeout(
				function() {
					if (!over_button) {
						$('#functions').hide();
					}
				},
				hover_time
			);
		}
	);

});

