var ParagraphMore = new Class({
	options:{
		'aimClass':'detail_item',
		'aimMoreClass':'more',
		'contentShowTime':2000,
		'moreShowTime':500,
		'moreBinHeight':0,
		'moreEndHeight':30,
		'contentBinBgColor':'#FFFFFF',
		'contentEndBgColor':'#FFFFFF'
	},
	initialize: function( options ){
		
		//alert(1)
		this.setOptions( options );
		var self = this;
		this.contents = $$( '.'+this.options.aimClass );
		this.mores = $$( '.'+this.options.aimMoreClass  );
		this.mores.each(function(more, index) {
			more.setStyles({
				height:self.options.moreBinHeight, width:more.getStyle("width").toInt(), position:'absolute', overflow:'hidden'
			});
		});
		this.createParagraph();
	},
	createParagraph:function(){
		var self = this;
		var contentFx = new Fx.Elements(self.contents, {wait: false, duration: self.options.contentShowTime, transition: Fx.Transitions.Back.easeOut});
		self.contents.each(function(content, index) {
			content.addEvent("mouseenter", function( event ) {
				var contentBackground = {};
				contentBackground[ index ] = { 'background-color': [ self.options.contentBinBgColor, self.options.contentEndBgColor ] }
				self.contents.each( function( other, j ){
					if( index != j ) {
						var endColor = other.getStyle("background-color");
						if( endColor != self.options.contentEndBgColor ){
							contentBackground[ j ] = { 'background-color' : [ self.options.contentBinBgColor, self.options.contentBinBgColor ] }
						};
					}
				});
				contentFx.start( contentBackground );
				self.createMores( content, index);
			});
			
		});
	},
	createMores:function( _content, _index ){
		var self = this;
		var moreFx = new Fx.Elements(self.mores, {wait: true, duration: self.options.moreShowTime, transition: Fx.Transitions.Back.easeOut});
		self.mores.each(function( more, index) {
			var itemPosition = _content.getPosition();
			var moreHeight = {};
			moreHeight[ _index ] = { 
				height: [ more.getStyle("height").toInt(), self.options.moreEndHeight],
				'top':[itemPosition.y+_content.getStyle('height').toInt(), itemPosition.y+_content.getStyle('height').toInt()-15], 'opacity': [0, 0.5]
			}
			moreFx.start( moreHeight ).chain(function(){
				self.mores.each(function( other, j) {
					if( _index != j ){
						other.setStyle(	'opacity', 0 );
					}
				});
			});
		});
	}
});
ParagraphMore.implement( new Options );