

var bgMovie = {
	body: null,

	load: function(e) {
		var h = document.getElementsByTagName("html");
		if (h != null)
			h = h[0];
		var b = document.getElementsByTagName("body");
		if (b != null)
			b = b[0];
		if (h == null || b == null)
			return;
		h.style.height = "100%";
		bgMovie.body = b;
		bgMovie.prepareSiteContent();
		bgMovie.body.style.background = "#aa0063 url('/inc/flash/DecBack2011.jpg') no-repeat center top";
		bgMovie.body.style.backgroundAttachment = "fixed";
		var playerHeight = h.offsetHeight;
		var d = document.createElement("div");
		d.id = "bgMovie_dynamic";
		d.style.width = (h.offsetWidth > h.scrollWidth?h.scrollWidth:h.offsetWidth) + "px";
		// test, if h.offsetHeight > h.scrollHeight do h.scrollHeight
		d.style.height = ((h.offsetHeight > h.scrollHeight?h.scrollHeight:h.offsetHeight) - 0) + "px";
		d.style.position = "absolute";
		if (h.scrollTop)
			d.style.top = h.scrollTop + "px";
		else if (h.pageYOffset)
			d.style.top = h.pageYOffset + "px";
		else
			d.style.top = "0px";
		d.style.left = "0";
		d.style.zIndex = 10;
		//d.style.background = "#202020";
		d.style.overflow = "hidden";
		// movie container
		var dc = document.createElement("div");
		dc.id = "bgMovie_dynamic_in";
		dc.style.width = "100%";
		dc.style.height = "100%";//h.offsetHeight + "px";
		d.appendChild(dc);
		b.appendChild(d);
		bgMovie.runSwfObject(h.offsetWidth > h.scrollWidth?h.scrollWidth:h.offsetWidth, (h.offsetHeight > h.scrollHeight?h.scrollHeight:h.offsetHeight) - 0);
		//return;
		infontoLib.events.register (window, "scroll", function(e) {
			var h = document.getElementsByTagName("html");
			h = window;
			//if (h != null)
			//	h = h[0];
			var m = document.getElementById("bgMovie_dynamic");
			if (h.scrollTop)
				m.style.top = h.scrollTop + "px";
			else if (h.pageYOffset)
				m.style.top = h.pageYOffset + "px";
			else
				m.style.top = "0px";
		});
	},

	unload: function(e) {

	},

	prepareSiteContent: function() {
		if (bgMovie.body != null && bgMovie.body.childNodes)
		{
			var bgi = document.getElementById("bgimage");
			if (bgi != null)
			{
				bgMovie.body.removeChild(bgi);
			}
			for (var n = 0; n < bgMovie.body.childNodes.length; n++)
			{
				if (bgMovie.body.childNodes[n].nodeType == 1 && bgMovie.body.childNodes[n].tagName == "DIV" && bgMovie.body.childNodes[n].id != "fb-root")
				{
					bgMovie.body.childNodes[n].style.position = "relative";
					bgMovie.body.childNodes[n].style.zIndex = "20";
					break;
				}
			}
		}
	},

	runSwfObject: function(width, height) {
		var plvars = {
			file: "/inc/flash/xmas10.flv",
			backcolor: "000000",
			controlbar: "none",
			autostart: "true",
			displayclick: "none",
			icons: "false",
			mute: "true",
			repeat: "always",
			stretching: "fill"
		};
		var factor = 0.64;
		if (height > width * factor)
		{
			var fw = height / factor;
			var fh = height;
		}
		else
		{
			var fw = width;
			var fh = width * factor;
		}
		swfobject.embedSWF("/inc/flash/vuurwerk.swf", "bgMovie_dynamic_in", fw, fh, "9.0.0", false, null, {menu: "false", wmode: "transparent",
			allowScriptAccess: "always", allowfullscreen: "true"});

	}
};

