﻿
 function HotShow(t)
 {
   for(var i=0;i<IDs.length;i++)
   {
    $("ShowDiv"+IDs[i]).style.display="none";
   }
   $("ShowDiv"+t).style.display="";
   
   GetFeature(t);

 }
 
 function ShowCategory(t,id,count)
 {
   var CateDiv=$("CateList");
   var BCateLi=$("BCate"+id);
   
   if(t==1 && count>0)
   {
   
     var x=GetObj_X(BCateLi);
     var y=GetObj_Y(BCateLi);
  
     CateDiv.style.display="";
     SetPosition(CateDiv,x+200,y-3);
     
     SCateList(id);
     
   }
   else
   {
    CateDiv.style.display="none";
   }
   
   
 }
 
function ShowC(t)
{
   var CateDiv=$("CateList");
   
   if(t==1)
   {
     CateDiv.style.display="";
   }
   else
   {
    CateDiv.style.display="none";
   }
}
 
 function SetPosition(obj,x,y)
 {
    obj.style.left=x+"".replace("px","");
    obj.style.top=y+"".replace("px","");
 }
 
 
 function ShowCateList(id,title)
 {
   var obj=$("CList"+id);
   
  if(obj.style.display=="")
  {
   obj.style.display="none";
  }
  else
  {
   obj.style.display="";
   GetCateIDs(obj);
  }

  LoadCate(id, 5, title);
  
 }
 
 function GetCateIDs(id)
 {
  var obj = $("CategoryTD").getElementsByTagName("div");
  
  for(var i=0;i<obj.length;i++)
  {
   obj[i].style.display="none";
  }
  
  id.style.display="";
  
 }
 
 
    var _BCateID=0;
    var _CateID=0;
    var _Price=0;
    
    function SCateList(ParentID)
     {  
        $("CListUL").innerHTML="Load...";
        this.ExecFun="_SCateList";      
        this.Query=new Array( ParentID+"" );
	    ExecAJ("CategoryByParentID");
     }
     
    function _SCateList()
     {
        $("CListUL").innerHTML=this.ReStr;
    }

    function SetV(title) {

        $("CT1").innerHTML = title;
        $("CT2").innerHTML = title;
    
    }
    
    function ShowProductList(t)
    {
      this.OrderType=t;
      this.IsLoad = false;
      LoadProductList(1);
    }
    
    function SBCateID()
    {
      SetPoint("SearchBCateID", "SearchBCateIDList", -2, 24);
      $("SearchCateIDList").style.display="none";
      $("SearchPriceList").style.display="none";
    }
    
    function SCateID()
    {
      if(this._BCateID>0)
      {
      this.ExecFun="_SCateID";     
      this.Query=new Array
            (
             this._BCateID+""
	        );
	        	        
	    ExecAJ("CategoryBySearch");

      $("SearchPriceList").style.display="none";
      $("SearchBCateIDList").style.display="none";
      }
    }
    
    function _SCateID()
    {
      if(this.ReStr!="")
      {
      SetPoint("SearchCateID", "SearchCateIDList", -2, 24);
      
      $("SearchCateIDList").innerHTML="<ul>"+this.ReStr+"</ul>";
      }
      else
      {
       alert("该项没有数据!");
      }
    }
   
    
    function SPrice()
    {
      SetPoint("SearchPrice", "SearchPriceList", -2, 24);
      $("SearchCateIDList").style.display="none";
      $("SearchBCateIDList").style.display="none";
    }
    
    function SValue(title,id,ParentID)
    {
     if(ParentID!=0)
     {
     this._BCateID=ParentID;
     this._CateID=id;
     
      $("SearchCateID").innerHTML=title;
     $("SearchCateIDList").style.display="none";
     }
     else
     {
      this._BCateID=id;
      this._CateID=0;
      $("SearchBCateID").innerHTML=title;
     $("SearchBCateIDList").style.display="none";
     $("SearchCateID").innerHTML="请选择小类";
     
     }
    
    }
    
    function SPriceV(t,title)
    {
     this._Price=t;
     $("SearchPrice").innerHTML=title;
     $("SearchPriceList").style.display="none";
    }
    
    function HideDiv(id)
    {
   //  $(id).style.display="none";
    }
    
    function QuickSearch()
    {
            this.SoTitle = this._BCateID+"|"+this._CateID+"|"+this._Price+"|"+trim($("SearchNameV").value.replace("输入产品名",""))
            this.SearchType = "-1";
            this.IsLoad=false;
            LoadProductList(1);     
    }
    
    function ClearSearch()
    {
        this._BCateID=0;
        this._CateID=0;
        this._Price=0;
        $("SearchCateIDList").style.display="none";
        $("SearchBCateIDList").style.display="none";
        $("SearchPriceList").style.display="none";
        
        $("SearchBCateID").innerHTML="请选择大类";
        $("SearchCateID").innerHTML="请选择小类";
        $("SearchPrice").innerHTML="请选择价格";
        $("SearchNameV").value="输入产品名";
    }
    
    
    
    var FeatureCateID=0;
    function GetFeature(CateID)
     {
        this.ExecFun="_GetFeature";
        this.FeatureCateID=CateID;
        
        if($("Feature"+CateID).innerHTML=="")
        {
            
            
            this.Query=new Array
                (
                 CateID+""
	            );
    	        	        
	        ExecAJ("Feature");
	    }
     }
     
    function _GetFeature()
     {
        $("Feature"+this.FeatureCateID).innerHTML = this.ReStr;
     }
     
     var IsShow=true;
     function ShowFeature(id)
     {

      SetPoint2("FeatureShowDiv"+id,"FeatureDescDiv",-325,15);
      
      $("FeatureDescDiv").innerHTML=$("FeatureDesc"+id).innerHTML;
      
      IsShow=true;
      
     }
     
     function HideFeature(t)
     {
       if(t==0)
       {
         IsShow=false;
         setTimeout("_HideFeature()",1000);
       }
       else
       {
        $("FeatureDescDiv").style.display="";
        IsShow=true;
       }
     }
     
     function _HideFeature()
     {
      if(IsShow==false)
      {
      $("FeatureDescDiv").style.display="none";
      }
     
     }
     
    
    

