﻿
//jQuery onload
$(function() {
    PagingControl.init();
});

var PagingControl = {
    pagerId: "",
    secondarypagerId: "",
    pageIndex: 0,
    pageSize: 15,
    totalCount: 0,
    totalPages: 0,
    onPageChange: "",
    hasPreviousPage: false,
    hasNextPage: false,
    PageResponse: "",
    currentStart: 0,
    maxPageDisplay: 10,
    init: function() {
    },

    setPagination: function(pagerid, pageindex, pagesize, totalcount, totalpages, onpagechange, secondarypagerid) {
        try {
            if (pagerid != null) { this.pagerId = pagerid; }
            if (pageindex != null) { this.pageIndex = pageindex; }
            if (pagesize != null) { this.pageSize = pagesize; }
            if (totalcount != null) { this.totalCount = totalcount; }
            if (totalpages != null) { this.totalPages = totalpages; }
            if (onpagechange != null) { this.onPageChange = onpagechange; }
            if (secondarypagerid != null) { this.secondarypagerId = secondarypagerid; }
        } catch (e) { }
        this.setCurrentPage(this.pageIndex);
    },

    setCurrentPage: function(selecteditem) {
        var pageN = selecteditem + "";
        this.currentStart = parseInt((pageN.substring(0, pageN.length - 1)) + "0");

        $("#" + this.pagerId + "PagingDropDown").empty();
        $("#" + this.secondarypagerId + "PagingDropDown").empty();
        //if ($("#" + this.pagerId + "PagingDropDown").attr("selectedIndex") == "-1") {
        for (var i = 0; i < this.totalPages; i++) {
            $("#" + this.pagerId + "PagingDropDown").append('<option value="' + i + '" ' + (i == selecteditem ? "selected=selected" : "") + '>' + (i + 1) + '</option>');
            $("#" + this.secondarypagerId + "PagingDropDown").append('<option value="' + i + '" ' + (i == selecteditem ? "selected=selected" : "") + '>' + (i + 1) + '</option>');
        }
        //}

        //$("#" + this.pagerId + "PagingDropDown").attr("selectedIndex", selecteditem);
        //if (this.secondarypagerId != "")
        //    $("#" + this.secondarypagerId + "PagingDropDown").attr("selectedIndex", selecteditem);

        $("#" + this.pagerId + "Pagingpage" + this.pageIndex).removeClass("active");
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "Pagingpage" + this.pageIndex).removeClass("active");

        $("#" + this.pagerId + "Pagingpage" + selecteditem).addClass("active");
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "Pagingpage" + selecteditem).addClass("active");

        this.pageIndex = selecteditem;

        if (this.totalPages <= 1) {
            $("#" + this.pagerId + "PagingPager").hide();
            if (this.secondarypagerId != "")
                $("#" + this.secondarypagerId + "PagingPager").hide();
        }
        else {
            $("#" + this.pagerId + "PagingPager").show();
            if (this.secondarypagerId != "")
                $("#" + this.secondarypagerId + "PagingPager").show();
        }

        $("#" + this.pagerId + "PagingShowing").html(this.getShowing());
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "PagingShowing").html(this.getShowing());

        var pagenumcontent = "";
        var maxPage = this.totalPages;
        if ((this.currentStart + this.maxPageDisplay) > this.totalPages)
            maxPage = this.totalPages;
        else
            maxPage = (this.currentStart + this.maxPageDisplay);

        for (var i = this.currentStart; i < maxPage; i++) {
            pagenumcontent += this.getPageNumber(this.pageIndex, i);
        }
        $("#" + this.pagerId + "PagingPageNumbers").attr("innerHTML", "");
        $("#" + this.pagerId + "PagingPageNumbers").html(pagenumcontent);

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "PagingPageNumbers").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "PagingPageNumbers").html(pagenumcontent);
        }

        $("#" + this.pagerId + "Pagingpagenext10").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpagenext10").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpageprev10").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpageprev10").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpagenext").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpagenext").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpageprev").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpageprev").removeClass("nodisplay");

        var prevpage = 0;
        if (this.pageIndex > 0)
            prevpage = parseInt(this.pageIndex) - 1;

        $("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
        $("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + prevpage + ");\">&#139; Prev</a>&nbsp;&nbsp;");

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + prevpage + ");\">&#139; Prev</a>&nbsp;&nbsp;");
        }

        var nextpage = this.pageIndex;
        if (this.totalPages > (parseInt(this.pageIndex) + 1))
            nextpage = parseInt(this.pageIndex) + 1;

        $("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
        $("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + nextpage + ");\">Next &#155;</a>&nbsp;&nbsp;");

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + nextpage + ");\">Next &#155;</a>&nbsp;&nbsp;");
        }

        if ((parseInt(this.currentStart) + parseInt(this.pageSize)) < parseInt(this.totalPages)) {
            $("#" + this.pagerId + "Pagingpagenext10").attr("innerHTML", "");
            $("#" + this.pagerId + "Pagingpagenext10").html("<a href='javascript:' onclick=\"PagingControl.currentStart=" + (parseInt(this.currentStart) + 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) + 10) + ");\"> ... </a>");

            $("#" + this.secondarypagerId + "Pagingpagenext10").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpagenext10").html("<a href='javascript:' onclick=\"PagingControl.currentStart=" + (parseInt(this.currentStart) + 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) + 10) + ");\"> ... </a>");
        } else {
            $("#" + this.pagerId + "Pagingpagenext10").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext10").addClass("nodisplay");
        }

        if (parseInt(this.currentStart) >= 10) {
            $("#" + this.pagerId + "Pagingpageprev10").attr("innerHTML", "");
            $("#" + this.pagerId + "Pagingpageprev10").html("<a href='javascript:' onclick=\"PagingControl.currentStart=" + (parseInt(this.currentStart) - 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) - 10) + ");\"> ... </a>");

            $("#" + this.secondarypagerId + "Pagingpageprev10").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpageprev10").html("<a href='javascript:' onclick=\"PagingControl.currentStart=" + (parseInt(this.currentStart) - 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) - 10) + ");\"> ... </a>");
        } else {
            $("#" + this.pagerId + "Pagingpageprev10").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev10").addClass("nodisplay");
        }

        if (parseInt(this.pageIndex) == 0 && parseInt(this.totalPages) == 1) {
            $("#" + this.pagerId + "Pagingpagenext").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");

            $("#" + this.pagerId + "Pagingpageprev").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
        } else if ((parseInt(this.pageIndex) + 1) == parseInt(this.totalPages)) {
            $("#" + this.pagerId + "Pagingpagenext").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
        } else if (parseInt(this.pageIndex) == 0) {
            $("#" + this.pagerId + "Pagingpageprev").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev").addClass("nodisplay");

            //$("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
        }
    },

    getShowing: function() {
        var frmCount = 0;
        var toCount = 0;
        var str = "Showing ";
        if (this.pageIndex == 0)
            frmCount = 1;
        else
            frmCount = (parseInt(this.pageIndex) * parseInt(this.pageSize) + 1);
        if (((parseInt(this.pageIndex) * parseInt(this.pageSize)) + parseInt(this.pageSize)) > this.totalCount)
            toCount = this.totalCount;
        else
            toCount = ((parseInt(this.pageIndex) * parseInt(this.pageSize)) + parseInt(this.pageSize));
        str += frmCount;
        str += " - ";
        str += toCount;
        str += " of ";
        str += this.totalCount;
        return str;
    },

    getPageNumber: function(pageindex, item) {
        var str = "<li>";
        str += "<a id='botpage";
        str += item + "' ";
        str += "href='javascript:' ";
        if (pageindex == item) {
            str += "class='active' ";
        }
        else {
            str += "class='' ";
        }
        str += "onclick=\"" + this.onPageChange + "('";
        str += item + "');\">"
        str += "<span>";
        str += item + 1;
        str += "</span></a>";
        str += "</li>";
        return str;
    }
}


