
var GeotraxLanding = new Class({
	initialize: function(){
		this.accordion = new Accordion('h3.atStart', 'ul.atStart', {
				opacity: false,
				onActive: function(toggler, element){
				toggler.addClass(GeotraxLanding.selectedItemName);
			}
		}, $('accordion'));
		
		//create parent ul element
		this.parentEl = new Element('ul', {
			'id': 'arrowsParent'
		});
		
		
		//create the arrow elements
		this.leftArrow = new Element('li', {
			'events': {
				'click' : function(){
					this.moveLeft();
				}.bind(this)
			},
			'class': 'leftArrow',
			'id': 'leftArrow'
		});
		this.leftArrow.setText('Previous');
		
		this.rightArrow = new Element('li', {
			'events': {
				'click': function(){
				this.moveRight();
				}.bind(this)
			},
			'class': 'rightArrow',
			'id': 'rightArrow'
		});
		this.rightArrow.setText('Next');
		
		this.leftArrow.injectInside(this.parentEl);
		this.rightArrow.injectInside(this.parentEl);
		
		this.parentEl.injectAfter($('feature'));
		
		this.fxScroll = new Fx.Scroll($('feature'), {
			wait: false,
			duration: 1000,
			offset: {'x': -0, 'y': 0},
			transition: Fx.Transitions.linear
		});
		
		this.currentIndex = 0;
		this.itemWidth = $('thumbs').getElement('div').getCoordinates().width + 10;
		this.numOfProducts  = $('thumbs').getElements('div').length;
		this.viewableItems = 3;
	},
	
	moveLeft: function(){
		if(this.currentIndex > 0){
			this.currentIndex--;
			this.move();
		}
	},
	
	moveRight: function(){
		if(this.currentIndex < (this.numOfProducts-this.viewableItems)){
			this.currentIndex++;
			this.move();
		}
	},
	
	move: function(){
		this.fxScroll.scrollTo(this.currentIndex*this.itemWidth);
	}
});


