jQuery(document).ready(function($){
	$('.nav li.cat').mouseenter(function(){$(this).siblings().andSelf().removeClass('prev')});
	$('.nav li.cat:has(ul)').hover(function(){$(this).prev().addClass('prev');}, function(){if(!$(this).hasClass('hover') && !$(this).hasClass('active')){$(this).prev().removeClass('prev');}});
	$('.nav ul').each(function(i){
		var c = $(this).children('li'), l = c.size(), ov = function(){$(this).parent('li').addClass('hover');}, ou = function(){$(this).siblings().removeClass('hover').prev().remove('prev')};
		//if (5 < l) $(this).after($('<ul class="skew left" />').css('left', /Mac/.test(navigator.platform)?-46:-54).append(c.slice(Math.ceil(l/2)))).removeClass('abs-pos').addClass('skew');
		$(this).parent('li').find('ul').mouseenter(ov).parent('li').siblings().mouseenter(ou);
	});
});
