");c.data("scrollWrapper",c.find("."+d.scrollWrapperClass))}else{if(c.data("scrollableArea").length===0){c.data("scrollWrapper").wrapInner("
");c.data("scrollableArea",c.find("."+d.scrollableAreaClass))}}}if(c.data("scrollingHotSpotRight").length===0){c.prepend("
");c.data("scrollingHotSpotRight",c.find("."+d.scrollingHotSpotRightClass))}else{c.prepend(c.data("scrollingHotSpotRight"))}if(c.data("scrollingHotSpotLeft").length===0){c.prepend("
");c.data("scrollingHotSpotLeft",c.find("."+d.scrollingHotSpotLeftClass))}else{c.prepend(c.data("scrollingHotSpotLeft"))}c.data("speedBooster",1);c.data("scrollXPos",0);c.data("hotSpotWidth",c.data("scrollingHotSpotLeft").innerWidth());c.data("scrollableAreaWidth",0);c.data("startingPosition",0);c.data("rightScrollingInterval",null);c.data("leftScrollingInterval",null);c.data("autoScrollingInterval",null);c.data("hideHotSpotBackgroundsInterval",null);c.data("previousScrollLeft",0);c.data("pingPongDirection","right");c.data("getNextElementWidth",true);c.data("swapAt",null);c.data("startAtElementHasNotPassed",true);c.data("swappedElement",null);c.data("originalElements",c.data("scrollableArea").children(d.countOnlyClass));c.data("visible",true);c.data("enabled",true);c.data("scrollableAreaHeight",c.data("scrollableArea").height());c.data("scrollerOffset",c.offset());if(d.touchScrolling&&c.data("enabled")){c.data("scrollWrapper").kinetic({y:false,moved:function(e){if(d.manualContinuousScrolling){if(c.data("scrollWrapper").scrollLeft()<=0){b._checkContinuousSwapLeft()}else{b._checkContinuousSwapRight()}}},stopped:function(e){c.data("scrollWrapper").stop(true,false);b.stopAutoScrolling()}})}c.data("scrollingHotSpotRight").bind("mousemove",function(g){if(d.hotSpotScrolling){var f=g.pageX-(this.offsetLeft+c.data("scrollerOffset").left);c.data("scrollXPos",Math.round((f/c.data("hotSpotWidth"))*d.hotSpotScrollingStep));if(c.data("scrollXPos")===Infinity||c.data("scrollXPos")<1){c.data("scrollXPos",1)}}});c.data("scrollingHotSpotRight").bind("mouseover",function(){if(d.hotSpotScrolling){c.data("scrollWrapper").stop(true,false);b.stopAutoScrolling();c.data("rightScrollingInterval",setInterval(function(){if(c.data("scrollXPos")>0&&c.data("enabled")){c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()+(c.data("scrollXPos")*c.data("speedBooster")));if(d.manualContinuousScrolling){b._checkContinuousSwapRight()}b._showHideHotSpots()}},d.hotSpotScrollingInterval));b._trigger("mouseOverRightHotSpot")}});c.data("scrollingHotSpotRight").bind("mouseout",function(){if(d.hotSpotScrolling){clearInterval(c.data("rightScrollingInterval"));c.data("scrollXPos",0);if(d.easingAfterHotSpotScrolling&&c.data("enabled")){c.data("scrollWrapper").animate({scrollLeft:c.data("scrollWrapper").scrollLeft()+d.easingAfterHotSpotScrollingDistance},{duration:d.easingAfterHotSpotScrollingDuration,easing:d.easingAfterHotSpotScrollingFunction})}}});c.data("scrollingHotSpotRight").bind("mousedown",function(){c.data("speedBooster",d.hotSpotMouseDownSpeedBooster)});a("body").bind("mouseup",function(){c.data("speedBooster",1)});c.data("scrollingHotSpotLeft").bind("mousemove",function(g){if(d.hotSpotScrolling){var f=((this.offsetLeft+c.data("scrollerOffset").left+c.data("hotSpotWidth"))-g.pageX);c.data("scrollXPos",Math.round((f/c.data("hotSpotWidth"))*d.hotSpotScrollingStep));if(c.data("scrollXPos")===Infinity||c.data("scrollXPos")<1){c.data("scrollXPos",1)}}});c.data("scrollingHotSpotLeft").bind("mouseover",function(){if(d.hotSpotScrolling){c.data("scrollWrapper").stop(true,false);b.stopAutoScrolling();c.data("leftScrollingInterval",setInterval(function(){if(c.data("scrollXPos")>0&&c.data("enabled")){c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()-(c.data("scrollXPos")*c.data("speedBooster")));if(d.manualContinuousScrolling){b._checkContinuousSwapLeft()}b._showHideHotSpots()}},d.hotSpotScrollingInterval));b._trigger("mouseOverLeftHotSpot")}});c.data("scrollingHotSpotLeft").bind("mouseout",function(){if(d.hotSpotScrolling){clearInterval(c.data("leftScrollingInterval"));c.data("scrollXPos",0);if(d.easingAfterHotSpotScrolling&&c.data("enabled")){c.data("scrollWrapper").animate({scrollLeft:c.data("scrollWrapper").scrollLeft()-d.easingAfterHotSpotScrollingDistance},{duration:d.easingAfterHotSpotScrollingDuration,easing:d.easingAfterHotSpotScrollingFunction})}}});c.data("scrollingHotSpotLeft").bind("mousedown",function(){c.data("speedBooster",d.hotSpotMouseDownSpeedBooster)});c.data("scrollableArea").mousewheel(function(g,i,f,e){if(c.data("enabled")&&d.mousewheelScrolling.length>0){var h;if(d.mousewheelScrolling==="vertical"&&e!==0){b.stopAutoScrolling();g.preventDefault();h=Math.round((d.mousewheelScrollingStep*e)*-1);b.move(h)}else{if(d.mousewheelScrolling==="horizontal"&&f!==0){b.stopAutoScrolling();g.preventDefault();h=Math.round((d.mousewheelScrollingStep*f)*-1);b.move(h)}else{if(d.mousewheelScrolling==="allDirections"){b.stopAutoScrolling();g.preventDefault();h=Math.round((d.mousewheelScrollingStep*i)*-1);b.move(h)}}}}});if(d.mousewheelScrolling){c.data("scrollingHotSpotLeft").add(c.data("scrollingHotSpotRight")).mousewheel(function(e){e.preventDefault()})}a(window).bind("resize",function(){b._showHideHotSpots();b._trigger("windowResized")});if(!(jQuery.isEmptyObject(d.getContentOnLoad))){b[d.getContentOnLoad.method](d.getContentOnLoad.content,d.getContentOnLoad.manipulationMethod,d.getContentOnLoad.addWhere,d.getContentOnLoad.filterTag)}if(d.hiddenOnStart){b.hide()}a(window).load(function(){if(!(d.hiddenOnStart)){b.recalculateScrollableArea()}if((d.autoScrollingMode.length>0)&&!(d.hiddenOnStart)){b.startAutoScrolling()}if(d.autoScrollingMode!=="always"){switch(d.visibleHotSpotBackgrounds){case"always":b.showHotSpotBackgrounds();break;case"onStart":b.showHotSpotBackgrounds();c.data("hideHotSpotBackgroundsInterval",setTimeout(function(){b.hideHotSpotBackgrounds(250)},d.hotSpotsVisibleTime));break;case"hover":c.mouseenter(function(e){if(d.hotSpotScrolling){e.stopPropagation();b.showHotSpotBackgrounds(250)}}).mouseleave(function(e){if(d.hotSpotScrolling){e.stopPropagation();b.hideHotSpotBackgrounds(250)}});break;default:break}}b._showHideHotSpots();b._trigger("setupComplete")})},_setOption:function(c,e){var b=this,f=this.options,d=this.element;f[c]=e;if(c==="hotSpotScrolling"){if(e===true){b._showHideHotSpots()}else{d.data("scrollingHotSpotLeft").hide();d.data("scrollingHotSpotRight").hide()}}else{if(c==="autoScrollingStep"||c==="easingAfterHotSpotScrollingDistance"||c==="easingAfterHotSpotScrollingDuration"||c==="easingAfterMouseWheelScrollingDuration"){f[c]=parseInt(e,10)}else{if(c==="autoScrollingInterval"){f[c]=parseInt(e,10);b.startAutoScrolling()}}}},showHotSpotBackgrounds:function(c){var b=this,d=this.element,e=this.option;if(c!==undefined){d.data("scrollingHotSpotLeft").addClass("scrollingHotSpotLeftVisible");d.data("scrollingHotSpotRight").addClass("scrollingHotSpotRightVisible");d.data("scrollingHotSpotLeft").add(d.data("scrollingHotSpotRight")).fadeTo(c,0.75)}else{d.data("scrollingHotSpotLeft").addClass("scrollingHotSpotLeftVisible");d.data("scrollingHotSpotLeft").removeAttr("style");d.data("scrollingHotSpotRight").addClass("scrollingHotSpotRightVisible");d.data("scrollingHotSpotRight").removeAttr("style")}b._showHideHotSpots()},hideHotSpotBackgrounds:function(b){var c=this.element,d=this.option;if(b!==undefined){c.data("scrollingHotSpotLeft").fadeTo(b,0,function(){c.data("scrollingHotSpotLeft").removeClass("scrollingHotSpotLeftVisible")});c.data("scrollingHotSpotRight").fadeTo(b,0,function(){c.data("scrollingHotSpotRight").removeClass("scrollingHotSpotRightVisible")})}else{c.data("scrollingHotSpotLeft").removeClass("scrollingHotSpotLeftVisible").removeAttr("style");c.data("scrollingHotSpotRight").removeClass("scrollingHotSpotRightVisible").removeAttr("style")}},_showHideHotSpots:function(){var b=this,c=this.element,d=this.options;if(!(d.hotSpotScrolling)){c.data("scrollingHotSpotLeft").hide();c.data("scrollingHotSpotRight").hide()}else{if(d.manualContinuousScrolling&&d.hotSpotScrolling&&d.autoScrollingMode!=="always"){c.data("scrollingHotSpotLeft").show();c.data("scrollingHotSpotRight").show()}else{if(d.autoScrollingMode!=="always"&&d.hotSpotScrolling){if(c.data("scrollableAreaWidth")<=(c.data("scrollWrapper").innerWidth())){c.data("scrollingHotSpotLeft").hide();c.data("scrollingHotSpotRight").hide()}else{if(c.data("scrollWrapper").scrollLeft()===0){c.data("scrollingHotSpotLeft").hide();c.data("scrollingHotSpotRight").show();b._trigger("scrollerLeftLimitReached");clearInterval(c.data("leftScrollingInterval"));c.data("leftScrollingInterval",null)}else{if(c.data("scrollableAreaWidth")<=(c.data("scrollWrapper").innerWidth()+c.data("scrollWrapper").scrollLeft())){c.data("scrollingHotSpotLeft").show();c.data("scrollingHotSpotRight").hide();b._trigger("scrollerRightLimitReached");clearInterval(c.data("rightScrollingInterval"));c.data("rightScrollingInterval",null)}else{c.data("scrollingHotSpotLeft").show();c.data("scrollingHotSpotRight").show()}}}}else{c.data("scrollingHotSpotLeft").hide();c.data("scrollingHotSpotRight").hide()}}}},_setElementScrollPosition:function(f,b){var c=this.element,e=this.options,d=0;switch(f){case"first":c.data("scrollXPos",0);return true;case"start":if(e.startAtElementId!==""){if(c.data("scrollableArea").has("#"+e.startAtElementId)){d=a("#"+e.startAtElementId).position().left;c.data("scrollXPos",d);return true}}return false;case"last":c.data("scrollXPos",(c.data("scrollableAreaWidth")-c.data("scrollWrapper").innerWidth()));return true;case"number":if(!(isNaN(b))){d=c.data("scrollableArea").children(e.countOnlyClass).eq(b-1).position().left;c.data("scrollXPos",d);return true}return false;case"id":if(b.length>0){if(c.data("scrollableArea").has("#"+b)){d=a("#"+b).position().left;c.data("scrollXPos",d);return true}}return false;default:return false}},jumpToElement:function(b,d){var c=this,e=this.element;if(e.data("enabled")){if(c._setElementScrollPosition(b,d)){e.data("scrollWrapper").scrollLeft(e.data("scrollXPos"));c._showHideHotSpots();switch(b){case"first":c._trigger("jumpedToFirstElement");break;case"start":c._trigger("jumpedToStartElement");break;case"last":c._trigger("jumpedToLastElement");break;case"number":c._trigger("jumpedToElementNumber",null,{elementNumber:d});break;case"id":c._trigger("jumpedToElementId",null,{elementId:d});break;default:break}}}},scrollToElement:function(c,d){var b=this,e=this.element,g=this.options,f=false;if(e.data("enabled")){if(b._setElementScrollPosition(c,d)){if(e.data("autoScrollingInterval")!==null){b.stopAutoScrolling();f=true}e.data("scrollWrapper").stop(true,false);e.data("scrollWrapper").animate({scrollLeft:e.data("scrollXPos")},{duration:g.scrollToAnimationDuration,easing:g.scrollToEasingFunction,complete:function(){if(f){b.startAutoScrolling()}b._showHideHotSpots();switch(c){case"first":b._trigger("scrolledToFirstElement");break;case"start":b._trigger("scrolledToStartElement");break;case"last":b._trigger("scrolledToLastElement");break;case"number":b._trigger("scrolledToElementNumber",null,{elementNumber:d});break;case"id":b._trigger("scrolledToElementId",null,{elementId:d});break;default:break}}})}}},move:function(e){var b=this,c=this.element,d=this.options;c.data("scrollWrapper").stop(true,true);if((e<0&&c.data("scrollWrapper").scrollLeft()>0)||(e>0&&c.data("scrollableAreaWidth")>(c.data("scrollWrapper").innerWidth()+c.data("scrollWrapper").scrollLeft()))){if(d.easingAfterMouseWheelScrolling){c.data("scrollWrapper").animate({scrollLeft:c.data("scrollWrapper").scrollLeft()+e},{duration:d.easingAfterMouseWheelScrollingDuration,easing:d.easingAfterMouseWheelFunction,complete:function(){b._showHideHotSpots();if(d.manualContinuousScrolling){if(e>0){b._checkContinuousSwapRight()}else{b._checkContinuousSwapLeft()}}}})}else{c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()+e);b._showHideHotSpots();if(d.manualContinuousScrolling){if(e>0){b._checkContinuousSwapRight()}else{b._checkContinuousSwapLeft()}}}}},getFlickrContent:function(e,b){var c=this,d=this.element;a.getJSON(e,function(i){var g=[{size:"small square",pixels:75,letter:"_s"},{size:"thumbnail",pixels:100,letter:"_t"},{size:"small",pixels:240,letter:"_m"},{size:"medium",pixels:500,letter:""},{size:"medium 640",pixels:640,letter:"_z"},{size:"large",pixels:1024,letter:"_b"}];var m=[];var j=[];var f;var h=i.items.length;var k=0;if(d.data("scrollableAreaHeight")<=75){f=0}else{if(d.data("scrollableAreaHeight")<=100){f=1}else{if(d.data("scrollableAreaHeight")<=240){f=2}else{if(d.data("scrollableAreaHeight")<=500){f=3}else{if(d.data("scrollableAreaHeight")<=640){f=4}else{f=5}}}}}a.each(i.items,function(o,p){l(p,f)});function l(r,p){var s=r.media.m;var o=s.replace("_m",g[p].letter);var q=a("
").attr("src",o);q.load(function(){if(this.height
0){g=a("").html(h).find(c)}else{g=f}}else{g=h}switch(b){case"addFirst":e.data("scrollableArea").children(":first").before(g);break;case"addLast":e.data("scrollableArea").children(":last").after(g);break;default:e.data("scrollableArea").html(g);break}d.recalculateScrollableArea();d._showHideHotSpots();d._trigger("addedAjaxContent")})},getHtmlContent:function(g,b,c){var d=this,f=this.element;var e;if(c!==undefined){if(c.length>0){e=a("
").html(g).find(c)}else{e=g}}else{e=g}switch(b){case"addFirst":f.data("scrollableArea").children(":first").before(e);break;case"addLast":f.data("scrollableArea").children(":last").after(e);break;default:f.data("scrollableArea").html(e);break}d.recalculateScrollableArea();d._showHideHotSpots();d._trigger("addedHtmlContent")},recalculateScrollableArea:function(){var b=0,e=false,d=this.options,c=this.element;c.data("scrollableArea").children(d.countOnlyClass).each(function(){if((d.startAtElementId.length>0)&&((a(this).attr("id"))===d.startAtElementId)){c.data("startingPosition",b);e=true}b=b+a(this).outerWidth(true)});if(!(e)){c.data("startAtElementId","")}c.data("scrollableAreaWidth",b);c.data("scrollableArea").width(c.data("scrollableAreaWidth"));c.data("scrollWrapper").scrollLeft(c.data("startingPosition"));c.data("scrollXPos",c.data("startingPosition"))},getScrollerOffset:function(){var b=this.element;return b.data("scrollWrapper").scrollLeft()},stopAutoScrolling:function(){var b=this,c=this.element;if(c.data("autoScrollingInterval")!==null){clearInterval(c.data("autoScrollingInterval"));c.data("autoScrollingInterval",null);b._showHideHotSpots();b._trigger("autoScrollingStopped")}},startAutoScrolling:function(){var b=this,c=this.element,d=this.options;if(c.data("enabled")){b._showHideHotSpots();clearInterval(c.data("autoScrollingInterval"));c.data("autoScrollingInterval",null);b._trigger("autoScrollingStarted");c.data("autoScrollingInterval",setInterval(function(){if(!(c.data("visible"))||(c.data("scrollableAreaWidth")<=(c.data("scrollWrapper").innerWidth()))){clearInterval(c.data("autoScrollingInterval"));c.data("autoScrollingInterval",null)}else{c.data("previousScrollLeft",c.data("scrollWrapper").scrollLeft());switch(d.autoScrollingDirection){case"right":c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()+d.autoScrollingStep);if(c.data("previousScrollLeft")===c.data("scrollWrapper").scrollLeft()){b._trigger("autoScrollingRightLimitReached");clearInterval(c.data("autoScrollingInterval"));c.data("autoScrollingInterval",null);b._trigger("autoScrollingIntervalStopped")}break;case"left":c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()-d.autoScrollingStep);if(c.data("previousScrollLeft")===c.data("scrollWrapper").scrollLeft()){b._trigger("autoScrollingLeftLimitReached");clearInterval(c.data("autoScrollingInterval"));c.data("autoScrollingInterval",null);b._trigger("autoScrollingIntervalStopped")}break;case"backAndForth":if(c.data("pingPongDirection")==="right"){c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()+(d.autoScrollingStep))}else{c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()-(d.autoScrollingStep))}if(c.data("previousScrollLeft")===c.data("scrollWrapper").scrollLeft()){if(c.data("pingPongDirection")==="right"){c.data("pingPongDirection","left");b._trigger("autoScrollingRightLimitReached")}else{c.data("pingPongDirection","right");b._trigger("autoScrollingLeftLimitReached")}}break;case"endlessLoopRight":c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()+d.autoScrollingStep);b._checkContinuousSwapRight();break;case"endlessLoopLeft":c.data("scrollWrapper").scrollLeft(c.data("scrollWrapper").scrollLeft()-d.autoScrollingStep);b._checkContinuousSwapLeft();break;default:break}}},d.autoScrollingInterval))}},_checkContinuousSwapRight:function(){var b=this.element,c=this.options;if(b.data("getNextElementWidth")){if((c.startAtElementId.length>0)&&(b.data("startAtElementHasNotPassed"))){b.data("swapAt",a("#"+c.startAtElementId).outerWidth(true));b.data("startAtElementHasNotPassed",false)}else{b.data("swapAt",b.data("scrollableArea").children(":first").outerWidth(true))}b.data("getNextElementWidth",false)}if(b.data("swapAt")<=b.data("scrollWrapper").scrollLeft()){b.data("swappedElement",b.data("scrollableArea").children(":first").detach());b.data("scrollableArea").append(b.data("swappedElement"));var d=b.data("scrollWrapper").scrollLeft();b.data("scrollWrapper").scrollLeft(d-b.data("swappedElement").outerWidth(true));b.data("getNextElementWidth",true)}},_checkContinuousSwapLeft:function(){var b=this.element,c=this.options;if(b.data("getNextElementWidth")){if((c.startAtElementId.length>0)&&(b.data("startAtElementHasNotPassed"))){b.data("swapAt",a("#"+c.startAtElementId).outerWidth(true));b.data("startAtElementHasNotPassed",false)}else{b.data("swapAt",b.data("scrollableArea").children(":first").outerWidth(true))}b.data("getNextElementWidth",false)}if(b.data("scrollWrapper").scrollLeft()===0){b.data("swappedElement",b.data("scrollableArea").children(":last").detach());b.data("scrollableArea").prepend(b.data("swappedElement"));b.data("scrollWrapper").scrollLeft(b.data("scrollWrapper").scrollLeft()+b.data("swappedElement").outerWidth(true));b.data("getNextElementWidth",true)}},restoreOriginalElements:function(){var b=this,c=this.element;c.data("scrollableArea").html(c.data("originalElements"));b.recalculateScrollableArea();b.jumpToElement("first")},show:function(){var b=this.element;b.data("visible",true);b.show()},hide:function(){var b=this.element;b.data("visible",false);b.hide()},enable:function(){var b=this.element;if(this.options.touchScrolling){b.data("scrollWrapper").kinetic("attach")}b.data("enabled",true)},disable:function(){var b=this,c=this.element;b.stopAutoScrolling();clearInterval(c.data("rightScrollingInterval"));clearInterval(c.data("leftScrollingInterval"));clearInterval(c.data("hideHotSpotBackgroundsInterval"));if(this.options.touchScrolling){c.data("scrollWrapper").kinetic("detach")}c.data("enabled",false)},destroy:function(){var b=this,c=this.element;b.stopAutoScrolling();clearInterval(c.data("rightScrollingInterval"));clearInterval(c.data("leftScrollingInterval"));clearInterval(c.data("hideHotSpotBackgroundsInterval"));c.data("scrollingHotSpotRight").unbind("mouseover");c.data("scrollingHotSpotRight").unbind("mouseout");c.data("scrollingHotSpotRight").unbind("mousedown");c.data("scrollingHotSpotLeft").unbind("mouseover");c.data("scrollingHotSpotLeft").unbind("mouseout");c.data("scrollingHotSpotLeft").unbind("mousedown");c.unbind("mousenter");c.unbind("mouseleave");c.data("scrollingHotSpotRight").remove();c.data("scrollingHotSpotLeft").remove();c.data("scrollableArea").remove();c.data("scrollWrapper").remove();c.html(c.data("originalElements"));a.Widget.prototype.destroy.apply(this,arguments)}})})(jQuery);