$(document).ready(function() {

	if($('.paginaoverzicht .item.fader').length)
		$('.paginaoverzicht .item.fader').cycle({
			fx: 'fade',
			random: 1
		});
	
	var bTekst = true;
	$(".producten-detail .link").click(function () {
		objLink = $(this);
		$(".producten-detail .img-holder .bottom").slideToggle("slow", function(){
			if(bTekst) {
				$(".producten-detail .link").html(objLink.attr("rel"));
				bTekst = false;
			}
			else {
				$(".producten-detail .link").html(objLink.attr("rev"));
				bTekst = true;
			}
		});
	});
	
	$(".hetmenu li.showchild").click(function () {
		if($(this).parent().find("ul.sub").css("display") == "none") {
			$(this).parent().find("li a").removeClass("over");
			$(this).find("a").addClass("over");
			$(this).parent().find("ul.sub").css("display","block");
		}
		else {
			$(this).parent().find("li a").removeClass("over");
			$(this).find("a").addClass("over");
			$(this).parent().find("ul.sub").css("display","none");
		}
		//$(this).
	});
	
	
	
	$(".paginaoverzicht .seperateinpages").each(function (index, value) {
		//highlight first time
		if(index == 0) {
			$(".verkoopforeach").append('<a href="javascript: void(0);" class="highlight" rel="'+(index+1)+'">'+(index+1)+'</a> <span>|</span>');
			$(this).css("display","block");
		}
		else {
			$(".verkoopforeach").append('<a href="javascript: void(0);" rel="'+(index+1)+'">'+(index+1)+'</a> <span>|</span>');	
		}
	});
	
	$(".verkoopforeach a").click(function () {
		$(".verkoopforeach a").each(function (index, value) {
			$(this).removeClass("highlight");
		});
		objClickedHref = $(this);
		$(".paginaoverzicht .seperateinpages").each(function (index, value) {
			if(index == (objClickedHref.attr("rel")-1)) {
				objClickedHref.addClass("highlight");
				$(this).css("display","block");
			}
			else {
				$(this).css("display","none");
			}
		});
	});

});
