(function($){var _css={};var methods={init:function(options){options=$.extend({},$.fn.lemmonSlider.defaults,options);return this.each(function(){var $slider=$(this),data=$slider.data('slider');if(!data){var $sliderContainer=$slider.find(options.slider),$sliderControls=$slider.next().filter('.controls'),$items=$sliderContainer.find(options.items),originalWidth=1;$items.each(function(){originalWidth+=$(this).outerWidth(!0)});$sliderContainer.width(originalWidth);if(options.slideToLast)$sliderContainer.css('padding-right',$slider.width());if(options.infinite){$slider.data('slider-infinite',!0);originalWidth=originalWidth*3;$sliderContainer.width(originalWidth);$items.clone(!0,!0).addClass('-after').insertAfter($items.filter(':last'));$items.filter(':first').before($items.clone(!0,!0).addClass('-before'));$items=$sliderContainer.find(options.items)}
$slider.items=$items;$slider.options=options;slideTo({},$slider,0,0,0);$slider.bind('nextSlide',function(e,t){var scroll=$slider.scrollLeft();var x=0;var slide=0;$items.each(function(i){if(x==0&&$(this).position().left>options.offset){x=$(this).position().left;slide=i}});if(x>0&&$sliderContainer.outerWidth()-scroll-$slider.width()-1>0){slideTo(e,$slider,scroll+x,slide,'slow')}else if(options.loop){slideTo(e,$slider,0,0,'slow')}});$slider.bind('prevSlide',function(e,t){var scroll=$slider.scrollLeft();var x=0;var slide=0;$items.each(function(i){if($(this).position().left<options.offset){x=$(this).position().left;slide=i}});if(x){slideTo(e,$slider,scroll+x,slide,'slow')}else if(options.loop){var a=$sliderContainer.outerWidth()-$slider.width();var b=$items.filter(':last').position().left;slide=$items.size()-1;if(a>b){slideTo(e,$slider,b,slide,'slow')}else{slideTo(e,$slider,a,slide,'slow')}}});$slider.bind('nextPage',function(e,t){var scroll=$slider.scrollLeft();var w=$slider.width();var x=0;var slide=0;$items.each(function(i){if($(this).position().left<w){x=$(this).position().left;slide=i}});if(x>0&&scroll+w+1<originalWidth){slideTo(e,$slider,scroll+x,slide,'slow')}else if(options.loop){slideTo(e,$slider,0,0,'slow')}});$slider.bind('prevPage',function(e,t){var scroll=$slider.scrollLeft();var w=$slider.width();var x=0;$items.each(function(i){if($(this).position().left<1-w){x=$(this).next().position().left;slide=i}});if(scroll){if(x==0){slideTo(e,$slider,0,0,'slow')}else{slideTo(e,$slider,scroll+x,slide,'slow')}}else if(options.loop){var a=$sliderContainer.outerWidth()-$slider.width();var b=$items.filter(':last').position().left;if(a>b){$slider.animate({'scrollLeft':b},'slow')}else{$slider.animate({'scrollLeft':a},'slow')}}});$slider.bind('slideTo',function(e,i,t){slideTo(e,$slider,$slider.scrollLeft()+$items.filter(':eq('+i+')').position().left,i,t)});$sliderControls.find('.next-slide').click(function(){$slider.trigger('nextSlide');return!1});$sliderControls.find('.prev-slide').click(function(){$slider.trigger('prevSlide');return!1});$sliderControls.find('.next-page').click(function(){$slider.trigger('nextPage');return!1});$sliderControls.find('.prev-page').click(function(){$slider.trigger('prevPage');return!1});$slider.data('slider',{'target':$slider,'options':options})}})},addItem:function(options){var options=$.extend({},$.fn.lemmonSlider.defaults,options);var $slider=$(this),$sliderContainer=$slider.find(options.slider),$sliderControls=$slider.next().filter('.controls'),$items=$sliderContainer.find(options.items)
options.infinite=$slider.data('slider-infinite')
if(!options.item){return!1}
methods.destroy.apply(this);if(options.prepend){$sliderContainer.prepend(options.item)}else{$sliderContainer.append(options.item)}
methods.init.apply(this,[options])},destroy:function(){return this.each(function(){var $slider=$(this),$sliderControls=$slider.next().filter('.controls'),$items=$slider.find('> *:first > *'),data=$slider.data('slider');$slider.unbind('nextSlide');$slider.unbind('prevSlide');$slider.unbind('nextPage');$slider.unbind('prevPage');$slider.unbind('slideTo');$sliderControls.find('.next-slide').unbind('click');$sliderControls.find('.prev-slide').unbind('click');$sliderControls.find('.next-page').unbind('click');$sliderControls.find('.next-page').unbind('click');$slider.removeData('slider');if($slider.data('slider-infinite')){$.merge($items.filter('.-before'),$items.filter('.-after')).each(function(index,item){$(item).remove()})}})}}
function slideTo(e,$slider,x,i,t){$slider.items.filter('li:eq('+i+')').addClass('active').siblings('.active').removeClass('active no_opacity_animation');if($slider.options.center){var currentElement=$($slider.items[i]);$slider.options.offset=Math.floor(($(window).width()-currentElement.width())/2)}
if(typeof t=='undefined'){t='slow'}
if(t){$slider.animate({'scrollLeft':x-$slider.options.offset},t,function(){checkInfinite($slider)})}else{var time=0;$slider.scrollLeft(x-$slider.options.offset);checkInfinite($slider)}}
function checkInfinite($slider){var $active=$slider.items.filter('.active');if($active.hasClass('-before')){var i=$active.prevAll().size();$active.removeClass('active');$active=$slider.items.filter(':not(.-before):eq('+i+')').addClass('active no_opacity_animation');$slider.scrollLeft($slider.scrollLeft()+$active.position().left-$slider.options.offset)}else if($active.hasClass('-after')){var i=$active.prevAll('.-after').size();$active.removeClass('active');$active=$slider.items.filter(':not(.-before):eq('+i+')').addClass('active no_opacity_animation');$slider.scrollLeft($slider.scrollLeft()+$active.position().left-$slider.options.offset)}}
function debug(text){$('#debug span').text(text)}
$.fn.lemmonSlider=function(method,options){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments)}else{$.error('Method '+method+' does not exist on jQuery.lemmonSlider')}};$.fn.lemmonSlider.defaults={'items':'> *','loop':!0,'slideToLast':!1,'slider':'> *:first','infinite':!0,'center':!0,'offset':0}})(jQuery)