Cufon.replace('#priMenu, #secMenu, .homeBlock strong, .nieuwsBlock strong, h1, h2, .actueleOnderwerpen strong, .interactiveBlock a, #contactBlock a, .tweet strong, #directNaar strong, .overYellowBlock strong ', { fontFamily: 'Myriad Pro', hover:true });

$(document).ready(function() {
						   
	$update = false;
	$('a.nieuwsBlock, a.homeBlock, a.overYellowBlock').hover(function(){
		Cufon.replace('a.nieuwsBlock strong,a.homeBlock strong, a.overYellowBlock strong', { fontFamily: 'Myriad Pro' });
		$update=true;
	});
	
	$("body").mousemove(function(e){
		if($update==true){
			Cufon.replace('a.nieuwsBlock strong, a.homeBlock strong, a.overYellowBlock strong', { fontFamily: 'Myriad Pro' });
		}
	});
	

	if ($('#contactBlock').length){
		$('#contactBlock').find('a').first().attr('id', 'contactBlock1');
		$('#contactBlock').find('a').last().attr('id', 'contactBlock2');
		Cufon.replace('.interactiveBlock a, #contactBlock a', { fontFamily: 'Myriad Pro', hover:true });
	}
	
	//Tweets
	$(".tweet .tweetBlock:last").addClass("last");	
	$('.invisible').css('display','none');
	$('#tweetBlockList').jScrollPane({maintainPosition :false});
	
	$hover = false;
	$('.jScrollPaneTrack').prepend('<div class="top"/><div class="bottom"/>');
	$(document).everyTime(5000, function(i) {
		if($hover == false){
			$('.tweetBlock:hidden:last').slideToggle(
				function(){
					$('#tweetBlockList').jScrollPane({maintainPosition :false});
					$('.jScrollPaneTrack').prepend('<div class="top"/><div class="bottom"/>');
				}
			);
		}
	});
	
	$('.tweet').hover(function(){
		$hover = true;
	},function(){
		$hover = false;
	});
	
	
	$('.sitemap a.toggle').click(function(){
		$(this).parents("li").children("ul").slideToggle("slow");
		if($(this).html()=='+'){ $(this).html("-"); } 
		else { $(this).html("+"); }
	})

	$("ol li").wrapInner('<span/>');
	
	$("#footer p:eq(0)").addClass("left");
	$("#footer p:eq(1)").addClass("right");
	
	Shadowbox.init({
		overlayOpacity: "0.9"
	});


	var timer1; var timer2; var timer3; var timer4;
	
	var main = $('.slides img');
	var opts = {
		image		:	"~general/images/img-teaser-01.jpg",
		opacity		:	0.8,
		blurLevel	:	4,
		init		: 	true
	}
	main.blurImage(opts);

	$(".blurWrapper").children(".blur").animate({"opacity" : 0}, 0);
	$(".slideOverlayText").css({"opacity" : 0});
	
	$('.slides').cycle({ 
		fx:     'scrollVert',
		speed:  1000, 
		timeout: 8000, 
		pager:  '#teaserPaging',
		before:	before,
		after:	after,
		easing: "easeOutQuad",
		pagerEvent: ""
	});
	
	/*var imgWidth = [];
	var margin = []
	for(i = 1; i < ($(".blurWrapper").size() + 1); i++){
		imgWidth[i] = 0;
		$(".nr"+i+"").children(".slideLogo").each( function() {
			var img = new Image();
			img.src = $(this).attr("src");
			imgWidth[i] = imgWidth[i] + img.width;
			
		});
		margin[i] = (862 - imgWidth[i])/5;
		$(".slideOverlay.nr"+i+" .slideLogo").css("margin-left", margin[i] + "px");
		$(".slideOverlay.nr"+i+" .slideLogo:last-child").css("margin-right", margin[i] + "px");
	}*/
	
	//var margin = $(".slideOverlay").width() - 

	
});

function before(){
		//$(".slideOverlay").css({"display" : "block"});
		
		//$(".slideOverlayText").css({"display" : "block"})
		//$(".slideOverlayText").animate({"opacity" : 1}, 500)
	$(".blurWrapper").each( function() {
			if($(this).css("display") == "block"){
				var main = $(this);
				var opts = {
					image		:	"~general/images/img-teaser-01.jpg",
					opacity		:	0.8,
					blurLevel	:	4,
					init		:	false,
					lass		:	main.children(".slideOverlay").attr("class")
				}
				main.blurImage(opts);
			}
		});
}

function after(){
	$(".blurWrapper").each( function() {
		if($(this).css("display") == "none"){
			$(".slideOverlayText").css({"opacity" : 0, "display" : "block"});
			var main = $(this);
			main.children(".blur").animate({"opacity" : 0}, 250);
		}
	});
	//$(".slideOverlayText").css({"display" : "block"})
	//$(".slideOverlayText").animate({"opacity" : 1}, 500)
		timer1 = setTimeout('$(".slideOverlayText").animate({"opacity" : 1}, 500, function() {$(".slideOverlayText").css({"display" : "block"})})', 0);
		timer2 = setTimeout('$(".slideOverlay").css({"display" : "block"}); $(".slideOverlay").animate({"bottom" : 0}, 1250, "easeOutQuad")', 0);
		timer3 = setTimeout('$(".slideOverlay").animate({"bottom" : -55}, 500, function() {$(".slideOverlay").css({"display" : "none"})})', 6500);
		timer4 = setTimeout('$(".slideOverlayText").animate({"opacity" : 0}, 500, function() {$(".slideOverlayText").css({"display" : "none"})})', 7000);
		
}

