var isLoadUser=0; //是否已经加载了用户资料
var isClose=0;
var userInfoTempDiv=null;
var EditContent="";
setRowColor=function(color1,color2){	
	var objs=document.getElementsByName("bbsRowDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onmouseover=function(){
			this.style.backgroundColor=color2;
		}		
		objs[i].onmouseout=function(){
			this.style.backgroundColor=color1;
		}		
		objs[i].style.height="auto";
	}
	objs=document.getElementsByName("bbsMenuDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onclick=function(){			
			var obj=this.parentNode.parentNode;
            var isBool=false;
			if(obj.getAttribute("dis")!="1"){			
			    for(var j=0;j<obj.childNodes.length;j++){
			        if(obj.childNodes[j].tagName=="DIV"){
			            if(isBool==false)
			                isBool=true;
			            else
			                obj.childNodes[j].style.display="none";
			        }
			    }
			    obj.setAttribute("dis",1);
			    this.innerHTML="<img src='img/collapsed_yes.gif'>";
			}else{
			    for(var j=0;j<obj.childNodes.length;j++){
			        if(obj.childNodes[j].tagName=="DIV"){
			            if(isBool==false)
			                isBool=true;
			            else
			                obj.childNodes[j].style.display="block";
			        }
			    }
			    this.innerHTML="<img src='img/collapsed_no.gif'>";
			    obj.setAttribute("dis",0)
			}
		}
	}
}
function addEventHander(obj,objEvent,objExec){
    if(obj.addEventListener){
       obj.addEventListener(objEvent,objExec,false);
    }else if(obj.attachEvent){
       obj.attachEvent("on"+objEvent,objExec);
    }else{
        obj["on"+objEvent]=objExec;
    }
}
//加网站论坛调查选项
function addVot(){   
       var tempObj=$c("div");
       var obj=$("votDiv");
       var newObj=obj.appendChild(tempObj);
       newObj.style.cssText="width:100%;";
       obj=newObj;
       obj.setAttribute("id","bbsVotOption"+bbsVoti);
       
       tempObj=$c("div");
       newObj=obj.appendChild(tempObj);
       newObj.style.cssText="float: left;width:35px;padding-top:3px;";
       newObj.innerText="选项";
       
       tempObj=$c("div");
       newObj=obj.appendChild(tempObj);
       newObj.style.cssText="float: left;width:165px";
       newObj.innerText="";
       
       tempObj=$c("input");
       tempObj.setAttribute("type","text");
       var textObj=newObj.appendChild(tempObj);
       textObj.style.cssText="width:120px;height:20px;"
       textObj.setAttribute("id","bbsVotText");
       textObj.setAttribute("name","bbsVotText");
       
       tempObj=$c("input");
       tempObj.type="button";
       tempObj.value="删除"
       var buttonObj=newObj.appendChild(tempObj);
       buttonObj.style.cssText="width:40px;height:20px;"
       buttonObj.setAttribute("i",bbsVoti);
       buttonObj.onclick=function(){
            var divObj=$("bbsVotOption"+this.i);
            divObj.removeNode(true);
       }   
       bbsVoti++;
}

//读取网址公告
function readBbsVot(){
	var outData=new Array();
	outData[0]="";
	outData[1]="";
	 var objs=document.getElementsByName("bbsVotText");
	 if (objs.length<1){
		return outData;  
	 }
	 var outStr="";
	 var intStr="";
	 var str="";
	 for (var i=0;i<objs.length;i++){
		 if (objs[i].value!=""){
			 str=objs[i].value;
			 str=str.replace(",","，");
			 outStr=outStr+str+",";
			 intStr=intStr+"0,";
		 }
	 }
	 if (outStr!=""){
		outStr=outStr.substring(0,outStr.length-1);
		intStr=intStr.substring(0,intStr.length-1);
	 }	 
	 outData[0]=outStr;
	 outData[1]=intStr;
	 return outData;
}
   
