
var FeaturedSlideControl = Class.create(
{
	initialize: function( slide )
	{
		this.slide = slide;
		this.initDOM();
		this.initEvents();
	},
	
	initDOM: function()
	{
		this.element = new Element( 'a', { href: "javascript:void(0);" } );
		this.element.innerHTML = ( this.slide.getIndex() + 1 ).toString();
	},
	
	initEvents: function()
	{
		this.element.observe( "click", this.handleClick.bind( this ) );
	},
	
	handleClick: function( e )
	{
		Event.stop( e );
		this.element.blur();
		
		if( FeaturedSlideShow.isInTransition() )
		{
			FeaturedSlideShow.addToQueue( this.slide );
			return false;
		}
		
		this.activate();
		FeaturedSlideShow.pauseFor( FeaturedSlideShow.lingerDuration );
		FeaturedSlideShow.fadeToSlide( this.slide );
		return true;
	},
	
	handleSelectorClick: function( e )
	{
		if( e.memo.selectorId != this.id )
			this.deactivate();
	},
	
	activate: function()
	{
		this.element.addClassName( 'active' );
	},
	
	deactivate: function()
	{
		this.element.removeClassName( 'active' );
	},
	
	getElement: function()
	{
		return this.element;
	}
});