var isLoadUser=0; //是否已经加载了用户资料
var EditContent="";//获取要编辑的内容
var isClose=0;

setRowColor=function(color1,color2)
{
	
	
	var objs=document.getElementsByName("bbsRowDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onmouseover=function(){
		    //alert(color1);
			this.style.backgroundColor=color2;
		}
		
		objs[i].onmouseout=function(){
			this.style.backgroundColor=color1;
		}
		
	}
	
	objs=document.getElementsByName("bbsMenuDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onclick=function(){
			var id=this.bbsid;
			var obj=$("bbsid"+id);
			if (obj.style.display==""){
				obj.style.display="none";
				this.innerHTML="<img src='img/collapsed_yes.gif'>";
			}else{
				obj.style.display="";	
				this.innerHTML="<img src='img/collapsed_no.gif'>";
			}
		}
	}
	
	
	
}

 function addVot(){    //加网站论坛调查选项
       var tempObj=$c("div");
       var obj=$("votDiv");
       var newObj=obj.appendChild(tempObj);
       newObj.style.cssText="width:100%;";
       obj=newObj;
       obj.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.type="text";
       var textObj=newObj.appendChild(tempObj);
       textObj.style.cssText="width:120px;height:20px;"
       textObj.id="bbsVotText";
       textObj.name="bbsVotText";
       
       tempObj=$c("input");
       tempObj.type="button";
       tempObj.value="删除"
       var buttonObj=newObj.appendChild(tempObj);
       buttonObj.style.cssText="width:40px;height:20px;"
       buttonObj.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";
   }
   
  // alert(prefixText);
   
	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(){
            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;
        }
        
        objs[i].onmouseout=function(){
             this.style.color=colorBak;
            this.style.backgroundColor=bgColorBak;
            this.style.border=bColorBak;
        }
    }
}

   
   
function bbsRePostSubmit(){ //发表回复
	//var menuid=;
	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,"../")
    
    //str="sPath=//g"
	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 readBbsUserInfo(){
    setContImg();
}


var uinfoList=null;
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].innerText+",")==-1){
			uList=uList+uObjs[i].innerText+",";
		}
	}
	
	if (uList==","){
		return;
	}
//	return;
	
   var w=Element.getWidth(uObjs[0]);
	//alert(w);
	
	var objAjax=new JAjax();
	var objResponse=new JHttpResponse();
	objResponse.write("uList",uList);  
	//alert(uList);
	var out=objAjax.getText("post",sysPath+"webServer.aspx?type=bbsReadUser",objResponse,null);
//				id,UserName,userPhoto,LevelName,GroupName,Count_Comment,Integral_Total,Date_Login,Count_Login,RegDate,IsLocked,idiograph ,sex,Money,Integral_Base,Integral_Expert 
//              id, 用户名   用户头像   级别名  组名       发的主题数   总积分      最后登录日期 登录次数    注册日期  是否锁定 签名    ,  性别 金钱     基本分       专家分
//               0,   1          2        3       4            5           6               7        8           9         10      11          12  13    14                  15
	
	out=comminute(out,c1,c2);
	uinfoList=out;
	var uid=""
	var html="";
	var h,y,x;
	for (var i=0;i<l;i++ ){
		uid=uObjs[i].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;display:none;padding:5px;width:380px;height:145px;position:absolute;top:"+y+"px;left:"+x+"px;z-index:1;background-color:#ffffff;'>";


			html="<div onmouseout='closeBbsExinfo(this)'   style='border: 1px solid #C0C0C0;display:none;padding:5px;width:380px;height:145px; position:absolute;z-index:1;background-color:#ffffff;top:0px;left:0px'>";
			html=html+"<div style='width:150px;height:130px;float:left;'>";
			html+="<b> "+uInfo[1]+"</b><br>";
			html=html+""+uInfo[3]+"<br>"
			html=html+"<div style='width:130px;text-align:center;height:90px;overflow:hidden;border:1px solid #c0c0c0;background-color:#f9f9f9;'><img   onerror='userImgErr(this)' onload=setImgWH(this);  sex='"+uInfo[12]+"'  src='"+uInfo[2]+"' id='uImg' name='uImg'></div>";
			html=html+"</div><div style='width:170px;height:130px;float:left;' >";
			html=html+"总积分:"+uInfo[6];
			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:"+(w-10)+"px;'><b> "+uInfo[1]+"</b><br>";
			html=html+""+uInfo[3]+"<br>"
			html=html+"<div style='width:130px;text-align:center;height:90px;overflow:hidden;border:1px solid #c0c0c0;background-color:#f9f9f9;'><img onerror='userImgErr(this)' onload=setImgWH(this); sex='"+uInfo[12]+"'  src='"+uInfo[2]+"' id='uImg' name='uImg'></div>";
			html=html+"</div>";
			uObjs[i].innerHTML=html;
			//uObjs[i].style.overflow="hidden";
			uObjs[i].style.width=w;
			
			
			idiogrObjs[i].innerHTML=uInfo[11];
			
		}else{
			uObjs[i].innerHTML="用户不存在";
		}
		h=Element.getHeight(bodyObjs[i]);
		uObjs[i].style.height=h;
		
	}	
    			
	//setTimeout("setUserImg()",2000);
	setTimeout("setManageDiv()",60);
	
    //需要同步的文件
    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);
	    //alert(out);
	}

}


