var xint = new Array();
var pt = 0;
var highestLevel = null;
var currentItem = 0;
$(document).ready(function () { init_menu(); });
var init_menu = function () {
	$('.nav-item').hover(function () {
		if ($(this).find('>.nav-box').length > 0) {
			if ($.support.opacity == true) {
				$(this).find('>.nav-box').show();
				$(this).find('>.nav-box > li > a').css({opacity: 0});
				pt++;
				xint[pt] = setInterval(anim, 50, $(this).find('>.nav-box'), pt);
			} else {
				$(this).find('>.nav-box').fadeIn();
			}
			$(this).find('>a').addClass('nav-selected');
		}
	}, function () {
		if ($(this).find('>.nav-box').length > 0) {
			$(this).find('>a').removeClass('nav-selected');
			if (!$(this).find('>.nav-box').is(':hidden')) $(this).find('>.nav-box').fadeOut();
		}
	});
}
function anim(x, pts) {
	if (x.find('> li >a:last').css('opacity') != 0) {
		clearInterval(xint[pts]);
		return false;
	}
	x.find('>li>a').each(function () {
		if ($(this).css('opacity') == 0) {
			$(this).animate({opacity: 1}, { queue: false, duration: 300 });
			return false;
		}
	});
}
