
function initTooltip() {
	var _slideSpeed = 200;

	$("a.tooltip-opener").each(function(){
		var _parent = $(this).parent();
		var _tooltip = _parent.find(" > div.tooltip").eq(0);
		var _offset = _parent.offset();
		var _hovering = false;
		_tooltip.css({opacity:0});

		if(_tooltip.length) {
			$(this).mouseenter(function(){
				// animate tooltip
				_hovering = true;
				_parent.css({position:"relative"});
				_tooltip.show().animate({opacity: 1}, _slideSpeed, false);
			}).mouseleave(function(){
				_hovering = false;
				_tooltip.show().animate({opacity: 0}, 0, false, function(){
					_parent.css({position:"static"});
				});
			});

			// make tooltip follow mouse
			$(_parent).mousemove(function(e){
				if(_hovering) _tooltip.css({left:e.pageX-_offset.left+20,top:e.pageY-_offset.top+20});
			});
		}
	});
}

function initFlashBoxes() {
	var params = {
	  allowScriptAccess: "sameDomain",
	  quality: "high",
	  menu: "false",
	  wmode: "transparent"
	};
	var attributes = {
		server: "live"
	};
	var flashvars = {
		server: "live"
	};

	swfobject.embedSWF("/swf/billboard.swf", "channel-bar", "925", "99", "9.0.0","expressInstall.swf", flashvars, params, attributes);

	swfobject.embedSWF("/swf/feature.swf", "feature", "258", "200", "9.0.0","expressInstall.swf", flashvars, params, attributes);
	swfobject.embedSWF("/swf/special.swf?type=galerij", "galerij", "258", "65", "9.0.0","expressInstall.swf", flashvars, params, attributes);
	swfobject.embedSWF("/swf/special.swf?type=dossier", "dossier", "258", "65", "9.0.0","expressInstall.swf", flashvars, params, attributes);
	swfobject.embedSWF("/swf/special.swf?type=bloggers", "bloggers", "258", "65", "9.0.0","expressInstall.swf", flashvars, params, attributes);
}


$(document).ready(function(){
	//initTooltip();
	initCufon();

	initFlashBoxes();

	// Externe links target blank geven
	$("a[href*='://']").attr('target', '_blank');

	$("a[href^='#print']").click(function(){
		window.print();
	});

	if(document.location.hash == '#print') {
		window.print();
	}

	if($('div.gallery-holder').length) {
		$('div.gallery-holder a').fancybox({
 			'zoomSpeedIn': 250,
 			'zoomSpeedOut': 250,
 			'centerOnScroll': true,
 			'hideOnContentClick': true,
 			'zoomSpeedChange': 50,
 			'overlayOpacity': 0.7
		});
	}

	$("a[href^='#taf']").click(function(){
		$('#dossier-taf').animate({"height": "toggle", "opacity": "toggle"}, "slow");
	});
});
