window.addEvent('domready',function(){

	// Highlight Active Story
	$$('.story').each( function( story ){
		
		// Init
		story.addClass('storyOff');		
		
		// Mouse events			
		story.addEvents({
				mouseover : function(){
					this.addClass('storyOn');
					this.removeClass('storyOff');
				},
				mouseout : function(){
					this.addClass('storyOff');
					this.removeClass('storyOn');
				}
		});	
		
		// Remember default height
		story.remHeight = story.offsetHeight;
		// Declare Fx
		//story.heightFx = new Fx.Style( story, 'height', { duration:750, wait:false } );
		story.heightFx = new Fx.Tween( story );
		// Initialize Height
		story.heightFx.start('height', 0, 100 );
		
	});	
	
	// Grow
	$$('.storyBy a.more').addEvents({
		
		click: function()
		{
			storyNode = this.getParent().getPrevious();
			if( storyNode.offsetHeight < parseInt( storyNode.remHeight ) )
				storyNode.heightFx.start( 'height', 100, parseInt( storyNode.remHeight ) ); 

			this.getNext().addClass('show');
			this.getNext().removeClass('hide');
						
			this.blur();
			this.addClass('hide');
		}
	});
	
	// Shrink
	$$('.storyBy a.less').each( function( element ){
		element.addClass('hide');

		element.addEvent('click', function(){ 				
			storyNode = this.getParent().getPrevious();
			
			this.getPrevious().addClass('show');
			this.getPrevious().removeClass('hide');
			
			if( storyNode.offsetHeight >= parseInt( storyNode.remHeight ) )
				storyNode.heightFx.start( 'height', parseInt( storyNode.remHeight ), 100 ); 
				
			this.blur();
			this.addClass('hide');
		});
		
	});	
		
});
