(function($,window,document,undefined){"use strict";var _globalWalkthrough={},_elements=[],_activeWalkthrough,_activeId,_hasDefault=true,_counter=0,_isCookieLoad,_firstTimeLoad=true,_onLoad=true,_index=0,_isWalkthroughActive=false,$jpwOverlay=$('
'),$jpWalkthrough=$(''),$jpwTooltip=$('');var methods={isActive:function(){return!!_isWalkthroughActive},index:function(value){if(typeof value!=="undefined"){_index=value}return _index},init:function(options){options=$.extend(true,{},$.fn.pagewalkthrough.defaults,options);var that=this;if(!options.name){throw new Error("Must provide a unique name for a tour")}this.first().data("jpw",options);options._element=this;return this.each(function(i){options=options||{};options.elementID=options.name;_globalWalkthrough[options.name]=options;_elements.push(options.name);if(options.onLoad){_counter++}if(_counter===1&&_onLoad){_activeId=options.name;_activeWalkthrough=_globalWalkthrough[_activeId];_onLoad=false}if(i+1===that.length&&_counter===0){_activeId=options.name;_activeWalkthrough=_globalWalkthrough[_elements[0]];_hasDefault=false}})},renderOverlay:function(){if(_counter>1){debug("Warning: Only 1st walkthrough will be shown onLoad as default")}_isCookieLoad=getCookie("_walkthrough-"+_activeId);if(typeof _isCookieLoad==="undefined"){_isWalkthroughActive=true;if(!onEnter()){return}showStep();showButton("jpwClose","body");setTimeout(function(){if(isFirstStep()&&_firstTimeLoad){if(!onAfterShow()){return}}},100)}else{onCookieLoad(_globalWalkthrough)}},restart:function(e){if(isFirstStep()){return}_index=0;if(!onRestart(e)||!onEnter(e)){return}showStep()},close:function(){var options=_activeWalkthrough;onLeave(true);if(typeof options.onClose==="function"){options.onClose.call(this)}_index=0;_firstTimeLoad=true;_isWalkthroughActive=false;setCookie("_walkthrough-"+_activeId,0,365);_isCookieLoad=getCookie("_walkthrough-"+_activeId);$jpwOverlay.fadeOut("slow",function(){$(this).remove()});$jpWalkthrough.fadeOut("slow",function(){$(this).html("").remove()});$("#jpwClose").fadeOut("slow",function(){$(this).remove()})},show:function(name,e){e=name==null?name:e;name=name||this.first().data("jpw").name;_activeWalkthrough=_globalWalkthrough[this.first().data("jpw").name];if(name===_activeId&&_isWalkthroughActive||!onEnter(e)){return}_isWalkthroughActive=true;_firstTimeLoad=true;if(!onBeforeShow()){return}showStep();showButton("jpwClose","body");if(isFirstStep()&&_firstTimeLoad&&!onAfterShow()){return}},next:function(e){_firstTimeLoad=false;if(isLastStep()||!onLeave(e)){return}_index=parseInt(_index,10)+1;if(!onEnter(e)){methods.next()}showStep("next")},prev:function(e){if(isFirstStep()||!onLeave(e)){return}_index=parseInt(_index,10)-1;if(!onEnter(e)){methods.prev()}showStep("prev")},getOptions:function(activeWalkthrough){var _wtObj;if(activeWalkthrough){if(!_isWalkthroughActive){_wtObj=false}else{_wtObj=_activeWalkthrough}}else{_wtObj=[];for(var wt in _globalWalkthrough){_wtObj.push(_globalWalkthrough[wt])}}return _wtObj},refresh:function(){showStep("next")}};function showStep(skipDirection){var options=_activeWalkthrough,step=options.steps[_index],targetElement=options._element.find(step.wrapper),scrollTarget=getScrollParent(targetElement),maxScroll,scrollTo;if(step.popup.type!=="modal"&&!targetElement.length){if(step.popup.fallback==="skip"||typeof step.popup.fallback==="undefined"){methods[skipDirection]();return}step.popup.type=step.popup.fallback}maxScroll=scrollTarget[0].scrollHeight-scrollTarget.outerHeight();if(step.autoScroll!==false){if(step.popup.type==="modal"){scrollTo=0}else{scrollTo=Math.floor(targetElement.offset().top-$(window).height()/2+scrollTarget.scrollTop())}}else{scrollTo=scrollTarget.scrollTop()}if(scrollTarget.scrollTop()!==scrollTo&&(scrollTarget.scrollTop()===maxScroll&&scrollTo