var newProducts;
var oldhash;
var page;
var originaltitle = "";

/*function pageload(hash) {
	if (page == undefined || page == "" || page == "NaN" || page == "undefined" || page == NaN) {
		page = 0;
	}
	if(hash) {
		var splithash = hash.split("&page=");
		if (splithash[1] != undefined) {
			page = splithash[1];
		} else {
			page = 0;
		}
		if (splithash[0] != oldhash) {
			productFilter.history(hash);
			productFilter.request();
		} else {
			setPagination();
		}
		oldhash = splithash[0];
	}
	$("#productFilter > ul > li").each(productFilter.hideItems);
}*/

function setPagination() {
	newProducts.handlePaginationClick(page, $('#newProducts'));
}

$(document).ready(function() {
	//$.history.init(pageload);
	newProducts = new paginator("#newProducts", 8, 4);
        if ($("#producten").children(".artikel").length > 8) {
            //setPagination();
            newProducts.init();
        }
	CasualKidsWearCart.init();
	
	//var hash = window.location.hash;
	//hash = hash.replace(/^.*#/, '');
	//if (hash != '') {
	//	productFilter.clickLink(hash);
	//}
	
	$('div.filter ul li.parent').hover(function() {$(this).children("ul").show()}, function() {$(this).children("ul").hide()});
	
//	$("#productFilter > ul > li").hover(productFilter.showItems, productFilter.hideItems);
	//$("#productFilter > ul > li").click(productFilter.clickShowItems);
	//$("#productFilter input[type='checkbox']").click(productFilter.clickItem);
	$("img.hoverimage").hover(function() {
		var src = $(this)[0].getAttribute("src").split("_");
		src[1] = "hover";
		$(this)[0].setAttribute("src", src.join("_") + ".jpg");
	}, function() {
		var src = $(this)[0].getAttribute("src").split("_");
		src[1] = "bw";
		$(this)[0].setAttribute("src", src.join("_") + ".jpg");
	});
        //$("ul.brands > li > a").click(function()
        //{
        //    productFilter.clickShowItems();
        //});
});