jQuery.fn.ListaDestaques = function (options) {
	
	var opts = jQuery.extend({
		timer: 6000,
		fadeSpeed: "normal",
		autoPlay: true,
		classAt: "ativa",
		classOver: "hover"
	}, options);
	
	this.each(function(){
		
		//Configs iniciais
		var Interval;
		var Father		= jQuery(this);
		var selItem		= 1;
		var nItens 		= jQuery(".item_slide", Father).size();
		
		jQuery('.item_slide', Father).hide();
		//jQuery('.item_slide:first', Father).show();
		
		jQuery("#Slides", Father).css('position', 'relative');
		jQuery('.item_slide', Father).css('position', 'absolute');
		
		//----------------
		
		//Funcoes		
		function showDst (n){
			if (opts.autoPlay) { stopDst(); }
			
			jQuery(".item_slide", Father).fadeOut(opts.fadeSpeed);
			jQuery(".item_slide:eq("+(n-1)+")", Father).fadeIn(opts.fadeSpeed);
			
				selItem = n;
				jQuery(".btRpt", Father).removeClass(opts.classAt);
				jQuery(".btRpt:eq("+(n-1)+")", Father).addClass(opts.classAt);
				
				jQuery(".btRpt", Father).stop().animate({paddingTop : '0'}, 'fast', 'easeOutBounce');
				jQuery(".btRpt."+opts.classAt, Father).stop().animate({paddingTop : '10px'}, 'fast', 'easeOutBounce');
				
				if (opts.autoPlay) { playDst(opts.timer); }
		}
		
		function nextDst () {

			if (selItem > nItens-1) {
				n = 1;
			} else {
				n = selItem + 1;
			}
			
			if (nItens > 1) {
			showDst(n);
			}

		}
		
		function playDst (t) {
			Interval = setTimeout(nextDst, t);
		}
		
		function stopDst () {
			clearTimeout(Interval);
		}
		//-------
		
		//Crio os Botoes
		var btModel = jQuery(".btRpt:last", Father);
		// for (i=0; i<nItens-1; i++) { btModel.clone().insertAfter(btModel); }
		
		// var lblBt = 0;
		jQuery(".btRpt", Father).each(function(i){
			// lblBt++;
			// jQuery(this).html(lblBt);
			jQuery(this).click(function(){
				n = i;
				n = n+1;
				if (selItem != n) {
				jQuery(this).stop().animate({paddingTop : '10px'}, 'fast', 'easeOutBounce');
					showDst(n);
				}
			});
			
			jQuery(this).hover(function(){
				jQuery(this).addClass(opts.classOver);
			},
			function(){
				jQuery(this).removeClass(opts.classOver);
			});
		});
		//--------------
		
		showDst (1);
		if (opts.autoPlay) { playDst(opts.timer); }
		
		
	});
}
