document.addEvent('keydown', function(e){
	e = new Event(e);
	
	// code 39 is rechts
	/*
	if(e.code == 39){
		if($('volgendelink')){
			var link = $('volgendelink').get('href');
			window.location.href = link;
		}
	}
	
	
	// code 37 is links
	if(e.code == 37){
		if($('vorigelink')){
			var link = $('vorigelink').get('href');
			window.location.href = link;
		}
	}
	*/
	
	/*
	//40 is onder
	if(e.code == 40){
		var albumblok = $('albumkeuzeblok');
		var sluitknop = $('albumbloksluit');

		var dezemorph = new Fx.Morph(albumblok, {
			duration: 200, 
			transition: Fx.Transitions.Sine.easeOut
		});
		
		
		dezemorph.start({
			'top' : '-10px'			
		});
	}
	
	//38 is boven
	if(e.code == 38){
		var albumblok = $('albumkeuzeblok');
		var sluitknop = $('albumbloksluit');

		var dezemorph = new Fx.Morph(albumblok, {
			duration: 200, 
			transition: Fx.Transitions.Sine.easeOut
		});
		
		
		dezemorph.start({
			'top' : '-800px'			
		});
	}
	*/


	

})

window.addEvent('domready', function(){				
	
	var customTips = $$('.tooltip');
	var toolTips = new Tips(customTips, {
	    className: 'tooltip'
	});
	
	/*
	konami = new Konami(function(){

		$('body').setStyle('background',' url("' + host() + '/plaatjes/achtergrondanim.gif")')

            
    });


	*/

	
	
	
	if($('gedichtenblokken')){
		
			$$('.navigatielink').each(function(link, i) {
			
				var delen = link.getElements('span');
				
				var linkmorph = new Fx.Morph(link,{
					duration: 200,
					link: 'cancel'
				});
		
			
				var pos = link.get('class').indexOf('actief');
				if(pos == '-1'){
					var actief = false;
				}else{
					var actief = true;
				}
			
				link.addEvents({
					'mouseenter' : function(e){
						e.stop();
						
						linkmorph.start({
							'background' : 'none',
						});
						
						delen.each(function(deel, d) {
							var deelmorph = new Fx.Morph(deel,{
								duration: 200,
								link: 'cancel'
							});	
							
							deelmorph.start({
								'color' : '#FFF',
							});
												
						});
						
						
					},
					'mouseleave' : function(e){
						e.stop();
						if(actief == false){
							linkmorph.start({
								'background-color' : '#FFF',
							});
							
							delen.each(function(deel, d) {
								
								var gedeeld = d/2;
								var afgerond = Math.floor(d/2);
								
								var deelmorph = new Fx.Morph(deel,{
									duration: 200,
									link: 'cancel'
								});	

								if(gedeeld == afgerond){
									deelmorph.start({
										'color' : '#fa39ba',
									});
								}else{
									deelmorph.start({
										'color' : '#999',
									});
								
								}
							});
							
						}
					}
				});
			});
	}
});
