jQuery.fn.stepBanner=function(holder,options){options=jQuery.extend({},jQuery.fn.stepBanner.defaults,options);return this.each(function(){var opts=jQuery.fn.stepBanner.elementOptions(this,options);var currentItem=jQuery(this);currentItem.banners=jQuery(this).find('.'+opts.subClass);currentItem.leftOutPos=jQuery(this).width();currentItem.stepIndex=0;currentItem.stop=false;currentItem.maxBanners=currentItem.banners.length;currentItem.stepNav=new Array;currentItem.opts=opts;currentItem.timer;if(currentItem.maxBanners>1){currentItem.banners.each(function(index,element){var newNavItem=jQuery(document.createElement('a')).attr('href','#').addClass(opts.navClass).attr('title',jQuery(element).attr('title')).click(function(e){e.preventDefault();jQuery.fn.stepBanner.changeBanner(currentItem,index)});jQuery(holder).append(newNavItem);currentItem.stepNav.push(newNavItem);if(index!=0)jQuery(element).css({left:currentItem.leftOutPos});else newNavItem.addClass(opts.navActiveClass)});jQuery.fn.stepBanner.changeBanner(currentItem,null,opts.delay)}jQuery(currentItem.banners[0]).show();jQuery(this).hover(function(){currentItem.stop=true;clearTimeout(currentItem.timer)},function(){currentItem.stop=false;jQuery.fn.stepBanner.changeBanner(currentItem,null,opts.delay)})})};jQuery.fn.stepBanner.elementOptions=function(ele,options){return jQuery.metadata?jQuery.extend({},options,jQuery(ele).metadata()):options};jQuery.fn.stepBanner.defaults={timeAnim:400,delay:5000,subClass:'stepBanners',navClass:'stepNav',navActiveClass:'ativado'};jQuery.fn.stepBanner.changeBanner=function(currentItem,location,timer){clearTimeout(currentItem.timer);currentItem.timer=setTimeout(function(){if(location==currentItem.stepIndex)return;var transition;var oldIndex=currentItem.stepIndex;currentItem.stepIndex=location!=null?location:currentItem.stepIndex+1;if(currentItem.stepIndex<0||currentItem.stepIndex>=currentItem.maxBanners)currentItem.stepIndex=0;jQuery(currentItem.stepNav[oldIndex]).removeClass(currentItem.opts.navActiveClass);jQuery(currentItem.stepNav[currentItem.stepIndex]).addClass(currentItem.opts.navActiveClass);jQuery(currentItem.banners[oldIndex]).fadeOut(currentItem.opts.timeAnim,function(){jQuery(currentItem.banners[oldIndex]).css({left:currentItem.leftOutPos});jQuery(currentItem.banners[currentItem.stepIndex]).css({left:0}).fadeIn(currentItem.opts.timeAnim);if(!currentItem.stop)jQuery.fn.stepBanner.changeBanner(currentItem,null,currentItem.opts.delay)})},timer?timer:0)};jQuery(document).ready(function(){jQuery('#stepBanner').stepBanner(jQuery('#navHolder'))});
