﻿window.ComponentArt_Grid.prototype.Render = function(bSkipHeader) {
    this.OldFrameHeight = this.qzmt ? this.qzmt: -1;
    this.OuterFrameDomObj = document.getElementById(this.Id + '_table');
    this.FrameDomObj = document.getElementById(this.Id + '_dom');

    this.FooterDomObj = document.getElementById(this.Id + '_footer');
    this.HeaderDomObj = document.getElementById(this.Id + '_header');
    this.ScrollDomObj = document.getElementById(this.Id + '_scroll');
    var actualWidth = this.OuterFrameDomObj.offsetWidth;
    if (this.ScrollDomObj) {
        this.ScrollDomObj.innerHTML = '';
    };
    if (this.FillContainer && this.OuterFrameDomObj) {
        if (this.FrameDomObj) this.FrameDomObj.style.height = '';
        var qzmt;
        if (this.OuterFrameDomObj.parentNode.style.height.indexOf('px') > 0) {
            qzmt = parseInt(this.OuterFrameDomObj.parentNode.style.height);
        } else {
            qzmt = this.OuterFrameDomObj.parentNode.offsetHeight;
        };
        var qzoz;
        if (this.OuterFrameDomObj.parentNode.style.width.indexOf('px') > 0) {
            qzoz = parseInt(this.OuterFrameDomObj.parentNode.style.width);
        } else {
            qzoz = this.OuterFrameDomObj.parentNode.offsetWidth;
        };
        qzoz = ComponentArt_GetAdjustedWidth(this.OuterFrameDomObj, qzoz);
        qzmt = ComponentArt_GetAdjustedHeight(this.OuterFrameDomObj, qzmt);
        if (qzoz >= 0 && qzmt >= 0) {
            var widthDiff = qzoz - actualWidth;
            if (widthDiff != 0) {
                this.RedistributeWidth(this.Levels[0], this.Levels[0].Table.Columns, this.Levels[0].Table.ColumnDisplayOrder, widthDiff, 0);
            };
            this.OuterFrameDomObj.style.height = qzmt + 'px';
            this.OuterFrameDomObj.style.width = qzoz + 'px';
            this.ConstantWidth = this.OuterFrameDomObj.offsetWidth;
            this.qzmt = qzmt;
            this.qzoz = qzoz;
        };
    };
    this.StyleInfo = new Object();
    if (this.FillContainer && this.AutoAdjustPageSize && this.OldFrameHeight != this.qzmt) {
        var domObj = document.createElement('div');
        domObj.style.position = 'absolute';
        domObj.style.visibility = 'hidden';
        domObj.style.left = '0px';
        domObj.style.top = '0px';
        var qza = ["<table cellpadding=0 cellspacing=0 border=0 cellspacing=\"" + this.CellSpacing + "\"><tbody>"];
        this.RenderDataTable(qza, [], this.Table, 0, 1);
        qza[qza.length] = '</tbody></table>';
        domObj.innerHTML = qza.join('');
        document.body.insertBefore(domObj, document.body.firstChild);
        var gridItemHeight = domObj.firstChild.firstChild.lastChild.offsetHeight,
        totalHeight = this.qzmt;
        if (this.FooterDomObj) totalHeight -= this.FooterDomObj.offsetHeight;
        if (this.HeaderDomObj) totalHeight -= this.HeaderDomObj.offsetHeight;
        totalHeight -= (domObj.firstChild.offsetHeight - gridItemHeight);
        qzff(domObj);
        var newPageSize = Math.floor(totalHeight / gridItemHeight);
        if (this.Levels.length > 0 && this.Levels[0].NumGroupings > 0) {
            this.GroupingPageSize = newPageSize;
        } else {
            this.PageSize = newPageSize;
        };
        this.PageCount = Math.ceil(this.RecordCount / this.PageSize);
        var selectedItems = this.GetSelectedItems();
        if (selectedItems.length > 0) {
            this.CurrentPageIndex = selectedItems[selectedItems.length - 1].PageIndex;
        } else {
            this.CurrentPageIndex = 0;
        };
    };
    var pageSize = (this.Levels.length > 0 && this.Levels[0].NumGroupings > 0 ? this.GroupingPageSize: this.PageSize),
    iNumRows = this.Table.GetRowCount(),
    startRow = 0;
    if (this.RunningMode == cart_grid_mode_client) {
        if (this.RecordOffset >= 0) {
            startRow = this.RecordOffset;
        } else {
            startRow = this.CurrentPageIndex * pageSize;
        };
        if (startRow >= iNumRows) startRow = 0;
    };
    if (this.Levels.length > 0) {
        var qza = ["<table style=\"width:100%;\" cellpadding=\"0\" cellspacing=\"" + this.CellSpacing + "\" border=\"0\"><tbody>"];
        this.RenderDataTable(qza, [], this.Table, startRow, pageSize);
        qza[qza.length] = "</tbody></table>";
        if (this.AllowHorizontalScrolling && cart_browser_ie) {
            qza[qza.length] = '<div style="height:16px;overflow:hidden;">&nbsp;</div>';
        };
        this.FrameDomObj.innerHTML = qza.join('');
    };
    if (this.NoRenderHeader) {
        this.NoRenderHeader = false;
        bSkipHeader = true;
    };
    if (this.ShowHeader && this.HeaderDomObj && !bSkipHeader) {
        this.RenderHeader(this.HeaderDomObj);
    };
    if (this.ShowFooter && this.FooterDomObj) {
        this.RenderFooter(this.FooterDomObj);
    };
    if (this.DomIdToExpand) {
        var qg14 = document.getElementById(this.DomIdToExpand);
        this.DomIdToExpand = null;
        ComponentArt_Grid_Expand(this, qg14);
    } else if (this.GroupToExpand) {
        var qg14 = document.getElementById(this.GroupToExpand);
        this.GroupToExpand = null;
        ComponentArt_Grid_ExpandGroup(this, qg14);
    };
    if (this.ScrollDomObj) {
        this.RenderScroll(this.ScrollDomObj);
    };
    if (this.ShowSearchBox && this.AutoFocusSearchBox) {
        setTimeout(this.Id + '.FocusSearchField()', 250);
    };
};
window.ComponentArt_Grid.prototype.RenderAddingRow = function(qza, arFamily, table) {
    var qg21 = this.Levels[table.Level],
    qzdm = qg21.SelectedRowCssClass;
    qza[qza.length] = '<tr id="' + this.Id + '_addingRow"';
    if (qzdm) {
        qza[qza.length] = " class=\"" + qzdm + "\"";
    };
    qza[qza.length] = ">";
    this.RenderColumnHeadingMargin(qza, arFamily, table);
    for (var qzAde = 0; qzAde < table.ColumnDisplayOrder.length; qzAde++) {
        var colNum = table.ColumnDisplayOrder[qzAde];
        qza[qza.length] = '<td align="center"><input onsubmit="return false;" onkeypress="' + this.Id + '.AddRowKeyPress(event,this);" type="text" style="width:' + table.Columns[colNum].Width + 'px;"></td>';
    };
};
window.ComponentArt_Grid.prototype.RenderColumnHeadings = function(qza, arFamily, table) {
    var qg21 = this.Levels[table.Level],
    qg7 = false,
    sHeadingRowId = this.Id + '_' + (table.Path.length > 0 ? table.Path.join('_') : 'top') + '_head';
    qza[qza.length] = "<tr id=\"" + sHeadingRowId + "\"";
    if (qg21.HeadingRowCssClass) {
        qza[qza.length] = " class=\"" + qg21.HeadingRowCssClass + "\"";
    };
    qza[qza.length] = ">";
    this.RenderColumnHeadingMargin(qza, arFamily, table);
    for (var qzba = 0; qzba < table.ColumnDisplayOrder.length; qzba++) {
        var colNum = table.ColumnDisplayOrder[qzba],
        qg15 = table.Columns[colNum],
        cssClass = qg21.HeadingCellCssClass ? qg21.HeadingCellCssClass: '';
        if (qg15.HeadingCellCssClass) {
            cssClass += " " + qg15.HeadingCellCssClass;
        };
        if (qg21.IndicatedSortColumn == qg15.ColumnNumber && qg15.SortedHeadingCellCssClass) {
            cssClass += " " + qg15.SortedHeadingCellCssClass;
        };
        qg15.EffectiveCssClass = cssClass;
        var sortIcon = null;
        if (qg21.IndicatedSortColumn == qg15.ColumnNumber) {
            if (qg21.IndicatedSortDirection == 0) {
                sortIcon = qg21.SortAscendingImageUrl;
            } else {
                sortIcon = qg21.SortDescendingImageUrl;
            };
        };
        qza[qza.length] = "<td align=\"" + qg15.Align + "\"";
        qza[qza.length] = " onclick=\"" + this.Id + ".ClickHandler(event,this," + colNum + "," + table.Level + ")\"";
        qza[qza.length] = " ondblclick=\"" + this.Id + ".DblClickHandler(event,null," + colNum + "," + table.Level + ")\"";
        qza[qza.length] = " onmousemove=\"" + this.Id + ".MoveHandler(event,this," + qzba + "," + table.Level + ")\"";
        if (qg21.HeadingCellHoverCssClass) {
            qza[qza.length] = " onmouseover=\"" + this.Id + ".OverHandler(event,this," + table.Level + ")\"";
            qza[qza.length] = " onmouseout=\"" + this.Id + ".OutHandler(event,this," + table.Level + ")\"";
        };
        qza[qza.length] = " onmousedown=\"" + this.Id + ".DownHandler(event,this," + colNum + "," + table.Level + ")\"";
        qza[qza.length] = " onmouseup=\"" + this.Id + ".UpHandler(event,this," + colNum + "," + table.Level + ")\"";
        if (qg15.Width > 0) {
            qza[qza.length] = " style=\"width:" + qg15.Width + "px;\"";
        } else {
            qg7 = true;
        };
        if (cssClass) {
            qza[qza.length] = " class=\"" + cssClass + "\"";
        };
        qza[qza.length] = "><div style=\"text-align:" + qg15.Align + ";overflow:hidden;text-overflow:ellipsis;";
        if (qg15.Width > 0) {
            qza[qza.length] = "width:" + qg15.Width + "px;";
        };
        qza[qza.length] = "\">" + this.GetHeaderCellContent(qg21, qg15, sortIcon) + "</div></td>";
    };
    qza[qza.length] = "</tr>";
    return qg7;
};
window.ComponentArt_Grid.prototype.RenderColumnHeadingMargin = function(qza, arFamily, table) {
    var qg21 = this.Levels[table.Level];
    for (var qzba = 0; qzba < arFamily.length; qzba++) {
        var ancestor = arFamily[qzba];
        this.RenderIndentCell(qza, !ancestor.LastInPage);
        if (ancestor.constructor == ComponentArt_GridItem && this.Levels[ancestor.Level].ShowSelectorCells) {
            this.RenderIndentCell(qza, false);
        };
    };
    for (var qzba = 0; qzba < qg21.NumGroupings; qzba++) {
        this.RenderIndentCell(qza, false);
    };
    if (this.SelfReferencing || this.Levels.length > 1) {
        qza[qza.length] = "<td class=\"" + qg21.HeadingSelectorCellCssClass + "\" width=\"" + this.IndentCellWidth + "\"><div style=\"width:" + this.IndentCellWidth + "px;\">&nbsp;</div></td>";
    };
    if (qg21.ShowSelectorCells) {
        qza[qza.length] = "<td class=\"" + qg21.HeadingSelectorCellCssClass + "\" width=\"" + qg21.SelectorCellWidth + "\"><div style=\"width:" + qg21.SelectorCellWidth + "px;\">&nbsp;</div></td>";
    };
};
window.ComponentArt_Grid.prototype.RenderDataCell = function(qza, row, col) {
    var level = row.Level,
    qg21 = this.Levels[level],
    qg28 = qg21.DataCellCssClass ? qg21.DataCellCssClass: '',
    qg15 = qg21.Table.Columns[col],
    qg12 = row.Cells[col],
    qg30 = row.qg10,
    bIsEditing = this.EditingId && this.EditingId == row.ClientId;
    if (qg15.DataCellCssClass) {
        qg28 += " " + qg15.DataCellCssClass;
    };
    if (qg15.SortedDataCellCssClass && qg21.IndicatedSortColumn == col) {
        qg28 += " " + qg15.SortedDataCellCssClass;
    };
    if (bIsEditing && qg15.EditCellCssClass) {
        qg28 += " " + qg15.EditCellCssClass;
    };
    qza[qza.length] = "<td align=\"" + qg15.Align + "\"";
    if (qg15.Width > 0) {
        qza[qza.length] = " style=\"width:" + qg15.Width + "px;\"";
    };
    qza[qza.length] = " onclick=\"" + this.Id + ".ClickHandler(event,this," + col + "," + level + ")\"";
    qza[qza.length] = " ondblclick=\"" + this.Id + ".DblClickHandler(event,this," + col + "," + level + ")\"";
    qza[qza.length] = " onmousedown=\"" + this.Id + ".DownHandler(event,this," + col + "," + level + ")\"";
    qza[qza.length] = " onmouseup=\"" + this.Id + ".UpHandler(event,this," + col + "," + level + ")\"";
    if (qg28) {
        qza[qza.length] = " class=\"" + qg28 + "\"";
    };
    qza[qza.length] = ">";
    var bRenderDiv = !qg15.TextWrap && (!cart_browser_ie || !(bIsEditing && qg15.AllowEditing));
    if (bRenderDiv) {
        qza[qza.length] = "<div style=\"padding:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;";
        if (qg15.Width > 0) {
            qza[qza.length] = "width:" + qg15.Width + "px;";
        };
        qza[qza.length] = "text-align:" + qg15.Align + ";\">";
    };
    qza[qza.length] = this.GetCellContent(qg12, qg15);
    if (bRenderDiv) {
        qza[qza.length] = "</div>";
    };
    qza[qza.length] = "</td>";
};
window.ComponentArt_Grid.prototype.RenderDataRow = function(qza, arFamily, table, row, path, bAlternating) {
    var qg21 = this.Levels[table.Level],
    qg30 = path.join('_'),
    styleInfo = this.StyleInfo[row.qg10];
    if (!styleInfo) {
        styleInfo = new Object();
        var bIsCustom = false;
        if (qg21.ConditionalFormats) {
            for (var qzba = 0; qzba < qg21.ConditionalFormats.length; qzba++) {
                var sFilter = qg21.ConditionalFormats[qzba][0],
                DataItem = row;
                bIsCustom = eval(sFilter);
                if (bIsCustom) {
                    styleInfo.RowClass = qg21.ConditionalFormats[qzba][1];
                    styleInfo.HoverRowClass = qg21.ConditionalFormats[qzba][2];
                    styleInfo.SelectedRowClass = qg21.ConditionalFormats[qzba][3];
                    styleInfo.SelectedHoverRowClass = qg21.ConditionalFormats[qzba][4];
                    break;
                };
            };
        };
        if (!bIsCustom) {
            styleInfo.RowClass = qg21.AlternatingRowCssClass && bAlternating ? qg21.AlternatingRowCssClass: qg21.RowCssClass;
            styleInfo.HoverRowClass = qg21.AlternatingHoverRowCssClass && bAlternating ? qg21.AlternatingHoverRowCssClass: qg21.HoverRowCssClass;
            styleInfo.SelectedRowClass = qg21.AlternatingSelectedRowCssClass && bAlternating ? qg21.AlternatingSelectedRowCssClass: qg21.SelectedRowCssClass;
            styleInfo.SelectedHoverRowClass = qg21.AlternatingSelectedHoverRowCssClass && bAlternating ? qg21.AlternatingSelectedHoverRowCssClass: qg21.SelectedHoverRowCssClass;
        };
        styleInfo.Selected = row.Selected;
        this.StyleInfo[row.qg10] = styleInfo;
    };
    var qzdm = row.Selected ? styleInfo.SelectedRowClass: styleInfo.RowClass;
    qza[qza.length] = "<tr";
    if (qzdm) {
        qza[qza.length] = " class=\"" + qzdm + "\"";
    };
    qza[qza.length] = " id=\"" + this.Id + "_row_" + qg30 + "\"";
    qza[qza.length] = " onmouseover=\"" + this.Id + ".OverHandler(event,this," + table.Level + ")\"";
    qza[qza.length] = " onmouseout=\"" + this.Id + ".OutHandler(event,this," + table.Level + ")\">";
    var totalCols = this.RenderMargin(qza, arFamily, table, row, qg30);
    for (var qzAde = 0; qzAde < table.ColumnDisplayOrder.length; qzAde++) {
        var colNum = table.ColumnDisplayOrder[qzAde];
        this.RenderDataCell(qza, row, colNum);
        totalCols++;
    };
    qza[qza.length] = "</tr>";
    if (row.ChildTable) {
        if (row.Expanded || this.ExpandingPath == qg30) {
            var qg33 = this.Id + "_stgroup_" + qg30;
            qza[qza.length] = "<tr><td colspan=\"" + totalCols + "\"><div id=\"" + qg33 + "\"";
            if (this.ExpandingPath == qg30) {
                qza[qza.length] = " style=\"display:none;\"";
                this.DomIdToExpand = qg33;
                this.ExpandingPath = null;
            };
            qza[qza.length] = "><table style=\"width:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tbody>";
            this.RenderDataTable(qza, arFamily.concat(row), row.ChildTable, 0, row.ChildTable.GetRowCount());
            qza[qza.length] = "</tbody></table></div></td></tr>";
        };
    };
};
window.ComponentArt_Grid.prototype.RenderDataTable = function(qza, arFamily, table, startRow, numRows) {
    var qg21 = this.Levels[table.Level];
    if (qg21.ShowTableHeading) {
        this.RenderDataTableHeading(qza, arFamily, table);
    };
    if (qg21.ShowHeadingCells) {
        qg21.NeedsColumnWidths = this.RenderColumnHeadings(qza, arFamily, table);
    };
    if (this.CallbackInProgress) {
        if (this.LoadingPanelClientTemplateId) {
            if (!this.LoadingPanelDomObj) {
                var qzn = document.createElement('div');
                qzn.style.position = 'absolute';
                qzn.style.visibility = 'hidden';
                qzn.style.top = '0px';
                qzn.style.left = '0px';
                var qg34 = this.GetClientTemplate(this.LoadingPanelClientTemplateId);
                if (qg34) {
                    qzn.innerHTML = ComponentArt_InstantiateClientTemplate(qg34, this, null);
                } else {
                    qzn.innerHTML = "Template not found: " + this.LoadingPanelClientTemplateId;
                };
                document.body.insertBefore(qzn, document.body.firstChild);
                var panelX = qzAfx(this.FrameDomObj) + this.LoadingPanelOffsetX,
                panelY = qzAfw(this.FrameDomObj) + this.LoadingPanelOffsetY;
                if (this.LoadingPanelPosition) {
                    var qzzu = this.FrameDomObj.offsetWidth - qzn.offsetWidth,
                    qzxa = this.FrameDomObj.offsetHeight - qzn.offsetHeight;
                    if (this.LoadingPanelPosition.toLowerCase().indexOf('right') >= 0) {
                        panelX += qzzu;
                    } else if (this.LoadingPanelPosition.toLowerCase().indexOf('center') >= 0) {
                        panelX += Math.round(qzzu / 2);
                    };
                    if (this.LoadingPanelPosition.toLowerCase().indexOf('bottom') >= 0) {
                        panelY += qzxa;
                    } else if (this.LoadingPanelPosition.toLowerCase().indexOf('middle') >= 0) {
                        panelY += Math.round(qzxa / 2);
                    };
                };
                qzn.style.top = panelY + 'px';
                qzn.style.left = panelX + 'px';
                qzn.style.visibility = 'visible';
                this.LoadingPanelDomObj = qzn;
            };
        } else {
            qza[qza.length] = '<tr><td colspan="199" height="20" align="center" valign="bottom" style="font-family:arial,verdana;font-size:11px;color:black;">Loading...</td></tr>';
        };
        return;
    };
    if (this.LoadingPanelDomObj) {
        qzff(this.LoadingPanelDomObj);
        this.LoadingPanelDomObj = null;
    };
    if (table.AddingRow) {
        this.RenderAddingRow(qza, arFamily, table);
    };
    if (this.EmptyGridText && this.Data.length == 0) {
        qza[qza.length] = '<tr><td colspan="199" height="20" align="center" valign="bottom" style="font-family:arial,verdana;font-size:11px;color:black;">' + this.EmptyGridText + ' </td></tr>';
        return;
    };
    if (table.Level == 0 && qg21.Groups && qg21.Groups.length > 0) {
        var iGroups = 0;
        for (var qzba = startRow; qzba < qg21.Groups.length && iGroups < numRows; qzba++) {
            var qg17 = qg21.Groups[qzba];
            qg17.FirstInPage = (qzba == startRow);
            qg17.LastInPage = (qzba == qg21.Groups.length - 1 || iGroups == numRows - 1);
            var curPath = [qzba];
            this.RenderGroup(qza, arFamily, qg17, curPath);
            iGroups++;
        };
    } else {
        var filteredRows = 0,
        qg11 = table.GetRowCount(),
        bIsAlternating = false,
        iRows = 0;
        if (qg21.FilterExpression) {
            for (var qzba = 0; qzba < qg11 && filteredRows < startRow; qzba++) {
                var DataItem = table.GetRow(qzba);
                bFilterOkay = eval(qg21.FilterExpression);
                if (bFilterOkay) {
                    filteredRows++;
                };
            };
            startRow = qzba;
        };
        for (var qzba = startRow; qzba < qg11 && iRows < numRows; qzba++) {
            var qg24 = table.GetRow(qzba),
            bFilterOkay = true;
            if (qg21.FilterExpression) {
                var DataItem = qg24;
                bFilterOkay = eval(qg21.FilterExpression);
            };
            if (bFilterOkay) {
                qg24.FirstInPage = (qzba == startRow);
                qg24.LastInPage = (qzba == qg11 - 1 || iRows == numRows - 1);
                this.RenderDataRow(qza, arFamily, table, qg24, qg24.Path, bIsAlternating);
                iRows++;
                table.NextToRender = (qzba + 1);
                filteredRows++;
                bIsAlternating = !bIsAlternating;
            };
        };
        if (qg21.FilterExpression) {
            for (var qzba = table.NextToRender; qzba < qg11; qzba++) {
                var DataItem = qg21.Table.GetRow(qzba);
                bFilterOkay = eval(qg21.FilterExpression);
                if (bFilterOkay) {
                    filteredRows++;
                };
            };
            this.RecordCount = filteredRows;
            this.PageCount = Math.ceil(this.RecordCount / this.PageSize);
        };
    };
};
window.ComponentArt_Grid.prototype.RenderDataTableHeading = function(qza, arFamily, table) {
    var qg21 = this.Levels[table.Level];
    qza[qza.length] = "<tr>";
    for (var qzba = 0; qzba < arFamily.length; qzba++) {
        var ancestor = arFamily[qzba];
        this.RenderIndentCell(qza, !ancestor.LastInPage);
        if (ancestor.constructor == ComponentArt_GridItem && this.Levels[ancestor.Level].ShowSelectorCells) {
            this.RenderIndentCell(qza, false);
        };
    };
    var colSpan = table.Columns.length + 1;
    if (this.SelfReferencing || this.Levels.length > 1) {
        colSpan++;
    };
    qza[qza.length] = "<td class=\"" + qg21.TableHeadingCssClass + "\" colspan=\"" + colSpan + "\">";
    if (qg21.TableHeadingClientTemplateId) {
        var qg34 = this.GetClientTemplate(qg21.TableHeadingClientTemplateId);
        if (qg34) {
            qza[qza.length] = ComponentArt_InstantiateClientTemplate(qg34, this, table);
        } else {
            qza[qza.length] = "Template not found: " + qg21.TableHeadingClientTemplateId;
        };
    } else {
        qza[qza.length] = table.TableName;
    };
    qza[qza.length] = "</td></tr>";
};
window.ComponentArt_Grid.prototype.RenderExpandCollapseCell = function(qza, row, qzgu, qzhb, bInnerOnly, bIsGroup) {
    var qg30 = row.qg10,
    qzAeb = this.Id + (bIsGroup ? "_expcolgrp_": "_expcol_") + qg30,
    expColMethod = bIsGroup ? "ToggleGroupExpand": "ToggleExpand",
    bIsFirstInGroup = (row.Level == 0 && row.qg10 % this.PageSize == 0);
    if (!bInnerOnly) {
        qza[qza.length] = "<td";
        if (this.IndentCellCssClass) {
            qza[qza.length] = " class=\"" + this.IndentCellCssClass + "\"";
        };
        qza[qza.length] = " id=\"" + qzAeb + "\" align=\"center\" width=\"" + this.IndentCellWidth + "\">";
    };
    if (qzgu || (!this.PreloadLevels && (this.SelfReferencing || row.Level < this.Levels.length - 1))) {
        var qzoi = "",
        qzoh = "",
        qzzu = -1,
        qzxa = -1;
        if (this.TreeLineImagesFolderUrl) {
            if (this.TreeLineImageHeight > 0) qzxa = this.TreeLineImageHeight;
            if (this.TreeLineImageWidth > 0) qzzu = this.TreeLineImageWidth;
            if (row.Level == 0) {
                if (bIsFirstInGroup) {
                    if (qzhb) {
                        qzoh = this.TreeLineImagesFolderUrl + "dashminus.gif";
                        qzoi = this.TreeLineImagesFolderUrl + "dashplus.gif";
                    } else {
                        qzoh = this.TreeLineImagesFolderUrl + "rminus.gif";
                        qzoi = this.TreeLineImagesFolderUrl + "rplus.gif";
                    };
                } else if (qzhb) {
                    qzoh = this.TreeLineImagesFolderUrl + "lminus.gif";
                    qzoi = this.TreeLineImagesFolderUrl + "lplus.gif";
                } else {
                    qzoh = this.TreeLineImagesFolderUrl + "tminus.gif";
                    qzoi = this.TreeLineImagesFolderUrl + "tplus.gif";
                };
            } else {
                if (qzhb) {
                    qzoh = this.TreeLineImagesFolderUrl + "lminus.gif";
                    qzoi = this.TreeLineImagesFolderUrl + "lplus.gif";
                } else {
                    qzoh = this.TreeLineImagesFolderUrl + "tminus.gif";
                    qzoi = this.TreeLineImagesFolderUrl + "tplus.gif";
                };
            };
        } else {
            if (this.ExpandCollapseImageHeight > 0) qzxa = this.ExpandCollapseImageHeight;
            if (this.ExpandCollapseImageWidth > 0) qzzu = this.ExpandCollapseImageWidth;
            qzoh = this.CollapseImageUrl;
            qzoi = this.ExpandImageUrl;
        };
        if (qzoh && qzoi) {
            qza[qza.length] = "<img alt=\"\" onclick=\"" + this.Id + "." + expColMethod + "(event,this,'" + qg30 + "')\"";
            if (qzxa > 0) {
                qza[qza.length] = " height=\"" + qzxa + "\"";
            };
            if (qzzu > 0) {
                qza[qza.length] = " width=\"" + qzzu + "\"";
            };
            if (row.Expanded || row.Expanding) {
                qza[qza.length] = " style=\"display:none;\"";
            } else {
                qza[qza.length] = " style=\"display:block;\"";
            };
            qza[qza.length] = " src=\"" + qzoi + "\" />";
            qza[qza.length] = "<img alt=\"\" onclick=\"" + this.Id + "." + expColMethod + "(event,this,'" + qg30 + "')\"";
            if (qzxa > 0) {
                qza[qza.length] = " height=\"" + qzxa + "\"";
            };
            if (qzzu > 0) {
                qza[qza.length] = " width=\"" + qzzu + "\"";
            };
            if (!row.Expanded && !row.Expanding) {
                qza[qza.length] = " style=\"display:none;\"";
            } else {
                qza[qza.length] = " style=\"display:block;\"";
            };
            qza[qza.length] = " src=\"" + qzoh + "\" />";
        };
    } else {
        if (this.TreeLineImagesFolderUrl) {
            qza[qza.length] = "<img alt=\"\" style=\"display:block;\"";
            if (this.TreeLineImageHeight > 0) qza[qza.length] = " height=\"" + this.TreeLineImageHeight + "\"";
            if (this.TreeLineImageWidth > 0) qza[qza.length] = " width=\"" + this.TreeLineImageWidth + "\"";
            if (row.Level == 0) {
                if (row.qg10 == '0') {
                    if (qzhb) {
                        qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "dash.gif\"";
                    } else {
                        qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "r.gif\"";
                    };
                } else if (qzhb) {
                    qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "l.gif\"";
                } else {
                    qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "t.gif\"";
                };
            } else {
                if (qzhb) {
                    qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "l.gif\"";
                } else {
                    qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "t.gif\"";
                };
            };
            qza[qza.length] = " />";
        } else if (this.NoExpandImageUrl) {
            qza[qza.length] = "<img alt=\"\" style=\"display:block;\"";
            if (this.ExpandCollapseImageHeight > 0) qza[qza.length] = " height=\"" + this.ExpandCollapseImageHeight + "\"";
            if (this.ExpandCollapseImageWidth > 0) qza[qza.length] = " width=\"" + this.ExpandCollapseImageWidth + "\"";
            qza[qza.length] = " src=\"" + this.NoExpandImageUrl + "\" />";
        } else {};
    };
    if (!bInnerOnly) {
        qza[qza.length] = "</td>";
    };
};
window.ComponentArt_Grid.prototype.RenderElement = function(qza, position) {
    if (this.PagerPosition == position) {
        this.RenderPager(qza);
    } else if (this.GroupingNotificationPosition == position) {
        this.RenderGroupingNotification(qza);
    } else if (this.PagerInfoPosition == position) {
        this.RenderPagerInfo(qza);
    } else if (this.SearchBoxPosition == position && this.ShowSearchBox) {
        this.RenderSearchBox(qza);
    };
};
window.ComponentArt_Grid.prototype.RenderFooter = function(domObj) {
    var qza = ['<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td nowrap align="left">'];
    this.RenderElement(qza, 'bottomleft');
    qza[qza.length] = '</td><td nowrap align="right">';
    this.RenderElement(qza, 'bottomright');
    qza[qza.length] = '</td></tr></table>';
    domObj.innerHTML = qza.join('');
};
window.ComponentArt_Grid.prototype.RenderGroup = function(qza, arFamily, group, path) {
    var qg21 = this.Levels[group.Level],
    qg30 = path.join('_');
    qza[qza.length] = "<tr>";
    group.qg10 = qg30;
    this.RenderExpandCollapseCell(qza, group, true, group.LastInPage, false, true);
    var colSpan = this.Table.Columns.length + qg21.NumGroupings;
    qza[qza.length] = "<td class=\"" + qg21.GroupHeadingCssClass + "\" colspan=\"" + colSpan + "\">";
    if (qg21.GroupHeadingClientTemplateId) {
        var qg34 = this.GetClientTemplate(qg21.GroupHeadingClientTemplateId);
        if (qg34) {
            var sContent = ComponentArt_InstantiateClientTemplate(qg34, this, group);
            if (sContent) {
                qza[qza.length] = sContent;
            };
        };
    } else {
        qza[qza.length] = this.Table.Columns[group.Column].HeadingText + " : " + group.ColumnValue;
    };
    qza[qza.length] = "</td>";
    qza[qza.length] = "</tr>";
    if (group.Expanded || group.Expanding) {
        var sGroupDomId = this.Id + "_group_" + qg30;
        qza[qza.length] = "</tbody><tbody";
        if (group.Expanding) {
            if (cart_browser_ie) {
                qza[qza.length] = " style=\"visibility:hidden;\"";
            } else {
                qza[qza.length] = " style=\"display:none;\"";
            };
        };
        qza[qza.length] = " id=\"" + sGroupDomId + "\">";
        if (group.Groups && group.Groups.length > 0) {
            for (var qzba = 0; qzba < group.Groups.length; qzba++) {
                var qg17 = group.Groups[qzba];
                qg17.FirstInPage = (qzba == 0);
                qg17.LastInPage = (qzba == group.Groups.length - 1);
                var curPath = path.concat(qzba);
                this.RenderGroup(qza, arFamily.concat(group), qg17, curPath);
            };
        } else {
            for (var qzba = 0; qzba < group.Rows.length; qzba++) {
                var qg24 = this.Table.GetRow(group.Rows[qzba]);
                qg24.LastInPage = (qzba == group.Rows.length - 1);
                qg24.FirstInPage = (qzba == 0);
                this.RenderDataRow(qza, arFamily.concat(group), this.Table, qg24, qg24.Path, (qzba % 2 == 0));
            };
        };
        qza[qza.length] = "</tbody>";
        if (group.Expanding) {
            if (cart_browser_ie) {
                this.GroupToExpand = sGroupDomId;
            } else {
                this.DomIdToExpand = sGroupDomId;
            };
            group.Expanding = false;
            group.Expanded = true;
        };
        if (this.GroupToExpand) {
            qza[qza.length] = "<tbody style=\"display:none;\">";
        } else {
            qza[qza.length] = "<tbody>";
        };
    };
};
window.ComponentArt_Grid.prototype.RenderGroupingNotification = function(qza) {
    qza[qza.length] = '<div';
    if (this.GroupingNotificationTextCssClass) {
        qza[qza.length] = ' class="' + this.GroupingNotificationTextCssClass + '"';
    };
    qza[qza.length] = '>';
    if (this.Groupings && this.Groupings.length > 0 && this.Levels[0].Groups && this.Levels[0].Groups.length > 0) {
        var col = this.Levels[0].Groups[0].Column,
        imgSrc;
        if (this.Groupings[0].indexOf(' 0') > 0 && this.GroupBySortAscendingImageUrl) {
            imgSrc = this.GroupBySortAscendingImageUrl;
        } else if (this.Groupings[0].indexOf(' 1') > 0 && this.GroupBySortDescendingImageUrl) {
            imgSrc = this.GroupBySortDescendingImageUrl;
        };
        var imgSize = '';
        if (imgSrc) {
            if (this.GroupBySortImageHeight > 0) {
                imgSize += " height=\"" + this.GroupBySortImageHeight + "\"";
            };
            if (this.GroupBySortImageWidth > 0) {
                imgSize += " width=\"" + this.GroupBySortImageWidth + "\"";
            };
        };
        var displayCol = 0;
        while (this.Levels[0].Table.ColumnDisplayOrder[displayCol] != col) {
            displayCol++;
        };
        qza[qza.length] = '<table cellspacing="0" cellpadding="0" border="0" onclick="' + this.Id + '.GroupClickHandler(event,this,' + col + ');" onmousedown="' + this.Id + '.GroupDownHandler(event,this,' + displayCol + ');"';
        if (this.GroupByCssClass) {
            qza[qza.length] = ' class="' + this.GroupByCssClass + '"';
        };
        qza[qza.length] = '><tr><td';
        if (this.GroupByTextCssClass) {
            qza[qza.length] = ' class="' + this.GroupByTextCssClass + '"';
        };
        qza[qza.length] = '>';
        if (this.GroupByClientTemplateId) {
            var qg34 = this.GetClientTemplate(this.GroupByClientTemplateId);
            if (qg34) {
                qza[qza.length] = ComponentArt_InstantiateClientTemplate(qg34, this, this.Levels[0].Table.Columns[col]);
            } else {
                qza[qza.length] = "Template not found: " + this.GroupByClientTemplateId;
            };
        } else {
            qza[qza.length] = 'Group by: ' + this.Levels[0].Table.Columns[col].HeadingText;
        };
        if (imgSrc) {
            qza[qza.length] = '</td><td><img alt="" src="' + imgSrc + '"' + imgSize + ' />';
        };
        qza[qza.length] = "</td></tr></table>";
    } else {
        qza[qza.length] = this.GroupingNotificationText;
    };
    qza[qza.length] = '</div>';
};
window.ComponentArt_Grid.prototype.RenderHeader = function(domObj) {
    var qza = ['<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td nowrap align="left">'];
    this.RenderElement(qza, 'topleft');
    qza[qza.length] = '</td><td nowrap align="right">';
    this.RenderElement(qza, 'topright');
    qza[qza.length] = '</td></tr></table>';
    domObj.innerHTML = qza.join('');
};
window.ComponentArt_Grid.prototype.RenderIndentCell = function(qza, bConsiderLines) {
    qza[qza.length] = "<td";
    if (this.IndentCellCssClass) {
        qza[qza.length] = " class=\"" + this.IndentCellCssClass + "\"";
    };
    qza[qza.length] = " width=\"" + this.IndentCellWidth + "\"><div style=\"width:" + this.IndentCellWidth + "px;\">";
    if (bConsiderLines && this.TreeLineImagesFolderUrl) {
        qza[qza.length] = "<img border=\"0\" alt=\"\"";
        if (this.TreeLineImageHeight > 0) {
            qza[qza.length] = " height=\"" + this.TreeLineImageHeight + "\"";
        };
        if (this.TreeLineImageWidth > 0) {
            qza[qza.length] = " width=\"" + this.TreeLineImageWidth + "\"";
        };
        qza[qza.length] = " src=\"" + this.TreeLineImagesFolderUrl + "i.gif\" />";
    };
    qza[qza.length] = "</div>";
    qza[qza.length] = "</td>";
};
window.ComponentArt_Grid.prototype.RenderMargin = function(qza, arFamily, table, row, qg30) {
    var qg21 = this.Levels[table.Level],
    totalCols = 1;
    for (var qzba = 0; qzba < arFamily.length; qzba++) {
        var ancestor = arFamily[qzba];
        this.RenderIndentCell(qza, !ancestor.LastInPage);
        totalCols++;
        if (ancestor.constructor == ComponentArt_GridItem && this.Levels[ancestor.Level].ShowSelectorCells) {
            this.RenderIndentCell(qza, false);
            totalCols++;
        };
    };
    if (this.SelfReferencing || this.Levels.length > 1) {
        this.RenderExpandCollapseCell(qza, row, row.ChildTable, row.LastInPage, false);
        totalCols++;
    };
    if (qg21.ShowSelectorCells) {
        qza[qza.length] = "<td";
        qza[qza.length] = " width=\"" + qg21.SelectorCellWidth + "\"";
        qza[qza.length] = " onclick=\"" + this.Id + ".ClickHandler(event,this,-1,' + table.Level + ')\"";
        qza[qza.length] = " class=\"" + qg21.SelectorCellCssClass + "\">";
        qza[qza.length] = "<div style=\"vertical-align:center;text-align:center;width:" + qg21.SelectorCellWidth + "px;\">";
        if (qg21.SelectorImageUrl) {
            qza[qza.length] = "<img id=\"" + this.Id + "_selector_" + qg30 + "\" border=\"0\" alt=\"\" src=\"" + qg21.SelectorImageUrl + "\"";
            if (qg21.SelectorImageHeight > 0) {
                qza[qza.length] = " height=\"" + qg21.SelectorImageHeight + "\"";
            };
            if (qg21.SelectorImageWidth > 0) {
                qza[qza.length] = " width=\"" + qg21.SelectorImageWidth + "\"";
            };
            if (!row.Selected) {
                qza[qza.length] = " style=\"visibility:hidden;\"";
            };
            qza[qza.length] = " />";
        } else {
            qza[qza.length] = "&nbsp;";
        };
        qza[qza.length] = "</div></td>";
    };
    return totalCols;
};
window.ComponentArt_Grid.prototype.RenderSearchBox = function(qza) {
    qza[qza.length] = '<div';
    if (this.SearchTextCssClass) {
        qza[qza.length] = ' class="' + this.SearchTextCssClass + '"';
    };
    qza[qza.length] = '>' + this.SearchText + ' ';
    qza[qza.length] = '<input onsubmit="return false;" onkeypress="return !' + this.Id + '.SearchCheckEnter(event)" id="' + this.Id + '_searchBox"';
    if (this.SearchBoxCssClass) {
        qza[qza.length] = ' class="' + this.SearchBoxCssClass + '"';
    };
    qza[qza.length] = ' onkeyup="' + this.Id + '.SearchKeyHandler(event,this);" type="text" maxlength="20" size="20" value="' + this.SearchString + '" /></div>';
};
window.ComponentArt_Grid.prototype.GetButtonImageSource = function(sLocation, sImage, qzxa, qzzu, bHover, bActive) {
    var sImageUrl = sLocation + sImage,
    sContent = "alt=\"\" src=\"" + sImageUrl + "\"";
    if (qzxa > 0) sContent += " height=\"" + qzxa + "\"";
    if (qzzu > 0) sContent += " width=\"" + qzzu + "\"";
    if (bHover) {
        var sHoverImageUrl = sLocation + sImage.replace(".gif", "_hover.gif");
        sContent += " onmouseover=\"this.src='" + sHoverImageUrl + "';\" onmouseout=\"this.src='" + sImageUrl + "';\"";
    };
    if (bActive) {
        var sActiveImageUrl = sLocation + sImage.replace(".gif", "_active.gif");
        sContent += " onmousedown=\"this.src='" + sActiveImageUrl + "';\" onmouseup=\"this.src='" + sImageUrl + "';\"";
    };
    return sContent;
};
window.ComponentArt_Grid.prototype.GetScrollButtonSource = function(sImage, qzxa, qzzu, bHover, bActive) {
    return this.GetButtonImageSource(this.ScrollImagesFolderUrl, sImage, qzxa, qzzu, bHover, bActive);
};
window.ComponentArt_Grid.prototype.RenderScroll = function(domObj) {
    var bEnabled = this.PageSize < this.RecordCount,
    scrollHeight = domObj.offsetHeight - this.ScrollButtonHeight * 2,
    qza = ['<table style="height:100%;" cellpadding="0" cellspacing="0" border="0"'];
    if (this.ScrollBarCssClass) {
        qza[qza.length] = ' class="' + this.ScrollBarCssClass + '"';
    };
    qza[qza.length] = '>';
    if (this.ScrollHeaderCssClass) {
        qza[qza.length] = '<tr><td class="' + this.ScrollHeaderCssClass + '">&nbsp;</td></tr>';
    };
    qza[qza.length] = '<tr><td style="height:' + this.ScrollButtonHeight + 'px;"><img style="display:block;" onclick="' + this.Id + '.ScrollBy(-1);return false;" ';
    qza[qza.length] = this.GetScrollButtonSource(bEnabled ? "up.gif": "up_disabled.gif", this.ScrollButtonHeight, this.ScrollButtonWidth, this.ScrollButtonHoverEnabled, this.ScrollButtonActiveEnabled);
    qza[qza.length] = ' /></td></tr>';
    qza[qza.length] = '<tr><td style="height:' + scrollHeight + 'px;" valign="top" onclick="ComponentArt_Grid_HandleScrollPage(event,this,' + this.Id + ');">';
    if (bEnabled) {
        var scrollGripHeight = Math.round((this.PageSize * scrollHeight) / this.RecordCount),
        outerScrollGripHeight = scrollGripHeight;
        if (this.ScrollTopBottomImagesEnabled && this.ScrollTopBottomImageHeight > 0) {
            outerScrollGripHeight += this.ScrollTopBottomImageHeight * 2;
        };
        var offsetTop = Math.max(0, Math.min(scrollHeight - outerScrollGripHeight, Math.round((this.RecordOffset * (scrollHeight - outerScrollGripHeight)) / (this.RecordCount - this.PageSize))));
        qza[qza.length] = '<table cellpadding="0" cellspacing="0" border="0" onmousedown="ComponentArt_Grid_HandleScrollStart(event,this,' + this.Id + ');" style="position:relative;top:' + offsetTop + 'px;">';
        if (this.ScrollTopBottomImagesEnabled) {
            qza[qza.length] = '<tr><td';
            if (this.ScrollTopBottomImageHeight > 0) {
                qza[qza.length] = ' height="' + this.ScrollTopBottomImageHeight + '"';
            };
            if (this.ScrollTopBottomImageWidth > 0) {
                qza[qza.length] = ' width="' + this.ScrollTopBottomImageWidth + '"';
            };
            qza[qza.length] = '><img style="display:block;" ' + this.GetScrollButtonSource('top.gif', this.ScrollTopBottomImageHeight, this.ScrollTopBottomImageWidth) + ' /></td></tr>';
        };
        qza[qza.length] = '<tr><td style="height:' + scrollGripHeight + 'px;" class="' + this.ScrollGripCssClass + '" >&nbsp;</td></tr>';
        if (this.ScrollTopBottomImagesEnabled) {
            qza[qza.length] = '<tr><td';
            if (this.ScrollTopBottomImageHeight > 0) {
                qza[qza.length] = ' height="' + this.ScrollTopBottomImageHeight + '"';
            };
            if (this.ScrollTopBottomImageWidth > 0) {
                qza[qza.length] = ' width="' + this.ScrollTopBottomImageWidth + '"';
            };
            qza[qza.length] = '><img style="display:block;" ' + this.GetScrollButtonSource('bottom.gif', this.ScrollTopBottomImageHeight, this.ScrollTopBottomImageWidth) + ' /></td></tr>';
        };
        qza[qza.length] = '</table>';
    };
    qza[qza.length] = '</td></tr><tr><td style="height:' + this.ScrollButtonHeight + 'px;"><img style="display:block;" onclick="' + this.Id + '.ScrollBy(1);return false;" ';
    qza[qza.length] = this.GetScrollButtonSource(bEnabled ? "down.gif": "down_disabled.gif", this.ScrollButtonHeight, this.ScrollButtonWidth, this.ScrollButtonHoverEnabled, this.ScrollButtonActiveEnabled);
    qza[qza.length] = ' /></td></tr></table>';
    domObj.innerHTML = qza.join('');
};
window.ComponentArt_Grid.prototype.GetPagerGripSource = function() {
    var sImageUrl = this.PagerImagesFolderUrl + "slider_grip.gif",
    sContent = "alt=\"\" src=\"" + sImageUrl + "\"";
    if (this.SliderGripWidth > 0) sContent += " width=\"" + this.SliderGripWidth + "\"";
    if (this.PagerButtonHoverEnabled) {
        var sHoverImageUrl = this.PagerImagesFolderUrl + "slider_grip_hover.gif";
        sContent += " onmouseover=\"this.src='" + sHoverImageUrl + "';\" onmouseout=\"this.src='" + sImageUrl + "';\"";
    };
    sContent += " onclick=\"ComponentArt_CancelEvent(event)\" onmousedown=\"ComponentArt_Grid_HandleSlideStart(event,this," + this.Id + ")";
    if (this.PagerButtonActiveEnabled) {
        var sActiveImageUrl = this.PagerImagesFolderUrl + "slider_grip_active.gif";
        sContent += "this.src='" + sActiveImageUrl + "';\" onmouseup=\"this.src='" + sImageUrl + "';\"";
    } else {
        sContent += "\"";
    };
    return sContent;
};
window.ComponentArt_Grid.prototype.GetPagerButtonSource = function(sImage) {
    return this.GetButtonImageSource(this.PagerImagesFolderUrl, sImage, this.PagerButtonHeight, this.PagerButtonWidth, this.PagerButtonHoverEnabled, this.PagerButtonActiveEnabled);
};
window.ComponentArt_Grid.prototype.RenderPager = function(qza) {
    if (this.PagerStyle == 0) {
        this.RenderNumberedPager(qza);
    } else if (this.PagerStyle == 1) {
        this.RenderSlider(qza);
    } else {
        this.RenderButtonPager(qza);
    };
};
window.ComponentArt_Grid.prototype.RenderPagerInfo = function(qza) {
    qza[qza.length] = '<div';
    if (this.PagerTextCssClass) {
        qza[qza.length] = " class=\"" + this.PagerTextCssClass + "\"";
    };
    qza[qza.length] = '>';
    if (this.PagerInfoClientTemplateId) {
        var qg34 = this.GetClientTemplate(this.PagerInfoClientTemplateId);
        if (qg34) {
            qza[qza.length] = ComponentArt_InstantiateClientTemplate(qg34, this, null);
        } else {
            qza[qza.length] = "Template not found: " + this.PagerInfoClientTemplateId;
        };
    } else {
        qza[qza.length] = "Page <b>" + (this.CurrentPageIndex + 1) + "</b> of <b>" + this.PageCount + "</b> (" + this.RecordCount + " items)";
    };
    qza[qza.length] = '</div>';
};
window.ComponentArt_Grid.prototype.RenderSlider = function(qza) {
    var totalPages = this.PageCount;
    qza[qza.length] = "<table height=\"" + this.SliderHeight + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"" + this.PagerButtonPadding + "\"><tr>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;display:none\" " + this.GetPagerButtonSource('first.gif') + " onclick=\"" + this.Id + ".Page(0);return false;\"></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;\" " + this.GetPagerButtonSource('prev.gif') + " onclick=\"" + this.Id + ".PreviousPage();return false;\"></td>";
    var slideImageWidth = this.SliderGripWidth,
    sliderWidth = this.SliderWidth;
    this.SliderPosition = Math.round((this.CurrentPageIndex * (sliderWidth - slideImageWidth)) / (totalPages - 1));
    qza[qza.length] = "<td onclick=\"ComponentArt_Grid_HandleSlideClick(event,this," + this.Id + ");\" width=\"" + sliderWidth + "\" background=\"" + this.PagerImagesFolderUrl + "slider_bg.gif\"><img style=\"cursor:pointer;position:relative;left:" + this.SliderPosition + "px;\" " + this.GetPagerGripSource() + "></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;\" " + this.GetPagerButtonSource('next.gif') + " onclick=\"" + this.Id + ".NextPage();return false;\"></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;display:none\" " + this.GetPagerButtonSource('last.gif') + " onclick=\"" + this.Id + ".Page(" + (totalPages - 1) + ");return false;\"></td>";
    qza[qza.length] = "</tr></table>";
};
window.ComponentArt_Grid.prototype.RenderNumberedPager = function(qza) {
    qza[qza.length] = "<div style='white-space:nowrap;'";
    if (this.PagerTextCssClass) {
        qza[qza.length] = " class=\"" + this.PagerTextCssClass + "\"";
    };
    qza[qza.length] = ">";
    var startPage = this.PageCount <= 5 ? 0: Math.max(0, this.CurrentPageIndex - 2),
    endPage = this.PageCount <= 5 ? this.PageCount: Math.min(startPage + 5, this.PageCount);
    if (this.PageCount > 5 && this.CurrentPageIndex > 2) {
        qza[qza.length] = "<a href=\"#\" onclick=\"" + this.Id + ".Page(0);return false;\">&laquo; First</a>&nbsp;...&nbsp;";
        qza[qza.length] = "<a href=\"#\" onclick=\"" + this.Id + ".PreviousPage();return false;\">&lt;</a>&nbsp;";
    };
    for (var page = startPage; page < endPage; page++) {
        var showPage = page + 1;
        if (page == this.CurrentPageIndex) {
            qza[qza.length] = showPage + "&nbsp;";
        } else {
            qza[qza.length] = "<a href=\"#\" onclick=\"" + this.Id + ".Page(" + page + ");return false;\">" + showPage + "</a>&nbsp;";
        };
    };
    if (this.PageCount > 5 && this.CurrentPageIndex < this.PageCount - 3) {
        qza[qza.length] = "<a href=\"#\" onclick=\"" + this.Id + ".NextPage();return false;\">&gt;</a>&nbsp;...&nbsp;";
        qza[qza.length] = "<a href=\"#\" onclick=\"" + this.Id + ".Page(" + (this.PageCount - 1) + ");return false;\">Last &raquo;</a>&nbsp;";
    };
    qza[qza.length] = "</div>";
};
window.ComponentArt_Grid.prototype.RenderButtonPager = function(qza) {
    var totalPages = this.PageCount;
    qza[qza.length] = "<table height=\"" + this.SliderHeight + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"" + this.PagerButtonPadding + "\"><tr>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;display:none\" " + this.GetPagerButtonSource('first.gif') + " onclick=\"" + this.Id + ".Page(0);return false;\"></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;\" " + this.GetPagerButtonSource('prev.gif') + " onclick=\"" + this.Id + ".PreviousPage();return false;\"></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;\" " + this.GetPagerButtonSource('next.gif') + " onclick=\"" + this.Id + ".NextPage();return false;\"></td>";
    qza[qza.length] = "<td width=\"1\"><img style=\"cursor:pointer;display:none\" " + this.GetPagerButtonSource('last.gif') + " onclick=\"" + this.Id + ".Page(" + (totalPages - 1) + ");return false;\"></td>";
    qza[qza.length] = "</tr></table>";
};
