(function(a){jQuery.fn.smoothDivScroll=function(b){var c={scrollingHotSpotLeft:"div.scrollingHotSpotLeft",scrollingHotSpotRight:"div.scrollingHotSpotRight",scrollWrapper:"div.scrollWrapper",scrollableArea:"div.scrollableArea",hiddenOnStart:false,ajaxContentURL:"",countOnlyClass:"",scrollingSpeed:25,mouseDownSpeedBooster:3,autoScroll:"",autoScrollDirection:"right",autoScrollSpeed:1,pauseAutoScroll:"",visibleHotSpots:"",hotSpotsVisibleTime:5,startAtElementId:""};b=a.extend(c,b);return this.each(function(){var e=a(this);if(b.ajaxContentURL.length!==0){e.scrollableAreaWidth=0;e.find(b.scrollableArea).load((b.ajaxContentURL),function(){e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",(e.scrollableAreaWidth+"px"));if(b.hiddenOnStart){e.hide()}q();n()})}var k;var j;var t=e.offset().left;var u=0;j=1;var o=false;a(window).one("load",function(){if(b.ajaxContentURL.length===0){e.scrollableAreaWidth=0;e.tempStartingPosition=0;e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){if((b.startAtElementId.length!==0)&&((a(this).attr("id"))==b.startAtElementId)){e.tempStartingPosition=e.scrollableAreaWidth}e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",e.scrollableAreaWidth+"px");if(b.hiddenOnStart){e.hide()}}e.find(b.scrollWrapper).scrollLeft(e.tempStartingPosition);if(b.autoScroll!==""){e.autoScrollInterval=setInterval(h,6)}if(b.autoScroll=="always"){p();l()}switch(b.visibleHotSpots){case"always":i();break;case"onstart":i();e.hideHotSpotBackgroundsInterval=setInterval(d,(b.hotSpotsVisibleTime*1000));break;default:break}});e.find(b.scrollingHotSpotRight,b.scrollingHotSpotLeft).one("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}});a(window).bind("resize",function(){q()});function q(){if(!(b.hiddenOnStart)){e.scrollableAreaWidth=0;e.find(b.scrollableArea).children((b.countOnlyClass)).each(function(){e.scrollableAreaWidth=e.scrollableAreaWidth+a(this).outerWidth(true)});e.find(b.scrollableArea).css("width",e.scrollableAreaWidth+"px")}e.find(b.scrollWrapper).scrollLeft("0");var v=a("body").innerWidth();if(b.autoScroll!=="always"){if(e.scrollableAreaWidth<v){p();l()}else{m()}}}function p(){e.find(b.scrollingHotSpotLeft).hide()}function l(){e.find(b.scrollingHotSpotRight).hide()}function s(){e.find(b.scrollingHotSpotLeft).show();if(u<=0){u=e.find(b.scrollingHotSpotLeft).width()}}function r(){e.find(b.scrollingHotSpotRight).show();if(u<=0){u=e.find(b.scrollingHotSpotRight).width()}}function n(){jQuery.each(jQuery.browser,function(v,w){if(v=="msie"&&jQuery.browser.version.substr(0,1)=="6"){e.find(b.scrollingHotSpotLeft).css("height",(e.find(b.scrollableArea).innerHeight()));e.find(b.scrollingHotSpotRight).css("height",(e.find(b.scrollableArea).innerHeight()))}})}e.find(b.scrollingHotSpotRight).bind("mousemove",function(w){var v=w.pageX-(this.offsetLeft+t);k=Math.round((v/u)*b.scrollingSpeed);if(k===Infinity){k=0}});e.find(b.scrollingHotSpotRight).bind("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}e.rightScrollInterval=setInterval(g,6)});e.find(b.scrollingHotSpotRight).bind("mouseout",function(){clearInterval(e.rightScrollInterval);k=0});e.find(b.scrollingHotSpotRight).bind("mousedown",function(){j=b.mouseDownSpeedBooster});a("*").bind("mouseup",function(){j=1});var g=function(){if(k>0){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+(k*j))}m()};if(b.pauseAutoScroll=="mousedown"&&b.autoScroll=="always"){e.find(b.scrollWrapper).bind("mousedown",function(){clearInterval(e.autoScrollInterval)});e.find(b.scrollWrapper).bind("mouseup",function(){e.autoScrollInterval=setInterval(h,6)})}else{if(b.pauseAutoScroll=="mouseover"&&b.autoScroll=="always"){e.find(b.scrollWrapper).bind("mouseover",function(){clearInterval(e.autoScrollInterval)});e.find(b.scrollWrapper).bind("mouseout",function(){e.autoScrollInterval=setInterval(h,6)})}}e.previousScrollLeft=0;e.pingPongDirection="right";e.swapAt;e.getNextElementWidth=true;var h=function(){if(b.autoScroll=="onstart"){m()}switch(b.autoScrollDirection){case"right":e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed);break;case"left":e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-b.autoScrollSpeed);break;case"backandforth":e.previousScrollLeft=e.find(b.scrollWrapper).scrollLeft();if(e.pingPongDirection=="right"){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed)}else{e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-b.autoScrollSpeed)}if(e.previousScrollLeft===e.find(b.scrollWrapper).scrollLeft()){if(e.pingPongDirection=="right"){e.pingPongDirection="left"}else{e.pingPongDirection="right"}}break;case"endlessloop":if(e.getNextElementWidth){if(b.startAtElementId!==""){e.swapAt=a("#"+b.startAtElementId).outerWidth()}else{e.swapAt=e.find(b.scrollableArea).children(":first-child").outerWidth()}e.getNextElementWidth=false}e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()+b.autoScrollSpeed);if((e.swapAt<=e.find(b.scrollWrapper).scrollLeft())){e.find(b.scrollableArea).append(e.find(b.scrollableArea).children(":first-child").clone());e.find(b.scrollWrapper).scrollLeft((e.find(b.scrollWrapper).scrollLeft()-e.find(b.scrollableArea).children(":first-child").outerWidth()));e.find(b.scrollableArea).children(":first-child").remove();e.getNextElementWidth=true}break;default:break}};e.find(b.scrollingHotSpotLeft).bind("mousemove",function(w){var v=e.find(b.scrollingHotSpotLeft).innerWidth()-(w.pageX-t);k=Math.round((v/u)*b.scrollingSpeed);if(k===Infinity){k=0}});e.find(b.scrollingHotSpotLeft).bind("mouseover",function(){if(b.autoScroll=="onstart"){clearInterval(e.autoScrollInterval)}e.leftScrollInterval=setInterval(f,6)});e.find(b.scrollingHotSpotLeft).bind("mouseout",function(){clearInterval(e.leftScrollInterval);k=0});e.find(b.scrollingHotSpotLeft).bind("mousedown",function(){j=b.mouseDownSpeedBooster});var f=function(){if(k>0){e.find(b.scrollWrapper).scrollLeft(e.find(b.scrollWrapper).scrollLeft()-(k*j))}m()};function m(){if(e.find(b.scrollWrapper).scrollLeft()===0){p();r()}else{if((e.scrollableAreaWidth)<=(e.find(b.scrollWrapper).innerWidth()+e.find(b.scrollWrapper).scrollLeft())){l();s()}else{r();s()}}}function i(){e.find(b.scrollingHotSpotLeft).addClass("scrollingHotSpotLeftVisible");e.find(b.scrollingHotSpotRight).addClass("scrollingHotSpotRightVisible")}function d(){clearInterval(e.hideHotSpotBackgroundsInterval);e.find(b.scrollingHotSpotLeft).fadeTo("slow",0,function(){e.find(b.scrollingHotSpotLeft).removeClass("scrollingHotSpotLeftVisible")});e.find(b.scrollingHotSpotRight).fadeTo("slow",0,function(){e.find(b.scrollingHotSpotRight).removeClass("scrollingHotSpotRightVisible")})}})}})(jQuery);