/* IE6 flicker fix
-------------------------------------------------- */
try { document.execCommand("BackgroundImageCache", false, true); } catch(err){}

var menutimer01;

$(document).ready(function(){
	$('BODY').append('<div id="menu02"><ul class="clear"></ul></div>');
	$('#menu01 > LI.hasdrop > DIV > A').mouseover(function(){
		window.clearTimeout(menutimer01);
		$t = $(this);
		if($t.hasClass('open')){ hideMenu2(); return false; }
		$m1 = $('#menu01');
		$m2 = $('#menu02');
		$m1.find('A.open').removeClass('open');
		$m2
			.css({
				left: $t.offset().left + 'px',
				top: $t.offset().top + $t.outerHeight() + 'px'
			})
			.hover(function(){
				window.clearTimeout(menutimer01);
			},function(){
				window.clearTimeout(menutimer01);
				menutimer01 = window.setTimeout(hideMenu2,500);
			})
			.find('UL').html($t.parents('LI.hasdrop').eq(0).find('UL').html())
		;
		$t.addClass('open');
		//$(document).bind('mousedown.menu',hideMenu2);
		$m1.find('LI.hasdrop > DIV > A').hover(function(){
			window.clearTimeout(menutimer01);
			$t = $(this);
			$('#menu01 A.open').removeClass('open');
			$t.addClass('open');
			$('#menu02').css({
				left: $t.offset().left + 'px',
				top: $t.offset().top + $t.outerHeight() + 'px'
			}).find('UL').html($t.parents('LI.hasdrop').eq(0).find('UL').html());
		},function(){
			window.clearTimeout(menutimer01);
			menutimer01 = window.setTimeout(hideMenu2,500);
		});
		return false;
	});
});

function hideMenu2(){
	window.clearTimeout(menutimer01);
	$(this).removeClass('open');
	$(document).unbind('mousedown.menu');
	$('#menu01').find('A.open').removeClass('open');
	$('#menu01 > LI.hasdrop > DIV > A').unbind('mouseenter mouseleave');
	$('#menu02').css({
		left: '-500px',
		top: '-500px'
	}).find('UL').empty();
}