	pathroot = "/";
	var onlinediv = "";
	
	
	function showonlinetop(forumid)
	{
		if($("#onlineusertop").css("display") == "none")
		{
			if(onlinediv == "")
			{
				loadonlinetop(forumid);
			}
			$("#onlineusertop .wrap").html(onlinediv);
			$("#onlineusertop").show();
			$("#showonlineusertop").attr("title","点击此处关闭在线列表");
			$("#showonlineusertop").addClass("closeonlineuser");
			
		}
		else
		{
			$("#onlineusertop").hide();
			$("#showonlineusertop").attr("title","点击此处显示在线列表");
			$("#showonlineusertop").removeClass("closeonlineuser");
		}
	}
	function loadonlinetop(forumid)
	{
		
		
			
			$.ajax  
			({
				type: "get",
				url: pathroot+"normalxml.php",
				data:"act=onlineuser&forumid="+forumid+"&rand="+randStr(),
				timeout: ajaxtimeout,
				async:true,
				beforeSend:function()
				{
					
				},
				success: function(xml)
				{
					var status = parseInt($(xml).find('status').text());
					var affnum = parseInt($(xml).find('affnum').text());
					if(status == 1)
					{
						onlinediv = $(xml).find('content').text();
						$("#onlineuser .wrap").html(onlinediv);
						$("#onlineuser").show();
						$("#onlinetopnum").html("在线学员："+affnum);
						
					}
				},
				errot: function(){}
			})
		
	}
	
	$("#newtopic").click(function()
	{
		var postmode = "createtopic";
		//alert(forumid);
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发贴','"+postmode+"',0)",false); 
		//plvXml('canPost',forumid,this.href,"showDiv(\"logindiv\",\"floatBox\",'登录',false)");
		return false;
	})
	
	
	
	$(".newpostbtnbtm a[@id=newtopicbtm]").click(function()
	{
		var postmode = "createtopic";
		//alert(forumid);
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发贴','"+postmode+"',0)",false); 
		//plvXml('canPost',forumid,this.href,"showDiv(\"logindiv\",\"floatBox\",'登录',false)");
		return false;
	})
	
	$("#newtopic2").click(function()
	{
		var postmode = "createtopic";
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发贴','"+postmode+"',0)",false); 
		return false;
	})
	
	$(".newtaskbtn #newtask").click(function()
	{
		var postmode = "createtask";
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发贴','"+postmode+"',0)",false); 
		return false;
	})
	
	$(".newpostbtnbtm a[@id=newtask]").click(function()
	{
		var postmode = "createtask";
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发贴','"+postmode+"',0)",false); 
		return false;
	})
	
	//上部在线列表
	
	
	
	
	//贴子列表排序
	
	$("#makeorder").click(function()
	{
		if($("#orderby").val() != "" && $("#ordertype").val() != "")
			window.location = $("#orderby").val()+"-"+$("#ordertype").val();
	})
	
	
	$("#makeordernew").mouseover(function()
	{
	
		$(".refresh").addClass("orderbylistpover")
	})
	$("#makeordernew").mouseout(function()
	{
		$(".refresh").removeClass("orderbylistpover")
	})
	
	$("#makeordernew").click(function()
	{
		/* 
		if($("#orderby").val() == "" && $("#ordertype").val() == "" && $("#topictype").val() == "")
			window.location.reload();
		else
		{
			var topictype = "";
			var ordertype = 'desc';
			var orderby = "addtime";
			var topicstats = "";
			
			if($("#topictype").val() != "")
				topictype = $("#topictype").val();
			
			if($("#ordertype").val() != "")
				ordertype = $("#ordertype").val();
			
			if($("#orderbypost").val() != "")
				orderby = $("#orderbypost").val();
			
			if($("#digest").val() != "")
				topicstats = $("#digest").val();
			
			var baseurl = $("#baseurl").val();
			
			orderf = "orderby-topictype,"+topictype+","+orderby+","+ordertype+","+topicstats;
			
			window.location = baseurl+orderf;
			
		}
		*/
		var baseurl = $("#baseurl").val();
		window.location = baseurl;
		
	})
	
	if(typeof topictypeoptions != 'undefined')
	{
		
		divList('topictypelist',topictypeoptions,'topictype');
	}
	
	if(typeof orderbyoptions != 'undefined')
	{
		divList('orderbylist',orderbyoptions,'orderbypost');
		
	}
	if(typeof ordertypeoptions != 'undefined')
	{
		
		divList('ordertypelist',ordertypeoptions,'ordertype');
		
	}
	
	if(typeof searchtypeoptions != 'undefined')
	{
		
		divList('searchtypelist',searchtypeoptions,'searchtype');
	}
	
	
	
	
	$("#jumplistbtn").click(function()
	{
		$("#"+optdivname).hide();
		$("#newforumnavigator").show();
		optdivname = "newforumnavigator";
 		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);
	})
	$("#newforumnavigator").mouseover(function()
	{
		onoptlist = 1;	
	})
	$("#newforumnavigator").mouseout(function()
	{
		onoptlist = 0;	
		
		
	})
	
	/* 
	$("#jumplistbtnbtm").click(function()
	{
		
		$("#"+optdivname).hide();
		$("#newforumnavigatorbtm").show();
		optdivname = "newforumnavigatorbtm";
 		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);
		checkForumNav();	
		
	})
	*/
	
	$("#gobackbtnbtm").mouseover(function()
	{
		$("#"+optdivname).hide();
		$(".goback").css("position","relative");
		$("#bottombutons").css("position","static");
		$("#returnlistbtm").show();
		optdivname = "returnlistbtm";
 		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);
		onoptlist = 1;	
		$("#gobackbtnbtm").addClass("mouseover");
		
	})
	$("#gobackbtnbtm").mouseout(function()
	{
		onoptlist = 0;
		$("#gobackbtnbtm").removeClass("mouseover");
		
	})
	$("#returnlistbtm").mouseover(function()
	{
		onoptlist = 1;	
	})
	$("#returnlistbtm").mouseout(function()
	{
		onoptlist = 0;	
		
		
	})
	
	
	
	function showJumplistbtm()
	{
		
		$("#"+optdivname).hide();
		$("#newforumnavigatorbtm").show();
		optdivname = "newforumnavigatorbtm";
 		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);
		checkForumNav();	
		
		
	}
	
	$("#newforumnavigatorbtm").mouseover(function()
	{
		onoptlist = 1;	
		
	})
	$("#newforumnavigatorbtm").mouseout(function()
	{
		onoptlist = 0;
		
	})
	
	
	function showJumplist()
	{
		
		
		$("#"+optdivname).hide();
		$("#newforumnavigator").show();
		optdivname = "newforumnavigator";
 		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);
		
	}
	
	function showJumplist_sl()
	{
		if ($("#newforumnavigator_sl").css('display') == 'block') {
			$("#newforumnavigator_sl").hide();	
		} else {
			$("#"+optdivname).hide();
			$("#newforumnavigator_sl").show();
			optdivname = "newforumnavigator_sl";
	 		clearInterval(hideintval);
	 		onoptlist = 0;	
			hideintval = setInterval("hideadminopt()",3000);
		}
	}
	
	
	$("#newforumnavigator").mouseover(function()
	{
		onoptlist = 1;	
		
	})
	$("#newforumnavigator").mouseout(function()
	{
		onoptlist = 0;
		
	})
	
	
		
	//翻页
	
	$(".pagenavigator input[@id=gotopage]").focus(function()
	{
		
		if($(this).val() == "转至")
		{
			$(this).val("");
			$(this).addClass("oninput");
		}
	})
	$(".pagenavigator input[@id=gotopage]").blur(function()
	{
		
		if($(this).val() == "")
		{
			$(this).val("转至");
			$(this).removeClass("oninput");
		}
	})
	$(".pagenavigator input[@id=gotopage]").keyup(function()
	{
		$("input[@id=gotopage]").val($(this).val());
		topage = $("#gotopage").val();
		$("input[@id=gotopage]").val(topage.replace(/[^\d]/g,''));
		
	})
	
	
	$(".pagenavigator input[@id=gotopage]").keydown(function(e)
	{
		
		if(e.keyCode == 13)
		{
			
			var topage = parseInt($("#gotopage").val());
			var golink = $(this).attr("class");
			var pernum = $("#gotopage").attr("maxlength");
			
			if(topage<=parseInt(this.name))
			{
				
				topage = topage - 1;
				if(topage>0)
					golink = golink.replace("OFFSETVALUE",topage*pernum);
				else
				{
					golink = golink.replace("offset-OFFSETVALUE/","");
					golink = golink.replace("-OFFSETVALUE","");
				}
				
				
				golink = golink.replace("oninput","");
				window.location = golink;
			}
			else
			{
				showDiv("dialogdiv","dialogBox","错误的页码","请输入正确的页码。");
			}
		}
		
		
	})
	
	
	$(".goto a[@name=gotobtn]").click(function()
	{
			
			var topage = parseInt($("#gotopage").val());
			var golink = $("#gotopage").attr("class");
			var pernum = $("#gotopage").attr("maxlength");
			if(topage<=parseInt($("#gotopage").attr('name')))
			{
				topage = topage - 1;
				
				if(topage>0)
					golink = golink.replace("OFFSETVALUE",topage*pernum);
				else
				{
					golink = golink.replace("offset-OFFSETVALUE/","");
					golink = golink.replace("-OFFSETVALUE","");
				}
				golink = golink.replace("oninput","");
				window.location = golink;
			}
			else
			{
				showDiv("dialogdiv","dialogBox","错误的页码","请输入正确的页码。");
			}
			return false;
	})
	
	//论坛在线列表
	$("#showonlineuser").click(function()
	{
		if($("#onlinelist").css("display")=='none')
		{
			var thetop = $(this).offset().top-40;
	 		var theleft = $(this).offset().left;
	 		thetop+="px";
	 		theleft+="px";
 		//$("#onlinelist").css({left:theleft});
 			$("#onlinelist").show();
 			$("#showonlineuser").html("隐藏在线列表");
 		}
 		else
 		{	
 			$("#onlinelist").hide();
 			$("#showonlineuser").html("查看在线列表");
 		}
 		return false;
	})
	
	
	
	//贴子列表页鼠标滑动效果
	
	/* $("#topiclist tr").mouseover(function()
	{
		
		$(this).addClass('tdover');
	})
	$("#topiclist tr").mouseout(function()
	{
		$(this).removeClass('tdover');
	})
	
	*/
	// 发贴下拉菜单
	
	$(".newpostbtnbtm a[@id=newtopicbtm]").mouseover(function()
	{
		$("#"+optdivname).hide();
		
		
		
		optdivname = 'newtopicbutlist'+this.name;
		
		$("#"+optdivname).show();
		
		
	})
	$(".newpostbtnbtm a[@id=newtopicbtm]").mouseout(function()
	{
		onoptlist = 0;
		clearInterval(hideintval);
		hideintval = setInterval("hideadminopt()",1000);

	})
	$("#newtopicbutlist1").mouseover(function()
	{
		onoptlist = 1;
	})
	$("#newtopicbutlist1").mouseout(function()
	{
		onoptlist = 0;
	})
	$("#newtopicbutlist2").mouseover(function()
	{
		onoptlist = 1;
	})
	$("#newtopicbutlist2").mouseout(function()
	{
		onoptlist = 0;
	})
	//管理
	if(!isguest)
	{
		
		$(".adminpanl").show();
		$("#moreoprate").show();
		$("#moredelbtn").click(function()
		{
			showMoreDel("moredel",'删除主题');
		})
		
		$("#movetopicbtn").click(function()
		{
			showMove("movetopic",'移动主题');
			
		})
		$("#admineditprofile").click(function()
		{
			var theuid = this.name;
			showAdminEditprofile(theuid);
		})
			
		$("#showpostbykeyword").click(function()
			
		{
			var keyword = $("#postkeyword").val();
			
			
			
			if(keyword != this.title)
			{
				$(this).attr("disabled",true);
				$(this).val("等待");
				$("#showtopicbyuid").attr("disabled",true);
				$("#showallpostbyuid").attr("disabled",true);
				showPostBy("keyword",keyword,offset);
			}
			return false;
		})
		
		onlynumber("uidkeyword");
		onlynumber("postuidkeyword");
		
		$("#showbykeyword").click(function()
		{
			
			
			var keywordtype = $("#keywordtype").val();
			
			
			
			if(keywordtype == 'uidkeyword')
			{
				var theuid = $("#managekeyword").val();
				if(theuid != "")
				{
					showTopicbyUid(theuid);
				}
				
			}
			
			if(keywordtype == 'postuidkeyword')
			{
				var theuid = $("#managekeyword").val();
				
				showPostBy('alluid',theuid);
				
			}
			
			return "";
		
		})
		
		$("#showtopicbyuid").click(function()
		{
			
			
			var theuid = $("#uidkeyword").val();
			if(theuid != this.title)
			{
				$(this).attr("disabled",true);
				$(this).val("等待");
				$("#showallpostbyuid").attr("disabled",true);
				$("#showpostbykeyword").attr("disabled",true);
				if(theuid != "")
				{
					showTopicbyUid(theuid);
					
				}
			}
			return false;
		})
		$("#showallpostbyuid").click(function()
		{
			
			var theuid = $("#postuidkeyword").val();
			if(theuid != this.title)
			{
				$(this).attr("disabled",true);
				$(this).val("等待");
				$("#showtopicbyuid").attr("disabled",true);
				$("#showpostbykeyword").attr("disabled",true);
				if(theuid != "")
				{
					showPostBy('alluid',theuid);
				}
			}
			return false;
		})
		
		$("#shownewtopic").click(function()
		{
			
			var theuid = 0;
			$(this).attr("disabled",true);
			$("#showtopicbyuid").attr("disabled",true);
			$("#showpostbykeyword").attr("disabled",true);
			$("#showallpostbyuid").attr("disabled",true);
			showTopicbyUid(theuid);
			return false;
		})
		
		$("#shownewpost").click(function()
			
		{
			
			
			$(this).attr("disabled",true);
			$(this).val("等待");
			$("#showtopicbyuid").attr("disabled",true);
			$("#showallpostbyuid").attr("disabled",true);
			$("#shownewtopic").attr("disabled",true);
			showPostBy("new",0,0);
			
			return false;
		})
	}
	
	//
	$("#author-expand").click(function()
	{
		$(".author").hide();
		$(".author1").show();	
		$.cookie('author', 'author1', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#author-collapse").click(function()
	{
		$(".author").show();
		$(".author1").hide();
		$.cookie('author', 'author', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });//315360000		
	})
	
 	$("#hits-expand").click(function()
	{
		$(".hits").hide();
		$(".hits1").show();	
		$.cookie('hits', 'hits1', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#hits-collapse").click(function()
	{
		$(".hits").show();
		$(".hits1").hide();	
		$.cookie('hits', 'hits', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#lastauthor-expand").click(function()
	{
		$(".lastauthor").hide();
		$(".lastauthor1").show();
		$.cookie('lastauthor', 'lastauthor1', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#lastauthor-collapse").click(function()
	{
		$(".lastauthor").show();
		$(".lastauthor1").hide();
		$.cookie('lastauthor', 'lastauthor', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#lastpost-expand").click(function()
	{
		$(".lastpost").hide();
		$(".lastpost1").show();	
		$.cookie('lastpost', 'lastpost1', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
	$("#lastpost-collapse").click(function()
	{
		$(".lastpost").show();
		$(".lastpost1").hide();
		$.cookie('lastpost', 'lastpost', {expires: 365, path: '/', domain: '.chinaacc.com', secure: false });
	})
	
$('#jumplistbtn_sl').bind('mouseenter', function() {
	$('#newforumnavigator_s2').hide();
	$('#newforumnavigator_s3').hide();
	$('#newforumnavigator_s4').hide();
	$('#newforumnavigator_sl').show();	
	$('#newforumnavigator_sl').bind('mouseleave', function() {		
		$('#newforumnavigator_sl').hide();
	});
});

$('#jumplistbtn_s2').bind('mouseenter', function() {
	$('#newforumnavigator_sl').hide();
	$('#newforumnavigator_s3').hide();
	$('#newforumnavigator_s4').hide();
	$('#newforumnavigator_s2').show();
	$('#newforumnavigator_s2').bind('mouseleave', function() {
		$('#newforumnavigator_s2').hide();
	});
});

$('#jumplistbtn_s3').bind('mouseenter', function() {
	$('#newforumnavigator_sl').hide();
	$('#newforumnavigator_s2').hide();
	$('#newforumnavigator_s4').hide();
	$('#newforumnavigator_s3').show();
	$('#newforumnavigator_s3').bind('mouseleave', function() {
		$('#newforumnavigator_s3').hide();
	});
});

$('#jumplistbtn_s4').bind('mouseenter', function() {
	$('#newforumnavigator_sl').hide();
	$('#newforumnavigator_s2').hide();
	$('#newforumnavigator_s3').hide();
	$('#newforumnavigator_s4').show();
	$('#newforumnavigator_s4').bind('mouseleave', function() {
		$('#newforumnavigator_s4').hide();
	});
});
