function Paging(id)
{
	//-----------------------------------------------------------------------------------------------------------
	// Member variables
	//-----------------------------------------------------------------------------------------------------------

	// Public
	this.id = id;
	this.numPages;
	this.maxPages = 10;
	this.numItemsPerPage = 5;
	this.currentPage = 1;
	this.containerId = '';
	this.pagingHtml = '';
	
	//-----------------------------------------------------------------------------------------------------------
	// Public functions
	//-----------------------------------------------------------------------------------------------------------
	
	this.addPaging = addPaging;
	
	//-----------------------------------------------------------------------------------------------------------
	// Functions
	//-----------------------------------------------------------------------------------------------------------	
	
	function addPaging()
	{
		html = '';
		
		// Don't display page numbers if there is only one page
		if (this.numPages > 1)
		{
			var startPage = 1;
			
			if (this.numPages > this.maxPages)
			{
				startPage = this.currentPage - Math.ceil(this.numItemsPerPage / 2) - 1;
				if (startPage < 1)
				{
					startPage = 1;
				}
				else if (startPage > (this.numPages - this.maxPages))
				{
					startPage = this.numPages - this.maxPages + 1;
				}
			}
			
			for (i = startPage; i < startPage + this.maxPages; i++)
			{
				if (i > this.numPages)
				{
					break;
				}
				
				html += '<a href=""' + (this.currentPage == i ? ' class="current"' : '')
				+ ' onclick="' + this.id + '.showPage(' + i + '); return false;">' + i + '</a>\n';
			}
			
			html = '<div class="pages">' + html + '</div>';
		}
		
		$('#' + this.containerId).append('<div class="pageBox">' + this.pagingHtml + html + '</div>');
	}
}
