jQuery.fn.ListaDestaques = function (options) {
	
	var opts = jQuery.extend({
		timer: 4000,
		fadeSpeed: "normal",
		autoPlay: true,
		classAt: "dstBtAt",
		classOver: "dstBtOver"
	}, options);
	
	this.each(function(){
		
		//Configs iniciais
		var Interval;
		var Father		= jQuery(this);
		var selItem		= 1;
		var nItens 		= jQuery(".DstItem", Father).size();
		
		jQuery('.DstItem', Father).hide();
		//jQuery('.DstItem:first', Father).show();
		
		jQuery(".dstItens", Father).css('position', 'relative');
		jQuery('.DstItem', Father).css('position', 'absolute');
		
		//----------------
		
		//Funcoes		
		function showDst (n){
			if (opts.autoPlay) { stopDst(); }
			
			jQuery(".DstItem", Father).fadeOut(opts.fadeSpeed);
			jQuery(".DstItem:eq("+(n-1)+")", Father).fadeIn(opts.fadeSpeed);
			
				selItem = n;
				jQuery(".btRpt", Father).removeClass(opts.classAt);
				jQuery(".btRpt:eq("+(n-1)+")", Father).addClass(opts.classAt);
				if (opts.autoPlay) { playDst(opts.timer); }
				
				jQuery(".pags .txtPag", Father).html(n + ' de ' + nItens);
		}
		
		function nextDst () {

			if (selItem > nItens-1) {
				n = 1;
			} else {
				n = selItem + 1;
			}

			showDst(n);

		}
		
		function prevDst () {
			
			if (selItem == 1) {
				n = nItens;
			} else {
				n = selItem - 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(){
			lblBt++;
			jQuery(this).html(lblBt);
			jQuery(this).click(function(){
				n = parseFloat(jQuery(this).html());
				if (selItem != n) {
					showDst(n);
				}
			});
			
			jQuery(this).hover(function(){
				jQuery(this).addClass(opts.classOver);
			},
			function(){
				jQuery(this).removeClass(opts.classOver);
			});
		});
		//--------------
		
		//Botos pgs
		jQuery('.pags .btNext', Father).click(function(){
			nextDst();
		});
		jQuery('.pags .btPrev', Father).click(function(){
			prevDst();
		});
		
		showDst (1);
		if (opts.autoPlay) { playDst(opts.timer); }
		
		
	});
}