if(typeof Object.create!=="function"){Object.create=function(b){function a(){}a.prototype=b;return new a()}}(function(a){a.fn.extend({lbListRotator:function(b){if(this.length){return this.each(function(){var c=Object.create(lbListRotatorClass);c.init(this,b);a.data(this,"lbListRotator",lbListRotatorClass)})}}})})(jQuery);var lbListRotatorClass={init:function(b,a){var d=this;d.settings=jQuery.extend({rotationInterval:5000,effectTimer:1000,effect:"fade",effectOptions:{},shuffle:false,randomStart:false,autoStart:true,disableRotationEngine:false,listRotatorHelper:false,activeItemClass:"lbListRotatorItemActive",activeHelperItemClass:"lbListRotatorHelperItemActive",helperInteraction:"mouseover",startIndex:0},d.settings,a);d.effectOptions=jQuery.extend({slideBy:100},d.effectOptions,d.settings.effectOptions);d.listRotator=b;d.$listRotator=jQuery(b);d.totalItems=d.$listRotator.find("li").length;d.currentItem=(d.settings.startIndex>=0&&d.settings.startIndex<d.totalItems)?d.settings.startIndex:0;d.shuffledItems=new Array();d.shuffledItems.push(d.currentItem);d.previousItem=null;d.tId=null;d.userInteraction=false;if(d.settings.randomStart){d.currentItem=d.random(d.totalItems)}d.$listRotator.children().each(function(c){if(c==d.currentItem){if(d.settings.effect=="slide"){var e="-"+d.currentItem*d.effectOptions.slideBy;d.$listRotator.css("left",e)}jQuery(this).show();jQuery(this).addClass(d.settings.activeItemClass);d.setHelperClass(d,c,true)}});if(jQuery(d.settings.listRotatorHelper).length>0){jQuery(d.settings.listRotatorHelper).children().each(function(){jQuery(this).bind(d.settings.helperInteraction,function(){d.userInteraction=true;d.stopRotationEngine(d);if(d.settings.effect!="slide"){d.$listRotator.children().hide()}d.$listRotator.children().removeClass(d.settings.activeItemClass);jQuery(d.settings.listRotatorHelper).children().removeClass(d.settings.activeHelperItemClass);d.currentItem=jQuery(this).index();d.$listRotator.children().each(function(c){if(c==d.currentItem){jQuery(this).stop();jQuery(this).css("opacity",1);jQuery(this).show();if(d.settings.effect=="slide"){d.runEffect(d,jQuery(this),false)}jQuery(this).addClass(d.settings.activeItemClass);d.setHelperClass(d,c,true);return false}})});jQuery(this).bind("mouseout",function(){d.startRotationEngine(d)})})}if(d.settings.autoStart){d.startRotationEngine(d)}},rotationEngine:function(a){a.stopRotationEngine(a);a.userInteraction=false;a.$listRotator.children().each(function(b){if(b==a.currentItem){if(a.settings.shuffle){a.currentItem=a.shuffleRotationEngine(a,a.totalItems)}else{a.currentItem++;a.currentItem=(a.currentItem>=a.totalItems)?0:a.currentItem}a.$listRotator.children().each(function(c){if(c==a.currentItem){jQuery(this).show();a.setHelperClass(a,c,true);a.setHelperClass(a,b,false);return false}});a.runEffect(a,jQuery(this),true);return false}})},continueRotation:function(d,b,a){if(!d.userInteraction){if(a){b.hide()}b.removeClass(d.settings.activeItemClass);d.$listRotator.children().each(function(c){if(c==d.currentItem){jQuery(this).addClass(d.settings.activeItemClass);return false}});this.startRotationEngine(d)}},runEffect:function(f,b,a){if(f.settings.effect=="slide"){var d="-"+f.currentItem*f.effectOptions.slideBy;f.$listRotator.animate({left:d},f.settings.effectTimer,"swing",function(){if(a){f.continueRotation(f,b,false)}})}else{if(b.effect&&f.settings.effect!="fade"){b.effect(f.settings.effect,f.effectOptions,f.settings.effectTimer,function(){if(a){f.continueRotation(f,b,true)}})}else{b.fadeOut(f.settings.effectTimer,function(){if(a){f.continueRotation(f,b,true)}})}}},stopRotationEngine:function(a){clearInterval(a.tId)},startRotationEngine:function(a){a.stopRotationEngine(a);if(!a.settings.disableRotationEngine){a.tId=setInterval(function(){a.rotationEngine(a)},a.settings.rotationInterval)}},shuffleRotationEngine:function(d,a){var b=d.random(a);while(d.in_array(b,d.shuffledItems)||b==d.previousItem){b=d.random(a)}d.previousItem=b;d.shuffledItems.push(b);if(d.shuffledItems.length==d.totalItems){d.shuffledItems=new Array()}return b},in_array:function(b,a){for(n in a){if(a[n]==b){return true}}return false},random:function(a){return Math.floor(Math.random()*a)},setHelperClass:function(d,b,a){if(jQuery(d.settings.listRotatorHelper).length>0){jQuery(d.settings.listRotatorHelper).children().each(function(c){if(c==b){if(a){jQuery(this).addClass(d.settings.activeHelperItemClass)}else{jQuery(this).removeClass(d.settings.activeHelperItemClass)}return false}})}}};
