
var StatsChart = new Class({
	
	initialize: function( containerDiv, options ) {
		options = options || {};
	
		this.containerDiv = $( containerDiv );
		this.containerDiv.store( 'usable', this );

		this.barCount = options.barCount || 25;
		
		for ( var i=0; i < this.barCount; i++ ) {
			var bar = new Element( 'div', { 
				'class': 'bar'				
			});
			bar.inject( this.containerDiv );
			
			bar.setStyle('height', '0');
			bar.setStyle('width', '10px');
			
			bar.setStyle('visibility', 'hidden');
			
			bar.setStyle('left', i * 11 );
			bar.setStyle('bottom', '0');
			
		}
		
	},
	
	
	
	display: function( values ) {
		var bars = this.containerDiv.getElements( 'div.bar' );
		
		for ( var i = 0; i < values.length; i ++ ) {
			
			if ( values[i] > 0 ) {
				bars[i].set('html', 'x');
				bars[i].setStyle('visibility', 'visible');
				var tween = new Fx.Tween( bars[i], { property: 'height', duration: 'long', transition: 'bounce:in' } );
				tween.start( 0, values[i] );
			}
			else {
				bars[i].setStyle('visibility', 'hidden');		
			}		
			
		}				
	}
	
});