//提交网站论坛的发贴
function bbsPostSubmit(){ 
  var objs=document.getElementsByName("pType");
  var votOutStr="";
  var votIntStr="";
  var postType="0";
  for (var i=0;i<objs.length;i++){
         switch  (i){
			 case 1:
			 	if (objs[i].checked){
					var votData=readBbsVot();
					votOutStr=votData[0];
					votIntStr=votData[1];
					postType="1";
					if (votOutStr==""){
						alert("请正确设置调查");
						return;	
					}
			  };break;
			  case 2:
			       if (objs[i].checked){
			            postType="2";
			   		    if ($("bbsOutInt").value==""){
						    alert("请设置悬赏出分的值");
						    return;	
					    }
			  };break;
			  case 3:
			        if (objs[i].checked){
			            postType="3";
			   		    if ($("bbsInInt").value==""){
						    alert("请设置看你贴需要多少积分");
						    return;	
					    }
			  };break;
		 }
   }   
	var content=editTxt.GetContent();
	if (content.length<5){
		alert("请你填写贴子内容");
		return;
	}
	if (content.indexOf("none;")==-1){
		content=content.replace(/<IMG /g,"<IMG style='display:none;' onerror='imgLoadErr(this)' onload='imgLoad(this)' ");
	}
	content=content.replace(sysPath,"../");
	content=content.replace("style=\"BORDER-LEFT-COLOR: #000000; FILTER: ; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000\"","");
	var v=new validate();
	v.form=$("form1");
	if (!v.start()){
	   return;
	}
	var prefixText=$("prefixSelect").value;
	var bbsTitle=$("pTitle").value;
	bbsTitle=bbsTitle.replace(" ","");
	if (bbsTitle.length<5){
		 alert("贴子标题不能少于5个字");
		 return;
	}
	var outInt=$("bbsOutInt").value;
	var inInt=$("bbsInInt").value;
	var votName=votOutStr;
	var votValue=votIntStr;
	var title="论坛投票:"+bbsTitle;
	
	var isV="0";
	if ($("R5").checked){
		var vType="1";
	}else{
		var vType="2";
	}
	var menuid=readPar(location.href,"menuid");   
    var objAjax=new JAjax();
   	var objResponse=new JHttpResponse();
	objResponse.write("postType",postType); //贴子类型   0 普通   1 调查   2 悬赏  3 卖分
	objResponse.write("bbsTitle",bbsTitle);  //帖子的标题
	objResponse.write("content",content);    //贴子内容
	objResponse.write("outInt",outInt);       //要送出的分
	objResponse.write("inInt",inInt);         //要收的分
	objResponse.write("votName",votName);      //调查的内容
	objResponse.write("votValue",votValue);    //调查的选项的值,
	objResponse.write("title",title);           //调查的标题 自动生成
	objResponse.write("vType",vType);           //调查的类型, 单选还是复选 单选为1 复选为2
	objResponse.write("prefix",prefixText);     //前缀
	objResponse.write("menuid",menuid);     //前缀	
	var out=objAjax.getText("post","AddPost.aspx?type=addPost",objResponse,null);
	switch (out){
	    case "1":
	        alert("发贴成功");
	        location.href="bbsList.aspx?menuid="+menuid+"&p=1";
	        break;
	    case "-1":
	        alert("发贴失败,你没有权限在此版发贴");
	        break;
	     default:
	        alert("错误:\n"+erStr(out));
	}    
}  

