// JavaScript Document

	var blocks;
	var offset = 0;
	var myFX;
	var do_stop = false;
	var timeout;
	
	function init() {
		myFX = new Fx.Tween('roller',{'duration':1000, transition: Fx.Transitions.Quad.easeOut});
		blocks = document.getElementById('blocks').value;
		$('canvas').addEvents({
				'mouseenter': function(){
					// Always sets the duration of the tween to 1000 ms and a bouncing transition
					// And then tweens the height of the element
					clearTimeout(timeout);
					do_stop = true;
				},
				'mouseleave': function(){
					// Resets the tween and changes the element back to its original size
					do_stop = false;
					timeout = setTimeout('go()',3000); //Functie opnieuw aanroepen
				}
		});
		go();
	}
	
	function go () {
		if(do_stop==false){
			if(offset > (180 * blocks * -1)) { //Kijken of de maximale offset al bereikt is
				offset = offset - 180; //Verder omhoog
				myFX.start('margin-top', offset + 'px'); //Effect starten
				timeout = setTimeout('go()',6000); //Functie opnieuw aanroepen
			} else {
				offset = 0;	
				$('roller').style.marginTop = '0px';
				go();
			}
		} else {
			clearTimeout(timeout);
		}
	}
	

