text: /*
   Copyright (C) Federico Zivolo 2017
   Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
   */(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.Popper=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=window.getComputedStyle(e,null);return t?o[t]:o}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function n(e){if(!e||-1!==['HTML','BODY','#document'].indexOf(e.nodeName))return window.document.body;var i=t(e),r=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetParent,i=o&&o.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TD','TABLE'].indexOf(o.nodeName)&&'static'===t(o,'position')?r(o):o:window.document.documentElement}function p(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||r(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return window.document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,i=o?e:t,n=o?t:e,a=document.createRange();a.setStart(i,0),a.setEnd(n,0);var f=a.commonAncestorContainer;if(e!==f&&t!==f||i.contains(n))return p(f)?f:r(f);var l=s(e);return l.host?d(l.host,t):d(e,s(t).host)}function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',i=e.nodeName;if('BODY'===i||'HTML'===i){var n=window.document.documentElement,r=window.document.scrollingElement||n;return r[o]}return e[o]}function f(e,t){var o=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=a(t,'top'),n=a(t,'left'),r=o?-1:1;return e.top+=i*r,e.bottom+=i*r,e.left+=n*r,e.right+=n*r,e}function l(e,t){var o='x'===t?'Left':'Top',i='Left'==o?'Right':'Bottom';return+e['border'+o+'Width'].split('px')[0]+ +e['border'+i+'Width'].split('px')[0]}function m(e,t,o,i){return _(t['offset'+e],o['client'+e],o['offset'+e],ie()?o['offset'+e]+i['margin'+('Height'===e?'Top':'Left')]+i['margin'+('Height'===e?'Bottom':'Right')]:0)}function h(){var e=window.document.body,t=window.document.documentElement,o=ie()&&window.getComputedStyle(t);return{height:m('Height',e,t,o),width:m('Width',e,t,o)}}function c(e){return se({},e,{right:e.left+e.width,bottom:e.top+e.height})}function g(e){var o={};if(ie())try{o=e.getBoundingClientRect();var i=a(e,'top'),n=a(e,'left');o.top+=i,o.left+=n,o.bottom+=i,o.right+=n}catch(e){}else o=e.getBoundingClientRect();var r={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},p='HTML'===e.nodeName?h():{},s=p.width||e.clientWidth||r.right-r.left,d=p.height||e.clientHeight||r.bottom-r.top,f=e.offsetWidth-s,m=e.offsetHeight-d;if(f||m){var g=t(e);f-=l(g,'x'),m-=l(g,'y'),r.width-=f,r.height-=m}return c(r)}function u(e,o){var i=ie(),r='HTML'===o.nodeName,p=g(e),s=g(o),d=n(e),a=t(o),l=+a.borderTopWidth.split('px')[0],m=+a.borderLeftWidth.split('px')[0],h=c({top:p.top-s.top-l,left:p.left-s.left-m,width:p.width,height:p.height});if(h.marginTop=0,h.marginLeft=0,!i&&r){var u=+a.marginTop.split('px')[0],b=+a.marginLeft.split('px')[0];h.top-=l-u,h.bottom-=l-u,h.left-=m-b,h.right-=m-b,h.marginTop=u,h.marginLeft=b}return(i?o.contains(d):o===d&&'BODY'!==d.nodeName)&&(h=f(h,o)),h}function b(e){var t=window.document.documentElement,o=u(e,t),i=_(t.clientWidth,window.innerWidth||0),n=_(t.clientHeight,window.innerHeight||0),r=a(t),p=a(t,'left'),s={top:r-o.top+o.marginTop,left:p-o.left+o.marginLeft,width:i,height:n};return c(s)}function y(e){var i=e.nodeName;return'BODY'===i||'HTML'===i?!1:'fixed'===t(e,'position')||y(o(e))}function w(e,t,i,r){var p={top:0,left:0},s=d(e,t);if('viewport'===r)p=b(s);else{var a;'scrollParent'===r?(a=n(o(e)),'BODY'===a.nodeName&&(a=window.document.documentElement)):'window'===r?a=window.document.documentElement:a=r;var f=u(a,s);if('HTML'===a.nodeName&&!y(s)){var l=h(),m=l.height,c=l.width;p.top+=f.top-f.marginTop,p.bottom=m+f.top,p.left+=f.left-f.marginLeft,p.right=c+f.left}else p=f}return p.left+=i,p.top+=i,p.right-=i,p.bottom-=i,p}function v(e){var t=e.width,o=e.height;return t*o}function E(e,t,o,i,n){var r=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var p=w(o,i,r,n),s={top:{width:p.width,height:t.top-p.top},right:{width:p.right-t.right,height:p.height},bottom:{width:p.width,height:p.bottom-t.bottom},left:{width:t.left-p.left,height:p.height}},d=Object.keys(s).map(function(e){return se({key:e},s[e],{area:v(s[e])})}).sort(function(e,t){return t.area-e.area}),a=d.filter(function(e){var t=e.width,i=e.height;return t>=o.clientWidth&&i>=o.clientHeight}),f=0<a.length?a[0].key:d[0].key,l=e.split('-')[1];return f+(l?'-'+l:'')}function x(e,t,o){var i=d(t,o);return u(o,i)}function O(e){var t=window.getComputedStyle(e),o=parseFloat(t.marginTop)+parseFloat(t.marginBottom),i=parseFloat(t.marginLeft)+parseFloat(t.marginRight),n={width:e.offsetWidth+i,height:e.offsetHeight+o};return n}function L(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function S(e,t,o){o=o.split('-')[0];var i=O(e),n={width:i.width,height:i.height},r=-1!==['right','left'].indexOf(o),p=r?'top':'left',s=r?'left':'top',d=r?'height':'width',a=r?'width':'height';return n[p]=t[p]+t[d]/2-i[d]/2,n[s]=o===s?t[s]-i[a]:t[L(s)],n}function T(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function C(e,t,o){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===o});var i=T(e,function(e){return e[t]===o});return e.indexOf(i)}function N(t,o,i){var n=void 0===i?t:t.slice(0,C(t,'name',i));return n.forEach(function(t){t.function&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var i=t.function||t.fn;t.enabled&&e(i)&&(o.offsets.popper=c(o.offsets.popper),o.offsets.reference=c(o.offsets.reference),o=i(o,t))}),o}function k(){if(!this.state.isDestroyed){var e={instance:this,styles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=x(this.state,this.popper,this.reference),e.placement=E(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=S(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position='absolute',e=N(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function W(e,t){return e.some(function(e){var o=e.name,i=e.enabled;return i&&o===t})}function B(e){for(var t=[!1,'ms','Webkit','Moz','O'],o=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<t.length-1;n++){var i=t[n],r=i?''+i+o:e;if('undefined'!=typeof window.document.body.style[r])return r}return null}function D(){return this.state.isDestroyed=!0,W(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[B('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function H(e,t,o,i){var r='BODY'===e.nodeName,p=r?window:e;p.addEventListener(t,o,{passive:!0}),r||H(n(p.parentNode),t,o,i),i.push(p)}function P(e,t,o,i){o.updateBound=i,window.addEventListener('resize',o.updateBound,{passive:!0});var r=n(e);return H(r,'scroll',o.updateBound,o.scrollParents),o.scrollElement=r,o.eventsEnabled=!0,o}function A(){this.state.eventsEnabled||(this.state=P(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return window.removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function I(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function R(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function U(e,t){Object.keys(t).forEach(function(o){var i='';-1!==['width','height','top','right','bottom','left'].indexOf(o)&&R(t[o])&&(i='px'),e.style[o]=t[o]+i})}function Y(e,t){Object.keys(t).forEach(function(o){var i=t[o];!1===i?e.removeAttribute(o):e.setAttribute(o,t[o])})}function F(e,t,o){var i=T(e,function(e){var o=e.name;return o===t}),n=!!i&&e.some(function(e){return e.name===o&&e.enabled&&e.order<i.order});if(!n){var r='`'+t+'`';console.warn('`'+o+'`'+' modifier is required by '+r+' modifier in order to work, be sure to include it before '+r+'!')}return n}function j(e){return'end'===e?'start':'start'===e?'end':e}function K(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=ae.indexOf(e),i=ae.slice(o+1).concat(ae.slice(0,o));return t?i.reverse():i}function q(e,t,o,i){var n=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+n[1],p=n[2];if(!r)return e;if(0===p.indexOf('%')){var s;switch(p){case'%p':s=o;break;case'%':case'%r':default:s=i;}var d=c(s);return d[t]/100*r}if('vh'===p||'vw'===p){var a;return a='vh'===p?_(document.documentElement.clientHeight,window.innerHeight||0):_(document.documentElement.clientWidth,window.innerWidth||0),a/100*r}return r}function G(e,t,o,i){var n=[0,0],r=-1!==['right','left'].indexOf(i),p=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=p.indexOf(T(p,function(e){return-1!==e.search(/,|\s/)}));p[s]&&-1===p[s].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var d=/\s*,\s*|\s+/,a=-1===s?[p]:[p.slice(0,s).concat([p[s].split(d)[0]]),[p[s].split(d)[1]].concat(p.slice(s+1))];return a=a.map(function(e,i){var n=(1===i?!r:r)?'height':'width',p=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,p=!0,e):p?(e[e.length-1]+=t,p=!1,e):e.concat(t)},[]).map(function(e){return q(e,n,t,o)})}),a.forEach(function(e,t){e.forEach(function(o,i){R(o)&&(n[t]+=o*('-'===e[i-1]?-1:1))})}),n}for(var z=Math.min,V=Math.floor,_=Math.max,X=['native code','[object MutationObserverConstructor]'],Q=function(e){return X.some(function(t){return-1<(e||'').toString().indexOf(t)})},J='undefined'!=typeof window,Z=['Edge','Trident','Firefox'],$=0,ee=0;ee<Z.length;ee+=1)if(J&&0<=navigator.userAgent.indexOf(Z[ee])){$=1;break}var i,te=J&&Q(window.MutationObserver),oe=te?function(e){var t=!1,o=0,i=document.createElement('span'),n=new MutationObserver(function(){e(),t=!1});return n.observe(i,{attributes:!0}),function(){t||(t=!0,i.setAttribute('x-index',o),++o)}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},$))}},ie=function(){return void 0==i&&(i=-1!==navigator.appVersion.indexOf('MSIE 10')),i},ne=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},re=function(){function e(e,t){for(var o,n=0;n<t.length;n++)o=t[n],o.enumerable=o.enumerable||!1,o.configurable=!0,'value'in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}(),pe=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},se=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var i in t=arguments[o],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},de=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],ae=de.slice(3),fe={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},le=function(){function t(o,i){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};ne(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(n.update)},this.update=oe(this.update.bind(this)),this.options=se({},t.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=o.jquery?o[0]:o,this.popper=i.jquery?i[0]:i,this.options.modifiers={},Object.keys(se({},t.Defaults.modifiers,r.modifiers)).forEach(function(e){n.options.modifiers[e]=se({},t.Defaults.modifiers[e]||{},r.modifiers?r.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return se({name:e},n.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(n.reference,n.popper,n.options,t,n.state)}),this.update();var p=this.options.eventsEnabled;p&&this.enableEventListeners(),this.state.eventsEnabled=p}return re(t,[{key:'update',value:function(){return k.call(this)}},{key:'destroy',value:function(){return D.call(this)}},{key:'enableEventListeners',value:function(){return A.call(this)}},{key:'disableEventListeners',value:function(){return I.call(this)}}]),t}();return le.Utils=('undefined'==typeof window?global:window).PopperUtils,le.placements=de,le.Defaults={placement:'bottom',eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,o=t.split('-')[0],i=t.split('-')[1];if(i){var n=e.offsets,r=n.reference,p=n.popper,s=-1!==['bottom','top'].indexOf(o),d=s?'left':'top',a=s?'width':'height',f={start:pe({},d,r[d]),end:pe({},d,r[d]+r[a]-p[a])};e.offsets.popper=se({},p,f[i])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var o,i=t.offset,n=e.placement,r=e.offsets,p=r.popper,s=r.reference,d=n.split('-')[0];return o=R(+i)?[+i,0]:G(i,p,s,d),'left'===d?(p.top+=o[0],p.left-=o[1]):'right'===d?(p.top+=o[0],p.left+=o[1]):'top'===d?(p.left+=o[0],p.top-=o[1]):'bottom'===d&&(p.left+=o[0],p.top+=o[1]),e.popper=p,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var o=t.boundariesElement||r(e.instance.popper);e.instance.reference===o&&(o=r(o));var i=w(e.instance.popper,e.instance.reference,t.padding,o);t.boundaries=i;var n=t.priority,p=e.offsets.popper,s={primary:function(e){var o=p[e];return p[e]<i[e]&&!t.escapeWithReference&&(o=_(p[e],i[e])),pe({},e,o)},secondary:function(e){var o='right'===e?'left':'top',n=p[o];return p[e]>i[e]&&!t.escapeWithReference&&(n=z(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=V,p=-1!==['top','bottom'].indexOf(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]<r(i[d])&&(e.offsets.popper[d]=r(i[d])-o[a]),o[d]>r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){if(!F(e.instance.modifiers,'arrow','keepTogether'))return e;var o=t.element;if('string'==typeof o){if(o=e.instance.popper.querySelector(o),!o)return e;}else if(!e.instance.popper.contains(o))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var i=e.placement.split('-')[0],n=e.offsets,r=n.popper,p=n.reference,s=-1!==['left','right'].indexOf(i),d=s?'height':'width',a=s?'top':'left',f=s?'left':'top',l=s?'bottom':'right',m=O(o)[d];p[l]-m<r[a]&&(e.offsets.popper[a]-=r[a]-(p[l]-m)),p[a]+m>r[l]&&(e.offsets.popper[a]+=p[a]+m-r[l]);var h=p[a]+p[d]/2-m/2,g=h-c(e.offsets.popper)[a];return g=_(z(r[d]-m,g),0),e.arrowElement=o,e.offsets.arrow={},e.offsets.arrow[a]=Math.round(g),e.offsets.arrow[f]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(W(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),i=e.placement.split('-')[0],n=L(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.FLIP:p=[i,n];break;case fe.CLOCKWISE:p=K(i);break;case fe.COUNTERCLOCKWISE:p=K(i,!0);break;default:p=t.behavior;}return p.forEach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=L(i);var a=e.offsets.popper,f=e.offsets.reference,l=V,m='left'===i&&l(a.right)>l(f.left)||'right'===i&&l(a.left)<l(f.right)||'top'===i&&l(a.bottom)>l(f.top)||'bottom'===i&&l(a.top)<l(f.bottom),h=l(a.left)<l(o.left),c=l(a.right)>l(o.right),g=l(a.top)<l(o.top),u=l(a.bottom)>l(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexOf(i),w=!!t.flipVariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,S(e.instance.popper,e.offsets.reference,e.placement)),e=N(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexOf(o),s=-1===['top','left'].indexOf(o);return n[p?'left':'top']=r[t]-(s?n[p?'width':'height']:0),e.placement=L(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!F(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,o=T(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<o.top||t.left>o.right||t.top>o.bottom||t.right<o.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var o=t.x,i=t.y,n=e.offsets.popper,p=T(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==p&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var s,d,a=void 0===p?t.gpuAcceleration:p,f=r(e.instance.popper),l=g(f),m={position:n.position},h={left:V(n.left),top:V(n.top),bottom:V(n.bottom),right:V(n.right)},c='bottom'===o?'top':'bottom',u='right'===i?'left':'right',b=B('transform');if(d='bottom'==c?-l.height+h.bottom:h.top,s='right'==u?-l.width+h.right:h.left,a&&b)m[b]='translate3d('+s+'px, '+d+'px, 0)',m[c]=0,m[u]=0,m.willChange='transform';else{var y='bottom'==c?-1:1,w='right'==u?-1:1;m[c]=d*y,m[u]=s*w,m.willChange=c+', '+u}var v={"x-placement":e.placement};return e.attributes=se({},v,e.attributes),e.styles=se({},m,e.styles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return U(e.instance.popper,e.styles),Y(e.instance.popper,e.attributes),e.offsets.arrow&&U(e.arrowElement,e.offsets.arrow),e},onLoad:function(e,t,o,i,n){var r=x(n,t,e),p=E(o.placement,r,t,e,o.modifiers.flip.boundariesElement,o.modifiers.flip.padding);return t.setAttribute('x-placement',p),U(t,{position:'absolute'}),o},gpuAcceleration:void 0}}},le});
  //# sourceMappingURL=popper.min.js.map
  
  /*!
    * Bootstrap v4.0.0 (https://getbootstrap.com)
    * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
    * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
    */
  (function (global, factory) {
  	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  	typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  	(factory((global.bootstrap = {}),global.jQuery,global.Popper));
  }(this, (function (exports,$,Popper) { 'use strict';
  
  $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  
  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  
  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }
  
  function _extends() {
    _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];
  
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }
  
      return target;
    };
  
    return _extends.apply(this, arguments);
  }
  
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
  }
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): util.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Util = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Private TransitionEnd Helpers
     * ------------------------------------------------------------------------
     */
    var transition = false;
    var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  
    function toType(obj) {
      return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
    }
  
    function getSpecialTransitionEndEvent() {
      return {
        bindType: transition.end,
        delegateType: transition.end,
        handle: function handle(event) {
          if ($$$1(event.target).is(this)) {
            return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
          }
  
          return undefined; // eslint-disable-line no-undefined
        }
      };
    }
  
    function transitionEndTest() {
      if (typeof window !== 'undefined' && window.QUnit) {
        return false;
      }
  
      return {
        end: 'transitionend'
      };
    }
  
    function transitionEndEmulator(duration) {
      var _this = this;
  
      var called = false;
      $$$1(this).one(Util.TRANSITION_END, function () {
        called = true;
      });
      setTimeout(function () {
        if (!called) {
          Util.triggerTransitionEnd(_this);
        }
      }, duration);
      return this;
    }
  
    function setTransitionEndSupport() {
      transition = transitionEndTest();
      $$$1.fn.emulateTransitionEnd = transitionEndEmulator;
  
      if (Util.supportsTransitionEnd()) {
        $$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
      }
    }
  
    function escapeId(selector) {
      // We escape IDs in case of special selectors (selector = '#myId:something')
      // $.escapeSelector does not exist in jQuery < 3
      selector = typeof $$$1.escapeSelector === 'function' ? $$$1.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
      return selector;
    }
    /**
     * --------------------------------------------------------------------------
     * Public Util Api
     * --------------------------------------------------------------------------
     */
  
  
    var Util = {
      TRANSITION_END: 'bsTransitionEnd',
      getUID: function getUID(prefix) {
        do {
          // eslint-disable-next-line no-bitwise
          prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
        } while (document.getElementById(prefix));
  
        return prefix;
      },
      getSelectorFromElement: function getSelectorFromElement(element) {
        var selector = element.getAttribute('data-target');
  
        if (!selector || selector === '#') {
          selector = element.getAttribute('href') || '';
        } // If it's an ID
  
  
        if (selector.charAt(0) === '#') {
          selector = escapeId(selector);
        }
  
        try {
          var $selector = $$$1(document).find(selector);
          return $selector.length > 0 ? selector : null;
        } catch (err) {
          return null;
        }
      },
      reflow: function reflow(element) {
        return element.offsetHeight;
      },
      triggerTransitionEnd: function triggerTransitionEnd(element) {
        $$$1(element).trigger(transition.end);
      },
      supportsTransitionEnd: function supportsTransitionEnd() {
        return Boolean(transition);
      },
      isElement: function isElement(obj) {
        return (obj[0] || obj).nodeType;
      },
      typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
        for (var property in configTypes) {
          if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
            var expectedTypes = configTypes[property];
            var value = config[property];
            var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  
            if (!new RegExp(expectedTypes).test(valueType)) {
              throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
            }
          }
        }
      }
    };
    setTransitionEndSupport();
    return Util;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): alert.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Alert = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'alert';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.alert';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 150;
    var Selector = {
      DISMISS: '[data-dismiss="alert"]'
    };
    var Event = {
      CLOSE: "close" + EVENT_KEY,
      CLOSED: "closed" + EVENT_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      ALERT: 'alert',
      FADE: 'fade',
      SHOW: 'show'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Alert =
    /*#__PURE__*/
    function () {
      function Alert(element) {
        this._element = element;
      } // Getters
  
  
      var _proto = Alert.prototype;
  
      // Public
      _proto.close = function close(element) {
        element = element || this._element;
  
        var rootElement = this._getRootElement(element);
  
        var customEvent = this._triggerCloseEvent(rootElement);
  
        if (customEvent.isDefaultPrevented()) {
          return;
        }
  
        this._removeElement(rootElement);
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        this._element = null;
      }; // Private
  
  
      _proto._getRootElement = function _getRootElement(element) {
        var selector = Util.getSelectorFromElement(element);
        var parent = false;
  
        if (selector) {
          parent = $$$1(selector)[0];
        }
  
        if (!parent) {
          parent = $$$1(element).closest("." + ClassName.ALERT)[0];
        }
  
        return parent;
      };
  
      _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
        var closeEvent = $$$1.Event(Event.CLOSE);
        $$$1(element).trigger(closeEvent);
        return closeEvent;
      };
  
      _proto._removeElement = function _removeElement(element) {
        var _this = this;
  
        $$$1(element).removeClass(ClassName.SHOW);
  
        if (!Util.supportsTransitionEnd() || !$$$1(element).hasClass(ClassName.FADE)) {
          this._destroyElement(element);
  
          return;
        }
  
        $$$1(element).one(Util.TRANSITION_END, function (event) {
          return _this._destroyElement(element, event);
        }).emulateTransitionEnd(TRANSITION_DURATION);
      };
  
      _proto._destroyElement = function _destroyElement(element) {
        $$$1(element).detach().trigger(Event.CLOSED).remove();
      }; // Static
  
  
      Alert._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var $element = $$$1(this);
          var data = $element.data(DATA_KEY);
  
          if (!data) {
            data = new Alert(this);
            $element.data(DATA_KEY, data);
          }
  
          if (config === 'close') {
            data[config](this);
          }
        });
      };
  
      Alert._handleDismiss = function _handleDismiss(alertInstance) {
        return function (event) {
          if (event) {
            event.preventDefault();
          }
  
          alertInstance.close(this);
        };
      };
  
      _createClass(Alert, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }]);
      return Alert;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Alert._jQueryInterface;
    $$$1.fn[NAME].Constructor = Alert;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert._jQueryInterface;
    };
  
    return Alert;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): button.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Button = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'button';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.button';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var ClassName = {
      ACTIVE: 'active',
      BUTTON: 'btn',
      FOCUS: 'focus'
    };
    var Selector = {
      DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
      DATA_TOGGLE: '[data-toggle="buttons"]',
      INPUT: 'input',
      ACTIVE: '.active',
      BUTTON: '.btn'
    };
    var Event = {
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
      FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Button =
    /*#__PURE__*/
    function () {
      function Button(element) {
        this._element = element;
      } // Getters
  
  
      var _proto = Button.prototype;
  
      // Public
      _proto.toggle = function toggle() {
        var triggerChangeEvent = true;
        var addAriaPressed = true;
        var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
  
        if (rootElement) {
          var input = $$$1(this._element).find(Selector.INPUT)[0];
  
          if (input) {
            if (input.type === 'radio') {
              if (input.checked && $$$1(this._element).hasClass(ClassName.ACTIVE)) {
                triggerChangeEvent = false;
              } else {
                var activeElement = $$$1(rootElement).find(Selector.ACTIVE)[0];
  
                if (activeElement) {
                  $$$1(activeElement).removeClass(ClassName.ACTIVE);
                }
              }
            }
  
            if (triggerChangeEvent) {
              if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
                return;
              }
  
              input.checked = !$$$1(this._element).hasClass(ClassName.ACTIVE);
              $$$1(input).trigger('change');
            }
  
            input.focus();
            addAriaPressed = false;
          }
        }
  
        if (addAriaPressed) {
          this._element.setAttribute('aria-pressed', !$$$1(this._element).hasClass(ClassName.ACTIVE));
        }
  
        if (triggerChangeEvent) {
          $$$1(this._element).toggleClass(ClassName.ACTIVE);
        }
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        this._element = null;
      }; // Static
  
  
      Button._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          if (!data) {
            data = new Button(this);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (config === 'toggle') {
            data[config]();
          }
        });
      };
  
      _createClass(Button, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }]);
      return Button;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
      event.preventDefault();
      var button = event.target;
  
      if (!$$$1(button).hasClass(ClassName.BUTTON)) {
        button = $$$1(button).closest(Selector.BUTTON);
      }
  
      Button._jQueryInterface.call($$$1(button), 'toggle');
    }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
      var button = $$$1(event.target).closest(Selector.BUTTON)[0];
      $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Button._jQueryInterface;
    $$$1.fn[NAME].Constructor = Button;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Button._jQueryInterface;
    };
  
    return Button;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): carousel.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Carousel = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'carousel';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.carousel';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 600;
    var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  
    var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  
    var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  
    var Default = {
      interval: 5000,
      keyboard: true,
      slide: false,
      pause: 'hover',
      wrap: true
    };
    var DefaultType = {
      interval: '(number|boolean)',
      keyboard: 'boolean',
      slide: '(boolean|string)',
      pause: '(string|boolean)',
      wrap: 'boolean'
    };
    var Direction = {
      NEXT: 'next',
      PREV: 'prev',
      LEFT: 'left',
      RIGHT: 'right'
    };
    var Event = {
      SLIDE: "slide" + EVENT_KEY,
      SLID: "slid" + EVENT_KEY,
      KEYDOWN: "keydown" + EVENT_KEY,
      MOUSEENTER: "mouseenter" + EVENT_KEY,
      MOUSELEAVE: "mouseleave" + EVENT_KEY,
      TOUCHEND: "touchend" + EVENT_KEY,
      LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      CAROUSEL: 'carousel',
      ACTIVE: 'active',
      SLIDE: 'slide',
      RIGHT: 'carousel-item-right',
      LEFT: 'carousel-item-left',
      NEXT: 'carousel-item-next',
      PREV: 'carousel-item-prev',
      ITEM: 'carousel-item'
    };
    var Selector = {
      ACTIVE: '.active',
      ACTIVE_ITEM: '.active.carousel-item',
      ITEM: '.carousel-item',
      NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
      INDICATORS: '.carousel-indicators',
      DATA_SLIDE: '[data-slide], [data-slide-to]',
      DATA_RIDE: '[data-ride="carousel"]'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Carousel =
    /*#__PURE__*/
    function () {
      function Carousel(element, config) {
        this._items = null;
        this._interval = null;
        this._activeElement = null;
        this._isPaused = false;
        this._isSliding = false;
        this.touchTimeout = null;
        this._config = this._getConfig(config);
        this._element = $$$1(element)[0];
        this._indicatorsElement = $$$1(this._element).find(Selector.INDICATORS)[0];
  
        this._addEventListeners();
      } // Getters
  
  
      var _proto = Carousel.prototype;
  
      // Public
      _proto.next = function next() {
        if (!this._isSliding) {
          this._slide(Direction.NEXT);
        }
      };
  
      _proto.nextWhenVisible = function nextWhenVisible() {
        // Don't call next when the page isn't visible
        // or the carousel or its parent isn't visible
        if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') {
          this.next();
        }
      };
  
      _proto.prev = function prev() {
        if (!this._isSliding) {
          this._slide(Direction.PREV);
        }
      };
  
      _proto.pause = function pause(event) {
        if (!event) {
          this._isPaused = true;
        }
  
        if ($$$1(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
          Util.triggerTransitionEnd(this._element);
          this.cycle(true);
        }
  
        clearInterval(this._interval);
        this._interval = null;
      };
  
      _proto.cycle = function cycle(event) {
        if (!event) {
          this._isPaused = false;
        }
  
        if (this._interval) {
          clearInterval(this._interval);
          this._interval = null;
        }
  
        if (this._config.interval && !this._isPaused) {
          this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
        }
      };
  
      _proto.to = function to(index) {
        var _this = this;
  
        this._activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0];
  
        var activeIndex = this._getItemIndex(this._activeElement);
  
        if (index > this._items.length - 1 || index < 0) {
          return;
        }
  
        if (this._isSliding) {
          $$$1(this._element).one(Event.SLID, function () {
            return _this.to(index);
          });
          return;
        }
  
        if (activeIndex === index) {
          this.pause();
          this.cycle();
          return;
        }
  
        var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  
        this._slide(direction, this._items[index]);
      };
  
      _proto.dispose = function dispose() {
        $$$1(this._element).off(EVENT_KEY);
        $$$1.removeData(this._element, DATA_KEY);
        this._items = null;
        this._config = null;
        this._element = null;
        this._interval = null;
        this._isPaused = null;
        this._isSliding = null;
        this._activeElement = null;
        this._indicatorsElement = null;
      }; // Private
  
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, Default, config);
        Util.typeCheckConfig(NAME, config, DefaultType);
        return config;
      };
  
      _proto._addEventListeners = function _addEventListeners() {
        var _this2 = this;
  
        if (this._config.keyboard) {
          $$$1(this._element).on(Event.KEYDOWN, function (event) {
            return _this2._keydown(event);
          });
        }
  
        if (this._config.pause === 'hover') {
          $$$1(this._element).on(Event.MOUSEENTER, function (event) {
            return _this2.pause(event);
          }).on(Event.MOUSELEAVE, function (event) {
            return _this2.cycle(event);
          });
  
          if ('ontouchstart' in document.documentElement) {
            // If it's a touch-enabled device, mouseenter/leave are fired as
            // part of the mouse compatibility events on first tap - the carousel
            // would stop cycling until user tapped out of it;
            // here, we listen for touchend, explicitly pause the carousel
            // (as if it's the second time we tap on it, mouseenter compat event
            // is NOT fired) and after a timeout (to allow for mouse compatibility
            // events to fire) we explicitly restart cycling
            $$$1(this._element).on(Event.TOUCHEND, function () {
              _this2.pause();
  
              if (_this2.touchTimeout) {
                clearTimeout(_this2.touchTimeout);
              }
  
              _this2.touchTimeout = setTimeout(function (event) {
                return _this2.cycle(event);
              }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
            });
          }
        }
      };
  
      _proto._keydown = function _keydown(event) {
        if (/input|textarea/i.test(event.target.tagName)) {
          return;
        }
  
        switch (event.which) {
          case ARROW_LEFT_KEYCODE:
            event.preventDefault();
            this.prev();
            break;
  
          case ARROW_RIGHT_KEYCODE:
            event.preventDefault();
            this.next();
            break;
  
          default:
        }
      };
  
      _proto._getItemIndex = function _getItemIndex(element) {
        this._items = $$$1.makeArray($$$1(element).parent().find(Selector.ITEM));
        return this._items.indexOf(element);
      };
  
      _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
        var isNextDirection = direction === Direction.NEXT;
        var isPrevDirection = direction === Direction.PREV;
  
        var activeIndex = this._getItemIndex(activeElement);
  
        var lastItemIndex = this._items.length - 1;
        var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  
        if (isGoingToWrap && !this._config.wrap) {
          return activeElement;
        }
  
        var delta = direction === Direction.PREV ? -1 : 1;
        var itemIndex = (activeIndex + delta) % this._items.length;
        return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
      };
  
      _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
        var targetIndex = this._getItemIndex(relatedTarget);
  
        var fromIndex = this._getItemIndex($$$1(this._element).find(Selector.ACTIVE_ITEM)[0]);
  
        var slideEvent = $$$1.Event(Event.SLIDE, {
          relatedTarget: relatedTarget,
          direction: eventDirectionName,
          from: fromIndex,
          to: targetIndex
        });
        $$$1(this._element).trigger(slideEvent);
        return slideEvent;
      };
  
      _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
        if (this._indicatorsElement) {
          $$$1(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  
          var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  
          if (nextIndicator) {
            $$$1(nextIndicator).addClass(ClassName.ACTIVE);
          }
        }
      };
  
      _proto._slide = function _slide(direction, element) {
        var _this3 = this;
  
        var activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0];
  
        var activeElementIndex = this._getItemIndex(activeElement);
  
        var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  
        var nextElementIndex = this._getItemIndex(nextElement);
  
        var isCycling = Boolean(this._interval);
        var directionalClassName;
        var orderClassName;
        var eventDirectionName;
  
        if (direction === Direction.NEXT) {
          directionalClassName = ClassName.LEFT;
          orderClassName = ClassName.NEXT;
          eventDirectionName = Direction.LEFT;
        } else {
          directionalClassName = ClassName.RIGHT;
          orderClassName = ClassName.PREV;
          eventDirectionName = Direction.RIGHT;
        }
  
        if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) {
          this._isSliding = false;
          return;
        }
  
        var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  
        if (slideEvent.isDefaultPrevented()) {
          return;
        }
  
        if (!activeElement || !nextElement) {
          // Some weirdness is happening, so we bail
          return;
        }
  
        this._isSliding = true;
  
        if (isCycling) {
          this.pause();
        }
  
        this._setActiveIndicatorElement(nextElement);
  
        var slidEvent = $$$1.Event(Event.SLID, {
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
  
        if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.SLIDE)) {
          $$$1(nextElement).addClass(orderClassName);
          Util.reflow(nextElement);
          $$$1(activeElement).addClass(directionalClassName);
          $$$1(nextElement).addClass(directionalClassName);
          $$$1(activeElement).one(Util.TRANSITION_END, function () {
            $$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
            $$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
            _this3._isSliding = false;
            setTimeout(function () {
              return $$$1(_this3._element).trigger(slidEvent);
            }, 0);
          }).emulateTransitionEnd(TRANSITION_DURATION);
        } else {
          $$$1(activeElement).removeClass(ClassName.ACTIVE);
          $$$1(nextElement).addClass(ClassName.ACTIVE);
          this._isSliding = false;
          $$$1(this._element).trigger(slidEvent);
        }
  
        if (isCycling) {
          this.cycle();
        }
      }; // Static
  
  
      Carousel._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = _extends({}, Default, $$$1(this).data());
  
          if (typeof config === 'object') {
            _config = _extends({}, _config, config);
          }
  
          var action = typeof config === 'string' ? config : _config.slide;
  
          if (!data) {
            data = new Carousel(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'number') {
            data.to(config);
          } else if (typeof action === 'string') {
            if (typeof data[action] === 'undefined') {
              throw new TypeError("No method named \"" + action + "\"");
            }
  
            data[action]();
          } else if (_config.interval) {
            data.pause();
            data.cycle();
          }
        });
      };
  
      Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
        var selector = Util.getSelectorFromElement(this);
  
        if (!selector) {
          return;
        }
  
        var target = $$$1(selector)[0];
  
        if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) {
          return;
        }
  
        var config = _extends({}, $$$1(target).data(), $$$1(this).data());
        var slideIndex = this.getAttribute('data-slide-to');
  
        if (slideIndex) {
          config.interval = false;
        }
  
        Carousel._jQueryInterface.call($$$1(target), config);
  
        if (slideIndex) {
          $$$1(target).data(DATA_KEY).to(slideIndex);
        }
  
        event.preventDefault();
      };
  
      _createClass(Carousel, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }]);
      return Carousel;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
    $$$1(window).on(Event.LOAD_DATA_API, function () {
      $$$1(Selector.DATA_RIDE).each(function () {
        var $carousel = $$$1(this);
  
        Carousel._jQueryInterface.call($carousel, $carousel.data());
      });
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Carousel._jQueryInterface;
    $$$1.fn[NAME].Constructor = Carousel;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Carousel._jQueryInterface;
    };
  
    return Carousel;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): collapse.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Collapse = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'collapse';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.collapse';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 600;
    var Default = {
      toggle: true,
      parent: ''
    };
    var DefaultType = {
      toggle: 'boolean',
      parent: '(string|element)'
    };
    var Event = {
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      SHOW: 'show',
      COLLAPSE: 'collapse',
      COLLAPSING: 'collapsing',
      COLLAPSED: 'collapsed'
    };
    var Dimension = {
      WIDTH: 'width',
      HEIGHT: 'height'
    };
    var Selector = {
      ACTIVES: '.show, .collapsing',
      DATA_TOGGLE: '[data-toggle="collapse"]'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Collapse =
    /*#__PURE__*/
    function () {
      function Collapse(element, config) {
        this._isTransitioning = false;
        this._element = element;
        this._config = this._getConfig(config);
        this._triggerArray = $$$1.makeArray($$$1("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
        var tabToggles = $$$1(Selector.DATA_TOGGLE);
  
        for (var i = 0; i < tabToggles.length; i++) {
          var elem = tabToggles[i];
          var selector = Util.getSelectorFromElement(elem);
  
          if (selector !== null && $$$1(selector).filter(element).length > 0) {
            this._selector = selector;
  
            this._triggerArray.push(elem);
          }
        }
  
        this._parent = this._config.parent ? this._getParent() : null;
  
        if (!this._config.parent) {
          this._addAriaAndCollapsedClass(this._element, this._triggerArray);
        }
  
        if (this._config.toggle) {
          this.toggle();
        }
      } // Getters
  
  
      var _proto = Collapse.prototype;
  
      // Public
      _proto.toggle = function toggle() {
        if ($$$1(this._element).hasClass(ClassName.SHOW)) {
          this.hide();
        } else {
          this.show();
        }
      };
  
      _proto.show = function show() {
        var _this = this;
  
        if (this._isTransitioning || $$$1(this._element).hasClass(ClassName.SHOW)) {
          return;
        }
  
        var actives;
        var activesData;
  
        if (this._parent) {
          actives = $$$1.makeArray($$$1(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]"));
  
          if (actives.length === 0) {
            actives = null;
          }
        }
  
        if (actives) {
          activesData = $$$1(actives).not(this._selector).data(DATA_KEY);
  
          if (activesData && activesData._isTransitioning) {
            return;
          }
        }
  
        var startEvent = $$$1.Event(Event.SHOW);
        $$$1(this._element).trigger(startEvent);
  
        if (startEvent.isDefaultPrevented()) {
          return;
        }
  
        if (actives) {
          Collapse._jQueryInterface.call($$$1(actives).not(this._selector), 'hide');
  
          if (!activesData) {
            $$$1(actives).data(DATA_KEY, null);
          }
        }
  
        var dimension = this._getDimension();
  
        $$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
        this._element.style[dimension] = 0;
  
        if (this._triggerArray.length > 0) {
          $$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
        }
  
        this.setTransitioning(true);
  
        var complete = function complete() {
          $$$1(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
          _this._element.style[dimension] = '';
  
          _this.setTransitioning(false);
  
          $$$1(_this._element).trigger(Event.SHOWN);
        };
  
        if (!Util.supportsTransitionEnd()) {
          complete();
          return;
        }
  
        var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
        var scrollSize = "scroll" + capitalizedDimension;
        $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
        this._element.style[dimension] = this._element[scrollSize] + "px";
      };
  
      _proto.hide = function hide() {
        var _this2 = this;
  
        if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
          return;
        }
  
        var startEvent = $$$1.Event(Event.HIDE);
        $$$1(this._element).trigger(startEvent);
  
        if (startEvent.isDefaultPrevented()) {
          return;
        }
  
        var dimension = this._getDimension();
  
        this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
        Util.reflow(this._element);
        $$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  
        if (this._triggerArray.length > 0) {
          for (var i = 0; i < this._triggerArray.length; i++) {
            var trigger = this._triggerArray[i];
            var selector = Util.getSelectorFromElement(trigger);
  
            if (selector !== null) {
              var $elem = $$$1(selector);
  
              if (!$elem.hasClass(ClassName.SHOW)) {
                $$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
              }
            }
          }
        }
  
        this.setTransitioning(true);
  
        var complete = function complete() {
          _this2.setTransitioning(false);
  
          $$$1(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
        };
  
        this._element.style[dimension] = '';
  
        if (!Util.supportsTransitionEnd()) {
          complete();
          return;
        }
  
        $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
      };
  
      _proto.setTransitioning = function setTransitioning(isTransitioning) {
        this._isTransitioning = isTransitioning;
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        this._config = null;
        this._parent = null;
        this._element = null;
        this._triggerArray = null;
        this._isTransitioning = null;
      }; // Private
  
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, Default, config);
        config.toggle = Boolean(config.toggle); // Coerce string values
  
        Util.typeCheckConfig(NAME, config, DefaultType);
        return config;
      };
  
      _proto._getDimension = function _getDimension() {
        var hasWidth = $$$1(this._element).hasClass(Dimension.WIDTH);
        return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
      };
  
      _proto._getParent = function _getParent() {
        var _this3 = this;
  
        var parent = null;
  
        if (Util.isElement(this._config.parent)) {
          parent = this._config.parent; // It's a jQuery object
  
          if (typeof this._config.parent.jquery !== 'undefined') {
            parent = this._config.parent[0];
          }
        } else {
          parent = $$$1(this._config.parent)[0];
        }
  
        var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
        $$$1(parent).find(selector).each(function (i, element) {
          _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
        });
        return parent;
      };
  
      _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
        if (element) {
          var isOpen = $$$1(element).hasClass(ClassName.SHOW);
  
          if (triggerArray.length > 0) {
            $$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
          }
        }
      }; // Static
  
  
      Collapse._getTargetFromElement = function _getTargetFromElement(element) {
        var selector = Util.getSelectorFromElement(element);
        return selector ? $$$1(selector)[0] : null;
      };
  
      Collapse._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var $this = $$$1(this);
          var data = $this.data(DATA_KEY);
  
          var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config);
  
          if (!data && _config.toggle && /show|hide/.test(config)) {
            _config.toggle = false;
          }
  
          if (!data) {
            data = new Collapse(this, _config);
            $this.data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      _createClass(Collapse, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }]);
      return Collapse;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
      // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
      if (event.currentTarget.tagName === 'A') {
        event.preventDefault();
      }
  
      var $trigger = $$$1(this);
      var selector = Util.getSelectorFromElement(this);
      $$$1(selector).each(function () {
        var $target = $$$1(this);
        var data = $target.data(DATA_KEY);
        var config = data ? 'toggle' : $trigger.data();
  
        Collapse._jQueryInterface.call($target, config);
      });
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Collapse._jQueryInterface;
    $$$1.fn[NAME].Constructor = Collapse;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Collapse._jQueryInterface;
    };
  
    return Collapse;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): dropdown.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Dropdown = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'dropdown';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.dropdown';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  
    var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  
    var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  
    var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  
    var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  
    var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  
    var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
    var Event = {
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      CLICK: "click" + EVENT_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
      KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY,
      KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      DISABLED: 'disabled',
      SHOW: 'show',
      DROPUP: 'dropup',
      DROPRIGHT: 'dropright',
      DROPLEFT: 'dropleft',
      MENURIGHT: 'dropdown-menu-right',
      MENULEFT: 'dropdown-menu-left',
      POSITION_STATIC: 'position-static'
    };
    var Selector = {
      DATA_TOGGLE: '[data-toggle="dropdown"]',
      FORM_CHILD: '.dropdown form',
      MENU: '.dropdown-menu',
      NAVBAR_NAV: '.navbar-nav',
      VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)'
    };
    var AttachmentMap = {
      TOP: 'top-start',
      TOPEND: 'top-end',
      BOTTOM: 'bottom-start',
      BOTTOMEND: 'bottom-end',
      RIGHT: 'right-start',
      RIGHTEND: 'right-end',
      LEFT: 'left-start',
      LEFTEND: 'left-end'
    };
    var Default = {
      offset: 0,
      flip: true,
      boundary: 'scrollParent'
    };
    var DefaultType = {
      offset: '(number|string|function)',
      flip: 'boolean',
      boundary: '(string|element)'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Dropdown =
    /*#__PURE__*/
    function () {
      function Dropdown(element, config) {
        this._element = element;
        this._popper = null;
        this._config = this._getConfig(config);
        this._menu = this._getMenuElement();
        this._inNavbar = this._detectNavbar();
  
        this._addEventListeners();
      } // Getters
  
  
      var _proto = Dropdown.prototype;
  
      // Public
      _proto.toggle = function toggle() {
        if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) {
          return;
        }
  
        var parent = Dropdown._getParentFromElement(this._element);
  
        var isActive = $$$1(this._menu).hasClass(ClassName.SHOW);
  
        Dropdown._clearMenus();
  
        if (isActive) {
          return;
        }
  
        var relatedTarget = {
          relatedTarget: this._element
        };
        var showEvent = $$$1.Event(Event.SHOW, relatedTarget);
        $$$1(parent).trigger(showEvent);
  
        if (showEvent.isDefaultPrevented()) {
          return;
        } // Disable totally Popper.js for Dropdown in Navbar
  
  
        if (!this._inNavbar) {
          /**
           * Check for Popper dependency
           * Popper - https://popper.js.org
           */
          if (typeof Popper === 'undefined') {
            throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)');
          }
  
          var element = this._element; // For dropup with alignment we use the parent as popper container
  
          if ($$$1(parent).hasClass(ClassName.DROPUP)) {
            if ($$$1(this._menu).hasClass(ClassName.MENULEFT) || $$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
              element = parent;
            }
          } // If boundary is not `scrollParent`, then set position to `static`
          // to allow the menu to "escape" the scroll parent's boundaries
          // https://github.com/twbs/bootstrap/issues/24251
  
  
          if (this._config.boundary !== 'scrollParent') {
            $$$1(parent).addClass(ClassName.POSITION_STATIC);
          }
  
          this._popper = new Popper(element, this._menu, this._getPopperConfig());
        } // If this is a touch-enabled device we add extra
        // empty mouseover listeners to the body's immediate children;
        // only needed because of broken event delegation on iOS
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  
  
        if ('ontouchstart' in document.documentElement && $$$1(parent).closest(Selector.NAVBAR_NAV).length === 0) {
          $$$1('body').children().on('mouseover', null, $$$1.noop);
        }
  
        this._element.focus();
  
        this._element.setAttribute('aria-expanded', true);
  
        $$$1(this._menu).toggleClass(ClassName.SHOW);
        $$$1(parent).toggleClass(ClassName.SHOW).trigger($$$1.Event(Event.SHOWN, relatedTarget));
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        $$$1(this._element).off(EVENT_KEY);
        this._element = null;
        this._menu = null;
  
        if (this._popper !== null) {
          this._popper.destroy();
  
          this._popper = null;
        }
      };
  
      _proto.update = function update() {
        this._inNavbar = this._detectNavbar();
  
        if (this._popper !== null) {
          this._popper.scheduleUpdate();
        }
      }; // Private
  
  
      _proto._addEventListeners = function _addEventListeners() {
        var _this = this;
  
        $$$1(this._element).on(Event.CLICK, function (event) {
          event.preventDefault();
          event.stopPropagation();
  
          _this.toggle();
        });
      };
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, this.constructor.Default, $$$1(this._element).data(), config);
        Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
        return config;
      };
  
      _proto._getMenuElement = function _getMenuElement() {
        if (!this._menu) {
          var parent = Dropdown._getParentFromElement(this._element);
  
          this._menu = $$$1(parent).find(Selector.MENU)[0];
        }
  
        return this._menu;
      };
  
      _proto._getPlacement = function _getPlacement() {
        var $parentDropdown = $$$1(this._element).parent();
        var placement = AttachmentMap.BOTTOM; // Handle dropup
  
        if ($parentDropdown.hasClass(ClassName.DROPUP)) {
          placement = AttachmentMap.TOP;
  
          if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
            placement = AttachmentMap.TOPEND;
          }
        } else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
          placement = AttachmentMap.RIGHT;
        } else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
          placement = AttachmentMap.LEFT;
        } else if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
          placement = AttachmentMap.BOTTOMEND;
        }
  
        return placement;
      };
  
      _proto._detectNavbar = function _detectNavbar() {
        return $$$1(this._element).closest('.navbar').length > 0;
      };
  
      _proto._getPopperConfig = function _getPopperConfig() {
        var _this2 = this;
  
        var offsetConf = {};
  
        if (typeof this._config.offset === 'function') {
          offsetConf.fn = function (data) {
            data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {});
            return data;
          };
        } else {
          offsetConf.offset = this._config.offset;
        }
  
        var popperConfig = {
          placement: this._getPlacement(),
          modifiers: {
            offset: offsetConf,
            flip: {
              enabled: this._config.flip
            },
            preventOverflow: {
              boundariesElement: this._config.boundary
            }
          }
        };
        return popperConfig;
      }; // Static
  
  
      Dropdown._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = typeof config === 'object' ? config : null;
  
          if (!data) {
            data = new Dropdown(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      Dropdown._clearMenus = function _clearMenus(event) {
        if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
          return;
        }
  
        var toggles = $$$1.makeArray($$$1(Selector.DATA_TOGGLE));
  
        for (var i = 0; i < toggles.length; i++) {
          var parent = Dropdown._getParentFromElement(toggles[i]);
  
          var context = $$$1(toggles[i]).data(DATA_KEY);
          var relatedTarget = {
            relatedTarget: toggles[i]
          };
  
          if (!context) {
            continue;
          }
  
          var dropdownMenu = context._menu;
  
          if (!$$$1(parent).hasClass(ClassName.SHOW)) {
            continue;
          }
  
          if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $$$1.contains(parent, event.target)) {
            continue;
          }
  
          var hideEvent = $$$1.Event(Event.HIDE, relatedTarget);
          $$$1(parent).trigger(hideEvent);
  
          if (hideEvent.isDefaultPrevented()) {
            continue;
          } // If this is a touch-enabled device we remove the extra
          // empty mouseover listeners we added for iOS support
  
  
          if ('ontouchstart' in document.documentElement) {
            $$$1('body').children().off('mouseover', null, $$$1.noop);
          }
  
          toggles[i].setAttribute('aria-expanded', 'false');
          $$$1(dropdownMenu).removeClass(ClassName.SHOW);
          $$$1(parent).removeClass(ClassName.SHOW).trigger($$$1.Event(Event.HIDDEN, relatedTarget));
        }
      };
  
      Dropdown._getParentFromElement = function _getParentFromElement(element) {
        var parent;
        var selector = Util.getSelectorFromElement(element);
  
        if (selector) {
          parent = $$$1(selector)[0];
        }
  
        return parent || element.parentNode;
      }; // eslint-disable-next-line complexity
  
  
      Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
        // If not input/textarea:
        //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
        // If input/textarea:
        //  - If space key => not a dropdown command
        //  - If key is other than escape
        //    - If key is not up or down => not a dropdown command
        //    - If trigger inside the menu => not a dropdown command
        if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $$$1(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
          return;
        }
  
        event.preventDefault();
        event.stopPropagation();
  
        if (this.disabled || $$$1(this).hasClass(ClassName.DISABLED)) {
          return;
        }
  
        var parent = Dropdown._getParentFromElement(this);
  
        var isActive = $$$1(parent).hasClass(ClassName.SHOW);
  
        if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
          if (event.which === ESCAPE_KEYCODE) {
            var toggle = $$$1(parent).find(Selector.DATA_TOGGLE)[0];
            $$$1(toggle).trigger('focus');
          }
  
          $$$1(this).trigger('click');
          return;
        }
  
        var items = $$$1(parent).find(Selector.VISIBLE_ITEMS).get();
  
        if (items.length === 0) {
          return;
        }
  
        var index = items.indexOf(event.target);
  
        if (event.which === ARROW_UP_KEYCODE && index > 0) {
          // Up
          index--;
        }
  
        if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
          // Down
          index++;
        }
  
        if (index < 0) {
          index = 0;
        }
  
        items[index].focus();
      };
  
      _createClass(Dropdown, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }, {
        key: "DefaultType",
        get: function get() {
          return DefaultType;
        }
      }]);
      return Dropdown;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
      event.preventDefault();
      event.stopPropagation();
  
      Dropdown._jQueryInterface.call($$$1(this), 'toggle');
    }).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
      e.stopPropagation();
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Dropdown._jQueryInterface;
    $$$1.fn[NAME].Constructor = Dropdown;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Dropdown._jQueryInterface;
    };
  
    return Dropdown;
  }($, Popper);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): modal.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Modal = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'modal';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.modal';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 300;
    var BACKDROP_TRANSITION_DURATION = 150;
    var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  
    var Default = {
      backdrop: true,
      keyboard: true,
      focus: true,
      show: true
    };
    var DefaultType = {
      backdrop: '(boolean|string)',
      keyboard: 'boolean',
      focus: 'boolean',
      show: 'boolean'
    };
    var Event = {
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      FOCUSIN: "focusin" + EVENT_KEY,
      RESIZE: "resize" + EVENT_KEY,
      CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
      KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY,
      MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY,
      MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
      BACKDROP: 'modal-backdrop',
      OPEN: 'modal-open',
      FADE: 'fade',
      SHOW: 'show'
    };
    var Selector = {
      DIALOG: '.modal-dialog',
      DATA_TOGGLE: '[data-toggle="modal"]',
      DATA_DISMISS: '[data-dismiss="modal"]',
      FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
      STICKY_CONTENT: '.sticky-top',
      NAVBAR_TOGGLER: '.navbar-toggler'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Modal =
    /*#__PURE__*/
    function () {
      function Modal(element, config) {
        this._config = this._getConfig(config);
        this._element = element;
        this._dialog = $$$1(element).find(Selector.DIALOG)[0];
        this._backdrop = null;
        this._isShown = false;
        this._isBodyOverflowing = false;
        this._ignoreBackdropClick = false;
        this._originalBodyPadding = 0;
        this._scrollbarWidth = 0;
      } // Getters
  
  
      var _proto = Modal.prototype;
  
      // Public
      _proto.toggle = function toggle(relatedTarget) {
        return this._isShown ? this.hide() : this.show(relatedTarget);
      };
  
      _proto.show = function show(relatedTarget) {
        var _this = this;
  
        if (this._isTransitioning || this._isShown) {
          return;
        }
  
        if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE)) {
          this._isTransitioning = true;
        }
  
        var showEvent = $$$1.Event(Event.SHOW, {
          relatedTarget: relatedTarget
        });
        $$$1(this._element).trigger(showEvent);
  
        if (this._isShown || showEvent.isDefaultPrevented()) {
          return;
        }
  
        this._isShown = true;
  
        this._checkScrollbar();
  
        this._setScrollbar();
  
        this._adjustDialog();
  
        $$$1(document.body).addClass(ClassName.OPEN);
  
        this._setEscapeEvent();
  
        this._setResizeEvent();
  
        $$$1(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
          return _this.hide(event);
        });
        $$$1(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
          $$$1(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
            if ($$$1(event.target).is(_this._element)) {
              _this._ignoreBackdropClick = true;
            }
          });
        });
  
        this._showBackdrop(function () {
          return _this._showElement(relatedTarget);
        });
      };
  
      _proto.hide = function hide(event) {
        var _this2 = this;
  
        if (event) {
          event.preventDefault();
        }
  
        if (this._isTransitioning || !this._isShown) {
          return;
        }
  
        var hideEvent = $$$1.Event(Event.HIDE);
        $$$1(this._element).trigger(hideEvent);
  
        if (!this._isShown || hideEvent.isDefaultPrevented()) {
          return;
        }
  
        this._isShown = false;
        var transition = Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE);
  
        if (transition) {
          this._isTransitioning = true;
        }
  
        this._setEscapeEvent();
  
        this._setResizeEvent();
  
        $$$1(document).off(Event.FOCUSIN);
        $$$1(this._element).removeClass(ClassName.SHOW);
        $$$1(this._element).off(Event.CLICK_DISMISS);
        $$$1(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  
        if (transition) {
          $$$1(this._element).one(Util.TRANSITION_END, function (event) {
            return _this2._hideModal(event);
          }).emulateTransitionEnd(TRANSITION_DURATION);
        } else {
          this._hideModal();
        }
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        $$$1(window, document, this._element, this._backdrop).off(EVENT_KEY);
        this._config = null;
        this._element = null;
        this._dialog = null;
        this._backdrop = null;
        this._isShown = null;
        this._isBodyOverflowing = null;
        this._ignoreBackdropClick = null;
        this._scrollbarWidth = null;
      };
  
      _proto.handleUpdate = function handleUpdate() {
        this._adjustDialog();
      }; // Private
  
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, Default, config);
        Util.typeCheckConfig(NAME, config, DefaultType);
        return config;
      };
  
      _proto._showElement = function _showElement(relatedTarget) {
        var _this3 = this;
  
        var transition = Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE);
  
        if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
          // Don't move modal's DOM position
          document.body.appendChild(this._element);
        }
  
        this._element.style.display = 'block';
  
        this._element.removeAttribute('aria-hidden');
  
        this._element.scrollTop = 0;
  
        if (transition) {
          Util.reflow(this._element);
        }
  
        $$$1(this._element).addClass(ClassName.SHOW);
  
        if (this._config.focus) {
          this._enforceFocus();
        }
  
        var shownEvent = $$$1.Event(Event.SHOWN, {
          relatedTarget: relatedTarget
        });
  
        var transitionComplete = function transitionComplete() {
          if (_this3._config.focus) {
            _this3._element.focus();
          }
  
          _this3._isTransitioning = false;
          $$$1(_this3._element).trigger(shownEvent);
        };
  
        if (transition) {
          $$$1(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
        } else {
          transitionComplete();
        }
      };
  
      _proto._enforceFocus = function _enforceFocus() {
        var _this4 = this;
  
        $$$1(document).off(Event.FOCUSIN) // Guard against infinite focus loop
        .on(Event.FOCUSIN, function (event) {
          if (document !== event.target && _this4._element !== event.target && $$$1(_this4._element).has(event.target).length === 0) {
            _this4._element.focus();
          }
        });
      };
  
      _proto._setEscapeEvent = function _setEscapeEvent() {
        var _this5 = this;
  
        if (this._isShown && this._config.keyboard) {
          $$$1(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
            if (event.which === ESCAPE_KEYCODE) {
              event.preventDefault();
  
              _this5.hide();
            }
          });
        } else if (!this._isShown) {
          $$$1(this._element).off(Event.KEYDOWN_DISMISS);
        }
      };
  
      _proto._setResizeEvent = function _setResizeEvent() {
        var _this6 = this;
  
        if (this._isShown) {
          $$$1(window).on(Event.RESIZE, function (event) {
            return _this6.handleUpdate(event);
          });
        } else {
          $$$1(window).off(Event.RESIZE);
        }
      };
  
      _proto._hideModal = function _hideModal() {
        var _this7 = this;
  
        this._element.style.display = 'none';
  
        this._element.setAttribute('aria-hidden', true);
  
        this._isTransitioning = false;
  
        this._showBackdrop(function () {
          $$$1(document.body).removeClass(ClassName.OPEN);
  
          _this7._resetAdjustments();
  
          _this7._resetScrollbar();
  
          $$$1(_this7._element).trigger(Event.HIDDEN);
        });
      };
  
      _proto._removeBackdrop = function _removeBackdrop() {
        if (this._backdrop) {
          $$$1(this._backdrop).remove();
          this._backdrop = null;
        }
      };
  
      _proto._showBackdrop = function _showBackdrop(callback) {
        var _this8 = this;
  
        var animate = $$$1(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  
        if (this._isShown && this._config.backdrop) {
          var doAnimate = Util.supportsTransitionEnd() && animate;
          this._backdrop = document.createElement('div');
          this._backdrop.className = ClassName.BACKDROP;
  
          if (animate) {
            $$$1(this._backdrop).addClass(animate);
          }
  
          $$$1(this._backdrop).appendTo(document.body);
          $$$1(this._element).on(Event.CLICK_DISMISS, function (event) {
            if (_this8._ignoreBackdropClick) {
              _this8._ignoreBackdropClick = false;
              return;
            }
  
            if (event.target !== event.currentTarget) {
              return;
            }
  
            if (_this8._config.backdrop === 'static') {
              _this8._element.focus();
            } else {
              _this8.hide();
            }
          });
  
          if (doAnimate) {
            Util.reflow(this._backdrop);
          }
  
          $$$1(this._backdrop).addClass(ClassName.SHOW);
  
          if (!callback) {
            return;
          }
  
          if (!doAnimate) {
            callback();
            return;
          }
  
          $$$1(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
        } else if (!this._isShown && this._backdrop) {
          $$$1(this._backdrop).removeClass(ClassName.SHOW);
  
          var callbackRemove = function callbackRemove() {
            _this8._removeBackdrop();
  
            if (callback) {
              callback();
            }
          };
  
          if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.FADE)) {
            $$$1(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
          } else {
            callbackRemove();
          }
        } else if (callback) {
          callback();
        }
      }; // ----------------------------------------------------------------------
      // the following methods are used to handle overflowing modals
      // todo (fat): these should probably be refactored out of modal.js
      // ----------------------------------------------------------------------
  
  
      _proto._adjustDialog = function _adjustDialog() {
        var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  
        if (!this._isBodyOverflowing && isModalOverflowing) {
          this._element.style.paddingLeft = this._scrollbarWidth + "px";
        }
  
        if (this._isBodyOverflowing && !isModalOverflowing) {
          this._element.style.paddingRight = this._scrollbarWidth + "px";
        }
      };
  
      _proto._resetAdjustments = function _resetAdjustments() {
        this._element.style.paddingLeft = '';
        this._element.style.paddingRight = '';
      };
  
      _proto._checkScrollbar = function _checkScrollbar() {
        var rect = document.body.getBoundingClientRect();
        this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
        this._scrollbarWidth = this._getScrollbarWidth();
      };
  
      _proto._setScrollbar = function _setScrollbar() {
        var _this9 = this;
  
        if (this._isBodyOverflowing) {
          // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
          //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
          // Adjust fixed content padding
          $$$1(Selector.FIXED_CONTENT).each(function (index, element) {
            var actualPadding = $$$1(element)[0].style.paddingRight;
            var calculatedPadding = $$$1(element).css('padding-right');
            $$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
          }); // Adjust sticky content margin
  
          $$$1(Selector.STICKY_CONTENT).each(function (index, element) {
            var actualMargin = $$$1(element)[0].style.marginRight;
            var calculatedMargin = $$$1(element).css('margin-right');
            $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
          }); // Adjust navbar-toggler margin
  
          $$$1(Selector.NAVBAR_TOGGLER).each(function (index, element) {
            var actualMargin = $$$1(element)[0].style.marginRight;
            var calculatedMargin = $$$1(element).css('margin-right');
            $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px");
          }); // Adjust body padding
  
          var actualPadding = document.body.style.paddingRight;
          var calculatedPadding = $$$1('body').css('padding-right');
          $$$1('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
        }
      };
  
      _proto._resetScrollbar = function _resetScrollbar() {
        // Restore fixed content padding
        $$$1(Selector.FIXED_CONTENT).each(function (index, element) {
          var padding = $$$1(element).data('padding-right');
  
          if (typeof padding !== 'undefined') {
            $$$1(element).css('padding-right', padding).removeData('padding-right');
          }
        }); // Restore sticky content and navbar-toggler margin
  
        $$$1(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) {
          var margin = $$$1(element).data('margin-right');
  
          if (typeof margin !== 'undefined') {
            $$$1(element).css('margin-right', margin).removeData('margin-right');
          }
        }); // Restore body padding
  
        var padding = $$$1('body').data('padding-right');
  
        if (typeof padding !== 'undefined') {
          $$$1('body').css('padding-right', padding).removeData('padding-right');
        }
      };
  
      _proto._getScrollbarWidth = function _getScrollbarWidth() {
        // thx d.walsh
        var scrollDiv = document.createElement('div');
        scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
        document.body.appendChild(scrollDiv);
        var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
        document.body.removeChild(scrollDiv);
        return scrollbarWidth;
      }; // Static
  
  
      Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = _extends({}, Modal.Default, $$$1(this).data(), typeof config === 'object' && config);
  
          if (!data) {
            data = new Modal(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config](relatedTarget);
          } else if (_config.show) {
            data.show(relatedTarget);
          }
        });
      };
  
      _createClass(Modal, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }]);
      return Modal;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
      var _this10 = this;
  
      var target;
      var selector = Util.getSelectorFromElement(this);
  
      if (selector) {
        target = $$$1(selector)[0];
      }
  
      var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _extends({}, $$$1(target).data(), $$$1(this).data());
  
      if (this.tagName === 'A' || this.tagName === 'AREA') {
        event.preventDefault();
      }
  
      var $target = $$$1(target).one(Event.SHOW, function (showEvent) {
        if (showEvent.isDefaultPrevented()) {
          // Only register focus restorer if modal will actually get shown
          return;
        }
  
        $target.one(Event.HIDDEN, function () {
          if ($$$1(_this10).is(':visible')) {
            _this10.focus();
          }
        });
      });
  
      Modal._jQueryInterface.call($$$1(target), config, this);
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Modal._jQueryInterface;
    $$$1.fn[NAME].Constructor = Modal;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Modal._jQueryInterface;
    };
  
    return Modal;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): tooltip.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Tooltip = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'tooltip';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.tooltip';
    var EVENT_KEY = "." + DATA_KEY;
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 150;
    var CLASS_PREFIX = 'bs-tooltip';
    var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
    var DefaultType = {
      animation: 'boolean',
      template: 'string',
      title: '(string|element|function)',
      trigger: 'string',
      delay: '(number|object)',
      html: 'boolean',
      selector: '(string|boolean)',
      placement: '(string|function)',
      offset: '(number|string)',
      container: '(string|element|boolean)',
      fallbackPlacement: '(string|array)',
      boundary: '(string|element)'
    };
    var AttachmentMap = {
      AUTO: 'auto',
      TOP: 'top',
      RIGHT: 'right',
      BOTTOM: 'bottom',
      LEFT: 'left'
    };
    var Default = {
      animation: true,
      template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
      trigger: 'hover focus',
      title: '',
      delay: 0,
      html: false,
      selector: false,
      placement: 'top',
      offset: 0,
      container: false,
      fallbackPlacement: 'flip',
      boundary: 'scrollParent'
    };
    var HoverState = {
      SHOW: 'show',
      OUT: 'out'
    };
    var Event = {
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      INSERTED: "inserted" + EVENT_KEY,
      CLICK: "click" + EVENT_KEY,
      FOCUSIN: "focusin" + EVENT_KEY,
      FOCUSOUT: "focusout" + EVENT_KEY,
      MOUSEENTER: "mouseenter" + EVENT_KEY,
      MOUSELEAVE: "mouseleave" + EVENT_KEY
    };
    var ClassName = {
      FADE: 'fade',
      SHOW: 'show'
    };
    var Selector = {
      TOOLTIP: '.tooltip',
      TOOLTIP_INNER: '.tooltip-inner',
      ARROW: '.arrow'
    };
    var Trigger = {
      HOVER: 'hover',
      FOCUS: 'focus',
      CLICK: 'click',
      MANUAL: 'manual'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Tooltip =
    /*#__PURE__*/
    function () {
      function Tooltip(element, config) {
        /**
         * Check for Popper dependency
         * Popper - https://popper.js.org
         */
        if (typeof Popper === 'undefined') {
          throw new TypeError('Bootstrap tooltips require Popper.js (https://popper.js.org)');
        } // private
  
  
        this._isEnabled = true;
        this._timeout = 0;
        this._hoverState = '';
        this._activeTrigger = {};
        this._popper = null; // Protected
  
        this.element = element;
        this.config = this._getConfig(config);
        this.tip = null;
  
        this._setListeners();
      } // Getters
  
  
      var _proto = Tooltip.prototype;
  
      // Public
      _proto.enable = function enable() {
        this._isEnabled = true;
      };
  
      _proto.disable = function disable() {
        this._isEnabled = false;
      };
  
      _proto.toggleEnabled = function toggleEnabled() {
        this._isEnabled = !this._isEnabled;
      };
  
      _proto.toggle = function toggle(event) {
        if (!this._isEnabled) {
          return;
        }
  
        if (event) {
          var dataKey = this.constructor.DATA_KEY;
          var context = $$$1(event.currentTarget).data(dataKey);
  
          if (!context) {
            context = new this.constructor(event.currentTarget, this._getDelegateConfig());
            $$$1(event.currentTarget).data(dataKey, context);
          }
  
          context._activeTrigger.click = !context._activeTrigger.click;
  
          if (context._isWithActiveTrigger()) {
            context._enter(null, context);
          } else {
            context._leave(null, context);
          }
        } else {
          if ($$$1(this.getTipElement()).hasClass(ClassName.SHOW)) {
            this._leave(null, this);
  
            return;
          }
  
          this._enter(null, this);
        }
      };
  
      _proto.dispose = function dispose() {
        clearTimeout(this._timeout);
        $$$1.removeData(this.element, this.constructor.DATA_KEY);
        $$$1(this.element).off(this.constructor.EVENT_KEY);
        $$$1(this.element).closest('.modal').off('hide.bs.modal');
  
        if (this.tip) {
          $$$1(this.tip).remove();
        }
  
        this._isEnabled = null;
        this._timeout = null;
        this._hoverState = null;
        this._activeTrigger = null;
  
        if (this._popper !== null) {
          this._popper.destroy();
        }
  
        this._popper = null;
        this.element = null;
        this.config = null;
        this.tip = null;
      };
  
      _proto.show = function show() {
        var _this = this;
  
        if ($$$1(this.element).css('display') === 'none') {
          throw new Error('Please use show on visible elements');
        }
  
        var showEvent = $$$1.Event(this.constructor.Event.SHOW);
  
        if (this.isWithContent() && this._isEnabled) {
          $$$1(this.element).trigger(showEvent);
          var isInTheDom = $$$1.contains(this.element.ownerDocument.documentElement, this.element);
  
          if (showEvent.isDefaultPrevented() || !isInTheDom) {
            return;
          }
  
          var tip = this.getTipElement();
          var tipId = Util.getUID(this.constructor.NAME);
          tip.setAttribute('id', tipId);
          this.element.setAttribute('aria-describedby', tipId);
          this.setContent();
  
          if (this.config.animation) {
            $$$1(tip).addClass(ClassName.FADE);
          }
  
          var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  
          var attachment = this._getAttachment(placement);
  
          this.addAttachmentClass(attachment);
          var container = this.config.container === false ? document.body : $$$1(this.config.container);
          $$$1(tip).data(this.constructor.DATA_KEY, this);
  
          if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) {
            $$$1(tip).appendTo(container);
          }
  
          $$$1(this.element).trigger(this.constructor.Event.INSERTED);
          this._popper = new Popper(this.element, tip, {
            placement: attachment,
            modifiers: {
              offset: {
                offset: this.config.offset
              },
              flip: {
                behavior: this.config.fallbackPlacement
              },
              arrow: {
                element: Selector.ARROW
              },
              preventOverflow: {
                boundariesElement: this.config.boundary
              }
            },
            onCreate: function onCreate(data) {
              if (data.originalPlacement !== data.placement) {
                _this._handlePopperPlacementChange(data);
              }
            },
            onUpdate: function onUpdate(data) {
              _this._handlePopperPlacementChange(data);
            }
          });
          $$$1(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra
          // empty mouseover listeners to the body's immediate children;
          // only needed because of broken event delegation on iOS
          // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  
          if ('ontouchstart' in document.documentElement) {
            $$$1('body').children().on('mouseover', null, $$$1.noop);
          }
  
          var complete = function complete() {
            if (_this.config.animation) {
              _this._fixTransition();
            }
  
            var prevHoverState = _this._hoverState;
            _this._hoverState = null;
            $$$1(_this.element).trigger(_this.constructor.Event.SHOWN);
  
            if (prevHoverState === HoverState.OUT) {
              _this._leave(null, _this);
            }
          };
  
          if (Util.supportsTransitionEnd() && $$$1(this.tip).hasClass(ClassName.FADE)) {
            $$$1(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
          } else {
            complete();
          }
        }
      };
  
      _proto.hide = function hide(callback) {
        var _this2 = this;
  
        var tip = this.getTipElement();
        var hideEvent = $$$1.Event(this.constructor.Event.HIDE);
  
        var complete = function complete() {
          if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
            tip.parentNode.removeChild(tip);
          }
  
          _this2._cleanTipClass();
  
          _this2.element.removeAttribute('aria-describedby');
  
          $$$1(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  
          if (_this2._popper !== null) {
            _this2._popper.destroy();
          }
  
          if (callback) {
            callback();
          }
        };
  
        $$$1(this.element).trigger(hideEvent);
  
        if (hideEvent.isDefaultPrevented()) {
          return;
        }
  
        $$$1(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
        // empty mouseover listeners we added for iOS support
  
        if ('ontouchstart' in document.documentElement) {
          $$$1('body').children().off('mouseover', null, $$$1.noop);
        }
  
        this._activeTrigger[Trigger.CLICK] = false;
        this._activeTrigger[Trigger.FOCUS] = false;
        this._activeTrigger[Trigger.HOVER] = false;
  
        if (Util.supportsTransitionEnd() && $$$1(this.tip).hasClass(ClassName.FADE)) {
          $$$1(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
        } else {
          complete();
        }
  
        this._hoverState = '';
      };
  
      _proto.update = function update() {
        if (this._popper !== null) {
          this._popper.scheduleUpdate();
        }
      }; // Protected
  
  
      _proto.isWithContent = function isWithContent() {
        return Boolean(this.getTitle());
      };
  
      _proto.addAttachmentClass = function addAttachmentClass(attachment) {
        $$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
      };
  
      _proto.getTipElement = function getTipElement() {
        this.tip = this.tip || $$$1(this.config.template)[0];
        return this.tip;
      };
  
      _proto.setContent = function setContent() {
        var $tip = $$$1(this.getTipElement());
        this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
        $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
      };
  
      _proto.setElementContent = function setElementContent($element, content) {
        var html = this.config.html;
  
        if (typeof content === 'object' && (content.nodeType || content.jquery)) {
          // Content is a DOM node or a jQuery
          if (html) {
            if (!$$$1(content).parent().is($element)) {
              $element.empty().append(content);
            }
          } else {
            $element.text($$$1(content).text());
          }
        } else {
          $element[html ? 'html' : 'text'](content);
        }
      };
  
      _proto.getTitle = function getTitle() {
        var title = this.element.getAttribute('data-original-title');
  
        if (!title) {
          title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
        }
  
        return title;
      }; // Private
  
  
      _proto._getAttachment = function _getAttachment(placement) {
        return AttachmentMap[placement.toUpperCase()];
      };
  
      _proto._setListeners = function _setListeners() {
        var _this3 = this;
  
        var triggers = this.config.trigger.split(' ');
        triggers.forEach(function (trigger) {
          if (trigger === 'click') {
            $$$1(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
              return _this3.toggle(event);
            });
          } else if (trigger !== Trigger.MANUAL) {
            var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
            var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
            $$$1(_this3.element).on(eventIn, _this3.config.selector, function (event) {
              return _this3._enter(event);
            }).on(eventOut, _this3.config.selector, function (event) {
              return _this3._leave(event);
            });
          }
  
          $$$1(_this3.element).closest('.modal').on('hide.bs.modal', function () {
            return _this3.hide();
          });
        });
  
        if (this.config.selector) {
          this.config = _extends({}, this.config, {
            trigger: 'manual',
            selector: ''
          });
        } else {
          this._fixTitle();
        }
      };
  
      _proto._fixTitle = function _fixTitle() {
        var titleType = typeof this.element.getAttribute('data-original-title');
  
        if (this.element.getAttribute('title') || titleType !== 'string') {
          this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
          this.element.setAttribute('title', '');
        }
      };
  
      _proto._enter = function _enter(event, context) {
        var dataKey = this.constructor.DATA_KEY;
        context = context || $$$1(event.currentTarget).data(dataKey);
  
        if (!context) {
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
          $$$1(event.currentTarget).data(dataKey, context);
        }
  
        if (event) {
          context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
        }
  
        if ($$$1(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
          context._hoverState = HoverState.SHOW;
          return;
        }
  
        clearTimeout(context._timeout);
        context._hoverState = HoverState.SHOW;
  
        if (!context.config.delay || !context.config.delay.show) {
          context.show();
          return;
        }
  
        context._timeout = setTimeout(function () {
          if (context._hoverState === HoverState.SHOW) {
            context.show();
          }
        }, context.config.delay.show);
      };
  
      _proto._leave = function _leave(event, context) {
        var dataKey = this.constructor.DATA_KEY;
        context = context || $$$1(event.currentTarget).data(dataKey);
  
        if (!context) {
          context = new this.constructor(event.currentTarget, this._getDelegateConfig());
          $$$1(event.currentTarget).data(dataKey, context);
        }
  
        if (event) {
          context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
        }
  
        if (context._isWithActiveTrigger()) {
          return;
        }
  
        clearTimeout(context._timeout);
        context._hoverState = HoverState.OUT;
  
        if (!context.config.delay || !context.config.delay.hide) {
          context.hide();
          return;
        }
  
        context._timeout = setTimeout(function () {
          if (context._hoverState === HoverState.OUT) {
            context.hide();
          }
        }, context.config.delay.hide);
      };
  
      _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
        for (var trigger in this._activeTrigger) {
          if (this._activeTrigger[trigger]) {
            return true;
          }
        }
  
        return false;
      };
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, this.constructor.Default, $$$1(this.element).data(), config);
  
        if (typeof config.delay === 'number') {
          config.delay = {
            show: config.delay,
            hide: config.delay
          };
        }
  
        if (typeof config.title === 'number') {
          config.title = config.title.toString();
        }
  
        if (typeof config.content === 'number') {
          config.content = config.content.toString();
        }
  
        Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
        return config;
      };
  
      _proto._getDelegateConfig = function _getDelegateConfig() {
        var config = {};
  
        if (this.config) {
          for (var key in this.config) {
            if (this.constructor.Default[key] !== this.config[key]) {
              config[key] = this.config[key];
            }
          }
        }
  
        return config;
      };
  
      _proto._cleanTipClass = function _cleanTipClass() {
        var $tip = $$$1(this.getTipElement());
        var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  
        if (tabClass !== null && tabClass.length > 0) {
          $tip.removeClass(tabClass.join(''));
        }
      };
  
      _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
        this._cleanTipClass();
  
        this.addAttachmentClass(this._getAttachment(data.placement));
      };
  
      _proto._fixTransition = function _fixTransition() {
        var tip = this.getTipElement();
        var initConfigAnimation = this.config.animation;
  
        if (tip.getAttribute('x-placement') !== null) {
          return;
        }
  
        $$$1(tip).removeClass(ClassName.FADE);
        this.config.animation = false;
        this.hide();
        this.show();
        this.config.animation = initConfigAnimation;
      }; // Static
  
  
      Tooltip._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = typeof config === 'object' && config;
  
          if (!data && /dispose|hide/.test(config)) {
            return;
          }
  
          if (!data) {
            data = new Tooltip(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      _createClass(Tooltip, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }, {
        key: "NAME",
        get: function get() {
          return NAME;
        }
      }, {
        key: "DATA_KEY",
        get: function get() {
          return DATA_KEY;
        }
      }, {
        key: "Event",
        get: function get() {
          return Event;
        }
      }, {
        key: "EVENT_KEY",
        get: function get() {
          return EVENT_KEY;
        }
      }, {
        key: "DefaultType",
        get: function get() {
          return DefaultType;
        }
      }]);
      return Tooltip;
    }();
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
  
    $$$1.fn[NAME] = Tooltip._jQueryInterface;
    $$$1.fn[NAME].Constructor = Tooltip;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Tooltip._jQueryInterface;
    };
  
    return Tooltip;
  }($, Popper);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): popover.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Popover = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'popover';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.popover';
    var EVENT_KEY = "." + DATA_KEY;
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var CLASS_PREFIX = 'bs-popover';
    var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
    var Default = _extends({}, Tooltip.Default, {
      placement: 'right',
      trigger: 'click',
      content: '',
      template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
    });
    var DefaultType = _extends({}, Tooltip.DefaultType, {
      content: '(string|element|function)'
    });
    var ClassName = {
      FADE: 'fade',
      SHOW: 'show'
    };
    var Selector = {
      TITLE: '.popover-header',
      CONTENT: '.popover-body'
    };
    var Event = {
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      INSERTED: "inserted" + EVENT_KEY,
      CLICK: "click" + EVENT_KEY,
      FOCUSIN: "focusin" + EVENT_KEY,
      FOCUSOUT: "focusout" + EVENT_KEY,
      MOUSEENTER: "mouseenter" + EVENT_KEY,
      MOUSELEAVE: "mouseleave" + EVENT_KEY
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Popover =
    /*#__PURE__*/
    function (_Tooltip) {
      _inheritsLoose(Popover, _Tooltip);
  
      function Popover() {
        return _Tooltip.apply(this, arguments) || this;
      }
  
      var _proto = Popover.prototype;
  
      // Overrides
      _proto.isWithContent = function isWithContent() {
        return this.getTitle() || this._getContent();
      };
  
      _proto.addAttachmentClass = function addAttachmentClass(attachment) {
        $$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
      };
  
      _proto.getTipElement = function getTipElement() {
        this.tip = this.tip || $$$1(this.config.template)[0];
        return this.tip;
      };
  
      _proto.setContent = function setContent() {
        var $tip = $$$1(this.getTipElement()); // We use append for html objects to maintain js events
  
        this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
  
        var content = this._getContent();
  
        if (typeof content === 'function') {
          content = content.call(this.element);
        }
  
        this.setElementContent($tip.find(Selector.CONTENT), content);
        $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
      }; // Private
  
  
      _proto._getContent = function _getContent() {
        return this.element.getAttribute('data-content') || this.config.content;
      };
  
      _proto._cleanTipClass = function _cleanTipClass() {
        var $tip = $$$1(this.getTipElement());
        var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  
        if (tabClass !== null && tabClass.length > 0) {
          $tip.removeClass(tabClass.join(''));
        }
      }; // Static
  
  
      Popover._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = typeof config === 'object' ? config : null;
  
          if (!data && /destroy|hide/.test(config)) {
            return;
          }
  
          if (!data) {
            data = new Popover(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      _createClass(Popover, null, [{
        key: "VERSION",
        // Getters
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }, {
        key: "NAME",
        get: function get() {
          return NAME;
        }
      }, {
        key: "DATA_KEY",
        get: function get() {
          return DATA_KEY;
        }
      }, {
        key: "Event",
        get: function get() {
          return Event;
        }
      }, {
        key: "EVENT_KEY",
        get: function get() {
          return EVENT_KEY;
        }
      }, {
        key: "DefaultType",
        get: function get() {
          return DefaultType;
        }
      }]);
      return Popover;
    }(Tooltip);
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
  
    $$$1.fn[NAME] = Popover._jQueryInterface;
    $$$1.fn[NAME].Constructor = Popover;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Popover._jQueryInterface;
    };
  
    return Popover;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): scrollspy.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var ScrollSpy = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'scrollspy';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.scrollspy';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var Default = {
      offset: 10,
      method: 'auto',
      target: ''
    };
    var DefaultType = {
      offset: 'number',
      method: 'string',
      target: '(string|element)'
    };
    var Event = {
      ACTIVATE: "activate" + EVENT_KEY,
      SCROLL: "scroll" + EVENT_KEY,
      LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      DROPDOWN_ITEM: 'dropdown-item',
      DROPDOWN_MENU: 'dropdown-menu',
      ACTIVE: 'active'
    };
    var Selector = {
      DATA_SPY: '[data-spy="scroll"]',
      ACTIVE: '.active',
      NAV_LIST_GROUP: '.nav, .list-group',
      NAV_LINKS: '.nav-link',
      NAV_ITEMS: '.nav-item',
      LIST_ITEMS: '.list-group-item',
      DROPDOWN: '.dropdown',
      DROPDOWN_ITEMS: '.dropdown-item',
      DROPDOWN_TOGGLE: '.dropdown-toggle'
    };
    var OffsetMethod = {
      OFFSET: 'offset',
      POSITION: 'position'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var ScrollSpy =
    /*#__PURE__*/
    function () {
      function ScrollSpy(element, config) {
        var _this = this;
  
        this._element = element;
        this._scrollElement = element.tagName === 'BODY' ? window : element;
        this._config = this._getConfig(config);
        this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS);
        this._offsets = [];
        this._targets = [];
        this._activeTarget = null;
        this._scrollHeight = 0;
        $$$1(this._scrollElement).on(Event.SCROLL, function (event) {
          return _this._process(event);
        });
        this.refresh();
  
        this._process();
      } // Getters
  
  
      var _proto = ScrollSpy.prototype;
  
      // Public
      _proto.refresh = function refresh() {
        var _this2 = this;
  
        var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
        var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
        var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
        this._offsets = [];
        this._targets = [];
        this._scrollHeight = this._getScrollHeight();
        var targets = $$$1.makeArray($$$1(this._selector));
        targets.map(function (element) {
          var target;
          var targetSelector = Util.getSelectorFromElement(element);
  
          if (targetSelector) {
            target = $$$1(targetSelector)[0];
          }
  
          if (target) {
            var targetBCR = target.getBoundingClientRect();
  
            if (targetBCR.width || targetBCR.height) {
              // TODO (fat): remove sketch reliance on jQuery position/offset
              return [$$$1(target)[offsetMethod]().top + offsetBase, targetSelector];
            }
          }
  
          return null;
        }).filter(function (item) {
          return item;
        }).sort(function (a, b) {
          return a[0] - b[0];
        }).forEach(function (item) {
          _this2._offsets.push(item[0]);
  
          _this2._targets.push(item[1]);
        });
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        $$$1(this._scrollElement).off(EVENT_KEY);
        this._element = null;
        this._scrollElement = null;
        this._config = null;
        this._selector = null;
        this._offsets = null;
        this._targets = null;
        this._activeTarget = null;
        this._scrollHeight = null;
      }; // Private
  
  
      _proto._getConfig = function _getConfig(config) {
        config = _extends({}, Default, config);
  
        if (typeof config.target !== 'string') {
          var id = $$$1(config.target).attr('id');
  
          if (!id) {
            id = Util.getUID(NAME);
            $$$1(config.target).attr('id', id);
          }
  
          config.target = "#" + id;
        }
  
        Util.typeCheckConfig(NAME, config, DefaultType);
        return config;
      };
  
      _proto._getScrollTop = function _getScrollTop() {
        return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
      };
  
      _proto._getScrollHeight = function _getScrollHeight() {
        return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
      };
  
      _proto._getOffsetHeight = function _getOffsetHeight() {
        return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
      };
  
      _proto._process = function _process() {
        var scrollTop = this._getScrollTop() + this._config.offset;
  
        var scrollHeight = this._getScrollHeight();
  
        var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  
        if (this._scrollHeight !== scrollHeight) {
          this.refresh();
        }
  
        if (scrollTop >= maxScroll) {
          var target = this._targets[this._targets.length - 1];
  
          if (this._activeTarget !== target) {
            this._activate(target);
          }
  
          return;
        }
  
        if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
          this._activeTarget = null;
  
          this._clear();
  
          return;
        }
  
        for (var i = this._offsets.length; i--;) {
          var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  
          if (isActiveTarget) {
            this._activate(this._targets[i]);
          }
        }
      };
  
      _proto._activate = function _activate(target) {
        this._activeTarget = target;
  
        this._clear();
  
        var queries = this._selector.split(','); // eslint-disable-next-line arrow-body-style
  
  
        queries = queries.map(function (selector) {
          return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]");
        });
        var $link = $$$1(queries.join(','));
  
        if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
          $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
          $link.addClass(ClassName.ACTIVE);
        } else {
          // Set triggered link as active
          $link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  
          $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  
          $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
        }
  
        $$$1(this._scrollElement).trigger(Event.ACTIVATE, {
          relatedTarget: target
        });
      };
  
      _proto._clear = function _clear() {
        $$$1(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
      }; // Static
  
  
      ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var data = $$$1(this).data(DATA_KEY);
  
          var _config = typeof config === 'object' && config;
  
          if (!data) {
            data = new ScrollSpy(this, _config);
            $$$1(this).data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      _createClass(ScrollSpy, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }, {
        key: "Default",
        get: function get() {
          return Default;
        }
      }]);
      return ScrollSpy;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(window).on(Event.LOAD_DATA_API, function () {
      var scrollSpys = $$$1.makeArray($$$1(Selector.DATA_SPY));
  
      for (var i = scrollSpys.length; i--;) {
        var $spy = $$$1(scrollSpys[i]);
  
        ScrollSpy._jQueryInterface.call($spy, $spy.data());
      }
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = ScrollSpy._jQueryInterface;
    $$$1.fn[NAME].Constructor = ScrollSpy;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return ScrollSpy._jQueryInterface;
    };
  
    return ScrollSpy;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0): tab.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  var Tab = function ($$$1) {
    /**
     * ------------------------------------------------------------------------
     * Constants
     * ------------------------------------------------------------------------
     */
    var NAME = 'tab';
    var VERSION = '4.0.0';
    var DATA_KEY = 'bs.tab';
    var EVENT_KEY = "." + DATA_KEY;
    var DATA_API_KEY = '.data-api';
    var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
    var TRANSITION_DURATION = 150;
    var Event = {
      HIDE: "hide" + EVENT_KEY,
      HIDDEN: "hidden" + EVENT_KEY,
      SHOW: "show" + EVENT_KEY,
      SHOWN: "shown" + EVENT_KEY,
      CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
    };
    var ClassName = {
      DROPDOWN_MENU: 'dropdown-menu',
      ACTIVE: 'active',
      DISABLED: 'disabled',
      FADE: 'fade',
      SHOW: 'show'
    };
    var Selector = {
      DROPDOWN: '.dropdown',
      NAV_LIST_GROUP: '.nav, .list-group',
      ACTIVE: '.active',
      ACTIVE_UL: '> li > .active',
      DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
      DROPDOWN_TOGGLE: '.dropdown-toggle',
      DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
      /**
       * ------------------------------------------------------------------------
       * Class Definition
       * ------------------------------------------------------------------------
       */
  
    };
  
    var Tab =
    /*#__PURE__*/
    function () {
      function Tab(element) {
        this._element = element;
      } // Getters
  
  
      var _proto = Tab.prototype;
  
      // Public
      _proto.show = function show() {
        var _this = this;
  
        if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $$$1(this._element).hasClass(ClassName.ACTIVE) || $$$1(this._element).hasClass(ClassName.DISABLED)) {
          return;
        }
  
        var target;
        var previous;
        var listElement = $$$1(this._element).closest(Selector.NAV_LIST_GROUP)[0];
        var selector = Util.getSelectorFromElement(this._element);
  
        if (listElement) {
          var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
          previous = $$$1.makeArray($$$1(listElement).find(itemSelector));
          previous = previous[previous.length - 1];
        }
  
        var hideEvent = $$$1.Event(Event.HIDE, {
          relatedTarget: this._element
        });
        var showEvent = $$$1.Event(Event.SHOW, {
          relatedTarget: previous
        });
  
        if (previous) {
          $$$1(previous).trigger(hideEvent);
        }
  
        $$$1(this._element).trigger(showEvent);
  
        if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
          return;
        }
  
        if (selector) {
          target = $$$1(selector)[0];
        }
  
        this._activate(this._element, listElement);
  
        var complete = function complete() {
          var hiddenEvent = $$$1.Event(Event.HIDDEN, {
            relatedTarget: _this._element
          });
          var shownEvent = $$$1.Event(Event.SHOWN, {
            relatedTarget: previous
          });
          $$$1(previous).trigger(hiddenEvent);
          $$$1(_this._element).trigger(shownEvent);
        };
  
        if (target) {
          this._activate(target, target.parentNode, complete);
        } else {
          complete();
        }
      };
  
      _proto.dispose = function dispose() {
        $$$1.removeData(this._element, DATA_KEY);
        this._element = null;
      }; // Private
  
  
      _proto._activate = function _activate(element, container, callback) {
        var _this2 = this;
  
        var activeElements;
  
        if (container.nodeName === 'UL') {
          activeElements = $$$1(container).find(Selector.ACTIVE_UL);
        } else {
          activeElements = $$$1(container).children(Selector.ACTIVE);
        }
  
        var active = activeElements[0];
        var isTransitioning = callback && Util.supportsTransitionEnd() && active && $$$1(active).hasClass(ClassName.FADE);
  
        var complete = function complete() {
          return _this2._transitionComplete(element, active, callback);
        };
  
        if (active && isTransitioning) {
          $$$1(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
        } else {
          complete();
        }
      };
  
      _proto._transitionComplete = function _transitionComplete(element, active, callback) {
        if (active) {
          $$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE);
          var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  
          if (dropdownChild) {
            $$$1(dropdownChild).removeClass(ClassName.ACTIVE);
          }
  
          if (active.getAttribute('role') === 'tab') {
            active.setAttribute('aria-selected', false);
          }
        }
  
        $$$1(element).addClass(ClassName.ACTIVE);
  
        if (element.getAttribute('role') === 'tab') {
          element.setAttribute('aria-selected', true);
        }
  
        Util.reflow(element);
        $$$1(element).addClass(ClassName.SHOW);
  
        if (element.parentNode && $$$1(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
          var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0];
  
          if (dropdownElement) {
            $$$1(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
          }
  
          element.setAttribute('aria-expanded', true);
        }
  
        if (callback) {
          callback();
        }
      }; // Static
  
  
      Tab._jQueryInterface = function _jQueryInterface(config) {
        return this.each(function () {
          var $this = $$$1(this);
          var data = $this.data(DATA_KEY);
  
          if (!data) {
            data = new Tab(this);
            $this.data(DATA_KEY, data);
          }
  
          if (typeof config === 'string') {
            if (typeof data[config] === 'undefined') {
              throw new TypeError("No method named \"" + config + "\"");
            }
  
            data[config]();
          }
        });
      };
  
      _createClass(Tab, null, [{
        key: "VERSION",
        get: function get() {
          return VERSION;
        }
      }]);
      return Tab;
    }();
    /**
     * ------------------------------------------------------------------------
     * Data Api implementation
     * ------------------------------------------------------------------------
     */
  
  
    $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
      event.preventDefault();
  
      Tab._jQueryInterface.call($$$1(this), 'show');
    });
    /**
     * ------------------------------------------------------------------------
     * jQuery
     * ------------------------------------------------------------------------
     */
  
    $$$1.fn[NAME] = Tab._jQueryInterface;
    $$$1.fn[NAME].Constructor = Tab;
  
    $$$1.fn[NAME].noConflict = function () {
      $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Tab._jQueryInterface;
    };
  
    return Tab;
  }($);
  
  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.0.0-alpha.6): index.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  
  (function ($$$1) {
    if (typeof $$$1 === 'undefined') {
      throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
    }
  
    var version = $$$1.fn.jquery.split(' ')[0].split('.');
    var minMajor = 1;
    var ltMajor = 2;
    var minMinor = 9;
    var minPatch = 1;
    var maxMajor = 4;
  
    if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
      throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
    }
  })($);
  
  exports.Util = Util;
  exports.Alert = Alert;
  exports.Button = Button;
  exports.Carousel = Carousel;
  exports.Collapse = Collapse;
  exports.Dropdown = Dropdown;
  exports.Modal = Modal;
  exports.Popover = Popover;
  exports.Scrollspy = ScrollSpy;
  exports.Tab = Tab;
  exports.Tooltip = Tooltip;
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  })));
  //# sourceMappingURL=bootstrap.js.map
  
  /*! Magnific Popup - v1.0.0 - 2015-01-03
  * http://dimsemenov.com/plugins/magnific-popup/
  * Copyright (c) 2015 Dmitry Semenov; */
  ;(function (factory) { 
  if (typeof define === 'function' && define.amd) { 
   // AMD. Register as an anonymous module. 
   define(['jquery'], factory); 
   } else if (typeof exports === 'object') { 
   // Node/CommonJS 
   factory(require('jquery')); 
   } else { 
   // Browser globals 
   factory(window.jQuery || window.Zepto); 
   } 
   }(function($) { 
  
  /*>>core*/
  /**
   * 
   * Magnific Popup Core JS file
   * 
   */
  
  
  /**
   * Private static constants
   */
  var CLOSE_EVENT = 'Close',
  	BEFORE_CLOSE_EVENT = 'BeforeClose',
  	AFTER_CLOSE_EVENT = 'AfterClose',
  	BEFORE_APPEND_EVENT = 'BeforeAppend',
  	MARKUP_PARSE_EVENT = 'MarkupParse',
  	OPEN_EVENT = 'Open',
  	CHANGE_EVENT = 'Change',
  	NS = 'mfp',
  	EVENT_NS = '.' + NS,
  	READY_CLASS = 'mfp-ready',
  	REMOVING_CLASS = 'mfp-removing',
  	PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
  
  
  /**
   * Private vars 
   */
  /*jshint -W079 */
  var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
  	MagnificPopup = function(){},
  	_isJQ = !!(window.jQuery),
  	_prevStatus,
  	_window = $(window),
  	_document,
  	_prevContentType,
  	_wrapClasses,
  	_currPopupType;
  
  
  /**
   * Private functions
   */
  var _mfpOn = function(name, f) {
  		mfp.ev.on(NS + name + EVENT_NS, f);
  	},
  	_getEl = function(className, appendTo, html, raw) {
  		var el = document.createElement('div');
  		el.className = 'mfp-'+className;
  		if(html) {
  			el.innerHTML = html;
  		}
  		if(!raw) {
  			el = $(el);
  			if(appendTo) {
  				el.appendTo(appendTo);
  			}
  		} else if(appendTo) {
  			appendTo.appendChild(el);
  		}
  		return el;
  	},
  	_mfpTrigger = function(e, data) {
  		mfp.ev.triggerHandler(NS + e, data);
  
  		if(mfp.st.callbacks) {
  			// converts "mfpEventName" to "eventName" callback and triggers it if it's present
  			e = e.charAt(0).toLowerCase() + e.slice(1);
  			if(mfp.st.callbacks[e]) {
  				mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
  			}
  		}
  	},
  	_getCloseBtn = function(type) {
  		if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
  			mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
  			_currPopupType = type;
  		}
  		return mfp.currTemplate.closeBtn;
  	},
  	// Initialize Magnific Popup only when called at least once
  	_checkInstance = function() {
  		if(!$.magnificPopup.instance) {
  			/*jshint -W020 */
  			mfp = new MagnificPopup();
  			mfp.init();
  			$.magnificPopup.instance = mfp;
  		}
  	},
  	// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
  	supportsTransitions = function() {
  		var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
  			v = ['ms','O','Moz','Webkit']; // 'v' for vendor
  
  		if( s['transition'] !== undefined ) {
  			return true; 
  		}
  			
  		while( v.length ) {
  			if( v.pop() + 'Transition' in s ) {
  				return true;
  			}
  		}
  				
  		return false;
  	};
  
  
  
  /**
   * Public functions
   */
  MagnificPopup.prototype = {
  
  	constructor: MagnificPopup,
  
  	/**
  	 * Initializes Magnific Popup plugin. 
  	 * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
  	 */
  	init: function() {
  		var appVersion = navigator.appVersion;
  		mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1; 
  		mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1;
  		mfp.isLowIE = mfp.isIE7 || mfp.isIE8;
  		mfp.isAndroid = (/android/gi).test(appVersion);
  		mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
  		mfp.supportsTransition = supportsTransitions();
  
  		// We disable fixed positioned lightbox on devices that don't handle it nicely.
  		// If you know a better way of detecting this - let me know.
  		mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
  		_document = $(document);
  
  		mfp.popupsCache = {};
  	},
  
  	/**
  	 * Opens popup
  	 * @param  data [description]
  	 */
  	open: function(data) {
  
  		var i;
  
  		if(data.isObj === false) { 
  			// convert jQuery collection to array to avoid conflicts later
  			mfp.items = data.items.toArray();
  
  			mfp.index = 0;
  			var items = data.items,
  				item;
  			for(i = 0; i < items.length; i++) {
  				item = items[i];
  				if(item.parsed) {
  					item = item.el[0];
  				}
  				if(item === data.el[0]) {
  					mfp.index = i;
  					break;
  				}
  			}
  		} else {
  			mfp.items = $.isArray(data.items) ? data.items : [data.items];
  			mfp.index = data.index || 0;
  		}
  
  		// if popup is already opened - we just update the content
  		if(mfp.isOpen) {
  			mfp.updateItemHTML();
  			return;
  		}
  		
  		mfp.types = []; 
  		_wrapClasses = '';
  		if(data.mainEl && data.mainEl.length) {
  			mfp.ev = data.mainEl.eq(0);
  		} else {
  			mfp.ev = _document;
  		}
  
  		if(data.key) {
  			if(!mfp.popupsCache[data.key]) {
  				mfp.popupsCache[data.key] = {};
  			}
  			mfp.currTemplate = mfp.popupsCache[data.key];
  		} else {
  			mfp.currTemplate = {};
  		}
  
  
  
  		mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); 
  		mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
  
  		if(mfp.st.modal) {
  			mfp.st.closeOnContentClick = false;
  			mfp.st.closeOnBgClick = false;
  			mfp.st.showCloseBtn = false;
  			mfp.st.enableEscapeKey = false;
  		}
  		
  
  		// Building markup
  		// main containers are created only once
  		if(!mfp.bgOverlay) {
  
  			// Dark overlay
  			mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
  				mfp.close();
  			});
  
  			mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
  				if(mfp._checkIfClose(e.target)) {
  					mfp.close();
  				}
  			});
  
  			mfp.container = _getEl('container', mfp.wrap);
  		}
  
  		mfp.contentContainer = _getEl('content');
  		if(mfp.st.preloader) {
  			mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
  		}
  
  
  		// Initializing modules
  		var modules = $.magnificPopup.modules;
  		for(i = 0; i < modules.length; i++) {
  			var n = modules[i];
  			n = n.charAt(0).toUpperCase() + n.slice(1);
  			mfp['init'+n].call(mfp);
  		}
  		_mfpTrigger('BeforeOpen');
  
  
  		if(mfp.st.showCloseBtn) {
  			// Close button
  			if(!mfp.st.closeBtnInside) {
  				mfp.wrap.append( _getCloseBtn() );
  			} else {
  				_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
  					values.close_replaceWith = _getCloseBtn(item.type);
  				});
  				_wrapClasses += ' mfp-close-btn-in';
  			}
  		}
  
  		if(mfp.st.alignTop) {
  			_wrapClasses += ' mfp-align-top';
  		}
  
  	
  
  		if(mfp.fixedContentPos) {
  			mfp.wrap.css({
  				overflow: mfp.st.overflowY,
  				overflowX: 'hidden',
  				overflowY: mfp.st.overflowY
  			});
  		} else {
  			mfp.wrap.css({ 
  				top: _window.scrollTop(),
  				position: 'absolute'
  			});
  		}
  		if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
  			mfp.bgOverlay.css({
  				height: _document.height(),
  				position: 'absolute'
  			});
  		}
  
  		
  
  		if(mfp.st.enableEscapeKey) {
  			// Close on ESC key
  			_document.on('keyup' + EVENT_NS, function(e) {
  				if(e.keyCode === 27) {
  					mfp.close();
  				}
  			});
  		}
  
  		_window.on('resize' + EVENT_NS, function() {
  			mfp.updateSize();
  		});
  
  
  		if(!mfp.st.closeOnContentClick) {
  			_wrapClasses += ' mfp-auto-cursor';
  		}
  		
  		if(_wrapClasses)
  			mfp.wrap.addClass(_wrapClasses);
  
  
  		// this triggers recalculation of layout, so we get it once to not to trigger twice
  		var windowHeight = mfp.wH = _window.height();
  
  		
  		var windowStyles = {};
  
  		if( mfp.fixedContentPos ) {
              if(mfp._hasScrollBar(windowHeight)){
                  var s = mfp._getScrollbarSize();
                  if(s) {
                      windowStyles.marginRight = s;
                  }
              }
          }
  
  		if(mfp.fixedContentPos) {
  			if(!mfp.isIE7) {
  				windowStyles.overflow = 'hidden';
  			} else {
  				// ie7 double-scroll bug
  				$('body, html').css('overflow', 'hidden');
  			}
  		}
  
  		
  		
  		var classesToadd = mfp.st.mainClass;
  		if(mfp.isIE7) {
  			classesToadd += ' mfp-ie7';
  		}
  		if(classesToadd) {
  			mfp._addClassToMFP( classesToadd );
  		}
  
  		// add content
  		mfp.updateItemHTML();
  
  		_mfpTrigger('BuildControls');
  
  		// remove scrollbar, add margin e.t.c
  		$('html').css(windowStyles);
  		
  		// add everything to DOM
  		mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
  
  		// Save last focused element
  		mfp._lastFocusedEl = document.activeElement;
  		
  		// Wait for next cycle to allow CSS transition
  		setTimeout(function() {
  			
  			if(mfp.content) {
  				mfp._addClassToMFP(READY_CLASS);
  				mfp._setFocus();
  			} else {
  				// if content is not defined (not loaded e.t.c) we add class only for BG
  				mfp.bgOverlay.addClass(READY_CLASS);
  			}
  			
  			// Trap the focus in popup
  			_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
  
  		}, 16);
  
  		mfp.isOpen = true;
  		mfp.updateSize(windowHeight);
  		_mfpTrigger(OPEN_EVENT);
  
  		return data;
  	},
  
  	/**
  	 * Closes the popup
  	 */
  	close: function() {
  		if(!mfp.isOpen) return;
  		_mfpTrigger(BEFORE_CLOSE_EVENT);
  
  		mfp.isOpen = false;
  		// for CSS3 animation
  		if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition )  {
  			mfp._addClassToMFP(REMOVING_CLASS);
  			setTimeout(function() {
  				mfp._close();
  			}, mfp.st.removalDelay);
  		} else {
  			mfp._close();
  		}
  	},
  
  	/**
  	 * Helper for close() function
  	 */
  	_close: function() {
  		_mfpTrigger(CLOSE_EVENT);
  
  		var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
  
  		mfp.bgOverlay.detach();
  		mfp.wrap.detach();
  		mfp.container.empty();
  
  		if(mfp.st.mainClass) {
  			classesToRemove += mfp.st.mainClass + ' ';
  		}
  
  		mfp._removeClassFromMFP(classesToRemove);
  
  		if(mfp.fixedContentPos) {
  			var windowStyles = {marginRight: ''};
  			if(mfp.isIE7) {
  				$('body, html').css('overflow', '');
  			} else {
  				windowStyles.overflow = '';
  			}
  			$('html').css(windowStyles);
  		}
  		
  		_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
  		mfp.ev.off(EVENT_NS);
  
  		// clean up DOM elements that aren't removed
  		mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
  		mfp.bgOverlay.attr('class', 'mfp-bg');
  		mfp.container.attr('class', 'mfp-container');
  
  		// remove close button from target element
  		if(mfp.st.showCloseBtn &&
  		(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
  			if(mfp.currTemplate.closeBtn)
  				mfp.currTemplate.closeBtn.detach();
  		}
  
  
  		if(mfp._lastFocusedEl) {
  			$(mfp._lastFocusedEl).focus(); // put tab focus back
  		}
  		mfp.currItem = null;	
  		mfp.content = null;
  		mfp.currTemplate = null;
  		mfp.prevHeight = 0;
  
  		_mfpTrigger(AFTER_CLOSE_EVENT);
  	},
  	
  	updateSize: function(winHeight) {
  
  		if(mfp.isIOS) {
  			// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
  			var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
  			var height = window.innerHeight * zoomLevel;
  			mfp.wrap.css('height', height);
  			mfp.wH = height;
  		} else {
  			mfp.wH = winHeight || _window.height();
  		}
  		// Fixes #84: popup incorrectly positioned with position:relative on body
  		if(!mfp.fixedContentPos) {
  			mfp.wrap.css('height', mfp.wH);
  		}
  
  		_mfpTrigger('Resize');
  
  	},
  
  	/**
  	 * Set content of popup based on current index
  	 */
  	updateItemHTML: function() {
  		var item = mfp.items[mfp.index];
  
  		// Detach and perform modifications
  		mfp.contentContainer.detach();
  
  		if(mfp.content)
  			mfp.content.detach();
  
  		if(!item.parsed) {
  			item = mfp.parseEl( mfp.index );
  		}
  
  		var type = item.type;	
  
  		_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
  		// BeforeChange event works like so:
  		// _mfpOn('BeforeChange', function(e, prevType, newType) { });
  		
  		mfp.currItem = item;
  
  		
  
  		
  
  		if(!mfp.currTemplate[type]) {
  			var markup = mfp.st[type] ? mfp.st[type].markup : false;
  
  			// allows to modify markup
  			_mfpTrigger('FirstMarkupParse', markup);
  
  			if(markup) {
  				mfp.currTemplate[type] = $(markup);
  			} else {
  				// if there is no markup found we just define that template is parsed
  				mfp.currTemplate[type] = true;
  			}
  		}
  
  		if(_prevContentType && _prevContentType !== item.type) {
  			mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
  		}
  		
  		var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
  		mfp.appendContent(newContent, type);
  
  		item.preloaded = true;
  
  		_mfpTrigger(CHANGE_EVENT, item);
  		_prevContentType = item.type;
  		
  		// Append container back after its content changed
  		mfp.container.prepend(mfp.contentContainer);
  
  		_mfpTrigger('AfterChange');
  	},
  
  
  	/**
  	 * Set HTML content of popup
  	 */
  	appendContent: function(newContent, type) {
  		mfp.content = newContent;
  		
  		if(newContent) {
  			if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
  				mfp.currTemplate[type] === true) {
  				// if there is no markup, we just append close button element inside
  				if(!mfp.content.find('.mfp-close').length) {
  					mfp.content.append(_getCloseBtn());
  				}
  			} else {
  				mfp.content = newContent;
  			}
  		} else {
  			mfp.content = '';
  		}
  
  		_mfpTrigger(BEFORE_APPEND_EVENT);
  		mfp.container.addClass('mfp-'+type+'-holder');
  
  		mfp.contentContainer.append(mfp.content);
  	},
  
  
  
  	
  	/**
  	 * Creates Magnific Popup data object based on given data
  	 * @param  {int} index Index of item to parse
  	 */
  	parseEl: function(index) {
  		var item = mfp.items[index],
  			type;
  
  		if(item.tagName) {
  			item = { el: $(item) };
  		} else {
  			type = item.type;
  			item = { data: item, src: item.src };
  		}
  
  		if(item.el) {
  			var types = mfp.types;
  
  			// check for 'mfp-TYPE' class
  			for(var i = 0; i < types.length; i++) {
  				if( item.el.hasClass('mfp-'+types[i]) ) {
  					type = types[i];
  					break;
  				}
  			}
  
  			item.src = item.el.attr('data-mfp-src');
  			if(!item.src) {
  				item.src = item.el.attr('href');
  			}
  		}
  
  		item.type = type || mfp.st.type || 'inline';
  		item.index = index;
  		item.parsed = true;
  		mfp.items[index] = item;
  		_mfpTrigger('ElementParse', item);
  
  		return mfp.items[index];
  	},
  
  
  	/**
  	 * Initializes single popup or a group of popups
  	 */
  	addGroup: function(el, options) {
  		var eHandler = function(e) {
  			e.mfpEl = this;
  			mfp._openClick(e, el, options);
  		};
  
  		if(!options) {
  			options = {};
  		} 
  
  		var eName = 'click.magnificPopup';
  		options.mainEl = el;
  		
  		if(options.items) {
  			options.isObj = true;
  			el.off(eName).on(eName, eHandler);
  		} else {
  			options.isObj = false;
  			if(options.delegate) {
  				el.off(eName).on(eName, options.delegate , eHandler);
  			} else {
  				options.items = el;
  				el.off(eName).on(eName, eHandler);
  			}
  		}
  	},
  	_openClick: function(e, el, options) {
  		var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
  
  
  		if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
  			return;
  		}
  
  		var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
  
  		if(disableOn) {
  			if($.isFunction(disableOn)) {
  				if( !disableOn.call(mfp) ) {
  					return true;
  				}
  			} else { // else it's number
  				if( _window.width() < disableOn ) {
  					return true;
  				}
  			}
  		}
  		
  		if(e.type) {
  			e.preventDefault();
  
  			// This will prevent popup from closing if element is inside and popup is already opened
  			if(mfp.isOpen) {
  				e.stopPropagation();
  			}
  		}
  			
  
  		options.el = $(e.mfpEl);
  		if(options.delegate) {
  			options.items = el.find(options.delegate);
  		}
  		mfp.open(options);
  	},
  
  
  	/**
  	 * Updates text on preloader
  	 */
  	updateStatus: function(status, text) {
  
  		if(mfp.preloader) {
  			if(_prevStatus !== status) {
  				mfp.container.removeClass('mfp-s-'+_prevStatus);
  			}
  
  			if(!text && status === 'loading') {
  				text = mfp.st.tLoading;
  			}
  
  			var data = {
  				status: status,
  				text: text
  			};
  			// allows to modify status
  			_mfpTrigger('UpdateStatus', data);
  
  			status = data.status;
  			text = data.text;
  
  			mfp.preloader.html(text);
  
  			mfp.preloader.find('a').on('click', function(e) {
  				e.stopImmediatePropagation();
  			});
  
  			mfp.container.addClass('mfp-s-'+status);
  			_prevStatus = status;
  		}
  	},
  
  
  	/*
  		"Private" helpers that aren't private at all
  	 */
  	// Check to close popup or not
  	// "target" is an element that was clicked
  	_checkIfClose: function(target) {
  
  		if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
  			return;
  		}
  
  		var closeOnContent = mfp.st.closeOnContentClick;
  		var closeOnBg = mfp.st.closeOnBgClick;
  
  		if(closeOnContent && closeOnBg) {
  			return true;
  		} else {
  
  			// We close the popup if click is on close button or on preloader. Or if there is no content.
  			if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
  				return true;
  			}
  
  			// if click is outside the content
  			if(  (target !== mfp.content[0] && !$.contains(mfp.content[0], target))  ) {
  				if(closeOnBg) {
  					// last check, if the clicked element is in DOM, (in case it's removed onclick)
  					if( $.contains(document, target) ) {
  						return true;
  					}
  				}
  			} else if(closeOnContent) {
  				return true;
  			}
  
  		}
  		return false;
  	},
  	_addClassToMFP: function(cName) {
  		mfp.bgOverlay.addClass(cName);
  		mfp.wrap.addClass(cName);
  	},
  	_removeClassFromMFP: function(cName) {
  		this.bgOverlay.removeClass(cName);
  		mfp.wrap.removeClass(cName);
  	},
  	_hasScrollBar: function(winHeight) {
  		return (  (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
  	},
  	_setFocus: function() {
  		(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
  	},
  	_onFocusIn: function(e) {
  		if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
  			mfp._setFocus();
  			return false;
  		}
  	},
  	_parseMarkup: function(template, values, item) {
  		var arr;
  		if(item.data) {
  			values = $.extend(item.data, values);
  		}
  		_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
  
  		$.each(values, function(key, value) {
  			if(value === undefined || value === false) {
  				return true;
  			}
  			arr = key.split('_');
  			if(arr.length > 1) {
  				var el = template.find(EVENT_NS + '-'+arr[0]);
  
  				if(el.length > 0) {
  					var attr = arr[1];
  					if(attr === 'replaceWith') {
  						if(el[0] !== value[0]) {
  							el.replaceWith(value);
  						}
  					} else if(attr === 'img') {
  						if(el.is('img')) {
  							el.attr('src', value);
  						} else {
  							el.replaceWith( '<img src="'+value+'" class="' + el.attr('class') + '" />' );
  						}
  					} else {
  						el.attr(arr[1], value);
  					}
  				}
  
  			} else {
  				template.find(EVENT_NS + '-'+key).html(value);
  			}
  		});
  	},
  
  	_getScrollbarSize: function() {
  		// thx David
  		if(mfp.scrollbarSize === undefined) {
  			var scrollDiv = document.createElement("div");
  			scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
  			document.body.appendChild(scrollDiv);
  			mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
  			document.body.removeChild(scrollDiv);
  		}
  		return mfp.scrollbarSize;
  	}
  
  }; /* MagnificPopup core prototype end */
  
  
  
  
  /**
   * Public static functions
   */
  $.magnificPopup = {
  	instance: null,
  	proto: MagnificPopup.prototype,
  	modules: [],
  
  	open: function(options, index) {
  		_checkInstance();	
  
  		if(!options) {
  			options = {};
  		} else {
  			options = $.extend(true, {}, options);
  		}
  			
  
  		options.isObj = true;
  		options.index = index || 0;
  		return this.instance.open(options);
  	},
  
  	close: function() {
  		return $.magnificPopup.instance && $.magnificPopup.instance.close();
  	},
  
  	registerModule: function(name, module) {
  		if(module.options) {
  			$.magnificPopup.defaults[name] = module.options;
  		}
  		$.extend(this.proto, module.proto);			
  		this.modules.push(name);
  	},
  
  	defaults: {   
  
  		// Info about options is in docs:
  		// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
  		
  		disableOn: 0,	
  
  		key: null,
  
  		midClick: false,
  
  		mainClass: '',
  
  		preloader: true,
  
  		focus: '', // CSS selector of input to focus after popup is opened
  		
  		closeOnContentClick: false,
  
  		closeOnBgClick: true,
  
  		closeBtnInside: true, 
  
  		showCloseBtn: true,
  
  		enableEscapeKey: true,
  
  		modal: false,
  
  		alignTop: false,
  	
  		removalDelay: 0,
  
  		prependTo: null,
  		
  		fixedContentPos: 'auto', 
  	
  		fixedBgPos: 'auto',
  
  		overflowY: 'auto',
  
  		closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>',
  
  		tClose: 'Close (Esc)',
  
  		tLoading: 'Loading...'
  
  	}
  };
  
  
  
  $.fn.magnificPopup = function(options) {
  	_checkInstance();
  
  	var jqEl = $(this);
  
  	// We call some API method of first param is a string
  	if (typeof options === "string" ) {
  
  		if(options === 'open') {
  			var items,
  				itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
  				index = parseInt(arguments[1], 10) || 0;
  
  			if(itemOpts.items) {
  				items = itemOpts.items[index];
  			} else {
  				items = jqEl;
  				if(itemOpts.delegate) {
  					items = items.find(itemOpts.delegate);
  				}
  				items = items.eq( index );
  			}
  			mfp._openClick({mfpEl:items}, jqEl, itemOpts);
  		} else {
  			if(mfp.isOpen)
  				mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
  		}
  
  	} else {
  		// clone options obj
  		options = $.extend(true, {}, options);
  		
  		/*
  		 * As Zepto doesn't support .data() method for objects 
  		 * and it works only in normal browsers
  		 * we assign "options" object directly to the DOM element. FTW!
  		 */
  		if(_isJQ) {
  			jqEl.data('magnificPopup', options);
  		} else {
  			jqEl[0].magnificPopup = options;
  		}
  
  		mfp.addGroup(jqEl, options);
  
  	}
  	return jqEl;
  };
  
  
  //Quick benchmark
  /*
  var start = performance.now(),
  	i,
  	rounds = 1000;
  
  for(i = 0; i < rounds; i++) {
  
  }
  console.log('Test #1:', performance.now() - start);
  
  start = performance.now();
  for(i = 0; i < rounds; i++) {
  
  }
  console.log('Test #2:', performance.now() - start);
  */
  
  
  /*>>core*/
  
  /*>>inline*/
  
  var INLINE_NS = 'inline',
  	_hiddenClass,
  	_inlinePlaceholder, 
  	_lastInlineElement,
  	_putInlineElementsBack = function() {
  		if(_lastInlineElement) {
  			_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
  			_lastInlineElement = null;
  		}
  	};
  
  $.magnificPopup.registerModule(INLINE_NS, {
  	options: {
  		hiddenClass: 'hide', // will be appended with `mfp-` prefix
  		markup: '',
  		tNotFound: 'Content not found'
  	},
  	proto: {
  
  		initInline: function() {
  			mfp.types.push(INLINE_NS);
  
  			_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
  				_putInlineElementsBack();
  			});
  		},
  
  		getInline: function(item, template) {
  
  			_putInlineElementsBack();
  
  			if(item.src) {
  				var inlineSt = mfp.st.inline,
  					el = $(item.src);
  
  				if(el.length) {
  
  					// If target element has parent - we replace it with placeholder and put it back after popup is closed
  					var parent = el[0].parentNode;
  					if(parent && parent.tagName) {
  						if(!_inlinePlaceholder) {
  							_hiddenClass = inlineSt.hiddenClass;
  							_inlinePlaceholder = _getEl(_hiddenClass);
  							_hiddenClass = 'mfp-'+_hiddenClass;
  						}
  						// replace target inline element with placeholder
  						_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
  					}
  
  					mfp.updateStatus('ready');
  				} else {
  					mfp.updateStatus('error', inlineSt.tNotFound);
  					el = $('<div>');
  				}
  
  				item.inlineElement = el;
  				return el;
  			}
  
  			mfp.updateStatus('ready');
  			mfp._parseMarkup(template, {}, item);
  			return template;
  		}
  	}
  });
  
  /*>>inline*/
  
  /*>>ajax*/
  var AJAX_NS = 'ajax',
  	_ajaxCur,
  	_removeAjaxCursor = function() {
  		if(_ajaxCur) {
  			$(document.body).removeClass(_ajaxCur);
  		}
  	},
  	_destroyAjaxRequest = function() {
  		_removeAjaxCursor();
  		if(mfp.req) {
  			mfp.req.abort();
  		}
  	};
  
  $.magnificPopup.registerModule(AJAX_NS, {
  
  	options: {
  		settings: null,
  		cursor: 'mfp-ajax-cur',
  		tError: '<a href="%url%">The content</a> could not be loaded.'
  	},
  
  	proto: {
  		initAjax: function() {
  			mfp.types.push(AJAX_NS);
  			_ajaxCur = mfp.st.ajax.cursor;
  
  			_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
  			_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
  		},
  		getAjax: function(item) {
  
  			if(_ajaxCur) {
  				$(document.body).addClass(_ajaxCur);
  			}
  
  			mfp.updateStatus('loading');
  
  			var opts = $.extend({
  				url: item.src,
  				success: function(data, textStatus, jqXHR) {
  					var temp = {
  						data:data,
  						xhr:jqXHR
  					};
  
  					_mfpTrigger('ParseAjax', temp);
  
  					mfp.appendContent( $(temp.data), AJAX_NS );
  
  					item.finished = true;
  
  					_removeAjaxCursor();
  
  					mfp._setFocus();
  
  					setTimeout(function() {
  						mfp.wrap.addClass(READY_CLASS);
  					}, 16);
  
  					mfp.updateStatus('ready');
  
  					_mfpTrigger('AjaxContentAdded');
  				},
  				error: function() {
  					_removeAjaxCursor();
  					item.finished = item.loadError = true;
  					mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
  				}
  			}, mfp.st.ajax.settings);
  
  			mfp.req = $.ajax(opts);
  
  			return '';
  		}
  	}
  });
  
  
  
  
  
  	
  
  /*>>ajax*/
  
  /*>>image*/
  var _imgInterval,
  	_getTitle = function(item) {
  		if(item.data && item.data.title !== undefined) 
  			return item.data.title;
  
  		var src = mfp.st.image.titleSrc;
  
  		if(src) {
  			if($.isFunction(src)) {
  				return src.call(mfp, item);
  			} else if(item.el) {
  				return item.el.attr(src) || '';
  			}
  		}
  		return '';
  	};
  
  $.magnificPopup.registerModule('image', {
  
  	options: {
  		markup: '<div class="mfp-figure">'+
  					'<div class="mfp-close"></div>'+
  					'<figure>'+
  						'<div class="mfp-img"></div>'+
  						'<figcaption>'+
  							'<div class="mfp-bottom-bar">'+
  								'<div class="mfp-title"></div>'+
  								'<div class="mfp-counter"></div>'+
  							'</div>'+
  						'</figcaption>'+
  					'</figure>'+
  				'</div>',
  		cursor: 'mfp-zoom-out-cur',
  		titleSrc: 'title', 
  		verticalFit: true,
  		tError: '<a href="%url%">The image</a> could not be loaded.'
  	},
  
  	proto: {
  		initImage: function() {
  			var imgSt = mfp.st.image,
  				ns = '.image';
  
  			mfp.types.push('image');
  
  			_mfpOn(OPEN_EVENT+ns, function() {
  				if(mfp.currItem.type === 'image' && imgSt.cursor) {
  					$(document.body).addClass(imgSt.cursor);
  				}
  			});
  
  			_mfpOn(CLOSE_EVENT+ns, function() {
  				if(imgSt.cursor) {
  					$(document.body).removeClass(imgSt.cursor);
  				}
  				_window.off('resize' + EVENT_NS);
  			});
  
  			_mfpOn('Resize'+ns, mfp.resizeImage);
  			if(mfp.isLowIE) {
  				_mfpOn('AfterChange', mfp.resizeImage);
  			}
  		},
  		resizeImage: function() {
  			var item = mfp.currItem;
  			if(!item || !item.img) return;
  
  			if(mfp.st.image.verticalFit) {
  				var decr = 0;
  				// fix box-sizing in ie7/8
  				if(mfp.isLowIE) {
  					decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
  				}
  				item.img.css('max-height', mfp.wH-decr);
  			}
  		},
  		_onImageHasSize: function(item) {
  			if(item.img) {
  				
  				item.hasSize = true;
  
  				if(_imgInterval) {
  					clearInterval(_imgInterval);
  				}
  				
  				item.isCheckingImgSize = false;
  
  				_mfpTrigger('ImageHasSize', item);
  
  				if(item.imgHidden) {
  					if(mfp.content)
  						mfp.content.removeClass('mfp-loading');
  					
  					item.imgHidden = false;
  				}
  
  			}
  		},
  
  		/**
  		 * Function that loops until the image has size to display elements that rely on it asap
  		 */
  		findImageSize: function(item) {
  
  			var counter = 0,
  				img = item.img[0],
  				mfpSetInterval = function(delay) {
  
  					if(_imgInterval) {
  						clearInterval(_imgInterval);
  					}
  					// decelerating interval that checks for size of an image
  					_imgInterval = setInterval(function() {
  						if(img.naturalWidth > 0) {
  							mfp._onImageHasSize(item);
  							return;
  						}
  
  						if(counter > 200) {
  							clearInterval(_imgInterval);
  						}
  
  						counter++;
  						if(counter === 3) {
  							mfpSetInterval(10);
  						} else if(counter === 40) {
  							mfpSetInterval(50);
  						} else if(counter === 100) {
  							mfpSetInterval(500);
  						}
  					}, delay);
  				};
  
  			mfpSetInterval(1);
  		},
  
  		getImage: function(item, template) {
  
  			var guard = 0,
  
  				// image load complete handler
  				onLoadComplete = function() {
  					if(item) {
  						if (item.img[0].complete) {
  							item.img.off('.mfploader');
  							
  							if(item === mfp.currItem){
  								mfp._onImageHasSize(item);
  
  								mfp.updateStatus('ready');
  							}
  
  							item.hasSize = true;
  							item.loaded = true;
  
  							_mfpTrigger('ImageLoadComplete');
  							
  						}
  						else {
  							// if image complete check fails 200 times (20 sec), we assume that there was an error.
  							guard++;
  							if(guard < 200) {
  								setTimeout(onLoadComplete,100);
  							} else {
  								onLoadError();
  							}
  						}
  					}
  				},
  
  				// image error handler
  				onLoadError = function() {
  					if(item) {
  						item.img.off('.mfploader');
  						if(item === mfp.currItem){
  							mfp._onImageHasSize(item);
  							mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
  						}
  
  						item.hasSize = true;
  						item.loaded = true;
  						item.loadError = true;
  					}
  				},
  				imgSt = mfp.st.image;
  
  
  			var el = template.find('.mfp-img');
  			if(el.length) {
  				var img = document.createElement('img');
  				img.className = 'mfp-img';
  				if(item.el && item.el.find('img').length) {
  					img.alt = item.el.find('img').attr('alt');
  				}
  				item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
  				img.src = item.src;
  
  				// without clone() "error" event is not firing when IMG is replaced by new IMG
  				// TODO: find a way to avoid such cloning
  				if(el.is('img')) {
  					item.img = item.img.clone();
  				}
  
  				img = item.img[0];
  				if(img.naturalWidth > 0) {
  					item.hasSize = true;
  				} else if(!img.width) {										
  					item.hasSize = false;
  				}
  			}
  
  			mfp._parseMarkup(template, {
  				title: _getTitle(item),
  				img_replaceWith: item.img
  			}, item);
  
  			mfp.resizeImage();
  
  			if(item.hasSize) {
  				if(_imgInterval) clearInterval(_imgInterval);
  
  				if(item.loadError) {
  					template.addClass('mfp-loading');
  					mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
  				} else {
  					template.removeClass('mfp-loading');
  					mfp.updateStatus('ready');
  				}
  				return template;
  			}
  
  			mfp.updateStatus('loading');
  			item.loading = true;
  
  			if(!item.hasSize) {
  				item.imgHidden = true;
  				template.addClass('mfp-loading');
  				mfp.findImageSize(item);
  			} 
  
  			return template;
  		}
  	}
  });
  
  
  
  /*>>image*/
  
  /*>>zoom*/
  var hasMozTransform,
  	getHasMozTransform = function() {
  		if(hasMozTransform === undefined) {
  			hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
  		}
  		return hasMozTransform;		
  	};
  
  $.magnificPopup.registerModule('zoom', {
  
  	options: {
  		enabled: false,
  		easing: 'ease-in-out',
  		duration: 300,
  		opener: function(element) {
  			return element.is('img') ? element : element.find('img');
  		}
  	},
  
  	proto: {
  
  		initZoom: function() {
  			var zoomSt = mfp.st.zoom,
  				ns = '.zoom',
  				image;
  				
  			if(!zoomSt.enabled || !mfp.supportsTransition) {
  				return;
  			}
  
  			var duration = zoomSt.duration,
  				getElToAnimate = function(image) {
  					var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
  						transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
  						cssObj = {
  							position: 'fixed',
  							zIndex: 9999,
  							left: 0,
  							top: 0,
  							'-webkit-backface-visibility': 'hidden'
  						},
  						t = 'transition';
  
  					cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
  
  					newImg.css(cssObj);
  					return newImg;
  				},
  				showMainContent = function() {
  					mfp.content.css('visibility', 'visible');
  				},
  				openTimeout,
  				animatedImg;
  
  			_mfpOn('BuildControls'+ns, function() {
  				if(mfp._allowZoom()) {
  
  					clearTimeout(openTimeout);
  					mfp.content.css('visibility', 'hidden');
  
  					// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
  					
  					image = mfp._getItemToZoom();
  
  					if(!image) {
  						showMainContent();
  						return;
  					}
  
  					animatedImg = getElToAnimate(image); 
  					
  					animatedImg.css( mfp._getOffset() );
  
  					mfp.wrap.append(animatedImg);
  
  					openTimeout = setTimeout(function() {
  						animatedImg.css( mfp._getOffset( true ) );
  						openTimeout = setTimeout(function() {
  
  							showMainContent();
  
  							setTimeout(function() {
  								animatedImg.remove();
  								image = animatedImg = null;
  								_mfpTrigger('ZoomAnimationEnded');
  							}, 16); // avoid blink when switching images 
  
  						}, duration); // this timeout equals animation duration
  
  					}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
  
  
  					// Lots of timeouts...
  				}
  			});
  			_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
  				if(mfp._allowZoom()) {
  
  					clearTimeout(openTimeout);
  
  					mfp.st.removalDelay = duration;
  
  					if(!image) {
  						image = mfp._getItemToZoom();
  						if(!image) {
  							return;
  						}
  						animatedImg = getElToAnimate(image);
  					}
  					
  					
  					animatedImg.css( mfp._getOffset(true) );
  					mfp.wrap.append(animatedImg);
  					mfp.content.css('visibility', 'hidden');
  					
  					setTimeout(function() {
  						animatedImg.css( mfp._getOffset() );
  					}, 16);
  				}
  
  			});
  
  			_mfpOn(CLOSE_EVENT+ns, function() {
  				if(mfp._allowZoom()) {
  					showMainContent();
  					if(animatedImg) {
  						animatedImg.remove();
  					}
  					image = null;
  				}	
  			});
  		},
  
  		_allowZoom: function() {
  			return mfp.currItem.type === 'image';
  		},
  
  		_getItemToZoom: function() {
  			if(mfp.currItem.hasSize) {
  				return mfp.currItem.img;
  			} else {
  				return false;
  			}
  		},
  
  		// Get element postion relative to viewport
  		_getOffset: function(isLarge) {
  			var el;
  			if(isLarge) {
  				el = mfp.currItem.img;
  			} else {
  				el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
  			}
  
  			var offset = el.offset();
  			var paddingTop = parseInt(el.css('padding-top'),10);
  			var paddingBottom = parseInt(el.css('padding-bottom'),10);
  			offset.top -= ( $(window).scrollTop() - paddingTop );
  
  
  			/*
  			
  			Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
  
  			 */
  			var obj = {
  				width: el.width(),
  				// fix Zepto height+padding issue
  				height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
  			};
  
  			// I hate to do this, but there is no another option
  			if( getHasMozTransform() ) {
  				obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
  			} else {
  				obj.left = offset.left;
  				obj.top = offset.top;
  			}
  			return obj;
  		}
  
  	}
  });
  
  
  
  /*>>zoom*/
  
  /*>>iframe*/
  
  var IFRAME_NS = 'iframe',
  	_emptyPage = '//about:blank',
  	
  	_fixIframeBugs = function(isShowing) {
  		if(mfp.currTemplate[IFRAME_NS]) {
  			var el = mfp.currTemplate[IFRAME_NS].find('iframe');
  			if(el.length) { 
  				// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
  				if(!isShowing) {
  					el[0].src = _emptyPage;
  				}
  
  				// IE8 black screen bug fix
  				if(mfp.isIE8) {
  					el.css('display', isShowing ? 'block' : 'none');
  				}
  			}
  		}
  	};
  
  $.magnificPopup.registerModule(IFRAME_NS, {
  
  	options: {
  		markup: '<div class="mfp-iframe-scaler">'+
  					'<div class="mfp-close"></div>'+
  					'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
  				'</div>',
  
  		srcAction: 'iframe_src',
  
  		// we don't care and support only one default type of URL by default
  		patterns: {
  			youtube: {
  				index: 'youtube.com', 
  				id: 'v=', 
  				src: '//www.youtube.com/embed/%id%?autoplay=1'
  			},
  			vimeo: {
  				index: 'vimeo.com/',
  				id: '/',
  				src: '//player.vimeo.com/video/%id%?autoplay=1'
  			},
  			gmaps: {
  				index: '//maps.google.',
  				src: '%id%&output=embed'
  			}
  		}
  	},
  
  	proto: {
  		initIframe: function() {
  			mfp.types.push(IFRAME_NS);
  
  			_mfpOn('BeforeChange', function(e, prevType, newType) {
  				if(prevType !== newType) {
  					if(prevType === IFRAME_NS) {
  						_fixIframeBugs(); // iframe if removed
  					} else if(newType === IFRAME_NS) {
  						_fixIframeBugs(true); // iframe is showing
  					} 
  				}// else {
  					// iframe source is switched, don't do anything
  				//}
  			});
  
  			_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
  				_fixIframeBugs();
  			});
  		},
  
  		getIframe: function(item, template) {
  			var embedSrc = item.src;
  			var iframeSt = mfp.st.iframe;
  				
  			$.each(iframeSt.patterns, function() {
  				if(embedSrc.indexOf( this.index ) > -1) {
  					if(this.id) {
  						if(typeof this.id === 'string') {
  							embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
  						} else {
  							embedSrc = this.id.call( this, embedSrc );
  						}
  					}
  					embedSrc = this.src.replace('%id%', embedSrc );
  					return false; // break;
  				}
  			});
  			
  			var dataObj = {};
  			if(iframeSt.srcAction) {
  				dataObj[iframeSt.srcAction] = embedSrc;
  			}
  			mfp._parseMarkup(template, dataObj, item);
  
  			mfp.updateStatus('ready');
  
  			return template;
  		}
  	}
  });
  
  
  
  /*>>iframe*/
  
  /*>>gallery*/
  /**
   * Get looped index depending on number of slides
   */
  var _getLoopedId = function(index) {
  		var numSlides = mfp.items.length;
  		if(index > numSlides - 1) {
  			return index - numSlides;
  		} else  if(index < 0) {
  			return numSlides + index;
  		}
  		return index;
  	},
  	_replaceCurrTotal = function(text, curr, total) {
  		return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
  	};
  
  $.magnificPopup.registerModule('gallery', {
  
  	options: {
  		enabled: false,
  		arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
  		preload: [0,2],
  		navigateByImgClick: true,
  		arrows: true,
  
  		tPrev: 'Previous (Left arrow key)',
  		tNext: 'Next (Right arrow key)',
  		tCounter: '%curr% of %total%'
  	},
  
  	proto: {
  		initGallery: function() {
  
  			var gSt = mfp.st.gallery,
  				ns = '.mfp-gallery',
  				supportsFastClick = Boolean($.fn.mfpFastClick);
  
  			mfp.direction = true; // true - next, false - prev
  			
  			if(!gSt || !gSt.enabled ) return false;
  
  			_wrapClasses += ' mfp-gallery';
  
  			_mfpOn(OPEN_EVENT+ns, function() {
  
  				if(gSt.navigateByImgClick) {
  					mfp.wrap.on('click'+ns, '.mfp-img', function() {
  						if(mfp.items.length > 1) {
  							mfp.next();
  							return false;
  						}
  					});
  				}
  
  				_document.on('keydown'+ns, function(e) {
  					if (e.keyCode === 37) {
  						mfp.prev();
  					} else if (e.keyCode === 39) {
  						mfp.next();
  					}
  				});
  			});
  
  			_mfpOn('UpdateStatus'+ns, function(e, data) {
  				if(data.text) {
  					data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
  				}
  			});
  
  			_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
  				var l = mfp.items.length;
  				values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
  			});
  
  			_mfpOn('BuildControls' + ns, function() {
  				if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
  					var markup = gSt.arrowMarkup,
  						arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),			
  						arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
  
  					var eName = supportsFastClick ? 'mfpFastClick' : 'click';
  					arrowLeft[eName](function() {
  						mfp.prev();
  					});			
  					arrowRight[eName](function() {
  						mfp.next();
  					});	
  
  					// Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b)
  					if(mfp.isIE7) {
  						_getEl('b', arrowLeft[0], false, true);
  						_getEl('a', arrowLeft[0], false, true);
  						_getEl('b', arrowRight[0], false, true);
  						_getEl('a', arrowRight[0], false, true);
  					}
  
  					mfp.container.append(arrowLeft.add(arrowRight));
  				}
  			});
  
  			_mfpOn(CHANGE_EVENT+ns, function() {
  				if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
  
  				mfp._preloadTimeout = setTimeout(function() {
  					mfp.preloadNearbyImages();
  					mfp._preloadTimeout = null;
  				}, 16);		
  			});
  
  
  			_mfpOn(CLOSE_EVENT+ns, function() {
  				_document.off(ns);
  				mfp.wrap.off('click'+ns);
  			
  				if(mfp.arrowLeft && supportsFastClick) {
  					mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();
  				}
  				mfp.arrowRight = mfp.arrowLeft = null;
  			});
  
  		}, 
  		next: function() {
  			mfp.direction = true;
  			mfp.index = _getLoopedId(mfp.index + 1);
  			mfp.updateItemHTML();
  		},
  		prev: function() {
  			mfp.direction = false;
  			mfp.index = _getLoopedId(mfp.index - 1);
  			mfp.updateItemHTML();
  		},
  		goTo: function(newIndex) {
  			mfp.direction = (newIndex >= mfp.index);
  			mfp.index = newIndex;
  			mfp.updateItemHTML();
  		},
  		preloadNearbyImages: function() {
  			var p = mfp.st.gallery.preload,
  				preloadBefore = Math.min(p[0], mfp.items.length),
  				preloadAfter = Math.min(p[1], mfp.items.length),
  				i;
  
  			for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
  				mfp._preloadItem(mfp.index+i);
  			}
  			for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
  				mfp._preloadItem(mfp.index-i);
  			}
  		},
  		_preloadItem: function(index) {
  			index = _getLoopedId(index);
  
  			if(mfp.items[index].preloaded) {
  				return;
  			}
  
  			var item = mfp.items[index];
  			if(!item.parsed) {
  				item = mfp.parseEl( index );
  			}
  
  			_mfpTrigger('LazyLoad', item);
  
  			if(item.type === 'image') {
  				item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
  					item.hasSize = true;
  				}).on('error.mfploader', function() {
  					item.hasSize = true;
  					item.loadError = true;
  					_mfpTrigger('LazyLoadError', item);
  				}).attr('src', item.src);
  			}
  
  
  			item.preloaded = true;
  		}
  	}
  });
  
  /*
  Touch Support that might be implemented some day
  
  addSwipeGesture: function() {
  	var startX,
  		moved,
  		multipleTouches;
  
  		return;
  
  	var namespace = '.mfp',
  		addEventNames = function(pref, down, move, up, cancel) {
  			mfp._tStart = pref + down + namespace;
  			mfp._tMove = pref + move + namespace;
  			mfp._tEnd = pref + up + namespace;
  			mfp._tCancel = pref + cancel + namespace;
  		};
  
  	if(window.navigator.msPointerEnabled) {
  		addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');
  	} else if('ontouchstart' in window) {
  		addEventNames('touch', 'start', 'move', 'end', 'cancel');
  	} else {
  		return;
  	}
  	_window.on(mfp._tStart, function(e) {
  		var oE = e.originalEvent;
  		multipleTouches = moved = false;
  		startX = oE.pageX || oE.changedTouches[0].pageX;
  	}).on(mfp._tMove, function(e) {
  		if(e.originalEvent.touches.length > 1) {
  			multipleTouches = e.originalEvent.touches.length;
  		} else {
  			//e.preventDefault();
  			moved = true;
  		}
  	}).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) {
  		if(moved && !multipleTouches) {
  			var oE = e.originalEvent,
  				diff = startX - (oE.pageX || oE.changedTouches[0].pageX);
  
  			if(diff > 20) {
  				mfp.next();
  			} else if(diff < -20) {
  				mfp.prev();
  			}
  		}
  	});
  },
  */
  
  
  /*>>gallery*/
  
  /*>>retina*/
  
  var RETINA_NS = 'retina';
  
  $.magnificPopup.registerModule(RETINA_NS, {
  	options: {
  		replaceSrc: function(item) {
  			return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
  		},
  		ratio: 1 // Function or number.  Set to 1 to disable.
  	},
  	proto: {
  		initRetina: function() {
  			if(window.devicePixelRatio > 1) {
  
  				var st = mfp.st.retina,
  					ratio = st.ratio;
  
  				ratio = !isNaN(ratio) ? ratio : ratio();
  
  				if(ratio > 1) {
  					_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
  						item.img.css({
  							'max-width': item.img[0].naturalWidth / ratio,
  							'width': '100%'
  						});
  					});
  					_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
  						item.src = st.replaceSrc(item, ratio);
  					});
  				}
  			}
  
  		}
  	}
  });
  
  /*>>retina*/
  
  /*>>fastclick*/
  /**
   * FastClick event implementation. (removes 300ms delay on touch devices)
   * Based on https://developers.google.com/mobile/articles/fast_buttons
   *
   * You may use it outside the Magnific Popup by calling just:
   *
   * $('.your-el').mfpFastClick(function() {
   *     console.log('Clicked!');
   * });
   *
   * To unbind:
   * $('.your-el').destroyMfpFastClick();
   * 
   * 
   * Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound.
   * If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick
   * 
   */
  
  (function() {
  	var ghostClickDelay = 1000,
  		supportsTouch = 'ontouchstart' in window,
  		unbindTouchMove = function() {
  			_window.off('touchmove'+ns+' touchend'+ns);
  		},
  		eName = 'mfpFastClick',
  		ns = '.'+eName;
  
  
  	// As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way
  	$.fn.mfpFastClick = function(callback) {
  
  		return $(this).each(function() {
  
  			var elem = $(this),
  				lock;
  
  			if( supportsTouch ) {
  
  				var timeout,
  					startX,
  					startY,
  					pointerMoved,
  					point,
  					numPointers;
  
  				elem.on('touchstart' + ns, function(e) {
  					pointerMoved = false;
  					numPointers = 1;
  
  					point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0];
  					startX = point.clientX;
  					startY = point.clientY;
  
  					_window.on('touchmove'+ns, function(e) {
  						point = e.originalEvent ? e.originalEvent.touches : e.touches;
  						numPointers = point.length;
  						point = point[0];
  						if (Math.abs(point.clientX - startX) > 10 ||
  							Math.abs(point.clientY - startY) > 10) {
  							pointerMoved = true;
  							unbindTouchMove();
  						}
  					}).on('touchend'+ns, function(e) {
  						unbindTouchMove();
  						if(pointerMoved || numPointers > 1) {
  							return;
  						}
  						lock = true;
  						e.preventDefault();
  						clearTimeout(timeout);
  						timeout = setTimeout(function() {
  							lock = false;
  						}, ghostClickDelay);
  						callback();
  					});
  				});
  
  			}
  
  			elem.on('click' + ns, function() {
  				if(!lock) {
  					callback();
  				}
  			});
  		});
  	};
  
  	$.fn.destroyMfpFastClick = function() {
  		$(this).off('touchstart' + ns + ' click' + ns);
  		if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns);
  	};
  })();
  
  /*>>fastclick*/
   _checkInstance(); }));
  /**
   * Owl Carousel v2.2.0
   * Copyright 2013-2016 David Deutsch
   * Licensed under MIT (https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE)
   */
  /**
   * Owl carousel
   * @version 2.1.6
   * @author Bartosz Wojciechowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   * @todo Lazy Load Icon
   * @todo prevent animationend bubling
   * @todo itemsScaleUp
   * @todo Test Zepto
   * @todo stagePadding calculate wrong active classes
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates a carousel.
  	 * @class The Owl Carousel.
  	 * @public
  	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
  	 * @param {Object} [options] - The options
  	 */
  	function Owl(element, options) {
  
  		/**
  		 * Current settings for the carousel.
  		 * @public
  		 */
  		this.settings = null;
  
  		/**
  		 * Current options set by the caller including defaults.
  		 * @public
  		 */
  		this.options = $.extend({}, Owl.Defaults, options);
  
  		/**
  		 * Plugin element.
  		 * @public
  		 */
  		this.$element = $(element);
  
  		/**
  		 * Proxied event handlers.
  		 * @protected
  		 */
  		this._handlers = {};
  
  		/**
  		 * References to the running plugins of this carousel.
  		 * @protected
  		 */
  		this._plugins = {};
  
  		/**
  		 * Currently suppressed events to prevent them from beeing retriggered.
  		 * @protected
  		 */
  		this._supress = {};
  
  		/**
  		 * Absolute current position.
  		 * @protected
  		 */
  		this._current = null;
  
  		/**
  		 * Animation speed in milliseconds.
  		 * @protected
  		 */
  		this._speed = null;
  
  		/**
  		 * Coordinates of all items in pixel.
  		 * @todo The name of this member is missleading.
  		 * @protected
  		 */
  		this._coordinates = [];
  
  		/**
  		 * Current breakpoint.
  		 * @todo Real media queries would be nice.
  		 * @protected
  		 */
  		this._breakpoint = null;
  
  		/**
  		 * Current width of the plugin element.
  		 */
  		this._width = null;
  
  		/**
  		 * All real items.
  		 * @protected
  		 */
  		this._items = [];
  
  		/**
  		 * All cloned items.
  		 * @protected
  		 */
  		this._clones = [];
  
  		/**
  		 * Merge values of all items.
  		 * @todo Maybe this could be part of a plugin.
  		 * @protected
  		 */
  		this._mergers = [];
  
  		/**
  		 * Widths of all items.
  		 */
  		this._widths = [];
  
  		/**
  		 * Invalidated parts within the update process.
  		 * @protected
  		 */
  		this._invalidated = {};
  
  		/**
  		 * Ordered list of workers for the update process.
  		 * @protected
  		 */
  		this._pipe = [];
  
  		/**
  		 * Current state information for the drag operation.
  		 * @todo #261
  		 * @protected
  		 */
  		this._drag = {
  			time: null,
  			target: null,
  			pointer: null,
  			stage: {
  				start: null,
  				current: null
  			},
  			direction: null
  		};
  
  		/**
  		 * Current state information and their tags.
  		 * @type {Object}
  		 * @protected
  		 */
  		this._states = {
  			current: {},
  			tags: {
  				'initializing': [ 'busy' ],
  				'animating': [ 'busy' ],
  				'dragging': [ 'interacting' ]
  			}
  		};
  
  		$.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
  			this._handlers[handler] = $.proxy(this[handler], this);
  		}, this));
  
  		$.each(Owl.Plugins, $.proxy(function(key, plugin) {
  			this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
  				= new plugin(this);
  		}, this));
  
  		$.each(Owl.Workers, $.proxy(function(priority, worker) {
  			this._pipe.push({
  				'filter': worker.filter,
  				'run': $.proxy(worker.run, this)
  			});
  		}, this));
  
  		this.setup();
  		this.initialize();
  	}
  
  	/**
  	 * Default options for the carousel.
  	 * @public
  	 */
  	Owl.Defaults = {
  		items: 3,
  		loop: false,
  		center: false,
  		rewind: false,
  
  		mouseDrag: true,
  		touchDrag: true,
  		pullDrag: true,
  		freeDrag: false,
  
  		margin: 0,
  		stagePadding: 0,
  
  		merge: false,
  		mergeFit: true,
  		autoWidth: false,
  
  		startPosition: 0,
  		rtl: false,
  
  		smartSpeed: 250,
  		fluidSpeed: false,
  		dragEndSpeed: false,
  
  		responsive: {},
  		responsiveRefreshRate: 200,
  		responsiveBaseElement: window,
  
  		fallbackEasing: 'swing',
  
  		info: false,
  
  		nestedItemSelector: false,
  		itemElement: 'div',
  		stageElement: 'div',
  
  		refreshClass: 'owl-refresh',
  		loadedClass: 'owl-loaded',
  		loadingClass: 'owl-loading',
  		rtlClass: 'owl-rtl',
  		responsiveClass: 'owl-responsive',
  		dragClass: 'owl-drag',
  		itemClass: 'owl-item',
  		stageClass: 'owl-stage',
  		stageOuterClass: 'owl-stage-outer',
  		grabClass: 'owl-grab'
  	};
  
  	/**
  	 * Enumeration for width.
  	 * @public
  	 * @readonly
  	 * @enum {String}
  	 */
  	Owl.Width = {
  		Default: 'default',
  		Inner: 'inner',
  		Outer: 'outer'
  	};
  
  	/**
  	 * Enumeration for types.
  	 * @public
  	 * @readonly
  	 * @enum {String}
  	 */
  	Owl.Type = {
  		Event: 'event',
  		State: 'state'
  	};
  
  	/**
  	 * Contains all registered plugins.
  	 * @public
  	 */
  	Owl.Plugins = {};
  
  	/**
  	 * List of workers involved in the update process.
  	 */
  	Owl.Workers = [ {
  		filter: [ 'width', 'settings' ],
  		run: function() {
  			this._width = this.$element.width();
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function(cache) {
  			cache.current = this._items && this._items[this.relative(this._current)];
  		}
  	}, {
  		filter: [ 'items', 'settings' ],
  		run: function() {
  			this.$stage.children('.cloned').remove();
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function(cache) {
  			var margin = this.settings.margin || '',
  				grid = !this.settings.autoWidth,
  				rtl = this.settings.rtl,
  				css = {
  					'width': 'auto',
  					'margin-left': rtl ? margin : '',
  					'margin-right': rtl ? '' : margin
  				};
  
  			!grid && this.$stage.children().css(css);
  
  			cache.css = css;
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function(cache) {
  			var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
  				merge = null,
  				iterator = this._items.length,
  				grid = !this.settings.autoWidth,
  				widths = [];
  
  			cache.items = {
  				merge: false,
  				width: width
  			};
  
  			while (iterator--) {
  				merge = this._mergers[iterator];
  				merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
  
  				cache.items.merge = merge > 1 || cache.items.merge;
  
  				widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
  			}
  
  			this._widths = widths;
  		}
  	}, {
  		filter: [ 'items', 'settings' ],
  		run: function() {
  			var clones = [],
  				items = this._items,
  				settings = this.settings,
  				view = Math.max(settings.items * 2, 4),
  				size = Math.ceil(items.length / 2) * 2,
  				repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
  				append = '',
  				prepend = '';
  
  			repeat /= 2;
  
  			while (repeat--) {
  				clones.push(this.normalize(clones.length / 2, true));
  				append = append + items[clones[clones.length - 1]][0].outerHTML;
  				clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
  				prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
  			}
  
  			this._clones = clones;
  
  			$(append).addClass('cloned').appendTo(this.$stage);
  			$(prepend).addClass('cloned').prependTo(this.$stage);
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function() {
  			var rtl = this.settings.rtl ? 1 : -1,
  				size = this._clones.length + this._items.length,
  				iterator = -1,
  				previous = 0,
  				current = 0,
  				coordinates = [];
  
  			while (++iterator < size) {
  				previous = coordinates[iterator - 1] || 0;
  				current = this._widths[this.relative(iterator)] + this.settings.margin;
  				coordinates.push(previous + current * rtl);
  			}
  
  			this._coordinates = coordinates;
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function() {
  			var padding = this.settings.stagePadding,
  				coordinates = this._coordinates,
  				css = {
  					'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
  					'padding-left': padding || '',
  					'padding-right': padding || ''
  				};
  
  			this.$stage.css(css);
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function(cache) {
  			var iterator = this._coordinates.length,
  				grid = !this.settings.autoWidth,
  				items = this.$stage.children();
  
  			if (grid && cache.items.merge) {
  				while (iterator--) {
  					cache.css.width = this._widths[this.relative(iterator)];
  					items.eq(iterator).css(cache.css);
  				}
  			} else if (grid) {
  				cache.css.width = cache.items.width;
  				items.css(cache.css);
  			}
  		}
  	}, {
  		filter: [ 'items' ],
  		run: function() {
  			this._coordinates.length < 1 && this.$stage.removeAttr('style');
  		}
  	}, {
  		filter: [ 'width', 'items', 'settings' ],
  		run: function(cache) {
  			cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
  			cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
  			this.reset(cache.current);
  		}
  	}, {
  		filter: [ 'position' ],
  		run: function() {
  			this.animate(this.coordinates(this._current));
  		}
  	}, {
  		filter: [ 'width', 'position', 'items', 'settings' ],
  		run: function() {
  			var rtl = this.settings.rtl ? 1 : -1,
  				padding = this.settings.stagePadding * 2,
  				begin = this.coordinates(this.current()) + padding,
  				end = begin + this.width() * rtl,
  				inner, outer, matches = [], i, n;
  
  			for (i = 0, n = this._coordinates.length; i < n; i++) {
  				inner = this._coordinates[i - 1] || 0;
  				outer = Math.abs(this._coordinates[i]) + padding * rtl;
  
  				if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
  					|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
  					matches.push(i);
  				}
  			}
  
  			this.$stage.children('.active').removeClass('active');
  			this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
  
  			if (this.settings.center) {
  				this.$stage.children('.center').removeClass('center');
  				this.$stage.children().eq(this.current()).addClass('center');
  			}
  		}
  	} ];
  
  	/**
  	 * Initializes the carousel.
  	 * @protected
  	 */
  	Owl.prototype.initialize = function() {
  		this.enter('initializing');
  		this.trigger('initialize');
  
  		this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
  
  		if (this.settings.autoWidth && !this.is('pre-loading')) {
  			var imgs, nestedSelector, width;
  			imgs = this.$element.find('img');
  			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
  			width = this.$element.children(nestedSelector).width();
  
  			if (imgs.length && width <= 0) {
  				this.preloadAutoWidthImages(imgs);
  			}
  		}
  
  		this.$element.addClass(this.options.loadingClass);
  
  		// create stage
  		this.$stage = $('<' + this.settings.stageElement + ' class="' + this.settings.stageClass + '"/>')
  			.wrap('<div class="' + this.settings.stageOuterClass + '"/>');
  
  		// append stage
  		this.$element.append(this.$stage.parent());
  
  		// append content
  		this.replace(this.$element.children().not(this.$stage.parent()));
  
  		// check visibility
  		if (this.$element.is(':visible')) {
  			// update view
  			this.refresh();
  		} else {
  			// invalidate width
  			this.invalidate('width');
  		}
  
  		this.$element
  			.removeClass(this.options.loadingClass)
  			.addClass(this.options.loadedClass);
  
  		// register event handlers
  		this.registerEventHandlers();
  
  		this.leave('initializing');
  		this.trigger('initialized');
  	};
  
  	/**
  	 * Setups the current settings.
  	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
  	 * @todo Support for media queries by using `matchMedia` would be nice.
  	 * @public
  	 */
  	Owl.prototype.setup = function() {
  		var viewport = this.viewport(),
  			overwrites = this.options.responsive,
  			match = -1,
  			settings = null;
  
  		if (!overwrites) {
  			settings = $.extend({}, this.options);
  		} else {
  			$.each(overwrites, function(breakpoint) {
  				if (breakpoint <= viewport && breakpoint > match) {
  					match = Number(breakpoint);
  				}
  			});
  
  			settings = $.extend({}, this.options, overwrites[match]);
  			if (typeof settings.stagePadding === 'function') {
  				settings.stagePadding = settings.stagePadding();
  			}
  			delete settings.responsive;
  
  			// responsive class
  			if (settings.responsiveClass) {
  				this.$element.attr('class',
  					this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
  				);
  			}
  		}
  
  		this.trigger('change', { property: { name: 'settings', value: settings } });
  		this._breakpoint = match;
  		this.settings = settings;
  		this.invalidate('settings');
  		this.trigger('changed', { property: { name: 'settings', value: this.settings } });
  	};
  
  	/**
  	 * Updates option logic if necessery.
  	 * @protected
  	 */
  	Owl.prototype.optionsLogic = function() {
  		if (this.settings.autoWidth) {
  			this.settings.stagePadding = false;
  			this.settings.merge = false;
  		}
  	};
  
  	/**
  	 * Prepares an item before add.
  	 * @todo Rename event parameter `content` to `item`.
  	 * @protected
  	 * @returns {jQuery|HTMLElement} - The item container.
  	 */
  	Owl.prototype.prepare = function(item) {
  		var event = this.trigger('prepare', { content: item });
  
  		if (!event.data) {
  			event.data = $('<' + this.settings.itemElement + '/>')
  				.addClass(this.options.itemClass).append(item)
  		}
  
  		this.trigger('prepared', { content: event.data });
  
  		return event.data;
  	};
  
  	/**
  	 * Updates the view.
  	 * @public
  	 */
  	Owl.prototype.update = function() {
  		var i = 0,
  			n = this._pipe.length,
  			filter = $.proxy(function(p) { return this[p] }, this._invalidated),
  			cache = {};
  
  		while (i < n) {
  			if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
  				this._pipe[i].run(cache);
  			}
  			i++;
  		}
  
  		this._invalidated = {};
  
  		!this.is('valid') && this.enter('valid');
  	};
  
  	/**
  	 * Gets the width of the view.
  	 * @public
  	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
  	 * @returns {Number} - The width of the view in pixel.
  	 */
  	Owl.prototype.width = function(dimension) {
  		dimension = dimension || Owl.Width.Default;
  		switch (dimension) {
  			case Owl.Width.Inner:
  			case Owl.Width.Outer:
  				return this._width;
  			default:
  				return this._width - this.settings.stagePadding * 2 + this.settings.margin;
  		}
  	};
  
  	/**
  	 * Refreshes the carousel primarily for adaptive purposes.
  	 * @public
  	 */
  	Owl.prototype.refresh = function() {
  		this.enter('refreshing');
  		this.trigger('refresh');
  
  		this.setup();
  
  		this.optionsLogic();
  
  		this.$element.addClass(this.options.refreshClass);
  
  		this.update();
  
  		this.$element.removeClass(this.options.refreshClass);
  
  		this.leave('refreshing');
  		this.trigger('refreshed');
  	};
  
  	/**
  	 * Checks window `resize` event.
  	 * @protected
  	 */
  	Owl.prototype.onThrottledResize = function() {
  		window.clearTimeout(this.resizeTimer);
  		this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
  	};
  
  	/**
  	 * Checks window `resize` event.
  	 * @protected
  	 */
  	Owl.prototype.onResize = function() {
  		if (!this._items.length) {
  			return false;
  		}
  
  		if (this._width === this.$element.width()) {
  			return false;
  		}
  
  		if (!this.$element.is(':visible')) {
  			return false;
  		}
  
  		this.enter('resizing');
  
  		if (this.trigger('resize').isDefaultPrevented()) {
  			this.leave('resizing');
  			return false;
  		}
  
  		this.invalidate('width');
  
  		this.refresh();
  
  		this.leave('resizing');
  		this.trigger('resized');
  	};
  
  	/**
  	 * Registers event handlers.
  	 * @todo Check `msPointerEnabled`
  	 * @todo #261
  	 * @protected
  	 */
  	Owl.prototype.registerEventHandlers = function() {
  		if ($.support.transition) {
  			this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
  		}
  
  		if (this.settings.responsive !== false) {
  			this.on(window, 'resize', this._handlers.onThrottledResize);
  		}
  
  		if (this.settings.mouseDrag) {
  			this.$element.addClass(this.options.dragClass);
  			this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
  			this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
  		}
  
  		if (this.settings.touchDrag){
  			this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
  			this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
  		}
  	};
  
  	/**
  	 * Handles `touchstart` and `mousedown` events.
  	 * @todo Horizontal swipe threshold as option
  	 * @todo #261
  	 * @protected
  	 * @param {Event} event - The event arguments.
  	 */
  	Owl.prototype.onDragStart = function(event) {
  		var stage = null;
  
  		if (event.which === 3) {
  			return;
  		}
  
  		if ($.support.transform) {
  			stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
  			stage = {
  				x: stage[stage.length === 16 ? 12 : 4],
  				y: stage[stage.length === 16 ? 13 : 5]
  			};
  		} else {
  			stage = this.$stage.position();
  			stage = {
  				x: this.settings.rtl ?
  					stage.left + this.$stage.width() - this.width() + this.settings.margin :
  					stage.left,
  				y: stage.top
  			};
  		}
  
  		if (this.is('animating')) {
  			$.support.transform ? this.animate(stage.x) : this.$stage.stop()
  			this.invalidate('position');
  		}
  
  		this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
  
  		this.speed(0);
  
  		this._drag.time = new Date().getTime();
  		this._drag.target = $(event.target);
  		this._drag.stage.start = stage;
  		this._drag.stage.current = stage;
  		this._drag.pointer = this.pointer(event);
  
  		$(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
  
  		$(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
  			var delta = this.difference(this._drag.pointer, this.pointer(event));
  
  			$(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
  
  			if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
  				return;
  			}
  
  			event.preventDefault();
  
  			this.enter('dragging');
  			this.trigger('drag');
  		}, this));
  	};
  
  	/**
  	 * Handles the `touchmove` and `mousemove` events.
  	 * @todo #261
  	 * @protected
  	 * @param {Event} event - The event arguments.
  	 */
  	Owl.prototype.onDragMove = function(event) {
  		var minimum = null,
  			maximum = null,
  			pull = null,
  			delta = this.difference(this._drag.pointer, this.pointer(event)),
  			stage = this.difference(this._drag.stage.start, delta);
  
  		if (!this.is('dragging')) {
  			return;
  		}
  
  		event.preventDefault();
  
  		if (this.settings.loop) {
  			minimum = this.coordinates(this.minimum());
  			maximum = this.coordinates(this.maximum() + 1) - minimum;
  			stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
  		} else {
  			minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
  			maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
  			pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
  			stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
  		}
  
  		this._drag.stage.current = stage;
  
  		this.animate(stage.x);
  	};
  
  	/**
  	 * Handles the `touchend` and `mouseup` events.
  	 * @todo #261
  	 * @todo Threshold for click event
  	 * @protected
  	 * @param {Event} event - The event arguments.
  	 */
  	Owl.prototype.onDragEnd = function(event) {
  		var delta = this.difference(this._drag.pointer, this.pointer(event)),
  			stage = this._drag.stage.current,
  			direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
  
  		$(document).off('.owl.core');
  
  		this.$element.removeClass(this.options.grabClass);
  
  		if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
  			this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
  			this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
  			this.invalidate('position');
  			this.update();
  
  			this._drag.direction = direction;
  
  			if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
  				this._drag.target.one('click.owl.core', function() { return false; });
  			}
  		}
  
  		if (!this.is('dragging')) {
  			return;
  		}
  
  		this.leave('dragging');
  		this.trigger('dragged');
  	};
  
  	/**
  	 * Gets absolute position of the closest item for a coordinate.
  	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
  	 * @protected
  	 * @param {Number} coordinate - The coordinate in pixel.
  	 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
  	 * @return {Number} - The absolute position of the closest item.
  	 */
  	Owl.prototype.closest = function(coordinate, direction) {
  		var position = -1,
  			pull = 30,
  			width = this.width(),
  			coordinates = this.coordinates();
  
  		if (!this.settings.freeDrag) {
  			// check closest item
  			$.each(coordinates, $.proxy(function(index, value) {
  				// on a left pull, check on current index
  				if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
  					position = index;
  				// on a right pull, check on previous index
  				// to do so, subtract width from value and set position = index + 1
  				} else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
  					position = index + 1;
  				} else if (this.op(coordinate, '<', value)
  					&& this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
  					position = direction === 'left' ? index + 1 : index;
  				}
  				return position === -1;
  			}, this));
  		}
  
  		if (!this.settings.loop) {
  			// non loop boundries
  			if (this.op(coordinate, '>', coordinates[this.minimum()])) {
  				position = coordinate = this.minimum();
  			} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
  				position = coordinate = this.maximum();
  			}
  		}
  
  		return position;
  	};
  
  	/**
  	 * Animates the stage.
  	 * @todo #270
  	 * @public
  	 * @param {Number} coordinate - The coordinate in pixels.
  	 */
  	Owl.prototype.animate = function(coordinate) {
  		var animate = this.speed() > 0;
  
  		this.is('animating') && this.onTransitionEnd();
  
  		if (animate) {
  			this.enter('animating');
  			this.trigger('translate');
  		}
  
  		if ($.support.transform3d && $.support.transition) {
  			this.$stage.css({
  				transform: 'translate3d(' + coordinate + 'px,0px,0px)',
  				transition: (this.speed() / 1000) + 's'
  			});
  		} else if (animate) {
  			this.$stage.animate({
  				left: coordinate + 'px'
  			}, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
  		} else {
  			this.$stage.css({
  				left: coordinate + 'px'
  			});
  		}
  	};
  
  	/**
  	 * Checks whether the carousel is in a specific state or not.
  	 * @param {String} state - The state to check.
  	 * @returns {Boolean} - The flag which indicates if the carousel is busy.
  	 */
  	Owl.prototype.is = function(state) {
  		return this._states.current[state] && this._states.current[state] > 0;
  	};
  
  	/**
  	 * Sets the absolute position of the current item.
  	 * @public
  	 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
  	 * @returns {Number} - The absolute position of the current item.
  	 */
  	Owl.prototype.current = function(position) {
  		if (position === undefined) {
  			return this._current;
  		}
  
  		if (this._items.length === 0) {
  			return undefined;
  		}
  
  		position = this.normalize(position);
  
  		if (this._current !== position) {
  			var event = this.trigger('change', { property: { name: 'position', value: position } });
  
  			if (event.data !== undefined) {
  				position = this.normalize(event.data);
  			}
  
  			this._current = position;
  
  			this.invalidate('position');
  
  			this.trigger('changed', { property: { name: 'position', value: this._current } });
  		}
  
  		return this._current;
  	};
  
  	/**
  	 * Invalidates the given part of the update routine.
  	 * @param {String} [part] - The part to invalidate.
  	 * @returns {Array.<String>} - The invalidated parts.
  	 */
  	Owl.prototype.invalidate = function(part) {
  		if ($.type(part) === 'string') {
  			this._invalidated[part] = true;
  			this.is('valid') && this.leave('valid');
  		}
  		return $.map(this._invalidated, function(v, i) { return i });
  	};
  
  	/**
  	 * Resets the absolute position of the current item.
  	 * @public
  	 * @param {Number} position - The absolute position of the new item.
  	 */
  	Owl.prototype.reset = function(position) {
  		position = this.normalize(position);
  
  		if (position === undefined) {
  			return;
  		}
  
  		this._speed = 0;
  		this._current = position;
  
  		this.suppress([ 'translate', 'translated' ]);
  
  		this.animate(this.coordinates(position));
  
  		this.release([ 'translate', 'translated' ]);
  	};
  
  	/**
  	 * Normalizes an absolute or a relative position of an item.
  	 * @public
  	 * @param {Number} position - The absolute or relative position to normalize.
  	 * @param {Boolean} [relative=false] - Whether the given position is relative or not.
  	 * @returns {Number} - The normalized position.
  	 */
  	Owl.prototype.normalize = function(position, relative) {
  		var n = this._items.length,
  			m = relative ? 0 : this._clones.length;
  
  		if (!this.isNumeric(position) || n < 1) {
  			position = undefined;
  		} else if (position < 0 || position >= n + m) {
  			position = ((position - m / 2) % n + n) % n + m / 2;
  		}
  
  		return position;
  	};
  
  	/**
  	 * Converts an absolute position of an item into a relative one.
  	 * @public
  	 * @param {Number} position - The absolute position to convert.
  	 * @returns {Number} - The converted position.
  	 */
  	Owl.prototype.relative = function(position) {
  		position -= this._clones.length / 2;
  		return this.normalize(position, true);
  	};
  
  	/**
  	 * Gets the maximum position for the current item.
  	 * @public
  	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
  	 * @returns {Number}
  	 */
  	Owl.prototype.maximum = function(relative) {
  		var settings = this.settings,
  			maximum = this._coordinates.length,
  			iterator,
  			reciprocalItemsWidth,
  			elementWidth;
  
  		if (settings.loop) {
  			maximum = this._clones.length / 2 + this._items.length - 1;
  		} else if (settings.autoWidth || settings.merge) {
  			iterator = this._items.length;
  			reciprocalItemsWidth = this._items[--iterator].width();
  			elementWidth = this.$element.width();
  			while (iterator--) {
  				reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
  				if (reciprocalItemsWidth > elementWidth) {
  					break;
  				}
  			}
  			maximum = iterator + 1;
  		} else if (settings.center) {
  			maximum = this._items.length - 1;
  		} else {
  			maximum = this._items.length - settings.items;
  		}
  
  		if (relative) {
  			maximum -= this._clones.length / 2;
  		}
  
  		return Math.max(maximum, 0);
  	};
  
  	/**
  	 * Gets the minimum position for the current item.
  	 * @public
  	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
  	 * @returns {Number}
  	 */
  	Owl.prototype.minimum = function(relative) {
  		return relative ? 0 : this._clones.length / 2;
  	};
  
  	/**
  	 * Gets an item at the specified relative position.
  	 * @public
  	 * @param {Number} [position] - The relative position of the item.
  	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
  	 */
  	Owl.prototype.items = function(position) {
  		if (position === undefined) {
  			return this._items.slice();
  		}
  
  		position = this.normalize(position, true);
  		return this._items[position];
  	};
  
  	/**
  	 * Gets an item at the specified relative position.
  	 * @public
  	 * @param {Number} [position] - The relative position of the item.
  	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
  	 */
  	Owl.prototype.mergers = function(position) {
  		if (position === undefined) {
  			return this._mergers.slice();
  		}
  
  		position = this.normalize(position, true);
  		return this._mergers[position];
  	};
  
  	/**
  	 * Gets the absolute positions of clones for an item.
  	 * @public
  	 * @param {Number} [position] - The relative position of the item.
  	 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
  	 */
  	Owl.prototype.clones = function(position) {
  		var odd = this._clones.length / 2,
  			even = odd + this._items.length,
  			map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
  
  		if (position === undefined) {
  			return $.map(this._clones, function(v, i) { return map(i) });
  		}
  
  		return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
  	};
  
  	/**
  	 * Sets the current animation speed.
  	 * @public
  	 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
  	 * @returns {Number} - The current animation speed in milliseconds.
  	 */
  	Owl.prototype.speed = function(speed) {
  		if (speed !== undefined) {
  			this._speed = speed;
  		}
  
  		return this._speed;
  	};
  
  	/**
  	 * Gets the coordinate of an item.
  	 * @todo The name of this method is missleanding.
  	 * @public
  	 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
  	 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
  	 */
  	Owl.prototype.coordinates = function(position) {
  		var multiplier = 1,
  			newPosition = position - 1,
  			coordinate;
  
  		if (position === undefined) {
  			return $.map(this._coordinates, $.proxy(function(coordinate, index) {
  				return this.coordinates(index);
  			}, this));
  		}
  
  		if (this.settings.center) {
  			if (this.settings.rtl) {
  				multiplier = -1;
  				newPosition = position + 1;
  			}
  
  			coordinate = this._coordinates[position];
  			coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
  		} else {
  			coordinate = this._coordinates[newPosition] || 0;
  		}
  
  		coordinate = Math.ceil(coordinate);
  
  		return coordinate;
  	};
  
  	/**
  	 * Calculates the speed for a translation.
  	 * @protected
  	 * @param {Number} from - The absolute position of the start item.
  	 * @param {Number} to - The absolute position of the target item.
  	 * @param {Number} [factor=undefined] - The time factor in milliseconds.
  	 * @returns {Number} - The time in milliseconds for the translation.
  	 */
  	Owl.prototype.duration = function(from, to, factor) {
  		if (factor === 0) {
  			return 0;
  		}
  
  		return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
  	};
  
  	/**
  	 * Slides to the specified item.
  	 * @public
  	 * @param {Number} position - The position of the item.
  	 * @param {Number} [speed] - The time in milliseconds for the transition.
  	 */
  	Owl.prototype.to = function(position, speed) {
  		var current = this.current(),
  			revert = null,
  			distance = position - this.relative(current),
  			direction = (distance > 0) - (distance < 0),
  			items = this._items.length,
  			minimum = this.minimum(),
  			maximum = this.maximum();
  
  		if (this.settings.loop) {
  			if (!this.settings.rewind && Math.abs(distance) > items / 2) {
  				distance += direction * -1 * items;
  			}
  
  			position = current + distance;
  			revert = ((position - minimum) % items + items) % items + minimum;
  
  			if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
  				current = revert - distance;
  				position = revert;
  				this.reset(current);
  			}
  		} else if (this.settings.rewind) {
  			maximum += 1;
  			position = (position % maximum + maximum) % maximum;
  		} else {
  			position = Math.max(minimum, Math.min(maximum, position));
  		}
  
  		this.speed(this.duration(current, position, speed));
  		this.current(position);
  
  		if (this.$element.is(':visible')) {
  			this.update();
  		}
  	};
  
  	/**
  	 * Slides to the next item.
  	 * @public
  	 * @param {Number} [speed] - The time in milliseconds for the transition.
  	 */
  	Owl.prototype.next = function(speed) {
  		speed = speed || false;
  		this.to(this.relative(this.current()) + 1, speed);
  	};
  
  	/**
  	 * Slides to the previous item.
  	 * @public
  	 * @param {Number} [speed] - The time in milliseconds for the transition.
  	 */
  	Owl.prototype.prev = function(speed) {
  		speed = speed || false;
  		this.to(this.relative(this.current()) - 1, speed);
  	};
  
  	/**
  	 * Handles the end of an animation.
  	 * @protected
  	 * @param {Event} event - The event arguments.
  	 */
  	Owl.prototype.onTransitionEnd = function(event) {
  
  		// if css2 animation then event object is undefined
  		if (event !== undefined) {
  			event.stopPropagation();
  
  			// Catch only owl-stage transitionEnd event
  			if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
  				return false;
  			}
  		}
  
  		this.leave('animating');
  		this.trigger('translated');
  	};
  
  	/**
  	 * Gets viewport width.
  	 * @protected
  	 * @return {Number} - The width in pixel.
  	 */
  	Owl.prototype.viewport = function() {
  		var width;
  		if (this.options.responsiveBaseElement !== window) {
  			width = $(this.options.responsiveBaseElement).width();
  		} else if (window.innerWidth) {
  			width = window.innerWidth;
  		} else if (document.documentElement && document.documentElement.clientWidth) {
  			width = document.documentElement.clientWidth;
  		} else {
  			throw 'Can not detect viewport width.';
  		}
  		return width;
  	};
  
  	/**
  	 * Replaces the current content.
  	 * @public
  	 * @param {HTMLElement|jQuery|String} content - The new content.
  	 */
  	Owl.prototype.replace = function(content) {
  		this.$stage.empty();
  		this._items = [];
  
  		if (content) {
  			content = (content instanceof jQuery) ? content : $(content);
  		}
  
  		if (this.settings.nestedItemSelector) {
  			content = content.find('.' + this.settings.nestedItemSelector);
  		}
  
  		content.filter(function() {
  			return this.nodeType === 1;
  		}).each($.proxy(function(index, item) {
  			item = this.prepare(item);
  			this.$stage.append(item);
  			this._items.push(item);
  			this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
  		}, this));
  
  		this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
  
  		this.invalidate('items');
  	};
  
  	/**
  	 * Adds an item.
  	 * @todo Use `item` instead of `content` for the event arguments.
  	 * @public
  	 * @param {HTMLElement|jQuery|String} content - The item content to add.
  	 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
  	 */
  	Owl.prototype.add = function(content, position) {
  		var current = this.relative(this._current);
  
  		position = position === undefined ? this._items.length : this.normalize(position, true);
  		content = content instanceof jQuery ? content : $(content);
  
  		this.trigger('add', { content: content, position: position });
  
  		content = this.prepare(content);
  
  		if (this._items.length === 0 || position === this._items.length) {
  			this._items.length === 0 && this.$stage.append(content);
  			this._items.length !== 0 && this._items[position - 1].after(content);
  			this._items.push(content);
  			this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
  		} else {
  			this._items[position].before(content);
  			this._items.splice(position, 0, content);
  			this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
  		}
  
  		this._items[current] && this.reset(this._items[current].index());
  
  		this.invalidate('items');
  
  		this.trigger('added', { content: content, position: position });
  	};
  
  	/**
  	 * Removes an item by its position.
  	 * @todo Use `item` instead of `content` for the event arguments.
  	 * @public
  	 * @param {Number} position - The relative position of the item to remove.
  	 */
  	Owl.prototype.remove = function(position) {
  		position = this.normalize(position, true);
  
  		if (position === undefined) {
  			return;
  		}
  
  		this.trigger('remove', { content: this._items[position], position: position });
  
  		this._items[position].remove();
  		this._items.splice(position, 1);
  		this._mergers.splice(position, 1);
  
  		this.invalidate('items');
  
  		this.trigger('removed', { content: null, position: position });
  	};
  
  	/**
  	 * Preloads images with auto width.
  	 * @todo Replace by a more generic approach
  	 * @protected
  	 */
  	Owl.prototype.preloadAutoWidthImages = function(images) {
  		images.each($.proxy(function(i, element) {
  			this.enter('pre-loading');
  			element = $(element);
  			$(new Image()).one('load', $.proxy(function(e) {
  				element.attr('src', e.target.src);
  				element.css('opacity', 1);
  				this.leave('pre-loading');
  				!this.is('pre-loading') && !this.is('initializing') && this.refresh();
  			}, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
  		}, this));
  	};
  
  	/**
  	 * Destroys the carousel.
  	 * @public
  	 */
  	Owl.prototype.destroy = function() {
  
  		this.$element.off('.owl.core');
  		this.$stage.off('.owl.core');
  		$(document).off('.owl.core');
  
  		if (this.settings.responsive !== false) {
  			window.clearTimeout(this.resizeTimer);
  			this.off(window, 'resize', this._handlers.onThrottledResize);
  		}
  
  		for (var i in this._plugins) {
  			this._plugins[i].destroy();
  		}
  
  		this.$stage.children('.cloned').remove();
  
  		this.$stage.unwrap();
  		this.$stage.children().contents().unwrap();
  		this.$stage.children().unwrap();
  
  		this.$element
  			.removeClass(this.options.refreshClass)
  			.removeClass(this.options.loadingClass)
  			.removeClass(this.options.loadedClass)
  			.removeClass(this.options.rtlClass)
  			.removeClass(this.options.dragClass)
  			.removeClass(this.options.grabClass)
  			.attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
  			.removeData('owl.carousel');
  	};
  
  	/**
  	 * Operators to calculate right-to-left and left-to-right.
  	 * @protected
  	 * @param {Number} [a] - The left side operand.
  	 * @param {String} [o] - The operator.
  	 * @param {Number} [b] - The right side operand.
  	 */
  	Owl.prototype.op = function(a, o, b) {
  		var rtl = this.settings.rtl;
  		switch (o) {
  			case '<':
  				return rtl ? a > b : a < b;
  			case '>':
  				return rtl ? a < b : a > b;
  			case '>=':
  				return rtl ? a <= b : a >= b;
  			case '<=':
  				return rtl ? a >= b : a <= b;
  			default:
  				break;
  		}
  	};
  
  	/**
  	 * Attaches to an internal event.
  	 * @protected
  	 * @param {HTMLElement} element - The event source.
  	 * @param {String} event - The event name.
  	 * @param {Function} listener - The event handler to attach.
  	 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
  	 */
  	Owl.prototype.on = function(element, event, listener, capture) {
  		if (element.addEventListener) {
  			element.addEventListener(event, listener, capture);
  		} else if (element.attachEvent) {
  			element.attachEvent('on' + event, listener);
  		}
  	};
  
  	/**
  	 * Detaches from an internal event.
  	 * @protected
  	 * @param {HTMLElement} element - The event source.
  	 * @param {String} event - The event name.
  	 * @param {Function} listener - The attached event handler to detach.
  	 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
  	 */
  	Owl.prototype.off = function(element, event, listener, capture) {
  		if (element.removeEventListener) {
  			element.removeEventListener(event, listener, capture);
  		} else if (element.detachEvent) {
  			element.detachEvent('on' + event, listener);
  		}
  	};
  
  	/**
  	 * Triggers a public event.
  	 * @todo Remove `status`, `relatedTarget` should be used instead.
  	 * @protected
  	 * @param {String} name - The event name.
  	 * @param {*} [data=null] - The event data.
  	 * @param {String} [namespace=carousel] - The event namespace.
  	 * @param {String} [state] - The state which is associated with the event.
  	 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
  	 * @returns {Event} - The event arguments.
  	 */
  	Owl.prototype.trigger = function(name, data, namespace, state, enter) {
  		var status = {
  			item: { count: this._items.length, index: this.current() }
  		}, handler = $.camelCase(
  			$.grep([ 'on', name, namespace ], function(v) { return v })
  				.join('-').toLowerCase()
  		), event = $.Event(
  			[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
  			$.extend({ relatedTarget: this }, status, data)
  		);
  
  		if (!this._supress[name]) {
  			$.each(this._plugins, function(name, plugin) {
  				if (plugin.onTrigger) {
  					plugin.onTrigger(event);
  				}
  			});
  
  			this.register({ type: Owl.Type.Event, name: name });
  			this.$element.trigger(event);
  
  			if (this.settings && typeof this.settings[handler] === 'function') {
  				this.settings[handler].call(this, event);
  			}
  		}
  
  		return event;
  	};
  
  	/**
  	 * Enters a state.
  	 * @param name - The state name.
  	 */
  	Owl.prototype.enter = function(name) {
  		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
  			if (this._states.current[name] === undefined) {
  				this._states.current[name] = 0;
  			}
  
  			this._states.current[name]++;
  		}, this));
  	};
  
  	/**
  	 * Leaves a state.
  	 * @param name - The state name.
  	 */
  	Owl.prototype.leave = function(name) {
  		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
  			this._states.current[name]--;
  		}, this));
  	};
  
  	/**
  	 * Registers an event or state.
  	 * @public
  	 * @param {Object} object - The event or state to register.
  	 */
  	Owl.prototype.register = function(object) {
  		if (object.type === Owl.Type.Event) {
  			if (!$.event.special[object.name]) {
  				$.event.special[object.name] = {};
  			}
  
  			if (!$.event.special[object.name].owl) {
  				var _default = $.event.special[object.name]._default;
  				$.event.special[object.name]._default = function(e) {
  					if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
  						return _default.apply(this, arguments);
  					}
  					return e.namespace && e.namespace.indexOf('owl') > -1;
  				};
  				$.event.special[object.name].owl = true;
  			}
  		} else if (object.type === Owl.Type.State) {
  			if (!this._states.tags[object.name]) {
  				this._states.tags[object.name] = object.tags;
  			} else {
  				this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
  			}
  
  			this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
  				return $.inArray(tag, this._states.tags[object.name]) === i;
  			}, this));
  		}
  	};
  
  	/**
  	 * Suppresses events.
  	 * @protected
  	 * @param {Array.<String>} events - The events to suppress.
  	 */
  	Owl.prototype.suppress = function(events) {
  		$.each(events, $.proxy(function(index, event) {
  			this._supress[event] = true;
  		}, this));
  	};
  
  	/**
  	 * Releases suppressed events.
  	 * @protected
  	 * @param {Array.<String>} events - The events to release.
  	 */
  	Owl.prototype.release = function(events) {
  		$.each(events, $.proxy(function(index, event) {
  			delete this._supress[event];
  		}, this));
  	};
  
  	/**
  	 * Gets unified pointer coordinates from event.
  	 * @todo #261
  	 * @protected
  	 * @param {Event} - The `mousedown` or `touchstart` event.
  	 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
  	 */
  	Owl.prototype.pointer = function(event) {
  		var result = { x: null, y: null };
  
  		event = event.originalEvent || event || window.event;
  
  		event = event.touches && event.touches.length ?
  			event.touches[0] : event.changedTouches && event.changedTouches.length ?
  				event.changedTouches[0] : event;
  
  		if (event.pageX) {
  			result.x = event.pageX;
  			result.y = event.pageY;
  		} else {
  			result.x = event.clientX;
  			result.y = event.clientY;
  		}
  
  		return result;
  	};
  
  	/**
  	 * Determines if the input is a Number or something that can be coerced to a Number
  	 * @protected
  	 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
  	 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
  	 */
  	Owl.prototype.isNumeric = function(number) {
  		return !isNaN(parseFloat(number));
  	};
  
  	/**
  	 * Gets the difference of two vectors.
  	 * @todo #261
  	 * @protected
  	 * @param {Object} - The first vector.
  	 * @param {Object} - The second vector.
  	 * @returns {Object} - The difference.
  	 */
  	Owl.prototype.difference = function(first, second) {
  		return {
  			x: first.x - second.x,
  			y: first.y - second.y
  		};
  	};
  
  	/**
  	 * The jQuery Plugin for the Owl Carousel
  	 * @todo Navigation plugin `next` and `prev`
  	 * @public
  	 */
  	$.fn.owlCarousel = function(option) {
  		var args = Array.prototype.slice.call(arguments, 1);
  
  		return this.each(function() {
  			var $this = $(this),
  				data = $this.data('owl.carousel');
  
  			if (!data) {
  				data = new Owl(this, typeof option == 'object' && option);
  				$this.data('owl.carousel', data);
  
  				$.each([
  					'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
  				], function(i, event) {
  					data.register({ type: Owl.Type.Event, name: event });
  					data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
  						if (e.namespace && e.relatedTarget !== this) {
  							this.suppress([ event ]);
  							data[event].apply(this, [].slice.call(arguments, 1));
  							this.release([ event ]);
  						}
  					}, data));
  				});
  			}
  
  			if (typeof option == 'string' && option.charAt(0) !== '_') {
  				data[option].apply(data, args);
  			}
  		});
  	};
  
  	/**
  	 * The constructor for the jQuery Plugin
  	 * @public
  	 */
  	$.fn.owlCarousel.Constructor = Owl;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * AutoRefresh Plugin
   * @version 2.1.0
   * @author Artus Kolanowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the auto refresh plugin.
  	 * @class The Auto Refresh Plugin
  	 * @param {Owl} carousel - The Owl Carousel
  	 */
  	var AutoRefresh = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * Refresh interval.
  		 * @protected
  		 * @type {number}
  		 */
  		this._interval = null;
  
  		/**
  		 * Whether the element is currently visible or not.
  		 * @protected
  		 * @type {Boolean}
  		 */
  		this._visible = null;
  
  		/**
  		 * All event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'initialized.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.autoRefresh) {
  					this.watch();
  				}
  			}, this)
  		};
  
  		// set default options
  		this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
  
  		// register event handlers
  		this._core.$element.on(this._handlers);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	AutoRefresh.Defaults = {
  		autoRefresh: true,
  		autoRefreshInterval: 500
  	};
  
  	/**
  	 * Watches the element.
  	 */
  	AutoRefresh.prototype.watch = function() {
  		if (this._interval) {
  			return;
  		}
  
  		this._visible = this._core.$element.is(':visible');
  		this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
  	};
  
  	/**
  	 * Refreshes the element.
  	 */
  	AutoRefresh.prototype.refresh = function() {
  		if (this._core.$element.is(':visible') === this._visible) {
  			return;
  		}
  
  		this._visible = !this._visible;
  
  		this._core.$element.toggleClass('owl-hidden', !this._visible);
  
  		this._visible && (this._core.invalidate('width') && this._core.refresh());
  	};
  
  	/**
  	 * Destroys the plugin.
  	 */
  	AutoRefresh.prototype.destroy = function() {
  		var handler, property;
  
  		window.clearInterval(this._interval);
  
  		for (handler in this._handlers) {
  			this._core.$element.off(handler, this._handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Lazy Plugin
   * @version 2.1.0
   * @author Bartosz Wojciechowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the lazy plugin.
  	 * @class The Lazy Plugin
  	 * @param {Owl} carousel - The Owl Carousel
  	 */
  	var Lazy = function(carousel) {
  
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * Already loaded items.
  		 * @protected
  		 * @type {Array.<jQuery>}
  		 */
  		this._loaded = [];
  
  		/**
  		 * Event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
  				if (!e.namespace) {
  					return;
  				}
  
  				if (!this._core.settings || !this._core.settings.lazyLoad) {
  					return;
  				}
  
  				if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
  					var settings = this._core.settings,
  						n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
  						i = ((settings.center && n * -1) || 0),
  						position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
  						clones = this._core.clones().length,
  						load = $.proxy(function(i, v) { this.load(v) }, this);
  
  					while (i++ < n) {
  						this.load(clones / 2 + this._core.relative(position));
  						clones && $.each(this._core.clones(this._core.relative(position)), load);
  						position++;
  					}
  				}
  			}, this)
  		};
  
  		// set the default options
  		this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
  
  		// register event handler
  		this._core.$element.on(this._handlers);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	Lazy.Defaults = {
  		lazyLoad: false
  	};
  
  	/**
  	 * Loads all resources of an item at the specified position.
  	 * @param {Number} position - The absolute position of the item.
  	 * @protected
  	 */
  	Lazy.prototype.load = function(position) {
  		var $item = this._core.$stage.children().eq(position),
  			$elements = $item && $item.find('.owl-lazy');
  
  		if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
  			return;
  		}
  
  		$elements.each($.proxy(function(index, element) {
  			var $element = $(element), image,
  				url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');
  
  			this._core.trigger('load', { element: $element, url: url }, 'lazy');
  
  			if ($element.is('img')) {
  				$element.one('load.owl.lazy', $.proxy(function() {
  					$element.css('opacity', 1);
  					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
  				}, this)).attr('src', url);
  			} else {
  				image = new Image();
  				image.onload = $.proxy(function() {
  					$element.css({
  						'background-image': 'url(' + url + ')',
  						'opacity': '1'
  					});
  					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
  				}, this);
  				image.src = url;
  			}
  		}, this));
  
  		this._loaded.push($item.get(0));
  	};
  
  	/**
  	 * Destroys the plugin.
  	 * @public
  	 */
  	Lazy.prototype.destroy = function() {
  		var handler, property;
  
  		for (handler in this.handlers) {
  			this._core.$element.off(handler, this.handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * AutoHeight Plugin
   * @version 2.1.0
   * @author Bartosz Wojciechowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the auto height plugin.
  	 * @class The Auto Height Plugin
  	 * @param {Owl} carousel - The Owl Carousel
  	 */
  	var AutoHeight = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * All event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.autoHeight) {
  					this.update();
  				}
  			}, this),
  			'changed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.autoHeight && e.property.name == 'position'){
  					this.update();
  				}
  			}, this),
  			'loaded.owl.lazy': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.autoHeight
  					&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
  					this.update();
  				}
  			}, this)
  		};
  
  		// set default options
  		this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
  
  		// register event handlers
  		this._core.$element.on(this._handlers);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	AutoHeight.Defaults = {
  		autoHeight: false,
  		autoHeightClass: 'owl-height'
  	};
  
  	/**
  	 * Updates the view.
  	 */
  	AutoHeight.prototype.update = function() {
  		var start = this._core._current,
  			end = start + this._core.settings.items,
  			visible = this._core.$stage.children().toArray().slice(start, end),
  			heights = [],
  			maxheight = 0;
  
  		$.each(visible, function(index, item) {
  			heights.push($(item).height());
  		});
  
  		maxheight = Math.max.apply(null, heights);
  
  		this._core.$stage.parent()
  			.height(maxheight)
  			.addClass(this._core.settings.autoHeightClass);
  	};
  
  	AutoHeight.prototype.destroy = function() {
  		var handler, property;
  
  		for (handler in this._handlers) {
  			this._core.$element.off(handler, this._handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Video Plugin
   * @version 2.1.0
   * @author Bartosz Wojciechowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the video plugin.
  	 * @class The Video Plugin
  	 * @param {Owl} carousel - The Owl Carousel
  	 */
  	var Video = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * Cache all video URLs.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._videos = {};
  
  		/**
  		 * Current playing item.
  		 * @protected
  		 * @type {jQuery}
  		 */
  		this._playing = null;
  
  		/**
  		 * All event handlers.
  		 * @todo The cloned content removale is too late
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'initialized.owl.carousel': $.proxy(function(e) {
  				if (e.namespace) {
  					this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
  				}
  			}, this),
  			'resize.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
  					e.preventDefault();
  				}
  			}, this),
  			'refreshed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.is('resizing')) {
  					this._core.$stage.find('.cloned .owl-video-frame').remove();
  				}
  			}, this),
  			'changed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && e.property.name === 'position' && this._playing) {
  					this.stop();
  				}
  			}, this),
  			'prepared.owl.carousel': $.proxy(function(e) {
  				if (!e.namespace) {
  					return;
  				}
  
  				var $element = $(e.content).find('.owl-video');
  
  				if ($element.length) {
  					$element.css('display', 'none');
  					this.fetch($element, $(e.content));
  				}
  			}, this)
  		};
  
  		// set default options
  		this._core.options = $.extend({}, Video.Defaults, this._core.options);
  
  		// register event handlers
  		this._core.$element.on(this._handlers);
  
  		this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
  			this.play(e);
  		}, this));
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	Video.Defaults = {
  		video: false,
  		videoHeight: false,
  		videoWidth: false
  	};
  
  	/**
  	 * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
  	 * @protected
  	 * @param {jQuery} target - The target containing the video data.
  	 * @param {jQuery} item - The item containing the video.
  	 */
  	Video.prototype.fetch = function(target, item) {
  			var type = (function() {
  					if (target.attr('data-vimeo-id')) {
  						return 'vimeo';
  					} else if (target.attr('data-vzaar-id')) {
  						return 'vzaar'
  					} else {
  						return 'youtube';
  					}
  				})(),
  				id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
  				width = target.attr('data-width') || this._core.settings.videoWidth,
  				height = target.attr('data-height') || this._core.settings.videoHeight,
  				url = target.attr('href');
  
  		if (url) {
  
  			/*
  					Parses the id's out of the following urls (and probably more):
  					https://www.youtube.com/watch?v=:id
  					https://youtu.be/:id
  					https://vimeo.com/:id
  					https://vimeo.com/channels/:channel/:id
  					https://vimeo.com/groups/:group/videos/:id
  					https://app.vzaar.com/videos/:id
  
  					Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
  			*/
  
  			id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
  
  			if (id[3].indexOf('youtu') > -1) {
  				type = 'youtube';
  			} else if (id[3].indexOf('vimeo') > -1) {
  				type = 'vimeo';
  			} else if (id[3].indexOf('vzaar') > -1) {
  				type = 'vzaar';
  			} else {
  				throw new Error('Video URL not supported.');
  			}
  			id = id[6];
  		} else {
  			throw new Error('Missing video URL.');
  		}
  
  		this._videos[url] = {
  			type: type,
  			id: id,
  			width: width,
  			height: height
  		};
  
  		item.attr('data-video', url);
  
  		this.thumbnail(target, this._videos[url]);
  	};
  
  	/**
  	 * Creates video thumbnail.
  	 * @protected
  	 * @param {jQuery} target - The target containing the video data.
  	 * @param {Object} info - The video info object.
  	 * @see `fetch`
  	 */
  	Video.prototype.thumbnail = function(target, video) {
  		var tnLink,
  			icon,
  			path,
  			dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
  			customTn = target.find('img'),
  			srcType = 'src',
  			lazyClass = '',
  			settings = this._core.settings,
  			create = function(path) {
  				icon = '<div class="owl-video-play-icon"></div>';
  
  				if (settings.lazyLoad) {
  					tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>';
  				} else {
  					tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>';
  				}
  				target.after(tnLink);
  				target.after(icon);
  			};
  
  		// wrap video content into owl-video-wrapper div
  		target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>');
  
  		if (this._core.settings.lazyLoad) {
  			srcType = 'data-src';
  			lazyClass = 'owl-lazy';
  		}
  
  		// custom thumbnail
  		if (customTn.length) {
  			create(customTn.attr(srcType));
  			customTn.remove();
  			return false;
  		}
  
  		if (video.type === 'youtube') {
  			path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
  			create(path);
  		} else if (video.type === 'vimeo') {
  			$.ajax({
  				type: 'GET',
  				url: '//vimeo.com/api/v2/video/' + video.id + '.json',
  				jsonp: 'callback',
  				dataType: 'jsonp',
  				success: function(data) {
  					path = data[0].thumbnail_large;
  					create(path);
  				}
  			});
  		} else if (video.type === 'vzaar') {
  			$.ajax({
  				type: 'GET',
  				url: '//vzaar.com/api/videos/' + video.id + '.json',
  				jsonp: 'callback',
  				dataType: 'jsonp',
  				success: function(data) {
  					path = data.framegrab_url;
  					create(path);
  				}
  			});
  		}
  	};
  
  	/**
  	 * Stops the current video.
  	 * @public
  	 */
  	Video.prototype.stop = function() {
  		this._core.trigger('stop', null, 'video');
  		this._playing.find('.owl-video-frame').remove();
  		this._playing.removeClass('owl-video-playing');
  		this._playing = null;
  		this._core.leave('playing');
  		this._core.trigger('stopped', null, 'video');
  	};
  
  	/**
  	 * Starts the current video.
  	 * @public
  	 * @param {Event} event - The event arguments.
  	 */
  	Video.prototype.play = function(event) {
  		var target = $(event.target),
  			item = target.closest('.' + this._core.settings.itemClass),
  			video = this._videos[item.attr('data-video')],
  			width = video.width || '100%',
  			height = video.height || this._core.$stage.height(),
  			html;
  
  		if (this._playing) {
  			return;
  		}
  
  		this._core.enter('playing');
  		this._core.trigger('play', null, 'video');
  
  		item = this._core.items(this._core.relative(item.index()));
  
  		this._core.reset(item.index());
  
  		if (video.type === 'youtube') {
  			html = '<iframe width="' + width + '" height="' + height + '" src="//www.youtube.com/embed/' +
  				video.id + '?autoplay=1&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>';
  		} else if (video.type === 'vimeo') {
  			html = '<iframe src="//player.vimeo.com/video/' + video.id +
  				'?autoplay=1" width="' + width + '" height="' + height +
  				'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
  		} else if (video.type === 'vzaar') {
  			html = '<iframe frameborder="0"' + 'height="' + height + '"' + 'width="' + width +
  				'" allowfullscreen mozallowfullscreen webkitAllowFullScreen ' +
  				'src="//view.vzaar.com/' + video.id + '/player?autoplay=true"></iframe>';
  		}
  
  		$('<div class="owl-video-frame">' + html + '</div>').insertAfter(item.find('.owl-video'));
  
  		this._playing = item.addClass('owl-video-playing');
  	};
  
  	/**
  	 * Checks whether an video is currently in full screen mode or not.
  	 * @todo Bad style because looks like a readonly method but changes members.
  	 * @protected
  	 * @returns {Boolean}
  	 */
  	Video.prototype.isInFullScreen = function() {
  		var element = document.fullscreenElement || document.mozFullScreenElement ||
  				document.webkitFullscreenElement;
  
  		return element && $(element).parent().hasClass('owl-video-frame');
  	};
  
  	/**
  	 * Destroys the plugin.
  	 */
  	Video.prototype.destroy = function() {
  		var handler, property;
  
  		this._core.$element.off('click.owl.video');
  
  		for (handler in this._handlers) {
  			this._core.$element.off(handler, this._handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.Video = Video;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Animate Plugin
   * @version 2.1.0
   * @author Bartosz Wojciechowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the animate plugin.
  	 * @class The Navigation Plugin
  	 * @param {Owl} scope - The Owl Carousel
  	 */
  	var Animate = function(scope) {
  		this.core = scope;
  		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
  		this.swapping = true;
  		this.previous = undefined;
  		this.next = undefined;
  
  		this.handlers = {
  			'change.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && e.property.name == 'position') {
  					this.previous = this.core.current();
  					this.next = e.property.value;
  				}
  			}, this),
  			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
  				if (e.namespace) {
  					this.swapping = e.type == 'translated';
  				}
  			}, this),
  			'translate.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
  					this.swap();
  				}
  			}, this)
  		};
  
  		this.core.$element.on(this.handlers);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	Animate.Defaults = {
  		animateOut: false,
  		animateIn: false
  	};
  
  	/**
  	 * Toggles the animation classes whenever an translations starts.
  	 * @protected
  	 * @returns {Boolean|undefined}
  	 */
  	Animate.prototype.swap = function() {
  
  		if (this.core.settings.items !== 1) {
  			return;
  		}
  
  		if (!$.support.animation || !$.support.transition) {
  			return;
  		}
  
  		this.core.speed(0);
  
  		var left,
  			clear = $.proxy(this.clear, this),
  			previous = this.core.$stage.children().eq(this.previous),
  			next = this.core.$stage.children().eq(this.next),
  			incoming = this.core.settings.animateIn,
  			outgoing = this.core.settings.animateOut;
  
  		if (this.core.current() === this.previous) {
  			return;
  		}
  
  		if (outgoing) {
  			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
  			previous.one($.support.animation.end, clear)
  				.css( { 'left': left + 'px' } )
  				.addClass('animated owl-animated-out')
  				.addClass(outgoing);
  		}
  
  		if (incoming) {
  			next.one($.support.animation.end, clear)
  				.addClass('animated owl-animated-in')
  				.addClass(incoming);
  		}
  	};
  
  	Animate.prototype.clear = function(e) {
  		$(e.target).css( { 'left': '' } )
  			.removeClass('animated owl-animated-out owl-animated-in')
  			.removeClass(this.core.settings.animateIn)
  			.removeClass(this.core.settings.animateOut);
  		this.core.onTransitionEnd();
  	};
  
  	/**
  	 * Destroys the plugin.
  	 * @public
  	 */
  	Animate.prototype.destroy = function() {
  		var handler, property;
  
  		for (handler in this.handlers) {
  			this.core.$element.off(handler, this.handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Autoplay Plugin
   * @version 2.1.0
   * @author Bartosz Wojciechowski
   * @author Artus Kolanowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	/**
  	 * Creates the autoplay plugin.
  	 * @class The Autoplay Plugin
  	 * @param {Owl} scope - The Owl Carousel
  	 */
  	var Autoplay = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * The autoplay timeout.
  		 * @type {Timeout}
  		 */
  		this._timeout = null;
  
  		/**
  		 * Indicates whenever the autoplay is paused.
  		 * @type {Boolean}
  		 */
  		this._paused = false;
  
  		/**
  		 * All event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'changed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && e.property.name === 'settings') {
  					if (this._core.settings.autoplay) {
  						this.play();
  					} else {
  						this.stop();
  					}
  				} else if (e.namespace && e.property.name === 'position') {
  					//console.log('play?', e);
  					if (this._core.settings.autoplay) {
  						this._setAutoPlayInterval();
  					}
  				}
  			}, this),
  			'initialized.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.autoplay) {
  					this.play();
  				}
  			}, this),
  			'play.owl.autoplay': $.proxy(function(e, t, s) {
  				if (e.namespace) {
  					this.play(t, s);
  				}
  			}, this),
  			'stop.owl.autoplay': $.proxy(function(e) {
  				if (e.namespace) {
  					this.stop();
  				}
  			}, this),
  			'mouseover.owl.autoplay': $.proxy(function() {
  				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
  					this.pause();
  				}
  			}, this),
  			'mouseleave.owl.autoplay': $.proxy(function() {
  				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
  					this.play();
  				}
  			}, this),
  			'touchstart.owl.core': $.proxy(function() {
  				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
  					this.pause();
  				}
  			}, this),
  			'touchend.owl.core': $.proxy(function() {
  				if (this._core.settings.autoplayHoverPause) {
  					this.play();
  				}
  			}, this)
  		};
  
  		// register event handlers
  		this._core.$element.on(this._handlers);
  
  		// set default options
  		this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	Autoplay.Defaults = {
  		autoplay: false,
  		autoplayTimeout: 5000,
  		autoplayHoverPause: false,
  		autoplaySpeed: false
  	};
  
  	/**
  	 * Starts the autoplay.
  	 * @public
  	 * @param {Number} [timeout] - The interval before the next animation starts.
  	 * @param {Number} [speed] - The animation speed for the animations.
  	 */
  	Autoplay.prototype.play = function(timeout, speed) {
  		this._paused = false;
  
  		if (this._core.is('rotating')) {
  			return;
  		}
  
  		this._core.enter('rotating');
  
  		this._setAutoPlayInterval();
  	};
  
  	/**
  	 * Gets a new timeout
  	 * @private
  	 * @param {Number} [timeout] - The interval before the next animation starts.
  	 * @param {Number} [speed] - The animation speed for the animations.
  	 * @return {Timeout}
  	 */
  	Autoplay.prototype._getNextTimeout = function(timeout, speed) {
  		if ( this._timeout ) {
  			window.clearTimeout(this._timeout);
  		}
  		return window.setTimeout($.proxy(function() {
  			if (this._paused || this._core.is('busy') || this._core.is('interacting') || document.hidden) {
  				return;
  			}
  			this._core.next(speed || this._core.settings.autoplaySpeed);
  		}, this), timeout || this._core.settings.autoplayTimeout);
  	};
  
  	/**
  	 * Sets autoplay in motion.
  	 * @private
  	 */
  	Autoplay.prototype._setAutoPlayInterval = function() {
  		this._timeout = this._getNextTimeout();
  	};
  
  	/**
  	 * Stops the autoplay.
  	 * @public
  	 */
  	Autoplay.prototype.stop = function() {
  		if (!this._core.is('rotating')) {
  			return;
  		}
  
  		window.clearTimeout(this._timeout);
  		this._core.leave('rotating');
  	};
  
  	/**
  	 * Stops the autoplay.
  	 * @public
  	 */
  	Autoplay.prototype.pause = function() {
  		if (!this._core.is('rotating')) {
  			return;
  		}
  
  		this._paused = true;
  	};
  
  	/**
  	 * Destroys the plugin.
  	 */
  	Autoplay.prototype.destroy = function() {
  		var handler, property;
  
  		this.stop();
  
  		for (handler in this._handlers) {
  			this._core.$element.off(handler, this._handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Navigation Plugin
   * @version 2.1.0
   * @author Artus Kolanowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  	'use strict';
  
  	/**
  	 * Creates the navigation plugin.
  	 * @class The Navigation Plugin
  	 * @param {Owl} carousel - The Owl Carousel.
  	 */
  	var Navigation = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * Indicates whether the plugin is initialized or not.
  		 * @protected
  		 * @type {Boolean}
  		 */
  		this._initialized = false;
  
  		/**
  		 * The current paging indexes.
  		 * @protected
  		 * @type {Array}
  		 */
  		this._pages = [];
  
  		/**
  		 * All DOM elements of the user interface.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._controls = {};
  
  		/**
  		 * Markup for an indicator.
  		 * @protected
  		 * @type {Array.<String>}
  		 */
  		this._templates = [];
  
  		/**
  		 * The carousel element.
  		 * @type {jQuery}
  		 */
  		this.$element = this._core.$element;
  
  		/**
  		 * Overridden methods of the carousel.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._overrides = {
  			next: this._core.next,
  			prev: this._core.prev,
  			to: this._core.to
  		};
  
  		/**
  		 * All event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'prepared.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.dotsData) {
  					this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
  						$(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
  				}
  			}, this),
  			'added.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.dotsData) {
  					this._templates.splice(e.position, 0, this._templates.pop());
  				}
  			}, this),
  			'remove.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.dotsData) {
  					this._templates.splice(e.position, 1);
  				}
  			}, this),
  			'changed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && e.property.name == 'position') {
  					this.draw();
  				}
  			}, this),
  			'initialized.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && !this._initialized) {
  					this._core.trigger('initialize', null, 'navigation');
  					this.initialize();
  					this.update();
  					this.draw();
  					this._initialized = true;
  					this._core.trigger('initialized', null, 'navigation');
  				}
  			}, this),
  			'refreshed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._initialized) {
  					this._core.trigger('refresh', null, 'navigation');
  					this.update();
  					this.draw();
  					this._core.trigger('refreshed', null, 'navigation');
  				}
  			}, this)
  		};
  
  		// set default options
  		this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
  
  		// register event handlers
  		this.$element.on(this._handlers);
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 * @todo Rename `slideBy` to `navBy`
  	 */
  	Navigation.Defaults = {
  		nav: false,
  		navText: [ 'prev', 'next' ],
  		navSpeed: false,
  		navElement: 'div',
  		navContainer: false,
  		navContainerClass: 'owl-nav',
  		navClass: [ 'owl-prev', 'owl-next' ],
  		slideBy: 1,
  		dotClass: 'owl-dot',
  		dotsClass: 'owl-dots',
  		dots: true,
  		dotsEach: false,
  		dotsData: false,
  		dotsSpeed: false,
  		dotsContainer: false
  	};
  
  	/**
  	 * Initializes the layout of the plugin and extends the carousel.
  	 * @protected
  	 */
  	Navigation.prototype.initialize = function() {
  		var override,
  			settings = this._core.settings;
  
  		// create DOM structure for relative navigation
  		this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
  			: $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
  
  		this._controls.$previous = $('<' + settings.navElement + '>')
  			.addClass(settings.navClass[0])
  			.html(settings.navText[0])
  			.prependTo(this._controls.$relative)
  			.on('click', $.proxy(function(e) {
  				this.prev(settings.navSpeed);
  			}, this));
  		this._controls.$next = $('<' + settings.navElement + '>')
  			.addClass(settings.navClass[1])
  			.html(settings.navText[1])
  			.appendTo(this._controls.$relative)
  			.on('click', $.proxy(function(e) {
  				this.next(settings.navSpeed);
  			}, this));
  
  		// create DOM structure for absolute navigation
  		if (!settings.dotsData) {
  			this._templates = [ $('<div>')
  				.addClass(settings.dotClass)
  				.append($('<span>'))
  				.prop('outerHTML') ];
  		}
  
  		this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
  			: $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
  
  		this._controls.$absolute.on('click', 'div', $.proxy(function(e) {
  			var index = $(e.target).parent().is(this._controls.$absolute)
  				? $(e.target).index() : $(e.target).parent().index();
  
  			e.preventDefault();
  
  			this.to(index, settings.dotsSpeed);
  		}, this));
  
  		// override public methods of the carousel
  		for (override in this._overrides) {
  			this._core[override] = $.proxy(this[override], this);
  		}
  	};
  
  	/**
  	 * Destroys the plugin.
  	 * @protected
  	 */
  	Navigation.prototype.destroy = function() {
  		var handler, control, property, override;
  
  		for (handler in this._handlers) {
  			this.$element.off(handler, this._handlers[handler]);
  		}
  		for (control in this._controls) {
  			this._controls[control].remove();
  		}
  		for (override in this.overides) {
  			this._core[override] = this._overrides[override];
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	/**
  	 * Updates the internal state.
  	 * @protected
  	 */
  	Navigation.prototype.update = function() {
  		var i, j, k,
  			lower = this._core.clones().length / 2,
  			upper = lower + this._core.items().length,
  			maximum = this._core.maximum(true),
  			settings = this._core.settings,
  			size = settings.center || settings.autoWidth || settings.dotsData
  				? 1 : settings.dotsEach || settings.items;
  
  		if (settings.slideBy !== 'page') {
  			settings.slideBy = Math.min(settings.slideBy, settings.items);
  		}
  
  		if (settings.dots || settings.slideBy == 'page') {
  			this._pages = [];
  
  			for (i = lower, j = 0, k = 0; i < upper; i++) {
  				if (j >= size || j === 0) {
  					this._pages.push({
  						start: Math.min(maximum, i - lower),
  						end: i - lower + size - 1
  					});
  					if (Math.min(maximum, i - lower) === maximum) {
  						break;
  					}
  					j = 0, ++k;
  				}
  				j += this._core.mergers(this._core.relative(i));
  			}
  		}
  	};
  
  	/**
  	 * Draws the user interface.
  	 * @todo The option `dotsData` wont work.
  	 * @protected
  	 */
  	Navigation.prototype.draw = function() {
  		var difference,
  			settings = this._core.settings,
  			disabled = this._core.items().length <= settings.items,
  			index = this._core.relative(this._core.current()),
  			loop = settings.loop || settings.rewind;
  
  		this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
  
  		if (settings.nav) {
  			this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
  			this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
  		}
  
  		this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
  
  		if (settings.dots) {
  			difference = this._pages.length - this._controls.$absolute.children().length;
  
  			if (settings.dotsData && difference !== 0) {
  				this._controls.$absolute.html(this._templates.join(''));
  			} else if (difference > 0) {
  				this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
  			} else if (difference < 0) {
  				this._controls.$absolute.children().slice(difference).remove();
  			}
  
  			this._controls.$absolute.find('.active').removeClass('active');
  			this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
  		}
  	};
  
  	/**
  	 * Extends event data.
  	 * @protected
  	 * @param {Event} event - The event object which gets thrown.
  	 */
  	Navigation.prototype.onTrigger = function(event) {
  		var settings = this._core.settings;
  
  		event.page = {
  			index: $.inArray(this.current(), this._pages),
  			count: this._pages.length,
  			size: settings && (settings.center || settings.autoWidth || settings.dotsData
  				? 1 : settings.dotsEach || settings.items)
  		};
  	};
  
  	/**
  	 * Gets the current page position of the carousel.
  	 * @protected
  	 * @returns {Number}
  	 */
  	Navigation.prototype.current = function() {
  		var current = this._core.relative(this._core.current());
  		return $.grep(this._pages, $.proxy(function(page, index) {
  			return page.start <= current && page.end >= current;
  		}, this)).pop();
  	};
  
  	/**
  	 * Gets the current succesor/predecessor position.
  	 * @protected
  	 * @returns {Number}
  	 */
  	Navigation.prototype.getPosition = function(successor) {
  		var position, length,
  			settings = this._core.settings;
  
  		if (settings.slideBy == 'page') {
  			position = $.inArray(this.current(), this._pages);
  			length = this._pages.length;
  			successor ? ++position : --position;
  			position = this._pages[((position % length) + length) % length].start;
  		} else {
  			position = this._core.relative(this._core.current());
  			length = this._core.items().length;
  			successor ? position += settings.slideBy : position -= settings.slideBy;
  		}
  
  		return position;
  	};
  
  	/**
  	 * Slides to the next item or page.
  	 * @public
  	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
  	 */
  	Navigation.prototype.next = function(speed) {
  		$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
  	};
  
  	/**
  	 * Slides to the previous item or page.
  	 * @public
  	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
  	 */
  	Navigation.prototype.prev = function(speed) {
  		$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
  	};
  
  	/**
  	 * Slides to the specified item or page.
  	 * @public
  	 * @param {Number} position - The position of the item or page.
  	 * @param {Number} [speed] - The time in milliseconds for the transition.
  	 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
  	 */
  	Navigation.prototype.to = function(position, speed, standard) {
  		var length;
  
  		if (!standard && this._pages.length) {
  			length = this._pages.length;
  			$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
  		} else {
  			$.proxy(this._overrides.to, this._core)(position, speed);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Hash Plugin
   * @version 2.1.0
   * @author Artus Kolanowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  	'use strict';
  
  	/**
  	 * Creates the hash plugin.
  	 * @class The Hash Plugin
  	 * @param {Owl} carousel - The Owl Carousel
  	 */
  	var Hash = function(carousel) {
  		/**
  		 * Reference to the core.
  		 * @protected
  		 * @type {Owl}
  		 */
  		this._core = carousel;
  
  		/**
  		 * Hash index for the items.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._hashes = {};
  
  		/**
  		 * The carousel element.
  		 * @type {jQuery}
  		 */
  		this.$element = this._core.$element;
  
  		/**
  		 * All event handlers.
  		 * @protected
  		 * @type {Object}
  		 */
  		this._handlers = {
  			'initialized.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && this._core.settings.startPosition === 'URLHash') {
  					$(window).trigger('hashchange.owl.navigation');
  				}
  			}, this),
  			'prepared.owl.carousel': $.proxy(function(e) {
  				if (e.namespace) {
  					var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
  
  					if (!hash) {
  						return;
  					}
  
  					this._hashes[hash] = e.content;
  				}
  			}, this),
  			'changed.owl.carousel': $.proxy(function(e) {
  				if (e.namespace && e.property.name === 'position') {
  					var current = this._core.items(this._core.relative(this._core.current())),
  						hash = $.map(this._hashes, function(item, hash) {
  							return item === current ? hash : null;
  						}).join();
  
  					if (!hash || window.location.hash.slice(1) === hash) {
  						return;
  					}
  
  					window.location.hash = hash;
  				}
  			}, this)
  		};
  
  		// set default options
  		this._core.options = $.extend({}, Hash.Defaults, this._core.options);
  
  		// register the event handlers
  		this.$element.on(this._handlers);
  
  		// register event listener for hash navigation
  		$(window).on('hashchange.owl.navigation', $.proxy(function(e) {
  			var hash = window.location.hash.substring(1),
  				items = this._core.$stage.children(),
  				position = this._hashes[hash] && items.index(this._hashes[hash]);
  
  			if (position === undefined || position === this._core.current()) {
  				return;
  			}
  
  			this._core.to(this._core.relative(position), false, true);
  		}, this));
  	};
  
  	/**
  	 * Default options.
  	 * @public
  	 */
  	Hash.Defaults = {
  		URLhashListener: false
  	};
  
  	/**
  	 * Destroys the plugin.
  	 * @public
  	 */
  	Hash.prototype.destroy = function() {
  		var handler, property;
  
  		$(window).off('hashchange.owl.navigation');
  
  		for (handler in this._handlers) {
  			this._core.$element.off(handler, this._handlers[handler]);
  		}
  		for (property in Object.getOwnPropertyNames(this)) {
  			typeof this[property] != 'function' && (this[property] = null);
  		}
  	};
  
  	$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
  
  })(window.Zepto || window.jQuery, window, document);
  
  /**
   * Support Plugin
   *
   * @version 2.1.0
   * @author Vivid Planet Software GmbH
   * @author Artus Kolanowski
   * @author David Deutsch
   * @license The MIT License (MIT)
   */
  ;(function($, window, document, undefined) {
  
  	var style = $('<support>').get(0).style,
  		prefixes = 'Webkit Moz O ms'.split(' '),
  		events = {
  			transition: {
  				end: {
  					WebkitTransition: 'webkitTransitionEnd',
  					MozTransition: 'transitionend',
  					OTransition: 'oTransitionEnd',
  					transition: 'transitionend'
  				}
  			},
  			animation: {
  				end: {
  					WebkitAnimation: 'webkitAnimationEnd',
  					MozAnimation: 'animationend',
  					OAnimation: 'oAnimationEnd',
  					animation: 'animationend'
  				}
  			}
  		},
  		tests = {
  			csstransforms: function() {
  				return !!test('transform');
  			},
  			csstransforms3d: function() {
  				return !!test('perspective');
  			},
  			csstransitions: function() {
  				return !!test('transition');
  			},
  			cssanimations: function() {
  				return !!test('animation');
  			}
  		};
  
  	function test(property, prefixed) {
  		var result = false,
  			upper = property.charAt(0).toUpperCase() + property.slice(1);
  
  		$.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
  			if (style[property] !== undefined) {
  				result = prefixed ? property : true;
  				return false;
  			}
  		});
  
  		return result;
  	}
  
  	function prefixed(property) {
  		return test(property, true);
  	}
  
  	if (tests.csstransitions()) {
  		/* jshint -W053 */
  		$.support.transition = new String(prefixed('transition'))
  		$.support.transition.end = events.transition.end[ $.support.transition ];
  	}
  
  	if (tests.cssanimations()) {
  		/* jshint -W053 */
  		$.support.animation = new String(prefixed('animation'))
  		$.support.animation.end = events.animation.end[ $.support.animation ];
  	}
  
  	if (tests.csstransforms()) {
  		/* jshint -W053 */
  		$.support.transform = new String(prefixed('transform'));
  		$.support.transform3d = tests.csstransforms3d();
  	}
  
  })(window.Zepto || window.jQuery, window, document);
  /*! jQuery UI - v1.8.22 - 2012-07-24
  * https://github.com/jquery/jquery-ui
  * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js, jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js, jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js, jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js, jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js, jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tabs.js
  * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
  (function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.22",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,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,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery),function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}}(jQuery),function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})}(jQuery),function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('<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(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.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";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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 b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.left<h[0]&&(f=h[0]+this.offset.click.left),b.pageY-this.offset.click.top<h[1]&&(g=h[1]+this.offset.click.top),b.pageX-this.offset.click.left>h[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.top<h[1]||j-this.offset.click.top>h[3]?j-this.offset.click.top<h[1]?j+c.grid[1]:j-c.grid[1]:j:j;var k=c.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX;f=h?k-this.offset.click.left<h[0]||k-this.offset.click.left>h[2]?k-this.offset.click.left<h[0]?k+c.grid[0]:k-c.grid[0]:k:k}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),b=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.extend(a.ui.draggable,{version:"1.8.22"}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,d.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this,f=function(b){var c=this.offset.click.top,d=this.offset.click.left,e=this.positionAbs.top,f=this.positionAbs.left,g=b.height,h=b.width,i=b.top,j=b.left;return a.ui.isOver(e+c,f+d,i,j,g,h)};a.each(d.sortables,function(f){this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c){var d=a("body"),e=a(this).data("draggable").options;d.css("cursor")&&(e._cursor=d.css("cursor")),d.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(b,c){var d=a(this).data("draggable");d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"&&(d.overflowOffset=d.scrollParent.offset())},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=!1;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")d.overflowOffset.top+d.scrollParent[0].offsetHeight-b.pageY<e.scrollSensitivity?d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop-e.scrollSpeed);if(!e.axis||e.axis!="y")d.overflowOffset.left+d.scrollParent[0].offsetWidth-b.pageX<e.scrollSensitivity?d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft-e.scrollSpeed)}else{if(!e.axis||e.axis!="x")b.pageY-a(document).scrollTop()<e.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<e.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")b.pageX-a(document).scrollLeft()<e.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<e.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+e.scrollSpeed))}f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c){var d=a(this).data("draggable"),e=d.options;d.snapElements=[],a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,i=c.offset.top,j=i+d.helperProportions.height;for(var k=d.snapElements.length-1;k>=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f<g&&g<m+f&&n-f<i&&i<o+f||l-f<g&&g<m+f&&n-f<j&&j<o+f||l-f<h&&h<m+f&&n-f<i&&i<o+f||l-f<h&&h<m+f&&n-f<j&&j<o+f)){d.snapElements[k].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=!1;continue}if(e.snapMode!="inner"){var p=Math.abs(n-j)<=f,q=Math.abs(o-i)<=f,r=Math.abs(l-h)<=f,s=Math.abs(m-g)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n-d.helperProportions.height,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m}).left-d.margins.left)}var t=p||q||r||s;if(e.snapMode!="outer"){var p=Math.abs(n-i)<=f,q=Math.abs(o-j)<=f,r=Math.abs(l-g)<=f,s=Math.abs(m-h)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o-d.helperProportions.height,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m-d.helperProportions.width}).left-d.margins.left)}!d.snapElements[k].snapping&&(p||q||r||s||t)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=p||q||r||s||t}}}),a.ui.plugin.add("draggable","stack",{start:function(b,c){var d=a(this).data("draggable").options,e=a.makeArray(a(d.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(!e.length)return;var f=parseInt(e[0].style.zIndex)||0;a(e).each(function(a){this.style.zIndex=f+a}),this[0].style.zIndex=f+e.length}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})}(jQuery),function(a,b){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0,this.isout=1,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);return this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"),this},_setOption:function(b,c){b=="accept"&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)}),a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]==this.element[0])return!1;var e=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==d.options.scope&&b.accept.call(b.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(b,{offset:b.element.offset()}),b.options.tolerance))return e=!0,!1}),e?!1:this.accept.call(this.element[0],d.currentItem||d.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d)),this.element):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.extend(a.ui.droppable,{version:"1.8.22"}),a.ui.intersect=function(b,c,d){if(!c.offset)return!1;var e=(b.positionAbs||b.position.absolute).left,f=e+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,h=g+b.helperProportions.height,i=c.offset.left,j=i+c.proportions.width,k=c.offset.top,l=k+c.proportions.height;switch(d){case"fit":return i<=e&&f<=j&&k<=g&&h<=l;case"intersect":return i<e+b.helperProportions.width/2&&f-b.helperProportions.width/2<j&&k<g+b.helperProportions.height/2&&h-b.helperProportions.height/2<l;case"pointer":var m=(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,n=(b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,o=a.ui.isOver(n,m,k,i,c.proportions.height,c.proportions.width);return o;case"touch":return(g>=k&&g<=l||h>=k&&h<=l||g<k&&h>l)&&(e>=i&&e<=j||f>=i&&f<=j||e<i&&f>j);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h<d.length;h++){if(d[h].options.disabled||b&&!d[h].accept.call(d[h].element[0],b.currentItem||b.element))continue;for(var i=0;i<f.length;i++)if(f[i]==d[h].element[0]){d[h].proportions.height=0;continue g}d[h].visible=d[h].element.css("display")!="none";if(!d[h].visible)continue;e=="mousedown"&&d[h]._activate.call(d[h],c),d[h].offset=d[h].element.offset(),d[h].proportions={width:d[h].element[0].offsetWidth,height:d[h].element[0].offsetHeight}}},drop:function(b,c){var d=!1;return a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,c))}),d},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var d=a.ui.intersect(b,this,this.options.tolerance),e=!d&&this.isover==1?"isout":d&&this.isover==0?"isover":null;if(!e)return;var f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");g.length&&(f=a.data(g[0],"droppable"),f.greedyChild=e=="isover"?1:0)}f&&e=="isover"&&(f.isover=0,f.isout=1,f._out.call(f,c)),this[e]=1,this[e=="isout"?"isover":"isout"]=0,this[e=="isover"?"_over":"_out"].call(this,c),f&&e=="isout"&&(f.isout=0,f.isover=1,f._over.call(f,c))})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}}}(jQuery),function(a,b){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(a('<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")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,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}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{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"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e<d.length;e++){var f=a.trim(d[e]),g="ui-resizable-"+f,h=a('<div class="ui-resizable-handle '+g+'"></div>');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),e<h.maxWidth&&(h.maxWidth=e),g<h.maxHeight&&(h.maxHeight=g);this._vBoundaries=h},_updateCache:function(a){var b=this.options;this.offset=this.helper.offset(),d(a.left)&&(this.position.left=a.left),d(a.top)&&(this.position.top=a.top),d(a.height)&&(this.size.height=a.height),d(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,b){var c=this.options,e=this.position,f=this.size,g=this.axis;return d(a.height)?a.width=a.height*this.aspectRatio:d(a.width)&&(a.height=a.width/this.aspectRatio),g=="sw"&&(a.left=e.left+(f.width-a.width),a.top=null),g=="nw"&&(a.top=e.top+(f.height-a.height),a.left=e.left+(f.width-a.width)),a},_respectSize:function(a,b){var c=this.helper,e=this._vBoundaries,f=this._aspectRatio||b.shiftKey,g=this.axis,h=d(a.width)&&e.maxWidth&&e.maxWidth<a.width,i=d(a.height)&&e.maxHeight&&e.maxHeight<a.height,j=d(a.width)&&e.minWidth&&e.minWidth>a.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d<this._proportionallyResizeElements.length;d++){var e=this._proportionallyResizeElements[d];if(!this.borderDif){var f=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],g=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];this.borderDif=a.map(f,function(a,b){var c=parseInt(a,10)||0,d=parseInt(g[b],10)||0;return c+d})}if(!a.browser.msie||!a(c).is(":hidden")&&!a(c).parents(":hidden").length)e.css({height:c.height()-this.borderDif[0]-this.borderDif[2]||0,width:c.width()-this.borderDif[1]-this.borderDif[3]||0});else continue}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,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}}}),a.extend(a.ui.resizable,{version:"1.8.22"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}}(jQuery),function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.right<e||i.top>h||i.bottom<f):d.tolerance=="fit"&&(j=i.left>e&&i.right<g&&i.top>f&&i.bottom<h),j?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,c._trigger("selecting",b,{selecting:i.element}))):(i.selecting&&((b.metaKey||b.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),c._trigger("unselecting",b,{unselecting:i.element}))),i.selected&&!b.metaKey&&!b.ctrlKey&&!i.startselected&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,c._trigger("unselecting",b,{unselecting:i.element})))}),!1},_mouseStop:function(b){var c=this;this.dragged=!1;var d=this.options;return a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove(),!1}}),a.extend(a.ui.selectable,{version:"1.8.22"})}(jQuery),function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))),d!==!1&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");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";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+j<i&&b+k>f&&b+k<g;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?l:f<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<g&&h<d+this.helperProportions.height/2&&e-this.helperProportions.height/2<i},_intersectsWithPointer:function(b){var c=this.options.axis==="x"||a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),d=this.options.axis==="y"||a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),e=c&&d,f=this._getDragVerticalDirection(),g=this._getDragHorizontalDirection();return e?this.floating?g&&g=="right"||f=="down"?2:1:f&&(f=="down"?2:1):!1},_intersectsWithSides:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&d||f=="left"&&!d:e&&(e=="down"&&c||e=="up"&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(b){this.items=[],this.containers=[this];var c=this.items,d=this,e=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],f=this._connectWith();if(f&&this.ready)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i<m;i++){var n=a(l[i]);n.data(this.widgetName+"-item",k),c.push({item:n,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;c>=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)<f&&(f=Math.abs(j-h),g=this.items[i],this.direction=j-h>0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[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")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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 b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.top<this.containment[1]||h-this.offset.click.top>this.containment[3]?h-this.offset.click.top<this.containment[1]?h+c.grid[1]:h-c.grid[1]:h:h;var i=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0];f=this.containment?i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2]?i-this.offset.click.left<this.containment[0]?i+c.grid[0]:i-c.grid[0]:i:i}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this,f=this.counter;window.setTimeout(function(){f==e.counter&&e.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var d=[],e=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!c&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0])){c||d.push(function(a){this._trigger("remove",a,this._uiHash())});for(var f=this.containers.length-1;f>=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!1}c||this._trigger("beforeStop",b,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!c){for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}}),a.extend(a.ui.sortable,{version:"1.8.22"})}(jQuery),jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=(a.curCSS||a.css)(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.22",save:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){return b=="toggle"&&(b=a.is(":hidden")?"show":"hide"),b},getBaseline:function(a,b){var c,d;switch(a[0]){case"top":c=0;break;case"middle":c=.5;break;case"bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case"left":d=0;break;case"center":d=.5;break;case"right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;g||(g=e*.3*1.5);if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return b<1?-0.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c:h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,c,d,e,f,g){return g==b&&(g=1.70158),e*(c/=f)*c*((g+1)*c-g)+d},easeOutBack:function(a,c,d,e,f,g){return g==b&&(g=1.70158),e*((c=c/f-1)*c*((g+1)*c+g)+1)+d},easeInOutBack:function(a,c,d,e,f,g){return g==b&&(g=1.70158),(c/=f/2)<1?e/2*c*c*(((g*=1.525)+1)*c-g)+d:e/2*((c-=2)*c*(((g*=1.525)+1)*c+g)+2)+d},easeInBounce:function(b,c,d,e,f){return e-a.easing.easeOutBounce(b,f-c,0,e,f)+d},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?d*7.5625*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(b,c,d,e,f){return c<f/2?a.easing.easeInBounce(b,c*2,0,e,f)*.5+d:a.easing.easeOutBounce(b,c*2-f,0,e,f)*.5+e*.5+d}})}(jQuery),function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight(!0)/3:c.outerWidth(!0)/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m<h;m++){var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing),g=e=="hide"?g*2:g/2}if(e=="hide"){var l={opacity:0};l[j]=(k=="pos"?"-=":"+=")+g,c.animate(l,i/2,b.options.easing,function(){c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}else{var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}c.queue("fx",function(){c.dequeue()}),c.dequeue()})}}(jQuery),function(a,b){a.effects.clip=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","height","width"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=c[0].tagName=="IMG"?g:c,i={size:f=="vertical"?"height":"width",position:f=="vertical"?"top":"left"},j=f=="vertical"?h.height():h.width();e=="show"&&(h.css(i.size,0),h.css(i.position,j/2));var k={};k[i.size]=e=="show"?j:0,k[i.position]=e=="show"?0:j/2,h.animate(k,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.drop=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","opacity"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0)/2:c.outerWidth(!0)/2);e=="show"&&c.css("opacity",0).css(g,h=="pos"?-i:i);var j={opacity:e=="show"?1:0};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":b.options.mode;var e=a(this).show().css("visibility","hidden"),f=e.offset();f.top-=parseInt(e.css("marginTop"),10)||0,f.left-=parseInt(e.css("marginLeft"),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i<c;i++)for(var j=0;j<d;j++)e.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}}(jQuery),function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i<e;i++)c.animate({opacity:h},f,b.options.easing),h=(h+1)%2;c.animate({opacity:h},f,b.options.easing,function(){h==0&&c.hide(),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}).dequeue()})}}(jQuery),function(a,b){a.effects.puff=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide"),e=parseInt(b.options.percent,10)||150,f=e/100,g={height:c.height(),width:c.width()};a.extend(b.options,{fade:!0,mode:d,percent:d=="hide"?e:100,from:d=="hide"?g:{height:g.height*f,width:g.width*f}}),c.effect("scale",b.options,b.duration,b.callback),c.dequeue()})},a.effects.scale=function(b){return this.queue(function(){var c=a(this),d=a.extend(!0,{},b.options),e=a.effects.setMode(c,b.options.mode||"effect"),f=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:e=="hide"?0:100),g=b.options.direction||"both",h=b.options.origin;e!="effect"&&(d.origin=h||["middle","center"],d.restore=!0);var i={height:c.height(),width:c.width()};c.from=b.options.from||(e=="show"?{height:0,width:0}:i);var j={y:g!="horizontal"?f/100:1,x:g!="vertical"?f/100:1};c.to={height:i.height*j.y,width:i.width*j.x},b.options.fade&&(e=="show"&&(c.from.opacity=0,c.to.opacity=1),e=="hide"&&(c.from.opacity=1,c.to.opacity=0)),d.from=c.from,d.to=c.to,d.mode=e,c.effect("size",d,b.duration,b.callback),c.dequeue()})},a.effects.size=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","width","height","overflow","opacity"],e=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],g=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],j=a.effects.setMode(c,b.options.mode||"effect"),k=b.options.restore||!1,l=b.options.scale||"both",m=b.options.origin,n={height:c.height(),width:c.width()};c.from=b.options.from||n,c.to=b.options.to||n;if(m){var p=a.effects.getBaseline(m,n);c.from.top=(n.height-c.from.height)*p.y,c.from.left=(n.width-c.from.width)*p.x,c.to.top=(n.height-c.to.height)*p.y,c.to.left=(n.width-c.to.width)*p.x}var q={from:{y:c.from.height/n.height,x:c.from.width/n.width},to:{y:c.to.height/n.height,x:c.to.width/n.width}};if(l=="box"||l=="both")q.from.y!=q.to.y&&(d=d.concat(h),c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(d=d.concat(i),c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to));(l=="content"||l=="both")&&q.from.y!=q.to.y&&(d=d.concat(g),c.from=a.effects.setTransition(c,g,q.from.y,c.from),c.to=a.effects.setTransition(c,g,q.to.y,c.to)),a.effects.save(c,k?d:e),c.show(),a.effects.createWrapper(c),c.css("overflow","hidden").css(c.from);if(l=="content"||l=="both")h=h.concat(["marginTop","marginBottom"]).concat(g),i=i.concat(["marginLeft","marginRight"]),f=d.concat(h).concat(i),c.find("*[width]").each(function(){var c=a(this);k&&a.effects.save(c,f);var d={height:c.height(),width:c.width()};c.from={height:d.height*q.from.y,width:d.width*q.from.x},c.to={height:d.height*q.to.y,width:d.width*q.to.x},q.from.y!=q.to.y&&(c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to)),c.css(c.from),c.animate(c.to,b.duration,b.options.easing,function(){k&&a.effects.restore(c,f)})});c.animate(c.to,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){c.to.opacity===0&&c.css("opacity",c.from.opacity),j=="hide"&&c.hide(),a.effects.restore(c,k?d:e),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.shake=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"left",g=b.options.distance||20,h=b.options.times||3,i=b.duration||b.options.duration||140;a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",l={},m={},n={};l[j]=(k=="pos"?"-=":"+=")+g,m[j]=(k=="pos"?"+=":"-=")+g*2,n[j]=(k=="pos"?"-=":"+=")+g*2,c.animate(l,i,b.options.easing);for(var p=1;p<h;p++)c.animate(m,i,b.options.easing).animate(n,i,b.options.easing);c.animate(m,i,b.options.easing).animate(l,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}),c.dequeue()})}}(jQuery),function(a,b){a.effects.slide=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"show"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c).css({overflow:"hidden"});var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0):c.outerWidth(!0));e=="show"&&c.css(g,h=="pos"?isNaN(i)?"-"+i:-i:i);var j={};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled 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("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.22",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})}(jQuery),function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)return;return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this._response())},_response:function(){var a=this,b=++c;return function(d){b===c&&a.__response(d),a.pending--,a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return typeof b=="string"?{label:b,value:b}:a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})}(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery),function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="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",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},k=function(b){var c=b.name,d=b.form,e=a([]);return c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form})),e};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){if(h.disabled)return;a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active")}).bind("mouseleave.button",function(){if(h.disabled)return;a(this).removeClass(l)}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation())}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m)}).bind("blur.button",function(){b.buttonElement.removeClass(m)}),i&&(this.element.bind("change.button",function(){if(f)return;b.refresh()}),this.buttonElement.bind("mousedown.button",function(a){if(h.disabled)return;f=!1,d=a.pageX,e=a.pageY}).bind("mouseup.button",function(a){if(h.disabled)return;if(d!==a.pageX||e!==a.pageY)f=!0})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null})}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()})),this._setOption("disabled",h.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled"){c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1);return}this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var b=this.buttonElement.removeClass(i),c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=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 a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})}(jQuery),function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.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>'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.22"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);return c&&!c.inline&&this._setDateFromField(c,b),c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;return c&&s++,c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;return r+=f[0].length,parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase())return f=c[0],r+=d.length,!1});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",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",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;return c&&m++,c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;return c&&e++,c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()==a.lastVal)return;var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;return b.setDate(b.getDate()+a),b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());return f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0)),this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){return a?(a.setHours(a.getHours()>12?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id;a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.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(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' data-handler="selectDay" data-event="click" data-month="'+Y.getMonth()+'" data-year="'+Y.getFullYear()+'"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;return e=d&&e>d?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.22",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||"&#160;",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("<div></div>")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("<span></span>")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("<span></span>").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('<button type="button"></button>').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){if(a==="click")return;a in f?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||"&#160;"))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.22",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()<a.ui.dialog.overlay.maxZ)return!1})},1),a(document).bind("keydown.dialog-overlay",function(c){b.options.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}),a(window).bind("resize.dialog-overlay",a.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||a("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b<c?a(window).height()+"px":b+"px"):a(document).height()+"px"},width:function(){var b,c;return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function(){b=b.add(this)}),b.css({width:0,height:0}).css({width:a.ui.dialog.overlay.width(),height:a.ui.dialog.overlay.height()})}}),a.extend(a.ui.dialog.overlay.prototype,{destroy:function(){a.ui.dialog.overlay.destroy(this.$el)}})}(jQuery),function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()}(jQuery),function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),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(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.22"})}(jQuery),function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(b.options.disabled)return;switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;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=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a),a},_values:function(a){var b,c,d;if(arguments.length)return b=this.options.values[a],b=this._trimAlignValue(b),b;c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.22"})}(jQuery),function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.22"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){e()}:function(a){a.clientX&&c.rotate(null)});return a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate),this}})}(jQuery);
  /*
  jQuery.wizard v1.0.0
  https://github.com/kflorence/jquery-wizard/
  An asynchronous form wizard that supports branching.
  
  Requires:
   - jQuery 1.3.2+
   - jQuery UI widget 1.8.0+
  
  Copyright (c) 2011 Kyle Florence
  Dual licensed under the MIT and GPLv2 licenses.
  */
  
  (function( $, undefined ) {
  
  var excludesFilter,
  	count = 0,
  	selector = {},
  	className = {},
  
  	// Reference to commonly used methods
  	aps = Array.prototype.slice,
  
  	// Used to normalize function arguments that can be either
  	// an array of values or a single value
  	arr = function( obj ) {
  		return $.isArray( obj ) ? obj : [ obj ];
  	},
  
  	// Commonly used strings
  	id = "id",
  	form = "form",
  	click = "click",
  	submit = "submit",
  	disabled = "disabled",
  	wizard = "wizard",
  
  	def = "default",
  	num = "number",
  	obj = "object",
  	str = "string",
  	bool = "boolean",
  
  	// Events
  	afterBackward = "afterBackward",
  	afterDestroy = "afterDestroy",
  	afterForward = "afterForward",
  	afterSelect = "afterSelect",
  	beforeBackward = "beforeBackward",
  	beforeDestroy = "beforeDestroy",
  	beforeForward = "beforeForward",
  	beforeSelect = "beforeSelect",
  	beforeSubmit = "beforeSubmit";
  
  // Generate selectors and class names for common wizard elements
  $.each( "branch form header step wrapper".split( " " ), function() {
  	selector[ this ] = "." + ( className[ this ] = wizard + "-" + this );
  });
  
  $.widget( "kf." + wizard, {
  	version: "1.0.0",
  	options: {
  		animations: {
  			show: {
  				options: {
  					duration: 0
  				},
  				properties: {
  					opacity: "show"
  				}
  			},
  			hide: {
  				options: {
  					duration: 0
  				},
  				properties: {
  					opacity: "hide"
  				}
  			}
  		},
  		backward: ".backward",
  		branches: ".branch",
  		disabled: false,
  		enableSubmit: false,
  		forward: ".forward",
  		header: ":header:first",
  		initialStep: 0,
  		stateAttribute: "data-state",
  		stepClasses: {
  			current: "current",
  			exclude: "exclude",
  			stop: "stop",
  			submit: "submit",
  			unidirectional: "unidirectional"
  		},
  		steps: ".step",
  		submit: ":submit",
  		transitions: {},
  		unidirectional: false,
  
  		/* callbacks */
  		afterBackward: null,
  		afterDestroy: null,
  		afterForward: null,
  		afterSelect: null,
  		beforeBackward: null,
  		beforeDestroy: null,
  		beforeForward: null,
  		beforeSelect: null,
  		create: null
  	},
  
  	_create: function() {
  		var $form, $header,
  			self = this,
  			o = self.options,
  			$element = self.element,
  			$steps = $element.find( o.steps ),
  			$stepsWrapper = $steps.eq( 0 ).parent();
  
  		if ( $element[ 0 ].elements ) {
  			$form = $element;
  
  		// If element isn't form, look inside and outside element
  		} else if ( !( $form = $element.find( form ) ).length ) {
  			$form = $element.closest( form );
  		}
  
  		// If header isn't found in element, look in form scope
  		if ( !( $header = $element.find( o.header ) ).length ) {
  			$header = $form.find( o.header );
  		}
  
  		self.elements = {
  			form: $form.addClass( className.form ),
  			submit: $form.find( o.submit ),
  			forward: $form.find( o.forward ),
  			backward: $form.find( o.backward ),
  			header: $header.addClass( className.header ),
  			steps: $element.find( o.steps ).hide().addClass( className.step ),
  			branches: $element.find( o.branches ).add( $stepsWrapper ).addClass( className.branch ),
  			stepsWrapper: $stepsWrapper.addClass( className.wrapper ),
  			wizard: $element.addClass( wizard )
  		};
  
  		if ( !$stepsWrapper.attr( id ) ) {
  
  			// stepsWrapper must have an ID as it also functions as the default branch
  			$stepsWrapper.attr( id, wizard + "-" + ( ++count ) );
  		}
  
  		self.elements.forward.click(function( event ) {
  			event.preventDefault();
  			self.forward( event );
  		});
  
  		self.elements.backward.click(function( event ) {
  			event.preventDefault();
  			self.backward( event );
  		});
  
  		self._currentState = {
  			branchesActivated: [],
  			stepsActivated: []
  		};
  
  		self._stepCount = self.elements.steps.length;
  		self._lastStepIndex = self._stepCount - 1;
  
  		// Cache branch labels for quick access later
  		self._branchLabels = [];
  		self.elements.steps.each(function( i ) {
  			self._branchLabels[ i ] = $( this ).parent().attr( id );
  		});
  
  		// Called in the context of jQuery's .filter() method in _state()
  		self._excludesFilter = function() {
  			return !$( this ).hasClass( o.stepClasses.exclude );
  		};
  
  		// Add default transition function if one wasn't defined
  		if ( !o.transitions[ def ] ) {
  			o.transitions[ def ] = function( step ) {
  				return self.stepIndex( step.nextAll( selector.step ) );
  			};
  		}
  
  		// Select initial step
  		self.select.apply( self, arr( o.initialStep ) );
  	},
  
  	_fastForward: function( toIndex, relative, callback ) {
  		var i = 0,
  			self = this,
  			stepIndex = self._currentState.stepIndex,
  			stepsTaken = [ stepIndex ];
  
  		if ( $.isFunction( relative ) ) {
  			callback = relative;
  			relative = undefined;
  		}
  
  		(function next() {
  			self._transition( stepIndex, function( step, branch ) {
  				if ( ( stepIndex = self.stepIndex( step, branch ) ) === -1 ) {
  					throw new Error( '[_fastForward]: Invalid step "' + step + '"' );
  
  				} else if ( $.inArray( stepIndex, stepsTaken ) >= 0 ) {
  					throw new Error( '[_fastForward]: Recursion detected on step "' + step + '"' );
  
  				} else {
  					stepsTaken.push( stepIndex );
  
  					if ( stepIndex === self._lastStepIndex ||
  						( relative ? ++i : stepIndex ) === toIndex ) {
  						callback.call( self, stepIndex, stepsTaken );
  
  					} else {
  						next();
  					}
  				}
  			});
  		})();
  	},
  
  	_find: function( needles, haystack, wrap ) {
  		var element, i, l, needle, type,
  			found = [],
  			$haystack = haystack instanceof jQuery ? haystack : $( haystack );
  
  		function matchElement( i, current ) {
  			if ( current === needle ) {
  				element = current;
  
  				// Break from .each loop
  				return false;
  			}
  		}
  
  		if ( needles !== null && $haystack.length ) {
  			needles = arr( needles );
  
  			for ( i = 0, l = needles.length; i < l; i++ ) {
  				element = null;
  				needle = needles[ i ];
  				type = typeof needle;
  
  				if ( type === num ) {
  					element = $haystack.get( needle );
  
  				} else if ( type === str ) {
  					element = document.getElementById( needle.replace( '#', '' ) );
  
  				} else if ( type === obj ) {
  					if ( needle instanceof jQuery && needle.length ) {
  						needle = needle[ 0 ];
  					}
  
  					if ( needle.nodeType ) {
  						$haystack.each( matchElement );
  					}
  				}
  
  				if ( element ) {
  					found.push( element );
  				}
  			}
  		}
  
  		// Returns a jQuery object by default. If the wrap argument is
  		// false, it will return an array of elements instead.
  		return wrap === false ? found : $( found );
  	},
  
  	_move: function( step, branch, relative, history, callback ) {
  		var self = this,
  			current = self._currentState;
  
  		if ( typeof branch === bool ) {
  			callback = history;
  			history = relative;
  			relative = branch;
  			branch = undefined;
  		}
  
  		function move( stepIndex, stepsTaken ) {
  			callback.call( self, stepIndex, $.isArray( history ) ?
  				history : history !== false ? stepsTaken : undefined );
  		}
  
  		if ( relative === true ) {
  			if ( step > 0 ) {
  				self._fastForward( step, relative, move );
  
  			} else {
  				callback.call( self, current.stepsActivated[
  					// Normalize to zero if negative
  					Math.max( 0, step + ( current.stepsActivated.length - 1 ) ) ] );
  			}
  
  		// Don't attempt to move to invalid steps
  		} else if ( ( step = self.stepIndex( step, branch ) ) !== -1 ) {
  			if ( step > current.stepIndex ) {
  				self._fastForward( step, move );
  
  			} else {
  				move.call( self, step );
  			}
  		}
  	},
  
  	_state: function( stepIndex, stepsTaken ) {
  		if ( !this.isValidStepIndex( stepIndex ) ) {
  			return null;
  		}
  
  		var o = this.options,
  			state = $.extend( true, {}, this._currentState );
  
  		// stepsTaken must be an array of at least one step
  		stepsTaken = arr( stepsTaken || stepIndex );
  
  		state.step = this.elements.steps.eq( stepIndex );
  		state.branch = state.step.parent();
  		state.branchStepCount = state.branch.children( selector.step ).length;
  		state.isMovingForward = stepIndex > state.stepIndex;
  		state.stepIndexInBranch = state.branch.children( selector.step ).index( state.step );
  
  		var branchLabel, indexOfBranch, indexOfStep,
  			i = 0,
  			l = stepsTaken.length;
  
  		for ( ; i < l; i++ ) {
  			stepIndex = stepsTaken[ i ];
  			branchLabel = this._branchLabels[ stepIndex ];
  
  			// Going forward
  			if ( !state.stepIndex || state.stepIndex < stepIndex ) {
  
  				// No duplicate steps
  				if ( $.inArray( stepIndex, state.stepsActivated ) < 0 ) {
  					state.stepsActivated.push( stepIndex );
  
  					// No duplicate branch labels
  					if ( $.inArray( branchLabel, state.branchesActivated ) < 0 ) {
  						state.branchesActivated.push( branchLabel );
  					}
  				}
  
  			// Going backward
  			} else if ( state.stepIndex > stepIndex ) {
  				indexOfBranch = $.inArray( branchLabel, state.branchesActivated ) + 1;
  				indexOfStep = $.inArray( stepIndex, state.stepsActivated ) + 1;
  
  				// Don't remove initial branch
  				if ( indexOfBranch > 0 ) {
  					state.branchesActivated.splice( indexOfBranch,
  							// IE requires this argument
  							state.branchesActivated.length - 1 );
  				}
  
  				// Don't remove the initial step
  				if ( indexOfStep > 0 ) {
  					state.stepsActivated.splice( indexOfStep,
  							// IE requires this argument
  							state.stepsActivated.length - 1 );
  				}
  			}
  
  			state.stepIndex = stepIndex;
  			state.branchLabel = branchLabel;
  		}
  
  		// Steps completed: the number of steps we have visited
  		state.stepsComplete = Math.max( 0, this._find(
  			state.stepsActivated, this.elements.steps
  		).filter( this._excludesFilter ).length - 1 );
  
  		// Steps possible: the number of steps in all of the branches we have visited
  		state.stepsPossible = Math.max( 0, this._find(
  			state.branchesActivated, this.elements.branches
  		).children( selector.step ).filter( this._excludesFilter ).length - 1 );
  
  		$.extend( state, {
  			branchLabel: this._branchLabels[ stepIndex ],
  			isFirstStep: stepIndex === 0,
  			isFirstStepInBranch: state.stepIndexInBranch === 0,
  			isLastStep: stepIndex === this._lastStepIndex,
  			isLastStepInBranch: state.stepIndexInBranch === state.branchStepCount - 1,
  			percentComplete: ( 100 * state.stepsComplete / state.stepsPossible ),
  			stepsRemaining: ( state.stepsPossible - state.stepsComplete )
  		});
  
  		return state;
  	},
  
  	_transition: function( step, branch, action ) {
  		var self = this;
  
  		// args: action
  		// step becomes the current step
  		if ( $.isFunction( step ) ) {
  			action = step;
  			step = self._currentState.stepIndex;
  			branch = undefined;
  
  		// args: step, action
  		} else if ( $.isFunction( branch ) ) {
  			action = branch;
  			branch = undefined;
  		}
  
  		var response,
  			o = self.options,
  			$step = self.step( step, branch ),
  			stateName = $step.attr( o.stateAttribute ),
  			transitionFunc = stateName ? o.transitions[ stateName ] : o.transitions[ def ];
  
  		if ( $.isFunction( transitionFunc ) ) {
  			response = transitionFunc.call( self, $step, function() {
  				return action.apply( self, aps.call( arguments ) );
  			});
  
  		} else {
  			response = stateName;
  		}
  
  		// A response of 'undefined' or 'false' will halt immediate action
  		// waiting instead for the transition function to handle the call
  		if ( response !== undefined && response !== false ) {
  
  			// Response could be array like [ step, branch ]
  			action.apply( self, arr( response ) );
  		}
  
  		// The immediate response
  		return response;
  	},
  
  	_update: function( event, state ) {
  		var current = this._currentState,
  			o = this.options;
  
  		if ( current.step ) {
  			if ( o.disabled || !state ||
  				state.stepIndex === current.stepIndex ||
  				!this._trigger( beforeSelect, event, state ) ||
  				( state.isMovingForward && !this._trigger( beforeForward, event, state ) ) ||
  				( !state.isMovingForward && !this._trigger( beforeBackward, event, state ) ) ) {
  
  				return;
  			}
  
  			current.step.removeClass( o.stepClasses.current )
  				.animate( o.animations.hide.properties,
  					// Fixes #3583 - http://bugs.jquery.com/ticket/3583
  					$.extend( {}, o.animations.hide.options ) );
  		}
  
  		// Note that this does not affect the value of 'current'
  		this._currentState = state;
  
  		state.step.addClass( o.stepClasses.current )
  			.animate( o.animations.show.properties,
  				// Fixes #3583 - http://bugs.jquery.com/ticket/3583
  				$.extend( {}, o.animations.show.options ) );
  
  		if ( state.isFirstStep || o.unidirectional ||
  			state.step.hasClass( o.stepClasses.unidirectional ) ) {
  			this.elements.backward.attr( disabled, true );
  
  		} else {
  			this.elements.backward.removeAttr( disabled );
  		}
  
  		if ( ( state.isLastStepInBranch && !state.step.attr( o.stateAttribute ) ) ||
  			state.step.hasClass( o.stepClasses.stop ) ) {
  			this.elements.forward.attr( disabled, true );
  
  		} else {
  			this.elements.forward.removeAttr( disabled );
  		}
  
  		if ( o.enableSubmit || state.step.hasClass( o.stepClasses.submit ) ) {
  			this.elements.submit.removeAttr( disabled );
  
  		} else {
  			this.elements.submit.attr( disabled, true );
  		}
  
  		if ( current.step ) {
  			this._trigger( afterSelect, event, state );
  			this._trigger( state.isMovingForward ? afterForward : afterBackward, event, state );
  		}
  	},
  
  	backward: function( event, howMany ) {
  		if ( typeof event === num ) {
  			howMany = event;
  			event = undefined;
  
  		}
  
  		if ( howMany === undefined ) {
  			howMany = 1;
  		}
  
  		if ( this._currentState.isFirstStep || typeof howMany !== num ) {
  			return;
  		}
  
  		this._move( -howMany, true, false, function( stepIndex, stepsTaken ) {
  			this._update( event, this._state( stepIndex, stepsTaken ) );
  		});
  	},
  
  	branch: function( branch ) {
  		return arguments.length ?
  			this._find( branch, this.elements.branches ) : this._currentState.branch;
  	},
  
  	branches: function( branch ) {
  		return arguments.length ?
  			this.branch( branch ).children( selector.branch ) : this.elements.branches;
  	},
  
  	branchesActivated: function() {
  		return this._find( this._currentState.branchesActivated, this.elements.branches );
  	},
  
  	destroy: function() {
  		var $elements = this.elements;
  
  		if ( !this._trigger( beforeDestroy, null, this.state() ) ) {
  			return;
  		}
  
  		this.element.removeClass( wizard );
  
  		$elements.form.removeClass( className.form );
  		$elements.header.removeClass( className.header );
  		$elements.steps.show().removeClass( className.step );
  		$elements.stepsWrapper.removeClass( className.wrapper );
  		$elements.branches.removeClass( className.branch );
  
  		$.Widget.prototype.destroy.call( this );
  
  		this._trigger( afterDestroy );
  	},
  
  	form: function() {
  		return this.elements.form;
  	},
  
  	forward: function( event, howMany, history ) {
  		if ( typeof event === num ) {
  			history = howMany;
  			howMany = event;
  			event = undefined;
  
  		}
  
  		if ( howMany === undefined ) {
  			howMany = 1;
  		}
  
  		if ( this._currentState.isLastStep || typeof howMany !== num ) {
  			return;
  		}
  
  		this._move( howMany, true, history, function( stepIndex, stepsTaken ) {
  			this._update( event, this._state( stepIndex, stepsTaken ) );
  		});
  	},
  
  	isValidStep: function( step, branch ) {
  		return this.isValidStepIndex( this.stepIndex( step, branch ) );
  	},
  
  	isValidStepIndex: function( stepIndex ) {
  		return typeof stepIndex === num && stepIndex >= 0 && stepIndex <= this._lastStepIndex;
  	},
  
  	stepCount: function() {
  		return this._stepCount;
  	},
  
  	select: function( event, step, branch, relative, history ) {
  
  		// args: step, branch, relative, history
  		if ( !( event instanceof $.Event ) ) {
  			history = relative;
  			relative = branch;
  			branch = step;
  			step = event;
  			event = undefined;
  		}
  
  		if ( step === undefined ) {
  			return;
  		}
  
  		// args: [ step, branch ], relative, history
  		if ( $.isArray( step ) ) {
  			history = relative;
  			relative = branch;
  			branch = step[ 1 ];
  			step = step[ 0 ];
  
  		// args: step, relative, history
  		} else if ( typeof branch === bool ) {
  			history = relative;
  			relative = branch;
  			branch = undefined;
  
  		// args: step, history
  		} else if ( $.isArray( branch ) ) {
  			history = branch;
  			branch = undefined;
  		}
  
  		this._move( step, branch, relative, history, function( stepIndex, stepsTaken ) {
  			this._update( event, this._state( stepIndex, stepsTaken ) );
  		});
  	},
  
  	state: function( step, branch, stepsTaken ) {
  		if ( !arguments.length ) {
  			return this._currentState;
  		}
  
  		// args: [ step, branch ], stepsTaken
  		if ( $.isArray( step ) ) {
  			stepsTaken = branch;
  			branch = step[ 1 ];
  			step = step[ 0 ];
  
  		// args: step, stepsTaken
  		} else if ( $.isArray( branch ) ) {
  			stepsTaken = branch;
  			branch = undefined;
  		}
  
  		return this._state( this.stepIndex( step, branch ), stepsTaken );
  	},
  
  	step: function( step, branch ) {
  		if ( !arguments.length ) {
  			return this._currentState.step;
  		}
  
  		// args: [ step, branch ]
  		if ( $.isArray( step ) ) {
  			branch = step[ 1 ];
  			step = step[ 0 ];
  		}
  
  		var $step,
  			type = typeof step;
  
  		// Searching for a step by index
  		if ( type === num ) {
  			$step = this._find( step,
  				// Search within branch, if defined, otherwise search all steps
  				branch !== undefined ? this.steps( branch ) : this.elements.steps );
  
  		// Searching for a step or branch by string ID, DOM element or jQuery object
  		} else {
  			$step = this._find( step, this.elements.steps.add( this.elements.branches ) );
  
  			if ( $step && $step.hasClass( className.branch ) ) {
  
  				// If a branch is found, the arguments are essentially flip-flopped
  				$step = this._find( branch || 0, this.steps( $step ) );
  			}
  		}
  
  		return $step;
  	},
  
  	stepIndex: function( step, branch, relative ) {
  		if ( !arguments.length ) {
  			return this._currentState.stepIndex;
  		}
  
  		var $step;
  
  		// args: [ step, branch ], relative
  		if ( $.isArray( step ) ) {
  			relative = branch;
  			branch = step[ 1 ];
  			step = step[ 0 ];
  
  		// args: step, relative
  		} else if ( typeof branch === bool ) {
  			relative = branch;
  			branch = undefined;
  		}
  
  		return ( $step = this.step( step, branch ) ) ?
  			// The returned index can be relative to a branch, or to all steps
  			( relative ? $step.siblings( selector.step ).andSelf() : this.elements.steps ).index( $step )
  			: -1;
  	},
  
  	steps: function( branch ) {
  		return arguments.length ?
  			this.branch( branch ).children( selector.step ) : this.elements.steps;
  	},
  
  	stepsActivated: function() {
  		return this._find( this._currentState.stepsActivated, this.elements.steps );
  	},
  
  	submit: function() {
  		this.elements.form.submit();
  	}
  });
  
  })( jQuery );
  /*!
   * jQuery Validation Plugin 1.11.1
   *
   * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
   * http://docs.jquery.com/Plugins/Validation
   *
   * Copyright 2013 JÃ¶rn Zaefferer
   * Released under the MIT license:
   *   http://www.opensource.org/licenses/mit-license.php
   */
  
  (function($) {
  
  $.extend($.fn, {
  	// http://docs.jquery.com/Plugins/Validation/validate
  	validate: function( options ) {
  
  		// if nothing is selected, return nothing; can't chain anyway
  		if ( !this.length ) {
  			if ( options && options.debug && window.console ) {
  				console.warn( "Nothing selected, can't validate, returning nothing." );
  			}
  			return;
  		}
  
  		// check if a validator for this form was already created
  		var validator = $.data( this[0], "validator" );
  		if ( validator ) {
  			return validator;
  		}
  
  		// Add novalidate tag if HTML5.
  		this.attr( "novalidate", "novalidate" );
  
  		validator = new $.validator( options, this[0] );
  		$.data( this[0], "validator", validator );
  
  		if ( validator.settings.onsubmit ) {
  
  			this.validateDelegate( ":submit", "click", function( event ) {
  				if ( validator.settings.submitHandler ) {
  					validator.submitButton = event.target;
  				}
  				// allow suppressing validation by adding a cancel class to the submit button
  				if ( $(event.target).hasClass("cancel") ) {
  					validator.cancelSubmit = true;
  				}
  
  				// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
  				if ( $(event.target).attr("formnovalidate") !== undefined ) {
  					validator.cancelSubmit = true;
  				}
  			});
  
  			// validate the form on submit
  			this.submit( function( event ) {
  				if ( validator.settings.debug ) {
  					// prevent form submit to be able to see console output
  					event.preventDefault();
  				}
  				function handle() {
  					var hidden;
  					if ( validator.settings.submitHandler ) {
  						if ( validator.submitButton ) {
  							// insert a hidden input as a replacement for the missing submit button
  							hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm);
  						}
  						validator.settings.submitHandler.call( validator, validator.currentForm, event );
  						if ( validator.submitButton ) {
  							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
  							hidden.remove();
  						}
  						return false;
  					}
  					return true;
  				}
  
  				// prevent submit for invalid forms or custom submit handlers
  				if ( validator.cancelSubmit ) {
  					validator.cancelSubmit = false;
  					return handle();
  				}
  				if ( validator.form() ) {
  					if ( validator.pendingRequest ) {
  						validator.formSubmitted = true;
  						return false;
  					}
  					return handle();
  				} else {
  					validator.focusInvalid();
  					return false;
  				}
  			});
  		}
  
  		return validator;
  	},
  	// http://docs.jquery.com/Plugins/Validation/valid
  	valid: function() {
  		if ( $(this[0]).is("form")) {
  			return this.validate().form();
  		} else {
  			var valid = true;
  			var validator = $(this[0].form).validate();
  			this.each(function() {
  				valid = valid && validator.element(this);
  			});
  			return valid;
  		}
  	},
  	// attributes: space seperated list of attributes to retrieve and remove
  	removeAttrs: function( attributes ) {
  		var result = {},
  			$element = this;
  		$.each(attributes.split(/\s/), function( index, value ) {
  			result[value] = $element.attr(value);
  			$element.removeAttr(value);
  		});
  		return result;
  	},
  	// http://docs.jquery.com/Plugins/Validation/rules
  	rules: function( command, argument ) {
  		var element = this[0];
  
  		if ( command ) {
  			var settings = $.data(element.form, "validator").settings;
  			var staticRules = settings.rules;
  			var existingRules = $.validator.staticRules(element);
  			switch(command) {
  			case "add":
  				$.extend(existingRules, $.validator.normalizeRule(argument));
  				// remove messages from rules, but allow them to be set separetely
  				delete existingRules.messages;
  				staticRules[element.name] = existingRules;
  				if ( argument.messages ) {
  					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
  				}
  				break;
  			case "remove":
  				if ( !argument ) {
  					delete staticRules[element.name];
  					return existingRules;
  				}
  				var filtered = {};
  				$.each(argument.split(/\s/), function( index, method ) {
  					filtered[method] = existingRules[method];
  					delete existingRules[method];
  				});
  				return filtered;
  			}
  		}
  
  		var data = $.validator.normalizeRules(
  		$.extend(
  			{},
  			$.validator.classRules(element),
  			$.validator.attributeRules(element),
  			$.validator.dataRules(element),
  			$.validator.staticRules(element)
  		), element);
  
  		// make sure required is at front
  		if ( data.required ) {
  			var param = data.required;
  			delete data.required;
  			data = $.extend({required: param}, data);
  		}
  
  		return data;
  	}
  });
  
  // Custom selectors
  $.extend($.expr[":"], {
  	// http://docs.jquery.com/Plugins/Validation/blank
  	blank: function( a ) { return !$.trim("" + $(a).val()); },
  	// http://docs.jquery.com/Plugins/Validation/filled
  	filled: function( a ) { return !!$.trim("" + $(a).val()); },
  	// http://docs.jquery.com/Plugins/Validation/unchecked
  	unchecked: function( a ) { return !$(a).prop("checked"); }
  });
  
  // constructor for validator
  $.validator = function( options, form ) {
  	this.settings = $.extend( true, {}, $.validator.defaults, options );
  	this.currentForm = form;
  	this.init();
  };
  
  $.validator.format = function( source, params ) {
  	if ( arguments.length === 1 ) {
  		return function() {
  			var args = $.makeArray(arguments);
  			args.unshift(source);
  			return $.validator.format.apply( this, args );
  		};
  	}
  	if ( arguments.length > 2 && params.constructor !== Array  ) {
  		params = $.makeArray(arguments).slice(1);
  	}
  	if ( params.constructor !== Array ) {
  		params = [ params ];
  	}
  	$.each(params, function( i, n ) {
  		source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() {
  			return n;
  		});
  	});
  	return source;
  };
  
  $.extend($.validator, {
  
  	defaults: {
  		messages: {},
  		groups: {},
  		rules: {},
  		errorClass: "error",
  		validClass: "valid",
  		errorElement: "span",
  		focusInvalid: true,
  		errorContainer: $([]),
  		errorLabelContainer: $([]),
  		onsubmit: true,
  		ignore: ":hidden",
  		ignoreTitle: false,
  		onfocusin: function( element, event ) {
  			this.lastActive = element;
  
  			// hide error label and remove error class on focus if enabled
  			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
  				if ( this.settings.unhighlight ) {
  					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
  				}
  				this.addWrapper(this.errorsFor(element)).hide();
  			}
  		},
  		onfocusout: function( element, event ) {
  			if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
  				this.element(element);
  			}
  		},
  		onkeyup: function( element, event ) {
  			if ( event.which === 9 && this.elementValue(element) === "" ) {
  				return;
  			} else if ( element.name in this.submitted || element === this.lastElement ) {
  				this.element(element);
  			}
  		},
  		onclick: function( element, event ) {
  			// click on selects, radiobuttons and checkboxes
  			if ( element.name in this.submitted ) {
  				this.element(element);
  			}
  			// or option elements, check parent select in that case
  			else if ( element.parentNode.name in this.submitted ) {
  				this.element(element.parentNode);
  			}
  		},
  		highlight: function( element, errorClass, validClass ) {
  			if ( element.type === "radio" ) {
  				this.findByName(element.name).addClass(errorClass).removeClass(validClass);
  			} else {
  				$(element).addClass(errorClass).removeClass(validClass);
  			}
  		},
  		unhighlight: function( element, errorClass, validClass ) {
  			if ( element.type === "radio" ) {
  				this.findByName(element.name).removeClass(errorClass).addClass(validClass);
  			} else {
  				$(element).removeClass(errorClass).addClass(validClass);
  			}
  		}
  	},
  
  	// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
  	setDefaults: function( settings ) {
  		$.extend( $.validator.defaults, settings );
  	},
  
  	messages: {
  		required: "Required",
  		remote: "Please fix this field.",
  		email: "Wrong email.",
  		url: "Please enter a valid URL.",
  		date: "Please enter a valid date.",
  		dateISO: "Please enter a valid date (ISO).",
  		number: "Please enter a valid number.",
  		digits: "Please enter only digits.",
  		creditcard: "Please enter a valid credit card number.",
  		equalTo: "Please enter the same value again.",
  		maxlength: $.validator.format("Please enter no more than {0} characters."),
  		minlength: $.validator.format("Please enter at least {0} characters."),
  		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
  		range: $.validator.format("Please enter a value between {0} and {1}."),
  		max: $.validator.format("Please enter a value less than or equal to {0}."),
  		min: $.validator.format("Please enter a value greater than or equal to {0}.")
  	},
  
  	autoCreateRanges: false,
  
  	prototype: {
  
  		init: function() {
  			this.labelContainer = $(this.settings.errorLabelContainer);
  			this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
  			this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
  			this.submitted = {};
  			this.valueCache = {};
  			this.pendingRequest = 0;
  			this.pending = {};
  			this.invalid = {};
  			this.reset();
  
  			var groups = (this.groups = {});
  			$.each(this.settings.groups, function( key, value ) {
  				if ( typeof value === "string" ) {
  					value = value.split(/\s/);
  				}
  				$.each(value, function( index, name ) {
  					groups[name] = key;
  				});
  			});
  			var rules = this.settings.rules;
  			$.each(rules, function( key, value ) {
  				rules[key] = $.validator.normalizeRule(value);
  			});
  
  			function delegate(event) {
  				var validator = $.data(this[0].form, "validator"),
  					eventType = "on" + event.type.replace(/^validate/, "");
  				if (!validator) return;
  validator.settings[eventType] && validator.settings[eventType].call(validator, this[0], event);
  }
  			$(this.currentForm)
  				.validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
  					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
  					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
  					"[type='week'], [type='time'], [type='datetime-local'], " +
  					"[type='range'], [type='color'] ",
  					"focusin focusout keyup", delegate)
  				.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
  
  			if ( this.settings.invalidHandler ) {
  				$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
  			}
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Validator/form
  		form: function() {
  			this.checkForm();
  			$.extend(this.submitted, this.errorMap);
  			this.invalid = $.extend({}, this.errorMap);
  			if ( !this.valid() ) {
  				$(this.currentForm).triggerHandler("invalid-form", [this]);
  			}
  			this.showErrors();
  			return this.valid();
  		},
  
  		checkForm: function() {
  			this.prepareForm();
  			for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
  				this.check( elements[i] );
  			}
  			return this.valid();
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Validator/element
  		element: function( element ) {
  			element = this.validationTargetFor( this.clean( element ) );
  			this.lastElement = element;
  			this.prepareElement( element );
  			this.currentElements = $(element);
  			var result = this.check( element ) !== false;
  			if ( result ) {
  				delete this.invalid[element.name];
  			} else {
  				this.invalid[element.name] = true;
  			}
  			if ( !this.numberOfInvalids() ) {
  				// Hide error containers on last error
  				this.toHide = this.toHide.add( this.containers );
  			}
  			this.showErrors();
  			return result;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
  		showErrors: function( errors ) {
  			if ( errors ) {
  				// add items to error list and map
  				$.extend( this.errorMap, errors );
  				this.errorList = [];
  				for ( var name in errors ) {
  					this.errorList.push({
  						message: errors[name],
  						element: this.findByName(name)[0]
  					});
  				}
  				// remove items from success list
  				this.successList = $.grep( this.successList, function( element ) {
  					return !(element.name in errors);
  				});
  			}
  			if ( this.settings.showErrors ) {
  				this.settings.showErrors.call( this, this.errorMap, this.errorList );
  			} else {
  				this.defaultShowErrors();
  			}
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
  		resetForm: function() {
  			if ( $.fn.resetForm ) {
  				$(this.currentForm).resetForm();
  			}
  			this.submitted = {};
  			this.lastElement = null;
  			this.prepareForm();
  			this.hideErrors();
  			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
  		},
  
  		numberOfInvalids: function() {
  			return this.objectLength(this.invalid);
  		},
  
  		objectLength: function( obj ) {
  			var count = 0;
  			for ( var i in obj ) {
  				count++;
  			}
  			return count;
  		},
  
  		hideErrors: function() {
  			this.addWrapper( this.toHide ).hide();
  		},
  
  		valid: function() {
  			return this.size() === 0;
  		},
  
  		size: function() {
  			return this.errorList.length;
  		},
  
  		focusInvalid: function() {
  			if ( this.settings.focusInvalid ) {
  				try {
  					$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
  					.filter(":visible")
  					.focus()
  					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
  					.trigger("focusin");
  				} catch(e) {
  					// ignore IE throwing errors when focusing hidden elements
  				}
  			}
  		},
  
  		findLastActive: function() {
  			var lastActive = this.lastActive;
  			return lastActive && $.grep(this.errorList, function( n ) {
  				return n.element.name === lastActive.name;
  			}).length === 1 && lastActive;
  		},
  
  		elements: function() {
  			var validator = this,
  				rulesCache = {};
  
  			// select all valid inputs inside the form (no submit or reset buttons)
  			return $(this.currentForm)
  			.find("input, select, textarea")
  			.not(":submit, :reset, :image, [disabled]")
  			.not( this.settings.ignore )
  			.filter(function() {
  				if ( !this.name && validator.settings.debug && window.console ) {
  					console.error( "%o has no name assigned", this);
  				}
  
  				// select only the first element for each name, and only those with rules specified
  				if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
  					return false;
  				}
  
  				rulesCache[this.name] = true;
  				return true;
  			});
  		},
  
  		clean: function( selector ) {
  			return $(selector)[0];
  		},
  
  		errors: function() {
  			var errorClass = this.settings.errorClass.replace(" ", ".");
  			return $(this.settings.errorElement + "." + errorClass, this.errorContext);
  		},
  
  		reset: function() {
  			this.successList = [];
  			this.errorList = [];
  			this.errorMap = {};
  			this.toShow = $([]);
  			this.toHide = $([]);
  			this.currentElements = $([]);
  		},
  
  		prepareForm: function() {
  			this.reset();
  			this.toHide = this.errors().add( this.containers );
  		},
  
  		prepareElement: function( element ) {
  			this.reset();
  			this.toHide = this.errorsFor(element);
  		},
  
  		elementValue: function( element ) {
  			var type = $(element).attr("type"),
  				val = $(element).val();
  
  			if ( type === "radio" || type === "checkbox" ) {
  				return $("input[name='" + $(element).attr("name") + "']:checked").val();
  			}
  
  			if ( typeof val === "string" ) {
  				return val.replace(/\r/g, "");
  			}
  			return val;
  		},
  
  		check: function( element ) {
  			element = this.validationTargetFor( this.clean( element ) );
  
  			var rules = $(element).rules();
  			var dependencyMismatch = false;
  			var val = this.elementValue(element);
  			var result;
  
  			for (var method in rules ) {
  				var rule = { method: method, parameters: rules[method] };
  				try {
  
  					result = $.validator.methods[method].call( this, val, element, rule.parameters );
  
  					// if a method indicates that the field is optional and therefore valid,
  					// don't mark it as valid when there are no other rules
  					if ( result === "dependency-mismatch" ) {
  						dependencyMismatch = true;
  						continue;
  					}
  					dependencyMismatch = false;
  
  					if ( result === "pending" ) {
  						this.toHide = this.toHide.not( this.errorsFor(element) );
  						return;
  					}
  
  					if ( !result ) {
  						this.formatAndAdd( element, rule );
  						return false;
  					}
  				} catch(e) {
  					if ( this.settings.debug && window.console ) {
  						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
  					}
  					throw e;
  				}
  			}
  			if ( dependencyMismatch ) {
  				return;
  			}
  			if ( this.objectLength(rules) ) {
  				this.successList.push(element);
  			}
  			return true;
  		},
  
  		// return the custom message for the given element and validation method
  		// specified in the element's HTML5 data attribute
  		customDataMessage: function( element, method ) {
  			return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
  		},
  
  		// return the custom message for the given element name and validation method
  		customMessage: function( name, method ) {
  			var m = this.settings.messages[name];
  			return m && (m.constructor === String ? m : m[method]);
  		},
  
  		// return the first defined argument, allowing empty strings
  		findDefined: function() {
  			for(var i = 0; i < arguments.length; i++) {
  				if ( arguments[i] !== undefined ) {
  					return arguments[i];
  				}
  			}
  			return undefined;
  		},
  
  		defaultMessage: function( element, method ) {
  			return this.findDefined(
  				this.customMessage( element.name, method ),
  				this.customDataMessage( element, method ),
  				// title is never undefined, so handle empty string as undefined
  				!this.settings.ignoreTitle && element.title || undefined,
  				$.validator.messages[method],
  				"<strong>Warning: No message defined for " + element.name + "</strong>"
  			);
  		},
  
  		formatAndAdd: function( element, rule ) {
  			var message = this.defaultMessage( element, rule.method ),
  				theregex = /\$?\{(\d+)\}/g;
  			if ( typeof message === "function" ) {
  				message = message.call(this, rule.parameters, element);
  			} else if (theregex.test(message)) {
  				message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
  			}
  			this.errorList.push({
  				message: message,
  				element: element
  			});
  
  			this.errorMap[element.name] = message;
  			this.submitted[element.name] = message;
  		},
  
  		addWrapper: function( toToggle ) {
  			if ( this.settings.wrapper ) {
  				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
  			}
  			return toToggle;
  		},
  
  		defaultShowErrors: function() {
  			var i, elements;
  			for ( i = 0; this.errorList[i]; i++ ) {
  				var error = this.errorList[i];
  				if ( this.settings.highlight ) {
  					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
  				}
  				this.showLabel( error.element, error.message );
  			}
  			if ( this.errorList.length ) {
  				this.toShow = this.toShow.add( this.containers );
  			}
  			if ( this.settings.success ) {
  				for ( i = 0; this.successList[i]; i++ ) {
  					this.showLabel( this.successList[i] );
  				}
  			}
  			if ( this.settings.unhighlight ) {
  				for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
  					this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
  				}
  			}
  			this.toHide = this.toHide.not( this.toShow );
  			this.hideErrors();
  			this.addWrapper( this.toShow ).show();
  		},
  
  		validElements: function() {
  			return this.currentElements.not(this.invalidElements());
  		},
  
  		invalidElements: function() {
  			return $(this.errorList).map(function() {
  				return this.element;
  			});
  		},
  
  		showLabel: function( element, message ) {
  			var label = this.errorsFor( element );
  			if ( label.length ) {
  				// refresh error/success class
  				label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
  				// replace message on existing label
  				label.html(message);
  			} else {
  				// create label
  				label = $("<" + this.settings.errorElement + ">")
  					.attr("for", this.idOrName(element))
  					.addClass(this.settings.errorClass)
  					.html(message || "");
  				if ( this.settings.wrapper ) {
  					// make sure the element is visible, even in IE
  					// actually showing the wrapped element is handled elsewhere
  					label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
  				}
  				if ( !this.labelContainer.append(label).length ) {
  					if ( this.settings.errorPlacement ) {
  						this.settings.errorPlacement(label, $(element) );
  					} else {
  						label.insertAfter(element);
  					}
  				}
  			}
  			if ( !message && this.settings.success ) {
  				label.text("");
  				if ( typeof this.settings.success === "string" ) {
  					label.addClass( this.settings.success );
  				} else {
  					this.settings.success( label, element );
  				}
  			}
  			this.toShow = this.toShow.add(label);
  		},
  
  		errorsFor: function( element ) {
  			var name = this.idOrName(element);
  			return this.errors().filter(function() {
  				return $(this).attr("for") === name;
  			});
  		},
  
  		idOrName: function( element ) {
  			return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
  		},
  
  		validationTargetFor: function( element ) {
  			// if radio/checkbox, validate first element in group instead
  			if ( this.checkable(element) ) {
  				element = this.findByName( element.name ).not(this.settings.ignore)[0];
  			}
  			return element;
  		},
  
  		checkable: function( element ) {
  			return (/radio|checkbox/i).test(element.type);
  		},
  
  		findByName: function( name ) {
  			return $(this.currentForm).find("[name='" + name + "']");
  		},
  
  		getLength: function( value, element ) {
  			switch( element.nodeName.toLowerCase() ) {
  			case "select":
  				return $("option:selected", element).length;
  			case "input":
  				if ( this.checkable( element) ) {
  					return this.findByName(element.name).filter(":checked").length;
  				}
  			}
  			return value.length;
  		},
  
  		depend: function( param, element ) {
  			return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
  		},
  
  		dependTypes: {
  			"boolean": function( param, element ) {
  				return param;
  			},
  			"string": function( param, element ) {
  				return !!$(param, element.form).length;
  			},
  			"function": function( param, element ) {
  				return param(element);
  			}
  		},
  
  		optional: function( element ) {
  			var val = this.elementValue(element);
  			return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
  		},
  
  		startRequest: function( element ) {
  			if ( !this.pending[element.name] ) {
  				this.pendingRequest++;
  				this.pending[element.name] = true;
  			}
  		},
  
  		stopRequest: function( element, valid ) {
  			this.pendingRequest--;
  			// sometimes synchronization fails, make sure pendingRequest is never < 0
  			if ( this.pendingRequest < 0 ) {
  				this.pendingRequest = 0;
  			}
  			delete this.pending[element.name];
  			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
  				$(this.currentForm).submit();
  				this.formSubmitted = false;
  			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
  				$(this.currentForm).triggerHandler("invalid-form", [this]);
  				this.formSubmitted = false;
  			}
  		},
  
  		previousValue: function( element ) {
  			return $.data(element, "previousValue") || $.data(element, "previousValue", {
  				old: null,
  				valid: true,
  				message: this.defaultMessage( element, "remote" )
  			});
  		}
  
  	},
  
  	classRuleSettings: {
  		required: {required: true},
  		email: {email: true},
  		url: {url: true},
  		date: {date: true},
  		dateISO: {dateISO: true},
  		number: {number: true},
  		digits: {digits: true},
  		creditcard: {creditcard: true}
  	},
  
  	addClassRules: function( className, rules ) {
  		if ( className.constructor === String ) {
  			this.classRuleSettings[className] = rules;
  		} else {
  			$.extend(this.classRuleSettings, className);
  		}
  	},
  
  	classRules: function( element ) {
  		var rules = {};
  		var classes = $(element).attr("class");
  		if ( classes ) {
  			$.each(classes.split(" "), function() {
  				if ( this in $.validator.classRuleSettings ) {
  					$.extend(rules, $.validator.classRuleSettings[this]);
  				}
  			});
  		}
  		return rules;
  	},
  
  	attributeRules: function( element ) {
  		var rules = {};
  		var $element = $(element);
  		var type = $element[0].getAttribute("type");
  
  		for (var method in $.validator.methods) {
  			var value;
  
  			// support for <input required> in both html5 and older browsers
  			if ( method === "required" ) {
  				value = $element.get(0).getAttribute(method);
  				// Some browsers return an empty string for the required attribute
  				// and non-HTML5 browsers might have required="" markup
  				if ( value === "" ) {
  					value = true;
  				}
  				// force non-HTML5 browsers to return bool
  				value = !!value;
  			} else {
  				value = $element.attr(method);
  			}
  
  			// convert the value to a number for number inputs, and for text for backwards compability
  			// allows type="date" and others to be compared as strings
  			if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
  				value = Number(value);
  			}
  
  			if ( value ) {
  				rules[method] = value;
  			} else if ( type === method && type !== 'range' ) {
  				// exception: the jquery validate 'range' method
  				// does not test for the html5 'range' type
  				rules[method] = true;
  			}
  		}
  
  		// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
  		if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) {
  			delete rules.maxlength;
  		}
  
  		return rules;
  	},
  
  	dataRules: function( element ) {
  		var method, value,
  			rules = {}, $element = $(element);
  		for (method in $.validator.methods) {
  			value = $element.data("rule-" + method.toLowerCase());
  			if ( value !== undefined ) {
  				rules[method] = value;
  			}
  		}
  		return rules;
  	},
  
  	staticRules: function( element ) {
  		var rules = {};
  		var validator = $.data(element.form, "validator");
  		if ( validator.settings.rules ) {
  			rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
  		}
  		return rules;
  	},
  
  	normalizeRules: function( rules, element ) {
  		// handle dependency check
  		$.each(rules, function( prop, val ) {
  			// ignore rule when param is explicitly false, eg. required:false
  			if ( val === false ) {
  				delete rules[prop];
  				return;
  			}
  			if ( val.param || val.depends ) {
  				var keepRule = true;
  				switch (typeof val.depends) {
  				case "string":
  					keepRule = !!$(val.depends, element.form).length;
  					break;
  				case "function":
  					keepRule = val.depends.call(element, element);
  					break;
  				}
  				if ( keepRule ) {
  					rules[prop] = val.param !== undefined ? val.param : true;
  				} else {
  					delete rules[prop];
  				}
  			}
  		});
  
  		// evaluate parameters
  		$.each(rules, function( rule, parameter ) {
  			rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
  		});
  
  		// clean number parameters
  		$.each(['minlength', 'maxlength'], function() {
  			if ( rules[this] ) {
  				rules[this] = Number(rules[this]);
  			}
  		});
  		$.each(['rangelength', 'range'], function() {
  			var parts;
  			if ( rules[this] ) {
  				if ( $.isArray(rules[this]) ) {
  					rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
  				} else if ( typeof rules[this] === "string" ) {
  					parts = rules[this].split(/[\s,]+/);
  					rules[this] = [Number(parts[0]), Number(parts[1])];
  				}
  			}
  		});
  
  		if ( $.validator.autoCreateRanges ) {
  			// auto-create ranges
  			if ( rules.min && rules.max ) {
  				rules.range = [rules.min, rules.max];
  				delete rules.min;
  				delete rules.max;
  			}
  			if ( rules.minlength && rules.maxlength ) {
  				rules.rangelength = [rules.minlength, rules.maxlength];
  				delete rules.minlength;
  				delete rules.maxlength;
  			}
  		}
  
  		return rules;
  	},
  
  	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
  	normalizeRule: function( data ) {
  		if ( typeof data === "string" ) {
  			var transformed = {};
  			$.each(data.split(/\s/), function() {
  				transformed[this] = true;
  			});
  			data = transformed;
  		}
  		return data;
  	},
  
  	// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
  	addMethod: function( name, method, message ) {
  		$.validator.methods[name] = method;
  		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
  		if ( method.length < 3 ) {
  			$.validator.addClassRules(name, $.validator.normalizeRule(name));
  		}
  	},
  
  	methods: {
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/required
  		required: function( value, element, param ) {
  			// check if dependency is met
  			if ( !this.depend(param, element) ) {
  				return "dependency-mismatch";
  			}
  			if ( element.nodeName.toLowerCase() === "select" ) {
  				// could be an array for select-multiple or a string, both are fine this way
  				var val = $(element).val();
  				return val && val.length > 0;
  			}
  			if ( this.checkable(element) ) {
  				return this.getLength(value, element) > 0;
  			}
  			return $.trim(value).length > 0;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/email
  		email: function( value, element ) {
  			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
  			return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value);
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/url
  		url: function( value, element ) {
  			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
  			return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/date
  		date: function( value, element ) {
  			return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
  		dateISO: function( value, element ) {
  			return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/number
  		number: function( value, element ) {
  			return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/digits
  		digits: function( value, element ) {
  			return this.optional(element) || /^\d+$/.test(value);
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
  		// based on http://en.wikipedia.org/wiki/Luhn
  		creditcard: function( value, element ) {
  			if ( this.optional(element) ) {
  				return "dependency-mismatch";
  			}
  			// accept only spaces, digits and dashes
  			if ( /[^0-9 \-]+/.test(value) ) {
  				return false;
  			}
  			var nCheck = 0,
  				nDigit = 0,
  				bEven = false;
  
  			value = value.replace(/\D/g, "");
  
  			for (var n = value.length - 1; n >= 0; n--) {
  				var cDigit = value.charAt(n);
  				nDigit = parseInt(cDigit, 10);
  				if ( bEven ) {
  					if ( (nDigit *= 2) > 9 ) {
  						nDigit -= 9;
  					}
  				}
  				nCheck += nDigit;
  				bEven = !bEven;
  			}
  
  			return (nCheck % 10) === 0;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/minlength
  		minlength: function( value, element, param ) {
  			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
  			return this.optional(element) || length >= param;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
  		maxlength: function( value, element, param ) {
  			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
  			return this.optional(element) || length <= param;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
  		rangelength: function( value, element, param ) {
  			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
  			return this.optional(element) || ( length >= param[0] && length <= param[1] );
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/min
  		min: function( value, element, param ) {
  			return this.optional(element) || value >= param;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/max
  		max: function( value, element, param ) {
  			return this.optional(element) || value <= param;
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/range
  		range: function( value, element, param ) {
  			return this.optional(element) || ( value >= param[0] && value <= param[1] );
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
  		equalTo: function( value, element, param ) {
  			// bind to the blur event of the target in order to revalidate whenever the target field is updated
  			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
  			var target = $(param);
  			if ( this.settings.onfocusout ) {
  				target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
  					$(element).valid();
  				});
  			}
  			return value === target.val();
  		},
  
  		// http://docs.jquery.com/Plugins/Validation/Methods/remote
  		remote: function( value, element, param ) {
  			if ( this.optional(element) ) {
  				return "dependency-mismatch";
  			}
  
  			var previous = this.previousValue(element);
  			if (!this.settings.messages[element.name] ) {
  				this.settings.messages[element.name] = {};
  			}
  			previous.originalMessage = this.settings.messages[element.name].remote;
  			this.settings.messages[element.name].remote = previous.message;
  
  			param = typeof param === "string" && {url:param} || param;
  
  			if ( previous.old === value ) {
  				return previous.valid;
  			}
  
  			previous.old = value;
  			var validator = this;
  			this.startRequest(element);
  			var data = {};
  			data[element.name] = value;
  			$.ajax($.extend(true, {
  				url: param,
  				mode: "abort",
  				port: "validate" + element.name,
  				dataType: "json",
  				data: data,
  				success: function( response ) {
  					validator.settings.messages[element.name].remote = previous.originalMessage;
  					var valid = response === true || response === "true";
  					if ( valid ) {
  						var submitted = validator.formSubmitted;
  						validator.prepareElement(element);
  						validator.formSubmitted = submitted;
  						validator.successList.push(element);
  						delete validator.invalid[element.name];
  						validator.showErrors();
  					} else {
  						var errors = {};
  						var message = response || validator.defaultMessage( element, "remote" );
  						errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
  						validator.invalid[element.name] = true;
  						validator.showErrors(errors);
  					}
  					previous.valid = valid;
  					validator.stopRequest(element, valid);
  				}
  			}, param));
  			return "pending";
  		}
  
  	}
  
  });
  
  // deprecated, use $.validator.format instead
  $.format = $.validator.format;
  
  }(jQuery));
  
  // ajax mode: abort
  // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
  // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
  (function($) {
  	var pendingRequests = {};
  	// Use a prefilter if available (1.5+)
  	if ( $.ajaxPrefilter ) {
  		$.ajaxPrefilter(function( settings, _, xhr ) {
  			var port = settings.port;
  			if ( settings.mode === "abort" ) {
  				if ( pendingRequests[port] ) {
  					pendingRequests[port].abort();
  				}
  				pendingRequests[port] = xhr;
  			}
  		});
  	} else {
  		// Proxy ajax
  		var ajax = $.ajax;
  		$.ajax = function( settings ) {
  			var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
  				port = ( "port" in settings ? settings : $.ajaxSettings ).port;
  			if ( mode === "abort" ) {
  				if ( pendingRequests[port] ) {
  					pendingRequests[port].abort();
  				}
  				pendingRequests[port] = ajax.apply(this, arguments);
  				return pendingRequests[port];
  			}
  			return ajax.apply(this, arguments);
  		};
  	}
  }(jQuery));
  
  // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
  // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
  (function($) {
  	$.extend($.fn, {
  		validateDelegate: function( delegate, type, handler ) {
  			return this.bind(type, function( event ) {
  				var target = $(event.target);
  				if ( target.is(delegate) ) {
  					return handler.apply(target, arguments);
  				}
  			});
  		}
  	});
  }(jQuery));
  /*!
   * iCheck v1.0.2, http://git.io/arlzeA
   * ===================================
   * Powerful jQuery and Zepto plugin for checkboxes and radio buttons customization
   *
   * (c) 2013 Damir Sultanov, http://fronteed.com
   * MIT Licensed
   */
  
  (function($) {
  
    // Cached vars
    var _iCheck = 'iCheck',
      _iCheckHelper = _iCheck + '-helper',
      _checkbox = 'checkbox',
      _radio = 'radio',
      _checked = 'checked',
      _unchecked = 'un' + _checked,
      _disabled = 'disabled',
      _determinate = 'determinate',
      _indeterminate = 'in' + _determinate,
      _update = 'update',
      _type = 'type',
      _click = 'click',
      _touch = 'touchbegin.i touchend.i',
      _add = 'addClass',
      _remove = 'removeClass',
      _callback = 'trigger',
      _label = 'label',
      _cursor = 'cursor',
      _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);
  
    // Plugin init
    $.fn[_iCheck] = function(options, fire) {
  
      // Walker
      var handle = 'input[type="' + _checkbox + '"], input[type="' + _radio + '"]',
        stack = $(),
        walker = function(object) {
          object.each(function() {
            var self = $(this);
  
            if (self.is(handle)) {
              stack = stack.add(self);
            } else {
              stack = stack.add(self.find(handle));
            }
          });
        };
  
      // Check if we should operate with some method
      if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(options)) {
  
        // Normalize method's name
        options = options.toLowerCase();
  
        // Find checkboxes and radio buttons
        walker(this);
  
        return stack.each(function() {
          var self = $(this);
  
          if (options == 'destroy') {
            tidy(self, 'ifDestroyed');
          } else {
            operate(self, true, options);
          }
  
          // Fire method's callback
          if ($.isFunction(fire)) {
            fire();
          }
        });
  
      // Customization
      } else if (typeof options == 'object' || !options) {
  
        // Check if any options were passed
        var settings = $.extend({
            checkedClass: _checked,
            disabledClass: _disabled,
            indeterminateClass: _indeterminate,
            labelHover: true
          }, options),
  
          selector = settings.handle,
          hoverClass = settings.hoverClass || 'hover',
          focusClass = settings.focusClass || 'focus',
          activeClass = settings.activeClass || 'active',
          labelHover = !!settings.labelHover,
          labelHoverClass = settings.labelHoverClass || 'hover',
  
          // Setup clickable area
          area = ('' + settings.increaseArea).replace('%', '') | 0;
  
        // Selector limit
        if (selector == _checkbox || selector == _radio) {
          handle = 'input[type="' + selector + '"]';
        }
  
        // Clickable area limit
        if (area < -50) {
          area = -50;
        }
  
        // Walk around the selector
        walker(this);
  
        return stack.each(function() {
          var self = $(this);
  
          // If already customized
          tidy(self);
  
          var node = this,
            id = node.id,
  
            // Layer styles
            offset = -area + '%',
            size = 100 + (area * 2) + '%',
            layer = {
              position: 'absolute',
              top: offset,
              left: offset,
              display: 'block',
              width: size,
              height: size,
              margin: 0,
              padding: 0,
              background: '#fff',
              border: 0,
              opacity: 0
            },
  
            // Choose how to hide input
            hide = _mobile ? {
              position: 'absolute',
              visibility: 'hidden'
            } : area ? layer : {
              position: 'absolute',
              opacity: 0
            },
  
            // Get proper class
            className = node[_type] == _checkbox ? settings.checkboxClass || 'i' + _checkbox : settings.radioClass || 'i' + _radio,
  
            // Find assigned labels
            label = $(_label + '[for="' + id + '"]').add(self.closest(_label)),
  
            // Check ARIA option
            aria = !!settings.aria,
  
            // Set ARIA placeholder
            ariaID = _iCheck + '-' + Math.random().toString(36).substr(2,6),
  
            // Parent & helper
            parent = '<div class="' + className + '" ' + (aria ? 'role="' + node[_type] + '" ' : ''),
            helper;
  
          // Set ARIA "labelledby"
          if (aria) {
            label.each(function() {
              parent += 'aria-labelledby="';
  
              if (this.id) {
                parent += this.id;
              } else {
                this.id = ariaID;
                parent += ariaID;
              }
  
              parent += '"';
            });
          }
  
          // Wrap input
          parent = self.wrap(parent + '/>')[_callback]('ifCreated').parent().append(settings.insert);
  
          // Layer addition
          helper = $('<ins class="' + _iCheckHelper + '"/>').css(layer).appendTo(parent);
  
          // Finalize customization
          self.data(_iCheck, {o: settings, s: self.attr('style')}).css(hide);
          !!settings.inheritClass && parent[_add](node.className || '');
          !!settings.inheritID && id && parent.attr('id', _iCheck + '-' + id);
          parent.css('position') == 'static' && parent.css('position', 'relative');
          operate(self, true, _update);
  
          // Label events
          if (label.length) {
            label.on(_click + '.i mouseover.i mouseout.i ' + _touch, function(event) {
              var type = event[_type],
                item = $(this);
  
              // Do nothing if input is disabled
              if (!node[_disabled]) {
  
                // Click
                if (type == _click) {
                  if ($(event.target).is('a')) {
                    return;
                  }
                  operate(self, false, true);
  
                // Hover state
                } else if (labelHover) {
  
                  // mouseout|touchend
                  if (/ut|nd/.test(type)) {
                    parent[_remove](hoverClass);
                    item[_remove](labelHoverClass);
                  } else {
                    parent[_add](hoverClass);
                    item[_add](labelHoverClass);
                  }
                }
  
                if (_mobile) {
                  event.stopPropagation();
                } else {
                  return false;
                }
              }
            });
          }
  
          // Input events
          self.on(_click + '.i focus.i blur.i keyup.i keydown.i keypress.i', function(event) {
            var type = event[_type],
              key = event.keyCode;
  
            // Click
            if (type == _click) {
              return false;
  
            // Keydown
            } else if (type == 'keydown' && key == 32) {
              if (!(node[_type] == _radio && node[_checked])) {
                if (node[_checked]) {
                  off(self, _checked);
                } else {
                  on(self, _checked);
                }
              }
  
              return false;
  
            // Keyup
            } else if (type == 'keyup' && node[_type] == _radio) {
              !node[_checked] && on(self, _checked);
  
            // Focus/blur
            } else if (/us|ur/.test(type)) {
              parent[type == 'blur' ? _remove : _add](focusClass);
            }
          });
  
          // Helper events
          helper.on(_click + ' mousedown mouseup mouseover mouseout ' + _touch, function(event) {
            var type = event[_type],
  
              // mousedown|mouseup
              toggle = /wn|up/.test(type) ? activeClass : hoverClass;
  
            // Do nothing if input is disabled
            if (!node[_disabled]) {
  
              // Click
              if (type == _click) {
                operate(self, false, true);
  
              // Active and hover states
              } else {
  
                // State is on
                if (/wn|er|in/.test(type)) {
  
                  // mousedown|mouseover|touchbegin
                  parent[_add](toggle);
  
                // State is off
                } else {
                  parent[_remove](toggle + ' ' + activeClass);
                }
  
                // Label hover
                if (label.length && labelHover && toggle == hoverClass) {
  
                  // mouseout|touchend
                  label[/ut|nd/.test(type) ? _remove : _add](labelHoverClass);
                }
              }
  
              if (_mobile) {
                event.stopPropagation();
              } else {
                return false;
              }
            }
          });
        });
      } else {
        return this;
      }
    };
  
    // Do something with inputs
    function operate(input, direct, method) {
      var node = input[0],
        state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked,
        active = method == _update ? {
          checked: node[_checked],
          disabled: node[_disabled],
          indeterminate: input.attr(_indeterminate) == 'true' || input.attr(_determinate) == 'false'
        } : node[state];
  
      // Check, disable or indeterminate
      if (/^(ch|di|in)/.test(method) && !active) {
        on(input, state);
  
      // Uncheck, enable or determinate
      } else if (/^(un|en|de)/.test(method) && active) {
        off(input, state);
  
      // Update
      } else if (method == _update) {
  
        // Handle states
        for (var each in active) {
          if (active[each]) {
            on(input, each, true);
          } else {
            off(input, each, true);
          }
        }
  
      } else if (!direct || method == 'toggle') {
  
        // Helper or label was clicked
        if (!direct) {
          input[_callback]('ifClicked');
        }
  
        // Toggle checked state
        if (active) {
          if (node[_type] !== _radio) {
            off(input, state);
          }
        } else {
          on(input, state);
        }
      }
    }
  
    // Add checked, disabled or indeterminate state
    function on(input, state, keep) {
      var node = input[0],
        parent = input.parent(),
        checked = state == _checked,
        indeterminate = state == _indeterminate,
        disabled = state == _disabled,
        callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
        regular = option(input, callback + capitalize(node[_type])),
        specific = option(input, state + capitalize(node[_type]));
  
      // Prevent unnecessary actions
      if (node[state] !== true) {
  
        // Toggle assigned radio buttons
        if (!keep && state == _checked && node[_type] == _radio && node.name) {
          var form = input.closest('form'),
            inputs = 'input[name="' + node.name + '"]';
  
          inputs = form.length ? form.find(inputs) : $(inputs);
  
          inputs.each(function() {
            if (this !== node && $(this).data(_iCheck)) {
              off($(this), state);
            }
          });
        }
  
        // Indeterminate state
        if (indeterminate) {
  
          // Add indeterminate state
          node[state] = true;
  
          // Remove checked state
          if (node[_checked]) {
            off(input, _checked, 'force');
          }
  
        // Checked or disabled state
        } else {
  
          // Add checked or disabled state
          if (!keep) {
            node[state] = true;
          }
  
          // Remove indeterminate state
          if (checked && node[_indeterminate]) {
            off(input, _indeterminate, false);
          }
        }
  
        // Trigger callbacks
        callbacks(input, checked, state, keep);
      }
  
      // Add proper cursor
      if (node[_disabled] && !!option(input, _cursor, true)) {
        parent.find('.' + _iCheckHelper).css(_cursor, 'default');
      }
  
      // Add state class
      parent[_add](specific || option(input, state) || '');
  
      // Set ARIA attribute
      if (!!parent.attr('role') && !indeterminate) {
        parent.attr('aria-' + (disabled ? _disabled : _checked), 'true');
      }
  
      // Remove regular state class
      parent[_remove](regular || option(input, callback) || '');
    }
  
    // Remove checked, disabled or indeterminate state
    function off(input, state, keep) {
      var node = input[0],
        parent = input.parent(),
        checked = state == _checked,
        indeterminate = state == _indeterminate,
        disabled = state == _disabled,
        callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
        regular = option(input, callback + capitalize(node[_type])),
        specific = option(input, state + capitalize(node[_type]));
  
      // Prevent unnecessary actions
      if (node[state] !== false) {
  
        // Toggle state
        if (indeterminate || !keep || keep == 'force') {
          node[state] = false;
        }
  
        // Trigger callbacks
        callbacks(input, checked, callback, keep);
      }
  
      // Add proper cursor
      if (!node[_disabled] && !!option(input, _cursor, true)) {
        parent.find('.' + _iCheckHelper).css(_cursor, 'pointer');
      }
  
      // Remove state class
      parent[_remove](specific || option(input, state) || '');
  
      // Set ARIA attribute
      if (!!parent.attr('role') && !indeterminate) {
        parent.attr('aria-' + (disabled ? _disabled : _checked), 'false');
      }
  
      // Add regular state class
      parent[_add](regular || option(input, callback) || '');
    }
  
    // Remove all traces
    function tidy(input, callback) {
      if (input.data(_iCheck)) {
  
        // Remove everything except input
        input.parent().html(input.attr('style', input.data(_iCheck).s || ''));
  
        // Callback
        if (callback) {
          input[_callback](callback);
        }
  
        // Unbind events
        input.off('.i').unwrap();
        $(_label + '[for="' + input[0].id + '"]').add(input.closest(_label)).off('.i');
      }
    }
  
    // Get some option
    function option(input, state, regular) {
      if (input.data(_iCheck)) {
        return input.data(_iCheck).o[state + (regular ? '' : 'Class')];
      }
    }
  
    // Capitalize some string
    function capitalize(string) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
  
    // Executable handlers
    function callbacks(input, checked, callback, keep) {
      if (!keep) {
        if (checked) {
          input[_callback]('ifToggled');
        }
  
        input[_callback]('ifChanged')[_callback]('if' + capitalize(callback));
      }
    }
  })(window.jQuery || window.Zepto);
  
  /* ========================= Form submit loader */
      $('form').on('submit',function() {
          var form = $("form#wrapped");
          form.validate();
          if (form.valid()) {
              $("#loader_form").fadeIn();
          }
      });