$(document).ready(

	function()
	{
		initTime();
		//initTimeline();
		initCarousel();
		initVideoPlayer();
		initDossierHeader();
		initReactieHeaders();
  	}	

);

function initFlashFonts()
{
	/*
	$("*[class^='flashfont']").each(
		function()
		{
			var data = $(this).attr("class").split("_");
			var size = data[1];
			var width = data[2];		
		}
	);
	
	'.sIFR-root': { 'text-transform': 'uppercase' },
	
	*/
	
	var conduit =
	{
		src: '/static/flash/conduit_medium.swf',
		ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
	};
	
	var conduitBold =
	{
		src: '/static/flash/conduit.swf',
		ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
	};
		
	sIFR.activate( conduit );
	sIFR.activate( conduitBold );
	
	sIFR.replace( 
		conduit,
		{
			selector: '.dossier-hilite h2.flashfont',
			css:
			{
				
				
				'a': { 'color': '#000000', 'text-decoration': 'none'},
				
				'a:hover': { 'color': '#000000 ', 'text-decoration': 'underline' }
			},
			offsetTop: 4,
			
			tuneHeight: 0,
			
			wmode: "transparent"
			
		}     
	);
	
	sIFR.replace( 
		conduit,
		{
			selector: 'h1.flashfont,h2.flashfont,h3.flashfont,h4.flashfont, .latest-item',
			css:
			{				
				'a': { 'color': '#000000', 'text-decoration': 'none'},
				
				'a:hover': { 'color': '#000000 ', 'text-decoration': 'underline' }
			},
			
			offsetTop: 4,
			
			tuneHeight: 0,
			
			wmode: "transparent"
			
			
		}     
	);
	
	
	
	sIFR.replace( 
		conduitBold,
		{
			selector: 'span.flashfont, span.published',
			css:
			{
				'.sIFR-root': { 'background-color': '#000000', 'color':'#ffffff', 'text-align': 'center' }
			},
			offsetTop: 1,
			tuneHeight: -6,
			
			wmode: "transparent"
			
		
		}     
	);	

	
	sIFR.replace( 
		conduitBold,
		{
			selector: '.bar h2',
			css:
			{
				'.sIFR-root': { 'text-transform': 'uppercase', 'color': '#ffffff' }
			},
			offsetTop: 4,
		
			wmode: "transparent"
			
			
		}     
	);	
	

      
}

initFlashFonts();




/*
	flash replacements
*/

function initTimeline()
{
	var id = "timeline";
	
	if ( document.getElementById(id) )
	{
		var data = ( document.getElementById(id).className ).split("_");
				
		if ( data[1] && parseInt( data[1] ) > 0 )
		{
			var flashvars = { dossier: parseInt( data[1] ) };
			var params = { wmode: "transparent" };
			var attributes = {};
						
			swfobject.embedSWF("/static/flash/timeline.swf", id, "944", "550", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
		}
	}
	
	
	var id = "timeline_throw";
	
	if ( document.getElementById(id) )
	{
		var flashvars = {};
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/novathrow.swf", id, "944", "550", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
}

function initTime()
{
	swfobject.embedSWF("/static/flash/currenttime.swf", "datum", "152", "20", "9.0.0", "/static/flash/expressInstall.swf");
}

function initCarousel()
{
	var id = "news-carousel";
	
	if ( document.getElementById(id) )
	{
		var flashvars = {};
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/carousel.swf", id, "384", "364", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
	
	var id = "news-carousel-new";
	
	if ( document.getElementById(id) )
	{
		var flashvars = {};
		var params = { wmode: "transparent" };
		var attributes = {};
					
		swfobject.embedSWF("/static/flash/carousel_new.swf", id, "384", "344", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
}


function initVideoPlayer()
{	
	var id = "video";

	if ( !document.getElementById( id ) ) return;

	var pad = document.getElementById( id ).href || false;
	
	if ( pad )
	{
		var flashvars = { file: pad };
		var params = { wmode: "transparent", allowfullscreen: 'true', allowscriptaccess:'always' };
		var attributes = {};
		
		swfobject.embedSWF("/static/flash/player.swf", id, "464", "261", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
	}
}


function initDossierHeader()
{
	var id = "dossiernaam";
	
	if ( !document.getElementById( id ) ) return;
	
	var naam = $("#dossiernaam h1").text();
	var rss = $("#dossiernaam a").attr("href");
	
	var flashvars = { naam: naam, rss: rss };
	var params = { wmode: "transparent" };
	var attributes = {};
	
	swfobject.embedSWF("/static/flash/dossiernaam.swf", id, "660", "24", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
}


function initReactieHeaders()
{
	$(".reactions-header").each(
		
		function(i)
		{
			var h2 = $(this).find("h2");
			
			var naam = h2.text();
			var rss = $(this).find("a").attr("href");
			var id = "reactionsheader" + i;
			
			h2.attr( "id", id );
			
			var flashvars = { naam: naam, rss: rss };
			var params = { wmode: "transparent" };
			var attributes = {};
			
			swfobject.embedSWF("/static/flash/reactiesheading.swf", id, "448", "18", "9.0.0", "/static/flash/expressInstall.swf", flashvars, params, attributes );
		
		}	
	);
}
