function get_page_sys(page, per_page, count, navfunction) {
	
	var page_system;
	
	if(page == "" || page == null){
		page = 1; 
	}
		
	if(count <= per_page ){
		return "";
	}
	
	pages = Math.ceil(count / per_page);
	lastPage = pages;  /*Added by Jr testing, used below as well */
		
	if (page == pages)
	{
		next = page;
	}
	else 
	{
		next = page + 1;
	}
	
	if (page == 1)
	{
		prev = 1;
	}
	else 
	{
		prev = page - 1;
	}
	
	page_system = "<div id='paging-system'><ul style='cursor:pointer;'>" + 
	"<li onclick='"+ navfunction +"(1);'><a>First</a></li>" +
	"<li onclick='" + navfunction + "(" +prev+ ");'><a>&#8249;&#8249; Previous</a></li>";
		
	if (page <= 5 )
	{
		// 1- (9 or last)
		start = 1;
		if (pages < 9) {
			end = pages;
		} else {
			end = 9;
		}
	}
	else if (page > 5 && pages >= page + 4)
	{
		// more or equal to 4 pages beyond current
		start = page - 4;
		if (start < 1)
		{
			start = 1;
		}
		end = page + 4;
	}
	else if (page > 5 && pages < page + 4)
	{
		// less than 4 pages beyond current 
		slack = pages - page;
		front = 8 - slack;
		start = page - front;
		if (start < 1)
		{
			start = 1;
		}
		end = page + slack;
	}
	
	for (var i = start; i <= end; i++)
	{
		if (i == page)
		{
			mark_current = " class='tag-current' ";
		}
		else 
		{
			mark_current = "";
		}
		page_system += "<li " + mark_current + " onclick='" + navfunction + "(" + i + ");' ><a>" + i + "</a></li>";
	}
	
	page_system += "<li onclick='" + navfunction + "(" + next + ");'><a>Next&nbsp;&#8250;&#8250;</a></li>" +
		"<li onclick='" + navfunction + "(" + lastPage + ");'><a>Last</a></li></ul></div><div style='clear:both;'></div>";	
		
	return page_system;
}