/*! * Feature Carousel, Version 1.3 * http://www.bkosolutions.com * * Copyright 2011 Brian Osborne * Licensed under GPL version 3 * brian@bkosborne.com * * http://www.gnu.org/licenses/gpl.txt */ (function(a){a.fn.featureCarousel=function(f){if(this.length>1){this.each(function(){a(this).featureCarousel(f)});return this}f=a.extend({},a.fn.featureCarousel.defaults,f||{});var q={currentCenterNum:f.startingFeature,containerWidth:0,containerHeight:0,largeFeatureWidth:0,largeFeatureHeight:0,smallFeatureWidth:0,smallFeatureHeight:0,totalFeatureCount:a(this).children("div").length,currentlyMoving:false,featuresContainer:a(this),featuresArray:[],containerIDTag:"#"+a(this).attr("id"),timeoutVar:null,rotationsRemaining:0,itemsToAnimate:0,borderWidth:0};var j=function(w){if(f.preload==true){var u=q.featuresContainer.find("img");var t=0;var v=u.length;u.each(function(y,z){var x=new Image();a(x).bind("load error",function(){t++;if(t==v){w()}});x.src=z.src})}else{w()}};var m=function(t){return q.featuresArray[t-1]};var n=function(t){a.each(q.featuresArray,function(){if(a(this).data().setPosition==t){return a(this)}})};var c=function(t){if((t-1)==0){return q.totalFeatureCount}else{return t-1}};var i=function(t){if((t+1)>q.totalFeatureCount){return 1}else{return t+1}};var e=function(){q.containerWidth=q.featuresContainer.width();q.containerHeight=q.featuresContainer.height();var t=a(q.containerIDTag).find(".carousel-image:first");if(f.largeFeatureWidth>1){q.largeFeatureWidth=f.largeFeatureWidth}else{if(f.largeFeatureWidth>0&&f.largeFeatureWidth<1){q.largeFeatureWidth=t.width()*f.largeFeatureWidth}else{q.largeFeatureWidth=t.outerWidth()}}if(f.largeFeatureHeight>1){q.largeFeatureHeight=f.largeFeatureHeight}else{if(f.largeFeatureHeight>0&&f.largeFeatureHeight<1){q.largeFeatureHeight=t.height()*f.largeFeatureHeight}else{q.largeFeatureHeight=t.outerHeight()}}if(f.smallFeatureWidth>1){q.smallFeatureWidth=f.smallFeatureWidth}else{if(f.smallFeatureWidth>0&&f.smallFeatureWidth<1){q.smallFeatureWidth=t.width()*f.smallFeatureWidth}else{q.smallFeatureWidth=t.outerWidth()/2}}if(f.smallFeatureHeight>1){q.smallFeatureHeight=f.smallFeatureHeight}else{if(f.smallFeatureHeight>0&&f.smallFeatureHeight<1){q.smallFeatureHeight=t.height()*f.smallFeatureHeight}else{q.smallFeatureHeight=t.outerHeight()/2}}};var b=function(){if(f.displayCutoff>0&&f.displayCutoff");x.addClass("numberTag");x.html("("+y+" of "+q.totalFeatureCount+") ");a(this).find(".carousel-caption p").prepend(x)})}};var h=function(){if(f.trackerIndividual){var z=a("");z.addClass("tracker-individual-container");for(var y=0;y"+t+"");x.addClass("tracker-individual-blip");x.css("cursor","pointer");x.attr("id","tracker-"+(y+1));var w=a("
  • ");w.append(x);w.css("float","left");w.css("list-style-type","none");z.append(w)}a(q.containerIDTag).append(z);z.hide().show()}if(f.trackerSummation){var v=a("
    ");v.addClass("tracker-summation-container");var u=a("").addClass("tracker-summation-current").text(f.startingFeature);var B=a("").addClass("tracker-summation-total").text(q.totalFeatureCount);var A=a("").addClass("tracker-summation-middle").text(" of ");v.append(u).append(A).append(B);a(q.containerIDTag).append(v)}};var s=function(x,t){if(f.trackerIndividual){var u=q.featuresContainer.find(".tracker-individual-container");var v=u.find("#tracker-"+x);var w=u.find("#tracker-"+t);v.removeClass("tracker-individual-blip-selected");w.addClass("tracker-individual-blip-selected")}if(f.trackerSummation){var u=q.featuresContainer.find(".tracker-summation-container");u.find(".tracker-summation-current").text(t)}};var p=function(u){clearTimeout(q.timeoutVar);if(!u&&f.autoPlay!=0){var t=(Math.abs(f.autoPlay)0)?k(true,1):k(false,1)},t)}};var d=function(t){a.each(q.featuresArray,function(){var u;if(t==false){u=i(a(this).data().position)}else{u=c(a(this).data().position)}a(this).data("position",u)})};var o=function(y,C){var w,t,v,z,u,D,A;var B=y.data("position");var x;if(C==true){x=c(B)}else{x=i(B)}if(B==1){f.leavingCenter(y)}if(x==1){w=q.largeFeatureWidth;t=q.largeFeatureHeight;v=f.topPadding;u=y.css("z-index");z=(q.containerWidth/2)-(q.largeFeatureWidth/2)-(q.borderWidth/2);A=1}else{w=q.smallFeatureWidth;t=q.smallFeatureHeight;v=f.smallFeatureOffset+f.topPadding;u=1;A=0.4;if(x==q.totalFeatureCount){z=f.sidePadding}else{if(x==2){z=q.containerWidth-q.smallFeatureWidth-f.sidePadding-q.borderWidth}else{z=(q.containerWidth/2)-(q.smallFeatureWidth/2)-(q.borderWidth/2);A=0}}}if(B==1){y.find(".carousel-caption").hide()}y.animate({width:w,height:t,top:v,left:z,opacity:A},f.carouselSpeed,f.animationEasing,function(){if(x==1){if(f.captionBelow){y.css("height","auto")}y.find(".carousel-caption").fadeTo("fast",0.85);f.movedToCenter(y)}q.rotationsRemaining=q.rotationsRemaining-1;y.css("z-index",u);if(f.trackerIndividual||f.trackerSummation){if(x==1){var E=q.featuresContainer.find(".carousel-feature").index(y)+1;var F;if(C==false){F=i(E)}else{F=c(E)}s(F,E)}}var G=q.rotationsRemaining/q.itemsToAnimate;if(G%1==0){q.currentlyMoving=false;d(C);if(q.rotationsRemaining>0){l(C)}}p(false)}).find(".carousel-image").animate({width:w,height:t},f.carouselSpeed,f.animationEasing).end()};var l=function(w){q.currentlyMoving=true;var x,v,t,u;if(w==true){x=m(i(q.currentCenterNum));v=m(q.currentCenterNum);t=m(i(i(q.currentCenterNum)));u=m(c(q.currentCenterNum));q.currentCenterNum=i(q.currentCenterNum)}else{x=m(c(q.currentCenterNum));v=m(c(c(q.currentCenterNum)));t=m(q.currentCenterNum);u=m(i(q.currentCenterNum));q.currentCenterNum=c(q.currentCenterNum)}if(w){v.css("z-index",3)}else{t.css("z-index",3)}x.css("z-index",4);o(v,w);o(x,w);o(t,w);if(q.totalFeatureCount>3){o(u,w)}};var k=function(v,u){if(q.currentlyMoving==false){var t=u*q.itemsToAnimate;q.rotationsRemaining=t;l(v)}};var g=function(x,w){var u=1,t=1,v;v=x;while((v=c(v))!=w){u++}v=x;while((v=i(v))!=w){t++}return(u