var scroll = new Fx.Scroll( window, {
	wait: false,
	duration: 2500,
	offset: { 'x': -200, 'y': -50 },
	transition: Fx.Transitions.Quad.easeInOut
});

var s = {
	
	start: function() {
		s.resizeCols();
		s.setFont();
	},
	
	resizeCols: function() {
		var pads = $ES( '.pad' );
		var col_left = pads[0].getStyle( 'height' ).toFloat();
		var col_right = pads[1].getStyle( 'height' ).toFloat();
		
		if( col_left > col_right ) {
			var total = ( col_left / 10 ) + 5.7;
			$( 'col_left' ).setStyle( 'height', total + 'em' ); }
		else if( col_right > col_left ) {
			var total = ( col_right / 10 ) + 5.7;
			$( 'col_left' ).setStyle( 'height', total + 'em' );
		}
	},
	
	setFont: function() {
		if( Cookie.get( 'baggagefont' ) )
			$( 'wrapper' ).setStyle( 'font-size', Cookie.get( 'baggagefont' ) + 'px' );
	},
	
	textTo: function( size ) {
		$( 'wrapper' ).effect( 'font-size', { duration: 500, transition: Fx.Transitions.Back.easeOut } ).start( size );
		
		Cookie.remove( 'baggagefont' );
		Cookie.set( 'baggagefont', size, { path: '/', duration: 28 } );
	},
	
	toCheckout: function() {
		window.location = 'http://emotionalbaggage.co.uk/checkout';
	},
	
	prodScrollUp: function() {
		var products = $ES( '#products a' );
		var lines = Math.ceil( products.length / 5 );
		if( !this.currentLine )
			this.currentLine = 3;
		if( this.currentLine > 3 ) {
			var line = ( this.currentLine - 4 ) * 120;
			new Fx.Scroll( $E( '#products .in' ) ).scrollTo( 0, line );
			this.currentLine = this.currentLine - 1;
		}
	},
	
	prodScrollDown: function() {
		var products = $ES( '#products a' );
		var lines = Math.ceil( products.length / 5 );
		if( !this.currentLine )
			this.currentLine = 3;
		if( lines >= this.currentLine ) {
			var line = ( this.currentLine - 2 ) * 120;
			new Fx.Scroll( $E( '#products .in' ) ).scrollTo( 0, line );
			this.currentLine = this.currentLine + 1;
		}
	}
	
}

window.addEvent( 'domready', s.start );

window.addEvent( 'domready', function() {
	var pageTracker = _gat._getTracker( "UA-4034807-1" );
	pageTracker._initData();
	pageTracker._trackPageview();
});
