/*
 * jQuery Left Slider @VERSION
 *
 *
 * Depends:
 *      jquery.ui.core.js
 *     
 */
$.widget("ui.fadeSlider", {
	// default options
	options : {
		periodical:5000,
		speed:3000
	},
	sliders:{},
	currentSlider:1,
	idClear:false,
	_create : function() {	  
    	var _self = this;
  	    this.imgs = this.element.find('img');  	    
  	    this.steps = this.imgs.length;
  	    this.currentSlider = 0;  	    
  	    setInterval(function(){
  	    	_self.next()
  	    },this.options.periodical)  	      	           
	},
	next:function(){
    	var _self = this;
	    var next = this.currentSlider+1;	    
	    if(next >= this.steps){
	    	next = 0;	    	
	    }
	    $(this.imgs[next]).fadeIn(this.options.speed);
	    
	    $(this.imgs[this.currentSlider]).fadeOut(this.options.speed);
	    this.currentSlider = next;
	}
});


