function searchClass(){
    var objAjax=new JAjax();
    var myWeb=new myWebClass();
    var selFil=new Array();
    this.loadPageSearch=function(){
         var tools=new toolsClass();
	     tools.add("","删除所选","search.delMenu()","删除所选");
	     tools.add("","编辑","search.editorDate()","编辑");
	     tools.create(toolsDiv);
	     var key=urlPar("key");
         writeFettleLeft("提示:当前显示的是对关键字'"+key+"'的搜索结果"); //状态栏提示
     }  
    this.clickCheckBox=function(obj){//添加要删除的文章
         if(obj.checked){//添加一篇要操作的文章
               this.addDelFile(obj.id);
               this.chickChange();
         }
         else
         {
              this.moveDelFile(obj.id);
         }
    }
    this.addDelFile=function(obj){//添加一项
        selFil.push(obj);  
    }
    this.moveDelFile=function(obj){//删除指定项
        var l=selFil.length;
        for(var i=0;i<l;i++)
        {
            if(selFil[i]==obj)
            {
                selFil.splice(i,1);
                break;
            }
        }
    }
    this.delMenu=function(){
	    var delResoult=null;//删除的结果		   
	    if (selFil.length!=0){//删除文章开始
			 var fl=selFil;
			 var l=fl.length;
			 for (var i=0;i<l;i++){
				var objResponse=new JHttpResponse();
		        objResponse.write("id",fl[i]);	
		        var out=objAjax.getText("post","searchResoult.aspx?type=editorSys",objResponse,null);
			    if(out.indexOf(c1)>-1)
			    {
			         			       
		             var objResponse=new JHttpResponse();
		             var outSplit=out.split(c1);
		             var menuid=outSplit[0];
	        	     var id=outSplit[1];
	        	     var asTab=outSplit[2];
	        	     var menuName=outSplit[3];
	        	     if(this.isPop(menuid))
	        	     {
			            objResponse.write("menuid",menuid);
			            objResponse.write("fileidList",id);
			            objResponse.write("table",asTab);			
			            var out=objAjax.getText("post","mywebServer.aspx?type=delFiles",objResponse,null);
			            if (out=="OK"){
				            delResoult="删除成功";
			            }
			            else
			            { 
			                delResoult=out;
			            }
			        }
			    }
		    }
		}
		window.location.href=window.location.href;
	}
	this.isPop=function(menuid){//判断是否对栏目有管理权限
	    var objResponse=new JHttpResponse();
		objResponse.write("menuid",menuid);	
		var out=objAjax.getText("post","searchResoult.aspx?type=isPop",objResponse,null);
        if(out=="ok")
        {
         return true;
        }
        else
        {
         return false;
        }
	}
    this.editorDate=function(){//没有传入任何参数 则默认编辑最后一个  // 有参数则编辑指定的数据                          
		if(arguments.length==0)
		{   
		    var id=null;
		    if (id==null){
			    if (selFil.length!=0){
				    var fl=selFil;
				    l=fl.length-1;				  
				    id=fl[l];
			    }
		    }		   
		    if (id==null){
			    alert("请先选择一篇文章")
			    return ;
		    }
		    else
		    {
		       this.editorContent(id);
		    }
		}
		if(arguments.length==1)
		{
		   if(arguments[0].id!=null&&arguments[0].id!="")
		   {
		      this.editorContent(arguments[0].id);
		   }
		}
	}
	this.editorContent=function(obj){
	    if(obj!=null&&obj!="")
	    {
            var objResponse=new JHttpResponse();
            objResponse.write("id",obj);	
            var out=objAjax.getText("post","searchResoult.aspx?type=editorSys",objResponse,null);
    	    if(out.indexOf(c1)>-1)
    	    {
    	       var objnum=parent.win.objNum;
    	       var outSplit=out.split(c1);
    	       var menuid=outSplit[0];
    	       var id=outSplit[1];
    	       var asTab=outSplit[2];
    	       var menuName=outSplit[3];
    	       if(this.isPop(menuid)){
                  par="wNum="+objnum+"&pType=modi&menuid="+menuid+"&id="+id+"&asTab="+asTab
                  parent.win.pCreate("p-createData",par,"编辑信息-"+menuName);
               }
               else
               {
                  alert("你当前不具有编辑权限");
               }
            }
            else
            {
               alert(out);
            }
        }
	}
	this.loadMenuName=function(obj){//读取栏目信息
	    var objResponse=new JHttpResponse();
		objResponse.write("menuid",obj);	
		var out=objAjax.getText("post","searchResoult.aspx?type=readMenu",objResponse,null);
		document.write(out);
	}
	this.searchReserchMenu=function(obj){
	    var key=urlPar("key");
	    if(obj!=null&&obj!="")
	    {     var objnum=parent.win.objNum;
              par="key="+key+"&menuid="+obj;	
              parent.win.pCreate("p-searchResoult",par,"搜索结果",true);      
	    }
	}
	this.over=function(obj){
	   var haveJoin=selFil.join(',');
	   if(haveJoin.indexOf(obj.id)==-1)
	   {
	       var childs=obj.getElementsByTagName("td");
	       for(var i=0;i<childs.length;i++)
	       {
	          childs[i].className="M4F_1";
	       }
	   }
	}
	this.leave=function(obj){
	   var haveJoin=selFil.join(',');
	   if(haveJoin.indexOf(obj.id)==-1)
	   {
	       var childs=obj.getElementsByTagName("td");
	       for(var i=0;i<childs.length;i++)
	       {
	          childs[i].className="M4F";
	       }
	   }
	}
	this.chickChange=function(){
	    var trElement=document.getElementsByTagName("tr");
	    var haveJoin=selFil.join(',');
	    for(var i=0;i<trElement.length;i++)
	    {
            if(haveJoin.indexOf(trElement[i].id)>-1&&trElement[i].id>0)
            {  
               var childs=trElement[i].getElementsByTagName("td");              
               for(var j=0;j<childs.length;j++)
               {
                  childs[j].className="M4F_1";
               }
            }
	    }
	}	
	this.addSelChackBox=function(obj){	  
       var childs=obj.getElementsByTagName("input");
       for(var i=0;i<childs.length;i++)
       {
          childs[i].click();
       }
	}
	
  this.setWH=function(){ 	
	var w=Element.getWidth(winDiv)
	var h=Element.getHeight(winDiv)
	var h1=Element.getHeight(document.getElementById("toolsDiv"))
	var b=document.getElementById("bodyDiv");
	b.style.height=(h-h1-20)+"px";
	b.style.width=w+"px";
   }
}