function virtualpaginate(className, chunksize, elementType, ltc, ap, an, ln) { this.chunksize=chunksize; this.listToCollect=ltc; this.anchorsPrevious=ap; this.anchorsNext=an; this.labelNumber=ln; //alert(this.labelNumber); var elementType=(typeof elementType=="undefined")? "div" : elementType this.pieces=virtualpaginate.collectElementbyClass(className, elementType) //get total number of divs matching class name this.pagecount=Math.ceil(this.pieces.length/this.chunksize) //calculate number of "pages" needed to show the divs this.totalStories=virtualpaginate.collectElementbyClass(this.listToCollect, "tr"); this.showpage(-1) //show no pages (aka hide all) this.currentpage=0 //Having hidden all pages, set currently visible page to 1st page //alert(this.currentpage); this.showpage(this.currentpage) //Show first page} } function navigatePages() { var numberOfPages=document.getElementsByTagName("tr").length; var pagesToDisplay=5; var batches=1; if ( numberOfPages >= pagesToDisplay) { if ( (numberOfPages % pagesToDisplay)==0) { batches=numberOfPages/pagesToDisplay; } else { batches=Math.floor(numberOfPages/pagesToDisplay)+1; } } } virtualpaginate.collectElementbyClass=function(classname, element)//Returns an array containing DIVs with specified classname { //alert(classname); var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element var pieces=[] var alltags=document.getElementsByTagName(element) for (var i=0; i=showstartindex && i<=showendindex) this.pieces[i].style.display="block" else this.pieces[i].style.display="none" } this.currentpage=parseInt(pagenumber) } virtualpaginate.prototype.buildpagination=function(divid){ //alert(divid); var instanceOfBox=this var paginatediv=document.getElementById(divid) var paginationcode=paginatediv.innerHTML //Get user defined, "unprocessed" HTML within paginate div //alert(paginatediv.getElementsByTagName("a").length); if (paginatediv.getElementsByTagName("a").length>0) //if there are links defined in div this.paginate_build_regularlinks(paginatediv.getElementsByTagName("a")) this.paginatediv=paginatediv } virtualpaginate.prototype.navigate=function(keyword) { if (keyword=="previous") this.currentpage=(this.currentpage>0)? this.currentpage-1 : (this.currentpage==0)? this.pagecount-1 : 0 else if (keyword=="next") this.currentpage=(this.currentpage