<!--
    var arr_MonthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var currDate = new Date();
    var currYear = currDate.getFullYear();
    var currMonth = currDate.getMonth();


    function LoadYear(ddlYear, selectCurYear, DefIndexText){
        var optn = document.createElement("OPTION");
        optn.text = DefIndexText;
        optn.value = -1;
        //document.frmPageNav.ddlYear.options.add(optn);
        document.getElementById(ddlYear).options.add(optn);

        for(var YearIndex = 2005;YearIndex <= currYear;YearIndex++){
            optn = document.createElement("OPTION");
            optn.text = YearIndex;
            optn.value = YearIndex;
            if(YearIndex == currYear && selectCurYear == true){
                optn.selected = true;
            }
            //document.frmPageNav.ddlYear.options.add(optn);
            document.getElementById(ddlYear).options.add(optn);
        }
    }

    function LoadMonth(ddlMonth, selectCurMonth, DefIndexText){
        var optn = document.createElement("OPTION");
        optn.text = DefIndexText;
        optn.value = -1;
        //document.frmPageNav.ddlMonth.options.add(optn);
        document.getElementById(ddlMonth).options.add(optn);

        for(var ind=0;ind<arr_MonthNames.length;ind++){
            optn = document.createElement("OPTION");
            optn.text = arr_MonthNames[ind];
            optn.value = currMonth;

            if(ind == currMonth && selectCurMonth == true)
                optn.selected = true;

            //document.frmPageNav.ddlMonth.options.add(optn);
            document.getElementById(ddlMonth).options.add(optn);
        }
    }
    
    
    
