window.addEvent('domready', function() {	
	
//	var scroll = new Fx.Scroll($('ticker-wrapper'),{offset: {'y':-15}, duration: 800} );	
	var fotos = $('ticker-wrapper-inner').getChildren('dl.tickeritem');
	var scroll	= new Fx.Tween( $('ticker-wrapper-inner') );
	var current = 0;
	
	$('ticker-next').addEvent('click' , function(e) {		
		var newIndex = current + 1;
		if ( newIndex >= fotos.length ) {
			newIndex = 0;
		}
					
//		scroll.toElement(fotos[newIndex]);
		scroll.start( 'margin-top' , ( current * 225 * -1 ) + 'px' , ( newIndex * 225 * -1 ) + 'px' );

		current = newIndex;
		return false;
	});
	
	$('ticker-previous').addEvent('click', function(e) {
		var newIndex = current - 1;
		if ( newIndex < 0 ) {
			newIndex = fotos.length - 1;
		} 

//		scroll.toElement(fotos[newIndex]);
		scroll.start( 'margin-top' , ( current * 225 * -1 ) + 'px' , ( newIndex * 225 * -1 ) + 'px' );
		
		current = newIndex;
		return false;
	});
		
	$$('a.contact-toggler').each(function (el) {
		el.addEvent('click', function(e) {
			$('contact-emmen').setStyle('display', $('contact-emmen').getStyle('display') == 'none' ? 'block':'none')
			$('contact-veendam').setStyle('display', $('contact-veendam').getStyle('display') == 'none' ? 'block':'none')
		
			return false;
		});
	});
});