function elySlideshow(config)
{
	if(!config) config = {};
  if(!jQuery)return this;
	this.config.frequency = config.frequency || 0;
	this.config.target = config.target || '#banner-container';
	this.config.menu = config.menu ||'#banner-nav';
	this.init();
}

elySlideshow.prototype = {
	config: {},
	init: function()
	{
		if($(this.config.target).css('position')!='absolute')$(this.config.target).css({'position':'relative'});
		
		this.listItems = $(this.config.target+ ' img');
		this.listItems.css({'position':'absolute','left':0,'top':0, 'z-index':20, 'display':'none'});
		
		this.listItems = this.listItems.get();
		var t=this;
	  $(this.config.menu+' a').hover(
    function(){t.slide($(this).attr('id'));},function(){t.slide(0);}
    );

		if(!this.listItems.length) return this;
		
		this.backFace = new Image();
		this.backFace.className = 'backFace';
		$(this.config.target).append(this.backFace);
		this.backFace = $(this.config.target+' > .backFace');
		this.backFace.attr('src',$(this.listItems[0]).attr('src'));
		this.backFace.css({'position':'absolute','left':0,'top':0, 'z-index':10});
		
		this.slide(0);
		
		var _this = this;
		//if(this.config.frequency)this.moveInterval = setInterval(function(){_this.slide();},this.config.frequency*1000);
	},
	activeImage: 0,
	slide: function(step)
	{
    var last = this.activeImage;	
	  
	  if(!(this.activeImage = $(this.config.target+ ' #img'+step)))return;
	   var t=this;
    if(last){
       this.backFace.attr('src',$(this.config.target+ ' #img0').attr('src'));
       last.stop().fadeOut(700,function(){
          t.activeImage.fadeIn(700);
       });
    }else{
      this.activeImage.fadeIn(700);
    }  
	}
};
$(function(){
   new elySlideshow();
});