// JavaScript Document

function pageNav(totalRows,rowsShowing,currentPage,url){
		
		if( (currentPage*rowsShowing) > totalRows) {
			var topCount = totalRows;
		}else{
			var topCount = (currentPage*rowsShowing);
		}
		
		var paging = "<div class='pageNavHolder'>";
		
		if(currentPage != 1){
			paging += "<div class='pageNavArrows'><a href='" + url + "pageNum=" + (currentPage-1) + "'><img src='includes/template/public/img/pagenation/page_nav_arrow_prev.png'/></a></div>"
		}
		
		var numOfPages = Math.ceil(totalRows/rowsShowing);
		
		if(numOfPages > 1){
		
			for(e=0; e<numOfPages; e++){
				if((e+1) != currentPage){
					paging += "<div class='pageNumNorm'><a href='" + url + "pageNum=" + (e+1) + "'>" + (e+1) + "</a></div>";
				}else{
					paging += "<div class='pageNumSel'>" + (e+1) + "</div>";
				}
			}
			
			if(currentPage != numOfPages){
				paging += "<div class='pageNavArrows'><a href='" + url + "pageNum=" + (currentPage+1) + "'><img src='includes/template/public/img/pagenation/page_nav_arrow_next.png'/></a></div>"
			}
			
			paging += "</div>";
		
		}
		
		document.getElementById("pageNav1").innerHTML = "<div class='pagesShowing'>Showing <strong>" + (((currentPage-1)*rowsShowing)+1) + "</strong> - <strong>" + topCount + "</strong> of <strong>" + totalRows + "</strong> products</div><div class='pageNavFloatCon'>" + paging + "</div><div class='clearing'></div>";
		document.getElementById("pageNav2").innerHTML = "<div class='pagesShowing'>Showing <strong>" + (((currentPage-1)*rowsShowing)+1) + "</strong> - <strong>" + topCount + "</strong> of <strong>" + totalRows + "</strong> products</div><div class='pageNavFloatCon'>" + paging + "</div><div class='clearing'></div>";
}