/*!
 * skrollr core
 *
 * Alexander Prinzhorn - https://github.com/Prinzhorn/skrollr
 *
 * Free to use under terms of MIT license
 */
(function(window,document,undefined){"use strict";/*
	 * Global api.
	 */
var skrollr={get:function(){return _instance},//Main entry point.
init:function(options){return _instance||new Skrollr(options)},VERSION:"0.6.26"};var powerSwitch=true;//Minify optimization.
var hasProp=Object.prototype.hasOwnProperty;var Math=window.Math;var getStyle=window.getComputedStyle;//They will be filled when skrollr gets initialized.
var documentElement;var body;var EVENT_TOUCHSTART="touchstart";var EVENT_TOUCHMOVE="touchmove";var EVENT_TOUCHCANCEL="touchcancel";var EVENT_TOUCHEND="touchend";var SKROLLABLE_CLASS="skrollable";var SKROLLABLE_BEFORE_CLASS=SKROLLABLE_CLASS+"-before";var SKROLLABLE_BETWEEN_CLASS=SKROLLABLE_CLASS+"-between";var SKROLLABLE_AFTER_CLASS=SKROLLABLE_CLASS+"-after";var SKROLLR_CLASS="skrollr";var NO_SKROLLR_CLASS="no-"+SKROLLR_CLASS;var SKROLLR_DESKTOP_CLASS=SKROLLR_CLASS+"-desktop";var SKROLLR_MOBILE_CLASS=SKROLLR_CLASS+"-mobile";var DEFAULT_EASING="linear";var DEFAULT_DURATION=1e3;//ms
var DEFAULT_MOBILE_DECELERATION=.004;//pixel/ms²
var DEFAULT_SMOOTH_SCROLLING_DURATION=200;//ms
var ANCHOR_START="start";var ANCHOR_END="end";var ANCHOR_CENTER="center";var ANCHOR_BOTTOM="bottom";//The property which will be added to the DOM element to hold the ID of the skrollable.
var SKROLLABLE_ID_DOM_PROPERTY="___skrollable_id";var rxTouchIgnoreTags=/^(?:input|textarea|button|select)$/i;var rxTrim=/^\s+|\s+$/g;//Find all data-attributes. data-[_constant]-[offset]-[anchor]-[anchor].
var rxKeyframeAttribute=/^data(?:-(_\w+))?(?:-?(-?\d*\.?\d+p?))?(?:-?(start|end|top|center|bottom))?(?:-?(top|center|bottom))?$/;var rxPropValue=/\s*(@?[\w\-\[\]]+)\s*:\s*(.+?)\s*(?:;|$)/gi;//Easing function names follow the property in square brackets.
var rxPropEasing=/^(@?[a-z\-]+)\[(\w+)\]$/;var rxCamelCase=/-([a-z0-9_])/g;var rxCamelCaseFn=function(str,letter){return letter.toUpperCase()};//Numeric values with optional sign.
var rxNumericValue=/[\-+]?[\d]*\.?[\d]+/g;//Used to replace occurences of {?} with a number.
var rxInterpolateString=/\{\?\}/g;//Finds rgb(a) colors, which don't use the percentage notation.
var rxRGBAIntegerColor=/rgba?\(\s*-?\d+\s*,\s*-?\d+\s*,\s*-?\d+/g;//Finds all gradients.
var rxGradient=/[a-z\-]+-gradient/g;//Vendor prefix. Will be set once skrollr gets initialized.
var theCSSPrefix="";var theDashedCSSPrefix="";//Will be called once (when skrollr gets initialized).
var detectCSSPrefix=function(){//Only relevant prefixes. May be extended.
//Could be dangerous if there will ever be a CSS property which actually starts with "ms". Don't hope so.
var rxPrefixes=/^(?:O|Moz|webkit|ms)|(?:-(?:o|moz|webkit|ms)-)/;//Detect prefix for current browser by finding the first property using a prefix.
if(!getStyle){return}var style=getStyle(body,null);for(var k in style){//We check the key and if the key is a number, we check the value as well, because safari's getComputedStyle returns some weird array-like thingy.
theCSSPrefix=k.match(rxPrefixes)||+k==k&&style[k].match(rxPrefixes);if(theCSSPrefix){break}}//Did we even detect a prefix?
if(!theCSSPrefix){theCSSPrefix=theDashedCSSPrefix="";return}theCSSPrefix=theCSSPrefix[0];//We could have detected either a dashed prefix or this camelCaseish-inconsistent stuff.
if(theCSSPrefix.slice(0,1)==="-"){theDashedCSSPrefix=theCSSPrefix;//There's no logic behind these. Need a look up.
theCSSPrefix={"-webkit-":"webkit","-moz-":"Moz","-ms-":"ms","-o-":"O"}[theCSSPrefix]}else{theDashedCSSPrefix="-"+theCSSPrefix.toLowerCase()+"-"}};var polyfillRAF=function(){var requestAnimFrame=window.requestAnimationFrame||window[theCSSPrefix.toLowerCase()+"RequestAnimationFrame"];var lastTime=_now();if(_isMobile||!requestAnimFrame){requestAnimFrame=function(callback){//How long did it take to render?
var deltaTime=_now()-lastTime;var delay=Math.max(0,1e3/60-deltaTime);return window.setTimeout(function(){lastTime=_now();callback()},delay)}}return requestAnimFrame};var polyfillCAF=function(){var cancelAnimFrame=window.cancelAnimationFrame||window[theCSSPrefix.toLowerCase()+"CancelAnimationFrame"];if(_isMobile||!cancelAnimFrame){cancelAnimFrame=function(timeout){return window.clearTimeout(timeout)}}return cancelAnimFrame};//Built-in easing functions.
var easings={begin:function(){return 0},end:function(){return 1},linear:function(p){return p},quadratic:function(p){return p*p},cubic:function(p){return p*p*p},swing:function(p){return-Math.cos(p*Math.PI)/2+.5},sqrt:function(p){return Math.sqrt(p)},outCubic:function(p){return Math.pow(p-1,3)+1},//see https://www.desmos.com/calculator/tbr20s8vd2 for how I did this
bounce:function(p){var a;if(p<=.5083){a=3}else if(p<=.8489){a=9}else if(p<=.96208){a=27}else if(p<=.99981){a=91}else{return 1}return 1-Math.abs(3*Math.cos(p*a*1.028)/a)}};/**
	 * Constructor.
	 */
function Skrollr(options){documentElement=document.documentElement;body=document.body;detectCSSPrefix();_instance=this;options=options||{};_constants=options.constants||{};//We allow defining custom easings or overwrite existing.
if(options.easing){for(var e in options.easing){easings[e]=options.easing[e]}}_edgeStrategy=options.edgeStrategy||"set";_listeners={//Function to be called right before rendering.
beforerender:options.beforerender,//Function to be called right after finishing rendering.
render:options.render,//Function to be called whenever an element with the `data-emit-events` attribute passes a keyframe.
keyframe:options.keyframe};//forceHeight is true by default
_forceHeight=options.forceHeight!==false;if(_forceHeight){_scale=options.scale||1}_mobileDeceleration=options.mobileDeceleration||DEFAULT_MOBILE_DECELERATION;_smoothScrollingEnabled=options.smoothScrolling!==false;_smoothScrollingDuration=options.smoothScrollingDuration||DEFAULT_SMOOTH_SCROLLING_DURATION;//Dummy object. Will be overwritten in the _render method when smooth scrolling is calculated.
_smoothScrolling={targetTop:_instance.getScrollTop()};//A custom check function may be passed.
_isMobile=(options.mobileCheck||function(){return/Android|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent||navigator.vendor||window.opera)})();if(_isMobile){_skrollrBody=document.getElementById("skrollr-body");//Detect 3d transform if there's a skrollr-body (only needed for #skrollr-body).
if(_skrollrBody){_detect3DTransforms()}_initMobile();_updateClass(documentElement,[SKROLLR_CLASS,SKROLLR_MOBILE_CLASS],[NO_SKROLLR_CLASS])}else{_updateClass(documentElement,[SKROLLR_CLASS,SKROLLR_DESKTOP_CLASS],[NO_SKROLLR_CLASS])}//Triggers parsing of elements and a first reflow.
_instance.refresh();_addEvent(window,"resize orientationchange",function(){var width=documentElement.clientWidth;var height=documentElement.clientHeight;//Only reflow if the size actually changed (#271).
if(height!==_lastViewportHeight||width!==_lastViewportWidth){_lastViewportHeight=height;_lastViewportWidth=width;_requestReflow=true}});var requestAnimFrame=polyfillRAF();//Let's go.
(function animloop(){_render();_animFrame=requestAnimFrame(animloop)})();return _instance}/**
	 * (Re)parses some or all elements.
	 */
Skrollr.prototype.refresh=function(elements){var elementIndex;var elementsLength;var ignoreID=false;//Completely reparse anything without argument.
if(elements===undefined){//Ignore that some elements may already have a skrollable ID.
ignoreID=true;_skrollables=[];_skrollableIdCounter=0;elements=document.getElementsByTagName("*")}else if(elements.length===undefined){//We also accept a single element as parameter.
elements=[elements]}elementIndex=0;elementsLength=elements.length;for(;elementIndex<elementsLength;elementIndex++){var el=elements[elementIndex];var anchorTarget=el;var keyFrames=[];//If this particular element should be smooth scrolled.
var smoothScrollThis=_smoothScrollingEnabled;//The edge strategy for this particular element.
var edgeStrategy=_edgeStrategy;//If this particular element should emit keyframe events.
var emitEvents=false;//If we're reseting the counter, remove any old element ids that may be hanging around.
if(ignoreID&&SKROLLABLE_ID_DOM_PROPERTY in el){delete el[SKROLLABLE_ID_DOM_PROPERTY]}if(!el.attributes){continue}//Iterate over all attributes and search for key frame attributes.
var attributeIndex=0;var attributesLength=el.attributes.length;for(;attributeIndex<attributesLength;attributeIndex++){var attr=el.attributes[attributeIndex];if(attr.name==="data-anchor-target"){anchorTarget=document.querySelector(attr.value);if(anchorTarget===null){throw'Unable to find anchor target "'+attr.value+'"'}continue}//Global smooth scrolling can be overridden by the element attribute.
if(attr.name==="data-smooth-scrolling"){smoothScrollThis=attr.value!=="off";continue}//Global edge strategy can be overridden by the element attribute.
if(attr.name==="data-edge-strategy"){edgeStrategy=attr.value;continue}//Is this element tagged with the `data-emit-events` attribute?
if(attr.name==="data-emit-events"){emitEvents=true;continue}var match=attr.name.match(rxKeyframeAttribute);if(match===null){continue}var kf={props:attr.value,//Point back to the element as well.
element:el,//The name of the event which this keyframe will fire, if emitEvents is
eventType:attr.name.replace(rxCamelCase,rxCamelCaseFn)};keyFrames.push(kf);var constant=match[1];if(constant){//Strip the underscore prefix.
kf.constant=constant.substr(1)}//Get the key frame offset.
var offset=match[2];//Is it a percentage offset?
if(/p$/.test(offset)){kf.isPercentage=true;kf.offset=(offset.slice(0,-1)|0)/100}else{kf.offset=offset|0}var anchor1=match[3];//If second anchor is not set, the first will be taken for both.
var anchor2=match[4]||anchor1;//"absolute" (or "classic") mode, where numbers mean absolute scroll offset.
if(!anchor1||anchor1===ANCHOR_START||anchor1===ANCHOR_END){kf.mode="absolute";//data-end needs to be calculated after all key frames are known.
if(anchor1===ANCHOR_END){kf.isEnd=true}else if(!kf.isPercentage){//For data-start we can already set the key frame w/o calculations.
//#59: "scale" options should only affect absolute mode.
kf.offset=kf.offset*_scale}}else{kf.mode="relative";kf.anchors=[anchor1,anchor2]}}//Does this element have key frames?
if(!keyFrames.length){continue}//Will hold the original style and class attributes before we controlled the element (see #80).
var styleAttr,classAttr;var id;if(!ignoreID&&SKROLLABLE_ID_DOM_PROPERTY in el){//We already have this element under control. Grab the corresponding skrollable id.
id=el[SKROLLABLE_ID_DOM_PROPERTY];styleAttr=_skrollables[id].styleAttr;classAttr=_skrollables[id].classAttr}else{//It's an unknown element. Asign it a new skrollable id.
id=el[SKROLLABLE_ID_DOM_PROPERTY]=_skrollableIdCounter++;styleAttr=el.style.cssText;classAttr=_getClass(el)}_skrollables[id]={element:el,styleAttr:styleAttr,classAttr:classAttr,anchorTarget:anchorTarget,keyFrames:keyFrames,smoothScrolling:smoothScrollThis,edgeStrategy:edgeStrategy,emitEvents:emitEvents,lastFrameIndex:-1};_updateClass(el,[SKROLLABLE_CLASS],[])}//Reflow for the first time.
_reflow();//Now that we got all key frame numbers right, actually parse the properties.
elementIndex=0;elementsLength=elements.length;for(;elementIndex<elementsLength;elementIndex++){var sk=_skrollables[elements[elementIndex][SKROLLABLE_ID_DOM_PROPERTY]];if(sk===undefined){continue}//Parse the property string to objects
_parseProps(sk);//Fill key frames with missing properties from left and right
_fillProps(sk)}return _instance};/**
	 * Transform "relative" mode to "absolute" mode.
	 * That is, calculate anchor position and offset of element.
	 */
Skrollr.prototype.relativeToAbsolute=function(element,viewportAnchor,elementAnchor){var viewportHeight=documentElement.clientHeight;var box=element.getBoundingClientRect();var absolute=box.top;//#100: IE doesn't supply "height" with getBoundingClientRect.
var boxHeight=box.bottom-box.top;if(viewportAnchor===ANCHOR_BOTTOM){absolute-=viewportHeight}else if(viewportAnchor===ANCHOR_CENTER){absolute-=viewportHeight/2}if(elementAnchor===ANCHOR_BOTTOM){absolute+=boxHeight}else if(elementAnchor===ANCHOR_CENTER){absolute+=boxHeight/2}//Compensate scrolling since getBoundingClientRect is relative to viewport.
absolute+=_instance.getScrollTop();return absolute+.5|0};/**
	 * Animates scroll top to new position.
	 */
Skrollr.prototype.animateTo=function(top,options){options=options||{};var now=_now();var scrollTop=_instance.getScrollTop();//Setting this to a new value will automatically cause the current animation to stop, if any.
_scrollAnimation={startTop:scrollTop,topDiff:top-scrollTop,targetTop:top,duration:options.duration||DEFAULT_DURATION,startTime:now,endTime:now+(options.duration||DEFAULT_DURATION),easing:easings[options.easing||DEFAULT_EASING],done:options.done};//Don't queue the animation if there's nothing to animate.
if(!_scrollAnimation.topDiff){if(_scrollAnimation.done){_scrollAnimation.done.call(_instance,false)}_scrollAnimation=undefined}return _instance};/**
	 * Stops animateTo animation.
	 */
Skrollr.prototype.stopAnimateTo=function(){if(_scrollAnimation&&_scrollAnimation.done){_scrollAnimation.done.call(_instance,true)}_scrollAnimation=undefined};/**
	 * Returns if an animation caused by animateTo is currently running.
	 */
Skrollr.prototype.isAnimatingTo=function(){return!!_scrollAnimation};Skrollr.prototype.isMobile=function(){return _isMobile};Skrollr.prototype.setScrollTop=function(top,force){_forceRender=force===true;if(_isMobile){_mobileOffset=Math.min(Math.max(top,0),_maxKeyFrame)}else{window.scrollTo(0,top)}return _instance};Skrollr.prototype.getScrollTop=function(){if(_isMobile){return _mobileOffset}else{return window.pageYOffset||documentElement.scrollTop||body.scrollTop||0}};Skrollr.prototype.getMaxScrollTop=function(){return _maxKeyFrame};Skrollr.prototype.on=function(name,fn){_listeners[name]=fn;return _instance};Skrollr.prototype.off=function(name){delete _listeners[name];return _instance};Skrollr.prototype.powerOn=function(){powerSwitch=true};Skrollr.prototype.powerOff=function(name){powerSwitch=false};Skrollr.prototype.destroy=function(){var cancelAnimFrame=polyfillCAF();cancelAnimFrame(_animFrame);_removeAllEvents();_updateClass(documentElement,[NO_SKROLLR_CLASS],[SKROLLR_CLASS,SKROLLR_DESKTOP_CLASS,SKROLLR_MOBILE_CLASS]);var skrollableIndex=0;var skrollablesLength=_skrollables.length;for(;skrollableIndex<skrollablesLength;skrollableIndex++){_reset(_skrollables[skrollableIndex].element)}documentElement.style.overflow=body.style.overflow="";documentElement.style.height=body.style.height="";if(_skrollrBody){skrollr.setStyle(_skrollrBody,"transform","none")}_instance=undefined;_skrollrBody=undefined;_listeners=undefined;_forceHeight=undefined;_maxKeyFrame=0;_scale=1;_constants=undefined;_mobileDeceleration=undefined;_direction="down";_lastTop=-1;_lastViewportWidth=0;_lastViewportHeight=0;_requestReflow=false;_scrollAnimation=undefined;_smoothScrollingEnabled=undefined;_smoothScrollingDuration=undefined;_smoothScrolling=undefined;_forceRender=undefined;_skrollableIdCounter=0;_edgeStrategy=undefined;_isMobile=false;_mobileOffset=0;_translateZ=undefined};/*
		Private methods.
	*/
var _initMobile=function(){var initialElement;var initialTouchY;var initialTouchX;var currentElement;var currentTouchY;var currentTouchX;var lastTouchY;var deltaY;var initialTouchTime;var currentTouchTime;var lastTouchTime;var deltaTime;_addEvent(documentElement,[EVENT_TOUCHSTART,EVENT_TOUCHMOVE,EVENT_TOUCHCANCEL,EVENT_TOUCHEND].join(" "),function(e){if(powerSwitch==false){return}var touch=e.changedTouches[0];currentElement=e.target;//We don't want text nodes.
while(currentElement.nodeType===3){currentElement=currentElement.parentNode}currentTouchY=touch.clientY;currentTouchX=touch.clientX;currentTouchTime=e.timeStamp;if(!rxTouchIgnoreTags.test(currentElement.tagName)){e.preventDefault()}switch(e.type){case EVENT_TOUCHSTART://The last element we tapped on.
if(initialElement){initialElement.blur()}_instance.stopAnimateTo();initialElement=currentElement;initialTouchY=lastTouchY=currentTouchY;initialTouchX=currentTouchX;initialTouchTime=currentTouchTime;break;case EVENT_TOUCHMOVE://Prevent default event on touchIgnore elements in case they don't have focus yet.
if(rxTouchIgnoreTags.test(currentElement.tagName)&&document.activeElement!==currentElement){e.preventDefault()}deltaY=currentTouchY-lastTouchY;deltaTime=currentTouchTime-lastTouchTime;_instance.setScrollTop(_mobileOffset-deltaY,true);lastTouchY=currentTouchY;lastTouchTime=currentTouchTime;break;default:case EVENT_TOUCHCANCEL:case EVENT_TOUCHEND:var distanceY=initialTouchY-currentTouchY;var distanceX=initialTouchX-currentTouchX;var distance2=distanceX*distanceX+distanceY*distanceY;//Check if it was more like a tap (moved less than 7px).
if(distance2<49){if(!rxTouchIgnoreTags.test(initialElement.tagName)){initialElement.focus();//It was a tap, click the element.
var clickEvent=document.createEvent("MouseEvents");clickEvent.initMouseEvent("click",true,true,e.view,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null);initialElement.dispatchEvent(clickEvent)}return}initialElement=undefined;var speed=deltaY/deltaTime;//Cap speed at 3 pixel/ms.
speed=Math.max(Math.min(speed,3),-3);var duration=Math.abs(speed/_mobileDeceleration);var targetOffset=speed*duration+.5*_mobileDeceleration*duration*duration;var targetTop=_instance.getScrollTop()-targetOffset;//Relative duration change for when scrolling above bounds.
var targetRatio=0;//Change duration proportionally when scrolling would leave bounds.
if(targetTop>_maxKeyFrame){targetRatio=(_maxKeyFrame-targetTop)/targetOffset;targetTop=_maxKeyFrame}else if(targetTop<0){targetRatio=-targetTop/targetOffset;targetTop=0}duration=duration*(1-targetRatio);_instance.animateTo(targetTop+.5|0,{easing:"outCubic",duration:duration});break}});//Just in case there has already been some native scrolling, reset it.
window.scrollTo(0,0);documentElement.style.overflow=body.style.overflow="hidden"};/**
	 * Updates key frames which depend on others / need to be updated on resize.
	 * That is "end" in "absolute" mode and all key frames in "relative" mode.
	 * Also handles constants, because they may change on resize.
	 */
var _updateDependentKeyFrames=function(){var viewportHeight=documentElement.clientHeight;var processedConstants=_processConstants();var skrollable;var element;var anchorTarget;var keyFrames;var keyFrameIndex;var keyFramesLength;var kf;var skrollableIndex;var skrollablesLength;var offset;var constantValue;//First process all relative-mode elements and find the max key frame.
skrollableIndex=0;skrollablesLength=_skrollables.length;for(;skrollableIndex<skrollablesLength;skrollableIndex++){skrollable=_skrollables[skrollableIndex];element=skrollable.element;anchorTarget=skrollable.anchorTarget;keyFrames=skrollable.keyFrames;keyFrameIndex=0;keyFramesLength=keyFrames.length;for(;keyFrameIndex<keyFramesLength;keyFrameIndex++){kf=keyFrames[keyFrameIndex];offset=kf.offset;constantValue=processedConstants[kf.constant]||0;kf.frame=offset;if(kf.isPercentage){//Convert the offset to percentage of the viewport height.
offset=offset*viewportHeight;//Absolute + percentage mode.
kf.frame=offset}if(kf.mode==="relative"){_reset(element);kf.frame=_instance.relativeToAbsolute(anchorTarget,kf.anchors[0],kf.anchors[1])-offset;_reset(element,true)}kf.frame+=constantValue;//Only search for max key frame when forceHeight is enabled.
if(_forceHeight){//Find the max key frame, but don't use one of the data-end ones for comparison.
if(!kf.isEnd&&kf.frame>_maxKeyFrame){_maxKeyFrame=kf.frame}}}}//#133: The document can be larger than the maxKeyFrame we found.
_maxKeyFrame=Math.max(_maxKeyFrame,_getDocumentHeight());//Now process all data-end keyframes.
skrollableIndex=0;skrollablesLength=_skrollables.length;for(;skrollableIndex<skrollablesLength;skrollableIndex++){skrollable=_skrollables[skrollableIndex];keyFrames=skrollable.keyFrames;keyFrameIndex=0;keyFramesLength=keyFrames.length;for(;keyFrameIndex<keyFramesLength;keyFrameIndex++){kf=keyFrames[keyFrameIndex];constantValue=processedConstants[kf.constant]||0;if(kf.isEnd){kf.frame=_maxKeyFrame-kf.offset+constantValue}}skrollable.keyFrames.sort(_keyFrameComparator)}};/**
	 * Calculates and sets the style properties for the element at the given frame.
	 * @param fakeFrame The frame to render at when smooth scrolling is enabled.
	 * @param actualFrame The actual frame we are at.
	 */
var _calcSteps=function(fakeFrame,actualFrame){//Iterate over all skrollables.
var skrollableIndex=0;var skrollablesLength=_skrollables.length;for(;skrollableIndex<skrollablesLength;skrollableIndex++){var skrollable=_skrollables[skrollableIndex];var element=skrollable.element;var frame=skrollable.smoothScrolling?fakeFrame:actualFrame;var frames=skrollable.keyFrames;var framesLength=frames.length;var firstFrame=frames[0];var lastFrame=frames[frames.length-1];var beforeFirst=frame<firstFrame.frame;var afterLast=frame>lastFrame.frame;var firstOrLastFrame=beforeFirst?firstFrame:lastFrame;var emitEvents=skrollable.emitEvents;var lastFrameIndex=skrollable.lastFrameIndex;var key;var value;//If we are before/after the first/last frame, set the styles according to the given edge strategy.
if(beforeFirst||afterLast){//Check if we already handled this edge case last time.
//Note: using setScrollTop it's possible that we jumped from one edge to the other.
if(beforeFirst&&skrollable.edge===-1||afterLast&&skrollable.edge===1){continue}//Add the skrollr-before or -after class.
if(beforeFirst){_updateClass(element,[SKROLLABLE_BEFORE_CLASS],[SKROLLABLE_AFTER_CLASS,SKROLLABLE_BETWEEN_CLASS]);//This handles the special case where we exit the first keyframe.
if(emitEvents&&lastFrameIndex>-1){_emitEvent(element,firstFrame.eventType,_direction);skrollable.lastFrameIndex=-1}}else{_updateClass(element,[SKROLLABLE_AFTER_CLASS],[SKROLLABLE_BEFORE_CLASS,SKROLLABLE_BETWEEN_CLASS]);//This handles the special case where we exit the last keyframe.
if(emitEvents&&lastFrameIndex<framesLength){_emitEvent(element,lastFrame.eventType,_direction);skrollable.lastFrameIndex=framesLength}}//Remember that we handled the edge case (before/after the first/last keyframe).
skrollable.edge=beforeFirst?-1:1;switch(skrollable.edgeStrategy){case"reset":_reset(element);continue;case"ease"://Handle this case like it would be exactly at first/last keyframe and just pass it on.
frame=firstOrLastFrame.frame;break;default:case"set":var props=firstOrLastFrame.props;for(key in props){if(hasProp.call(props,key)){value=_interpolateString(props[key].value);//Set style or attribute.
if(key.indexOf("@")===0){element.setAttribute(key.substr(1),value)}else{skrollr.setStyle(element,key,value)}}}continue}}else{//Did we handle an edge last time?
if(skrollable.edge!==0){_updateClass(element,[SKROLLABLE_CLASS,SKROLLABLE_BETWEEN_CLASS],[SKROLLABLE_BEFORE_CLASS,SKROLLABLE_AFTER_CLASS]);skrollable.edge=0}}//Find out between which two key frames we are right now.
var keyFrameIndex=0;for(;keyFrameIndex<framesLength-1;keyFrameIndex++){if(frame>=frames[keyFrameIndex].frame&&frame<=frames[keyFrameIndex+1].frame){var left=frames[keyFrameIndex];var right=frames[keyFrameIndex+1];for(key in left.props){if(hasProp.call(left.props,key)){var progress=(frame-left.frame)/(right.frame-left.frame);//Transform the current progress using the given easing function.
progress=left.props[key].easing(progress);//Interpolate between the two values
value=_calcInterpolation(left.props[key].value,right.props[key].value,progress);value=_interpolateString(value);//Set style or attribute.
if(key.indexOf("@")===0){element.setAttribute(key.substr(1),value)}else{skrollr.setStyle(element,key,value)}}}//Are events enabled on this element?
//This code handles the usual cases of scrolling through different keyframes.
//The special cases of before first and after last keyframe are handled above.
if(emitEvents){//Did we pass a new keyframe?
if(lastFrameIndex!==keyFrameIndex){if(_direction==="down"){_emitEvent(element,left.eventType,_direction)}else{_emitEvent(element,right.eventType,_direction)}skrollable.lastFrameIndex=keyFrameIndex}}break}}}};/**
	 * Renders all elements.
	 */
var _render=function(){if(_requestReflow){_requestReflow=false;_reflow()}//We may render something else than the actual scrollbar position.
var renderTop=_instance.getScrollTop();//If there's an animation, which ends in current render call, call the callback after rendering.
var afterAnimationCallback;var now=_now();var progress;//Before actually rendering handle the scroll animation, if any.
if(_scrollAnimation){//It's over
if(now>=_scrollAnimation.endTime){renderTop=_scrollAnimation.targetTop;afterAnimationCallback=_scrollAnimation.done;_scrollAnimation=undefined}else{//Map the current progress to the new progress using given easing function.
progress=_scrollAnimation.easing((now-_scrollAnimation.startTime)/_scrollAnimation.duration);renderTop=_scrollAnimation.startTop+progress*_scrollAnimation.topDiff|0}_instance.setScrollTop(renderTop,true)}else if(!_forceRender){var smoothScrollingDiff=_smoothScrolling.targetTop-renderTop;//The user scrolled, start new smooth scrolling.
if(smoothScrollingDiff){_smoothScrolling={startTop:_lastTop,topDiff:renderTop-_lastTop,targetTop:renderTop,startTime:_lastRenderCall,endTime:_lastRenderCall+_smoothScrollingDuration}}//Interpolate the internal scroll position (not the actual scrollbar).
if(now<=_smoothScrolling.endTime){//Map the current progress to the new progress using easing function.
progress=easings.sqrt((now-_smoothScrolling.startTime)/_smoothScrollingDuration);renderTop=_smoothScrolling.startTop+progress*_smoothScrolling.topDiff|0}}//That's were we actually "scroll" on mobile.
if(_isMobile&&_skrollrBody){//Set the transform ("scroll it").
skrollr.setStyle(_skrollrBody,"transform","translate(0, "+-_mobileOffset+"px) "+_translateZ)}//Did the scroll position even change?
if(_forceRender||_lastTop!==renderTop){//Remember in which direction are we scrolling?
_direction=renderTop>_lastTop?"down":renderTop<_lastTop?"up":_direction;_forceRender=false;var listenerParams={curTop:renderTop,lastTop:_lastTop,maxTop:_maxKeyFrame,direction:_direction};//Tell the listener we are about to render.
var continueRendering=_listeners.beforerender&&_listeners.beforerender.call(_instance,listenerParams);//The beforerender listener function is able the cancel rendering.
if(continueRendering!==false){//Now actually interpolate all the styles.
_calcSteps(renderTop,_instance.getScrollTop());//Remember when we last rendered.
_lastTop=renderTop;if(_listeners.render){_listeners.render.call(_instance,listenerParams)}}if(afterAnimationCallback){afterAnimationCallback.call(_instance,false)}}_lastRenderCall=now};/**
	 * Parses the properties for each key frame of the given skrollable.
	 */
var _parseProps=function(skrollable){//Iterate over all key frames
var keyFrameIndex=0;var keyFramesLength=skrollable.keyFrames.length;for(;keyFrameIndex<keyFramesLength;keyFrameIndex++){var frame=skrollable.keyFrames[keyFrameIndex];var easing;var value;var prop;var props={};var match;while((match=rxPropValue.exec(frame.props))!==null){prop=match[1];value=match[2];easing=prop.match(rxPropEasing);//Is there an easing specified for this prop?
if(easing!==null){prop=easing[1];easing=easing[2]}else{easing=DEFAULT_EASING}//Exclamation point at first position forces the value to be taken literal.
value=value.indexOf("!")?_parseProp(value):[value.slice(1)];//Save the prop for this key frame with his value and easing function
props[prop]={value:value,easing:easings[easing]}}frame.props=props}};/**
	 * Parses a value extracting numeric values and generating a format string
	 * for later interpolation of the new values in old string.
	 *
	 * @param val The CSS value to be parsed.
	 * @return Something like ["rgba(?%,?%, ?%,?)", 100, 50, 0, .7]
	 * where the first element is the format string later used
	 * and all following elements are the numeric value.
	 */
var _parseProp=function(val){var numbers=[];//One special case, where floats don't work.
//We replace all occurences of rgba colors
//which don't use percentage notation with the percentage notation.
rxRGBAIntegerColor.lastIndex=0;val=val.replace(rxRGBAIntegerColor,function(rgba){return rgba.replace(rxNumericValue,function(n){return n/255*100+"%"})});//Handle prefixing of "gradient" values.
//For now only the prefixed value will be set. Unprefixed isn't supported anyway.
if(theDashedCSSPrefix){rxGradient.lastIndex=0;val=val.replace(rxGradient,function(s){return theDashedCSSPrefix+s})}//Now parse ANY number inside this string and create a format string.
val=val.replace(rxNumericValue,function(n){numbers.push(+n);return"{?}"});//Add the formatstring as first value.
numbers.unshift(val);return numbers};/**
	 * Fills the key frames with missing left and right hand properties.
	 * If key frame 1 has property X and key frame 2 is missing X,
	 * but key frame 3 has X again, then we need to assign X to key frame 2 too.
	 *
	 * @param sk A skrollable.
	 */
var _fillProps=function(sk){//Will collect the properties key frame by key frame
var propList={};var keyFrameIndex;var keyFramesLength;//Iterate over all key frames from left to right
keyFrameIndex=0;keyFramesLength=sk.keyFrames.length;for(;keyFrameIndex<keyFramesLength;keyFrameIndex++){_fillPropForFrame(sk.keyFrames[keyFrameIndex],propList)}//Now do the same from right to fill the last gaps
propList={};//Iterate over all key frames from right to left
keyFrameIndex=sk.keyFrames.length-1;for(;keyFrameIndex>=0;keyFrameIndex--){_fillPropForFrame(sk.keyFrames[keyFrameIndex],propList)}};var _fillPropForFrame=function(frame,propList){var key;//For each key frame iterate over all right hand properties and assign them,
//but only if the current key frame doesn't have the property by itself
for(key in propList){//The current frame misses this property, so assign it.
if(!hasProp.call(frame.props,key)){frame.props[key]=propList[key]}}//Iterate over all props of the current frame and collect them
for(key in frame.props){propList[key]=frame.props[key]}};/**
	 * Calculates the new values for two given values array.
	 */
var _calcInterpolation=function(val1,val2,progress){var valueIndex;var val1Length=val1.length;//They both need to have the same length
if(val1Length!==val2.length){throw"Can't interpolate between \""+val1[0]+'" and "'+val2[0]+'"'}//Add the format string as first element.
var interpolated=[val1[0]];valueIndex=1;for(;valueIndex<val1Length;valueIndex++){//That's the line where the two numbers are actually interpolated.
interpolated[valueIndex]=val1[valueIndex]+(val2[valueIndex]-val1[valueIndex])*progress}return interpolated};/**
	 * Interpolates the numeric values into the format string.
	 */
var _interpolateString=function(val){var valueIndex=1;rxInterpolateString.lastIndex=0;return val[0].replace(rxInterpolateString,function(){return val[valueIndex++]})};/**
	 * Resets the class and style attribute to what it was before skrollr manipulated the element.
	 * Also remembers the values it had before reseting, in order to undo the reset.
	 */
var _reset=function(elements,undo){//We accept a single element or an array of elements.
elements=[].concat(elements);var skrollable;var element;var elementsIndex=0;var elementsLength=elements.length;for(;elementsIndex<elementsLength;elementsIndex++){element=elements[elementsIndex];skrollable=_skrollables[element[SKROLLABLE_ID_DOM_PROPERTY]];//Couldn't find the skrollable for this DOM element.
if(!skrollable){continue}if(undo){//Reset class and style to the "dirty" (set by skrollr) values.
element.style.cssText=skrollable.dirtyStyleAttr;_updateClass(element,skrollable.dirtyClassAttr)}else{//Remember the "dirty" (set by skrollr) class and style.
skrollable.dirtyStyleAttr=element.style.cssText;skrollable.dirtyClassAttr=_getClass(element);//Reset class and style to what it originally was.
element.style.cssText=skrollable.styleAttr;_updateClass(element,skrollable.classAttr)}}};/**
	 * Detects support for 3d transforms by applying it to the skrollr-body.
	 */
var _detect3DTransforms=function(){_translateZ="translateZ(0)";skrollr.setStyle(_skrollrBody,"transform",_translateZ);var computedStyle=getStyle(_skrollrBody);var computedTransform=computedStyle.getPropertyValue("transform");var computedTransformWithPrefix=computedStyle.getPropertyValue(theDashedCSSPrefix+"transform");var has3D=computedTransform&&computedTransform!=="none"||computedTransformWithPrefix&&computedTransformWithPrefix!=="none";if(!has3D){_translateZ=""}};/**
	 * Set the CSS property on the given element. Sets prefixed properties as well.
	 */
skrollr.setStyle=function(el,prop,val){var style=el.style;//Camel case.
prop=prop.replace(rxCamelCase,rxCamelCaseFn).replace("-","");//Make sure z-index gets a <integer>.
//This is the only <integer> case we need to handle.
if(prop==="zIndex"){if(isNaN(val)){//If it's not a number, don't touch it.
//It could for example be "auto" (#351).
style[prop]=val}else{//Floor the number.
style[prop]=""+(val|0)}}else if(prop==="float"){style.styleFloat=style.cssFloat=val}else{//Need try-catch for old IE.
try{//Set prefixed property if there's a prefix.
if(theCSSPrefix){style[theCSSPrefix+prop.slice(0,1).toUpperCase()+prop.slice(1)]=val}//Set unprefixed.
style[prop]=val}catch(ignore){}}};/**
	 * Cross browser event handling.
	 */
var _addEvent=skrollr.addEvent=function(element,names,callback){var intermediate=function(e){//Normalize IE event stuff.
e=e||window.event;if(!e.target){e.target=e.srcElement}if(!e.preventDefault){e.preventDefault=function(){e.returnValue=false;e.defaultPrevented=true}}return callback.call(this,e)};names=names.split(" ");var name;var nameCounter=0;var namesLength=names.length;for(;nameCounter<namesLength;nameCounter++){name=names[nameCounter];if(element.addEventListener){element.addEventListener(name,callback,false)}else{element.attachEvent("on"+name,intermediate)}//Remember the events to be able to flush them later.
_registeredEvents.push({element:element,name:name,listener:callback})}};var _removeEvent=skrollr.removeEvent=function(element,names,callback){names=names.split(" ");var nameCounter=0;var namesLength=names.length;for(;nameCounter<namesLength;nameCounter++){if(element.removeEventListener){element.removeEventListener(names[nameCounter],callback,false)}else{element.detachEvent("on"+names[nameCounter],callback)}}};var _removeAllEvents=function(){var eventData;var eventCounter=0;var eventsLength=_registeredEvents.length;for(;eventCounter<eventsLength;eventCounter++){eventData=_registeredEvents[eventCounter];_removeEvent(eventData.element,eventData.name,eventData.listener)}_registeredEvents=[]};var _emitEvent=function(element,name,direction){if(_listeners.keyframe){_listeners.keyframe.call(_instance,element,name,direction)}};var _reflow=function(){var pos=_instance.getScrollTop();//Will be recalculated by _updateDependentKeyFrames.
_maxKeyFrame=0;if(_forceHeight&&!_isMobile){//un-"force" the height to not mess with the calculations in _updateDependentKeyFrames (#216).
body.style.height=""}_updateDependentKeyFrames();if(_forceHeight&&!_isMobile){//"force" the height.
body.style.height=_maxKeyFrame+documentElement.clientHeight+"px"}//The scroll offset may now be larger than needed (on desktop the browser/os prevents scrolling farther than the bottom).
if(_isMobile){_instance.setScrollTop(Math.min(_instance.getScrollTop(),_maxKeyFrame))}else{//Remember and reset the scroll pos (#217).
_instance.setScrollTop(pos,true)}_forceRender=true};/*
	 * Returns a copy of the constants object where all functions and strings have been evaluated.
	 */
var _processConstants=function(){var viewportHeight=documentElement.clientHeight;var copy={};var prop;var value;for(prop in _constants){value=_constants[prop];if(typeof value==="function"){value=value.call(_instance)}else if(/p$/.test(value)){value=value.slice(0,-1)/100*viewportHeight}copy[prop]=value}return copy};/*
	 * Returns the height of the document.
	 */
var _getDocumentHeight=function(){var skrollrBodyHeight=_skrollrBody&&_skrollrBody.offsetHeight||0;var bodyHeight=Math.max(skrollrBodyHeight,body.scrollHeight,body.offsetHeight,documentElement.scrollHeight,documentElement.offsetHeight,documentElement.clientHeight);return bodyHeight-documentElement.clientHeight};/**
	 * Returns a string of space separated classnames for the current element.
	 * Works with SVG as well.
	 */
var _getClass=function(element){var prop="className";//SVG support by using className.baseVal instead of just className.
if(window.SVGElement&&element instanceof window.SVGElement){element=element[prop];prop="baseVal"}return element[prop]};/**
	 * Adds and removes a CSS classes.
	 * Works with SVG as well.
	 * add and remove are arrays of strings,
	 * or if remove is ommited add is a string and overwrites all classes.
	 */
var _updateClass=function(element,add,remove){var prop="className";//SVG support by using className.baseVal instead of just className.
if(window.SVGElement&&element instanceof window.SVGElement){element=element[prop];prop="baseVal"}//When remove is ommited, we want to overwrite/set the classes.
if(remove===undefined){element[prop]=add;return}//Cache current classes. We will work on a string before passing back to DOM.
var val=element[prop];//All classes to be removed.
var classRemoveIndex=0;var removeLength=remove.length;for(;classRemoveIndex<removeLength;classRemoveIndex++){val=_untrim(val).replace(_untrim(remove[classRemoveIndex])," ")}val=_trim(val);//All classes to be added.
var classAddIndex=0;var addLength=add.length;for(;classAddIndex<addLength;classAddIndex++){//Only add if el not already has class.
if(_untrim(val).indexOf(_untrim(add[classAddIndex]))===-1){val+=" "+add[classAddIndex]}}element[prop]=_trim(val)};var _trim=function(a){return a.replace(rxTrim,"")};/**
	 * Adds a space before and after the string.
	 */
var _untrim=function(a){return" "+a+" "};var _now=Date.now||function(){return+new Date};var _keyFrameComparator=function(a,b){return a.frame-b.frame};/*
	 * Private variables.
	 */
//Singleton
var _instance;/*
		A list of all elements which should be animated associated with their the metadata.
		Exmaple skrollable with two key frames animating from 100px width to 20px:

		skrollable = {
			element: <the DOM element>,
			styleAttr: <style attribute of the element before skrollr>,
			classAttr: <class attribute of the element before skrollr>,
			keyFrames: [
				{
					frame: 100,
					props: {
						width: {
							value: ['{?}px', 100],
							easing: <reference to easing function>
						}
					},
					mode: "absolute"
				},
				{
					frame: 200,
					props: {
						width: {
							value: ['{?}px', 20],
							easing: <reference to easing function>
						}
					},
					mode: "absolute"
				}
			]
		};
	*/
var _skrollables;var _skrollrBody;var _listeners;var _forceHeight;var _maxKeyFrame=0;var _scale=1;var _constants;var _mobileDeceleration;//Current direction (up/down).
var _direction="down";//The last top offset value. Needed to determine direction.
var _lastTop=-1;//The last time we called the render method (doesn't mean we rendered!).
var _lastRenderCall=_now();//For detecting if it actually resized (#271).
var _lastViewportWidth=0;var _lastViewportHeight=0;var _requestReflow=false;//Will contain data about a running scrollbar animation, if any.
var _scrollAnimation;var _smoothScrollingEnabled;var _smoothScrollingDuration;//Will contain settins for smooth scrolling if enabled.
var _smoothScrolling;//Can be set by any operation/event to force rendering even if the scrollbar didn't move.
var _forceRender;//Each skrollable gets an unique ID incremented for each skrollable.
//The ID is the index in the _skrollables array.
var _skrollableIdCounter=0;var _edgeStrategy;//Mobile specific vars. Will be stripped by UglifyJS when not in use.
var _isMobile=false;//The virtual scroll offset when using mobile scrolling.
var _mobileOffset=0;//If the browser supports 3d transforms, this will be filled with 'translateZ(0)' (empty string otherwise).
var _translateZ;//Will contain data about registered events by skrollr.
var _registeredEvents=[];//Animation frame id returned by RequestAnimationFrame (or timeout when RAF is not supported).
var _animFrame;//Expose skrollr as either a global variable or a require.js module
if(typeof define==="function"&&define.amd){define("skrollr",function(){return skrollr})}else if(typeof module!=="undefined"&&module.exports){module.exports=skrollr}else{window.skrollr=skrollr}})(window,document);/*!
 * skrollr stylesheets.
 * Parses stylesheets and searches for skrollr keyframe declarations.
 * Converts them to data-attributes.
 * Doesn't expose any globals.
 */
(function(window,document,undefined){"use strict";var content;var contents=[];//Finds the declaration of an animation block.
var rxAnimation=/@-skrollr-keyframes\s+([\w-]+)/g;//Finds the block of keyframes inside an animation block.
//http://regexpal.com/ saves your ass with stuff like this.
var rxKeyframes=/\s*\{\s*((?:[^{]+\{[^}]*\}\s*)+?)\s*\}/g;//Gets a single keyframe and the properties inside.
var rxSingleKeyframe=/([\w\-]+)\s*\{([^}]+)\}/g;//Finds usages of the animation.
var rxAnimationUsage=/-skrollr-animation-name\s*:\s*([\w-]+)/g;//Finds usages of attribute setters.
var rxAttributeSetter=/-skrollr-(anchor-target|smooth-scrolling|emit-events|menu-offset)\s*:\s*['"]([^'"]+)['"]/g;var fetchRemote=function(url){var xhr=new XMLHttpRequest;/*
		 * Yes, these are SYNCHRONOUS requests.
		 * Simply because skrollr stylesheets should run while the page is loaded.
		 * Get over it.
		 */
try{xhr.open("GET",url,false);xhr.send(null)}catch(e){//Fallback to XDomainRequest if available
if(window.XDomainRequest){xhr=new XDomainRequest;xhr.open("GET",url,false);xhr.send(null)}}return xhr.responseText};//"main"
var kickstart=function(stylesheets){//Iterate over all stylesheets, embedded and remote.
for(var stylesheetIndex=0;stylesheetIndex<stylesheets.length;stylesheetIndex++){var sheet=stylesheets[stylesheetIndex];if(sheet.tagName==="LINK"){if(sheet.getAttribute("data-skrollr-stylesheet")===null){continue}//Test media attribute if matchMedia available.
if(window.matchMedia){var media=sheet.getAttribute("media");if(media&&!matchMedia(media).matches){continue}}//Remote stylesheet, fetch it (synchrnonous).
content=fetchRemote(sheet.href)}else{//Embedded stylesheet, grab the node content.
content=sheet.textContent||sheet.innerText||sheet.innerHTML}if(content){contents.push(content)}}//We take the stylesheets in reverse order.
//This is needed to ensure correct order of stylesheets and inline styles.
contents.reverse();var animations={};var selectors=[];var attributes=[];//Now parse all stylesheets.
for(var contentIndex=0;contentIndex<contents.length;contentIndex++){content=contents[contentIndex];parseAnimationDeclarations(content,animations);parseAnimationUsage(content,selectors);parseAttributeSetters(content,attributes)}applyKeyframeAttributes(animations,selectors);applyAttributeSetters(attributes)};//Finds animation declarations and puts them into the output map.
var parseAnimationDeclarations=function(input,output){rxAnimation.lastIndex=0;var animation;var rawKeyframes;var keyframe;var curAnimation;while((animation=rxAnimation.exec(input))!==null){//Grab the keyframes inside this animation.
rxKeyframes.lastIndex=rxAnimation.lastIndex;rawKeyframes=rxKeyframes.exec(input);//Grab the single keyframes with their CSS properties.
rxSingleKeyframe.lastIndex=0;//Save the animation in an object using it's name as key.
curAnimation=output[animation[1]]={};while((keyframe=rxSingleKeyframe.exec(rawKeyframes[1]))!==null){//Put all keyframes inside the animation using the keyframe (like botttom-top, or 100) as key
//and the properties as value (just the raw string, newline stripped).
curAnimation[keyframe[1]]=keyframe[2].replace(/[\n\r\t]/g,"")}}};//Extracts the selector of the given block by walking backwards to the start of the block.
var extractSelector=function(input,startIndex){var begin;var end=startIndex;//First find the curly bracket that opens this block.
while(end--&&input.charAt(end)!=="{"){}//The end is now fixed to the right of the selector.
//Now start there to find the begin of the selector.
begin=end;//Now walk farther backwards until we grabbed the whole selector.
//This either ends at beginning of string or at end of next block.
while(begin--&&input.charAt(begin-1)!=="}"){}//Return the cleaned selector.
return input.substring(begin,end).replace(/[\n\r\t]/g,"")};//Finds usage of animations and puts the selectors into the output array.
var parseAnimationUsage=function(input,output){var match;var selector;rxAnimationUsage.lastIndex=0;while((match=rxAnimationUsage.exec(input))!==null){//Extract the selector of the block we found the animation in.
selector=extractSelector(input,rxAnimationUsage.lastIndex);//Associate this selector with the animation name.
output.push([selector,match[1]])}};//Finds usage of attribute setters and puts the selector and attribute data into the output array.
var parseAttributeSetters=function(input,output){var match;var selector;rxAttributeSetter.lastIndex=0;while((match=rxAttributeSetter.exec(input))!==null){//Extract the selector of the block we found the animation in.
selector=extractSelector(input,rxAttributeSetter.lastIndex);//Associate this selector with the attribute name and value.
output.push([selector,match[1],match[2]])}};//Applies the keyframes (as data-attributes) to the elements.
var applyKeyframeAttributes=function(animations,selectors){var elements;var keyframes;var keyframeName;var elementIndex;var attributeName;var attributeValue;var curElement;for(var selectorIndex=0;selectorIndex<selectors.length;selectorIndex++){elements=document.querySelectorAll(selectors[selectorIndex][0]);if(!elements){continue}keyframes=animations[selectors[selectorIndex][1]];for(keyframeName in keyframes){for(elementIndex=0;elementIndex<elements.length;elementIndex++){curElement=elements[elementIndex];attributeName="data-"+keyframeName;attributeValue=keyframes[keyframeName];//If the element already has this keyframe inline, give the inline one precedence by putting it on the right side.
//The inline one may actually be the result of the keyframes from another stylesheet.
//Since we reversed the order of the stylesheets, everything comes together correctly here.
if(curElement.hasAttribute(attributeName)){attributeValue+=curElement.getAttribute(attributeName)}curElement.setAttribute(attributeName,attributeValue)}}}};//Applies the keyframes (as data-attributes) to the elements.
var applyAttributeSetters=function(selectors){var curSelector;var elements;var attributeName;var attributeValue;var elementIndex;for(var selectorIndex=0;selectorIndex<selectors.length;selectorIndex++){curSelector=selectors[selectorIndex];elements=document.querySelectorAll(curSelector[0]);attributeName="data-"+curSelector[1];attributeValue=curSelector[2];if(!elements){continue}for(elementIndex=0;elementIndex<elements.length;elementIndex++){elements[elementIndex].setAttribute(attributeName,attributeValue)}}};kickstart(document.querySelectorAll("link, style"))})(window,document);/*! Picturefill - v2.1.0 - 2014-07-25
* http://scottjehl.github.io/picturefill
* Copyright (c) 2014 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
window.matchMedia||(window.matchMedia=function(){"use strict";// For browsers that support matchMedium api such as IE 9 and webkit
var styleMedia=window.styleMedia||window.media;// For those that don't support matchMedium
if(!styleMedia){var style=document.createElement("style"),script=document.getElementsByTagName("script")[0],info=null;style.type="text/css";style.id="matchmediajs-test";script.parentNode.insertBefore(style,script);// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
info="getComputedStyle"in window&&window.getComputedStyle(style,null)||style.currentStyle;styleMedia={matchMedium:function(media){var text="@media "+media+"{ #matchmediajs-test { width: 1px; } }";// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
if(style.styleSheet){style.styleSheet.cssText=text}else{style.textContent=text}// Test if media query is true or false
return info.width==="1px"}}}return function(media){return{matches:styleMedia.matchMedium(media||"all"),media:media||"all"}}}());/*! Picturefill - Responsive Images that work today.
*  Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
*  License: MIT/GPLv2
*  Spec: http://picture.responsiveimages.org/
*/
(function(w,doc){// Enable strict mode
"use strict";// If picture is supported, well, that's awesome. Let's get outta here...
if(w.HTMLPictureElement){w.picturefill=function(){};return}// HTML shim|v it for old IE (IE9 will still need the HTML video tag workaround)
doc.createElement("picture");// local object for method references and testing exposure
var pf={};// namespace
pf.ns="picturefill";// srcset support test
pf.srcsetSupported="srcset"in doc.createElement("img");pf.sizesSupported=w.HTMLImageElement.sizes;// just a string trim workaround
pf.trim=function(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")};// just a string endsWith workaround
pf.endsWith=function(str,suffix){return str.endsWith?str.endsWith(suffix):str.indexOf(suffix,str.length-suffix.length)!==-1};/**
	 * Shortcut method for matchMedia ( for easy overriding in tests )
	 */
pf.matchesMedia=function(media){return w.matchMedia&&w.matchMedia(media).matches};/**
	 * Shortcut method for `devicePixelRatio` ( for easy overriding in tests )
	 */
pf.getDpr=function(){return w.devicePixelRatio||1};/**
	 * Get width in css pixel value from a "length" value
	 * http://dev.w3.org/csswg/css-values-3/#length-value
	 */
pf.getWidthFromLength=function(length){// If no length was specified, or it is 0 or negative, default to `100vw` (per the spec).
length=length&&(parseFloat(length)>0||length.indexOf("calc(")>-1)?length:"100vw";/**
		* If length is specified in  `vw` units, use `%` instead since the div we’re measuring
		* is injected at the top of the document.
		*
		* TODO: maybe we should put this behind a feature test for `vw`?
		*/
length=length.replace("vw","%");// Create a cached element for getting length value widths
if(!pf.lengthEl){pf.lengthEl=doc.createElement("div");doc.documentElement.insertBefore(pf.lengthEl,doc.documentElement.firstChild)}// Positioning styles help prevent padding/margin/width on `html` from throwing calculations off.
pf.lengthEl.style.cssText="position: absolute; left: 0; width: "+length+";";if(pf.lengthEl.offsetWidth<=0){// Something has gone wrong. `calc()` is in use and unsupported, most likely. Default to `100vw` (`100%`, for broader support.):
pf.lengthEl.style.cssText="width: 100%;"}return pf.lengthEl.offsetWidth};// container of supported mime types that one might need to qualify before using
pf.types={};// Add support for standard mime types.
pf.types["image/jpeg"]=true;pf.types["image/gif"]=true;pf.types["image/png"]=true;// test svg support
pf.types["image/svg+xml"]=doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1");// test webp support, only when the markup calls for it
pf.types["image/webp"]=function(){// based on Modernizr's lossless img-webp test
// note: asynchronous
var img=new w.Image,type="image/webp";img.onerror=function(){pf.types[type]=false;picturefill()};img.onload=function(){pf.types[type]=img.width===1;picturefill()};img.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="};/**
	 * Takes a source element and checks if its type attribute is present and if so, supported
	 * Note: for type tests that require a async logic,
	 * you can define them as a function that'll run only if that type needs to be tested. Just make the test function call picturefill again when it is complete.
	 * see the async webp test above for example
	 */
pf.verifyTypeSupport=function(source){var type=source.getAttribute("type");// if type attribute exists, return test result, otherwise return true
if(type===null||type===""){return true}else{// if the type test is a function, run it and return "pending" status. The function will rerun picturefill on pending elements once finished.
if(typeof pf.types[type]==="function"){pf.types[type]();return"pending"}else{return pf.types[type]}}};/**
	* Parses an individual `size` and returns the length, and optional media query
	*/
pf.parseSize=function(sourceSizeStr){var match=/(\([^)]+\))?\s*(.+)/g.exec(sourceSizeStr);return{media:match&&match[1],length:match&&match[2]}};/**
	 * Takes a string of sizes and returns the width in pixels as a number
	 */
pf.findWidthFromSourceSize=function(sourceSizeListStr){// Split up source size list, ie ( max-width: 30em ) 100%, ( max-width: 50em ) 50%, 33%
//                            or (min-width:30em) calc(30% - 15px)
var sourceSizeList=pf.trim(sourceSizeListStr).split(/\s*,\s*/),winningLength;for(var i=0,len=sourceSizeList.length;i<len;i++){// Match <media-condition>? length, ie ( min-width: 50em ) 100%
var sourceSize=sourceSizeList[i],// Split "( min-width: 50em ) 100%" into separate strings
parsedSize=pf.parseSize(sourceSize),length=parsedSize.length,media=parsedSize.media;if(!length){continue}if(!media||pf.matchesMedia(media)){// if there is no media query or it matches, choose this as our winning length
// and end algorithm
winningLength=length;break}}// pass the length to a method that can properly determine length
// in pixels based on these formats: http://dev.w3.org/csswg/css-values-3/#length-value
return pf.getWidthFromLength(winningLength)};pf.parseSrcset=function(srcset){/**
		* A lot of this was pulled from Boris Smus’ parser for the now-defunct WHATWG `srcset`
		* https://github.com/borismus/srcset-polyfill/blob/master/js/srcset-info.js
		*
		* 1. Let input (`srcset`) be the value passed to this algorithm.
		* 2. Let position be a pointer into input, initially pointing at the start of the string.
		* 3. Let raw candidates be an initially empty ordered list of URLs with associated 
		*    unparsed descriptors. The order of entries in the list is the order in which entries 
		*    are added to the list.
		*/
var candidates=[];while(srcset!==""){srcset=srcset.replace(/^\s+/g,"");// 5. Collect a sequence of characters that are not space characters, and let that be url.
var pos=srcset.search(/\s/g),url,descriptor=null;if(pos!==-1){url=srcset.slice(0,pos);var last=url[url.length-1];// 6. If url ends with a U+002C COMMA character (,), remove that character from url
// and let descriptors be the empty string. Otherwise, follow these substeps
// 6.1. If url is empty, then jump to the step labeled descriptor parser.
if(last===","||url===""){url=url.replace(/,+$/,"");descriptor=""}srcset=srcset.slice(pos+1);// 6.2. Collect a sequence of characters that are not U+002C COMMA characters (,), and 
// let that be descriptors.
if(descriptor===null){var descpos=srcset.indexOf(",");if(descpos!==-1){descriptor=srcset.slice(0,descpos);srcset=srcset.slice(descpos+1)}else{descriptor=srcset;srcset=""}}}else{url=srcset;srcset=""}// 7. Add url to raw candidates, associated with descriptors.
if(url||descriptor){candidates.push({url:url,descriptor:descriptor})}}return candidates};pf.parseDescriptor=function(descriptor,sizesattr){// 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list 
// is the order in which entries are added to the list.
var sizes=sizesattr||"100vw",sizeDescriptor=descriptor&&descriptor.replace(/(^\s+|\s+$)/g,""),widthInCssPixels=pf.findWidthFromSourceSize(sizes),resCandidate;if(sizeDescriptor){var splitDescriptor=sizeDescriptor.split(" ");for(var i=splitDescriptor.length+1;i>=0;i--){if(splitDescriptor[i]!==undefined){var curr=splitDescriptor[i],lastchar=curr&&curr.slice(curr.length-1);if((lastchar==="h"||lastchar==="w")&&!pf.sizesSupported){resCandidate=parseFloat(parseInt(curr,10)/widthInCssPixels)}else if(lastchar==="x"){var res=curr&&parseFloat(curr,10);resCandidate=res&&!isNaN(res)?res:1}}}}return resCandidate||1};/**
	 * Takes a srcset in the form of url/
	 * ex. "images/pic-medium.png 1x, images/pic-medium-2x.png 2x" or
	 *     "images/pic-medium.png 400w, images/pic-medium-2x.png 800w" or
	 *     "images/pic-small.png"
	 * Get an array of image candidates in the form of
	 *      {url: "/foo/bar.png", resolution: 1}
	 * where resolution is http://dev.w3.org/csswg/css-values-3/#resolution-value
	 * If sizes is specified, resolution is calculated
	 */
pf.getCandidatesFromSourceSet=function(srcset,sizes){var candidates=pf.parseSrcset(srcset),formattedCandidates=[];for(var i=0,len=candidates.length;i<len;i++){var candidate=candidates[i];formattedCandidates.push({url:candidate.url,resolution:pf.parseDescriptor(candidate.descriptor,sizes)})}return formattedCandidates};/*
	 * if it's an img element and it has a srcset property,
	 * we need to remove the attribute so we can manipulate src
	 * (the property's existence infers native srcset support, and a srcset-supporting browser will prioritize srcset's value over our winning picture candidate)
	 * this moves srcset's value to memory for later use and removes the attr
	 */
pf.dodgeSrcset=function(img){if(img.srcset){img[pf.ns].srcset=img.srcset;img.removeAttribute("srcset")}};/*
	 * Accept a source or img element and process its srcset and sizes attrs
	 */
pf.processSourceSet=function(el){var srcset=el.getAttribute("srcset"),sizes=el.getAttribute("sizes"),candidates=[];// if it's an img element, use the cached srcset property (defined or not)
if(el.nodeName.toUpperCase()==="IMG"&&el[pf.ns]&&el[pf.ns].srcset){srcset=el[pf.ns].srcset}if(srcset){candidates=pf.getCandidatesFromSourceSet(srcset,sizes)}return candidates};pf.applyBestCandidate=function(candidates,picImg){var candidate,length,bestCandidate;candidates.sort(pf.ascendingSort);length=candidates.length;bestCandidate=candidates[length-1];for(var i=0;i<length;i++){candidate=candidates[i];if(candidate.resolution>=pf.getDpr()){bestCandidate=candidate;break}}if(bestCandidate&&!pf.endsWith(picImg.src,bestCandidate.url)){var $picture=$(picImg);if($picture.attr("src").search("blank.gif")>0){$(picImg).attr("data-src",bestCandidate.url);picImg.currentSrc=$(picImg).attr("data-src")}else{picImg.src=bestCandidate.url;// currentSrc attribute and property to match
// http://picture.responsiveimages.org/#the-img-element
picImg.currentSrc=picImg.src}}};pf.ascendingSort=function(a,b){return a.resolution-b.resolution};/*
	 * In IE9, <source> elements get removed if they aren't children of
	 * video elements. Thus, we conditionally wrap source elements
	 * using <!--[if IE 9]><video style="display: none;"><![endif]-->
	 * and must account for that here by moving those source elements
	 * back into the picture element.
	 */
pf.removeVideoShim=function(picture){var videos=picture.getElementsByTagName("video");if(videos.length){var video=videos[0],vsources=video.getElementsByTagName("source");while(vsources.length){picture.insertBefore(vsources[0],video)}// Remove the video element once we're finished removing its children
video.parentNode.removeChild(video)}};/*
	 * Find all `img` elements, and add them to the candidate list if they have
	 * a `picture` parent, a `sizes` attribute in basic `srcset` supporting browsers,
	 * a `srcset` attribute at all, and they haven’t been evaluated already.
	 */
pf.getAllElements=function(){var elems=[],imgs=doc.getElementsByTagName("img");for(var h=0,len=imgs.length;h<len;h++){var currImg=imgs[h];if(currImg.parentNode.nodeName.toUpperCase()==="PICTURE"||currImg.getAttribute("srcset")!==null||currImg[pf.ns]&&currImg[pf.ns].srcset!==null){elems.push(currImg)}}return elems};pf.getMatch=function(img,picture){var sources=picture.childNodes,match;// Go through each child, and if they have media queries, evaluate them
for(var j=0,slen=sources.length;j<slen;j++){var source=sources[j];// ignore non-element nodes
if(source.nodeType!==1){continue}// Hitting the `img` element that started everything stops the search for `sources`.
// If no previous `source` matches, the `img` itself is evaluated later.
if(source===img){return match}// ignore non-`source` nodes
if(source.nodeName.toUpperCase()!=="SOURCE"){continue}// if it's a source element that has the `src` property set, throw a warning in the console
if(source.getAttribute("src")!==null&&typeof console!==undefined){console.warn("The `src` attribute is invalid on `picture` `source` element; instead, use `srcset`.")}var media=source.getAttribute("media");// if source does not have a srcset attribute, skip
if(!source.getAttribute("srcset")){continue}// if there's no media specified, OR w.matchMedia is supported
if(!media||pf.matchesMedia(media)){var typeSupported=pf.verifyTypeSupport(source);if(typeSupported===true){match=source;break}else if(typeSupported==="pending"){return false}}}return match};function picturefill(opt){var elements,element,parent,firstMatch,candidates,options=opt||{};elements=options.elements||pf.getAllElements();// Loop through all elements
for(var i=0,plen=elements.length;i<plen;i++){element=elements[i];parent=element.parentNode;firstMatch=undefined;candidates=undefined;// expando for caching data on the img
if(!element[pf.ns]){element[pf.ns]={}}// if the element has already been evaluated, skip it
// unless `options.force` is set to true ( this, for example,
// is set to true when running `picturefill` on `resize` ).
if(!options.reevaluate&&element[pf.ns].evaluated){continue}// if `img` is in a `picture` element
if(parent.nodeName.toUpperCase()==="PICTURE"){// IE9 video workaround
pf.removeVideoShim(parent);// return the first match which might undefined
// returns false if there is a pending source
// TODO the return type here is brutal, cleanup
firstMatch=pf.getMatch(element,parent);// if any sources are pending in this picture due to async type test(s)
// remove the evaluated attr and skip for now ( the pending test will
// rerun picturefill on this element when complete)
if(firstMatch===false){continue}}else{firstMatch=undefined}// Cache and remove `srcset` if present and we’re going to be doing `picture`/`srcset`/`sizes` polyfilling to it.
if(parent.nodeName.toUpperCase()==="PICTURE"||element.srcset&&!pf.srcsetSupported||!pf.sizesSupported&&(element.srcset&&element.srcset.indexOf("w")>-1)){pf.dodgeSrcset(element)}if(firstMatch){candidates=pf.processSourceSet(firstMatch);pf.applyBestCandidate(candidates,element)}else{// No sources matched, so we’re down to processing the inner `img` as a source.
candidates=pf.processSourceSet(element);if(element.srcset===undefined||element[pf.ns].srcset){// Either `srcset` is completely unsupported, or we need to polyfill `sizes` functionality.
pf.applyBestCandidate(candidates,element)}}// set evaluated to true to avoid unnecessary reparsing
element[pf.ns].evaluated=true}}/**
	 * Sets up picture polyfill by polling the document and running
	 * the polyfill every 250ms until the document is ready.
	 * Also attaches picturefill on resize
	 */
function runPicturefill(){picturefill();var intervalId=setInterval(function(){// When the document has finished loading, stop checking for new images
// https://github.com/ded/domready/blob/master/ready.js#L15
picturefill();if(/^loaded|^i|^c/.test(doc.readyState)){clearInterval(intervalId);return}},250);if(w.addEventListener){var resizeThrottle;w.addEventListener("resize",function(){if(!w._picturefillWorking){w._picturefillWorking=true;w.clearTimeout(resizeThrottle);resizeThrottle=w.setTimeout(function(){picturefill({reevaluate:true});w._picturefillWorking=false},60)}},false)}}runPicturefill();/* expose methods for testing */
picturefill._=pf;/* expose picturefill */
if(typeof module==="object"&&typeof module.exports==="object"){// CommonJS, just export
module.exports=picturefill}else if(typeof define==="function"&&define.amd){// AMD support
define(function(){return picturefill})}else if(typeof w==="object"){// If no AMD and we are in the browser, attach to window
w.picturefill=picturefill}})(this,this.document);/**
 * jQuery Unveil
 * A very lightweight jQuery plugin to lazy load images
 * http://luis-almeida.github.com/unveil
 *
 * Licensed under the MIT license.
 * Copyright 2013 Luís Almeida
 * https://github.com/luis-almeida
 */
(function($){$.fn.unveil=function(threshold,callback){var $w=$(window),th=threshold||0,retina=window.devicePixelRatio>1,attrib=retina?"data-src-retina":"data-src",images=this,loaded;this.one("unveil",function(){var source=this.getAttribute(attrib);source=source||this.getAttribute("data-src");if(source){this.setAttribute("src",source);if(typeof callback==="function")callback.call(this)}});function unveil(){var inview=images.filter(function(){var $e=$(this);if($e.is(":hidden"))return;if(typeof autotouring.skrollr.instance!=="undefined"&&autotouring.skrollr.instance!==null&&"ontouchstart"in document.documentElement&&autotouring.isMobileDevice()){var wt=autotouring.skrollr.instance.getScrollTop()}else{var wt=$w.scrollTop()}var wb=wt+$w.height(),et=$e.offset().top,eb=et+$e.height();return eb>=wt-th&&et<=wb+th});loaded=inview.trigger("unveil");images=images.not(loaded)}if("ontouchstart"in document.documentElement&&autotouring.isMobileDevice()){if(typeof autotouring.skrollr.instance!=="undefined"&&autotouring.skrollr.instance!==null){autotouring.skrollr.instance.on("render",unveil)}}$w.on("scroll.unveil resize.unveil lookup.unveil",unveil);unveil();return this}})(window.jQuery||window.Zepto);/* ========================================================================
 * Bootstrap: tab.js v3.2.0
 * http://getbootstrap.com/javascript/#tabs
 * ========================================================================
 * Copyright 2011-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
+function($){"use strict";// TAB CLASS DEFINITION
// ====================
var Tab=function(element){this.element=$(element)};Tab.VERSION="3.2.0";Tab.prototype.show=function(){var $this=this.element;var $ul=$this.closest("ul:not(.dropdown-menu)");var selector=$this.data("target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}if($this.parent("li").hasClass("active"))return;var previous=$ul.find(".active:last a")[0];var e=$.Event("show.bs.tab",{relatedTarget:previous});$this.trigger(e);if(e.isDefaultPrevented())return;var $target=$(selector);this.activate($this.closest("li"),$ul);this.activate($target,$target.parent(),function(){$this.trigger({type:"shown.bs.tab",relatedTarget:previous})})};Tab.prototype.activate=function(element,container,callback){var $active=container.find("> .active");var transition=callback&&$.support.transition&&$active.hasClass("fade");function next(){$active.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");element.addClass("active");if(transition){element[0].offsetWidth;// reflow for transition
element.addClass("in")}else{element.removeClass("fade")}if(element.parent(".dropdown-menu")){element.closest("li.dropdown").addClass("active")}callback&&callback()}transition?$active.one("bsTransitionEnd",next).emulateTransitionEnd(150):next();$active.removeClass("in")};// TAB PLUGIN DEFINITION
// =====================
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.tab");if(!data)$this.data("bs.tab",data=new Tab(this));if(typeof option=="string")data[option]()})}var old=$.fn.tab;$.fn.tab=Plugin;$.fn.tab.Constructor=Tab;// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict=function(){$.fn.tab=old;return this};// TAB DATA-API
// ============
$(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault();Plugin.call($(this),"show")})}(jQuery);/* ========================================================================
 * Bootstrap: transition.js v3.2.0
 * http://getbootstrap.com/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
+function($){"use strict";// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd(){var el=document.createElement("bootstrap");var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]}}}return false}// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd=function(duration){var called=false;var $el=this;$(this).one("bsTransitionEnd",function(){called=true});var callback=function(){if(!called)$($el).trigger($.support.transition.end)};setTimeout(callback,duration);return this};$(function(){$.support.transition=transitionEnd();if(!$.support.transition)return;$.event.special.bsTransitionEnd={bindType:$.support.transition.end,delegateType:$.support.transition.end,handle:function(e){if($(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}})}(jQuery);/*
    json2.js
    2012-10-08

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html


    This code should be minified before deployment.
    See http://javascript.crockford.com/jsmin.html

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
    NOT CONTROL.


    This file creates a global JSON object containing two methods: stringify
    and parse.

        JSON.stringify(value, replacer, space)
            value       any JavaScript value, usually an object or array.

            replacer    an optional parameter that determines how object
                        values are stringified for objects. It can be a
                        function or an array of strings.

            space       an optional parameter that specifies the indentation
                        of nested structures. If it is omitted, the text will
                        be packed without extra whitespace. If it is a number,
                        it will specify the number of spaces to indent at each
                        level. If it is a string (such as '\t' or '&nbsp;'),
                        it contains the characters used to indent at each level.

            This method produces a JSON text from a JavaScript value.

            When an object value is found, if the object contains a toJSON
            method, its toJSON method will be called and the result will be
            stringified. A toJSON method does not serialize: it returns the
            value represented by the name/value pair that should be serialized,
            or undefined if nothing should be serialized. The toJSON method
            will be passed the key associated with the value, and this will be
            bound to the value

            For example, this would serialize Dates as ISO strings.

                Date.prototype.toJSON = function (key) {
                    function f(n) {
                        // Format integers to have at least two digits.
                        return n < 10 ? '0' + n : n;
                    }

                    return this.getUTCFullYear()   + '-' +
                         f(this.getUTCMonth() + 1) + '-' +
                         f(this.getUTCDate())      + 'T' +
                         f(this.getUTCHours())     + ':' +
                         f(this.getUTCMinutes())   + ':' +
                         f(this.getUTCSeconds())   + 'Z';
                };

            You can provide an optional replacer method. It will be passed the
            key and value of each member, with this bound to the containing
            object. The value that is returned from your method will be
            serialized. If your method returns undefined, then the member will
            be excluded from the serialization.

            If the replacer parameter is an array of strings, then it will be
            used to select the members to be serialized. It filters the results
            such that only members with keys listed in the replacer array are
            stringified.

            Values that do not have JSON representations, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays they will be replaced with null. You can use
            a replacer function to replace those with JSON values.
            JSON.stringify(undefined) returns undefined.

            The optional space parameter produces a stringification of the
            value that is filled with line breaks and indentation to make it
            easier to read.

            If the space parameter is a non-empty string, then that string will
            be used for indentation. If the space parameter is a number, then
            the indentation will be that many spaces.

            Example:

            text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'

            text = JSON.stringify([new Date()], function (key, value) {
                return this[key] instanceof Date ?
                    'Date(' + this[key] + ')' : value;
            });
            // text is '["Date(---current time---)"]'


        JSON.parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = JSON.parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });

            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
                var d;
                if (typeof value === 'string' &&
                        value.slice(0, 5) === 'Date(' &&
                        value.slice(-1) === ')') {
                    d = new Date(value.slice(5, -1));
                    if (d) {
                        return d;
                    }
                }
                return value;
            });


    This is a reference implementation. You are free to copy, modify, or
    redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
    lastIndex, length, parse, prototype, push, replace, slice, stringify,
    test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if(typeof JSON!=="object"){JSON={}}(function(){"use strict";function f(n){// Format integers to have at least two digits.
return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={// table of character substitutions
"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){// Produce a string from holder[key].
var i,// The loop counter.
k,// The member key.
v,// The member value.
length,mind=gap,partial,value=holder[key];// If the value has a toJSON method, call it to obtain a replacement value.
if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if(typeof rep==="function"){value=rep.call(holder,key,value)}// What happens next depends on the value's type.
switch(typeof value){case"string":return quote(value);case"number":// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value)?String(value):"null";case"boolean":case"null":// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);// If the type is 'object', we might be dealing with an object or an array or
// null.
case"object":// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if(!value){return"null"}// Make an array to hold the partial results of stringifying this object value.
gap+=indent;partial=[];// Is the value an array?
if(Object.prototype.toString.apply(value)==="[object Array]"){// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}// If the replacer is an array, use it to select the members to be stringified.
if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{// Otherwise, iterate through all of the keys in the object.
for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}// If the JSON object does not yet have a stringify method, give it one.
if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;gap="";indent="";// If the space parameter is a number, make an indent string containing that
// many spaces.
if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else if(typeof space==="string"){indent=space}// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str("",{"":value})}}// If the JSON object does not yet have a parse method, give it one.
if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;function walk(holder,key){// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j=eval("("+text+")");// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver==="function"?walk({"":j},""):j}// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError("JSON.parse")}}})();/**
 * History.js jQuery Adapter
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
// Closure
(function(window,undefined){"use strict";// Localise Globals
var History=window.History=window.History||{},jQuery=window.jQuery;// Check Existence
if(typeof History.Adapter!=="undefined"){throw new Error("History.js Adapter has already been loaded...")}// Add the Adapter
History.Adapter={/**
		 * History.Adapter.bind(el,event,callback)
		 * @param {Element|string} el
		 * @param {string} event - custom and standard events
		 * @param {function} callback
		 * @return {void}
		 */
bind:function(el,event,callback){jQuery(el).bind(event,callback)},/**
		 * History.Adapter.trigger(el,event)
		 * @param {Element|string} el
		 * @param {string} event - custom and standard events
		 * @param {Object=} extra - a object of extra event data (optional)
		 * @return {void}
		 */
trigger:function(el,event,extra){jQuery(el).trigger(event,extra)},/**
		 * History.Adapter.extractEventData(key,event,extra)
		 * @param {string} key - key for the event data to extract
		 * @param {string} event - custom and standard events
		 * @param {Object=} extra - a object of extra event data (optional)
		 * @return {mixed}
		 */
extractEventData:function(key,event,extra){// jQuery Native then jQuery Custom
var result=event&&event.originalEvent&&event.originalEvent[key]||extra&&extra[key]||undefined;// Return
return result},/**
		 * History.Adapter.onDomLoad(callback)
		 * @param {function} callback
		 * @return {void}
		 */
onDomLoad:function(callback){jQuery(callback)}};// Try and Initialise History
if(typeof History.init!=="undefined"){History.init()}})(window);/**
 * History.js HTML4 Support
 * Depends on the HTML5 Support
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
(function(window,undefined){"use strict";// ========================================================================
// Initialise
// Localise Globals
var document=window.document,// Make sure we are using the correct document
setTimeout=window.setTimeout||setTimeout,clearTimeout=window.clearTimeout||clearTimeout,setInterval=window.setInterval||setInterval,History=window.History=window.History||{};// Public History Object
// Check Existence
if(typeof History.initHtml4!=="undefined"){throw new Error("History.js HTML4 Support has already been loaded...")}// ========================================================================
// Initialise HTML4 Support
// Initialise HTML4 Support
History.initHtml4=function(){// Initialise
if(typeof History.initHtml4.initialized!=="undefined"){// Already Loaded
return false}else{History.initHtml4.initialized=true}// ====================================================================
// Properties
/**
		 * History.enabled
		 * Is History enabled?
		 */
History.enabled=true;// ====================================================================
// Hash Storage
/**
		 * History.savedHashes
		 * Store the hashes in an array
		 */
History.savedHashes=[];/**
		 * History.isLastHash(newHash)
		 * Checks if the hash is the last hash
		 * @param {string} newHash
		 * @return {boolean} true
		 */
History.isLastHash=function(newHash){// Prepare
var oldHash=History.getHashByIndex(),isLast;// Check
isLast=newHash===oldHash;// Return isLast
return isLast};/**
		 * History.isHashEqual(newHash, oldHash)
		 * Checks to see if two hashes are functionally equal
		 * @param {string} newHash
		 * @param {string} oldHash
		 * @return {boolean} true
		 */
History.isHashEqual=function(newHash,oldHash){newHash=encodeURIComponent(newHash).replace(/%25/g,"%");oldHash=encodeURIComponent(oldHash).replace(/%25/g,"%");return newHash===oldHash};/**
		 * History.saveHash(newHash)
		 * Push a Hash
		 * @param {string} newHash
		 * @return {boolean} true
		 */
History.saveHash=function(newHash){// Check Hash
if(History.isLastHash(newHash)){return false}// Push the Hash
History.savedHashes.push(newHash);// Return true
return true};/**
		 * History.getHashByIndex()
		 * Gets a hash by the index
		 * @param {integer} index
		 * @return {string}
		 */
History.getHashByIndex=function(index){// Prepare
var hash=null;// Handle
if(typeof index==="undefined"){// Get the last inserted
hash=History.savedHashes[History.savedHashes.length-1]}else if(index<0){// Get from the end
hash=History.savedHashes[History.savedHashes.length+index]}else{// Get from the beginning
hash=History.savedHashes[index]}// Return hash
return hash};// ====================================================================
// Discarded States
/**
		 * History.discardedHashes
		 * A hashed array of discarded hashes
		 */
History.discardedHashes={};/**
		 * History.discardedStates
		 * A hashed array of discarded states
		 */
History.discardedStates={};/**
		 * History.discardState(State)
		 * Discards the state by ignoring it through History
		 * @param {object} State
		 * @return {true}
		 */
History.discardState=function(discardedState,forwardState,backState){//History.debug('History.discardState', arguments);
// Prepare
var discardedStateHash=History.getHashByState(discardedState),discardObject;// Create Discard Object
discardObject={discardedState:discardedState,backState:backState,forwardState:forwardState};// Add to DiscardedStates
History.discardedStates[discardedStateHash]=discardObject;// Return true
return true};/**
		 * History.discardHash(hash)
		 * Discards the hash by ignoring it through History
		 * @param {string} hash
		 * @return {true}
		 */
History.discardHash=function(discardedHash,forwardState,backState){//History.debug('History.discardState', arguments);
// Create Discard Object
var discardObject={discardedHash:discardedHash,backState:backState,forwardState:forwardState};// Add to discardedHash
History.discardedHashes[discardedHash]=discardObject;// Return true
return true};/**
		 * History.discardedState(State)
		 * Checks to see if the state is discarded
		 * @param {object} State
		 * @return {bool}
		 */
History.discardedState=function(State){// Prepare
var StateHash=History.getHashByState(State),discarded;// Check
discarded=History.discardedStates[StateHash]||false;// Return true
return discarded};/**
		 * History.discardedHash(hash)
		 * Checks to see if the state is discarded
		 * @param {string} State
		 * @return {bool}
		 */
History.discardedHash=function(hash){// Check
var discarded=History.discardedHashes[hash]||false;// Return true
return discarded};/**
		 * History.recycleState(State)
		 * Allows a discarded state to be used again
		 * @param {object} data
		 * @param {string} title
		 * @param {string} url
		 * @return {true}
		 */
History.recycleState=function(State){//History.debug('History.recycleState', arguments);
// Prepare
var StateHash=History.getHashByState(State);// Remove from DiscardedStates
if(History.discardedState(State)){delete History.discardedStates[StateHash]}// Return true
return true};// ====================================================================
// HTML4 HashChange Support
if(History.emulated.hashChange){/*
			 * We must emulate the HTML4 HashChange Support by manually checking for hash changes
			 */
/**
			 * History.hashChangeInit()
			 * Init the HashChange Emulation
			 */
History.hashChangeInit=function(){// Define our Checker Function
History.checkerFunction=null;// Define some variables that will help in our checker function
var lastDocumentHash="",iframeId,iframe,lastIframeHash,checkerRunning,startedWithHash=Boolean(History.getHash());// Handle depending on the browser
if(History.isInternetExplorer()){// IE6 and IE7
// We need to use an iframe to emulate the back and forward buttons
// Create iFrame
iframeId="historyjs-iframe";iframe=document.createElement("iframe");// Adjust iFarme
// IE 6 requires iframe to have a src on HTTPS pages, otherwise it will throw a
// "This page contains both secure and nonsecure items" warning.
iframe.setAttribute("id",iframeId);iframe.setAttribute("src","#");iframe.style.display="none";// Append iFrame
document.body.appendChild(iframe);// Create initial history entry
iframe.contentWindow.document.open();iframe.contentWindow.document.close();// Define some variables that will help in our checker function
lastIframeHash="";checkerRunning=false;// Define the checker function
History.checkerFunction=function(){// Check Running
if(checkerRunning){return false}// Update Running
checkerRunning=true;// Fetch
var documentHash=History.getHash(),iframeHash=History.getHash(iframe.contentWindow.document);// The Document Hash has changed (application caused)
if(documentHash!==lastDocumentHash){// Equalise
lastDocumentHash=documentHash;// Create a history entry in the iframe
if(iframeHash!==documentHash){//History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);
// Equalise
lastIframeHash=iframeHash=documentHash;// Create History Entry
iframe.contentWindow.document.open();iframe.contentWindow.document.close();// Update the iframe's hash
iframe.contentWindow.document.location.hash=History.escapeHash(documentHash)}// Trigger Hashchange Event
History.Adapter.trigger(window,"hashchange")}else if(iframeHash!==lastIframeHash){//History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);
// Equalise
lastIframeHash=iframeHash;// If there is no iframe hash that means we're at the original
// iframe state.
// And if there was a hash on the original request, the original
// iframe state was replaced instantly, so skip this state and take
// the user back to where they came from.
if(startedWithHash&&iframeHash===""){History.back()}else{// Update the Hash
History.setHash(iframeHash,false)}}// Reset Running
checkerRunning=false;// Return true
return true}}else{// We are not IE
// Firefox 1 or 2, Opera
// Define the checker function
History.checkerFunction=function(){// Prepare
var documentHash=History.getHash()||"";// The Document Hash has changed (application caused)
if(documentHash!==lastDocumentHash){// Equalise
lastDocumentHash=documentHash;// Trigger Hashchange Event
History.Adapter.trigger(window,"hashchange")}// Return true
return true}}// Apply the checker function
History.intervalList.push(setInterval(History.checkerFunction,History.options.hashChangeInterval));// Done
return true};// History.hashChangeInit
// Bind hashChangeInit
History.Adapter.onDomLoad(History.hashChangeInit)}// History.emulated.hashChange
// ====================================================================
// HTML5 State Support
// Non-Native pushState Implementation
if(History.emulated.pushState){/*
			 * We must emulate the HTML5 State Management by using HTML4 HashChange
			 */
/**
			 * History.onHashChange(event)
			 * Trigger HTML5's window.onpopstate via HTML4 HashChange Support
			 */
History.onHashChange=function(event){//History.debug('History.onHashChange', arguments);
// Prepare
var currentUrl=event&&event.newURL||History.getLocationHref(),currentHash=History.getHashByUrl(currentUrl),currentState=null,currentStateHash=null,currentStateHashExits=null,discardObject;// Check if we are the same state
if(History.isLastHash(currentHash)){// There has been no change (just the page's hash has finally propagated)
//History.debug('History.onHashChange: no change');
History.busy(false);return false}// Reset the double check
History.doubleCheckComplete();// Store our location for use in detecting back/forward direction
History.saveHash(currentHash);// Expand Hash
if(currentHash&&History.isTraditionalAnchor(currentHash)){//History.debug('History.onHashChange: traditional anchor', currentHash);
// Traditional Anchor Hash
History.Adapter.trigger(window,"anchorchange");History.busy(false);return false}// Create State
currentState=History.extractState(History.getFullUrl(currentHash||History.getLocationHref()),true);// Check if we are the same state
if(History.isLastSavedState(currentState)){//History.debug('History.onHashChange: no change');
// There has been no change (just the page's hash has finally propagated)
History.busy(false);return false}// Create the state Hash
currentStateHash=History.getHashByState(currentState);// Check if we are DiscardedState
discardObject=History.discardedState(currentState);if(discardObject){// Ignore this state as it has been discarded and go back to the state before it
if(History.getHashByIndex(-2)===History.getHashByState(discardObject.forwardState)){// We are going backwards
//History.debug('History.onHashChange: go backwards');
History.back(false)}else{// We are going forwards
//History.debug('History.onHashChange: go forwards');
History.forward(false)}return false}// Push the new HTML5 State
//History.debug('History.onHashChange: success hashchange');
History.pushState(currentState.data,currentState.title,encodeURI(currentState.url),false);// End onHashChange closure
return true};History.Adapter.bind(window,"hashchange",History.onHashChange);/**
			 * History.pushState(data,title,url)
			 * Add a new State to the history object, become it, and trigger onpopstate
			 * We have to trigger for HTML4 compatibility
			 * @param {object} data
			 * @param {string} title
			 * @param {string} url
			 * @return {true}
			 */
History.pushState=function(data,title,url,queue){//History.debug('History.pushState: called', arguments);
// We assume that the URL passed in is URI-encoded, but this makes
// sure that it's fully URI encoded; any '%'s that are encoded are
// converted back into '%'s
url=encodeURI(url).replace(/%25/g,"%");// Check the State
if(History.getHashByUrl(url)){throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).")}// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.pushState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.pushState,args:arguments,queue:queue});return false}// Make Busy
History.busy(true);// Fetch the State Object
var newState=History.createStateObject(data,title,url),newStateHash=History.getHashByState(newState),oldState=History.getState(false),oldStateHash=History.getHashByState(oldState),html4Hash=History.getHash(),wasExpected=History.expectedStateId==newState.id;// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;// Recycle the State
History.recycleState(newState);// Force update of the title
History.setTitle(newState);// Check if we are the same State
if(newStateHash===oldStateHash){//History.debug('History.pushState: no change', newStateHash);
History.busy(false);return false}// Update HTML5 State
History.saveState(newState);// Fire HTML5 Event
if(!wasExpected)History.Adapter.trigger(window,"statechange");// Update HTML4 Hash
if(!History.isHashEqual(newStateHash,html4Hash)&&!History.isHashEqual(newStateHash,History.getShortUrl(History.getLocationHref()))){History.setHash(newStateHash,false)}History.busy(false);// End pushState closure
return true};/**
			 * History.replaceState(data,title,url)
			 * Replace the State and trigger onpopstate
			 * We have to trigger for HTML4 compatibility
			 * @param {object} data
			 * @param {string} title
			 * @param {string} url
			 * @return {true}
			 */
History.replaceState=function(data,title,url,queue){//History.debug('History.replaceState: called', arguments);
// We assume that the URL passed in is URI-encoded, but this makes
// sure that it's fully URI encoded; any '%'s that are encoded are
// converted back into '%'s
url=encodeURI(url).replace(/%25/g,"%");// Check the State
if(History.getHashByUrl(url)){throw new Error("History.js does not support states with fragment-identifiers (hashes/anchors).")}// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.replaceState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.replaceState,args:arguments,queue:queue});return false}// Make Busy
History.busy(true);// Fetch the State Objects
var newState=History.createStateObject(data,title,url),newStateHash=History.getHashByState(newState),oldState=History.getState(false),oldStateHash=History.getHashByState(oldState),previousState=History.getStateByIndex(-2);// Discard Old State
History.discardState(oldState,newState,previousState);// If the url hasn't changed, just store and save the state
// and fire a statechange event to be consistent with the
// html 5 api
if(newStateHash===oldStateHash){// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;// Recycle the State
History.recycleState(newState);// Force update of the title
History.setTitle(newState);// Update HTML5 State
History.saveState(newState);// Fire HTML5 Event
//History.debug('History.pushState: trigger popstate');
History.Adapter.trigger(window,"statechange");History.busy(false)}else{// Alias to PushState
History.pushState(newState.data,newState.title,newState.url,false)}// End replaceState closure
return true}}// History.emulated.pushState
// ====================================================================
// Initialise
// Non-Native pushState Implementation
if(History.emulated.pushState){/**
			 * Ensure initial state is handled correctly
			 */
if(History.getHash()&&!History.emulated.hashChange){History.Adapter.onDomLoad(function(){History.Adapter.trigger(window,"hashchange")})}}};// History.initHtml4
// Try to Initialise History
if(typeof History.init!=="undefined"){History.init()}})(window);/**
 * History.js Core
 * @author Benjamin Arthur Lupton <contact@balupton.com>
 * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
 * @license New BSD License <http://creativecommons.org/licenses/BSD/>
 */
(function(window,undefined){"use strict";// ========================================================================
// Initialise
// Localise Globals
var console=window.console||undefined,// Prevent a JSLint complain
document=window.document,// Make sure we are using the correct document
navigator=window.navigator,// Make sure we are using the correct navigator
sessionStorage=window.sessionStorage||false,// sessionStorage
setTimeout=window.setTimeout,clearTimeout=window.clearTimeout,setInterval=window.setInterval,clearInterval=window.clearInterval,JSON=window.JSON,alert=window.alert,History=window.History=window.History||{},// Public History Object
history=window.history;// Old History Object
try{sessionStorage.setItem("TEST","1");sessionStorage.removeItem("TEST")}catch(e){sessionStorage=false}// MooTools Compatibility
JSON.stringify=JSON.stringify||JSON.encode;JSON.parse=JSON.parse||JSON.decode;// Check Existence
if(typeof History.init!=="undefined"){throw new Error("History.js Core has already been loaded...")}// Initialise History
History.init=function(options){// Check Load Status of Adapter
if(typeof History.Adapter==="undefined"){return false}// Check Load Status of Core
if(typeof History.initCore!=="undefined"){History.initCore()}// Check Load Status of HTML4 Support
if(typeof History.initHtml4!=="undefined"){History.initHtml4()}// Return true
return true};// ========================================================================
// Initialise Core
// Initialise Core
History.initCore=function(options){// Initialise
if(typeof History.initCore.initialized!=="undefined"){// Already Loaded
return false}else{History.initCore.initialized=true}// ====================================================================
// Options
/**
		 * History.options
		 * Configurable options
		 */
History.options=History.options||{};/**
		 * History.options.hashChangeInterval
		 * How long should the interval be before hashchange checks
		 */
History.options.hashChangeInterval=History.options.hashChangeInterval||100;/**
		 * History.options.safariPollInterval
		 * How long should the interval be before safari poll checks
		 */
History.options.safariPollInterval=History.options.safariPollInterval||500;/**
		 * History.options.doubleCheckInterval
		 * How long should the interval be before we perform a double check
		 */
History.options.doubleCheckInterval=History.options.doubleCheckInterval||500;/**
		 * History.options.disableSuid
		 * Force History not to append suid
		 */
History.options.disableSuid=History.options.disableSuid||false;/**
		 * History.options.storeInterval
		 * How long should we wait between store calls
		 */
History.options.storeInterval=History.options.storeInterval||1e3;/**
		 * History.options.busyDelay
		 * How long should we wait between busy events
		 */
History.options.busyDelay=History.options.busyDelay||250;/**
		 * History.options.debug
		 * If true will enable debug messages to be logged
		 */
History.options.debug=History.options.debug||false;/**
		 * History.options.initialTitle
		 * What is the title of the initial state
		 */
History.options.initialTitle=History.options.initialTitle||document.title;/**
		 * History.options.html4Mode
		 * If true, will force HTMl4 mode (hashtags)
		 */
History.options.html4Mode=History.options.html4Mode||false;/**
		 * History.options.delayInit
		 * Want to override default options and call init manually.
		 */
History.options.delayInit=History.options.delayInit||false;// ====================================================================
// Interval record
/**
		 * History.intervalList
		 * List of intervals set, to be cleared when document is unloaded.
		 */
History.intervalList=[];/**
		 * History.clearAllIntervals
		 * Clears all setInterval instances.
		 */
History.clearAllIntervals=function(){var i,il=History.intervalList;if(typeof il!=="undefined"&&il!==null){for(i=0;i<il.length;i++){clearInterval(il[i])}History.intervalList=null}};// ====================================================================
// Debug
/**
		 * History.debug(message,...)
		 * Logs the passed arguments if debug enabled
		 */
History.debug=function(){if(History.options.debug||false){History.log.apply(History,arguments)}};/**
		 * History.log(message,...)
		 * Logs the passed arguments
		 */
History.log=function(){// Prepare
var consoleExists=!(typeof console==="undefined"||typeof console.log==="undefined"||typeof console.log.apply==="undefined"),textarea=document.getElementById("log"),message,i,n,args,arg;// Write to Console
if(consoleExists){args=Array.prototype.slice.call(arguments);message=args.shift();if(typeof console.debug!=="undefined"){console.debug.apply(console,[message,args])}else{console.log.apply(console,[message,args])}}else{message="\n"+arguments[0]+"\n"}// Write to log
for(i=1,n=arguments.length;i<n;++i){arg=arguments[i];if(typeof arg==="object"&&typeof JSON!=="undefined"){try{arg=JSON.stringify(arg)}catch(Exception){}}message+="\n"+arg+"\n"}// Textarea
if(textarea){textarea.value+=message+"\n-----\n";textarea.scrollTop=textarea.scrollHeight-textarea.clientHeight}else if(!consoleExists){alert(message)}// Return true
return true};// ====================================================================
// Emulated Status
/**
		 * History.getInternetExplorerMajorVersion()
		 * Get's the major version of Internet Explorer
		 * @return {integer}
		 * @license Public Domain
		 * @author Benjamin Arthur Lupton <contact@balupton.com>
		 * @author James Padolsey <https://gist.github.com/527683>
		 */
History.getInternetExplorerMajorVersion=function(){var result=History.getInternetExplorerMajorVersion.cached=typeof History.getInternetExplorerMajorVersion.cached!=="undefined"?History.getInternetExplorerMajorVersion.cached:function(){var v=3,div=document.createElement("div"),all=div.getElementsByTagName("i");while((div.innerHTML="<!--[if gt IE "+ ++v+"]><i></i><![endif]-->")&&all[0]){}return v>4?v:false}();return result};/**
		 * History.isInternetExplorer()
		 * Are we using Internet Explorer?
		 * @return {boolean}
		 * @license Public Domain
		 * @author Benjamin Arthur Lupton <contact@balupton.com>
		 */
History.isInternetExplorer=function(){var result=History.isInternetExplorer.cached=typeof History.isInternetExplorer.cached!=="undefined"?History.isInternetExplorer.cached:Boolean(History.getInternetExplorerMajorVersion());return result};/**
		 * History.emulated
		 * Which features require emulating?
		 */
if(History.options.html4Mode){History.emulated={pushState:true,hashChange:true}}else{History.emulated={pushState:!Boolean(window.history&&window.history.pushState&&window.history.replaceState&&!(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(navigator.userAgent)||/AppleWebKit\/5([0-2]|3[0-2])/i.test(navigator.userAgent))),hashChange:Boolean(!("onhashchange"in window||"onhashchange"in document)||History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8)}}/**
		 * History.enabled
		 * Is History enabled?
		 */
History.enabled=!History.emulated.pushState;/**
		 * History.bugs
		 * Which bugs are present
		 */
History.bugs={/**
			 * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
			 * https://bugs.webkit.org/show_bug.cgi?id=56249
			 */
setHash:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),/**
			 * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
			 * https://bugs.webkit.org/show_bug.cgi?id=42940
			 */
safariPoll:Boolean(!History.emulated.pushState&&navigator.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),/**
			 * MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
			 */
ieDoubleCheck:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<8),/**
			 * MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event
			 */
hashEscape:Boolean(History.isInternetExplorer()&&History.getInternetExplorerMajorVersion()<7)};/**
		 * History.isEmptyObject(obj)
		 * Checks to see if the Object is Empty
		 * @param {Object} obj
		 * @return {boolean}
		 */
History.isEmptyObject=function(obj){for(var name in obj){if(obj.hasOwnProperty(name)){return false}}return true};/**
		 * History.cloneObject(obj)
		 * Clones a object and eliminate all references to the original contexts
		 * @param {Object} obj
		 * @return {Object}
		 */
History.cloneObject=function(obj){var hash,newObj;if(obj){hash=JSON.stringify(obj);newObj=JSON.parse(hash)}else{newObj={}}return newObj};// ====================================================================
// URL Helpers
/**
		 * History.getRootUrl()
		 * Turns "http://mysite.com/dir/page.html?asd" into "http://mysite.com"
		 * @return {String} rootUrl
		 */
History.getRootUrl=function(){// Create
var rootUrl=document.location.protocol+"//"+(document.location.hostname||document.location.host);if(document.location.port||false){rootUrl+=":"+document.location.port}rootUrl+="/";// Return
return rootUrl};/**
		 * History.getBaseHref()
		 * Fetches the `href` attribute of the `<base href="...">` element if it exists
		 * @return {String} baseHref
		 */
History.getBaseHref=function(){// Create
var baseElements=document.getElementsByTagName("base"),baseElement=null,baseHref="";// Test for Base Element
if(baseElements.length===1){// Prepare for Base Element
baseElement=baseElements[0];baseHref=baseElement.href.replace(/[^\/]+$/,"")}// Adjust trailing slash
baseHref=baseHref.replace(/\/+$/,"");if(baseHref)baseHref+="/";// Return
return baseHref};/**
		 * History.getBaseUrl()
		 * Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)
		 * @return {String} baseUrl
		 */
History.getBaseUrl=function(){// Create
var baseUrl=History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();// Return
return baseUrl};/**
		 * History.getPageUrl()
		 * Fetches the URL of the current page
		 * @return {String} pageUrl
		 */
History.getPageUrl=function(){// Fetch
var State=History.getState(false,false),stateUrl=(State||{}).url||History.getLocationHref(),pageUrl;// Create
pageUrl=stateUrl.replace(/\/+$/,"").replace(/[^\/]+$/,function(part,index,string){return/\./.test(part)?part:part+"/"});// Return
return pageUrl};/**
		 * History.getBasePageUrl()
		 * Fetches the Url of the directory of the current page
		 * @return {String} basePageUrl
		 */
History.getBasePageUrl=function(){// Create
var basePageUrl=History.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(part,index,string){return/[^\/]$/.test(part)?"":part}).replace(/\/+$/,"")+"/";// Return
return basePageUrl};/**
		 * History.getFullUrl(url)
		 * Ensures that we have an absolute URL and not a relative URL
		 * @param {string} url
		 * @param {Boolean} allowBaseHref
		 * @return {string} fullUrl
		 */
History.getFullUrl=function(url,allowBaseHref){// Prepare
var fullUrl=url,firstChar=url.substring(0,1);allowBaseHref=typeof allowBaseHref==="undefined"?true:allowBaseHref;// Check
if(/[a-z]+\:\/\//.test(url)){}else if(firstChar==="/"){// Root URL
fullUrl=History.getRootUrl()+url.replace(/^\/+/,"")}else if(firstChar==="#"){// Anchor URL
fullUrl=History.getPageUrl().replace(/#.*/,"")+url}else if(firstChar==="?"){// Query URL
fullUrl=History.getPageUrl().replace(/[\?#].*/,"")+url}else{// Relative URL
if(allowBaseHref){fullUrl=History.getBaseUrl()+url.replace(/^(\.\/)+/,"")}else{fullUrl=History.getBasePageUrl()+url.replace(/^(\.\/)+/,"")}}// Return
return fullUrl.replace(/\#$/,"")};/**
		 * History.getShortUrl(url)
		 * Ensures that we have a relative URL and not a absolute URL
		 * @param {string} url
		 * @return {string} url
		 */
History.getShortUrl=function(url){// Prepare
var shortUrl=url,baseUrl=History.getBaseUrl(),rootUrl=History.getRootUrl();// Trim baseUrl
if(History.emulated.pushState){// We are in a if statement as when pushState is not emulated
// The actual url these short urls are relative to can change
// So within the same session, we the url may end up somewhere different
shortUrl=shortUrl.replace(baseUrl,"")}// Trim rootUrl
shortUrl=shortUrl.replace(rootUrl,"/");// Ensure we can still detect it as a state
if(History.isTraditionalAnchor(shortUrl)){shortUrl="./"+shortUrl}// Clean It
shortUrl=shortUrl.replace(/^(\.\/)+/g,"./").replace(/\#$/,"");// Return
return shortUrl};/**
		 * History.getLocationHref(document)
		 * Returns a normalized version of document.location.href
		 * accounting for browser inconsistencies, etc.
		 *
		 * This URL will be URI-encoded and will include the hash
		 *
		 * @param {object} document
		 * @return {string} url
		 */
History.getLocationHref=function(doc){doc=doc||document;// most of the time, this will be true
if(doc.URL===doc.location.href)return doc.location.href;// some versions of webkit URI-decode document.location.href
// but they leave document.URL in an encoded state
if(doc.location.href===decodeURIComponent(doc.URL))return doc.URL;// FF 3.6 only updates document.URL when a page is reloaded
// document.location.href is updated correctly
if(doc.location.hash&&decodeURIComponent(doc.location.href.replace(/^[^#]+/,""))===doc.location.hash)return doc.location.href;if(doc.URL.indexOf("#")==-1&&doc.location.href.indexOf("#")!=-1)return doc.location.href;return doc.URL||doc.location.href};// ====================================================================
// State Storage
/**
		 * History.store
		 * The store for all session specific data
		 */
History.store={};/**
		 * History.idToState
		 * 1-1: State ID to State Object
		 */
History.idToState=History.idToState||{};/**
		 * History.stateToId
		 * 1-1: State String to State ID
		 */
History.stateToId=History.stateToId||{};/**
		 * History.urlToId
		 * 1-1: State URL to State ID
		 */
History.urlToId=History.urlToId||{};/**
		 * History.storedStates
		 * Store the states in an array
		 */
History.storedStates=History.storedStates||[];/**
		 * History.savedStates
		 * Saved the states in an array
		 */
History.savedStates=History.savedStates||[];/**
		 * History.noramlizeStore()
		 * Noramlize the store by adding necessary values
		 */
History.normalizeStore=function(){History.store.idToState=History.store.idToState||{};History.store.urlToId=History.store.urlToId||{};History.store.stateToId=History.store.stateToId||{}};/**
		 * History.getState()
		 * Get an object containing the data, title and url of the current state
		 * @param {Boolean} friendly
		 * @param {Boolean} create
		 * @return {Object} State
		 */
History.getState=function(friendly,create){// Prepare
if(typeof friendly==="undefined"){friendly=true}if(typeof create==="undefined"){create=true}// Fetch
var State=History.getLastSavedState();// Create
if(!State&&create){State=History.createStateObject()}// Adjust
if(friendly){State=History.cloneObject(State);State.url=State.cleanUrl||State.url}// Return
return State};/**
		 * History.getIdByState(State)
		 * Gets a ID for a State
		 * @param {State} newState
		 * @return {String} id
		 */
History.getIdByState=function(newState){// Fetch ID
var id=History.extractId(newState.url),str;if(!id){// Find ID via State String
str=History.getStateString(newState);if(typeof History.stateToId[str]!=="undefined"){id=History.stateToId[str]}else if(typeof History.store.stateToId[str]!=="undefined"){id=History.store.stateToId[str]}else{// Generate a new ID
while(true){id=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof History.idToState[id]==="undefined"&&typeof History.store.idToState[id]==="undefined"){break}}// Apply the new State to the ID
History.stateToId[str]=id;History.idToState[id]=newState}}// Return ID
return id};/**
		 * History.normalizeState(State)
		 * Expands a State Object
		 * @param {object} State
		 * @return {object}
		 */
History.normalizeState=function(oldState){// Variables
var newState,dataNotEmpty;// Prepare
if(!oldState||typeof oldState!=="object"){oldState={}}// Check
if(typeof oldState.normalized!=="undefined"){return oldState}// Adjust
if(!oldState.data||typeof oldState.data!=="object"){oldState.data={}}// ----------------------------------------------------------------
// Create
newState={};newState.normalized=true;newState.title=oldState.title||"";newState.url=History.getFullUrl(oldState.url?oldState.url:History.getLocationHref());newState.hash=History.getShortUrl(newState.url);newState.data=History.cloneObject(oldState.data);// Fetch ID
newState.id=History.getIdByState(newState);// ----------------------------------------------------------------
// Clean the URL
newState.cleanUrl=newState.url.replace(/\??\&_suid.*/,"");newState.url=newState.cleanUrl;// Check to see if we have more than just a url
dataNotEmpty=!History.isEmptyObject(newState.data);// Apply
if((newState.title||dataNotEmpty)&&History.options.disableSuid!==true){// Add ID to Hash
newState.hash=History.getShortUrl(newState.url).replace(/\??\&_suid.*/,"");if(!/\?/.test(newState.hash)){newState.hash+="?"}newState.hash+="&_suid="+newState.id}// Create the Hashed URL
newState.hashedUrl=History.getFullUrl(newState.hash);// ----------------------------------------------------------------
// Update the URL if we have a duplicate
if((History.emulated.pushState||History.bugs.safariPoll)&&History.hasUrlDuplicate(newState)){newState.url=newState.hashedUrl}// ----------------------------------------------------------------
// Return
return newState};/**
		 * History.createStateObject(data,title,url)
		 * Creates a object based on the data, title and url state params
		 * @param {object} data
		 * @param {string} title
		 * @param {string} url
		 * @return {object}
		 */
History.createStateObject=function(data,title,url){// Hashify
var State={data:data,title:title,url:url};// Expand the State
State=History.normalizeState(State);// Return object
return State};/**
		 * History.getStateById(id)
		 * Get a state by it's UID
		 * @param {String} id
		 */
History.getStateById=function(id){// Prepare
id=String(id);// Retrieve
var State=History.idToState[id]||History.store.idToState[id]||undefined;// Return State
return State};/**
		 * Get a State's String
		 * @param {State} passedState
		 */
History.getStateString=function(passedState){// Prepare
var State,cleanedState,str;// Fetch
State=History.normalizeState(passedState);// Clean
cleanedState={data:State.data,title:passedState.title,url:passedState.url};// Fetch
str=JSON.stringify(cleanedState);// Return
return str};/**
		 * Get a State's ID
		 * @param {State} passedState
		 * @return {String} id
		 */
History.getStateId=function(passedState){// Prepare
var State,id;// Fetch
State=History.normalizeState(passedState);// Fetch
id=State.id;// Return
return id};/**
		 * History.getHashByState(State)
		 * Creates a Hash for the State Object
		 * @param {State} passedState
		 * @return {String} hash
		 */
History.getHashByState=function(passedState){// Prepare
var State,hash;// Fetch
State=History.normalizeState(passedState);// Hash
hash=State.hash;// Return
return hash};/**
		 * History.extractId(url_or_hash)
		 * Get a State ID by it's URL or Hash
		 * @param {string} url_or_hash
		 * @return {string} id
		 */
History.extractId=function(url_or_hash){// Prepare
var id,parts,url,tmp;// Extract
// If the URL has a #, use the id from before the #
if(url_or_hash.indexOf("#")!=-1){tmp=url_or_hash.split("#")[0]}else{tmp=url_or_hash}parts=/(.*)\&_suid=([0-9]+)$/.exec(tmp);url=parts?parts[1]||url_or_hash:url_or_hash;id=parts?String(parts[2]||""):"";// Return
return id||false};/**
		 * History.isTraditionalAnchor
		 * Checks to see if the url is a traditional anchor or not
		 * @param {String} url_or_hash
		 * @return {Boolean}
		 */
History.isTraditionalAnchor=function(url_or_hash){// Check
var isTraditional=!/[\/\?\.]/.test(url_or_hash);// Return
return isTraditional};/**
		 * History.extractState
		 * Get a State by it's URL or Hash
		 * @param {String} url_or_hash
		 * @return {State|null}
		 */
History.extractState=function(url_or_hash,create){// Prepare
var State=null,id,url;create=create||false;// Fetch SUID
id=History.extractId(url_or_hash);if(id){State=History.getStateById(id)}// Fetch SUID returned no State
if(!State){// Fetch URL
url=History.getFullUrl(url_or_hash);// Check URL
id=History.getIdByUrl(url)||false;if(id){State=History.getStateById(id)}// Create State
if(!State&&create&&!History.isTraditionalAnchor(url_or_hash)){State=History.createStateObject(null,null,url)}}// Return
return State};/**
		 * History.getIdByUrl()
		 * Get a State ID by a State URL
		 */
History.getIdByUrl=function(url){// Fetch
var id=History.urlToId[url]||History.store.urlToId[url]||undefined;// Return
return id};/**
		 * History.getLastSavedState()
		 * Get an object containing the data, title and url of the current state
		 * @return {Object} State
		 */
History.getLastSavedState=function(){return History.savedStates[History.savedStates.length-1]||undefined};/**
		 * History.getLastStoredState()
		 * Get an object containing the data, title and url of the current state
		 * @return {Object} State
		 */
History.getLastStoredState=function(){return History.storedStates[History.storedStates.length-1]||undefined};/**
		 * History.hasUrlDuplicate
		 * Checks if a Url will have a url conflict
		 * @param {Object} newState
		 * @return {Boolean} hasDuplicate
		 */
History.hasUrlDuplicate=function(newState){// Prepare
var hasDuplicate=false,oldState;// Fetch
oldState=History.extractState(newState.url);// Check
hasDuplicate=oldState&&oldState.id!==newState.id;// Return
return hasDuplicate};/**
		 * History.storeState
		 * Store a State
		 * @param {Object} newState
		 * @return {Object} newState
		 */
History.storeState=function(newState){// Store the State
History.urlToId[newState.url]=newState.id;// Push the State
History.storedStates.push(History.cloneObject(newState));// Return newState
return newState};/**
		 * History.isLastSavedState(newState)
		 * Tests to see if the state is the last state
		 * @param {Object} newState
		 * @return {boolean} isLast
		 */
History.isLastSavedState=function(newState){// Prepare
var isLast=false,newId,oldState,oldId;// Check
if(History.savedStates.length){newId=newState.id;oldState=History.getLastSavedState();oldId=oldState.id;// Check
isLast=newId===oldId}// Return
return isLast};/**
		 * History.saveState
		 * Push a State
		 * @param {Object} newState
		 * @return {boolean} changed
		 */
History.saveState=function(newState){// Check Hash
if(History.isLastSavedState(newState)){return false}// Push the State
History.savedStates.push(History.cloneObject(newState));// Return true
return true};/**
		 * History.getStateByIndex()
		 * Gets a state by the index
		 * @param {integer} index
		 * @return {Object}
		 */
History.getStateByIndex=function(index){// Prepare
var State=null;// Handle
if(typeof index==="undefined"){// Get the last inserted
State=History.savedStates[History.savedStates.length-1]}else if(index<0){// Get from the end
State=History.savedStates[History.savedStates.length+index]}else{// Get from the beginning
State=History.savedStates[index]}// Return State
return State};/**
		 * History.getCurrentIndex()
		 * Gets the current index
		 * @return (integer)
		*/
History.getCurrentIndex=function(){// Prepare
var index=null;// No states saved
if(History.savedStates.length<1){index=0}else{index=History.savedStates.length-1}return index};// ====================================================================
// Hash Helpers
/**
		 * History.getHash()
		 * @param {Location=} location
		 * Gets the current document hash
		 * Note: unlike location.hash, this is guaranteed to return the escaped hash in all browsers
		 * @return {string}
		 */
History.getHash=function(doc){var url=History.getLocationHref(doc),hash;hash=History.getHashByUrl(url);return hash};/**
		 * History.unescapeHash()
		 * normalize and Unescape a Hash
		 * @param {String} hash
		 * @return {string}
		 */
History.unescapeHash=function(hash){// Prepare
var result=History.normalizeHash(hash);// Unescape hash
result=decodeURIComponent(result);// Return result
return result};/**
		 * History.normalizeHash()
		 * normalize a hash across browsers
		 * @return {string}
		 */
History.normalizeHash=function(hash){// Prepare
var result=hash.replace(/[^#]*#/,"").replace(/#.*/,"");// Return result
return result};/**
		 * History.setHash(hash)
		 * Sets the document hash
		 * @param {string} hash
		 * @return {History}
		 */
History.setHash=function(hash,queue){// Prepare
var State,pageUrl;// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.setHash: we must wait', arguments);
History.pushQueue({scope:History,callback:History.setHash,args:arguments,queue:queue});return false}// Log
//History.debug('History.setHash: called',hash);
// Make Busy + Continue
History.busy(true);// Check if hash is a state
State=History.extractState(hash,true);if(State&&!History.emulated.pushState){// Hash is a state so skip the setHash
//History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);
// PushState
History.pushState(State.data,State.title,State.url,false)}else if(History.getHash()!==hash){// Hash is a proper hash, so apply it
// Handle browser bugs
if(History.bugs.setHash){// Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249
// Fetch the base page
pageUrl=History.getPageUrl();// Safari hash apply
History.pushState(null,null,pageUrl+"#"+hash,false)}else{// Normal hash apply
document.location.hash=hash}}// Chain
return History};/**
		 * History.escape()
		 * normalize and Escape a Hash
		 * @return {string}
		 */
History.escapeHash=function(hash){// Prepare
var result=History.normalizeHash(hash);// Escape hash
result=window.encodeURIComponent(result);// IE6 Escape Bug
if(!History.bugs.hashEscape){// Restore common parts
result=result.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")}// Return result
return result};/**
		 * History.getHashByUrl(url)
		 * Extracts the Hash from a URL
		 * @param {string} url
		 * @return {string} url
		 */
History.getHashByUrl=function(url){// Extract the hash
var hash=String(url).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");// Unescape hash
hash=History.unescapeHash(hash);// Return hash
return hash};/**
		 * History.setTitle(title)
		 * Applies the title to the document
		 * @param {State} newState
		 * @return {Boolean}
		 */
History.setTitle=function(newState){// Prepare
var title=newState.title,firstState;// Initial
if(!title){firstState=History.getStateByIndex(0);if(firstState&&firstState.url===newState.url){title=firstState.title||History.options.initialTitle}}// Apply
try{document.getElementsByTagName("title")[0].innerHTML=title.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(Exception){}document.title=title;// Chain
return History};// ====================================================================
// Queueing
/**
		 * History.queues
		 * The list of queues to use
		 * First In, First Out
		 */
History.queues=[];/**
		 * History.busy(value)
		 * @param {boolean} value [optional]
		 * @return {boolean} busy
		 */
History.busy=function(value){// Apply
if(typeof value!=="undefined"){//History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);
History.busy.flag=value}else if(typeof History.busy.flag==="undefined"){History.busy.flag=false}// Queue
if(!History.busy.flag){// Execute the next item in the queue
clearTimeout(History.busy.timeout);var fireNext=function(){var i,queue,item;if(History.busy.flag)return;for(i=History.queues.length-1;i>=0;--i){queue=History.queues[i];if(queue.length===0)continue;item=queue.shift();History.fireQueueItem(item);History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}};History.busy.timeout=setTimeout(fireNext,History.options.busyDelay)}// Return
return History.busy.flag};/**
		 * History.busy.flag
		 */
History.busy.flag=false;/**
		 * History.fireQueueItem(item)
		 * Fire a Queue Item
		 * @param {Object} item
		 * @return {Mixed} result
		 */
History.fireQueueItem=function(item){return item.callback.apply(item.scope||History,item.args||[])};/**
		 * History.pushQueue(callback,args)
		 * Add an item to the queue
		 * @param {Object} item [scope,callback,args,queue]
		 */
History.pushQueue=function(item){// Prepare the queue
History.queues[item.queue||0]=History.queues[item.queue||0]||[];// Add to the queue
History.queues[item.queue||0].push(item);// Chain
return History};/**
		 * History.queue (item,queue), (func,queue), (func), (item)
		 * Either firs the item now if not busy, or adds it to the queue
		 */
History.queue=function(item,queue){// Prepare
if(typeof item==="function"){item={callback:item}}if(typeof queue!=="undefined"){item.queue=queue}// Handle
if(History.busy()){History.pushQueue(item)}else{History.fireQueueItem(item)}// Chain
return History};/**
		 * History.clearQueue()
		 * Clears the Queue
		 */
History.clearQueue=function(){History.busy.flag=false;History.queues=[];return History};// ====================================================================
// IE Bug Fix
/**
		 * History.stateChanged
		 * States whether or not the state has changed since the last double check was initialised
		 */
History.stateChanged=false;/**
		 * History.doubleChecker
		 * Contains the timeout used for the double checks
		 */
History.doubleChecker=false;/**
		 * History.doubleCheckComplete()
		 * Complete a double check
		 * @return {History}
		 */
History.doubleCheckComplete=function(){// Update
History.stateChanged=true;// Clear
History.doubleCheckClear();// Chain
return History};/**
		 * History.doubleCheckClear()
		 * Clear a double check
		 * @return {History}
		 */
History.doubleCheckClear=function(){// Clear
if(History.doubleChecker){clearTimeout(History.doubleChecker);History.doubleChecker=false}// Chain
return History};/**
		 * History.doubleCheck()
		 * Create a double check
		 * @return {History}
		 */
History.doubleCheck=function(tryAgain){// Reset
History.stateChanged=false;History.doubleCheckClear();// Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)
// Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940
if(History.bugs.ieDoubleCheck){// Apply Check
History.doubleChecker=setTimeout(function(){History.doubleCheckClear();if(!History.stateChanged){//History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
// Re-Attempt
tryAgain()}return true},History.options.doubleCheckInterval)}// Chain
return History};// ====================================================================
// Safari Bug Fix
/**
		 * History.safariStatePoll()
		 * Poll the current state
		 * @return {History}
		 */
History.safariStatePoll=function(){// Poll the URL
// Get the Last State which has the new URL
var urlState=History.extractState(History.getLocationHref()),newState;// Check for a difference
if(!History.isLastSavedState(urlState)){newState=urlState}else{return}// Check if we have a state with that url
// If not create it
if(!newState){//History.debug('History.safariStatePoll: new');
newState=History.createStateObject()}// Apply the New State
//History.debug('History.safariStatePoll: trigger');
History.Adapter.trigger(window,"popstate");// Chain
return History};// ====================================================================
// State Aliases
/**
		 * History.back(queue)
		 * Send the browser history back one item
		 * @param {Integer} queue [optional]
		 */
History.back=function(queue){//History.debug('History.back: called', arguments);
// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.back: we must wait', arguments);
History.pushQueue({scope:History,callback:History.back,args:arguments,queue:queue});return false}// Make Busy + Continue
History.busy(true);// Fix certain browser bugs that prevent the state from changing
History.doubleCheck(function(){History.back(false)});// Go back
history.go(-1);// End back closure
return true};/**
		 * History.forward(queue)
		 * Send the browser history forward one item
		 * @param {Integer} queue [optional]
		 */
History.forward=function(queue){//History.debug('History.forward: called', arguments);
// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.forward: we must wait', arguments);
History.pushQueue({scope:History,callback:History.forward,args:arguments,queue:queue});return false}// Make Busy + Continue
History.busy(true);// Fix certain browser bugs that prevent the state from changing
History.doubleCheck(function(){History.forward(false)});// Go forward
history.go(1);// End forward closure
return true};/**
		 * History.go(index,queue)
		 * Send the browser history back or forward index times
		 * @param {Integer} queue [optional]
		 */
History.go=function(index,queue){//History.debug('History.go: called', arguments);
// Prepare
var i;// Handle
if(index>0){// Forward
for(i=1;i<=index;++i){History.forward(queue)}}else if(index<0){// Backward
for(i=-1;i>=index;--i){History.back(queue)}}else{throw new Error("History.go: History.go requires a positive or negative integer passed.")}// Chain
return History};// ====================================================================
// HTML5 State Support
// Non-Native pushState Implementation
if(History.emulated.pushState){/*
			 * Provide Skeleton for HTML4 Browsers
			 */
// Prepare
var emptyFunction=function(){};History.pushState=History.pushState||emptyFunction;History.replaceState=History.replaceState||emptyFunction}else{/*
			 * Use native HTML5 History API Implementation
			 */
/**
			 * History.onPopState(event,extra)
			 * Refresh the Current State
			 */
History.onPopState=function(event,extra){// Prepare
var stateId=false,newState=false,currentHash,currentState;// Reset the double check
History.doubleCheckComplete();// Check for a Hash, and handle apporiatly
currentHash=History.getHash();if(currentHash){// Expand Hash
currentState=History.extractState(currentHash||History.getLocationHref(),true);if(currentState){// We were able to parse it, it must be a State!
// Let's forward to replaceState
//History.debug('History.onPopState: state anchor', currentHash, currentState);
History.replaceState(currentState.data,currentState.title,currentState.url,false)}else{// Traditional Anchor
//History.debug('History.onPopState: traditional anchor', currentHash);
History.Adapter.trigger(window,"anchorchange");History.busy(false)}// We don't care for hashes
History.expectedStateId=false;return false}// Ensure
stateId=History.Adapter.extractEventData("state",event,extra)||false;// Fetch State
if(stateId){// Vanilla: Back/forward button was used
newState=History.getStateById(stateId)}else if(History.expectedStateId){// Vanilla: A new state was pushed, and popstate was called manually
newState=History.getStateById(History.expectedStateId)}else{// Initial State
newState=History.extractState(History.getLocationHref())}// The State did not exist in our store
if(!newState){// Regenerate the State
newState=History.createStateObject(null,null,History.getLocationHref())}// Clean
History.expectedStateId=false;// Check if we are the same state
if(History.isLastSavedState(newState)){// There has been no change (just the page's hash has finally propagated)
//History.debug('History.onPopState: no change', newState, History.savedStates);
History.busy(false);return false}// Store the State
History.storeState(newState);History.saveState(newState);// Force update of the title
History.setTitle(newState);// Fire Our Event
History.Adapter.trigger(window,"statechange");History.busy(false);// Return true
return true};History.Adapter.bind(window,"popstate",History.onPopState);/**
			 * History.pushState(data,title,url)
			 * Add a new State to the history object, become it, and trigger onpopstate
			 * We have to trigger for HTML4 compatibility
			 * @param {object} data
			 * @param {string} title
			 * @param {string} url
			 * @return {true}
			 */
History.pushState=function(data,title,url,queue){//History.debug('History.pushState: called', arguments);
// Check the State
if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.pushState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.pushState,args:arguments,queue:queue});return false}// Make Busy + Continue
History.busy(true);// Create the newState
var newState=History.createStateObject(data,title,url);// Check it
if(History.isLastSavedState(newState)){// Won't be a change
History.busy(false)}else{// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;// Push the newState
history.pushState(newState.id,newState.title,newState.url);// Fire HTML5 Event
History.Adapter.trigger(window,"popstate")}// End pushState closure
return true};/**
			 * History.replaceState(data,title,url)
			 * Replace the State and trigger onpopstate
			 * We have to trigger for HTML4 compatibility
			 * @param {object} data
			 * @param {string} title
			 * @param {string} url
			 * @return {true}
			 */
History.replaceState=function(data,title,url,queue){//History.debug('History.replaceState: called', arguments);
// Check the State
if(History.getHashByUrl(url)&&History.emulated.pushState){throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).")}// Handle Queueing
if(queue!==false&&History.busy()){// Wait + Push to Queue
//History.debug('History.replaceState: we must wait', arguments);
History.pushQueue({scope:History,callback:History.replaceState,args:arguments,queue:queue});return false}// Make Busy + Continue
History.busy(true);// Create the newState
var newState=History.createStateObject(data,title,url);// Check it
if(History.isLastSavedState(newState)){// Won't be a change
History.busy(false)}else{// Store the newState
History.storeState(newState);History.expectedStateId=newState.id;// Push the newState
history.replaceState(newState.id,newState.title,newState.url);// Fire HTML5 Event
History.Adapter.trigger(window,"popstate")}// End replaceState closure
return true}}// !History.emulated.pushState
// ====================================================================
// Initialise
/**
		 * Load the Store
		 */
if(sessionStorage){// Fetch
try{History.store=JSON.parse(sessionStorage.getItem("History.store"))||{}}catch(err){History.store={}}// Normalize
History.normalizeStore()}else{// Default Load
History.store={};History.normalizeStore()}/**
		 * Clear Intervals on exit to prevent memory leaks
		 */
History.Adapter.bind(window,"unload",History.clearAllIntervals);/**
		 * Create the initial State
		 */
History.saveState(History.storeState(History.extractState(History.getLocationHref(),true)));/**
		 * Bind for Saving Store
		 */
if(sessionStorage){// When the page is closed
History.onUnload=function(){// Prepare
var currentStore,item,currentStoreString;// Fetch
try{currentStore=JSON.parse(sessionStorage.getItem("History.store"))||{}}catch(err){currentStore={}}// Ensure
currentStore.idToState=currentStore.idToState||{};currentStore.urlToId=currentStore.urlToId||{};currentStore.stateToId=currentStore.stateToId||{};// Sync
for(item in History.idToState){if(!History.idToState.hasOwnProperty(item)){continue}currentStore.idToState[item]=History.idToState[item]}for(item in History.urlToId){if(!History.urlToId.hasOwnProperty(item)){continue}currentStore.urlToId[item]=History.urlToId[item]}for(item in History.stateToId){if(!History.stateToId.hasOwnProperty(item)){continue}currentStore.stateToId[item]=History.stateToId[item]}// Update
History.store=currentStore;History.normalizeStore();// In Safari, going into Private Browsing mode causes the
// Session Storage object to still exist but if you try and use
// or set any property/function of it it throws the exception
// "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to
// add something to storage that exceeded the quota." infinitely
// every second.
currentStoreString=JSON.stringify(currentStore);try{// Store
sessionStorage.setItem("History.store",currentStoreString)}catch(e){if(e.code===DOMException.QUOTA_EXCEEDED_ERR){if(sessionStorage.length){// Workaround for a bug seen on iPads. Sometimes the quota exceeded error comes up and simply
// removing/resetting the storage can work.
sessionStorage.removeItem("History.store");sessionStorage.setItem("History.store",currentStoreString)}else{}}else{throw e}}};// For Internet Explorer
History.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));// For Other Browsers
History.Adapter.bind(window,"beforeunload",History.onUnload);History.Adapter.bind(window,"unload",History.onUnload)}// Non-Native pushState Implementation
if(!History.emulated.pushState){// Be aware, the following is only for native pushState implementations
// If you are wanting to include something for all browsers
// Then include it above this if block
/**
			 * Setup Safari Fix
			 */
if(History.bugs.safariPoll){History.intervalList.push(setInterval(History.safariStatePoll,History.options.safariPollInterval))}/**
			 * Ensure Cross Browser Compatibility
			 */
if(navigator.vendor==="Apple Computer, Inc."||(navigator.appCodeName||"")==="Mozilla"){/**
				 * Fix Safari HashChange Issue
				 */
// Setup Alias
History.Adapter.bind(window,"hashchange",function(){History.Adapter.trigger(window,"popstate")});// Initialise Alias
if(History.getHash()){History.Adapter.onDomLoad(function(){History.Adapter.trigger(window,"hashchange")})}}}};// History.initCore
// Try to Initialise History
if(!History.options||!History.options.delayInit){History.init()}})(window);/*
* @fileOverview TouchSwipe - jQuery Plugin
* @version 1.6.6
*
* @author Matt Bryson http://www.github.com/mattbryson
* @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
* @see http://labs.skinkers.com/touchSwipe/
* @see http://plugins.jquery.com/project/touchSwipe
*
* Copyright (c) 2010 Matt Bryson
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
/*
*
* Changelog
* $Date: 2010-12-12 (Wed, 12 Dec 2010) $
* $version: 1.0.0
* $version: 1.0.1 - removed multibyte comments
*
* $Date: 2011-21-02 (Mon, 21 Feb 2011) $
* $version: 1.1.0 	- added allowPageScroll property to allow swiping and scrolling of page
*					- changed handler signatures so one handler can be used for multiple events
* $Date: 2011-23-02 (Wed, 23 Feb 2011) $
* $version: 1.2.0 	- added click handler. This is fired if the user simply clicks and does not swipe. The event object and click target are passed to handler.
*					- If you use the http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ plugin, you can also assign jQuery mouse events to children of a touchSwipe object.
* $version: 1.2.1 	- removed console log!
*
* $version: 1.2.2 	- Fixed bug where scope was not preserved in callback methods.
*
* $Date: 2011-28-04 (Thurs, 28 April 2011) $
* $version: 1.2.4 	- Changed licence terms to be MIT or GPL inline with jQuery. Added check for support of touch events to stop non compatible browsers erroring.
*
* $Date: 2011-27-09 (Tues, 27 September 2011) $
* $version: 1.2.5 	- Added support for testing swipes with mouse on desktop browser (thanks to https://github.com/joelhy)
*
* $Date: 2012-14-05 (Mon, 14 May 2012) $
* $version: 1.2.6 	- Added timeThreshold between start and end touch, so user can ignore slow swipes (thanks to Mark Chase). Default is null, all swipes are detected
*
* $Date: 2012-05-06 (Tues, 05 June 2012) $
* $version: 1.2.7 	- Changed time threshold to have null default for backwards compatibility. Added duration param passed back in events, and refactored how time is handled.
*
* $Date: 2012-05-06 (Tues, 05 June 2012) $
* $version: 1.2.8 	- Added the possibility to return a value like null or false in the trigger callback. In that way we can control when the touch start/move should take effect or not (simply by returning in some cases return null; or return false;) This effects the ontouchstart/ontouchmove event.
*
* $Date: 2012-06-06 (Wed, 06 June 2012) $
* $version: 1.3.0 	- Refactored whole plugin to allow for methods to be executed, as well as exposed defaults for user override. Added 'enable', 'disable', and 'destroy' methods
*
* $Date: 2012-05-06 (Fri, 05 June 2012) $
* $version: 1.3.1 	- Bug fixes  - bind() with false as last argument is no longer supported in jQuery 1.6, also, if you just click, the duration is now returned correctly.
*
* $Date: 2012-29-07 (Sun, 29 July 2012) $
* $version: 1.3.2	- Added fallbackToMouseEvents option to NOT capture mouse events on non touch devices.
* 			- Added "all" fingers value to the fingers property, so any combination of fingers triggers the swipe, allowing event handlers to check the finger count
*
* $Date: 2012-09-08 (Thurs, 9 Aug 2012) $
* $version: 1.3.3	- Code tidy prep for minefied version
*
* $Date: 2012-04-10 (wed, 4 Oct 2012) $
* $version: 1.4.0	- Added pinch support, pinchIn and pinchOut
*
* $Date: 2012-11-10 (Thurs, 11 Oct 2012) $
* $version: 1.5.0	- Added excludedElements, a jquery selector that specifies child elements that do NOT trigger swipes. By default, this is one select that removes all form, input select, button and anchor elements.
*
* $Date: 2012-22-10 (Mon, 22 Oct 2012) $
* $version: 1.5.1	- Fixed bug with jQuery 1.8 and trailing comma in excludedElements
*					- Fixed bug with IE and eventPreventDefault()
* $Date: 2013-01-12 (Fri, 12 Jan 2013) $
* $version: 1.6.0	- Fixed bugs with pinching, mainly when both pinch and swipe enabled, as well as adding time threshold for multifinger gestures, so releasing one finger beofre the other doesnt trigger as single finger gesture.
*					- made the demo site all static local HTML pages so they can be run locally by a developer
*					- added jsDoc comments and added documentation for the plugin	
*					- code tidy
*					- added triggerOnTouchLeave property that will end the event when the user swipes off the element.
* $Date: 2013-03-23 (Sat, 23 Mar 2013) $
* $version: 1.6.1	- Added support for ie8 touch events
* $version: 1.6.2	- Added support for events binding with on / off / bind in jQ for all callback names.
*                   - Deprecated the 'click' handler in favour of tap.
*                   - added cancelThreshold property
*                   - added option method to update init options at runtime
* $version 1.6.3    - added doubletap, longtap events and longTapThreshold, doubleTapThreshold property
*
* $Date: 2013-04-04 (Thurs, 04 April 2013) $
* $version 1.6.4    - Fixed bug with cancelThreshold introduced in 1.6.3, where swipe status no longer fired start event, and stopped once swiping back.
*
* $Date: 2013-08-24 (Sat, 24 Aug 2013) $
* $version 1.6.5    - Merged a few pull requests fixing various bugs, added AMD support.
*
* $Date: 2014-06-04 (Wed, 04 June 2014) $
* $version 1.6.6 	- Merge of pull requests.
*    				- IE10 touch support 
*    				- Only prevent default event handling on valid swipe
*    				- Separate license/changelog comment
*    				- Detect if the swipe is valid at the end of the touch event.
*    				- Pass fingerdata to event handlers. 
*    				- Add 'hold' gesture 
*    				- Be more tolerant about the tap distance
*    				- Typos and minor fixes
*/
/**
 * See (http://jquery.com/).
 * @name $
 * @class 
 * See the jQuery Library  (http://jquery.com/) for full details.  This just
 * documents the function and classes that are added to jQuery by this plug-in.
 */
/**
 * See (http://jquery.com/)
 * @name fn
 * @class 
 * See the jQuery Library  (http://jquery.com/) for full details.  This just
 * documents the function and classes that are added to jQuery by this plug-in.
 * @memberOf $
 */
(function(factory){if(typeof define==="function"&&define.amd&&define.amd.jQuery){// AMD. Register as anonymous module.
define(["jquery"],factory)}else{// Browser globals.
factory(jQuery)}})(function($){"use strict";//Constants
var LEFT="left",RIGHT="right",UP="up",DOWN="down",IN="in",OUT="out",NONE="none",AUTO="auto",SWIPE="swipe",PINCH="pinch",TAP="tap",DOUBLE_TAP="doubletap",LONG_TAP="longtap",HOLD="hold",HORIZONTAL="horizontal",VERTICAL="vertical",ALL_FINGERS="all",DOUBLE_TAP_THRESHOLD=10,PHASE_START="start",PHASE_MOVE="move",PHASE_END="end",PHASE_CANCEL="cancel",SUPPORTS_TOUCH="ontouchstart"in window,SUPPORTS_POINTER_IE10=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled,SUPPORTS_POINTER=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,PLUGIN_NS="TouchSwipe";/**
	* The default configuration, and available options to configure touch swipe with.
	* You can set the default values by updating any of the properties prior to instantiation.
	* @name $.fn.swipe.defaults
	* @namespace
	* @property {int} [fingers=1] The number of fingers to detect in a swipe. Any swipes that do not meet this requirement will NOT trigger swipe handlers.
	* @property {int} [threshold=75] The number of pixels that the user must move their finger by before it is considered a swipe. 
	* @property {int} [cancelThreshold=null] The number of pixels that the user must move their finger back from the original swipe direction to cancel the gesture.
	* @property {int} [pinchThreshold=20] The number of pixels that the user must pinch their finger by before it is considered a pinch. 
	* @property {int} [maxTimeThreshold=null] Time, in milliseconds, between touchStart and touchEnd must NOT exceed in order to be considered a swipe. 
	* @property {int} [fingerReleaseThreshold=250] Time in milliseconds between releasing multiple fingers.  If 2 fingers are down, and are released one after the other, if they are within this threshold, it counts as a simultaneous release. 
	* @property {int} [longTapThreshold=500] Time in milliseconds between tap and release for a long tap
	* @property {int} [doubleTapThreshold=200] Time in milliseconds between 2 taps to count as a double tap
	* @property {function} [swipe=null] A handler to catch all swipes. See {@link $.fn.swipe#event:swipe}
	* @property {function} [swipeLeft=null] A handler that is triggered for "left" swipes. See {@link $.fn.swipe#event:swipeLeft}
	* @property {function} [swipeRight=null] A handler that is triggered for "right" swipes. See {@link $.fn.swipe#event:swipeRight}
	* @property {function} [swipeUp=null] A handler that is triggered for "up" swipes. See {@link $.fn.swipe#event:swipeUp}
	* @property {function} [swipeDown=null] A handler that is triggered for "down" swipes. See {@link $.fn.swipe#event:swipeDown}
	* @property {function} [swipeStatus=null] A handler triggered for every phase of the swipe. See {@link $.fn.swipe#event:swipeStatus}
	* @property {function} [pinchIn=null] A handler triggered for pinch in events. See {@link $.fn.swipe#event:pinchIn}
	* @property {function} [pinchOut=null] A handler triggered for pinch out events. See {@link $.fn.swipe#event:pinchOut}
	* @property {function} [pinchStatus=null] A handler triggered for every phase of a pinch. See {@link $.fn.swipe#event:pinchStatus}
	* @property {function} [tap=null] A handler triggered when a user just taps on the item, rather than swipes it. If they do not move, tap is triggered, if they do move, it is not. 
	* @property {function} [doubleTap=null] A handler triggered when a user double taps on the item. The delay between taps can be set with the doubleTapThreshold property. See {@link $.fn.swipe.defaults#doubleTapThreshold}
	* @property {function} [longTap=null] A handler triggered when a user long taps on the item. The delay between start and end can be set with the longTapThreshold property. See {@link $.fn.swipe.defaults#longTapThreshold}
	* @property (function) [hold=null] A handler triggered when a user reaches longTapThreshold on the item. See {@link $.fn.swipe.defaults#longTapThreshold}
	* @property {boolean} [triggerOnTouchEnd=true] If true, the swipe events are triggered when the touch end event is received (user releases finger).  If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically. 
	* @property {boolean} [triggerOnTouchLeave=false] If true, then when the user leaves the swipe object, the swipe will end and trigger appropriate handlers. 
	* @property {string|undefined} [allowPageScroll='auto'] How the browser handles page scrolls when the user is swiping on a touchSwipe object. See {@link $.fn.swipe.pageScroll}.  <br/><br/>
										<code>"auto"</code> : all undefined swipes will cause the page to scroll in that direction. <br/>
										<code>"none"</code> : the page will not scroll when user swipes. <br/>
										<code>"horizontal"</code> : will force page to scroll on horizontal swipes. <br/>
										<code>"vertical"</code> : will force page to scroll on vertical swipes. <br/>
	* @property {boolean} [fallbackToMouseEvents=true] If true mouse events are used when run on a non touch device, false will stop swipes being triggered by mouse events on non tocuh devices. 
	* @property {string} [excludedElements="button, input, select, textarea, a, .noSwipe"] A jquery selector that specifies child elements that do NOT trigger swipes. By default this excludes all form, input, select, button, anchor and .noSwipe elements. 
	
	*/
var defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,//Deprecated since 1.6.2
tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe"};/**
	* Applies TouchSwipe behaviour to one or more jQuery objects.
	* The TouchSwipe plugin can be instantiated via this method, or methods within 
	* TouchSwipe can be executed via this method as per jQuery plugin architecture.
	* @see TouchSwipe
	* @class
	* @param {Mixed} method If the current DOMNode is a TouchSwipe object, and <code>method</code> is a TouchSwipe method, then
	* the <code>method</code> is executed, and any following arguments are passed to the TouchSwipe method.
	* If <code>method</code> is an object, then the TouchSwipe class is instantiated on the current DOMNode, passing the 
	* configuration properties defined in the object. See TouchSwipe
	*
	*/
$.fn.swipe=function(method){var $this=$(this),plugin=$this.data(PLUGIN_NS);//Check if we are already instantiated and trying to execute a method	
if(plugin&&typeof method==="string"){if(plugin[method]){return plugin[method].apply(this,Array.prototype.slice.call(arguments,1))}else{$.error("Method "+method+" does not exist on jQuery.swipe")}}else if(!plugin&&(typeof method==="object"||!method)){return init.apply(this,arguments)}return $this};//Expose our defaults so a user could override the plugin defaults
$.fn.swipe.defaults=defaults;/**
	* The phases that a touch event goes through.  The <code>phase</code> is passed to the event handlers. 
	* These properties are read only, attempting to change them will not alter the values passed to the event handlers.
	* @namespace
	* @readonly
	* @property {string} PHASE_START Constant indicating the start phase of the touch event. Value is <code>"start"</code>.
	* @property {string} PHASE_MOVE Constant indicating the move phase of the touch event. Value is <code>"move"</code>.
	* @property {string} PHASE_END Constant indicating the end phase of the touch event. Value is <code>"end"</code>.
	* @property {string} PHASE_CANCEL Constant indicating the cancel phase of the touch event. Value is <code>"cancel"</code>.
	*/
$.fn.swipe.phases={PHASE_START:PHASE_START,PHASE_MOVE:PHASE_MOVE,PHASE_END:PHASE_END,PHASE_CANCEL:PHASE_CANCEL};/**
	* The direction constants that are passed to the event handlers. 
	* These properties are read only, attempting to change them will not alter the values passed to the event handlers.
	* @namespace
	* @readonly
	* @property {string} LEFT Constant indicating the left direction. Value is <code>"left"</code>.
	* @property {string} RIGHT Constant indicating the right direction. Value is <code>"right"</code>.
	* @property {string} UP Constant indicating the up direction. Value is <code>"up"</code>.
	* @property {string} DOWN Constant indicating the down direction. Value is <code>"cancel"</code>.
	* @property {string} IN Constant indicating the in direction. Value is <code>"in"</code>.
	* @property {string} OUT Constant indicating the out direction. Value is <code>"out"</code>.
	*/
$.fn.swipe.directions={LEFT:LEFT,RIGHT:RIGHT,UP:UP,DOWN:DOWN,IN:IN,OUT:OUT};/**
	* The page scroll constants that can be used to set the value of <code>allowPageScroll</code> option
	* These properties are read only
	* @namespace
	* @readonly
	* @see $.fn.swipe.defaults#allowPageScroll
	* @property {string} NONE Constant indicating no page scrolling is allowed. Value is <code>"none"</code>.
	* @property {string} HORIZONTAL Constant indicating horizontal page scrolling is allowed. Value is <code>"horizontal"</code>.
	* @property {string} VERTICAL Constant indicating vertical page scrolling is allowed. Value is <code>"vertical"</code>.
	* @property {string} AUTO Constant indicating either horizontal or vertical will be allowed, depending on the swipe handlers registered. Value is <code>"auto"</code>.
	*/
$.fn.swipe.pageScroll={NONE:NONE,HORIZONTAL:HORIZONTAL,VERTICAL:VERTICAL,AUTO:AUTO};/**
	* Constants representing the number of fingers used in a swipe.  These are used to set both the value of <code>fingers</code> in the 
	* options object, as well as the value of the <code>fingers</code> event property.
	* These properties are read only, attempting to change them will not alter the values passed to the event handlers.
	* @namespace
	* @readonly
	* @see $.fn.swipe.defaults#fingers
	* @property {string} ONE Constant indicating 1 finger is to be detected / was detected. Value is <code>1</code>.
	* @property {string} TWO Constant indicating 2 fingers are to be detected / were detected. Value is <code>1</code>.
	* @property {string} THREE Constant indicating 3 finger are to be detected / were detected. Value is <code>1</code>.
	* @property {string} ALL Constant indicating any combination of finger are to be detected.  Value is <code>"all"</code>.
	*/
$.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:ALL_FINGERS};/**
	* Initialise the plugin for each DOM element matched
	* This creates a new instance of the main TouchSwipe class for each DOM element, and then
	* saves a reference to that instance in the elements data property.
	* @internal
	*/
function init(options){//Prep and extend the options
if(options&&(options.allowPageScroll===undefined&&(options.swipe!==undefined||options.swipeStatus!==undefined))){options.allowPageScroll=NONE}//Check for deprecated options
//Ensure that any old click handlers are assigned to the new tap, unless we have a tap
if(options.click!==undefined&&options.tap===undefined){options.tap=options.click}if(!options){options={}}//pass empty object so we dont modify the defaults
options=$.extend({},$.fn.swipe.defaults,options);//For each element instantiate the plugin
return this.each(function(){var $this=$(this);//Check we havent already initialised the plugin
var plugin=$this.data(PLUGIN_NS);if(!plugin){plugin=new TouchSwipe(this,options);$this.data(PLUGIN_NS,plugin)}})}/**
	* Main TouchSwipe Plugin Class.
	* Do not use this to construct your TouchSwipe object, use the jQuery plugin method $.fn.swipe(); {@link $.fn.swipe}
	* @private
	* @name TouchSwipe
	* @param {DOMNode} element The HTML DOM object to apply to plugin to
	* @param {Object} options The options to configure the plugin with.  @link {$.fn.swipe.defaults}
	* @see $.fh.swipe.defaults
	* @see $.fh.swipe
    * @class
	*/
function TouchSwipe(element,options){var useTouchEvents=SUPPORTS_TOUCH||SUPPORTS_POINTER||!options.fallbackToMouseEvents,START_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerDown":"pointerdown":"touchstart":"mousedown",MOVE_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerMove":"pointermove":"touchmove":"mousemove",END_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerUp":"pointerup":"touchend":"mouseup",LEAVE_EV=useTouchEvents?null:"mouseleave",//we manually detect leave on touch devices, so null event here
CANCEL_EV=SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerCancel":"pointercancel":"touchcancel";//touch properties
var distance=0,direction=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,pinchDirection=0,maximumsMap=null;//jQuery wrapped element for this instance
var $element=$(element);//Current phase of th touch cycle
var phase="start";// the current number of fingers being used.
var fingerCount=0;//track mouse points / delta
var fingerData=null;//track times
var startTime=0,endTime=0,previousTouchEndTime=0,previousTouchFingerCount=0,doubleTapStartTime=0;//Timeouts
var singleTapTimeout=null,holdTimeout=null;// Add gestures to all swipable areas if supported
try{$element.bind(START_EV,touchStart);$element.bind(CANCEL_EV,touchCancel)}catch(e){$.error("events not supported "+START_EV+","+CANCEL_EV+" on jQuery.swipe")}//
//Public methods
//
/**
		* re-enables the swipe plugin with the previous configuration
		* @function
		* @name $.fn.swipe#enable
		* @return {DOMNode} The Dom element that was registered with TouchSwipe 
		* @example $("#element").swipe("enable");
		*/
this.enable=function(){$element.bind(START_EV,touchStart);$element.bind(CANCEL_EV,touchCancel);return $element};/**
		* disables the swipe plugin
		* @function
		* @name $.fn.swipe#disable
		* @return {DOMNode} The Dom element that is now registered with TouchSwipe
	    * @example $("#element").swipe("disable");
		*/
this.disable=function(){removeListeners();return $element};/**
		* Destroy the swipe plugin completely. To use any swipe methods, you must re initialise the plugin.
		* @function
		* @name $.fn.swipe#destroy
		* @return {DOMNode} The Dom element that was registered with TouchSwipe 
		* @example $("#element").swipe("destroy");
		*/
this.destroy=function(){removeListeners();$element.data(PLUGIN_NS,null);return $element};/**
         * Allows run time updating of the swipe configuration options.
         * @function
    	 * @name $.fn.swipe#option
    	 * @param {String} property The option property to get or set
         * @param {Object} [value] The value to set the property to
		 * @return {Object} If only a property name is passed, then that property value is returned.
		 * @example $("#element").swipe("option", "threshold"); // return the threshold
         * @example $("#element").swipe("option", "threshold", 100); // set the threshold after init
         * @see $.fn.swipe.defaults
         *
         */
this.option=function(property,value){if(options[property]!==undefined){if(value===undefined){return options[property]}else{options[property]=value}}else{$.error("Option "+property+" does not exist on jQuery.swipe.options")}return null};//
// Private methods
//
//
// EVENTS
//
/**
		* Event handler for a touch start event.
		* Stops the default click event from triggering and stores where we touched
		* @inner
		* @param {object} jqEvent The normalised jQuery event object.
		*/
function touchStart(jqEvent){//If we already in a touch event (a finger already in use) then ignore subsequent ones..
if(getTouchInProgress())return;//Check if this element matches any in the excluded elements selectors,  or its parent is excluded, if so, DON'T swipe
if($(jqEvent.target).closest(options.excludedElements,$element).length>0)return;//As we use Jquery bind for events, we need to target the original event object
//If these events are being programmatically triggered, we don't have an original event object, so use the Jq one.
var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;var ret,evt=SUPPORTS_TOUCH?event.touches[0]:event;phase=PHASE_START;//If we support touches, get the finger count
if(SUPPORTS_TOUCH){// get the total number of fingers touching the screen
fingerCount=event.touches.length}else{jqEvent.preventDefault()}//clear vars..
distance=0;direction=null;pinchDirection=null;duration=0;startTouchesDistance=0;endTouchesDistance=0;pinchZoom=1;pinchDistance=0;fingerData=createAllFingerData();maximumsMap=createMaximumsData();cancelMultiFingerRelease();// check the number of fingers is what we are looking for, or we are capturing pinches
if(!SUPPORTS_TOUCH||(fingerCount===options.fingers||options.fingers===ALL_FINGERS)||hasPinches()){// get the coordinates of the touch
createFingerData(0,evt);startTime=getTimeStamp();if(fingerCount==2){//Keep track of the initial pinch distance, so we can calculate the diff later
//Store second finger data as start
createFingerData(1,event.touches[1]);startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)}if(options.swipeStatus||options.pinchStatus){ret=triggerHandler(event,phase)}}else{//A touch with more or less than the fingers we are looking for, so cancel
ret=false}//If we have a return value from the users handler, then return and cancel
if(ret===false){phase=PHASE_CANCEL;triggerHandler(event,phase);return ret}else{if(options.hold){holdTimeout=setTimeout($.proxy(function(){//Trigger the event
$element.trigger("hold",[event.target]);//Fire the callback
if(options.hold){ret=options.hold.call($element,event,event.target)}},this),options.longTapThreshold)}setTouchInProgress(true)}return null}/**
		* Event handler for a touch move event. 
		* If we change fingers during move, then cancel the event
		* @inner
		* @param {object} jqEvent The normalised jQuery event object.
		*/
function touchMove(jqEvent){//As we use Jquery bind for events, we need to target the original event object
//If these events are being programmatically triggered, we don't have an original event object, so use the Jq one.
var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;//If we are ending, cancelling, or within the threshold of 2 fingers being released, don't track anything..
if(phase===PHASE_END||phase===PHASE_CANCEL||inMultiFingerRelease())return;var ret,evt=SUPPORTS_TOUCH?event.touches[0]:event;//Update the  finger data 
var currentFinger=updateFingerData(evt);endTime=getTimeStamp();if(SUPPORTS_TOUCH){fingerCount=event.touches.length}if(options.hold)clearTimeout(holdTimeout);phase=PHASE_MOVE;//If we have 2 fingers get Touches distance as well
if(fingerCount==2){//Keep track of the initial pinch distance, so we can calculate the diff later
//We do this here as well as the start event, in case they start with 1 finger, and the press 2 fingers
if(startTouchesDistance==0){//Create second finger if this is the first time...
createFingerData(1,event.touches[1]);startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)}else{//Else just update the second finger
updateFingerData(event.touches[1]);endTouchesDistance=calculateTouchesDistance(fingerData[0].end,fingerData[1].end);pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)}pinchZoom=calculatePinchZoom(startTouchesDistance,endTouchesDistance);pinchDistance=Math.abs(startTouchesDistance-endTouchesDistance)}if(fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH||hasPinches()){direction=calculateDirection(currentFinger.start,currentFinger.end);//Check if we need to prevent default event (page scroll / pinch zoom) or not
validateDefaultEvent(jqEvent,direction);//Distance and duration are all off the main finger
distance=calculateDistance(currentFinger.start,currentFinger.end);duration=calculateDuration();//Cache the maximum distance we made in this direction
setMaxDistance(direction,distance);if(options.swipeStatus||options.pinchStatus){ret=triggerHandler(event,phase)}//If we trigger end events when threshold are met, or trigger events when touch leaves element
if(!options.triggerOnTouchEnd||options.triggerOnTouchLeave){var inBounds=true;//If checking if we leave the element, run the bounds check (we can use touchleave as its not supported on webkit)
if(options.triggerOnTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}//Trigger end handles as we swipe if thresholds met or if we have left the element if the user has asked to check these..
if(!options.triggerOnTouchEnd&&inBounds){phase=getNextPhase(PHASE_MOVE)}else if(options.triggerOnTouchLeave&&!inBounds){phase=getNextPhase(PHASE_END)}if(phase==PHASE_CANCEL||phase==PHASE_END){triggerHandler(event,phase)}}}else{phase=PHASE_CANCEL;triggerHandler(event,phase)}if(ret===false){phase=PHASE_CANCEL;triggerHandler(event,phase)}}/**
		* Event handler for a touch end event. 
		* Calculate the direction and trigger events
		* @inner
		* @param {object} jqEvent The normalised jQuery event object.
		*/
function touchEnd(jqEvent){//As we use Jquery bind for events, we need to target the original event object
var event=jqEvent.originalEvent;//If we are still in a touch with another finger return
//This allows us to wait a fraction and see if the other finger comes up, if it does within the threshold, then we treat it as a multi release, not a single release.
if(SUPPORTS_TOUCH){if(event.touches.length>0){startMultiFingerRelease();return true}}//If a previous finger has been released, check how long ago, if within the threshold, then assume it was a multifinger release.
//This is used to allow 2 fingers to release fractionally after each other, whilst maintainig the event as containg 2 fingers, not 1
if(inMultiFingerRelease()){fingerCount=previousTouchFingerCount}//Set end of swipe
endTime=getTimeStamp();//Get duration incase move was never fired
duration=calculateDuration();//If we trigger handlers at end of swipe OR, we trigger during, but they didnt trigger and we are still in the move phase
if(didSwipeBackToCancel()||!validateSwipeDistance()){phase=PHASE_CANCEL;triggerHandler(event,phase)}else if(options.triggerOnTouchEnd||options.triggerOnTouchEnd==false&&phase===PHASE_MOVE){//call this on jq event so we are cross browser 
jqEvent.preventDefault();phase=PHASE_END;triggerHandler(event,phase)}else if(!options.triggerOnTouchEnd&&hasTap()){//Trigger the pinch events...
phase=PHASE_END;triggerHandlerForGesture(event,phase,TAP)}else if(phase===PHASE_MOVE){phase=PHASE_CANCEL;triggerHandler(event,phase)}setTouchInProgress(false);return null}/**
		* Event handler for a touch cancel event. 
		* Clears current vars
		* @inner
		*/
function touchCancel(){// reset the variables back to default values
fingerCount=0;endTime=0;startTime=0;startTouchesDistance=0;endTouchesDistance=0;pinchZoom=1;//If we were in progress of tracking a possible multi touch end, then re set it.
cancelMultiFingerRelease();setTouchInProgress(false)}/**
		* Event handler for a touch leave event. 
		* This is only triggered on desktops, in touch we work this out manually
		* as the touchleave event is not supported in webkit
		* @inner
		*/
function touchLeave(jqEvent){var event=jqEvent.originalEvent;//If we have the trigger on leave property set....
if(options.triggerOnTouchLeave){phase=getNextPhase(PHASE_END);triggerHandler(event,phase)}}/**
		* Removes all listeners that were associated with the plugin
		* @inner
		*/
function removeListeners(){$element.unbind(START_EV,touchStart);$element.unbind(CANCEL_EV,touchCancel);$element.unbind(MOVE_EV,touchMove);$element.unbind(END_EV,touchEnd);//we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit
if(LEAVE_EV){$element.unbind(LEAVE_EV,touchLeave)}setTouchInProgress(false)}/**
		 * Checks if the time and distance thresholds have been met, and if so then the appropriate handlers are fired.
		 */
function getNextPhase(currentPhase){var nextPhase=currentPhase;// Ensure we have valid swipe (under time and over distance  and check if we are out of bound...)
var validTime=validateSwipeTime();var validDistance=validateSwipeDistance();var didCancel=didSwipeBackToCancel();//If we have exceeded our time, then cancel	
if(!validTime||didCancel){nextPhase=PHASE_CANCEL}else if(validDistance&&currentPhase==PHASE_MOVE&&(!options.triggerOnTouchEnd||options.triggerOnTouchLeave)){nextPhase=PHASE_END}else if(!validDistance&&currentPhase==PHASE_END&&options.triggerOnTouchLeave){nextPhase=PHASE_CANCEL}return nextPhase}/**
		* Trigger the relevant event handler
		* The handlers are passed the original event, the element that was swiped, and in the case of the catch all handler, the direction that was swiped, "left", "right", "up", or "down"
		* @param {object} event the original event object
		* @param {string} phase the phase of the swipe (start, end cancel etc) {@link $.fn.swipe.phases}
		* @inner
		*/
function triggerHandler(event,phase){var ret=undefined;// SWIPE GESTURES
if(didSwipe()||hasSwipes()){//hasSwipes as status needs to fire even if swipe is invalid
//Trigger the swipe events...
ret=triggerHandlerForGesture(event,phase,SWIPE)}else if((didPinch()||hasPinches())&&ret!==false){//Trigger the pinch events...
ret=triggerHandlerForGesture(event,phase,PINCH)}// CLICK / TAP (if the above didn't cancel)
if(didDoubleTap()&&ret!==false){//Trigger the tap events...
ret=triggerHandlerForGesture(event,phase,DOUBLE_TAP)}else if(didLongTap()&&ret!==false){//Trigger the tap events...
ret=triggerHandlerForGesture(event,phase,LONG_TAP)}else if(didTap()&&ret!==false){//Trigger the tap event..
ret=triggerHandlerForGesture(event,phase,TAP)}// If we are cancelling the gesture, then manually trigger the reset handler
if(phase===PHASE_CANCEL){touchCancel(event)}// If we are ending the gesture, then manually trigger the reset handler IF all fingers are off
if(phase===PHASE_END){//If we support touch, then check that all fingers are off before we cancel
if(SUPPORTS_TOUCH){if(event.touches.length==0){touchCancel(event)}}else{touchCancel(event)}}return ret}/**
		* Trigger the relevant event handler
		* The handlers are passed the original event, the element that was swiped, and in the case of the catch all handler, the direction that was swiped, "left", "right", "up", or "down"
		* @param {object} event the original event object
		* @param {string} phase the phase of the swipe (start, end cancel etc) {@link $.fn.swipe.phases}
		* @param {string} gesture the gesture to trigger a handler for : PINCH or SWIPE {@link $.fn.swipe.gestures}
		* @return Boolean False, to indicate that the event should stop propagation, or void.
		* @inner
		*/
function triggerHandlerForGesture(event,phase,gesture){var ret=undefined;//SWIPES....
if(gesture==SWIPE){//Trigger status every time..
//Trigger the event...
$element.trigger("swipeStatus",[phase,direction||null,distance||0,duration||0,fingerCount,fingerData]);//Fire the callback
if(options.swipeStatus){ret=options.swipeStatus.call($element,event,phase,direction||null,distance||0,duration||0,fingerCount,fingerData);//If the status cancels, then dont run the subsequent event handlers..
if(ret===false)return false}if(phase==PHASE_END&&validateSwipe()){//Fire the catch all event
$element.trigger("swipe",[direction,distance,duration,fingerCount,fingerData]);//Fire catch all callback
if(options.swipe){ret=options.swipe.call($element,event,direction,distance,duration,fingerCount,fingerData);//If the status cancels, then dont run the subsequent event handlers..
if(ret===false)return false}//trigger direction specific event handlers	
switch(direction){case LEFT://Trigger the event
$element.trigger("swipeLeft",[direction,distance,duration,fingerCount,fingerData]);//Fire the callback
if(options.swipeLeft){ret=options.swipeLeft.call($element,event,direction,distance,duration,fingerCount,fingerData)}break;case RIGHT://Trigger the event
$element.trigger("swipeRight",[direction,distance,duration,fingerCount,fingerData]);//Fire the callback
if(options.swipeRight){ret=options.swipeRight.call($element,event,direction,distance,duration,fingerCount,fingerData)}break;case UP://Trigger the event
$element.trigger("swipeUp",[direction,distance,duration,fingerCount,fingerData]);//Fire the callback
if(options.swipeUp){ret=options.swipeUp.call($element,event,direction,distance,duration,fingerCount,fingerData)}break;case DOWN://Trigger the event
$element.trigger("swipeDown",[direction,distance,duration,fingerCount,fingerData]);//Fire the callback
if(options.swipeDown){ret=options.swipeDown.call($element,event,direction,distance,duration,fingerCount,fingerData)}break}}}//PINCHES....
if(gesture==PINCH){//Trigger the event
$element.trigger("pinchStatus",[phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]);//Fire the callback
if(options.pinchStatus){ret=options.pinchStatus.call($element,event,phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData);//If the status cancels, then dont run the subsequent event handlers..
if(ret===false)return false}if(phase==PHASE_END&&validatePinch()){switch(pinchDirection){case IN://Trigger the event
$element.trigger("pinchIn",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]);//Fire the callback
if(options.pinchIn){ret=options.pinchIn.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData)}break;case OUT://Trigger the event
$element.trigger("pinchOut",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]);//Fire the callback
if(options.pinchOut){ret=options.pinchOut.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData)}break}}}if(gesture==TAP){if(phase===PHASE_CANCEL||phase===PHASE_END){//Cancel any existing double tap
clearTimeout(singleTapTimeout);//Cancel hold timeout
clearTimeout(holdTimeout);//If we are also looking for doubelTaps, wait incase this is one...
if(hasDoubleTap()&&!inDoubleTap()){//Cache the time of this tap
doubleTapStartTime=getTimeStamp();//Now wait for the double tap timeout, and trigger this single tap
//if its not cancelled by a double tap
singleTapTimeout=setTimeout($.proxy(function(){doubleTapStartTime=null;//Trigger the event
$element.trigger("tap",[event.target]);//Fire the callback
if(options.tap){ret=options.tap.call($element,event,event.target)}},this),options.doubleTapThreshold)}else{doubleTapStartTime=null;//Trigger the event
$element.trigger("tap",[event.target]);//Fire the callback
if(options.tap){ret=options.tap.call($element,event,event.target)}}}}else if(gesture==DOUBLE_TAP){if(phase===PHASE_CANCEL||phase===PHASE_END){//Cancel any pending singletap 
clearTimeout(singleTapTimeout);doubleTapStartTime=null;//Trigger the event
$element.trigger("doubletap",[event.target]);//Fire the callback
if(options.doubleTap){ret=options.doubleTap.call($element,event,event.target)}}}else if(gesture==LONG_TAP){if(phase===PHASE_CANCEL||phase===PHASE_END){//Cancel any pending singletap (shouldnt be one)
clearTimeout(singleTapTimeout);doubleTapStartTime=null;//Trigger the event
$element.trigger("longtap",[event.target]);//Fire the callback
if(options.longTap){ret=options.longTap.call($element,event,event.target)}}}return ret}//
// GESTURE VALIDATION
//
/**
		* Checks the user has swipe far enough
		* @return Boolean if <code>threshold</code> has been set, return true if the threshold was met, else false.
		* If no threshold was set, then we return true.
		* @inner
		*/
function validateSwipeDistance(){var valid=true;//If we made it past the min swipe distance..
if(options.threshold!==null){valid=distance>=options.threshold}return valid}/**
		* Checks the user has swiped back to cancel.
		* @return Boolean if <code>cancelThreshold</code> has been set, return true if the cancelThreshold was met, else false.
		* If no cancelThreshold was set, then we return true.
		* @inner
		*/
function didSwipeBackToCancel(){var cancelled=false;if(options.cancelThreshold!==null&&direction!==null){cancelled=getMaxDistance(direction)-distance>=options.cancelThreshold}return cancelled}/**
		* Checks the user has pinched far enough
		* @return Boolean if <code>pinchThreshold</code> has been set, return true if the threshold was met, else false.
		* If no threshold was set, then we return true.
		* @inner
		*/
function validatePinchDistance(){if(options.pinchThreshold!==null){return pinchDistance>=options.pinchThreshold}return true}/**
		* Checks that the time taken to swipe meets the minimum / maximum requirements
		* @return Boolean
		* @inner
		*/
function validateSwipeTime(){var result;//If no time set, then return true
if(options.maxTimeThreshold){if(duration>=options.maxTimeThreshold){result=false}else{result=true}}else{result=true}return result}/**
		* Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring.
		* This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object.
		* @param {object} jqEvent The normalised jQuery representation of the event object.
		* @param {string} direction The direction of the event. See {@link $.fn.swipe.directions}
		* @see $.fn.swipe.directions
		* @inner
		*/
function validateDefaultEvent(jqEvent,direction){if(options.allowPageScroll===NONE||hasPinches()){jqEvent.preventDefault()}else{var auto=options.allowPageScroll===AUTO;switch(direction){case LEFT:if(options.swipeLeft&&auto||!auto&&options.allowPageScroll!=HORIZONTAL){jqEvent.preventDefault()}break;case RIGHT:if(options.swipeRight&&auto||!auto&&options.allowPageScroll!=HORIZONTAL){jqEvent.preventDefault()}break;case UP:if(options.swipeUp&&auto||!auto&&options.allowPageScroll!=VERTICAL){jqEvent.preventDefault()}break;case DOWN:if(options.swipeDown&&auto||!auto&&options.allowPageScroll!=VERTICAL){jqEvent.preventDefault()}break}}}// PINCHES
/**
		 * Returns true of the current pinch meets the thresholds
		 * @return Boolean
		 * @inner
		*/
function validatePinch(){var hasCorrectFingerCount=validateFingers();var hasEndPoint=validateEndPoint();var hasCorrectDistance=validatePinchDistance();return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance}/**
		 * Returns true if any Pinch events have been registered
		 * @return Boolean
		 * @inner
		*/
function hasPinches(){//Enure we dont return 0 or null for false values
return!!(options.pinchStatus||options.pinchIn||options.pinchOut)}/**
		 * Returns true if we are detecting pinches, and have one
		 * @return Boolean
		 * @inner
		 */
function didPinch(){//Enure we dont return 0 or null for false values
return!!(validatePinch()&&hasPinches())}// SWIPES
/**
		 * Returns true if the current swipe meets the thresholds
		 * @return Boolean
		 * @inner
		*/
function validateSwipe(){//Check validity of swipe
var hasValidTime=validateSwipeTime();var hasValidDistance=validateSwipeDistance();var hasCorrectFingerCount=validateFingers();var hasEndPoint=validateEndPoint();var didCancel=didSwipeBackToCancel();// if the user swiped more than the minimum length, perform the appropriate action
// hasValidDistance is null when no distance is set 
var valid=!didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;return valid}/**
		 * Returns true if any Swipe events have been registered
		 * @return Boolean
		 * @inner
		*/
function hasSwipes(){//Enure we dont return 0 or null for false values
return!!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown)}/**
		 * Returns true if we are detecting swipes and have one
		 * @return Boolean
		 * @inner
		*/
function didSwipe(){//Enure we dont return 0 or null for false values
return!!(validateSwipe()&&hasSwipes())}/**
		 * Returns true if we have matched the number of fingers we are looking for
		 * @return Boolean
		 * @inner
		*/
function validateFingers(){//The number of fingers we want were matched, or on desktop we ignore
return fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH}/**
		 * Returns true if we have an end point for the swipe
		 * @return Boolean
		 * @inner
		*/
function validateEndPoint(){//We have an end value for the finger
return fingerData[0].end.x!==0}// TAP / CLICK
/**
		 * Returns true if a click / tap events have been registered
		 * @return Boolean
		 * @inner
		*/
function hasTap(){//Enure we dont return 0 or null for false values
return!!options.tap}/**
		 * Returns true if a double tap events have been registered
		 * @return Boolean
		 * @inner
		*/
function hasDoubleTap(){//Enure we dont return 0 or null for false values
return!!options.doubleTap}/**
		 * Returns true if any long tap events have been registered
		 * @return Boolean
		 * @inner
		*/
function hasLongTap(){//Enure we dont return 0 or null for false values
return!!options.longTap}/**
		 * Returns true if we could be in the process of a double tap (one tap has occurred, we are listening for double taps, and the threshold hasn't past.
		 * @return Boolean
		 * @inner
		*/
function validateDoubleTap(){if(doubleTapStartTime==null){return false}var now=getTimeStamp();return hasDoubleTap()&&now-doubleTapStartTime<=options.doubleTapThreshold}/**
		 * Returns true if we could be in the process of a double tap (one tap has occurred, we are listening for double taps, and the threshold hasn't past.
		 * @return Boolean
		 * @inner
		*/
function inDoubleTap(){return validateDoubleTap()}/**
		 * Returns true if we have a valid tap
		 * @return Boolean
		 * @inner
		*/
function validateTap(){return(fingerCount===1||!SUPPORTS_TOUCH)&&(isNaN(distance)||distance<options.threshold)}/**
		 * Returns true if we have a valid long tap
		 * @return Boolean
		 * @inner
		*/
function validateLongTap(){//slight threshold on moving finger
return duration>options.longTapThreshold&&distance<DOUBLE_TAP_THRESHOLD}/**
		 * Returns true if we are detecting taps and have one
		 * @return Boolean
		 * @inner
		*/
function didTap(){//Enure we dont return 0 or null for false values
return!!(validateTap()&&hasTap())}/**
		 * Returns true if we are detecting double taps and have one
		 * @return Boolean
		 * @inner
		*/
function didDoubleTap(){//Enure we dont return 0 or null for false values
return!!(validateDoubleTap()&&hasDoubleTap())}/**
		 * Returns true if we are detecting long taps and have one
		 * @return Boolean
		 * @inner
		*/
function didLongTap(){//Enure we dont return 0 or null for false values
return!!(validateLongTap()&&hasLongTap())}// MULTI FINGER TOUCH
/**
		 * Starts tracking the time between 2 finger releases, and keeps track of how many fingers we initially had up
		 * @inner
		*/
function startMultiFingerRelease(){previousTouchEndTime=getTimeStamp();previousTouchFingerCount=event.touches.length+1}/**
		 * Cancels the tracking of time between 2 finger releases, and resets counters
		 * @inner
		*/
function cancelMultiFingerRelease(){previousTouchEndTime=0;previousTouchFingerCount=0}/**
		 * Checks if we are in the threshold between 2 fingers being released 
		 * @return Boolean
		 * @inner
		*/
function inMultiFingerRelease(){var withinThreshold=false;if(previousTouchEndTime){var diff=getTimeStamp()-previousTouchEndTime;if(diff<=options.fingerReleaseThreshold){withinThreshold=true}}return withinThreshold}/**
		* gets a data flag to indicate that a touch is in progress
		* @return Boolean
		* @inner
		*/
function getTouchInProgress(){//strict equality to ensure only true and false are returned
return!!($element.data(PLUGIN_NS+"_intouch")===true)}/**
		* Sets a data flag to indicate that a touch is in progress
		* @param {boolean} val The value to set the property to
		* @inner
		*/
function setTouchInProgress(val){//Add or remove event listeners depending on touch status
if(val===true){$element.bind(MOVE_EV,touchMove);$element.bind(END_EV,touchEnd);//we only have leave events on desktop, we manually calcuate leave on touch as its not supported in webkit
if(LEAVE_EV){$element.bind(LEAVE_EV,touchLeave)}}else{$element.unbind(MOVE_EV,touchMove,false);$element.unbind(END_EV,touchEnd,false);//we only have leave events on desktop, we manually calcuate leave on touch as its not supported in webkit
if(LEAVE_EV){$element.unbind(LEAVE_EV,touchLeave,false)}}//strict equality to ensure only true and false can update the value
$element.data(PLUGIN_NS+"_intouch",val===true)}/**
		 * Creates the finger data for the touch/finger in the event object.
		 * @param {int} index The index in the array to store the finger data (usually the order the fingers were pressed)
		 * @param {object} evt The event object containing finger data
		 * @return finger data object
		 * @inner
		*/
function createFingerData(index,evt){var id=evt.identifier!==undefined?evt.identifier:0;fingerData[index].identifier=id;fingerData[index].start.x=fingerData[index].end.x=evt.pageX||evt.clientX;fingerData[index].start.y=fingerData[index].end.y=evt.pageY||evt.clientY;return fingerData[index]}/**
		 * Updates the finger data for a particular event object
		 * @param {object} evt The event object containing the touch/finger data to upadte
		 * @return a finger data object.
		 * @inner
		*/
function updateFingerData(evt){var id=evt.identifier!==undefined?evt.identifier:0;var f=getFingerData(id);f.end.x=evt.pageX||evt.clientX;f.end.y=evt.pageY||evt.clientY;return f}/**
		 * Returns a finger data object by its event ID.
		 * Each touch event has an identifier property, which is used 
		 * to track repeat touches
		 * @param {int} id The unique id of the finger in the sequence of touch events.
		 * @return a finger data object.
		 * @inner
		*/
function getFingerData(id){for(var i=0;i<fingerData.length;i++){if(fingerData[i].identifier==id){return fingerData[i]}}}/**
		 * Creats all the finger onjects and returns an array of finger data
		 * @return Array of finger objects
		 * @inner
		*/
function createAllFingerData(){var fingerData=[];for(var i=0;i<=5;i++){fingerData.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0})}return fingerData}/**
		 * Sets the maximum distance swiped in the given direction. 
		 * If the new value is lower than the current value, the max value is not changed.
		 * @param {string}  direction The direction of the swipe
		 * @param {int}  distance The distance of the swipe
		 * @inner
		*/
function setMaxDistance(direction,distance){distance=Math.max(distance,getMaxDistance(direction));maximumsMap[direction].distance=distance}/**
		 * gets the maximum distance swiped in the given direction. 
		 * @param {string}  direction The direction of the swipe
		 * @return int  The distance of the swipe
		 * @inner
		*/
function getMaxDistance(direction){if(maximumsMap[direction])return maximumsMap[direction].distance;return undefined}/**
		 * Creats a map of directions to maximum swiped values.
		 * @return Object A dictionary of maximum values, indexed by direction.
		 * @inner
		*/
function createMaximumsData(){var maxData={};maxData[LEFT]=createMaximumVO(LEFT);maxData[RIGHT]=createMaximumVO(RIGHT);maxData[UP]=createMaximumVO(UP);maxData[DOWN]=createMaximumVO(DOWN);return maxData}/**
		 * Creates a map maximum swiped values for a given swipe direction
		 * @param {string} The direction that these values will be associated with
		 * @return Object Maximum values
		 * @inner
		*/
function createMaximumVO(dir){return{direction:dir,distance:0}}//
// MATHS / UTILS
//
/**
		* Calculate the duration of the swipe
		* @return int
		* @inner
		*/
function calculateDuration(){return endTime-startTime}/**
		* Calculate the distance between 2 touches (pinch)
		* @param {point} startPoint A point object containing x and y co-ordinates
	    * @param {point} endPoint A point object containing x and y co-ordinates
	    * @return int;
		* @inner
		*/
function calculateTouchesDistance(startPoint,endPoint){var diffX=Math.abs(startPoint.x-endPoint.x);var diffY=Math.abs(startPoint.y-endPoint.y);return Math.round(Math.sqrt(diffX*diffX+diffY*diffY))}/**
		* Calculate the zoom factor between the start and end distances
		* @param {int} startDistance Distance (between 2 fingers) the user started pinching at
	    * @param {int} endDistance Distance (between 2 fingers) the user ended pinching at
	    * @return float The zoom value from 0 to 1.
		* @inner
		*/
function calculatePinchZoom(startDistance,endDistance){var percent=endDistance/startDistance*1;return percent.toFixed(2)}/**
		* Returns the pinch direction, either IN or OUT for the given points
		* @return string Either {@link $.fn.swipe.directions.IN} or {@link $.fn.swipe.directions.OUT}
		* @see $.fn.swipe.directions
		* @inner
		*/
function calculatePinchDirection(){if(pinchZoom<1){return OUT}else{return IN}}/**
		* Calculate the length / distance of the swipe
		* @param {point} startPoint A point object containing x and y co-ordinates
	    * @param {point} endPoint A point object containing x and y co-ordinates
	    * @return int
		* @inner
		*/
function calculateDistance(startPoint,endPoint){return Math.round(Math.sqrt(Math.pow(endPoint.x-startPoint.x,2)+Math.pow(endPoint.y-startPoint.y,2)))}/**
		* Calculate the angle of the swipe
		* @param {point} startPoint A point object containing x and y co-ordinates
	    * @param {point} endPoint A point object containing x and y co-ordinates
	    * @return int
		* @inner
		*/
function calculateAngle(startPoint,endPoint){var x=startPoint.x-endPoint.x;var y=endPoint.y-startPoint.y;var r=Math.atan2(y,x);//radians
var angle=Math.round(r*180/Math.PI);//degrees
//ensure value is positive
if(angle<0){angle=360-Math.abs(angle)}return angle}/**
		* Calculate the direction of the swipe
		* This will also call calculateAngle to get the latest angle of swipe
		* @param {point} startPoint A point object containing x and y co-ordinates
	    * @param {point} endPoint A point object containing x and y co-ordinates
	    * @return string Either {@link $.fn.swipe.directions.LEFT} / {@link $.fn.swipe.directions.RIGHT} / {@link $.fn.swipe.directions.DOWN} / {@link $.fn.swipe.directions.UP}
		* @see $.fn.swipe.directions
		* @inner
		*/
function calculateDirection(startPoint,endPoint){var angle=calculateAngle(startPoint,endPoint);if(angle<=45&&angle>=0){return LEFT}else if(angle<=360&&angle>=315){return LEFT}else if(angle>=135&&angle<=225){return RIGHT}else if(angle>45&&angle<135){return DOWN}else{return UP}}/**
		* Returns a MS time stamp of the current time
		* @return int
		* @inner
		*/
function getTimeStamp(){var now=new Date;return now.getTime()}/**
		 * Returns a bounds object with left, right, top and bottom properties for the element specified.
		 * @param {DomNode} The DOM node to get the bounds for.
		 */
function getbounds(el){el=$(el);var offset=el.offset();var bounds={left:offset.left,right:offset.left+el.outerWidth(),top:offset.top,bottom:offset.top+el.outerHeight()};return bounds}/**
		 * Checks if the point object is in the bounds object.
		 * @param {object} point A point object.
		 * @param {int} point.x The x value of the point.
		 * @param {int} point.y The x value of the point.
		 * @param {object} bounds The bounds object to test
		 * @param {int} bounds.left The leftmost value
		 * @param {int} bounds.right The righttmost value
		 * @param {int} bounds.top The topmost value
		* @param {int} bounds.bottom The bottommost value
		 */
function isInBounds(point,bounds){return point.x>bounds.left&&point.x<bounds.right&&point.y>bounds.top&&point.y<bounds.bottom}}});/*
 * $Id: base64.js,v 2.15 2014/04/05 12:58:57 dankogai Exp dankogai $
 *
 *  Licensed under the BSD 3-Clause License.
 *    http://opensource.org/licenses/BSD-3-Clause
 *
 *  References:
 *    http://en.wikipedia.org/wiki/Base64
 */
(function(global){"use strict";// existing version for noConflict()
var _Base64=global.Base64;var version="2.1.9";// if node.js, we use Buffer
var buffer;if(typeof module!=="undefined"&&module.exports){try{buffer=require("buffer").Buffer}catch(err){}}// constants
var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64tab=function(bin){var t={};for(var i=0,l=bin.length;i<l;i++)t[bin.charAt(i)]=i;return t}(b64chars);var fromCharCode=String.fromCharCode;// encoder stuff
var cb_utob=function(c){if(c.length<2){var cc=c.charCodeAt(0);return cc<128?c:cc<2048?fromCharCode(192|cc>>>6)+fromCharCode(128|cc&63):fromCharCode(224|cc>>>12&15)+fromCharCode(128|cc>>>6&63)+fromCharCode(128|cc&63)}else{var cc=65536+(c.charCodeAt(0)-55296)*1024+(c.charCodeAt(1)-56320);return fromCharCode(240|cc>>>18&7)+fromCharCode(128|cc>>>12&63)+fromCharCode(128|cc>>>6&63)+fromCharCode(128|cc&63)}};var re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;var utob=function(u){return u.replace(re_utob,cb_utob)};var cb_encode=function(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charCodeAt(0)<<16|(ccc.length>1?ccc.charCodeAt(1):0)<<8|(ccc.length>2?ccc.charCodeAt(2):0),chars=[b64chars.charAt(ord>>>18),b64chars.charAt(ord>>>12&63),padlen>=2?"=":b64chars.charAt(ord>>>6&63),padlen>=1?"=":b64chars.charAt(ord&63)];return chars.join("")};var btoa=global.btoa?function(b){return global.btoa(b)}:function(b){return b.replace(/[\s\S]{1,3}/g,cb_encode)};var _encode=buffer?function(u){return(u.constructor===buffer.constructor?u:new buffer(u)).toString("base64")}:function(u){return btoa(utob(u))};var encode=function(u,urisafe){return!urisafe?_encode(String(u)):_encode(String(u)).replace(/[+\/]/g,function(m0){return m0=="+"?"-":"_"}).replace(/=/g,"")};var encodeURI=function(u){return encode(u,true)};// decoder stuff
var re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g");var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=(7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3),offset=cp-65536;return fromCharCode((offset>>>10)+55296)+fromCharCode((offset&1023)+56320);case 3:return fromCharCode((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return fromCharCode((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var cb_decode=function(cccc){var len=cccc.length,padlen=len%4,n=(len>0?b64tab[cccc.charAt(0)]<<18:0)|(len>1?b64tab[cccc.charAt(1)]<<12:0)|(len>2?b64tab[cccc.charAt(2)]<<6:0)|(len>3?b64tab[cccc.charAt(3)]:0),chars=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(n&255)];chars.length-=[0,0,2,1][padlen];return chars.join("")};var atob=global.atob?function(a){return global.atob(a)}:function(a){return a.replace(/[\s\S]{1,4}/g,cb_decode)};var _decode=buffer?function(a){return(a.constructor===buffer.constructor?a:new buffer(a,"base64")).toString()}:function(a){return btou(atob(a))};var decode=function(a){return _decode(String(a).replace(/[-_]/g,function(m0){return m0=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))};var noConflict=function(){var Base64=global.Base64;global.Base64=_Base64;return Base64};// export Base64
global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict};// if ES5 is available, make Base64.extendString() available
if(typeof Object.defineProperty==="function"){var noEnum=function(v){return{value:v,enumerable:false,writable:true,configurable:true}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)}));Object.defineProperty(String.prototype,"toBase64",noEnum(function(urisafe){return encode(this,urisafe)}));Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,true)}))}}// that's it!
if(global["Meteor"]){Base64=global.Base64}if(typeof module!=="undefined"&&module.exports){module.exports.Base64=global.Base64}if(typeof define==="function"&&define.amd){// AMD. Register as an anonymous module.
define([],function(){return global.Base64})}})(typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:this);/*! jQuery UI - v1.10.4 - 2014-01-17
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
(function($,undefined){var uuid=0,runiqueId=/^ui-id-\d+$/;// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui=$.ui||{};$.extend($.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});// plugins
$.fn.extend({focus:function(orig){return function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem)}},delay)}):orig.apply(this,arguments)}}($.fn.focus),scrollParent:function(){var scrollParent;if($.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))){scrollParent=this.parents().filter(function(){return/(relative|absolute|fixed)/.test($.css(this,"position"))&&/(auto|scroll)/.test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"))}).eq(0)}else{scrollParent=this.parents().filter(function(){return/(auto|scroll)/.test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"))}).eq(0)}return/fixed/.test(this.css("position"))||!scrollParent.length?$(document):scrollParent},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex)}if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}}return 0},uniqueId:function(){return this.each(function(){if(!this.id){this.id="ui-id-"+ ++uuid}})},removeUniqueId:function(){return this.each(function(){if(runiqueId.test(this.id)){$(this).removeAttr("id")}})}});// selectors
function focusable(element,isTabIndexNotNaN){var map,mapName,img,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img)}// the element and all of its ancestors must be visible
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element)}function visible(element){return $.expr.filters.visible(element)&&!$(element).parents().addBack().filter(function(){return $.css(this,"visibility")==="hidden"}).length}$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName)}}):// support: jQuery <1.8
function(elem,i,match){return!!$.data(elem,match[3])},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")))},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN)}});// support: jQuery <1.8
if(!$("<a>").outerWidth(1).jquery){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0}if(margin){size-=parseFloat($.css(elem,"margin"+this))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}})}// support: jQuery <1.8
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if($("<a>").data("a-b","a").removeData("a-b").data("a-b")){$.fn.removeData=function(removeData){return function(key){if(arguments.length){return removeData.call(this,$.camelCase(key))}else{return removeData.call(this)}}}($.fn.removeData)}// deprecated
$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());$.support.selectstart="onselectstart"in document.createElement("div");$.fn.extend({disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});$.extend($.ui,{// $.ui.plugin is deprecated. Use $.widget() extensions instead.
plugin:{add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args){var i,set=instance.plugins[name];if(!set||!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11){return}for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}},// only used by resizable
hasScroll:function(el,a){//If overflow is hidden, the element might have extra content, but the user wants to hide it
if($(el).css("overflow")==="hidden"){return false}var scroll=a&&a==="left"?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true}// TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to
// set the scroll
el[scroll]=1;has=el[scroll]>0;el[scroll]=0;return has}})})(jQuery);(function($,undefined){var uuid=0,slice=Array.prototype.slice,_cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){try{$(elem).triggerHandler("remove")}catch(e){}}_cleanData(elems)};$.widget=function(name,base,prototype){var fullName,existingConstructor,constructor,basePrototype,// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype={},namespace=name.split(".")[0];name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}// create selector for plugin
$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){// allow instantiation without "new" keyword
if(!this._createWidget){return new constructor(options,element)}// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if(arguments.length){this._createWidget(options,element)}};// extend with the existing constructor to carry over any static properties
$.extend(constructor,existingConstructor,{version:prototype.version,// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto:$.extend({},prototype),// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors:[]});basePrototype=new base;// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){var _super=function(){return base.prototype[prop].apply(this,arguments)},_superApply=function(args){return base.prototype[prop].apply(this,args)};return function(){var __super=this._super,__superApply=this._superApply,returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()});constructor.prototype=$.widget.extend(basePrototype,{// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor)};$.widget.extend=function(target){var input=slice.call(arguments,1),inputIndex=0,inputLength=input.length,key,value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){// Clone objects
if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):// Don't extend strings, arrays, etc. with objects
$.widget.extend({},value)}else{target[key]=value}}}}return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=slice.call(arguments,1),returnValue=this;// allow multiple hashes to be passed on init
options=!isMethodCall&&args.length?$.widget.extend.apply(null,[options].concat(args)):options;if(isMethodCall){this.each(function(){var methodValue,instance=$.data(this,fullName);if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")}methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false}})}else{this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{})._init()}else{$.data(this,fullName,new object(options,this))}})}return returnValue}};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,// callbacks
create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=uuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this.bindings=$();this.hoverable=$();this.focusable=$();if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?// element within the document
element.ownerDocument:// element is window or document
element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:$.noop,_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){this._destroy();// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData($.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled");// clean up events and states
this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key,parts,curOption,i;if(arguments.length===0){// don't return a reference to the internal hash
return $.widget.extend({},this.options)}if(typeof key==="string"){// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]]}key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key]}curOption[key]=value}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key]}options[key]=value}}this._setOptions(options);return this},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key])}return this},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!value).attr("aria-disabled",value);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_on:function(suppressDisabledCheck,element,handlers){var delegateElement,instance=this;// no suppressDisabledCheck flag, shuffle arguments
if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false}// no element argument, shuffle and use this.element
if(!handlers){handlers=element;element=this.element;delegateElement=this.widget()}else{// accept selectors, DOM elements
element=delegateElement=$(element);this.bindings=this.bindings.add(element)}$.each(handlers,function(event,handler){function handlerProxy(){// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return}return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}// copy the guid so direct unbinding works
if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++}var match=event.match(/^(\w+)\s*(.*)$/),eventName=match[1]+instance.eventNamespace,selector=match[2];if(selector){delegateElement.delegate(selector,eventName,handlerProxy)}else{element.bind(eventName,handlerProxy)}})},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.unbind(eventName).undelegate(eventName)},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){$(event.currentTarget).addClass("ui-state-hover")},mouseleave:function(event){$(event.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){$(event.currentTarget).addClass("ui-state-focus")},focusout:function(event){$(event.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig,callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();// the original event may come from any element
// so we need to reset the target on the new event
event.target=this.element[0];// copy original event properties over to the new event
orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}}this.element.trigger(event,data);return!($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented())}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options}}var hasOptions,effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}}hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)}if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0])}next()})}}})})(jQuery);(function($,undefined){var mouseHandled=false;$(document).mouseup(function(){mouseHandled=false});$.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.bind("mousedown."+this.widgetName,function(event){return that._mouseDown(event)}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy:function(){this.element.unbind("."+this.widgetName);if(this._mouseMoveDelegate){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(event){// don't let more than one widget handle mouseStart
if(mouseHandled){return}// we may have missed mouseup (out of window)
this._mouseStarted&&this._mouseUp(event);this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel=typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}// Click event may never have fired (Gecko & Opera)
if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}// these delegates are required to keep context
this._mouseMoveDelegate=function(event){return that._mouseMove(event)};this._mouseUpDelegate=function(event){return that._mouseUp(event)};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){// IE mouseup check - mouseup happened when mouse was out of window
if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event)}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)}return!this._mouseStarted},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}return false},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},// These are placeholder methods, to be overriden by extending plugin
_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);(function($,undefined){$.ui=$.ui||{};var cachedScrollbarWidth,max=Math.max,abs=Math.abs,round=Math.round,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}function parseCss(element,property){return parseInt($.css(element,property),10)||0}function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}}}if($.isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}}}if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}}return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()}}$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth}var w1,w2,div=$("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth}div.remove();return cachedScrollbarWidth=w1-w2},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||overflowX==="auto"&&within.width<within.element[0].scrollWidth,hasOverflowY=overflowY==="scroll"||overflowY==="auto"&&within.height<within.element[0].scrollHeight;return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:withinElement.offset()||{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:isWindow?withinElement.width():withinElement.outerWidth(),height:isWindow?withinElement.height():withinElement.outerHeight()}}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments)}// make a copy, we don't want to modify arguments
options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){// force left top to allow flipping
options.at="left top"}targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;// clone to reuse original targetOffset later
basePosition=$.extend({},targetOffset);// force my and at to have valid horizontal and vertical positions
// if a value is missing or invalid, it will be converted to center
$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]}pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";// calculate offsets
horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];// reduce to just the positions without the offsets
options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]});// normalize collision option
if(collision.length===1){collision[1]=collision[0]}if(options.at[0]==="right"){basePosition.left+=targetWidth}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2}if(options.at[1]==="bottom"){basePosition.top+=targetHeight}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2}atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth}else if(options.my[0]==="center"){position.left-=elemWidth/2}if(options.my[1]==="bottom"){position.top-=elemHeight}else if(options.my[1]==="center"){position.top-=elemHeight/2}position.left+=myOffset[0];position.top+=myOffset[1];// if the browser doesn't support fractions, then round for consistent results
if(!$.support.offsetFractions){position.left=round(position.left);position.top=round(position.top)}collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}});if(options.using){// adds feedback as second argument to using callback, if present
using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center"}if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle"}if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal"}else{feedback.important="vertical"}options.using.call(this,props,feedback)}}elem.offset($.extend(position,{using:using}))})};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;// element is wider than within
if(data.collisionWidth>outerWidth){// element is initially over the left side of within
if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight}else if(overRight>0&&overLeft<=0){position.left=withinOffset}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth}else{position.left=withinOffset}}}else if(overLeft>0){position.left+=overLeft}else if(overRight>0){position.left-=overRight}else{position.left=max(position.left-collisionPosLeft,position.left)}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;// element is taller than within
if(data.collisionHeight>outerHeight){// element is initially over the top of within
if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom}else if(overBottom>0&&overTop<=0){position.top=withinOffset}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight}else{position.top=withinOffset}}}else if(overTop>0){position.top+=overTop}else if(overBottom>0){position.top-=overBottom}else{position.top=max(position.top-collisionPosTop,position.top)}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset}}else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if(position.top+myOffset+atOffset+offset>overTop&&(newOverBottom<0||newOverBottom<abs(overTop))){position.top+=myOffset+atOffset+offset}}else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if(position.top+myOffset+atOffset+offset>overBottom&&(newOverTop>0||abs(newOverTop)<overBottom)){position.top+=myOffset+atOffset+offset}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments)}}};// fraction support test
(function(){var testElement,testElementParent,testElementStyle,offsetLeft,i,body=document.getElementsByTagName("body")[0],div=document.createElement("div");//Create a "fake body" for testing based on method used in jQuery.support
testElement=document.createElement(body?"div":"body");testElementStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(body){$.extend(testElementStyle,{position:"absolute",left:"-1000px",top:"-1000px"})}for(i in testElementStyle){testElement.style[i]=testElementStyle[i]}testElement.appendChild(div);testElementParent=body||document.documentElement;testElementParent.insertBefore(testElement,testElementParent.firstChild);div.style.cssText="position: absolute; left: 10.7432222px;";offsetLeft=$(div).offset().left;$.support.offsetFractions=offsetLeft>10&&offsetLeft<11;testElement.innerHTML="";testElementParent.removeChild(testElement)})()})(jQuery);(function($,undefined){var uid=0,hideProps={},showProps={};hideProps.height=hideProps.paddingTop=hideProps.paddingBottom=hideProps.borderTopWidth=hideProps.borderBottomWidth="hide";showProps.height=showProps.paddingTop=showProps.paddingBottom=showProps.borderTopWidth=showProps.borderBottomWidth="show";$.widget("ui.accordion",{version:"1.10.4",options:{active:0,animate:{},collapsible:false,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},// callbacks
activate:null,beforeActivate:null},_create:function(){var options=this.options;this.prevShow=this.prevHide=$();this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist");// don't allow collapsible: false and active: false / null
if(!options.collapsible&&(options.active===false||options.active==null)){options.active=0}this._processPanels();// handle negative values
if(options.active<0){options.active+=this.headers.length}this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:!this.active.length?$():this.active.next(),content:!this.active.length?$():this.active.next()}},_createIcons:function(){var icons=this.options.icons;if(icons){$("<span>").addClass("ui-accordion-header-icon ui-icon "+icons.header).prependTo(this.headers);this.active.children(".ui-accordion-header-icon").removeClass(icons.header).addClass(icons.activeHeader);this.headers.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var contents;// clean up main element
this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");// clean up headers
this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){if(/^ui-accordion/.test(this.id)){this.removeAttribute("id")}});this._destroyIcons();// clean up content panels
contents=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){if(/^ui-accordion/.test(this.id)){this.removeAttribute("id")}});if(this.options.heightStyle!=="content"){contents.css("height","")}},_setOption:function(key,value){if(key==="active"){// _activate() will handle invalid values and update this.options
this._activate(value);return}if(key==="event"){if(this.options.event){this._off(this.headers,this.options.event)}this._setupEvents(value)}this._super(key,value);// setting collapsible: false while collapsed; open first panel
if(key==="collapsible"&&!value&&this.options.active===false){this._activate(0)}if(key==="icons"){this._destroyIcons();if(value){this._createIcons()}}// #5332 - opacity doesn't cascade to positioned elements in IE
// so we need to add the disabled class to the headers and panels
if(key==="disabled"){this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!value)}},_keydown:function(event){if(event.altKey||event.ctrlKey){return}var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._eventHandler(event);break;case keyCode.HOME:toFocus=this.headers[0];break;case keyCode.END:toFocus=this.headers[length-1];break}if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);toFocus.focus();event.preventDefault()}},_panelKeyDown:function(event){if(event.keyCode===$.ui.keyCode.UP&&event.ctrlKey){$(event.currentTarget).prev().focus()}},refresh:function(){var options=this.options;this._processPanels();// was collapsed or no panel
if(options.active===false&&options.collapsible===true||!this.headers.length){options.active=false;this.active=$()}else if(options.active===false){this._activate(0)}else if(this.active.length&&!$.contains(this.element[0],this.active[0])){// all remaining panel are disabled
if(this.headers.length===this.headers.find(".ui-state-disabled").length){options.active=false;this.active=$()}else{this._activate(Math.max(0,options.active-1))}}else{// make sure active index is correct
options.active=this.headers.index(this.active)}this._destroyIcons();this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var maxHeight,options=this.options,heightStyle=options.heightStyle,parent=this.element.parent(),accordionId=this.accordionId="ui-accordion-"+(this.element.attr("id")||++uid);this.active=this._findActive(options.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all");this.active.next().addClass("ui-accordion-content-active").show();this.headers.attr("role","tab").each(function(i){var header=$(this),headerId=header.attr("id"),panel=header.next(),panelId=panel.attr("id");if(!headerId){headerId=accordionId+"-header-"+i;header.attr("id",headerId)}if(!panelId){panelId=accordionId+"-panel-"+i;panel.attr("id",panelId)}header.attr("aria-controls",panelId);panel.attr("aria-labelledby",headerId)}).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide();// make sure at least one header is in the tab order
if(!this.active.length){this.headers.eq(0).attr("tabIndex",0)}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"})}this._createIcons();this._setupEvents(options.event);if(heightStyle==="fill"){maxHeight=parent.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return}maxHeight-=elem.outerHeight(true)});this.headers.each(function(){maxHeight-=$(this).outerHeight(true)});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else if(heightStyle==="auto"){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).css("height","").height())}).height(maxHeight)}},_activate:function(index){var active=this._findActive(index)[0];// trying to activate the already active panel
if(active===this.active[0]){return}// trying to collapse, simulate a click on the currently active header
active=active||this.active[0];this._eventHandler({target:active,currentTarget:active,preventDefault:$.noop})},_findActive:function(selector){return typeof selector==="number"?this.headers.eq(selector):$()},_setupEvents:function(event){var events={keydown:"_keydown"};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"})}this._off(this.headers.add(this.headers.next()));this._on(this.headers,events);this._on(this.headers.next(),{keydown:"_panelKeyDown"});this._hoverable(this.headers);this._focusable(this.headers)},_eventHandler:function(event){var options=this.options,active=this.active,clicked=$(event.currentTarget),clickedIsActive=clicked[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():clicked.next(),toHide=active.next(),eventData={oldHeader:active,oldPanel:toHide,newHeader:collapsing?$():clicked,newPanel:toShow};event.preventDefault();if(// click on active header, but not collapsible
clickedIsActive&&!options.collapsible||// allow canceling activation
this._trigger("beforeActivate",event,eventData)===false){return}options.active=collapsing?false:this.headers.index(clicked);// when the call to ._toggle() comes after the class changes
// it causes a very odd bug in IE 8 (see #6720)
this.active=clickedIsActive?$():clicked;this._toggle(eventData);// switch classes
// corner classes on the previously active header stay after the animation
active.removeClass("ui-accordion-header-active ui-state-active");if(options.icons){active.children(".ui-accordion-header-icon").removeClass(options.icons.activeHeader).addClass(options.icons.header)}if(!clickedIsActive){clicked.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top");if(options.icons){clicked.children(".ui-accordion-header-icon").removeClass(options.icons.header).addClass(options.icons.activeHeader)}clicked.next().addClass("ui-accordion-content-active")}},_toggle:function(data){var toShow=data.newPanel,toHide=this.prevShow.length?this.prevShow:data.oldPanel;// handle activating a panel during the animation for another activation
this.prevShow.add(this.prevHide).stop(true,true);this.prevShow=toShow;this.prevHide=toHide;if(this.options.animate){this._animate(toShow,toHide,data)}else{toHide.hide();toShow.show();this._toggleComplete(data)}toHide.attr({"aria-hidden":"true"});toHide.prev().attr("aria-selected","false");// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
if(toShow.length&&toHide.length){toHide.prev().attr({tabIndex:-1,"aria-expanded":"false"})}else if(toShow.length){this.headers.filter(function(){return $(this).attr("tabIndex")===0}).attr("tabIndex",-1)}toShow.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(toShow,toHide,data){var total,easing,duration,that=this,adjust=0,down=toShow.length&&(!toHide.length||toShow.index()<toHide.index()),animate=this.options.animate||{},options=down&&animate.down||animate,complete=function(){that._toggleComplete(data)};if(typeof options==="number"){duration=options}if(typeof options==="string"){easing=options}// fall back from options to animation in case of partial down settings
easing=easing||options.easing||animate.easing;duration=duration||options.duration||animate.duration;if(!toHide.length){return toShow.animate(showProps,duration,easing,complete)}if(!toShow.length){return toHide.animate(hideProps,duration,easing,complete)}total=toShow.show().outerHeight();toHide.animate(hideProps,{duration:duration,easing:easing,step:function(now,fx){fx.now=Math.round(now)}});toShow.hide().animate(showProps,{duration:duration,easing:easing,complete:complete,step:function(now,fx){fx.now=Math.round(now);if(fx.prop!=="height"){adjust+=fx.now}else if(that.options.heightStyle!=="content"){fx.now=Math.round(total-toHide.outerHeight()-adjust);adjust=0}}})},_toggleComplete:function(data){var toHide=data.oldPanel;toHide.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all");// Work around for rendering bug in IE (#5421)
if(toHide.length){toHide.parent()[0].className=toHide.parent()[0].className}this._trigger("activate",null,data)}})})(jQuery);(function($,undefined){$.widget("ui.autocomplete",{version:"1.10.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,// callbacks
change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){// Some browsers only repeat keydown events, not keypress events,
// so we use the suppressKeyPress flag to determine if we've already
// handled the keydown event. #7269
// Unfortunately the code for & in keypress is the same as the up arrow,
// so we use the suppressKeyPressRepeat flag to avoid handling keypress
// events when we know the keydown event was used to modify the
// search term. #7799
var suppressKeyPress,suppressKeyPressRepeat,suppressInput,nodeName=this.element[0].nodeName.toLowerCase(),isTextarea=nodeName==="textarea",isInput=nodeName==="input";this.isMultiLine=// Textareas are always multi-line
isTextarea?true:// Inputs are always single-line, even if inside a contentEditable element
// IE also treats inputs as contentEditable
isInput?false:// All other element types are determined by whether or not they're contentEditable
this.element.prop("isContentEditable");this.valueMethod=this.element[isTextarea||isInput?"val":"text"];this.isNewMenu=true;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off");this._on(this.element,{keydown:function(event){if(this.element.prop("readOnly")){suppressKeyPress=true;suppressInput=true;suppressKeyPressRepeat=true;return}suppressKeyPress=false;suppressInput=false;suppressKeyPressRepeat=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:suppressKeyPress=true;this._move("previousPage",event);break;case keyCode.PAGE_DOWN:suppressKeyPress=true;this._move("nextPage",event);break;case keyCode.UP:suppressKeyPress=true;this._keyEvent("previous",event);break;case keyCode.DOWN:suppressKeyPress=true;this._keyEvent("next",event);break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:// when menu is open and has focus
if(this.menu.active){// #6055 - Opera still allows the keypress to occur
// which causes forms to submit
suppressKeyPress=true;event.preventDefault();this.menu.select(event)}break;case keyCode.TAB:if(this.menu.active){this.menu.select(event)}break;case keyCode.ESCAPE:if(this.menu.element.is(":visible")){this._value(this.term);this.close(event);// Different browsers have different default behavior for escape
// Single press can mean undo or clear
// Double press in IE means clear the whole form
event.preventDefault()}break;default:suppressKeyPressRepeat=true;// search timeout should be triggered before the input value is changed
this._searchTimeout(event);break}},keypress:function(event){if(suppressKeyPress){suppressKeyPress=false;if(!this.isMultiLine||this.menu.element.is(":visible")){event.preventDefault()}return}if(suppressKeyPressRepeat){return}// replicate some key handlers to allow them to repeat in Firefox and Opera
var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:this._move("previousPage",event);break;case keyCode.PAGE_DOWN:this._move("nextPage",event);break;case keyCode.UP:this._keyEvent("previous",event);break;case keyCode.DOWN:this._keyEvent("next",event);break}},input:function(event){if(suppressInput){suppressInput=false;event.preventDefault();return}this._searchTimeout(event)},focus:function(){this.selectedItem=null;this.previous=this._value()},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching);this.close(event);this._change(event)}});this._initSource();this.menu=$("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({// disable ARIA support, the live region takes care of that
role:null}).hide().data("ui-menu");this._on(this.menu.element,{mousedown:function(event){// prevent moving focus out of the text field
event.preventDefault();// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
this.cancelBlur=true;this._delay(function(){delete this.cancelBlur});// clicking on the scrollbar causes focus to shift to the body
// but we can't detect a mouseup or a click immediately afterward
// so we have to track the next mousedown and close the menu if
// the user clicks somewhere outside of the autocomplete
var menuElement=this.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){this._delay(function(){var that=this;this.document.one("mousedown",function(event){if(event.target!==that.element[0]&&event.target!==menuElement&&!$.contains(menuElement,event.target)){that.close()}})})}},menufocus:function(event,ui){// support: Firefox
// Prevent accidental activation of menu items in Firefox (#7024 #9118)
if(this.isNewMenu){this.isNewMenu=false;if(event.originalEvent&&/^mouse/.test(event.originalEvent.type)){this.menu.blur();this.document.one("mousemove",function(){$(event.target).trigger(event.originalEvent)});return}}var item=ui.item.data("ui-autocomplete-item");if(false!==this._trigger("focus",event,{item:item})){// use value to match what will end up in the input, if it was a key event
if(event.originalEvent&&/^key/.test(event.originalEvent.type)){this._value(item.value)}}else{// Normally the input is populated with the item's value as the
// menu is navigated, causing screen readers to notice a change and
// announce the item. Since the focus event was canceled, this doesn't
// happen, so we update the live region so that screen readers can
// still notice the change and announce it.
this.liveRegion.text(item.value)}},menuselect:function(event,ui){var item=ui.item.data("ui-autocomplete-item"),previous=this.previous;// only trigger when focus was lost (click on menu)
if(this.element[0]!==this.document[0].activeElement){this.element.focus();this.previous=previous;// #6109 - IE triggers two focus events and the second
// is asynchronous, so we need to reset the previous
// term synchronously and asynchronously :-(
this._delay(function(){this.previous=previous;this.selectedItem=item})}if(false!==this._trigger("select",event,{item:item})){this._value(item.value)}// reset the term after the select event
// this allows custom select handling to work properly
this.term=this._value();this.close(event);this.selectedItem=item}});this.liveRegion=$("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element);// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching);this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete");this.menu.element.remove();this.liveRegion.remove()},_setOption:function(key,value){this._super(key,value);if(key==="source"){this._initSource()}if(key==="appendTo"){this.menu.element.appendTo(this._appendTo())}if(key==="disabled"&&value&&this.xhr){this.xhr.abort()}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0)}if(!element){element=this.element.closest(".ui-front")}if(!element.length){element=this.document[0].body}return element},_initSource:function(){var array,url,that=this;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term))}}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(that.xhr){that.xhr.abort()}that.xhr=$.ajax({url:url,data:request,dataType:"json",success:function(data){response(data)},error:function(){response([])}})}}else{this.source=this.options.source}},_searchTimeout:function(event){clearTimeout(this.searching);this.searching=this._delay(function(){// only search if the value has changed
if(this.term!==this._value()){this.selectedItem=null;this.search(null,event)}},this.options.delay)},search:function(value,event){value=value!=null?value:this._value();// always save the actual value, not the one passed as an argument
this.term=this._value();if(value.length<this.options.minLength){return this.close(event)}if(this._trigger("search",event)===false){return}return this._search(value)},_search:function(value){this.pending++;this.element.addClass("ui-autocomplete-loading");this.cancelSearch=false;this.source({term:value},this._response())},_response:function(){var index=++this.requestIndex;return $.proxy(function(content){if(index===this.requestIndex){this.__response(content)}this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading")}},this)},__response:function(content){if(content){content=this._normalize(content)}this._trigger("response",null,{content:content});if(!this.options.disabled&&content&&content.length&&!this.cancelSearch){this._suggest(content);this._trigger("open")}else{// use ._close() instead of .close() so we don't cancel future searches
this._close()}},close:function(event){this.cancelSearch=true;this._close(event)},_close:function(event){if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.blur();this.isNewMenu=true;this._trigger("close",event)}},_change:function(event){if(this.previous!==this._value()){this._trigger("change",event,{item:this.selectedItem})}},_normalize:function(items){// assume all items have the right format when the first item is complete
if(items.length&&items[0].label&&items[0].value){return items}return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item}}return $.extend({label:item.label||item.value,value:item.value||item.label},item)})},_suggest:function(items){var ul=this.menu.element.empty();this._renderMenu(ul,items);this.isNewMenu=true;this.menu.refresh();// size and position menu
ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next()}},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(// Firefox wraps long text (possibly a rounding bug)
// so we add 1px to avoid the wrapping (#7513)
ul.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(ul,items){var that=this;$.each(items,function(index,item){that._renderItemData(ul,item)})},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-autocomplete-item",item)},_renderItem:function(ul,item){return $("<li>").append($("<a>").text(item.label)).appendTo(ul)},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return}if(this.menu.isFirstItem()&&/^previous/.test(direction)||this.menu.isLastItem()&&/^next/.test(direction)){this._value(this.term);this.menu.blur();return}this.menu[direction](event)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(keyEvent,event){if(!this.isMultiLine||this.menu.element.is(":visible")){this._move(keyEvent,event);// prevents moving cursor to beginning/end of the text field in some browsers
event.preventDefault()}}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value)})}});// live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget("ui.autocomplete",$.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(amount){return amount+(amount>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(content){var message;this._superApply(arguments);if(this.options.disabled||this.cancelSearch){return}if(content&&content.length){message=this.options.messages.results(content.length)}else{message=this.options.messages.noResults}this.liveRegion.text(message)}})})(jQuery);(function($,undefined){var lastActive,baseClasses="ui-button ui-widget ui-state-default ui-corner-all",typeClasses="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",formResetHandler=function(){var form=$(this);setTimeout(function(){form.find(":ui-button").button("refresh")},1)},radioGroup=function(radio){var name=radio.name,form=radio.form,radios=$([]);if(name){name=name.replace(/'/g,"\\'");if(form){radios=$(form).find("[name='"+name+"']")}else{radios=$("[name='"+name+"']",radio.ownerDocument).filter(function(){return!this.form})}}return radios};$.widget("ui.button",{version:"1.10.4",defaultElement:"<button>",options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,formResetHandler);if(typeof this.options.disabled!=="boolean"){this.options.disabled=!!this.element.prop("disabled")}else{this.element.prop("disabled",this.options.disabled)}this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var that=this,options=this.options,toggleButton=this.type==="checkbox"||this.type==="radio",activeClass=!toggleButton?"ui-state-active":"";if(options.label===null){options.label=this.type==="input"?this.buttonElement.val():this.buttonElement.html()}this._hoverable(this.buttonElement);this.buttonElement.addClass(baseClasses).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(options.disabled){return}if(this===lastActive){$(this).addClass("ui-state-active")}}).bind("mouseleave"+this.eventNamespace,function(){if(options.disabled){return}$(this).removeClass(activeClass)}).bind("click"+this.eventNamespace,function(event){if(options.disabled){event.preventDefault();event.stopImmediatePropagation()}});// Can't use _focusable() because the element that receives focus
// and the element that gets the ui-state-focus class are different
this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}});if(toggleButton){this.element.bind("change"+this.eventNamespace,function(){that.refresh()})}if(this.type==="checkbox"){this.buttonElement.bind("click"+this.eventNamespace,function(){if(options.disabled){return false}})}else if(this.type==="radio"){this.buttonElement.bind("click"+this.eventNamespace,function(){if(options.disabled){return false}$(this).addClass("ui-state-active");that.buttonElement.attr("aria-pressed","true");var radio=that.element[0];radioGroup(radio).not(radio).map(function(){return $(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")})}else{this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(options.disabled){return false}$(this).addClass("ui-state-active");lastActive=this;that.document.one("mouseup",function(){lastActive=null})}).bind("mouseup"+this.eventNamespace,function(){if(options.disabled){return false}$(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(event){if(options.disabled){return false}if(event.keyCode===$.ui.keyCode.SPACE||event.keyCode===$.ui.keyCode.ENTER){$(this).addClass("ui-state-active")}}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){$(this).removeClass("ui-state-active")});if(this.buttonElement.is("a")){this.buttonElement.keyup(function(event){if(event.keyCode===$.ui.keyCode.SPACE){// TODO pass through original event correctly (just as 2nd argument doesn't work)
$(this).click()}})}}// TODO: pull out $.Widget's handling for the disabled option into
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
// be overridden by individual plugins
this._setOption("disabled",options.disabled);this._resetButton()},_determineButtonType:function(){var ancestor,labelSelector,checked;if(this.element.is("[type=checkbox]")){this.type="checkbox"}else if(this.element.is("[type=radio]")){this.type="radio"}else if(this.element.is("input")){this.type="input"}else{this.type="button"}if(this.type==="checkbox"||this.type==="radio"){// we don't search against the document in case the element
// is disconnected from the DOM
ancestor=this.element.parents().last();labelSelector="label[for='"+this.element.attr("id")+"']";this.buttonElement=ancestor.find(labelSelector);if(!this.buttonElement.length){ancestor=ancestor.length?ancestor.siblings():this.element.siblings();this.buttonElement=ancestor.filter(labelSelector);if(!this.buttonElement.length){this.buttonElement=ancestor.find(labelSelector)}}this.element.addClass("ui-helper-hidden-accessible");checked=this.element.is(":checked");if(checked){this.buttonElement.addClass("ui-state-active")}this.buttonElement.prop("aria-pressed",checked)}else{this.buttonElement=this.element}},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass(baseClasses+" ui-state-active "+typeClasses).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());if(!this.hasTitle){this.buttonElement.removeAttr("title")}},_setOption:function(key,value){this._super(key,value);if(key==="disabled"){this.element.prop("disabled",!!value);if(value){this.buttonElement.removeClass("ui-state-focus")}return}this._resetButton()},refresh:function(){//See #8237 & #8828
var isDisabled=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");if(isDisabled!==this.options.disabled){this._setOption("disabled",isDisabled)}if(this.type==="radio"){radioGroup(this.element[0]).each(function(){if($(this).is(":checked")){$(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true")}else{$(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}})}else if(this.type==="checkbox"){if(this.element.is(":checked")){this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true")}else{this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false")}}},_resetButton:function(){if(this.type==="input"){if(this.options.label){this.element.val(this.options.label)}return}var buttonElement=this.buttonElement.removeClass(typeClasses),buttonText=$("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(buttonElement.empty()).text(),icons=this.options.icons,multipleIcons=icons.primary&&icons.secondary,buttonClasses=[];if(icons.primary||icons.secondary){if(this.options.text){buttonClasses.push("ui-button-text-icon"+(multipleIcons?"s":icons.primary?"-primary":"-secondary"))}if(icons.primary){buttonElement.prepend("<span class='ui-button-icon-primary ui-icon "+icons.primary+"'></span>")}if(icons.secondary){buttonElement.append("<span class='ui-button-icon-secondary ui-icon "+icons.secondary+"'></span>")}if(!this.options.text){buttonClasses.push(multipleIcons?"ui-button-icons-only":"ui-button-icon-only");if(!this.hasTitle){buttonElement.attr("title",$.trim(buttonText))}}}else{buttonClasses.push("ui-button-text-only")}buttonElement.addClass(buttonClasses.join(" "))}});$.widget("ui.buttonset",{version:"1.10.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(key,value){if(key==="disabled"){this.buttons.button("option",key,value)}this._super(key,value)},refresh:function(){var rtl=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(rtl?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(rtl?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return $(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function($,undefined){$.extend($.ui,{datepicker:{version:"1.10.4"}});var PROP_NAME="datepicker",instActive;/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */
function Datepicker(){this._curInst=null;// The current instance in use
this._keyEvent=false;// If the last event was a key event
this._disabledInputs=[];// List of date picker inputs that have been disabled
this._datepickerShowing=false;// True if the popup picker is showing , false if not
this._inDialog=false;// True if showing within a "dialog", false if not
this._mainDivId="ui-datepicker-div";// The ID of the main datepicker division
this._inlineClass="ui-datepicker-inline";// The name of the inline marker class
this._appendClass="ui-datepicker-append";// The name of the append marker class
this._triggerClass="ui-datepicker-trigger";// The name of the trigger marker class
this._dialogClass="ui-datepicker-dialog";// The name of the dialog marker class
this._disableClass="ui-datepicker-disabled";// The name of the disabled covering marker class
this._unselectableClass="ui-datepicker-unselectable";// The name of the unselectable cell marker class
this._currentClass="ui-datepicker-current-day";// The name of the current day marker class
this._dayOverClass="ui-datepicker-days-cell-over";// The name of the day hover marker class
this.regional=[];// Available regional settings, indexed by language code
this.regional[""]={// Default regional settings
closeText:"Done",// Display text for close link
prevText:"Prev",// Display text for previous month link
nextText:"Next",// Display text for next month link
currentText:"Today",// Display text for current month link
monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],// Names of months for drop-down and formatting
monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],// For formatting
dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],// For formatting
dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],// For formatting
dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],// Column headings for days starting at Sunday
weekHeader:"Wk",// Column header for week of the year
dateFormat:"mm/dd/yy",// See format options on parseDate
firstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...
isRTL:false,// True if right-to-left language, false if left-to-right
showMonthAfterYear:false,// True if the year select precedes month, false for month then year
yearSuffix:""};this._defaults={// Global defaults for all the date picker instances
showOn:"focus",// "focus" for popup on focus,
// "button" for trigger button, or "both" for either
showAnim:"fadeIn",// Name of jQuery animation for popup
showOptions:{},// Options for enhanced animations
defaultDate:null,// Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText:"",// Display text following the input box, e.g. showing the format
buttonText:"...",// Text for trigger button
buttonImage:"",// URL for trigger button image
buttonImageOnly:false,// True if the image appears alone, false if it appears on a button
hideIfNoPrevNext:false,// True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat:false,// True if date formatting applied to prev/today/next links
gotoCurrent:false,// True if today link goes back to current selection instead
changeMonth:false,// True if month can be selected directly, false if only prev/next
changeYear:false,// True if year can be selected directly, false if only prev/next
yearRange:"c-10:c+10",// Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths:false,// True to show dates in other months, false to leave blank
selectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable
showWeek:false,// True to show week of the year, false to not show it
calculateWeek:this.iso8601Week,// How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff:"+10",// Short year values < this are in the current century,
// > this are in the previous century,
// string value starting with "+" for current year + value
minDate:null,// The earliest selectable date, or null for no limit
maxDate:null,// The latest selectable date, or null for no limit
duration:"fast",// Duration of display/closure
beforeShowDay:null,// Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow:null,// Function that takes an input field and
// returns a set of custom settings for the date picker
onSelect:null,// Define a callback function when a date is selected
onChangeMonthYear:null,// Define a callback function when the month or year is changed
onClose:null,// Define a callback function when the datepicker is closed
numberOfMonths:1,// Number of months to show at a time
showCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)
stepMonths:1,// Number of months to step back/forward
stepBigMonths:12,// Number of months to step back/forward for the big links
altField:"",// Selector for an alternate field to store selected dates into
altFormat:"",// The date format to use for the alternate field
constrainInput:true,// The input is constrained by the current date format
showButtonPanel:false,// True to show button panel, false to not show it
autoSize:false,// True to size the input for the date format, false to leave as is
disabled:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=bindHover($("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}$.extend(Datepicker.prototype,{/* Class name added to elements to indicate already configured with a date picker. */
markerClassName:"hasDatepicker",//Keep track of the maximum number of rows displayed (see #7043)
maxRows:4,// TODO rename to "widget" when switching to widget factory
_widgetDatepicker:function(){return this.dpDiv},/* Override the default settings for all instances of the date picker.
	 * @param  settings  object - the new settings to use as defaults (anonymous object)
	 * @return the manager object
	 */
setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},/* Attach the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 * @param  settings  object - the new settings to use for this date picker instance (anonymous)
	 */
_attachDatepicker:function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase();inline=nodeName==="div"||nodeName==="span";if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{});if(nodeName==="input"){this._connectDatepicker(target,inst)}else if(inline){this._inlineDatepicker(target,inst)}},/* Create a new instance object. */
_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");// escape jQuery meta chars
return{id:id,input:target,// associated target
selectedDay:0,selectedMonth:0,selectedYear:0,// current selection
drawMonth:0,drawYear:0,// month being drawn
inline:inline,// is datepicker inline or not
dpDiv:!inline?this.dpDiv:// presentation div
bindHover($("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}},/* Attach the date picker to an input field. */
_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp);this._autoSize(inst);$.data(target,PROP_NAME,inst);//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
if(inst.settings.disabled){this._disableDatepicker(target)}},/* Make attachments based on settings. */
_attachments:function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$("<span class='"+this._appendClass+"'>"+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}showOn=this._get(inst,"showOn");if(showOn==="focus"||showOn==="both"){// pop-up date picker when in the marked field
input.focus(this._showDatepicker)}if(showOn==="button"||showOn==="both"){// pop-up date picker when button clicked
buttonText=this._get(inst,"buttonText");buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[0]){$.datepicker._hideDatepicker()}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[0]){$.datepicker._hideDatepicker();$.datepicker._showDatepicker(input[0])}else{$.datepicker._showDatepicker(input[0])}return false})}},/* Apply the maximum length for the date format. */
_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,12-1,20),// Ensure double digits
dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){findMax=function(names){max=0;maxI=0;for(i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,dateFormat.match(/MM/)?"monthNames":"monthNamesShort")));date.setDate(findMax(this._get(inst,dateFormat.match(/DD/)?"dayNames":"dayNamesShort"))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},/* Attach an inline date picker to a div. */
_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv);$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
if(inst.settings.disabled){this._disableDatepicker(target)}// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
inst.dpDiv.css("display","block")},/* Pop-up the date picker in a "dialog" box.
	 * @param  input element - ignored
	 * @param  date	string or Date - the initial date to display
	 * @param  onSelect  function - the function to call when a date is selected
	 * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
	 * @param  pos int[2] - coordinates for the dialog's position within the screen or
	 *					event - with x/y coordinates or
	 *					leave empty for default (screen centre)
	 * @return the manager object
	 */
_dialogDatepicker:function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;// internal instance
if(!inst){this.uuid+=1;id="dp"+this.uuid;this._dialogInput=$("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>");this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=date&&date.constructor===Date?this._formatDate(inst,date):date;this._dialogInput.val(date);this._pos=pos?pos.length?pos:[pos.pageX,pos.pageY]:null;if(!this._pos){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=// should use actual width/height below
[browserWidth/2-100+scrollX,browserHeight/2-150+scrollY]}// move input on screen for focus, but hidden behind dialog
this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},/* Detach a datepicker from its control.
	 * @param  target	element - the target input field or division or span
	 */
_destroyDatepicker:function(target){var nodeName,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName==="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(nodeName==="div"||nodeName==="span"){$target.removeClass(this.markerClassName).empty()}},/* Enable the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 */
_enableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",false)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value})},/* Disable the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 */
_disableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",true)}this._disabledInputs=$.map(this._disabledInputs,function(value){return value===target?null:value});// delete entry
this._disabledInputs[this._disabledInputs.length]=target},/* Is the first field in a jQuery collection disabled as a datepicker?
	 * @param  target	element - the target input field or division or span
	 * @return boolean - true if disabled, false if enabled
	 */
_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]===target){return true}}return false},/* Retrieve the instance data for the target control.
	 * @param  target  element - the target input field or division or span
	 * @return  object - the associated instance data
	 * @throws  error if a jQuery problem getting data
	 */
_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},/* Update or retrieve the settings for a date picker attached to an input field or division.
	 * @param  target  element - the target input field or division or span
	 * @param  name	object - the new settings to update or
	 *				string - the name of the setting to change or retrieve,
	 *				when retrieving also "all" for all instance settings or
	 *				"defaults" for all global defaults
	 * @param  value   any - the new value for the setting
	 *				(omit if above is an object or to retrieve a value)
	 */
_optionDatepicker:function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name==="string"){return name==="defaults"?$.extend({},$.datepicker._defaults):inst?name==="all"?$.extend({},inst.settings):this._get(inst,name):null}settings=name||{};if(typeof name==="string"){settings={};settings[name]=value}if(inst){if(this._curInst===inst){this._hideDatepicker()}date=this._getDateDatepicker(target,true);minDate=this._getMinMaxDate(inst,"min");maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}if("disabled"in settings){if(settings.disabled){this._disableDatepicker(target)}else{this._enableDatepicker(target)}}this._attachments($(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst)}},// change method deprecated
_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},/* Redraw the date picker attached to an input field or division.
	 * @param  target  element - the target input field or division or span
	 */
_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},/* Set the dates for a jQuery selection.
	 * @param  target element - the target input field or division or span
	 * @param  date	Date - the new date
	 */
_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},/* Get the date(s) for the first entry in a jQuery selection.
	 * @param  target element - the target input field or division or span
	 * @param  noDefault boolean - true if no default date is to be used
	 * @return Date - the current date
	 */
_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return inst?this._getDate(inst):null},/* Handle keystrokes. */
_doKeyDown:function(event){var onSelect,dateStr,sel,inst=$.datepicker._getInst(event.target),handled=true,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;// hide on tab out
case 13:sel=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}onSelect=$.datepicker._get(inst,"onSelect");if(onSelect){dateStr=$.datepicker._formatDate(inst);// trigger custom callback
onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])}else{$.datepicker._hideDatepicker()}return false;// don't submit the form
case 27:$.datepicker._hideDatepicker();break;// hide on escape
case 33:$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M");break;// previous month/year on page up/+ ctrl
case 34:$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M");break;// next month/year on page down/+ ctrl
case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;// clear on ctrl or command +end
case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;// current on ctrl or command +home
case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?+1:-1,"D")}handled=event.ctrlKey||event.metaKey;// -1 day on ctrl or command +left
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths"),"M")}// next month/year on alt +left on Mac
break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;// -1 week on ctrl or command +up
case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,isRTL?-1:+1,"D")}handled=event.ctrlKey||event.metaKey;// +1 day on ctrl or command +right
if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths"),"M")}// next month/year on alt +right
break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;// +1 week on ctrl or command +down
default:handled=false}}else if(event.keyCode===36&&event.ctrlKey){// display the date picker on ctrl+home
$.datepicker._showDatepicker(this)}else{handled=false}if(handled){event.preventDefault();event.stopPropagation()}},/* Filter entered characters - based on date format. */
_doKeyPress:function(event){var chars,chr,inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},/* Synchronise manual entry and field/alternate field. */
_doKeyUp:function(event){var date,inst=$.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal){try{date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),inst.input?inst.input.val():null,$.datepicker._getFormatConfig(inst));if(date){// only if valid
$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst)}}catch(err){}}return true},/* Pop-up the date picker for a given input field.
	 * If false returned from beforeShow event handler do not show.
	 * @param  input  element - the input field attached to the date picker or
	 *					event - if triggered by focus
	 */
_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!=="input"){// find from button/image trigger
input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){// already here
return}var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!==inst){$.datepicker._curInst.dpDiv.stop(true,true);if(inst&&$.datepicker._datepickerShowing){$.datepicker._hideDatepicker($.datepicker._curInst.input[0])}}beforeShow=$.datepicker._get(inst,"beforeShow");beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return}extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){// hide cursor
input.value=""}if(!$.datepicker._pos){// position below input
$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")==="fixed";return!isFixed});offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;//to avoid flashes on Firefox
inst.dpDiv.empty();// determine sizing offscreen
inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);// fix width for dynamic number of date pickers
// and adjust position before showing
offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){showAnim=$.datepicker._get(inst,"showAnim");duration=$.datepicker._get(inst,"duration");inst.dpDiv.zIndex($(input).zIndex()+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects.effect[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration)}else{inst.dpDiv[showAnim||"show"](showAnim?duration:null)}if($.datepicker._shouldFocusInput(inst)){inst.input.focus()}$.datepicker._curInst=inst}},/* Generate the date picker content. */
_updateDatepicker:function(inst){this.maxRows=4;//Reset the max number of rows being displayed (see #7043)
instActive=inst;// for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));this._attachHandlers(inst);inst.dpDiv.find("."+this._dayOverClass+" a").mouseover();var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17;inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",width*cols+"em")}inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst)){inst.input.focus()}// deffered render of the years select (to avoid flashes on Firefox)
if(inst.yearshtml){origyearshtml=inst.yearshtml;setTimeout(function(){//assure that inst.yearshtml didn't change.
if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},// #6694 - don't focus the input if it's already focused
// this breaks the change event in IE
// Support: IE and jQuery <1.9
_shouldFocusInput:function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus")},/* Check positioning to remain on screen. */
_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$(document).scrollTop());offset.left-=this._get(inst,"isRTL")?dpWidth-inputWidth:0;offset.left-=isFixed&&offset.left===inst.input.offset().left?$(document).scrollLeft():0;offset.top-=isFixed&&offset.top===inst.input.offset().top+inputHeight?$(document).scrollTop():0;// now check if datepicker is showing outside window viewport - move to a better place if so.
offset.left-=Math.min(offset.left,offset.left+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,offset.top+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight):0);return offset},/* Find an object's position on the screen. */
_findPos:function(obj){var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}position=$(obj).offset();return[position.left,position.top]},/* Hide the date picker from view.
	 * @param  input  element - the input field attached to the date picker
	 */
_hideDatepicker:function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;if(!inst||input&&inst!==$.data(input,PROP_NAME)){return}if(this._datepickerShowing){showAnim=this._get(inst,"showAnim");duration=this._get(inst,"duration");postProcess=function(){$.datepicker._tidyDialog(inst)};// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if($.effects&&($.effects.effect[showAnim]||$.effects[showAnim])){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim==="slideDown"?"slideUp":showAnim==="fadeIn"?"fadeOut":"hide"](showAnim?duration:null,postProcess)}if(!showAnim){postProcess()}this._datepickerShowing=false;onClose=this._get(inst,"onClose");if(onClose){onClose.apply(inst.input?inst.input[0]:null,[inst.input?inst.input.val():"",inst])}this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},/* Tidy up after a dialog display. */
_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},/* Close date picker if clicked elsewhere. */
_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target),inst=$.datepicker._getInst($target[0]);if($target[0].id!==$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length===0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)||$target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst){$.datepicker._hideDatepicker()}},/* Adjust one of the date sub-fields. */
_adjustDate:function(id,offset,period){var target=$(id),inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period==="M"?this._get(inst,"showCurrentAtPos"):0),// undo positioning
period);this._updateDatepicker(inst)},/* Action for current link. */
_gotoToday:function(id){var date,target=$(id),inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{date=new Date;inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},/* Action for selecting a new month/year. */
_selectMonthYear:function(id,select,period){var target=$(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},/* Action for selecting a day. */
_selectDay:function(id,month,year,td){var inst,target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},/* Erase the input field and hide the date picker. */
_clearDate:function(id){var target=$(id);this._selectDate(target,"")},/* Update the input field with the selected date. */
_selectDate:function(id,dateStr){var onSelect,target=$(id),inst=this._getInst(target[0]);dateStr=dateStr!=null?dateStr:this._formatDate(inst);if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply(inst.input?inst.input[0]:null,[dateStr,inst])}else if(inst.input){inst.input.trigger("change")}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof inst.input[0]!=="object"){inst.input.focus()}this._lastInput=null}},/* Update any alternate field to synchronise with the main field. */
_updateAlternate:function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");if(altField){// update alternate field too
altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},/* Set as beforeShowDay function to prevent selection of weekends.
	 * @param  date  Date - the date to customise
	 * @return [boolean, string] - is this date selectable?, what is its CSS class?
	 */
noWeekends:function(date){var day=date.getDay();return[day>0&&day<6,""]},/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
	 * @param  date  Date - the date to get the week for
	 * @return  number - the number of the week within the year that contains this date
	 */
iso8601Week:function(date){var time,checkDate=new Date(date.getTime());// Find Thursday of this week starting on Monday
checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));time=checkDate.getTime();checkDate.setMonth(0);// Compare with Jan 1
checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/864e5)/7)+1},/* Parse a string value into a date object.
	 * See formatDate below for the possible formats.
	 *
	 * @param  format string - the expected format of the date
	 * @param  value string - the date in the above format
	 * @param  settings Object - attributes include:
	 *					shortYearCutoff  number - the cutoff year for determining the century (optional)
	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
	 *					dayNames		string[7] - names of the days from Sunday (optional)
	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
	 *					monthNames		string[12] - names of the months (optional)
	 * @return  Date - the extracted date value or null if value is blank
	 */
parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=typeof value==="object"?value.toString():value+"";if(value===""){return null}var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=typeof shortYearCutoffTemp!=="string"?shortYearCutoffTemp:(new Date).getFullYear()%100+parseInt(shortYearCutoffTemp,10),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=false,date,// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},// Extract a number from the string value
getNumber=function(match){var isDoubled=lookAhead(match),size=match==="@"?14:match==="!"?20:match==="y"&&isDoubled?4:match==="o"?3:2,digits=new RegExp("^\\d{1,"+size+"}"),num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)},// Extract a name from the string value and convert to an index
getName=function(match,shortNames,longNames){var index=-1,names=$.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return-(a[1].length-b[1].length)});$.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase()){index=pair[0];iValue+=name.length;return false}});if(index!==-1){return index+1}else{throw"Unknown name at position "+iValue}},// Confirm that a literal character matches the string value
checkLiteral=function(){if(value.charAt(iValue)!==format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/1e4);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(iValue<value.length){extra=value.substr(iValue);if(!/^\s+/.test(extra)){throw"Extra/unparsed characters found in date: "+extra}}if(year===-1){year=(new Date).getFullYear()}else if(year<100){year+=(new Date).getFullYear()-(new Date).getFullYear()%100+(year<=shortYearCutoff?0:-100)}if(doy>-1){month=1;day=doy;do{dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day){throw"Invalid date"}return date},/* Standard date formats. */
ATOM:"yy-mm-dd",// RFC 3339 (ISO 8601)
COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",// RFC 822
TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",// ISO 8601
_ticksTo1970:((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*1e7,/* Format a date object into a string value.
	 * The format can be combinations of the following:
	 * d  - day of month (no leading zero)
	 * dd - day of month (two digit)
	 * o  - day of year (no leading zeros)
	 * oo - day of year (three digit)
	 * D  - day name short
	 * DD - day name long
	 * m  - month of year (no leading zero)
	 * mm - month of year (two digit)
	 * M  - month name short
	 * MM - month name long
	 * y  - year (two digit)
	 * yy - year (four digit)
	 * @ - Unix timestamp (ms since 01/01/1970)
	 * ! - Windows ticks (100ns since 01/01/0001)
	 * "..." - literal text
	 * '' - single quote
	 *
	 * @param  format string - the desired format of the date
	 * @param  date Date - the date value to format
	 * @param  settings Object - attributes include:
	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
	 *					dayNames		string[7] - names of the days from Sunday (optional)
	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
	 *					monthNames		string[12] - names of the months (optional)
	 * @return  string - the date in the above format
	 */
formatDate:function(format,date,settings){if(!date){return""}var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches},// Format a number, with leading zero if necessary
formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num},// Format a name, short or long as requested
formatName=function(match,value,shortNames,longNames){return lookAhead(match)?longNames[value]:shortNames[value]},output="",literal=false;if(date){for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/864e5),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100;break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*1e4+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},/* Extract all possible characters from the date format. */
_possibleChars:function(format){var iFormat,chars="",literal=false,// Check whether a format character is doubled
lookAhead=function(match){var matches=iFormat+1<format.length&&format.charAt(iFormat+1)===match;if(matches){iFormat++}return matches};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;// Accept anything
case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},/* Get a setting value, defaulting if necessary. */
_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},/* Parse existing date and initialise date picker. */
_setDateFromField:function(inst,noDefault){if(inst.input.val()===inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){dates=noDefault?"":dates}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=dates?date.getDate():0;inst.currentMonth=dates?date.getMonth():0;inst.currentYear=dates?date.getFullYear():0;this._adjustInstDate(inst)},/* Retrieve the default date shown on opening. */
_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date))},/* A date may be specified as an exact value or a relative one. */
_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date;date.setDate(date.getDate()+offset);return date},offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst))}catch(e){}var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date,year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)},newDate=date==null||date===""?defaultDate:typeof date==="string"?offsetString(date):typeof date==="number"?isNaN(date)?defaultDate:offsetNumeric(date):new Date(date.getTime());newDate=newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate;if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},/* Handle switch to/from daylight saving.
	 * Hours may be non-zero on daylight saving cut-over:
	 * > 12 when midnight changeover, but then cannot generate
	 * midnight datetime, so jump to 1AM, otherwise reset.
	 * @param  date  (Date) the date to check
	 * @return  (Date) the corrected date
	 */
_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},/* Set the date(s) directly. */
_setDate:function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},/* Retrieve the date(s) directly. */
_getDate:function(inst){var startDate=!inst.currentYear||inst.input&&inst.input.val()===""?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return startDate},/* Attach the onxxx handlers.  These are declared statically so
	 * they work with static code transformers like Caja.
	 */
_attachHandlers:function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:function(){$.datepicker._adjustDate(id,-stepMonths,"M")},next:function(){$.datepicker._adjustDate(id,+stepMonths,"M")},hide:function(){$.datepicker._hideDatepicker()},today:function(){$.datepicker._gotoToday(id)},selectDay:function(){$.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this);return false},selectMonth:function(){$.datepicker._selectMonthYear(id,this,"M");return false},selectYear:function(){$.datepicker._selectMonthYear(id,this,"Y");return false}};$(this).bind(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")])})},/* Generate the HTML for the current state of the date picker. */
_generateHTML:function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date,today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),// clear time
isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=numMonths[0]!==1||numMonths[1]!==1,currentDate=this._daylightSavingAdjust(!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[0]*numMonths[1]+1,maxDate.getDate()));maxDraw=minDate&&maxDraw<minDate?minDate:maxDraw;while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;prevText=this._get(inst,"prevText");prevText=!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst));prev=this._canAdjustMonth(inst,-1,drawYear,drawMonth)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'"+" title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>";nextText=this._get(inst,"nextText");nextText=!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst));next=this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'"+" title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>":hideIfNoPrevNext?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>";currentText=this._get(inst,"currentText");gotoDate=this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today;currentText=!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst));controls=!inst.inline?"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(inst,"closeText")+"</button>":"";buttonPanel=showButtonPanel?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'"+">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=isNaN(firstDay)?0:firstDay;showWeek=this._get(inst,"showWeek");dayNames=this._get(inst,"dayNames");dayNamesMin=this._get(inst,"dayNamesMin");monthNames=this._get(inst,"monthNames");monthNamesShort=this._get(inst,"monthNamesShort");beforeShowDay=this._get(inst,"beforeShowDay");showOtherMonths=this._get(inst,"showOtherMonths");selectOtherMonths=this._get(inst,"selectOtherMonths");defaultDate=this._getDefaultDate(inst);html="";dow;for(row=0;row<numMonths[0];row++){group="";this.maxRows=4;for(col=0;col<numMonths[1];col++){selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));cornerClass=" ui-corner-all";calender="";if(isMultiMonth){calender+="<div class='ui-datepicker-group";if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+="'>"}calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+(/all|left/.test(cornerClass)&&row===0?isRTL?next:prev:"")+(/all|right/.test(cornerClass)&&row===0?isRTL?prev:next:"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+// draw month headers
"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>";thead=showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"";for(dow=0;dow<7;dow++){// days of the week
day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;curRows=Math.ceil((leadDays+daysInMonth)/7);// calculate the number of rows to generate
numRows=isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows;//If multiple months, use the higher number of rows (see #7043)
this.maxRows=numRows;printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(dRow=0;dRow<numRows;dRow++){// create date picker rows
calender+="<tr>";tbody=!showWeek?"":"<td class='ui-datepicker-week-col'>"+this._get(inst,"calculateWeek")(printDate)+"</td>";for(dow=0;dow<7;dow++){// create date picker days
daySettings=beforeShowDay?beforeShowDay.apply(inst.input?inst.input[0]:null,[printDate]):[true,""];otherMonth=printDate.getMonth()!==drawMonth;unselectable=otherMonth&&!selectOtherMonths||!daySettings[0]||minDate&&printDate<minDate||maxDate&&printDate>maxDate;tbody+="<td class='"+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(// highlight weekends
otherMonth?" ui-datepicker-other-month":"")+(// highlight days from other months
printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent||// user pressed key
defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime()?// or defaultDate is current printedDate and defaultDate is selectedDate
" "+this._dayOverClass:"")+(// highlight selected day
unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(// highlight unselectable days
otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(// highlight custom dates
printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+(// highlight selected day
printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+(// highlight today (if different)
(!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+(// cell title
unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+(// actions
otherMonth&&!showOtherMonths?"&#xa0;":// display for other months
unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+(// highlight selected day
otherMonth?" ui-priority-secondary":"")+// distinguish dates from other months
"' href='#'>"+printDate.getDate()+"</a>")+"</td>";// display selectable date
printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+(numMonths[0]>0&&col===numMonths[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"");group+=calender}html+=group}html+=buttonPanel;inst._keyEvent=false;return html},/* Generate the month and year header. */
_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),html="<div class='ui-datepicker-title'>",monthHtml="";// month selection
if(secondary||!changeMonth){monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>"}else{inMinYear=minDate&&minDate.getFullYear()===drawYear;inMaxYear=maxDate&&maxDate.getFullYear()===drawYear;monthHtml+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for(month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+="<option value='"+month+"'"+(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")}// year selection
if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+="<span class='ui-datepicker-year'>"+drawYear+"</span>"}else{// determine range of years to display
years=this._get(inst,"yearRange").split(":");thisYear=(new Date).getFullYear();determineYear=function(value){var year=value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10);return isNaN(year)?thisYear:year};year=determineYear(years[0]);endYear=Math.max(year,determineYear(years[1]||""));year=minDate?Math.max(year,minDate.getFullYear()):year;endYear=maxDate?Math.min(endYear,maxDate.getFullYear()):endYear;inst.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for(;year<=endYear;year++){inst.yearshtml+="<option value='"+year+"'"+(year===drawYear?" selected='selected'":"")+">"+year+"</option>"}inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml}html+="</div>";// Close datepicker_header
return html},/* Adjust one of the date sub-fields. */
_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period==="Y"?offset:0),month=inst.drawMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period==="M"||period==="Y"){this._notifyChange(inst)}},/* Ensure a date is within any min/max bounds. */
_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=minDate&&date<minDate?minDate:date;return maxDate&&newDate>maxDate?maxDate:newDate},/* Notify change of month/year. */
_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply(inst.input?inst.input[0]:null,[inst.selectedYear,inst.selectedMonth+1,inst])}},/* Determine the number of months to show. */
_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return numMonths==null?[1,1]:typeof numMonths==="number"?[1,numMonths]:numMonths},/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},/* Find the number of days in a given month. */
_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},/* Is the given date in the accepted range? */
_isInRange:function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");if(years){yearSplit=years.split(":");currentYear=(new Date).getFullYear();minYear=parseInt(yearSplit[0],10);maxYear=parseInt(yearSplit[1],10);if(yearSplit[0].match(/[+\-].*/)){minYear+=currentYear}if(yearSplit[1].match(/[+\-].*/)){maxYear+=currentYear}}return(!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear)},/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=typeof shortYearCutoff!=="string"?shortYearCutoff:(new Date).getFullYear()%100+parseInt(shortYearCutoff,10);return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},/* Format the given date for display. */
_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=day?typeof day==="object"?day:this._daylightSavingAdjust(new Date(year,month,day)):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});/*
 * Bind hover events for datepicker elements.
 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
 * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
 */
function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.delegate(selector,"mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).removeClass("ui-datepicker-next-hover")}}).delegate(selector,"mouseover",function(){if(!$.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).addClass("ui-datepicker-next-hover")}}})}/* jQuery extend now ignores nulls! */
function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=props[name]}}return target}/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
					Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker=function(options){/* Verify an empty collection wasn't passed - Fixes #6976 */
if(!this.length){return this}/* Initialise the date picker. */
if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true}/* Append datepicker main container to body if not exist. */
if($("#"+$.datepicker._mainDivId).length===0){$("body").append($.datepicker.dpDiv)}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options==="option"&&arguments.length===2&&typeof arguments[1]==="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options==="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker;// singleton instance
$.datepicker.initialized=false;$.datepicker.uuid=(new Date).getTime();$.datepicker.version="1.10.4"})(jQuery);(function($,undefined){var sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};$.widget("ui.dialog",{version:"1.10.4",options:{appendTo:"body",autoOpen:true,buttons:[],closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",// Ensure the titlebar is always visible
using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset)}}},resizable:true,show:null,title:null,width:300,// callbacks
beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height};this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;this._createWrapper();this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog);this._createTitlebar();this._createButtonPane();if(this.options.draggable&&$.fn.draggable){this._makeDraggable()}if(this.options.resizable&&$.fn.resizable){this._makeResizable()}this._isOpen=false},_init:function(){if(this.options.autoOpen){this.open()}},_appendTo:function(){var element=this.options.appendTo;if(element&&(element.jquery||element.nodeType)){return $(element)}return this.document.find(element||"body").eq(0)},_destroy:function(){var next,originalPosition=this.originalPosition;this._destroyOverlay();this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach();this.uiDialog.stop(true,true).remove();if(this.originalTitle){this.element.attr("title",this.originalTitle)}next=originalPosition.parent.children().eq(originalPosition.index);// Don't try to place the dialog next to itself (#8613)
if(next.length&&next[0]!==this.element[0]){next.before(this.element)}else{originalPosition.parent.append(this.element)}},widget:function(){return this.uiDialog},disable:$.noop,enable:$.noop,close:function(event){var activeElement,that=this;if(!this._isOpen||this._trigger("beforeClose",event)===false){return}this._isOpen=false;this._destroyOverlay();if(!this.opener.filter(":focusable").focus().length){// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try{activeElement=this.document[0].activeElement;// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #4520
if(activeElement&&activeElement.nodeName.toLowerCase()!=="body"){// Hiding a focused element doesn't trigger blur in WebKit
// so in case we have nothing to focus on, explicitly blur the active element
// https://bugs.webkit.org/show_bug.cgi?id=47182
$(activeElement).blur()}}catch(error){}}this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event)})},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(event,silent){var moved=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;if(moved&&!silent){this._trigger("focus",event)}return moved},open:function(){var that=this;if(this._isOpen){if(this._moveToTop()){this._focusTabbable()}return}this._isOpen=true;this.opener=$(this.document[0].activeElement);this._size();this._position();this._createOverlay();this._moveToTop(null,true);this._show(this.uiDialog,this.options.show,function(){that._focusTabbable();that._trigger("focus")});this._trigger("open")},_focusTabbable:function(){// Set focus to the first match:
// 1. First element inside the dialog matching [autofocus]
// 2. Tabbable element inside the content element
// 3. Tabbable element inside the buttonpane
// 4. The close button
// 5. The dialog itself
var hasFocus=this.element.find("[autofocus]");if(!hasFocus.length){hasFocus=this.element.find(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialogButtonPane.find(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialogTitlebarClose.filter(":tabbable")}if(!hasFocus.length){hasFocus=this.uiDialog}hasFocus.eq(0).focus()},_keepFocus:function(event){function checkFocus(){var activeElement=this.document[0].activeElement,isActive=this.uiDialog[0]===activeElement||$.contains(this.uiDialog[0],activeElement);if(!isActive){this._focusTabbable()}}event.preventDefault();checkFocus.call(this);// support: IE
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
// so we check again later
this._delay(checkFocus)},_createWrapper:function(){this.uiDialog=$("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({// Setting tabIndex makes the div focusable
tabIndex:-1,role:"dialog"}).appendTo(this._appendTo());this._on(this.uiDialog,{keydown:function(event){if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){event.preventDefault();this.close(event);return}// prevent tabbing out of dialogs
if(event.keyCode!==$.ui.keyCode.TAB){return}var tabbables=this.uiDialog.find(":tabbable"),first=tabbables.filter(":first"),last=tabbables.filter(":last");if((event.target===last[0]||event.target===this.uiDialog[0])&&!event.shiftKey){first.focus(1);event.preventDefault()}else if((event.target===first[0]||event.target===this.uiDialog[0])&&event.shiftKey){last.focus(1);event.preventDefault()}},mousedown:function(event){if(this._moveToTop(event)){this._focusTabbable()}}});// We assume that any existing aria-describedby attribute means
// that the dialog content is marked up properly
// otherwise we brute force the content as the description
if(!this.element.find("[aria-describedby]").length){this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})}},_createTitlebar:function(){var uiDialogTitle;this.uiDialogTitlebar=$("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog);this._on(this.uiDialogTitlebar,{mousedown:function(event){// Don't prevent click on close button (#8838)
// Focusing a dialog that is partially scrolled out of view
// causes the browser to scroll it into view, preventing the click event
if(!$(event.target).closest(".ui-dialog-titlebar-close")){// Dialog isn't getting focus when dragging (#8063)
this.uiDialog.focus()}}});// support: IE
// Use type="button" to prevent enter keypresses in textboxes from closing the
// dialog in IE (#9312)
this.uiDialogTitlebarClose=$("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:false}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar);this._on(this.uiDialogTitlebarClose,{click:function(event){event.preventDefault();this.close(event)}});uiDialogTitle=$("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar);this._title(uiDialogTitle);this.uiDialog.attr({"aria-labelledby":uiDialogTitle.attr("id")})},_title:function(title){if(!this.options.title){title.html("&#160;")}title.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=$("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiButtonSet=$("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane);this._createButtons()},_createButtons:function(){var that=this,buttons=this.options.buttons;// if we already have a button pane, remove it
this.uiDialogButtonPane.remove();this.uiButtonSet.empty();if($.isEmptyObject(buttons)||$.isArray(buttons)&&!buttons.length){this.uiDialog.removeClass("ui-dialog-buttons");return}$.each(buttons,function(name,props){var click,buttonOptions;props=$.isFunction(props)?{click:props,text:name}:props;// Default to a non-submitting button
props=$.extend({type:"button"},props);// Change the context for the click callback to be the main element
click=props.click;props.click=function(){click.apply(that.element[0],arguments)};buttonOptions={icons:props.icons,text:props.showText};delete props.icons;delete props.showText;$("<button></button>",props).button(buttonOptions).appendTo(that.uiButtonSet)});this.uiDialog.addClass("ui-dialog-buttons");this.uiDialogButtonPane.appendTo(this.uiDialog)},_makeDraggable:function(){var that=this,options=this.options;function filteredUi(ui){return{position:ui.position,offset:ui.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){$(this).addClass("ui-dialog-dragging");that._blockFrames();that._trigger("dragStart",event,filteredUi(ui))},drag:function(event,ui){that._trigger("drag",event,filteredUi(ui))},stop:function(event,ui){options.position=[ui.position.left-that.document.scrollLeft(),ui.position.top-that.document.scrollTop()];$(this).removeClass("ui-dialog-dragging");that._unblockFrames();that._trigger("dragStop",event,filteredUi(ui))}})},_makeResizable:function(){var that=this,options=this.options,handles=options.resizable,// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position=this.uiDialog.css("position"),resizeHandles=typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:this._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");that._blockFrames();that._trigger("resizeStart",event,filteredUi(ui))},resize:function(event,ui){that._trigger("resize",event,filteredUi(ui))},stop:function(event,ui){options.height=$(this).height();options.width=$(this).width();$(this).removeClass("ui-dialog-resizing");that._unblockFrames();that._trigger("resizeStop",event,filteredUi(ui))}}).css("position",position)},_minHeight:function(){var options=this.options;return options.height==="auto"?options.minHeight:Math.min(options.minHeight,options.height)},_position:function(){// Need to show the dialog to get the actual offset in the position plugin
var isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.position(this.options.position);if(!isVisible){this.uiDialog.hide()}},_setOptions:function(options){var that=this,resize=false,resizableOptions={};$.each(options,function(key,value){that._setOption(key,value);if(key in sizeRelatedOptions){resize=true}if(key in resizableRelatedOptions){resizableOptions[key]=value}});if(resize){this._size();this._position()}if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option",resizableOptions)}},_setOption:function(key,value){var isDraggable,isResizable,uiDialog=this.uiDialog;if(key==="dialogClass"){uiDialog.removeClass(this.options.dialogClass).addClass(value)}if(key==="disabled"){return}this._super(key,value);if(key==="appendTo"){this.uiDialog.appendTo(this._appendTo())}if(key==="buttons"){this._createButtons()}if(key==="closeText"){this.uiDialogTitlebarClose.button({// Ensure that we always pass a string
label:""+value})}if(key==="draggable"){isDraggable=uiDialog.is(":data(ui-draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy")}if(!isDraggable&&value){this._makeDraggable()}}if(key==="position"){this._position()}if(key==="resizable"){// currently resizable, becoming non-resizable
isResizable=uiDialog.is(":data(ui-resizable)");if(isResizable&&!value){uiDialog.resizable("destroy")}// currently resizable, changing handles
if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value)}// currently non-resizable, becoming resizable
if(!isResizable&&value!==false){this._makeResizable()}}if(key==="title"){this._title(this.uiDialogTitlebar.find(".ui-dialog-title"))}},_size:function(){// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight,minContentHeight,maxContentHeight,options=this.options;// Reset content sizing
this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0});if(options.minWidth>options.width){options.width=options.minWidth}// reset wrapper sizing
// determine the height of all the non-content elements
nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).outerHeight();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);maxContentHeight=typeof options.maxHeight==="number"?Math.max(0,options.maxHeight-nonContentHeight):"none";if(options.height==="auto"){this.element.css({minHeight:minContentHeight,maxHeight:maxContentHeight,height:"auto"})}else{this.element.height(Math.max(0,options.height-nonContentHeight))}if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight())}},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var iframe=$(this);return $("<div>").css({position:"absolute",width:iframe.outerWidth(),height:iframe.outerHeight()}).appendTo(iframe.parent()).offset(iframe.offset())[0]})},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_allowInteraction:function(event){if($(event.target).closest(".ui-dialog").length){return true}// TODO: Remove hack when datepicker implements
// the .ui-front logic (#8989)
return!!$(event.target).closest(".ui-datepicker").length},_createOverlay:function(){if(!this.options.modal){return}var that=this,widgetFullName=this.widgetFullName;if(!$.ui.dialog.overlayInstances){// Prevent use of anchors and inputs.
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling. (#2804)
this._delay(function(){// Handle .dialog().dialog("close") (#4065)
if($.ui.dialog.overlayInstances){this.document.bind("focusin.dialog",function(event){if(!that._allowInteraction(event)){event.preventDefault();$(".ui-dialog:visible:last .ui-dialog-content").data(widgetFullName)._focusTabbable()}})}})}this.overlay=$("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo());this._on(this.overlay,{mousedown:"_keepFocus"});$.ui.dialog.overlayInstances++},_destroyOverlay:function(){if(!this.options.modal){return}if(this.overlay){$.ui.dialog.overlayInstances--;if(!$.ui.dialog.overlayInstances){this.document.unbind("focusin.dialog")}this.overlay.remove();this.overlay=null}}});$.ui.dialog.overlayInstances=0;// DEPRECATED
if($.uiBackCompat!==false){// position option with array notation
// just override with old implementation
$.widget("ui.dialog",$.ui.dialog,{_position:function(){var position=this.options.position,myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||typeof position==="object"&&"0"in position){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0]}$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition}});position={my:myAt[0]+(offset[0]<0?offset[0]:"+"+offset[0])+" "+myAt[1]+(offset[1]<0?offset[1]:"+"+offset[1]),at:myAt.join(" ")}}position=$.extend({},$.ui.dialog.prototype.options.position,position)}else{position=$.ui.dialog.prototype.options.position}// need to show the dialog to get the actual offset in the position plugin
isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show()}this.uiDialog.position(position);if(!isVisible){this.uiDialog.hide()}}})}})(jQuery);(function($,undefined){$.widget("ui.draggable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,// callbacks
drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))){this.element[0].style.position="relative"}if(this.options.addClasses){this.element.addClass("ui-draggable")}if(this.options.disabled){this.element.addClass("ui-draggable-disabled")}this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(event){var o=this.options;// among others, prevent a drag on a resizable-handle
if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false}//Quit if we're not on a valid handle
this.handle=this._getHandle(event);if(!this.handle){return false}$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css($(this).offset()).appendTo("body")});return true},_mouseStart:function(event){var o=this.options;//Create and append the visible helper
this.helper=this._createHelper(event);this.helper.addClass("ui-draggable-dragging");//Cache the helper size
this._cacheHelperProportions();//If ddmanager is used for droppables, set the global draggable
if($.ui.ddmanager){$.ui.ddmanager.current=this}/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */
//Cache the margins of the original element
this._cacheMargins();//Store the helper's css position
this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offsetParent=this.helper.offsetParent();this.offsetParentCssPosition=this.offsetParent.css("position");//The element's absolute position on the page minus margins
this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};//Reset scroll cache
this.offset.scroll=false;$.extend(this.offset,{click:{//Where the click happened, relative to the element
left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});//Generate the original position
this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);//Set a containment if given in the options
this._setContainment();//Trigger event + callbacks
if(this._trigger("start",event)===false){this._clear();return false}//Recache the helper size
this._cacheHelperProportions();//Prepare the droppable offsets
if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this._mouseDrag(event,true);//Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event)}return true},_mouseDrag:function(event,noPropagation){// reset any necessary cached properties (see #5009)
if(this.offsetParentCssPosition==="fixed"){this.offset.parent=this._getParentOffset()}//Compute the helpers position
this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");//Call plugins and callbacks and use the resulting position if something is returned
if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp({});return false}this.position=ui.position}if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}return false},_mouseStop:function(event){//If we are using droppables, inform the manager about the drop
var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event)}//if a drop comes from outside (a sortable)
if(this.dropped){dropped=this.dropped;this.dropped=false}//if the original element is no longer in the DOM don't bother to continue (see #8269)
if(this.options.helper==="original"&&!$.contains(this.element[0].ownerDocument,this.element[0])){return false}if(this.options.revert==="invalid"&&!dropped||this.options.revert==="valid"&&dropped||this.options.revert===true||$.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped)){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(that._trigger("stop",event)!==false){that._clear()}})}else{if(this._trigger("stop",event)!==false){this._clear()}}return false},_mouseUp:function(event){//Remove frame helpers
$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event)}return $.ui.mouse.prototype._mouseUp.call(this,event)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({})}else{this._clear()}return this},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):o.helper==="clone"?this.element.clone().removeAttr("id"):this.element;if(!helper.parents("body").length){helper.appendTo(o.appendTo==="parent"?this.element[0].parentNode:o.appendTo)}if(helper[0]!==this.element[0]&&!/(fixed|absolute)/.test(helper.css("position"))){helper.css("position","absolute")}return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){//Get the offsetParent and cache its position
var po=this.offsetParent.offset();// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}//This needs to be actually done for all browsers, since pageX/pageY includes this information
//Ugly IE fix
if(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var over,c,ce,o=this.options;if(!o.containment){this.containment=null;return}if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-this.helperProportions.width-this.margins.left,$(window).scrollTop()+($(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(o.containment.constructor===Array){this.containment=o.containment;return}if(o.containment==="parent"){o.containment=this.helper[0].parentNode}c=$(o.containment);ce=c[0];if(!ce){return}over=c.css("overflow")!=="hidden";this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=c},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent;//Cache the scroll
if(!this.offset.scroll){this.offset.scroll={top:scroll.scrollTop(),left:scroll.scrollLeft()}}return{top:pos.top+// The absolute mouse position
this.offset.relative.top*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():this.offset.scroll.top)*mod,left:pos.left+// The absolute mouse position
this.offset.relative.left*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():this.offset.scroll.left)*mod}},_generatePosition:function(event){var containment,co,top,left,o=this.options,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,pageX=event.pageX,pageY=event.pageY;//Cache the scroll
if(!this.offset.scroll){this.offset.scroll={top:scroll.scrollTop(),left:scroll.scrollLeft()}}/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */
// If we are not dragging yet, we won't check for options
if(this.originalPosition){if(this.containment){if(this.relative_container){co=this.relative_container.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top]}else{containment=this.containment}if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top}}if(o.grid){//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3]?top:top-this.offset.click.top>=containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2]?left:left-this.offset.click.left>=containment[0]?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-// The absolute mouse position
this.offset.click.top-// Click offset (relative to the element)
this.offset.relative.top-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollTop():this.offset.scroll.top),left:pageX-// The absolute mouse position
this.offset.click.left-// Click offset (relative to the element)
this.offset.relative.left-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},// From now on bulk stuff - mainly helpers
_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);//The absolute position has to be recalculated after plugins
if(type==="drag"){this.positionAbs=this._convertPositionTo("absolute")}return $.Widget.prototype._trigger.call(this,type,event,ui)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("ui-draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,"ui-sortable");if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshPositions();// Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
sortable._trigger("activate",event,uiSortable)}})},stop:function(event,ui){//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
var inst=$(this).data("ui-draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;//Don't remove the helper in the draggable instance
this.instance.cancelHelperRemoval=false;//Remove it in the sortable instance (so sortable plugins like revert still work)
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
if(this.shouldRevert){this.instance.options.revert=this.shouldRevert}//Trigger the stop of the sortable
this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;//If the helper has been the original item, restore properties in the sortable
if(inst.options.helper==="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;//Remove the helper in the sortable instance
this.instance._trigger("deactivate",event,uiSortable)}})},drag:function(event,ui){var inst=$(this).data("ui-draggable"),that=this;$.each(inst.sortables,function(){var innermostIntersecting=false,thisSortable=this;//Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){innermostIntersecting=true;$.each(inst.sortables,function(){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this!==thisSortable&&this.instance._intersectsWith(this.instance.containerCache)&&$.contains(thisSortable.instance.element[0],this.instance.element[0])){innermostIntersecting=false}return innermostIntersecting})}if(innermostIntersecting){//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
if(!this.instance.isOver){this.instance.isOver=1;//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
this.instance.currentItem=$(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",true);this.instance.options._helper=this.instance.options.helper;//Store helper option to later restore it
this.instance.options.helper=function(){return ui.helper[0]};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;//draggable revert needs that
//hack so receive/update callbacks work (mostly)
inst.currentItem=inst.element;this.instance.fromOutside=inst}//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
if(this.instance.currentItem){this.instance._mouseDrag(event)}}else{//If it doesn't intersect with the sortable, and it intersected before,
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;//Prevent reverting on this forced stop
this.instance.options.revert=false;// The out event needs to be triggered independently
this.instance._trigger("out",event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}inst._trigger("fromSortable",event);inst.dropped=false}}})}});$.ui.plugin.add("draggable","cursor",{start:function(){var t=$("body"),o=$(this).data("ui-draggable").options;if(t.css("cursor")){o._cursor=t.css("cursor")}t.css("cursor",o.cursor)},stop:function(){var o=$(this).data("ui-draggable").options;if(o._cursor){$("body").css("cursor",o._cursor)}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("ui-draggable").options;if(t.css("opacity")){o._opacity=t.css("opacity")}t.css("opacity",o.opacity)},stop:function(event,ui){var o=$(this).data("ui-draggable").options;if(o._opacity){$(ui.helper).css("opacity",o._opacity)}}});$.ui.plugin.add("draggable","scroll",{start:function(){var i=$(this).data("ui-draggable");if(i.scrollParent[0]!==document&&i.scrollParent[0].tagName!=="HTML"){i.overflowOffset=i.scrollParent.offset()}},drag:function(event){var i=$(this).data("ui-draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!==document&&i.scrollParent[0].tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if(i.overflowOffset.top+i.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed}}if(!o.axis||o.axis!=="y"){if(i.overflowOffset.left+i.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)}}if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event)}}});$.ui.plugin.add("draggable","snap",{start:function(){var i=$(this).data("ui-draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left})}})},drag:function(event,ui){var ts,bs,ls,rs,l,r,t,b,i,first,inst=$(this).data("ui-draggable"),o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=false;continue}if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left}}first=ts||bs||ls||rs;if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top}if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top}if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left}if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left}}if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item}))}inst.snapElements[i].snapping=ts||bs||ls||rs||first}}});$.ui.plugin.add("draggable","stack",{start:function(){var min,o=this.data("ui-draggable").options,group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0)});if(!group.length){return}min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each(function(i){$(this).css("zIndex",min+i)});this.css("zIndex",min+group.length)}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("ui-draggable").options;if(t.css("zIndex")){o._zIndex=t.css("zIndex")}t.css("zIndex",o.zIndex)},stop:function(event,ui){var o=$(this).data("ui-draggable").options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex)}}})})(jQuery);(function($,undefined){function isOverAxis(x,reference,size){return x>reference&&x<reference+size}$.widget("ui.droppable",{version:"1.10.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect",// callbacks
activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var proportions,o=this.options,accept=o.accept;this.isover=false;this.isout=true;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept)};this.proportions=function(){if(arguments.length){// Store the droppable's proportions
proportions=arguments[0]}else{// Retrieve or derive the droppable's proportions
return proportions?proportions:proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}}};// Add the reference and positions to the manager
$.ui.ddmanager.droppables[o.scope]=$.ui.ddmanager.droppables[o.scope]||[];$.ui.ddmanager.droppables[o.scope].push(this);o.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){var i=0,drop=$.ui.ddmanager.droppables[this.options.scope];for(;i<drop.length;i++){if(drop[i]===this){drop.splice(i,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(key,value){if(key==="accept"){this.accept=$.isFunction(value)?value:function(d){return d.is(value)}}$.Widget.prototype._setOption.apply(this,arguments)},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}if(draggable){this._trigger("activate",event,this.ui(draggable))}},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(draggable){this._trigger("deactivate",event,this.ui(draggable))}},_over:function(event){var draggable=$.ui.ddmanager.current;// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",event,this.ui(draggable))}},_out:function(event){var draggable=$.ui.ddmanager.current;// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",event,this.ui(draggable))}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current,childrenIntersection=false;// Bail if draggable and droppable are same element
if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return false}this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,"ui-droppable");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable.options.scope&&inst.accept.call(inst.element[0],draggable.currentItem||draggable.element)&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false}});if(childrenIntersection){return false}if(this.accept.call(this.element[0],draggable.currentItem||draggable.element)){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",event,this.ui(draggable));return this.element}return false},ui:function(c){return{draggable:c.currentItem||c.element,helper:c.helper,position:c.position,offset:c.positionAbs}}});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset){return false}var draggableLeft,draggableTop,x1=(draggable.positionAbs||draggable.position.absolute).left,y1=(draggable.positionAbs||draggable.position.absolute).top,x2=x1+draggable.helperProportions.width,y2=y1+draggable.helperProportions.height,l=droppable.offset.left,t=droppable.offset.top,r=l+droppable.proportions().width,b=t+droppable.proportions().height;switch(toleranceMode){case"fit":return l<=x1&&x2<=r&&t<=y1&&y2<=b;case"intersect":// Right Half
// Left Half
// Bottom Half
return l<x1+draggable.helperProportions.width/2&&x2-draggable.helperProportions.width/2<r&&t<y1+draggable.helperProportions.height/2&&y2-draggable.helperProportions.height/2<b;// Top Half
case"pointer":draggableLeft=(draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left;draggableTop=(draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top;return isOverAxis(draggableTop,t,droppable.proportions().height)&&isOverAxis(draggableLeft,l,droppable.proportions().width);case"touch":// Top edge touching
// Bottom edge touching
// Left edge touching
// Right edge touching
return(y1>=t&&y1<=b||y2>=t&&y2<=b||y1<t&&y2>b)&&(x1>=l&&x1<=r||x2>=l&&x2<=r||x1<l&&x2>r);default:return false}};/*
	This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var i,j,m=$.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,// workaround for #2317
list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++){//No disabled and non-accepted
if(m[i].options.disabled||t&&!m[i].accept.call(m[i].element[0],t.currentItem||t.element)){continue}// Filter out elements in the current dragged item
for(j=0;j<list.length;j++){if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop}}m[i].visible=m[i].element.css("display")!=="none";if(!m[i].visible){continue}//Activate the droppable if used directly from draggables
if(type==="mousedown"){m[i]._activate.call(m[i],event)}m[i].offset=m[i].element.offset();m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight})}},drop:function(draggable,event){var dropped=false;// Create a copy of the droppables in case the list changes during the drop (#9116)
$.each(($.ui.ddmanager.droppables[draggable.options.scope]||[]).slice(),function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance)){dropped=this._drop.call(this,event)||dropped}if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],draggable.currentItem||draggable.element)){this.isout=true;this.isover=false;this._deactivate.call(this,event)}});return dropped},dragStart:function(draggable,event){//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil("body").bind("scroll.droppable",function(){if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}})},drag:function(draggable,event){//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}//Run through all droppables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var parentInstance,scope,parent,intersects=$.ui.intersect(draggable,this,this.options.tolerance),c=!intersects&&this.isover?"isout":intersects&&!this.isover?"isover":null;if(!c){return}if(this.options.greedy){// find droppable parents with same scope
scope=this.options.scope;parent=this.element.parents(":data(ui-droppable)").filter(function(){return $.data(this,"ui-droppable").options.scope===scope});if(parent.length){parentInstance=$.data(parent[0],"ui-droppable");parentInstance.greedyChild=c==="isover"}}// we just moved into a greedy child
if(parentInstance&&c==="isover"){parentInstance.isover=false;parentInstance.isout=true;parentInstance._out.call(parentInstance,event)}this[c]=true;this[c==="isout"?"isover":"isout"]=false;this[c==="isover"?"_over":"_out"].call(this,event);// we just moved out of a greedy child
if(parentInstance&&c==="isout"){parentInstance.isout=false;parentInstance.isover=true;parentInstance._over.call(parentInstance,event)}})},dragStop:function(draggable,event){draggable.element.parentsUntil("body").unbind("scroll.droppable");//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event)}}}})(jQuery);(function($,undefined){var dataSpace="ui-effects-";$.effects={effect:{}};/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2013 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */
(function(jQuery,undefined){var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",// plusequals test for += 100 -= 100
rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,// a set of RE's that can match strings and generate color tuples.
stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]]}},{// this regex ignores A-F because it's compared against an already lowercased string
re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16)]}},{// this regex ignores A-F because it's compared against an already lowercased string
re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]]}}],// jQuery.Color( )
color=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha)},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={"byte":{floor:true,max:255},percent:{max:1},degrees:{mod:360,floor:true}},support=color.support={},// element for support tests
supportElem=jQuery("<p>")[0],// colors = jQuery.Color.names
colors,// local aliases of functions called often
each=jQuery.each;// determine rgba support immediately
supportElem.style.cssText="background-color:rgba(1,1,1,.5)";support.rgba=supportElem.style.backgroundColor.indexOf("rgba")>-1;// define cache name and alpha properties
// for rgba and hsla spaces
each(spaces,function(spaceName,space){space.cache="_"+spaceName;space.props.alpha={idx:3,type:"percent",def:1}});function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return allowEmpty||!prop.def?null:prop.def}// ~~ is an short way of doing floor for positive numbers
value=type.floor?~~value:parseFloat(value);// IE will pass in empty strings as value for alpha,
// which will hit this case
if(isNaN(value)){return prop.def}if(type.mod){// we add mod before modding to make sure that negatives values
// get converted properly: -10 -> 350
return(value+type.mod)%type.mod}// for now all property types without mod have min and max
return 0>value?0:type.max<value?type.max:value}function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values){parsed=inst[spaceName](values);// if this was an rgba parse the assignment might happen twice
// oh well....
inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;// exit each( stringParsers ) here because we matched
return false}});// Found a stringParser that handled it
if(rgba.length){// if this came from a parsed string, force "transparent" when alpha is 0
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
if(rgba.join()==="0,0,0,0"){jQuery.extend(rgba,colors.transparent)}return inst}// named colors
return colors[string]}color.fn=jQuery.extend(color.prototype,{parse:function(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this}if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined}var inst=this,type=jQuery.type(red),rgba=this._rgba=[];// more than 1 argument specified - assume ( red, green, blue, alpha )
if(green!==undefined){red=[red,green,blue,alpha];type="array"}if(type==="string"){return this.parse(stringParse(red)||colors._default)}if(type==="array"){each(spaces.rgba.props,function(key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop)});return this}if(type==="object"){if(red instanceof color){each(spaces,function(spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice()}})}else{each(spaces,function(spaceName,space){var cache=space.cache;each(space.props,function(key,prop){// if the cache doesn't exist, and we know how to convert
if(!inst[cache]&&space.to){// if the value was null, we don't need to copy it
// if the key was alpha, we don't need to copy it either
if(key==="alpha"||red[key]==null){return}inst[cache]=space.to(inst._rgba)}// this is the only case where we allow nulls for ALL properties.
// call clamp with alwaysAllowEmpty
inst[cache][prop.idx]=clamp(red[key],prop,true)});// everything defined but alpha?
if(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){// use the default of 1
inst[cache][3]=1;if(space.from){inst._rgba=space.from(inst[cache])}}})}return this}},is:function(compare){var is=color(compare),same=true,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=isCache[prop.idx]===localCache[prop.idx];return same}})}return same});return same},_space:function(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName)}});return used.pop()},transition:function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};// if null, don't override start value
if(endValue===null){return}// if null - use end
if(startValue===null){result[index]=endValue}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod}else if(startValue-endValue>type.mod/2){startValue-=type.mod}}result[index]=clamp((endValue-startValue)*distance+startValue,prop)}});return this[spaceName](result)},blend:function(opaque){// if we are already opaque - return ourself
if(this._rgba[3]===1){return this}var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v}))},toRgbaString:function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){return v==null?i>2?1:0:v});if(rgba[3]===1){rgba.pop();prefix="rgb("}return prefix+rgba.join()+")"},toHslaString:function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0}// catch 1 and 2
if(i&&i<3){v=Math.round(v*100)+"%"}return v});if(hsla[3]===1){hsla.pop();prefix="hsl("}return prefix+hsla.join()+")"},toHexString:function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255))}return"#"+jQuery.map(rgba,function(v){// default to 0 when nulls exist
v=(v||0).toString(16);return v.length===1?"0"+v:v}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}});color.fn.parse.prototype=color.fn;// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6}if(h*2<1){return q}if(h*3<2){return p+(q-p)*(2/3-h)*6}return p}spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]]}var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*.5,h,s;if(min===max){h=0}else if(r===max){h=60*(g-b)/diff+360}else if(g===max){h=60*(b-r)/diff+120}else{h=60*(r-g)/diff+240}// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
if(diff===0){s=0}else if(l<=.5){s=diff/add}else{s=diff/(2-add)}return[Math.round(h)%360,s,l,a==null?1:a]};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]]}var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+1/3)*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-1/3)*255),a]};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;// makes rgba() and hsla()
color.fn[spaceName]=function(value){// generate a cache for this space if it doesn't exist
if(to&&!this[cache]){this[cache]=to(this._rgba)}if(value===undefined){return this[cache].slice()}var ret,type=jQuery.type(value),arr=type==="array"||type==="object"?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];if(val==null){val=local[prop.idx]}local[prop.idx]=clamp(val,prop)});if(from){ret=color(from(local));ret[cache]=local;return ret}else{return color(local)}};// makes red() green() blue() alpha() hue() saturation() lightness()
each(props,function(key,prop){// alpha is included in more than one space
if(color.fn[key]){return}color.fn[key]=function(value){var vtype=jQuery.type(value),fn=key==="alpha"?this._hsla?"hsla":"rgba":spaceName,local=this[fn](),cur=local[prop.idx],match;if(vtype==="undefined"){return cur}if(vtype==="function"){value=value.call(this,cur);vtype=jQuery.type(value)}if(value==null&&prop.empty){return this}if(vtype==="string"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1)}}local[prop.idx]=value;return this[fn](local)}})});// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(i,hook){jQuery.cssHooks[hook]={set:function(elem,value){var parsed,curElem,backgroundColor="";if(value!=="transparent"&&(jQuery.type(value)!=="string"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook==="backgroundColor"?elem.parentNode:elem;while((backgroundColor===""||backgroundColor==="transparent")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,"backgroundColor");curElem=curElem.parentNode}catch(e){}}value=value.blend(backgroundColor&&backgroundColor!=="transparent"?backgroundColor:"_default")}value=value.toRgbaString()}try{elem.style[hook]=value}catch(e){}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=true}jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos))}})};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function(value){var expanded={};each(["Top","Right","Bottom","Left"],function(i,part){expanded["border"+part+"Color"]=value});return expanded}};// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors=jQuery.Color.names={// 4.1. Basic color keywords
aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",// 4.2.3. "transparent" color keyword
transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=true}}});function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView?elem.ownerDocument.defaultView.getComputedStyle(elem,null):elem.currentStyle,styles={};if(style&&style.length&&style[0]&&style[style[0]]){len=style.length;while(len--){key=style[len];if(typeof style[key]==="string"){styles[$.camelCase(key)]=style[key]}}}else{for(key in style){if(typeof style[key]==="string"){styles[key]=style[key]}}}return styles}function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle){value=newStyle[name];if(oldStyle[name]!==value){if(!shorthandStyles[name]){if($.fx.step[name]||!isNaN(parseFloat(value))){diff[name]=value}}}}return diff}// support: jQuery <1.8
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}$.effects.animateClass=function(value,duration,easing,callback){var o=$.speed(duration,easing,callback);return this.queue(function(){var animated=$(this),baseClass=animated.attr("class")||"",applyClassChange,allAnimations=o.children?animated.find("*").addBack():animated;// map the animated objects to store the original styles.
allAnimations=allAnimations.map(function(){var el=$(this);return{el:el,start:getElementStyles(this)}});// apply class change
applyClassChange=function(){$.each(classAnimationActions,function(i,action){if(value[action]){animated[action+"Class"](value[action])}})};applyClassChange();// map all animated objects again - calculate new styles and diff
allAnimations=allAnimations.map(function(){this.end=getElementStyles(this.el[0]);this.diff=styleDifference(this.start,this.end);return this});// apply original class
animated.attr("class",baseClass);// map all animated objects again - this time collecting a promise
allAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$.Deferred(),opts=$.extend({},o,{queue:false,complete:function(){dfd.resolve(styleInfo)}});this.el.animate(this.diff,opts);return dfd.promise()});// once all animations have completed:
$.when.apply($,allAnimations.get()).done(function(){// set the final class
applyClassChange();// for each animated element,
// clear all css properties that were animated
$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,"")})});// this is guarnteed to be there if you use jQuery.speed()
// it also handles dequeuing the next anim...
o.complete.call(animated[0])})})};$.fn.extend({addClass:function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments)}}($.fn.addClass),removeClass:function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments)}}($.fn.removeClass),toggleClass:function(orig){return function(classNames,force,speed,easing,callback){if(typeof force==="boolean"||force===undefined){if(!speed){// without speed parameter
return orig.apply(this,arguments)}else{return $.effects.animateClass.call(this,force?{add:classNames}:{remove:classNames},speed,easing,callback)}}else{// without force parameter
return $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing)}}}($.fn.toggleClass),switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback)}})})();/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
(function(){$.extend($.effects,{version:"1.10.4",// Saves a set of properties in a data storage
save:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null){element.data(dataSpace+set[i],element[0].style[set[i]])}}},// Restores a set of previously saved properties from a data storage
restore:function(element,set){var val,i;for(i=0;i<set.length;i++){if(set[i]!==null){val=element.data(dataSpace+set[i]);// support: jQuery 1.6.2
// http://bugs.jquery.com/ticket/9917
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
// We can't differentiate between "" and 0 here, so we just assume
// empty string since it's likely to be a more common value...
if(val===undefined){val=""}element.css(set[i],val)}}},setMode:function(el,mode){if(mode==="toggle"){mode=el.is(":hidden")?"show":"hide"}return mode},// Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height}switch(origin[1]){case"left":x=0;break;case"center":x=.5;break;case"right":x=1;break;default:x=origin[1]/original.width}return{x:x,y:y}},// Wraps the element around a wrapper that copies position properties
createWrapper:function(element){// if the element is already wrapped, return it
if(element.parent().is(".ui-effects-wrapper")){return element.parent()}// wrap the element
var props={width:element.outerWidth(true),height:element.outerHeight(true),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),// Store the size in case width/height are defined in % - Fixes #5245
size={width:element.width(),height:element.height()},active=document.activeElement;// support: Firefox
// Firefox incorrectly exposes anonymous content
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
try{active.id}catch(e){active=document.body}element.wrap(wrapper);// Fixes #7595 - Elements lose focus when wrapped.
if(element[0]===active||$.contains(element[0],active)){$(active).focus()}wrapper=element.parent();//Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
// transfer positioning properties to the wrapper
if(element.css("position")==="static"){wrapper.css({position:"relative"});element.css({position:"relative"})}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto"}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}element.css(size);return wrapper.css(props).show()},removeWrapper:function(element){var active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){element.parent().replaceWith(element);// Fixes #7595 - Elements lose focus when wrapped.
if(element[0]===active||$.contains(element[0],active)){$(active).focus()}}return element},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1]}});return value}});// return an effect options object for the given parameters:
function _normalizeArguments(effect,options,speed,callback){// allow passing all options as the first parameter
if($.isPlainObject(effect)){options=effect;effect=effect.effect}// convert to an object
effect={effect:effect};// catch (effect, null, ...)
if(options==null){options={}}// catch (effect, callback)
if($.isFunction(options)){callback=options;speed=null;options={}}// catch (effect, speed, ?)
if(typeof options==="number"||$.fx.speeds[options]){callback=speed;speed=options;options={}}// catch (effect, options, callback)
if($.isFunction(speed)){callback=speed;speed=null}// add options to effect
if(options){$.extend(effect,options)}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed==="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect}function standardAnimationOption(option){// Valid standard speeds (nothing, number, named speed)
if(!option||typeof option==="number"||$.fx.speeds[option]){return true}// Invalid strings - treat as "normal" speed
if(typeof option==="string"&&!$.effects.effect[option]){return true}// Complete callback
if($.isFunction(option)){return true}// Options hash (but not naming an effect)
if(typeof option==="object"&&!option.effect){return true}// Didn't match any standard API
return false}$.fn.extend({effect:function(){var args=_normalizeArguments.apply(this,arguments),mode=args.mode,queue=args.queue,effectMethod=$.effects.effect[args.effect];if($.fx.off||!effectMethod){// delegate to the original method (e.g., .show()) if possible
if(mode){return this[mode](args.duration,args.complete)}else{return this.each(function(){if(args.complete){args.complete.call(this)}})}}function run(next){var elem=$(this),complete=args.complete,mode=args.mode;function done(){if($.isFunction(complete)){complete.call(elem[0])}if($.isFunction(next)){next()}}// If the element already has the correct final state, delegate to
// the core methods so the internal tracking of "olddisplay" works.
if(elem.is(":hidden")?mode==="hide":mode==="show"){elem[mode]();done()}else{effectMethod.call(elem[0],args,done)}}return queue===false?this.each(run):this.queue(queue||"fx",run)},show:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="show";return this.effect.call(this,args)}}}($.fn.show),hide:function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="hide";return this.effect.call(this,args)}}}($.fn.hide),toggle:function(orig){return function(option){if(standardAnimationOption(option)||typeof option==="boolean"){return orig.apply(this,arguments)}else{var args=_normalizeArguments.apply(this,arguments);args.mode="toggle";return this.effect.call(this,args)}}}($.fn.toggle),// helper functions
cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit]}});return val}})})();/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
(function(){// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(i,name){baseEasings[name]=function(p){return Math.pow(p,i+2)}});$.extend(baseEasings,{Sine:function(p){return 1-Math.cos(p*Math.PI/2)},Circ:function(p){return 1-Math.sqrt(1-p*p)},Elastic:function(p){return p===0||p===1?p:-Math.pow(2,8*(p-1))*Math.sin(((p-1)*80-7.5)*Math.PI/15)},Back:function(p){return p*p*(3*p-2)},Bounce:function(p){var pow2,bounce=4;while(p<((pow2=Math.pow(2,--bounce))-1)/11){}return 1/Math.pow(4,3-bounce)-7.5625*Math.pow((pow2*3-2)/22-p,2)}});$.each(baseEasings,function(name,easeIn){$.easing["easeIn"+name]=easeIn;$.easing["easeOut"+name]=function(p){return 1-easeIn(1-p)};$.easing["easeInOut"+name]=function(p){return p<.5?easeIn(p*2)/2:1-easeIn(p*-2+2)/2}})})()})(jQuery);(function($,undefined){var rvertical=/up|down|vertical/,rpositivemotion=/up|left|vertical|horizontal/;$.effects.effect.blind=function(o,done){// Create element
var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),direction=o.direction||"up",vertical=rvertical.test(direction),ref=vertical?"height":"width",ref2=vertical?"top":"left",motion=rpositivemotion.test(direction),animation={},show=mode==="show",wrapper,distance,margin;// if already wrapped, the wrapper's properties are my property. #6245
if(el.parent().is(".ui-effects-wrapper")){$.effects.save(el.parent(),props)}else{$.effects.save(el,props)}el.show();wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});distance=wrapper[ref]();margin=parseFloat(wrapper.css(ref2))||0;animation[ref]=show?distance:0;if(!motion){el.css(vertical?"bottom":"right",0).css(vertical?"top":"left","auto").css({position:"absolute"});animation[ref2]=show?margin:distance+margin}// start at 0 if we are showing
if(show){wrapper.css(ref,0);if(!motion){wrapper.css(ref2,margin+distance)}}// Animate
wrapper.animate(animation,{duration:o.duration,easing:o.easing,queue:false,complete:function(){if(mode==="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()}})}})(jQuery);(function($,undefined){$.effects.effect.bounce=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],// defaults:
mode=$.effects.setMode(el,o.mode||"effect"),hide=mode==="hide",show=mode==="show",direction=o.direction||"up",distance=o.distance,times=o.times||5,// number of internal animations
anims=times*2+(show||hide?1:0),speed=o.duration/anims,easing=o.easing,// utility:
ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left",i,upAnim,downAnim,// we will need to re-assemble the queue to stack our animations in place
queue=el.queue(),queuelen=queue.length;// Avoid touching opacity to prevent clearType and PNG issues in IE
if(show||hide){props.push("opacity")}$.effects.save(el,props);el.show();$.effects.createWrapper(el);// Create Wrapper
// default distance for the BIGGEST bounce is the outer Distance / 3
if(!distance){distance=el[ref==="top"?"outerHeight":"outerWidth"]()/3}if(show){downAnim={opacity:1};downAnim[ref]=0;// if we are showing, force opacity 0 and set the initial position
// then do the "first" animation
el.css("opacity",0).css(ref,motion?-distance*2:distance*2).animate(downAnim,speed,easing)}// start at the smallest distance if we are hiding
if(hide){distance=distance/Math.pow(2,times-1)}downAnim={};downAnim[ref]=0;// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
for(i=0;i<times;i++){upAnim={};upAnim[ref]=(motion?"-=":"+=")+distance;el.animate(upAnim,speed,easing).animate(downAnim,speed,easing);distance=hide?distance*2:distance/2}// Last Bounce when Hiding
if(hide){upAnim={opacity:0};upAnim[ref]=(motion?"-=":"+=")+distance;el.animate(upAnim,speed,easing)}el.queue(function(){if(hide){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()});// inject all the animations we just queued to be first in line (after "inprogress")
if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)))}el.dequeue()}})(jQuery);(function($,undefined){$.effects.effect.clip=function(o,done){// Create element
var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",direction=o.direction||"vertical",vert=direction==="vertical",size=vert?"height":"width",position=vert?"top":"left",animation={},wrapper,animate,distance;// Save & Show
$.effects.save(el,props);el.show();// Create Wrapper
wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});animate=el[0].tagName==="IMG"?wrapper:el;distance=animate[size]();// Shift
if(show){animate.css(size,0);animate.css(position,distance/2)}// Create Animation Object:
animation[size]=show?distance:0;animation[position]=show?0:distance/2;// Animate
animate.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(!show){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()}})}})(jQuery);(function($,undefined){$.effects.effect.drop=function(o,done){var el=$(this),props=["position","top","bottom","left","right","opacity","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",direction=o.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",motion=direction==="up"||direction==="left"?"pos":"neg",animation={opacity:show?1:0},distance;// Adjust
$.effects.save(el,props);el.show();$.effects.createWrapper(el);distance=o.distance||el[ref==="top"?"outerHeight":"outerWidth"](true)/2;if(show){el.css("opacity",0).css(ref,motion==="pos"?-distance:distance)}// Animation
animation[ref]=(show?motion==="pos"?"+=":"-=":motion==="pos"?"-=":"+=")+distance;// Animate
el.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()}})}})(jQuery);(function($,undefined){$.effects.effect.explode=function(o,done){var rows=o.pieces?Math.round(Math.sqrt(o.pieces)):3,cells=rows,el=$(this),mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",// show and then visibility:hidden the element before calculating offset
offset=el.show().css("visibility","hidden").offset(),// width and height of a piece
width=Math.ceil(el.outerWidth()/cells),height=Math.ceil(el.outerHeight()/rows),pieces=[],// loop
i,j,left,top,mx,my;// children animate complete:
function childComplete(){pieces.push(this);if(pieces.length===rows*cells){animComplete()}}// clone the element for each row and cell.
for(i=0;i<rows;i++){// ===>
top=offset.top+i*height;my=i-(rows-1)/2;for(j=0;j<cells;j++){// |||
left=offset.left+j*width;mx=j-(cells-1)/2;// Create a clone of the now hidden main element that will be absolute positioned
// within a wrapper div off the -left and -top equal to size of our pieces
el.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*width,top:-i*height}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width,height:height,left:left+(show?mx*width:0),top:top+(show?my*height:0),opacity:show?0:1}).animate({left:left+(show?0:mx*width),top:top+(show?0:my*height),opacity:show?1:0},o.duration||500,o.easing,childComplete)}}function animComplete(){el.css({visibility:"visible"});$(pieces).remove();if(!show){el.hide()}done()}}})(jQuery);(function($,undefined){$.effects.effect.fade=function(o,done){var el=$(this),mode=$.effects.setMode(el,o.mode||"toggle");el.animate({opacity:mode},{queue:false,duration:o.duration,easing:o.easing,complete:done})}})(jQuery);(function($,undefined){$.effects.effect.fold=function(o,done){// Create element
var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",hide=mode==="hide",size=o.size||15,percent=/([0-9]+)%/.exec(size),horizFirst=!!o.horizFirst,widthFirst=show!==horizFirst,ref=widthFirst?["width","height"]:["height","width"],duration=o.duration/2,wrapper,distance,animation1={},animation2={};$.effects.save(el,props);el.show();// Create Wrapper
wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});distance=widthFirst?[wrapper.width(),wrapper.height()]:[wrapper.height(),wrapper.width()];if(percent){size=parseInt(percent[1],10)/100*distance[hide?0:1]}if(show){wrapper.css(horizFirst?{height:0,width:size}:{height:size,width:0})}// Animation
animation1[ref[0]]=show?distance[0]:size;animation2[ref[1]]=show?distance[1]:0;// Animate
wrapper.animate(animation1,duration,o.easing).animate(animation2,duration,o.easing,function(){if(hide){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()})}})(jQuery);(function($,undefined){$.effects.effect.highlight=function(o,done){var elem=$(this),props=["backgroundImage","backgroundColor","opacity"],mode=$.effects.setMode(elem,o.mode||"show"),animation={backgroundColor:elem.css("backgroundColor")};if(mode==="hide"){animation.opacity=0}$.effects.save(elem,props);elem.show().css({backgroundImage:"none",backgroundColor:o.color||"#ffff99"}).animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){elem.hide()}$.effects.restore(elem,props);done()}})}})(jQuery);(function($,undefined){$.effects.effect.pulsate=function(o,done){var elem=$(this),mode=$.effects.setMode(elem,o.mode||"show"),show=mode==="show",hide=mode==="hide",showhide=show||mode==="hide",// showing or hiding leaves of the "last" animation
anims=(o.times||5)*2+(showhide?1:0),duration=o.duration/anims,animateTo=0,queue=elem.queue(),queuelen=queue.length,i;if(show||!elem.is(":visible")){elem.css("opacity",0).show();animateTo=1}// anims - 1 opacity "toggles"
for(i=1;i<anims;i++){elem.animate({opacity:animateTo},duration,o.easing);animateTo=1-animateTo}elem.animate({opacity:animateTo},duration,o.easing);elem.queue(function(){if(hide){elem.hide()}done()});// We just queued up "anims" animations, we need to put them next in the queue
if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)))}elem.dequeue()}})(jQuery);(function($,undefined){$.effects.effect.puff=function(o,done){var elem=$(this),mode=$.effects.setMode(elem,o.mode||"hide"),hide=mode==="hide",percent=parseInt(o.percent,10)||150,factor=percent/100,original={height:elem.height(),width:elem.width(),outerHeight:elem.outerHeight(),outerWidth:elem.outerWidth()};$.extend(o,{effect:"scale",queue:false,fade:true,mode:mode,complete:done,percent:hide?percent:100,from:hide?original:{height:original.height*factor,width:original.width*factor,outerHeight:original.outerHeight*factor,outerWidth:original.outerWidth*factor}});elem.effect(o)};$.effects.effect.scale=function(o,done){// Create element
var el=$(this),options=$.extend(true,{},o),mode=$.effects.setMode(el,o.mode||"effect"),percent=parseInt(o.percent,10)||(parseInt(o.percent,10)===0?0:mode==="hide"?0:100),direction=o.direction||"both",origin=o.origin,original={height:el.height(),width:el.width(),outerHeight:el.outerHeight(),outerWidth:el.outerWidth()},factor={y:direction!=="horizontal"?percent/100:1,x:direction!=="vertical"?percent/100:1};// We are going to pass this effect to the size effect:
options.effect="size";options.queue=false;options.complete=done;// Set default origin and restore for show/hide
if(mode!=="effect"){options.origin=origin||["middle","center"];options.restore=true}options.from=o.from||(mode==="show"?{height:0,width:0,outerHeight:0,outerWidth:0}:original);options.to={height:original.height*factor.y,width:original.width*factor.x,outerHeight:original.outerHeight*factor.y,outerWidth:original.outerWidth*factor.x};// Fade option to support puff
if(options.fade){if(mode==="show"){options.from.opacity=0;options.to.opacity=1}if(mode==="hide"){options.from.opacity=1;options.to.opacity=0}}// Animate
el.effect(options)};$.effects.effect.size=function(o,done){// Create element
var original,baseline,factor,el=$(this),props0=["position","top","bottom","left","right","width","height","overflow","opacity"],// Always restore
props1=["position","top","bottom","left","right","overflow","opacity"],// Copy for children
props2=["width","height","overflow"],cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],// Set options
mode=$.effects.setMode(el,o.mode||"effect"),restore=o.restore||mode!=="effect",scale=o.scale||"both",origin=o.origin||["middle","center"],position=el.css("position"),props=restore?props0:props1,zero={height:0,width:0,outerHeight:0,outerWidth:0};if(mode==="show"){el.show()}original={height:el.height(),width:el.width(),outerHeight:el.outerHeight(),outerWidth:el.outerWidth()};if(o.mode==="toggle"&&mode==="show"){el.from=o.to||zero;el.to=o.from||original}else{el.from=o.from||(mode==="show"?zero:original);el.to=o.to||(mode==="hide"?zero:original)}// Set scaling factor
factor={from:{y:el.from.height/original.height,x:el.from.width/original.width},to:{y:el.to.height/original.height,x:el.to.width/original.width}};// Scale the css box
if(scale==="box"||scale==="both"){// Vertical props scaling
if(factor.from.y!==factor.to.y){props=props.concat(vProps);el.from=$.effects.setTransition(el,vProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,vProps,factor.to.y,el.to)}// Horizontal props scaling
if(factor.from.x!==factor.to.x){props=props.concat(hProps);el.from=$.effects.setTransition(el,hProps,factor.from.x,el.from);el.to=$.effects.setTransition(el,hProps,factor.to.x,el.to)}}// Scale the content
if(scale==="content"||scale==="both"){// Vertical props scaling
if(factor.from.y!==factor.to.y){props=props.concat(cProps).concat(props2);el.from=$.effects.setTransition(el,cProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,cProps,factor.to.y,el.to)}}$.effects.save(el,props);el.show();$.effects.createWrapper(el);el.css("overflow","hidden").css(el.from);// Adjust
if(origin){// Calculate baseline shifts
baseline=$.effects.getBaseline(origin,original);el.from.top=(original.outerHeight-el.outerHeight())*baseline.y;el.from.left=(original.outerWidth-el.outerWidth())*baseline.x;el.to.top=(original.outerHeight-el.to.outerHeight)*baseline.y;el.to.left=(original.outerWidth-el.to.outerWidth)*baseline.x}el.css(el.from);// set top & left
// Animate
if(scale==="content"||scale==="both"){// Scale the children
// Add margins/font-size
vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);props2=props0.concat(vProps).concat(hProps);el.find("*[width]").each(function(){var child=$(this),c_original={height:child.height(),width:child.width(),outerHeight:child.outerHeight(),outerWidth:child.outerWidth()};if(restore){$.effects.save(child,props2)}child.from={height:c_original.height*factor.from.y,width:c_original.width*factor.from.x,outerHeight:c_original.outerHeight*factor.from.y,outerWidth:c_original.outerWidth*factor.from.x};child.to={height:c_original.height*factor.to.y,width:c_original.width*factor.to.x,outerHeight:c_original.height*factor.to.y,outerWidth:c_original.width*factor.to.x};// Vertical props scaling
if(factor.from.y!==factor.to.y){child.from=$.effects.setTransition(child,vProps,factor.from.y,child.from);child.to=$.effects.setTransition(child,vProps,factor.to.y,child.to)}// Horizontal props scaling
if(factor.from.x!==factor.to.x){child.from=$.effects.setTransition(child,hProps,factor.from.x,child.from);child.to=$.effects.setTransition(child,hProps,factor.to.x,child.to)}// Animate children
child.css(child.from);child.animate(child.to,o.duration,o.easing,function(){// Restore children
if(restore){$.effects.restore(child,props2)}})})}// Animate
el.animate(el.to,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(el.to.opacity===0){el.css("opacity",el.from.opacity)}if(mode==="hide"){el.hide()}$.effects.restore(el,props);if(!restore){// we need to calculate our new positioning based on the scaling
if(position==="static"){el.css({position:"relative",top:el.to.top,left:el.to.left})}else{$.each(["top","left"],function(idx,pos){el.css(pos,function(_,str){var val=parseInt(str,10),toRef=idx?el.to.left:el.to.top;// if original was "auto", recalculate the new value from wrapper
if(str==="auto"){return toRef+"px"}return val+toRef+"px"})})}}$.effects.removeWrapper(el);done()}})}})(jQuery);(function($,undefined){$.effects.effect.shake=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"effect"),direction=o.direction||"left",distance=o.distance||20,times=o.times||3,anims=times*2+1,speed=Math.round(o.duration/anims),ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",animation={},animation1={},animation2={},i,// we will need to re-assemble the queue to stack our animations in place
queue=el.queue(),queuelen=queue.length;$.effects.save(el,props);el.show();$.effects.createWrapper(el);// Animation
animation[ref]=(positiveMotion?"-=":"+=")+distance;animation1[ref]=(positiveMotion?"+=":"-=")+distance*2;animation2[ref]=(positiveMotion?"-=":"+=")+distance*2;// Animate
el.animate(animation,speed,o.easing);// Shakes
for(i=1;i<times;i++){el.animate(animation1,speed,o.easing).animate(animation2,speed,o.easing)}el.animate(animation1,speed,o.easing).animate(animation,speed/2,o.easing).queue(function(){if(mode==="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()});// inject all the animations we just queued to be first in line (after "inprogress")
if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)))}el.dequeue()}})(jQuery);(function($,undefined){$.effects.effect.slide=function(o,done){// Create element
var el=$(this),props=["position","top","bottom","left","right","width","height"],mode=$.effects.setMode(el,o.mode||"show"),show=mode==="show",direction=o.direction||"left",ref=direction==="up"||direction==="down"?"top":"left",positiveMotion=direction==="up"||direction==="left",distance,animation={};// Adjust
$.effects.save(el,props);el.show();distance=o.distance||el[ref==="top"?"outerHeight":"outerWidth"](true);$.effects.createWrapper(el).css({overflow:"hidden"});if(show){el.css(ref,positiveMotion?isNaN(distance)?"-"+distance:-distance:distance)}// Animation
animation[ref]=(show?positiveMotion?"+=":"-=":positiveMotion?"-=":"+=")+distance;// Animate
el.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);done()}})}})(jQuery);(function($,undefined){$.effects.effect.transfer=function(o,done){var elem=$(this),target=$(o.to),targetFixed=target.css("position")==="fixed",body=$("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=elem.offset(),transfer=$("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(o.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:elem.innerHeight(),width:elem.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,o.duration,o.easing,function(){transfer.remove();done()})}})(jQuery);(function($,undefined){$.widget("ui.menu",{version:"1.10.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",// callbacks
blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;// flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled=false;this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,$.proxy(function(event){if(this.options.disabled){event.preventDefault()}},this));if(this.options.disabled){this.element.addClass("ui-state-disabled").attr("aria-disabled","true")}this._on({// Prevent focus from sticking to links inside menu after clicking
// them (focus should always stay on UL during navigation).
"mousedown .ui-menu-item > a":function(event){event.preventDefault()},"click .ui-state-disabled > a":function(event){event.preventDefault()},"click .ui-menu-item:has(a)":function(event){var target=$(event.target).closest(".ui-menu-item");if(!this.mouseHandled&&target.not(".ui-state-disabled").length){this.select(event);// Only set the mouseHandled flag if the event will bubble, see #9469.
if(!event.isPropagationStopped()){this.mouseHandled=true}// Open submenu on click
if(target.has(".ui-menu").length){this.expand(event)}else if(!this.element.is(":focus")&&$(this.document[0].activeElement).closest(".ui-menu").length){// Redirect focus to the menu
this.element.trigger("focus",[true]);// If the active item is on the top level, let it stay active.
// Otherwise, blur the active item since it is no longer visible.
if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer)}}}},"mouseenter .ui-menu-item":function(event){var target=$(event.currentTarget);// Remove ui-state-active class from siblings of the newly focused menu item
// to avoid a jump caused by adjacent elements both having a class with a border
target.siblings().children(".ui-state-active").removeClass("ui-state-active");this.focus(event,target)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(event,keepActiveItem){// If there's already an active item, keep it active
// If not, activate the first item
var item=this.active||this.element.children(".ui-menu-item").eq(0);if(!keepActiveItem){this.focus(event,item)}},blur:function(event){this._delay(function(){if(!$.contains(this.element[0],this.document[0].activeElement)){this.collapseAll(event)}})},keydown:"_keydown"});this.refresh();// Clicks outside of a menu collapse any open menus
this._on(this.document,{click:function(event){if(!$(event.target).closest(".ui-menu").length){this.collapseAll(event)}// Reset the mouseHandled flag
this.mouseHandled=false}})},_destroy:function(){// Destroy (sub)menus
this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();// Destroy menu items
this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var elem=$(this);if(elem.data("ui-menu-submenu-carat")){elem.remove()}});// Destroy menu dividers
this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(event){var match,prev,character,skip,regex,preventDefault=true;function escape(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}switch(event.keyCode){case $.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $.ui.keyCode.HOME:this._move("first","first",event);break;case $.ui.keyCode.END:this._move("last","last",event);break;case $.ui.keyCode.UP:this.previous(event);break;case $.ui.keyCode.DOWN:this.next(event);break;case $.ui.keyCode.LEFT:this.collapse(event);break;case $.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(event)}break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:this._activate(event);break;case $.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=false;prev=this.previousFilter||"";character=String.fromCharCode(event.keyCode);skip=false;clearTimeout(this.filterTimer);if(character===prev){skip=true}else{character=prev+character}regex=new RegExp("^"+escape(character),"i");match=this.activeMenu.children(".ui-menu-item").filter(function(){return regex.test($(this).children("a").text())});match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match;// If no matches on the current filter, reset to the last character pressed
// to move down the menu to the first item that starts with that character
if(!match.length){character=String.fromCharCode(event.keyCode);regex=new RegExp("^"+escape(character),"i");match=this.activeMenu.children(".ui-menu-item").filter(function(){return regex.test($(this).children("a").text())})}if(match.length){this.focus(event,match);if(match.length>1){this.previousFilter=character;this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)}else{delete this.previousFilter}}else{delete this.previousFilter}}if(preventDefault){event.preventDefault()}},_activate:function(event){if(!this.active.is(".ui-state-disabled")){if(this.active.children("a[aria-haspopup='true']").length){this.expand(event)}else{this.select(event)}}},refresh:function(){var menus,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length);// Initialize nested menus
submenus.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$(this),item=menu.prev("a"),submenuCarat=$("<span>").addClass("ui-menu-icon ui-icon "+icon).data("ui-menu-submenu-carat",true);item.attr("aria-haspopup","true").prepend(submenuCarat);menu.attr("aria-labelledby",item.attr("id"))});menus=submenus.add(this.element);// Don't refresh list items that are already adapted
menus.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()});// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
menus.children(":not(.ui-menu-item)").each(function(){var item=$(this);// hyphen, em dash, en dash
if(!/[^\-\u2014\u2013\s]/.test(item.text())){item.addClass("ui-widget-content ui-menu-divider")}});// Add aria-disabled attribute to any disabled menu item
menus.children(".ui-state-disabled").attr("aria-disabled","true");// If the active item has been removed, blur the menu
if(this.active&&!$.contains(this.element[0],this.active[0])){this.blur()}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(key,value){if(key==="icons"){this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(value.submenu)}this._super(key,value)},focus:function(event,item){var nested,focused;this.blur(event,event&&event.type==="focus");this._scrollIntoView(item);this.active=item.first();focused=this.active.children("a").addClass("ui-state-focus");// Only update aria-activedescendant if there's a role
// otherwise we assume focus is managed elsewhere
if(this.options.role){this.element.attr("aria-activedescendant",focused.attr("id"))}// Highlight active parent menu item, if any
this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");if(event&&event.type==="keydown"){this._close()}else{this.timer=this._delay(function(){this._close()},this.delay)}nested=item.children(".ui-menu");if(nested.length&&event&&/^mouse/.test(event.type)){this._startOpening(nested)}this.activeMenu=item.parent();this._trigger("focus",event,{item:item})},_scrollIntoView:function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;if(this._hasScroll()){borderTop=parseFloat($.css(this.activeMenu[0],"borderTopWidth"))||0;paddingTop=parseFloat($.css(this.activeMenu[0],"paddingTop"))||0;offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop;scroll=this.activeMenu.scrollTop();elementHeight=this.activeMenu.height();itemHeight=item.height();if(offset<0){this.activeMenu.scrollTop(scroll+offset)}else if(offset+itemHeight>elementHeight){this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight)}}},blur:function(event,fromFocus){if(!fromFocus){clearTimeout(this.timer)}if(!this.active){return}this.active.children("a").removeClass("ui-state-focus");this.active=null;this._trigger("blur",event,{item:this.active})},_startOpening:function(submenu){clearTimeout(this.timer);// Don't open if already open fixes a Firefox bug that caused a .5 pixel
// shift in the submenu position when mousing over the carat icon
if(submenu.attr("aria-hidden")!=="true"){return}this.timer=this._delay(function(){this._close();this._open(submenu)},this.delay)},_open:function(submenu){var position=$.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true");submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position)},collapseAll:function(event,all){clearTimeout(this.timer);this.timer=this._delay(function(){// If we were passed an event, look for the submenu that contains the event
var currentMenu=all?this.element:$(event&&event.target).closest(this.element.find(".ui-menu"));// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
if(!currentMenu.length){currentMenu=this.element}this._close(currentMenu);this.blur(event);this.activeMenu=currentMenu},this.delay)},// With no arguments, closes the currently active menu - if nothing is active
// it closes all menus.  If passed an argument, it will search for menus BELOW
_close:function(startMenu){if(!startMenu){startMenu=this.active?this.active.parent():this.element}startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(newItem&&newItem.length){this._close();this.focus(event,newItem)}},expand:function(event){var newItem=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();if(newItem&&newItem.length){this._open(newItem.parent());// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
this._delay(function(){this.focus(event,newItem)})}},next:function(event){this._move("next","first",event)},previous:function(event){this._move("prev","last",event)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(direction,filter,event){var next;if(this.active){if(direction==="first"||direction==="last"){next=this.active[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1)}else{next=this.active[direction+"All"](".ui-menu-item").eq(0)}}if(!next||!next.length||!this.active){next=this.activeMenu.children(".ui-menu-item")[filter]()}this.focus(event,next)},nextPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isLastItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.nextAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base-height<0});this.focus(event,item)}else{this.focus(event,this.activeMenu.children(".ui-menu-item")[!this.active?"first":"last"]())}},previousPage:function(event){var item,base,height;if(!this.active){this.next(event);return}if(this.isFirstItem()){return}if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.prevAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base+height>0});this.focus(event,item)}else{this.focus(event,this.activeMenu.children(".ui-menu-item").first())}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(event){// TODO: It should never be possible to not have an active item at this
// point, but the tests don't trigger mouseenter before click.
this.active=this.active||$(event.target).closest(".ui-menu-item");var ui={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(event,true)}this._trigger("select",event,ui)}})})(jQuery);(function($,undefined){$.widget("ui.progressbar",{version:"1.10.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){// Constrain initial value
this.oldValue=this.options.value=this._constrainedValue();this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({// Only set static values, aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role:"progressbar","aria-valuemin":this.min});this.valueDiv=$("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove()},value:function(newValue){if(newValue===undefined){return this.options.value}this.options.value=this._constrainedValue(newValue);this._refreshValue()},_constrainedValue:function(newValue){if(newValue===undefined){newValue=this.options.value}this.indeterminate=newValue===false;// sanitize value
if(typeof newValue!=="number"){newValue=0}return this.indeterminate?false:Math.min(this.options.max,Math.max(this.min,newValue))},_setOptions:function(options){// Ensure "value" option is set after other values (like max)
var value=options.value;delete options.value;this._super(options);this.options.value=this._constrainedValue(value);this._refreshValue()},_setOption:function(key,value){if(key==="max"){// Don't allow a max less than min
value=Math.max(this.min,value)}this._super(key,value)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var value=this.options.value,percentage=this._percentage();this.valueDiv.toggle(this.indeterminate||value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate);if(this.indeterminate){this.element.removeAttr("aria-valuenow");if(!this.overlayDiv){this.overlayDiv=$("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv)}}else{this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":value});if(this.overlayDiv){this.overlayDiv.remove();this.overlayDiv=null}}if(this.oldValue!==value){this.oldValue=value;this._trigger("change")}if(value===this.options.max){this._trigger("complete")}}})})(jQuery);(function($,undefined){function num(v){return parseInt(v,10)||0}function isNumber(value){return!isNaN(parseInt(value,10))}$.widget("ui.resizable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,// See #7960
zIndex:90,// callbacks
resize:null,start:null,stop:null},_create:function(){var n,i,handle,axis,hname,that=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!o.aspectRatio,aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null});//Wrap the element if it cannot hold child nodes
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){//Create a wrapper element and set the wrapper to the new current internal element
this.element.wrap($("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));//Overwrite the original this.element
this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable"));this.elementIsWrapper=true;//Move margins to the wrapper
this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});//Prevent Safari textarea resize
this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");//Push the actual element to our proportionallyResize internal array
this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));// avoid IE jump (hard set the margin)
this.originalElement.css({margin:this.originalElement.css("margin")});// fix handlers offset
this._proportionallyResize()}this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor===String){if(this.handles==="all"){this.handles="n,e,s,w,se,sw,ne,nw"}n=this.handles.split(",");this.handles={};for(i=0;i<n.length;i++){handle=$.trim(n[i]);hname="ui-resizable-"+handle;axis=$("<div class='ui-resizable-handle "+hname+"'></div>");// Apply zIndex to all handles - see #7960
axis.css({zIndex:o.zIndex});//TODO : What's going on here?
if("se"===handle){axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}//Insert into internal handles object and append to element
this.handles[handle]=".ui-resizable-"+handle;this.element.append(axis)}}this._renderAxis=function(target){var i,axis,padPos,padWrapper;target=target||this.element;for(i in this.handles){if(this.handles[i].constructor===String){this.handles[i]=$(this.handles[i],this.element).show()}//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){axis=$(this.handles[i],this.element);//Checking the correct pad and border
padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();//The padding type i have to apply...
padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize()}//TODO: What's that good for? There's not anything to be executed left
if(!$(this.handles[i]).length){continue}}};//TODO: make renderAxis a prototype function
this._renderAxis(this.element);this._handles=$(".ui-resizable-handle",this.element).disableSelection();//Matching axis name
this._handles.mouseover(function(){if(!that.resizing){if(this.className){axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}//Axis, default = se
that.axis=axis&&axis[1]?axis[1]:"se"}});//If we want to auto hide the elements
if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(o.disabled){return}$(this).removeClass("ui-resizable-autohide");that._handles.show()}).mouseleave(function(){if(o.disabled){return}if(!that.resizing){$(this).addClass("ui-resizable-autohide");that._handles.hide()}})}//Initialize the mouse interaction
this._mouseInit()},_destroy:function(){this._mouseDestroy();var wrapper,_destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};//TODO: Unwrap at same DOM position
if(this.elementIsWrapper){_destroy(this.element);wrapper=this.element;this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")}).insertAfter(wrapper);wrapper.remove()}this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this},_mouseCapture:function(event){var i,handle,capture=false;for(i in this.handles){handle=$(this.handles[i])[0];if(handle===event.target||$.contains(handle,event.target)){capture=true}}return!this.options.disabled&&capture},_mouseStart:function(event){var curleft,curtop,cursor,o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;// bugfix for http://dev.jquery.com/ticket/1749
if(/absolute/.test(el.css("position"))){el.css({position:"absolute",top:el.css("top"),left:el.css("left")})}else if(el.is(".ui-draggable")){el.css({position:"absolute",top:iniPos.top,left:iniPos.left})}this._renderProxy();curleft=num(this.helper.css("left"));curtop=num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0}//Store needed variables
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};//Aspect Ratio
this.aspectRatio=typeof o.aspectRatio==="number"?o.aspectRatio:this.originalSize.width/this.originalSize.height||1;cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor==="auto"?this.axis+"-resize":cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true},_mouseDrag:function(event){//Increase performance, avoid regex
var data,el=this.helper,props={},smp=this.originalMousePosition,a=this.axis,prevTop=this.position.top,prevLeft=this.position.left,prevWidth=this.size.width,prevHeight=this.size.height,dx=event.pageX-smp.left||0,dy=event.pageY-smp.top||0,trigger=this._change[a];if(!trigger){return false}// Calculate the attrs that will be change
data=trigger.apply(this,[event,dx,dy]);// Put this in the mouseDrag handler since the user can start pressing shift while resizing
this._updateVirtualBoundaries(event.shiftKey);if(this._aspectRatio||event.shiftKey){data=this._updateRatio(data,event)}data=this._respectSize(data,event);this._updateCache(data);// plugins callbacks need to be called first
this._propagate("resize",event);if(this.position.top!==prevTop){props.top=this.position.top+"px"}if(this.position.left!==prevLeft){props.left=this.position.left+"px"}if(this.size.width!==prevWidth){props.width=this.size.width+"px"}if(this.size.height!==prevHeight){props.height=this.size.height+"px"}el.css(props);if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}// Call the user callback if the element was resized
if(!$.isEmptyObject(props)){this._trigger("resize",event,this.ui())}return false},_mouseStop:function(event){this.resizing=false;var pr,ista,soffseth,soffsetw,s,left,top,o=this.options,that=this;if(this._helper){pr=this._proportionallyResizeElements;ista=pr.length&&/textarea/i.test(pr[0].nodeName);soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:that.sizeDiff.height;soffsetw=ista?0:that.sizeDiff.width;s={width:that.helper.width()-soffsetw,height:that.helper.height()-soffseth};left=parseInt(that.element.css("left"),10)+(that.position.left-that.originalPosition.left)||null;top=parseInt(that.element.css("top"),10)+(that.position.top-that.originalPosition.top)||null;if(!o.animate){this.element.css($.extend(s,{top:top,left:left}))}that.helper.height(that.size.height);that.helper.width(that.size.width);if(this._helper&&!o.animate){this._proportionallyResize()}}$("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(forceAspectRatio){var pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b,o=this.options;b={minWidth:isNumber(o.minWidth)?o.minWidth:0,maxWidth:isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:isNumber(o.minHeight)?o.minHeight:0,maxHeight:isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||forceAspectRatio){// We want to create an enclosing box whose aspect ration is the requested one
// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
pMinWidth=b.minHeight*this.aspectRatio;pMinHeight=b.minWidth/this.aspectRatio;pMaxWidth=b.maxHeight*this.aspectRatio;pMaxHeight=b.maxWidth/this.aspectRatio;if(pMinWidth>b.minWidth){b.minWidth=pMinWidth}if(pMinHeight>b.minHeight){b.minHeight=pMinHeight}if(pMaxWidth<b.maxWidth){b.maxWidth=pMaxWidth}if(pMaxHeight<b.maxHeight){b.maxHeight=pMaxHeight}}this._vBoundaries=b},_updateCache:function(data){this.offset=this.helper.offset();if(isNumber(data.left)){this.position.left=data.left}if(isNumber(data.top)){this.position.top=data.top}if(isNumber(data.height)){this.size.height=data.height}if(isNumber(data.width)){this.size.width=data.width}},_updateRatio:function(data){var cpos=this.position,csize=this.size,a=this.axis;if(isNumber(data.height)){data.width=data.height*this.aspectRatio}else if(isNumber(data.width)){data.height=data.width/this.aspectRatio}if(a==="sw"){data.left=cpos.left+(csize.width-data.width);data.top=null}if(a==="nw"){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width)}return data},_respectSize:function(data){var o=this._vBoundaries,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&o.maxWidth<data.width,ismaxh=isNumber(data.height)&&o.maxHeight&&o.maxHeight<data.height,isminw=isNumber(data.width)&&o.minWidth&&o.minWidth>data.width,isminh=isNumber(data.height)&&o.minHeight&&o.minHeight>data.height,dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height,cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw){data.width=o.minWidth}if(isminh){data.height=o.minHeight}if(ismaxw){data.width=o.maxWidth}if(ismaxh){data.height=o.maxHeight}if(isminw&&cw){data.left=dw-o.minWidth}if(ismaxw&&cw){data.left=dw-o.maxWidth}if(isminh&&ch){data.top=dh-o.minHeight}if(ismaxh&&ch){data.top=dh-o.maxHeight}// fixing jump error on top/left - bug #2330
if(!data.width&&!data.height&&!data.left&&data.top){data.top=null}else if(!data.width&&!data.height&&!data.top&&data.left){data.left=null}return data},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length){return}var i,j,borders,paddings,prel,element=this.helper||this.element;for(i=0;i<this._proportionallyResizeElements.length;i++){prel=this._proportionallyResizeElements[i];if(!this.borderDif){this.borderDif=[];borders=[prel.css("borderTopWidth"),prel.css("borderRightWidth"),prel.css("borderBottomWidth"),prel.css("borderLeftWidth")];paddings=[prel.css("paddingTop"),prel.css("paddingRight"),prel.css("paddingBottom"),prel.css("paddingLeft")];for(j=0;j<borders.length;j++){this.borderDif[j]=(parseInt(borders[j],10)||0)+(parseInt(paddings[j],10)||0)}}prel.css({height:element.height()-this.borderDif[0]-this.borderDif[2]||0,width:element.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$("<div style='overflow:hidden;'></div>");this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(event,dx){return{width:this.originalSize.width+dx}},w:function(event,dx){var cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx}},n:function(event,dx,dy){var cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy}},s:function(event,dx,dy){return{height:this.originalSize.height+dy}},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]))},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]))}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);n!=="resize"&&this._trigger(n,event,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});/*
 * Resizable Extensions
 */
$.ui.plugin.add("resizable","animate",{stop:function(event){var that=$(this).data("ui-resizable"),o=that.options,pr=that._proportionallyResizeElements,ista=pr.length&&/textarea/i.test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,style={width:that.size.width-soffsetw,height:that.size.height-soffseth},left=parseInt(that.element.css("left"),10)+(that.position.left-that.originalPosition.left)||null,top=parseInt(that.element.css("top"),10)+(that.position.top-that.originalPosition.top)||null;that.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(that.element.css("width"),10),height:parseInt(that.element.css("height"),10),top:parseInt(that.element.css("top"),10),left:parseInt(that.element.css("left"),10)};if(pr&&pr.length){$(pr[0]).css({width:data.width,height:data.height})}// propagating resize, and updating values for each animation step
that._updateCache(data);that._propagate("resize",event)}})}});$.ui.plugin.add("resizable","containment",{start:function(){var element,p,co,ch,cw,width,height,that=$(this).data("ui-resizable"),o=that.options,el=that.element,oc=o.containment,ce=oc instanceof $?oc.get(0):/parent/.test(oc)?el.parent().get(0):oc;if(!ce){return}that.containerElement=$(ce);if(/document/.test(oc)||oc===document){that.containerOffset={left:0,top:0};that.containerPosition={left:0,top:0};that.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight}}else{element=$(ce);p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name))});that.containerOffset=element.offset();that.containerPosition=element.position();that.containerSize={height:element.innerHeight()-p[3],width:element.innerWidth()-p[1]};co=that.containerOffset;ch=that.containerSize.height;cw=that.containerSize.width;width=$.ui.hasScroll(ce,"left")?ce.scrollWidth:cw;height=$.ui.hasScroll(ce)?ce.scrollHeight:ch;that.parentData={element:ce,left:co.left,top:co.top,width:width,height:height}}},resize:function(event){var woset,hoset,isParent,isOffsetRelative,that=$(this).data("ui-resizable"),o=that.options,co=that.containerOffset,cp=that.position,pRatio=that._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=that.containerElement;if(ce[0]!==document&&/static/.test(ce.css("position"))){cop=co}if(cp.left<(that._helper?co.left:0)){that.size.width=that.size.width+(that._helper?that.position.left-co.left:that.position.left-cop.left);if(pRatio){that.size.height=that.size.width/that.aspectRatio}that.position.left=o.helper?co.left:0}if(cp.top<(that._helper?co.top:0)){that.size.height=that.size.height+(that._helper?that.position.top-co.top:that.position.top);if(pRatio){that.size.width=that.size.height*that.aspectRatio}that.position.top=that._helper?co.top:0}that.offset.left=that.parentData.left+that.position.left;that.offset.top=that.parentData.top+that.position.top;woset=Math.abs((that._helper?that.offset.left-cop.left:that.offset.left-cop.left)+that.sizeDiff.width);hoset=Math.abs((that._helper?that.offset.top-cop.top:that.offset.top-co.top)+that.sizeDiff.height);isParent=that.containerElement.get(0)===that.element.parent().get(0);isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position"));if(isParent&&isOffsetRelative){woset-=Math.abs(that.parentData.left)}if(woset+that.size.width>=that.parentData.width){that.size.width=that.parentData.width-woset;if(pRatio){that.size.height=that.size.width/that.aspectRatio}}if(hoset+that.size.height>=that.parentData.height){that.size.height=that.parentData.height-hoset;if(pRatio){that.size.width=that.size.height*that.aspectRatio}}},stop:function(){var that=$(this).data("ui-resizable"),o=that.options,co=that.containerOffset,cop=that.containerPosition,ce=that.containerElement,helper=$(that.helper),ho=helper.offset(),w=helper.outerWidth()-that.sizeDiff.width,h=helper.outerHeight()-that.sizeDiff.height;if(that._helper&&!o.animate&&/relative/.test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}if(that._helper&&!o.animate&&/static/.test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h})}}});$.ui.plugin.add("resizable","alsoResize",{start:function(){var that=$(this).data("ui-resizable"),o=that.options,_store=function(exp){$(exp).each(function(){var el=$(this);el.data("ui-resizable-alsoresize",{width:parseInt(el.width(),10),height:parseInt(el.height(),10),left:parseInt(el.css("left"),10),top:parseInt(el.css("top"),10)})})};if(typeof o.alsoResize==="object"&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize)}else{$.each(o.alsoResize,function(exp){_store(exp)})}}else{_store(o.alsoResize)}},resize:function(event,ui){var that=$(this).data("ui-resizable"),o=that.options,os=that.originalSize,op=that.originalPosition,delta={height:that.size.height-os.height||0,width:that.size.width-os.width||0,top:that.position.top-op.top||0,left:that.position.left-op.left||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("ui-resizable-alsoresize"),style={},css=c&&c.length?c:el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0){style[prop]=sum||null}});el.css(style)})};if(typeof o.alsoResize==="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c)})}else{_alsoResize(o.alsoResize)}},stop:function(){$(this).removeData("resizable-alsoresize")}});$.ui.plugin.add("resizable","ghost",{start:function(){var that=$(this).data("ui-resizable"),o=that.options,cs=that.size;that.ghost=that.originalElement.clone();that.ghost.css({opacity:.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof o.ghost==="string"?o.ghost:"");that.ghost.appendTo(that.helper)},resize:function(){var that=$(this).data("ui-resizable");if(that.ghost){that.ghost.css({position:"relative",height:that.size.height,width:that.size.width})}},stop:function(){var that=$(this).data("ui-resizable");if(that.ghost&&that.helper){that.helper.get(0).removeChild(that.ghost.get(0))}}});$.ui.plugin.add("resizable","grid",{resize:function(){var that=$(this).data("ui-resizable"),o=that.options,cs=that.size,os=that.originalSize,op=that.originalPosition,a=that.axis,grid=typeof o.grid==="number"?[o.grid,o.grid]:o.grid,gridX=grid[0]||1,gridY=grid[1]||1,ox=Math.round((cs.width-os.width)/gridX)*gridX,oy=Math.round((cs.height-os.height)/gridY)*gridY,newWidth=os.width+ox,newHeight=os.height+oy,isMaxWidth=o.maxWidth&&o.maxWidth<newWidth,isMaxHeight=o.maxHeight&&o.maxHeight<newHeight,isMinWidth=o.minWidth&&o.minWidth>newWidth,isMinHeight=o.minHeight&&o.minHeight>newHeight;o.grid=grid;if(isMinWidth){newWidth=newWidth+gridX}if(isMinHeight){newHeight=newHeight+gridY}if(isMaxWidth){newWidth=newWidth-gridX}if(isMaxHeight){newHeight=newHeight-gridY}if(/^(se|s|e)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight}else if(/^(ne)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.top=op.top-oy}else if(/^(sw)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.left=op.left-ox}else{if(newHeight-gridY>0){that.size.height=newHeight;that.position.top=op.top-oy}else{that.size.height=gridY;that.position.top=op.top+os.height-gridY}if(newWidth-gridX>0){that.size.width=newWidth;that.position.left=op.left-ox}else{that.size.width=gridX;that.position.left=op.left+os.width-gridX}}}})})(jQuery);(function($,undefined){$.widget("ui.selectable",$.ui.mouse,{version:"1.10.4",options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch",// callbacks
selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var selectees,that=this;this.element.addClass("ui-selectable");this.dragged=false;// cache selectee children based on filter
this.refresh=function(){selectees=$(that.options.filter,that.element[0]);selectees.addClass("ui-selectee");selectees.each(function(){var $this=$(this),pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")})})};this.refresh();this.selectees=selectees.addClass("ui-selectee");this._mouseInit();this.helper=$("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled");this._mouseDestroy()},_mouseStart:function(event){var that=this,options=this.options;this.opos=[event.pageX,event.pageY];if(this.options.disabled){return}this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);// position helper (lasso)
this.helper.css({left:event.pageX,top:event.pageY,width:0,height:0});if(options.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey&&!event.ctrlKey){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;// selectable UNSELECTING callback
that._trigger("unselecting",event,{unselecting:selectee.element})}});$(event.target).parents().addBack().each(function(){var doSelect,selectee=$.data(this,"selectable-item");if(selectee){doSelect=!event.metaKey&&!event.ctrlKey||!selectee.$element.hasClass("ui-selected");selectee.$element.removeClass(doSelect?"ui-unselecting":"ui-selected").addClass(doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;// selectable (UN)SELECTING callback
if(doSelect){that._trigger("selecting",event,{selecting:selectee.element})}else{that._trigger("unselecting",event,{unselecting:selectee.element})}return false}})},_mouseDrag:function(event){this.dragged=true;if(this.options.disabled){return}var tmp,that=this,options=this.options,x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp}this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item"),hit=false;//prevent helper from being selected if appendTo: selectable
if(!selectee||selectee.element===that.element[0]){return}if(options.tolerance==="touch"){hit=!(selectee.left>x2||selectee.right<x1||selectee.top>y2||selectee.bottom<y1)}else if(options.tolerance==="fit"){hit=selectee.left>x1&&selectee.right<x2&&selectee.top>y1&&selectee.bottom<y2}if(hit){// SELECT
if(selectee.selected){selectee.$element.removeClass("ui-selected");selectee.selected=false}if(selectee.unselecting){selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false}if(!selectee.selecting){selectee.$element.addClass("ui-selecting");selectee.selecting=true;// selectable SELECTING callback
that._trigger("selecting",event,{selecting:selectee.element})}}else{// UNSELECT
if(selectee.selecting){if((event.metaKey||event.ctrlKey)&&selectee.startselected){selectee.$element.removeClass("ui-selecting");selectee.selecting=false;selectee.$element.addClass("ui-selected");selectee.selected=true}else{selectee.$element.removeClass("ui-selecting");selectee.selecting=false;if(selectee.startselected){selectee.$element.addClass("ui-unselecting");selectee.unselecting=true}// selectable UNSELECTING callback
that._trigger("unselecting",event,{unselecting:selectee.element})}}if(selectee.selected){if(!event.metaKey&&!event.ctrlKey&&!selectee.startselected){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;// selectable UNSELECTING callback
that._trigger("unselecting",event,{unselecting:selectee.element})}}}});return false},_mouseStop:function(event){var that=this;this.dragged=false;$(".ui-unselecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false;selectee.startselected=false;that._trigger("unselected",event,{unselected:selectee.element})});$(".ui-selecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-selecting").addClass("ui-selected");selectee.selecting=false;selectee.selected=true;selectee.startselected=true;that._trigger("selected",event,{selected:selectee.element})});this._trigger("stop",event);this.helper.remove();return false}})})(jQuery);(function($,undefined){// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
var numPages=5;$.widget("ui.slider",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null,// callbacks
change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._refresh();this._setOption("disabled",this.options.disabled);this._animateOff=false},_refresh:function(){this._createRange();this._createHandles();this._setupEvents();this._refreshValue()},_createHandles:function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",handles=[];handleCount=options.values&&options.values.length||1;if(existingHandles.length>handleCount){existingHandles.slice(handleCount).remove();existingHandles=existingHandles.slice(0,handleCount)}for(i=existingHandles.length;i<handleCount;i++){handles.push(handle)}this.handles=existingHandles.add($(handles.join("")).appendTo(this.element));this.handle=this.handles.eq(0);this.handles.each(function(i){$(this).data("ui-slider-handle-index",i)})},_createRange:function(){var options=this.options,classes="";if(options.range){if(options.range===true){if(!options.values){options.values=[this._valueMin(),this._valueMin()]}else if(options.values.length&&options.values.length!==2){options.values=[options.values[0],options.values[0]]}else if($.isArray(options.values)){options.values=options.values.slice(0)}}if(!this.range||!this.range.length){this.range=$("<div></div>").appendTo(this.element);classes="ui-slider-range"+// note: this isn't the most fittingly semantic framework class for this element,
// but worked best visually with a variety of themes
" ui-widget-header ui-corner-all"}else{this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""})}this.range.addClass(classes+(options.range==="min"||options.range==="max"?" ui-slider-range-"+options.range:""))}else{if(this.range){this.range.remove()}this.range=null}},_setupEvents:function(){var elements=this.handles.add(this.range).filter("a");this._off(elements);this._on(elements,this._handleEvents);this._hoverable(elements);this._focusable(elements)},_destroy:function(){this.handles.remove();if(this.range){this.range.remove()}this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._mouseDestroy()},_mouseCapture:function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;if(o.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));if(distance>thisDistance||distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min)){distance=thisDistance;closestHandle=$(this);index=i}});allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;this._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().addBack().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-closestHandle.width()/2,top:event.pageY-offset.top-closestHandle.height()/2-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=pixelMouse/pixelTotal;if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if(this.options.values.length===2&&this.options.range===true&&(index===0&&newVal>otherVal||index===1&&newVal<otherVal)){newVal=otherVal}if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;// A slide can be canceled by returning false from the slide callback
allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal)}}}else{if(newVal!==this.value()){// A slide can be canceled by returning false from the slide callback
allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal)}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}this._trigger("stop",event,uiHash)},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}//store the last changed value index for reference when handles overlap
this._lastChangedValue=index;this._trigger("change",event,uiHash)}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return}return this._value()},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i)}this._refreshValue()}else{if(this.options.values&&this.options.values.length){return this._values(index)}else{return this.value()}}}else{return this._values()}},_setOption:function(key,value){var i,valsLength=0;if(key==="range"&&this.options.range===true){if(value==="min"){this.options.value=this._values(0);this.options.values=null}else if(value==="max"){this.options.value=this._values(this.options.values.length-1);this.options.values=null}}if($.isArray(this.options.values)){valsLength=this.options.values.length}$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i)}this._animateOff=false;break;case"min":case"max":this._animateOff=true;this._refreshValue();this._animateOff=false;break;case"range":this._animateOff=true;this._refresh();this._animateOff=false;break}},//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val},//internal values getter
// _values() returns array of values trimmed by min and max, aligned by step
// _values( index ) returns single value trimmed by min and max, aligned by step
_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val}else if(this.options.values&&this.options.values.length){// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i])}return vals}else{return[]}},// returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin()}if(val>=this._valueMax()){return this._valueMax()}var step=this.options.step>0?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=valModStep>0?step:-step}// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=!this._animateOff?o.animate:false,_set={};if(this.options.values&&this.options.values.length){this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-that._valueMin())*100;_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(that.options.range===true){if(that.orientation==="horizontal"){if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({width:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}else{if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({bottom:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({height:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=valueMax!==valueMin?(value-valueMin)/(valueMax-valueMin)*100:0;_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:100-valPercent+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:100-valPercent+"%"},{queue:false,duration:o.animate})}}},_handleEvents:{keydown:function(event){var allowed,curVal,newVal,step,index=$(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:event.preventDefault();if(!this._keySliding){this._keySliding=true;$(event.target).addClass("ui-state-active");allowed=this._start(event,index);if(allowed===false){return}}break}step=this.options.step;if(this.options.values&&this.options.values.length){curVal=newVal=this.values(index)}else{curVal=newVal=this.value()}switch(event.keyCode){case $.ui.keyCode.HOME:newVal=this._valueMin();break;case $.ui.keyCode.END:newVal=this._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+(this._valueMax()-this._valueMin())/numPages);break;case $.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-(this._valueMax()-this._valueMin())/numPages);break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===this._valueMax()){return}newVal=this._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===this._valueMin()){return}newVal=this._trimAlignValue(curVal-step);break}this._slide(event,index,newVal)},click:function(event){event.preventDefault()},keyup:function(event){var index=$(event.target).data("ui-slider-handle-index");if(this._keySliding){this._keySliding=false;this._stop(event,index);this._change(event,index);$(event.target).removeClass("ui-state-active")}}}})})(jQuery);(function($,undefined){function isOverAxis(x,reference,size){return x>reference&&x<reference+size}function isFloating(item){return/left|right/.test(item.css("float"))||/inline|table-cell/.test(item.css("display"))}$.widget("ui.sortable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,// callbacks
activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");//Get the items
this.refresh();//Let's determine if the items are being displayed horizontally
this.floating=this.items.length?o.axis==="x"||isFloating(this.items[0].item):false;//Let's determine the parent's offset
this.offset=this.element.offset();//Initialize mouse events for interaction
this._mouseInit();//We're ready to go
this.ready=true},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData(this.widgetName+"-item")}return this},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget().toggleClass("ui-sortable-disabled",!!value)}else{// Don't call widget base _setOption for disable as it adds ui-state-disabled class
$.Widget.prototype._setOption.apply(this,arguments)}},_mouseCapture:function(event,overrideHandle){var currentItem=null,validHandle=false,that=this;if(this.reverting){return false}if(this.options.disabled||this.options.type==="static"){return false}//We have to refresh the items data once first
this._refreshItems(event);//Find out if the clicked node (or one of its parents) is a actual item in this.items
$(event.target).parents().each(function(){if($.data(this,that.widgetName+"-item")===that){currentItem=$(this);return false}});if($.data(event.target,that.widgetName+"-item")===that){currentItem=$(event.target)}if(!currentItem){return false}if(this.options.handle&&!overrideHandle){$(this.options.handle,currentItem).find("*").addBack().each(function(){if(this===event.target){validHandle=true}});if(!validHandle){return false}}this.currentItem=currentItem;this._removeCurrentsFromItems();return true},_mouseStart:function(event,overrideHandle,noActivation){var i,body,o=this.options;this.currentContainer=this;//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
this.refreshPositions();//Create and append the visible helper
this.helper=this._createHelper(event);//Cache the helper size
this._cacheHelperProportions();/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */
//Cache the margins of the original element
this._cacheMargins();//Get the next scrolling parent
this.scrollParent=this.helper.scrollParent();//The element's absolute position on the page minus margins
this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{//Where the click happened, relative to the element
left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});// Only after we got the offset, we can change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");//Generate the original position
this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt);//Cache the former DOM position
this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide()}//Create the placeholder
this._createPlaceholder();//Set a containment if given in the options
if(o.containment){this._setContainment()}if(o.cursor&&o.cursor!=="auto"){// cursor option
body=this.document.find("body");// support: IE
this.storedCursor=body.css("cursor");body.css("cursor",o.cursor);this.storedStylesheet=$("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body)}if(o.opacity){// opacity option
if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",o.opacity)}if(o.zIndex){// zIndex option
if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",o.zIndex)}//Prepare scrolling
if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset()}//Call callbacks
this._trigger("start",event,this._uiHash());//Recache the helper size
if(!this._preserveHelperProportions){this._cacheHelperProportions()}//Post "activate" events to possible containers
if(!noActivation){for(i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,this._uiHash(this))}}//Prepare possible droppables
if($.ui.ddmanager){$.ui.ddmanager.current=this}if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);//Execute the drag once - this causes the helper not to be visible before getting its correct position
return true},_mouseDrag:function(event){var i,item,itemElement,intersection,o=this.options,scrolled=false;//Compute the helpers position
this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}//Do scrolling
if(this.options.scroll){if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-event.pageY<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed}else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed}if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-event.pageX<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed}else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed}}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed)}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed)}if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed)}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed)}}if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event)}}//Regenerate the absolute position used for position checks
this.positionAbs=this._convertPositionTo("absolute");//Set the helper position
if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px"}//Rearrange
for(i=this.items.length-1;i>=0;i--){//Cache variables and intersection, continue if no intersection
item=this.items[i];itemElement=item.item[0];intersection=this._intersectsWithPointer(item);if(!intersection){continue}// Only put the placeholder inside the current Container, skip all
// items from other containers. This works because when moving
// an item from one container to another the
// currentContainer is switched before the placeholder is moved.
//
// Without this, moving items in "sub-sortables" can cause
// the placeholder to jitter beetween the outer and inner container.
if(item.instance!==this.currentContainer){continue}// cannot intersect with itself
// no useless actions that have been done before
// no action if the item moved is the parent of the item checked
if(itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$.contains(this.placeholder[0],itemElement)&&(this.options.type==="semi-dynamic"?!$.contains(this.element[0],itemElement):true)){this.direction=intersection===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item)}else{break}this._trigger("change",event,this._uiHash());break}}//Post events to containers
this._contactContainers(event);//Interconnect with droppables
if($.ui.ddmanager){$.ui.ddmanager.drag(this,event)}//Call callbacks
this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(event,noPropagation){if(!event){return}//If we are using droppables, inform the manager about the drop
if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event)}if(this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};if(!axis||axis==="x"){animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)}if(!axis||axis==="y"){animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)}this.reverting=true;$(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event)})}else{this._clear(event,noPropagation)}return false},cancel:function(){if(this.dragging){this._mouseUp({target:null});if(this.options.helper==="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}//Post deactivating events to containers
for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,this._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,this._uiHash(this));this.containers[i].containerCache.over=0}}}if(this.placeholder){//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem)}else{$(this.domPosition.parent).prepend(this.currentItem)}}return this},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||/(.+)[\-=_](.+)/);if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]))}});if(!str.length&&o.key){str.push(o.key+"=")}return str.join("&")},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"")});return ret},/* Be careful with the following core functions */
_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=this.options.axis==="x"||y1+dyClick>t&&y1+dyClick<b,isOverElementWidth=this.options.axis==="y"||x1+dxClick>l&&x1+dxClick<r,isOverElement=isOverElementHeight&&isOverElementWidth;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"]){return isOverElement}else{// Right Half
// Left Half
// Bottom Half
return l<x1+this.helperProportions.width/2&&x2-this.helperProportions.width/2<r&&t<y1+this.helperProportions.height/2&&y2-this.helperProportions.height/2<b}},_intersectsWithPointer:function(item){var isOverElementHeight=this.options.axis==="x"||isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=this.options.axis==="y"||isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement){return false}return this.floating?horizontalDirection&&horizontalDirection==="right"||verticalDirection==="down"?2:1:verticalDirection&&(verticalDirection==="down"?2:1)},_intersectsWithSides:function(item){var isOverBottomHalf=isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+item.height/2,item.height),isOverRightHalf=isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+item.width/2,item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return horizontalDirection==="right"&&isOverRightHalf||horizontalDirection==="left"&&!isOverRightHalf}else{return verticalDirection&&(verticalDirection==="down"&&isOverBottomHalf||verticalDirection==="up"&&!isOverBottomHalf)}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up")},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left")},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this},_connectWith:function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith},_getItemsAsjQuery:function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst])}}}}queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this)}for(i=queries.length-1;i>=0;i--){queries[i][0].each(addItems)}return $(items)},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$.grep(this.items,function(item){for(var j=0;j<list.length;j++){if(list[j]===item.item[0]){return false}}return true})},_refreshItems:function(event){this.items=[];this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready){//Shouldn't be run the first time through due to massive slow-down
for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst)}}}}for(i=queries.length-1;i>=0;i--){targetData=queries[i][1];_queries=queries[i][0];for(j=0,queriesLength=_queries.length;j<queriesLength;j++){item=$(_queries[j]);item.data(this.widgetName+"-item",targetData);// Data for target checking (mouse manager)
items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0})}}},refreshPositions:function(fast){//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}var i,item,t,p;for(i=this.items.length-1;i>=0;i--){item=this.items[i];//We ignore calculating positions of all connected containers when we're not over them
if(item.instance!==this.currentContainer&&this.currentContainer&&item.item[0]!==this.currentItem[0]){continue}t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight()}p=t.offset();item.left=p.left;item.top=p.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(i=this.containers.length-1;i>=0;i--){p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight()}}return this},_createPlaceholder:function(that){that=that||this;var className,o=that.options;if(!o.placeholder||o.placeholder.constructor===String){className=o.placeholder;o.placeholder={element:function(){var nodeName=that.currentItem[0].nodeName.toLowerCase(),element=$("<"+nodeName+">",that.document[0]).addClass(className||that.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");if(nodeName==="tr"){that.currentItem.children().each(function(){$("<td>&#160;</td>",that.document[0]).attr("colspan",$(this).attr("colspan")||1).appendTo(element)})}else if(nodeName==="img"){element.attr("src",that.currentItem.attr("src"))}if(!className){element.css("visibility","hidden")}return element},update:function(container,p){// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
if(className&&!o.forcePlaceholderSize){return}//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
if(!p.height()){p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10))}if(!p.width()){p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10))}}}}//Create the placeholder
that.placeholder=$(o.placeholder.element.call(that.element,that.currentItem));//Append it after the actual current item
that.currentItem.after(that.placeholder);//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
o.placeholder.update(that,that.placeholder)},_contactContainers:function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,base,cur,nearBottom,floating,innermostContainer=null,innermostIndex=null;// get innermost container that intersects with item
for(i=this.containers.length-1;i>=0;i--){// never consider a container that's located within the item itself
if($.contains(this.currentItem[0],this.containers[i].element[0])){continue}if(this._intersectsWith(this.containers[i].containerCache)){// if we've already found a container and it's more "inner" than this, then continue
if(innermostContainer&&$.contains(this.containers[i].element[0],innermostContainer.element[0])){continue}innermostContainer=this.containers[i];innermostIndex=i}else{// container doesn't intersect. trigger "out" event if necessary
if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0}}}// if no intersecting containers found, return
if(!innermostContainer){return}// move the item into the container if it's not there already
if(this.containers.length===1){if(!this.containers[innermostIndex].containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}}else{//When entering a new container, we will find the item with the least distance and append our item near it
dist=1e4;itemWithLeastDistance=null;floating=innermostContainer.floating||isFloating(this.currentItem);posProperty=floating?"left":"top";sizeProperty=floating?"width":"height";base=this.positionAbs[posProperty]+this.offset.click[posProperty];for(j=this.items.length-1;j>=0;j--){if(!$.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue}if(this.items[j].item[0]===this.currentItem[0]){continue}if(floating&&!isOverAxis(this.positionAbs.top+this.offset.click.top,this.items[j].top,this.items[j].height)){continue}cur=this.items[j].item.offset()[posProperty];nearBottom=false;if(Math.abs(cur-base)>Math.abs(cur+this.items[j][sizeProperty]-base)){nearBottom=true;cur+=this.items[j][sizeProperty]}if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];this.direction=nearBottom?"up":"down"}}//Check if dropOnEmpty is enabled
if(!itemWithLeastDistance&&!this.options.dropOnEmpty){return}if(this.currentContainer===this.containers[innermostIndex]){return}itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.currentContainer=this.containers[innermostIndex];//Update the placeholder
this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1}},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):o.helper==="clone"?this.currentItem.clone():this.currentItem;//Add the helper to the DOM if that didn't happen already
if(!helper.parents("body").length){$(o.appendTo!=="parent"?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0])}if(helper[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(!helper[0].style.width||o.forceHelperSize){helper.width(this.currentItem.width())}if(!helper[0].style.height||o.forceHelperSize){helper.height(this.currentItem.height())}return helper},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ")}if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0}}if("left"in obj){this.offset.click.left=obj.left+this.margins.left}if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left}if("top"in obj){this.offset.click.top=obj.top+this.margins.top}if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top}},_getParentOffset:function(){//Get the offsetParent and cache its position
this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop()}// This needs to be actually done for all browsers, since pageX/pageY includes this information
// with an ugly IE fix
if(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie){po={top:0,left:0}}return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var ce,co,over,o=this.options;if(o.containment==="parent"){o.containment=this.helper[0].parentNode}if(o.containment==="document"||o.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!/^(document|window|parent)$/.test(o.containment)){ce=$(o.containment)[0];co=$(o.containment).offset();over=$(ce).css("overflow")!=="hidden";this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position}var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);return{top:pos.top+// The absolute mouse position
this.offset.relative.top*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop())*mod,left:pos.left+// The absolute mouse position
this.offset.relative.left*mod+// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left*mod-// The offsetParent's offset without borders (offset + border)
(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod}},_generatePosition:function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=/(html|body)/i.test(scroll[0].tagName);// This is another very weird special case that only happens for relative elements:
// 1. If the css position is relative
// 2. and the scroll parent is the document or similar to the offset parent
// we have to refresh the relative offset during the scroll so there are no jumps
if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */
if(this.originalPosition){//If we are not dragging yet, we won't check for options
if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left}if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top}if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left}if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top}}if(o.grid){top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3]?top:top-this.offset.click.top>=this.containment[1]?top-o.grid[1]:top+o.grid[1]:top;left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2]?left:left-this.offset.click.left>=this.containment[0]?left-o.grid[0]:left+o.grid[0]:left}}return{top:pageY-// The absolute mouse position
this.offset.click.top-// Click offset (relative to the element)
this.offset.relative.top-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.top+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollTop():scrollIsRootNode?0:scroll.scrollTop()),left:pageX-// The absolute mouse position
this.offset.click.left-// Click offset (relative to the element)
this.offset.relative.left-// Only for relative positioned nodes: Relative offset from element to offset parent
this.offset.parent.left+(// The offsetParent's offset without borders (offset + border)
this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())}},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?i.item[0]:i.item[0].nextSibling);//Various things done here to improve the performance:
// 1. we create a setTimeout, that calls refreshPositions
// 2. on the instance, we have a counter variable, that get's higher after every append
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
// 4. this lets only the last addition to the timeout stack through
this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){if(counter===this.counter){this.refreshPositions(!hardRefresh)}})},_clear:function(event,noPropagation){this.reverting=false;// We delay all events that have to be triggered to after the point where the placeholder has been removed and
// everything else normalized again
var i,delayedTriggers=[];// We first have to update the dom position of the actual currentItem
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){if(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static"){this._storedCSS[i]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!noPropagation){delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation){delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash())})}// Check if the items Container has Changed and trigger appropriate
// events.
if(this!==this.currentContainer){if(!noPropagation){delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash())});delayedTriggers.push(function(c){return function(event){c._trigger("receive",event,this._uiHash(this))}}.call(this,this.currentContainer));delayedTriggers.push(function(c){return function(event){c._trigger("update",event,this._uiHash(this))}}.call(this,this.currentContainer))}}//Post events to containers
function delayEvent(type,instance,container){return function(event){container._trigger(type,event,instance._uiHash(instance))}}for(i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push(delayEvent("deactivate",this,this.containers[i]))}if(this.containers[i].containerCache.over){delayedTriggers.push(delayEvent("out",this,this.containers[i]));this.containers[i].containerCache.over=0}}//Do what was originally in plugins
if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}//Trigger all delayed events
this._trigger("stop",event,this._uiHash())}this.fromOutside=false;return false}if(!noPropagation){this._trigger("beforeStop",event,this._uiHash())}//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!==this.currentItem[0]){this.helper.remove()}this.helper=null;if(!noPropagation){for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event)}//Trigger all delayed events
this._trigger("stop",event,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null}}})})(jQuery);(function($){function modifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger("change")}}}$.widget("ui.spinner",{version:"1.10.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:true,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){// handle string values that need to be parsed
this._setOption("max",this.options.max);this._setOption("min",this.options.min);this._setOption("step",this.options.step);// Only format if there is a value, prevents the field from being marked
// as invalid in Firefox, see #9573.
if(this.value()!==""){// Format the value, but don't constrain.
this._value(this.element.val(),true)}this._draw();this._on(this._events);this._refresh();// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var options={},element=this.element;$.each(["min","max","step"],function(i,option){var value=element.attr(option);if(value!==undefined&&value.length){options[option]=value}});return options},_events:{keydown:function(event){if(this._start(event)&&this._keydown(event)){event.preventDefault()}},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return}this._stop();this._refresh();if(this.previous!==this.element.val()){this._trigger("change",event)}},mousewheel:function(event,delta){if(!delta){return}if(!this.spinning&&!this._start(event)){return false}this._spin((delta>0?1:-1)*this.options.step,event);clearTimeout(this.mousewheelTimer);this.mousewheelTimer=this._delay(function(){if(this.spinning){this._stop(event)}},100);event.preventDefault()},"mousedown .ui-spinner-button":function(event){var previous;// We never want the buttons to have focus; whenever the user is
// interacting with the spinner, the focus should be on the input.
// If the input is focused then this.previous is properly set from
// when the input first received focus. If the input is not focused
// then we need to set this.previous based on the value before spinning.
previous=this.element[0]===this.document[0].activeElement?this.previous:this.element.val();function checkFocus(){var isActive=this.element[0]===this.document[0].activeElement;if(!isActive){this.element.focus();this.previous=previous;// support: IE
// IE sets focus asynchronously, so we need to check if focus
// moved off of the input because the user clicked on the button.
this._delay(function(){this.previous=previous})}}// ensure focus is on (or stays on) the text field
event.preventDefault();checkFocus.call(this);// support: IE
// IE doesn't prevent moving focus even with event.preventDefault()
// so we set a flag to know when we should ignore the blur event
// and check (again) if focus moved off of the input.
this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;checkFocus.call(this)});if(this._start(event)===false){return}this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(event){// button will add ui-state-active if mouse was down while mouseleave and kept down
if(!$(event.currentTarget).hasClass("ui-state-active")){return}if(this._start(event)===false){return false}this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event)},// TODO: do we really want to consider this a stop?
// shouldn't we just stop the repeater and wait until mouseup before
// we trigger the stop event?
"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var uiSpinner=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton");// button bindings
this.buttons=uiSpinner.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all");// IE 6 doesn't understand height: 50% for the buttons
// unless the wrapper has an explicit height
if(this.buttons.height()>Math.ceil(uiSpinner.height()*.5)&&uiSpinner.height()>0){uiSpinner.height(uiSpinner.height())}// disable spinner if element was already disabled
if(this.options.disabled){this.disable()}},_keydown:function(event){var options=this.options,keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.UP:this._repeat(null,1,event);return true;case keyCode.DOWN:this._repeat(null,-1,event);return true;case keyCode.PAGE_UP:this._repeat(null,options.page,event);return true;case keyCode.PAGE_DOWN:this._repeat(null,-options.page,event);return true}return false},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return""+"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>"+"<span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(event){if(!this.spinning&&this._trigger("start",event)===false){return false}if(!this.counter){this.counter=1}this.spinning=true;return true},_repeat:function(i,steps,event){i=i||500;clearTimeout(this.timer);this.timer=this._delay(function(){this._repeat(40,steps,event)},i);this._spin(steps*this.options.step,event)},_spin:function(step,event){var value=this.value()||0;if(!this.counter){this.counter=1}value=this._adjustValue(value+step*this._increment(this.counter));if(!this.spinning||this._trigger("spin",event,{value:value})!==false){this._value(value);this.counter++}},_increment:function(i){var incremental=this.options.incremental;if(incremental){return $.isFunction(incremental)?incremental(i):Math.floor(i*i*i/5e4-i*i/500+17*i/200+1)}return 1},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min))}return precision},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1},_adjustValue:function(value){var base,aboveMin,options=this.options;// make sure we're at a valid step
// - find out where we are relative to the base (min or 0)
base=options.min!==null?options.min:0;aboveMin=value-base;// - round to the nearest step
aboveMin=Math.round(aboveMin/options.step)*options.step;// - rounding is based on 0, so adjust back to our base
value=base+aboveMin;// fix precision from bad JS floating point math
value=parseFloat(value.toFixed(this._precision()));// clamp the value
if(options.max!==null&&value>options.max){return options.max}if(options.min!==null&&value<options.min){return options.min}return value},_stop:function(event){if(!this.spinning){return}clearTimeout(this.timer);clearTimeout(this.mousewheelTimer);this.counter=0;this.spinning=false;this._trigger("stop",event)},_setOption:function(key,value){if(key==="culture"||key==="numberFormat"){var prevValue=this._parse(this.element.val());this.options[key]=value;this.element.val(this._format(prevValue));return}if(key==="max"||key==="min"||key==="step"){if(typeof value==="string"){value=this._parse(value)}}if(key==="icons"){this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(value.up);this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(value.down)}this._super(key,value);if(key==="disabled"){if(value){this.element.prop("disabled",true);this.buttons.button("disable")}else{this.element.prop("disabled",false);this.buttons.button("enable")}}},_setOptions:modifier(function(options){this._super(options);this._value(this.element.val())}),_parse:function(val){if(typeof val==="string"&&val!==""){val=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(val,10,this.options.culture):+val}return val===""||isNaN(val)?null:val},_format:function(value){if(value===""){return""}return window.Globalize&&this.options.numberFormat?Globalize.format(value,this.options.numberFormat,this.options.culture):value},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,// TODO: what should we do with values that can't be parsed?
"aria-valuenow":this._parse(this.element.val())})},// update the value without triggering change
_value:function(value,allowAny){var parsed;if(value!==""){parsed=this._parse(value);if(parsed!==null){if(!allowAny){parsed=this._adjustValue(parsed)}value=this._format(parsed)}}this.element.val(value);this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",false).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.uiSpinner.replaceWith(this.element)},stepUp:modifier(function(steps){this._stepUp(steps)}),_stepUp:function(steps){if(this._start()){this._spin((steps||1)*this.options.step);this._stop()}},stepDown:modifier(function(steps){this._stepDown(steps)}),_stepDown:function(steps){if(this._start()){this._spin((steps||1)*-this.options.step);this._stop()}},pageUp:modifier(function(pages){this._stepUp((pages||1)*this.options.page)}),pageDown:modifier(function(pages){this._stepDown((pages||1)*this.options.page)}),value:function(newVal){if(!arguments.length){return this._parse(this.element.val())}modifier(this._value).call(this,newVal)},widget:function(){return this.uiSpinner}})})(jQuery);(function($,undefined){var tabId=0,rhash=/#.*$/;function getNextTabId(){return++tabId}function isLocal(anchor){// support: IE7
// IE7 doesn't normalize the href property when set via script (#9317)
anchor=anchor.cloneNode(false);return anchor.hash.length>1&&decodeURIComponent(anchor.href.replace(rhash,""))===decodeURIComponent(location.href.replace(rhash,""))}$.widget("ui.tabs",{version:"1.10.4",delay:300,options:{active:null,collapsible:false,event:"click",heightStyle:"content",hide:null,show:null,// callbacks
activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var that=this,options=this.options;this.running=false;this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",options.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(event){if($(this).is(".ui-state-disabled")){event.preventDefault()}}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){if($(this).closest("li").is(".ui-state-disabled")){this.blur()}});this._processTabs();options.active=this._initialActive();// Take disabling tabs via class attribute from HTML
// into account and update option properly.
if($.isArray(options.disabled)){options.disabled=$.unique(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"),function(li){return that.tabs.index(li)}))).sort()}// check for length avoids error when initializing empty list
if(this.options.active!==false&&this.anchors.length){this.active=this._findActive(options.active)}else{this.active=$()}this._refresh();if(this.active.length){this.load(options.active)}},_initialActive:function(){var active=this.options.active,collapsible=this.options.collapsible,locationHash=location.hash.substring(1);if(active===null){// check the fragment identifier in the URL
if(locationHash){this.tabs.each(function(i,tab){if($(tab).attr("aria-controls")===locationHash){active=i;return false}})}// check for a tab marked active via a class
if(active===null){active=this.tabs.index(this.tabs.filter(".ui-tabs-active"))}// no active tab, set to false
if(active===null||active===-1){active=this.tabs.length?0:false}}// handle numbers: negative, out of range
if(active!==false){active=this.tabs.index(this.tabs.eq(active));if(active===-1){active=collapsible?false:0}}// don't allow collapsible: false and active: false
if(!collapsible&&active===false&&this.anchors.length){active=0}return active},_getCreateEventData:function(){return{tab:this.active,panel:!this.active.length?$():this._getPanelForTab(this.active)}},_tabKeydown:function(event){var focusedTab=$(this.document[0].activeElement).closest("li"),selectedIndex=this.tabs.index(focusedTab),goingForward=true;if(this._handlePageNav(event)){return}switch(event.keyCode){case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:selectedIndex++;break;case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:goingForward=false;selectedIndex--;break;case $.ui.keyCode.END:selectedIndex=this.anchors.length-1;break;case $.ui.keyCode.HOME:selectedIndex=0;break;case $.ui.keyCode.SPACE:// Activate only, no collapsing
event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex);return;case $.ui.keyCode.ENTER:// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();clearTimeout(this.activating);// Determine if we should collapse or activate
this._activate(selectedIndex===this.options.active?false:selectedIndex);return;default:return}// Focus the appropriate tab, based on which key was pressed
event.preventDefault();clearTimeout(this.activating);selectedIndex=this._focusNextTab(selectedIndex,goingForward);// Navigating with control key will prevent automatic activation
if(!event.ctrlKey){// Update aria-selected immediately so that AT think the tab is already selected.
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
focusedTab.attr("aria-selected","false");this.tabs.eq(selectedIndex).attr("aria-selected","true");this.activating=this._delay(function(){this.option("active",selectedIndex)},this.delay)}},_panelKeydown:function(event){if(this._handlePageNav(event)){return}// Ctrl+up moves focus to the current tab
if(event.ctrlKey&&event.keyCode===$.ui.keyCode.UP){event.preventDefault();this.active.focus()}},// Alt+page up/down moves focus to the previous/next tab (and activates)
_handlePageNav:function(event){if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_UP){this._activate(this._focusNextTab(this.options.active-1,false));return true}if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_DOWN){this._activate(this._focusNextTab(this.options.active+1,true));return true}},_findNextTab:function(index,goingForward){var lastTabIndex=this.tabs.length-1;function constrain(){if(index>lastTabIndex){index=0}if(index<0){index=lastTabIndex}return index}while($.inArray(constrain(),this.options.disabled)!==-1){index=goingForward?index+1:index-1}return index},_focusNextTab:function(index,goingForward){index=this._findNextTab(index,goingForward);this.tabs.eq(index).focus();return index},_setOption:function(key,value){if(key==="active"){// _activate() will handle invalid values and update this.options
this._activate(value);return}if(key==="disabled"){// don't use the widget factory's disabled handling
this._setupDisabled(value);return}this._super(key,value);if(key==="collapsible"){this.element.toggleClass("ui-tabs-collapsible",value);// Setting collapsible: false while collapsed; open first panel
if(!value&&this.options.active===false){this._activate(0)}}if(key==="event"){this._setupEvents(value)}if(key==="heightStyle"){this._setupHeightStyle(value)}},_tabId:function(tab){return tab.attr("aria-controls")||"ui-tabs-"+getNextTabId()},_sanitizeSelector:function(hash){return hash?hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var options=this.options,lis=this.tablist.children(":has(a[href])");// get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled=$.map(lis.filter(".ui-state-disabled"),function(tab){return lis.index(tab)});this._processTabs();// was collapsed or no tabs
if(options.active===false||!this.anchors.length){options.active=false;this.active=$()}else if(this.active.length&&!$.contains(this.tablist[0],this.active[0])){// all remaining tabs are disabled
if(this.tabs.length===options.disabled.length){options.active=false;this.active=$()}else{this._activate(this._findNextTab(Math.max(0,options.active-1),false))}}else{// make sure active index is correct
options.active=this.tabs.index(this.active)}this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"});// Make sure one tab is in the tab order
if(!this.active.length){this.tabs.eq(0).attr("tabIndex",0)}else{this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0});this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})}},_processTabs:function(){var that=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist");this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1});this.anchors=this.tabs.map(function(){return $("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1});this.panels=$();this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$(anchor).uniqueId().attr("id"),tab=$(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");// inline tab
if(isLocal(anchor)){selector=anchor.hash;panel=that.element.find(that._sanitizeSelector(selector))}else{panelId=that._tabId(tab);selector="#"+panelId;panel=that.element.find(selector);if(!panel.length){panel=that._createPanel(panelId);panel.insertAfter(that.panels[i-1]||that.tablist)}panel.attr("aria-live","polite")}if(panel.length){that.panels=that.panels.add(panel)}if(originalAriaControls){tab.data("ui-tabs-aria-controls",originalAriaControls)}tab.attr({"aria-controls":selector.substring(1),"aria-labelledby":anchorId});panel.attr("aria-labelledby",anchorId)});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},// allow overriding how to find the list for rare usage scenarios (#7715)
_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(id){return $("<div>").attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",true)},_setupDisabled:function(disabled){if($.isArray(disabled)){if(!disabled.length){disabled=false}else if(disabled.length===this.anchors.length){disabled=true}}// disable tabs
for(var i=0,li;li=this.tabs[i];i++){if(disabled===true||$.inArray(i,disabled)!==-1){$(li).addClass("ui-state-disabled").attr("aria-disabled","true")}else{$(li).removeClass("ui-state-disabled").removeAttr("aria-disabled")}}this.options.disabled=disabled},_setupEvents:function(event){var events={click:function(event){event.preventDefault()}};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler"})}this._off(this.anchors.add(this.tabs).add(this.panels));this._on(this.anchors,events);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs)},_setupHeightStyle:function(heightStyle){var maxHeight,parent=this.element.parent();if(heightStyle==="fill"){maxHeight=parent.height();maxHeight-=this.element.outerHeight()-this.element.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return}maxHeight-=elem.outerHeight(true)});this.element.children().not(this.panels).each(function(){maxHeight-=$(this).outerHeight(true)});this.panels.each(function(){$(this).height(Math.max(0,maxHeight-$(this).innerHeight()+$(this).height()))}).css("overflow","auto")}else if(heightStyle==="auto"){maxHeight=0;this.panels.each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height())}).height(maxHeight)}},_eventHandler:function(event){var options=this.options,active=this.active,anchor=$(event.currentTarget),tab=anchor.closest("li"),clickedIsActive=tab[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():this._getPanelForTab(tab),toHide=!active.length?$():this._getPanelForTab(active),eventData={oldTab:active,oldPanel:toHide,newTab:collapsing?$():tab,newPanel:toShow};event.preventDefault();if(tab.hasClass("ui-state-disabled")||// tab is already loading
tab.hasClass("ui-tabs-loading")||// can't switch durning an animation
this.running||// click on active header, but not collapsible
clickedIsActive&&!options.collapsible||// allow canceling activation
this._trigger("beforeActivate",event,eventData)===false){return}options.active=collapsing?false:this.tabs.index(tab);this.active=clickedIsActive?$():tab;if(this.xhr){this.xhr.abort()}if(!toHide.length&&!toShow.length){$.error("jQuery UI Tabs: Mismatching fragment identifier.")}if(toShow.length){this.load(this.tabs.index(tab),event)}this._toggle(event,eventData)},// handles show/hide for selecting tabs
_toggle:function(event,eventData){var that=this,toShow=eventData.newPanel,toHide=eventData.oldPanel;this.running=true;function complete(){that.running=false;that._trigger("activate",event,eventData)}function show(){eventData.newTab.closest("li").addClass("ui-tabs-active ui-state-active");if(toShow.length&&that.options.show){that._show(toShow,that.options.show,complete)}else{toShow.show();complete()}}// start out by hiding, then showing, then completing
if(toHide.length&&this.options.hide){this._hide(toHide,this.options.hide,function(){eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");show()})}else{eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");toHide.hide();show()}toHide.attr({"aria-expanded":"false","aria-hidden":"true"});eventData.oldTab.attr("aria-selected","false");// If we're switching tabs, remove the old tab from the tab order.
// If we're opening from collapsed state, remove the previous tab from the tab order.
// If we're collapsing, then keep the collapsing tab in the tab order.
if(toShow.length&&toHide.length){eventData.oldTab.attr("tabIndex",-1)}else if(toShow.length){this.tabs.filter(function(){return $(this).attr("tabIndex")===0}).attr("tabIndex",-1)}toShow.attr({"aria-expanded":"true","aria-hidden":"false"});eventData.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(index){var anchor,active=this._findActive(index);// trying to activate the already active panel
if(active[0]===this.active[0]){return}// trying to collapse, simulate a click on the current active header
if(!active.length){active=this.active}anchor=active.find(".ui-tabs-anchor")[0];this._eventHandler({target:anchor,currentTarget:anchor,preventDefault:$.noop})},_findActive:function(index){return index===false?$():this.tabs.eq(index)},_getIndex:function(index){// meta-function to give users option to provide a href string instead of a numerical index.
if(typeof index==="string"){index=this.anchors.index(this.anchors.filter("[href$='"+index+"']"))}return index},_destroy:function(){if(this.xhr){this.xhr.abort()}this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible");this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role");this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId();this.tabs.add(this.panels).each(function(){if($.data(this,"ui-tabs-destroy")){$(this).remove()}else{$(this).removeClass("ui-state-default ui-state-active ui-state-disabled "+"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}});this.tabs.each(function(){var li=$(this),prev=li.data("ui-tabs-aria-controls");if(prev){li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls")}else{li.removeAttr("aria-controls")}});this.panels.show();if(this.options.heightStyle!=="content"){this.panels.css("height","")}},enable:function(index){var disabled=this.options.disabled;if(disabled===false){return}if(index===undefined){disabled=false}else{index=this._getIndex(index);if($.isArray(disabled)){disabled=$.map(disabled,function(num){return num!==index?num:null})}else{disabled=$.map(this.tabs,function(li,num){return num!==index?num:null})}}this._setupDisabled(disabled)},disable:function(index){var disabled=this.options.disabled;if(disabled===true){return}if(index===undefined){disabled=true}else{index=this._getIndex(index);if($.inArray(index,disabled)!==-1){return}if($.isArray(disabled)){disabled=$.merge([index],disabled).sort()}else{disabled=[index]}}this._setupDisabled(disabled)},load:function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab:tab,panel:panel};// not remote
if(isLocal(anchor[0])){return}this.xhr=$.ajax(this._ajaxSettings(anchor,event,eventData));// support: jQuery <1.8
// jQuery <1.8 returns false if the request is canceled in beforeSend,
// but as of 1.8, $.ajax() always returns a jqXHR object.
if(this.xhr&&this.xhr.statusText!=="canceled"){tab.addClass("ui-tabs-loading");panel.attr("aria-busy","true");this.xhr.success(function(response){// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function(){panel.html(response);that._trigger("load",event,eventData)},1)}).complete(function(jqXHR,status){// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function(){if(status==="abort"){that.panels.stop(false,true)}tab.removeClass("ui-tabs-loading");panel.removeAttr("aria-busy");if(jqXHR===that.xhr){delete that.xhr}},1)})}},_ajaxSettings:function(anchor,event,eventData){var that=this;return{url:anchor.attr("href"),beforeSend:function(jqXHR,settings){return that._trigger("beforeLoad",event,$.extend({jqXHR:jqXHR,ajaxSettings:settings},eventData))}}},_getPanelForTab:function(tab){var id=$(tab).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+id))}})})(jQuery);(function($){var increments=0;function addDescribedBy(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",$.trim(describedby.join(" ")))}function removeDescribedBy(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1)}elem.removeData("ui-tooltip-id");describedby=$.trim(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby)}else{elem.removeAttr("aria-describedby")}}$.widget("ui.tooltip",{version:"1.10.4",options:{content:function(){// support: IE<9, Opera in jQuery <1.7
// .text() can't accept undefined, so coerce to a string
var title=$(this).attr("title")||"";// Escape title, since we're going from an attribute to raw HTML
return $("<a>").text(title).html()},hide:true,// Disabled elements have inconsistent behavior across browsers (#8661)
items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,tooltipClass:null,track:false,// callbacks
close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"});// IDs of generated tooltips, needed for destroy
this.tooltips={};// IDs of parent tooltips where we removed the title attribute
this.parents={};if(this.options.disabled){this._disable()}},_setOption:function(key,value){var that=this;if(key==="disabled"){this[value?"_disable":"_enable"]();this.options[key]=value;// disable element style changes
return}this._super(key,value);if(key==="content"){$.each(this.tooltips,function(id,element){that._updateContent(element)})}},_disable:function(){var that=this;// close open tooltips
$.each(this.tooltips,function(id,element){var event=$.Event("blur");event.target=event.currentTarget=element[0];that.close(event,true)});// remove title attributes to prevent native tooltips
this.element.find(this.options.items).addBack().each(function(){var element=$(this);if(element.is("[title]")){element.data("ui-tooltip-title",element.attr("title")).attr("title","")}})},_enable:function(){// restore title attributes
this.element.find(this.options.items).addBack().each(function(){var element=$(this);if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"))}})},open:function(event){var that=this,target=$(event?event.target:this.element).closest(this.options.items);// No element to show a tooltip for or the tooltip is already open
if(!target.length||target.data("ui-tooltip-id")){return}if(target.attr("title")){target.data("ui-tooltip-title",target.attr("title"))}target.data("ui-tooltip-open",true);// kill parent tooltips, custom or native, for hover
if(event&&event.type==="mouseover"){target.parents().each(function(){var parent=$(this),blurEvent;if(parent.data("ui-tooltip-open")){blurEvent=$.Event("blur");blurEvent.target=blurEvent.currentTarget=this;that.close(blurEvent,true)}if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","")}})}this._updateContent(target,event)},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"){return this._open(event,target,contentOption)}content=contentOption.call(target[0],function(response){// ignore async response if tooltip was closed already
if(!target.data("ui-tooltip-open")){return}// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay(function(){// jQuery creates a special event for focusin when it doesn't
// exist natively. To improve performance, the native event
// object is reused and the type is changed. Therefore, we can't
// rely on the type being correct after the event finished
// bubbling, so we set it back to the previous value. (#8740)
if(event){event.type=eventType}this._open(event,target,response)})});if(content){this._open(event,target,content)}},_open:function(event,target,content){var tooltip,events,delayedShow,positionOption=$.extend({},this.options.position);if(!content){return}// Content can be updated multiple times. If the tooltip already
// exists, then just update the content and bail.
tooltip=this._find(target);if(tooltip.length){tooltip.find(".ui-tooltip-content").html(content);return}// if we have a title, clear it to prevent the native tooltip
// we have to check first to avoid defining a title if none exists
// (we don't want to cause an element to start matching [title])
//
// We use removeAttr only for key events, to allow IE to export the correct
// accessible attributes. For mouse events, set to empty string to avoid
// native tooltip showing up (happens only when removing inside mouseover).
if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","")}else{target.removeAttr("title")}}tooltip=this._tooltip(target);addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return}tooltip.position(positionOption)}if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});// trigger once to override element-relative positioning
position(event)}else{tooltip.position($.extend({of:target},this.options.position))}tooltip.hide();this._show(tooltip,this.options.show);// Handle tracking tooltips that are shown with a delay (#8644). As soon
// as the tooltip is visible, position the tooltip using the most recent
// event.
if(this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval(function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow)}},$.fx.interval)}this._trigger("open",event,{tooltip:tooltip});events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,true)}},remove:function(){this._removeTooltip(tooltip)}};if(!event||event.type==="mouseover"){events.mouseleave="close"}if(!event||event.type==="focusin"){events.focusout="close"}this._on(true,target,events)},close:function(event){var that=this,target=$(event?event.currentTarget:this.element),tooltip=this._find(target);// disabling closes the tooltip, so we need to track when we're closing
// to avoid an infinite loop in case the tooltip becomes disabled on close
if(this.closing){return}// Clear the interval for delayed tracking tooltips
clearInterval(this.delayedShow);// only set title if we had one before (see comment in _open())
if(target.data("ui-tooltip-title")){target.attr("title",target.data("ui-tooltip-title"))}removeDescribedBy(target);tooltip.stop(true);this._hide(tooltip,this.options.hide,function(){that._removeTooltip($(this))});target.removeData("ui-tooltip-open");this._off(target,"mouseleave focusout keyup");// Remove 'remove' binding only on delegated targets
if(target[0]!==this.element[0]){this._off(target,"remove")}this._off(this.document,"mousemove");if(event&&event.type==="mouseleave"){$.each(this.parents,function(id,parent){$(parent.element).attr("title",parent.title);delete that.parents[id]})}this.closing=true;this._trigger("close",event,{tooltip:tooltip});this.closing=false},_tooltip:function(element){var id="ui-tooltip-"+increments++,tooltip=$("<div>").attr({id:id,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));$("<div>").addClass("ui-tooltip-content").appendTo(tooltip);tooltip.appendTo(this.document[0].body);this.tooltips[id]=element;return tooltip},_find:function(target){var id=target.data("ui-tooltip-id");return id?$("#"+id):$()},_removeTooltip:function(tooltip){tooltip.remove();delete this.tooltips[tooltip.attr("id")]},_destroy:function(){var that=this;// close open tooltips
$.each(this.tooltips,function(id,element){// Delegate to close method to handle common cleanup
var event=$.Event("blur");event.target=event.currentTarget=element[0];that.close(event,true);// Remove immediately; destroying an open tooltip doesn't use the
// hide animation
$("#"+id).remove();// Restore the title
if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"));element.removeData("ui-tooltip-title")}})}})})(jQuery);(function($,window,undefined){"use strict";// global
var $window=$(window),Modernizr=window.Modernizr;// https://gist.github.com/edankwan/4389601
Modernizr.addTest("csstransformspreserve3d",function(){var prop=Modernizr.prefixed("transformStyle");var val="preserve-3d";var computedStyle;if(!prop)return false;prop=prop.replace(/([A-Z])/g,function(str,m1){return"-"+m1.toLowerCase()}).replace(/^ms-/,"-ms-");Modernizr.testStyles("#modernizr{"+prop+":"+val+";}",function(el,rule){computedStyle=window.getComputedStyle?getComputedStyle(el,null).getPropertyValue(prop):""});return computedStyle===val});/*
	* debouncedresize: special jQuery event that happens once after a window resize
	*
	* latest version and complete README available on Github:
	* https://github.com/louisremi/jquery-smartresize
	*
	* Copyright 2012 @louis_remi
	* Licensed under the MIT license.
	*
	* This saved you an hour of work? 
	* Send me music http://www.amazon.co.uk/wishlist/HNTU0468LQON
	*/
var $event=$.event,$special,resizeTimeout;$special=$event.special.debouncedresize={setup:function(){$(this).on("resize",$special.handler)},teardown:function(){$(this).off("resize",$special.handler)},handler:function(event,execAsap){// Save the context
var context=this,args=arguments,dispatch=function(){// set correct event type
event.type="debouncedresize";$event.dispatch.apply(context,args)};if(resizeTimeout){clearTimeout(resizeTimeout)}execAsap?dispatch():resizeTimeout=setTimeout(dispatch,$special.threshold)},threshold:150};$.BookBlock=function(options,element){this.$el=$(element);this._init(options)};// the options
$.BookBlock.defaults={// vertical or horizontal flip
orientation:"vertical",// ltr (left to right) or rtl (right to left)
direction:"ltr",// speed for the flip transition in ms
speed:100,// easing for the flip transition
easing:"ease-in-out",// if set to true, both the flipping page and the sides will have an overlay to simulate shadows
shadows:false,// opacity value for the "shadow" on both sides (when the flipping page is over it)
// value : 0.1 - 1
shadowSides:.2,// opacity value for the "shadow" on the flipping page (while it is flipping)
// value : 0.1 - 1
shadowFlip:.1,// if we should show the first item after reaching the end
circular:true,// if we want to specify a selector that triggers the next() function. example: ´#bb-nav-next´
nextEl:"",// if we want to specify a selector that triggers the prev() function
prevEl:"",// autoplay. If true it overwrites the circular option to true
autoplay:false,// time (ms) between page switch, if autoplay is true
interval:3e3,// callback after the flip transition
// old is the index of the previous item
// page is the current item´s index
// isLimit is true if the current page is the last one (or the first one)
onEndFlip:function(old,page,isLimit){return false},// callback before the flip transition
// page is the current item´s index
onBeforeFlip:function(page){return false}};$.BookBlock.prototype={_init:function(options){// options
this.options=$.extend(true,{},$.BookBlock.defaults,options);// orientation class
this.$el.addClass("bb-"+this.options.orientation);// items
this.$items=this.$el.children(".bb-item").hide();// total items
this.itemsCount=this.$items.length;// current item´s index
this.current=0;// previous item´s index
this.previous=-1;// show first item
this.$current=this.$items.eq(this.current).show();// get width of this.$el
// this will be necessary to create the flipping layout
this.elWidth=this.$el.width();var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"};this.transEndEventName=transEndEventNames[Modernizr.prefixed("transition")]+".bookblock";// support css 3d transforms && css transitions && Modernizr.csstransformspreserve3d
this.support=Modernizr.csstransitions&&Modernizr.csstransforms3d&&Modernizr.csstransformspreserve3d;// initialize/bind some events
this._initEvents();// start slideshow
if(this.options.autoplay){this.options.circular=true;this._startSlideshow()}},_initEvents:function(){var self=this;if(this.options.nextEl!==""){$(this.options.nextEl).on("click.bookblock touchstart.bookblock",function(){self._action("next");return false})}if(this.options.prevEl!==""){$(this.options.prevEl).on("click.bookblock touchstart.bookblock",function(){self._action("prev");return false})}$window.on("debouncedresize",function(){// update width value
self.elWidth=self.$el.width()})},_action:function(dir,page){this._stopSlideshow();this._navigate(dir,page)},_navigate:function(dir,page){if(this.isAnimating){return false}// callback trigger
this.options.onBeforeFlip(this.current);this.isAnimating=true;// update current value
this.$current=this.$items.eq(this.current);if(page!==undefined){this.current=page}else if(dir==="next"&&this.options.direction==="ltr"||dir==="prev"&&this.options.direction==="rtl"){if(!this.options.circular&&this.current===this.itemsCount-1){this.end=true}else{this.previous=this.current;this.current=this.current<this.itemsCount-1?this.current+1:0}}else if(dir==="prev"&&this.options.direction==="ltr"||dir==="next"&&this.options.direction==="rtl"){if(!this.options.circular&&this.current===0){this.end=true}else{this.previous=this.current;this.current=this.current>0?this.current-1:this.itemsCount-1}}this.$nextItem=!this.options.circular&&this.end?this.$current:this.$items.eq(this.current);if(!this.support){this._layoutNoSupport(dir)}else{this._layout(dir)}},_layoutNoSupport:function(dir){this.$items.hide();this.$nextItem.show();this.end=false;this.isAnimating=false;var isLimit=dir==="next"&&this.current===this.itemsCount-1||dir==="prev"&&this.current===0;// callback trigger
this.options.onEndFlip(this.previous,this.current,isLimit)},// creates the necessary layout for the 3d structure
_layout:function(dir){var self=this,// basic structure: 1 element for the left side.
$s_left=this._addSide("left",dir),// 1 element for the flipping/middle page
$s_middle=this._addSide("middle",dir),// 1 element for the right side
$s_right=this._addSide("right",dir),// overlays
$o_left=$s_left.find("div.bb-overlay"),$o_middle_f=$s_middle.find("div.bb-flipoverlay:first"),$o_middle_b=$s_middle.find("div.bb-flipoverlay:last"),$o_right=$s_right.find("div.bb-overlay"),speed=this.end?400:this.options.speed;this.$items.hide();this.$el.prepend($s_left,$s_middle,$s_right);$s_middle.css({transitionDuration:speed+"ms",transitionTimingFunction:this.options.easing}).on(this.transEndEventName,function(event){if($(event.target).hasClass("bb-page")){self.$el.children(".bb-page").remove();self.$nextItem.show();self.end=false;self.isAnimating=false;var isLimit=dir==="next"&&self.current===self.itemsCount-1||dir==="prev"&&self.current===0;// callback trigger
self.options.onEndFlip(self.previous,self.current,isLimit)}});if(dir==="prev"){$s_middle.addClass("bb-flip-initial")}// overlays
if(this.options.shadows&&!this.end){var o_left_style=dir==="next"?{transition:"opacity "+this.options.speed/2+"ms "+"linear"+" "+this.options.speed/2+"ms"}:{transition:"opacity "+this.options.speed/2+"ms "+"linear",opacity:this.options.shadowSides},o_middle_f_style=dir==="next"?{transition:"opacity "+this.options.speed/2+"ms "+"linear"}:{transition:"opacity "+this.options.speed/2+"ms "+"linear"+" "+this.options.speed/2+"ms",opacity:this.options.shadowFlip},o_middle_b_style=dir==="next"?{transition:"opacity "+this.options.speed/2+"ms "+"linear"+" "+this.options.speed/2+"ms",opacity:this.options.shadowFlip}:{transition:"opacity "+this.options.speed/2+"ms "+"linear"},o_right_style=dir==="next"?{transition:"opacity "+this.options.speed/2+"ms "+"linear",opacity:this.options.shadowSides}:{transition:"opacity "+this.options.speed/2+"ms "+"linear"+" "+this.options.speed/2+"ms"};$o_middle_f.css(o_middle_f_style);$o_middle_b.css(o_middle_b_style);$o_left.css(o_left_style);$o_right.css(o_right_style)}setTimeout(function(){// first && last pages lift slightly up when we can't go further
$s_middle.addClass(self.end?"bb-flip-"+dir+"-end":"bb-flip-"+dir);// overlays
if(self.options.shadows&&!self.end){$o_middle_f.css({opacity:dir==="next"?self.options.shadowFlip:0});$o_middle_b.css({opacity:dir==="next"?0:self.options.shadowFlip});$o_left.css({opacity:dir==="next"?self.options.shadowSides:0});$o_right.css({opacity:dir==="next"?0:self.options.shadowSides})}},25)},// adds the necessary sides (bb-page) to the layout 
_addSide:function(side,dir){var $side;switch(side){case"left":/*
						<div class="bb-page" style="z-index:102;">
							<div class="bb-back">
								<div class="bb-outer">
									<div class="bb-content">
										<div class="bb-inner">
											dir==='next' ? [content of current page] : [content of next page]
										</div>
									</div>
									<div class="bb-overlay"></div>
								</div>
							</div>
						</div>
						*/
$side=$('<div class="bb-page"><div class="bb-back"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">'+(dir==="next"?this.$current.html():this.$nextItem.html())+'</div></div><div class="bb-overlay"></div></div></div></div>').css("z-index",6);break;case"middle":/*
						<div class="bb-page" style="z-index:103;">
							<div class="bb-front">
								<div class="bb-outer">
									<div class="bb-content">
										<div class="bb-inner">
											dir==='next' ? [content of current page] : [content of next page]
										</div>
									</div>
									<div class="bb-flipoverlay"></div>
								</div>
							</div>
							<div class="bb-back">
								<div class="bb-outer">
									<div class="bb-content">
										<div class="bb-inner">
											dir==='next' ? [content of next page] : [content of current page]
										</div>
									</div>
									<div class="bb-flipoverlay"></div>
								</div>
							</div>
						</div>
						*/
$side=$('<div class="bb-page"><div class="bb-front"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">'+(dir==="next"?this.$current.html():this.$nextItem.html())+'</div></div><div class="bb-flipoverlay"></div></div></div><div class="bb-back"><div class="bb-outer"><div class="bb-content" style="width:'+this.elWidth+'px"><div class="bb-inner">'+(dir==="next"?this.$nextItem.html():this.$current.html())+'</div></div><div class="bb-flipoverlay"></div></div></div></div>').css("z-index",7);break;case"right":/*
						<div class="bb-page" style="z-index:101;">
							<div class="bb-front">
								<div class="bb-outer">
									<div class="bb-content">
										<div class="bb-inner">
											dir==='next' ? [content of next page] : [content of current page]
										</div>
									</div>
									<div class="bb-overlay"></div>
								</div>
							</div>
						</div>
						*/
$side=$('<div class="bb-page"><div class="bb-front"><div class="bb-outer"><div class="bb-content"><div class="bb-inner">'+(dir==="next"?this.$nextItem.html():this.$current.html())+'</div></div><div class="bb-overlay"></div></div></div></div>').css("z-index",5);break}return $side},_startSlideshow:function(){var self=this;this.slideshow=setTimeout(function(){self._navigate("next");if(self.options.autoplay){self._startSlideshow()}},this.options.interval)},_stopSlideshow:function(){if(this.options.autoplay){clearTimeout(this.slideshow);this.options.autoplay=false}},// public method: flips next
next:function(){this._action(this.options.direction==="ltr"?"next":"prev")},// public method: flips back
prev:function(){this._action(this.options.direction==="ltr"?"prev":"next")},// public method: goes to a specific page
jump:function(page){page-=1;if(page===this.current||page>=this.itemsCount||page<0){return false}var dir;if(this.options.direction==="ltr"){dir=page>this.current?"next":"prev"}else{dir=page>this.current?"prev":"next"}this._action(dir,page)},// public method: goes to the last page
last:function(){this.jump(this.itemsCount)},// public method: goes to the first page
first:function(){this.jump(1)},// public method: check if isAnimating is true
isActive:function(){return this.isAnimating},// public method: dynamically adds new elements
// call this method after inserting new "bb-item" elements inside the BookBlock
update:function(){var $currentItem=this.$items.eq(this.current);this.$items=this.$el.children(".bb-item");this.itemsCount=this.$items.length;this.current=$currentItem.index()},destroy:function(){if(this.options.autoplay){this._stopSlideshow()}this.$el.removeClass("bb-"+this.options.orientation);this.$items.show();if(this.options.nextEl!==""){$(this.options.nextEl).off(".bookblock")}if(this.options.prevEl!==""){$(this.options.prevEl).off(".bookblock")}$window.off("debouncedresize")}};var logError=function(message){if(window.console){window.console.error(message)}};$.fn.bookblock=function(options){if(typeof options==="string"){var args=Array.prototype.slice.call(arguments,1);this.each(function(){var instance=$.data(this,"bookblock");if(!instance){logError("cannot call methods on bookblock prior to initialization; "+"attempted to call method '"+options+"'");return}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){logError("no such method '"+options+"' for bookblock instance");return}instance[options].apply(instance,args)})}else{this.each(function(){var instance=$.data(this,"bookblock");if(instance){instance._init()}else{instance=$.data(this,"bookblock",new $.BookBlock(options,this))}})}return this}})(jQuery,window);(function(root,factory){if(typeof define==="function"&&define.amd){// AMD. Register as an anonymous module.
define(["jquery"],factory)}else{// Browser globals
if(root.jQuery){// Use jQuery if available
factory(root.jQuery)}else{// Otherwise, use Zepto
factory(root.Zepto)}}})(this,function($,undefined){// Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge - Tweaked $.data(this,XYZ) to $(this).data(XYZ) for Zepto
$.fn.jPlayer=function(options){var name="jPlayer";var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;// allow multiple hashes to be passed on init
options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;// prevent calls to internal methods
if(isMethodCall&&options.charAt(0)==="_"){return returnValue}if(isMethodCall){this.each(function(){var instance=$(this).data(name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false}})}else{this.each(function(){var instance=$(this).data(name);if(instance){// instance.option( options || {} )._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface.
instance.option(options||{})}else{$(this).data(name,new $.jPlayer(options,this))}})}return returnValue};$.jPlayer=function(options,element){// allow instantiation without initializing for simple inheritance
if(arguments.length){this.element=$(element);this.options=$.extend(true,{},this.options,options);var self=this;this.element.bind("remove.jPlayer",function(){self.destroy()});this._init()}};// End of: (Adapted from jquery.ui.widget.js (1.8.7))
// Zepto is missing one of the animation methods.
if(typeof $.fn.stop!=="function"){$.fn.stop=function(){}}// Emulated HTML5 methods and properties
$.jPlayer.emulateMethods="load play pause";$.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";$.jPlayer.emulateOptions="muted volume";// Reserved event names generated by jPlayer that are not part of the HTML5 Media element spec
$.jPlayer.reservedEvent="ready flashreset resize repeat error warning";// Events generated by jPlayer
$.jPlayer.event={};$.each(["ready","flashreset",// Similar to the ready event if the Flash solution is set to display:none and then shown again or if it's reloaded for another reason by the browser. For example, using CSS position:fixed on Firefox for the full screen feature.
"resize",// Occurs when the size changes through a full/restore screen operation or if the size/sizeFull options are changed.
"repeat",// Occurs when the repeat status changes. Usually through clicks on the repeat button of the interface.
"click",// Occurs when the user clicks on one of the following: poster image, html video, flash video.
"error",// Event error code in event.jPlayer.error.type. See $.jPlayer.error
"warning",// Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning
// Other events match HTML5 spec.
"loadstart","progress","suspend","abort","emptied","stalled","play","pause","loadedmetadata","loadeddata","waiting","playing","canplay","canplaythrough","seeking","seeked","timeupdate","ended","ratechange","durationchange","volumechange"],function(){$.jPlayer.event[this]="jPlayer_"+this});$.jPlayer.htmlEvent=[// These HTML events are bubbled through to the jPlayer event, without any internal action.
"loadstart",// "progress", // jPlayer uses internally before bubbling.
// "suspend", // jPlayer uses internally before bubbling.
"abort",// "error", // jPlayer uses internally before bubbling.
"emptied","stalled",// "play", // jPlayer uses internally before bubbling.
// "pause", // jPlayer uses internally before bubbling.
"loadedmetadata","loadeddata",// "waiting", // jPlayer uses internally before bubbling.
// "playing", // jPlayer uses internally before bubbling.
"canplay","canplaythrough",// "seeking", // jPlayer uses internally before bubbling.
// "seeked", // jPlayer uses internally before bubbling.
// "timeupdate", // jPlayer uses internally before bubbling.
// "ended", // jPlayer uses internally before bubbling.
"ratechange"];$.jPlayer.pause=function(){$.each($.jPlayer.prototype.instances,function(i,element){if(element.data("jPlayer").status.srcSet){// Check that media is set otherwise would cause error event.
element.jPlayer("pause")}})};// Default for jPlayer option.timeFormat
$.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};var ConvertTime=function(){this.init()};ConvertTime.prototype={init:function(){this.options={timeFormat:$.jPlayer.timeFormat}},time:function(s){// function used on jPlayer.prototype._convertTime to enable per instance options.
s=s&&typeof s==="number"?s:0;var myTime=new Date(s*1e3),hour=myTime.getUTCHours(),min=this.options.timeFormat.showHour?myTime.getUTCMinutes():myTime.getUTCMinutes()+hour*60,sec=this.options.timeFormat.showMin?myTime.getUTCSeconds():myTime.getUTCSeconds()+min*60,strHour=this.options.timeFormat.padHour&&hour<10?"0"+hour:hour,strMin=this.options.timeFormat.padMin&&min<10?"0"+min:min,strSec=this.options.timeFormat.padSec&&sec<10?"0"+sec:sec,strTime="";strTime+=this.options.timeFormat.showHour?strHour+this.options.timeFormat.sepHour:"";strTime+=this.options.timeFormat.showMin?strMin+this.options.timeFormat.sepMin:"";strTime+=this.options.timeFormat.showSec?strSec+this.options.timeFormat.sepSec:"";return strTime}};var myConvertTime=new ConvertTime;$.jPlayer.convertTime=function(s){return myConvertTime.time(s)};// Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit.
$.jPlayer.uaBrowser=function(userAgent){var ua=userAgent.toLowerCase();// Useragent RegExp
var rwebkit=/(webkit)[ \/]([\w.]+)/;var ropera=/(opera)(?:.*version)?[ \/]([\w.]+)/;var rmsie=/(msie) ([\w.]+)/;var rmozilla=/(mozilla)(?:.*? rv:([\w.]+))?/;var match=rwebkit.exec(ua)||ropera.exec(ua)||rmsie.exec(ua)||ua.indexOf("compatible")<0&&rmozilla.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"}};// Platform sniffer for detecting mobile devices
$.jPlayer.uaPlatform=function(userAgent){var ua=userAgent.toLowerCase();// Useragent RegExp
var rplatform=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/;var rtablet=/(ipad|playbook)/;var randroid=/(android)/;var rmobile=/(mobile)/;var platform=rplatform.exec(ua)||[];var tablet=rtablet.exec(ua)||!rmobile.exec(ua)&&randroid.exec(ua)||[];if(platform[1]){platform[1]=platform[1].replace(/\s/g,"_")}return{platform:platform[1]||"",tablet:tablet[1]||""}};$.jPlayer.browser={};$.jPlayer.platform={};var browserMatch=$.jPlayer.uaBrowser(navigator.userAgent);if(browserMatch.browser){$.jPlayer.browser[browserMatch.browser]=true;$.jPlayer.browser.version=browserMatch.version}var platformMatch=$.jPlayer.uaPlatform(navigator.userAgent);if(platformMatch.platform){$.jPlayer.platform[platformMatch.platform]=true;$.jPlayer.platform.mobile=!platformMatch.tablet;$.jPlayer.platform.tablet=!!platformMatch.tablet}// Internet Explorer (IE) Browser Document Mode Sniffer. Based on code at:
// http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx#GetMode
$.jPlayer.getDocMode=function(){var docMode;if($.jPlayer.browser.msie){if(document.documentMode){// IE8 or later
docMode=document.documentMode}else{// IE 5-7
docMode=5;// Assume quirks mode unless proven otherwise
if(document.compatMode){if(document.compatMode==="CSS1Compat"){docMode=7}}}}return docMode};$.jPlayer.browser.documentMode=$.jPlayer.getDocMode();$.jPlayer.nativeFeatures={init:function(){/* Fullscreen function naming influenced by W3C naming.
			 * No support for: Mozilla Proposal: https://wiki.mozilla.org/Gecko:FullScreenAPI
			 */
var d=document,v=d.createElement("video"),spec={// http://www.w3.org/TR/fullscreen/
w3c:["fullscreenEnabled","fullscreenElement","requestFullscreen","exitFullscreen","fullscreenchange","fullscreenerror"],// https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode
moz:["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror"],// http://developer.apple.com/library/safari/#documentation/WebKit/Reference/ElementClassRef/Element/Element.html
// http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
webkit:["","webkitCurrentFullScreenElement","webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange",""],// http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html
webkitVideo:["webkitSupportsFullscreen","webkitDisplayingFullscreen","webkitEnterFullscreen","webkitExitFullscreen","",""]},specOrder=["w3c","moz","webkit","webkitVideo"],fs,i,il;this.fullscreen=fs={support:{w3c:!!d[spec.w3c[0]],moz:!!d[spec.moz[0]],webkit:typeof d[spec.webkit[3]]==="function",webkitVideo:typeof v[spec.webkitVideo[2]]==="function"},used:{}};// Store the name of the spec being used and as a handy boolean.
for(i=0,il=specOrder.length;i<il;i++){var n=specOrder[i];if(fs.support[n]){fs.spec=n;fs.used[n]=true;break}}if(fs.spec){var s=spec[fs.spec];fs.api={fullscreenEnabled:true,fullscreenElement:function(elem){elem=elem?elem:d;// Video element required for webkitVideo
return elem[s[1]]},requestFullscreen:function(elem){return elem[s[2]]()},exitFullscreen:function(elem){elem=elem?elem:d;// Video element required for webkitVideo
return elem[s[3]]()}};fs.event={fullscreenchange:s[4],fullscreenerror:s[5]}}else{fs.api={fullscreenEnabled:false,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}};fs.event={}}}};$.jPlayer.nativeFeatures.init();// The keyboard control system.
// The current jPlayer instance in focus.
$.jPlayer.focus=null;// The list of element node names to ignore with key controls.
$.jPlayer.keyIgnoreElementNames="INPUT TEXTAREA";// The function that deals with key presses.
var keyBindings=function(event){var f=$.jPlayer.focus,ignoreKey;// A jPlayer instance must be in focus. ie., keyEnabled and the last one played.
if(f){// What generated the key press?
$.each($.jPlayer.keyIgnoreElementNames.split(/\s+/g),function(i,name){// The strings should already be uppercase.
if(event.target.nodeName.toUpperCase()===name.toUpperCase()){ignoreKey=true;return false}});if(!ignoreKey){// See if the key pressed matches any of the bindings.
$.each(f.options.keyBindings,function(action,binding){// The binding could be a null when the default has been disabled. ie., 1st clause in if()
if(binding&&event.which===binding.key&&$.isFunction(binding.fn)){event.preventDefault();// Key being used by jPlayer, so prevent default operation.
binding.fn(f);return false}})}}};$.jPlayer.keys=function(en){var event="keydown.jPlayer";// Remove any binding, just in case enabled more than once.
$(document.documentElement).unbind(event);if(en){$(document.documentElement).bind(event,keyBindings)}};// Enable the global key control handler ready for any jPlayer instance with the keyEnabled option enabled.
$.jPlayer.keys(true);$.jPlayer.prototype={count:0,// Static Variable: Change it via prototype.
version:{// Static Object
script:"2.4.0",needFlash:"2.4.0",flash:"unknown"},options:{// Instanced in $.jPlayer() constructor
swfPath:"js",// Path to Jplayer.swf. Can be relative, absolute or server root relative.
solution:"html, flash",// Valid solutions: html, flash. Order defines priority. 1st is highest,
supplied:"mp3",// Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
preload:"metadata",// HTML5 Spec values: none, metadata, auto.
volume:.8,// The volume. Number 0 to 1.
muted:false,wmode:"opaque",// Valid wmode: window, transparent, opaque, direct, gpu. 
backgroundColor:"#000000",// To define the jPlayer div and Flash background color.
cssSelectorAncestor:"#jp_container_1",cssSelector:{// * denotes properties that should only be required when video media type required. _cssSelector() would require changes to enable splitting these into Audio and Video defaults.
videoPlay:".jp-video-play",// *
play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",// *
restoreScreen:".jp-restore-screen",// *
repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",// The interface used with autohide feature.
noSolution:".jp-no-solution"},smoothPlayBar:false,// Smooths the play bar transitions, which affects clicks and short media with big changes per second.
fullScreen:false,// Native Full Screen
fullWindow:false,autohide:{restored:false,// Controls the interface autohide feature.
full:true,// Controls the interface autohide feature.
fadeIn:200,// Milliseconds. The period of the fadeIn anim.
fadeOut:600,// Milliseconds. The period of the fadeOut anim.
hold:1e3},loop:false,repeat:function(event){// The default jPlayer repeat event handler
if(event.jPlayer.options.loop){$(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){$(this).jPlayer("play")})}else{$(this).unbind(".jPlayerRepeat")}},nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{},keyEnabled:false,// Enables keyboard controls.
audioFullScreen:false,// Enables keyboard controls to enter full screen with audio media.
keyBindings:{// The key control object, defining the key codes and the functions to execute.
// The parameter, f = $.jPlayer.focus, will be checked truethy before attempting to call any of these functions.
// Properties may be added to this object, in key/fn pairs, to enable other key controls. EG, for the playlist add-on.
play:{key:32,// space
fn:function(f){if(f.status.paused){f.play()}else{f.pause()}}},fullScreen:{key:13,// enter
fn:function(f){if(f.status.video||f.options.audioFullScreen){f._setOption("fullScreen",!f.options.fullScreen)}}},muted:{key:8,// backspace
fn:function(f){f._muted(!f.options.muted)}},volumeUp:{key:38,// UP
fn:function(f){f.volume(f.options.volume+.1)}},volumeDown:{key:40,// DOWN
fn:function(f){f.volume(f.options.volume-.1)}}},verticalVolume:false,// Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height.
// globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances
// globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances
idPrefix:"jp",// Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \
noConflict:"jQuery",emulateHtml:false,// Emulates the HTML5 Media element on the jPlayer element.
errorAlerts:false,warningAlerts:false},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},// Static Object
status:{// Instanced in _init()
src:"",media:{},paused:true,format:{},formatType:"",waitForPlay:true,// Same as waitForLoad except in case where preloading.
waitForLoad:true,srcSet:false,video:false,// True if playing a video
seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,videoWidth:0,// Intrinsic width of the video in pixels.
videoHeight:0,// Intrinsic height of the video in pixels.
readyState:0,networkState:0,playbackRate:1,ended:0},internal:{// Instanced in _init()
ready:false},solution:{// Static Object: Defines the solutions built in jPlayer.
html:true,flash:true},// 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"')
format:{// Static Object
mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:true,media:"audio"},m4a:{// AAC / MP4
codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:true,media:"audio"},oga:{// OGG
codec:'audio/ogg; codecs="vorbis"',flashCanPlay:false,media:"audio"},wav:{// PCM
codec:'audio/wav; codecs="1"',flashCanPlay:false,media:"audio"},webma:{// WEBM
codec:'audio/webm; codecs="vorbis"',flashCanPlay:false,media:"audio"},fla:{// FLV / F4A
codec:"audio/x-flv",flashCanPlay:true,media:"audio"},rtmpa:{// RTMP AUDIO
codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:true,media:"audio"},m4v:{// H.264 / MP4
codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:true,media:"video"},ogv:{// OGG
codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:false,media:"video"},webmv:{// WEBM
codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:false,media:"video"},flv:{// FLV / F4V
codec:"video/x-flv",flashCanPlay:true,media:"video"},rtmpv:{// RTMP VIDEO
codec:'video/rtmp; codecs="rtmp"',flashCanPlay:true,media:"video"}},_init:function(){var self=this;this.element.empty();this.status=$.extend({},this.status);// Copy static to unique instance.
this.internal=$.extend({},this.internal);// Copy static to unique instance.
// Initialize the time format
this.options.timeFormat=$.extend({},$.jPlayer.timeFormat,this.options.timeFormat);// On iOS, assume commands will be ignored before user initiates them.
this.internal.cmdsIgnored=$.jPlayer.platform.ipad||$.jPlayer.platform.iphone||$.jPlayer.platform.ipod;this.internal.domNode=this.element.get(0);// Add key bindings focus to 1st jPlayer instanced with key control enabled.
if(this.options.keyEnabled&&!$.jPlayer.focus){$.jPlayer.focus=this}this.formats=[];// Array based on supplied string option. Order defines priority.
this.solutions=[];// Array based on solution string option. Order defines priority.
this.require={};// Which media types are required: video, audio.
this.htmlElement={};// DOM elements created by jPlayer
this.html={};// In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
this.html.audio={};this.html.video={};this.flash={};// In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array.
this.css={};this.css.cs={};// Holds the css selector strings
this.css.jq={};// Holds jQuery selectors. ie., $(css.cs.method)
this.ancestorJq=[];// Holds jQuery selector of cssSelectorAncestor. Init would use $() instead of [], but it is only 1.4+
this.options.volume=this._limitValue(this.options.volume,0,1);// Limit volume value's bounds.
// Create the formats array, with prority based on the order of the supplied formats string
$.each(this.options.supplied.toLowerCase().split(","),function(index1,value1){var format=value1.replace(/^\s+|\s+$/g,"");//trim
if(self.format[format]){// Check format is valid.
var dupFound=false;$.each(self.formats,function(index2,value2){// Check for duplicates
if(format===value2){dupFound=true;return false}});if(!dupFound){self.formats.push(format)}}});// Create the solutions array, with prority based on the order of the solution string
$.each(this.options.solution.toLowerCase().split(","),function(index1,value1){var solution=value1.replace(/^\s+|\s+$/g,"");//trim
if(self.solution[solution]){// Check solution is valid.
var dupFound=false;$.each(self.solutions,function(index2,value2){// Check for duplicates
if(solution===value2){dupFound=true;return false}});if(!dupFound){self.solutions.push(solution)}}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;// Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms.
if(!this.element.attr("id")){this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count)}this.internal.self=$.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=$.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:undefined});this.internal.video=$.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:undefined});this.internal.flash=$.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:undefined,swf:this.options.swfPath+(this.options.swfPath.toLowerCase().slice(-4)!==".swf"?(this.options.swfPath&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf":"")});this.internal.poster=$.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:undefined});// Register listeners defined in the constructor
$.each($.jPlayer.event,function(eventName,eventType){if(self.options[eventName]!==undefined){self.element.bind(eventType+".jPlayer",self.options[eventName]);// With .jPlayer namespace.
self.options[eventName]=undefined}});// Determine if we require solutions for audio, video or both media types.
this.require.audio=false;this.require.video=false;$.each(this.formats,function(priority,format){self.require[self.format[format].media]=true});// Now required types are known, finish the options default settings.
if(this.require.video){this.options=$.extend(true,{},this.optionsVideo,this.options)}else{this.options=$.extend(true,{},this.optionsAudio,this.options)}this._setSize();// update status and jPlayer element size
// Determine the status for Blocklisted options.
this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this.status.noVolume=this._uaBlocklist(this.options.noVolume);// Create event handlers if native fullscreen is supported
if($.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled){this._fullscreenAddEventListeners()}// The native controls are only for video and are disabled when audio is also used.
this._restrictNativeVideoControls();// Create the poster image.
this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){// Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser.
if(!self.status.video||self.status.waitForPlay){self.internal.poster.jq.show()}};this.element.append(this.htmlElement.poster);this.internal.poster.jq=$("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){self._trigger($.jPlayer.event.click)});// Generate the required media elements
this.html.audio.available=false;if(this.require.audio){// If a supplied format is audio
this.htmlElement.audio=document.createElement("audio");this.htmlElement.audio.id=this.internal.audio.id;this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio)}this.html.video.available=false;if(this.require.video){// If a supplied format is video
this.htmlElement.video=document.createElement("video");this.htmlElement.video.id=this.internal.video.id;this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video)}this.flash.available=this._checkForFlash(10.1);this.html.canPlay={};this.flash.canPlay={};$.each(this.formats,function(priority,format){self.html.canPlay[format]=self.html[self.format[format].media].available&&""!==self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec);self.flash.canPlay[format]=self.format[format].flashCanPlay&&self.flash.available});this.html.desired=false;this.flash.desired=false;$.each(this.solutions,function(solutionPriority,solution){if(solutionPriority===0){self[solution].desired=true}else{var audioCanPlay=false;var videoCanPlay=false;$.each(self.formats,function(formatPriority,format){if(self[self.solutions[0]].canPlay[format]){// The other solution can play
if(self.format[format].media==="video"){videoCanPlay=true}else{audioCanPlay=true}}});self[solution].desired=self.require.audio&&!audioCanPlay||self.require.video&&!videoCanPlay}});// This is what jPlayer will support, based on solution and supplied.
this.html.support={};this.flash.support={};$.each(this.formats,function(priority,format){self.html.support[format]=self.html.canPlay[format]&&self.html.desired;self.flash.support[format]=self.flash.canPlay[format]&&self.flash.desired});// If jPlayer is supporting any format in a solution, then the solution is used.
this.html.used=false;this.flash.used=false;$.each(this.solutions,function(solutionPriority,solution){$.each(self.formats,function(formatPriority,format){if(self[solution].support[format]){self[solution].used=true;return false}})});// Init solution active state and the event gates to false.
this._resetActive();this._resetGate();// Set up the css selectors for the control and feedback entities.
this._cssSelectorAncestor(this.options.cssSelectorAncestor);// If neither html nor flash are being used by this browser, then media playback is not possible. Trigger an error event.
if(!(this.html.used||this.flash.used)){this._error({type:$.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:$.jPlayer.errorMsg.NO_SOLUTION,hint:$.jPlayer.errorHint.NO_SOLUTION});if(this.css.jq.noSolution.length){this.css.jq.noSolution.show()}}else{if(this.css.jq.noSolution.length){this.css.jq.noSolution.hide()}}// Add the flash solution if it is being used.
if(this.flash.used){var htmlObj,flashVars="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;// Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/
// Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event. 
if($.jPlayer.browser.msie&&(Number($.jPlayer.browser.version)<9||$.jPlayer.browser.documentMode<9)){var objStr='<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>';var paramStr=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+flashVars+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];htmlObj=document.createElement(objStr);for(var i=0;i<paramStr.length;i++){htmlObj.appendChild(document.createElement(paramStr[i]))}}else{var createParam=function(el,n,v){var p=document.createElement("param");p.setAttribute("name",n);p.setAttribute("value",v);el.appendChild(p)};htmlObj=document.createElement("object");htmlObj.setAttribute("id",this.internal.flash.id);htmlObj.setAttribute("name",this.internal.flash.id);htmlObj.setAttribute("data",this.internal.flash.swf);htmlObj.setAttribute("type","application/x-shockwave-flash");htmlObj.setAttribute("width","1");// Non-zero
htmlObj.setAttribute("height","1");// Non-zero
htmlObj.setAttribute("tabindex","-1");createParam(htmlObj,"flashvars",flashVars);createParam(htmlObj,"allowscriptaccess","always");createParam(htmlObj,"bgcolor",this.options.backgroundColor);createParam(htmlObj,"wmode",this.options.wmode)}this.element.append(htmlObj);this.internal.flash.jq=$(htmlObj)}// Add the HTML solution if being used.
if(this.html.used){// The HTML Audio handlers
if(this.html.audio.available){this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio);this.element.append(this.htmlElement.audio);this.internal.audio.jq=$("#"+this.internal.audio.id)}// The HTML Video handlers
if(this.html.video.available){this._addHtmlEventListeners(this.htmlElement.video,this.html.video);this.element.append(this.htmlElement.video);this.internal.video.jq=$("#"+this.internal.video.id);if(this.status.nativeVideoControls){this.internal.video.jq.css({width:this.status.width,height:this.status.height})}else{this.internal.video.jq.css({width:"0px",height:"0px"})}this.internal.video.jq.bind("click.jPlayer",function(){self._trigger($.jPlayer.event.click)})}}// Create the bridge that emulates the HTML Media element on the jPlayer DIV
if(this.options.emulateHtml){this._emulateHtmlBridge()}if(this.html.used&&!this.flash.used){// If only HTML, then emulate flash ready() call after 100ms.
setTimeout(function(){self.internal.ready=true;self.version.flash="n/a";self._trigger($.jPlayer.event.repeat);// Trigger the repeat event so its handler can initialize itself with the loop option.
self._trigger($.jPlayer.event.ready)},100)}// Initialize the interface components with the options.
this._updateNativeVideoControls();// The other controls are now setup in _cssSelectorAncestor()
if(this.css.jq.videoPlay.length){this.css.jq.videoPlay.hide()}$.jPlayer.prototype.count++},destroy:function(){// MJP: The background change remains. Would need to store the original to restore it correctly.
// MJP: The jPlayer element's size change remains.
// Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome)
this.clearMedia();// Remove the size/sizeFull cssClass from the cssSelectorAncestor
this._removeUiClass();// Remove the times from the GUI
if(this.css.jq.currentTime.length){this.css.jq.currentTime.text("")}if(this.css.jq.duration.length){this.css.jq.duration.text("")}// Remove any bindings from the interface controls.
$.each(this.css.jq,function(fn,jq){// Check selector is valid before trying to execute method.
if(jq.length){jq.unbind(".jPlayer")}});// Remove the click handlers for $.jPlayer.event.click
this.internal.poster.jq.unbind(".jPlayer");if(this.internal.video.jq){this.internal.video.jq.unbind(".jPlayer")}// Remove the fullscreen event handlers
this._fullscreenRemoveEventListeners();// Remove key bindings
if(this===$.jPlayer.focus){$.jPlayer.focus=null}// Destroy the HTML bridge.
if(this.options.emulateHtml){this._destroyHtmlBridge()}this.element.removeData("jPlayer");// Remove jPlayer data
this.element.unbind(".jPlayer");// Remove all event handlers created by the jPlayer constructor
this.element.empty();// Remove the inserted child elements
delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(elem){// IE9 on Win Server 2008 did not implement canPlayType(), but it has the property.
try{elem.canPlayType(this.format.mp3.codec);// The type is irrelevant.
return true}catch(err){return false}},_uaBlocklist:function(list){// list : object with properties that are all regular expressions. Property names are irrelevant.
// Returns true if the user agent is matched in list.
var ua=navigator.userAgent.toLowerCase(),block=false;$.each(list,function(p,re){if(re&&re.test(ua)){block=true;return false}});return block},_restrictNativeVideoControls:function(){// Fallback to noFullWindow when nativeVideoControls is true and audio media is being used. Affects when both media types are used.
if(this.require.audio){if(this.status.nativeVideoControls){this.status.nativeVideoControls=false;this.status.noFullWindow=true}}},_updateNativeVideoControls:function(){if(this.html.video.available&&this.html.used){// Turn the HTML Video controls on/off
this.htmlElement.video.controls=this.status.nativeVideoControls;// Show/hide the jPlayer GUI.
this._updateAutohide();// For when option changed. The poster image is not updated, as it is dealt with in setMedia(). Acceptable degradation since seriously doubt these options will change on the fly. Can again review later.
if(this.status.nativeVideoControls&&this.require.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}else if(this.status.waitForPlay&&this.status.video){this.internal.poster.jq.show();this.internal.video.jq.css({width:"0px",height:"0px"})}}},_addHtmlEventListeners:function(mediaElement,entity){var self=this;mediaElement.preload=this.options.preload;mediaElement.muted=this.options.muted;mediaElement.volume=this.options.volume;// Create the event listeners
// Only want the active entity to affect jPlayer and bubble events.
// Using entity.gate so that object is referenced and gate property always current
mediaElement.addEventListener("progress",function(){if(entity.gate){if(self.internal.cmdsIgnored&&this.readyState>0){// Detect iOS executed the command
self.internal.cmdsIgnored=false}self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.progress)}},false);mediaElement.addEventListener("timeupdate",function(){if(entity.gate){self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.timeupdate)}},false);mediaElement.addEventListener("durationchange",function(){if(entity.gate){self._getHtmlStatus(mediaElement);self._updateInterface();self._trigger($.jPlayer.event.durationchange)}},false);mediaElement.addEventListener("play",function(){if(entity.gate){self._updateButtons(true);self._html_checkWaitForPlay();// So the native controls update this variable and puts the hidden interface in the correct state. Affects toggling native controls.
self._trigger($.jPlayer.event.play)}},false);mediaElement.addEventListener("playing",function(){if(entity.gate){self._updateButtons(true);self._seeked();self._trigger($.jPlayer.event.playing)}},false);mediaElement.addEventListener("pause",function(){if(entity.gate){self._updateButtons(false);self._trigger($.jPlayer.event.pause)}},false);mediaElement.addEventListener("waiting",function(){if(entity.gate){self._seeking();self._trigger($.jPlayer.event.waiting)}},false);mediaElement.addEventListener("seeking",function(){if(entity.gate){self._seeking();self._trigger($.jPlayer.event.seeking)}},false);mediaElement.addEventListener("seeked",function(){if(entity.gate){self._seeked();self._trigger($.jPlayer.event.seeked)}},false);mediaElement.addEventListener("volumechange",function(){if(entity.gate){// Read the values back from the element as the Blackberry PlayBook shares the volume with the physical buttons master volume control.
// However, when tested 6th July 2011, those buttons do not generate an event. The physical play/pause button does though.
self.options.volume=mediaElement.volume;self.options.muted=mediaElement.muted;self._updateMute();self._updateVolume();self._trigger($.jPlayer.event.volumechange)}},false);mediaElement.addEventListener("suspend",function(){// Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture.
if(entity.gate){self._seeked();self._trigger($.jPlayer.event.suspend)}},false);mediaElement.addEventListener("ended",function(){if(entity.gate){// Order of the next few commands are important. Change the time and then pause.
// Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored.
if(!$.jPlayer.browser.webkit){// Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo.
self.htmlElement.media.currentTime=0}self.htmlElement.media.pause();// Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback.
self._updateButtons(false);self._getHtmlStatus(mediaElement,true);// With override true. Otherwise Chrome leaves progress at full.
self._updateInterface();self._trigger($.jPlayer.event.ended)}},false);mediaElement.addEventListener("error",function(){if(entity.gate){self._updateButtons(false);self._seeked();if(self.status.srcSet){// Deals with case of clearMedia() causing an error event.
clearTimeout(self.internal.htmlDlyCmdId);// Clears any delayed commands used in the HTML solution.
self.status.waitForLoad=true;// Allows the load operation to try again.
self.status.waitForPlay=true;// Reset since a play was captured.
if(self.status.video&&!self.status.nativeVideoControls){self.internal.video.jq.css({width:"0px",height:"0px"})}if(self._validString(self.status.media.poster)&&!self.status.nativeVideoControls){self.internal.poster.jq.show()}if(self.css.jq.videoPlay.length){self.css.jq.videoPlay.show()}self._error({type:$.jPlayer.error.URL,context:self.status.src,// this.src shows absolute urls. Want context to show the url given.
message:$.jPlayer.errorMsg.URL,hint:$.jPlayer.errorHint.URL})}}},false);// Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer.
$.each($.jPlayer.htmlEvent,function(i,eventType){mediaElement.addEventListener(this,function(){if(entity.gate){self._trigger($.jPlayer.event[eventType])}},false)})},_getHtmlStatus:function(media,override){var ct=0,cpa=0,sp=0,cpr=0;// Fixes the duration bug in iOS, where the durationchange event occurs when media.duration is not always correct.
// Fixes the initial duration bug in BB OS7, where the media.duration is infinity and displays as NaN:NaN due to Date() using inifity.
if(isFinite(media.duration)){this.status.duration=media.duration}ct=media.currentTime;cpa=this.status.duration>0?100*ct/this.status.duration:0;if(typeof media.seekable==="object"&&media.seekable.length>0){sp=this.status.duration>0?100*media.seekable.end(media.seekable.length-1)/this.status.duration:100;cpr=this.status.duration>0?100*media.currentTime/media.seekable.end(media.seekable.length-1):0}else{sp=100;cpr=cpa}if(override){ct=0;cpr=0;cpa=0}this.status.seekPercent=sp;this.status.currentPercentRelative=cpr;this.status.currentPercentAbsolute=cpa;this.status.currentTime=ct;this.status.videoWidth=media.videoWidth;this.status.videoHeight=media.videoHeight;this.status.readyState=media.readyState;this.status.networkState=media.networkState;this.status.playbackRate=media.playbackRate;this.status.ended=media.ended},_resetStatus:function(){this.status=$.extend({},this.status,$.jPlayer.prototype.status)},_trigger:function(eventType,error,warning){// eventType always valid as called using $.jPlayer.event.eventType
var event=$.Event(eventType);event.jPlayer={};event.jPlayer.version=$.extend({},this.version);event.jPlayer.options=$.extend(true,{},this.options);// Deep copy
event.jPlayer.status=$.extend(true,{},this.status);// Deep copy
event.jPlayer.html=$.extend(true,{},this.html);// Deep copy
event.jPlayer.flash=$.extend(true,{},this.flash);// Deep copy
if(error){event.jPlayer.error=$.extend({},error)}if(warning){event.jPlayer.warning=$.extend({},warning)}this.element.trigger(event)},jPlayerFlashEvent:function(eventType,status){// Called from Flash
if(eventType===$.jPlayer.event.ready){if(!this.internal.ready){this.internal.ready=true;this.internal.flash.jq.css({width:"0px",height:"0px"});// Once Flash generates the ready event, minimise to zero as it is not affected by wmode anymore.
this.version.flash=status.version;if(this.version.needFlash!==this.version.flash){this._error({type:$.jPlayer.error.VERSION,context:this.version.flash,message:$.jPlayer.errorMsg.VERSION+this.version.flash,hint:$.jPlayer.errorHint.VERSION})}this._trigger($.jPlayer.event.repeat);// Trigger the repeat event so its handler can initialize itself with the loop option.
this._trigger(eventType)}else{// This condition occurs if the Flash is hidden and then shown again.
// Firefox also reloads the Flash if the CSS position changes. position:fixed is used for full screen.
// Only do this if the Flash is the solution being used at the moment. Affects Media players where both solution may be being used.
if(this.flash.gate){// Send the current status to the Flash now that it is ready (available) again.
if(this.status.srcSet){// Need to read original status before issuing the setMedia command.
var currentTime=this.status.currentTime,paused=this.status.paused;this.setMedia(this.status.media);if(currentTime>0){if(paused){this.pause(currentTime)}else{this.play(currentTime)}}}this._trigger($.jPlayer.event.flashreset)}}}if(this.flash.gate){switch(eventType){case $.jPlayer.event.progress:this._getFlashStatus(status);this._updateInterface();this._trigger(eventType);break;case $.jPlayer.event.timeupdate:this._getFlashStatus(status);this._updateInterface();this._trigger(eventType);break;case $.jPlayer.event.play:this._seeked();this._updateButtons(true);this._trigger(eventType);break;case $.jPlayer.event.pause:this._updateButtons(false);this._trigger(eventType);break;case $.jPlayer.event.ended:this._updateButtons(false);this._trigger(eventType);break;case $.jPlayer.event.click:this._trigger(eventType);// This could be dealt with by the default
break;case $.jPlayer.event.error:this.status.waitForLoad=true;// Allows the load operation to try again.
this.status.waitForPlay=true;// Reset since a play was captured.
if(this.status.video){this.internal.flash.jq.css({width:"0px",height:"0px"})}if(this._validString(this.status.media.poster)){this.internal.poster.jq.show()}if(this.css.jq.videoPlay.length&&this.status.video){this.css.jq.videoPlay.show()}if(this.status.video){// Set up for another try. Execute before error event.
this._flash_setVideo(this.status.media)}else{this._flash_setAudio(this.status.media)}this._updateButtons(false);this._error({type:$.jPlayer.error.URL,context:status.src,message:$.jPlayer.errorMsg.URL,hint:$.jPlayer.errorHint.URL});break;case $.jPlayer.event.seeking:this._seeking();this._trigger(eventType);break;case $.jPlayer.event.seeked:this._seeked();this._trigger(eventType);break;case $.jPlayer.event.ready:// The ready event is handled outside the switch statement.
// Captured here otherwise 2 ready events would be generated if the ready event handler used setMedia.
break;default:this._trigger(eventType)}}return false},_getFlashStatus:function(status){this.status.seekPercent=status.seekPercent;this.status.currentPercentRelative=status.currentPercentRelative;this.status.currentPercentAbsolute=status.currentPercentAbsolute;this.status.currentTime=status.currentTime;this.status.duration=status.duration;this.status.videoWidth=status.videoWidth;this.status.videoHeight=status.videoHeight;// The Flash does not generate this information in this release
this.status.readyState=4;// status.readyState;
this.status.networkState=0;// status.networkState;
this.status.playbackRate=1;// status.playbackRate;
this.status.ended=false},_updateButtons:function(playing){if(playing===undefined){playing=!this.status.paused}else{this.status.paused=!playing}if(this.css.jq.play.length&&this.css.jq.pause.length){if(playing){this.css.jq.play.hide();this.css.jq.pause.show()}else{this.css.jq.play.show();this.css.jq.pause.hide()}}if(this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length){if(this.status.noFullWindow){this.css.jq.fullScreen.hide();this.css.jq.restoreScreen.hide()}else if(this.options.fullWindow){this.css.jq.fullScreen.hide();this.css.jq.restoreScreen.show()}else{this.css.jq.fullScreen.show();this.css.jq.restoreScreen.hide()}}if(this.css.jq.repeat.length&&this.css.jq.repeatOff.length){if(this.options.loop){this.css.jq.repeat.hide();this.css.jq.repeatOff.show()}else{this.css.jq.repeat.show();this.css.jq.repeatOff.hide()}}},_updateInterface:function(){if(this.css.jq.seekBar.length){this.css.jq.seekBar.width(this.status.seekPercent+"%")}if(this.css.jq.playBar.length){if(this.options.smoothPlayBar){this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+"%"},250,"linear")}else{this.css.jq.playBar.width(this.status.currentPercentRelative+"%")}}if(this.css.jq.currentTime.length){this.css.jq.currentTime.text(this._convertTime(this.status.currentTime))}if(this.css.jq.duration.length){this.css.jq.duration.text(this._convertTime(this.status.duration))}},_convertTime:ConvertTime.prototype.time,_seeking:function(){if(this.css.jq.seekBar.length){this.css.jq.seekBar.addClass("jp-seeking-bg")}},_seeked:function(){if(this.css.jq.seekBar.length){this.css.jq.seekBar.removeClass("jp-seeking-bg")}},_resetGate:function(){this.html.audio.gate=false;this.html.video.gate=false;this.flash.gate=false},_resetActive:function(){this.html.active=false;this.flash.active=false},setMedia:function(media){/*	media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats.
			 *	media.poster = String: Video poster URL.
			 *	media.subtitles = String: * NOT IMPLEMENTED * URL of subtitles SRT file
			 *	media.chapters = String: * NOT IMPLEMENTED * URL of chapters SRT file
			 *	media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often.
			 */
var self=this,supported=false,posterChanged=this.status.media.poster!==media.poster;// Compare before reset. Important for OSX Safari as this.htmlElement.poster.src is absolute, even if original poster URL was relative.
this._resetMedia();this._resetGate();this._resetActive();$.each(this.formats,function(formatPriority,format){var isVideo=self.format[format].media==="video";$.each(self.solutions,function(solutionPriority,solution){if(self[solution].support[format]&&self._validString(media[format])){// Format supported in solution and url given for format.
var isHtml=solution==="html";if(isVideo){if(isHtml){self.html.video.gate=true;self._html_setVideo(media);self.html.active=true}else{self.flash.gate=true;self._flash_setVideo(media);self.flash.active=true}if(self.css.jq.videoPlay.length){self.css.jq.videoPlay.show()}self.status.video=true}else{if(isHtml){self.html.audio.gate=true;self._html_setAudio(media);self.html.active=true}else{self.flash.gate=true;self._flash_setAudio(media);self.flash.active=true}if(self.css.jq.videoPlay.length){self.css.jq.videoPlay.hide()}self.status.video=false}supported=true;return false}});if(supported){return false}});if(supported){if(!(this.status.nativeVideoControls&&this.html.video.gate)){// Set poster IMG if native video controls are not being used
// Note: With IE the IMG onload event occurs immediately when cached.
// Note: Poster hidden by default in _resetMedia()
if(this._validString(media.poster)){if(posterChanged){// Since some browsers do not generate img onload event.
this.htmlElement.poster.src=media.poster}else{this.internal.poster.jq.show()}}}this.status.srcSet=true;this.status.media=$.extend({},media);this._updateButtons(false);this._updateInterface()}else{// jPlayer cannot support any formats provided in this browser
// Send an error event
this._error({type:$.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:$.jPlayer.errorMsg.NO_SUPPORT,hint:$.jPlayer.errorHint.NO_SUPPORT})}},_resetMedia:function(){this._resetStatus();this._updateButtons(false);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);if(this.html.active){this._html_resetMedia()}else if(this.flash.active){this._flash_resetMedia()}},clearMedia:function(){this._resetMedia();if(this.html.active){this._html_clearMedia()}else if(this.flash.active){this._flash_clearMedia()}this._resetGate();this._resetActive()},load:function(){if(this.status.srcSet){if(this.html.active){this._html_load()}else if(this.flash.active){this._flash_load()}}else{this._urlNotSetError("load")}},focus:function(){if(this.options.keyEnabled){$.jPlayer.focus=this}},play:function(time){time=typeof time==="number"?time:NaN;// Remove jQuery event from click handler
if(this.status.srcSet){this.focus();if(this.html.active){this._html_play(time)}else if(this.flash.active){this._flash_play(time)}}else{this._urlNotSetError("play")}},videoPlay:function(){// Handles clicks on the play button over the video poster
this.play()},pause:function(time){time=typeof time==="number"?time:NaN;// Remove jQuery event from click handler
if(this.status.srcSet){if(this.html.active){this._html_pause(time)}else if(this.flash.active){this._flash_pause(time)}}else{this._urlNotSetError("pause")}},pauseOthers:function(){var self=this;$.each(this.instances,function(i,element){if(self.element!==element){// Do not this instance.
if(element.data("jPlayer").status.srcSet){// Check that media is set otherwise would cause error event.
element.jPlayer("pause")}}})},stop:function(){if(this.status.srcSet){if(this.html.active){this._html_pause(0)}else if(this.flash.active){this._flash_pause(0)}}else{this._urlNotSetError("stop")}},playHead:function(p){p=this._limitValue(p,0,100);if(this.status.srcSet){if(this.html.active){this._html_playHead(p)}else if(this.flash.active){this._flash_playHead(p)}}else{this._urlNotSetError("playHead")}},_muted:function(muted){this.options.muted=muted;if(this.html.used){this._html_mute(muted)}if(this.flash.used){this._flash_mute(muted)}// The HTML solution generates this event from the media element itself.
if(!this.html.video.gate&&!this.html.audio.gate){this._updateMute(muted);this._updateVolume(this.options.volume);this._trigger($.jPlayer.event.volumechange)}},mute:function(mute){// mute is either: undefined (true), an event object (true) or a boolean (muted).
mute=mute===undefined?true:!!mute;this._muted(mute)},unmute:function(unmute){// unmute is either: undefined (true), an event object (true) or a boolean (!muted).
unmute=unmute===undefined?true:!!unmute;this._muted(!unmute)},_updateMute:function(mute){if(mute===undefined){mute=this.options.muted}if(this.css.jq.mute.length&&this.css.jq.unmute.length){if(this.status.noVolume){this.css.jq.mute.hide();this.css.jq.unmute.hide()}else if(mute){this.css.jq.mute.hide();this.css.jq.unmute.show()}else{this.css.jq.mute.show();this.css.jq.unmute.hide()}}},volume:function(v){v=this._limitValue(v,0,1);this.options.volume=v;if(this.html.used){this._html_volume(v)}if(this.flash.used){this._flash_volume(v)}// The HTML solution generates this event from the media element itself.
if(!this.html.video.gate&&!this.html.audio.gate){this._updateVolume(v);this._trigger($.jPlayer.event.volumechange)}},volumeBar:function(e){// Handles clicks on the volumeBar
if(this.css.jq.volumeBar.length){// Using $(e.currentTarget) to enable multiple volume bars
var $bar=$(e.currentTarget),offset=$bar.offset(),x=e.pageX-offset.left,w=$bar.width(),y=$bar.height()-e.pageY+offset.top,h=$bar.height();if(this.options.verticalVolume){this.volume(y/h)}else{this.volume(x/w)}}if(this.options.muted){this._muted(false)}},volumeBarValue:function(){},_updateVolume:function(v){if(v===undefined){v=this.options.volume}v=this.options.muted?0:v;if(this.status.noVolume){if(this.css.jq.volumeBar.length){this.css.jq.volumeBar.hide()}if(this.css.jq.volumeBarValue.length){this.css.jq.volumeBarValue.hide()}if(this.css.jq.volumeMax.length){this.css.jq.volumeMax.hide()}}else{if(this.css.jq.volumeBar.length){this.css.jq.volumeBar.show()}if(this.css.jq.volumeBarValue.length){this.css.jq.volumeBarValue.show();this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](v*100+"%")}if(this.css.jq.volumeMax.length){this.css.jq.volumeMax.show()}}},volumeMax:function(){// Handles clicks on the volume max
this.volume(1);if(this.options.muted){this._muted(false)}},_cssSelectorAncestor:function(ancestor){var self=this;this.options.cssSelectorAncestor=ancestor;this._removeUiClass();this.ancestorJq=ancestor?$(ancestor):[];// Would use $() instead of [], but it is only 1.4+
if(ancestor&&this.ancestorJq.length!==1){// So empty strings do not generate the warning.
this._warning({type:$.jPlayer.warning.CSS_SELECTOR_COUNT,context:ancestor,message:$.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:$.jPlayer.warningHint.CSS_SELECTOR_COUNT})}this._addUiClass();$.each(this.options.cssSelector,function(fn,cssSel){self._cssSelector(fn,cssSel)});// Set the GUI to the current state.
this._updateInterface();this._updateButtons();this._updateAutohide();this._updateVolume();this._updateMute()},_cssSelector:function(fn,cssSel){var self=this;if(typeof cssSel==="string"){if($.jPlayer.prototype.options.cssSelector[fn]){if(this.css.jq[fn]&&this.css.jq[fn].length){this.css.jq[fn].unbind(".jPlayer")}this.options.cssSelector[fn]=cssSel;this.css.cs[fn]=this.options.cssSelectorAncestor+" "+cssSel;if(cssSel){// Checks for empty string
this.css.jq[fn]=$(this.css.cs[fn])}else{this.css.jq[fn]=[]}if(this.css.jq[fn].length){var handler=function(e){e.preventDefault();self[fn](e);$(this).blur()};this.css.jq[fn].bind("click.jPlayer",handler)}if(cssSel&&this.css.jq[fn].length!==1){// So empty strings do not generate the warning. ie., they just remove the old one.
this._warning({type:$.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[fn],message:$.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[fn].length+" found for "+fn+" method.",hint:$.jPlayer.warningHint.CSS_SELECTOR_COUNT})}}else{this._warning({type:$.jPlayer.warning.CSS_SELECTOR_METHOD,context:fn,message:$.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:$.jPlayer.warningHint.CSS_SELECTOR_METHOD})}}else{this._warning({type:$.jPlayer.warning.CSS_SELECTOR_STRING,context:cssSel,message:$.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:$.jPlayer.warningHint.CSS_SELECTOR_STRING})}},seekBar:function(e){// Handles clicks on the seekBar
if(this.css.jq.seekBar.length){// Using $(e.currentTarget) to enable multiple seek bars
var $bar=$(e.currentTarget),offset=$bar.offset(),x=e.pageX-offset.left,w=$bar.width(),p=100*x/w;this.playHead(p)}},playBar:function(){},repeat:function(){// Handle clicks on the repeat button
this._loop(true)},repeatOff:function(){// Handle clicks on the repeatOff button
this._loop(false)},_loop:function(loop){if(this.options.loop!==loop){this.options.loop=loop;this._updateButtons();this._trigger($.jPlayer.event.repeat)}},// Plan to review the cssSelector method to cope with missing associated functions accordingly.
currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},// Options code adapted from ui.widget.js (1.8.7).  Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1.
option:function(key,value){var options=key;// Enables use: options().  Returns a copy of options object
if(arguments.length===0){return $.extend(true,{},this.options)}if(typeof key==="string"){var keys=key.split(".");// Enables use: options("someOption")  Returns a copy of the option. Supports dot notation.
if(value===undefined){var opt=$.extend(true,{},this.options);for(var i=0;i<keys.length;i++){if(opt[keys[i]]!==undefined){opt=opt[keys[i]]}else{this._warning({type:$.jPlayer.warning.OPTION_KEY,context:key,message:$.jPlayer.warningMsg.OPTION_KEY,hint:$.jPlayer.warningHint.OPTION_KEY});return undefined}}return opt}// Enables use: options("someOptionObject", someObject}).  Creates: {someOptionObject:someObject}
// Enables use: options("someOption", someValue).  Creates: {someOption:someValue}
// Enables use: options("someOptionObject.someOption", someValue).  Creates: {someOptionObject:{someOption:someValue}}
options={};var opts=options;for(var j=0;j<keys.length;j++){if(j<keys.length-1){opts[keys[j]]={};opts=opts[keys[j]]}else{opts[keys[j]]=value}}}// Otherwise enables use: options(optionObject).  Uses original object (the key)
this._setOptions(options);return this},_setOptions:function(options){var self=this;$.each(options,function(key,value){// This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth.
self._setOption(key,value)});return this},_setOption:function(key,value){var self=this;// The ability to set options is limited at this time.
switch(key){case"volume":this.volume(value);break;case"muted":this._muted(value);break;case"cssSelectorAncestor":this._cssSelectorAncestor(value);// Set and refresh all associations for the new ancestor.
break;case"cssSelector":$.each(value,function(fn,cssSel){self._cssSelector(fn,cssSel)});break;case"fullScreen":if(this.options[key]!==value){// if changed
var wkv=$.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;if(!wkv||wkv&&!this.status.waitForPlay){if(!wkv){// No sensible way to unset option on these devices.
this.options[key]=value}if(value){this._requestFullscreen()}else{this._exitFullscreen()}if(!wkv){this._setOption("fullWindow",value)}}}break;case"fullWindow":if(this.options[key]!==value){// if changed
this._removeUiClass();this.options[key]=value;this._refreshSize()}break;case"size":if(!this.options.fullWindow&&this.options[key].cssClass!==value.cssClass){this._removeUiClass()}this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this._refreshSize();break;case"sizeFull":if(this.options.fullWindow&&this.options[key].cssClass!==value.cssClass){this._removeUiClass()}this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this._refreshSize();break;case"autohide":this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this._updateAutohide();break;case"loop":this._loop(value);break;case"nativeVideoControls":this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case"noFullWindow":this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);// Need to check again as noFullWindow can depend on this flag and the restrict() can override it.
this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this._restrictNativeVideoControls();this._updateButtons();break;case"noVolume":this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case"emulateHtml":if(this.options[key]!==value){// To avoid multiple event handlers being created, if true already.
this.options[key]=value;if(value){this._emulateHtmlBridge()}else{this._destroyHtmlBridge()}}break;case"timeFormat":this.options[key]=$.extend({},this.options[key],value);// store a merged copy of it, incase not all properties changed.
break;case"keyEnabled":this.options[key]=value;if(!value&&this===$.jPlayer.focus){$.jPlayer.focus=null}break;case"keyBindings":this.options[key]=$.extend(true,{},this.options[key],value);// store a merged DEEP copy of it, incase not all properties changed.
break;case"audioFullScreen":this.options[key]=value;break}return this},// End of: (Options code adapted from ui.widget.js)
_refreshSize:function(){this._setSize();// update status and jPlayer element size
this._addUiClass();// update the ui class
this._updateSize();// update internal sizes
this._updateButtons();this._updateAutohide();this._trigger($.jPlayer.event.resize)},_setSize:function(){// Determine the current size from the options
if(this.options.fullWindow){this.status.width=this.options.sizeFull.width;this.status.height=this.options.sizeFull.height;this.status.cssClass=this.options.sizeFull.cssClass}else{this.status.width=this.options.size.width;this.status.height=this.options.size.height;this.status.cssClass=this.options.size.cssClass}// Set the size of the jPlayer area.
this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){if(this.ancestorJq.length){this.ancestorJq.addClass(this.status.cssClass)}},_removeUiClass:function(){if(this.ancestorJq.length){this.ancestorJq.removeClass(this.status.cssClass)}},_updateSize:function(){// The poster uses show/hide so can simply resize it.
this.internal.poster.jq.css({width:this.status.width,height:this.status.height});// Video html or flash resized if necessary at this time, or if native video controls being used.
if(!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls){this.internal.video.jq.css({width:this.status.width,height:this.status.height})}else if(!this.status.waitForPlay&&this.flash.active&&this.status.video){this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}},_updateAutohide:function(){var self=this,event="mousemove.jPlayer",namespace=".jPlayerAutohide",eventType=event+namespace,handler=function(){self.css.jq.gui.fadeIn(self.options.autohide.fadeIn,function(){clearTimeout(self.internal.autohideId);self.internal.autohideId=setTimeout(function(){self.css.jq.gui.fadeOut(self.options.autohide.fadeOut)},self.options.autohide.hold)})};if(this.css.jq.gui.length){// End animations first so that its callback is executed now.
// Otherwise an in progress fadeIn animation still has the callback to fadeOut again.
this.css.jq.gui.stop(true,true);// Removes the fadeOut operation from the fadeIn callback.
clearTimeout(this.internal.autohideId);this.element.unbind(namespace);this.css.jq.gui.unbind(namespace);if(!this.status.nativeVideoControls){if(this.options.fullWindow&&this.options.autohide.full||!this.options.fullWindow&&this.options.autohide.restored){this.element.bind(eventType,handler);this.css.jq.gui.bind(eventType,handler);this.css.jq.gui.hide()}else{this.css.jq.gui.show()}}else{this.css.jq.gui.hide()}}},fullScreen:function(){this._setOption("fullScreen",true)},restoreScreen:function(){this._setOption("fullScreen",false)},_fullscreenAddEventListeners:function(){var self=this,fs=$.jPlayer.nativeFeatures.fullscreen;if(fs.api.fullscreenEnabled){if(fs.event.fullscreenchange){// Create the event handler function and store it for removal.
if(typeof this.internal.fullscreenchangeHandler!=="function"){this.internal.fullscreenchangeHandler=function(){self._fullscreenchange()}}document.addEventListener(fs.event.fullscreenchange,this.internal.fullscreenchangeHandler,false)}}},_fullscreenRemoveEventListeners:function(){var fs=$.jPlayer.nativeFeatures.fullscreen;if(this.internal.fullscreenchangeHandler){document.addEventListener(fs.event.fullscreenchange,this.internal.fullscreenchangeHandler,false)}},_fullscreenchange:function(){// If nothing is fullscreen, then we cannot be in fullscreen mode.
if(this.options.fullScreen&&!$.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()){this._setOption("fullScreen",false)}},_requestFullscreen:function(){// Either the container or the jPlayer div
var e=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],fs=$.jPlayer.nativeFeatures.fullscreen;// This method needs the video element. For iOS and Android.
if(fs.used.webkitVideo){e=this.htmlElement.video}if(fs.api.fullscreenEnabled){fs.api.requestFullscreen(e)}},_exitFullscreen:function(){var fs=$.jPlayer.nativeFeatures.fullscreen,e;// This method needs the video element. For iOS and Android.
if(fs.used.webkitVideo){e=this.htmlElement.video}if(fs.api.fullscreenEnabled){fs.api.exitFullscreen(e)}},_html_initMedia:function(media){// Remove any existing track elements
var $media=$(this.htmlElement.media).empty();// Create any track elements given with the media, as an Array of track Objects.
$.each(media.track||[],function(i,v){var track=document.createElement("track");track.setAttribute("kind",v.kind?v.kind:"");track.setAttribute("src",v.src?v.src:"");track.setAttribute("srclang",v.srclang?v.srclang:"");track.setAttribute("label",v.label?v.label:"");if(v.def){track.setAttribute("default",v.def)}$media.append(track)});this.htmlElement.media.src=this.status.src;if(this.options.preload!=="none"){this._html_load()}this._trigger($.jPlayer.event.timeupdate)},_html_setFormat:function(media){var self=this;// Always finds a format due to checks in setMedia()
$.each(this.formats,function(priority,format){if(self.html.support[format]&&media[format]){self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}})},_html_setAudio:function(media){this._html_setFormat(media);this.htmlElement.media=this.htmlElement.audio;this._html_initMedia(media)},_html_setVideo:function(media){this._html_setFormat(media);if(this.status.nativeVideoControls){this.htmlElement.video.poster=this._validString(media.poster)?media.poster:""}this.htmlElement.media=this.htmlElement.video;this._html_initMedia(media)},_html_resetMedia:function(){if(this.htmlElement.media){if(this.htmlElement.media.id===this.internal.video.id&&!this.status.nativeVideoControls){this.internal.video.jq.css({width:"0px",height:"0px"})}this.htmlElement.media.pause()}},_html_clearMedia:function(){if(this.htmlElement.media){this.htmlElement.media.src="about:blank";// The following load() is only required for Firefox 3.6 (PowerMacs).
// Recent HTMl5 browsers only require the src change. Due to changes in W3C spec and load() effect.
this.htmlElement.media.load()}},_html_load:function(){// This function remains to allow the early HTML5 browsers to work, such as Firefox 3.6
// A change in the W3C spec for the media.load() command means that this is no longer necessary.
// This command should be removed and actually causes minor undesirable effects on some browsers. Such as loading the whole file and not only the metadata.
setTimeout(function(){if(this.status.waitForLoad){this.status.waitForLoad=false;try{this.htmlElement.media.load()}catch(e){var isAndroid=/Android/i.test(navigator.userAgent);if(!(e.code==DOMException.INVALID_STATE_ERR&&isAndroid)){throw e}}}},100);clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(time){var self=this,media=this.htmlElement.media;this._html_load();// Loads if required and clears any delayed commands.
if(!isNaN(time)){// Attempt to play it, since iOS has been ignoring commands
if(this.internal.cmdsIgnored){media.play()}try{// !media.seekable is for old HTML5 browsers, like Firefox 3.6.
// Checking seekable.length is important for iOS6 to work with setMedia().play(time)
if(!media.seekable||typeof media.seekable==="object"&&media.seekable.length>0){media.currentTime=time;media.play()}else{throw 1}}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.play(time)},250);return}}else{media.play()}this._html_checkWaitForPlay()},_html_pause:function(time){var self=this,media=this.htmlElement.media;if(time>0){// We do not want the stop() command, which does pause(0), causing a load operation.
this._html_load()}else{clearTimeout(this.internal.htmlDlyCmdId)}// Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime.
media.pause();if(!isNaN(time)){try{if(!media.seekable||typeof media.seekable==="object"&&media.seekable.length>0){media.currentTime=time}else{throw 1}}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.pause(time)},250);return}}if(time>0){// Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
this._html_checkWaitForPlay()}},_html_playHead:function(percent){var self=this,media=this.htmlElement.media;this._html_load();// Loads if required and clears any delayed commands.
try{if(typeof media.seekable==="object"&&media.seekable.length>0){media.currentTime=percent*media.seekable.end(media.seekable.length-1)/100}else if(media.duration>0&&!isNaN(media.duration)){media.currentTime=percent*media.duration/100}else{throw"e"}}catch(err){this.internal.htmlDlyCmdId=setTimeout(function(){self.playHead(percent)},250);return}if(!this.status.waitForLoad){this._html_checkWaitForPlay()}},_html_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;if(this.css.jq.videoPlay.length){this.css.jq.videoPlay.hide()}if(this.status.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}}},_html_volume:function(v){if(this.html.audio.available){this.htmlElement.audio.volume=v}if(this.html.video.available){this.htmlElement.video.volume=v}},_html_mute:function(m){if(this.html.audio.available){this.htmlElement.audio.muted=m}if(this.html.video.available){this.htmlElement.video.muted=m}},_flash_setAudio:function(media){var self=this;try{// Always finds a format due to checks in setMedia()
$.each(this.formats,function(priority,format){if(self.flash.support[format]&&media[format]){switch(format){case"m4a":case"fla":self._getMovie().fl_setAudio_m4a(media[format]);break;case"mp3":self._getMovie().fl_setAudio_mp3(media[format]);break;case"rtmpa":self._getMovie().fl_setAudio_rtmp(media[format]);break}self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(err){this._flashError(err)}},_flash_setVideo:function(media){var self=this;try{// Always finds a format due to checks in setMedia()
$.each(this.formats,function(priority,format){if(self.flash.support[format]&&media[format]){switch(format){case"m4v":case"flv":self._getMovie().fl_setVideo_m4v(media[format]);break;case"rtmpv":self._getMovie().fl_setVideo_rtmp(media[format]);break}self.status.src=media[format];self.status.format[format]=true;self.status.formatType=format;return false}});if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(err){this._flashError(err)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"});// Must do via CSS as setting attr() to zero causes a jQuery error in IE.
this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(err){this._flashError(err)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(err){this._flashError(err)}this.status.waitForLoad=false},_flash_play:function(time){try{this._getMovie().fl_play(time)}catch(err){this._flashError(err)}this.status.waitForLoad=false;this._flash_checkWaitForPlay()},_flash_pause:function(time){try{this._getMovie().fl_pause(time)}catch(err){this._flashError(err)}if(time>0){// Avoids a setMedia() followed by stop() or pause(0) hiding the video play button.
this.status.waitForLoad=false;this._flash_checkWaitForPlay()}},_flash_playHead:function(p){try{this._getMovie().fl_play_head(p)}catch(err){this._flashError(err)}if(!this.status.waitForLoad){this._flash_checkWaitForPlay()}},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;if(this.css.jq.videoPlay.length){this.css.jq.videoPlay.hide()}if(this.status.video){this.internal.poster.jq.hide();this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}}},_flash_volume:function(v){try{this._getMovie().fl_volume(v)}catch(err){this._flashError(err)}},_flash_mute:function(m){try{this._getMovie().fl_mute(m)}catch(err){this._flashError(err)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){// _getFlashPluginVersion() code influenced by:
// - FlashReplace 1.01: http://code.google.com/p/flashreplace/
// - SWFObject 2.2: http://code.google.com/p/swfobject/
var version=0,flash;if(window.ActiveXObject){try{flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(flash){// flash will return null when ActiveX is disabled
var v=flash.GetVariable("$version");if(v){v=v.split(" ")[1].split(",");version=parseInt(v[0],10)+"."+parseInt(v[1],10)}}}catch(e){}}else if(navigator.plugins&&navigator.mimeTypes.length>0){flash=navigator.plugins["Shockwave Flash"];if(flash){version=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")}}return version*1},_checkForFlash:function(version){var flashOk=false;if(this._getFlashPluginVersion()>=version){flashOk=true}return flashOk},_validString:function(url){return url&&typeof url==="string"},_limitValue:function(value,min,max){return value<min?min:value>max?max:value},_urlNotSetError:function(context){this._error({type:$.jPlayer.error.URL_NOT_SET,context:context,message:$.jPlayer.errorMsg.URL_NOT_SET,hint:$.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(error){var errorType;if(!this.internal.ready){errorType="FLASH"}else{errorType="FLASH_DISABLED"}this._error({type:$.jPlayer.error[errorType],context:this.internal.flash.swf,message:$.jPlayer.errorMsg[errorType]+error.message,hint:$.jPlayer.errorHint[errorType]});// Allow the audio player to recover if display:none and then shown again, or with position:fixed on Firefox.
// This really only affects audio in a media player, as an audio player could easily move the jPlayer element away from such issues.
this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(error){this._trigger($.jPlayer.event.error,error);if(this.options.errorAlerts){this._alert("Error!"+(error.message?"\n\n"+error.message:"")+(error.hint?"\n\n"+error.hint:"")+"\n\nContext: "+error.context)}},_warning:function(warning){this._trigger($.jPlayer.event.warning,undefined,warning);if(this.options.warningAlerts){this._alert("Warning!"+(warning.message?"\n\n"+warning.message:"")+(warning.hint?"\n\n"+warning.hint:"")+"\n\nContext: "+warning.context)}},_alert:function(message){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+message)},_emulateHtmlBridge:function(){var self=this;// Emulate methods on jPlayer's DOM element.
$.each($.jPlayer.emulateMethods.split(/\s+/g),function(i,name){self.internal.domNode[name]=function(arg){self[name](arg)}});// Bubble jPlayer events to its DOM element.
$.each($.jPlayer.event,function(eventName,eventType){var nativeEvent=true;$.each($.jPlayer.reservedEvent.split(/\s+/g),function(i,name){if(name===eventName){nativeEvent=false;return false}});if(nativeEvent){self.element.bind(eventType+".jPlayer.jPlayerHtml",function(){// With .jPlayer & .jPlayerHtml namespaces.
self._emulateHtmlUpdate();var domEvent=document.createEvent("Event");domEvent.initEvent(eventName,false,true);self.internal.domNode.dispatchEvent(domEvent)})}})},_emulateHtmlUpdate:function(){var self=this;$.each($.jPlayer.emulateStatus.split(/\s+/g),function(i,name){self.internal.domNode[name]=self.status[name]});$.each($.jPlayer.emulateOptions.split(/\s+/g),function(i,name){self.internal.domNode[name]=self.options[name]})},_destroyHtmlBridge:function(){var self=this;// Bridge event handlers are also removed by destroy() through .jPlayer namespace.
this.element.unbind(".jPlayerHtml");// Remove all event handlers created by the jPlayer bridge. So you can change the emulateHtml option.
// Remove the methods and properties
var emulated=$.jPlayer.emulateMethods+" "+$.jPlayer.emulateStatus+" "+$.jPlayer.emulateOptions;$.each(emulated.split(/\s+/g),function(i,name){delete self.internal.domNode[name]})}};$.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};$.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",// Used in: _flashError()
FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",// Used in: _flashError()
NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",// Used in: _init()
NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",// Used in: setMedia()
URL:"Media URL could not be loaded.",// Used in: jPlayerFlashEvent() and _addHtmlEventListeners()
URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",// Used in: load(), play(), pause(), stop() and playHead()
VERSION:"jPlayer "+$.jPlayer.prototype.version.script+" needs Jplayer.swf version "+$.jPlayer.prototype.version.needFlash+" but found "};$.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};$.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};$.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};$.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});(function($){$.fn.audioSlideshow=function(options){var settings={jPlayerPath:"//images01-www.oeamtc.at/autotouring/images/Jplayer.swf",suppliedFileType:"mp3, oga",wmode:"window",playSelector:".audio-play",pauseSelector:".audio-pause",currentTimeSelector:".play-time",durationSelector:".total-time",playheadSelector:".playhead",timelineSelector:".timeline"};if(options){jQuery.extend(settings,options)}// Begin to iterate over the jQuery collection that the method was called on
return this.each(function(){// Cache `this`
var $that=$(this),$slides=$that.find(".audio-slides").children().children("img"),$currentTime=$that.find(settings.currentTimeSelector),$duration=$that.find(settings.durationSelector),$playhead=$that.find(settings.playheadSelector),$timeline=$that.find(settings.timelineSelector),$playButton=$that.find(settings.playSelector),$pauseButton=$that.find(settings.pauseSelector),slidesCount=$slides.length,slideTimes=new Array,audioDurationinSeconds=parseInt($that.attr("data-audio-duration")),isPlaying=false,currentSlide=-1;$pauseButton.hide();// Setup slides			
$slides.each(function(index,el){var $el=$(el);$el.hide();var second=parseInt($el.attr("data-slide-time")),thumbnail=$el.attr("data-thumbnail");if(index>0){slideTimes.push(second);var img='<span><img src="'+thumbnail+'"></span>',$marker=$('<a href="javascript:;" class="marker" data-time="'+second+'">'+img+"</a>"),l=second/audioDurationinSeconds*$that.width();$marker.css("left",l).click(function(e){$jPlayerObj.jPlayer("play",parseInt($(this).attr("data-time"))+.5)});$timeline.append($marker)}});var $jPlayerObj=$("<div></div>");$that.append($jPlayerObj);$jPlayerObj.jPlayer("destroy");$jPlayerObj.jPlayer({ready:function(){$.jPlayer.timeFormat.padMin=false;$(this).jPlayer("setMedia",{mp3:$that.attr("data-audio-mp3"),oga:$that.attr("data-audio-oga")})},swfPath:settings.jPlayerPath,supplied:settings.suppliedFileType,preload:"auto",cssSelectorAncestor:""});$jPlayerObj.bind($.jPlayer.event.timeupdate,function(event){// Add a listener to report the time play began
var curTime=event.jPlayer.status.currentTime;audioDurationinSeconds=event.jPlayer.status.duration;var p=curTime/audioDurationinSeconds*100+"%";$currentTime.text($.jPlayer.convertTime(curTime));$duration.text($.jPlayer.convertTime(audioDurationinSeconds));$playhead.width(p);if(slidesCount){var nxtSlide=0;for(var i=0;i<slidesCount;i++){if(slideTimes[i]<curTime){nxtSlide=i+1}}setAudioSlide(nxtSlide)}});$jPlayerObj.bind($.jPlayer.event.play,function(event){// Add a listener to report the time play began
isPlaying=true;$playButton.hide();$pauseButton.show()});$jPlayerObj.bind($.jPlayer.event.pause,function(event){// Add a listener to report the time pause began
isPlaying=false;$pauseButton.hide();$playButton.show()});$slides.click(function(event){$jPlayerObj.jPlayer("play")});$playButton.click(function(event){$jPlayerObj.jPlayer("play")});$pauseButton.click(function(event){$jPlayerObj.jPlayer("pause")});$(window).on("resize",function(){$slides.each(function(index,el){if(index<=0){return}var second=parseInt($(el).attr("data-slide-time"));var audioDurationinSeconds=parseInt($that.attr("data-audio-duration"));var l=second/audioDurationinSeconds*$that.width();$that.find('a.marker[data-time="'+second+'"]').css("left",l)})});$(window).on("load",function(){$slides.each(function(index,el){if(index<=0){return}var second=parseInt($(el).attr("data-slide-time"));var audioDurationinSeconds=parseInt($that.attr("data-audio-duration"));var l=second/audioDurationinSeconds*$that.width();$that.find('a.marker[data-time="'+second+'"]').css("left",l)})});$timeline.click(function(event){var l=event.pageX-$(this).offset().left;var t=l/$that.width()*audioDurationinSeconds;$jPlayerObj.jPlayer("play",t)});setAudioSlide(0);function setAudioSlide(n){if(n!=currentSlide){if($slides.get(currentSlide)){$($slides.get(currentSlide)).fadeOut()}$($slides.get(n)).fadeIn();currentSlide=n}}})}})(jQuery);(function($){function defined(a){return typeof a!=="undefined"}function extend(child,parent,prototype){var F=function(){};F.prototype=parent.prototype;child.prototype=new F;child.prototype.constructor=child;parent.prototype.constructor=parent;child._super=parent.prototype;if(prototype){$.extend(child.prototype,prototype)}}var SUBST=[["",""],// spec
["exit","cancel"],// firefox & old webkits expect cancelFullScreen instead of exitFullscreen
["screen","Screen"]];var VENDOR_PREFIXES=["","o","ms","moz","webkit","webkitCurrent"];function native(obj,name){var prefixed;if(typeof obj==="string"){name=obj;obj=document}for(var i=0;i<SUBST.length;++i){name=name.replace(SUBST[i][0],SUBST[i][1]);for(var j=0;j<VENDOR_PREFIXES.length;++j){prefixed=VENDOR_PREFIXES[j];prefixed+=j===0?name:name.charAt(0).toUpperCase()+name.substr(1);if(defined(obj[prefixed])){return obj[prefixed]}}}return void 0}var ua=navigator.userAgent;var fsEnabled=native("fullscreenEnabled");var IS_ANDROID_CHROME=ua.indexOf("Android")!==-1&&ua.indexOf("Chrome")!==-1;var IS_NATIVELY_SUPPORTED=!IS_ANDROID_CHROME&&defined(native("fullscreenElement"))&&(!defined(fsEnabled)||fsEnabled===true);var version=$.fn.jquery.split(".");var JQ_LT_17=parseInt(version[0])<2&&parseInt(version[1])<7;var FullScreenAbstract=function(){this.__options=null;this._fullScreenElement=null;this.__savedStyles={}};FullScreenAbstract.prototype={_DEFAULT_OPTIONS:{styles:{boxSizing:"border-box",MozBoxSizing:"border-box",WebkitBoxSizing:"border-box"},toggleClass:null},__documentOverflow:"",__htmlOverflow:"",_preventDocumentScroll:function(){this.__documentOverflow=$("body")[0].style.overflow;this.__htmlOverflow=$("html")[0].style.overflow;$("body, html").css("overflow","hidden")},_allowDocumentScroll:function(){$("body")[0].style.overflow=this.__documentOverflow;$("html")[0].style.overflow=this.__htmlOverflow},_fullScreenChange:function(){if(!this.isFullScreen()){this._allowDocumentScroll();this._revertStyles();this._triggerEvents();this._fullScreenElement=null}else{this._preventDocumentScroll();this._triggerEvents()}},_fullScreenError:function(e){this._revertStyles();this._fullScreenElement=null;if(e){$(document).trigger("fscreenerror",[e])}},_triggerEvents:function(){$(this._fullScreenElement).trigger(this.isFullScreen()?"fscreenopen":"fscreenclose");$(document).trigger("fscreenchange",[this.isFullScreen(),this._fullScreenElement])},_saveAndApplyStyles:function(){var $elem=$(this._fullScreenElement);this.__savedStyles={};for(var property in this.__options.styles){// save
this.__savedStyles[property]=this._fullScreenElement.style[property];// apply
this._fullScreenElement.style[property]=this.__options.styles[property]}if(this.__options.toggleClass){$elem.addClass(this.__options.toggleClass)}},_revertStyles:function(){var $elem=$(this._fullScreenElement);for(var property in this.__options.styles){this._fullScreenElement.style[property]=this.__savedStyles[property]}if(this.__options.toggleClass){$elem.removeClass(this.__options.toggleClass)}},open:function(elem,options){// do nothing if request is for already fullscreened element
if(elem===this._fullScreenElement){return}// exit active fullscreen before opening another one
if(this.isFullScreen()){this.exit()}// save fullscreened element
this._fullScreenElement=elem;// apply options, if any
this.__options=$.extend(true,{},this._DEFAULT_OPTIONS,options);// save current element styles and apply new
this._saveAndApplyStyles()},exit:null,isFullScreen:null,isNativelySupported:function(){return IS_NATIVELY_SUPPORTED}};var FullScreenNative=function(){FullScreenNative._super.constructor.apply(this,arguments);this.exit=$.proxy(native("exitFullscreen"),document);this._DEFAULT_OPTIONS=$.extend(true,{},this._DEFAULT_OPTIONS,{styles:{width:"100%",height:"100%"}});$(document).bind(this._prefixedString("fullscreenchange")+" MSFullscreenChange",$.proxy(this._fullScreenChange,this)).bind(this._prefixedString("fullscreenerror")+" MSFullscreenError",$.proxy(this._fullScreenError,this))};extend(FullScreenNative,FullScreenAbstract,{VENDOR_PREFIXES:["","o","moz","webkit"],_prefixedString:function(str){return $.map(this.VENDOR_PREFIXES,function(s){return s+str}).join(" ")},open:function(elem,options){FullScreenNative._super.open.apply(this,arguments);var requestFS=native(elem,"requestFullscreen");requestFS.call(elem)},exit:$.noop,isFullScreen:function(){return native("fullscreenElement")!==null},element:function(){return native("fullscreenElement")}});var FullScreenFallback=function(){FullScreenFallback._super.constructor.apply(this,arguments);this._DEFAULT_OPTIONS=$.extend({},this._DEFAULT_OPTIONS,{styles:{position:"fixed",zIndex:"2147483647",left:0,top:0,bottom:0,right:0}});this.__delegateKeydownHandler()};extend(FullScreenFallback,FullScreenAbstract,{__isFullScreen:false,__delegateKeydownHandler:function(){var $doc=$(document);$doc.delegate("*","keydown.fullscreen",$.proxy(this.__keydownHandler,this));var data=JQ_LT_17?$doc.data("events"):$._data(document).events;var events=data["keydown"];if(!JQ_LT_17){events.splice(0,0,events.splice(events.delegateCount-1,1)[0])}else{data.live.unshift(data.live.pop())}},__keydownHandler:function(e){if(this.isFullScreen()&&e.which===27){this.exit();return false}return true},_revertStyles:function(){FullScreenFallback._super._revertStyles.apply(this,arguments);// force redraw (fixes bug in IE7 with content dissapearing)
this._fullScreenElement.offsetHeight},open:function(elem){FullScreenFallback._super.open.apply(this,arguments);this.__isFullScreen=true;this._fullScreenChange()},exit:function(){this.__isFullScreen=false;this._fullScreenChange()},isFullScreen:function(){return this.__isFullScreen},element:function(){return this.__isFullScreen?this._fullScreenElement:null}});$.fullscreen=IS_NATIVELY_SUPPORTED?new FullScreenNative:new FullScreenFallback;$.fn.fullscreen=function(options){var elem=this[0];options=$.extend({toggleClass:null,overflow:"hidden"},options);options.styles={overflow:options.overflow};delete options.overflow;if(elem){$.fullscreen.open(elem,options)}return this}})(jQuery);/*!
 * jQuery UI Core 1.10.4
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */
(function($,undefined){var uuid=0,runiqueId=/^ui-id-\d+$/;// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui=$.ui||{};$.extend($.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});// plugins
$.fn.extend({focus:function(orig){return function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem)}},delay)}):orig.apply(this,arguments)}}($.fn.focus),scrollParent:function(){var scrollParent;if($.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))){scrollParent=this.parents().filter(function(){return/(relative|absolute|fixed)/.test($.css(this,"position"))&&/(auto|scroll)/.test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"))}).eq(0)}else{scrollParent=this.parents().filter(function(){return/(auto|scroll)/.test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"))}).eq(0)}return/fixed/.test(this.css("position"))||!scrollParent.length?$(document):scrollParent},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex)}if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value}}elem=elem.parent()}}return 0},uniqueId:function(){return this.each(function(){if(!this.id){this.id="ui-id-"+ ++uuid}})},removeUniqueId:function(){return this.each(function(){if(runiqueId.test(this.id)){$(this).removeAttr("id")}})}});// selectors
function focusable(element,isTabIndexNotNaN){var map,mapName,img,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false}img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img)}// the element and all of its ancestors must be visible
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element)}function visible(element){return $.expr.filters.visible(element)&&!$(element).parents().addBack().filter(function(){return $.css(this,"visibility")==="hidden"}).length}$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName)}}):// support: jQuery <1.8
function(elem,i,match){return!!$.data(elem,match[3])},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")))},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN)}});// support: jQuery <1.8
if(!$("<a>").outerWidth(1).jquery){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0}if(margin){size-=parseFloat($.css(elem,"margin"+this))||0}});return size}$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this)}return this.each(function(){$(this).css(type,reduce(this,size)+"px")})};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size)}return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px")})}})}// support: jQuery <1.8
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector))}}// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if($("<a>").data("a-b","a").removeData("a-b").data("a-b")){$.fn.removeData=function(removeData){return function(key){if(arguments.length){return removeData.call(this,$.camelCase(key))}else{return removeData.call(this)}}}($.fn.removeData)}// deprecated
$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());$.support.selectstart="onselectstart"in document.createElement("div");$.fn.extend({disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});$.extend($.ui,{// $.ui.plugin is deprecated. Use $.widget() extensions instead.
plugin:{add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args){var i,set=instance.plugins[name];if(!set||!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11){return}for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}},// only used by resizable
hasScroll:function(el,a){//If overflow is hidden, the element might have extra content, but the user wants to hide it
if($(el).css("overflow")==="hidden"){return false}var scroll=a&&a==="left"?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true}// TODO: determine which cases actually cause this to happen
// if the element doesn't have the scroll set, see if it's possible to
// set the scroll
el[scroll]=1;has=el[scroll]>0;el[scroll]=0;return has}})})(jQuery);/*!
 * jQuery UI Widget 1.10.4
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */
(function($,undefined){var uuid=0,slice=Array.prototype.slice,_cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){try{$(elem).triggerHandler("remove")}catch(e){}}_cleanData(elems)};$.widget=function(name,base,prototype){var fullName,existingConstructor,constructor,basePrototype,// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype={},namespace=name.split(".")[0];name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}// create selector for plugin
$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){// allow instantiation without "new" keyword
if(!this._createWidget){return new constructor(options,element)}// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if(arguments.length){this._createWidget(options,element)}};// extend with the existing constructor to carry over any static properties
$.extend(constructor,existingConstructor,{version:prototype.version,// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto:$.extend({},prototype),// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors:[]});basePrototype=new base;// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){var _super=function(){return base.prototype[prop].apply(this,arguments)},_superApply=function(args){return base.prototype[prop].apply(this,args)};return function(){var __super=this._super,__superApply=this._superApply,returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()});constructor.prototype=$.widget.extend(basePrototype,{// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor)};$.widget.extend=function(target){var input=slice.call(arguments,1),inputIndex=0,inputLength=input.length,key,value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){// Clone objects
if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):// Don't extend strings, arrays, etc. with objects
$.widget.extend({},value)}else{target[key]=value}}}}return target};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=slice.call(arguments,1),returnValue=this;// allow multiple hashes to be passed on init
options=!isMethodCall&&args.length?$.widget.extend.apply(null,[options].concat(args)):options;if(isMethodCall){this.each(function(){var methodValue,instance=$.data(this,fullName);if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'")}if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance")}methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false}})}else{this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{})._init()}else{$.data(this,fullName,new object(options,this))}})}return returnValue}};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,// callbacks
create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=uuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this.bindings=$();this.hoverable=$();this.focusable=$();if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?// element within the document
element.ownerDocument:// element is window or document
element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:$.noop,_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){this._destroy();// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData($.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled");// clean up events and states
this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key,parts,curOption,i;if(arguments.length===0){// don't return a reference to the internal hash
return $.widget.extend({},this.options)}if(typeof key==="string"){// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]]}key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key]}curOption[key]=value}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key]}options[key]=value}}this._setOptions(options);return this},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key])}return this},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!value).attr("aria-disabled",value);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_on:function(suppressDisabledCheck,element,handlers){var delegateElement,instance=this;// no suppressDisabledCheck flag, shuffle arguments
if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false}// no element argument, shuffle and use this.element
if(!handlers){handlers=element;element=this.element;delegateElement=this.widget()}else{// accept selectors, DOM elements
element=delegateElement=$(element);this.bindings=this.bindings.add(element)}$.each(handlers,function(event,handler){function handlerProxy(){// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return}return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}// copy the guid so direct unbinding works
if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++}var match=event.match(/^(\w+)\s*(.*)$/),eventName=match[1]+instance.eventNamespace,selector=match[2];if(selector){delegateElement.delegate(selector,eventName,handlerProxy)}else{element.bind(eventName,handlerProxy)}})},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.unbind(eventName).undelegate(eventName)},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments)}var instance=this;return setTimeout(handlerProxy,delay||0)},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){$(event.currentTarget).addClass("ui-state-hover")},mouseleave:function(event){$(event.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){$(event.currentTarget).addClass("ui-state-focus")},focusout:function(event){$(event.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(type,event,data){var prop,orig,callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();// the original event may come from any element
// so we need to reset the target on the new event
event.target=this.element[0];// copy original event properties over to the new event
orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop]}}}this.element.trigger(event,data);return!($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented())}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options}}var hasOptions,effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options}}hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay)}if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options)}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback)}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0])}next()})}}})})(jQuery);/*!
 * jQuery UI Mouse 1.10.4
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/mouse/
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function($,undefined){var mouseHandled=false;$(document).mouseup(function(){mouseHandled=false});$.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.bind("mousedown."+this.widgetName,function(event){return that._mouseDown(event)}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false}});this.started=false},// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy:function(){this.element.unbind("."+this.widgetName);if(this._mouseMoveDelegate){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(event){// don't let more than one widget handle mouseStart
if(mouseHandled){return}// we may have missed mouseup (out of window)
this._mouseStarted&&this._mouseUp(event);this._mouseDownEvent=event;var that=this,btnIsLeft=event.which===1,// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel=typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false;if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(event)!==false;if(!this._mouseStarted){event.preventDefault();return true}}// Click event may never have fired (Gecko & Opera)
if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent")}// these delegates are required to keep context
this._mouseMoveDelegate=function(event){return that._mouseMove(event)};this._mouseUpDelegate=function(event){return that._mouseUp(event)};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true},_mouseMove:function(event){// IE mouseup check - mouseup happened when mouse was out of window
if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event)}if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault()}if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,event)!==false;this._mouseStarted?this._mouseDrag(event):this._mouseUp(event)}return!this._mouseStarted},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(event)}return false},_mouseDistanceMet:function(event){return Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},// These are placeholder methods, to be overriden by extending plugin
_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);/*!
 * jQuery UI Slider 1.10.4
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/slider/
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function($,undefined){// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
var numPages=5;$.widget("ui.slider",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null,// callbacks
change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._refresh();this._setOption("disabled",this.options.disabled);this._animateOff=false},_refresh:function(){this._createRange();this._createHandles();this._setupEvents();this._refreshValue()},_createHandles:function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",handles=[];handleCount=options.values&&options.values.length||1;if(existingHandles.length>handleCount){existingHandles.slice(handleCount).remove();existingHandles=existingHandles.slice(0,handleCount)}for(i=existingHandles.length;i<handleCount;i++){handles.push(handle)}this.handles=existingHandles.add($(handles.join("")).appendTo(this.element));this.handle=this.handles.eq(0);this.handles.each(function(i){$(this).data("ui-slider-handle-index",i)})},_createRange:function(){var options=this.options,classes="";if(options.range){if(options.range===true){if(!options.values){options.values=[this._valueMin(),this._valueMin()]}else if(options.values.length&&options.values.length!==2){options.values=[options.values[0],options.values[0]]}else if($.isArray(options.values)){options.values=options.values.slice(0)}}if(!this.range||!this.range.length){this.range=$("<div></div>").appendTo(this.element);classes="ui-slider-range"+// note: this isn't the most fittingly semantic framework class for this element,
// but worked best visually with a variety of themes
" ui-widget-header ui-corner-all"}else{this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""})}this.range.addClass(classes+(options.range==="min"||options.range==="max"?" ui-slider-range-"+options.range:""))}else{if(this.range){this.range.remove()}this.range=null}},_setupEvents:function(){var elements=this.handles.add(this.range).filter("a");this._off(elements);this._on(elements,this._handleEvents);this._hoverable(elements);this._focusable(elements)},_destroy:function(){this.handles.remove();if(this.range){this.range.remove()}this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._mouseDestroy()},_mouseCapture:function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;if(o.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));if(distance>thisDistance||distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min)){distance=thisDistance;closestHandle=$(this);index=i}});allowed=this._start(event,index);if(allowed===false){return false}this._mouseSliding=true;this._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().addBack().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-closestHandle.width()/2,top:event.pageY-offset.top-closestHandle.height()/2-(parseInt(closestHandle.css("borderTopWidth"),10)||0)-(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue)}this._animateOff=true;return true},_mouseStart:function(){return true},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}percentMouse=pixelMouse/pixelTotal;if(percentMouse>1){percentMouse=1}if(percentMouse<0){percentMouse=0}if(this.orientation==="vertical"){percentMouse=1-percentMouse}valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse)},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}return this._trigger("start",event,uiHash)},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if(this.options.values.length===2&&this.options.range===true&&(index===0&&newVal>otherVal||index===1&&newVal<otherVal)){newVal=otherVal}if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;// A slide can be canceled by returning false from the slide callback
allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal)}}}else{if(newVal!==this.value()){// A slide can be canceled by returning false from the slide callback
allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal)}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}this._trigger("stop",event,uiHash)},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values()}//store the last changed value index for reference when handles overlap
this._lastChangedValue=index;this._trigger("change",event,uiHash)}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return}return this._value()},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return}if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i)}this._refreshValue()}else{if(this.options.values&&this.options.values.length){return this._values(index)}else{return this.value()}}}else{return this._values()}},_setOption:function(key,value){var i,valsLength=0;if(key==="range"&&this.options.range===true){if(value==="min"){this.options.value=this._values(0);this.options.values=null}else if(value==="max"){this.options.value=this._values(this.options.values.length-1);this.options.values=null}}if($.isArray(this.options.values)){valsLength=this.options.values.length}$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i)}this._animateOff=false;break;case"min":case"max":this._animateOff=true;this._refreshValue();this._animateOff=false;break;case"range":this._animateOff=true;this._refresh();this._animateOff=false;break}},//internal value getter
// _value() returns value trimmed by min and max, aligned by step
_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val},//internal values getter
// _values() returns array of values trimmed by min and max, aligned by step
// _values( index ) returns single value trimmed by min and max, aligned by step
_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val}else if(this.options.values&&this.options.values.length){// .slice() creates a copy of the array
// this copy gets trimmed by min and max and then returned
vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i])}return vals}else{return[]}},// returns the step-aligned value that val is closest to, between (inclusive) min and max
_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin()}if(val>=this._valueMax()){return this._valueMax()}var step=this.options.step>0?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=valModStep>0?step:-step}// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see #4124)
return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=!this._animateOff?o.animate:false,_set={};if(this.options.values&&this.options.values.length){this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-that._valueMin())*100;_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(that.options.range===true){if(that.orientation==="horizontal"){if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({width:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}else{if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({bottom:valPercent+"%"},o.animate)}if(i===1){that.range[animate?"animate":"css"]({height:valPercent-lastValPercent+"%"},{queue:false,duration:o.animate})}}}lastValPercent=valPercent})}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=valueMax!==valueMin?(value-valueMin)/(valueMax-valueMin)*100:0;_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:100-valPercent+"%"},{queue:false,duration:o.animate})}if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate)}if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:100-valPercent+"%"},{queue:false,duration:o.animate})}}},_handleEvents:{keydown:function(event){var allowed,curVal,newVal,step,index=$(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:event.preventDefault();if(!this._keySliding){this._keySliding=true;$(event.target).addClass("ui-state-active");allowed=this._start(event,index);if(allowed===false){return}}break}step=this.options.step;if(this.options.values&&this.options.values.length){curVal=newVal=this.values(index)}else{curVal=newVal=this.value()}switch(event.keyCode){case $.ui.keyCode.HOME:newVal=this._valueMin();break;case $.ui.keyCode.END:newVal=this._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+(this._valueMax()-this._valueMin())/numPages);break;case $.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-(this._valueMax()-this._valueMin())/numPages);break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===this._valueMax()){return}newVal=this._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===this._valueMin()){return}newVal=this._trimAlignValue(curVal-step);break}this._slide(event,index,newVal)},click:function(event){event.preventDefault()},keyup:function(event){var index=$(event.target).data("ui-slider-handle-index");if(this._keySliding){this._keySliding=false;this._stop(event,index);this._change(event,index);$(event.target).removeClass("ui-state-active")}}}})})(jQuery);/*!
 * jQuery UI Touch Punch 0.2.2
 *
 * Copyright 2011, Dave Furfero
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * Depends:
 *  jquery.ui.widget.js
 *  jquery.ui.mouse.js
 */
(function($){// Detect touch support
$.support.touch="ontouchend"in document;// Ignore browsers without touch support
if(!$.support.touch){return}var mouseProto=$.ui.mouse.prototype,_mouseInit=mouseProto._mouseInit,touchHandled;/**
   * Simulate a mouse event based on a corresponding touch event
   * @param {Object} event A touch event
   * @param {String} simulatedType The corresponding mouse event
   */
function simulateMouseEvent(event,simulatedType){// Ignore multi-touch events
if(event.originalEvent.touches.length>1){return}event.preventDefault();var touch=event.originalEvent.changedTouches[0],simulatedEvent=document.createEvent("MouseEvents");// Initialize the simulated mouse event using the touch event's coordinates
simulatedEvent.initMouseEvent(simulatedType,// type
true,// bubbles
true,// cancelable
window,// view
1,// detail
touch.screenX,// screenX
touch.screenY,// screenY
touch.clientX,// clientX
touch.clientY,// clientY
false,// ctrlKey
false,// altKey
false,// shiftKey
false,// metaKey
0,// button
null);// Dispatch the simulated event to the target element
event.target.dispatchEvent(simulatedEvent)}/**
   * Handle the jQuery UI widget's touchstart events
   * @param {Object} event The widget element's touchstart event
   */
mouseProto._touchStart=function(event){var self=this;// Ignore the event if another widget is already being handled
if(touchHandled||!self._mouseCapture(event.originalEvent.changedTouches[0])){return}// Set the flag to prevent other widgets from inheriting the touch event
touchHandled=true;// Track movement to determine if interaction was a click
self._touchMoved=false;// Simulate the mouseover event
simulateMouseEvent(event,"mouseover");// Simulate the mousemove event
simulateMouseEvent(event,"mousemove");// Simulate the mousedown event
simulateMouseEvent(event,"mousedown")};/**
   * Handle the jQuery UI widget's touchmove events
   * @param {Object} event The document's touchmove event
   */
mouseProto._touchMove=function(event){// Ignore event if not handled
if(!touchHandled){return}// Interaction was not a click
this._touchMoved=true;// Simulate the mousemove event
simulateMouseEvent(event,"mousemove")};/**
   * Handle the jQuery UI widget's touchend events
   * @param {Object} event The document's touchend event
   */
mouseProto._touchEnd=function(event){// Ignore event if not handled
if(!touchHandled){return}// Simulate the mouseup event
simulateMouseEvent(event,"mouseup");// Simulate the mouseout event
simulateMouseEvent(event,"mouseout");// If the touch interaction did not move, it should trigger a click
if(!this._touchMoved){// Simulate the click event
simulateMouseEvent(event,"click")}// Unset the flag to allow other widgets to inherit the touch event
touchHandled=false};/**
   * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
   * This method extends the widget with bound touch event handlers that
   * translate touch events to mouse events and pass them to the widget's
   * original mouse event handling methods.
   */
mouseProto._mouseInit=function(){var self=this;// Delegate the touch handlers to the widget's element
self.element.bind("touchstart",$.proxy(self,"_touchStart")).bind("touchmove",$.proxy(self,"_touchMove")).bind("touchend",$.proxy(self,"_touchEnd"));// Call the original $.ui.mouse init method
_mouseInit.call(self)}})(jQuery);/*!
 * Copyright (c) 2012 Ben Olson (https://github.com/bseth99/jquery-ui-extensions)
 * jQuery UI LabeledSlider @VERSION
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Depends:
 *  jquery.ui.core.js
 *  jquery.ui.widget.js
 *  jquery.ui.mouse.js
 *  jquery.ui.slider.js
 */
(function($,undefined){$.widget("ui.labeledslider",$.ui.slider,{version:"@VERSION",options:{tickInterval:0,tweenLabels:true,tickLabels:null,tickArray:[]},uiSlider:null,tickInterval:0,tweenLabels:true,_create:function(){this._detectOrientation();this.uiSlider=this.element.wrap('<div class="ui-slider-wrapper ui-widget"></div>').before('<div class="ui-slider-labels"></div>').parent().addClass(this.orientation).css("font-size",this.element.css("font-size"));this._super();this.element.removeClass("ui-widget");this._alignWithStep();if(this.orientation=="horizontal"){this.uiSlider.width(this.element.css("width"))}else{this.uiSlider.height(this.element.css("height"))}this._drawLabels()},_drawLabels:function(){var labels=this.options.tickLabels||{},$lbl=this.uiSlider.children(".ui-slider-labels"),dir=this.orientation=="horizontal"?"left":"bottom",min=this.options.min,max=this.options.max,inr=this.tickInterval,cnt=max-min,tickArray=this.options.tickArray,ta=tickArray.length>0,label,pt,i=0;$lbl.html("");for(;i<=cnt;i++){if(!ta&&i%inr==0||ta&&tickArray.indexOf(i+min)>-1){label=labels[i+min]?labels[i+min]:this.options.tweenLabels?i+min:"";$("<div>").addClass("ui-slider-label-ticks").css(dir,Math.round(i/cnt*1e4)/100+"%").html("<span>"+label+"</span>"+'<div class="upper">'+"</div>").appendTo($lbl)}}},_setOption:function(key,value){this._super(key,value);switch(key){case"tickInterval":case"tickLabels":case"tickArray":case"min":case"max":case"step":this._alignWithStep();this._drawLabels();break;case"orientation":this.element.removeClass("horizontal vertical").addClass(this.orientation);this._drawLabels();break}},_alignWithStep:function(){if(this.options.tickInterval<this.options.step)this.tickInterval=this.options.step;else this.tickInterval=this.options.tickInterval},_destroy:function(){this._super();this.uiSlider.replaceWith(this.element)},widget:function(){return this.uiSlider}})})(jQuery);var autotouring=autotouring||{log:function(message){var logging="false";if(logging==="false"){return}console.log(message)},events:{LOGGED_OUT:"cms_autotouring_events_logged_out",LOGIN_ERROR:"cms_autotouring_events_login_error",HEADER_LOADED:"cms_autotouring_events_header_loaded",SESSION_LOADED:"cms_autotouring_events_session_loaded",SESSION_ABANDONED:"cms_autotouring_events_session_abandoned",CONTENT_LOADED:"cms_autotouring_events_content_loaded",ADS_LOADED:"cms_autotouring_events_ads_loaded"},animateDuration:{slow:600,medium:400,fast:200},fadeDuration:{slow:500,medium:350,fast:200},isIPad:function(){return navigator.userAgent.match(/iPad/i)},isIOS:function(){return autotouring.isIPad()||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)},isIPhone:function(){return navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)},isAndroid:function(){return navigator.userAgent.match(/Android/i)},isWindowsMobile:function(){return navigator.userAgent.match(/Windows Phone/i)},isMobileDevice:function(){return autotouring.isIOS()||autotouring.isAndroid()||autotouring.isWindowsMobile()||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Kindle Fire/i)},isPhone:function(){return autotouring.isIPhone()||autotouring.isAndroid()||autotouring.isWindowsMobile()||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Kindle Fire/i)},isTouchDevice:function(){return typeof window.ontouchstart!=="undefined"?true:false},isAjaxBrowser:function(){return!autotouring.isIe()||autotouring.isIe()&&$.browser.version>9},isIe:function(){return $.browser.msie},isGtIe9:function(){return autotouring.isIe()&&$.browser.version>9},isIe8:function(){//return (navigator.userAgent.match(/MSIE\s(?!9.0)/));
return autotouring.isIe()&&$.browser.version==8},resizeElements:function(){var ww=$(window).width();var pageHeight=$(window).height();//$('.sidebar').outerHeight(pageHeight - $('.page-header').outerHeight());
$("#SearchResultContainer .article-container").outerHeight(pageHeight-$(".page-header").outerHeight()-30);if(ww<768){$(".article-container").outerHeight(pageHeight-$(".page-header").outerHeight()-150)}else{$(".article-container").outerHeight(pageHeight-$(".page-header").outerHeight()-110)}},skrollr:{//Note: SKROLLR INSTANCE HEIGHT HAS TO BE ADAPTED IF DOCUMENT HEIGHT CHANGES
instance:null,init:function(args){if(autotouring.isPhone()){return}autotouring.skrollr.instance=skrollr.init(args)},disable:function(){if(autotouring.skrollr.instance===null){return}autotouring.skrollr.instance.powerOff();autotouring.overflow.disable()},enable:function(){if(autotouring.skrollr.instance===null){return}autotouring.skrollr.instance.powerOn();autotouring.skrollr.instance.refresh();autotouring.overflow.enable()},refresh:function(){if(autotouring.skrollr.instance===null){return}autotouring.skrollr.instance.refresh()},destroy:function(){if(autotouring.skrollr.instance===null){return}autotouring.skrollr.instance.destroy()},run:function(){autotouring.skrollr.destroy();autotouring.skrollr.init({forceHeight:false,smoothScrolling:false})}},overflow:{enable:function(){$("body").removeClass("bodyOverflow");$("body").css("width","100%");$("body").css("height","100%")},disable:function(){$(".maincontainer").on("scroll touchmove",function(e){e.preventDefault()});var bwidth=$(window).width();var bheight=$(window).height();$("body").addClass("bodyOverflow");$("body").css("width",bwidth);$("body").css("height",bheight)}},//    lazyload: function() {
//        $('img.lazy').lazyload({
//            effect : "fadeIn"
//        });
//        $('img.lazy').on('load', function() {
//            autotouring.skrollr.refresh();
//        });
//    },
unveilit:function(){$(".unveil").unveil();$(".unveil").addClass("unveiled");$(".unveil").on("load",function(){this.style.opacity=1;autotouring.skrollr.refresh()})},picturefill:function(){picturefill()},menu:{},fullscreen:{enable:function(){$(".gallery-container").fullscreen();$(".fullscreen-btn.requestfullscreen").hide();$(".fullscreen-btn.exitfullscreen").show();$("body").addClass("fullscreen")},disable:function(){$.fullscreen.exit();$(".fullscreen-btn.requestfullscreen").show();$(".fullscreen-btn.exitfullscreen").hide();$("body").removeClass("fullscreen")}},fullwidthSection:{open:function(){$("#fullwidth-toggle-arrow").addClass("active");$(".fullwidth-box-body").addClass("box-body-up");$(".fullwidth-image-description .title").addClass("title-up");$(".icon-arrow-up").fadeOut("fast");$(".icon-arrow-down").fadeIn("fast")},close:function(){$("#fullwidth-toggle-arrow").removeClass("active");$(".fullwidth-box-body").removeClass("box-body-up");$(".fullwidth-image-description .title").removeClass("title-up");$(".icon-arrow-up").fadeIn("fast");$(".icon-arrow-down").fadeOut("fast")}},history:{pushState:function(url,title){if(!url||!autotouring.isAjaxBrowser()){return false}History.pushState({url:url},title,url);autotouring.log('autotouring.history.pushState("'+url+'", "'+title+'")')},replaceState:function(url,title){if(!url||!autotouring.isAjaxBrowser()){return false}History.replaceState({url:url},title,url);autotouring.log('autotouring.history.replaceState("'+url+'", "'+title+'")')},onPopState:function(callback){if(!autotouring.isAjaxBrowser()){return false}var state=History.getState();if(!state){return false}var url=state.data.url;if(!url){return false}return callback(url)}},fetchXhrs:{},fetch:function(type,url,success,error,always){if($.type(type)!=="string"||type.length===0||$.type(url)!=="string"||url.length===0){return}url=url+(/\?/.test(url)?"&xhr":"?xhr");$.each(autotouring.fetchXhrs,function(key,value){if(type!==key){return}value.abort()});autotouring.fetchXhrs={};autotouring.fetchXhrs[type]=$.ajax({url:url,contentType:"text/html",success:function(data,textStatus,jqXHR){if(!data){return}if($.type(success)==="function"){success(data)}},error:function(jqXHR,textStatus,errorThrown){if($.type(error)==="function"){error(jqXHR)}},complete:function(jqXHR,textStatus){if($.type(always)==="function"){always(jqXHR)}}})},content:{pager:{fetch:function(){var url=$("#article-pager").data("href");if(!url){return}autotouring.fetch("content.pager",url,function(data){$("#article-pager").html(data);var iv=setInterval(function(){$("#article-pager .arrow.prev").css("margin-left","0");$("#article-pager .arrow.next").css("margin-right","0");clearInterval(iv)},300)})}},animDone:false,xhrDone:false,page:function($node){if(!$node.data("href")){return false}$(".ajax-loader-wrapper").show();autotouring.content.animDone=false;autotouring.content.xhrDone=false;var direction=$node.data("direction");var done=function(){autotouring.history.pushState($node.data("href"),$node.data("title"));$("#maincontainer").css("transform","");$("html, body").animate({scrollTop:0},autotouring.animateDuration.fast);$("#article-pager").show();$("#maincontainer").trigger("CONTENT_CHANGED");$(".ajax-loader-wrapper").hide()};$("#maincontainer").parent().css("overflow-x","hidden");$("#article-pager").hide();$("#maincontainer").animate({transform:"translateX("+(direction>0?"-":"")+$(window).width()+"px)"},autotouring.animateDuration.fast,function(){autotouring.content.animDone=true;if(autotouring.content.xhrDone){done()}});autotouring.fetch("content",$node.data("href"),function(data){$("#maincontainer").html(data);autotouring.content.xhrDone=true;if(autotouring.content.animDone){done()}});return false}},swipe:function(){if(!autotouring.isMobileDevice()){return}$("#maincontainer").swipe({swipeRight:function(evtObj,direction,distance,duration,fingerCount){autotouring.log($(evtObj.srcElement));if($(evtObj.srcElement).closest(".prevent-paging").size()>0){return false}return autotouring.content.page($("#article-pager .arrow.prev a"))},swipeLeft:function(evtObj,direction,distance,duration,fingerCount){autotouring.log($(evtObj.srcElement));if($(evtObj.srcElement).closest(".prevent-paging").size()>0){return false}return autotouring.content.page($("#article-pager .arrow.next a"))},threshold:$(window).width()*.4})},swipers:function(){// TAKE CARE OF SLIDERS ON HORIZONTAL SLIDE SWIPE
if(!autotouring.isMobileDevice()){return}var startX,startY,moveX,moveY;function handleStart(evt){startX=evt.changedTouches[0].pageX;startY=evt.changedTouches[0].pageY}function handleMove(evt){moveX=evt.changedTouches[0].pageX;moveY=evt.changedTouches[0].pageY;var difX=Math.abs(startX-moveX);var difY=Math.abs(startY-moveY);if(difX>20&&difY<100){evt.stopPropagation()}}var el=document.getElementsByClassName("swipers");var l=el.length;for(var i=0;i<l;i++){el[i].addEventListener("touchstart",handleStart,false);el[i].addEventListener("touchmove",handleMove,false)}},fixedHeaderArticle:function(){var ww=$(window).width();if(ww>1440){var ww=1440}var baseHeight=ww/(16/8);if(ww<736){$(".fixedheader-detailtop").css("height",baseHeight);$(".fixedheadermargin-article").css("margin-top",baseHeight+50)}else{$(".fixedheader-detailtop").css("height",baseHeight-30);$(".fixedheadermargin-article").css("margin-top",baseHeight-30)}autotouring.skrollr.refresh()},fixedHeaderChannel:function(){var ww=$(window).width();if(ww>1440){var ww=1440}var baseHeight=ww/(16/7);$(".channel-teaser-img-top").css("height",baseHeight);$(".channel-teaser-img-issue").css("height",baseHeight);autotouring.skrollr.refresh()},mobileNavScrollButtons:function(){var node=document.getElementById("alternative-header-sub-navigation");var scrollContainerNode=document.getElementById("alternative-header-sub-navigation__list");var buttonLeftNode=document.getElementById("scrollbutton--left");var buttonRightNode=document.getElementById("scrollbutton--right");var scrollToLeft=function(){var scrollAmount=0;var slideTimer=setInterval(function(){scrollContainerNode.scrollLeft-=30;scrollAmount+=30;if(scrollAmount>=100){window.clearInterval(slideTimer)}},35)};var scrollToRight=function(){var scrollAmount=0;var slideTimer=setInterval(function(){scrollContainerNode.scrollLeft+=30;scrollAmount+=30;if(scrollAmount>=100){window.clearInterval(slideTimer)}},35)};var showButtons=function(){node.classList.add("buttons-visible")};var hideButtons=function(){node.classList.remove("buttons-visible")};var isOverflowed=function(element){return element.scrollWidth>element.clientWidth};var updateButtons=function(element){if(element.clientWidth+element.scrollLeft===element.scrollWidth){node.classList.add("button-right-hidden")}else if(element.scrollLeft===0){node.classList.add("button-left-hidden")}else{node.classList.remove("button-left-hidden");node.classList.remove("button-right-hidden")}};$(buttonLeftNode).on("click",function(){scrollToLeft();updateButtons(scrollContainerNode)});$(scrollContainerNode).on("scroll",function(){updateButtons(scrollContainerNode)});$(buttonRightNode).on("click",function(){scrollToRight();updateButtons(scrollContainerNode)});$(window).on("resize",function(){if(isOverflowed(scrollContainerNode)===true){showButtons()}else{hideButtons()}});if(isOverflowed(scrollContainerNode)===true){showButtons()}else{hideButtons()}}};// DOCUMENT
$(document).on("ready",function(){if(typeof comments!=="undefined"){comments.loadComments()}// DISABLE FADE EFFECTS FOR MOBILE DEVICES
if(autotouring.isMobileDevice()){autotouring.animateDuration.fast=0;autotouring.animateDuration.medium=0;autotouring.animateDuration.slow=0}// CONTENT HANDLER
if(autotouring.isAjaxBrowser()){$("#maincontainer").on("click","#article-pager .arrow.prev a, #article-pager .arrow.next a",function(){return autotouring.content.page($(this))})}if(autotouring.isIPad()){var clickCountLeft=0;var clickCountRight=0;$("#maincontainer").on("touchend","#article-pager .arrow.prev a",function(){if(clickCountLeft===0){var t=setTimeout(function(){clickCountLeft=0;clearTimeout(t)},3e3);clickCountLeft++;return false}clickCountLeft=0;$(this).trigger("click");return false});$("#maincontainer").on("touchend","#article-pager .arrow.next a",function(){if(clickCountRight===0){var t=setTimeout(function(){clickCountRight=0;clearTimeout(t)},3e3);clickCountRight++;return false}clickCountRight=0;$(this).trigger("click");return false})}// HISTORY CHANGED HANDLER
$(window).bind("popstate",function(){autotouring.history.onPopState(function(url){if(url===$("#article").data("href")){return false}autotouring.fetch("content",url,function(data){$("#maincontainer").html(data);$("#maincontainer").trigger("CONTENT_CHANGED")})})});autotouring.swipe();autotouring.swipers();if($.browser.version=="8.0"||$.browser.version=="9.0"){// PLACEHOLDER FOR IE8/IE9
$(function(){var $input=document.createElement("input");if("placeholder"in $input==true){return}$("[placeholder]").focus(function(){var $input=$(this);if($input.val()==$input.attr("placeholder")){$input.val("");$input.removeClass("placeholder");$input.css({color:"#666",background:"#fff"})}}).blur(function(){var $input=$(this);if($input.val()==""||$input.val()==$input.attr("placeholder")){$input.addClass("placeholder");$input.val($input.attr("placeholder"));$input.css({color:"#bbb",background:"#fff"})}}).blur();$("[placeholder]").parents("form").submit(function(){$(this).find("[placeholder]").each(function(){var $input=$(this);if($input.val()==$input.attr("placeholder")){$input.val("")}})})})}// INDEXOF EXTENSIONS
/**
    * Array indexOf extension for browsers that do not implement this
    * return index of array element if exists
    * eg: var elPos = myArray.indexOf('elementName');
    */
if($.browser.version=="8.0"){if(!Array.indexOf){Array.indexOf=[].indexOf?function(arr,obj,from){return arr.indexOf(obj,from)}:function(arr,obj,from){// (for IE6)
var l=arr.length,i=from?parseInt(1*from+(from<0?l:0),10):0;i=i<0?0:i;for(;i<l;i++){if(i in arr&&arr[i]===obj){return i}}return-1}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(val){return jQuery.inArray(val,this)}}(function(){var style=document.styleSheets[0]||document.createStyleSheet();window.select=function(selector){style.addRule(selector,"foo:bar");var all=document.all,resultSet=[];for(var i=0,l=all.length;i<l;i++){if(all[i].currentStyle.foo==="bar"){resultSet[resultSet.length]=all[i]}}style.removeRule(0);return resultSet}})();// add filter for ie8 - temporary
if(!Array.prototype.filter){Array.prototype.filter=function(fun){"use strict";if(this===void 0||this===null)throw new TypeError;var t=Object(this);var len=t.length>>>0;if(typeof fun!=="function")throw new TypeError;var res=[];var thisp=arguments[1];for(var i=0;i<len;i++){if(i in t){var val=t[i];// in case fun mutates this
if(fun.call(thisp,val,i,t))res.push(val)}}return res}}}});// ON RESIZE
$(window).on("resize",function(){autotouring.resizeElements();autotouring.fixedHeaderChannel();autotouring.fixedHeaderArticle();autotouring.skrollr.refresh();autotouring.unveilit()});// ON ORIENTATIONCHANGE
$(window).on("orientationchange",function(){autotouring.fixedHeaderChannel();autotouring.fixedHeaderArticle();autotouring.resizeElements();autotouring.skrollr.refresh();autotouring.unveilit()});// ON LOAD
$(window).bind("load",function(){$("#maincontainer").trigger("CONTENT_CHANGED")});// CONTENT_CHANGED
$("#maincontainer").on("CONTENT_CHANGED",function(){autotouring.picturefill();if(autotouring.isTouchDevice()&&autotouring.isMobileDevice()){// if ('ontouchstart' in document.documentElement) {
$("img.unveil").each(function(){$(this).attr("src",$(this).attr("data-src"));$(this).addClass("unveiled");autotouring.skrollr.refresh()})}else{autotouring.unveilit()}autotouring.content.pager.fetch();autotouring.resizeElements();//autotouring.menu.changeSidebarNavs();
autotouring.fixedHeaderChannel();autotouring.fixedHeaderArticle();autotouring.skrollr.run();$("#maincontainer").trigger("PAGE_JS_READY");$("#maincontainer").trigger("CONTENT_LOADED")});// CSS LOADED
$("#maincontainer").on("CSS_LOADED",function(){autotouring.fixedHeaderChannel();autotouring.fixedHeaderArticle();autotouring.mobileNavScrollButtons();autotouring.skrollr.refresh()});// RESPONSIVE AJAX LOADING CONTENT
$("#maincontainer").on("CONTENT_CHANGED",function(){$(document).trigger("GET_SUITABLE_CONTENT")});// determine on resizestop if we need to load the other option
$(window).bind("resize",function(e){window.resizeEvt;$(window).resize(function(){clearTimeout(window.resizeEvt);window.resizeEvt=setTimeout(function(){$(document).trigger("GET_SUITABLE_CONTENT")},600)})});/*!
 * classie - class helper functions
 * from bonzo https://github.com/ded/bonzo
 * 
 * classie.has( elem, 'my-class' ) -> true/false
 * classie.add( elem, 'my-new-class' )
 * classie.remove( elem, 'my-unwanted-class' )
 * classie.toggle( elem, 'my-class' )
 */
/*jshint browser: true, strict: true, undef: true */
/*global define: false */
if($.browser.msie&&$.browser.version==7||$.browser.msie&&$.browser.version==8){}else{(function(window){"use strict";// class helper functions from bonzo https://github.com/ded/bonzo
function classReg(className){return new RegExp("(^|\\s+)"+className+"(\\s+|$)")}// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass,addClass,removeClass;if("classList"in document.documentElement){hasClass=function(elem,c){return elem.classList.contains(c)};addClass=function(elem,c){elem.classList.add(c)};removeClass=function(elem,c){elem.classList.remove(c)}}else{hasClass=function(elem,c){return classReg(c).test(elem.className)};addClass=function(elem,c){if(!hasClass(elem,c)){elem.className=elem.className+" "+c}};removeClass=function(elem,c){elem.className=elem.className.replace(classReg(c)," ")}}function toggleClass(elem,c){var fn=hasClass(elem,c)?removeClass:addClass;fn(elem,c)}var classie={// full names
hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,// short names
has:hasClass,add:addClass,remove:removeClass,toggle:toggleClass};// transport
if(typeof define==="function"&&define.amd){// AMD
define(classie)}else{// browser global
window.classie=classie}})(window)}/**
 * svganimations.js v1.0.0
 * http://www.codrops.com
 *
 * the svg path animation is based on http://24ways.org/2013/animating-vectors-with-svg/ by Brian Suda (@briansuda)
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
$("#maincontainer").on("CONTENT_CHANGED",function(){if($.browser.msie&&$.browser.version==7||$.browser.msie&&$.browser.version==8){}else{(function(){"use strict";var docElem=window.document.documentElement;window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(/* function */callback){window.setTimeout(callback,1e3/100)}}();window.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(id){window.clearTimeout(id)}}();function SVGEl(el){this.el=el;this.image=this.el.previousElementSibling;this.current_frame=0;this.total_frames=125;this.path=new Array;this.length=new Array;this.handle=0;this.init()}SVGEl.prototype.init=function(){var self=this;[].slice.call(this.el.querySelectorAll("path")).forEach(function(path,i){self.path[i]=path;var l=self.path[i].getTotalLength();self.length[i]=l;self.path[i].style.strokeDasharray=l+" "+l;self.path[i].style.strokeDashoffset=l})};SVGEl.prototype.render=function(){if(this.rendered)return;this.rendered=true;this.draw()};SVGEl.prototype.draw=function(){var self=this,progress=this.current_frame/this.total_frames;if(progress>1){window.cancelAnimFrame(this.handle);this.showImage()}else{this.current_frame++;for(var j=0,len=this.path.length;j<len;j++){this.path[j].style.strokeDashoffset=Math.floor(this.length[j]*(1-progress))}this.handle=window.requestAnimFrame(function(){self.draw()})}};SVGEl.prototype.showImage=function(){classie.add(this.image,"show");classie.add(this.el,"hide");setTimeout(function(){$("#header").css("transform","translateY(0)")},1e3)};function getViewportH(){var client=docElem["clientHeight"],inner=window["innerHeight"];if(client<inner)return inner;else return client}function scrollY(){return window.pageYOffset||docElem.scrollTop}// http://stackoverflow.com/a/5598797/989439
function getOffset(el){var offsetTop=0,offsetLeft=0;do{if(!isNaN(el.offsetTop)){offsetTop+=el.offsetTop}if(!isNaN(el.offsetLeft)){offsetLeft+=el.offsetLeft}}while(el=el.offsetParent);return{top:offsetTop,left:offsetLeft}}function inViewport(el,h){var elH=el.offsetHeight,scrolled=scrollY(),viewed=scrolled+getViewportH(),elTop=getOffset(el).top,elBottom=elTop+elH,// if 0, the element is considered in the viewport as soon as it enters.
// if 1, the element is considered in the viewport only when it's fully inside
// value in percentage (1 >= h >= 0)
h=h||0;return elTop+elH*h<=viewed&&elBottom>=scrolled}function init(){var svgs=Array.prototype.slice.call(document.querySelectorAll("#main svg")),svgArr=new Array,didScroll=false,resizeTimeout;// the svgs already shown...
svgs.forEach(function(el,i){var svg=new SVGEl(el);svgArr[i]=svg;setTimeout(function(el){return function(){if(inViewport(el.parentNode)){svg.render()}}}(el),250)});var scrollHandler=function(){if(!didScroll){didScroll=true;setTimeout(function(){scrollPage()},60)}},scrollPage=function(){svgs.forEach(function(el,i){if(inViewport(el.parentNode,.5)){svgArr[i].render()}});didScroll=false},resizeHandler=function(){function delayed(){scrollPage();resizeTimeout=null}if(resizeTimeout){clearTimeout(resizeTimeout)}resizeTimeout=setTimeout(delayed,200)};window.addEventListener("scroll",scrollHandler,false);window.addEventListener("resize",resizeHandler,false);if(typeof autotouring.skrollr.instance!=="undefined"&&autotouring.skrollr.instance!==null){autotouring.skrollr.instance.on("render",scrollHandler,false)}}init()})()}});var autotouring=autotouring||{};/**
 * The Sub Navigation.
 * @param element the form node surrounding the questionnaire form.
 * @param agbArtilceUrl
 * @param isBox boolean determining if its a ContentBox or in article.
 */
autotouring.Questionnaire=function(element,agbArtilceUrl,isBox){var self=this;/**
     * The form node we use as reference.
     */
var node=$(element);/**
     * We save this object in the form node.
     */
node.data("questionnaire",self);/**
     * Shows a message of a given type.
     * @param message the message to show.
     * @param type the type of the message, either 'error' or 'info'
     * @return void
     */
self.showMessage=function(message,type){// for now we dont need the type, maybe we need to add it for styling
node.find(".jsQuestionnaireChoices").removeClass("loading").html(message);node.find(".jsQuestionnaireButtons .buttonsmall").hide();$(".agb-input").parent().remove()};/**
     * Shows a result given by a json.
     * @param json Json representing a result.
     * @return void
     */
self.showResult=function(json){if(isBox){var list=$("<ul></ul>");if(typeof json.questions!=="undefined"){list.append($("<li>"+json.completeUserCount+" Mitspieler.</li>"));list.append($("<li>Du hast "+json.correctAnswerRatio+"% richtig.</li>"));list.append($("<li>Mehr erfährst du auf der Quizseite.</li>"))}else{// show the result
for(var i in json){if(json.length>1){node.find(".questionText").text("");list.append("<li>"+json[i].text+"<span>"+json[i].count+"</span></li>")}else{node.find(".questionText").html(json[i].text+"<span>"+json[i].count+"</span>")}if($.map(json[i].choices,function(n,i){return i}).length>3){list.append($('<li><span class="resulttext">Danke für Deine Stimme!</span></li>'));list.append($('<li><span class="resulttext">Das Ergebnis erfährst Du auf der Umfrageseite.</span></li>'))}else{for(var j in json[i].choices){var choice=json[i].choices[j];list.append($('<li><span class="resulttext">'+choice.text+'</span><div class="resultcontainer"><span class="bar" style="width:'+choice.percentage+'%"><span class="percent">'+choice.percentage+'%</span></span></div><div class="clear"></div></li>'))}}}}node.find(".jsQuestionnaireChoices").replaceWith($('<div class="jsQuestionnaireChoices" />').append(list));node.find(".jsQuestionnaireButtons .buttonsmall").hide()}else{var list=$("<ul></ul>");if(typeof json.questions!=="undefined"){node.find(".jsQuestionnaireText").text("");// quiz
node.find(".jsQuestionnaireChoices").removeClass("loading");node.find(".questioncount").empty().append($('<span class="openbold">Auflösung</span>'));var container=node.find(".questioncontainer");container.empty();var statusText="Sie verfügen über ein solides Grundwissen auf diesem Gebiet. Weiter so!";if(json.correctAnswerRatio>66){statusText="Sehr gut gemacht! Ihnen kann auf diesem Gebiet keiner etwas vormachen."}else if(json.correctAnswerRatio<33){statusText="Da geht noch was. Ihre Fachgebiete liegen offenbar in anderen Bereichen."}container.prepend($('<span class="blockcontent">Sie haben '+json.correctAnswerCount+" von "+json.questionCount+" Fragen richtig beantwortet. "+statusText+"</span>"));var list=$("<ul></ul>");var questionIndex=1;for(var i in json.questions){var listitem=$('<li class="question"><span class="blockletters">Frage '+questionIndex++ +"</span></li>");listitem.append($('<h2 class="">'+json.questions[i].text+"</h2>"));if(typeof json.questions[i].imageUrl!=="undefined"){listitem.append($('<img src="'+json.questions[i].imageUrl+'" alt="'+json.questions[i].text+'" /><span class="questionImageCaption">'+json.questions[i].imageDescription+"</span>"))}var choices=$('<ul class="withimg"></ul>');for(var j in json.questions[i].choices){var cssClass="";var conclusion="";if(json.questions[i].choices[j].userAnswer&&json.questions[i].choices[j].correctAnswer){cssClass="green";conclusion="richtig"}else if(json.questions[i].choices[j].correctAnswer){cssClass="green";conclusion=""}else if(json.questions[i].choices[j].userAnswer&&!json.questions[i].choices[j].correctAnswer){cssClass="red";conclusion="falsch"}var choiceElement=$('<label for="choice-'+j+'" class="'+cssClass+'"></label>');if(conclusion!==""){choiceElement.append($('<span class="conclusion blockletters">'+conclusion+"</span>"))}if(json.questions[i].choices[j].userAnswer){choiceElement.append($('<input name="choices['+i+'][]" type="radio" disabled checked id="choice-'+j+'">'))}else{choiceElement.append($('<input name="choices['+i+'][]" type="radio" disabled id="choice-'+j+'">'))}if(json.questions[i].choices[j].relatedContent){for(var k in json.questions[i].choices[j].relatedContent){var text=json.questions[i].choices[j].text;var imageUrl=json.questions[i].choices[j].relatedContent[k].imageUrl;if(!imageUrl){continue}choiceElement.append($('<span class="answer"><img src="'+imageUrl+'" height="80" alt="'+text+'"/></span>'));break}}else{choiceElement.append($('<span class="answer">'+json.questions[i].choices[j].text+"</span>"))}choiceElement.append($('<div class="clear"></div>'));choices.append($("<li></li>").append(choiceElement))}listitem.append(choices);list.append(listitem)}container.append(list);$(".type_buzzquiz div.questionnaireContainer").addClass("hide");$(".type_buzzquiz hgroup, .type_buzzquiz figure").removeClass("hide")}else if(typeof json.resultcategorytext!=="undefined"){node.find(".questionnaireResultText").removeClass("hide");if(typeof json.imageUrl!=="undefined"){$(".type_buzzquiz .inner figure img").attr("src",json.imageUrl).css({display:"block",margin:"10px 0"});$(".type_buzzquiz .inner figure").addClass("relative");$(".type_buzzquiz .inner figure").append('<span class="buzzfeed-img-copyright">'+json.imageCopyright+"</span>");$(".type_buzzquiz .inner figure").removeClass("hide")}$(".type_buzzquiz hgroup h1").text(json.title);$(".type_buzzquiz hgroup .textsection").html(json.resultcategorytext);$(".type_buzzquiz div.questionnaireContainer").addClass("hide");$(".type_buzzquiz hgroup").removeClass("hide");if(typeof json.color!=="undefined"){$(".quizcontainer").css("background-color",json.color)}}else{// poll
node.find(".jsQuestionnaireChoices").removeClass("loading");for(var i in json){if(json.length>1){node.find(".questionText").text("");list.append("<li>"+json[i].text+"<span>"+json[i].count+"</span></li>")}else{node.find(".questionText").html(json[i].text+"<span>"+json[i].count+"</span>")}for(var j in json[i].choices){var choice=json[i].choices[j];list.append($('<li><span class="resulttext block">'+choice.text+'</span><div class="resultcontainer"><span class="percent">'+choice.percentage+'%</span><span class="percentdivider"></span><span class="bar" style="width:'+Math.round(choice.percentage)+'%"></span></div><div class="clear"></div></li>'))}}}node.find(".jsQuestionnaireChoices").empty().append(list);node.find(".jsQuestionnaireButtons .buttonsmall").hide()}};/**
     * Shows a question given by a json.
     * @param json Json representing a question.
     * @return void
     */
self.showQuestion=function(json){var list=$("<ul></ul>");node.attr("action",json.action);$userReference=node.find("input[name=userReference]");if($userReference.length===0){$userReference=$('<input type="hidden" name="userReference" value="'+json.userReference+'">')}node.append($userReference);if(isBox){node.find(".questionText").html(json.text);for(var i in json.choices){var label=$('<label for="choice-'+i+'"></label>');label.append($('<input name="choice[]" type="radio" value="'+i+'" id="choice-'+i+'">'));label.append($('<span class="blockcontent">'+json.choices[i].text+'</span><span class="clear"></span>'));list.append($("<li></li>").append(label))}}else{// new question
node.find(".jsQuestionnaireText").html(json.text);node.find(".buzzfeed-question-sub-text").removeClass("hide");node.find(".jsQuestionIndex").text(json.index+1);node.find(".bullets .bullet").removeClass("active").eq(json.index).addClass("active");if(typeof json.imageUrl!=="undefined"){node.find(".questionImageContainer .questionImage").attr({src:json.imageUrl,alt:json.text,style:""}).removeClass("hide");node.find(".buzzfeed-img-copyright").removeClass("hide");node.find(".questionImageContainer .questionImageCaption").text(json.imageDescription);if(typeof json.imageCopyright!=="undefined"&&json.imageCopyright!=null){if(json.questionnaire.type===5){node.find(".buzzfeed-textimage .buzzfeed-img-copyright").text(json.imageCopyright)}if(json.imageDescription.length!==0){node.find(".questionImageContainer .questionImageCopyright").text(" - "+json.imageCopyright)}else{node.find(".questionImageContainer .questionImageCopyright").text(json.imageCopyright)}}if(typeof json.imageCopyrightUri!=="undefined"&&json.imageCopyrightUri!=null){if(json.imageCopyright.length!==0){node.find(".questionImageContainer .questionImageCopyrightUri").text(" - "+json.imageCopyrightUri)}else{node.find(".questionImageContainer .questionImageCopyrightUri").text(json.imageCopyrightUri)}}}else{node.find(".buzzfeed-question-sub-text").addClass("hide");node.find(".buzzfeed-img-copyright").addClass("hide");node.find(".questionImageContainer .questionImage").addClass("hide")}for(var i in json.choices){var labelContent;if(json.choices[i].relatedContent){for(var j in json.choices[i].relatedContent){if(json.questionnaire.type===5){labelContent='<span class="answer down">'+json.choices[i].text+"</span>";labelContent+='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+json.choices[i].text+'" /><span class="buzzfeed-img-copyright">'+json.choices[i].relatedContent[j].imageCopyright+"</span>"}else if(json.questionnaire.styleSheet){labelContent='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" width="195" height="137" alt="'+json.choices[i].text+'" />'}else{labelContent='<img src="'+json.choices[i].relatedContent[j].imageUrl+'" height="80" alt="'+json.choices[i].text+'" />'}break}}else{labelContent=json.choices[i].text}var label=$('<label for="choice-'+i+'"></label>');label.append($('<input name="choice[]" type="radio" value="'+i+'" id="choice-'+i+'">'));if(json.questionnaire.styleSheet&&json.choices[i].relatedContent){for(var j in json.choices[i].relatedContent){if(json.choices[i].relatedContent[j].imageUrl!=null){label.append($('<span class="answer down">'+json.choices[i].text+'</span><span class="clear"></span>'+labelContent));label.addClass("block")}}}else{label.append($('<span class="answer">'+labelContent+'</span><span class="clear"></span>'))}if(json.questionnaire.styleSheet){list.append($('<li style="background-color: '+json.questionnaire.styleSheet+';"></li>').append(label))}else{list.append($("<li></li>").append(label))}}if(typeof json.uploadAction!=="undefined"){var label=$('<iframe height="75" width="400" src="'+json.uploadAction+'" border="0" frameborder="0" allowTransparency="true"></iframe>');list.append($("<li></li>").append(label))}if(json.freeTextAllowed){var label=$('<label for="question-'+json.id+'-freechoice"></label>');label.append($('<input name="choice[]" type="text" id="question-'+json.id+'-freechoice">'));list.append($("<li></li>").append(label))}if(json.last===true){var input=$('<input name="agb" type="checkbox" id="agb-'+json.id+'"><label for="agb-'+json.id+'">Akzeptieren Sie <a href="'+agbArtilceUrl+'" target="_blank"> die Teilnahmebedingungen </a> um an dem Gewinnspiel teilnehmen zu können.</label>');list.append($('<li class="wrap-accept-agb" style="opacity:1 !important"><div class="agb-feedback"  > Dieses Feld muss ausgefüllt werden. </div></li>').append(input))}}node.find(".jsQuestionnaireChoices").replaceWith($('<div class="jsQuestionnaireChoices" />').append(list));var inputs=node.find("input");self.buttonControl(inputs);node.find(".jsQuestionnaireButtons").addClass("buttonsmall-inactive")};self.buttonControl=function(inputs){node.find(".jsQuestionnaireButtons").show();if(inputs.length==0){var txtArea=node.find("textarea");var upload_iFrame=node.find("iframe");if(txtArea){for(var i=0,len=txtArea.length;i<len;i++){$(txtArea[i]).bind("keydown",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("keydown")})}}if(upload_iFrame){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive")}}else{for(var i=0,len=inputs.length;i<len;i++){var inputType=inputs[i].type;if(inputType=="radio"){$(inputs[i]).bind("change",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("change")})}else if(inputType=="text"){$(inputs[i]).bind("keydown",function(){node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive");$(this).unbind("keydown")})}else{node.find(".jsQuestionnaireButtons").removeClass("buttonsmall-inactive")}}}if($(".type_buzzquiz div.questionnaireContainer")){node.find('input[type="radio"]').click(function(){$(".jsQuestionnaireChoices ul li").css("opacity",.5);$(this).closest("li").css("opacity",1)})}};/**
     * Constructor.
     */
(function(){var inputs=node.find("input");self.buttonControl(inputs);node.find("a.login").on("click",function(evt){var $login=$(".topmenus .minimenu .symbol.login");if($login){$login.click()}return false});node.find(".submitButton").on("click",function(){//check if one radio button is checked
var $agbInputNode=node.find("input[name=agb]");var $agbFeedbackNode=node.find(".agb-feedback");$agbFeedbackNode.hide();var input=node.find("input");var checked=false;if(input.length==0){var txtArea=node.find("textarea");if(txtArea){for(var i=0,len=txtArea.length;i<len;i++){if(txtArea[0].value!=""){checked=true;break}}}}else{for(var i=0,len=input.length;i<len;i++){if(input[i].type=="radio"){if(input[i].checked==true){checked=true;break}}else if(input[i].type=="text"){if(input[i].value!=""){checked=true;break}}else if(input[i].type=="file"){if(input[i].value!=""){checked=true;break}}}}if(!checked){return false}if($agbInputNode.length){if(!$agbInputNode.prop("checked")){// agb input
$agbFeedbackNode.show();return false}}node.find(".jsQuestionnaireButtons").hide();node.find(".jsQuestionnaireButtons").addClass("buttonsmall-inactive");// so we can be sure that its a json object.
var url=node.attr("action");var data=node.serialize();if(data.length==0){return false}node.find(".jsQuestionnaireChoices").addClass("loading").html("");//reloadOewa('umfrageclick');
$.ajax({url:url,type:"POST",data:data,dataType:"JSON",success:function(data,textStatus,jqXHR){if(typeof data.error!=="undefined"){self.showMessage(data.error.message,"error")}else if(typeof data.message!=="undefined"){node.find(".wrap-accept-agb").remove();self.showMessage(data.message,"info")}else if(typeof data.result!=="undefined"){self.showResult(data.result)}else if(typeof data.question!=="undefined"){self.showQuestion(data.question)}}});return false});node.find(".freeTextChoice").keypress(function(event){if(event.which===13){node.find(".submitButton").focus().click();return false}});// show result if user already voted
if(node.data("questionnaire-type")=="1"){// only for poll
var url=node.data("result-url");$.ajax({url:url,type:"GET",dataType:"JSON",success:function(data,textStatus,jqXHR){if(typeof data.error!=="undefined"){self.showMessage(data.error.message,"error")}else if(typeof data.message!=="undefined"){self.showMessage(data.message,"info")}else if(typeof data.result!=="undefined"){self.showResult(data.result)}}})}})()};var autotouring=autotouring||{};autotouring.header=function(){var self=this;/**
     * Constructor;
     */
(function(){self.bodyNode=$("#at-body")[0];self.mainNode=$("#maincontainer");self.footerNode=$("#page-footer");self.smallHeaderNode=$("#fixed-page-header");self.smallMenuNode=$("#small-header-menu");self.smallNavNode=$("#style-elements-small-header");self.smallHeaderUserIconTrigger=$("#small-header-userstate");self.scrollable=self.smallNavNode;self.smallHeaderUserIconTrigger=$("#small-header-userstate");self.isIOSDevice=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;self.scrollingDisabled=false;self.smallMenuClickHandler=function(){self.smallMenuNode.toggleClass("active");self.smallNavNode.toggleClass("active");self.smallHeaderUserIconTrigger.toggleClass("menu-closed");var width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(width<767){if(smallMenuNode.hasClass("active")){self.bodyNode.style.overflow="hidden"}else{self.bodyNode.style.overflow="visible"}}else{self.bodyNode.style.overflow="visible"}if(self.isIOSDevice){if(self.smallMenuNode.hasClass("active")){self.absolute();self.disableScrolling()}else{self.fixed();self.enableScrolling()}}function menuOuterClick(e){var isClickInside=self.smallNavNode.contains(e.target);var isTrigger=self.smallMenuNode.contains(e.target);if(!isClickInside&&!isTrigger){self.smallMenuNode.removeClass("active");self.smallNavNode.removeClass("active");self.enableScrolling();self.fixed();document.activeElement.blur();document.removeEventListener("touchend",menuOuterClick)}}document.addEventListener("touchend",menuOuterClick)};self.absolute=function(){if(navigator.userAgent.match(/iPhone/i)){self.mainNode.addClass("main-hidden");self.footerNode.addClass("main-hidden")}else{self.smallHeaderNode.style.position="absolute";self.smallHeaderNode.style.top=window.scrollY+"px"}};self.fixed=function(){if(navigator.userAgent.match(/iPhone/i)){self.mainNode.removeClass("main-hidden");self.footerNode.removeClass("main-hidden")}else{self.smallHeaderNode.style.position="fixed";self.smallHeaderNode.style.top="0"}};self.disableScrolling=function(){self.scrollingDisabled=true};self.enableScrolling=function(){self.scrollingDisabled=false};self.smallMenuNode.on("click",function(){self.smallMenuClickHandler()});self.smallHeaderUserIconTrigger.on("click",function(){self.smallMenuClickHandler()})})()};var header=new autotouring.header;var autotouring=autotouring||{};autotouring.user=function(){var self=this;var host=window.location.host;/**
     * Constructor;
     */
(function(){// define the urls and variables we need
self.extUserUrl="https://"+host+"/selfservice/ext/user";self.extUserCallback="callbackUM";self.extLoginUrl="https://"+host+"/selfservice/ext/v2/login";self.extLogoutUrl="https://"+host+"/selfservice/ext/logout";self.sessionData=undefined;self.sessionLoaded=false;self.loggedin=false;/**
         * Override for .on('session-loaded', callback) to be able to call
         * the callback right away when session is already loaded.
         * @param callback
         */
self.onSessionLoadedfunction=function(callback){if(self.sessionLoaded){callback(self.sessionData);return}document.on(autotouring.events.SESSION_LOADED,callback)};/**
         * Callback for the jsonp request to load the session.
         * @param response
         */
self.sessionLoadCallback=function(response){self.sessionLoaded=true;if(response.email||response.firstname||response.lastname){self.sessionData=response;$(document).trigger(autotouring.events.SESSION_LOADED,response)}else{self.sessionData={};$(document).trigger(autotouring.events.LOGGED_OUT,{})}};/**
         * Including a jsonp URL that returns session data for the logged in user.
         */
self.checkLogin=function(){self.sessionData=undefined;self.sessionLoaded=false;var s=document.createElement("script");s.setAttribute("src",self.extUserUrl+"?callback="+self.extUserCallback);document.body.appendChild(s);window.callbackUM=function(response){self.sessionLoadCallback(response);delete window.callbackUM}};self.login=function(username,password,rememberMe){var url=self.extLoginUrl;var parameters={rememberMe:"false"};if(rememberMe){parameters.rememberMe="true"}url=self.addGetParameters(url,parameters);$.ajax({url:url,method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Basic "+Base64.toBase64(username+":"+password)},success:function(response){self.sessionData=response;$(document).trigger(autotouring.events.SESSION_LOADED,response);self.loggedin=true},error:function(){$(document).trigger(autotouring.events.LOGIN_ERROR,{})}})};self.addGetParameters=function(url,parameters){if(typeof parameters==="undefined"){return url}var sanitizedParameters=[];for(var i in parameters){sanitizedParameters.push(encodeURI(i)+"="+encodeURI(parameters[i]))}var glue="?";if(url.indexOf("?")>=0){glue="&"}return url+glue+sanitizedParameters.join("&")};self.logout=function(){$.ajax({url:self.extLogoutUrl,success:function(){self.sessionData={};$(document).trigger(autotouring.events.LOGGED_OUT,{});self.loggedin=false;if($("#login-form__login-email-small")[0]){$("#login-form__login-email-small").val("")}if($("#login-form__login-password-small")[0]){$("#login-form__login-password-small").val("")}},error:function(){$(document).trigger(autotouring.events.LOGGED_OUT,{})}})};self.loggedIn=function(){return self.loggedin};self.isMember=function(){return self.loggedIn()&&self.sessionData["isMember"]}})()};var user=new autotouring.user;user.checkLogin();var autotouring=autotouring||{};autotouring.loginForm=function(){var self=this;/**
     * Constructor;
     */
(function(){self.smallHeaderNode=$("#fixed-page-header");self.smallLoginNode=$("#login-form-small");self.smallButtonNode=self.smallLoginNode.find(".login-form-trigger");self.navNodeSmall=self.smallHeaderNode.find(".myoeamtc-nav");self.userNavigationNodeSmall=self.smallHeaderNode.find("#usernavigation-small");self.logoutButtonNodeSmall=self.smallHeaderNode.find(".usernavigation__logout");self.smallHeaderUserIconTrigger=$("#small-header-userstate");self.smallLoginNode.on("keypress",function(event){if(event.keyCode=="13"){self.smallButtonNode.trigger("click")}});self.logoutButtonNodeSmall.on("click",function(){user.logout()});self.smallButtonNode.on("click",function(){self.submitLoginForm()});/* handler for session-loaded on page load */
$(document).on(autotouring.events.SESSION_LOADED,function(event,response){user.loggedin=true;//console.log('session-loaded', response);
if(response){self.showLoggedinState(response)}$(".read-later").removeClass("user-is-guest");if(typeof comments!=="undefined"){comments.triggerLoggedIn()}$(".quizcontainer .loginNotice").hide();$(".quizcontainer .questionnaireContainer").show()});$(document).on(autotouring.events.LOGGED_OUT,function(event,response){// console.log('logged-out', response);
self.hideLoggedinState();$(".read-later").addClass("user-is-guest");if(typeof comments!=="undefined"){comments.triggerLoggedOut()}$(".quizcontainer .loginNotice").show();$(".quizcontainer .questionnaireContainer").hide()});$(document).on(autotouring.events.LOGIN_ERROR,function(){self.smallLoginNode.addClass("login-form--error")});self.submitLoginForm=function(){self.smallLoginNode.removeClass("login-form--error");var postfix="-small";var node=self.smallLoginNode;var username=node.find("#login-form__login-email"+postfix).val();var password=node.find("#login-form__login-password"+postfix).val();var stayloggedin=node.find("#login-form__login-stayloggedin"+postfix).val();user.login(username,password,stayloggedin)};self.showLoggedinState=function(userdata){self.smallHeaderNode.find(".myoeamtc-nav__user-name-small").text("Willkommen "+userdata.firstname+" "+userdata.lastname);self.navNodeSmall.addClass("logged-in");self.smallHeaderUserIconTrigger.find(".small-header-userstate-flyout__text-username").text(userdata.firstname+" "+userdata.lastname);self.smallHeaderUserIconTrigger.addClass("small-header-userstate--logged-in")};self.hideLoggedinState=function(){self.navNodeSmall.removeClass("logged-in");self.smallHeaderUserIconTrigger.find(".small-header-userstate-flyout__text-username").text("");self.smallHeaderUserIconTrigger.removeClass("small-header-userstate--logged-in")};function showUserNavigationSmall(self){dispatcher.trigger("exclusive-ui-opened",self.navNodeSmall);self.userNavigationNodeSmall.addClass("active")}function hideUserNavigationSmall(self){self.userNavigationNodeSmall.removeClass("active")}})()};new autotouring.loginForm;/*!
   JW Player version 8.2.4
   Copyright (c) 2018, JW Player, All Rights Reserved
   This source code and its use and distribution is subject to the terms
   and conditions of the applicable license agreement.
   https://www.jwplayer.com/tos/
   This product includes portions of other software. For the full text of licenses, see
   https://ssl.p.jwpcdn.com/player/v/8.2.4/notice.txt
*/
window.jwplayer=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n=window.webpackJsonpjwplayer;window.webpackJsonpjwplayer=function(t,r,o){for(var a,u,c=0,s=[];c<t.length;c++)u=t[c],i[u]&&s.push(i[u][0]),i[u]=0;for(a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);for(n&&n(t,r,o);s.length;)s.shift()()};var r={},i={16:0};return t.e=function(e){function n(){u.onerror=u.onload=null,clearTimeout(c);var t=i[e];0!==t&&(t&&t[1](new Error("Loading chunk "+e+" failed.")),i[e]=void 0)}var r=i[e];if(0===r)return new Promise(function(e){e()});if(r)return r[2];var o=new Promise(function(t,n){r=i[e]=[t,n]});r[2]=o;var a=document.getElementsByTagName("head")[0],u=document.createElement("script");u.type="text/javascript",u.charset="utf-8",u.async=!0,u.timeout=35e3,t.nc&&u.setAttribute("nonce",t.nc),u.src=t.p+""+({0:"jwplayer.core.controls.polyfills.html5",1:"jwplayer.core.controls.html5",2:"jwplayer.core.controls.polyfills",3:"jwplayer.core.controls",4:"jwplayer.controls",5:"provider.shaka",6:"provider.hlsjs",7:"jwplayer.core",8:"provider.html5",9:"provider.flash",10:"polyfills.intersection-observer",11:"provider.cast",12:"jwplayer.vr",13:"vttparser",14:"provider.airplay",15:"polyfills.webvtt"}[e]||e)+".js";var c=setTimeout(n,35e3);return u.onerror=u.onload=n,a.appendChild(u),o},t.m=e,t.c=r,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t.oe=function(e){throw console.error(e),e},t(t.s=55)}([function(e,t,n){"use strict";n.d(t,"a",function(){return P}),n.d(t,"b",function(){return T});var r=n(21),i={},o=Array.prototype,a=Object.prototype,u=Function.prototype,c=o.slice,s=o.concat,l=a.toString,f=a.hasOwnProperty,d=o.map,p=o.reduce,v=o.forEach,h=o.filter,m=o.every,g=o.some,y=o.indexOf,b=Array.isArray,w=Object.keys,j=u.bind,O=function e(t){return t instanceof e?t:this instanceof e?void 0:new e(t)},k=O.each=O.forEach=function(e,t,n){var r,o;if(null==e)return e;if(v&&e.forEach===v)e.forEach(t,n);else if(e.length===+e.length){for(r=0,o=e.length;r<o;r++)if(t.call(n,e[r],r,e)===i)return}else{var a=O.keys(e);for(r=0,o=a.length;r<o;r++)if(t.call(n,e[a[r]],a[r],e)===i)return}return e};O.map=O.collect=function(e,t,n){var r=[];return null==e?r:d&&e.map===d?e.map(t,n):(k(e,function(e,i,o){r.push(t.call(n,e,i,o))}),r)};O.reduce=O.foldl=O.inject=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return r&&(t=O.bind(t,r)),i?e.reduce(t,n):e.reduce(t);if(k(e,function(e,o,a){i?n=t.call(r,n,e,o,a):(n=e,i=!0)}),!i)throw new TypeError("Reduce of empty array with no initial value");return n},O.find=O.detect=function(e,t,n){var r;return C(e,function(e,i,o){if(t.call(n,e,i,o))return r=e,!0}),r},O.filter=O.select=function(e,t,n){var r=[];return null==e?r:h&&e.filter===h?e.filter(t,n):(k(e,function(e,i,o){t.call(n,e,i,o)&&r.push(e)}),r)},O.reject=function(e,t,n){return O.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},O.compact=function(e){return O.filter(e,O.identity)},O.every=O.all=function(e,t,n){t||(t=O.identity);var r=!0;return null==e?r:m&&e.every===m?e.every(t,n):(k(e,function(e,o,a){if(!(r=r&&t.call(n,e,o,a)))return i}),!!r)};var C=O.some=O.any=function(e,t,n){t||(t=O.identity);var r=!1;return null==e?r:g&&e.some===g?e.some(t,n):(k(e,function(e,o,a){if(r||(r=t.call(n,e,o,a)))return i}),!!r)};O.size=function(e){return null==e?0:e.length===+e.length?e.length:O.keys(e).length},O.last=function(e,t,n){if(null!=e)return null==t||n?e[e.length-1]:c.call(e,Math.max(e.length-t,0))},O.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},O.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}};var x=function(e){return null==e?O.identity:O.isFunction(e)?e:O.property(e)},E=function(e){return function(t,n,r){var i={};return n=x(n),k(t,function(o,a){var u=n.call(r,o,a,t);e(i,u,o)}),i}};O.groupBy=E(function(e,t,n){O.has(e,t)?e[t].push(n):e[t]=[n]}),O.indexBy=E(function(e,t,n){e[t]=n}),O.sortedIndex=function(e,t,n,r){n=x(n);for(var i=n.call(r,t),o=0,a=e.length;o<a;){var u=o+a>>>1;n.call(r,e[u])<i?o=u+1:a=u}return o},O.contains=O.include=function(e,t){return null!=e&&(e.length!==+e.length&&(e=O.values(e)),O.indexOf(e,t)>=0)},O.pluck=function(e,t){return O.map(e,O.property(t))},O.where=function(e,t){return O.filter(e,O.matches(t))},O.findWhere=function(e,t){return O.find(e,O.matches(t))},O.max=function(e,t,n){if(!t&&O.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);var r=-1/0,i=-1/0;return k(e,function(e,o,a){var u=t?t.call(n,e,o,a):e;u>i&&(r=e,i=u)}),r},O.difference=function(e){var t=s.apply(o,c.call(arguments,1));return O.filter(e,function(e){return!O.contains(t,e)})},O.without=function(e){return O.difference(e,c.call(arguments,1))},O.indexOf=function(e,t,n){if(null==e)return-1;var r=0,i=e.length;if(n){if("number"!=typeof n)return r=O.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1};var S=function(){};O.bind=function(e,t){var n,r;if(j&&e.bind===j)return j.apply(e,c.call(arguments,1));if(!O.isFunction(e))throw new TypeError;return n=c.call(arguments,2),r=function(){if(!(this instanceof r))return e.apply(t,n.concat(c.call(arguments)));S.prototype=e.prototype;var i=new S;S.prototype=null;var o=e.apply(i,n.concat(c.call(arguments)));return Object(o)===o?o:i}},O.partial=function(e){var t=c.call(arguments,1);return function(){for(var n=0,r=t.slice(),i=0,o=r.length;i<o;i++)r[i]===O&&(r[i]=arguments[n++]);for(;n<arguments.length;)r.push(arguments[n++]);return e.apply(this,r)}},O.once=O.partial(O.before,2),O.memoize=function(e,t){var n={};return t||(t=O.identity),function(){var r=t.apply(this,arguments);return O.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},O.delay=function(e,t){var n=c.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},O.defer=function(e){return O.delay.apply(O,[e,1].concat(c.call(arguments,1)))},O.throttle=function(e,t,n){var i,o,a,u=null,c=0;n||(n={});var s=function(){c=!1===n.leading?0:Object(r.a)(),u=null,a=e.apply(i,o),i=o=null};return function(){c||!1!==n.leading||(c=r.a);var l=t-(r.a-c);return i=this,o=arguments,l<=0?(clearTimeout(u),u=null,c=r.a,a=e.apply(i,o),i=o=null):u||!1===n.trailing||(u=setTimeout(s,l)),a}},O.keys=function(e){if(!O.isObject(e))return[];if(w)return w(e);var t=[];for(var n in e)O.has(e,n)&&t.push(n);return t},O.invert=function(e){for(var t={},n=O.keys(e),r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},O.defaults=function(e){return k(c.call(arguments,1),function(t){if(t)for(var n in t)void 0===e[n]&&(e[n]=t[n])}),e},O.extend=function(e){return k(c.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},O.pick=function(e){var t={},n=s.apply(o,c.call(arguments,1));return k(n,function(n){n in e&&(t[n]=e[n])}),t},O.omit=function(e){var t={},n=s.apply(o,c.call(arguments,1));for(var r in e)O.contains(n,r)||(t[r]=e[r]);return t},O.clone=function(e){return O.isObject(e)?O.isArray(e)?e.slice():O.extend({},e):e},O.isArray=b||function(e){return"[object Array]"==l.call(e)},O.isObject=function(e){return e===Object(e)},k(["Function","String","Number","Date","RegExp"],function(e){O["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),O.isFunction=function(e){return"function"==typeof e},O.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))};var P=O.isNaN=function(e){return O.isNumber(e)&&e!=+e};O.isBoolean=function(e){return!0===e||!1===e||"[object Boolean]"==l.call(e)},O.isNull=function(e){return null===e},O.isUndefined=function(e){return void 0===e},O.has=function(e,t){return f.call(e,t)},O.identity=function(e){return e},O.constant=function(e){return function(){return e}},O.property=function(e){return function(t){return t[e]}},O.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},O.matches=function(e){return function(t){if(t===e)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0}},O.now=r.a,O.result=function(e,t){if(null!=e){var n=e[t];return O.isFunction(n)?n.call(e):n}};var T=O.isNumber;t.c=O},function(e,t,n){"use strict";function r(){}function i(e,t){return function(){e.apply(t,arguments)}}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(e,this)}function a(e,t){for(;3===e._state;)e=e._value;if(0===e._state)return void e._deferreds.push(t);e._handled=!0,o._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?u:c)(t.promise,e._value);var r;try{r=n(e._value)}catch(e){return void c(t.promise,e)}u(t.promise,r)})}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return void f(i(n,t),e)}e._state=1,e._value=t,s(e)}catch(t){c(e,t)}}function c(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function l(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function f(e,t){var n=!1;try{e(function(e){n||(n=!0,u(t,e))},function(e){n||(n=!0,c(t,e))})}catch(e){if(n)return;n=!0,c(t,e)}}var d=setTimeout;o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=new this.constructor(r);return a(this,new l(e,t,n)),n},o.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})},o.all=function(e){return new o(function(t,n){function r(e,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,function(t){r(e,t)},n)}i[e]=a,0==--o&&t(i)}catch(e){n(e)}}if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var o=i.length,a=0;a<i.length;a++)r(a,i[a])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(e){return new o(function(t,n){n(e)})},o.race=function(e){return new o(function(t,n){for(var r=0,i=e.length;r<i;r++)e[r].then(t,n)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){d(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var p=o;n.d(t,"b",function(){return h});var v=window.Promise||(window.Promise=p),h=v.resolve();t.a=v},function(e,t,n){"use strict";function r(e){return e.replace(/^\s+|\s+$/g,"")}function i(e,t,n){for(e=""+e,n=n||"0";e.length<t;)e=n+e;return e}function o(e,t){for(var n=0;n<e.attributes.length;n++)if(e.attributes[n].name&&e.attributes[n].name.toLowerCase()===t.toLowerCase())return e.attributes[n].value.toString();return""}function a(e){return/[(,]format=m3u8-/i.test(e)?"m3u8":!!/[(,]format=mpd-/i.test(e)&&"mpd"}function u(e){if(!e||"rtmp"===e.substr(0,4))return"";var t=a(e);return t||(e=e.split("?")[0].split("#")[0],e.lastIndexOf(".")>-1?e.substr(e.lastIndexOf(".")+1,e.length).toLowerCase():void 0)}function c(e){var t=parseInt(e/3600),n=parseInt(e/60)%60,r=e%60;return i(t,2)+":"+i(n,2)+":"+i(r.toFixed(3),6)}function s(e,t){if(!e)return 0;if(p.c.isNumber(e)&&!p.c.isNaN(e))return e;e=e.replace(",",".");var n=e.split(":"),r=n.length,i=0;if("s"===e.slice(-1))i=parseFloat(e);else if("m"===e.slice(-1))i=60*parseFloat(e);else if("h"===e.slice(-1))i=3600*parseFloat(e);else if(r>1){var o=r-1;4===r&&(t&&(i=parseFloat(n[o])/t),o-=1),i+=parseFloat(n[o]),i+=60*parseFloat(n[o-1]),r>=3&&(i+=3600*parseFloat(n[o-2]))}else i=parseFloat(e);return p.c.isNaN(i)?0:i}function l(e,t,n){if(p.c.isString(e)&&"%"===e.slice(-1)){var r=parseFloat(e);return!t||isNaN(t)||isNaN(r)?null:t*r/100}return s(e,n)}function f(e,t){return p.c.map(e,function(e){return t+e})}function d(e,t){return p.c.map(e,function(e){return e+t})}t.h=r,t.d=i,t.i=o,t.a=u,t.b=c,t.f=s,t.c=l,t.e=f,t.g=d;var p=n(0)},,,function(e,t,n){"use strict";n.d(t,"_3",function(){return r}),n.d(t,"_6",function(){return i}),n.d(t,"_4",function(){return o}),n.d(t,"_8",function(){return a}),n.d(t,"_9",function(){return u}),n.d(t,"_5",function(){return c}),n.d(t,"_7",function(){return s}),n.d(t,"_10",function(){return l}),n.d(t,"n",function(){return f}),n.d(t,"p",function(){return d}),n.d(t,"o",function(){return p}),n.d(t,"i",function(){return v}),n.d(t,"l",function(){return h}),n.d(t,"_11",function(){return m}),n.d(t,"m",function(){return g}),n.d(t,"S",function(){return y}),n.d(t,"P",function(){return b}),n.d(t,"q",function(){return w}),n.d(t,"R",function(){return j}),n.d(t,"r",function(){return O}),n.d(t,"a",function(){return k}),n.d(t,"d",function(){return C}),n.d(t,"z",function(){return x}),n.d(t,"_0",function(){return E}),n.d(t,"J",function(){return S}),n.d(t,"w",function(){return P}),n.d(t,"v",function(){return T}),n.d(t,"y",function(){return _}),n.d(t,"k",function(){return N}),n.d(t,"V",function(){return L}),n.d(t,"h",function(){return A}),n.d(t,"A",function(){return M}),n.d(t,"B",function(){return F}),n.d(t,"G",function(){return I}),n.d(t,"H",function(){return R}),n.d(t,"K",function(){return B}),n.d(t,"_2",function(){return D}),n.d(t,"U",function(){return q}),n.d(t,"x",function(){return X}),n.d(t,"L",function(){return Q}),n.d(t,"I",function(){return z}),n.d(t,"M",function(){return V}),n.d(t,"O",function(){return W}),n.d(t,"F",function(){return H}),n.d(t,"E",function(){return U}),n.d(t,"C",function(){return J}),n.d(t,"D",function(){return $}),n.d(t,"N",function(){return K}),n.d(t,"j",function(){return Y}),n.d(t,"s",function(){return G}),n.d(t,"_1",function(){return Z}),n.d(t,"W",function(){return ee}),n.d(t,"X",function(){return te}),n.d(t,"b",function(){return ne}),n.d(t,"c",function(){return re}),n.d(t,"T",function(){return ie}),n.d(t,"u",function(){return oe}),n.d(t,"g",function(){return ae}),n.d(t,"f",function(){return ue}),n.d(t,"Y",function(){return ce}),n.d(t,"Z",function(){return se}),n.d(t,"_12",function(){return le}),n.d(t,"t",function(){return fe}),n.d(t,"e",function(){return de}),n.d(t,"Q",function(){return pe});var r="buffering",i="idle",o="complete",a="paused",u="playing",c="error",s="loading",l="stalled",f="drag",d="dragStart",p="dragEnd",v="click",h="doubleClick",m="tap",g="doubleTap",y="over",b="move",w="enter",j="out",O=c,k="adSkipped",C="autostartNotAllowed",x=o,E="ready",S="seek",P="beforePlay",T="beforeComplete",_="bufferFull",N="displayClick",L="playlistComplete",A="cast",M="mediaError",F="firstFrame",I="playAttempt",R="playAttemptFailed",B="seeked",D="setupError",q="state",X="bufferChange",Q="time",z="ratechange",V="mediaType",W="volume",H="mute",U="meta",J="levels",$="levelsChanged",K="visualQuality",Y="controls",G="fullscreen",Z="resize",ee="playlistItem",te="playlist",ne="audioTracks",re="audioTrackChanged",ie="playbackRateChanged",oe="logoClick",ae="captionsList",ue="captionsChanged",ce="providerChanged",se="providerFirstFrame",le="userAction",fe="instreamClick",de="breakpoint",pe="fullscreenchange"},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(l.a.debug)return e.apply(t||this,n);try{return e.apply(t||this,n)}catch(t){return new i(e.name,t)}}function i(e,t){this.name=e,this.message=t.message||t.toString(),this.error=t}var o=n(17),a=n(14),u=n(11),c=n(2),s=n(23),l=n(16),f=n(0),d=n(31),p=n(26),v=n(27),h=n(53);n.d(t,"b",function(){return g});var m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g="function"==typeof console.log?console.log.bind(console):function(){},y=function(e,t,n){return Math.max(Math.min(e,n),t)},b=function(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])},w=f.c.indexOf,j=function(){},O=m({},u,a,o,{addClass:p.a,hasClass:p.h,removeClass:p.j,replaceClass:p.k,toggleClass:p.m,classList:p.d,styleDimension:p.l,createElement:p.e,emptyElement:p.g,addStyleSheet:p.b,bounds:p.c,css:v.b,clearCss:v.a,style:v.d,transform:v.e,getRgba:v.c,ajax:h.a,crossdomain:h.b,tryCatch:r,Error:i,Timer:s.a,log:g,between:y,foreach:b,flashVersion:d.a,isIframe:d.m,indexOf:w,trim:c.h,pad:c.d,extension:c.a,hms:c.b,seconds:c.f,prefix:c.e,suffix:c.g,noop:j});t.a=O},function(e,t,n){"use strict";function r(e,t,n){if(!c(this,"on",e,[t,n])||!t)return this;var r=this._events||(this._events={});return(r[e]||(r[e]=[])).push({callback:t,context:n}),this}function i(e,t,n){if(!c(this,"once",e,[t,n])||!t)return this;var r=0,i=this,o=function n(){r++||(i.off(e,n),t.apply(this,arguments))};return o._callback=t,this.on(e,o,n)}function o(e,t,n){if(!this._events||!c(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return delete this._events,this;for(var r=e?[e]:Object.keys(this._events),i=0,o=r.length;i<o;i++){e=r[i];var a=this._events[e];if(a){var u=this._events[e]=[];if(t||n)for(var s=0,l=a.length;s<l;s++){var f=a[s];(t&&t!==f.callback&&t!==f.callback._callback||n&&n!==f.context)&&u.push(f)}u.length||delete this._events[e]}}return this}function a(e){if(!this._events)return this;var t=f.call(arguments,1);if(!c(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&s(n,t,this),r&&s(r,arguments,this),this}function u(e){if(!this._events)return this;var t=f.call(arguments,1);if(!c(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&s(n,t,this,e),r&&s(r,arguments,this,e),this}function c(e,t,n,r){if(!n)return!0;if("object"===(void 0===n?"undefined":l(n))){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e[t].apply(e,[i,n[i]].concat(r));return!1}if(d.test(n)){for(var o=n.split(d),a=0,u=o.length;a<u;a++)e[t].apply(e,[o[a]].concat(r));return!1}return!0}function s(e,t,n,r){for(var i=-1,o=e.length;++i<o;){var a=e[i];if(r)try{a.callback.apply(a.context||n,t)}catch(e){console.log('Error in "'+r+'" event handler:',e)}else a.callback.apply(a.context||n,t)}}t.c=r,t.d=i,t.b=o,t.e=a,t.f=u;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=[].slice,d=/\s+/;t.a={on:r,once:i,off:o,trigger:a}},function(e,t,n){"use strict";function r(e,t){var n=void 0,r=void 0,i=void 0,o=void 0;return e.chrome?n=-1!==t.indexOf("Chrome")?t.substring(t.indexOf("Chrome")+7):t.substring(t.indexOf("CriOS")+6):e.safari?n=t.substring(t.indexOf("Version")+8):e.firefox?n=t.substring(t.indexOf("Firefox")+8):e.edge?n=t.substring(t.indexOf("Edge")+5):e.ie&&(-1!==t.indexOf("rv:")?n=t.substring(t.indexOf("rv:")+3):-1!==t.indexOf("MSIE")&&(n=t.substring(t.indexOf("MSIE")+5))),n&&(-1!==(o=n.indexOf(";"))&&(n=n.substring(0,o)),-1!==(o=n.indexOf(" "))&&(n=n.substring(0,o)),-1!==(o=n.indexOf(")"))&&(n=n.substring(0,o)),r=parseInt(n,10),i=parseInt(n.split(".")[1],10)),{version:n,major:r,minor:i}}function i(e,t){if(e&&e.length>t)return e[t]}function o(e,t){var n=void 0,r=void 0,o=void 0;if(e.windows)switch(n=i(/Windows(?: NT|)? ([._\d]+)/.exec(t),1)){case"6.1":n="7.0";break;case"6.2":n="8.0";break;case"6.3":n="8.1"}else e.android?n=i(/Android ([._\d]+)/.exec(t),1):e.iOS?n=i(/OS ([._\d]+)/.exec(t),1):e.mac&&(n=i(/Mac OS X (10[._\d]+)/.exec(t),1));if(n){r=parseInt(n,10);var a=n.split(/[._]/);a&&(o=parseInt(a[1],10))}return{version:n,major:r,minor:o}}function a(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}return e}Object.defineProperty(t,"__esModule",{value:!0});var u=n(31),c=n(0);n.d(t,"Browser",function(){return f}),n.d(t,"OS",function(){return d}),n.d(t,"Features",function(){return p});var s=c.c.memoize,l=navigator.userAgent,f={},d={},p={},v=function(){return l.indexOf("Windows")>-1};Object.defineProperties(f,{androidNative:{get:s(u.c),enumerable:!0},chrome:{get:s(u.d),enumerable:!0},edge:{get:s(u.e),enumerable:!0},facebook:{get:s(u.g),enumerable:!0},firefox:{get:s(u.f),enumerable:!0},ie:{get:s(u.i),enumerable:!0},msie:{get:s(u.n),enumerable:!0},safari:{get:s(u.q),enumerable:!0},version:{get:s(r.bind(this,f,l)),enumerable:!0}}),Object.defineProperties(d,{android:{get:s(u.b),enumerable:!0},iOS:{get:s(u.j),enumerable:!0},mobile:{get:s(u.o),enumerable:!0},mac:{get:s(u.p),enumerable:!0},iPad:{get:s(u.k),enumerable:!0},iPhone:{get:s(u.l),enumerable:!0},windows:{get:s(v),enumerable:!0},version:{get:s(o.bind(this,d,l)),enumerable:!0}}),Object.defineProperties(p,{flash:{get:s(u.h),enumerable:!0},flashVersion:{get:s(u.a),enumerable:!0},iframe:{get:s(u.m),enumerable:!0},passiveEvents:{get:s(a),enumerable:!0},backgroundLoading:{get:s(function(){return!(d.iOS||f.safari)}),enumerable:!0}})},function(e,t,n){"use strict";function r(e){return w||(w=o(e)),w}function i(){throw new Error("Network error")}function o(e){var t=e.get("controls"),n=a(),r=u(e,"html5");return t&&n&&r?c():t&&r?s():t&&n?l():t?f():d()}function a(){var e=window.IntersectionObserverEntry;return!(e&&"IntersectionObserver"in window&&"intersectionRatio"in e.prototype)}function u(e,t){var n=e.get("playlist");if(Array.isArray(n)&&n.length)for(var r=Object(h.c)(Object(v.a)(n[0]),e),i=0;i<r.length;i++)for(var o=r[i],a=e.getProviders(),u=0;u<m.a.length;u++){var c=m.a[u];if(a.providerSupports(c,o))return c.name===t}return!1}function c(){var e=n.e(0).then(function(e){n(10);var t=n(4).default;return y.b.controls=n(3).default,Object(g.a)(n(13).default),t}.bind(null,n)).catch(i);return j.html5=e,e}function s(){var e=n.e(1).then(function(e){var t=n(4).default;return y.b.controls=n(3).default,Object(g.a)(n(13).default),t}.bind(null,n)).catch(i);return j.html5=e,e}function l(){return n.e(2).then(function(e){n(10);var t=n(4).default;return y.b.controls=n(3).default,t}.bind(null,n)).catch(i)}function f(){return n.e(3).then(function(e){var t=n(4).default;return y.b.controls=n(3).default,t}.bind(null,n)).catch(i)}function d(){return p().then(function(){return n.e(7).then(function(e){return n(4).default}.bind(null,n)).catch(i)})}function p(){return a()?n.e(10).then(function(e){return n(10)}.bind(null,n)).catch(i):b.b}n.d(t,"a",function(){return j}),t.c=r,t.b=i;var v=n(24),h=n(32),m=n(18),g=n(19),y=n(50),b=n(1),w=null,j={}},,function(e,t,n){"use strict";function r(e,t){if(Object(l.exists)(t)||(t=document.location.href),Object(l.exists)(e)){if(i(e))return e;var n=t.substring(0,t.indexOf("://")+3),r=t.substring(n.length,t.indexOf("/",n.length+1)),o=void 0;if(0===e.indexOf("/"))o=e.split("/");else{var a=t.split("?")[0];a=a.substring(n.length+r.length+1,a.lastIndexOf("/")),o=a.split("/").concat(e.split("/"))}for(var u=[],c=0;c<o.length;c++)o[c]&&Object(l.exists)(o[c])&&"."!==o[c]&&(".."===o[c]?u.pop():u.push(o[c]));return n+r+"/"+u.join("/")}}function i(e){return/^(?:(?:https?|file):)?\/\//.test(e)}function o(e){return f.c.some(e,function(e){return"parsererror"===e.nodeName})}function a(e){var t=null;try{"DOMParser"in window?(t=(new window.DOMParser).parseFromString(e,"text/xml"),(o(t.childNodes)||t.childNodes&&o(t.childNodes[0].childNodes))&&(t=null)):(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e))}catch(e){}return t}function u(e){if(void 0===e)return null;if("string"==typeof e&&e.length<6){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;if(!isNaN(Number(e))&&!isNaN(parseFloat(e)))return Number(e)}return e}function c(e){return"string"==typeof e?""===e?0:e.lastIndexOf("%")>-1?e:parseInt(e.replace("px",""),10):e}function s(e,t){if(e<=0&&!t||f.c.isNaN(parseInt(e)))return"00:00";var n=e<0?"-":"";e=Math.abs(e);var r=Math.floor(e/3600),i=Math.floor((e-3600*r)/60),o=Math.floor(e%60);return n+(r?r+":":"")+(i<10?"0":"")+i+":"+(o<10?"0":"")+o}Object.defineProperty(t,"__esModule",{value:!0}),t.getAbsolutePath=r,t.isAbsolutePath=i,t.parseXML=a,t.serialize=u,t.parseDimension=c,t.timeFormat=s;var l=n(14),f=n(0)},function(e,t,n){"use strict";function r(e){var t="";return e&&(e.localName?t=e.localName:e.baseName&&(t=e.baseName)),t}function i(e){var t="";return e&&(e.textContent?t=Object(u.h)(e.textContent):e.text&&(t=Object(u.h)(e.text))),t}function o(e,t){return e.childNodes[t]}function a(e){return e.childNodes?e.childNodes.length:0}t.b=r,t.d=i,t.a=o,t.c=a;var u=n(2)},,function(e,t,n){"use strict";function r(e){switch(void 0===e?"undefined":c(e)){case"string":return e.length>0;case"object":return null!==e;case"undefined":return!1;default:return!0}}function i(){return"https:"===window.location.protocol}function o(e,t){return 0===e.indexOf("rtmp:")||"rtmp"===t}function a(e,t){return"youtube"===t||/^(http|\/\/).*(youtube\.com|youtu\.be)\/.+/.test(e)}function u(e){if(null===e)return"null";var t=void 0===e?"undefined":c(e);return"object"===t&&Array.isArray(e)?"array":t}Object.defineProperty(t,"__esModule",{value:!0}),t.exists=r,t.isHTTPS=i,t.isRtmp=o,t.isYouTube=a,t.typeOf=u;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}},function(e,t,n){"use strict";function r(e){var t={setup:[i,o,a,u,c,l,f,d,s],drm:[c,l,f,d],ads:[l,f,d,s,c],jwpsrv:[i,o,a,u,c,l,d,s],discovery:[l,c,d,f]};return function(n){return t[n]&&t[n].indexOf(e)>-1}}t.a=r;var i="free",o="starter",a="business",u="premium",c="enterprise",s="platinum",l="ads",f="unlimited",d="trial"},function(e,t,n){"use strict";t.a={debug:!1}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"getScriptPath",function(){return i}),n.d(t,"repo",function(){return o}),n.d(t,"versionCheck",function(){return a}),n.d(t,"loadFrom",function(){return u});var r=n(22),i=function(e){for(var t=document.getElementsByTagName("script"),n=0;n<t.length;n++){var r=t[n].src;if(r){var i=r.lastIndexOf("/"+e);if(i>=0)return r.substr(0,i+1)}}return""},o=function(){var e="//ssl.p.jwpcdn.com/player/v/8.2.4/";return("file:"===window.location.protocol?"https:":"")+e},a=function(e){var t=("0"+e).split(/\W/),n=r.a.split(/\W/),i=parseFloat(t[0]),o=parseFloat(n[0]);return!(i>o)&&!(i===o&&parseFloat("0"+t[1])>parseFloat(n[1]))},u=function(){return o()}},function(e,t,n){"use strict";function r(){return!!window.MediaSource&&!!window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')}function i(e){if(e.drm&&!Object(l.a)(e.drm))return!1;var t=window.MediaSource;if(!window.HTMLVideoElement||!t)return!1;var n=!0;return e.mediaTypes&&(n=c.c.all(e.mediaTypes,function(e){return t.isTypeSupported(e)})),n&&("dash"===e.type||"mpd"===e.type||(e.file||"").indexOf("mpd-time-csf")>-1)}var o=n(48),a=n(8),u=n(15),c=n(0),s=n(14),l=n(30),f=c.c.find(o.a,c.c.matches({name:"html5"})),d=f.supports;f.supports=function(e,t){var n=d.apply(this,arguments);if(n&&e.drm&&"hls"===e.type){var r=Object(u.a)(t),i=r("drm");if(i&&e.drm.fairplay){var o=window.WebKitMediaKeys;return o&&o.isTypeSupported&&o.isTypeSupported("com.apple.fps.1_0","video/mp4")}return i}return n},o.a.push({name:"shaka",supports:i}),o.a.splice(0,0,{name:"hlsjs",supports:function(e){if(e.drm)return!1;var t=e.file.indexOf(".m3u8")>-1,n="hls"===e.type||"m3u8"===e.type;if(!t&&!n)return!1;var i=a.Browser.chrome||a.Browser.firefox||a.Browser.edge||a.Browser.ie&&11===a.Browser.version.major,o=a.OS.android&&!1===e.hlsjsdefault,u=a.Browser.safari&&!!e.safarihlsjs;return r()&&(i||u)&&!o}}),o.a.push({name:"flash",supports:function(e){if(!a.Features.flash||e.drm)return!1;var t=e.type;return"hls"===t||"m3u8"===t||!Object(s.isRtmp)(e.file,t)&&["flv","f4v","mov","m4a","m4v","mp4","aac","f4a","mp3","mpeg","smil"].indexOf(t)>-1}}),t.a=o.a},function(e,t,n){"use strict";function r(e){var t=e.getName().name;if(!i.a[t]){if(!u.c.find(o.a,u.c.matches({name:t}))){if(!u.c.isFunction(e.supports))throw new Error("Tried to register a provider with an invalid object");o.a.unshift({name:t,supports:e.supports})}u.c.defaults(e.prototype,a.a),i.a[t]=e}}t.a=r;var i=n(35),o=n(18),a=n(47),u=n(0)},function(e,t,n){"use strict";function r(e,t,n){var r=e.name,i=document.createElement("div");i.id=n.id+"_"+r,i.className="jw-plugin jw-reset";var o=s({},t),a=e.getNewInstance(n,o,i);n.addPlugin(r,a)}function i(e){switch(y(e)){case m:return e;case g:return Object(p.getAbsolutePath)(e,window.location.href)}}function o(e){return S[e]=new f,S[e]}function a(e,t){var n=e.get("id"),r=e.get("plugins");window.jwplayerPluginJsonp=P;var i=o(n);return i.load(t,E,r).then(function(e){i===S[n]&&(e&&e.forEach(function(e){e instanceof Error&&Object(j.b)(e.message)}),delete window.jwplayerPluginJsonp)})}var u=n(1),c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){this.load=function(e,t,n){return n&&"object"===(void 0===n?"undefined":c(n))?u.a.all(Object.keys(n).filter(function(e){return e}).map(function(i){var o=t.addPlugin(i,!0),a=n[i];return o.load().then(function(){r(o,a,e)}).catch(function(e){return e instanceof Error?e:new Error("Error in "+i+' "'+e+'"')})})):u.b}},f=l,d=n(25),p=n(11),v=n(2),h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=0,g=1,y=function(e){if("string"==typeof e){e=e.split("?")[0];var t=e.indexOf("://");if(t>0)return m;var n=e.indexOf("/"),r=Object(v.a)(e);return!(t<0&&n<0)||r&&isNaN(r)?g:2}},b=function(e){this.url=e};h(b.prototype,{load:function(){if(2===y(this.url))return u.b;var e=new d.a(i(this.url));return this.loader=e,e.load()},registerPlugin:function(e,t,n){this.name=e,this.target=t,this.js=n},getNewInstance:function(e,t,n){var r=this.js,i=new r(e,t,n);return i.addToPlayer=function(){var t=e.getContainer().querySelector(".jw-overlays");t&&(n.left=t.style.left,n.top=t.style.top,t.appendChild(n),i.displayArea=t)},i.resizeHandler=function(){var e=i.displayArea;e&&i.resize(e.clientWidth,e.clientHeight)},i}});var w=b,j=n(6),O={},k=function(e){return e.replace(/^(.*\/)?([^-]*)-?.*\.(js)$/,"$2")},C=function(){this.addPlugin=function(e,t){var n=k(e),r=O[n];return r?t&&r.url!==e&&Object(j.b)('JW Plugin "'+n+'" already loaded from "'+r.url+'". Ignoring "'+e+'."'):(r=new w(e),O[n]=r),r},this.getPlugins=function(){return O}},x=C;n.d(t,"b",function(){return P}),t.a=a;var E=new x,S={},P=function(e,t,n){var r=E.addPlugin(e);r.js||r.registerPlugin(e,t,n)}},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=Date.now||function(){return(new Date).getTime()}},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r="8.2.4+commercial_v8-2-4.259.commercial.1fc75ae.hlsjs..jwplayer.0a8d18a.dai.0d5ca8d.freewheel.2d1b58a.googima.caee413.vast.7759f79.analytics.0ae6a24.gapro.f664e4e.related.d09e606"},function(e,t,n){"use strict";function r(){return a+o.now()}var i=n(21),o=window.performance||{timing:{}},a=o.timing.navigationStart||Object(i.a)();"now"in o||(o.now=function(){return Object(i.a)()-a});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];
for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){var e={},t={},n={},i={};return{start:function(t){e[t]=r(),n[t]=n[t]+1||1},end:function(n){if(e[n]){var i=r(),o=i-e[n];delete e[n],t[n]=t[n]+o||o}},dump:function(){var o=u({},t);for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var c=r(),s=c-e[a];o[a]=o[a]+s||s}return{counts:u({},n),sums:o,events:u({},i)}},tick:function(e){i[e]=r()},clear:function(e){delete i[e]},between:function(e,t){return i[t]&&i[e]?i[t]-i[e]:null}}};t.a=c},function(e,t,n){"use strict";var r=n(38),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(e){if(e&&e.file)return i({},{kind:"captions","default":!1},e)},a=o,u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=Array.isArray,s=function(e){e=e||{},c(e.tracks)||delete e.tracks;var t=u({},{sources:[],tracks:[],minDvrWindow:120,dvrSeekLimit:25},e);t.dvrSeekLimit<5&&(t.dvrSeekLimit=5),t.sources!==Object(t.sources)||c(t.sources)||(t.sources=[Object(r.a)(t.sources)]),c(t.sources)&&0!==t.sources.length||(e.levels?t.sources=e.levels:t.sources=[Object(r.a)(e)]);for(var n=0;n<t.sources.length;n++){var i=t.sources[n];if(i){var o=i.default;i.default=!!o&&"true"===o.toString(),t.sources[n].label||(t.sources[n].label=n.toString()),t.sources[n]=Object(r.a)(t.sources[n])}}return t.sources=t.sources.filter(function(e){return!!e}),c(t.tracks)||(t.tracks=[]),c(t.captions)&&(t.tracks=t.tracks.concat(t.captions),delete t.captions),t.tracks=t.tracks.map(a).filter(function(e){return!!e}),t};t.a=s},function(e,t,n){"use strict";function r(e){var t=document.createElement("link");return t.type="text/css",t.rel="stylesheet",t.href=e,t}function i(e){var t=document.createElement("script");return t.type="text/javascript",t.charset="utf-8",t.async=!0,t.timeout=l,t.src=e,t}var o=n(7),a=n(5),u=n(1),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s={},l=15e3,f=2,d=3,p=function(e,t){function n(e){p=f,c.trigger(a.r,e).off()}function o(e){p=d,c.trigger(a._4,e).off()}var c=this,p=0;this.getStatus=function(){return p},this.load=function(){var a=s[e];return 0!==p?a:(a&&a.then(o).catch(n),p=1,a=new u.a(function(a,u){var c=t?r:i,s=c(e),f=function(){s.onerror=s.onload=null,clearTimeout(p)},d=function(e){f(),n(e),u(e)},p=setTimeout(function(){d(new Error("Network timeout "+e))},l);s.onerror=function(){d(new Error("Failed to load "+e))},s.onload=function(e){f(),o(e),a(e)};var v=document.getElementsByTagName("head")[0]||document.documentElement;v.insertBefore(s,v.firstChild)}),s[e]=a,a)}};c(p.prototype,o.a),t.a=p},function(e,t,n){"use strict";function r(e,t){return e.classList.contains(t)}function i(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild}function o(e){return e+(e.toString().indexOf("%")>0?"":"px")}function a(e){return b.c.isString(e.className)?e.className.split(" "):[]}function u(e,t){t=Object(y.h)(t),e.className!==t&&(e.className=t)}function c(e){return e.classList?e.classList:a(e)}function s(e,t){var n=a(e),r=b.c.isArray(t)?t:t.split(" ");b.c.each(r,function(e){b.c.contains(n,e)||n.push(e)}),u(e,n.join(" "))}function l(e,t){var n=a(e),r=b.c.isArray(t)?t:t.split(" ");u(e,b.c.difference(n,r).join(" "))}function f(e,t,n){var r=e.className||"";t.test(r)?r=r.replace(t,n):n&&(r+=" "+n),u(e,r)}function d(e,t,n){var i=r(e,t);(n=b.c.isBoolean(n)?n:!i)!==i&&(n?s(e,t):l(e,t))}function p(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function v(e){var t=document.createElement("link");t.rel="stylesheet",t.href=e,document.getElementsByTagName("head")[0].appendChild(t)}function h(e){e&&p(e)}function m(e){var t={left:0,right:0,width:0,height:0,top:0,bottom:0};if(!e||!document.body.contains(e))return t;var n=e.getBoundingClientRect(),r=window.pageYOffset,i=window.pageXOffset;return n.width||n.height||n.left||n.top?(t.left=n.left+i,t.right=n.right+i,t.top=n.top+r,t.bottom=n.bottom+r,t.width=n.right-n.left,t.height=n.bottom-n.top,t):t}function g(e,t){e.insertBefore(t,e.firstChild)}t.h=r,t.e=i,t.l=o,t.d=c,t.a=s,t.j=l,t.k=f,t.m=d,t.g=p,t.b=v,t.f=h,t.c=m,t.i=g;var y=n(2),b=n(0)},function(e,t,n){"use strict";function r(e,t,n,r){n=n||"all-players";var o="";if("object"===(void 0===t?"undefined":d(t))){var a=document.createElement("div");i(a,t);var u=a.style.cssText;r&&u&&(u=u.replace(/;/g," !important;")),o="{"+u+"}"}else"string"==typeof t&&(o=t);if(""===o||"{}"===o)return void f.a.clear(n,e);f.a.style([[e,e+o]],n)}function i(e,t){if(void 0!==e&&null!==e){void 0===e.length&&(e=[e]);var n,r={};for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=a(n,t[n]));for(var i=0;i<e.length;i++){var u,c=e[i];if(void 0!==c&&null!==c)for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(u=o(n),c.style[u]!==r[n]&&(c.style[u]=r[n]))}}}function o(e){e=e.split("-");for(var t=1;t<e.length;t++)e[t]=e[t].charAt(0).toUpperCase()+e[t].slice(1);return e.join("")}function a(e,t){return""===t||void 0===t||null===t?"":"string"==typeof t&&isNaN(t)?/png|gif|jpe?g/i.test(t)&&t.indexOf("url")<0?"url("+t+")":t:0===t||"z-index"===e||"opacity"===e?""+t:/color/i.test(e)?"#"+Object(s.d)(t.toString(16).replace(/^0x/i,""),6):Math.ceil(t)+"px"}function u(e,t){i(e,{transform:t,webkitTransform:t,msTransform:t,mozTransform:t,oTransform:t})}function c(e,t){var n="rgb",r=void 0!==t&&100!==t;if(r&&(n+="a"),!v){var i=document.createElement("canvas");i.height=1,i.width=1,v=i.getContext("2d")}e?isNaN(parseInt(e,16))||(e="#"+e):e="#000000",v.clearRect(0,0,1,1),v.fillStyle=e,v.fillRect(0,0,1,1);var o=v.getImageData(0,0,1,1).data;return n+="("+o[0]+", "+o[1]+", "+o[2],r&&(n+=", "+t/100),n+")"}n.d(t,"a",function(){return p}),t.b=r,t.d=i,t.e=u,t.c=c;var s=n(2),l=n(41),f=n.n(l),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p=f.a.clear,v=void 0},function(e,t,n){"use strict";var r=[];t.a=r},function(e,t,n){"use strict";function r(e){this.config=e||{}}var i=n(18),o=n(19),a=n(35),u=n(9),c=n(1),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l={html5:function(){return n.e(8).then(function(e){var t=n(13).default;return Object(o.a)(t),t}.bind(null,n)).catch(u.b)}};s(r.prototype,{load:function(e){var t=l[e],n=function(){return c.a.reject(new Error("Failed to load media"))};return t?t().then(function(){var t=a.a[e];return t||n()}):n()},providerSupports:function(e,t){return e.supports(t)},choose:function(e){if(e===Object(e))for(var t=i.a.length,n=0;n<t;n++){var r=i.a[n];if(this.providerSupports(r,e)){var o=t-n-1;return{priority:o,name:r.name,type:e.type,providerToCheck:r,provider:a.a[r.name]}}}return{}}});var f=r,d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=void 0;d(l,{shaka:function(){return n.e(5).then(function(e){var t=n(119).default;return Object(o.a)(t),t}.bind(null,n)).catch(u.b)},hlsjs:function(){return n.e(6).then(function(e){var t=n(120).default;return t.setEdition&&t.setEdition(p),Object(o.a)(t),t}.bind(null,n)).catch(u.b)},flash:function(){return n.e(9).then(function(e){var t=n(121).default;return Object(o.a)(t),t}.bind(null,n)).catch(u.b)}}),f.prototype.providerSupports=function(e,t){return p=this.config.edition,e.supports(t,p)};t.a=f},function(e,t,n){"use strict";function r(e){return e.some(function(e){return!!e.drm||e.sources.some(function(e){return!!e.drm})})}function i(e){return new l.a(function(t,n){var r=void 0;try{r=new window.MSMediaKeys(e)}catch(e){return void n(e)}t(r)})}function o(e){if(v)return v;if(a()&&Object(s.a)(e)("drm")){var t=i;return navigator.requestMediaKeySystemAccess&&(t=navigator.requestMediaKeySystemAccess.bind(navigator)),f.forEach(function(e){var n=t(e.keyName,[{initDataTypes:["cenc"],videoCapabilities:[{contentType:'video/mp4;codecs="avc1.4d401e"'}],audioCapabilities:[{contentType:'audio/mp4;codecs="mp4a.40.2"'}]}]).then(function(){p[e.configName]=!0}).catch(function(){p[e.configName]=!1});d.push(n)}),v=l.a.all(d)}return l.b}function a(){return!!navigator.requestMediaKeySystemAccess&&!!MediaKeySystemAccess.prototype.getConfiguration||!!window.MSMediaKeys}function u(e){return p[e]}function c(e){if(v)return Object.keys(e).some(function(e){return u(e)})}t.b=r,t.d=o,t.c=u,t.a=c;var s=n(15),l=n(1),f=[{configName:"clearkey",keyName:"org.w3.clearkey"},{configName:"widevine",keyName:"com.widevine.alpha"},{configName:"playready",keyName:"com.microsoft.playready"}],d=[],p={},v=void 0},function(e,t,n){"use strict";function r(e){return null!==g.match(e)}function i(e){return function(){return r(e)}}function o(){var e=m();return!!(e&&e>=18)}function a(){return r(/\sEdge\/\d+/i)}function u(){return r(/msie/i)}function c(){return r(/\s(?:Chrome|CriOS)\//i)&&!a()&&!r(/UCBrowser/i)}function s(){return a()||b()||u()}function l(){return r(/safari/i)&&!r(/(?:Chrome|CriOS|chromium|android|phantom)/i)}function f(){return r(/iP(hone|ad|od)/i)}function d(){return!(r(/chrome\/[123456789]/i)&&!r(/chrome\/18/i)&&!y())&&p()}function p(){return r(/Android/i)&&!r(/Windows Phone/i)}function v(){return f()||p()||r(/Windows Phone/i)}function h(){try{return window.self!==window.top}catch(e){return!0}}function m(){if(p())return 0;var e,t=navigator.plugins;if(t&&(e=t["Shockwave Flash"])&&e.description)return parseFloat(e.description.replace(/\D+(\d+\.?\d*).*/,"$1"));if(void 0!==window.ActiveXObject){try{if(e=new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return parseFloat(e.GetVariable("$version").split(" ")[1].replace(/\s*,\s*/,"."))}catch(e){return 0}return e}return 0}t.h=o,n.d(t,"f",function(){return y}),n.d(t,"l",function(){return w}),n.d(t,"k",function(){return j}),n.d(t,"p",function(){return O}),n.d(t,"g",function(){return k}),t.e=a,t.n=u,t.d=c,t.i=s,t.q=l,t.j=f,t.c=d,t.b=p,t.o=v,t.m=h,t.a=m;var g=navigator.userAgent,y=i(/gecko\//i),b=i(/trident\/.+rv:\s*11/i),w=i(/iP(hone|od)/i),j=i(/iPad/i),O=i(/Macintosh/i),k=i(/FBAV/i)},function(e,t,n){"use strict";function r(e,t){return f[e]?e:f[t]?t:"metadata"}function i(e,t,n){var i=[],o=t.getProviders(),c=t.get("preload"),s=h({},n);return delete s.playlist,e.forEach(function(e){e=h({},e),e.preload=r(e.preload,c),e.allSources=a(e,t),e.sources=u(e.allSources,o),e.sources.length&&(e.file=e.sources[0].file,n&&(e.feedData=s),i.push(e))}),i}function o(e){if(!Array.isArray(e)||0===e.length)throw new Error("No playable sources found")}function a(e,t){var n=t.attributes,i=e.sources,o=e.preload,a=e.drm,u=s(e.withCredentials,n.withCredentials);return i.map(function(e){if(e!==Object(e))return null;l(e,n,"androidhls"),l(e,n,"hlsjsdefault"),l(e,n,"safarihlsjs"),e.preload=r(e.preload,o);var t=e.drm||a||n.drm;t&&(e.drm=t);var i=s(e.withCredentials,u);return void 0!==i&&(e.withCredentials=i),Object(p.a)(e)}).filter(function(e){return!!e})}function u(e,t){t&&t.choose||(t=new v.a);var n=c(e,t);if(!n)return[];var r=n.provider,i=n.type;return e.filter(function(e){return e.type===i&&t.providerSupports(r,e)})}function c(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=t.choose(r),o=i.providerToCheck;if(o)return{type:r.type,provider:o}}return null}function s(e,t){return void 0===e?t:e}function l(e,t,n){n in t&&(e[n]=t[n])}var f={none:!0,metadata:!0,auto:!0},d=n(24),p=n(38),v=n(29);t.b=i,t.d=o,n.d(t,"c",function(){return g});var h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(e){return(Array.isArray(e)?e:[e]).map(d.a)},g=function(e,t){return u(a(e,t),t.getProviders())};t.a=m},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=window.atob},function(e,t,n){"use strict";var r=document.createElement("video");t.a=r},function(e,t,n){"use strict";var r={};t.a=r},function(e,t,n){"use strict";var r=n(37),i=n(15),o=n(33),a="invalid",u=function(e){var t=void 0,n=void 0,u=void 0;this.edition=function(){return u&&u.getTime()<(new Date).getTime()?a:t},this.token=function(){return n},this.expiration=function(){return u},function(e,c){try{var s=Object(r.a)(e,Object(o.a)(c)),l=s.split("/");"pro"===(t=l[0])&&(t="premium");var f=Object(i.a)(t);if(l.length>2&&f("setup")){n=l[1];var d=parseInt(l[2]);d>0&&(u=new Date,u.setTime(d))}else t=a}catch(e){t=a}}(e||"","NDh2aU1Cb0NHRG5hcDFRZQ==")};t.a=u},function(e,t,n){"use strict";function r(e){return unescape(encodeURIComponent(e))}function i(e){try{return decodeURIComponent(escape(e))}catch(t){return e}}function o(e){for(var t=new Array(Math.ceil(e.length/4)),n=0;n<t.length;n++)t[n]=e.charCodeAt(4*n)+(e.charCodeAt(4*n+1)<<8)+(e.charCodeAt(4*n+2)<<16)+(e.charCodeAt(4*n+3)<<24);return t}function a(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=String.fromCharCode(255&e[n],e[n]>>>8&255,e[n]>>>16&255,e[n]>>>24&255);return t.join("")}function u(e,t){if(e=String(e),t=String(t),0===e.length)return"";for(var n=o(Object(c.a)(e)),u=o(r(t).slice(0,16)),s=n.length,l=n[s-1],f=n[0],d=void 0,p=void 0,v=2654435769*Math.floor(6+52/s);v;){p=v>>>2&3;for(var h=s-1;h>=0;h--)l=n[h>0?h-1:s-1],d=(l>>>5^f<<2)+(f>>>3^l<<4)^(v^f)+(u[3&h^p]^l),f=n[h]-=d;v-=2654435769}return i(a(n).replace(/\0+$/,""))}t.a=u;var c=n(33)},function(e,t,n){"use strict";var r=n(14),i=n(2),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(e){if(e&&e.file){var t=o({},{"default":!1},e);t.file=Object(i.h)(""+t.file);var n=/^[^\/]+\/(?:x-)?([^\/]+)$/;if(n.test(t.type)&&(t.mimeType=t.type,t.type=t.type.replace(n,"$1")),Object(r.isYouTube)(t.file)?t.type="youtube":Object(r.isRtmp)(t.file)?t.type="rtmp":t.type||(t.type=Object(i.a)(t.file)),t.type){switch(t.type){case"m3u8":case"vnd.apple.mpegurl":t.type="hls";break;case"dash+xml":t.type="dash";break;case"m4a":t.type="aac";break;case"smil":t.type="rtmp"}return Object.keys(t).forEach(function(e){""===t[e]&&delete t[e]}),t}}};t.a=a},function(e,t,n){"use strict";function r(e){for(var t=[],n=0;n<Object(a.c)(e);n++){var r=e.childNodes[n];"jwplayer"===r.prefix&&"mediatypes"===Object(a.b)(r).toLowerCase()&&t.push(Object(a.d)(r))}return t}function i(e){var t=[];t.feedData={};for(var n=0;n<Object(a.c)(e);n++){var r=Object(a.a)(e,n);if("channel"===Object(a.b)(r).toLowerCase())for(var i=0;i<Object(a.c)(r);i++){var u=Object(a.a)(r,i),c=Object(a.b)(u).toLowerCase();"item"===c?t.push(o(u)):c&&(t.feedData[c]=Object(a.d)(u))}}return t}function o(e){for(var t={},n=0;n<e.childNodes.length;n++){var r=e.childNodes[n],i=Object(a.b)(r);if(i)switch(i.toLowerCase()){case"enclosure":t.file=Object(u.i)(r,"url");break;case"title":t.title=Object(a.d)(r);break;case"guid":t.mediaid=Object(a.d)(r);break;case"pubdate":t.date=Object(a.d)(r);break;case"description":t.description=Object(a.d)(r);break;case"link":t.link=Object(a.d)(r);break;case"category":t.tags?t.tags+=Object(a.d)(r):t.tags=Object(a.d)(r)}}return new p.a(d(e,l(e,t)))}var a=n(12),u=n(2),c=n(6),s=function e(t,n){for(var i=[],o=0;o<Object(a.c)(t);o++){var s=t.childNodes[o];if("media"===s.prefix){if(!Object(a.b)(s))continue;switch(Object(a.b)(s).toLowerCase()){case"content":if(Object(u.i)(s,"duration")&&(n.duration=c.a.seconds(Object(u.i)(s,"duration"))),Object(u.i)(s,"url")){n.sources||(n.sources=[]);var l={file:Object(u.i)(s,"url"),type:Object(u.i)(s,"type"),width:Object(u.i)(s,"width"),label:Object(u.i)(s,"label")},f=r(s);f.length&&(l.mediaTypes=f),n.sources.push(l)}Object(a.c)(s)>0&&(n=e(s,n));break;case"title":n.title=Object(a.d)(s);break;case"description":n.description=Object(a.d)(s);break;case"guid":n.mediaid=Object(a.d)(s);break;case"thumbnail":n.image||(n.image=Object(u.i)(s,"url"));break;case"group":e(s,n);break;case"subtitle":var d={};d.file=Object(u.i)(s,"url"),d.kind="captions",Object(u.i)(s,"lang").length>0&&(d.label=function(e){var t={zh:"Chinese",nl:"Dutch",en:"English",fr:"French",de:"German",it:"Italian",ja:"Japanese",pt:"Portuguese",ru:"Russian",es:"Spanish"};return t[e]?t[e]:e}(Object(u.i)(s,"lang"))),i.push(d)}}}n.hasOwnProperty("tracks")||(n.tracks=[]);for(var p=0;p<i.length;p++)n.tracks.push(i[p]);return n},l=s,f=function(e,t){for(var n="default",r=[],i=[],o=0;o<e.childNodes.length;o++){var s=e.childNodes[o];if("jwplayer"===s.prefix){var l=Object(a.b)(s);"source"===l?(delete t.sources,r.push({file:Object(u.i)(s,"file"),"default":Object(u.i)(s,n),label:Object(u.i)(s,"label"),type:Object(u.i)(s,"type")})):"track"===l?(delete t.tracks,i.push({file:Object(u.i)(s,"file"),"default":Object(u.i)(s,n),kind:Object(u.i)(s,"kind"),label:Object(u.i)(s,"label")})):(t[l]=c.a.serialize(Object(a.d)(s)),"file"===l&&t.sources&&delete t.sources)}t.file||(t.file=t.link)}if(r.length){t.sources=[];for(var f=0;f<r.length;f++)r[f].file.length>0&&(r[f][n]="true"===r[f][n],r[f].label.length||delete r[f].label,t.sources.push(r[f]))}if(i.length){t.tracks=[];for(var d=0;d<i.length;d++)i[d].file.length>0&&(i[d][n]="true"===i[d][n],i[d].kind=i[d].kind.length?i[d].kind:"captions",i[d].label.length||delete i[d].label,t.tracks.push(i[d]))}return t},d=f,p=n(24);t.a=i},function(e,t,n){"use strict";function r(e,t){return/touch/.test(e.type)?(e.originalEvent||e).changedTouches[0]["page"+t]:e["page"+t]}function i(e){var t=e||window.event;return e instanceof MouseEvent&&("which"in t?3===t.which:"button"in t&&2===t.button)}function o(e){var t=e||window.event;return t instanceof KeyboardEvent&&13===t.keyCode&&(e.stopPropagation(),!0)}function a(e,t,n){var r=void 0;return r=t instanceof MouseEvent||!t.touches&&!t.changedTouches?t:t.touches&&t.touches.length?t.touches[0]:t.changedTouches[0],{type:e,sourceEvent:t,target:t.target,currentTarget:n,pageX:r.pageX,pageY:r.pageY}}function u(e){(e instanceof MouseEvent||e instanceof v)&&(e.preventManipulation&&e.preventManipulation(),e.preventDefault&&e.preventDefault())}function c(e){return g&&e instanceof v||m&&e instanceof h&&"touch"===e.pointerType?"touch":"mouse"}t.b=c;var s=n(8),l=n(5),f=n(7),d=n(21),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v=window.TouchEvent,h=window.PointerEvent,m="PointerEvent"in window&&!s.OS.android,g="ontouchstart"in window,y=!(m||g&&s.OS.mobile),b=s.Browser.firefox&&s.OS.mac,w=function(e,t){function n(e){"touch"!==e.pointerType&&O(l.S,e)}function c(e){"touch"!==e.pointerType&&O(l.P,e)}function f(t){if("touch"!==t.pointerType&&"x"in t){var n=t.x,r=t.y,i=document.elementFromPoint(n,r);e.contains(i)||O(l.R,t)}}function p(e){O(l.R,e)}function v(e){o(e)&&O(l.q,e)}function h(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}function g(n){T=n.target,x=r(n,"X"),E=r(n,"Y"),i(n)||("pointerdown"===n.type&&n.isPrimary?(t.preventScrolling&&(_=n.pointerId,e.setPointerCapture(_)),h(e,"pointermove",w,N),h(e,"pointercancel",j),"mouse"===n.pointerType&&"OBJECT"===T.nodeName?h(document,"mouseup",L):h(e,"pointerup",j)):"mousedown"===n.type?(h(document,"mousemove",w,N),b&&"object"===n.target.nodeName.toLowerCase()?h(e,"click",j):h(document,"mouseup",L)):"touchstart"===n.type&&(h(T,"touchmove",w,N),h(T,"touchcancel",j),h(T,"touchend",j)),t.preventScrolling&&u(n))}function w(e){if(C)O(l.n,e);else{var n=r(e,"X"),i=r(e,"Y"),o=n-x,a=i-E;o*o+a*a>36&&(O(l.p,e),C=!0,O(l.n,e))}t.preventScrolling&&u(e)}function j(n){var r="pointerup"===n.type||"pointercancel"===n.type;r&&t.preventScrolling&&e.releasePointerCapture(_),e.removeEventListener("pointermove",w),e.removeEventListener("pointercancel",j),e.removeEventListener("pointerup",j),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",L),T&&(T.removeEventListener("touchmove",w),T.removeEventListener("touchcancel",j),T.removeEventListener("touchend",j)),C?O(l.o,n):t.directSelect&&n.target!==e||-1!==n.type.indexOf("cancel")||("mouseup"===n.type||"click"===n.type||r&&"mouse"===n.pointerType?O(l.i,n):(O(l._11,n),"touchend"===n.type&&u(n))),T=null,C=!1}function O(e,n){var r=void 0;if(t.enableDoubleTap&&(e===l.i||e===l._11))if(Object(d.a)()-S<P){var i=e===l.i?l.l:l.m;r=a(i,n,k),A.trigger(i,r),S=0}else S=Object(d.a)();r=a(e,n,k),A.trigger(e,r)}var k=e,C=!1,x=0,E=0,S=0,P=300,T=void 0,_=void 0;t=t||{};var N=!!s.Features.passiveEvents&&{passive:!t.preventScrolling},L=function(e){return j(e)};m?(e.addEventListener("pointerdown",g,N),t.useHover&&(e.addEventListener("pointerover",n),e.addEventListener("pointerout",f)),t.useMove&&e.addEventListener("pointermove",c)):(y&&(e.addEventListener("mousedown",g,N),t.useHover&&(e.addEventListener("mouseover",n),e.addEventListener("mouseout",p)),t.useMove&&e.addEventListener("mousemove",c)),e.addEventListener("touchstart",g,N)),e.addEventListener("keydown",v),t.useFocus&&(e.addEventListener("focus",n),e.addEventListener("blur",p));var A=this;return this.triggerEvent=O,this.destroy=function(){this.off(),e.removeEventListener("touchstart",g),e.removeEventListener("mousedown",g),e.removeEventListener("keydown",v),T&&(T.removeEventListener("touchmove",w),T.removeEventListener("touchcancel",j),T.removeEventListener("touchend",j),T=null),m&&(t.preventScrolling&&e.releasePointerCapture(_),e.removeEventListener("pointerover",n),e.removeEventListener("pointerdown",g),e.removeEventListener("pointermove",w),e.removeEventListener("pointermove",c),e.removeEventListener("pointercancel",j),e.removeEventListener("pointerout",f),e.removeEventListener("pointerup",j)),e.removeEventListener("click",j),e.removeEventListener("mouseover",n),e.removeEventListener("mousemove",c),e.removeEventListener("mouseout",p),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",L),t.useFocus&&(e.removeEventListener("focus",n),e.removeEventListener("blur",p))},this};p(w.prototype,f.a),t.a=w},function(e,t,n){var r;void 0!==(r=function(e,t,n){function r(e,t){o(t,a(e))}function i(e,t){var n=f[e];if(n)if(t){var r=n[t];if(r)for(var i=0;i<r.parts.length;i+=1)r.parts[i]()}else{for(var o=Object.keys(n),a=0;a<o.length;a+=1)for(var u=n[o[a]],c=0;c<u.parts.length;c+=1)u.parts[c]();delete f[e]}}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=(f[e]||{})[r.id];if(i){for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(s(e,r.parts[o]))}else{for(var a=[],o=0;o<r.parts.length;o++)a.push(s(e,r.parts[o]));f[e]=f[e]||{},f[e][r.id]={id:r.id,parts:a}}}}function a(e){for(var t=[],n={},r=0;r<e.length;r++){var i=e[r],o=i[0],a=i[1],u=i[2],c={css:a,media:u};n[o]?n[o].parts.push(c):t.push(n[o]={id:o,parts:[c]})}return t}function u(e){p().appendChild(e)}function c(e){var t=document.createElement("style");return t.type="text/css",t.setAttribute("data-jwplayer-id",e),u(t),t}function s(e,t){var n,r,i,o=d[e];o||(o=d[e]={element:c(e),counter:0});var a=o.counter++;return n=o.element,r=function(e){l(n,a,e)},i=function(){l(n,a,"")},r(t.css),function(e){if(e){if(e.css===t.css&&e.media===t.media)return;t=e,r(t.css)}else i()}}function l(e,t,n){if(e.styleSheet)e.styleSheet.cssText=v(t,n);else{var r=document.createTextNode(n),i=e.childNodes,o=i[t];o?e.replaceChild(r,o):e.appendChild(r)}}var f={},d={},p=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return document.head||document.getElementsByTagName("head")[0]});n.exports={style:r,clear:i};var v=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()}.call(t,n,t,e))&&(e.exports=r)},function(e,t,n){"use strict";function r(e,t,n){function r(){for(;i.length>0;){var t=i.shift(),n=t.command,r=t.args;(o[n]||e[n]).apply(e,r)}}var i=[],o={};t.forEach(function(t){var a=e[t];o[t]=a,e[t]=function(){var e=Array.prototype.slice.call(arguments,0);n()?i.push({command:t,args:e}):(r(),a&&a.apply(this,e))}}),Object.defineProperty(this,"queue",{enumerable:!0,get:function(){return i}}),this.flush=r,this.empty=function(){i.length=0},this.off=function(){t.forEach(function(t){var n=o[t];n&&(e[t]=n,delete o[t])})},this.destroy=function(){this.off(),this.empty()}}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=t.indexOf(":")+1,r=n>0?t.substr(0,n):"Error loading player:",u=t.substr(n),c=i(e.get("id"),r,u),s=e.get("width"),l=e.get("height"),f=Object(o.e)(c);return Object(a.d)(f,{width:s.toString().indexOf("%")>0?s:s+"px",height:l.toString().indexOf("%")>0?l:l+"px"}),f}var i=function(e){return'<div id="'+e+'" class="jw-error jw-reset"><div class="jw-error-msg jw-reset"><style>[id="'+e+'"].jw-error{position:relative;background:#000;overflow:hidden;position:relative}[id="'+e+'"] .jw-error-msg{top:50%;left:50%;position:absolute;align-items:center;display:flex;transform:translate(-50%,-50%)}[id="'+e+'"] .jw-title{color:#FFF;position:static}[id="'+e+'"] .jw-title-primary,[id="'+e+'"] .jw-title-secondary{font:600 14px/1.35 Arial,Helvetica,sans-serif}[id="'+e+'"] .jw-title-secondary{font-weight:400}</style><div class="jw-icon jw-reset"></div><div class="jw-title jw-reset"><div class="jw-title-primary jw-reset">'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'</div><div class="jw-title-secondary jw-reset">'+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")+"</div></div></div></div>"},o=n(26),a=n(27);t.a=r},function(e,t,n){"use strict";n.d(t,"c",function(){return r}),n.d(t,"b",function(){return i}),n.d(t,"a",function(){return o});var r=4,i=2,o=1},function(e,t,n){"use strict";var r=n(7),i={on:r.a.on,once:r.a.once,off:r.a.off,trigger:r.a.trigger,get:function(e){return this.attributes=this.attributes||{},this.attributes[e]},set:function(e,t){if(this.attributes=this.attributes||{},this.attributes[e]!==t){var n=this.attributes[e];this.attributes[e]=t,this.trigger("change:"+e,this,t,n)}},clone:function(){var e={},t=this.attributes;if(t)for(var n in t)e[n]=t[n];return e},change:function(e,t,n){this.on("change:"+e,t,n);var r=this.get(e);return t.call(n,this,r,r),this}};t.a=i},function(e,t,n){"use strict";n.d(t,"b",function(){return i}),n.d(t,"a",function(){return o});var r=n(5),i={audioMode:!1,flashBlocked:!1,item:0,itemMeta:{},playbackRate:1,playRejected:!1,state:r._6,itemReady:!1},o={position:0,duration:0,buffer:0,currentTime:0}},function(e,t,n){"use strict";var r=n(5),i=function(){},o=function(){return!1},a={name:"default"},u=function(){return a},c={supports:o,play:i,pause:i,preload:i,load:i,stop:i,volume:i,mute:i,seek:i,resize:i,remove:i,destroy:i,eventsOn_:i,eventsOff_:i,setVisibility:i,setFullscreen:i,getFullscreen:o,getContainer:i,setContainer:o,getName:u,getQualityLevels:i,getCurrentQuality:i,setCurrentQuality:i,getAudioTracks:i,getCurrentAudioTrack:i,setCurrentAudioTrack:i,getSeekRange:function(){return{start:0,end:this.getDuration()}},setPlaybackRate:i,getPlaybackRate:function(){return 1},checkComplete:i,setControls:i,attachMedia:i,detachMedia:i,init:i,setState:function(e){this.state=e,this.trigger(r.U,{newstate:e})},sendMediaType:function(e){var t=e[0].type,n="oga"===t||"aac"===t||"mp3"===t||"mpeg"===t||"vorbis"===t;this.trigger(r.M,{mediaType:n?"audio":"video"})}};t.a=c},function(e,t,n){"use strict";function r(e){if(!1===Object(i.a)(e))return!1;if(!a.a.canPlayType)return!1;var t=e.file,n=e.type;if(Object(o.isRtmp)(t,n))return!1;var r=e.mimeType||u[n];return!!r&&!!a.a.canPlayType(r)}t.b=r;var i=n(54),o=n(14),a=n(34),u={aac:"audio/mp4",mp4:"video/mp4",f4v:"video/mp4",m4v:"video/mp4",mov:"video/mp4",mp3:"audio/mpeg",mpeg:"audio/mpeg",ogv:"video/ogg",ogg:"video/ogg",oga:"video/ogg",vorbis:"video/ogg",webm:"video/webm",f4a:"video/aac",m3u8:"application/vnd.apple.mpegurl",m3u:"application/vnd.apple.mpegurl",hls:"application/vnd.apple.mpegurl"},c=[{name:"html5",supports:r}];t.a=c},function(e,t,n){"use strict";function r(e){Object.keys(e).forEach(function(t){"id"!==t&&(e[t]=Object(S.serialize)(e[t]))})}function i(e){return e.slice&&"px"===e.slice(-2)&&(e=e.slice(0,-2)),e}function o(e,t){if(-1===t.toString().indexOf("%"))return 0;if("string"!=typeof e||!e)return 0;if(/^\d*\.?\d+%$/.test(e))return e;var n=e.indexOf(":");if(-1===n)return 0;var r=parseFloat(e.substr(0,n)),i=parseFloat(e.substr(n+1));return r<=0||i<=0?0:i/r*100+"%"}function a(e){var t=e.flashplayer;return t||(t=(Object(E.getScriptPath)("jwplayer.js")||e.base)+"jwplayer.flash.swf"),"http:"===window.location.protocol&&(t=t.replace(/^https/,"http")),t}function u(e){var t="file:"===window.location.protocol?"https:":"",n={jwpsrv:"//ssl.p.jwpcdn.com/player/v/8.2.4/jwpsrv.js",dai:"//ssl.p.jwpcdn.com/player/plugins/dai/v/0.3.0/dai.js",vast:"//ssl.p.jwpcdn.com/player/plugins/vast/v/8.3.1/vast.js",googima:"//ssl.p.jwpcdn.com/player/plugins/googima/v/8.1.15/googima.js",freewheel:"//ssl.p.jwpcdn.com/player/plugins/freewheel/v/2.1.4/freewheel.js",related:"//ssl.p.jwpcdn.com/player/plugins/related/v/6.2.3/related.js",gapro:"//ssl.p.jwpcdn.com/player/plugins/gapro/v/2.1.3/gapro.js"},r=n[e];return r?t+r:""}function c(e,t,n){if(t){e[t.client||u(n)]=t,delete t.client}}function s(e){var t=M({},e.plugins),n=e.edition,r=Object(A.a)(n);if(r("ads")){var i=M({},e.advertising),o=i.client;if(o){t[u(o)||o]=i,delete i.client}}if(r("jwpsrv")){var a=e.analytics;a!==Object(a)&&(a={}),c(t,a,"jwpsrv")}c(t,e.ga,"gapro");var s=e.related,l=s===Object(s)&&r("discovery");if(!1!==e.controls||l){var f=!1!==e.visualplaylist||l;l||(s={disableRelated:!0}),s.showButton=f,c(t,s,"related")}return t}function l(e){var t=e.get("playlist");if("string"==typeof t)return new D.a(function(n,r){var i=new q.a;i.on(B.X,function(t){var r=t.playlist;delete t.playlist,f(e,r,t),n()}),i.on(B.r,function(t){f(e,[],{}),r(new Error("Error loading playlist: "+t.message))}),i.load(t)});var n=e.get("feedData")||{};return f(e,t,n),D.b}function f(e,t,n){var r=e.attributes;r.playlist=Object(X.a)(t),r.feedData=n}function d(e){return l(e).then(function(){if(!h(e)){var t=Object(X.b)(e.get("playlist"),e);Object(X.d)(t);var n=e.getProviders(),r=n.choose(t[0].sources[0]),i=r.provider,o=r.name;return"function"==typeof i?i:R.a.html5&&"html5"===o?R.a.html5:n.load(o)}})}function p(e){for(var t=document.styleSheets,n=0,r=t.length;n<r;n++)if(t[n].href===e)return!0;return!1}function v(e){var t=e.get("skin")?e.get("skin").url:void 0;if("string"==typeof t&&!p(t)){return new Q.a(t,!0).load().catch(function(e){return e})}return D.b}function h(e){return e.attributes._destroyed}function m(e){return l(e).then(function(){return e.get("drm")||Object(W.b)(e.get("playlist"))?Object(W.d)(e.get("edition")):D.b})}function g(e){return m(e).then(function(){return V(e)})}function y(e,t){this.namespace=e,this.items=t}function b(){for(var e=oe.c,t=[],n=[],r=0;r<e;r++){var i=j();t.push(i),n.push(i)}var o=n.shift(),a=n.shift();return{prime:function(){t.forEach(w)},getPrimedElement:function(){return n.length?n.shift():null},getAdElement:function(){return o},getTestElement:function(){return a},clean:function(e){if(e.src){e.removeAttribute("src");try{e.load()}catch(e){}}},recycle:function(e){e&&!n.some(function(t){return t===e})&&(this.clean(e),n.push(e))},syncVolume:function(e){t.forEach(function(t){t.volume=e/100})},syncMute:function(e){t.forEach(function(t){t.muted=e})}}}function w(e){if(e.src){if(ae.OS.android&&!e.parentNode){var t=e.played;(!t||t&&!t.length)&&e.load()}}else e.load()}function j(){var e=document.createElement("video");return e.className="jw-video jw-reset",e.setAttribute("disableRemotePlayback",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("playsinline",""),e}function O(e,t){D.b.then(function(){var n=t.message,r=t.code,i=Object(ie.a)(e,n);ie.a.cloneIcon&&i.querySelector(".jw-icon").appendChild(ie.a.cloneIcon("error")),k(e,i);var o={message:n,code:r,error:t},a=e._model||e.modelShim;a.set("errorEvent",o),a.set("state",B._5),e.trigger(B._2,o)
})}function k(e,t){if(!document.body.contains(e.currentContainer)){var n=document.getElementById(e.get("id"));n&&(e.currentContainer=n)}e.currentContainer.parentElement&&e.currentContainer.parentElement.replaceChild(t,e.currentContainer),e.currentContainer=t}var C=n(42),x=n(0),E=n(17),S=n(11),P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},T={autostart:!1,castAvailable:!1,controls:!0,defaultPlaybackRate:1,displaydescription:!0,displaytitle:!0,height:360,liveTimeout:null,localization:{player:"Video Player",play:"Play",playback:"Start Playback",pause:"Pause",volume:"Volume",prev:"Previous",next:"Next",cast:"Chromecast",airplay:"AirPlay",fullscreen:"Fullscreen",playlist:"Playlist",hd:"Quality",cc:"Closed Captions",audioTracks:"Audio Tracks",playbackRates:"Playback Rates",replay:"Replay",buffer:"Loading",more:"More",liveBroadcast:"Live",loadingAd:"Loading ad",rewind:"Rewind 10 Seconds",nextUp:"Next Up",nextUpClose:"Next Up Close",related:"More Videos",close:"Close",settings:"Settings",unmute:"Unmute",copied:"Copied"},mute:!1,nextUpDisplay:!0,playbackRateControls:!1,playbackRates:[.5,1,1.25,1.5,2],renderCaptionsNatively:!1,repeat:!1,stretching:"uniform",volume:90,width:640},_=function(e,t){var a=P({},(window.jwplayer||{}).defaults,t,e);r(a),a.localization=P({},T.localization,a.localization);var u=P({},T,a);"."===u.base&&(u.base=Object(E.getScriptPath)("jwplayer.js")),u.base=(u.base||Object(E.loadFrom)()).replace(/\/?$/,"/"),n.p=u.base,u.width=i(u.width),u.height=i(u.height),u.aspectratio=o(u.aspectratio,u.width);var c=u.playbackRateControls;if(c){var s=u.playbackRates;Array.isArray(c)&&(s=c),s=s.filter(function(e){return x.c.isNumber(e)&&e>=.25&&e<=4}).map(function(e){return Math.round(4*e)/4}),s.indexOf(1)<0&&s.push(1),s.sort(),u.playbackRateControls=!0,u.playbackRates=s}(!u.playbackRateControls||u.playbackRates.indexOf(u.defaultPlaybackRate)<0)&&(u.defaultPlaybackRate=1),u.playbackRate=u.defaultPlaybackRate,u.aspectratio||delete u.aspectratio;var l=u.playlist;if(l)Array.isArray(l.playlist)&&(u.feedData=l,u.playlist=l.playlist);else{var f=x.c.pick(u,["title","description","type","mediaid","image","file","sources","tracks","preload","duration"]);u.playlist=[f]}u.qualityLabels=u.qualityLabels||u.hlslabels,delete u.duration;var d=u.liveTimeout;return null!==d&&(Object(x.a)(d)||!Object(x.b)(d)?d=null:0!==d&&(d=Math.max(30,d)),u.liveTimeout=d),u},N=_,L=n(36),A=n(15),M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F=function(e,t){var r=N(e,t),i=r.key||window.jwplayer&&window.jwplayer.key,o=new L.a(i),u=o.edition();if(r.key=i,r.edition=u,r.error=null,"unlimited"===u){var c=Object(E.getScriptPath)("jwplayer.js");if(!c)throw new Error("Error setting up player: Could not locate jwplayer.js script tag");n.p=c}if("invalid"===u){var l=void 0===i?"Missing":"Invalid";r.error=new Error("Error setting up player: "+l+" license key")}r.flashplayer=a(r),r.plugins=s(r);var f=r.ab;return f&&Object.keys(f.tests).forEach(function(e){f.tests[e].forEach(function(e){e.addConfig&&e.addConfig(r,e.selection)})}),r},I=F,R=n(9),B=n(5),D=n(1),q=n(51),X=n(32),Q=n(25),z=function(e){return h(e)?D.a.reject():D.a.all([d(e),v(e)])},V=z,W=n(30),H=n(20),U=function(e){var t=void 0;this.start=function(n){var r=D.a.all([Object(R.c)(e),g(e),Object(H.a)(e,n)]),i=new D.a(function(e,n){t=setTimeout(function(){n(new Error("Setup Timeout Error: Setup took longer than 30 seconds to complete."))},3e4);var i=function(){clearTimeout(t),e()};r.then(i).catch(i)});return D.a.race([r,i])},this.destroy=function(){clearTimeout(t),e=null}},J=U,$=n(29),K=n(23),Y=n(16),G=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Z={removeItem:function(){}};try{Z=window.localStorage||Z}catch(e){}G(y.prototype,{getAllItems:function(){var e=this;return this.items.reduce(function(t,n){var r=Z[e.namespace+"."+n];return r&&(t[n]=Object(S.serialize)(r)),t},{})},track:function(e){var t=this;this.items.forEach(function(n){e.on("change:"+n,function(e,r){try{Z[t.namespace+"."+n]=r}catch(e){Y.a.debug&&console.error(e)}})})},clear:function(){var e=this;this.items.forEach(function(t){Z.removeItem(e.namespace+"."+t)})}});var ee=y,te=n(45),ne=n(46),re=n(7),ie=n(43),oe=n(44),ae=n(8),ue=n(52);t.b=k;var ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},se=function(){};ce(se.prototype,te.a);var le=function(e){this._events={},this.modelShim=new se,this.modelShim._qoeItem=new K.a,this.mediaShim={},this.setup=new J(this.modelShim),this.currentContainer=this.originalContainer=e,this.apiQueue=new C.a(this,["load","play","pause","seek","stop","playlistItem","playlistNext","playlistPrev","next","setConfig","setCurrentAudioTrack","setCurrentCaptions","setCurrentQuality","setFullscreen","addButton","removeButton","castToggle","setMute","setVolume","setPlaybackRate","setCues","resize","setCaptions","setControls"],function(){return!0})};ce(le.prototype,{on:re.a.on,once:re.a.once,off:re.a.off,trigger:re.a.trigger,init:function(e,t){var n=this,r=this.modelShim,i=new ee("jwplayer",["volume","mute","captionLabel","qualityLabel"]),o=i&&i.getAllItems();r.attributes=r.attributes||{},ce(this.mediaShim,ne.a);var a=e,u=I(ce({},e),o);u.id=t.id,u.setupConfig=a,ce(r.attributes,u,ne.b),r.getProviders=function(){return new $.a(u)},r.setProvider=function(){};var c=b();return ae.Features.backgroundLoading||(c=Object(ue.a)(c.getPrimedElement(),c)),c.prime(),this.setup.start(t).then(function(e){var r=e[0];if(n.setup){var o=n.modelShim.clone();if(o.error instanceof Error)throw o.error;var a=n.apiQueue.queue.slice(0);n.apiQueue.destroy(),ce(n,r.prototype),n.setup(o,t,n.originalContainer,n._events,a,c);var u=n._model;return i.track(u),n.updatePlaylist(u.get("playlist"),u.get("feedData"))}}).then(function(){n.setup&&n.playerReady()}).catch(function(e){n.setup&&O(n,e)})},playerDestroy:function(){this.apiQueue&&this.apiQueue.destroy(),this.setup&&this.setup.destroy(),this.off(),this._events=this._model=this.originalContainer=this.apiQueue=this.setup=null},getContainer:function(){return this.currentContainer},get:function(e){return e in this.mediaShim?this.mediaShim[e]:this.modelShim.get(e)},getItemQoe:function(){return this.modelShim._qoeItem},getConfig:function(){return ce({},this.modelShim.attributes,this.mediaShim)},getCurrentCaptions:function(){return this.get("captionsIndex")},getWidth:function(){return this.get("containerWidth")},getHeight:function(){return this.get("containerHeight")},getMute:function(){return this.get("mute")},getProvider:function(){return this.get("provider")},getState:function(){return this.get("state")},getAudioTracks:function(){return null},getCaptionsList:function(){return null},getQualityLevels:function(){return null},getVisualQuality:function(){return null},getCurrentQuality:function(){return-1},getCurrentAudioTrack:function(){return-1},getSafeRegion:function(){return{x:0,y:0,width:0,height:0}},isBeforeComplete:function(){return!1},isBeforePlay:function(){return!1},createInstream:function(){return null},skipAd:function(){},attachMedia:function(){},detachMedia:function(){return null}});t.a=le},function(e,t,n){"use strict";function r(){return o||(o=n.e(4).then(function(t){var r=n(3).default;return e.controls=r,r}.bind(null,n)).catch(function(){o=null,Object(i.b)()})),o}n.d(t,"b",function(){return e}),t.a=r;var i=n(9),o=null,e={}},function(e,t,n){"use strict";var r=n(5),i=n(12),o=n(39),a=n(6),u=n(7),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e){try{var a,u=e.responseXML?e.responseXML.childNodes:null,s="";if(u){for(var l=0;l<u.length&&(s=u[l],8===s.nodeType);l++);if("xml"===Object(i.b)(s)&&(s=s.nextSibling),"rss"===Object(i.b)(s)){var f=Object(o.a)(s);a=c({playlist:f},f.feedData)}}if(!a)try{var d=JSON.parse(e.responseText);if(Array.isArray(d))a={playlist:d};else{if(!Array.isArray(d.playlist))throw Error;a=d}}catch(e){throw new Error("Not a valid RSS/JSON feed")}n.trigger(r.X,a)}catch(e){t(e.message)}}function t(e){n.trigger(r.r,{message:e||"Error loading file"})}var n=c(this,u.a);this.load=function(n){a.a.ajax(n,e,t)},this.destroy=function(){this.off()}};t.a=s},function(e,t,n){"use strict";function r(e,t){return i({},t,{prime:function(){e.src||e.load()},getPrimedElement:function(){return e},clean:function(){t.clean(e)},recycle:function(){t.clean(e)}})}t.a=r;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";function r(e){var t=document.createElement("a"),n=document.createElement("a");t.href=location.href;try{return n.href=e,n.href=n.href,t.protocol+"//"+t.host!=n.protocol+"//"+n.host}catch(e){}return!0}function i(e,t,n,i){d.c.isObject(e)&&(i=e,e=i.url);var s,l=p({xhr:null,url:e,withCredentials:!1,retryWithoutCredentials:!1,timeout:6e4,timeoutId:-1,oncomplete:t||v,onerror:n||v,mimeType:i&&!i.responseType?"text/xml":"",requireValidXML:!1,responseType:i&&i.plainText?"text":""},i);if("XDomainRequest"in window&&r(e))s=l.xhr=new window.XDomainRequest,s.onload=c(l),s.ontimeout=s.onprogress=v,h=!0;else{if(!("XMLHttpRequest"in window))return void l.onerror("",e);s=l.xhr=new window.XMLHttpRequest,s.onreadystatechange=u(l)}var f=a("Error loading file",l);s.onerror=f,"overrideMimeType"in s?l.mimeType&&s.overrideMimeType(l.mimeType):h=!0;try{e=e.replace(/#.*$/,""),s.open("GET",e,!0)}catch(e){return f(e),s}if(l.responseType)try{s.responseType=l.responseType}catch(e){}l.timeout&&(l.timeoutId=setTimeout(function(){o(s),l.onerror("Timeout",e,s)},l.timeout),s.onabort=function(){clearTimeout(l.timeoutId)});try{l.withCredentials&&"withCredentials"in s&&(s.withCredentials=!0),s.send()}catch(e){f(e)}return s}function o(e){e.onload=null,e.onprogress=null,e.onreadystatechange=null,e.onerror=null,"abort"in e&&e.abort()}function a(e,t){return function(n){var r=n.currentTarget||t.xhr;if(clearTimeout(t.timeoutId),t.retryWithoutCredentials&&t.xhr.withCredentials){o(r);return void i(p({},t,{xhr:null,withCredentials:!1,retryWithoutCredentials:!1}))}t.onerror(e,t.url,r)}}function u(e){return function(t){var n=t.currentTarget||e.xhr;if(4===n.readyState){if(clearTimeout(e.timeoutId),n.status>=400){var r;return r=404===n.status?"File not found":n.status+"("+n.statusText+")",e.onerror(r,e.url,n)}if(200===n.status)return c(e)(t)}}}function c(e){return function(t){var n=t.currentTarget||e.xhr;if(clearTimeout(e.timeoutId),e.responseType){if("json"===e.responseType)return s(n,e)}else{var r,i=n.responseXML;if(i)try{r=i.firstChild}catch(e){}if(i&&r)return l(n,i,e);if(h&&n.responseText&&!i&&(i=Object(f.parseXML)(n.responseText))&&i.firstChild)return l(n,i,e);if(e.requireValidXML)return void e.onerror("Invalid XML",e.url,n)}e.oncomplete(n)}}function s(e,t){if(!e.response||d.c.isString(e.response)&&'"'!==e.responseText.substr(1))try{e=p({},e,{response:JSON.parse(e.responseText)})}catch(n){return void t.onerror("Invalid JSON",t.url,e)}return t.oncomplete(e)}function l(e,t,n){var r=t.documentElement;return n.requireValidXML&&("parsererror"===r.nodeName||r.getElementsByTagName("parsererror").length)?void n.onerror("Invalid XML",n.url,e):(e.responseXML||(e=p({},e,{responseXML:t})),n.oncomplete(e))}t.b=r,t.a=i;var f=n(11),d=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v=function(){},h=!1},function(e,t,n){"use strict";function r(e){return"hls"===e.type&&i.OS.android?!1!==e.androidhls&&(!i.Browser.firefox&&parseFloat(i.OS.version.version)>=4.4):null}t.a=r;var i=n(8)},function(e,t,n){"use strict";function r(e,t){var n=new y.a(t);return n.on(b._0,function(t){e._qoe.tick("ready"),t.setupTime=e._qoe.between("setup","ready")}),n.on("all",function(t,n){e.trigger(t,n)}),n}function i(e,t){var n=e.plugins;Object.keys(n).forEach(function(e){delete n[e]}),e.off(),t.playerDestroy(),t.getContainer().removeAttribute("data-jwplayer-id")}function o(e){for(var t=s.a.length;t--;)if(s.a[t].uniqueId===e.uniqueId){s.a.splice(t,1);break}}function a(e){var t=++x,n=e.id||"player-"+t,a=new w.a,u={},c=r(this,e);a.tick("init"),e.setAttribute("data-jwplayer-id",n),Object.defineProperties(this,{id:{get:function(){return n}},uniqueId:{get:function(){return t}},plugins:{get:function(){return u}},_qoe:{get:function(){return a}},version:{get:function(){return h.a}},Events:{get:function(){return j.a}},utils:{get:function(){return O.a}},_:{get:function(){return k.c}}}),C(this,{_events:{},setup:function(t){return a.clear("ready"),a.tick("setup"),i(this,c),c=r(this,e),c.init(t,this),this.on(t.events,null,this)},remove:function(){return o(this),this.trigger("remove"),i(this,c),this},qoe:function(){var e=c.getItemQoe();return{setupTime:this._qoe.between("setup","ready"),firstFrame:e.getFirstFrame?e.getFirstFrame():null,player:this._qoe.dump(),item:e.dump()}},getAudioTracks:function(){return c.getAudioTracks()},getBuffer:function(){return c.get("buffer")},getCaptions:function(){return c.get("captions")},getCaptionsList:function(){return c.getCaptionsList()},getConfig:function(){return c.getConfig()},getContainer:function(){return c.getContainer()},getControls:function(){return c.get("controls")},getCurrentAudioTrack:function(){return c.getCurrentAudioTrack()},getCurrentCaptions:function(){return c.getCurrentCaptions()},getCurrentQuality:function(){return c.getCurrentQuality()},getCurrentTime:function(){return c.get("currentTime")},getDuration:function(){return c.get("duration")},getEnvironment:function(){return g},getFullscreen:function(){return c.get("fullscreen")},getHeight:function(){return c.getHeight()},getItemMeta:function(){return c.get("itemMeta")||{}},getMute:function(){return c.getMute()},getPlaybackRate:function(){return c.get("playbackRate")},getPlaylist:function(){return c.get("playlist")},getPlaylistIndex:function(){return c.get("item")},getPlaylistItem:function(e){if(!O.a.exists(e))return c.get("playlistItem");var t=this.getPlaylist();return t?t[e]:null},getPosition:function(){return c.get("position")},getProvider:function(){return c.getProvider()},getQualityLevels:function(){return c.getQualityLevels()},getSafeRegion:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return c.getSafeRegion(e)},getState:function(){return c.getState()},getStretching:function(){return c.get("stretching")},getViewable:function(){return c.get("viewable")},getVisualQuality:function(){return c.getVisualQuality()},getVolume:function(){return c.get("volume")},getWidth:function(){return c.getWidth()},setCaptions:function(e){return c.setCaptions(e),this},setConfig:function(e){return c.setConfig(e),this},setControls:function(e){return c.setControls(e),this},setCurrentAudioTrack:function(e){c.setCurrentAudioTrack(e)},setCurrentCaptions:function(e){c.setCurrentCaptions(e)},setCurrentQuality:function(e){c.setCurrentQuality(e)},setFullscreen:function(e){return c.setFullscreen(e),this},setMute:function(e){return c.setMute(e),this},setPlaybackRate:function(e){return c.setPlaybackRate(e),this},setCues:function(e){return c.setCues(e),this},setVolume:function(e){return c.setVolume(e),this},load:function(e,t){return c.load(e,t),this},play:function(e){return c.play(e),this},pause:function(e){return c.pause(e),this},playToggle:function(e){switch(this.getState()){case b._9:case b._3:return this.pause(e);default:return this.play(e)}},seek:function(e,t){return c.seek(e,t),this},playlistItem:function(e,t){return c.playlistItem(e,t),this},playlistNext:function(e){return c.playlistNext(e),this},playlistPrev:function(e){return c.playlistPrev(e),this},next:function(){return c.next(),this},castToggle:function(){return c.castToggle(),this},createInstream:function(){return c.createInstream()},skipAd:function(){return c.skipAd(),this},stop:function(){return c.stop(),this},resize:function(e,t){return c.resize(e,t),this},addButton:function(e,t,n,r,i){return c.addButton(e,t,n,r,i),this},removeButton:function(e){return c.removeButton(e),this},attachMedia:function(){return c.attachMedia(),this},detachMedia:function(){return c.detachMedia(),this},isBeforeComplete:function(){return c.isBeforeComplete()},isBeforePlay:function(){return c.isBeforePlay()}})}function u(e){for(var t=0;t<s.a.length;t++)if(s.a[t].id===e)return s.a[t];return null}Object.defineProperty(t,"__esModule",{value:!0});var c=n(17),s=n(28),l=n(18),f=n(19),d={availableProviders:l.a,registerProvider:f.a},p=n(20);d.registerPlugin=function(e,t,n){"jwpsrv"!==e&&Object(p.b)(e,t,n)};var v=d,h=n(22),m=n(16),g=n(8),y=n(49),b=n(5),w=n(23),j=n(7),O=n(6),k=n(0),C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x=0;C(a.prototype,{on:function(e,t,n){return j.c.call(this,e,t,n)},once:function(e,t,n){return j.d.call(this,e,t,n)},off:function(e,t,n){return j.b.call(this,e,t,n)},trigger:function(e,t){return t=k.c.isObject(t)?C({},t):{},t.type=e,m.a.debug?j.e.call(this,e,t):j.f.call(this,e,t)},getPlugin:function(e){return this.plugins[e]},addPlugin:function(e,t){this.plugins[e]=t,this.on("ready",t.addToPlayer),t.resize&&this.on("resize",t.resizeHandler)},registerPlugin:function(e,t,n){Object(p.b)(e,t,n)},getAdBlock:function(){return!1},playAd:function(e){},pauseAd:function(e){}}),n.p=Object(c.loadFrom)();var E=function(e){var t=void 0,n=void 0;if(e?"string"==typeof e?(t=u(e))||(n=document.getElementById(e)):"number"==typeof e?t=s.a[e]:e.nodeType&&(n=e,t=u(n.id||n.getAttribute("data-jwplayer-id"))):t=s.a[0],t)return t;if(n){var r=new a(n);return s.a.push(r),r}return{registerPlugin:p.b}};Object.defineProperties(E,{api:{get:function(){return v},set:function(){}},version:{get:function(){return h.a},set:function(){}},debug:{get:function(){return m.a.debug},set:function(e){m.a.debug=!!e}}});var S=E,P=n(40),T=n(36),_=n(25),N=n(37),L=n(39),A=n(34),M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F=k.c.extend,I={};I.api=v,I._=k.c,I.version="8.2.4+commercial_v8-2-4.259.commercial.1fc75ae.hlsjs..jwplayer.0a8d18a.dai.0d5ca8d.freewheel.2d1b58a.googima.caee413.vast.7759f79.analytics.0ae6a24.gapro.f664e4e.related.d09e606",I.utils=M(O.a,{key:T.a,extend:F,scriptloader:_.a,rssparser:{parse:L.a},tea:N.a,UI:P.a}),I.utils.css.style=I.utils.style,I.vid=A.a;var R=I,B=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D=window;B(S,R);var q=S;D.jwplayer&&(q=D.jwplayer);t.default=q}]).default;