try {
	document.execCommand("BackgroundImageCache", false, true);
}
catch (e) {}

pages = {
	current : null,
	target : null,
	init : function()
	{
		switch ( pages.current )
		{
			case 'intro':
				pages.intro.init();
				break;
				
			case 'home':
				pages.home.init();
				break;
				
			case 'mogelijkheden':
				pages.mogelijkheden.init();
				break;
				
			case 'contact':
				pages.contact.init();
				break;
				
			case 'historie':
				pages.historie.init();
				break;
				
			case 'aan-en-verkoop':
				pages.aan_en_verkoop.init();
				break;
				
			case 'missie_en_visie':
				pages.missie_en_visie.init();
				break;
				
			case 'sponsoring':
				pages.sponsoring.init();
				break;
		}
	},
	start : function()
	{
		switch ( pages.current )
		{
			case 'intro':
				pages.intro.start();
				break;
				
			case 'home':
				pages.home.start();
				break;
				
			case 'mogelijkheden':
				pages.mogelijkheden.start();
				break;
				
			case 'contact':
				pages.contact.start();
				break;
				
			case 'historie':
				pages.historie.start();
				break;
				
			case 'missie_en_visie':
				pages.missie_en_visie.start();
				break;
				
			case 'aan-en-verkoop':
				pages.aan_en_verkoop.start();
				break;
				
			case 'sponsoring':
				pages.sponsoring.start();
				break;
		}
	},
	unload : function( link )
	{
		pages.target = link.href;

		switch ( pages.current )
		{
			case 'intro':
				pages.intro.unload();
				break;
				
			case 'home':
				pages.home.unload();
				break;
				
			case 'mogelijkheden':
				pages.mogelijkheden.unload();
				break;
				
			case 'contact':
				pages.contact.unload();
				break;
				
			case 'historie':
				pages.historie.unload();
				break;
				
			case 'missie_en_visie':
				pages.missie_en_visie.unload();
				break;
				
			case 'aan-en-verkoop':
				pages.aan_en_verkoop.unload();
				break;
				
			case 'sponsoring':
				pages.sponsoring.unload();
				break;
		}
	},
	home : {
		init : function()
		{
			document.getElementById('content-afb').style.left = "-2000px";
			document.getElementById('content-home').style.left = "2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-home', 'x', com.roqz.transitions.easing.outBack, 2000, 362, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-afb', 'x', com.roqz.transitions.easing.outBack, -2000, 0, 1000 );
		},
		second : function()
		{
			
		},
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-afb', 'x', com.roqz.transitions.easing.outBack, 0, -2000, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-home', 'x', com.roqz.transitions.easing.outBack, 368, 2000, 1000, pages.unloadComplete );
		},
	},
	mogelijkheden : {
		init : function()
		{
			document.getElementById('content-1').style.left = "-2000px";
			document.getElementById('content-2').style.left = "2000px";
			document.getElementById('content-3').style.left = "2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, -3500, 0, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, -2000, 318, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack, 2000, 636, 1000 );
		},		
		second : function()
		{
			
		},
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 0, -3500, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 318, -2000, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack, 636, 2000, 1000, pages.unloadComplete );
		}
	},
	contact : {
		init : function()
		{
			document.getElementById('content-1').style.left = "2000px";
			document.getElementById('content-2').style.left = "-2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 2000, 338, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, -2000, 475, 1000 );
		},		
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 338, 2000,  1000 );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 535, -2000,  1000, pages.unloadComplete );
		},		
	},
	historie : {
		init : function()
		{
			document.getElementById('content-1').style.left = "-2000px";
			document.getElementById('content-2').style.left = "2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, -3500, 0, 1000, pages.historie.second );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 2000, 562, 1000 );
		
		},		
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 0,-3500,  1000);
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 562, 2000,  1000, pages.unloadComplete );
		},
	},
	aan_en_verkoop : {
		init : function()
		{
			document.getElementById('content-1').style.left = "2000px";
			document.getElementById('content-2').style.left = "-2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 2000, 406, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, -2000, 0, 1000 );
		},		
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 406, -2000,  1000);
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 0, 2000,  1000, pages.unloadComplete );
		},		
	},
	missie_en_visie : {
		init : function()
		{
			document.getElementById('content-1').style.left = "-2000px";
			document.getElementById('content-2').style.left = "2000px";
			document.getElementById('content-3').style.left = "2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack, 2000, 400, 1000);
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, -2000, 0, 1000, pages.missie_en_visie.second );
		},		
		second : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 2000, 628, 1000 );
		},
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack, 400, 2000, 1000);
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 0, -2000, 1000);
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 560, 2000,  1000, pages.unloadComplete   );
		},
	},
	sponsoring : {
		init : function()
		{
			document.getElementById('content-1').style.left = "-2000px";
			document.getElementById('content-2').style.left = "2000px";
			document.getElementById('content-3').style.left = "2000px";
			document.getElementById('content-4').style.left = "2000px";
		},
		start : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, -2000, 0, 1000, pages.sponsoring.second );
		},		
		second : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 2000, 476, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack,  4000, 476, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-4', 'x', com.roqz.transitions.easing.outBack,  6000, 476, 1000 );
		},
		unload : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-2', 'x', com.roqz.transitions.easing.outBack, 476, 6000, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-3', 'x', com.roqz.transitions.easing.outBack, 476, 4000, 1000 );
			var tween = new com.roqz.transitions.Tween( 'content-4', 'x', com.roqz.transitions.easing.outBack, 476, 2000, 1000, pages.sponsoring.second2 );
		},		
		second2 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'content-1', 'x', com.roqz.transitions.easing.outBack, 0, -2000, 1000,  pages.unloadComplete   );
		},
	},
	intro : {
		init : function()
		{
			document.getElementById('heipaal_en').style.top = "-2000px";
			document.getElementById('heipaal_es').style.top	 = "2000px";
			document.getElementById('heipaal_nl').style.top = "2000px";
		},
		start : function()
		{
			document.getElementById('heipaal_en').style.top = "-2000px";
			document.getElementById('heipaal_es').style.top = "-2000px";
			document.getElementById( 'background-image' ).style.top = "-10px";
			var tween = new com.roqz.transitions.Tween( 'heipaal_nl', 'y', com.roqz.transitions.easing.outBack, -500, 40, 400, pages.intro.stap2);	
		},		
		stap2 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -10, 80,
			pages.intro.stap3);
		},
		stap3 : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			document.getElementById( 'background-image' ).style.top = "-10px";
			var tween = new com.roqz.transitions.Tween( 'heipaal_nl', 'y', com.roqz.transitions.easing.outBack, 53, 320 ,300, pages.			intro.stap3a);
		},
		stap3a : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.linear, 0, -8, 100, pages.intro.stap3b);
		},	
		stap3b : function()
		{
			//document.getElementById('background-image').style.top = "0px";
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.linear, 0, -8, 100, pages.intro.stap4);
		},	
		stap4 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'heipaal_en', 'y', com.roqz.transitions.easing.outBack, -500, 40, 400, pages.intro.stap5);	
		},
		stap5 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -8, 100, pages.intro.stap6);
		},
		stap6 : function()
		{
			document.getElementById('background-image').style.top = "-5px";
			var tween = new com.roqz.transitions.Tween( 'heipaal_en', 'y', com.roqz.transitions.easing.outBack, 53, 320,300, pages.intro.stap6a);
		},
		stap6a : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -8, 100, pages.intro.stap6b);
		},	
		stap6b : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -8, 100, pages.intro.stap7);
		},	
		stap7 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'heipaal_es', 'y', com.roqz.transitions.easing.outBack, -500, 40, 400, pages.intro.stap8);	
		},	
		stap8 : function()
		{
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -8, 100, pages.intro.stap9);
		},
		stap9 : function()
		{
			document.getElementById('background-image').style.top = "-8px";
			var tween = new com.roqz.transitions.Tween( 'heipaal_es', 'y', com.roqz.transitions.easing.outBack, 53, 320,300, pages.intro.stap9a);
		},
		stap9a : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			document.getElementById('background-image').style.top = "-10px";
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, -8, 100, pages.intro.stap9b);
		},	
		stap9b : function()
		{
			//var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 0, 20);
			var tween = new com.roqz.transitions.Tween( 'background-image', 'y', com.roqz.transitions.easing.outBack, 0, 1, 100);
		},	
	},
	unloadComplete : function()
	{
		document.location = pages.target;
	}
}