//设置论坛分页背景颜色
function setBbsPageColor(color,bColor,bgColor){   
    var objs=document.getElementsByName("bbsPageDiv");
    var colorBak,bColorBak,bgColorBak;
    for (var i=0;i<objs.length;i++){
        objs[i].onmouseover=function(){
             try{
                colorBak=this.style.color;
                bColorBak=this.style.border;
                bgColorBak=this.style.backgroundColor;            
                this.style.color=color;
                this.style.backgroundColor=bgColor;
                this.style.border=" 1px solid "+bColor;
             }catch(e){}
        }
        objs[i].onmouseout=function(){
            try{
                 this.style.color=colorBak;
                this.style.backgroundColor=bgColorBak;
                this.style.border=bColorBak;
             }catch(e){}
        }
    }
}
//发表回复
function bbsRePostSubmit(){ 
	var mainID=readPar(location.href,"mainID");
	var content=editTxt.GetContent();
	if (content.indexOf("none;")==-1){
		content=content.replace(/<IMG /g,"<IMG style='display:none;' onerror='imgLoadErr(this)' onload='imgLoad(this)' ");
	}
	var sPath=sysPath.replace(/\//g,"\\/");
	var str="sPath=/"+sPath+"/g";
    eval(str);
    content=content.replace(sPath,"../")
	content=content.replace(/style="BORDER-LEFT-COLOR: #000000; FILTER: ; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000"/g,"");
	if (content.length<5){
	     alert("回复不能为空");
	    return;
	}
	var objAjax=new JAjax();	
   	var objResponse=new JHttpResponse();
	objResponse.write("menuid",menuid);   
	objResponse.write("mainID",mainID);   
	objResponse.write("content",content);   
	var out=objAjax.getText("post",sysPath+"webServer.aspx?type=bbsRePostSave",objResponse,null);
	if (out=="1"){
	    alert("回复成功");		
		location.reload();
	}else{
	    alert("错误:\n"+erStr(out));
	}
}


//提交网站论坛的发贴
function bbsPostSubmit(){ 
  var objs=document.getElementsByName("pType");
  var votOutStr="";
  var votIntStr="";
  var postType="0";
  for (var i=0;i<objs.length;i++){
         switch  (i){
			 case 1:
			 	if (objs[i].checked){
					var votData=readBbsVot();
					votOutStr=votData[0];
					votIntStr=votData[1];
					postType="1";
					if (votOutStr==""){
						alert("请正确设置调查");
						return;	
					}
			  };break;
			  case 2:
			       if (objs[i].checked){
			            postType="2";
			   		    if ($("bbsOutInt").value==""){
						    alert("请设置悬赏出分的值");
						    return;	
					    }
			  };break;
			  case 3:
			        if (objs[i].checked){
			            postType="3";
			   		    if ($("bbsInInt").value==""){
						    alert("请设置看你贴需要多少积分");
						    return;	
					    }
			  };break;
		 }
   }   
	var content=editTxt.GetContent();
	if (content.length<5){
		alert("请你填写贴子内容");
		return;
	}
	if (content.indexOf("none;")==-1){
		content=content.replace(/<IMG /g,"<IMG style='display:none;' onerror='imgLoadErr(this)' onload='imgLoad(this)' ");
	}
	content=content.replace(sysPath,"../");
	content=content.replace("style=\"BORDER-LEFT-COLOR: #000000; FILTER: ; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000\"","");
	var v=new validate();
	v.form=$("form1");
	if (!v.start()){
	   return;
	}
	var prefixText=$("prefixSelect").value;
	var bbsTitle=$("pTitle").value;
	bbsTitle=bbsTitle.replace(" ","");
	if (bbsTitle.length<5){
		 alert("贴子标题不能少于5个字");
		 return;
	}
	var outInt=$("bbsOutInt").value;
	var inInt=$("bbsInInt").value;
	var votName=votOutStr;
	var votValue=votIntStr;
	var title="论坛投票:"+bbsTitle;
	
	var isV="0";
	if ($("R5").checked){
		var vType="1";
	}else{
		var vType="2";
	}
	var menuid=readPar(location.href,"menuid");   
    var objAjax=new JAjax();
   	var objResponse=new JHttpResponse();
	objResponse.write("postType",postType); //贴子类型   0 普通   1 调查   2 悬赏  3 卖分
	objResponse.write("bbsTitle",bbsTitle);  //帖子的标题
	objResponse.write("content",content);    //贴子内容
	objResponse.write("outInt",outInt);       //要送出的分
	objResponse.write("inInt",inInt);         //要收的分
	objResponse.write("votName",votName);      //调查的内容
	objResponse.write("votValue",votValue);    //调查的选项的值,
	objResponse.write("title",title);           //调查的标题 自动生成
	objResponse.write("vType",vType);           //调查的类型, 单选还是复选 单选为1 复选为2
	objResponse.write("prefix",prefixText);     //前缀
	objResponse.write("menuid",menuid);     //前缀	
	var out=objAjax.getText("post","AddPost.aspx?type=addPost",objResponse,null);
	switch (out){
	    case "1":
	        alert("发贴成功");
	        location.href="bbsList.aspx?menuid="+menuid+"&p=1";
	        break;
	    case "-1":
	        alert("发贴失败,你没有权限在此版发贴");
	        break;
	     default:
	        alert("错误:\n"+erStr(out));
	}    
}  


//加载用户信息
function readBbsUserInfo1(){
	isLoadUser=1;
	var uObjs=document.getElementsByName("userBbsDiv");
	var bodyObjs=document.getElementsByName("bodyBbsDiv");
	var idiogrObjs=document.getElementsByName("idiographDiv");
	var uList=",";
	var l=uObjs.length;
	for (var i=0;i<l;i++){
		if(uList.indexOf(","+uObjs[i].getAttribute("uid")+",")==-1){
			uList=uList+uObjs[i].getAttribute("uid")+",";
		}
	}	
	if (uList==","){
		return;
	}
	var objAjax=new JAjax();
	var objResponse=new JHttpResponse();
	objResponse.write("uList",uList);  
	var out=objAjax.getText("post",sysPath+"webServer.aspx?type=bbsReadUser",objResponse,null);
//0     1          2        3          4        5               6           7           8          9       10      11 
//id, 用户名     用户头像   级别名      组名    发的主题数         总积分     最后登录日期   登录次数    注册日期  是否锁定 签名   
//id,UserName,userPhoto,LevelName,GroupName,Count_Comment,Integral_Total,Date_Login,Count_Login,RegDate,IsLocked,idiograph,
//12     13        14          15         
//性别   金钱     基本分        专家分       
//sex,Money,Integral_Base,Integral_Expert
	out=comminute(out,c1,c2);
	var uid=""
	var html="";
	var h,y,x;
	for (var i=0;i<l;i++ ){
		uid=uObjs[i].getAttribute("uid");
		html="";
		uInfo=findBbsUser(out,uid);
		if (uInfo!=null){
			y=getTop(uObjs[i]);
			x=getLeft(uObjs[i]);
			y=y+2;
			x=x+2;
			html="<div  onmouseout='closeBbsExinfo(this)' style='border: 1px solid #C0C0C0;padding:5px;width:380px;height:145px;display:none;position:absolute;top:2px;left:2px;z-index:50;background-color:#ffffff;'>";
			html=html+"<div style='width:150px;height:130px;float:left;'>";
			html=html+"</div><div style='width:170px;height:130px;float:left;' >";
			html=html+"<br>基本分:"+uInfo[14];
			html=html+"<br>登录次数:"+uInfo[8];
			html=html+"<br>发文章数:"+uInfo[5];
			html=html+"<br>注册时间:"+uInfo[9];
			html=html+"<br>用户组:"+uInfo[4];		
			html=html+"</div>";
			html=html+"</div>";
			html=html+"<div  onmouseover='displayBbsExinfo(this)'  style='padding:5px;height:130px;width:200px;position:absolute;top:5px;left:5px;z-index:70;'><b> "+uInfo[1]+"</b><br>";
			html=html+""+uInfo[3]+"<br>";
			html=html+"<div style='width:130px;text-align:center;height:90px;overflow:hidden;'><img onload='setImgWH(this)' onerror='hendImgError(this)' sex='"+uInfo[12]+"'  src='"+uInfo[2]+"' id='uImg' name='uImg'></div>";
			html=html+"</div>";
			uObjs[i].innerHTML=html;
			idiogrObjs[i].innerHTML=uInfo[11];			
		}else
			uObjs[i].innerHTML="当前用户可能被禁用或者删除";
		h=Element.getHeight(bodyObjs[i]);
		uObjs[i].style.height=h;		
	}	

    //需要同步的文件
    if (sysPath1=="" | sysPath2=="")
        return;
	if (errFile=="")
		return;	
    errFile=errFile.split("|"); 
    i=0
    for (i=0;i<errFile.length-1;i++){
    	objResponse.write("file"+i,errFile[i]); 
    }
    if (i>0){
	    objResponse.write("count",i);
	    var out=objAjax.getText("post",sysPath+"webServer.aspx?type=downImgFile",objResponse,null);
	}
}
function hendImgError(obj){
	obj.src='../webUser/face/EF10945928.gif'
}
function setContImg(){ 
	var objs=document.getElementsByName("bbsBodyContent");
	var y=0;
	for (var i=0;i<objs.length;i++){
		var imgs=objs[i].getElementsByTagName("img");
		objs[i].style.height="auto";
		if (Element.getHeight(objs[i])<130){
			objs[i].style.height=130;
		}
		objs[i].style.overflow="hidden";
		for (var x=0;x<imgs.length;x++){	   
		    imgs[x].id="bbsUpImg";
		    imgs[x].name="bbsUpImg";		
			pageImgCount++
			if (imgs[x].onload=="" || imgs[x].onload==null){
    			imgs[x].onload=function(){
    				 imgLoad(this);
    			}    			
    			imgs[x].onerror=function(){
    		     imgLoadErr(this);
    			}
			}
		}		
		if (imgs.length>0){
			objs[i].style.height="auto";
		}
		if (Element.getHeight(objs[i])<130){
			objs[i].style.height=130;
		}
	}	
	if (pageImgCount==0 & isLoadUser==0){
  	  	isLoadUser=1;		
    	setTimeout("readBbsUserInfo1()",100)
   }	
}

function imgLoadErr(imgObj){
   errFile=errFile+imgObj.src+"|";
   pageLoadImg++
   if (pageLoadImg>=pageImgCount & isLoadUser==0){
      	isLoadUser=1;
       setTimeout("readBbsUserInfo1()",100)
   }
}

function imgLoad(imgObj){
    pageLoadImg++
	imgObj.style.display="";
    var w=Element.getWidth(imgObj);   
	if (w>200){
	    imgObj.style.border="1px solid #000000";
	}
    if (w>700){
	    imgObj.title="点击放大";
	    imgObj.width=700;
	    imgObj.onclick=function(){
		    window.open(this.src);
	    }
   }
   if (pageLoadImg>=pageImgCount & isLoadUser==0){
   	isLoadUser=1;
     setTimeout("readBbsUserInfo1()",100)
   }		    
}
function userImgErr(imgObj){
    if (imgObj.sex=="1"){
		imgObj.src="img/girl.gif";
	}else{
		imgObj.src="img/Boy.gif";
	}
}
var isCloseMangeMenu=1;
var manageType=1; //管理的主题为1, 回复为2
var manageID=0;   //当前管理的贴子的ID 
function setManageDiv(){  //管理DIV加事件
    //  alert("管理准备");
	var objs=document.getElementsByName("manageDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onmouseover=function(){
			manageID=this.getAttribute("rid");
			isCloseMangeMenu=0;
			if (this.getAttribute("mType")=="1"){//如果是主贴的管理
				manageType=1;
				addMainManage(this);				
			}else{ //如果是回复的管理
				manageType=2;
				addComManage(this);
			}
		}
		objs[i].onmouseout=function(){  //鼠标离开管理层
			if(parseInt(isClose)==0){
			 isCloseMangeMenu=1;
			 setTimeout("closMangeMenu()",500)
			}
		}		
	}
	var mObj=document.getElementById("bbsManageDiv");	
	mObj.onmouseout=function(){ //鼠标离开管理管理菜单
		if(parseInt(isClose)==0){
		    isCloseMangeMenu=1;
		    setTimeout("closMangeMenu()",500)
		}
	}	
	mObj.onclick=function(){  //点击管理菜单
		isCloseMangeMenu=1;
		setTimeout("closMangeMenu()",500)
	}	
	mObj.onmouseover=function(){ //鼠标移上管理菜单
		isCloseMangeMenu=0;
	}
}

