/**
 * 菜单鼠标的滑过事件
 * 显示下级菜单及当前的高亮
 */

jQuery(function() {

	var currentAObj = jQuery("div#nav ul.level_1").find("li.active").not(jQuery("div#nav ul.level_2").find("li.active"));
	
	jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).each(function() {
	
		jQuery(this).hover(
			function() {
				jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(jQuery(this)).removeClass('active');
				jQuery(this).addClass('active');
				
				jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(jQuery(this)).find("ul.level_2").hide();
				jQuery(this).find("ul.level_2").show();
			},
			function(event) {
				if ($.browser.msie)
				{
					if (jQuery(event.target).parent().parent().attr('id') != 'nav' && jQuery(event.target).parent().parent().parent().attr('id') != 'nav')
					{
						setTimeOutId = window.setTimeout(function() {
							jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
							currentAObj.addClass('active');
							
							jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
							currentAObj.find("ul.level_2").show();
						}, 400);
						
						jQuery(this).find("ul.level_2").hover(
							function() {
								JT_HideLatter();
							},
							function() {
								jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
								currentAObj.addClass('active');
								
								jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
								currentAObj.find("ul.level_2").show();
							}
						);
					}
					else
					{
						jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
						currentAObj.addClass('active');
						
						jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
						currentAObj.find("ul.level_2").show();
					}
				}
				else
				{
					if (jQuery(event.target).parent().parent().parent().attr('id') != 'nav' && jQuery(event.target).parent().parent().parent().parent().attr('id') != 'nav')
					{
						setTimeOutId = window.setTimeout(function() {
							jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
							currentAObj.addClass('active');
							
							jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
							currentAObj.find("ul.level_2").show();
						}, 400);
						
						jQuery(this).find("ul.level_2").hover(
							function() {
								JT_HideLatter();
							},
							function() {
								jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
								currentAObj.addClass('active');
								
								jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
								currentAObj.find("ul.level_2").show();
							}
						);
					}
					else
					{
						jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).removeClass('active');
						currentAObj.addClass('active');
						
						jQuery("div#nav ul.level_1").find("li").not(jQuery("div#nav ul.level_2").find("li")).not(currentAObj).find("ul.level_2").hide();
						currentAObj.find("ul.level_2").show();
					}
				}
			}
		);
		
	});
});