(function(b){b.fn.joyride=function(h){var a={tipLocation:"bottom left",scrollSpeed:300,timer:0,startTimerOnClick:!1,nextButton:!0,nextButtonText:"Next",prevButton:!0,prevButtonText:"Previous",tipAnimation:"pop",tipAnimationFadeSpeed:300,cookieMonster:!1,cookieName:"JoyRide",cookieDomain:!1,tipContainer:"body",inline:!1,tipContent:"#joyRideTipContent",postRideCallback:null},h=b.extend(a,h);return this.each(function(){if(0!==b(h.tipContent).length){b(h.tipContent).hide();var c=b(h.tipContainer).children("*").first().position(),
i=b(h.tipContent+" li"),d=skipCount=0,f=-1,n,p=function(a,j,c,d){return'<div class="joyride-tip-guide '+a+'" id="joyRidePopup'+j+'"><span class="joyride-nub"></span>'+b(d).html()+c+'<a href="#close" class="joyride-close-tip">X</a>'+n+"</div>"},q=function(e,j,c,d,g){var f="";n=0==j&&a.startTimerOnClick&&0<a.timer||0==a.timer?"":'<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>';e||(e="");if(a.nextButton||!a.nextButton&&a.startTimerOnClick)f='<a href="#" class="joyride-next-tip small nice radius yellow button">'+
c+"</a>";0!=j&&a.prevButton&&(f='<a href="#" class="joyride-prev-tip button">'+d+"</a>&nbsp;"+f);a.inline?b(p(e,j,f,g)).insertAfter("#"+b(g).data("id")):b(h.tipContainer).append(p(e,j,f,g))};(!a.cookieMonster||!b.cookie(a.cookieName))&&i.each(function(e){var c=b(this).data("next"),d=b(this).data("previous"),f=b(this).attr("class");if(a.nextButton&&void 0==c)c=a.nextButtonText;if(a.prevButtonText&&void 0==d)d=a.prevButtonText;b(this).attr("class")?q(f,e,c,d,this):q(!1,e,c,d,this);b("#joyRidePopup"+
e).hide()});showPrevTip=function(){"pop"==a.tipAnimation?b("#joyRidePopup"+(d-1)).hide():"fade"==a.tipAnimation&&b("#joyRidePopup"+(d-1)).fadeOut(a.tipAnimationFadeSpeed);d-=2;f-=2;return showNextTip()};showNextTip=function(){for(var e=b(i[d]),j=e.data("tip-location")||a.tipLocation,h=e.data("id"),o=b("#"+h);null===o.offset()&&!(d++,skipCount++,f++,e=b(i[d]),j=e.data("tip-location")||a.tipLocation,h=e.data("id"),o=b("#"+h),b(i).length<d););var h=Math.ceil(b(window).height()/2),g=b("#joyRidePopup"+
d),l=o.offset(),k=o.outerHeight(),n=g.outerHeight(),m=void 0,m=0;0!==g.length&&(d<i.length?("pop"==a.tipAnimation?(b(".joyride-timer-indicator").width(0),0<a.timer?g.show().children(".joyride-timer-indicator-wrap").children(".joyride-timer-indicator").animate({width:b(".joyride-timer-indicator-wrap").width()},a.timer):g.show()):"fade"==a.tipAnimation&&(b(".joyride-timer-indicator").width(0),0<a.timer?g.fadeIn(a.tipAnimationFadeSpeed).children(".joyride-timer-indicator-wrap").children(".joyride-timer-indicator").animate({width:b(".joyride-timer-indicator-wrap").width()},
a.timer):g.fadeIn(a.tipAnimationFadeSpeed)),e.trigger("joyride/in"),m=Math.ceil(b(".joyride-nub").outerHeight()/2),-1!=j.indexOf("bottom")?(g.offset({top:l.top+k+m,left:l.left-c.left}),g.children(".joyride-nub").addClass("top").removeClass("bottom")):-1!=j.indexOf("top")&&(n>=l.top?(g.offset({top:l.top+k+m-c.top,left:l.left-c.left}),g.children(".joyride-nub").addClass("top").removeClass("bottom")):(g.offset({top:l.top-(n+c.top+m),left:l.left-c.left}),g.children(".joyride-nub").addClass("bottom").removeClass("top"))),
-1!=j.indexOf("right")?(g.offset({left:l.left-c.left-g.width()+o.width()}),g.children(".joyride-nub").addClass("right")):-1!=j.indexOf("left")&&g.children(".joyride-nub").removeClass("right"),m=Math.ceil(g.offset().top-h),b("html, body").animate({scrollTop:m},a.scrollSpeed),0<d&&(0<skipCount?(e=f-skipCount,skipCount=0):e=f,"pop"==a.tipAnimation?b("#joyRidePopup"+e).hide():"fade"==a.tipAnimation&&b("#joyRidePopup"+e).fadeOut(a.tipAnimationFadeSpeed))):i.length-1<d&&(0<skipCount?(e=f-skipCount,skipCount=
0):e=f,!0==a.cookieMonster&&b.cookie(a.cookieName,"ridden",{expires:365,domain:a.cookieDomain}),"pop"==a.tipAnimation?b("#joyRidePopup"+e).fadeTo(0,0):"fade"==a.tipAnimation&&b("#joyRidePopup"+e).fadeTo(a.tipAnimationFadeSpeed,0)),d++,0>f?f=0:f++)};(!a.inline||!a.cookieMonster||!b.cookie(a.cookieName))&&b(window).resize(function(){var e=b(i[f]).data("id"),c=b("#"+e).offset(),e=b("#"+e).outerHeight(),d=b("#joyRidePopup"+f).outerHeight(),h=Math.ceil(b(".joyride-nub").outerHeight()/2);-1!=a.tipLocation.indexOf("bottom")?
b("#joyRidePopup"+f).offset({top:c.top+e+h,left:c.left}):-1!=a.tipLocation.indexOf("top")&&(c.top<=d?b("#joyRidePopup"+f).offset({top:c.top+h+e,left:c.left}):b("#joyRidePopup"+f).offset({top:c.top-(d+h),left:c.left}))});var k=null;!a.startTimerOnClick&&0<a.timer?(showNextTip(),k=setInterval(function(){showNextTip()},a.timer)):showNextTip();var r=function(c,d,f,i){c.preventDefault();clearInterval(d);f&&b.cookie(a.cookieName,"ridden",{expires:365,domain:a.cookieDomain});b(i).parent().hide();null!=a.postRideCallback&&
a.postRideCallback();b(h.tipContent).trigger("joyride/end")};b(".joyride-close-tip, .joyride-prev-tip, .joyride-next-tip").unbind("click");b(".joyride-close-tip").click(function(b){r(b,k,a.cookieMonster,this)});b(".joyride-prev-tip").click(function(){showPrevTip()});b(".joyride-next-tip").click(function(b){b.preventDefault();d>=i.length&&r(b,k,a.cookieMonster,this);0<a.timer&&a.startTimerOnClick?(showNextTip(),clearInterval(k),k=setInterval(function(){showNextTip()},a.timer)):0<a.timer&&!a.startTimerOnClick?
(clearInterval(k),k=setInterval(function(){showNextTip()},a.timer)):showNextTip()})}})};jQuery.cookie=function(b,a,c){if(1<arguments.length&&"[object Object]"!==""+a){c=jQuery.extend({},c);if(null===a||void 0===a)c.expires=-1;if("number"===typeof c.expires){var i=c.expires,d=c.expires=new Date;d.setDate(d.getDate()+i)}a=""+a;return document.cookie=[encodeURIComponent(b),"=",c.raw?a:encodeURIComponent(a),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+
c.domain:"",c.secure?"; secure":""].join("")}c=a||{};d=c.raw?function(a){return a}:decodeURIComponent;return(i=RegExp("(?:^|; )"+encodeURIComponent(b)+"=([^;]*)").exec(document.cookie))?d(i[1]):null}})(jQuery);