function Pager(id, tableName, itemsPerPage, noofpageDiv, actDataDiv, positionId, dispPagesIndex, ddlMonth, ddlYear, noRecMsg) {
    this.id = id;
    this.tableName = tableName;
    this.itemsPerPage = itemsPerPage;
    this.currentPage = 1;
    this.pages = 0;
    this.inited = false;
    this.noofpageDiv = noofpageDiv;
    this.actDataDiv = actDataDiv;
    this.positionId=positionId;
    this.ddlMonth = ddlMonth;
    this.ddlYear = ddlYear;
    this.noRecMsg = noRecMsg;
    this.dispPagesIndex = dispPagesIndex;
    this.action = '';
    this.startPageIndex = 1;
    this.endPageIndex = dispPagesIndex;

    this.showRecords = function(from, to) {
          var rows = document.getElementById(tableName).childNodes[0].childNodes;

				        // i starts from 1 to skip table header row

                         for (var i = 0; i < rows.length; i++)
				        {
						            if (i < from || i > to)
						                rows[i].style.display = 'none';
						            else
						                rows[i].style.display = '';
                         }
    }

    this.showPage = function(pageNumber) {
    	if (! this.inited) {
    		//alert("not inited");
    		//document.getElementById(this.noofpageDiv).innerHTML = "No records found.";
    		document.getElementById(this.noofpageDiv).innerHTML = "";
    		document.getElementById(this.tableName).innerHTML = this.noRecMsg;
    		return;
    	}


        this.currentPage = pageNumber;

        var from = (pageNumber - 1) * itemsPerPage;
        var to = from + itemsPerPage - 1;
        this.showRecords(from, to);
        var nopages="Showing " + this.currentPage+" of "+this.pages+" pages";

        document.getElementById(this.noofpageDiv).innerHTML=nopages;

        this.showPageNav(this.id, this.action);
        
    }

    this.prev = function() {
        if (this.currentPage > 1)
        {
            this.action = 'prev';
            this.showPage(this.currentPage - 1);
        }

    }

    this.next = function() {
        if (this.currentPage < this.pages)
        {
            this.action = 'next';
            this.showPage(this.currentPage + 1);
        }

    }

    this.init = function(tagtype) {
        var ctrl = document.getElementById(tableName);

        //First remove existing child nodes if any
        RemoveAllChildNodes(ctrl);
        ctrl.innerHTML = document.getElementById(this.actDataDiv).innerHTML;


    for(i=0;i<ctrl.childNodes.length;i++)
    {
                if(ctrl.childNodes[i].nodeName!=tagtype)
	             {
	             ctrl.removeChild(ctrl.childNodes[i]);
	             }
    }




               for(i=0;i<ctrl.childNodes[0].childNodes.length;i++)
		        {
//		          if(document.getElementById(tableName).childNodes[0].childNodes[i].nodeName=='LI'){
//		          //alert(document.getElementById(tableName).childNodes[0].childNodes[i].attributes["id"].nodeValue + ' ' + document.getElementById("ddlMonth").value + document.getElementById("ddlYear").value);
//		            if(document.getElementById(tableName).childNodes[0].childNodes[i].attributes["id"].nodeValue != document.getElementById("ddlMonth").value + document.getElementById("ddlYear").value){
//
//		                document.getElementById(tableName).childNodes[0].childNodes[i].style.display = 'none';
//		            }
//                  }

		          if(ctrl.childNodes[0].childNodes[i].nodeName!='LI')
				   {

		            ctrl.childNodes[0].removeChild(ctrl.childNodes[0].childNodes[i]);
		           }

                 }

            var index = 0;
            var maxindex = ctrl.childNodes[0].childNodes.length;
            var subctrl = ctrl.childNodes[0];
            var chkMonth="", chkYear=-1;

            if(document.getElementById(this.ddlMonth).value != -1)
                chkMonth = document.getElementById(this.ddlMonth).options[document.getElementById(this.ddlMonth).selectedIndex].text.toUpperCase();

            if(document.getElementById(this.ddlYear).value != -1)
                chkYear = document.getElementById(this.ddlYear).value;


            while(subctrl.childNodes[index]){
                if(subctrl.childNodes[index].attributes.length > 0){
                    var MonthIndex, YearIndex, idMonthYear;
                    idMonthYear = subctrl.childNodes[index].attributes["id"].nodeValue.toUpperCase();

                    if(idMonthYear.indexOf(chkMonth) >=0 && idMonthYear.indexOf(chkYear) >= 0 ){
                        index = index + 1;
                    }
                    else if(chkYear == -1 && idMonthYear.indexOf(chkMonth) >= 0){
                        index = index + 1;
                    }
                    else if(chkMonth == "" && idMonthYear.indexOf(chkYear) >= 0){
                        index = index + 1;
                    }
                    else{
                        subctrl.removeChild(subctrl.childNodes[index]);
                    }


                }

                if (index == maxindex) break;
            }




         var rows = ctrl.childNodes[0].childNodes;

if(rows.length>0){
         var records = (rows.length);
		 this.pages = Math.ceil(records / itemsPerPage);
            this.currentPage = 1;
        this.inited = true;
}else{
    this.inited = false;
}


     }

    this.showPageNav = function(pagerName, action) {

        var startPage, maxPage;
    	var element = document.getElementById(this.positionId);

    	if (! this.inited) {
    		//alert("not inited");
    		element.innerHTML = "";
    		return;
    	}

        this.action = action;
        switch(action.toString().toUpperCase()){
            case 'FIRST':
                startPage = 1;
                maxPage = startPage + (this.dispPagesIndex-1);
                maxPage = checkMaxPageIndex(maxPage, this.pages);
                this.startPageIndex = startPage;
                this.endPageIndex = maxPage;
                break;
            case 'PREV':
                startPage = this.currentPage;
                startPage = checkStartPageIndex(startPage);
                if(startPage > this.startPageIndex)
                    startPage = this.startPageIndex;
                    
                maxPage = startPage + (this.dispPagesIndex-1);
                maxPage = checkMaxPageIndex(maxPage, this.pages);
                this.endPageIndex = maxPage;
                break;
            case 'NEXT':
                startPage = this.currentPage - (this.dispPagesIndex-1);
                startPage = checkStartPageIndex(startPage);
                maxPage = startPage + (this.dispPagesIndex-1);
                maxPage = checkMaxPageIndex(maxPage, this.pages);
                this.startPageIndex = startPage;
                this.endPageIndex = maxPage;
                break;
            case 'LAST':
                startPage = this.pages - (this.dispPagesIndex-1);
                maxPage = startPage + (this.dispPagesIndex-1);
                maxPage = checkMaxPageIndex(maxPage, this.pages);
                this.startPageIndex = startPage;
                this.endPageIndex = maxPage;
                break;
            default:
                startPage = 1;
                maxPage = startPage + (this.dispPagesIndex-1);
                maxPage = checkMaxPageIndex(maxPage, this.pages);
                this.startPageIndex = startPage;
                this.endPageIndex = maxPage;
                break;
        }
        

        this.startPageIndex = checkStartPageIndex(this.startPageIndex);
        this.endPageIndex = checkMaxPageIndex(this.endPageIndex, this.pages);
        

            
    	var pagerHtml='<span id="pgfirst" onclick="' + pagerName + '.action=\'first\';' + pagerName + '.showPage(1);" class="pg-normal"> &#171 First </span> ';
    	pagerHtml+= '<span id="pgpr" onclick="' + pagerName + '.prev();" class="pg-normal"> &#60 Prev | </span> ';
    	
    	for (var page = startPage; page <= maxPage; page++){
            pagerHtml += '<span id="pg' + page + '" class="' + ((page==this.currentPage)?"pg-selected":"pg-normal") + '" onclick="' + pagerName + '.showPage(' + page + ');">' + page + '</span> | ';
        }
        pagerHtml += '<span id="pgne" onclick="'+pagerName+'.next();" class="pg-normal"> Next &#62;</span>';
        pagerHtml+='<span id="pglast" onclick="' + pagerName + '.action=\'last\';' + pagerName + '.showPage('+this.pages+');" class="pg-normal"> Last &#187 </span> ';
        element.innerHTML = pagerHtml;
        

    }
}

function checkMaxPageIndex (maxPage, NoofPages){
    if(maxPage > NoofPages)
        return NoofPages;
    else    
        return maxPage;
}

function checkStartPageIndex(startPage){
    if(startPage < 1)
        return 1;
    else    
        return startPage;
}

function RemoveAllChildNodes(parentNode){
    if(parentNode.childNodes.length>0){
        while(parentNode.childNodes[0]){
            parentNode.removeChild(parentNode.childNodes[0]);
        }
    }
}
    

//-->
