function CPageHome(library, styles)
{
  this.prototype = new CPage();
  CPage.call(this, library);

  var thisPtr = this;

  this.library = library;
  this.styles = styles;

  this.renderWorksByTable = function(destId, resource, filter)
  {
    var len;
    var node;

    node = thisPtr.library.getElementByIdEx(destId);
    node.innerHTML = "";

    var oTableTop;
    var oTableBottom;
    var rowCount;
    var oRow;
    var oColTop;
    var oColBottom;
    var oCol;

    oTableTop = document.createElement("Table");
    oTableTop.border = "0";
    oTableTop.cellSpacing = "0";
    oTableTop.cellPadding = "0";

    rowCount = oTableTop.rows.length;
    oRow = oTableTop.insertRow(rowCount);

    oColTop = oRow.insertCell(0);
    oColTop.vAlign = "top";
    oColTop.align = "left";
    oColTop.style.margin = "0px";
    oColTop.style.padding = "0px";
    oColTop.colSpan = "9";

    oTableBottom = document.createElement("Table");
    oTableBottom.border = "0";
    oTableBottom.cellSpacing = "0";
    oTableBottom.cellPadding = "0";

    rowCount = oTableBottom.rows.length;
    oRow = oTableBottom.insertRow(rowCount);

    var count = 0;
    var rowNum = 0;

    len = resource.length;
     
    for (var i = 0; i < len; i++)
    {
      if (resource[i].Category == filter || filter == g_enumCategory.AllWorks)
      {
        if (count == 9 || count == 0)
        {
          rowNum++;

          if (i < len)
          {
            rowCount = oTableBottom.rows.length;
            oRow = oTableBottom.insertRow(rowCount);

            if (count == 9)
            {
              oColBottom = oRow.insertCell(0);
              oColBottom.vAlign = "top";
              oColBottom.align = "left";
//              oColBottom.height = "32px";
              oColBottom.style.padding = "0px 0px 0px 0px";
              oColBottom.colSpan = "9";

              rowCount = oTableBottom.rows.length;
              oRow = oTableBottom.insertRow(rowCount);

              break;
            }
          }

          count = 0;
        }

        oColBottom = oRow.insertCell(count);
        oColBottom.vAlign = "top";
        oColBottom.align = "left";
        oColBottom.style.margin = "0px";
        oColBottom.style.padding = "0px 0px 0px 0px";

        thisPtr.createThumbTable(oColBottom, resource[i], thisPtr.styles, 0, g_enumMenuItem.Work, resource[i].Category);
        count++;

        if (count < 8 && i != len - 1)
        {
          oCol = oRow.insertCell(count);
          oCol.vAlign = "top";
          oCol.align = "left";
          oCol.width = "21";
          oCol.style.margin = "0px";
          oCol.style.padding = "0px 0px 0px 0px";
          count++;
        }          
      }
    }

    node.appendChild(oTableTop);
    node.appendChild(oTableBottom);
  }

  this.renderWorks = function(destId, resource, filter)
  {
    var len;
    var node;

    node = thisPtr.library.getElementByIdEx(destId);
    node.innerHTML = "";

    len = resource.length;
        
    for (var i = 0; i < len; i++)
    {
      if (resource[i].Category == filter)
      {
        thisPtr.createThumbTable(node, resource[i], thisPtr.styles, 0, g_enumMenuItem.Work);
      }
    }
  }
}
