var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}

$(function() {
	
	/* scroll-blok homepage */
		
	$("#scroll-vorige").hover(
		function () {
			$(this).animate({ height: "18px", marginTop: "-3px" }, "fast");
		}, 
		function () {
			$(this).animate({ height: "15px", marginTop: "0px" }, "fast");
	}).click(function () {
		if ($("#scroll-navigatie h3.actief").prev("h3").length > 0 && !$("#scroll-blok").is(":animated")) {
			if($("#scroll-navigatie h3.actief").prev("h3").prev("h3").length == 0){
				$("#scroll-vorige").css("visibility","hidden");
			}
			$("#scroll-volgende").css("visibility","visible");
			$("#video-speler").css("visibility","hidden");
			player.sendEvent("PREV");
			player.sendEvent("playpause");
			$("#scroll-blok .scroll-blok-item.actief, #scroll-navigatie h3.actief").removeClass("actief").prev().addClass("actief");
			$("#scroll-blok").animate({ scrollTop: ($("#scroll-blok").scrollTop()-406) }, 2000, "linear", function(){
				player.sendEvent("playpause");
				$("#video-speler").css("visibility","visible");
			});
		}
    });
	
	$("#scroll-volgende").hover(
		function () {
			$(this).animate({ height: "18px" }, "fast");
		}, 
		function () {
			$(this).animate({ height: "15px" }, "fast");
	}).click(function () {
		if ($("#scroll-navigatie h3.actief").next("h3").length > 0 && !$("#scroll-blok").is(":animated")) {
			if($("#scroll-navigatie h3.actief").next("h3").next("h3").length == 0){
				$("#scroll-volgende").css("visibility","hidden");
			}
			$("#scroll-vorige").css("visibility","visible");
			$("#video-speler").css("visibility","hidden");
			player.sendEvent("NEXT");
			player.sendEvent("playpause");
			$("#scroll-blok .scroll-blok-item.actief, #scroll-navigatie h3.actief").removeClass("actief").next().addClass("actief");
			$("#scroll-blok").animate({ scrollTop: ($("#scroll-blok").scrollTop()+406) }, 2000, "linear", function(){
				player.sendEvent("playpause");
				$("#video-speler").css("visibility","visible");
			});
		}
    });
	/* einde scroll-blok hompage */
	
	$("#filmpjes-overzicht a").hover(
		function () {
			$(this).find("div.filmpjes-overzicht-meer-tekst").slideDown();
		}, 
		function () {
			$(this).find("div.filmpjes-overzicht-meer-tekst").slideUp("fast");
		}
	);
	
});