function init(){
	var currentPage = 'index';
	
	var images = [];
		images['index'] = ['img/bg_index.jpg',397,302];
		images['wie'] = ['img/bg_wie.jpg',700,467];
		images['wat'] = ['img/bg_wat.jpg',700,404];
		images['hallo'] = ['img/bg_hallo.jpg',544,392];
		images['hoezo'] = ['img/bg_hoezo.jpg',480,270];
		images['vacature'] = ['../img/bg_vacature.jpg',700,491];
	
	var cache = [];
	  
	  function preLoadImages() {
	    var args_len = arguments.length;
	    for (var i = args_len; i--;) {
	      var cacheImage = document.createElement('img');
	      cacheImage.src = arguments[i];
	      cache.push(cacheImage);
	    }
	  }	

	var locked;
	
	var pageDefWidth;
	var pageWidth;
	
	var pageDefHeight;
	var pageHeight;
	
	var bgImage;
	
	var ratio;
	
	bgImage = $('#bgimage img');
	
	function setSizes()
	{
	
		pageDefWidth = images[currentPage][1];
		pageDefHeight = images[currentPage][2];
		
		pageHeight = $(window).height();
		pageWidth = $(window).width();
		
		var ratio = pageDefHeight/pageDefWidth;
		
		if (pageHeight/pageWidth < ratio){
			pageHeight = pageWidth*ratio;
		} else {
			pageWidth = pageHeight/ratio;
		}
	
		if ($('#bgimage img').length){
			setBgMeasure();	
		}
	}
	
	function setBgMeasure(){
		bgImage.width(pageWidth).height(pageHeight)
		//.parent()
		.css('left', ($(window).width() - pageWidth)/2)
		.css('top', ($(window).height() - pageHeight)/2)
		//bgImage.show();
	}
	
	setSizes();
	
	setBgMeasure();
	
	$(window).resize(function() {
		setSizes();
	})
	
	$('#items li .handle').click(function(){
		
		if (locked)
			 return false;
		
		locked = true;
		
		if(document.getElementById('mockus_video')){
			if(undefined!==window.HTMLMediaElement && !window.HTMLMediaElement.paused){
				try{
				document.getElementById('mockus_video').pause()
				}
				catch(err)
				  {
				  //Handle errors here
				  }
			}
		}
		var nieuw = $(this);
		var current = "";
		
		currentPage = nieuw.parent().attr('id');
		bgImage.fadeOut('slow').queue(function(){
			bgImage.attr('src',images[currentPage][0]);
			$(this).dequeue();
			}).queue(function(){
				setSizes();
				$(this).dequeue();
			}).fadeIn('slow');
						
		if (nieuw.hasClass('active')){
			nieuw.removeClass('active')
			.next('.text').fadeOut('slow').queue(function(){
				nieuw.parent().animate({width: '-=410px'}, 1000, 'easeInOutQuint', function(){locked=false})
				$(this).dequeue();
			})
						
		} else {
			current = $('.active');

			if (current.length){
				current.removeClass('active')
				.next('.text').fadeOut('slow').queue(function(){
					var curQueue = $(this);
					current.parent().animate({width: '-=410px'}, 1000, 'easeInOutQuint', function(){curQueue.dequeue();})
					
				}).queue(function(){
					showNew();
					$(this).dequeue();
				})
			} else {
				showNew();
			}
			
		}
		
		function showNew(){
			nieuw.addClass('active')
			.parent().animate({width: '+=410px'}, 1000, 'easeInOutQuint').queue(function(){
			nieuw.next('.text').fadeIn('slow');
			locked = false;
			$(this).dequeue();
			})
		}
		
		window.location.hash = '!/'+currentPage;
		window.scroll(0,0);
		return false;
		
	})
	
	if($.browser.msie && parseInt($.browser.version)< "9")
	{
		$.getScript('http://html5shiv.googlecode.com/svn/trunk/html5.js', function() {
			});
		}
	
	if($.browser.msie && parseInt($.browser.version)< "7")
	{
		$.getScript('js/jquery.pngfix.js', function() {
				$(document).pngFix();
				$('#striped').remove();
		});
		
		$.getScript('js/jquery.suy.js', function() {
				$('head').append('<link rel="stylesheet" href="css/suy.css" type="text/css" />');
			$.fn.suy({
		      onLoad: false
		    });

		});
	}

	
	
	/* */
	if (undefined==window.HTMLMediaElement){
		$.getScript('js/swfobject.js', function() {
				  var so = new SWFObject('player.swf','jwplayerId','400','245','9');
			  so.addParam('allowfullscreen','true');
			  so.addParam('allowscriptaccess','always');
			  so.addParam('wmode','opaque');
			  so.addVariable('duration','85');
			  so.addVariable('file','mov/mockus_h264.mp4');
			  so.addVariable('image','mov/mockus_h264-poster.jpg');
			  so.addVariable('controlbar','bottom');
			  so.addVariable('screencolor','FFFFFF');
			  so.write("jwplayer");
		});
	}
	/* */
	
	preLoadImages(
		images['wie'][0],
		images['wat'][0],
		images['hallo'][0],
		images['hoezo'][0]
	)
	
	if(window.location.hash) 
	{
		bgImage.show();
		$("#items a[href='" + window.location.hash + "']").parent().delay(1000).trigger("click");
		window.scroll(0,0);
		//return false;

	} else {
		bgImage.fadeIn('slow');
	}
}