//var pageImgCount=0; 在PAGE.JS中已定义
//var pageLoadImg=0;
//var errFile="";

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";
	    //return;
		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++
   alert(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";
	}
	// alert(pageLoadImg);
   // alert(imgObj.fileSize+"|"+imgObj.src);
    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)
//   }
		    
}
		

/*

	var objAjax=new JAjax();
	var objResponse=new JHttpResponse();
	if (imgs[x].fileSize==-1){
		alert(imgs[x].src);
		objResponse.write("file"+y,imgs[x].src); 
		y=y+1;
	}

	if (y>0){
			objResponse.write("count",y);
			var out=objAjax.getText("post",sysPath+"webServer.aspx?type=downImgFile",objResponse,null);
			alert(out);
			//return;
	}
	*/


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加事件
	var objs=document.getElementsByName("manageDiv");
		//alert("");
	for (var i=0;i<objs.length;i++){
		objs[i].onmouseover=function(){
			manageID=this.rid;
			isCloseMangeMenu=0;
			if (this.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=$("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 closMangeMenu(){
	if (isCloseMangeMenu==1){
		$("bbsManageDiv").style.display="none";
	}
}

function addMainManage(thisObj){  //创建主题管理选项
	if(parseInt(isClose)==0)
	{
	    if (userIsAdmin=="0"){return;}
	    var mObj=$("bbsManageDiv");
	    mObj.innerHTML="";

	    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.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.mType="setAllTop";
    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="设为置顶";
	    obj.mType="setTop";

    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="取消置顶";
	    obj.mType="delTop";
    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="设为精华";
	    obj.mType="setElite";
    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="取消精华";
	    obj.mType="delElite";
    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="删除";
	    obj.mType="delete";

    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="锁定";
	    obj.mType="locked";
    	
	    obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="解锁";	
	    obj.mType="unLocked";
    	
	    obj=cObj(mObj,"div");
        obj.id="bbsManageOption";
        obj.name="bbsManageOption";
        obj.innerHTML="编辑";	
        obj.mType="sendEditor";
    	
	    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="";

	    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.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="删除";
	    obj.mType="delete";
	    
        obj=cObj(mObj,"div");
	    obj.id="bbsManageOption";
	    obj.name="bbsManageOption";
	    obj.innerHTML="编辑";	
	    obj.mType="backEditor";
	    
	    var objs=document.getElementsByName("bbsManageOption");
	    for (var i=0;i<objs.length;i++){
		    objs[i].onclick=function(){
			    execManage(this);
		    }
	    }
	}
}

function execManage(obj){ //执行管理选项
	//alert(obj.mType);
	var type=obj.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.innerText)
		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)
           {
                $("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";
	        }
	       // getEditorTxt=out;
	        isClose=1;
	        //setTimeout("stopTime()",1000);
		}
	}
}
function clearEditor()
{
   isClose=0;
   isCloseMangeMenu=1;
   setTimeout("closMangeMenu()",50)
}
function  stopTime()
{
    editTxtEditor.Composition.document.body.innerHTML=getEditorTxt;
}
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")
	    {
	     alert("成功");
	    }
	    location.href=location.href;
	}
}
//---------------------------------------------------------------------------------
function findBbsUser(uList,uid){ //取出用户的资料, 这是一个数组.
		var l=uList.length-1;
		for (var i=0;i<l;i++){
			//alert(uList[i][0]);
			if (uid==uList[i][0]){
				return uList[i];
			}
		}
		return null;
}

	
function	displayBbsExinfo(obj){
    var x=getLeft(obj);
    var y=getTop(obj);
	if (userInfoTempDiv!=null){
	    userInfoTempDiv.style.position="absolute";
	    userInfoTempDiv.style.top=y;
	    userInfoTempDiv.style.left=x;

	  userInfoTempDiv.style.display="none"	;
	}
	
	var nObj=obj.previousSibling;
	
	userInfoTempDiv=nObj;
	userInfoTempDiv.style.position="absolute";
    userInfoTempDiv.style.top=y;
	userInfoTempDiv.style.left=x;
	nObj.style.display="";
	//alert(nObj.outerHTML);
	var img=userInfoTempDiv.getElementsByTagName("img")[0];
	img.src=img.src;
	//setImgWH(img);
	
}


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


function QuoteRe(x){
	var objs=document.getElementsByName("bbsBodyContent");
	var dObjs=document.getElementsByName("bbsDate");
	var lObjs=document.getElementsByName("lNum");
	
	var c=objs[x].innerHTML;
	c=c.replace(/<.*\/DIV>/g,"");
	c=c.replace(/<[^>]*>/g,"");
	c=c.replace(/\n/g," ");
	//alert(c);
	c="<b>"+lObjs[x].innerText+"</b>"+dObjs[x].innerText+" &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;
	
}
//---------------搜索的方法
    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;
 }
//--------------------------