//创建主题管理选项
function addMainManage(thisObj){ 
   // alert("准备选项"+userIsAdmin) ;
	if(parseInt(isClose)==0){
	    if (userIsAdmin=="0")
	    alert("退出");
			return;
	    var mObj=$("bbsManageDiv");
	    mObj.innerHTML="";
		mObj.setAttribute("rid",thisObj.getAttribute("rid"));
	    var x=getLeft(thisObj);
	    var y=getTop(thisObj);
	    var h=Element.getHeight(thisObj);
	    y=y+h;
	    mObj.style.left=x+"px";
	    mObj.style.top=y+"px";
	    mObj.style.display="";

	    var obj=cObj(mObj,"div");
	    obj.innerHTML="设为总置顶";
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","setAllTop");
    	
	    obj=cObj(mObj,"div");
	    obj.innerHTML="设为置顶";
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","setTop");
		
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","delTop");
	    obj.innerHTML="取消置顶";
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","setElite");
	    obj.innerHTML="设为精华";
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","delElite");
	    obj.innerHTML="取消精华";
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","delete");
	    obj.innerHTML="删除";
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","locked");
	    obj.innerHTML="锁定";
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","unLocked");
	    obj.innerHTML="解锁";	
    	
	    obj=cObj(mObj,"div");
		obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.setAttribute("mType","sendEditor");
        obj.innerHTML="编辑";	
    	
	    var objs=document.getElementsByName("bbsManageOption");
	    for (var i=0;i<objs.length;i++){
		    objs[i].onclick=function(){
			    execManage(this);
		    }
	    }
	}
}

