$(function(){
	if($("#navuinfo").size() > 0){
		$("#navuinfo .inp_text, #navuinfo .inp_sm").hover(function(){$(this).addClass("inp_text_active")},function(){$(this).removeClass("inp_text_active")}) 
	}
	
		
	$("#showswitch").hover(
		function(){$(this).addClass("nav_switch_active")},function(){$(this).removeClass("nav_switch_active");}
	)

	$("#quickmenu").hover(function(){$(this).addClass("nav_quicklick_active")},function(){$(this).removeClass("nav_quicklick_active")})

	$("#forumnav dt a").focus(function(){$(this).blur();})

	if($("#forumnav").size() > 0){$("#showitemnav").navgation({obj:"forumnav"})}


	$("#searchform input").removeAttr("checked").eq(1).attr("checked","checked");

	$("#searchform .inp_radio input").click(function(){
		$("#searchform .inp_radio").removeClass("inp_radio_active");
		$(this).parent().addClass("inp_radio_active")
	}).focus(function(){$(this).blur();});

	$("#announce .announce_closed").click(function(){
		$("#announce").animate({marginTop:"-30px"},800)
	})

	$("#headernav").hover(function(){
		var navTmp = $(this).find("#nav_tips");
		navTmp.find("div").css("width",navTmp.width()).end().show()
	},function(){$(this).find("#nav_tips").fadeOut()})

	$("body").click(function(){$("#forumnav dl").removeClass("active");})

	$("#closeNavgation").click(function(){$("#galaskin").attr("disabled","disabled");$(this).hide();})

	$("#show_navmsg").hover(function(){
		var msglist = $("#show_navmsg .nav_msglist");
		var diff = $(window).width() - $(this).offset().left;
		var width = msglist.outerWidth();
		if(diff < width){
			msglist.addClass("nav_msglist_right");
		}
		$(this).addClass("nav_msg_active");
	},function(){
		$(this).removeClass("nav_msg_active");
		$(this).find(".nav_msglist").removeClass("nav_msglist_right");
	})

	$("#version_showam, #version_showpm").click(function(){
		var className = $(this).attr("rel");
		$("#pub_main").attr("class","pub_main " + className);
		return false;
	})

	$("#gossip_tab a").click(function(){
		var str = $(this).attr("rel");
		$("#threadadd_gossip").attr("class","threadadd_main " + str);
		$("#gossip_tab span").removeClass("threadadd_active");
		$(this).parent().addClass("threadadd_active");
		return false;
	}).focus(function(){$(this).blur();})

	$("#show_tab a").click(function(){
		var str = $(this).attr("rel");
		$("#threadadd_show").attr("class","show_version " + str);
		$("#show_tab span").removeClass("threadadd_active");
		$(this).parent().addClass("threadadd_active");
		return false;
	}).focus(function(){$(this).blur();})

	//10楼层导航
	$("#nav_floor").find("h1").mouseover(function(){
		var i = parseInt($(this).attr("rel"));
		if(i == 2){$("#nav_floor dl").removeClass("sub_forum_select");$(this).attr("rel",0)}else{$(this).attr("rel", i+1);}
	}).end().find("dl").mouseover(function(){
		$("#nav_floor dl").removeClass("sub_forum_select");
		$(this).addClass("sub_forum_select");
	})
});

(function($){
	$.fn.navgation = function(options){
		var $this = $(this);
		var $obj = $("#"+ options.obj);
		var tmpHeight = ($obj.height() * (-1));
		var timeout = pause = "";
		if($obj.is(".nav_forum_club")){
			$this.hover(function(){
				if($obj.css("top") < 0 && $obj.css("top") > tmpHeight){return false;}
				$obj.animate({top:"0px"},80,function(){
					clearTimeout(timeout);
					$obj.hover(
						function(){
							pause = true;
							$(this).show()
						},
						function(){
							timeout = setTimeout(
								function(){
									pause = false;
									$obj.animate({top:tmpHeight + "px"},120)
								},200)
						}
					)
				})
			},function(){
				timeout = setTimeout(
					function(){
						if(pause != true){
							$obj.animate({top:tmpHeight + "px"},120)
						}
					},300)
			}).find("a").click(function(){return false;});
		}
	}
})(jQuery);


