var createDropDown = new Class ({
	
	options:
	{
		
		Menu: Class.empty,
		Button: Class.empty,
		OptionList: Class.empty,
		InputField: Class.empty
		
	},

	initialize: function( options ) 
	{
		
		this.setOptions( options );
		this.menu = $( this.options.Menu );
		this.button = $( this.options.Button );
		this.optionList = $( this.options.OptionList );
		this.inputField = $( this.options.InputField );
		
		this.button.addEvent( 'click', this.toggleOptionList.bindWithEvent( this, 'open' ) );
		this.button.addEvent( 'blur', this.toggleOptionList.bindWithEvent( this, 'close' ) );
		
		this.listAnchors = this.optionList.getElements('a');
		
		for ( var i = 0; i < this.listAnchors.length; i++ ) {
			
			this.listAnchors[ i ].addEvent( 'click', this.toggleSearchCategory.bindWithEvent( this, this.listAnchors[ i ].id ) );
			
		}
		
	},
	
	toggleOptionList: function ( event, _direction )
	{
		
		( _direction == 'open' ) ? this.menu.addClass( 'open' ) : this.closeOptionList.delay( 200, this.menu );

	},
	
	closeOptionList: function () 
	{
		
		this.removeClass( 'open' )
		
	},

	toggleSearchCategory: function ( event, _category )
	{
		
		this.inputField.setProperty( 'value', _category );

	}

});

createDropDown.implement( new Options );