init = {
	page : null,
	background : null,
	width : null,
	height : null,
	preinitialize : function()
	{
		window.onload = pages.start;
	},
	creationComplete : function()
	{
		pages.current = document.getElementsByTagName('body')[0].id;
		init.background = document.getElementById( 'background-image' );
		
		init.updateLayout();
		
		pages.init();
		
		window.onresize = init.updateLayout;
		//window.onunload  = pages.unload;
		
		 
		/**
		 * Page specific
		 */
		
		


	},
	updateLayout : function()
	{	
		// 1920x1280
		// minimum is viewport and targetHeight
		var viewportHeight = com.roqz.document.documentHeight() - 160;
		var heightScale = viewportHeight / 1280;
		
		var viewportWidth = com.roqz.document.documentWidth();
		var widthScale = viewportWidth / 1920;
		
		var scale = Math.max( heightScale, widthScale );
		
		
		if ( scale > 1 )
		{
			scale = 1;
		}
		
		if ( pages.current == 'intro' )
		{
			if ( viewportHeight > 1080 )
			{
				document.getElementById('container').style.height = "1240px";
				document.getElementById('container').style.minHeight = "1240px";
				document.getElementById('content').style.top = ( 1080 - 600 ) + "px";
			}
			else
			{
				document.getElementById('container').style.height = ( viewportHeight + 160 ) + "px";
				document.getElementById('container').style.minHeight = ( viewportHeight + 160 ) + "px";
				document.getElementById('content').style.top = ( viewportHeight - 600 ) + "px";
			}
		}
		
					
		
		init.background.width = 1920 * scale;
		init.background.height = 1280 * scale;
		init.background.style.left = Math.floor( ( viewportWidth - ( 1920 * scale ) ) / 2 ) + "px";
		
	}
};

init.preinitialize();
//ROQZ.Event.DomReady.add( init.creationComplete );
