  //*************************************************************************//
  //  ModuleName  : Deco_Category.js                                         //
  //                                                                         //
  //  Last Update : 2004_04_09 by tews                                       //
  //*************************************************************************//
  //  History                                                                //
  //      2004_04_09  :                                                      //
  //      2004_05_07  : Category align support                               //
  //      2004_05_13  : all update                                           //
  //      2004_12_09  : URL Link Support                                     //
  //      2005_03_15  : rollover image cheng bug fix. //Yu, hwasun           //
  //*************************************************************************//

  function Category2() {
    this.id               = "oCategory2";
    try{
      this.ParentDiv      = arguments[0];
      this.TextColor      = arguments[1];  // Contents text color
      this.BGOverColor    = arguments[2];  // Contents area background color :  mouse over
      this.BGOutColor     = arguments[3];  // Contents area background color :  mouse out/default
      } catch (e){
      }             
    this.oBookInfo        = oBookInfo;
    this.oBaseDivC        = null;
    this.dcInitial        = dcInitial;
    this.sCacheBasePath   = gsSrv_Cache +   gsPort +  gsSlash  + oDecoder2.cdeGetPathInfo(0);
    this.Cate_Bullet      = "";

    if(ga_Category.length) {
      this.dcInitial();
    }
  }

  function dcInitial() {

    this.ParentDiv.style.position = "relative";

    if (String( this.TextColor   )  == "undefined" ) { this.TextColor   = "black"  ; }
    if (String( this.BGOverColor )  == "undefined" ) { this.BGOverColor = ""  ; }
    if (String( this.BGOutColor  )  == "undefined" ) { this.BGOutColor  = ""  ; }

    var tmpBaseTABLE = document.createElement("TABLE");
    this.ParentDiv.appendChild(tmpBaseTABLE) ;
    tmpBaseTABLE.outerHTML = "<Table id=\"oBaseDivC\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"></table>";
    this.oBaseDivC  = oBaseDivC ;

    delete tmpBaseTABLE ;       

    var oRow      = this.oBaseDivC.insertRow();
    oRow.height   = ga_Category[0][2];
    oRow.bgColor  = this.BGOutColor;

    //Is Bullet?
    if(gi_Cate_Bullet){
      var iNodeIndex = 1;
      this.Cate_Bullet =  "<img src=\"" +   gsProtocol + this.sCacheBasePath + gsSlash + "thumbnails"  + gsSlash + gi_Cate_Bullet  + "\" borcer=0>";
      
    }else{
      var iNodeIndex = 0;
      this.Cate_Bullet =  "";
    }

    //Category Text
    if(gi_Cate_Img){
      var sImageBaseURL = gsProtocol + this.sCacheBasePath + gsSlash + "thumbnails"  + gsSlash;

      for(var iIdx=0 ; iIdx < ga_Category.length ;iIdx++) {
        var oCell = oRow.insertCell();

        with(oCell) {
          align         = "center";
          width         = ga_Category[iIdx][1];
          style.cursor  = "hand";

          // 2004_12_09 by tews for URL Link 
          switch (typeof(ga_Category[iIdx][0])) {
            case "string" : 
                            onclick     = new Function("CategoryOnClick('" + ga_Category[iIdx][0] + "')");
                            break;
            case "number" : 
                            onclick     = new Function("CategoryOnClick(" + ga_Category[iIdx][0] + ")");
                            break;
          } 
  

          innerHTML     = this.Cate_Bullet + "<img src=\"" +  sImageBaseURL + ga_Category[iIdx][3]  + "\" border=\"0\">";
          if(ga_Category[iIdx][4]) {
            childNodes(iNodeIndex).onmouseover = new Function("this.src='" + sImageBaseURL + ga_Category[iIdx][4] + "'");
            childNodes(iNodeIndex).onmouseout  = new Function("this.src='" + sImageBaseURL + ga_Category[iIdx][3] + "'");
          }
        }
      }
    //Category Image
    }else{
      for(var iIdx=0 ; iIdx < ga_Category.length ;iIdx++) {
        var oCell = oRow.insertCell();

        with(oCell) {
          align       = "center";
          width       = ga_Category[iIdx][1];
          onmouseover = new Function("this.style.fontWeight='bold';this.style.backgroundColor='" + this.BGOverColor + "'");
          onmouseout  = new Function("this.style.fontWeight='normal';this.style.backgroundColor='" + this.BGOutColor + "'");

          // 2004_12_09 by tews for URL Link 
          switch (typeof(ga_Category[iIdx][0])) {
            case "string" : 
                            onclick     = new Function("CategoryOnClick('" + ga_Category[iIdx][0] + "')");
                            break;
            case "number" : 
                            onclick     = new Function("CategoryOnClick(" + ga_Category[iIdx][0] + ")");
                            break;
          } 
          innerHTML = this.Cate_Bullet + ga_Category[iIdx][3];
          with(style) {
            color = this.TextColor;
            fontSize = "9pt";
            padding = "0 2";
            cursor = "hand";
          }
        }

        if(!this.Cate_Bullet){
          if(iIdx < (ga_Category.length-1)){
            var oCell2 = oRow.insertCell();
            oCell2.innerHTML = "<font color=\"#999999\">|</font>";
            oCell2.width = 10;
          }                
        }             
      }
    }
  }

  // 2004_12_09 by tews for URL Link 
  function CategoryOnClick() {
    switch (typeof(arguments[0])) {
      case "undefined"  : 
                          break;
      case "string"     :
                          window.open(arguments[0],gsDefaultWndStyle) ;
                          break;   
      default           : 
                          oBook.GotoPage(arguments[0]) ;
                          break;
    }
  }



  