var NPagingControl = {
    pagerId: "",
    secondarypagerId: "",
    pageIndex: 0,
    pageSize: 15,
    totalCount: 0,
    totalPages: 0,
    onPageChange: "",
    hasPreviousPage: false,
    hasNextPage: false,
    PageResponse: "",
    currentStart: 0,
    maxPageDisplay: 10,
    init: function() {
    },

    setPagination: function(pagerid, pageindex, pagesize, totalcount, totalpages, onpagechange, secondarypagerid) {
        if (pagerid != null) { this.pagerId = pagerid; }
        if (pageindex != null) { this.pageIndex = pageindex; }
        if (pagesize != null) { this.pageSize = pagesize; }
        if (totalcount != null) { this.totalCount = totalcount; }
        if (totalpages != null) { this.totalPages = totalpages; }
        if (onpagechange != null) { this.onPageChange = onpagechange; }
        if (secondarypagerid != null) { this.secondarypagerId = secondarypagerid; }
        this.setCurrentPage(this.pageIndex);
    },

    setCurrentPage: function(selecteditem) {
        var pageN = selecteditem + "";
        this.currentStart = parseInt((pageN.substring(0, pageN.length - 1)) + "0");

        if (!($("#" + this.pagerId + "PagingDropDown option").length >= parseInt(this.totalPages) && $("#" + this.pagerId + "PagingDropDown option").length <= parseInt(this.totalPages + 1))) {
            $("#" + this.pagerId + "PagingDropDown").empty();
            $("#" + this.secondarypagerId + "PagingDropDown").empty();
            if ($("#" + this.pagerId + "PagingDropDown").attr("selectedIndex") == "-1") {
                var options = "";
                for (var i = 0; i < this.totalPages; i++) {
                    options += '<option value="' + i + '">' + (i + 1) + '</option>';
                }
                $("#" + this.pagerId + "PagingDropDown").append(options);
                $("#" + this.secondarypagerId + "PagingDropDown").append(options);
            }
        }

        $("#" + this.pagerId + "PagingDropDown").attr("selectedIndex", selecteditem);
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "PagingDropDown").attr("selectedIndex", selecteditem);

        $("#" + this.pagerId + "Pagingpage" + this.pageIndex).removeClass("active");
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "Pagingpage" + this.pageIndex).removeClass("active");

        $("#" + this.pagerId + "Pagingpage" + selecteditem).addClass("active");
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "Pagingpage" + selecteditem).addClass("active");

        this.pageIndex = selecteditem;

        if (this.totalPages <= 1) {
            $("#" + this.pagerId + "PagingPager").hide();
            if (this.secondarypagerId != "")
                $("#" + this.secondarypagerId + "PagingPager").hide();
        }
        else {
            $("#" + this.pagerId + "PagingPager").show();
            if (this.secondarypagerId != "")
                $("#" + this.secondarypagerId + "PagingPager").show();
        }

        $("#" + this.pagerId + "PagingShowing").html(this.getShowing());
        if (this.secondarypagerId != "")
            $("#" + this.secondarypagerId + "PagingShowing").html(this.getShowing());

        var pagenumcontent = "";
        var maxPage = this.totalPages;
        if ((this.currentStart + this.maxPageDisplay) > this.totalPages)
            maxPage = this.totalPages;
        else
            maxPage = (this.currentStart + this.maxPageDisplay);

        for (var i = this.currentStart; i < maxPage; i++) {
            pagenumcontent += this.getPageNumber(this.pageIndex, i);
        }
        $("#" + this.pagerId + "PagingPageNumbers").attr("innerHTML", "");
        $("#" + this.pagerId + "PagingPageNumbers").html("Page " + pagenumcontent + "&nbsp;|&nbsp;");

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "PagingPageNumbers").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "PagingPageNumbers").html(pagenumcontent);
        }

        $("#" + this.pagerId + "Pagingpagenext10").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpagenext10").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpageprev10").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpageprev10").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpagenext").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpagenext").removeClass("nodisplay");
        $("#" + this.pagerId + "Pagingpageprev").removeClass("nodisplay");
        $("#" + this.secondarypagerId + "Pagingpageprev").removeClass("nodisplay");

        var prevpage = 0;
        if (this.pageIndex > 0)
            prevpage = parseInt(this.pageIndex) - 1;

        $("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
        $("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + prevpage + ");\">&#139; Prev</a>&nbsp;|&nbsp;");

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + prevpage + ");\">&#139; Prev</a>&nbsp;|&nbsp;");
        }

        var nextpage = this.pageIndex;
        if (this.totalPages > (parseInt(this.pageIndex) + 1))
            nextpage = parseInt(this.pageIndex) + 1;

        $("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
        $("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + nextpage + ");\">Next &#155;</a>&nbsp;|&nbsp;");

        if (this.secondarypagerId != "") {
            $("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' onclick=\"" + this.onPageChange + "(" + nextpage + ");\">Next &#155;</a>&nbsp;|&nbsp;");
        }

        if ((parseInt(this.currentStart) + parseInt(this.pageSize)) < parseInt(this.totalPages)) {
            $("#" + this.pagerId + "Pagingpagenext10").attr("innerHTML", "");
            $("#" + this.pagerId + "Pagingpagenext10").html("<a href='javascript:' onclick=\"NPagingControl.currentStart=" + (parseInt(this.currentStart) + 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) + 10) + ");\">Next10 &#155;&#155;</a>&nbsp;|&nbsp;");

            $("#" + this.secondarypagerId + "Pagingpagenext10").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpagenext10").html("<a href='javascript:' onclick=\"NPagingControl.currentStart=" + (parseInt(this.currentStart) + 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) + 10) + ");\">Next10 &#155;&#155;</a>&nbsp;|&nbsp;");
        } else {
            $("#" + this.pagerId + "Pagingpagenext10").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext10").addClass("nodisplay");
        }

        if (parseInt(this.currentStart) >= 10) {
            $("#" + this.pagerId + "Pagingpageprev10").attr("innerHTML", "");
            $("#" + this.pagerId + "Pagingpageprev10").html("<a href='javascript:' onclick=\"NPagingControl.currentStart=" + (parseInt(this.currentStart) - 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) - 10) + ");\">&#139;&#139; Prev10</a>&nbsp;|&nbsp;");

            $("#" + this.secondarypagerId + "Pagingpageprev10").attr("innerHTML", "");
            $("#" + this.secondarypagerId + "Pagingpageprev10").html("<a href='javascript:' onclick=\"NPagingControl.currentStart=" + (parseInt(this.currentStart) - 10) + "; " + this.onPageChange + "(" + (parseInt(this.currentStart) - 10) + ");\">&#139;&#139; Prev10</a>&nbsp;|&nbsp;");
        } else {
            $("#" + this.pagerId + "Pagingpageprev10").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev10").addClass("nodisplay");
        }

        if (parseInt(this.pageIndex) == 0 && parseInt(this.totalPages) == 1) {
            $("#" + this.pagerId + "Pagingpagenext").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");

            $("#" + this.pagerId + "Pagingpageprev").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
        } else if ((parseInt(this.pageIndex) + 1) == parseInt(this.totalPages)) {
            $("#" + this.pagerId + "Pagingpagenext").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpagenext").addClass("nodisplay");
            //$("#" + this.pagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpagenext").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpagenext").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>Next &#155;</a>&nbsp;|&nbsp;");
        } else if (parseInt(this.pageIndex) == 0) {
            $("#" + this.pagerId + "Pagingpageprev").addClass("nodisplay");
            $("#" + this.secondarypagerId + "Pagingpageprev").addClass("nodisplay");

            //$("#" + this.pagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.pagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
            //$("#" + this.secondarypagerId + "Pagingpageprev").attr("innerHTML", "");
            //$("#" + this.secondarypagerId + "Pagingpageprev").html("<a href='javascript:' style='text-decoration:none;color:#C6C6C6'>&#139; Prev</a>&nbsp;|&nbsp;");
        }
    },

    getShowing: function() {
        var frmCount = 0;
        var toCount = 0;
        var str = "Showing ";
        if (this.pageIndex == 0)
            frmCount = 1;
        else
            frmCount = (parseInt(this.pageIndex) * parseInt(this.pageSize) + 1);
        if (((parseInt(this.pageIndex) * parseInt(this.pageSize)) + parseInt(this.pageSize)) > this.totalCount)
            toCount = this.totalCount;
        else
            toCount = ((parseInt(this.pageIndex) * parseInt(this.pageSize)) + parseInt(this.pageSize));
        str += frmCount;
        str += " - ";
        str += toCount;
        str += " of ";
        str += this.totalCount;
        return str;
    },

    getPageNumber: function(pageindex, item) {
        var str = "<li>";
        str += "<a id='botpage";
        str += item + "' ";
        str += "href='javascript:' ";
        if (pageindex == item) {
            str += "class='active' ";
        }
        else {
            str += "class='' ";
        }
        str += "onclick=\"" + this.onPageChange + "('";
        str += item + "');\">"
        str += "<span>";
        str += item + 1;
        str += "</span></a>";
        str += "</li>";
        return str;
    }
}

