
		/**
		 * @author poly 89490364a@gmail.com
		 */
		var searchPath = "";
		var sType = 0;
		function searchItem(){
			var s = encodeURI(encodeURI(document.getElementById("keyword").value));
			var url = searchPath + "_" + s;
			document.location.href = url;
		}
		function goNextPage(url){
			if (checkLogin2()) {
				document.location.href = url;
			}
		}
			$(function(){
				$("#nav li").each(function(){
					var that=$(this);
					var reg=new RegExp("^"+$("a",this).attr("href").replace(/(?=[.?*^$-\/])/g,"\\"));
					if(reg.test(location.pathname))
					{
						that.addClass("current");
						var s = location.href + "";
						if (s.split("/")[s.split("/").length-2] == "agency"){
							searchPath = contextPath + "/agency/search";
							sType = 1;
							document.getElementById("keyword").value = "搜索机构";
						} else if (s.split("/")[s.split("/").length-2] == "activity"){
							searchPath = contextPath + "/activity/search";
							sType = 2;
							document.getElementById("keyword").value = "搜索活动";
						} else if (s.split("/")[s.split("/").length-2] == "group"){
							searchPath = contextPath + "/group/search";
							sType = 3;
							document.getElementById("keyword").value = "搜索讨论组";
						} else if (s.split("/")[s.split("/").length-2] == "ranking" && s.split("/")[s.split("/").length-3] == "school") {
							searchPath = contextPath + "/school/ranking/search";
							sType = 6;
							document.getElementById("keyword").value = "搜索院校榜单";
						} else if (s.split("/")[s.split("/").length-2] == "ranking" && s.split("/")[s.split("/").length-3] == "agency") {
							searchPath = contextPath + "/agency/ranking/search";
							sType = 7;
							document.getElementById("keyword").value = "搜索机构榜单";
						} else if (s.split("/")[s.split("/").length-2] == "ranking"){
							searchPath = contextPath + "/ranking/search";
							sType = 4;
							document.getElementById("keyword").value = "搜索排名";
						} else {
							searchPath = contextPath + "/school/search";
							sType = 5;
							document.getElementById("keyword").value = "搜索院校";
						}
					}
				});
				
				var msg=$("#top_nav .msg").hover(function(){
					$("span",this).show();
					$(this).addClass("onshow");
				},function(){
					$("span",this).hide();
					$(this).removeClass("onshow");
				}).bind("refresh",update);
				var msg_p=$("p",msg).bind("update",update_p).bind("awake",awake).bind("sleep",sleep);
				var msg_em=$("em",msg).bind("update",update_em).parent().bind("awake",awake).bind("sleep",sleep);
				msg.data("render",$("p,em",msg));
				msgListener();
				
				function msgListener()
				{
					msg.trigger("refresh");
					setTimeout(msgListener,1000 * 60 * 30);
				}
				
				
				function update(e)
				{
					var that=$(this);
					$.ajax({
						url:contextPath + "/servlet/smsUpdate",
						success:function(data)
						{
							var event=new jQuery.Event("update");
							event.d=data;
							that.data("render").trigger(event);
						}
					});
					e.stopPropagation();
				}
				
				function update_p(e)
				{
					var that=$(this);
					var total=0;
					for(each in e.d)
					{total+=parseInt(e.d[each]);}
					if(total)
					{that.trigger("awake");}
					else
					{that.trigger("sleep");}
					e.stopPropagation();
				}
				
				function awake(e)
				{
					var that=$(this);
					if(!that.data("timer"))
					{
						that.data("timer",setInterval(function(){that.toggleClass("light")},400));
					}
					e.stopPropagation();
				}
				
				function sleep(e)
				{
					var that=$(this);
					if(that.data("timer"))
					{
						clearInterval(that.data("timer"));
						that.removeData("timer").removeClass("light");
					}
					e.stopPropagation();
				}
				
				function update_em(e)
				{
					var that=$(this);
					that.html(e.d[that.attr("className")]);
					if(parseInt(e.d[that.attr("className")]))
					{that.parent().trigger("awake");}
					else
					{that.parent().trigger("sleep");}
					e.stopPropagation();
				}
				
				var sub_menu=$("#sub_menu").bind("show",show).bind("hide",hide);
				function show()
				{	
					$(this).stop(true).animate({marginTop:0,opacity:1});
				}
				
				function hide()
				{
					$(this).stop(true).animate({marginTop:"-29px",opacity:0});
				}
				
				function conOn()
				{
					var that=$(this);
					if(that.html()!="")
					{
						sub_menu.trigger("show");
						$(this).addClass("current");
					}
					else
					{
						sub_menu.trigger("hide");
					}
				}
				function conInit(i)
				{
					var that=$(this);
					that.css({paddingLeft:that.data("i")*4+"em"});
				}
				
				$("#navbar").tab168({tBtn:"#nav li",tCon:"#sub_menu dd",method:"mouseover",conOn:conOn,conInit:conInit,reset:true})
			});

