//knop wisselaar homepagina
var animation_actief = 0;
function animation(){
	if(animation_actief == 0) {
		$("#hb_bestelboek-1 img").fadeOut();
		$("#hb_bestelboek-2 img").fadeIn();
		animation_actief = 1;
	} else {
		$("#hb_bestelboek-1 img").fadeIn();
		$("#hb_bestelboek-2 img").fadeOut();
		animation_actief = 0;
	}
	setTimeout('animation()', 4000);
}
//setTimeout('animation()', 4000);

//producten op de homepage
$('#wpb_hold-2').hide();
$('#wpb_hold-3').hide();
$('#wpb_hold-4').hide();
$("#wizzlr_prod_head-1").addClass("actief");
$("#wizzlr_prod_head-1").click(function() {
	$(".wizzlr_prod_head ul li").removeClass("actief");
	$("#wizzlr_prod_head-1").addClass("actief");
	$('#wpb_hold-1').show();
	$('#wpb_hold-2').hide();
	$('#wpb_hold-3').hide();
	$('#wpb_hold-4').hide();
});
$("#wizzlr_prod_head-2").click(function() {
	$(".wizzlr_prod_head ul li").removeClass("actief");
	$("#wizzlr_prod_head-2").addClass("actief");
	$('#wpb_hold-1').hide();
	$('#wpb_hold-2').show();
	$('#wpb_hold-3').hide();
	$('#wpb_hold-4').hide();
});
$("#wizzlr_prod_head-3").click(function() {
	$(".wizzlr_prod_head ul li").removeClass("actief");
	$("#wizzlr_prod_head-3").addClass("actief");
	$('#wpb_hold-1').hide();
	$('#wpb_hold-2').hide();
	$('#wpb_hold-3').show();
	$('#wpb_hold-4').hide();
});
$("#wizzlr_prod_head-4").click(function() {
	$(".wizzlr_prod_head ul li").removeClass("actief");
	$("#wizzlr_prod_head-4").addClass("actief");
	$('#wpb_hold-1').hide();
	$('#wpb_hold-2').hide();
	$('#wpb_hold-3').hide();
	$('#wpb_hold-4').show();
});
	
///////////////////////////////////////////////////////////////////////////////////

//wizzlr blok (homepage bovenaan)
var $$ = $.fn;
var pauze=0;
// begin
$('#wizzlr_blok-2').hide();
$('#wizzlr_blok-3').hide();
$('#wizzlr_blok-4').hide();
$$.extend({
	SplitID : function() {
		return this.attr('id').split('-').pop();
    },
	Slideshow : {
		Ready : function() {
			$('#wizzlr_menu ul li')
			.hover(
				function() {
					$(this).addClass('actief');
				},
				function() {
					$(this).removeClass('actief');
				}
			)
			.click(
				function() {
					$$.Slideshow.Interrupted = true;

					$('.wizzlr_blok').hide();
					$('#wizzlr_menu ul li').removeClass('actief1');	
					
					$('#wizzlr_blok-' + $(this).SplitID()).show();
					$(this).addClass('actief1');
        
					$$.Slideshow.Counter = parseInt($(this).SplitID());
					clearTimeout($$.Slideshow.Tijd);
					$$.Slideshow.Tijd = setTimeout('$$.Slideshow.Resume();', 5000);
				}
			);

			this.Counter = 1;
			this.Interrupted = false;

			$$.Slideshow.Transition();
			//pauze stuk
			$('#wizzlr_pauze').click(function() {
				if(pauze == 0) {
					$$.Slideshow.Interrupted = true;
					clearTimeout($$.Slideshow.Tijd);
					$('#wizzlr_pauze').addClass('wizzlr_actief');
					pauze = 1;
				} else {
					this.Interrupted = false;
					$$.Slideshow.Tijd = setTimeout('$$.Slideshow.Resume();', 5000);
					$('#wizzlr_pauze').removeClass('wizzlr_actief');
					pauze = 0;
				}
			});
		},
		Resume : function() {
			$('div.wizzlr_blok').hide();
			$('#wizzlr_menu ul li').removeClass('actief1');	

			if (this.Counter == 4) {
				this.Counter = 1;
			}
			else {
				this.Counter++;
			}

			this.Interrupted = false;
			$$.Slideshow.Transition();
		},
		Transition : function() {
			if (this.Interrupted) {
				return;
			}

			this.Last = this.Counter - 1;

			if (this.Last < 1) {
				this.Last = 4;
			}

			$('#wizzlr_blok-' + this.Last).fadeOut(
				'slow',
				function() {
					$('#wizzlr_menu-' + $$.Slideshow.Last).removeClass('actief1');
					$('#wizzlr_menu-' + $$.Slideshow.Counter).addClass('actief1');
					$('#wizzlr_blok-' + $$.Slideshow.Counter).fadeIn('slow');

					$$.Slideshow.Counter++;

					if ($$.Slideshow.Counter > 4) {
						$$.Slideshow.Counter = 1;
					}

					setTimeout('$$.Slideshow.Transition();', 5000);
				}
			);
		}
	}
});

$(document).ready(
	function() {
		$$.Slideshow.Ready();
	}
);