//创建回复管理选项
function addComManage(thisObj){ 
	if(parseInt(isClose)==0){
	    if (userIsAdmin=="0")
			return;
	    var mObj=$("bbsManageDiv");
	    mObj.innerHTML="";
		mObj.setAttribute("rid",thisObj.getAttribute("rid"));
	    var x=getLeft(thisObj);
	    var y=getTop(thisObj);
	    var h=Element.getHeight(thisObj);
	    y=y+h;
	    mObj.style.left=x+"px";
	    mObj.style.top=y+"px";
	    mObj.style.display="";
    	
	    var obj=cObj(mObj,"div");
	    obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.innerHTML="删除";
	    obj.setAttribute("mType","delete");
	    obj.onclick=function(){
			execManage(this);
		}
        obj=cObj(mObj,"div");
	    obj.setAttribute("id","bbsManageOption");
	    obj.setAttribute("name","bbsManageOption");
	    obj.innerHTML="编辑";	
	    obj.setAttribute("mType","backEditor");
	    obj.onclick=function(){
			execManage(this);
		}
	}
}

//执行管理选项
function execManage(obj){ 
	var type=obj.getAttribute("mType");
	var objAjax=new JAjax();
	var objResponse=new JHttpResponse();
	objResponse.write("manageID",manageID);  
	objResponse.write("manageType",manageType);  
	objResponse.write("operation",type); 
	var out=objAjax.getText("post",sysPath+"webServer.aspx?type=bbsManage",objResponse,null);
	if (out=="1"){
		alert("操作成功: "+obj.innerHTML)
		if (manageType==1 & type=="delete")
			location.href="bbsList.aspx?menuid="+menuid;
		else{
			if (type=="delete" | type=="locked" | type=="unLocked")
				location.reload();
		}
	}else{
	     if(type!="backEditor"&&type!="sendEditor")
		    alert("错误:\n"+erStr(out));
         else{  
           if(out=="-1"){
             alert("你没有此权限");
             return;
           }
            EditContent=out;
           var result = window.showEditorBBSTxt!=null&&showEditorBBSTxt.tagName=="DIV";

           if(result==false){
			    isCloseMangeMenu=0;
				$("bbsManageDiv").innerHTML="";                
	            str="<div id=\"showEditorBBSTxt\" name=\"showEditorBBSTxt\" style='border:solid 1px black'><div id=\"editTextDiv\" style=\"height:250px; width:600px\">";
	            str+="<iframe src=\"../system/editor/Editor.htm\" id=\"editTxtEditor\" name=\"editTxtEditor\" style=\"width: 100%; height: 100%\"";
	            str+="marginwidth=\"0\" marginheight=\"0\" align=\"top\" scrolling=\"no\" frameborder=\"0\"></iframe></div><div><div><input id=\"Button1\"";
	            str+="type=\"button\" value=\"保存\" onclick=\"saveEditor()\" />      <input id=\"Button1\" type=\"button\" value=\"取消\" onclick=\"clearEditor()\" /></div>";
                $("bbsManageDiv").style.display="block";
                $("bbsManageDiv").innerHTML=str;
	        }else
	            $("bbsManageDiv").style.display="block";
	        isClose=1;
		}
	}
}

