function paginator(el, numItems, itemsInRow)
{
	this.itemsInRow = itemsInRow;
	this.numItems = numItems;
	this.element = el;
	var content = new Array();
	
	this.init = function()
	{
		content = this.getContent();
		if (content.length > 6) {
			$(this.element + " .pagination").pagination(content.length, {
				items_per_page: this.numItems, 
				callback: this.handlePaginationClick,
				prev_text: "Vorige",
				next_text: "Volgende",
				ellipse_text: "...",
				prev_show_always: true,
				next_show_always: true
			});
		} else if (content.length > 0) {
			$(this.element + " .pagination").pagination(content.length, {
				items_per_page: content.length, 
				callback: this.handlePaginationClick,
				prev_text: "Vorige",
				next_text: "Volgende",
				ellipse_text: "...",
				prev_show_always: true,
				next_show_always: true
			});		
		} else {
			
		}
		//setPagination();
	}	
	
	this.handlePaginationClick = function(new_page_index, pagination_container)
	{
		var page = new_page_index;
		//var url = window.location.hash;
		//url = url.split("&page=");
		//if (url[1] != "" && new_page_index != 0 && page != "NaN" && page != NaN) {
		//	window.location.hash = url[0] + "&page=" + page;
		//}
		var rowCounter = 1;
		var productCounter = 1;
		var rowClass;
		var el = $(".pagination");
		var items_per_page = 8;
		
		$("#producten").html(null);
		for(var i = new_page_index * items_per_page; i < (new_page_index * items_per_page) + items_per_page; i++) {
			if ($(content[i]).context == undefined) {
				var addContent = $(content[i]);
				if (productCounter > items_per_page) {
					productCounter = 1;
					rowCounter++;
				}
				addContent.addClass("product" + productCounter);
				if (rowCounter % 2 == 0) {
					rowClass = "Even";
				} else {
					rowClass = "Odd";
				}
				addContent.addClass("productRow" + rowClass);
				addContent.addClass("productRow" + rowCounter);
				$("#producten").append(addContent);
				productCounter++;
			}
		}
		$("#producten").append("<div class='clear'></div>");
		return false;
	}

	this.getContent = function()
	{
		var i = 0;
		var contentArray = new Array();
		$("#producten .artikel").each(function() {
			contentArray[i] = $(this);
			i++;
		});
		return contentArray;
	}
}