// TODO Use the general Menu class instead of this
$(document).ready(function() {

	/*
		create website.getGoingDetail wrapper
	*/

	website.getGoingDetail = {};


	/*
		create website.getGoingDetail menu
	*/
	website.getGoingDetail.menu =(function() {

		init = function() {

			var flashvar = {

				id : 2,
				animation : 'true',
				color_active : "0xFFFFFF",
				color_inactive : "0x000000",
				links : [
					{
						url : '/'
					},
					{
						url : '/activiteiten'
					},
					{
						url : '/aandeslag'
					},
					{
						url : '/inzenden'
					},
					{
						url : '/mdvers'
					},
					{
						url : '/motto'
					},
					{
						url : '/nieuws'
					},
					{
						url : '/clubs'
					}
				]
			};

			// setup swfobject properties
			var flashvars = {

				menudata : encodeURI(JSON.stringify(flashvar))

			};

			var params = {
				scale : "noscale",
				menu  : "false",
				wmode : "transparent",
				allowscriptaccess : "samedomain"
			};

			// add class on successful embed to check if flash is present
			attributes  = {
				styleclass : "swfobject_present"
			};

			// trigger the swf embed (a bit delayed to prevent framerate issues)
			setTimeout(function() {
				//window.swfobject.embedSWF("/swf/header.swf", "getGoingDetail-menu-flash-element", "100%", "100%", "9", "false", flashvars, params, attributes);

				window.swfobject.embedSWF("/swf/mainmenu.swf", "getGoingDetail-menu-flash-element", "100%", "100%", "9", "false", flashvars, params, attributes, onFlashEmbed);
			}, 300);

			// trigger the embed-check
			//setTimeout(function() { embedCheck(); }, 1500);

			function onFlashEmbed(e) {
				if(!e.success) {
					$('#getGoingDetail-menu-flash-element');
					new mdv.MenuHtml(
						$('#getGoingDetail-menu-flash-element'),
						'getGoingDetail-menu-flash-element',
						'#FFFFFF',
						'#000000'
					);
				}
			}
		}

		init();

	})();
});