function testKeydown(e){
    var objNode=null;
    if(e.srcElement){
        objNode=e.srcElement;
    }else{
        objNode=e.target;
    }
    if(e.keyCode==13)
        objNode.value=objNode.value+"<br>";        
}

//关闭编辑
function closMangeMenu(){
	if (isCloseMangeMenu==1&&$("bbsManageDiv").getAttribute("stop")!="1"){
		$("bbsManageDiv").style.display="none";
	}
}

//取消编辑
function clearEditor(){
   isClose=0;
   isCloseMangeMenu=1;
   $("bbsManageDiv").setAttribute("stop",0);
   setTimeout("closMangeMenu()",50)
}

//保存编辑的内容
function saveEditor(){
    var EditorTxt=editTxtEditor.Composition.document.body.innerHTML;  
    if(EditorTxt==""||EditorTxt==null){
      alert("你当前没有填写任何内容");      
    }else{
        var objAjax=new JAjax();
	    var objResponse=new JHttpResponse();
	    objResponse.write("manageID",manageID); 
	    objResponse.write("manageType",manageType);  
	    objResponse.write("operation","updateEditorTxt");  
	    objResponse.write("EditorTxt",EditorTxt);
	    var out=objAjax.getText("post",sysPath+"webServer.aspx?type=bbsManage",objResponse,null);
		if(out=="1"||out==""){
	        alert("成功");
	    }
	   location.reload();
	}
}

