/******************************************************************
  generated by H2G Internetagentur, CH-Aarau, www.h2g.ch, July 08  
*******************************************************************/

if (typeof(Scroller) == 'undefined')

var Scroller = {};

Scroller = Class.create();

Object.extend(Scroller.prototype, {

	initialize: function() {
		
		this.distance = 439; // in pixels
		this.duration = 1; // in seconds
		this.position = 1;
		// count content Layers
		
	},scroll:function(direction) {
	
		// set operator and new position
		if (direction == "down") {
			this.operator = "-";
			this.position++;
		} else if (direction == "up") {
			this.operator = "+";
			this.position--;
		}
		
		// calculate layer move (direction and distance)
		yMove = this.operator+this.distance;
		
		// move the tube which contains all content layers
		new Effect.Move($('contentTube'), { x: 0, y: yMove, mode: 'relative', duration: this.duration });
		
		
		// check for IE 6!
		
		// disable trigger links while performing the move
		$$('#scrollerLink a')[0].href = 'javascript:void(0);';
		$$('#scrollerLink a')[1].href = 'javascript:void(0);';
		// wait for the move to end
		
	
		this.setTriggers.delay(1, this.position);
		
			
	},setTriggers:function(position) {
	
		// check if we're on first or last position - if so deactivate trigger links
		if (position == 1) {
			// first
			$$('#scrollerLink img')[0].src = "/_img/scroller_up_off.gif";
			$$('#scrollerLink img')[1].src = "/_img/scroller_down.gif";
			$$('#scrollerLink a')[0].href = "javascript:void(0);";
			$$('#scrollerLink a')[0].setStyle({cursor: 'default'});
			$$('#scrollerLink a')[1].href = "javascript:scroller.scroll('down')";
			$$('#scrollerLink a')[1].setStyle({cursor: 'pointer'});
		} else if (position == $$("#contentTube div.contentLayer").length) {
			// last
			$$('#scrollerLink img')[0].src = "/_img/scroller_up.gif";
			$$('#scrollerLink img')[1].src = "/_img/scroller_down_off.gif";
			$$('#scrollerLink a')[0].href = "javascript:scroller.scroll('up')";
			$$('#scrollerLink a')[0].setStyle({cursor: 'pointer'});
			$$('#scrollerLink a')[1].href = "javascript:void(0);";
			$$('#scrollerLink a')[1].setStyle({cursor: 'default'});
		} else {
			// every other
			$$('#scrollerLink img')[0].src = "/_img/scroller_up.gif";
			$$('#scrollerLink img')[1].src = "/_img/scroller_down.gif";
			$$('#scrollerLink a')[0].href = "javascript:scroller.scroll('up')";
			$$('#scrollerLink a')[0].setStyle({cursor: 'pointer'});
			$$('#scrollerLink a')[1].href = "javascript:scroller.scroll('down')";
			$$('#scrollerLink a')[1].setStyle({cursor: 'pointer'});
		}
		
		
	}
});

scroller = new Scroller;

