	
	var PortfolioReveal = new Class(function() {

		/**
		* Event handler to show/hide the additional portfolio items
		*
		* @private
		* @param	{Object}	event
		* @param	{Object}	that	Context of the instance
		*/
		function displayPortfolios( event, that ) {

			var wrapped = that.wrappedItems,
				duration = that.options.duration;

			if ( !wrapped.isDisplayed() ) {

				wrapped.reveal({

					duration : duration,

					onComplete : changeText.bind( this, 'Show less' )

				});

			} else {

				wrapped.dissolve({

					duration : 	duration,

					onComplete : changeText.bind( this, 'Show more' )

				});

			}

			event.preventDefault();

		};


		/**
		* Changes text on the Show link. Called from the displayPortfolios event handler
		*
		* @private
		* @param	{String}	text
		*/
		function changeText( text ) {

			this.set( 'text', text );

		};

		return {

			Implements : Options,

			initialize : function( container, options ) {

				var articles;

				this.setOptions( options );

				this.container = $( container );

				if ( $(this).getElements('article').length <= 3 ) return;

				// Remove all but first 3
				articles = $(this).getElements('article:nth-child(n+5)').dispose();

				this.wrappedItems = new Element('div').hide().adopt( articles );

				this.showMore = new Element('p').grab( new Element('a[text="Show more"][href="#"]') );

				// Inject elems
				$(this).grab( this.wrappedItems ).grab( this.showMore );

				this.showMore.getElement('a').addEvent( 'click', displayPortfolios.bindEvent( this ) );


			},

			options : {

				duration : 350

			},

			toElement : function() {

				return this.container;

			}

		}

	}());
	