//引用
function QuoteRe(x){
	var d=document.getElementsByTagName("div");
	var c="";
	var idx=0;
	for(var i=0;i<d.length;i++){
		if(d[i].getAttribute("name")=="bbsBodyContent"){			
			if(idx==x){
				c=d[i].innerHTML;
				break;
			}
			idx+=1;
		}
	}
	c=c.replace(/<.*\/DIV>/g,"");
	c=c.replace(/<[^>]*>/g,"");
	c=c.replace(/\n/g," ");
	var d1=document.getElementsByTagName("span");
	var ck1="";
	idx=0;
	for(var i=0;i<d1.length;i++){
		if(d1[i].getAttribute("name")=="bbsDate"){			
			if(idx==x){
				ck1=d1[i].innerHTML;
				break;
			}
			idx+=1;
		}
	}
	var d2=document.getElementsByTagName("span");
	var ck2="";
	idx=0;
	for(var i=0;i<d2.length;i++){
		if(d2[i].getAttribute("name")=="lNum"){			
			if(idx==x){
				ck2=d2[i].innerHTML;
				break;
			}
			idx+=1;
		}
	}
	c="<b>"+ck1+"</b>"+ck2+" &nbsp;"+c;
	c="<div style='border:1px solid #2c3654;background-color:d6def6;padding:1px 5px 3px 5px;'>"+c+"</div>&nbsp;";
	editTxt.Composition.document.body.innerHTML=c;
}

