var page = '';
var first = true;
function loaded(p,type){
	//new Effect.Appear('robots', {duration: 5});
	new Effect.Appear('slogan', {duration: 1});
	
	new Effect.Appear('gallery_container');
	new Effect.Fade('gallery_loading');
	
	playGallery();

	page = p.toLowerCase();

	swapButton(document.getElementById(page), type, true);
}

function showVideoPlayer(){
	new Effect.Appear('video_container');
	window.setTimeout("new Effect.Appear('video'); new Effect.Scale('video', 200.0);", 1500);
	window.setTimeout("alert('Binnenkort!'); new Effect.Fade('video_container'); new Effect.Fade('video');", 3000);
}

function playGallery(){
		new Effect.Move('gallery_container', {x: -25, y: 0, duration: 40, mode: 'absolute', transition: Effect.Transitions.sinoidal, afterFinish: function(request){replayGallery();}});
		
}

function replayGallery(){
		new Effect.Move('gallery_container', {x: -1000, y: 0, duration: 40, mode: 'absolute', transition: Effect.Transitions.sinoidal, afterFinish: function(request){playGallery();}});
}

function swapButton(button,p,state){
	if(button.id != page){
		if(state) 	button.src = '/images/navigation/'+p+'/'+button.id+'_over.jpg';
		else button.src = '/images/navigation/'+p+'/'+button.id+'.jpg';
	} else {
		button.src = '/images/navigation/'+p+'/'+button.id+'_over.jpg';
	}
}
