	//发新帖
	
	$("#quicknewtopic").click(function()
	{
		var postmode = "createtopic";
		checkPlv('canPost',forumid,this.href,false,"showPostDiv('发帖','"+postmode+"',0)",false); 
		return false;
	})		
			
	//回帖 
	$(".cmd a[@href*=newpost.php]").click(function()
	{
		var postmode = "createpost";
		var quotepostid = getvalue(this.href,'quotepostid');
		refloor = getvalue(this.href,'refloor');
		
		checkPlv('canReply',forumid,this.href,false,"showPostDiv('回帖','"+postmode+"',0,'"+quotepostid+"')",false); 
		return false;
	})
	
	
	
	$(".replypostbtn a[@href*=newpost.php]").click(function()
	{
		var postmode = "createpost";
		var quotepostid = getvalue(this.href,'quotepostid');
		refloor = getvalue(this.href,'refloor');
		
		checkPlv('canReply',forumid,this.href,false,"showPostDiv('回帖','"+postmode+"',0,'"+quotepostid+"')",false); 
		return false;
	})
	
	$("#quickreplybtn").click(function()
	{
		
		var postmode = "createpost";
		var quotepostid = '';
		refloor = '';
		checkPlv('canReply',forumid,this.href,false,"showPostDiv('回帖','"+postmode+"',0,'"+quotepostid+"')",false); 
		return false;
	})
	
	
	
	//收藏
	$(".cmd a[@href*=act\=interest]").click(function()
	{
			
		checkPlv('canInterest',forumid,'',false,'addInterest('+thetopicid+')'); 
			
		return false;
	})
	
	//送鲜花
	$(".cmd a[@href*=act\=flower]").click(function()
	{
		postid = getvalue(this.href,'postid');
		
		checkPlv('canFlower',forumid,this.href,false,"showFlowerDiv('flower','送鲜花',"+postid+")"); 
		
		return false;
	})
	
	//扔鸡蛋
	$(".cmd a[@href*=act\=egg]").click(function()
	{
		postid = getvalue(this.href,'postid');

		checkPlv('canEgg',forumid,this.href,false,"showFlowerDiv('egg','扔鸡蛋',"+postid+")"); 
		return false;
	})
	
	//送勋章
	
	$(".cmd a[@href*=act\=medal]").click(function()
	{
		postid = getvalue(this.href,'postid');

		checkPlv('canEgg',forumid,this.href,false,"showFlowerDiv('medal','送勋章',"+postid+")"); 
		return false;
	})
	
	//报告
	$(".cmd a[@id=report]").click(function()
	{

		checkPlv('canReport',forumid,this.href,false,"showReportDiv('"+this.href+"')"); 
		return false;
	})
	
	//好友请求
	$("a[@href*=addfriend.php]").click(function()
	{
		fuid = getvalue(this.href,'frienduid');
		//checkPlv('canDigest',forumid,this.href,true,"showDigest('"+topicid+"','undigest')"); 
		showCommonDiv(fuid,'addfriend','发送好友请求',this.href);
		return false;
	})
	
	/*
	$(".profileleft a[@href*=addfriend.php]").click(function()
	{
		fuid = getvalue(this.href,'frienduid');
		//checkPlv('canDigest',forumid,this.href,true,"showDigest('"+topicid+"','undigest')"); 
		showCommonDiv(fuid,'addfriend','发送好友请求',this.href);
		return false;
	})
	*/
	
	$(".flowernum").click(function()
	{
		//showDiv('flowerusersdiv','voteusersbox','送鲜花用户列表',this.id);
		var thehref = window.location.toString();
		checkPlv('canFlower',forumid,thehref,false,"showFlowerDiv('flower','送鲜花',"+this.id+")"); 
		
	})
	$(".eggnum").click(function()
	{
		showDiv('eggusersdiv','voteusersbox','扔鸡蛋用户列表',this.id);
	})
	
	$("#showvotelist").click(function()
	{
		showDiv('voteusersdiv','voteusersbox','投票用户列表');
	})
	
	
	//控制签名档图片大小
	$("#signarea img").each(function()
	{
		if(this.width > 450)
		{
			this.width = 450;
			//this.width = 450;
		}
	});
	
	//控制签名档链接为新窗口
	$("#signarea a").each(function()
	{
		this.target = "_blank";
	});
	$(".postcontent img").each(function()
	{
		if(this.width >640)
			this.width = 640;
	})
	
	//加载快速回复
	
	//setTimeout("setEditorUrl()",500);
	
	
	$("#lastoperate").click(function()
	{
		
		showDiv("operatelog","floatBox",'查看操作记录','','');	 
		return false;
	})
	
	
	
	if(!isguest)
	{
		
		//提交投票
		
		$("#topicpoll #submitpoll").click(function()
		{
			
			var polltype = $("#topicpoll #polltype").val();
			var maxchoices =parseInt($("#topicpoll #maxchoices").val());
			var choicesnum = $("input[@id=pollopt][@checked]").length;
			
			if(choicesnum == 0)
			{
				var ameg = "最多只能选择"+maxchoices+"个选项";
				if(polltype == 0 && maxchoices ==0)
				{
					var ameg = "最多只能选择1个选项"
					
				}
				if(polltype !=0 && maxchoices == 0)
				{
					var ameg = "选责数不限";
				}
				$("#topicpoll #pollalert").html("<font color=red>请选择后投票,"+ameg+"</font>");
				return false;
			}
			if(polltype != 0 && maxchoices!=0)
			{
				
				
				if(choicesnum > maxchoices)
				{
					$("#topicpoll #pollalert").html("<font color=red>最多只能选择"+maxchoices+"个选项</font>")
					return false;
				}
				
			}
			return true;
	
		})
		
		//最佳答案
		$(".cmd a[@id*=bestresult]").click(function()
		{
			//alert(this.name);
			confirmTask(this.name);
			return false;
		})
		//编辑
		$(".cmd a[@href*=edit.php\?self]").click(function()
		{
			
			postmode = "edit";
			var postid = getvalue(this.href,"postid");
			topicoffset = getvalue(this.href,'topicoffset');	
			vforumoffset = getvalue(this.href,'vforumoffset');
			//alert(postid);
			//checkPlv(theact,forumid,href,logintag,fun,evalfun)
			checkPlv('canEditSelf',forumid,this.href,true,"showPostDiv('编辑','"+postmode+"','"+postid+"')",true); 
			
			return false;
		})
		
		//自己删除帖子
		$(".cmd a[@href*=delete.php\?self]").click(function()
		{
			
			var thepostid=getvalue(this.href,'postid');	
			vforumoffset = getvalue(this.href,'vforumoffset');	
			topicoffset = getvalue(this.href,'topicoffset');	
			checkPlv('canDeleteSelf',forumid,'',true,'confirmDel('+thepostid+','+vforumoffset+','+topicoffset+')'); 
			return false;
		})
		
		
		// 管理操作按钮
		$(".cmd a[@id=showadminopt]").mouseover(function()
		{
			//hidelastdiv();
			//lastdivobj = this.name;
			$("#"+optdivname).hide();
			optdivname = this.name;
			$("#"+optdivname).show();
		})
		$(".cmd a[@id=showadminopt]").mouseout(function()
		{
			//alert(optdivname);
			//alert(onoptlist);
			onoptlist = 0;
			clearInterval(hideintval);
			hideintval = setInterval("hideadminopt()",1000);
			
		})
		$(".cmd div[name=adminopt]").mouseover(function()
		{
			
			//$("#"+optdivname).show();
			onoptlist = 1;
		})
		$(".cmd div[name=adminopt]").mouseout(function()
		{
			//$("#"+optdivname).hide();
			onoptlist = 0;
		})
		
		//管理编辑
		$(".cmd a[@href*=edit.php\?modrate]").click(function()
		{
			
			postmode = "edit";
			var postid = getvalue(this.href,"postid");
			vforumoffset = getvalue(this.href,'vforumoffset');
			topicoffset = getvalue(this.href,'topicoffset');	
			checkPlv('canEdit',forumid,this.href,true,"showPostDiv('编辑','"+postmode+"','"+postid+"')",true); 
			
			return false;
		})
		//管理删除
		$(".cmd a[@href*=delete.php\?modrate]").click(function()
		{
			
			var thepostid = getvalue(this.href,'postid');	
			vforumoffset = getvalue(this.href,'vforumoffset');	
			topicoffset = getvalue(this.href,'topicoffset');	
			checkPlv('canDelete',forumid,'',true,'confirmDel('+thepostid+','+vforumoffset+','+topicoffset+')'); 
	
			return false;
		})
		
		//编辑代码
		$(".cmd a[@id*=act\=editcode]").click(function()
		{
			
			var thepostid = getvalue(this.id,'postid');
			showEditcode(thepostid);
			return false;
		})
		
		//奖励惩罚
		$(".cmd a[@href*=act\=pushsocre]").click(function()
		{
			var theuid = getvalue(this.href,'theuid');
			var thepostid = getvalue(this.href,'postid');
			showPushscore(theuid,thepostid);
			
			return false;
		})
		
		// 置顶
		$(".cmd a[@href*=act\=stick]").click(function()
		{
			topicid = getvalue(this.href,'topicid');	
			//showStick(topicid,'stick');
			vforumoffset = getvalue(this.href,'vforumoffset');	
			checkPlv('canStick',forumid,this.href,true,"showStick('"+topicid+"','"+vforumoffset+"','stick','"+this.href+"')"); 
			
			return false;
		})
		
		//解除置顶
		$(".cmd a[@href*=act\=unstick]").click(function()
		{
			topicid = getvalue(this.href,'topicid');	
			vforumoffset = getvalue(this.href,'vforumoffset');	
			checkPlv('canStick',forumid,this.href,true,"showStick('"+topicid+"','"+vforumoffset+"','unstick','"+this.href+"')"); 
			
			return false;
		})
		
		//精华
		$(".cmd a[@href*=act\=digest]").click(function()
		{
			topicid = getvalue(this.href,'topicid');
			vforumoffset = getvalue(this.href,'vforumoffset');
			checkPlv('canDigest',forumid,this.href,true,"showDigest('"+topicid+"','digest')"); 
			
			return false;
		})
		//解除精华
		$(".cmd a[@href*=act\=undigest]").click(function()
		{
			topicid = getvalue(this.href,'topicid');
			vforumoffset = getvalue(this.href,'vforumoffset');
			checkPlv('canDigest',forumid,this.href,true,"showDigest('"+topicid+"','undigest')"); 
			
			return false;
		})
		
		//高亮
		$(".cmd a[@id*=act\=highlight]").click(function()
		{
			topicid = getvalue(this.id,'topicid');
			showHighlight(topicid);
			return false;
		})
		
		//提升下沉
		$(".cmd a[@id*=act\=updown]").click(function()
		{
			
			topicid = getvalue(this.id,'topicid');
			showUpdown(topicid);
			return false;
		})
		
		//锁定主题
		$(".cmd a[@id*=act\=locktopic]").click(function()
		{
			var opid = getvalue(this.id,'topicid');
			showOperate(opid,'locktopic','确认锁定主题');
			return false;
		})
		//解除锁定
		$(".cmd a[@id*=act\=unlocktopic]").click(function()
		{
			var opid = getvalue(this.id,'topicid');
			showOperate(opid,'unlocktopic','确认解除主题锁定');
			return false;
		})
		//移动主题
		$(".cmd a[@id*=act\=moveone]").click(function()
		{
			showMove("movetopic",'移动主题',getvalue(this.id,"topicid"));
			
			return false;
		})
		
		$(".cmd a[@href*=act\=canceltask]").click(function()
		{
			
			showCancelTask();
			return false;
		})
	
		//推荐
		$(".cmd a[@href*=act\=recommend]").click(function()
		{
			topicid = getvalue(this.href,'topicid');
			showRecommend(topicid);
			return false;
		})
		
		
		//禁言
		$(".username img[@id=filteruser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'filteruser','确认禁言用户');
			
			return false;
			
		})
		//解除禁言
		$(".username img[@id=unfilteruser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unfilteruser','确认解除禁言用户');
			
			return false;
			
		})
		
		//显示ip
		$(".username img[@id=filteruser]").mouseover(function()
		{
			thealt = this.alt;
			$("#floatip"+this.alt).show();	
			
		})
		
		$(".username a[id=killip]").mouseover(function()
		{
			$("#floatip"+this.title).show();	
		})
		
		$(".username a[id=killip]").mouseout(function()
		{
			$("#floatip"+this.title).hide();	
		})
		
		
		//锁定用户
		$(".username img[@id=lockuser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'lockuser','确认锁定用户');
			
			return false;
			
		})
		//解除锁定用户
		$(".username img[@id=unlockuser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unlockuser','确认解除锁定用户');
			
			return false;
			
		})
		
		//个人资料页-锁定用户
		$(".profliename img[@id=lockuser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'lockuser','确认锁定用户');
			
			return false;
			
		})
		
		//解除锁定用户
		$(".profliename img[@id=unlockuser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unlockuser','确认解除锁定用户');
			
			return false;
			
		})
		
		//禁言
		$(".profliename img[@id=filteruser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'filteruser','确认禁言用户');
			
			return false;
			
		})
		//解除禁言
		$(".profliename img[@id=unfilteruser]").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unfilteruser','确认解除禁言用户');
			
			return false;
			
		})
		//禁言
		$("#filteruser").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'filteruser','确认禁言用户');
			
			return false;
			
		})
		//解除禁言
		$("#unfilteruser").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unfilteruser','确认解除禁言用户');
			
			return false;
			
		})
		
		
		//锁定用户
		$("#lockuser").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'lockuser','确认锁定用户');
			
			return false;
			
		})
		//解除锁定用户
		$("#unlockuser").click(function()
		{
			var thisuid = this.name;
			
			showOperate(thisuid,'unlockuser','确认解除锁定用户');
			
			return false;
			
		})
		
		
		//管理主题
		$("#showpostbyuid").click(function()
		{
			var spluid = $("#spluid").val();
			showPostBy('uid',spluid)
			
			return false;
		})
	
		
		
		
			
	
		
		
		//封IP
		$(".username a[@id=killip]").click(function()
		{
			var thisip = this.name;
			div = "killipdiv";
			
			
			$.ajax  
			({
			 	type: "get",
				url: pathroot+"getdiv.php",
				data: "div="+div+"&ip="+thisip,
			 	timeout: ajaxtimeout,
			 	beforeSend:function(){loading(true)},
			 	success: 
			 	function(xml)
			 	{
			 		var ratediv = $(xml).find('root').text();
			 		addDiv(div);
			 		document.getElementById(div).innerHTML=ratediv; 
			 		showFloatBg("popbox");
			 		hideMedia();
			 		$("#popboxtitle").html('确认禁止IP');
			 		//$("#flowerBox #msg").html("")
					minDiv();
					$("#popbox").show();
					closeFloat("popbox");
					
					$("#popboxbody #sure").click(function()
					{
						var expire = $("#expire option[selected]").val();
						
						$.ajax  
						({
				 			type: "POST",
							url: pathroot+"ajaxxml.php",
				 			data:   "act=killip&ip="+thisip+"&expire="+expire,
				 			timeout: ajaxtimeout,
				 			beforeSend:function(){loading(true)},
				 			success: 
				 			function(xml)
				 			{
				 				var status =parseInt($(xml).find('status').text());
				 				var msg = $(xml).find('msg').text();
				 				if(status == 1)
				 				{
				 					hideFloat(div);
				 					showDiv("dialogdiv","dialogBox",'操作成功',msg);	 
				 				}
				 				else
				 				{
				 					showDiv("dialogdiv","dialogBox",'操作失败',msg);	 
				 				}
				 			},
				 			error:function()
				 			{
				 				go2href(href);
				 			},
				 			complate:function()
				 			{
				 				loading();
				 			}
				 		})
					})
				},
				error:function()
				{
					alert("error");
				},
				complate:function()
				{
					
				}
			})
			
			return false;
			
		})
		
		
	}
	