//---------------------------------------------------------------------------------
function findBbsUser(uList,uid){ //取出用户的资料, 这是一个数组.
	var l=uList.length-1;
	for (var i=0;i<l;i++){
		if (uid==uList[i][0]){
			return uList[i];
		}
	}
	return null;
}

function displayBbsExinfo(obj){
	if (userInfoTempDiv!=null){
	  userInfoTempDiv.style.display="none"	;
	}	
	var nObj=obj.previousSibling;
	nObj.style.display="";
	userInfoTempDiv=nObj;
}

function closeBbsExinfo(obj){
	obj.style.display="none";
}

//---------------搜索的方法
 var objAjax=new JAjax();
 function bbsSearchList(obj){
   var bbskey=$("bbskey").value;//关键字
   if(bbskey==""||bbskey==null){
     alert("关键字不能够为空");
     $("bbskey").focus();
     return;
   }
   var out=objAjax.getText("post","goto.aspx?type=getBBsSearchTime",null,null);
   if(out!=""&&out!=null){    
        var nextTime=out;
        var jg=0;
        var d=new Date()
        var t=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
        var nextTimeArr=nextTime.split(':');
        var tArr=t.split(':');
        if(parseInt(parseInt(d.getHours())-parseInt(nextTimeArr[0]))>0){
          jg=parseInt(jg)+parseInt(parseInt(d.getHours())-parseInt(nextTimeArr[0]))*3600;
        }
        if(parseInt(parseInt(d.getMinutes())-parseInt(nextTimeArr[1]))>0){
           jg=parseInt(jg)+parseInt(parseInt(d.getMinutes())-parseInt(nextTimeArr[1]))*60;
        }
        if(parseInt(parseInt(d.getSeconds())-parseInt(nextTimeArr[2]))>0){
           jg=parseInt(jg)+parseInt(parseInt(d.getSeconds())-parseInt(nextTimeArr[2]))
        }
        if(parseInt(jg)<parseInt(obj.id)){  
          alert("系统设置"+obj.id+"秒内只能够做一次查询\n离上次查询只有"+jg+"秒\n请再次稍等"+(parseInt(obj.id)-parseInt(jg))+"秒后查询"); 
          return; 
       }
   }
  var bbsuser=$("bbsuser").value;//用户名
  var bbstime=document.getElementById("srchfrom").value;//搜索时间
  var bbstype=document.getElementById("orderby").value;//排序方式
  var menuid=document.getElementById("srchfid").value;
  if(menuid==""||menuid==null){
    alert("请选择搜索范围");
    return;
  }
  var lastCssstyle=document.getElementsByName("lastCssstyle");
  var bbsMenu="";//主题范围
  var searchbefore="";
  var ade="";
  for(var i=0;i<lastCssstyle.length;i++){
    if(lastCssstyle[i].checked){
      bbsMenu=lastCssstyle[i].value;
    }
  }
  //获取查询时间的前后
  var before=document.getElementsByName("before");
  for(var i=0;i<before.length;i++){
    if(before[i].checked){
      searchbefore=before[i].value;
    }
  }
  //获取排序方式
  var ascdesc=document.getElementsByName("ascdesc");
  for(var i=0;i<ascdesc.length;i++){
    if(ascdesc[i].checked){
      ade=ascdesc[i].value;
    }
  }
  var urlPath=window.location.href;
  if(urlPath.indexOf("?")!=-1){
     urlPath=urlPath.substring(0,urlPath.indexOf("?"));
  }  
  window.location.href=urlPath+"?syskey="+bbskey+"&bbsuser="+bbsuser+"&bbstime="+bbstime+"&bbstype="+bbstype+"&menuid="+menuid+"&bbsMenu="+bbsMenu+"&searchbefore="+searchbefore+"&ade="+ade;
 }