var Carrousel = {
	interval: null,
	counter: null,
	body: null,
	overlay: null,
	overlayback: null,

	load: function(e) {
		Carrousel.makeoverlay();
		Carrousel.insertContainer();
		Carrousel.runSwfObject();
	},

	closePopup: function(e)
	{
		var a = document.getElementById("Carrousel_dynamic_close_a");
		a.onclick = null;
		Carrousel.body.removeChild(Carrousel.overlay);
		Carrousel.body.removeChild(Carrousel.overlayback);
		Carrousel = null;
	},

	checkScript: function() {
		var h = document.getElementsByTagName("head");
		if (h != null)
			h = h[0];
		var s = document.getElementsByTagName("script");
		if (s != null)
		{
			var ns = document.createElement("script");
			ns.type = "text/javascript";
			ns.src = "/inc/js/swfobject.js";
			h.insertBefore(ns, s[0]);
		}
		return;
	},

	makeoverlay: function() {
		var h = document.getElementsByTagName("html");
		if (h != null)
			h = h[0];
		var b = document.getElementsByTagName("body");
		if (b != null)
			b = b[0];
		if (h == null || b == null)
			return;
		h.style.height = "100%";
		var d = document.createElement("div");
		d.id = "overlay";
		d.style.width = "100%";
		d.style.height = (h.offsetHeight > b.offsetHeight?h.offsetHeight:b.offsetHeight) + "px";
		d.style.position = "absolute";
		d.style.top = "0";
		d.style.left = "0";
		d.style.backgroundColor = "#000";
		d.style.zIndex = 200;
		if (typeof d.style.opacity != "undefined")
			d.style.opacity = "0.6";
		else if (typeof d.style.filter != "undefined")
			d.style.filter = "alpha(opacity=60)";
		b.appendChild(d);
		Carrousel.overlayback = d;
		return;
	},

	insertContainer: function() {
		var b = document.getElementsByTagName("body");
		if (b != null)
			b = b[0];
		else
			return true;
		var d = document.createElement("div");
		d.id = "Carrousel_dynamic";
		d.style.width = "800px";
		d.style.height = "640px";
		d.style.position = "absolute";
		d.style.top = "0";
		d.style.left = "50%";
		d.style.marginLeft = "-400px";
		d.style.zIndex = 201;
		var dc = document.createElement("div");
		dc.id = "Carrousel_dynamic_close";
		dc.style.width = "100%";
		dc.style.height = "40px";
		dc.style.background = "#333";
		dc.innerHTML = "<img src='/inc/flash/carrousel_close.jpg' id='Carrousel_dynamic_close_a' width='800' height='40' alt='sluiten' />";
		var df = document.createElement("div");
		df.id = "Carrousel_dynamic_flash";
		df.style.width = "100%";
		df.style.height = "600px";
		d.appendChild(df);
		d.appendChild(dc);
		b.appendChild(d);
		var i = document.getElementById("Carrousel_dynamic_close_a");
		i.style.cursor = "pointer";
		i.onclick = Carrousel.closePopup;
		Carrousel.body = b;
		Carrousel.overlay = d;
	},

	runSwfObject: function() {
		if (typeof swfobject == "object")
		{
			swfobject.embedSWF("/inc/flash/carrousel.swf", "Carrousel_dynamic_flash", "100%", "100%", "8.0.0", false, null, {menu: "false", wmode: "transparent",
				allowScriptAccess: "always"});
		}
		else
			Carrousel.closePopup();
	}

}

var infontoLib = {
	events: {
		register: function( e , t , f )
		{		
			if( document.all )
			{
				e.attachEvent( 'on' + t , f ); //ie
			}else
			{
				e.addEventListener( t , f , false ); //ff
			}
		},
	
		cancel: function( e )
		{
			if( e.stopPropagation ) e.stopPropagation();
			if( e.preventDefault ) e.preventDefault( );
			e.cancelBubble = true;
		}
	}
};

try {

// initialisatie
$(function() {
	//bgMovie.load();
	//Carrousel.load();
});

}
catch(err) {}
