JohnGalt14 icon

Malicious or Legitimate

JohnGalt14 | PRO | 05/19/19 08:33:25 AM UTC | 0 ⭐ | 2130 👁️ | Never ⏰ | []
JavaScript |

0 B

|

None

|

0 👍

/

0 👎

window.___gcfg = {lang: 'de'}
var gapi=window.gapi=window.gapi||{};gapi._bs=new Date().getTime();(function(){var m=this,aa=function(a,b,c){return a.call.apply(a.bind,arguments)},ba=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}},ca=function(a,b,c){ca=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return ca.apply(null,arguments)},da=function(a,
b){function c(){}c.prototype=b.prototype;a.ja=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.A=function(d,e,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[e].apply(d,g)}};var ea=function(){this.V=""};ea.prototype.toString=function(){return"SafeScript{"+this.V+"}"};ea.prototype.i=function(a){this.V=a};(new ea).i("");var fa=function(){this.X=""};fa.prototype.toString=function(){return"SafeStyle{"+this.X+"}"};fa.prototype.i=function(a){this.X=a};(new fa).i("");var ha=function(){this.W=""};ha.prototype.toString=function(){return"SafeStyleSheet{"+this.W+"}"};ha.prototype.i=function(a){this.W=a};(new ha).i("");var q=function(){this.U=""};q.prototype.toString=function(){return"SafeHtml{"+this.U+"}"};q.prototype.i=function(a){this.U=a};(new q).i("<!DOCTYPE html>");(new q).i("");(new q).i("<br>");/*
 gapi.loader.OBJECT_CREATE_TEST_OVERRIDE &&*/
var t=window,v=document,ia=t.location,ja=function(){},ka=/\[native code\]/,w=function(a,b,c){return a[b]=a[b]||c},la=function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1},ma=function(a){a=a.sort();for(var b=[],c=void 0,d=0;d<a.length;d++){var e=a[d];e!=c&&b.push(e);c=e}return b},na=/&/g,oa=/</g,pa=/>/g,ra=/"/g,sa=/'/g,ta=function(a){return String(a).replace(na,"&amp;").replace(oa,"&lt;").replace(pa,"&gt;").replace(ra,"&quot;").replace(sa,"&#39;")},x=function(){var a;if((a=Object.create)&&
ka.test(a))a=a(null);else{a={};for(var b in a)a[b]=void 0}return a},z=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},ua=function(a){if(ka.test(Object.keys))return Object.keys(a);var b=[],c;for(c in a)z(a,c)&&b.push(c);return b},A=function(a,b){a=a||{};for(var c in a)z(a,c)&&(b[c]=a[c])},va=function(a){return function(){t.setTimeout(a,0)}},B=function(a,b){if(!a)throw Error(b||"");},C=w(t,"gapi",{});var D=function(a,b,c){var d=new RegExp("([#].*&|[#])"+b+"=([^&#]*)","g");b=new RegExp("([?#].*&|[?#])"+b+"=([^&#]*)","g");if(a=a&&(d.exec(a)||b.exec(a)))try{c=decodeURIComponent(a[2])}catch(e){}return c},wa=new RegExp(/^/.source+/([a-zA-Z][-+.a-zA-Z0-9]*:)?/.source+/(\/\/[^\/?#]*)?/.source+/([^?#]*)?/.source+/(\?([^#]*))?/.source+/(#((#|[^#])*))?/.source+/$/.source),xa=/[\ud800-\udbff][\udc00-\udfff]|[^!-~]/g,ya=new RegExp(/(%([^0-9a-fA-F%]|[0-9a-fA-F]([^0-9a-fA-F%])?)?)*/.source+/%($|[^0-9a-fA-F]|[0-9a-fA-F]($|[^0-9a-fA-F]))/.source,
"g"),za=/%([a-f]|[0-9a-fA-F][a-f])/g,Aa=/^(https?|ftp|file|chrome-extension):$/i,F=function(a){a=String(a);a=a.replace(xa,function(e){try{return encodeURIComponent(e)}catch(f){return encodeURIComponent(e.replace(/^[^%]+$/g,"\ufffd"))}}).replace(ya,function(e){return e.replace(/%/g,"%25")}).replace(za,function(e){return e.toUpperCase()});a=a.match(wa)||[];var b=x(),c=function(e){return e.replace(/\\/g,"%5C").replace(/\^/g,"%5E").replace(/`/g,"%60").replace(/\{/g,"%7B").replace(/\|/g,"%7C").replace(/\}/g,
"%7D")},d=!!(a[1]||"").match(Aa);b.A=c((a[1]||"")+(a[2]||"")+(a[3]||(a[2]&&d?"/":"")));d=function(e){return c(e.replace(/\?/g,"%3F").replace(/#/g,"%23"))};b.query=a[5]?[d(a[5])]:[];b.g=a[7]?[d(a[7])]:[];return b},Ba=function(a){return a.A+(0<a.query.length?"?"+a.query.join("&"):"")+(0<a.g.length?"#"+a.g.join("&"):"")},Ca=function(a,b){var c=[];if(a)for(var d in a)if(z(a,d)&&null!=a[d]){var e=b?b(a[d]):a[d];c.push(encodeURIComponent(d)+"="+encodeURIComponent(e))}return c},Da=function(a,b,c,d){a=F(a);
a.query.push.apply(a.query,Ca(b,d));a.g.push.apply(a.g,Ca(c,d));return Ba(a)},Ea=new RegExp(/\/?\??#?/.source+"("+/[\/?#]/i.source+"|"+/[\uD800-\uDBFF]/i.source+"|"+/%[c-f][0-9a-f](%[89ab][0-9a-f]){0,2}(%[89ab]?)?/i.source+"|"+/%[0-9a-f]?/i.source+")$","i"),Fa=function(a,b){var c=F(b);b=c.A;c.query.length&&(b+="?"+c.query.join(""));c.g.length&&(b+="#"+c.g.join(""));var d="";2E3<b.length&&(c=b,b=b.substr(0,2E3),b=b.replace(Ea,""),d=c.substr(b.length));var e=a.createElement("div");a=a.createElement("a");
c=F(b);b=c.A;c.query.length&&(b+="?"+c.query.join(""));c.g.length&&(b+="#"+c.g.join(""));a.href=b;e.appendChild(a);e.innerHTML=e.innerHTML;b=String(e.firstChild.href);e.parentNode&&e.parentNode.removeChild(e);c=F(b+d);b=c.A;c.query.length&&(b+="?"+c.query.join(""));c.g.length&&(b+="#"+c.g.join(""));return b},Ga=/^https?:\/\/[^\/%\\?#\s]+\/[^\s]*$/i;var Ha=function(a,b,c,d){if(t[c+"EventListener"])t[c+"EventListener"](a,b,!1);else if(t[d+"tachEvent"])t[d+"tachEvent"]("on"+a,b)},Ja=function(){var a=v.readyState;return"complete"===a||"interactive"===a&&-1==navigator.userAgent.indexOf("MSIE")},Ma=function(a){var b=Ka;if(!Ja())try{b()}catch(c){}La(a)},La=function(a){if(Ja())a();else{var b=!1,c=function(){if(!b)return b=!0,a.apply(this,arguments)};t.addEventListener?(t.addEventListener("load",c,!1),t.addEventListener("DOMContentLoaded",c,!1)):t.attachEvent&&
(t.attachEvent("onreadystatechange",function(){Ja()&&c.apply(this,arguments)}),t.attachEvent("onload",c))}},Na=function(a){for(;a.firstChild;)a.removeChild(a.firstChild)},Oa={button:!0,div:!0,span:!0};var G;G=w(t,"___jsl",x());w(G,"I",0);w(G,"hel",10);var Pa=function(a){return G.dpo?G.h:D(a,"jsh",G.h)},Qa=function(a){var b=w(G,"sws",[]);b.push.apply(b,a)},Ra=function(a){return w(G,"watt",x())[a]},Sa=function(a){var b=w(G,"PQ",[]);G.PQ=[];var c=b.length;if(0===c)a();else for(var d=0,e=function(){++d===c&&a()},f=0;f<c;f++)b[f](e)},Ta=function(a){return w(w(G,"H",x()),a,x())};var Ua=w(G,"perf",x()),Va=w(Ua,"g",x()),Wa=w(Ua,"i",x());w(Ua,"r",[]);x();x();
var Xa=function(a,b,c){var d=Ua.r;"function"===typeof d?d(a,b,c):d.push([a,b,c])},H=function(a,b,c){Va[a]=!b&&Va[a]||c||(new Date).getTime();Xa(a)},Za=function(a,b,c){b&&0<b.length&&(b=Ya(b),c&&0<c.length&&(b+="___"+Ya(c)),28<b.length&&(b=b.substr(0,28)+(b.length-28)),c=b,b=w(Wa,"_p",x()),w(b,c,x())[a]=(new Date).getTime(),Xa(a,"_p",c))},Ya=function(a){return a.join("__").replace(/\./g,"_").replace(/\-/g,"_").replace(/,/g,"_")};var $a=x(),J=[],L=function(a){throw Error("Bad hint"+(a?": "+a:""));};J.push(["jsl",function(a){for(var b in a)if(z(a,b)){var c=a[b];"object"==typeof c?G[b]=w(G,b,[]).concat(c):w(G,b,c)}if(b=a.u)a=w(G,"us",[]),a.push(b),(b=/^https:(.*)$/.exec(b))&&a.push("http:"+b[1])}]);var ab=/^(\/[a-zA-Z0-9_\-]+)+$/,bb=[/\/amp\//,/\/amp$/,/^\/amp$/],cb=/^[a-zA-Z0-9\-_\.,!]+$/,db=/^gapi\.loaded_[0-9]+$/,eb=/^[a-zA-Z0-9,._-]+$/,ib=function(a,b,c,d){var e=a.split(";"),f=e.shift(),g=$a[f],h=null;g?h=g(e,b,c,d):L("no hint processor for: "+f);h||L("failed to generate load url");b=h;c=b.match(fb);(d=b.match(gb))&&1===d.length&&hb.test(b)&&c&&1===c.length||L("failed sanity: "+a);return h},lb=function(a,b,c,d){a=jb(a);db.test(c)||L("invalid_callback");b=kb(b);d=d&&d.length?kb(d):null;var e=
function(f){return encodeURIComponent(f).replace(/%2C/g,",")};return[encodeURIComponent(a.pathPrefix).replace(/%2C/g,",").replace(/%2F/g,"/"),"/k=",e(a.version),"/m=",e(b),d?"/exm="+e(d):"","/rt=j/sv=1/d=1/ed=1",a.M?"/am="+e(a.M):"",a.Y?"/rs="+e(a.Y):"",a.$?"/t="+e(a.$):"","/cb=",e(c)].join("")},jb=function(a){"/"!==a.charAt(0)&&L("relative path");for(var b=a.substring(1).split("/"),c=[];b.length;){a=b.shift();if(!a.length||0==a.indexOf("."))L("empty/relative directory");else if(0<a.indexOf("=")){b.unshift(a);
break}c.push(a)}a={};for(var d=0,e=b.length;d<e;++d){var f=b[d].split("="),g=decodeURIComponent(f[0]),h=decodeURIComponent(f[1]);2==f.length&&g&&h&&(a[g]=a[g]||h)}b="/"+c.join("/");ab.test(b)||L("invalid_prefix");c=0;for(d=bb.length;c<d;++c)bb[c].test(b)&&L("invalid_prefix");c=mb(a,"k",!0);d=mb(a,"am");e=mb(a,"rs");a=mb(a,"t");return{pathPrefix:b,version:c,M:d,Y:e,$:a}},kb=function(a){for(var b=[],c=0,d=a.length;c<d;++c){var e=a[c].replace(/\./g,"_").replace(/-/g,"_");eb.test(e)&&b.push(e)}return b.join(",")},
mb=function(a,b,c){a=a[b];!a&&c&&L("missing: "+b);if(a){if(cb.test(a))return a;L("invalid: "+b)}return null},hb=/^https?:\/\/[a-z0-9_.-]+\.google(rs)?\.com(:\d+)?\/[a-zA-Z0-9_.,!=\-\/]+$/,gb=/\/cb=/g,fb=/\/\//g,nb=function(){var a=Pa(ia.href);if(!a)throw Error("Bad hint");return a};$a.m=function(a,b,c,d){(a=a[0])||L("missing_hint");return"https://apis.google.com"+lb(a,b,c,d)};var ob=decodeURI("%73cript"),pb=/^[-+_0-9\/A-Za-z]+={0,2}$/,qb=function(a,b){for(var c=[],d=0;d<a.length;++d){var e=a[d];e&&0>la.call(b,e)&&c.push(e)}return c},rb=function(){var a=G.nonce;return void 0!==a?a&&a===String(a)&&a.match(pb)?a:G.nonce=null:v.querySelector?(a=v.querySelector("script[nonce]"))?(a=a.nonce||a.getAttribute("nonce")||"",a&&a===String(a)&&a.match(pb)?G.nonce=a:G.nonce=null):null:null},tb=function(a){if("loading"!=v.readyState)sb(a);else{var b=rb(),c="";null!==b&&(c=' nonce="'+
b+'"');v.write("<"+ob+' src="'+encodeURI(a)+'"'+c+"></"+ob+">")}},sb=function(a){var b=v.createElement(ob);b.setAttribute("src",a);a=rb();null!==a&&b.setAttribute("nonce",a);b.async="true";(a=v.getElementsByTagName(ob)[0])?a.parentNode.insertBefore(b,a):(v.head||v.body||v.documentElement).appendChild(b)},ub=function(a,b){var c=b&&b._c;if(c)for(var d=0;d<J.length;d++){var e=J[d][0],f=J[d][1];f&&z(c,e)&&f(c[e],a,b)}},wb=function(a,b,c){vb(function(){var d=b===Pa(ia.href)?w(C,"_",x()):x();d=w(Ta(b),
"_",d);a(d)},c)},M=function(a,b){var c=b||{};"function"==typeof b&&(c={},c.callback=b);ub(a,c);b=a?a.split(":"):[];var d=c.h||nb(),e=w(G,"ah",x());if(e["::"]&&b.length){a=[];for(var f=null;f=b.shift();){var g=f.split(".");g=e[f]||e[g[1]&&"ns:"+g[0]||""]||d;var h=a.length&&a[a.length-1]||null,k=h;h&&h.hint==g||(k={hint:g,P:[]},a.push(k));k.P.push(f)}var l=a.length;if(1<l){var n=c.callback;n&&(c.callback=function(){0==--l&&n()})}for(;b=a.shift();)xb(b.P,c,b.hint)}else xb(b||[],c,d)},xb=function(a,b,
c){a=ma(a)||[];var d=b.callback,e=b.config,f=b.timeout,g=b.ontimeout,h=b.onerror,k=void 0;"function"==typeof h&&(k=h);var l=null,n=!1;if(f&&!g||!f&&g)throw"Timeout requires both the timeout parameter and ontimeout parameter to be set";h=w(Ta(c),"r",[]).sort();var p=w(Ta(c),"L",[]).sort(),r=[].concat(h),u=function(K,Y){if(n)return 0;t.clearTimeout(l);p.push.apply(p,y);var Z=((C||{}).config||{}).update;Z?Z(e):e&&w(G,"cu",[]).push(e);if(Y){Za("me0",K,r);try{wb(Y,c,k)}finally{Za("me1",K,r)}}return 1};
0<f&&(l=t.setTimeout(function(){n=!0;g()},f));var y=qb(a,p);if(y.length){y=qb(a,h);var E=w(G,"CP",[]),I=E.length;E[I]=function(K){if(!K)return 0;Za("ml1",y,r);var Y=function(qa){E[I]=null;u(y,K)&&Sa(function(){d&&d();qa()})},Z=function(){var qa=E[I+1];qa&&qa()};0<I&&E[I-1]?E[I]=function(){Y(Z)}:Y(Z)};if(y.length){var Ia="loaded_"+G.I++;C[Ia]=function(K){E[I](K);C[Ia]=null};a=ib(c,y,"gapi."+Ia,h);h.push.apply(h,y);Za("ml0",y,r);b.sync||t.___gapisync?tb(a):sb(a)}else E[I](ja)}else u(y)&&d&&d()};var vb=function(a,b){if(G.hee&&0<G.hel)try{return a()}catch(c){b&&b(c),G.hel--,M("debug_error",function(){try{window.___jsl.hefn(c)}catch(d){throw c;}})}else try{return a()}catch(c){throw b&&b(c),c;}};C.load=function(a,b){return vb(function(){return M(a,b)})};var yb=function(a){var b=window.___jsl=window.___jsl||{};b[a]=b[a]||[];return b[a]},zb=function(a){var b=window.___jsl=window.___jsl||{};b.cfg=!a&&b.cfg||{};return b.cfg},Ab=function(a){return"object"===typeof a&&/\[native code\]/.test(a.push)},N=function(a,b,c){if(b&&"object"===typeof b)for(var d in b)!Object.prototype.hasOwnProperty.call(b,d)||c&&"___goc"===d&&"undefined"===typeof b[d]||(a[d]&&b[d]&&"object"===typeof a[d]&&"object"===typeof b[d]&&!Ab(a[d])&&!Ab(b[d])?N(a[d],b[d]):b[d]&&"object"===
typeof b[d]?(a[d]=Ab(b[d])?[]:{},N(a[d],b[d])):a[d]=b[d])},Bb=function(a){if(a&&!/^\s+$/.test(a)){for(;0==a.charCodeAt(a.length-1);)a=a.substring(0,a.length-1);try{var b=window.JSON.parse(a)}catch(c){}if("object"===typeof b)return b;try{b=(new Function("return ("+a+"\n)"))()}catch(c){}if("object"===typeof b)return b;try{b=(new Function("return ({"+a+"\n})"))()}catch(c){}return"object"===typeof b?b:{}}},Cb=function(a,b){var c={___goc:void 0};a.length&&a[a.length-1]&&Object.hasOwnProperty.call(a[a.length-
1],"___goc")&&"undefined"===typeof a[a.length-1].___goc&&(c=a.pop());N(c,b);a.push(c)},Db=function(a){zb(!0);var b=window.___gcfg,c=yb("cu"),d=window.___gu;b&&b!==d&&(Cb(c,b),window.___gu=b);b=yb("cu");var e=document.scripts||document.getElementsByTagName("script")||[];d=[];var f=[];f.push.apply(f,yb("us"));for(var g=0;g<e.length;++g)for(var h=e[g],k=0;k<f.length;++k)h.src&&0==h.src.indexOf(f[k])&&d.push(h);0==d.length&&0<e.length&&e[e.length-1].src&&d.push(e[e.length-1]);for(e=0;e<d.length;++e)d[e].getAttribute("gapi_processed")||
(d[e].setAttribute("gapi_processed",!0),(f=d[e])?(g=f.nodeType,f=3==g||4==g?f.nodeValue:f.textContent||f.innerText||f.innerHTML||""):f=void 0,(f=Bb(f))&&b.push(f));a&&Cb(c,a);d=yb("cd");a=0;for(b=d.length;a<b;++a)N(zb(),d[a],!0);d=yb("ci");a=0;for(b=d.length;a<b;++a)N(zb(),d[a],!0);a=0;for(b=c.length;a<b;++a)N(zb(),c[a],!0)},O=function(a){var b=zb();if(!a)return b;a=a.split("/");for(var c=0,d=a.length;b&&"object"===typeof b&&c<d;++c)b=b[a[c]];return c===a.length&&void 0!==b?b:void 0},Eb=function(a,
b){var c;if("string"===typeof a){var d=c={};a=a.split("/");for(var e=0,f=a.length;e<f-1;++e){var g={};d=d[a[e]]=g}d[a[e]]=b}else c=a;Db(c)};var Fb=function(){var a=window.__GOOGLEAPIS;a&&(a.googleapis&&!a["googleapis.config"]&&(a["googleapis.config"]=a.googleapis),w(G,"ci",[]).push(a),window.__GOOGLEAPIS=void 0)};var Gb={callback:1,clientid:1,cookiepolicy:1,openidrealm:-1,includegrantedscopes:-1,requestvisibleactions:1,scope:1},Hb=!1,Ib=x(),Jb=function(){if(!Hb){for(var a=document.getElementsByTagName("meta"),b=0;b<a.length;++b){var c=a[b].name.toLowerCase();if(0==c.lastIndexOf("google-signin-",0)){c=c.substring(14);var d=a[b].content;Gb[c]&&d&&(Ib[c]=d)}}if(window.self!==window.top){a=document.location.toString();for(var e in Gb)0<Gb[e]&&(b=D(a,e,""))&&(Ib[e]=b)}Hb=!0}e=x();A(Ib,e);return e},Kb=function(a){return!!(a.clientid&&
a.scope&&a.callback)};var Lb=window.console,Mb=function(a){Lb&&Lb.log&&Lb.log(a)};var Nb=function(){return!!G.oa},Ob=function(){};var P=w(G,"rw",x()),Pb=function(a){for(var b in P)a(P[b])},Qb=function(a,b){(a=P[a])&&a.state<b&&(a.state=b)};var Rb;var Sb=/^https?:\/\/(?:\w|[\-\.])+\.google\.(?:\w|[\-:\.])+(?:\/[^\?#]*)?\/u\/(\d)\//,Tb=/^https?:\/\/(?:\w|[\-\.])+\.google\.(?:\w|[\-:\.])+(?:\/[^\?#]*)?\/b\/(\d{10,21})\//,Ub=function(a){var b=O("googleapis.config/sessionIndex");"string"===typeof b&&254<b.length&&(b=null);null==b&&(b=window.__X_GOOG_AUTHUSER);"string"===typeof b&&254<b.length&&(b=null);if(null==b){var c=window.google;c&&(b=c.authuser)}"string"===typeof b&&254<b.length&&(b=null);null==b&&(a=a||window.location.href,b=D(a,"authuser")||
null,null==b&&(b=(b=a.match(Sb))?b[1]:null));if(null==b)return null;b=String(b);254<b.length&&(b=null);return b},Vb=function(a){var b=O("googleapis.config/sessionDelegate");"string"===typeof b&&21<b.length&&(b=null);null==b&&(b=(a=(a||window.location.href).match(Tb))?a[1]:null);if(null==b)return null;b=String(b);21<b.length&&(b=null);return b};var Wb,Q,R=void 0,S=function(a){try{return m.JSON.parse.call(m.JSON,a)}catch(b){return!1}},T=function(a){return Object.prototype.toString.call(a)},Xb=T(0),Yb=T(new Date(0)),Zb=T(!0),$b=T(""),ac=T({}),bc=T([]),U=function(a,b){if(b)for(var c=0,d=b.length;c<d;++c)if(a===b[c])throw new TypeError("Converting circular structure to JSON");d=typeof a;if("undefined"!==d){c=Array.prototype.slice.call(b||[],0);c[c.length]=a;b=[];var e=T(a);if(null!=a&&"function"===typeof a.toJSON&&(Object.prototype.hasOwnProperty.call(a,
"toJSON")||(e!==bc||a.constructor!==Array&&a.constructor!==Object)&&(e!==ac||a.constructor!==Array&&a.constructor!==Object)&&e!==$b&&e!==Xb&&e!==Zb&&e!==Yb))return U(a.toJSON.call(a),c);if(null==a)b[b.length]="null";else if(e===Xb)a=Number(a),isNaN(a)||isNaN(a-a)?a="null":-0===a&&0>1/a&&(a="-0"),b[b.length]=String(a);else if(e===Zb)b[b.length]=String(!!Number(a));else{if(e===Yb)return U(a.toISOString.call(a),c);if(e===bc&&T(a.length)===Xb){b[b.length]="[";var f=0;for(d=Number(a.length)>>0;f<d;++f)f&&
(b[b.length]=","),b[b.length]=U(a[f],c)||"null";b[b.length]="]"}else if(e==$b&&T(a.length)===Xb){b[b.length]='"';f=0;for(c=Number(a.length)>>0;f<c;++f)d=String.prototype.charAt.call(a,f),e=String.prototype.charCodeAt.call(a,f),b[b.length]="\b"===d?"\\b":"\f"===d?"\\f":"\n"===d?"\\n":"\r"===d?"\\r":"\t"===d?"\\t":"\\"===d||'"'===d?"\\"+d:31>=e?"\\u"+(e+65536).toString(16).substr(1):32<=e&&65535>=e?d:"\ufffd";b[b.length]='"'}else if("object"===d){b[b.length]="{";d=0;for(f in a)Object.prototype.hasOwnProperty.call(a,
f)&&(e=U(a[f],c),void 0!==e&&(d++&&(b[b.length]=","),b[b.length]=U(f),b[b.length]=":",b[b.length]=e));b[b.length]="}"}else return}return b.join("")}},cc=/[\0-\x07\x0b\x0e-\x1f]/,dc=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*[\0-\x1f]/,ec=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*\\[^\\\/"bfnrtu]/,fc=/^([^"]*"([^\\"]|\\.)*")*[^"]*"([^"\\]|\\.)*\\u([0-9a-fA-F]{0,3}[^0-9a-fA-F])/,gc=/"([^\0-\x1f\\"]|\\[\\\/"bfnrt]|\\u[0-9a-fA-F]{4})*"/g,hc=/-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?/g,ic=/[ \t\n\r]+/g,
jc=/[^"]:/,kc=/""/g,lc=/true|false|null/g,mc=/00/,nc=/[\{]([^0\}]|0[^:])/,oc=/(^|\[)[,:]|[,:](\]|\}|[,:]|$)/,pc=/[^\[,:][\[\{]/,qc=/^(\{|\}|\[|\]|,|:|0)+/,rc=/\u2028/g,sc=/\u2029/g,tc=function(a){a=String(a);if(cc.test(a)||dc.test(a)||ec.test(a)||fc.test(a))return!1;var b=a.replace(gc,'""');b=b.replace(hc,"0");b=b.replace(ic,"");if(jc.test(b))return!1;b=b.replace(kc,"0");b=b.replace(lc,"0");if(mc.test(b)||nc.test(b)||oc.test(b)||pc.test(b)||!b||(b=b.replace(qc,"")))return!1;a=a.replace(rc,"\\u2028").replace(sc,
"\\u2029");b=void 0;try{b=R?[S(a)]:eval("(function (var_args) {\n  return Array.prototype.slice.call(arguments, 0);\n})(\n"+a+"\n)")}catch(c){return!1}return b&&1===b.length?b[0]:!1},uc=function(){var a=((m.document||{}).scripts||[]).length;if((void 0===Wb||void 0===R||Q!==a)&&-1!==Q){Wb=R=!1;Q=-1;try{try{R=!!m.JSON&&'{"a":[3,true,"1970-01-01T00:00:00.000Z"]}'===m.JSON.stringify.call(m.JSON,{a:[3,!0,new Date(0)],c:function(){}})&&!0===S("true")&&3===S('[{"a":3}]')[0].a}catch(b){}Wb=R&&!S("[00]")&&
!S('"\u0007"')&&!S('"\\0"')&&!S('"\\v"')}finally{Q=a}}},vc=function(a){if(-1===Q)return!1;uc();return(Wb?S:tc)(a)},wc=function(a){if(-1!==Q)return uc(),R?m.JSON.stringify.call(m.JSON,a):U(a)},xc=!Date.prototype.toISOString||"function"!==typeof Date.prototype.toISOString||"1970-01-01T00:00:00.000Z"!==(new Date(0)).toISOString(),yc=function(){var a=Date.prototype.getUTCFullYear.call(this);return[0>a?"-"+String(1E6-a).substr(1):9999>=a?String(1E4+a).substr(1):"+"+String(1E6+a).substr(1),"-",String(101+
Date.prototype.getUTCMonth.call(this)).substr(1),"-",String(100+Date.prototype.getUTCDate.call(this)).substr(1),"T",String(100+Date.prototype.getUTCHours.call(this)).substr(1),":",String(100+Date.prototype.getUTCMinutes.call(this)).substr(1),":",String(100+Date.prototype.getUTCSeconds.call(this)).substr(1),".",String(1E3+Date.prototype.getUTCMilliseconds.call(this)).substr(1),"Z"].join("")};Date.prototype.toISOString=xc?yc:Date.prototype.toISOString;var zc=function(){this.l=-1};var Ac=function(){this.l=64;this.b=[];this.G=[];this.aa=[];this.C=[];this.C[0]=128;for(var a=1;a<this.l;++a)this.C[a]=0;this.D=this.v=0;this.reset()};da(Ac,zc);Ac.prototype.reset=function(){this.b[0]=1732584193;this.b[1]=4023233417;this.b[2]=2562383102;this.b[3]=271733878;this.b[4]=3285377520;this.D=this.v=0};
var Bc=function(a,b,c){c||(c=0);var d=a.aa;if("string"==typeof b)for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.b[0];c=a.b[1];var g=a.b[2],h=a.b[3],k=a.b[4];for(e=0;80>e;e++){if(40>e)if(20>e){f=h^c&(g^h);var l=1518500249}else f=c^g^h,l=1859775393;else 60>e?(f=c&g|h&(c|g),l=2400959708):
(f=c^g^h,l=3395469782);f=(b<<5|b>>>27)+f+k+l+d[e]&4294967295;k=h;h=g;g=(c<<30|c>>>2)&4294967295;c=b;b=f}a.b[0]=a.b[0]+b&4294967295;a.b[1]=a.b[1]+c&4294967295;a.b[2]=a.b[2]+g&4294967295;a.b[3]=a.b[3]+h&4294967295;a.b[4]=a.b[4]+k&4294967295};
Ac.prototype.update=function(a,b){if(null!=a){void 0===b&&(b=a.length);for(var c=b-this.l,d=0,e=this.G,f=this.v;d<b;){if(0==f)for(;d<=c;)Bc(this,a,d),d+=this.l;if("string"==typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.l){Bc(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.l){Bc(this,e);f=0;break}}this.v=f;this.D+=b}};
Ac.prototype.digest=function(){var a=[],b=8*this.D;56>this.v?this.update(this.C,56-this.v):this.update(this.C,this.l-(this.v-56));for(var c=this.l-1;56<=c;c--)this.G[c]=b&255,b/=256;Bc(this,this.G);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.b[c]>>d&255,++b;return a};var Cc=function(){this.K=new Ac};Cc.prototype.reset=function(){this.K.reset()};var Dc=t.crypto,Ec=!1,Fc=0,Gc=0,Hc=1,Ic=0,Jc="",Kc=function(a){a=a||t.event;var b=a.screenX+a.clientX<<16;b+=a.screenY+a.clientY;b*=(new Date).getTime()%1E6;Hc=Hc*b%Ic;0<Fc&&++Gc==Fc&&Ha("mousemove",Kc,"remove","de")},Lc=function(a){var b=new Cc;a=unescape(encodeURIComponent(a));for(var c=[],d=0,e=a.length;d<e;++d)c.push(a.charCodeAt(d));b.K.update(c);b=b.K.digest();a="";for(c=0;c<b.length;c++)a+="0123456789ABCDEF".charAt(Math.floor(b[c]/16))+"0123456789ABCDEF".charAt(b[c]%16);return a};
Ec=!!Dc&&"function"==typeof Dc.getRandomValues;Ec||(Ic=1E6*(screen.width*screen.width+screen.height),Jc=Lc(v.cookie+"|"+v.location+"|"+(new Date).getTime()+"|"+Math.random()),Fc=O("random/maxObserveMousemove")||0,0!=Fc&&Ha("mousemove",Kc,"add","at"));var Mc=function(){var a=Hc;a+=parseInt(Jc.substr(0,20),16);Jc=Lc(Jc);return a/(Ic+Math.pow(16,20))},Nc=function(){var a=new t.Uint32Array(1);Dc.getRandomValues(a);return Number("0."+a[0])};var Oc=function(){var a=G.onl;if(!a){a=x();G.onl=a;var b=x();a.e=function(c){var d=b[c];d&&(delete b[c],d())};a.a=function(c,d){b[c]=d};a.r=function(c){delete b[c]}}return a},Pc=function(a,b){b=b.onload;return"function"===typeof b?(Oc().a(a,b),b):null},Qc=function(a){B(/^\w+$/.test(a),"Unsupported id - "+a);Oc();return'onload="window.___jsl.onl.e(&#34;'+a+'&#34;)"'},Rc=function(a){Oc().r(a)};var Sc={allowtransparency:"true",frameborder:"0",hspace:"0",marginheight:"0",marginwidth:"0",scrolling:"no",style:"",tabindex:"0",vspace:"0",width:"100%"},Tc={allowtransparency:!0,onload:!0},Uc=0,Vc=function(a){B(!a||Ga.test(a),"Illegal url for new iframe - "+a)},Wc=function(a,b,c,d,e){Vc(c.src);var f,g=Pc(d,c),h=g?Qc(d):"";try{document.all&&(f=a.createElement('<iframe frameborder="'+ta(String(c.frameborder))+'" scrolling="'+ta(String(c.scrolling))+'" '+h+' name="'+ta(String(c.name))+'"/>'))}catch(l){}finally{f||
(f=a.createElement("iframe"),g&&(f.onload=function(){f.onload=null;g.call(this)},Rc(d)))}f.setAttribute("ng-non-bindable","");for(var k in c)a=c[k],"style"===k&&"object"===typeof a?A(a,f.style):Tc[k]||f.setAttribute(k,String(a));(k=e&&e.beforeNode||null)||e&&e.dontclear||Na(b);b.insertBefore(f,k);f=k?k.previousSibling:b.lastChild;c.allowtransparency&&(f.allowTransparency=!0);return f};var Xc=/^:[\w]+$/,Yc=/:([a-zA-Z_]+):/g,Zc=function(){var a=Ub()||"0",b=Vb();var c=Ub(void 0)||a;var d=Vb(void 0),e="";c&&(e+="u/"+encodeURIComponent(String(c))+"/");d&&(e+="b/"+encodeURIComponent(String(d))+"/");c=e||null;(e=(d=!1===O("isLoggedIn"))?"_/im/":"")&&(c="");var f=O("iframes/:socialhost:"),g=O("iframes/:im_socialhost:");return Rb={socialhost:f,ctx_socialhost:d?g:f,session_index:a,session_delegate:b,session_prefix:c,im_prefix:e}},$c=function(a,b){return Zc()[b]||""},ad=function(a){return function(b,
c){return a?Zc()[c]||a[c]||"":Zc()[c]||""}};var bd=function(a){var b;a.match(/^https?%3A/i)&&(b=decodeURIComponent(a));return Fa(document,b?b:a)},cd=function(a){a=a||"canonical";for(var b=document.getElementsByTagName("link"),c=0,d=b.length;c<d;c++){var e=b[c],f=e.getAttribute("rel");if(f&&f.toLowerCase()==a&&(e=e.getAttribute("href"))&&(e=bd(e))&&null!=e.match(/^https?:\/\/[\w\-_\.]+/i))return e}return window.location.href};var dd={se:"0"},ed={post:!0},fd={style:"position:absolute;top:-10000px;width:450px;margin:0px;border-style:none"},gd="onPlusOne _ready _close _open _resizeMe _renderstart oncircled drefresh erefresh".split(" "),hd=w(G,"WI",x()),id=function(a,b,c){var d;var e={};var f=d=a;"plus"==a&&b.action&&(d=a+"_"+b.action,f=a+"/"+b.action);(d=O("iframes/"+d+"/url"))||(d=":im_socialhost:/:session_prefix::im_prefix:_/widget/render/"+f+"?usegapi=1");for(var g in dd)e[g]=g+"/"+(b[g]||dd[g])+"/";e=Fa(v,d.replace(Yc,
ad(e)));g="iframes/"+a+"/params/";f={};A(b,f);(d=O("lang")||O("gwidget/lang"))&&(f.hl=d);ed[a]||(f.origin=window.location.origin||window.location.protocol+"//"+window.location.host);f.exp=O(g+"exp");if(g=O(g+"location"))for(d=0;d<g.length;d++){var h=g[d];f[h]=t.location[h]}switch(a){case "plus":case "follow":g=f.href;d=b.action?void 0:"publisher";g=(g="string"==typeof g?g:void 0)?bd(g):cd(d);f.url=g;delete f.href;break;case "plusone":g=(g=b.href)?bd(g):cd();f.url=g;g=b.db;d=O();null==g&&d&&(g=d.db,
null==g&&(g=d.gwidget&&d.gwidget.db));f.db=g||void 0;g=b.ecp;d=O();null==g&&d&&(g=d.ecp,null==g&&(g=d.gwidget&&d.gwidget.ecp));f.ecp=g||void 0;delete f.href;break;case "signin":f.url=cd()}G.ILI&&(f.iloader="1");delete f["data-onload"];delete f.rd;for(var k in dd)f[k]&&delete f[k];f.gsrc=O("iframes/:source:");k=O("inline/css");"undefined"!==typeof k&&0<c&&k>=c&&(f.ic="1");k=/^#|^fr-/;c={};for(var l in f)z(f,l)&&k.test(l)&&(c[l.replace(k,"")]=f[l],delete f[l]);l="q"==O("iframes/"+a+"/params/si")?f:
c;k=Jb();for(var n in k)!z(k,n)||z(f,n)||z(c,n)||(l[n]=k[n]);n=[].concat(gd);(l=O("iframes/"+a+"/methods"))&&"object"===typeof l&&ka.test(l.push)&&(n=n.concat(l));for(var p in b)z(b,p)&&/^on/.test(p)&&("plus"!=a||"onconnect"!=p)&&(n.push(p),delete f[p]);delete f.callback;c._methods=n.join(",");return Da(e,f,c)},jd=["style","data-gapiscan"],ld=function(a){for(var b=x(),c=0!=a.nodeName.toLowerCase().indexOf("g:"),d=0,e=a.attributes.length;d<e;d++){var f=a.attributes[d],g=f.name,h=f.value;0<=la.call(jd,
g)||c&&0!=g.indexOf("data-")||"null"===h||"specified"in f&&!f.specified||(c&&(g=g.substr(5)),b[g.toLowerCase()]=h)}a=a.style;(c=kd(a&&a.height))&&(b.height=String(c));(a=kd(a&&a.width))&&(b.width=String(a));return b},kd=function(a){var b=void 0;"number"===typeof a?b=a:"string"===typeof a&&(b=parseInt(a,10));return b},nd=function(){var a=G.drw;Pb(function(b){if(a!==b.id&&4!=b.state&&"share"!=b.type){var c=b.id,d=b.type,e=b.url;b=b.userParams;var f=v.getElementById(c);if(f){var g=id(d,b,0);g?(f=f.parentNode,
e.replace(/#.*/,"").replace(/(\?|&)ic=1/,"")!==g.replace(/#.*/,"").replace(/(\?|&)ic=1/,"")&&(b.dontclear=!0,b.rd=!0,b.ri=!0,b.type=d,md(f,b),(d=P[f.lastChild.id])&&(d.oid=c),Qb(c,4))):delete P[c]}else delete P[c]}})};var od,pd,V,qd,rd,sd=/(?:^|\s)g-((\S)*)(?:$|\s)/,td={plusone:!0,autocomplete:!0,profile:!0,signin:!0,signin2:!0};od=w(G,"SW",x());pd=w(G,"SA",x());V=w(G,"SM",x());qd=w(G,"FW",[]);rd=null;
var vd=function(a,b){ud(void 0,!1,a,b)},ud=function(a,b,c,d){H("ps0",!0);c=("string"===typeof c?document.getElementById(c):c)||v;var e=v.documentMode;if(c.querySelectorAll&&(!e||8<e)){e=d?[d]:ua(od).concat(ua(pd)).concat(ua(V));for(var f=[],g=0;g<e.length;g++){var h=e[g];f.push(".g-"+h,"g\\:"+h)}e=c.querySelectorAll(f.join(","))}else e=c.getElementsByTagName("*");c=x();for(f=0;f<e.length;f++){g=e[f];var k=g;h=d;var l=k.nodeName.toLowerCase(),n=void 0;if(k.getAttribute("data-gapiscan"))h=null;else{var p=
l.indexOf("g:");0==p?n=l.substr(2):(p=(p=String(k.className||k.getAttribute("class")))&&sd.exec(p))&&(n=p[1]);h=!n||!(od[n]||pd[n]||V[n])||h&&n!==h?null:n}h&&(td[h]||0==g.nodeName.toLowerCase().indexOf("g:")||0!=ua(ld(g)).length)&&(g.setAttribute("data-gapiscan",!0),w(c,h,[]).push(g))}if(b)for(var r in c)for(b=c[r],d=0;d<b.length;d++)b[d].setAttribute("data-onload",!0);for(var u in c)qd.push(u);H("ps1",!0);if((r=qd.join(":"))||a)try{C.load(r,a)}catch(E){Mb(E);return}if(wd(rd||{}))for(var y in c){a=
c[y];u=0;for(b=a.length;u<b;u++)a[u].removeAttribute("data-gapiscan");xd(y)}else{d=[];for(y in c)for(a=c[y],u=0,b=a.length;u<b;u++)e=a[u],yd(y,e,ld(e),d,b);zd(r,d)}},Ad=function(a){var b=w(C,a,{});b.go||(b.go=function(c){return vd(c,a)},b.render=function(c,d){d=d||{};d.type=a;return md(c,d)})},Bd=function(a){od[a]=!0},Cd=function(a){pd[a]=!0},Dd=function(a){V[a]=!0};var xd=function(a,b){var c=Ra(a);b&&c?(c(b),(c=b.iframeNode)&&c.setAttribute("data-gapiattached",!0)):C.load(a,function(){var d=Ra(a),e=b&&b.iframeNode,f=b&&b.userParams;e&&d?(d(b),e.setAttribute("data-gapiattached",!0)):(d=C[a].go,"signin2"==a?d(e,f):d(e&&e.parentNode,f))})},wd=function(){return!1},zd=function(){},yd=function(a,b,c,d,e,f,g){switch(Ed(b,a,f)){case 0:a=V[a]?a+"_annotation":a;d={};d.iframeNode=b;d.userParams=c;xd(a,d);break;case 1:if(b.parentNode){for(var h in c){if(f=z(c,h))f=c[h],
f=!!f&&"object"===typeof f&&(!f.toString||f.toString===Object.prototype.toString||f.toString===Array.prototype.toString);if(f)try{c[h]=wc(c[h])}catch(y){delete c[h]}}f=!0;c.dontclear&&(f=!1);delete c.dontclear;Ob();h=id(a,c,e);e=g||{};e.allowPost=1;e.attributes=fd;e.dontclear=!f;g={};g.userParams=c;g.url=h;g.type=a;if(c.rd)var k=b;else k=document.createElement("div"),b.setAttribute("data-gapistub",!0),k.style.cssText="position:absolute;width:450px;left:-10000px;",b.parentNode.insertBefore(k,b);g.siteElement=
k;k.id||(b=k,w(hd,a,0),f="___"+a+"_"+hd[a]++,b.id=f);b=x();b[">type"]=a;A(c,b);f=h;c=k;h=e||{};b=h.attributes||{};B(!(h.allowPost||h.forcePost)||!b.onload,"onload is not supported by post iframe (allowPost or forcePost)");e=b=f;Xc.test(b)&&(e=O("iframes/"+e.substring(1)+"/url"),B(!!e,"Unknown iframe url config for - "+b));f=Fa(v,e.replace(Yc,$c));b=c.ownerDocument||v;k=0;do e=h.id||["I",Uc++,"_",(new Date).getTime()].join("");while(b.getElementById(e)&&5>++k);B(5>k,"Error creating iframe id");k={};
var l={};b.documentMode&&9>b.documentMode&&(k.hostiemode=b.documentMode);A(h.queryParams||{},k);A(h.fragmentParams||{},l);var n=h.pfname;var p=x();O("iframes/dropLegacyIdParam")||(p.id=e);p._gfid=e;p.parent=b.location.protocol+"//"+b.location.host;var r=D(b.location.href,"parent");n=n||"";!n&&r&&(r=D(b.location.href,"_gfid","")||D(b.location.href,"id",""),n=D(b.location.href,"pfname",""),n=r?n+"/"+r:"");n||(r=vc(D(b.location.href,"jcp","")))&&"object"==typeof r&&(n=(n=r.id)?r.pfname+"/"+n:"");p.pfname=
n;h.connectWithJsonParam&&(r={},r.jcp=wc(p),p=r);r=D(f,"rpctoken")||k.rpctoken||l.rpctoken;r||(r=h.rpctoken||String(Math.round(1E8*(Ec?Nc():Mc()))),p.rpctoken=r);h.rpctoken=r;A(p,h.connectWithQueryParams?k:l);r=b.location.href;p=x();(n=D(r,"_bsh",G.bsh))&&(p._bsh=n);(r=Pa(r))&&(p.jsh=r);h.hintInFragment?A(p,l):A(p,k);f=Da(f,k,l,h.paramsSerializer);l=x();A(Sc,l);A(h.attributes,l);l.name=l.id=e;l.src=f;h.eurl=f;k=h||{};p=!!k.allowPost;if(k.forcePost||p&&2E3<f.length){k=F(f);l.src="";h.dropDataPostorigin||
(l["data-postorigin"]=f);f=Wc(b,c,l,e);if(-1!=navigator.userAgent.indexOf("WebKit")){var u=f.contentWindow.document;u.open();l=u.createElement("div");p={};r=e+"_inner";p.name=r;p.src="";p.style="display:none";Wc(b,l,p,r,h)}l=(h=k.query[0])?h.split("&"):[];h=[];for(p=0;p<l.length;p++)r=l[p].split("=",2),h.push([decodeURIComponent(r[0]),decodeURIComponent(r[1])]);k.query=[];l=Ba(k);B(Ga.test(l),"Invalid URL: "+l);k=b.createElement("form");k.action=l;k.method="POST";k.target=e;k.style.display="none";
for(e=0;e<h.length;e++)l=b.createElement("input"),l.type="hidden",l.name=h[e][0],l.value=h[e][1],k.appendChild(l);c.appendChild(k);k.submit();k.parentNode.removeChild(k);u&&u.close();u=f}else u=Wc(b,c,l,e,h);g.iframeNode=u;g.id=u.getAttribute("id");u=g.id;c=x();c.id=u;c.userParams=g.userParams;c.url=g.url;c.type=g.type;c.state=1;P[u]=c;u=g}else u=null;u&&((g=u.id)&&d.push(g),xd(a,u))}},Ed=function(a,b,c){if(a&&1===a.nodeType&&b){if(c)return 1;if(V[b]){if(Oa[a.nodeName.toLowerCase()])return(a=a.innerHTML)&&
a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")?0:1}else{if(pd[b])return 0;if(od[b])return 1}}return null},md=function(a,b){var c=b.type;delete b.type;var d=("string"===typeof a?document.getElementById(a):a)||void 0;if(d){a={};for(var e in b)z(b,e)&&(a[e.toLowerCase()]=b[e]);a.rd=1;(b=!!a.ri)&&delete a.ri;e=[];yd(c,d,a,e,0,b,void 0);zd(c,e)}else Mb("string"==="gapi."+c+".render: missing element "+typeof a?a:"")};w(C,"platform",{}).go=vd;wd=function(a){for(var b=["_c","jsl","h"],c=0;c<b.length&&a;c++)a=a[b[c]];b=Pa(ia.href);return!a||0!=a.indexOf("n;")&&0!=b.indexOf("n;")&&a!==b};zd=function(a,b){Fd(a,b)};var Ka=function(a){ud(a,!0)},Gd=function(a,b){b=b||[];for(var c=0;c<b.length;++c)a(b[c]);for(a=0;a<b.length;a++)Ad(b[a])};
J.push(["platform",function(a,b,c){rd=c;b&&qd.push(b);Gd(Bd,a);Gd(Cd,c._c.annotation);Gd(Dd,c._c.bimodal);Fb();Db();if("explicit"!=O("parsetags")){Qa(a);Kb(Jb())&&!O("disableRealtimeCallback")&&Ob();if(c&&(a=c.callback)){var d=va(a);delete c.callback}Ma(function(){Ka(d)})}}]);C._pl=!0;var Hd=function(a){a=(a=P[a])?a.oid:void 0;if(a){var b=v.getElementById(a);b&&b.parentNode.removeChild(b);delete P[a];Hd(a)}};var Id=/^\{h:'/,Jd=/^!_/,Kd="",Fd=function(a,b){function c(){Ha("message",d,"remove","de")}function d(f){var g=f.data,h=f.origin;if(Ld(g,b)){var k=e;e=!1;k&&H("rqe");Md(a,function(){k&&H("rqd");c();for(var l=w(G,"RPMQ",[]),n=0;n<l.length;n++)l[n]({data:g,origin:h})})}}if(0!==b.length){Kd=D(ia.href,"pfname","");var e=!0;Ha("message",d,"add","at");M(a,c)}},Ld=function(a,b){a=String(a);if(Id.test(a))return!0;var c=!1;Jd.test(a)&&(c=!0,a=a.substr(2));if(!/^\{/.test(a))return!1;var d=vc(a);if(!d)return!1;
a=d.f;if(d.s&&a&&-1!=la.call(b,a)){if("_renderstart"===d.s||d.s===Kd+"/"+a+"::_renderstart")if(d=d.a&&d.a[c?0:1],b=v.getElementById(a),Qb(a,2),d&&b&&d.width&&d.height){a:{c=b.parentNode;a=d||{};if(Nb()){var e=b.id;if(e){d=(d=P[e])?d.state:void 0;if(1===d||4===d)break a;Hd(e)}}(d=c.nextSibling)&&d.getAttribute&&d.getAttribute("data-gapistub")&&(c.parentNode.removeChild(d),c.style.cssText="");d=a.width;var f=a.height,g=c.style;g.textIndent="0";g.margin="0";g.padding="0";g.background="transparent";g.borderStyle=
"none";g.cssFloat="none";g.styleFloat="none";g.lineHeight="normal";g.fontSize="1px";g.verticalAlign="baseline";c=c.style;c.display="inline-block";g=b.style;g.position="static";g.left="0";g.top="0";g.visibility="visible";d&&(c.width=g.width=d+"px");f&&(c.height=g.height=f+"px");a.verticalAlign&&(c.verticalAlign=a.verticalAlign);e&&Qb(e,3)}b["data-csi-wdt"]=(new Date).getTime()}return!0}return!1},Md=function(a,b){M(a,b)};var Nd=function(a,b){this.J=a;a=b||{};this.ca=Number(a.maxAge)||0;this.O=a.domain;this.S=a.path;this.da=!!a.secure},Od=/^[-+/_=.:|%&a-zA-Z0-9@]*$/,Pd=/^[A-Z_][A-Z0-9_]{0,63}$/;Nd.prototype.read=function(){for(var a=this.J+"=",b=document.cookie.split(/;\s*/),c=0;c<b.length;++c){var d=b[c];if(0==d.indexOf(a))return d.substr(a.length)}};
Nd.prototype.write=function(a,b){if(!Pd.test(this.J))throw"Invalid cookie name";if(!Od.test(a))throw"Invalid cookie value";a=this.J+"="+a;this.O&&(a+=";domain="+this.O);this.S&&(a+=";path="+this.S);b="number"===typeof b?b:this.ca;if(0<=b){var c=new Date;c.setSeconds(c.getSeconds()+b);a+=";expires="+c.toUTCString()}this.da&&(a+=";secure");document.cookie=a;return!0};Nd.prototype.clear=function(){this.write("",0)};
Nd.iterate=function(a){for(var b=document.cookie.split(/;\s*/),c=0;c<b.length;++c){var d=b[c].split("="),e=d.shift();a(e,d.join("="))}};var Qd=function(a){this.B=a},W={};Qd.prototype.read=function(){if(W.hasOwnProperty(this.B))return W[this.B]};Qd.prototype.write=function(a){W[this.B]=a;return!0};Qd.prototype.clear=function(){delete W[this.B]};Qd.iterate=function(a){for(var b in W)W.hasOwnProperty(b)&&a(b,W[b])};var Rd="https:"===window.location.protocol,Sd=Rd||"http:"===window.location.protocol?Nd:Qd,Td=function(a){var b=a.substr(1),c="",d=window.location.hostname;if(""!==b){c=parseInt(b,10);if(isNaN(c))return null;b=d.split(".");if(b.length<c-1)return null;b.length==c-1&&(d="."+d)}else d="";return{j:"S"==a.charAt(0),domain:d,o:c}},Ud=function(){var a,b=null;Sd.iterate(function(c,d){0===c.indexOf("G_AUTHUSER_")&&(c=Td(c.substring(11)),!a||c.j&&!a.j||c.j==a.j&&c.o>a.o)&&(a=c,b=d)});return{ba:a,F:b}};var Vd=function(a){if(0!==a.indexOf("GCSC"))return null;var b={R:!1};a=a.substr(4);if(!a)return b;var c=a.charAt(0);a=a.substr(1);var d=a.lastIndexOf("_");if(-1==d)return b;var e=Td(a.substr(d+1));if(null==e)return b;a=a.substring(0,d);if("_"!==a.charAt(0))return b;d="E"===c&&e.j;return!d&&("U"!==c||e.j)||d&&!Rd?b:{R:!0,j:d,ga:a.substr(1),domain:e.domain,o:e.o}},Wd=function(a){if(!a)return[];a=a.split("=");return a[1]?a[1].split("|"):[]},Xd=function(a){a=a.split(":");return{clientId:a[0].split("=")[1],
fa:Wd(a[1]),ia:Wd(a[2]),ha:Wd(a[3])}},Yd=function(){var a=Ud(),b=a.ba;a=a.F;if(null!==a){var c;Sd.iterate(function(f,g){(f=Vd(f))&&f.R&&f.j==b.j&&f.o==b.o&&(c=g)});if(c){var d=Xd(c),e=d&&d.fa[Number(a)];d=d&&d.clientId;if(e)return{F:a,ea:e,clientId:d}}}return null};var X=function(){this.N=Zd};X.prototype.w=0;X.prototype.L=2;X.prototype.N=null;X.prototype.H=!1;X.prototype.Z=function(){this.H||(this.w=0,this.H=!0,this.T())};X.prototype.T=function(){this.H&&(this.N()?this.w=this.L:this.w=Math.min(2*(this.w||this.L),120),window.setTimeout(ca(this.T,this),1E3*this.w))};for(var $d=0;64>$d;++$d);var ae=null;Nb=function(){return G.oa=!0};Ob=function(){G.oa=!0;var a=Yd();(a=a&&a.F)&&Eb("googleapis.config/sessionIndex",a);ae||(ae=w(G,"ss",new X));a=ae;a.Z&&a.Z()};
var Zd=function(){var a=Yd(),b=a&&a.ea||null,c=a&&a.clientId;M("auth",{callback:function(){var d=t.gapi.auth,e={client_id:c,session_state:b};d.checkSessionState(e,function(f){var g=e.session_state,h=O("isLoggedIn");f=O("debug/forceIm")?!1:g&&f||!g&&!f;if(h=h!=f)Eb("isLoggedIn",f),Ob(),nd(),f||((f=d.signOut)?f():(f=d.setToken)&&f(null));f=Jb();var k=O("savedUserState");g=d._guss(f.cookiepolicy);k=k!=g&&"undefined"!=typeof k;Eb("savedUserState",g);(h||k)&&Kb(f)&&!O("disableRealtimeCallback")&&d._pimf(f,
!0)})}});return!0};H("bs0",!0,window.gapi._bs);H("bs1",!0);delete window.gapi._bs;}).call(this);
gapi.load("",{callback:window["gapi_onload"],_c:{"jsl":{"ci":{"deviceType":"desktop","oauth-flow":{"authUrl":"https://accounts.google.com/o/oauth2/auth","proxyUrl":"https://accounts.google.com/o/oauth2/postmessageRelay","disableOpt":true,"idpIframeUrl":"https://accounts.google.com/o/oauth2/iframe","usegapi":false},"debug":{"reportExceptionRate":0.05,"forceIm":false,"rethrowException":false,"host":"https://apis.google.com"},"enableMultilogin":true,"googleapis.config":{"auth":{"useFirstPartyAuthV2":false}},"isPlusUser":false,"inline":{"css":1},"disableRealtimeCallback":false,"drive_share":{"skipInitCommand":true},"csi":{"rate":0.01},"client":{"cors":false},"isLoggedIn":false,"signInDeprecation":{"rate":0.0},"include_granted_scopes":true,"llang":"en","iframes":{"youtube":{"params":{"location":["search","hash"]},"url":":socialhost:/:session_prefix:_/widget/render/youtube?usegapi\u003d1","methods":["scroll","openwindow"]},"ytsubscribe":{"url":"https://www.youtube.com/subscribe_embed?usegapi\u003d1"},"plus_circle":{"params":{"url":""},"url":":socialhost:/:session_prefix::se:_/widget/plus/circle?usegapi\u003d1"},"plus_share":{"params":{"url":""},"url":":socialhost:/:session_prefix::se:_/+1/sharebutton?plusShare\u003dtrue\u0026usegapi\u003d1"},"rbr_s":{"params":{"url":""},"url":":socialhost:/:session_prefix::se:_/widget/render/recobarsimplescroller"},":source:":"3p","playemm":{"url":"https://play.google.com/work/embedded/search?usegapi\u003d1\u0026usegapi\u003d1"},"savetoandroidpay":{"url":"https://pay.google.com/gp/v/widget/save"},"blogger":{"params":{"location":["search","hash"]},"url":":socialhost:/:session_prefix:_/widget/render/blogger?usegapi\u003d1","methods":["scroll","openwindow"]},"evwidget":{"params":{"url":""},"url":":socialhost:/:session_prefix:_/events/widget?usegapi\u003d1"},"partnersbadge":{"url":"https://www.gstatic.com/partners/badge/templates/badge.html?usegapi\u003d1"},"dataconnector":{"url":"https://dataconnector.corp.google.com/:session_prefix:ui/widgetview?usegapi\u003d1"},"surveyoptin":{"url":"https://www.google.com/shopping/customerreviews/optin?usegapi\u003d1"},":socialhost:":"https://apis.google.com","shortlists":{"url":""},"hangout":{"url":"https://talkgadget.google.com/:session_prefix:talkgadget/_/widget"},"plus_followers":{"params":{"url":""},"url":":socialhost:/_/im/_/widget/render/plus/followers?usegapi\u003d1"},"post":{"params":{"url":""},"url":":socialhost:/:session_prefix::im_prefix:_/widget/render/post?usegapi\u003d1"},":gplus_url:":"https://plus.google.com","signin":{"params":{"url":""},"url":":socialhost:/:session_prefix:_/widget/render/signin?usegapi\u003d1","methods":["onauth"]},"rbr_i":{"params":{"url":""},"url":":socialhost:/:session_prefix::se:_/widget/render/recobarinvitation"},"donation":{"url":"https://onetoday.google.com/home/donationWidget?usegapi\u003d1"},"share":{"url":":socialhost:/:session_prefix::im_prefix:_/widget/render/share?usegapi\u003d1"},"plusone":{"params":{"count":"","size":"","url":""},"url":":socialhost:/:session_prefix::se:_/+1/fastbutton?usegapi\u003d1"},"comments":{"params":{"location":["search","hash"]},"url":":socialhost:/:session_prefix:_/widget/render/comments?usegapi\u003d1","methods":["scroll","openwindow"]},":im_socialhost:":"https://plus.googleapis.com","backdrop":{"url":"https://clients3.google.com/cast/chromecast/home/widget/backdrop?usegapi\u003d1"},"visibility":{"params":{"url":""},"url":":socialhost:/:session_prefix:_/widget/render/visibility?usegapi\u003d1"},"autocomplete":{"params":{"url":""},"url":":socialhost:/:session_prefix:_/widget/render/autocomplete"},"additnow":{"url":"https://apis.google.com/marketplace/button?usegapi\u003d1","methods":["launchurl"]},":signuphost:":"https://plus.google.com","ratingbadge":{"url":"https://www.google.com/shopping/customerreviews/badge?usegapi\u003d1"},"appcirclepicker":{"url":":socialhost:/:session_prefix:_/widget/render/appcirclepicker"},"follow":{"url":":socialhost:/:session_prefix:_/widget/render/follow?usegapi\u003d1"},"community":{"url":":ctx_socialhost:/:session_prefix::im_prefix:_/widget/render/community?usegapi\u003d1"},"sharetoclassroom":{"url":"https://www.gstatic.com/classroom/sharewidget/widget_stable.html?usegapi\u003d1"},"ytshare":{"params":{"url":""},"url":":socialhost:/:session_prefix:_/widget/render/ytshare?usegapi\u003d1"},"plus":{"url":":socialhost:/:session_prefix:_/widget/render/badge?usegapi\u003d1"},"family_creation":{"params":{"url":""},"url":"https://families.google.com/webcreation?usegapi\u003d1\u0026usegapi\u003d1"},"commentcount":{"url":":socialhost:/:session_prefix:_/widget/render/commentcount?usegapi\u003d1"},"configurator":{"url":":socialhost:/:session_prefix:_/plusbuttonconfigurator?usegapi\u003d1"},"zoomableimage":{"url":"https://ssl.gstatic.com/microscope/embed/"},"appfinder":{"url":"https://gsuite.google.com/:session_prefix:marketplace/appfinder?usegapi\u003d1"},"savetowallet":{"url":"https://pay.google.com/gp/v/widget/save"},"person":{"url":":socialhost:/:session_prefix:_/widget/render/person?usegapi\u003d1"},"savetodrive":{"url":"https://drive.google.com/savetodrivebutton?usegapi\u003d1","methods":["save"]},"page":{"url":":socialhost:/:session_prefix:_/widget/render/page?usegapi\u003d1"},"card":{"url":":socialhost:/:session_prefix:_/hovercard/card"}}},"h":"m;/_/scs/apps-static/_/js/k\u003doz.gapi.en_US.OOhUjQBchWs.O/am\u003dwQ/rt\u003dj/d\u003d1/rs\u003dAGLTcCPPWMrK_1WmtCU8v4YoO6JBH9g3EA/m\u003d__features__","u":"https://apis.google.com/js/platform.js","hee":true,"fp":"88b33dd56243ffbd67ca8e533edc4a5a79778cca","dpo":false},"platform":["additnow","backdrop","blogger","comments","commentcount","community","donation","family_creation","follow","hangout","health","page","partnersbadge","person","playemm","playreview","plus","plusone","post","ratingbadge","savetoandroidpay","savetodrive","savetowallet","sharetoclassroom","shortlists","signin2","surveyoptin","visibility","youtube","ytsubscribe","zoomableimage"],"fp":"88b33dd56243ffbd67ca8e533edc4a5a79778cca","annotation":["interactivepost","recobar","signin2","autocomplete","profile"],"bimodal":["signin","share"]}});
 
    window.cookieconsent_options = {
        "message": "Durch die weitere Nutzung dieser Webseite erklären Sie sich mit der in der Datenschutzerklärung beschriebenen Verwendung von Cookies durch bundes-telefonbuch.de einverstanden. An dieser Stelle können Sie auch der Verwendung von Cookies widersprechen bzw. eine erteilte Einwilligung widerrufen. Der Einsatz von Cookies erfolgt, um Ihre Nutzung unserer Webseiten zu analysieren und unser Angebot zu personalisieren. Durch Werbecookies von Drittanbietern erhalten Sie zudem personalisierte Werbung, auch wenn Sie sich nicht mehr auf unsere Webseite zugreifen. ",
        "dismiss": "Einverstanden",
        "learnMore": "Datenschutzerklärung",
        "link": "https://www.bundes-telefonbuch.de/infos/datenschutzhinweis#5",
        "theme": "dark-top"
    };
 
 
 
window.google = window.google || {};
google.maps = google.maps || {};
(function() {
  
  function getScript(src) {
    document.write('<' + 'script src="' + src + '"><' + '/script>');
  }
  
  var modules = google.maps.modules = {};
  google.maps.__gjsload__ = function(name, text) {
    modules[name] = text;
  };
  
  google.maps.Load = function(apiLoad) {
    delete google.maps.Load;
    apiLoad([0.009999999776482582,[null,[["https://khms0.googleapis.com/kh?v=821\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=821\u0026hl=en-US\u0026"],null,null,null,1,"821",["https://khms0.google.com/kh?v=821\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=821\u0026hl=en-US\u0026"]],null,null,null,null,[["https://cbks0.googleapis.com/cbk?","https://cbks1.googleapis.com/cbk?"]],[["https://khms0.googleapis.com/kh?v=123\u0026hl=en-US\u0026","https://khms1.googleapis.com/kh?v=123\u0026hl=en-US\u0026"],null,null,null,null,"123",["https://khms0.google.com/kh?v=123\u0026hl=en-US\u0026","https://khms1.google.com/kh?v=123\u0026hl=en-US\u0026"]],[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]],null,null,null,[["https://mts0.googleapis.com/mapslt?hl=en-US\u0026","https://mts1.googleapis.com/mapslt?hl=en-US\u0026"]]],["en-US","US",null,0,null,null,"https://maps.gstatic.com/mapfiles/",null,"https://maps.googleapis.com","https://maps.googleapis.com",null,"https://maps.google.com",null,"https://maps.gstatic.com/maps-api-v3/api/images/","https://www.google.com/maps",0,"https://www.google.com"],["https://maps.googleapis.com/maps-api-v3/api/js/36/10a","3.36.10a"],[4070854093],null,null,null,null,null,null,"",null,null,1,"https://khms.googleapis.com/mz?v=821\u0026","AIzaSyCIviOgBC4_EmAjKmfpLVo_FKR6OAUY2y0","https://earthbuilder.googleapis.com","https://earthbuilder.googleapis.com",null,"https://mts.googleapis.com/maps/vt/icon",[["https://maps.googleapis.com/maps/vt"],["https://maps.googleapis.com/maps/vt"],null,null,null,null,null,null,null,null,null,null,["https://www.google.com/maps/vt"],"/maps/vt",463000000,463],2,500,[null,null,null,null,"https://www.google.com/maps/preview/log204","","https://static.panoramio.com.storage.googleapis.com/photos/",["https://geo0.ggpht.com/cbk","https://geo1.ggpht.com/cbk","https://geo2.ggpht.com/cbk","https://geo3.ggpht.com/cbk"],"https://maps.googleapis.com/maps/api/js/GeoPhotoService.GetMetadata","https://maps.googleapis.com/maps/api/js/GeoPhotoService.SingleImageSearch",["https://lh3.ggpht.com/","https://lh4.ggpht.com/","https://lh5.ggpht.com/","https://lh6.ggpht.com/"]],null,null,null,null,"/maps/api/js/ApplicationService.GetEntityDetails",0,null,null,null,null,[],["36.10a"],1,0,[1]], loadScriptTime);
  };
  var loadScriptTime = (new Date).getTime();
})();
// inlined
(function(_){var ta,xa,Ba,Ca,Ea,Fa,Ga,Ha,Ya,Za,kb,tb,ub,wb,xb,Bb,Db,Eb,Fb,Gb,Hb,Jb,Nb,bc,cc,dc,fc,kc,mc,lc,uc,yc,Ac,Nc,Pc,Tc,ad,cd,dd,hd,pd,rd,vd,Dd,Ed,Fd,Gd,Id,Jd,Md,Pd,Ld,Td,Yd,ie,je,ne,qe,se,ue,te,Ae,Ce,Ee,Fe,De,He,Ke,Me,Ne,Ge,Je,Le,Oe,Re,Se,Te,kf,lf,mf,of,pf,rf,sf,wf,xf,yf,zf,Af,Cf,Ff,Gf,Of,Pf,Qf,Sf,Xf,$f,fg,bg,jg,ig,dg,Yf,Vf,xg,yg,zg,Bg,Cg,Dg,Eg,Fg,Lg,Rg,Mg,Tg,Pg,Qg,Xg,Ug,Yg,Zg,ah,dh,fh,eh,hh,lh,oh,nh,rh,sh,th,wh,xh,Hh,Gh,yh,zh,Lh,Aa,Ma,Ka,Va,Wa;_.aa="ERROR";_.ba="INVALID_REQUEST";_.ca="MAX_DIMENSIONS_EXCEEDED";
_.da="MAX_ELEMENTS_EXCEEDED";_.ea="MAX_WAYPOINTS_EXCEEDED";_.fa="NOT_FOUND";_.ha="OK";_.ia="OVER_QUERY_LIMIT";_.ja="REQUEST_DENIED";_.ka="UNKNOWN_ERROR";_.la="ZERO_RESULTS";_.ma=function(){return function(a){return a}};_.n=function(){return function(){}};_.na=function(a){return function(b){this[a]=b}};_.oa=function(a){return function(){return this[a]}};_.pa=function(a){return function(){return a}};_.ra=function(a){return function(){return _.qa[a].apply(this,arguments)}};
ta=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};_.ua=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:ta(a)}};_.wa=function(a){if(!(a instanceof Array)){a=_.ua(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a};xa=function(){xa=_.n();_.ya.Symbol||(_.ya.Symbol=za)};Ba=function(a,b){this.j=a;Aa(this,"description",{configurable:!0,writable:!0,value:b})};
_.Da=function(){xa();var a=_.ya.Symbol.iterator;a||(a=_.ya.Symbol.iterator=_.ya.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&Aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return Ca(ta(this))}});_.Da=_.n()};Ca=function(a){(0,_.Da)();a={next:a};a[_.ya.Symbol.iterator]=function(){return this};return a};
Ea=function(a,b){if(b){var c=_.ya;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&Aa(c,a,{configurable:!0,writable:!0,value:b})}};Fa=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{je:e,Ai:f}}return{je:-1,Ai:void 0}};
Ga=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};Ha=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};_.t=function(a){return void 0!==a};_.Ia=function(a){return"string"==typeof a};_.Ja=function(a){return"number"==typeof a};
_.Na=function(){if(null===Ka)a:{var a=_.y.document;if((a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&Ma.test(a)){Ka=a;break a}Ka=""}return Ka};_.Oa=function(a){a=a.split(".");for(var b=_.y,c=0;c<a.length;c++)if(b=b[a[c]],null==b)return null;return b};_.Pa=_.n();
_.Qa=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};_.Ra=function(a){return"array"==_.Qa(a)};_.Sa=function(a){var b=_.Qa(a);return"array"==b||"object"==b&&"number"==typeof a.length};_.Ta=function(a){return"function"==_.Qa(a)};_.Ua=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};_.Xa=function(a){return a[Va]||(a[Va]=++Wa)};Ya=function(a,b,c){return a.call.apply(a.bind,arguments)};
Za=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}};_.z=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?_.z=Ya:_.z=Za;return _.z.apply(null,arguments)};_.$a=function(){return+new Date};
_.bb=function(a,b){a=a.split(".");var c=_.y;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&_.t(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}};_.B=function(a,b){function c(){}c.prototype=b.prototype;a.Cb=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.hf=function(d,e,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];b.prototype[e].apply(d,g)}};
_.cb=function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(_.Ia(a))return _.Ia(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};_.C=function(a,b,c){for(var d=a.length,e=_.Ia(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};_.db=function(a,b){for(var c=a.length,d=[],e=0,f=_.Ia(a)?a.split(""):a,g=0;g<c;g++)if(g in f){var h=f[g];b.call(void 0,h,g,a)&&(d[e++]=h)}return d};
_.eb=function(a,b,c){for(var d=a.length,e=_.Ia(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1};_.gb=function(a,b){b=_.cb(a,b);var c;(c=0<=b)&&_.fb(a,b);return c};_.fb=function(a,b){Array.prototype.splice.call(a,b,1)};_.hb=function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};_.jb=function(){return-1!=_.ib.toLowerCase().indexOf("webkit")};
_.lb=function(a,b){var c=0;a=_.hb(String(a)).split(".");b=_.hb(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;0==c&&e<d;e++){var f=a[e]||"",g=b[e]||"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(0==f[0].length&&0==g[0].length)break;c=kb(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||kb(0==f[2].length,0==g[2].length)||kb(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c};kb=function(a,b){return a<b?-1:a>b?1:0};
_.mb=function(a){return-1!=_.ib.indexOf(a)};_.nb=function(a){for(var b in a)return!1;return!0};_.ob=function(){return _.mb("Trident")||_.mb("MSIE")};_.pb=function(){return _.mb("Firefox")||_.mb("FxiOS")};_.sb=function(){return _.mb("Safari")&&!(_.qb()||_.mb("Coast")||_.mb("Opera")||_.mb("Edge")||_.pb()||_.mb("Silk")||_.mb("Android"))};_.qb=function(){return(_.mb("Chrome")||_.mb("CriOS"))&&!_.mb("Edge")};tb=function(){return _.mb("iPhone")&&!_.mb("iPod")&&!_.mb("iPad")};ub=function(a){ub[" "](a);return a};
wb=function(a,b){var c=vb;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};xb=function(){var a=_.y.document;return a?a.documentMode:void 0};_.Ab=function(a){return wb(a,function(){return 0<=_.lb(zb,a)})};Bb=function(a,b){this.m=a;this.A=b;this.l=0;this.j=null};_.Cb=_.ma();Db=function(a){var b=!1,c;return function(){b||(c=a(),b=!0);return c}};Eb=function(a){_.y.setTimeout(function(){throw a;},0)};
Fb=function(){var a=_.y.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!_.mb("Presto")&&(a=function(){var e=document.createElement("IFRAME");e.style.display="none";e.src="";document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.write("");e.close();var g="callImmediate"+Math.random(),h="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;e=(0,_.z)(function(k){if(("*"==h||k.origin==
h)&&k.data==g)this.port1.onmessage()},this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,h)}}});if("undefined"!==typeof a&&!_.ob()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(_.t(c.next)){c=c.next;var e=c.Yg;c.Yg=null;e()}};return function(e){d.next={Yg:e};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(e){var f=document.createElement("SCRIPT");f.onreadystatechange=
function(){f.onreadystatechange=null;f.parentNode.removeChild(f);f=null;e();e=null};document.documentElement.appendChild(f)}:function(e){_.y.setTimeout(e,0)}};Gb=function(){this.l=this.j=null};Hb=function(){this.next=this.j=this.Qc=null};_.Mb=function(a,b){Ib||Jb();Kb||(Ib(),Kb=!0);Lb.add(a,b)};
Jb=function(){if(_.y.Promise&&_.y.Promise.resolve){var a=_.y.Promise.resolve(void 0);Ib=function(){a.then(Nb)}}else Ib=function(){var b=Nb;!_.Ta(_.y.setImmediate)||_.y.Window&&_.y.Window.prototype&&!_.mb("Edge")&&_.y.Window.prototype.setImmediate==_.y.setImmediate?(Ob||(Ob=Fb()),Ob(b)):_.y.setImmediate(b)}};Nb=function(){for(var a;a=Lb.remove();){try{a.Qc.call(a.j)}catch(c){Eb(c)}var b=Pb;b.A(a);100>b.l&&(b.l++,a.next=b.j,b.j=a)}Kb=!1};_.Rb=function(){this.m="";this.A=_.Qb};
_.Sb=function(a){var b=new _.Rb;b.m=a;return b};_.Ub=function(){this.m="";this.C=Tb;this.A=null};_.Vb=function(a){if(a instanceof _.Ub&&a.constructor===_.Ub&&a.C===Tb)return a.m;_.Qa(a);return"type_error:SafeHtml"};_.Wb=function(a,b){var c=new _.Ub;c.m=a;c.A=b;return c};_.Xb=function(a){return a*Math.PI/180};_.Yb=function(a){return 180*a/Math.PI};_.Zb=function(a){return document.createElement(String(a))};_.$b=function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b.nextSibling)};
_.ac=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)};bc=_.n();cc=function(a,b,c,d,e){this.j=!!b;this.node=null;this.l=0;this.m=!1;this.A=!c;a&&this.setPosition(a,d);this.depth=void 0!=e?e:this.l||0;this.j&&(this.depth*=-1)};dc=function(a,b,c,d){cc.call(this,a,b,c,null,d)};_.ec=function(a,b){a[b]||(a[b]=[]);return a[b]};
_.gc=function(a,b){if(null==a||null==b)return null==a==(null==b);if(a.constructor!=Array&&a.constructor!=Object)throw Error("Invalid object type passed into jsproto.areObjectsEqual()");if(a===b)return!0;if(a.constructor!=b.constructor)return!1;for(var c in a)if(!(c in b&&fc(a[c],b[c])))return!1;for(var d in b)if(!(d in a))return!1;return!0};
fc=function(a,b){if(a===b||!(!0!==a&&1!==a||!0!==b&&1!==b)||!(!1!==a&&0!==a||!1!==b&&0!==b))return!0;if(a instanceof Object&&b instanceof Object){if(!_.gc(a,b))return!1}else return!1;return!0};_.jc=function(a){_.Ia(a)?this.j=a:(this.j=a.G,this.m=a.I);a=this.j;var b=hc[a];if(!b){var c=1==parseInt(a,10)?0:-1;hc[a]=b=[c];ic.lastIndex=1+c;c=1;for(var d;d=ic.exec(a);)d=d[0],b[c++]=ic.lastIndex-d.length,b[c++]=parseInt(d,10);b[c]=a.length}this.l=b;this.Gb=this.l[0]};kc=_.n();
mc=function(a,b,c){var d=new _.jc(b);d.forEach(function(e){var f=e.qc,g=a[f+d.Gb];if(null!=g)if(e.Jd)for(var h=0;h<g.length;++h)lc(g[h],f,e,c);else lc(g,f,e,c)})};lc=function(a,b,c,d){if("m"==c.type){var e=d.length;mc(a,c.Le,d);d.splice(e,0,[b,"m",d.length-e].join(""))}else"b"==c.type&&(a=a?"1":"0"),a=[b,c.type,encodeURIComponent(a)].join(""),d.push(a)};_.F=function(a){this.B=a||[]};_.nc=function(a,b,c){a=a.B[b];return null!=a?a:c};_.oc=function(a,b,c){return _.nc(a,b,c||0)};
_.G=function(a,b,c){return _.nc(a,b,c||0)};_.H=function(a,b,c){return _.nc(a,b,c||"")};_.I=function(a,b){var c=a.B[b];c||(c=a.B[b]=[]);return c};_.pc=function(a,b){return _.ec(a.B,b)};_.qc=function(a,b,c){_.pc(a,b).push(c)};_.rc=function(a,b,c){return _.pc(a,b)[c]};_.sc=function(a,b){var c=[];_.pc(a,b).push(c);return c};_.tc=function(a,b){return a.B[b]?a.B[b].length:0};uc=function(a){this.B=a||[]};_.vc=function(a){return _.H(a,0)};_.wc=function(a){return _.H(a,1)};_.xc=function(a){this.B=a||[]};
yc=function(a){this.B=a||[]};_.zc=function(a){this.B=a||[]};Ac=function(a){this.B=a||[]};_.Bc=function(a){return new uc(a.B[2])};_.J=function(a){return a?a.length:0};_.Dc=function(a,b){_.Cc(b,function(c){a[c]=b[c]})};_.Ec=function(a,b,c){null!=b&&(a=Math.max(a,b));null!=c&&(a=Math.min(a,c));return a};_.Fc=function(a,b,c){c-=b;return((a-b)%c+c)%c+b};_.Gc=function(a,b,c){return Math.abs(a-b)<=(c||1E-9)};_.Hc=function(a,b){for(var c=[],d=_.J(a),e=0;e<d;++e)c.push(b(a[e],e));return c};
_.Jc=function(a,b){for(var c=_.Ic(void 0,_.J(b)),d=_.Ic(void 0,0);d<c;++d)a.push(b[d])};_.K=function(a){return"number"==typeof a};_.Kc=function(a){return"object"==typeof a};_.Ic=function(a,b){return null==a?b:a};_.Lc=function(a){return"string"==typeof a};_.Mc=function(a){return a===!!a};_.Cc=function(a,b){for(var c in a)b(c,a[c])};Nc=function(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]};
_.Oc=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];_.y.console&&_.y.console.error&&_.y.console.error.apply(_.y.console,_.wa(b))};Pc=function(a){this.message=a;this.name="InvalidValueError";this.stack=Error().stack};_.Qc=function(a,b){var c="";if(null!=b){if(!(b instanceof Pc))return b;c=": "+b.message}return new Pc(a+c)};_.Rc=function(a){if(!(a instanceof Pc))throw a;_.Oc(a.name+": "+a.message)};
_.Sc=function(a,b){var c=c?c+": ":"";return function(d){if(!d||!_.Kc(d))throw _.Qc(c+"not an Object");var e={},f;for(f in d)if(e[f]=d[f],!b&&!a[f])throw _.Qc(c+"unknown property "+f);for(f in a)try{var g=a[f](e[f]);if(_.t(g)||Object.prototype.hasOwnProperty.call(d,f))e[f]=g}catch(h){throw _.Qc(c+"in property "+f,h);}return e}};Tc=function(a){try{return!!a.cloneNode}catch(b){return!1}};
_.Vc=function(a,b,c){return c?function(d){if(d instanceof a)return d;try{return new a(d)}catch(e){throw _.Qc("when calling new "+b,e);}}:function(d){if(d instanceof a)return d;throw _.Qc("not an instance of "+b);}};_.Wc=function(a){return function(b){for(var c in a)if(a[c]==b)return b;throw _.Qc(b);}};_.Xc=function(a){return function(b){if(!_.Ra(b))throw _.Qc("not an Array");return _.Hc(b,function(c,d){try{return a(c)}catch(e){throw _.Qc("at index "+d,e);}})}};
_.Yc=function(a,b){return function(c){if(a(c))return c;throw _.Qc(b||""+c);}};_.Zc=function(a){return function(b){for(var c=[],d=0,e=a.length;d<e;++d){var f=a[d];try{(f.wg||f)(b)}catch(g){if(!(g instanceof Pc))throw g;c.push(g.message);continue}return(f.then||f)(b)}throw _.Qc(c.join("; and "));}};_.$c=function(a,b){return function(c){return b(a(c))}};_.L=function(a){return function(b){return null==b?b:a(b)}};
ad=function(a){return function(b){if(b&&null!=b[a])return b;throw _.Qc("no "+a+" property");}};_.M=function(a,b){this.x=a;this.y=b};cd=function(a){if(a instanceof _.M)return a;try{_.Sc({x:_.bd,y:_.bd},!0)(a)}catch(b){throw _.Qc("not a Point",b);}return new _.M(a.x,a.y)};_.O=function(a,b,c,d){this.width=a;this.height=b;this.l=c;this.j=d};dd=function(a){if(a instanceof _.O)return a;try{_.Sc({height:_.bd,width:_.bd},!0)(a)}catch(b){throw _.Qc("not a Size",b);}return new _.O(a.width,a.height)};
_.ed=function(a,b){this.S=a;this.T=b};_.fd=function(a){this.min=0;this.max=a;this.j=a-0};_.gd=function(a){this.yc=a.yc||null;this.zc=a.zc||null};hd=function(a,b,c){this.j=a;a=Math.cos(b*Math.PI/180);b=Math.cos(c*Math.PI/180);c=Math.sin(c*Math.PI/180);this.l=this.j*b;this.m=this.j*c;this.A=-this.j*a*c;this.C=this.j*a*b;this.D=this.l*this.C-this.m*this.A};_.id=function(a,b,c){var d=Math.pow(2,Math.round(a))/256;return new hd(Math.round(Math.pow(2,a)/d)*d,b,c)};
_.jd=function(a,b){return new _.ed((a.C*b.L-a.m*b.O)/a.D,(-a.A*b.L+a.l*b.O)/a.D)};_.kd=function(a){this.X=this.V=Infinity;this.ba=this.aa=-Infinity;_.C(a||[],this.extend,this)};_.ld=function(a,b,c,d){var e=new _.kd;e.V=a;e.X=b;e.aa=c;e.ba=d;return e};_.P=function(a,b,c){if(a&&(void 0!==a.lat||void 0!==a.lng))try{md(a),b=a.lng,a=a.lat,c=!1}catch(d){_.Rc(d)}a-=0;b-=0;c||(a=_.Ec(a,-90,90),180!=b&&(b=_.Fc(b,-180,180)));this.lat=function(){return a};this.lng=function(){return b}};_.nd=function(a){return _.Xb(a.lat())};
_.od=function(a){return _.Xb(a.lng())};pd=function(a,b){b=Math.pow(10,b);return Math.round(a*b)/b};_.qd=function(a){try{if(a instanceof _.P)return a;a=md(a);return new _.P(a.lat,a.lng)}catch(b){throw _.Qc("not a LatLng or LatLngLiteral",b);}};rd=function(a,b){-180==a&&180!=b&&(a=180);-180==b&&180!=a&&(b=180);this.j=a;this.l=b};_.sd=function(a){return a.j>a.l};_.td=function(a,b){var c=b-a;return 0<=c?c:b+180-(a-180)};_.ud=function(a){return a.isEmpty()?0:_.sd(a)?360-(a.j-a.l):a.l-a.j};
vd=function(a,b){this.j=a;this.l=b};_.Q=function(a,b){a=a&&_.qd(a);b=b&&_.qd(b);if(a){b=b||a;var c=_.Ec(a.lat(),-90,90),d=_.Ec(b.lat(),-90,90);this.na=new vd(c,d);a=a.lng();b=b.lng();360<=b-a?this.ia=new rd(-180,180):(a=_.Fc(a,-180,180),b=_.Fc(b,-180,180),this.ia=new rd(a,b))}else this.na=new vd(1,-1),this.ia=new rd(180,-180)};_.wd=function(a,b,c,d){return new _.Q(new _.P(a,b,!0),new _.P(c,d,!0))};
_.yd=function(a){if(a instanceof _.Q)return a;try{return a=xd(a),_.wd(a.south,a.west,a.north,a.east)}catch(b){throw _.Qc("not a LatLngBounds or LatLngBoundsLiteral",b);}};_.Bd=function(a){a=a||window.event;_.zd(a);_.Ad(a)};_.zd=function(a){a.stopPropagation()};_.Ad=function(a){a.preventDefault()};_.Cd=function(a){a.handled=!0};Dd=function(a,b){a.__e3_||(a.__e3_={});a=a.__e3_;a[b]||(a[b]={});return a[b]};Ed=function(a,b){var c=a.__e3_||{};if(b)a=c[b]||{};else for(b in a={},c)_.Dc(a,c[b]);return a};
Fd=function(a,b){return function(c){return b.call(a,c,this)}};Gd=function(a,b,c){return function(d){var e=[b,a];_.Jc(e,arguments);_.R.trigger.apply(this,e);c&&_.Cd.apply(null,arguments)}};Id=function(a,b,c,d){this.l=a;this.m=b;this.j=c;this.C=d;this.id=++Hd;Dd(a,b)[this.id]=this};Jd=function(a){return function(b){b||(b=window.event);if(b&&!b.target)try{b.target=b.srcElement}catch(d){}var c=a.A([b]);return b&&"click"==b.type&&(b=b.srcElement)&&"A"==b.tagName&&"javascript:void(0)"==b.href?!1:c}};
_.Kd=function(a){return""+(_.Ua(a)?_.Xa(a):a)};_.S=_.n();Md=function(a,b){var c=b+"_changed";if(a[c])a[c]();else a.changed(b);c=Ld(a,b);for(var d in c){var e=c[d];Md(e.Wc,e.sb)}_.R.trigger(a,b.toLowerCase()+"_changed")};_.Od=function(a){return Nd[a]||(Nd[a]=a.substr(0,1).toUpperCase()+a.substr(1))};Pd=function(a){a.gm_accessors_||(a.gm_accessors_={});return a.gm_accessors_};Ld=function(a,b){a.gm_bindings_||(a.gm_bindings_={});a.gm_bindings_.hasOwnProperty(b)||(a.gm_bindings_[b]={});return a.gm_bindings_[b]};
_.Qd=function(a){this.W=[];this.j=a&&a.Dd||_.Pa;this.l=a&&a.Ed||_.Pa};_.Sd=function(a,b,c,d){function e(){_.C(f,function(h){b.call(c||null,function(k){if(h.once){if(h.once.Xg)return;h.once.Xg=!0;_.gb(g.W,h);g.W.length||g.j()}h.Qc.call(h.context,k)})})}var f=a.W.slice(0),g=a;d&&d.sync?e():(Rd||_.Mb)(e)};Td=function(a,b){return function(c){return c.Qc==a&&c.context==(b||null)}};_.Ud=function(){this.W=new _.Qd({Dd:(0,_.z)(this.Dd,this),Ed:(0,_.z)(this.Ed,this)})};_.Vd=function(a){return function(){return this.get(a)}};
_.Wd=function(a,b){return b?function(c){try{this.set(a,b(c))}catch(d){_.Rc(_.Qc("set"+_.Od(a),d))}}:function(c){this.set(a,c)}};_.Xd=function(a,b){_.Cc(b,function(c,d){var e=_.Vd(c);a["get"+_.Od(c)]=e;d&&(d=_.Wd(c,d),a["set"+_.Od(c)]=d)})};_.Zd=function(a){this.j=a||[];Yd(this)};Yd=function(a){a.set("length",a.j.length)};_.$d=function(){this.l={};this.m=0};_.ae=function(a,b){var c=a.l,d=_.Kd(b);c[d]||(c[d]=b,++a.m,_.R.trigger(a,"insert",b),a.j&&a.j(b))};_.be=_.na("j");
_.ce=function(a,b){var c=b.qb();return _.db(a.j,function(d){d=d.qb();return c!=d})};_.de=function(a,b,c){this.heading=a;this.pitch=_.Ec(b,-90,90);this.zoom=Math.max(0,c)};_.ee=function(a){_.Ud.call(this);this.C=!!a};_.ge=function(a,b){return new _.fe(a,b)};_.fe=function(a,b){_.ee.call(this,b);this.j=a};_.he=function(){this.__gm=new _.S;this.C=null};ie=_.n();je=_.n();_.ke=_.na("__gm");
_.me=function(){for(var a=Array(36),b=0,c,d=0;36>d;d++)8==d||13==d||18==d||23==d?a[d]="-":14==d?a[d]="4":(2>=b&&(b=33554432+16777216*Math.random()|0),c=b&15,b>>=4,a[d]=le[19==d?c&3|8:c]);this.Rf=a.join("")+(Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^_.$a()).toString(36))};ne=function(a,b){this.j=a;this.l=b||0};
qe=function(){var a=navigator.userAgent;this.A=a;this.j=this.type=0;this.version=new ne(0);this.C=new ne(0);a=a.toLowerCase();for(var b=1;8>b;++b){var c=oe[b];if(-1!=a.indexOf(c)){this.type=b;var d=(new RegExp(c+"[ /]?([0-9]+).?([0-9]+)?")).exec(a);d&&(this.version=new ne(parseInt(d[1],10),parseInt(d[2]||"0",10)));break}}7==this.type&&(b=/^Mozilla\/.*Gecko\/.*[Minefield|Shiretoko][ /]?([0-9]+).?([0-9]+)?/,d=b.exec(this.A))&&(this.type=5,this.version=new ne(parseInt(d[1],10),parseInt(d[2]||"0",10)));
6==this.type&&(b=/rv:([0-9]{2,}.?[0-9]+)/,b=b.exec(this.A))&&(this.type=1,this.version=new ne(parseInt(b[1],10)));for(b=1;7>b;++b)if(c=pe[b],-1!=a.indexOf(c)){this.j=b;break}if(5==this.j||6==this.j||2==this.j)if(b=/OS (?:X )?(\d+)[_.]?(\d+)/.exec(this.A))this.C=new ne(parseInt(b[1],10),parseInt(b[2]||"0",10));4==this.j&&(b=/Android (\d+)\.?(\d+)?/.exec(this.A))&&(this.C=new ne(parseInt(b[1],10),parseInt(b[2]||"0",10)));this.l=5==this.type||7==this.type;this.m=4==this.type||3==this.type;this.D=0;this.l&&
(d=/\brv:\s*(\d+\.\d+)/.exec(a))&&(this.D=parseFloat(d[1]));this.F=document.compatMode||""};se=function(){this.j=_.re};ue=function(){var a=document;this.j=_.re;this.l=te(a,["transform","WebkitTransform","MozTransform","msTransform"]);this.m=te(a,["WebkitUserSelect","MozUserSelect","msUserSelect"])};te=function(a,b){for(var c=0,d;d=b[c];++c)if("string"==typeof a.documentElement.style[d])return d;return null};_.ve=function(a,b){a=a.style;a.width=b.width+(b.l||"px");a.height=b.height+(b.j||"px")};
_.we=function(a){return new _.O(a.offsetWidth,a.offsetHeight)};_.ye=function(a){for(var b;b=a.firstChild;)_.xe(b),a.removeChild(b)};_.xe=function(a){a=new dc(a);try{for(;;){var b=a.next();b&&_.R.clearInstanceListeners(b)}}catch(c){if(c!==ze)throw c;}};Ae=_.n();_.Be=function(a){this.j=_.qd(a)};Ce=function(a){if(a instanceof Ae)return a;try{return new _.Be(_.qd(a))}catch(b){}throw _.Qc("not a Geometry or LatLng or LatLngLiteral object");};
Ee=function(a){var b=_.y.document;var c=void 0===c?De:c;this.l=b;this.j=a;this.m=c};Fe=function(a,b,c){var d=a.l;b=a.m(a.j,b);a=d.getElementsByTagName("head")[0];d=d.createElement("script");d.type="text/javascript";d.charset="UTF-8";d.src=b;c&&(d.onerror=c);(c=_.Na())&&d.setAttribute("nonce",c);a.appendChild(d)};De=function(a,b){var c="";a=_.ua([a,b]);for(b=a.next();!b.done;b=a.next())b=b.value,b.length&&"/"==b[0]?c=b:(c&&"/"!=c[c.length-1]&&(c+="/"),c+=b);return c+".js"};
He=function(){this.C={};this.l={};this.D={};this.j={};this.A=void 0;this.m=new Ge};Ke=function(a,b,c){var d=Ie;var e=void 0===e?new Ee(b):e;a.A=_.n();Je(a.m,d,c,e)};Me=function(a,b){a.C[b]||(a.C[b]=!0,Le(a.m,function(c){for(var d=c.j[b],e=d?d.length:0,f=0;f<e;++f){var g=d[f];a.j[g]||Me(a,g)}Fe(c.m,b,function(h){for(var k=_.ua(a.l[b]||[]),l=k.next();!l.done;l=k.next())(l=l.value.Lb)&&l(h&&h.error||Error('Could not load "'+b+'".'));delete a.l[b];a.A&&a.A(b,h)})}))};
Ne=function(a,b,c){this.m=a;this.j=b;a={};for(var d in b)for(var e=b[d],f=0,g=e.length;f<g;++f){var h=e[f];a[h]||(a[h]=[]);a[h].push(d)}this.A=a;this.l=c};Ge=function(){this.l=void 0;this.j=[]};Je=function(a,b,c,d){b=a.l=new Ne(d,b,c);c=0;for(d=a.j.length;c<d;++c)a.j[c](b);a.j.length=0};Le=function(a,b){a.l?b(a.l):a.j.push(b)};Oe=function(a,b){if(a)return function(){--a||b()};b();return _.n()};
_.T=function(a){return new Promise(function(b,c){var d=He.j(),e=""+a;d.j[e]?b(d.j[e]):((d.l[e]=d.l[e]||[]).push({Hb:b,Lb:c}),Me(d,e))})};_.Pe=function(a,b){He.j().j[""+a]=b};_.Qe=function(a){a=a||{};this.m=a.id;this.j=null;try{this.j=a.geometry?Ce(a.geometry):null}catch(b){_.Rc(b)}this.l=a.properties||{}};Re=function(){this.j={};this.m={};this.l={}};Se=function(){this.j={}};Te=function(a){var b=this;this.j=new Se;_.R.addListenerOnce(a,"addfeature",function(){_.T("data").then(function(c){c.j(b,a,b.j)})})};
_.Xe=function(a){this.j=[];try{this.j=We(a)}catch(b){_.Rc(b)}};_.Ze=function(a){this.j=(0,_.Ye)(a)};_.$e=function(a){this.j=(0,_.Ye)(a)};_.bf=function(a){this.j=af(a)};_.cf=function(a){this.j=(0,_.Ye)(a)};_.ef=function(a){this.j=df(a)};_.gf=function(a){this.j=ff(a)};
_.hf=function(a,b,c){function d(w){if(!w)throw _.Qc("not a Feature");if("Feature"!=w.type)throw _.Qc('type != "Feature"');var x=w.geometry;try{x=null==x?null:e(x)}catch(E){throw _.Qc('in property "geometry"',E);}var A=w.properties||{};if(!_.Kc(A))throw _.Qc("properties is not an Object");var D=c.idPropertyName;w=D?A[D]:w.id;if(null!=w&&!_.K(w)&&!_.Lc(w))throw _.Qc((D||"id")+" is not a string or number");return{id:w,geometry:x,properties:A}}function e(w){if(null==w)throw _.Qc("is null");var x=(w.type+
"").toLowerCase(),A=w.coordinates;try{switch(x){case "point":return new _.Be(h(A));case "multipoint":return new _.cf(l(A));case "linestring":return g(A);case "multilinestring":return new _.bf(m(A));case "polygon":return f(A);case "multipolygon":return new _.gf(r(A))}}catch(D){throw _.Qc('in property "coordinates"',D);}if("geometrycollection"==x)try{return new _.Xe(v(w.geometries))}catch(D){throw _.Qc('in property "geometries"',D);}throw _.Qc("invalid type");}function f(w){return new _.ef(q(w))}function g(w){return new _.Ze(l(w))}
function h(w){w=k(w);return _.qd({lat:w[1],lng:w[0]})}if(!b)return[];c=c||{};var k=_.Xc(_.bd),l=_.Xc(h),m=_.Xc(g),q=_.Xc(function(w){w=l(w);if(!w.length)throw _.Qc("contains no elements");if(!w[0].equals(w[w.length-1]))throw _.Qc("first and last positions are not equal");return new _.$e(w.slice(0,-1))}),r=_.Xc(f),v=_.Xc(e),u=_.Xc(d);if("FeatureCollection"==b.type){b=b.features;try{return _.Hc(u(b),function(w){return a.add(w)})}catch(w){throw _.Qc('in property "features"',w);}}if("Feature"==b.type)return[a.add(d(b))];
throw _.Qc("not a Feature or FeatureCollection");};kf=function(a){var b=this;a=a||{};this.setValues(a);this.j=new Re;_.R.forward(this.j,"addfeature",this);_.R.forward(this.j,"removefeature",this);_.R.forward(this.j,"setgeometry",this);_.R.forward(this.j,"setproperty",this);_.R.forward(this.j,"removeproperty",this);this.l=new Te(this.j);this.l.bindTo("map",this);this.l.bindTo("style",this);_.C(_.jf,function(c){_.R.forward(b.l,c,b)});this.m=!1};lf=function(a){a.m||(a.m=!0,_.T("drawing_impl").then(function(b){b.Fk(a)}))};
mf=function(a){if(!a)return null;if(_.Ia(a)){var b=document.createElement("div");b.innerHTML=a}else a.nodeType==Node.TEXT_NODE?(b=document.createElement("div"),b.appendChild(a)):b=a;return b};of=function(a){var b=nf;Ke(He.j(),a,b)};pf=function(a){a=a||{};a.clickable=_.Ic(a.clickable,!0);a.visible=_.Ic(a.visible,!0);this.setValues(a);_.T("marker")};_.qf=function(a){this.__gm={set:null,ke:null,dc:{map:null,streetView:null}};pf.call(this,a)};
rf=function(a,b){this.j=a;this.l=b;a.addListener("map_changed",(0,_.z)(this.Al,this));this.bindTo("map",a);this.bindTo("disableAutoPan",a);this.bindTo("maxWidth",a);this.bindTo("position",a);this.bindTo("zIndex",a);this.bindTo("internalAnchor",a,"anchor");this.bindTo("internalContent",a,"content");this.bindTo("internalPixelOffset",a,"pixelOffset")};sf=function(a,b,c,d){c?a.bindTo(b,c,d):(a.unbind(b),a.set(b,void 0))};
_.tf=function(a){function b(){e||(e=!0,_.T("infowindow").then(function(f){f.xj(d)}))}window.setTimeout(function(){_.T("infowindow")},100);a=a||{};var c=!!a.j;delete a.j;var d=new rf(this,c),e=!1;_.R.addListenerOnce(this,"anchor_changed",b);_.R.addListenerOnce(this,"map_changed",b);this.setValues(a)};_.vf=function(a){_.uf&&a&&_.uf.push(a)};wf=function(a){this.setValues(a)};xf=_.n();yf=_.n();zf=_.n();Af=function(){_.T("geocoder")};
_.Bf=function(a,b,c){this.set("url",a);this.set("bounds",_.L(_.yd)(b));this.setValues(c)};Cf=function(a,b){_.Lc(a)?(this.set("url",a),this.setValues(b)):this.setValues(a)};_.Df=function(){this.j=new _.M(128,128);this.m=256/360;this.A=256/(2*Math.PI);this.l=!0};_.Ef=function(){var a=this;_.T("layers").then(function(b){b.j(a)})};Ff=function(a){var b=this;this.setValues(a);_.T("layers").then(function(c){c.l(b)})};Gf=function(){var a=this;_.T("layers").then(function(b){b.m(a)})};
_.Hf=function(){this.D=this.D;this.F=this.F};_.If=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.j=!1;this.bi=!0};
_.Mf=function(a,b){_.If.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.key="";this.charCode=this.keyCode=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.state=null;this.pointerId=0;this.pointerType="";this.l=null;if(a){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=
b;if(b=a.relatedTarget){if(_.Jf){a:{try{ub(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.offsetX=_.Kf||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=_.Kf||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX:a.pageX,
this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.key=a.key||"";this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType=_.Ia(a.pointerType)?a.pointerType:Lf[a.pointerType]||"";this.state=a.state;this.l=a;a.defaultPrevented&&this.preventDefault()}};
Of=function(a,b,c,d,e){this.listener=a;this.j=null;this.src=b;this.type=c;this.capture=!!d;this.Xb=e;this.key=++Nf;this.Bb=this.Ud=!1};Pf=function(a){a.Bb=!0;a.listener=null;a.j=null;a.src=null;a.Xb=null};Qf=function(a){this.src=a;this.listeners={};this.j=0};_.Rf=function(a,b){var c=b.type;c in a.listeners&&_.gb(a.listeners[c],b)&&(Pf(b),0==a.listeners[c].length&&(delete a.listeners[c],a.j--))};
Sf=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.Bb&&f.listener==b&&f.capture==!!c&&f.Xb==d)return e}return-1};_.Uf=function(a,b,c,d,e){if(d&&d.once)return _.Tf(a,b,c,d,e);if(_.Ra(b)){for(var f=0;f<b.length;f++)_.Uf(a,b[f],c,d,e);return null}c=Vf(c);return a&&a[Wf]?a.listen(b,c,_.Ua(d)?!!d.capture:!!d,e):Xf(a,b,c,!1,d,e)};
Xf=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=_.Ua(e)?!!e.capture:!!e,h=Yf(a);h||(a[Zf]=h=new Qf(a));c=h.add(b,c,d,g,f);if(c.j)return c;d=$f();c.j=d;d.src=a;d.listener=c;if(a.addEventListener)ag||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(bg(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");cg++;return c};
$f=function(){var a=dg,b=eg?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b};_.Tf=function(a,b,c,d,e){if(_.Ra(b)){for(var f=0;f<b.length;f++)_.Tf(a,b[f],c,d,e);return null}c=Vf(c);return a&&a[Wf]?a.A.add(String(b),c,!0,_.Ua(d)?!!d.capture:!!d,e):Xf(a,b,c,!0,d,e)};
fg=function(a,b,c,d,e){if(_.Ra(b))for(var f=0;f<b.length;f++)fg(a,b[f],c,d,e);else(d=_.Ua(d)?!!d.capture:!!d,c=Vf(c),a&&a[Wf])?a.A.remove(String(b),c,d,e):a&&(a=Yf(a))&&(b=a.listeners[b.toString()],a=-1,b&&(a=Sf(b,c,d,e)),(c=-1<a?b[a]:null)&&_.gg(c))};
_.gg=function(a){if(!_.Ja(a)&&a&&!a.Bb){var b=a.src;if(b&&b[Wf])_.Rf(b.A,a);else{var c=a.type,d=a.j;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(bg(c),d):b.addListener&&b.removeListener&&b.removeListener(d);cg--;(c=Yf(b))?(_.Rf(c,a),0==c.j&&(c.src=null,b[Zf]=null)):Pf(a)}}};bg=function(a){return a in hg?hg[a]:hg[a]="on"+a};
jg=function(a,b,c,d){var e=!0;if(a=Yf(a))if(b=a.listeners[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.Bb&&(f=ig(f,d),e=e&&!1!==f)}return e};ig=function(a,b){var c=a.listener,d=a.Xb||a.src;a.Ud&&_.gg(a);return c.call(d,b)};
dg=function(a,b){if(a.Bb)return!0;if(!eg){var c=b||_.Oa("window.event");b=new _.Mf(c,this);var d=!0;if(!(0>c.keyCode||void 0!=c.returnValue)){a:{var e=!1;if(0==c.keyCode)try{c.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==c.returnValue)c.returnValue=!0}c=[];for(e=b.currentTarget;e;e=e.parentNode)c.push(e);a=a.type;for(e=c.length-1;!b.j&&0<=e;e--){b.currentTarget=c[e];var f=jg(c[e],a,!0,b);d=d&&f}for(e=0;!b.j&&e<c.length;e++)b.currentTarget=c[e],f=jg(c[e],a,!1,b),d=d&&f}return d}return ig(a,new _.Mf(b,
this))};Yf=function(a){a=a[Zf];return a instanceof Qf?a:null};Vf=function(a){if(_.Ta(a))return a;a[kg]||(a[kg]=function(b){return a.handleEvent(b)});return a[kg]};_.lg=function(){_.Hf.call(this);this.A=new Qf(this);this.K=this;this.H=null};_.mg=function(a,b){if(!_.Ta(a))if(a&&"function"==typeof a.handleEvent)a=(0,_.z)(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:_.y.setTimeout(a,b||0)};
_.ng=function(a,b,c){_.Hf.call(this);this.j=a;this.A=b||0;this.l=c;this.m=(0,_.z)(this.Bh,this)};_.og=function(a){0!=a.Wb||a.start(void 0)};_.rg=function(a,b,c){this.size=a;this.tilt=b;this.heading=c;this.j=Math.cos(this.tilt/180*Math.PI)};_.sg=function(a,b,c){if(a=a.fromLatLngToPoint(b))c=Math.pow(2,c),a.x*=c,a.y*=c;return a};
_.tg=function(a,b){var c=a.lat()+_.Yb(b);90<c&&(c=90);var d=a.lat()-_.Yb(b);-90>d&&(d=-90);b=Math.sin(b);var e=Math.cos(_.Xb(a.lat()));if(90==c||-90==d||1E-6>e)return new _.Q(new _.P(d,-180),new _.P(c,180));b=_.Yb(Math.asin(b/e));return new _.Q(new _.P(d,a.lng()-b),new _.P(c,a.lng()+b))};
xg=function(a,b){var c=this;_.he.call(this);_.vf(a);this.__gm=new _.S;this.j=_.ge(!1,!0);this.j.addListener(function(f){c.get("visible")!=f&&c.set("visible",f)});this.m=this.A=null;b&&b.client&&(this.m=_.ug[b.client]||null);var d=this.controls=[];_.Cc(_.vg,function(f,g){d[g]=new _.Zd});this.D=!1;this.l=a;this.__gm.fa=b&&b.fa||new _.$d;this.set("standAlone",!0);this.setPov(new _.de(0,0,1));b&&b.pov&&(a=b.pov,_.K(a.zoom)||(a.zoom=_.Ja(b.zoom)?b.zoom:1));this.setValues(b);void 0==this.getVisible()&&
this.setVisible(!0);var e=this.__gm.fa;_.R.addListenerOnce(this,"pano_changed",function(){_.T("marker").then(function(f){f.j(e,c)})});_.wg[35]&&b&&b.dE&&_.T("util").then(function(f){f.j.m(new _.zc(b.dE))})};yg=function(){this.A=[];this.m=this.j=this.l=null};
zg=function(a,b,c,d){this.Z=b;this.j=d;this.l=_.ge(new _.be([]));this.J=new _.$d;this.copyrights=new _.Zd;this.A=new _.$d;this.D=new _.$d;this.C=new _.$d;var e=this.fa=new _.$d;e.j=function(){delete e.j;_.T("marker").then(function(f){f.j(e,a)})};this.F=new xg(c,{visible:!1,enableCloseButton:!0,fa:e});this.F.bindTo("controlSize",a);this.F.bindTo("reportErrorControl",a);this.F.D=!0;this.m=new yg;this.overlayLayer=null};
_.Ag=function(){var a=[],b=_.y.google&&_.y.google.maps&&_.y.google.maps.fisfetsz;b&&Array.isArray(b)&&_.wg[15]&&b.forEach(function(c){_.K(c)&&a.push(c)});return a};Bg=function(a){this.B=a||[]};Cg=function(a){this.B=a||[]};Dg=function(a){this.B=a||[]};Eg=function(a){this.B=a||[]};Fg=function(a){this.B=a||[]};
Lg=function(a){if(!Gg){var b=Gg={G:"meummm"};if(!Hg){var c=Hg={G:"ebb5ss8MmbbbEI100b"};Ig||(Ig={G:"eedmbddemd",I:["uuuu","uuuu"]});c.I=[Ig,"Eb"]}c=Hg;Jg||(Jg={G:"10m",I:["bb"]});b.I=["ii","uue",c,Jg]}return _.Kg.j(a.B,Gg)};
Rg=function(a,b,c){var d=this;this.U=new _.ng(function(){var e=Mg(d);if(d.m&&d.D)d.A!=e&&_.Ng(d.l);else{var f="",g=d.uh(),h=d.Gg(),k=d.af();if(k){if(g&&isFinite(g.lat())&&isFinite(g.lng())&&1<h&&null!=e&&k&&k.width&&k.height&&d.j){_.ve(d.j,k);if(g=_.sg(d.F,g,h)){var l=new _.kd;l.V=Math.round(g.x-k.width/2);l.aa=l.V+k.width;l.X=Math.round(g.y-k.height/2);l.ba=l.X+k.height;g=l}else g=null;l=Og[e];g&&(d.D=!0,d.A=e,d.m&&d.l&&(f=_.id(h,0,0),d.m.set({image:d.l,bounds:{min:_.jd(f,{L:g.V,O:g.X}),max:_.jd(f,
{L:g.aa,O:g.ba})},size:{width:k.width,height:k.height}})),f=Pg(d,g,h,e,l))}d.l&&(_.ve(d.l,k),Qg(d,f))}}},0);this.H=b;this.F=new _.Df;this.J=c+"/maps/api/js/StaticMapService.GetMapImage";this.l=this.j=null;this.m=new _.fe(null,void 0);this.A=null;this.C=this.D=!1;this.set("div",a);this.set("loading",!0)};Mg=function(a){var b=a.get("tilt")||_.J(a.get("styles"));a=a.get("mapTypeId");return b?null:Sg[a]};_.Ng=function(a){a.parentNode&&a.parentNode.removeChild(a)};
Tg=function(a,b){var c=a.l;c.onload=null;c.onerror=null;var d=a.af();d&&(b&&(c.parentNode||a.j.appendChild(c),a.m||_.ve(c,d)),a.set("loading",!1))};
Pg=function(a,b,c,d,e){var f=new Fg,g=new Dg(_.I(f,0));g.B[0]=b.V;g.B[1]=b.X;f.B[1]=e;f.setZoom(c);c=new Eg(_.I(f,3));c.B[0]=b.aa-b.V;c.B[1]=b.ba-b.X;var h=new Cg(_.I(f,4));h.B[0]=d;h.B[4]=_.vc(_.Bc(_.U));h.B[5]=_.wc(_.Bc(_.U)).toLowerCase();h.B[9]=!0;_.Ag().forEach(function(k){0>_.pc(h,13).indexOf(k)&&_.qc(h,13,k)});h.B[11]=!0;_.wg[13]&&(b=new Bg(_.sc(h,7)),b.B[0]=33,b.B[1]=3,b.B[7]=1);f=a.J+unescape("%3F")+Lg(f);return a.H(f)};
Qg=function(a,b){var c=a.l;b!=c.src?(a.m||_.Ng(c),c.onload=function(){Tg(a,!0)},c.onerror=function(){Tg(a,!1)},c.src=b):!c.parentNode&&b&&a.j.appendChild(c)};
Xg=function(a,b){var c=this;_.$a();var d=b||{};d.noClear||_.ye(a);var e="undefined"==typeof document?null:document.createElement("div");e&&a.appendChild&&(a.appendChild(e),e.style.width=e.style.height="100%");if(!_.y.requestAnimationFrame)throw _.T("controls").then(function(l){l.qg(a)}),Error("The Google Maps JavaScript API does not support this browser.");_.T("util").then(function(l){_.wg[35]&&b&&b.dE&&l.j.m(new _.zc(b.dE));l.j.j.ma(function(m){2==m.getStatus()&&_.T("controls").then(function(q){q.ji(a,
_.H(m,1)||"http://g.co/dev/maps-no-account")})})});var f,g=new Promise(function(l){f=l});_.ke.call(this,new zg(this,a,e,g));_.t(d.mapTypeId)||(d.mapTypeId="roadmap");this.setValues(d);this.j=_.wg[15]&&d.noControlsOrLogging;this.mapTypes=new je;this.features=new _.S;_.vf(e);this.notify("streetView");g=_.we(e);var h=null;Ug(d.useStaticMap,g)&&(h=new Rg(e,_.Vg,_.H(_.Bc(_.U),9)),h.set("size",g),h.bindTo("center",this),h.bindTo("zoom",this),h.bindTo("mapTypeId",this),h.bindTo("styles",this));this.overlayMapTypes=
new _.Zd;var k=this.controls=[];_.Cc(_.vg,function(l,m){k[m]=new _.Zd});_.T("map").then(function(l){Wg=l;c.getDiv()&&e&&l.l(c,d,e,h,f)});this.data=new kf({map:this})};Ug=function(a,b){if(!_.U||2==_.oc(_.U,37))return!1;if(_.t(a))return!!a;a=b.width;b=b.height;return 384E3>=a*b&&800>=a&&800>=b};Yg=function(){_.T("maxzoom")};Zg=function(a,b){!a||_.Lc(a)||_.K(a)?(this.set("tableId",a),this.setValues(b)):this.setValues(a)};_.$g=_.n();ah=function(a){a=a||{};a.visible=_.Ic(a.visible,!0);return a};
_.bh=function(a){return a&&a.radius||6378137};dh=function(a){return a instanceof _.Zd?ch(a):new _.Zd((0,_.Ye)(a))};fh=function(a){if(_.Ra(a)||a instanceof _.Zd)if(0==_.J(a))var b=!0;else b=a instanceof _.Zd?a.getAt(0):a[0],b=_.Ra(b)||b instanceof _.Zd;else b=!1;return b?a instanceof _.Zd?eh(ch)(a):new _.Zd(_.Xc(dh)(a)):new _.Zd([dh(a)])};
eh=function(a){return function(b){if(!(b instanceof _.Zd))throw _.Qc("not an MVCArray");b.forEach(function(c,d){try{a(c)}catch(e){throw _.Qc("at index "+d,e);}});return b}};_.gh=function(a){this.setValues(ah(a));_.T("poly")};hh=function(a){this.set("latLngs",new _.Zd([new _.Zd]));this.setValues(ah(a));_.T("poly")};_.ih=function(a){hh.call(this,a)};_.jh=function(a){hh.call(this,a)};_.kh=function(a){this.setValues(ah(a));_.T("poly")};lh=function(){this.j=null};_.mh=function(){this.j=null};
oh=function(a){var b=this;this.tileSize=a.tileSize||new _.O(256,256);this.name=a.name;this.alt=a.alt;this.minZoom=a.minZoom;this.maxZoom=a.maxZoom;this.m=(0,_.z)(a.getTileUrl,a);this.j=new _.$d;this.l=null;this.set("opacity",a.opacity);_.T("map").then(function(c){var d=b.l=c.j,e=b.tileSize||new _.O(256,256);b.j.forEach(function(f){var g=f.__gmimt,h=g.la,k=g.zoom,l=b.m(h,k);(g.md=d({M:h.x,N:h.y,Y:k},e,f,l,function(){return _.R.trigger(f,"load")})).setOpacity(nh(b))})})};
nh=function(a){a=a.get("opacity");return"number"==typeof a?a:1};_.ph=function(){_.ph.hf(this,"constructor")};_.qh=function(a,b){_.qh.hf(this,"constructor");this.set("styles",a);a=b||{};this.j=a.baseMapTypeId||"roadmap";this.minZoom=a.minZoom;this.maxZoom=a.maxZoom||20;this.name=a.name;this.alt=a.alt;this.projection=null;this.tileSize=new _.O(256,256)};rh=function(a,b){this.setValues(b)};sh=_.na("j");
th=function(a,b,c){for(var d=Array(b.length),e=0,f=b.length;e<f;++e)d[e]=b.charCodeAt(e);d.unshift(c);a=a.j;c=b=0;for(e=d.length;c<e;++c)b*=1729,b+=d[c],b%=a;return b};
wh=function(){var a=_.G(new yc(_.U.B[4]),0),b=_.H(_.U,16),c=_.H(_.U,6),d=_.H(_.U,13),e=new sh(131071),f=unescape("%26%74%6F%6B%65%6E%3D"),g=unescape("%26%6B%65%79%3D"),h=unescape("%26%63%6C%69%65%6E%74%3D"),k=unescape("%26%63%68%61%6E%6E%65%6C%3D"),l="";b&&(l+=g+encodeURIComponent(b));c&&(l+=h+encodeURIComponent(c));d&&(l+=k+encodeURIComponent(d));return function(m){m=m.replace(uh,"%27")+l;var q=m+f;vh||(vh=/(?:https?:\/\/[^/]+)?(.*)/);m=vh.exec(m);return q+th(e,m&&m[1],a)}};
xh=function(){var a=new sh(2147483647);return function(b){return th(a,b,0)}};
Hh=function(a,b){var c=window.google.maps;yh();var d=zh(c);_.U=new Ac(a);_.Ah=Math.random()<_.G(_.U,0,1);_.Bh=Math.round(1E15*Math.random()).toString(36);_.Vg=wh();_.Ch=xh();_.Dh=new _.Zd;_.Eh=b;for(a=0;a<_.tc(_.U,8);++a)_.wg[_.rc(_.U,8,a)]=!0;a=new _.xc(_.U.B[3]);of(_.H(a,0));_.Cc(Fh,function(f,g){c[f]=g});c.version=_.H(a,1);setTimeout(function(){_.T("util").then(function(f){f.l.j();f.m();d&&_.T("stats").then(function(g){g.j.j({ev:"api_alreadyloaded",client:_.H(_.U,6),key:_.H(_.U,16)})})})},5E3);
var e=_.H(_.U,11);e&&Promise.all(_.pc(_.U,12).map(function(f){return _.T(f)})).then(function(){Gh(e)()})};Gh=function(a){for(var b=a.split("."),c=window,d=window,e=0;e<b.length;e++)if(d=c,c=c[b[e]],!c)throw _.Qc(a+" is not a function");return function(){c.apply(d)}};yh=function(){for(var a in Object.prototype)window.console&&window.console.error("This site adds property <"+a+"> to Object.prototype. Extending Object.prototype breaks JavaScript for..in loops, which are used heavily in Google Maps JavaScript API v3.")};
zh=function(a){(a="version"in a)&&window.console&&window.console.error("You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.");return a};
_.Jh=function(a,b){b=void 0===b?"LocationBias":b;if("string"===typeof a){if("IP_BIAS"!==a)throw _.Qc(b+" of type string was invalid: "+a);return a}if(!a||!_.Kc(a))throw _.Qc("Invalid "+b+": "+a);if(!(a instanceof _.P||a instanceof _.Q||a instanceof _.gh))try{a=_.yd(a)}catch(c){try{a=_.qd(a)}catch(d){try{a=new _.gh(Ih(a))}catch(e){throw _.Qc("Invalid "+b+": "+JSON.stringify(a));}}}if(a instanceof _.gh){if(!a||!_.Kc(a))throw _.Qc("Passed Circle is not an Object.");a instanceof _.gh||(a=new _.gh(a));
if(!a.getCenter())throw _.Qc("Circle is missing center.");if(void 0==a.getRadius())throw _.Qc("Circle is missing radius.");}return a};_.qa=[];_.Kh="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b};
if("function"==typeof Object.setPrototypeOf)Lh=Object.setPrototypeOf;else{var Mh;a:{var Nh={a:!0},Oh={};try{Oh.__proto__=Nh;Mh=Oh.a;break a}catch(a){}Mh=!1}Lh=Mh?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}_.Ph=Lh;_.ya="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;
Aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};Ba.prototype.toString=_.oa("j");var za=function(){function a(c){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new Ba("jscomp_symbol_"+(c||"")+"_"+b++,c)}var b=0;return a}();
Ea("Promise",function(a){function b(g){this.l=0;this.m=void 0;this.j=[];var h=this.A();try{g(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.j=null}function d(g){return g instanceof b?g:new b(function(h){h(g)})}if(a)return a;c.prototype.l=function(g){if(null==this.j){this.j=[];var h=this;this.m(function(){h.C()})}this.j.push(g)};var e=_.ya.setTimeout;c.prototype.m=function(g){e(g,0)};c.prototype.C=function(){for(;this.j&&this.j.length;){var g=this.j;this.j=[];for(var h=0;h<g.length;++h){var k=
g[h];g[h]=null;try{k()}catch(l){this.A(l)}}}this.j=null};c.prototype.A=function(g){this.m(function(){throw g;})};b.prototype.A=function(){function g(l){return function(m){k||(k=!0,l.call(h,m))}}var h=this,k=!1;return{resolve:g(this.K),reject:g(this.C)}};b.prototype.K=function(g){if(g===this)this.C(new TypeError("A Promise cannot resolve to itself"));else if(g instanceof b)this.fa(g);else{a:switch(typeof g){case "object":var h=null!=g;break a;case "function":h=!0;break a;default:h=!1}h?this.J(g):this.D(g)}};
b.prototype.J=function(g){var h=void 0;try{h=g.then}catch(k){this.C(k);return}"function"==typeof h?this.ca(h,g):this.D(g)};b.prototype.C=function(g){this.F(2,g)};b.prototype.D=function(g){this.F(1,g)};b.prototype.F=function(g,h){if(0!=this.l)throw Error("Cannot settle("+g+", "+h+"): Promise already settled in state"+this.l);this.l=g;this.m=h;this.H()};b.prototype.H=function(){if(null!=this.j){for(var g=0;g<this.j.length;++g)f.l(this.j[g]);this.j=null}};var f=new c;b.prototype.fa=function(g){var h=
this.A();g.Vd(h.resolve,h.reject)};b.prototype.ca=function(g,h){var k=this.A();try{g.call(h,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(g,h){function k(r,v){return"function"==typeof r?function(u){try{l(r(u))}catch(w){m(w)}}:v}var l,m,q=new b(function(r,v){l=r;m=v});this.Vd(k(g,l),k(h,m));return q};b.prototype["catch"]=function(g){return this.then(void 0,g)};b.prototype.Vd=function(g,h){function k(){switch(l.l){case 1:g(l.m);break;case 2:h(l.m);break;default:throw Error("Unexpected state: "+
l.l);}}var l=this;null==this.j?f.l(k):this.j.push(k)};b.resolve=d;b.reject=function(g){return new b(function(h,k){k(g)})};b.race=function(g){return new b(function(h,k){for(var l=_.ua(g),m=l.next();!m.done;m=l.next())d(m.value).Vd(h,k)})};b.all=function(g){var h=_.ua(g),k=h.next();return k.done?d([]):new b(function(l,m){function q(u){return function(w){r[u]=w;v--;0==v&&l(r)}}var r=[],v=0;do r.push(void 0),v++,d(k.value).Vd(q(r.length-1),m),k=h.next();while(!k.done)})};return b});
Ea("Array.prototype.findIndex",function(a){return a?a:function(b,c){return Fa(this,b,c).je}});Ea("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=Ga(this,b,"startsWith");b+="";var e=d.length,f=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var g=0;g<f&&c<e;)if(d[c++]!=b[g++])return!1;return g>=f}});
Ea("String.prototype.endsWith",function(a){return a?a:function(b,c){var d=Ga(this,b,"endsWith");b+="";void 0===c&&(c=d.length);c=Math.max(0,Math.min(c|0,d.length));for(var e=b.length;0<e&&0<c;)if(d[--c]!=b[--e])return!1;return 0>=e}});Ea("String.prototype.repeat",function(a){return a?a:function(b){var c=Ga(this,null,"repeat");if(0>b||1342177279<b)throw new RangeError("Invalid count value");b|=0;for(var d="";b;)if(b&1&&(d+=c),b>>>=1)c+=c;return d}});
Ea("Array.prototype.find",function(a){return a?a:function(b,c){return Fa(this,b,c).Ai}});Ea("Math.log10",function(a){return a?a:function(b){return Math.log(b)/Math.LN10}});
Ea("WeakMap",function(a){function b(h){this.j=(g+=Math.random()+1).toString();if(h){h=_.ua(h);for(var k;!(k=h.next()).done;)k=k.value,this.set(k[0],k[1])}}function c(){}function d(h){if(!Ha(h,f)){var k=new c;Aa(h,f,{value:k})}}function e(h){var k=Object[h];k&&(Object[h]=function(l){if(l instanceof c)return l;d(l);return k(l)})}if(function(){if(!a||!Object.seal)return!1;try{var h=Object.seal({}),k=Object.seal({}),l=new a([[h,2],[k,3]]);if(2!=l.get(h)||3!=l.get(k))return!1;l["delete"](h);l.set(k,4);
return!l.has(h)&&4==l.get(k)}catch(m){return!1}}())return a;var f="$jscomp_hidden_"+Math.random();e("freeze");e("preventExtensions");e("seal");var g=0;b.prototype.set=function(h,k){d(h);if(!Ha(h,f))throw Error("WeakMap key fail: "+h);h[f][this.j]=k;return this};b.prototype.get=function(h){return Ha(h,f)?h[f][this.j]:void 0};b.prototype.has=function(h){return Ha(h,f)&&Ha(h[f],this.j)};b.prototype["delete"]=function(h){return Ha(h,f)&&Ha(h[f],this.j)?delete h[f][this.j]:!1};return b});
Ea("Map",function(a){function b(){var h={};return h.Nb=h.next=h.head=h}function c(h,k){var l=h.j;return Ca(function(){if(l){for(;l.head!=h.j;)l=l.Nb;for(;l.next!=l.head;)return l=l.next,{done:!1,value:k(l)};l=null}return{done:!0,value:void 0}})}function d(h,k){var l=k&&typeof k;"object"==l||"function"==l?f.has(k)?l=f.get(k):(l=""+ ++g,f.set(k,l)):l="p_"+k;var m=h.l[l];if(m&&Ha(h.l,l))for(h=0;h<m.length;h++){var q=m[h];if(k!==k&&q.key!==q.key||k===q.key)return{id:l,list:m,index:h,Xa:q}}return{id:l,
list:m,index:-1,Xa:void 0}}function e(h){this.l={};this.j=b();this.size=0;if(h){h=_.ua(h);for(var k;!(k=h.next()).done;)k=k.value,this.set(k[0],k[1])}}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var h=Object.seal({x:4}),k=new a(_.ua([[h,"s"]]));if("s"!=k.get(h)||1!=k.size||k.get({x:4})||k.set({x:4},"t")!=k||2!=k.size)return!1;var l=k.entries(),m=l.next();if(m.done||m.value[0]!=h||"s"!=m.value[1])return!1;m=l.next();return m.done||4!=
m.value[0].x||"t"!=m.value[1]||!l.next().done?!1:!0}catch(q){return!1}}())return a;(0,_.Da)();var f=new WeakMap;e.prototype.set=function(h,k){h=0===h?0:h;var l=d(this,h);l.list||(l.list=this.l[l.id]=[]);l.Xa?l.Xa.value=k:(l.Xa={next:this.j,Nb:this.j.Nb,head:this.j,key:h,value:k},l.list.push(l.Xa),this.j.Nb.next=l.Xa,this.j.Nb=l.Xa,this.size++);return this};e.prototype["delete"]=function(h){h=d(this,h);return h.Xa&&h.list?(h.list.splice(h.index,1),h.list.length||delete this.l[h.id],h.Xa.Nb.next=h.Xa.next,
h.Xa.next.Nb=h.Xa.Nb,h.Xa.head=null,this.size--,!0):!1};e.prototype.clear=function(){this.l={};this.j=this.j.Nb=b();this.size=0};e.prototype.has=function(h){return!!d(this,h).Xa};e.prototype.get=function(h){return(h=d(this,h).Xa)&&h.value};e.prototype.entries=function(){return c(this,function(h){return[h.key,h.value]})};e.prototype.keys=function(){return c(this,function(h){return h.key})};e.prototype.values=function(){return c(this,function(h){return h.value})};e.prototype.forEach=function(h,k){for(var l=
this.entries(),m;!(m=l.next()).done;)m=m.value,h.call(k,m[1],m[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var g=0;return e});
Ea("WeakSet",function(a){function b(c){this.j=new WeakMap;if(c){c=_.ua(c);for(var d;!(d=c.next()).done;)this.add(d.value)}}if(function(){if(!a||!Object.seal)return!1;try{var c=Object.seal({}),d=Object.seal({}),e=new a([c]);if(!e.has(c)||e.has(d))return!1;e["delete"](c);e.add(d);return!e.has(c)&&e.has(d)}catch(f){return!1}}())return a;b.prototype.add=function(c){this.j.set(c,!0);return this};b.prototype.has=function(c){return this.j.has(c)};b.prototype["delete"]=function(c){return this.j["delete"](c)};
return b});Ea("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});Ea("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var f=d[c];if(f===b||Object.is(f,b))return!0}return!1}});Ea("String.prototype.includes",function(a){return a?a:function(b,c){return-1!==Ga(this,b,"includes").indexOf(b,c||0)}});
Ea("Array.from",function(a){return a?a:function(b,c,d){c=null!=c?c:_.ma();var e=[],f="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];if("function"==typeof f){b=f.call(b);for(var g=0;!(f=b.next()).done;)e.push(c.call(d,f.value,g++))}else for(f=b.length,g=0;g<f;g++)e.push(c.call(d,b[g],g));return e}});Ea("Math.sign",function(a){return a?a:function(b){b=Number(b);return 0===b||isNaN(b)?b:0<b?1:-1}});Ea("Math.log2",function(a){return a?a:function(b){return Math.log(b)/Math.LN2}});
Ea("Math.hypot",function(a){return a?a:function(b){if(2>arguments.length)return arguments.length?Math.abs(arguments[0]):0;var c,d,e;for(c=e=0;c<arguments.length;c++)e=Math.max(e,Math.abs(arguments[c]));if(1E100<e||1E-100>e){if(!e)return e;for(c=d=0;c<arguments.length;c++){var f=Number(arguments[c])/e;d+=f*f}return Math.sqrt(d)*e}for(c=d=0;c<arguments.length;c++)f=Number(arguments[c]),d+=f*f;return Math.sqrt(d)}});
Ea("Math.log1p",function(a){return a?a:function(b){b=Number(b);if(.25>b&&-.25<b){for(var c=b,d=1,e=b,f=0,g=1;f!=e;)c*=b,g*=-1,e=(f=e)+g*c/++d;return e}return Math.log(1+b)}});Ea("Math.expm1",function(a){return a?a:function(b){b=Number(b);if(.25>b&&-.25<b){for(var c=b,d=1,e=b,f=0;f!=e;)c*=b/++d,e=(f=e)+c;return e}return Math.exp(b)-1}});var Qh="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Ha(d,e)&&(a[e]=d[e])}return a};
Ea("Object.assign",function(a){return a||Qh});
Ea("Set",function(a){function b(c){this.j=new Map;if(c){c=_.ua(c);for(var d;!(d=c.next()).done;)this.add(d.value)}this.size=this.j.size}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),d=new a(_.ua([c]));if(!d.has(c)||1!=d.size||d.add(c)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var e=d.entries(),f=e.next();if(f.done||f.value[0]!=c||f.value[1]!=c)return!1;f=e.next();return f.done||f.value[0]==c||4!=f.value[0].x||
f.value[1]!=f.value[0]?!1:e.next().done}catch(g){return!1}}())return a;(0,_.Da)();b.prototype.add=function(c){c=0===c?0:c;this.j.set(c,c);this.size=this.j.size;return this};b.prototype["delete"]=function(c){c=this.j["delete"](c);this.size=this.j.size;return c};b.prototype.clear=function(){this.j.clear();this.size=0};b.prototype.has=function(c){return this.j.has(c)};b.prototype.entries=function(){return this.j.entries()};b.prototype.values=function(){return this.j.values()};b.prototype.keys=b.prototype.values;
b.prototype[Symbol.iterator]=b.prototype.values;b.prototype.forEach=function(c,d){var e=this;this.j.forEach(function(f){return c.call(d,f,f,e)})};return b});Ea("Array.prototype.fill",function(a){return a?a:function(b,c,d){var e=this.length||0;0>c&&(c=Math.max(0,e+c));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(c=Number(c||0);c<d;c++)this[c]=b;return this}});_.y=this;Ma=/^[\w+/_-]+[=]{0,2}$/;Ka=null;Va="closure_uid_"+(1E9*Math.random()>>>0);Wa=0;a:{var Rh=_.y.navigator;if(Rh){var Sh=Rh.userAgent;if(Sh){_.ib=Sh;break a}}_.ib=""};ub[" "]=_.Pa;var Vh,di;_.Th=_.mb("Opera");_.Uh=_.ob();Vh=_.mb("Edge");_.Jf=_.mb("Gecko")&&!(_.jb()&&!_.mb("Edge"))&&!(_.mb("Trident")||_.mb("MSIE"))&&!_.mb("Edge");_.Kf=_.jb()&&!_.mb("Edge");_.Xh=_.mb("Macintosh");_.Yh=_.mb("Windows");_.Zh=_.mb("Linux")||_.mb("CrOS");_.$h=_.mb("Android");_.ai=tb();_.bi=_.mb("iPad");_.ci=_.mb("iPod");
a:{var ei="",fi=function(){var a=_.ib;if(_.Jf)return/rv:([^\);]+)(\)|;)/.exec(a);if(Vh)return/Edge\/([\d\.]+)/.exec(a);if(_.Uh)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(_.Kf)return/WebKit\/(\S+)/.exec(a);if(_.Th)return/(?:Version)[ \/]?(\S+)/.exec(a)}();fi&&(ei=fi?fi[1]:"");if(_.Uh){var gi=xb();if(null!=gi&&gi>parseFloat(ei)){di=String(gi);break a}}di=ei}var zb=di,vb={},hi;var ii=_.y.document;hi=ii&&_.Uh?xb()||("CSS1Compat"==ii.compatMode?parseInt(zb,10):5):void 0;var ni;_.ji=_.pb();_.ki=tb()||_.mb("iPod");_.li=_.mb("iPad");_.mi=_.qb();ni=_.sb()&&!(tb()||_.mb("iPad")||_.mb("iPod"));_.oi={sd:null,Wd:null,jf:null,Ze:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"};_.oi.Ag=_.oi.Ze+"+/=";_.oi.Bg=_.oi.Ze+"-_.";_.oi.xg=_.Jf||_.Kf&&!ni||_.Th;_.oi.Xi=_.oi.xg||"function"==typeof _.y.btoa;_.oi.Wi=_.oi.xg||!ni&&!_.Uh&&"function"==typeof _.y.atob;
_.oi.$d=function(a,b){_.Sa(a);_.oi.Ih();b=b?_.oi.jf:_.oi.sd;for(var c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,h=d+2<a.length,k=h?a[d+2]:0,l=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|k>>6;k&=63;h||(k=64,f||(g=64));c.push(b[l],b[e],b[g],b[k])}return c.join("")};_.oi.bk=function(a){if(_.oi.Xi)a=_.y.btoa(a);else{for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);255<e&&(b[c++]=e&255,e>>=8);b[c++]=e}a=_.oi.$d(b,void 0)}return a};
_.oi.Oj=function(a){if(_.oi.Wi)return _.y.atob(a);var b="";_.oi.nf(a,function(c){b+=String.fromCharCode(c)});return b};_.oi.Pj=function(a){var b=[];_.oi.nf(a,function(c){b.push(c)});return b};_.oi.Qj=function(a){var b=a.length,c=0;"="===a[b-2]?c=2:"="===a[b-1]&&(c=1);var d=new Uint8Array(Math.ceil(3*b/4)-c),e=0;_.oi.nf(a,function(f){d[e++]=f});return d.subarray(0,e)};
_.oi.nf=function(a,b){function c(k){for(;d<a.length;){var l=a.charAt(d++),m=_.oi.Wd[l];if(null!=m)return m;if(!/^[\s\xa0]*$/.test(l))throw Error("Unknown base64 encoding at char: "+l);}return k}_.oi.Ih();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}};
_.oi.Ih=function(){if(!_.oi.sd){_.oi.sd={};_.oi.Wd={};_.oi.jf={};for(var a=0;a<_.oi.Ag.length;a++)_.oi.sd[a]=_.oi.Ag.charAt(a),_.oi.Wd[_.oi.sd[a]]=a,_.oi.jf[a]=_.oi.Bg.charAt(a),a>=_.oi.Ze.length&&(_.oi.Wd[_.oi.Bg.charAt(a)]=a)}};Bb.prototype.get=function(){if(0<this.l){this.l--;var a=this.j;this.j=a.next;a.next=null}else a=this.m();return a};var Ob;var Pb=new Bb(function(){return new Hb},function(a){a.reset()});Gb.prototype.add=function(a,b){var c=Pb.get();c.set(a,b);this.l?this.l.next=c:this.j=c;this.l=c};Gb.prototype.remove=function(){var a=null;this.j&&(a=this.j,this.j=this.j.next,this.j||(this.l=null),a.next=null);return a};Hb.prototype.set=function(a,b){this.Qc=a;this.j=b;this.next=null};Hb.prototype.reset=function(){this.next=this.j=this.Qc=null};var Ib,Kb=!1,Lb=new Gb;_.Rb.prototype.oe=!0;_.Rb.prototype.j=_.ra(1);_.Rb.prototype.Eh=!0;_.Rb.prototype.l=_.ra(3);_.Qb={};_.Sb("about:blank");_.Ub.prototype.Eh=!0;_.Ub.prototype.l=_.ra(2);_.Ub.prototype.oe=!0;_.Ub.prototype.j=_.ra(0);var Tb={};_.Wb("<!DOCTYPE html>",0);var pi=_.Wb("",0);_.Wb("<br>",0);_.qi=Db(function(){var a=document.createElement("div"),b=document.createElement("div");b.appendChild(document.createElement("div"));a.appendChild(b);b=a.firstChild.firstChild;a.innerHTML=_.Vb(pi);return!b.parentElement});var ze="StopIteration"in _.y?_.y.StopIteration:{message:"StopIteration",stack:""};bc.prototype.next=function(){throw ze;};_.B(cc,bc);cc.prototype.setPosition=function(a,b,c){if(this.node=a)this.l=_.Ja(b)?b:1!=this.node.nodeType?0:this.j?-1:1;_.Ja(c)&&(this.depth=c)};
cc.prototype.next=function(){if(this.m){if(!this.node||this.A&&0==this.depth)throw ze;var a=this.node;var b=this.j?-1:1;if(this.l==b){var c=this.j?a.lastChild:a.firstChild;c?this.setPosition(c):this.setPosition(a,-1*b)}else(c=this.j?a.previousSibling:a.nextSibling)?this.setPosition(c):this.setPosition(a.parentNode,-1*b);this.depth+=this.l*(this.j?-1:1)}else this.m=!0;a=this.node;if(!this.node)throw ze;return a};cc.prototype.equals=function(a){return a.node==this.node&&(!this.node||a.l==this.l)};
cc.prototype.splice=function(a){var b=this.node,c=this.j?1:-1;this.l==c&&(this.l=-1*c,this.depth+=this.l*(this.j?-1:1));this.j=!this.j;cc.prototype.next.call(this);this.j=!this.j;c=_.Sa(arguments[0])?arguments[0]:arguments;for(var d=c.length-1;0<=d;d--)_.$b(c[d],b);_.ac(b)};_.B(dc,cc);dc.prototype.next=function(){do dc.Cb.next.call(this);while(-1==this.l);return this.node};_.jc.prototype.forEach=function(a,b){for(var c={type:"s",qc:0,Le:this.m?this.m[0]:"",Jd:!1,Jh:!1,value:null},d=1,e=this.l[1],f=2,g=1+this.Gb,h=this.j.length;g<h;){c.qc++;g==e&&(c.qc=this.l[f++],e=this.l[f++],g+=Math.ceil(Math.log10(c.qc+1)));var k=this.j.charCodeAt(g++),l=k&-33,m=c.type=ri[l];c.value=b&&b[c.qc+this.Gb];b&&null==c.value||(c.Jd=k==l,k=l-75,c.Jh=0<=l&&0<(4321&1<<k),a(c));"m"==m&&d<this.m.length&&(c.Le=this.m[d++])}};
var hc={},ic=/(\d+)/g,ri=[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"B","b",,"d","e","f","g","h","i","j","j",,"m","n","o","o","y","h","s",,"u","v","v","x","y","z"];var si;_.Kg=new kc;si=/'/g;kc.prototype.j=function(a,b){var c=[];mc(a,b,c);return c.join("&").replace(si,"%27")};_.F.prototype.clear=function(){this.B.length=0};_.F.prototype.equals=function(a){return _.gc(this.B,a?(a&&a).B:null)};_.F.prototype.ti=_.ra(4);_.F.prototype.jd=_.ra(5);_.B(uc,_.F);_.B(_.xc,_.F);_.B(yc,_.F);_.B(_.zc,_.F);_.zc.prototype.getStatus=function(){return _.oc(this,0)};var Jg;_.B(Ac,_.F);_.wg={};_.ti={ROADMAP:"roadmap",SATELLITE:"satellite",HYBRID:"hybrid",TERRAIN:"terrain"};_.vg={TOP_LEFT:1,TOP_CENTER:2,TOP:2,TOP_RIGHT:3,LEFT_CENTER:4,LEFT_TOP:5,LEFT:5,LEFT_BOTTOM:6,RIGHT_TOP:7,RIGHT:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM:11,BOTTOM_RIGHT:12,CENTER:13};_.B(Pc,Error);var ui,wi;_.bd=_.Yc(_.K,"not a number");ui=_.$c(_.bd,function(a){if(isNaN(a))throw _.Qc("NaN is not an accepted value");return a});_.vi=_.Yc(_.Lc,"not a string");wi=_.Yc(_.Mc,"not a boolean");_.xi=_.L(_.bd);_.yi=_.L(_.vi);_.zi=_.L(wi);_.Ai=new _.M(0,0);_.M.prototype.toString=function(){return"("+this.x+", "+this.y+")"};_.M.prototype.toString=_.M.prototype.toString;_.M.prototype.equals=function(a){return a?a.x==this.x&&a.y==this.y:!1};_.M.prototype.equals=_.M.prototype.equals;_.M.prototype.equals=_.M.prototype.equals;_.M.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y)};_.M.prototype.Kf=_.ra(6);_.Bi=new _.O(0,0);_.O.prototype.toString=function(){return"("+this.width+", "+this.height+")"};_.O.prototype.toString=_.O.prototype.toString;_.O.prototype.equals=function(a){return a?a.width==this.width&&a.height==this.height:!1};_.O.prototype.equals=_.O.prototype.equals;_.O.prototype.equals=_.O.prototype.equals;_.ed.prototype.equals=function(a){return a?this.S==a.S&&this.T==a.T:!1};_.Ci=new _.gd({yc:new _.fd(256),zc:void 0});hd.prototype.equals=function(a){return a?this.l==a.l&&this.m==a.m&&this.A==a.A&&this.C==a.C:!1};_.kd.prototype.isEmpty=function(){return!(this.V<this.aa&&this.X<this.ba)};_.kd.prototype.extend=function(a){a&&(this.V=Math.min(this.V,a.x),this.aa=Math.max(this.aa,a.x),this.X=Math.min(this.X,a.y),this.ba=Math.max(this.ba,a.y))};_.kd.prototype.getCenter=function(){return new _.M((this.V+this.aa)/2,(this.X+this.ba)/2)};_.kd.prototype.equals=function(a){return a?this.V==a.V&&this.X==a.X&&this.aa==a.aa&&this.ba==a.ba:!1};_.Di=_.ld(-Infinity,-Infinity,Infinity,Infinity);_.ld(0,0,0,0);var md=_.Sc({lat:_.bd,lng:_.bd},!0);_.P.prototype.toString=function(){return"("+this.lat()+", "+this.lng()+")"};_.P.prototype.toString=_.P.prototype.toString;_.P.prototype.toJSON=function(){return{lat:this.lat(),lng:this.lng()}};_.P.prototype.toJSON=_.P.prototype.toJSON;_.P.prototype.equals=function(a){return a?_.Gc(this.lat(),a.lat())&&_.Gc(this.lng(),a.lng()):!1};_.P.prototype.equals=_.P.prototype.equals;_.P.prototype.equals=_.P.prototype.equals;
_.P.prototype.toUrlValue=function(a){a=_.t(a)?a:6;return pd(this.lat(),a)+","+pd(this.lng(),a)};_.P.prototype.toUrlValue=_.P.prototype.toUrlValue;_.Ye=_.Xc(_.qd);_.p=rd.prototype;_.p.isEmpty=function(){return 360==this.j-this.l};_.p.intersects=function(a){var b=this.j,c=this.l;return this.isEmpty()||a.isEmpty()?!1:_.sd(this)?_.sd(a)||a.j<=this.l||a.l>=b:_.sd(a)?a.j<=c||a.l>=b:a.j<=c&&a.l>=b};_.p.contains=function(a){-180==a&&(a=180);var b=this.j,c=this.l;return _.sd(this)?(a>=b||a<=c)&&!this.isEmpty():a>=b&&a<=c};_.p.extend=function(a){this.contains(a)||(this.isEmpty()?this.j=this.l=a:_.td(a,this.j)<_.td(this.l,a)?this.j=a:this.l=a)};
_.p.equals=function(a){return 1E-9>=Math.abs(a.j-this.j)%360+Math.abs(_.ud(a)-_.ud(this))};_.p.center=function(){var a=(this.j+this.l)/2;_.sd(this)&&(a=_.Fc(a+180,-180,180));return a};_.p=vd.prototype;_.p.isEmpty=function(){return this.j>this.l};_.p.intersects=function(a){var b=this.j,c=this.l;return b<=a.j?a.j<=c&&a.j<=a.l:b<=a.l&&b<=c};_.p.contains=function(a){return a>=this.j&&a<=this.l};_.p.extend=function(a){this.isEmpty()?this.l=this.j=a:a<this.j?this.j=a:a>this.l&&(this.l=a)};
_.p.equals=function(a){return this.isEmpty()?a.isEmpty():1E-9>=Math.abs(a.j-this.j)+Math.abs(this.l-a.l)};_.p.center=function(){return(this.l+this.j)/2};_.Q.prototype.getCenter=function(){return new _.P(this.na.center(),this.ia.center())};_.Q.prototype.getCenter=_.Q.prototype.getCenter;_.Q.prototype.toString=function(){return"("+this.getSouthWest()+", "+this.getNorthEast()+")"};_.Q.prototype.toString=_.Q.prototype.toString;_.Q.prototype.toJSON=function(){return{south:this.na.j,west:this.ia.j,north:this.na.l,east:this.ia.l}};_.Q.prototype.toJSON=_.Q.prototype.toJSON;
_.Q.prototype.toUrlValue=function(a){var b=this.getSouthWest(),c=this.getNorthEast();return[b.toUrlValue(a),c.toUrlValue(a)].join()};_.Q.prototype.toUrlValue=_.Q.prototype.toUrlValue;_.Q.prototype.equals=function(a){if(!a)return!1;a=_.yd(a);return this.na.equals(a.na)&&this.ia.equals(a.ia)};_.Q.prototype.equals=_.Q.prototype.equals;_.Q.prototype.equals=_.Q.prototype.equals;_.Q.prototype.contains=function(a){a=_.qd(a);return this.na.contains(a.lat())&&this.ia.contains(a.lng())};
_.Q.prototype.contains=_.Q.prototype.contains;_.Q.prototype.intersects=function(a){a=_.yd(a);return this.na.intersects(a.na)&&this.ia.intersects(a.ia)};_.Q.prototype.intersects=_.Q.prototype.intersects;_.Q.prototype.extend=function(a){a=_.qd(a);this.na.extend(a.lat());this.ia.extend(a.lng());return this};_.Q.prototype.extend=_.Q.prototype.extend;_.Q.prototype.union=function(a){a=_.yd(a);if(!a||a.isEmpty())return this;this.extend(a.getSouthWest());this.extend(a.getNorthEast());return this};
_.Q.prototype.union=_.Q.prototype.union;_.Q.prototype.getSouthWest=function(){return new _.P(this.na.j,this.ia.j,!0)};_.Q.prototype.getSouthWest=_.Q.prototype.getSouthWest;_.Q.prototype.getNorthEast=function(){return new _.P(this.na.l,this.ia.l,!0)};_.Q.prototype.getNorthEast=_.Q.prototype.getNorthEast;_.Q.prototype.toSpan=function(){var a=this.na;a=a.isEmpty()?0:a.l-a.j;return new _.P(a,_.ud(this.ia),!0)};_.Q.prototype.toSpan=_.Q.prototype.toSpan;
_.Q.prototype.isEmpty=function(){return this.na.isEmpty()||this.ia.isEmpty()};_.Q.prototype.isEmpty=_.Q.prototype.isEmpty;var xd=_.Sc({south:_.bd,west:_.bd,north:_.bd,east:_.bd},!1);_.R={addListener:function(a,b,c){return new Id(a,b,c,0)}};_.bb("module$contents$MapsEvent_MapsEvent.addListener",_.R.addListener);_.R.hasListeners=function(a,b){if(!a)return!1;b=(a=a.__e3_)&&a[b];return!!b&&!_.nb(b)};_.R.removeListener=function(a){a&&a.remove()};_.bb("module$contents$MapsEvent_MapsEvent.removeListener",_.R.removeListener);_.R.clearListeners=function(a,b){_.Cc(Ed(a,b),function(c,d){d&&d.remove()})};_.bb("module$contents$MapsEvent_MapsEvent.clearListeners",_.R.clearListeners);
_.R.clearInstanceListeners=function(a){_.Cc(Ed(a),function(b,c){c&&c.remove()})};_.bb("module$contents$MapsEvent_MapsEvent.clearInstanceListeners",_.R.clearInstanceListeners);_.R.trigger=function(a,b,c){for(var d=[],e=2;e<arguments.length;++e)d[e-2]=arguments[e];if(_.R.hasListeners(a,b)){e=Ed(a,b);for(var f in e){var g=e[f];g&&g.A(d)}}};_.bb("module$contents$MapsEvent_MapsEvent.trigger",_.R.trigger);
_.R.addDomListener=function(a,b,c,d){var e=d?4:1;if(!a.addEventListener&&a.attachEvent)return c=new Id(a,b,c,2),a.attachEvent("on"+b,Jd(c)),c;a.addEventListener&&a.addEventListener(b,c,d);return new Id(a,b,c,e)};_.bb("module$contents$MapsEvent_MapsEvent.addDomListener",_.R.addDomListener);_.R.addDomListenerOnce=function(a,b,c,d){var e=_.R.addDomListener(a,b,function(){e.remove();return c.apply(this,arguments)},d);return e};_.bb("module$contents$MapsEvent_MapsEvent.addDomListenerOnce",_.R.addDomListenerOnce);
_.R.pa=function(a,b,c,d){return _.R.addDomListener(a,b,Fd(c,d))};_.R.bind=function(a,b,c,d){return _.R.addListener(a,b,(0,_.z)(d,c))};_.R.addListenerOnce=function(a,b,c){var d=_.R.addListener(a,b,function(){d.remove();return c.apply(this,arguments)});return d};_.bb("module$contents$MapsEvent_MapsEvent.addListenerOnce",_.R.addListenerOnce);_.R.ma=function(a,b,c){b=_.R.addListener(a,b,c);c.call(a);return b};_.R.forward=function(a,b,c){return _.R.addListener(a,b,Gd(b,c))};
_.R.Rc=function(a,b,c,d){_.R.addDomListener(a,b,Gd(b,c,!d))};var Hd=0;Id.prototype.remove=function(){if(this.l){if(this.l.removeEventListener)switch(this.C){case 1:this.l.removeEventListener(this.m,this.j,!1);break;case 4:this.l.removeEventListener(this.m,this.j,!0)}delete Dd(this.l,this.m)[this.id];this.j=this.l=null}};Id.prototype.A=function(a){return this.j.apply(this.l,a)};_.S.prototype.get=function(a){var b=Pd(this);a+="";b=Nc(b,a);if(_.t(b)){if(b){a=b.sb;b=b.Wc;var c="get"+_.Od(a);return b[c]?b[c]():b.get(a)}return this[a]}};_.S.prototype.get=_.S.prototype.get;_.S.prototype.set=function(a,b){var c=Pd(this);a+="";var d=Nc(c,a);if(d)if(a=d.sb,d=d.Wc,c="set"+_.Od(a),d[c])d[c](b);else d.set(a,b);else this[a]=b,c[a]=null,Md(this,a)};_.S.prototype.set=_.S.prototype.set;_.S.prototype.notify=function(a){var b=Pd(this);a+="";(b=Nc(b,a))?b.Wc.notify(b.sb):Md(this,a)};
_.S.prototype.notify=_.S.prototype.notify;_.S.prototype.setValues=function(a){for(var b in a){var c=a[b],d="set"+_.Od(b);if(this[d])this[d](c);else this.set(b,c)}};_.S.prototype.setValues=_.S.prototype.setValues;_.S.prototype.setOptions=_.S.prototype.setValues;_.S.prototype.changed=_.n();var Nd={};_.S.prototype.bindTo=function(a,b,c,d){a+="";c=(c||a)+"";this.unbind(a);var e={Wc:this,sb:a},f={Wc:b,sb:c,Rg:e};Pd(this)[a]=f;Ld(b,c)[_.Kd(e)]=e;d||Md(this,a)};_.S.prototype.bindTo=_.S.prototype.bindTo;
_.S.prototype.unbind=function(a){var b=Pd(this),c=b[a];c&&(c.Rg&&delete Ld(c.Wc,c.sb)[_.Kd(c.Rg)],this[a]=this.get(a),b[a]=null)};_.S.prototype.unbind=_.S.prototype.unbind;_.S.prototype.unbindAll=function(){var a=(0,_.z)(this.unbind,this),b=Pd(this),c;for(c in b)a(c)};_.S.prototype.unbindAll=_.S.prototype.unbindAll;_.S.prototype.addListener=function(a,b){return _.R.addListener(this,a,b)};_.S.prototype.addListener=_.S.prototype.addListener;_.Qd.prototype.addListener=function(a,b,c){c=c?{Xg:!1}:null;var d=!this.W.length,e=this.W.find(Td(a,b));e?e.once=e.once&&c:this.W.push({Qc:a,context:b||null,once:c});d&&this.l();return a};_.Qd.prototype.addListenerOnce=function(a,b){this.addListener(a,b,!0);return a};_.Qd.prototype.removeListener=function(a,b){if(this.W.length){var c=this.W;a=_.eb(c,Td(a,b),void 0);0<=a&&_.fb(c,a);this.W.length||this.j()}};var Rd=null;_.p=_.Ud.prototype;_.p.Ed=_.n();_.p.Dd=_.n();_.p.addListener=function(a,b){return this.W.addListener(a,b)};_.p.addListenerOnce=function(a,b){return this.W.addListenerOnce(a,b)};_.p.removeListener=function(a,b){return this.W.removeListener(a,b)};_.p.ma=function(a,b){this.W.addListener(a,b);a.call(b,this.get())};_.p.notify=function(a){_.Sd(this.W,function(b){b(this.get())},this,a)};_.B(_.Zd,_.S);_.Zd.prototype.getAt=function(a){return this.j[a]};_.Zd.prototype.getAt=_.Zd.prototype.getAt;_.Zd.prototype.indexOf=function(a){for(var b=0,c=this.j.length;b<c;++b)if(a===this.j[b])return b;return-1};_.Zd.prototype.forEach=function(a){for(var b=0,c=this.j.length;b<c;++b)a(this.j[b],b)};_.Zd.prototype.forEach=_.Zd.prototype.forEach;
_.Zd.prototype.setAt=function(a,b){var c=this.j[a],d=this.j.length;if(a<d)this.j[a]=b,_.R.trigger(this,"set_at",a,c),this.A&&this.A(a,c);else{for(c=d;c<a;++c)this.insertAt(c,void 0);this.insertAt(a,b)}};_.Zd.prototype.setAt=_.Zd.prototype.setAt;_.Zd.prototype.insertAt=function(a,b){this.j.splice(a,0,b);Yd(this);_.R.trigger(this,"insert_at",a);this.l&&this.l(a)};_.Zd.prototype.insertAt=_.Zd.prototype.insertAt;
_.Zd.prototype.removeAt=function(a){var b=this.j[a];this.j.splice(a,1);Yd(this);_.R.trigger(this,"remove_at",a,b);this.m&&this.m(a,b);return b};_.Zd.prototype.removeAt=_.Zd.prototype.removeAt;_.Zd.prototype.push=function(a){this.insertAt(this.j.length,a);return this.j.length};_.Zd.prototype.push=_.Zd.prototype.push;_.Zd.prototype.pop=function(){return this.removeAt(this.j.length-1)};_.Zd.prototype.pop=_.Zd.prototype.pop;_.Zd.prototype.getArray=_.oa("j");_.Zd.prototype.getArray=_.Zd.prototype.getArray;
_.Zd.prototype.clear=function(){for(;this.get("length");)this.pop()};_.Zd.prototype.clear=_.Zd.prototype.clear;_.Xd(_.Zd.prototype,{length:null});_.$d.prototype.remove=function(a){var b=this.l,c=_.Kd(a);b[c]&&(delete b[c],--this.m,_.R.trigger(this,"remove",a),this.onRemove&&this.onRemove(a))};_.$d.prototype.contains=function(a){return!!this.l[_.Kd(a)]};_.$d.prototype.forEach=function(a){var b=this.l,c;for(c in b)a.call(this,b[c])};_.be.prototype.Bb=function(a){a=_.ce(this,a);return a.length<this.j.length?new _.be(a):this};_.be.prototype.forEach=function(a,b){_.C(this.j,function(c,d){a.call(b,c,d)})};var Ei=_.Sc({zoom:_.L(ui),heading:ui,pitch:ui});_.B(_.ee,_.Ud);_.ee.prototype.set=function(a){this.C&&this.get()===a||(this.gi(a),this.notify())};_.B(_.fe,_.ee);_.fe.prototype.get=_.oa("j");_.fe.prototype.gi=_.na("j");_.B(_.he,_.S);_.B(ie,_.S);_.B(je,_.S);je.prototype.set=function(a,b){if(null!=b&&!(b&&_.K(b.maxZoom)&&b.tileSize&&b.tileSize.width&&b.tileSize.height&&b.getTile&&b.getTile.apply))throw Error("Expected value implementing google.maps.MapType");return _.S.prototype.set.apply(this,arguments)};je.prototype.set=je.prototype.set;_.B(_.ke,_.S);var Ih=_.Sc({center:function(a){return _.qd(a)},radius:_.bd},!0);/*
 
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:[email protected]
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
var le="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var oe,pe;oe={0:"",1:"msie",3:"chrome",4:"applewebkit",5:"firefox",6:"trident",7:"mozilla",2:"edge"};pe={0:"",1:"x11",2:"macintosh",3:"windows",4:"android",5:"iphone",6:"ipad"};_.re=null;"undefined"!=typeof navigator&&(_.re=new qe);se.prototype.l=Db(function(){var a=new Image;return _.t(a.crossOrigin)});se.prototype.m=Db(function(){return _.t(document.createElement("span").draggable)});_.Fi=_.re?new se:null;_.Gi=_.re?new ue:null;_.Hi=new WeakMap;_.B(_.Be,Ae);_.Be.prototype.getType=_.pa("Point");_.Be.prototype.getType=_.Be.prototype.getType;_.Be.prototype.forEachLatLng=function(a){a(this.j)};_.Be.prototype.forEachLatLng=_.Be.prototype.forEachLatLng;_.Be.prototype.get=_.oa("j");_.Be.prototype.get=_.Be.prototype.get;var We=_.Xc(Ce);He.prototype.ac=function(a,b){if(!this.j[a]){var c=this,d=c.D;Le(c.m,function(e){for(var f=e.j[a]||[],g=e.A[a]||[],h=d[a]=Oe(f.length,function(){delete d[a];b(e.l);for(var m=c.l[a],q=m?m.length:0,r=0;r<q;++r)m[r].Hb(c.j[a]);delete c.l[a];r=0;for(m=g.length;r<m;++r)q=g[r],d[q]&&d[q]()}),k=0,l=f.length;k<l;++k)c.j[f[k]]&&h()})}};He.l=void 0;He.j=function(){return He.l?He.l:He.l=new He};_.Qe.prototype.getId=_.oa("m");_.Qe.prototype.getId=_.Qe.prototype.getId;_.Qe.prototype.getGeometry=_.oa("j");_.Qe.prototype.getGeometry=_.Qe.prototype.getGeometry;_.Qe.prototype.setGeometry=function(a){var b=this.j;try{this.j=a?Ce(a):null}catch(c){_.Rc(c);return}_.R.trigger(this,"setgeometry",{feature:this,newGeometry:this.j,oldGeometry:b})};_.Qe.prototype.setGeometry=_.Qe.prototype.setGeometry;_.Qe.prototype.getProperty=function(a){return Nc(this.l,a)};_.Qe.prototype.getProperty=_.Qe.prototype.getProperty;
_.Qe.prototype.setProperty=function(a,b){if(void 0===b)this.removeProperty(a);else{var c=this.getProperty(a);this.l[a]=b;_.R.trigger(this,"setproperty",{feature:this,name:a,newValue:b,oldValue:c})}};_.Qe.prototype.setProperty=_.Qe.prototype.setProperty;_.Qe.prototype.removeProperty=function(a){var b=this.getProperty(a);delete this.l[a];_.R.trigger(this,"removeproperty",{feature:this,name:a,oldValue:b})};_.Qe.prototype.removeProperty=_.Qe.prototype.removeProperty;
_.Qe.prototype.forEachProperty=function(a){for(var b in this.l)a(this.getProperty(b),b)};_.Qe.prototype.forEachProperty=_.Qe.prototype.forEachProperty;_.Qe.prototype.toGeoJson=function(a){var b=this;_.T("data").then(function(c){c.m(b,a)})};_.Qe.prototype.toGeoJson=_.Qe.prototype.toGeoJson;var Ii={qn:"Point",on:"LineString",POLYGON:"Polygon"};var Ji={CIRCLE:0,FORWARD_CLOSED_ARROW:1,FORWARD_OPEN_ARROW:2,BACKWARD_CLOSED_ARROW:3,BACKWARD_OPEN_ARROW:4};_.p=Re.prototype;_.p.contains=function(a){return this.j.hasOwnProperty(_.Kd(a))};_.p.getFeatureById=function(a){return Nc(this.l,a)};
_.p.add=function(a){a=a||{};a=a instanceof _.Qe?a:new _.Qe(a);if(!this.contains(a)){var b=a.getId();if(b){var c=this.getFeatureById(b);c&&this.remove(c)}c=_.Kd(a);this.j[c]=a;b&&(this.l[b]=a);var d=_.R.forward(a,"setgeometry",this),e=_.R.forward(a,"setproperty",this),f=_.R.forward(a,"removeproperty",this);this.m[c]=function(){_.R.removeListener(d);_.R.removeListener(e);_.R.removeListener(f)};_.R.trigger(this,"addfeature",{feature:a})}return a};
_.p.remove=function(a){var b=_.Kd(a),c=a.getId();if(this.j[b]){delete this.j[b];c&&delete this.l[c];if(c=this.m[b])delete this.m[b],c();_.R.trigger(this,"removefeature",{feature:a})}};_.p.forEach=function(a){for(var b in this.j)a(this.j[b])};_.jf="click dblclick mousedown mousemove mouseout mouseover mouseup rightclick".split(" ");Se.prototype.get=function(a){return this.j[a]};Se.prototype.set=function(a,b){var c=this.j;c[a]||(c[a]={});_.Dc(c[a],b);_.R.trigger(this,"changed",a)};Se.prototype.reset=function(a){delete this.j[a];_.R.trigger(this,"changed",a)};Se.prototype.forEach=function(a){_.Cc(this.j,a)};_.B(Te,_.S);Te.prototype.overrideStyle=function(a,b){this.j.set(_.Kd(a),b)};Te.prototype.revertStyle=function(a){a?this.j.reset(_.Kd(a)):this.j.forEach((0,_.z)(this.j.reset,this.j))};_.B(_.Xe,Ae);_.Xe.prototype.getType=_.pa("GeometryCollection");_.Xe.prototype.getType=_.Xe.prototype.getType;_.Xe.prototype.getLength=function(){return this.j.length};_.Xe.prototype.getLength=_.Xe.prototype.getLength;_.Xe.prototype.getAt=function(a){return this.j[a]};_.Xe.prototype.getAt=_.Xe.prototype.getAt;_.Xe.prototype.getArray=function(){return this.j.slice()};_.Xe.prototype.getArray=_.Xe.prototype.getArray;_.Xe.prototype.forEachLatLng=function(a){this.j.forEach(function(b){b.forEachLatLng(a)})};
_.Xe.prototype.forEachLatLng=_.Xe.prototype.forEachLatLng;_.B(_.Ze,Ae);_.Ze.prototype.getType=_.pa("LineString");_.Ze.prototype.getType=_.Ze.prototype.getType;_.Ze.prototype.getLength=function(){return this.j.length};_.Ze.prototype.getLength=_.Ze.prototype.getLength;_.Ze.prototype.getAt=function(a){return this.j[a]};_.Ze.prototype.getAt=_.Ze.prototype.getAt;_.Ze.prototype.getArray=function(){return this.j.slice()};_.Ze.prototype.getArray=_.Ze.prototype.getArray;_.Ze.prototype.forEachLatLng=function(a){this.j.forEach(a)};_.Ze.prototype.forEachLatLng=_.Ze.prototype.forEachLatLng;
var af=_.Xc(_.Vc(_.Ze,"google.maps.Data.LineString",!0));_.B(_.$e,Ae);_.$e.prototype.getType=_.pa("LinearRing");_.$e.prototype.getType=_.$e.prototype.getType;_.$e.prototype.getLength=function(){return this.j.length};_.$e.prototype.getLength=_.$e.prototype.getLength;_.$e.prototype.getAt=function(a){return this.j[a]};_.$e.prototype.getAt=_.$e.prototype.getAt;_.$e.prototype.getArray=function(){return this.j.slice()};_.$e.prototype.getArray=_.$e.prototype.getArray;_.$e.prototype.forEachLatLng=function(a){this.j.forEach(a)};_.$e.prototype.forEachLatLng=_.$e.prototype.forEachLatLng;
var df=_.Xc(_.Vc(_.$e,"google.maps.Data.LinearRing",!0));_.B(_.bf,Ae);_.bf.prototype.getType=_.pa("MultiLineString");_.bf.prototype.getType=_.bf.prototype.getType;_.bf.prototype.getLength=function(){return this.j.length};_.bf.prototype.getLength=_.bf.prototype.getLength;_.bf.prototype.getAt=function(a){return this.j[a]};_.bf.prototype.getAt=_.bf.prototype.getAt;_.bf.prototype.getArray=function(){return this.j.slice()};_.bf.prototype.getArray=_.bf.prototype.getArray;_.bf.prototype.forEachLatLng=function(a){this.j.forEach(function(b){b.forEachLatLng(a)})};
_.bf.prototype.forEachLatLng=_.bf.prototype.forEachLatLng;_.B(_.cf,Ae);_.cf.prototype.getType=_.pa("MultiPoint");_.cf.prototype.getType=_.cf.prototype.getType;_.cf.prototype.getLength=function(){return this.j.length};_.cf.prototype.getLength=_.cf.prototype.getLength;_.cf.prototype.getAt=function(a){return this.j[a]};_.cf.prototype.getAt=_.cf.prototype.getAt;_.cf.prototype.getArray=function(){return this.j.slice()};_.cf.prototype.getArray=_.cf.prototype.getArray;_.cf.prototype.forEachLatLng=function(a){this.j.forEach(a)};_.cf.prototype.forEachLatLng=_.cf.prototype.forEachLatLng;_.B(_.ef,Ae);_.ef.prototype.getType=_.pa("Polygon");_.ef.prototype.getType=_.ef.prototype.getType;_.ef.prototype.getLength=function(){return this.j.length};_.ef.prototype.getLength=_.ef.prototype.getLength;_.ef.prototype.getAt=function(a){return this.j[a]};_.ef.prototype.getAt=_.ef.prototype.getAt;_.ef.prototype.getArray=function(){return this.j.slice()};_.ef.prototype.getArray=_.ef.prototype.getArray;_.ef.prototype.forEachLatLng=function(a){this.j.forEach(function(b){b.forEachLatLng(a)})};
_.ef.prototype.forEachLatLng=_.ef.prototype.forEachLatLng;var ff=_.Xc(_.Vc(_.ef,"google.maps.Data.Polygon",!0));_.B(_.gf,Ae);_.gf.prototype.getType=_.pa("MultiPolygon");_.gf.prototype.getType=_.gf.prototype.getType;_.gf.prototype.getLength=function(){return this.j.length};_.gf.prototype.getLength=_.gf.prototype.getLength;_.gf.prototype.getAt=function(a){return this.j[a]};_.gf.prototype.getAt=_.gf.prototype.getAt;_.gf.prototype.getArray=function(){return this.j.slice()};_.gf.prototype.getArray=_.gf.prototype.getArray;_.gf.prototype.forEachLatLng=function(a){this.j.forEach(function(b){b.forEachLatLng(a)})};
_.gf.prototype.forEachLatLng=_.gf.prototype.forEachLatLng;_.Ki=_.L(_.Vc(_.ke,"Map"));_.B(kf,_.S);kf.prototype.contains=function(a){return this.j.contains(a)};kf.prototype.contains=kf.prototype.contains;kf.prototype.getFeatureById=function(a){return this.j.getFeatureById(a)};kf.prototype.getFeatureById=kf.prototype.getFeatureById;kf.prototype.add=function(a){return this.j.add(a)};kf.prototype.add=kf.prototype.add;kf.prototype.remove=function(a){this.j.remove(a)};kf.prototype.remove=kf.prototype.remove;kf.prototype.forEach=function(a){this.j.forEach(a)};kf.prototype.forEach=kf.prototype.forEach;
kf.prototype.addGeoJson=function(a,b){return _.hf(this.j,a,b)};kf.prototype.addGeoJson=kf.prototype.addGeoJson;kf.prototype.loadGeoJson=function(a,b,c){var d=this.j;_.T("data").then(function(e){e.A(d,a,b,c)})};kf.prototype.loadGeoJson=kf.prototype.loadGeoJson;kf.prototype.toGeoJson=function(a){var b=this.j;_.T("data").then(function(c){c.l(b,a)})};kf.prototype.toGeoJson=kf.prototype.toGeoJson;kf.prototype.overrideStyle=function(a,b){this.l.overrideStyle(a,b)};kf.prototype.overrideStyle=kf.prototype.overrideStyle;
kf.prototype.revertStyle=function(a){this.l.revertStyle(a)};kf.prototype.revertStyle=kf.prototype.revertStyle;kf.prototype.controls_changed=function(){this.get("controls")&&lf(this)};kf.prototype.drawingMode_changed=function(){this.get("drawingMode")&&lf(this)};_.Xd(kf.prototype,{map:_.Ki,style:_.Cb,controls:_.L(_.Xc(_.Wc(Ii))),controlPosition:_.L(_.Wc(_.vg)),drawingMode:_.L(_.Wc(Ii))});_.Li={METRIC:0,IMPERIAL:1};_.Mi={DRIVING:"DRIVING",WALKING:"WALKING",BICYCLING:"BICYCLING",TRANSIT:"TRANSIT"};_.Ni={BEST_GUESS:"bestguess",OPTIMISTIC:"optimistic",PESSIMISTIC:"pessimistic"};_.Oi={BUS:"BUS",RAIL:"RAIL",SUBWAY:"SUBWAY",TRAIN:"TRAIN",TRAM:"TRAM"};_.Pi={LESS_WALKING:"LESS_WALKING",FEWER_TRANSFERS:"FEWER_TRANSFERS"};var Qi=_.Sc({routes:_.Xc(_.Yc(_.Kc))},!0);var Ie={main:[],common:["main"],util:["common"],adsense:["main"],controls:["util"],data:["util"],directions:["util","geometry"],distance_matrix:["util"],drawing:["main"],drawing_impl:["controls"],elevation:["util","geometry"],geocoder:["util"],imagery_viewer:["main"],geometry:["main"],discovery:["main"],infowindow:["util"],kml:["onion","util","map"],layers:["map"],map:["common"],marker:["util"],maxzoom:["util"],onion:["util","map"],overlay:["common"],panoramio:["main"],places:["main"],places_impl:["controls"],
poly:["util","map","geometry"],search:["main"],search_impl:["onion"],stats:["util"],streetview:["util","geometry"],usage:["util"],visualization:["main"],visualization_impl:["onion"],weather:["main"],zombie:["main"]};var Ri=_.y.google.maps,Si=He.j(),Ti=(0,_.z)(Si.ac,Si);Ri.__gjsload__=Ti;_.Cc(Ri.modules,Ti);delete Ri.modules;var Ui=_.Sc({source:_.vi,webUrl:_.yi,iosDeepLinkId:_.yi});var Vi=_.$c(_.Sc({placeId:_.yi,query:_.yi,location:_.qd}),function(a){if(a.placeId&&a.query)throw _.Qc("cannot set both placeId and query");if(!a.placeId&&!a.query)throw _.Qc("must set one of placeId or query");return a});_.B(pf,_.S);
_.Xd(pf.prototype,{position:_.L(_.qd),title:_.yi,icon:_.L(_.Zc([_.vi,{wg:ad("url"),then:_.Sc({url:_.vi,scaledSize:_.L(dd),size:_.L(dd),origin:_.L(cd),anchor:_.L(cd),labelOrigin:_.L(cd),path:_.Yc(function(a){return null==a})},!0)},{wg:ad("path"),then:_.Sc({path:_.Zc([_.vi,_.Wc(Ji)]),anchor:_.L(cd),labelOrigin:_.L(cd),fillColor:_.yi,fillOpacity:_.xi,rotation:_.xi,scale:_.xi,strokeColor:_.yi,strokeOpacity:_.xi,strokeWeight:_.xi,url:_.Yc(function(a){return null==a})},!0)}])),label:_.L(_.Zc([_.vi,{wg:ad("text"),
then:_.Sc({text:_.vi,fontSize:_.yi,fontWeight:_.yi,fontFamily:_.yi},!0)}])),shadow:_.Cb,shape:_.Cb,cursor:_.yi,clickable:_.zi,animation:_.Cb,draggable:_.zi,visible:_.zi,flat:_.Cb,zIndex:_.xi,opacity:_.xi,place:_.L(Vi),attribution:_.L(Ui)});var Wi=_.L(_.Vc(_.he,"StreetViewPanorama"));_.B(_.qf,pf);_.qf.prototype.map_changed=function(){var a=this.get("map");a=a&&a.__gm.fa;this.__gm.set!==a&&(this.__gm.set&&this.__gm.set.remove(this),(this.__gm.set=a)&&_.ae(a,this))};_.qf.MAX_ZINDEX=1E6;_.Xd(_.qf.prototype,{map:_.Zc([_.Ki,Wi])});_.B(rf,_.S);_.p=rf.prototype;_.p.internalAnchor_changed=function(){var a=this.get("internalAnchor");sf(this,"attribution",a);sf(this,"place",a);sf(this,"internalAnchorMap",a,"map");sf(this,"internalAnchorPoint",a,"anchorPoint");a instanceof _.qf?sf(this,"internalAnchorPosition",a,"internalPosition"):sf(this,"internalAnchorPosition",a,"position")};
_.p.internalAnchorPoint_changed=rf.prototype.internalPixelOffset_changed=function(){var a=this.get("internalAnchorPoint")||_.Ai,b=this.get("internalPixelOffset")||_.Bi;this.set("pixelOffset",new _.O(b.width+Math.round(a.x),b.height+Math.round(a.y)))};_.p.internalAnchorPosition_changed=function(){var a=this.get("internalAnchorPosition");a&&this.set("position",a)};_.p.internalAnchorMap_changed=function(){this.get("internalAnchor")&&this.j.set("map",this.get("internalAnchorMap"))};
_.p.Al=function(){var a=this.get("internalAnchor");!this.j.get("map")&&a&&a.get("map")&&this.set("internalAnchor",null)};_.p.internalContent_changed=function(){this.set("content",mf(this.get("internalContent")))};_.p.trigger=function(a){_.R.trigger(this.j,a)};_.p.close=function(){this.j.set("map",null)};_.B(_.tf,_.S);_.Xd(_.tf.prototype,{content:_.Zc([_.yi,_.Yc(Tc)]),position:_.L(_.qd),size:_.L(dd),map:_.Zc([_.Ki,Wi]),anchor:_.L(_.Vc(_.S,"MVCObject")),zIndex:_.xi});_.tf.prototype.open=function(a,b){this.set("anchor",b);b?!this.get("map")&&a&&this.set("map",a):this.set("map",a)};_.tf.prototype.open=_.tf.prototype.open;_.tf.prototype.close=function(){this.set("map",null)};_.tf.prototype.close=_.tf.prototype.close;_.uf=[];_.B(wf,_.S);wf.prototype.changed=function(a){var b=this;"map"!=a&&"panel"!=a||_.T("directions").then(function(c){c.Gk(b,a)});"panel"==a&&_.vf(this.getPanel())};_.Xd(wf.prototype,{directions:Qi,map:_.Ki,panel:_.L(_.Yc(Tc)),routeIndex:_.xi});xf.prototype.route=function(a,b){_.T("directions").then(function(c){c.di(a,b,!0)})};xf.prototype.route=xf.prototype.route;yf.prototype.getDistanceMatrix=function(a,b){_.T("distance_matrix").then(function(c){c.j(a,b)})};yf.prototype.getDistanceMatrix=yf.prototype.getDistanceMatrix;zf.prototype.getElevationAlongPath=function(a,b){_.T("elevation").then(function(c){c.getElevationAlongPath(a,b)})};zf.prototype.getElevationAlongPath=zf.prototype.getElevationAlongPath;zf.prototype.getElevationForLocations=function(a,b){_.T("elevation").then(function(c){c.getElevationForLocations(a,b)})};zf.prototype.getElevationForLocations=zf.prototype.getElevationForLocations;_.Xi=_.Vc(_.Q,"LatLngBounds");Af.prototype.geocode=function(a,b){_.T("geocoder").then(function(c){c.geocode(a,b)})};Af.prototype.geocode=Af.prototype.geocode;_.B(_.Bf,_.S);_.Bf.prototype.map_changed=function(){var a=this;_.T("kml").then(function(b){b.j(a)})};_.Xd(_.Bf.prototype,{map:_.Ki,url:null,bounds:null,opacity:_.xi});_.Yi={UNKNOWN:"UNKNOWN",OK:_.ha,INVALID_REQUEST:_.ba,DOCUMENT_NOT_FOUND:"DOCUMENT_NOT_FOUND",FETCH_ERROR:"FETCH_ERROR",INVALID_DOCUMENT:"INVALID_DOCUMENT",DOCUMENT_TOO_LARGE:"DOCUMENT_TOO_LARGE",LIMITS_EXCEEDED:"LIMITS_EXECEEDED",TIMED_OUT:"TIMED_OUT"};_.B(Cf,_.S);Cf.prototype.D=function(){var a=this;_.T("kml").then(function(b){b.l(a)})};Cf.prototype.url_changed=Cf.prototype.D;Cf.prototype.map_changed=Cf.prototype.D;Cf.prototype.zIndex_changed=Cf.prototype.D;_.Xd(Cf.prototype,{map:_.Ki,defaultViewport:null,metadata:null,status:null,url:_.yi,screenOverlays:_.zi,zIndex:_.xi});_.Df.prototype.fromLatLngToPoint=function(a,b){b=b||new _.M(0,0);var c=this.j;b.x=c.x+a.lng()*this.m;a=_.Ec(Math.sin(_.Xb(a.lat())),-(1-1E-15),1-1E-15);b.y=c.y+.5*Math.log((1+a)/(1-a))*-this.A;return b};_.Df.prototype.fromPointToLatLng=function(a,b){var c=this.j;return new _.P(_.Yb(2*Math.atan(Math.exp((a.y-c.y)/-this.A))-Math.PI/2),(a.x-c.x)/this.m,b)};_.Zi=Math.sqrt(2);_.$i=new _.Df;_.B(_.Ef,_.S);_.Xd(_.Ef.prototype,{map:_.Ki});_.B(Ff,_.S);_.Xd(Ff.prototype,{map:_.Ki});_.B(Gf,_.S);_.Xd(Gf.prototype,{map:_.Ki});_.Hf.prototype.D=!1;_.Hf.prototype.dispose=function(){this.D||(this.D=!0,this.jb())};_.Hf.prototype.jb=function(){if(this.F)for(;this.F.length;)this.F.shift()()};_.If.prototype.stopPropagation=function(){this.j=!0};_.If.prototype.preventDefault=function(){this.defaultPrevented=!0;this.bi=!1};var eg=!_.Uh||9<=Number(hi),aj=_.Uh&&!_.Ab("9"),ag=function(){if(!_.y.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{_.y.addEventListener("test",_.Pa,b),_.y.removeEventListener("test",_.Pa,b)}catch(c){}return a}();_.B(_.Mf,_.If);var Lf={2:"touch",3:"pen",4:"mouse"};_.Mf.prototype.stopPropagation=function(){_.Mf.Cb.stopPropagation.call(this);this.l.stopPropagation?this.l.stopPropagation():this.l.cancelBubble=!0};_.Mf.prototype.preventDefault=function(){_.Mf.Cb.preventDefault.call(this);var a=this.l;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,aj)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Wf="closure_listenable_"+(1E6*Math.random()|0),Nf=0;Qf.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.listeners[f];a||(a=this.listeners[f]=[],this.j++);var g=Sf(a,b,d,e);-1<g?(b=a[g],c||(b.Ud=!1)):(b=new Of(b,this.src,f,!!d,e),b.Ud=c,a.push(b));return b};Qf.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.listeners))return!1;var e=this.listeners[a];b=Sf(e,b,c,d);return-1<b?(Pf(e[b]),_.fb(e,b),0==e.length&&(delete this.listeners[a],this.j--),!0):!1};var Zf="closure_lm_"+(1E6*Math.random()|0),hg={},cg=0,kg="__closure_events_fn_"+(1E9*Math.random()>>>0);_.B(_.lg,_.Hf);_.lg.prototype[Wf]=!0;_.lg.prototype.addEventListener=function(a,b,c,d){_.Uf(this,a,b,c,d)};_.lg.prototype.removeEventListener=function(a,b,c,d){fg(this,a,b,c,d)};_.lg.prototype.jb=function(){_.lg.Cb.jb.call(this);if(this.A){var a=this.A,b=0,c;for(c in a.listeners){for(var d=a.listeners[c],e=0;e<d.length;e++)++b,Pf(d[e]);delete a.listeners[c];a.j--}}this.H=null};_.lg.prototype.listen=function(a,b,c,d){return this.A.add(String(a),b,!1,c,d)};_.B(_.ng,_.Hf);_.p=_.ng.prototype;_.p.Wb=0;_.p.jb=function(){_.ng.Cb.jb.call(this);this.stop();delete this.j;delete this.l};_.p.start=function(a){this.stop();this.Wb=_.mg(this.m,_.t(a)?a:this.A)};_.p.stop=function(){0!=this.Wb&&_.y.clearTimeout(this.Wb);this.Wb=0};_.p.Ma=function(){this.stop();this.Bh()};_.p.Bh=function(){this.Wb=0;this.j&&this.j.call(this.l)};_.bj=!!(_.y.requestAnimationFrame&&_.y.performance&&_.y.performance.now);_.cj=new WeakMap;_.rg.prototype.equals=function(a){return this==a||a instanceof _.rg&&this.size.L==a.size.L&&this.size.O==a.size.O&&this.heading==a.heading&&this.tilt==a.tilt};_.dj=new _.rg({L:256,O:256},0,0);_.ug={japan_prequake:20,japan_postquake2010:24};_.ej={NEAREST:"nearest",BEST:"best"};_.fj={DEFAULT:"default",OUTDOOR:"outdoor"};_.B(xg,_.he);xg.prototype.visible_changed=function(){var a=this,b=!!this.get("visible"),c=!1;this.j.get()!=b&&(this.j.set(b),c=b);b&&(this.A=this.A||new Promise(function(d){_.T("streetview").then(function(e){if(a.m)var f=a.m;d(e.Sl(a,a.j,a.D,f))})}),c&&this.A.then(function(d){return d.nm()}))};_.Xd(xg.prototype,{visible:_.zi,pano:_.yi,position:_.L(_.qd),pov:_.L(Ei),motionTracking:wi,photographerPov:null,location:null,links:_.Xc(_.Yc(_.Kc)),status:null,zoom:_.xi,enableCloseButton:_.zi});
xg.prototype.registerPanoProvider=function(a,b){this.set("panoProvider",{Xh:a,options:b||{}})};xg.prototype.registerPanoProvider=xg.prototype.registerPanoProvider;yg.prototype.register=function(a){var b=this.A;var c=b.length;if(!c||a.zIndex>=b[0].zIndex)var d=0;else if(a.zIndex>=b[c-1].zIndex){for(d=0;1<c-d;){var e=d+c>>1;a.zIndex>=b[e].zIndex?c=e:d=e}d=c}else d=c;b.splice(d,0,a)};_.B(zg,ie);var Ig;_.B(Bg,_.F);var Hg;_.B(Cg,_.F);_.B(Dg,_.F);_.B(Eg,_.F);var Gg;_.B(Fg,_.F);Fg.prototype.getZoom=function(){return _.G(this,2)};Fg.prototype.setZoom=function(a){this.B[2]=a};_.B(Rg,_.S);var Sg={roadmap:0,satellite:2,hybrid:3,terrain:4},Og={0:1,2:2,3:2,4:2};_.p=Rg.prototype;_.p.uh=_.Vd("center");_.p.Gg=_.Vd("zoom");_.p.af=_.Vd("size");_.p.changed=function(){var a=this.uh(),b=this.Gg(),c=Mg(this),d=!!this.af();if(a&&!a.equals(this.ca)||this.K!=b||this.ja!=c||this.C!=d)this.m||_.Ng(this.l),_.og(this.U),this.K=b,this.ja=c,this.C=d;this.ca=a};
_.p.div_changed=function(){var a=this.get("div"),b=this.j;if(a)if(b)a.appendChild(b);else{b=this.j=document.createElement("div");b.style.overflow="hidden";var c=this.l=document.createElement("img");_.R.addDomListener(b,"contextmenu",function(d){_.Ad(d);_.Cd(d)});c.ontouchstart=c.ontouchmove=c.ontouchend=c.ontouchcancel=function(d){_.Bd(d);_.Cd(d)};_.ve(c,_.Bi);a.appendChild(b);this.U.Ma()}else b&&(_.Ng(b),this.j=null)};var Wg=null;_.B(Xg,_.ke);Xg.j=Object.freeze({latLngBounds:new _.Q(new _.P(-85,-180),new _.P(85,180)),strictBounds:!0});Xg.prototype.streetView_changed=function(){var a=this.get("streetView");a?a.set("standAlone",!1):this.set("streetView",this.__gm.F)};Xg.prototype.getDiv=function(){return this.__gm.Z};Xg.prototype.getDiv=Xg.prototype.getDiv;Xg.prototype.panBy=function(a,b){var c=this.__gm;Wg?_.R.trigger(c,"panby",a,b):_.T("map").then(function(){_.R.trigger(c,"panby",a,b)})};Xg.prototype.panBy=Xg.prototype.panBy;
Xg.prototype.panTo=function(a){var b=this.__gm;a=_.qd(a);Wg?_.R.trigger(b,"panto",a):_.T("map").then(function(){_.R.trigger(b,"panto",a)})};Xg.prototype.panTo=Xg.prototype.panTo;Xg.prototype.panToBounds=function(a,b){var c=this.__gm,d=_.yd(a);Wg?_.R.trigger(c,"pantolatlngbounds",d,b):_.T("map").then(function(){_.R.trigger(c,"pantolatlngbounds",d,b)})};Xg.prototype.panToBounds=Xg.prototype.panToBounds;
Xg.prototype.fitBounds=function(a,b){var c=this,d=_.yd(a);Wg?Wg.fitBounds(this,d,b):_.T("map").then(function(e){e.fitBounds(c,d,b)})};Xg.prototype.fitBounds=Xg.prototype.fitBounds;
_.Xd(Xg.prototype,{bounds:null,streetView:Wi,center:_.L(_.qd),zoom:_.xi,restriction:function(a){if(null==a)return null;a=_.Sc({strictBounds:_.zi,latLngBounds:_.yd})(a);var b=a.latLngBounds;if(!(b.na.l>b.na.j))throw _.Qc("south latitude must be smaller than north latitude");if((-180==b.ia.l?180:b.ia.l)==b.ia.j)throw _.Qc("eastern longitude cannot equal western longitude");return a},mapTypeId:_.yi,projection:null,heading:_.xi,tilt:_.xi,clickableIcons:wi});Yg.prototype.getMaxZoomAtLatLng=function(a,b){_.T("maxzoom").then(function(c){c.getMaxZoomAtLatLng(a,b)})};Yg.prototype.getMaxZoomAtLatLng=Yg.prototype.getMaxZoomAtLatLng;_.B(Zg,_.S);Zg.prototype.changed=function(a){var b=this;"suppressInfoWindows"!=a&&"clickable"!=a&&_.T("onion").then(function(c){c.j(b)})};_.Xd(Zg.prototype,{map:_.Ki,tableId:_.xi,query:_.L(_.Zc([_.vi,_.Yc(_.Kc,"not an Object")]))});var gj=null;_.B(_.$g,_.S);_.$g.prototype.map_changed=function(){var a=this;gj?gj.Kg(this):_.T("overlay").then(function(b){gj=b;b.Kg(a)})};_.$g.preventMapHitsFrom=function(a){_.T("overlay").then(function(b){gj=b;b.preventMapHitsFrom(a)})};_.bb("module$contents$mapsapi$overlay$OverlayView_OverlayView.preventMapHitsFrom",_.$g.preventMapHitsFrom);_.$g.preventMapHitsAndGesturesFrom=function(a){_.T("overlay").then(function(b){gj=b;b.preventMapHitsAndGesturesFrom(a)})};
_.bb("module$contents$mapsapi$overlay$OverlayView_OverlayView.preventMapHitsAndGesturesFrom",_.$g.preventMapHitsAndGesturesFrom);_.Xd(_.$g.prototype,{panes:null,projection:null,map:_.Zc([_.Ki,Wi])});var ch=eh(_.Vc(_.P,"LatLng"));_.B(_.gh,_.S);_.gh.prototype.map_changed=_.gh.prototype.visible_changed=function(){var a=this;_.T("poly").then(function(b){b.j(a)})};_.gh.prototype.center_changed=function(){_.R.trigger(this,"bounds_changed")};_.gh.prototype.radius_changed=_.gh.prototype.center_changed;_.gh.prototype.getBounds=function(){var a=this.get("radius"),b=this.get("center");if(b&&_.K(a)){var c=this.get("map");c=c&&c.__gm.get("baseMapType");return _.tg(b,a/_.bh(c))}return null};_.gh.prototype.getBounds=_.gh.prototype.getBounds;
_.Xd(_.gh.prototype,{center:_.L(_.qd),draggable:_.zi,editable:_.zi,map:_.Ki,radius:_.xi,visible:_.zi});_.B(hh,_.S);hh.prototype.map_changed=hh.prototype.visible_changed=function(){var a=this;_.T("poly").then(function(b){b.l(a)})};hh.prototype.getPath=function(){return this.get("latLngs").getAt(0)};hh.prototype.getPath=hh.prototype.getPath;hh.prototype.setPath=function(a){try{this.get("latLngs").setAt(0,dh(a))}catch(b){_.Rc(b)}};hh.prototype.setPath=hh.prototype.setPath;_.Xd(hh.prototype,{draggable:_.zi,editable:_.zi,map:_.Ki,visible:_.zi});_.B(_.ih,hh);_.ih.prototype.Za=!0;_.ih.prototype.getPaths=function(){return this.get("latLngs")};_.ih.prototype.getPaths=_.ih.prototype.getPaths;_.ih.prototype.setPaths=function(a){this.set("latLngs",fh(a))};_.ih.prototype.setPaths=_.ih.prototype.setPaths;_.B(_.jh,hh);_.jh.prototype.Za=!1;_.B(_.kh,_.S);_.kh.prototype.map_changed=_.kh.prototype.visible_changed=function(){var a=this;_.T("poly").then(function(b){b.m(a)})};_.Xd(_.kh.prototype,{draggable:_.zi,editable:_.zi,bounds:_.L(_.yd),map:_.Ki,visible:_.zi});_.B(lh,_.S);lh.prototype.map_changed=function(){var a=this;_.T("streetview").then(function(b){b.yj(a)})};_.Xd(lh.prototype,{map:_.Ki});_.mh.prototype.getPanorama=function(a,b){var c=this.j||void 0;_.T("streetview").then(function(d){_.T("geometry").then(function(e){d.qk(a,b,e.computeHeading,e.computeOffset,c)})})};_.mh.prototype.getPanorama=_.mh.prototype.getPanorama;_.mh.prototype.getPanoramaByLocation=function(a,b,c){this.getPanorama({location:a,radius:b,preference:50>(b||0)?"best":"nearest"},c)};_.mh.prototype.getPanoramaById=function(a,b){this.getPanorama({pano:a},b)};_.B(oh,_.S);oh.prototype.getTile=function(a,b,c){if(!a||!c)return null;var d=_.Zb("DIV");c={la:a,zoom:b,md:null};d.__gmimt=c;_.ae(this.j,d);if(this.l){var e=this.tileSize||new _.O(256,256),f=this.m(a,b);(c.md=this.l({M:a.x,N:a.y,Y:b},e,d,f,function(){_.R.trigger(d,"load")})).setOpacity(nh(this))}return d};oh.prototype.getTile=oh.prototype.getTile;oh.prototype.releaseTile=function(a){a&&this.j.contains(a)&&(this.j.remove(a),(a=a.__gmimt.md)&&a.release())};oh.prototype.releaseTile=oh.prototype.releaseTile;
oh.prototype.opacity_changed=function(){var a=nh(this);this.j.forEach(function(b){b.__gmimt.md.setOpacity(a)})};oh.prototype.triggersTileLoadEvent=!0;_.Xd(oh.prototype,{opacity:_.xi});_.B(_.ph,_.S);_.ph.prototype.getTile=_.pa(null);_.ph.prototype.tileSize=new _.O(256,256);_.ph.prototype.triggersTileLoadEvent=!0;_.B(_.qh,_.ph);_.B(rh,_.S);_.Xd(rh.prototype,{attribution:_.pa(!0),place:_.pa(!0)});var Fh={Animation:{BOUNCE:1,DROP:2,rn:3,pn:4},BicyclingLayer:_.Ef,Circle:_.gh,ControlPosition:_.vg,Data:kf,DirectionsRenderer:wf,DirectionsService:xf,DirectionsStatus:{OK:_.ha,UNKNOWN_ERROR:_.ka,OVER_QUERY_LIMIT:_.ia,REQUEST_DENIED:_.ja,INVALID_REQUEST:_.ba,ZERO_RESULTS:_.la,MAX_WAYPOINTS_EXCEEDED:_.ea,NOT_FOUND:_.fa},DirectionsTravelMode:_.Mi,DirectionsUnitSystem:_.Li,DistanceMatrixService:yf,DistanceMatrixStatus:{OK:_.ha,INVALID_REQUEST:_.ba,OVER_QUERY_LIMIT:_.ia,REQUEST_DENIED:_.ja,UNKNOWN_ERROR:_.ka,
MAX_ELEMENTS_EXCEEDED:_.da,MAX_DIMENSIONS_EXCEEDED:_.ca},DistanceMatrixElementStatus:{OK:_.ha,NOT_FOUND:_.fa,ZERO_RESULTS:_.la},ElevationService:zf,ElevationStatus:{OK:_.ha,UNKNOWN_ERROR:_.ka,OVER_QUERY_LIMIT:_.ia,REQUEST_DENIED:_.ja,INVALID_REQUEST:_.ba,mn:"DATA_NOT_AVAILABLE"},FusionTablesLayer:Zg,Geocoder:Af,GeocoderLocationType:{ROOFTOP:"ROOFTOP",RANGE_INTERPOLATED:"RANGE_INTERPOLATED",GEOMETRIC_CENTER:"GEOMETRIC_CENTER",APPROXIMATE:"APPROXIMATE"},GeocoderStatus:{OK:_.ha,UNKNOWN_ERROR:_.ka,OVER_QUERY_LIMIT:_.ia,
REQUEST_DENIED:_.ja,INVALID_REQUEST:_.ba,ZERO_RESULTS:_.la,ERROR:_.aa},GroundOverlay:_.Bf,ImageMapType:oh,InfoWindow:_.tf,KmlLayer:Cf,KmlLayerStatus:_.Yi,LatLng:_.P,LatLngBounds:_.Q,MVCArray:_.Zd,MVCObject:_.S,Map:Xg,MapTypeControlStyle:{DEFAULT:0,HORIZONTAL_BAR:1,DROPDOWN_MENU:2,INSET:3,INSET_LARGE:4},MapTypeId:_.ti,MapTypeRegistry:je,Marker:_.qf,MarkerImage:function(a,b,c,d,e){this.url=a;this.size=b||e;this.origin=c;this.anchor=d;this.scaledSize=e;this.labelOrigin=null},MaxZoomService:Yg,MaxZoomStatus:{OK:_.ha,
ERROR:_.aa},NavigationControlStyle:{DEFAULT:0,SMALL:1,ANDROID:2,ZOOM_PAN:3,sn:4,kj:5},OverlayView:_.$g,Point:_.M,Polygon:_.ih,Polyline:_.jh,Rectangle:_.kh,SaveWidget:rh,ScaleControlStyle:{DEFAULT:0},Size:_.O,StreetViewCoverageLayer:lh,StreetViewPanorama:xg,StreetViewPreference:_.ej,StreetViewService:_.mh,StreetViewStatus:{OK:_.ha,UNKNOWN_ERROR:_.ka,ZERO_RESULTS:_.la},StreetViewSource:_.fj,StrokePosition:{CENTER:0,INSIDE:1,OUTSIDE:2},StyledMapType:_.qh,SymbolPath:Ji,TrafficLayer:Ff,TrafficModel:_.Ni,
TransitLayer:Gf,TransitMode:_.Oi,TransitRoutePreference:_.Pi,TravelMode:_.Mi,UnitSystem:_.Li,ZoomControlStyle:{DEFAULT:0,SMALL:1,LARGE:2,kj:3},event:_.R};_.Dc(kf,{Feature:_.Qe,Geometry:Ae,GeometryCollection:_.Xe,LineString:_.Ze,LinearRing:_.$e,MultiLineString:_.bf,MultiPoint:_.cf,MultiPolygon:_.gf,Point:_.Be,Polygon:_.ef});_.Pe("main",{});var uh=/'/g,vh;var nf=arguments[0];window.google.maps.Load&&window.google.maps.Load(Hh);}).call(this,{});
 
 
/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){
return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ia={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qa[0].contentDocument,b.write(),b.close(),c=sa(a,b),qa.detach()),ra[a]=c),c}var ua=/^margin/,va=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wa=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)};function xa(a,b,c){var d,e,f,g,h=a.style;return c=c||wa(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),va.test(g)&&ua.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function ya(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),f.removeChild(c),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var za=/^(none|table(?!-c[ea]).+)/,Aa=new RegExp("^("+Q+")(.*)$","i"),Ba=new RegExp("^([+-])=("+Q+")","i"),Ca={position:"absolute",visibility:"hidden",display:"block"},Da={letterSpacing:"0",fontWeight:"400"},Ea=["Webkit","O","Moz","ms"];function Fa(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Ea.length;while(e--)if(b=Ea[e]+c,b in a)return b;return d}function Ga(a,b,c){var d=Aa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Ha(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ia(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wa(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xa(a,b,f),(0>e||null==e)&&(e=a.style[b]),va.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Ha(a,b,c||(g?"border":"content"),d,f)+"px"}function Ja(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",ta(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fa(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Ba.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fa(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xa(a,b,d)),"normal"===e&&b in Da&&(e=Da[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?za.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Ca,function(){return Ia(a,b,d)}):Ia(a,b,d):void 0},set:function(a,c,d){var e=d&&wa(a);return Ga(a,c,d?Ha(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=ya(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ua.test(a)||(n.cssHooks[a+b].set=Ga)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wa(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Ja(this,!0)},hide:function(){return Ja(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Ka(a,b,c,d,e){return new Ka.prototype.init(a,b,c,d,e)}n.Tween=Ka,Ka.prototype={constructor:Ka,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ka.propHooks[this.prop];return a&&a.get?a.get(this):Ka.propHooks._default.get(this)},run:function(a){var b,c=Ka.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ka.propHooks._default.set(this),this}},Ka.prototype.init.prototype=Ka.prototype,Ka.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Ka.propHooks.scrollTop=Ka.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Ka.prototype.init,n.fx.step={};var La,Ma,Na=/^(?:toggle|show|hide)$/,Oa=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pa=/queueHooks$/,Qa=[Va],Ra={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Oa.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Oa.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sa(){return setTimeout(function(){La=void 0}),La=n.now()}function Ta(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ua(a,b,c){for(var d,e=(Ra[b]||[]).concat(Ra["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Va(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||ta(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Na.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?ta(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ua(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wa(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xa(a,b,c){var d,e,f=0,g=Qa.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=La||Sa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:La||Sa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wa(k,j.opts.specialEasing);g>f;f++)if(d=Qa[f].call(j,a,k,j.opts))return d;return n.map(k,Ua,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xa,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Ra[c]=Ra[c]||[],Ra[c].unshift(b)},prefilter:function(a,b){b?Qa.unshift(a):Qa.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xa(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pa.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Ta(b,!0),a,d,e)}}),n.each({slideDown:Ta("show"),slideUp:Ta("hide"),slideToggle:Ta("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(La=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),La=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ma||(Ma=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Ma),Ma=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Ya,Za,$a=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Za:Ya)),
void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Za={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$a[b]||n.find.attr;$a[b]=function(a,b,d){var e,f;return d||(f=$a[b],$a[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$a[b]=f),e}});var _a=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_a.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ab=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ab," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ab," ").indexOf(b)>=0)return!0;return!1}});var bb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cb=n.now(),db=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var eb=/#.*$/,fb=/([?&])_=[^&]*/,gb=/^(.*?):[ \t]*([^\r\n]*)$/gm,hb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ib=/^(?:GET|HEAD)$/,jb=/^\/\//,kb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,lb={},mb={},nb="*/".concat("*"),ob=a.location.href,pb=kb.exec(ob.toLowerCase())||[];function qb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function rb(a,b,c,d){var e={},f=a===mb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function sb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function tb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function ub(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ob,type:"GET",isLocal:hb.test(pb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?sb(sb(a,n.ajaxSettings),b):sb(n.ajaxSettings,a)},ajaxPrefilter:qb(lb),ajaxTransport:qb(mb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||ob)+"").replace(eb,"").replace(jb,pb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=kb.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===pb[1]&&h[2]===pb[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(pb[3]||("http:"===pb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),rb(lb,k,b,v),2===t)return v;i=n.event&&k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!ib.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(db.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=fb.test(d)?d.replace(fb,"$1_="+cb++):d+(db.test(d)?"&":"?")+"_="+cb++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+nb+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=rb(mb,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=tb(k,v,f)),u=ub(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var vb=/%20/g,wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&").replace(vb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Bb=0,Cb={},Db={0:200,1223:204},Eb=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Cb)Cb[a]()}),k.cors=!!Eb&&"withCredentials"in Eb,k.ajax=Eb=!!Eb,n.ajaxTransport(function(a){var b;return k.cors||Eb&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Bb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Cb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Db[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Cb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Fb=[],Gb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Fb.pop()||n.expando+"_"+cb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Gb.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Gb,"$1"+e):b.jsonp!==!1&&(b.url+=(db.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Fb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Hb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Hb)return Hb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Ib=a.document.documentElement;function Jb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Jb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Ib;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ib})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Jb(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=ya(k.pixelPosition,function(a,c){return c?(c=xa(a,b),va.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Kb=a.jQuery,Lb=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Lb),b&&a.jQuery===n&&(a.jQuery=Kb),n},typeof b===U&&(a.jQuery=a.$=n),n});
;/*! jQuery UI - v1.11.4 - 2015-05-31
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
 
(function( factory ) {
    if ( typeof define === "function" && define.amd ) {
 
        // AMD. Register as an anonymous module.
        define([ "jquery" ], factory );
    } else {
 
        // Browser globals
        factory( jQuery );
    }
}(function( $ ) {
/*!
 * jQuery UI Core 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */
 
 
// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {};
 
$.extend( $.ui, {
    version: "1.11.4",
 
    keyCode: {
        BACKSPACE: 8,
        COMMA: 188,
        DELETE: 46,
        DOWN: 40,
        END: 35,
        ENTER: 13,
        ESCAPE: 27,
        HOME: 36,
        LEFT: 37,
        PAGE_DOWN: 34,
        PAGE_UP: 33,
        PERIOD: 190,
        RIGHT: 39,
        SPACE: 32,
        TAB: 9,
        UP: 38
    }
});
 
// plugins
$.fn.extend({
    scrollParent: function( includeHidden ) {
        var position = this.css( "position" ),
            excludeStaticParent = position === "absolute",
            overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
            scrollParent = this.parents().filter( function() {
                var parent = $( this );
                if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
                    return false;
                }
                return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
            }).eq( 0 );
 
        return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
    },
 
    uniqueId: (function() {
        var uuid = 0;
 
        return function() {
            return this.each(function() {
                if ( !this.id ) {
                    this.id = "ui-id-" + ( ++uuid );
                }
            });
        };
    })(),
 
    removeUniqueId: function() {
        return this.each(function() {
            if ( /^ui-id-\d+$/.test( this.id ) ) {
                $( this ).removeAttr( "id" );
            }
        });
    }
});
 
// selectors
function focusable( element, isTabIndexNotNaN ) {
    var map, mapName, img,
        nodeName = element.nodeName.toLowerCase();
    if ( "area" === nodeName ) {
        map = element.parentNode;
        mapName = map.name;
        if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
            return false;
        }
        img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
        return !!img && visible( img );
    }
    return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
        !element.disabled :
        "a" === nodeName ?
            element.href || isTabIndexNotNaN :
            isTabIndexNotNaN) &&
        // the element and all of its ancestors must be visible
        visible( element );
}
 
function visible( element ) {
    return $.expr.filters.visible( element ) &&
        !$( element ).parents().addBack().filter(function() {
            return $.css( this, "visibility" ) === "hidden";
        }).length;
}
 
$.extend( $.expr[ ":" ], {
    data: $.expr.createPseudo ?
        $.expr.createPseudo(function( dataName ) {
            return function( elem ) {
                return !!$.data( elem, dataName );
            };
        }) :
        // support: jQuery <1.8
        function( elem, i, match ) {
            return !!$.data( elem, match[ 3 ] );
        },
 
    focusable: function( element ) {
        return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
    },
 
    tabbable: function( element ) {
        var tabIndex = $.attr( element, "tabindex" ),
            isTabIndexNaN = isNaN( tabIndex );
        return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
    }
});
 
// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
    $.each( [ "Width", "Height" ], function( i, name ) {
        var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
            type = name.toLowerCase(),
            orig = {
                innerWidth: $.fn.innerWidth,
                innerHeight: $.fn.innerHeight,
                outerWidth: $.fn.outerWidth,
                outerHeight: $.fn.outerHeight
            };
 
        function reduce( elem, size, border, margin ) {
            $.each( side, function() {
                size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
                if ( border ) {
                    size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
                }
                if ( margin ) {
                    size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
                }
            });
            return size;
        }
 
        $.fn[ "inner" + name ] = function( size ) {
            if ( size === undefined ) {
                return orig[ "inner" + name ].call( this );
            }
 
            return this.each(function() {
                $( this ).css( type, reduce( this, size ) + "px" );
            });
        };
 
        $.fn[ "outer" + name] = function( size, margin ) {
            if ( typeof size !== "number" ) {
                return orig[ "outer" + name ].call( this, size );
            }
 
            return this.each(function() {
                $( this).css( type, reduce( this, size, true, margin ) + "px" );
            });
        };
    });
}
 
// support: jQuery <1.8
if ( !$.fn.addBack ) {
    $.fn.addBack = function( selector ) {
        return this.add( selector == null ?
            this.prevObject : this.prevObject.filter( selector )
        );
    };
}
 
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
    $.fn.removeData = (function( removeData ) {
        return function( key ) {
            if ( arguments.length ) {
                return removeData.call( this, $.camelCase( key ) );
            } else {
                return removeData.call( this );
            }
        };
    })( $.fn.removeData );
}
 
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
 
$.fn.extend({
    focus: (function( orig ) {
        return function( delay, fn ) {
            return typeof delay === "number" ?
                this.each(function() {
                    var elem = this;
                    setTimeout(function() {
                        $( elem ).focus();
                        if ( fn ) {
                            fn.call( elem );
                        }
                    }, delay );
                }) :
                orig.apply( this, arguments );
        };
    })( $.fn.focus ),
 
    disableSelection: (function() {
        var eventType = "onselectstart" in document.createElement( "div" ) ?
            "selectstart" :
            "mousedown";
 
        return function() {
            return this.bind( eventType + ".ui-disableSelection", function( event ) {
                event.preventDefault();
            });
        };
    })(),
 
    enableSelection: function() {
        return this.unbind( ".ui-disableSelection" );
    },
 
    zIndex: function( zIndex ) {
        if ( zIndex !== undefined ) {
            return this.css( "zIndex", zIndex );
        }
 
        if ( this.length ) {
            var elem = $( this[ 0 ] ), position, value;
            while ( elem.length && elem[ 0 ] !== document ) {
                // Ignore z-index if position is set to a value where z-index is ignored by the browser
                // This makes behavior of this function consistent across browsers
                // WebKit always returns auto if the element is positioned
                position = elem.css( "position" );
                if ( position === "absolute" || position === "relative" || position === "fixed" ) {
                    // IE returns 0 when zIndex is not specified
                    // other browsers return a string
                    // we ignore the case of nested elements with an explicit value of 0
                    // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
                    value = parseInt( elem.css( "zIndex" ), 10 );
                    if ( !isNaN( value ) && value !== 0 ) {
                        return value;
                    }
                }
                elem = elem.parent();
            }
        }
 
        return 0;
    }
});
 
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
    add: function( module, option, set ) {
        var i,
            proto = $.ui[ module ].prototype;
        for ( i in set ) {
            proto.plugins[ i ] = proto.plugins[ i ] || [];
            proto.plugins[ i ].push( [ option, set[ i ] ] );
        }
    },
    call: function( instance, name, args, allowDisconnected ) {
        var i,
            set = instance.plugins[ name ];
 
        if ( !set ) {
            return;
        }
 
        if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
            return;
        }
 
        for ( i = 0; i < set.length; i++ ) {
            if ( instance.options[ set[ i ][ 0 ] ] ) {
                set[ i ][ 1 ].apply( instance.element, args );
            }
        }
    }
};
 
 
/*!
 * jQuery UI Widget 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */
 
 
var widget_uuid = 0,
    widget_slice = Array.prototype.slice;
 
$.cleanData = (function( orig ) {
    return function( elems ) {
        var events, elem, i;
        for ( i = 0; (elem = elems[i]) != null; i++ ) {
            try {
 
                // Only trigger remove when necessary to save time
                events = $._data( elem, "events" );
                if ( events && events.remove ) {
                    $( elem ).triggerHandler( "remove" );
                }
 
            // http://bugs.jquery.com/ticket/8235
            } catch ( e ) {}
        }
        orig( elems );
    };
})( $.cleanData );
 
$.widget = function( name, base, prototype ) {
    var fullName, existingConstructor, constructor, basePrototype,
        // proxiedPrototype allows the provided prototype to remain unmodified
        // so that it can be used as a mixin for multiple widgets (#8876)
        proxiedPrototype = {},
        namespace = name.split( "." )[ 0 ];
 
    name = name.split( "." )[ 1 ];
    fullName = namespace + "-" + name;
 
    if ( !prototype ) {
        prototype = base;
        base = $.Widget;
    }
 
    // create selector for plugin
    $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
        return !!$.data( elem, fullName );
    };
 
    $[ namespace ] = $[ namespace ] || {};
    existingConstructor = $[ namespace ][ name ];
    constructor = $[ namespace ][ name ] = function( options, element ) {
        // allow instantiation without "new" keyword
        if ( !this._createWidget ) {
            return new constructor( options, element );
        }
 
        // allow instantiation without initializing for simple inheritance
        // must use "new" keyword (the code above always passes args)
        if ( arguments.length ) {
            this._createWidget( options, element );
        }
    };
    // extend with the existing constructor to carry over any static properties
    $.extend( constructor, existingConstructor, {
        version: prototype.version,
        // copy the object used to create the prototype in case we need to
        // redefine the widget later
        _proto: $.extend( {}, prototype ),
        // track widgets that inherit from this widget in case this widget is
        // redefined after a widget inherits from it
        _childConstructors: []
    });
 
    basePrototype = new base();
    // we need to make the options hash a property directly on the new instance
    // otherwise we'll modify the options hash on the prototype that we're
    // inheriting from
    basePrototype.options = $.widget.extend( {}, basePrototype.options );
    $.each( prototype, function( prop, value ) {
        if ( !$.isFunction( value ) ) {
            proxiedPrototype[ prop ] = value;
            return;
        }
        proxiedPrototype[ prop ] = (function() {
            var _super = function() {
                    return base.prototype[ prop ].apply( this, arguments );
                },
                _superApply = function( args ) {
                    return base.prototype[ prop ].apply( this, args );
                };
            return function() {
                var __super = this._super,
                    __superApply = this._superApply,
                    returnValue;
 
                this._super = _super;
                this._superApply = _superApply;
 
                returnValue = value.apply( this, arguments );
 
                this._super = __super;
                this._superApply = __superApply;
 
                return returnValue;
            };
        })();
    });
    constructor.prototype = $.widget.extend( basePrototype, {
        // TODO: remove support for widgetEventPrefix
        // always use the name + a colon as the prefix, e.g., draggable:start
        // don't prefix for widgets that aren't DOM-based
        widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
    }, proxiedPrototype, {
        constructor: constructor,
        namespace: namespace,
        widgetName: name,
        widgetFullName: fullName
    });
 
    // If this widget is being redefined then we need to find all widgets that
    // are inheriting from it and redefine all of them so that they inherit from
    // the new version of this widget. We're essentially trying to replace one
    // level in the prototype chain.
    if ( existingConstructor ) {
        $.each( existingConstructor._childConstructors, function( i, child ) {
            var childPrototype = child.prototype;
 
            // redefine the child widget using the same prototype that was
            // originally used, but inherit from the new version of the base
            $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
        });
        // remove the list of existing child constructors from the old constructor
        // so the old child constructors can be garbage collected
        delete existingConstructor._childConstructors;
    } else {
        base._childConstructors.push( constructor );
    }
 
    $.widget.bridge( name, constructor );
 
    return constructor;
};
 
$.widget.extend = function( target ) {
    var input = widget_slice.call( arguments, 1 ),
        inputIndex = 0,
        inputLength = input.length,
        key,
        value;
    for ( ; inputIndex < inputLength; inputIndex++ ) {
        for ( key in input[ inputIndex ] ) {
            value = input[ inputIndex ][ key ];
            if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
                // Clone objects
                if ( $.isPlainObject( value ) ) {
                    target[ key ] = $.isPlainObject( target[ key ] ) ?
                        $.widget.extend( {}, target[ key ], value ) :
                        // Don't extend strings, arrays, etc. with objects
                        $.widget.extend( {}, value );
                // Copy everything else by reference
                } else {
                    target[ key ] = value;
                }
            }
        }
    }
    return target;
};
 
$.widget.bridge = function( name, object ) {
    var fullName = object.prototype.widgetFullName || name;
    $.fn[ name ] = function( options ) {
        var isMethodCall = typeof options === "string",
            args = widget_slice.call( arguments, 1 ),
            returnValue = this;
 
        if ( isMethodCall ) {
            this.each(function() {
                var methodValue,
                    instance = $.data( this, fullName );
                if ( options === "instance" ) {
                    returnValue = instance;
                    return false;
                }
                if ( !instance ) {
                    return $.error( "cannot call methods on " + name + " prior to initialization; " +
                        "attempted to call method '" + options + "'" );
                }
                if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
                    return $.error( "no such method '" + options + "' for " + name + " widget instance" );
                }
                methodValue = instance[ options ].apply( instance, args );
                if ( methodValue !== instance && methodValue !== undefined ) {
                    returnValue = methodValue && methodValue.jquery ?
                        returnValue.pushStack( methodValue.get() ) :
                        methodValue;
                    return false;
                }
            });
        } else {
 
            // Allow multiple hashes to be passed on init
            if ( args.length ) {
                options = $.widget.extend.apply( null, [ options ].concat(args) );
            }
 
            this.each(function() {
                var instance = $.data( this, fullName );
                if ( instance ) {
                    instance.option( options || {} );
                    if ( instance._init ) {
                        instance._init();
                    }
                } else {
                    $.data( this, fullName, new object( options, this ) );
                }
            });
        }
 
        return returnValue;
    };
};
 
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
 
$.Widget.prototype = {
    widgetName: "widget",
    widgetEventPrefix: "",
    defaultElement: "<div>",
    options: {
        disabled: false,
 
        // callbacks
        create: null
    },
    _createWidget: function( options, element ) {
        element = $( element || this.defaultElement || this )[ 0 ];
        this.element = $( element );
        this.uuid = widget_uuid++;
        this.eventNamespace = "." + this.widgetName + this.uuid;
 
        this.bindings = $();
        this.hoverable = $();
        this.focusable = $();
 
        if ( element !== this ) {
            $.data( element, this.widgetFullName, this );
            this._on( true, this.element, {
                remove: function( event ) {
                    if ( event.target === element ) {
                        this.destroy();
                    }
                }
            });
            this.document = $( element.style ?
                // element within the document
                element.ownerDocument :
                // element is window or document
                element.document || element );
            this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
        }
 
        this.options = $.widget.extend( {},
            this.options,
            this._getCreateOptions(),
            options );
 
        this._create();
        this._trigger( "create", null, this._getCreateEventData() );
        this._init();
    },
    _getCreateOptions: $.noop,
    _getCreateEventData: $.noop,
    _create: $.noop,
    _init: $.noop,
 
    destroy: function() {
        this._destroy();
        // we can probably remove the unbind calls in 2.0
        // all event bindings should go through this._on()
        this.element
            .unbind( this.eventNamespace )
            .removeData( this.widgetFullName )
            // support: jquery <1.6.3
            // http://bugs.jquery.com/ticket/9413
            .removeData( $.camelCase( this.widgetFullName ) );
        this.widget()
            .unbind( this.eventNamespace )
            .removeAttr( "aria-disabled" )
            .removeClass(
                this.widgetFullName + "-disabled " +
                "ui-state-disabled" );
 
        // clean up events and states
        this.bindings.unbind( this.eventNamespace );
        this.hoverable.removeClass( "ui-state-hover" );
        this.focusable.removeClass( "ui-state-focus" );
    },
    _destroy: $.noop,
 
    widget: function() {
        return this.element;
    },
 
    option: function( key, value ) {
        var options = key,
            parts,
            curOption,
            i;
 
        if ( arguments.length === 0 ) {
            // don't return a reference to the internal hash
            return $.widget.extend( {}, this.options );
        }
 
        if ( typeof key === "string" ) {
            // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
            options = {};
            parts = key.split( "." );
            key = parts.shift();
            if ( parts.length ) {
                curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
                for ( i = 0; i < parts.length - 1; i++ ) {
                    curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
                    curOption = curOption[ parts[ i ] ];
                }
                key = parts.pop();
                if ( arguments.length === 1 ) {
                    return curOption[ key ] === undefined ? null : curOption[ key ];
                }
                curOption[ key ] = value;
            } else {
                if ( arguments.length === 1 ) {
                    return this.options[ key ] === undefined ? null : this.options[ key ];
                }
                options[ key ] = value;
            }
        }
 
        this._setOptions( options );
 
        return this;
    },
    _setOptions: function( options ) {
        var key;
 
        for ( key in options ) {
            this._setOption( key, options[ key ] );
        }
 
        return this;
    },
    _setOption: function( key, value ) {
        this.options[ key ] = value;
 
        if ( key === "disabled" ) {
            this.widget()
                .toggleClass( this.widgetFullName + "-disabled", !!value );
 
            // If the widget is becoming disabled, then nothing is interactive
            if ( value ) {
                this.hoverable.removeClass( "ui-state-hover" );
                this.focusable.removeClass( "ui-state-focus" );
            }
        }
 
        return this;
    },
 
    enable: function() {
        return this._setOptions({ disabled: false });
    },
    disable: function() {
        return this._setOptions({ disabled: true });
    },
 
    _on: function( suppressDisabledCheck, element, handlers ) {
        var delegateElement,
            instance = this;
 
        // no suppressDisabledCheck flag, shuffle arguments
        if ( typeof suppressDisabledCheck !== "boolean" ) {
            handlers = element;
            element = suppressDisabledCheck;
            suppressDisabledCheck = false;
        }
 
        // no element argument, shuffle and use this.element
        if ( !handlers ) {
            handlers = element;
            element = this.element;
            delegateElement = this.widget();
        } else {
            element = delegateElement = $( element );
            this.bindings = this.bindings.add( element );
        }
 
        $.each( handlers, function( event, handler ) {
            function handlerProxy() {
                // allow widgets to customize the disabled handling
                // - disabled as an array instead of boolean
                // - disabled class as method for disabling individual parts
                if ( !suppressDisabledCheck &&
                        ( instance.options.disabled === true ||
                            $( this ).hasClass( "ui-state-disabled" ) ) ) {
                    return;
                }
                return ( typeof handler === "string" ? instance[ handler ] : handler )
                    .apply( instance, arguments );
            }
 
            // copy the guid so direct unbinding works
            if ( typeof handler !== "string" ) {
                handlerProxy.guid = handler.guid =
                    handler.guid || handlerProxy.guid || $.guid++;
            }
 
            var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
                eventName = match[1] + instance.eventNamespace,
                selector = match[2];
            if ( selector ) {
                delegateElement.delegate( selector, eventName, handlerProxy );
            } else {
                element.bind( eventName, handlerProxy );
            }
        });
    },
 
    _off: function( element, eventName ) {
        eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
            this.eventNamespace;
        element.unbind( eventName ).undelegate( eventName );
 
        // Clear the stack to avoid memory leaks (#10056)
        this.bindings = $( this.bindings.not( element ).get() );
        this.focusable = $( this.focusable.not( element ).get() );
        this.hoverable = $( this.hoverable.not( element ).get() );
    },
 
    _delay: function( handler, delay ) {
        function handlerProxy() {
            return ( typeof handler === "string" ? instance[ handler ] : handler )
                .apply( instance, arguments );
        }
        var instance = this;
        return setTimeout( handlerProxy, delay || 0 );
    },
 
    _hoverable: function( element ) {
        this.hoverable = this.hoverable.add( element );
        this._on( element, {
            mouseenter: function( event ) {
                $( event.currentTarget ).addClass( "ui-state-hover" );
            },
            mouseleave: function( event ) {
                $( event.currentTarget ).removeClass( "ui-state-hover" );
            }
        });
    },
 
    _focusable: function( element ) {
        this.focusable = this.focusable.add( element );
        this._on( element, {
            focusin: function( event ) {
                $( event.currentTarget ).addClass( "ui-state-focus" );
            },
            focusout: function( event ) {
                $( event.currentTarget ).removeClass( "ui-state-focus" );
            }
        });
    },
 
    _trigger: function( type, event, data ) {
        var prop, orig,
            callback = this.options[ type ];
 
        data = data || {};
        event = $.Event( event );
        event.type = ( type === this.widgetEventPrefix ?
            type :
            this.widgetEventPrefix + type ).toLowerCase();
        // the original event may come from any element
        // so we need to reset the target on the new event
        event.target = this.element[ 0 ];
 
        // copy original event properties over to the new event
        orig = event.originalEvent;
        if ( orig ) {
            for ( prop in orig ) {
                if ( !( prop in event ) ) {
                    event[ prop ] = orig[ prop ];
                }
            }
        }
 
        this.element.trigger( event, data );
        return !( $.isFunction( callback ) &&
            callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
            event.isDefaultPrevented() );
    }
};
 
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
    $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
        if ( typeof options === "string" ) {
            options = { effect: options };
        }
        var hasOptions,
            effectName = !options ?
                method :
                options === true || typeof options === "number" ?
                    defaultEffect :
                    options.effect || defaultEffect;
        options = options || {};
        if ( typeof options === "number" ) {
            options = { duration: options };
        }
        hasOptions = !$.isEmptyObject( options );
        options.complete = callback;
        if ( options.delay ) {
            element.delay( options.delay );
        }
        if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
            element[ method ]( options );
        } else if ( effectName !== method && element[ effectName ] ) {
            element[ effectName ]( options.duration, options.easing, callback );
        } else {
            element.queue(function( next ) {
                $( this )[ method ]();
                if ( callback ) {
                    callback.call( element[ 0 ] );
                }
                next();
            });
        }
    };
});
 
var widget = $.widget;
 
 
/*!
 * jQuery UI Mouse 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/mouse/
 */
 
 
var mouseHandled = false;
$( document ).mouseup( function() {
    mouseHandled = false;
});
 
var mouse = $.widget("ui.mouse", {
    version: "1.11.4",
    options: {
        cancel: "input,textarea,button,select,option",
        distance: 1,
        delay: 0
    },
    _mouseInit: function() {
        var that = this;
 
        this.element
            .bind("mousedown." + this.widgetName, function(event) {
                return that._mouseDown(event);
            })
            .bind("click." + this.widgetName, function(event) {
                if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
                    $.removeData(event.target, that.widgetName + ".preventClickEvent");
                    event.stopImmediatePropagation();
                    return false;
                }
            });
 
        this.started = false;
    },
 
    // TODO: make sure destroying one instance of mouse doesn't mess with
    // other instances of mouse
    _mouseDestroy: function() {
        this.element.unbind("." + this.widgetName);
        if ( this._mouseMoveDelegate ) {
            this.document
                .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
                .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
        }
    },
 
    _mouseDown: function(event) {
        // don't let more than one widget handle mouseStart
        if ( mouseHandled ) {
            return;
        }
 
        this._mouseMoved = false;
 
        // we may have missed mouseup (out of window)
        (this._mouseStarted && this._mouseUp(event));
 
        this._mouseDownEvent = event;
 
        var that = this,
            btnIsLeft = (event.which === 1),
            // event.target.nodeName works around a bug in IE 8 with
            // disabled inputs (#7620)
            elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
        if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
            return true;
        }
 
        this.mouseDelayMet = !this.options.delay;
        if (!this.mouseDelayMet) {
            this._mouseDelayTimer = setTimeout(function() {
                that.mouseDelayMet = true;
            }, this.options.delay);
        }
 
        if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
            this._mouseStarted = (this._mouseStart(event) !== false);
            if (!this._mouseStarted) {
                event.preventDefault();
                return true;
            }
        }
 
        // Click event may never have fired (Gecko & Opera)
        if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
            $.removeData(event.target, this.widgetName + ".preventClickEvent");
        }
 
        // these delegates are required to keep context
        this._mouseMoveDelegate = function(event) {
            return that._mouseMove(event);
        };
        this._mouseUpDelegate = function(event) {
            return that._mouseUp(event);
        };
 
        this.document
            .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
            .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
 
        event.preventDefault();
 
        mouseHandled = true;
        return true;
    },
 
    _mouseMove: function(event) {
        // Only check for mouseups outside the document if you've moved inside the document
        // at least once. This prevents the firing of mouseup in the case of IE<9, which will
        // fire a mousemove event if content is placed under the cursor. See #7778
        // Support: IE <9
        if ( this._mouseMoved ) {
            // IE mouseup check - mouseup happened when mouse was out of window
            if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
                return this._mouseUp(event);
 
            // Iframe mouseup check - mouseup occurred in another document
            } else if ( !event.which ) {
                return this._mouseUp( event );
            }
        }
 
        if ( event.which || event.button ) {
            this._mouseMoved = true;
        }
 
        if (this._mouseStarted) {
            this._mouseDrag(event);
            return event.preventDefault();
        }
 
        if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
            this._mouseStarted =
                (this._mouseStart(this._mouseDownEvent, event) !== false);
            (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
        }
 
        return !this._mouseStarted;
    },
 
    _mouseUp: function(event) {
        this.document
            .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
            .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
 
        if (this._mouseStarted) {
            this._mouseStarted = false;
 
            if (event.target === this._mouseDownEvent.target) {
                $.data(event.target, this.widgetName + ".preventClickEvent", true);
            }
 
            this._mouseStop(event);
        }
 
        mouseHandled = false;
        return false;
    },
 
    _mouseDistanceMet: function(event) {
        return (Math.max(
                Math.abs(this._mouseDownEvent.pageX - event.pageX),
                Math.abs(this._mouseDownEvent.pageY - event.pageY)
            ) >= this.options.distance
        );
    },
 
    _mouseDelayMet: function(/* event */) {
        return this.mouseDelayMet;
    },
 
    // These are placeholder methods, to be overriden by extending plugin
    _mouseStart: function(/* event */) {},
    _mouseDrag: function(/* event */) {},
    _mouseStop: function(/* event */) {},
    _mouseCapture: function(/* event */) { return true; }
});
 
 
/*!
 * jQuery UI Position 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */
 
(function() {
 
$.ui = $.ui || {};
 
var cachedScrollbarWidth, supportsOffsetFractions,
    max = Math.max,
    abs = Math.abs,
    round = Math.round,
    rhorizontal = /left|center|right/,
    rvertical = /top|center|bottom/,
    roffset = /[\+\-]\d+(\.[\d]+)?%?/,
    rposition = /^\w+/,
    rpercent = /%$/,
    _position = $.fn.position;
 
function getOffsets( offsets, width, height ) {
    return [
        parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
        parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
    ];
}
 
function parseCss( element, property ) {
    return parseInt( $.css( element, property ), 10 ) || 0;
}
 
function getDimensions( elem ) {
    var raw = elem[0];
    if ( raw.nodeType === 9 ) {
        return {
            width: elem.width(),
            height: elem.height(),
            offset: { top: 0, left: 0 }
        };
    }
    if ( $.isWindow( raw ) ) {
        return {
            width: elem.width(),
            height: elem.height(),
            offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
        };
    }
    if ( raw.preventDefault ) {
        return {
            width: 0,
            height: 0,
            offset: { top: raw.pageY, left: raw.pageX }
        };
    }
    return {
        width: elem.outerWidth(),
        height: elem.outerHeight(),
        offset: elem.offset()
    };
}
 
$.position = {
    scrollbarWidth: function() {
        if ( cachedScrollbarWidth !== undefined ) {
            return cachedScrollbarWidth;
        }
        var w1, w2,
            div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
            innerDiv = div.children()[0];
 
        $( "body" ).append( div );
        w1 = innerDiv.offsetWidth;
        div.css( "overflow", "scroll" );
 
        w2 = innerDiv.offsetWidth;
 
        if ( w1 === w2 ) {
            w2 = div[0].clientWidth;
        }
 
        div.remove();
 
        return (cachedScrollbarWidth = w1 - w2);
    },
    getScrollInfo: function( within ) {
        var overflowX = within.isWindow || within.isDocument ? "" :
                within.element.css( "overflow-x" ),
            overflowY = within.isWindow || within.isDocument ? "" :
                within.element.css( "overflow-y" ),
            hasOverflowX = overflowX === "scroll" ||
                ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
            hasOverflowY = overflowY === "scroll" ||
                ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
        return {
            width: hasOverflowY ? $.position.scrollbarWidth() : 0,
            height: hasOverflowX ? $.position.scrollbarWidth() : 0
        };
    },
    getWithinInfo: function( element ) {
        var withinElement = $( element || window ),
            isWindow = $.isWindow( withinElement[0] ),
            isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
        return {
            element: withinElement,
            isWindow: isWindow,
            isDocument: isDocument,
            offset: withinElement.offset() || { left: 0, top: 0 },
            scrollLeft: withinElement.scrollLeft(),
            scrollTop: withinElement.scrollTop(),
 
            // support: jQuery 1.6.x
            // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
            width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
            height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
        };
    }
};
 
$.fn.position = function( options ) {
    if ( !options || !options.of ) {
        return _position.apply( this, arguments );
    }
 
    // make a copy, we don't want to modify arguments
    options = $.extend( {}, options );
 
    var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
        target = $( options.of ),
        within = $.position.getWithinInfo( options.within ),
        scrollInfo = $.position.getScrollInfo( within ),
        collision = ( options.collision || "flip" ).split( " " ),
        offsets = {};
 
    dimensions = getDimensions( target );
    if ( target[0].preventDefault ) {
        // force left top to allow flipping
        options.at = "left top";
    }
    targetWidth = dimensions.width;
    targetHeight = dimensions.height;
    targetOffset = dimensions.offset;
    // clone to reuse original targetOffset later
    basePosition = $.extend( {}, targetOffset );
 
    // force my and at to have valid horizontal and vertical positions
    // if a value is missing or invalid, it will be converted to center
    $.each( [ "my", "at" ], function() {
        var pos = ( options[ this ] || "" ).split( " " ),
            horizontalOffset,
            verticalOffset;
 
        if ( pos.length === 1) {
            pos = rhorizontal.test( pos[ 0 ] ) ?
                pos.concat( [ "center" ] ) :
                rvertical.test( pos[ 0 ] ) ?
                    [ "center" ].concat( pos ) :
                    [ "center", "center" ];
        }
        pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
        pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
 
        // calculate offsets
        horizontalOffset = roffset.exec( pos[ 0 ] );
        verticalOffset = roffset.exec( pos[ 1 ] );
        offsets[ this ] = [
            horizontalOffset ? horizontalOffset[ 0 ] : 0,
            verticalOffset ? verticalOffset[ 0 ] : 0
        ];
 
        // reduce to just the positions without the offsets
        options[ this ] = [
            rposition.exec( pos[ 0 ] )[ 0 ],
            rposition.exec( pos[ 1 ] )[ 0 ]
        ];
    });
 
    // normalize collision option
    if ( collision.length === 1 ) {
        collision[ 1 ] = collision[ 0 ];
    }
 
    if ( options.at[ 0 ] === "right" ) {
        basePosition.left += targetWidth;
    } else if ( options.at[ 0 ] === "center" ) {
        basePosition.left += targetWidth / 2;
    }
 
    if ( options.at[ 1 ] === "bottom" ) {
        basePosition.top += targetHeight;
    } else if ( options.at[ 1 ] === "center" ) {
        basePosition.top += targetHeight / 2;
    }
 
    atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
    basePosition.left += atOffset[ 0 ];
    basePosition.top += atOffset[ 1 ];
 
    return this.each(function() {
        var collisionPosition, using,
            elem = $( this ),
            elemWidth = elem.outerWidth(),
            elemHeight = elem.outerHeight(),
            marginLeft = parseCss( this, "marginLeft" ),
            marginTop = parseCss( this, "marginTop" ),
            collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
            collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
            position = $.extend( {}, basePosition ),
            myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
 
        if ( options.my[ 0 ] === "right" ) {
            position.left -= elemWidth;
        } else if ( options.my[ 0 ] === "center" ) {
            position.left -= elemWidth / 2;
        }
 
        if ( options.my[ 1 ] === "bottom" ) {
            position.top -= elemHeight;
        } else if ( options.my[ 1 ] === "center" ) {
            position.top -= elemHeight / 2;
        }
 
        position.left += myOffset[ 0 ];
        position.top += myOffset[ 1 ];
 
        // if the browser doesn't support fractions, then round for consistent results
        if ( !supportsOffsetFractions ) {
            position.left = round( position.left );
            position.top = round( position.top );
        }
 
        collisionPosition = {
            marginLeft: marginLeft,
            marginTop: marginTop
        };
 
        $.each( [ "left", "top" ], function( i, dir ) {
            if ( $.ui.position[ collision[ i ] ] ) {
                $.ui.position[ collision[ i ] ][ dir ]( position, {
                    targetWidth: targetWidth,
                    targetHeight: targetHeight,
                    elemWidth: elemWidth,
                    elemHeight: elemHeight,
                    collisionPosition: collisionPosition,
                    collisionWidth: collisionWidth,
                    collisionHeight: collisionHeight,
                    offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
                    my: options.my,
                    at: options.at,
                    within: within,
                    elem: elem
                });
            }
        });
 
        if ( options.using ) {
            // adds feedback as second argument to using callback, if present
            using = function( props ) {
                var left = targetOffset.left - position.left,
                    right = left + targetWidth - elemWidth,
                    top = targetOffset.top - position.top,
                    bottom = top + targetHeight - elemHeight,
                    feedback = {
                        target: {
                            element: target,
                            left: targetOffset.left,
                            top: targetOffset.top,
                            width: targetWidth,
                            height: targetHeight
                        },
                        element: {
                            element: elem,
                            left: position.left,
                            top: position.top,
                            width: elemWidth,
                            height: elemHeight
                        },
                        horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
                        vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
                    };
                if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
                    feedback.horizontal = "center";
                }
                if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
                    feedback.vertical = "middle";
                }
                if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
                    feedback.important = "horizontal";
                } else {
                    feedback.important = "vertical";
                }
                options.using.call( this, props, feedback );
            };
        }
 
        elem.offset( $.extend( position, { using: using } ) );
    });
};
 
$.ui.position = {
    fit: {
        left: function( position, data ) {
            var within = data.within,
                withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                outerWidth = within.width,
                collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                overLeft = withinOffset - collisionPosLeft,
                overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
                newOverRight;
 
            // element is wider than within
            if ( data.collisionWidth > outerWidth ) {
                // element is initially over the left side of within
                if ( overLeft > 0 && overRight <= 0 ) {
                    newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
                    position.left += overLeft - newOverRight;
                // element is initially over right side of within
                } else if ( overRight > 0 && overLeft <= 0 ) {
                    position.left = withinOffset;
                // element is initially over both left and right sides of within
                } else {
                    if ( overLeft > overRight ) {
                        position.left = withinOffset + outerWidth - data.collisionWidth;
                    } else {
                        position.left = withinOffset;
                    }
                }
            // too far left -> align with left edge
            } else if ( overLeft > 0 ) {
                position.left += overLeft;
            // too far right -> align with right edge
            } else if ( overRight > 0 ) {
                position.left -= overRight;
            // adjust based on position and margin
            } else {
                position.left = max( position.left - collisionPosLeft, position.left );
            }
        },
        top: function( position, data ) {
            var within = data.within,
                withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
                outerHeight = data.within.height,
                collisionPosTop = position.top - data.collisionPosition.marginTop,
                overTop = withinOffset - collisionPosTop,
                overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
                newOverBottom;
 
            // element is taller than within
            if ( data.collisionHeight > outerHeight ) {
                // element is initially over the top of within
                if ( overTop > 0 && overBottom <= 0 ) {
                    newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
                    position.top += overTop - newOverBottom;
                // element is initially over bottom of within
                } else if ( overBottom > 0 && overTop <= 0 ) {
                    position.top = withinOffset;
                // element is initially over both top and bottom of within
                } else {
                    if ( overTop > overBottom ) {
                        position.top = withinOffset + outerHeight - data.collisionHeight;
                    } else {
                        position.top = withinOffset;
                    }
                }
            // too far up -> align with top
            } else if ( overTop > 0 ) {
                position.top += overTop;
            // too far down -> align with bottom edge
            } else if ( overBottom > 0 ) {
                position.top -= overBottom;
            // adjust based on position and margin
            } else {
                position.top = max( position.top - collisionPosTop, position.top );
            }
        }
    },
    flip: {
        left: function( position, data ) {
            var within = data.within,
                withinOffset = within.offset.left + within.scrollLeft,
                outerWidth = within.width,
                offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
                collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                overLeft = collisionPosLeft - offsetLeft,
                overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
                myOffset = data.my[ 0 ] === "left" ?
                    -data.elemWidth :
                    data.my[ 0 ] === "right" ?
                        data.elemWidth :
                        0,
                atOffset = data.at[ 0 ] === "left" ?
                    data.targetWidth :
                    data.at[ 0 ] === "right" ?
                        -data.targetWidth :
                        0,
                offset = -2 * data.offset[ 0 ],
                newOverRight,
                newOverLeft;
 
            if ( overLeft < 0 ) {
                newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
                if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
                    position.left += myOffset + atOffset + offset;
                }
            } else if ( overRight > 0 ) {
                newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
                if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
                    position.left += myOffset + atOffset + offset;
                }
            }
        },
        top: function( position, data ) {
            var within = data.within,
                withinOffset = within.offset.top + within.scrollTop,
                outerHeight = within.height,
                offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
                collisionPosTop = position.top - data.collisionPosition.marginTop,
                overTop = collisionPosTop - offsetTop,
                overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
                top = data.my[ 1 ] === "top",
                myOffset = top ?
                    -data.elemHeight :
                    data.my[ 1 ] === "bottom" ?
                        data.elemHeight :
                        0,
                atOffset = data.at[ 1 ] === "top" ?
                    data.targetHeight :
                    data.at[ 1 ] === "bottom" ?
                        -data.targetHeight :
                        0,
                offset = -2 * data.offset[ 1 ],
                newOverTop,
                newOverBottom;
            if ( overTop < 0 ) {
                newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
                if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
                    position.top += myOffset + atOffset + offset;
                }
            } else if ( overBottom > 0 ) {
                newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
                if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
                    position.top += myOffset + atOffset + offset;
                }
            }
        }
    },
    flipfit: {
        left: function() {
            $.ui.position.flip.left.apply( this, arguments );
            $.ui.position.fit.left.apply( this, arguments );
        },
        top: function() {
            $.ui.position.flip.top.apply( this, arguments );
            $.ui.position.fit.top.apply( this, arguments );
        }
    }
};
 
// fraction support test
(function() {
    var testElement, testElementParent, testElementStyle, offsetLeft, i,
        body = document.getElementsByTagName( "body" )[ 0 ],
        div = document.createElement( "div" );
 
    //Create a "fake body" for testing based on method used in jQuery.support
    testElement = document.createElement( body ? "div" : "body" );
    testElementStyle = {
        visibility: "hidden",
        width: 0,
        height: 0,
        border: 0,
        margin: 0,
        background: "none"
    };
    if ( body ) {
        $.extend( testElementStyle, {
            position: "absolute",
            left: "-1000px",
            top: "-1000px"
        });
    }
    for ( i in testElementStyle ) {
        testElement.style[ i ] = testElementStyle[ i ];
    }
    testElement.appendChild( div );
    testElementParent = body || document.documentElement;
    testElementParent.insertBefore( testElement, testElementParent.firstChild );
 
    div.style.cssText = "position: absolute; left: 10.7432222px;";
 
    offsetLeft = $( div ).offset().left;
    supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
 
    testElement.innerHTML = "";
    testElementParent.removeChild( testElement );
})();
 
})();
 
var position = $.ui.position;
 
 
/*!
 * jQuery UI Draggable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/draggable/
 */
 
 
$.widget("ui.draggable", $.ui.mouse, {
    version: "1.11.4",
    widgetEventPrefix: "drag",
    options: {
        addClasses: true,
        appendTo: "parent",
        axis: false,
        connectToSortable: false,
        containment: false,
        cursor: "auto",
        cursorAt: false,
        grid: false,
        handle: false,
        helper: "original",
        iframeFix: false,
        opacity: false,
        refreshPositions: false,
        revert: false,
        revertDuration: 500,
        scope: "default",
        scroll: true,
        scrollSensitivity: 20,
        scrollSpeed: 20,
        snap: false,
        snapMode: "both",
        snapTolerance: 20,
        stack: false,
        zIndex: false,
 
        // callbacks
        drag: null,
        start: null,
        stop: null
    },
    _create: function() {
 
        if ( this.options.helper === "original" ) {
            this._setPositionRelative();
        }
        if (this.options.addClasses){
            this.element.addClass("ui-draggable");
        }
        if (this.options.disabled){
            this.element.addClass("ui-draggable-disabled");
        }
        this._setHandleClassName();
 
        this._mouseInit();
    },
 
    _setOption: function( key, value ) {
        this._super( key, value );
        if ( key === "handle" ) {
            this._removeHandleClassName();
            this._setHandleClassName();
        }
    },
 
    _destroy: function() {
        if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
            this.destroyOnClear = true;
            return;
        }
        this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
        this._removeHandleClassName();
        this._mouseDestroy();
    },
 
    _mouseCapture: function(event) {
        var o = this.options;
 
        this._blurActiveElement( event );
 
        // among others, prevent a drag on a resizable-handle
        if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
            return false;
        }
 
        //Quit if we're not on a valid handle
        this.handle = this._getHandle(event);
        if (!this.handle) {
            return false;
        }
 
        this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
 
        return true;
 
    },
 
    _blockFrames: function( selector ) {
        this.iframeBlocks = this.document.find( selector ).map(function() {
            var iframe = $( this );
 
            return $( "<div>" )
                .css( "position", "absolute" )
                .appendTo( iframe.parent() )
                .outerWidth( iframe.outerWidth() )
                .outerHeight( iframe.outerHeight() )
                .offset( iframe.offset() )[ 0 ];
        });
    },
 
    _unblockFrames: function() {
        if ( this.iframeBlocks ) {
            this.iframeBlocks.remove();
            delete this.iframeBlocks;
        }
    },
 
    _blurActiveElement: function( event ) {
        var document = this.document[ 0 ];
 
        // Only need to blur if the event occurred on the draggable itself, see #10527
        if ( !this.handleElement.is( event.target ) ) {
            return;
        }
 
        // support: IE9
        // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
        try {
 
            // Support: IE9, IE10
            // If the <body> is blurred, IE will switch windows, see #9520
            if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
 
                // Blur any element that currently has focus, see #4261
                $( document.activeElement ).blur();
            }
        } catch ( error ) {}
    },
 
    _mouseStart: function(event) {
 
        var o = this.options;
 
        //Create and append the visible helper
        this.helper = this._createHelper(event);
 
        this.helper.addClass("ui-draggable-dragging");
 
        //Cache the helper size
        this._cacheHelperProportions();
 
        //If ddmanager is used for droppables, set the global draggable
        if ($.ui.ddmanager) {
            $.ui.ddmanager.current = this;
        }
 
        /*
         * - Position generation -
         * This block generates everything position related - it's the core of draggables.
         */
 
        //Cache the margins of the original element
        this._cacheMargins();
 
        //Store the helper's css position
        this.cssPosition = this.helper.css( "position" );
        this.scrollParent = this.helper.scrollParent( true );
        this.offsetParent = this.helper.offsetParent();
        this.hasFixedAncestor = this.helper.parents().filter(function() {
                return $( this ).css( "position" ) === "fixed";
            }).length > 0;
 
        //The element's absolute position on the page minus margins
        this.positionAbs = this.element.offset();
        this._refreshOffsets( event );
 
        //Generate the original position
        this.originalPosition = this.position = this._generatePosition( event, false );
        this.originalPageX = event.pageX;
        this.originalPageY = event.pageY;
 
        //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
        (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
 
        //Set a containment if given in the options
        this._setContainment();
 
        //Trigger event + callbacks
        if (this._trigger("start", event) === false) {
            this._clear();
            return false;
        }
 
        //Recache the helper size
        this._cacheHelperProportions();
 
        //Prepare the droppable offsets
        if ($.ui.ddmanager && !o.dropBehaviour) {
            $.ui.ddmanager.prepareOffsets(this, event);
        }
 
        // Reset helper's right/bottom css if they're set and set explicit width/height instead
        // as this prevents resizing of elements with right/bottom set (see #7772)
        this._normalizeRightBottom();
 
        this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
 
        //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
        if ( $.ui.ddmanager ) {
            $.ui.ddmanager.dragStart(this, event);
        }
 
        return true;
    },
 
    _refreshOffsets: function( event ) {
        this.offset = {
            top: this.positionAbs.top - this.margins.top,
            left: this.positionAbs.left - this.margins.left,
            scroll: false,
            parent: this._getParentOffset(),
            relative: this._getRelativeOffset()
        };
 
        this.offset.click = {
            left: event.pageX - this.offset.left,
            top: event.pageY - this.offset.top
        };
    },
 
    _mouseDrag: function(event, noPropagation) {
        // reset any necessary cached properties (see #5009)
        if ( this.hasFixedAncestor ) {
            this.offset.parent = this._getParentOffset();
        }
 
        //Compute the helpers position
        this.position = this._generatePosition( event, true );
        this.positionAbs = this._convertPositionTo("absolute");
 
        //Call plugins and callbacks and use the resulting position if something is returned
        if (!noPropagation) {
            var ui = this._uiHash();
            if (this._trigger("drag", event, ui) === false) {
                this._mouseUp({});
                return false;
            }
            this.position = ui.position;
        }
 
        this.helper[ 0 ].style.left = this.position.left + "px";
        this.helper[ 0 ].style.top = this.position.top + "px";
 
        if ($.ui.ddmanager) {
            $.ui.ddmanager.drag(this, event);
        }
 
        return false;
    },
 
    _mouseStop: function(event) {
 
        //If we are using droppables, inform the manager about the drop
        var that = this,
            dropped = false;
        if ($.ui.ddmanager && !this.options.dropBehaviour) {
            dropped = $.ui.ddmanager.drop(this, event);
        }
 
        //if a drop comes from outside (a sortable)
        if (this.dropped) {
            dropped = this.dropped;
            this.dropped = false;
        }
 
        if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
            $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
                if (that._trigger("stop", event) !== false) {
                    that._clear();
                }
            });
        } else {
            if (this._trigger("stop", event) !== false) {
                this._clear();
            }
        }
 
        return false;
    },
 
    _mouseUp: function( event ) {
        this._unblockFrames();
 
        //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
        if ( $.ui.ddmanager ) {
            $.ui.ddmanager.dragStop(this, event);
        }
 
        // Only need to focus if the event occurred on the draggable itself, see #10527
        if ( this.handleElement.is( event.target ) ) {
            // The interaction is over; whether or not the click resulted in a drag, focus the element
            this.element.focus();
        }
 
        return $.ui.mouse.prototype._mouseUp.call(this, event);
    },
 
    cancel: function() {
 
        if (this.helper.is(".ui-draggable-dragging")) {
            this._mouseUp({});
        } else {
            this._clear();
        }
 
        return this;
 
    },
 
    _getHandle: function(event) {
        return this.options.handle ?
            !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
            true;
    },
 
    _setHandleClassName: function() {
        this.handleElement = this.options.handle ?
            this.element.find( this.options.handle ) : this.element;
        this.handleElement.addClass( "ui-draggable-handle" );
    },
 
    _removeHandleClassName: function() {
        this.handleElement.removeClass( "ui-draggable-handle" );
    },
 
    _createHelper: function(event) {
 
        var o = this.options,
            helperIsFunction = $.isFunction( o.helper ),
            helper = helperIsFunction ?
                $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
                ( o.helper === "clone" ?
                    this.element.clone().removeAttr( "id" ) :
                    this.element );
 
        if (!helper.parents("body").length) {
            helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
        }
 
        // http://bugs.jqueryui.com/ticket/9446
        // a helper function can return the original element
        // which wouldn't have been set to relative in _create
        if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
            this._setPositionRelative();
        }
 
        if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
            helper.css("position", "absolute");
        }
 
        return helper;
 
    },
 
    _setPositionRelative: function() {
        if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
            this.element[ 0 ].style.position = "relative";
        }
    },
 
    _adjustOffsetFromHelper: function(obj) {
        if (typeof obj === "string") {
            obj = obj.split(" ");
        }
        if ($.isArray(obj)) {
            obj = { left: +obj[0], top: +obj[1] || 0 };
        }
        if ("left" in obj) {
            this.offset.click.left = obj.left + this.margins.left;
        }
        if ("right" in obj) {
            this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
        }
        if ("top" in obj) {
            this.offset.click.top = obj.top + this.margins.top;
        }
        if ("bottom" in obj) {
            this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
        }
    },
 
    _isRootNode: function( element ) {
        return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
    },
 
    _getParentOffset: function() {
 
        //Get the offsetParent and cache its position
        var po = this.offsetParent.offset(),
            document = this.document[ 0 ];
 
        // This is a special case where we need to modify a offset calculated on start, since the following happened:
        // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
        // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
        //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
        if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
            po.left += this.scrollParent.scrollLeft();
            po.top += this.scrollParent.scrollTop();
        }
 
        if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
            po = { top: 0, left: 0 };
        }
 
        return {
            top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
            left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
        };
 
    },
 
    _getRelativeOffset: function() {
        if ( this.cssPosition !== "relative" ) {
            return { top: 0, left: 0 };
        }
 
        var p = this.element.position(),
            scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
 
        return {
            top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
            left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 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 isUserScrollable, c, ce,
            o = this.options,
            document = this.document[ 0 ];
 
        this.relativeContainer = null;
 
        if ( !o.containment ) {
            this.containment = null;
            return;
        }
 
        if ( o.containment === "window" ) {
            this.containment = [
                $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
                $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
                $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
                $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
            ];
            return;
        }
 
        if ( o.containment === "document") {
            this.containment = [
                0,
                0,
                $( document ).width() - this.helperProportions.width - this.margins.left,
                ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
            ];
            return;
        }
 
        if ( o.containment.constructor === Array ) {
            this.containment = o.containment;
            return;
        }
 
        if ( o.containment === "parent" ) {
            o.containment = this.helper[ 0 ].parentNode;
        }
 
        c = $( o.containment );
        ce = c[ 0 ];
 
        if ( !ce ) {
            return;
        }
 
        isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
 
        this.containment = [
            ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
            ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
            ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
                ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
                ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
                this.helperProportions.width -
                this.margins.left -
                this.margins.right,
            ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
                ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
                ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
                this.helperProportions.height -
                this.margins.top -
                this.margins.bottom
        ];
        this.relativeContainer = c;
    },
 
    _convertPositionTo: function(d, pos) {
 
        if (!pos) {
            pos = this.position;
        }
 
        var mod = d === "absolute" ? 1 : -1,
            scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
 
        return {
            top: (
                pos.top +                                                               // The absolute mouse position
                this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.top * mod -                                      // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
            ),
            left: (
                pos.left +                                                              // The absolute mouse position
                this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
            )
        };
 
    },
 
    _generatePosition: function( event, constrainPosition ) {
 
        var containment, co, top, left,
            o = this.options,
            scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
            pageX = event.pageX,
            pageY = event.pageY;
 
        // Cache the scroll
        if ( !scrollIsRootNode || !this.offset.scroll ) {
            this.offset.scroll = {
                top: this.scrollParent.scrollTop(),
                left: this.scrollParent.scrollLeft()
            };
        }
 
        /*
         * - Position constraining -
         * Constrain the position to a mix of grid, containment.
         */
 
        // If we are not dragging yet, we won't check for options
        if ( constrainPosition ) {
            if ( this.containment ) {
                if ( this.relativeContainer ){
                    co = this.relativeContainer.offset();
                    containment = [
                        this.containment[ 0 ] + co.left,
                        this.containment[ 1 ] + co.top,
                        this.containment[ 2 ] + co.left,
                        this.containment[ 3 ] + co.top
                    ];
                } else {
                    containment = this.containment;
                }
 
                if (event.pageX - this.offset.click.left < containment[0]) {
                    pageX = containment[0] + this.offset.click.left;
                }
                if (event.pageY - this.offset.click.top < containment[1]) {
                    pageY = containment[1] + this.offset.click.top;
                }
                if (event.pageX - this.offset.click.left > containment[2]) {
                    pageX = containment[2] + this.offset.click.left;
                }
                if (event.pageY - this.offset.click.top > containment[3]) {
                    pageY = containment[3] + this.offset.click.top;
                }
            }
 
            if (o.grid) {
                //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
                top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
                pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
 
                left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
                pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
            }
 
            if ( o.axis === "y" ) {
                pageX = this.originalPageX;
            }
 
            if ( o.axis === "x" ) {
                pageY = this.originalPageY;
            }
        }
 
        return {
            top: (
                pageY -                                                                 // The absolute mouse position
                this.offset.click.top   -                                               // Click offset (relative to the element)
                this.offset.relative.top -                                              // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
                ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
            ),
            left: (
                pageX -                                                                 // The absolute mouse position
                this.offset.click.left -                                                // Click offset (relative to the element)
                this.offset.relative.left -                                             // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
                ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
            )
        };
 
    },
 
    _clear: function() {
        this.helper.removeClass("ui-draggable-dragging");
        if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
            this.helper.remove();
        }
        this.helper = null;
        this.cancelHelperRemoval = false;
        if ( this.destroyOnClear ) {
            this.destroy();
        }
    },
 
    _normalizeRightBottom: function() {
        if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
            this.helper.width( this.helper.width() );
            this.helper.css( "right", "auto" );
        }
        if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
            this.helper.height( this.helper.height() );
            this.helper.css( "bottom", "auto" );
        }
    },
 
    // From now on bulk stuff - mainly helpers
 
    _trigger: function( type, event, ui ) {
        ui = ui || this._uiHash();
        $.ui.plugin.call( this, type, [ event, ui, this ], true );
 
        // Absolute position and offset (see #6884 ) have to be recalculated after plugins
        if ( /^(drag|start|stop)/.test( type ) ) {
            this.positionAbs = this._convertPositionTo( "absolute" );
            ui.offset = this.positionAbs;
        }
        return $.Widget.prototype._trigger.call( this, type, event, ui );
    },
 
    plugins: {},
 
    _uiHash: function() {
        return {
            helper: this.helper,
            position: this.position,
            originalPosition: this.originalPosition,
            offset: this.positionAbs
        };
    }
 
});
 
$.ui.plugin.add( "draggable", "connectToSortable", {
    start: function( event, ui, draggable ) {
        var uiSortable = $.extend( {}, ui, {
            item: draggable.element
        });
 
        draggable.sortables = [];
        $( draggable.options.connectToSortable ).each(function() {
            var sortable = $( this ).sortable( "instance" );
 
            if ( sortable && !sortable.options.disabled ) {
                draggable.sortables.push( sortable );
 
                // refreshPositions is called at drag start to refresh the containerCache
                // which is used in drag. This ensures it's initialized and synchronized
                // with any changes that might have happened on the page since initialization.
                sortable.refreshPositions();
                sortable._trigger("activate", event, uiSortable);
            }
        });
    },
    stop: function( event, ui, draggable ) {
        var uiSortable = $.extend( {}, ui, {
            item: draggable.element
        });
 
        draggable.cancelHelperRemoval = false;
 
        $.each( draggable.sortables, function() {
            var sortable = this;
 
            if ( sortable.isOver ) {
                sortable.isOver = 0;
 
                // Allow this sortable to handle removing the helper
                draggable.cancelHelperRemoval = true;
                sortable.cancelHelperRemoval = false;
 
                // Use _storedCSS To restore properties in the sortable,
                // as this also handles revert (#9675) since the draggable
                // may have modified them in unexpected ways (#8809)
                sortable._storedCSS = {
                    position: sortable.placeholder.css( "position" ),
                    top: sortable.placeholder.css( "top" ),
                    left: sortable.placeholder.css( "left" )
                };
 
                sortable._mouseStop(event);
 
                // Once drag has ended, the sortable should return to using
                // its original helper, not the shared helper from draggable
                sortable.options.helper = sortable.options._helper;
            } else {
                // Prevent this Sortable from removing the helper.
                // However, don't set the draggable to remove the helper
                // either as another connected Sortable may yet handle the removal.
                sortable.cancelHelperRemoval = true;
 
                sortable._trigger( "deactivate", event, uiSortable );
            }
        });
    },
    drag: function( event, ui, draggable ) {
        $.each( draggable.sortables, function() {
            var innermostIntersecting = false,
                sortable = this;
 
            // Copy over variables that sortable's _intersectsWith uses
            sortable.positionAbs = draggable.positionAbs;
            sortable.helperProportions = draggable.helperProportions;
            sortable.offset.click = draggable.offset.click;
 
            if ( sortable._intersectsWith( sortable.containerCache ) ) {
                innermostIntersecting = true;
 
                $.each( draggable.sortables, function() {
                    // Copy over variables that sortable's _intersectsWith uses
                    this.positionAbs = draggable.positionAbs;
                    this.helperProportions = draggable.helperProportions;
                    this.offset.click = draggable.offset.click;
 
                    if ( this !== sortable &&
                            this._intersectsWith( this.containerCache ) &&
                            $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
                        innermostIntersecting = false;
                    }
 
                    return innermostIntersecting;
                });
            }
 
            if ( innermostIntersecting ) {
                // If it intersects, we use a little isOver variable and set it once,
                // so that the move-in stuff gets fired only once.
                if ( !sortable.isOver ) {
                    sortable.isOver = 1;
 
                    // Store draggable's parent in case we need to reappend to it later.
                    draggable._parent = ui.helper.parent();
 
                    sortable.currentItem = ui.helper
                        .appendTo( sortable.element )
                        .data( "ui-sortable-item", true );
 
                    // Store helper option to later restore it
                    sortable.options._helper = sortable.options.helper;
 
                    sortable.options.helper = function() {
                        return ui.helper[ 0 ];
                    };
 
                    // Fire the start events of the sortable with our passed browser event,
                    // and our own helper (so it doesn't create a new one)
                    event.target = sortable.currentItem[ 0 ];
                    sortable._mouseCapture( event, true );
                    sortable._mouseStart( event, true, true );
 
                    // Because the browser event is way off the new appended portlet,
                    // modify necessary variables to reflect the changes
                    sortable.offset.click.top = draggable.offset.click.top;
                    sortable.offset.click.left = draggable.offset.click.left;
                    sortable.offset.parent.left -= draggable.offset.parent.left -
                        sortable.offset.parent.left;
                    sortable.offset.parent.top -= draggable.offset.parent.top -
                        sortable.offset.parent.top;
 
                    draggable._trigger( "toSortable", event );
 
                    // Inform draggable that the helper is in a valid drop zone,
                    // used solely in the revert option to handle "valid/invalid".
                    draggable.dropped = sortable.element;
 
                    // Need to refreshPositions of all sortables in the case that
                    // adding to one sortable changes the location of the other sortables (#9675)
                    $.each( draggable.sortables, function() {
                        this.refreshPositions();
                    });
 
                    // hack so receive/update callbacks work (mostly)
                    draggable.currentItem = draggable.element;
                    sortable.fromOutside = draggable;
                }
 
                if ( sortable.currentItem ) {
                    sortable._mouseDrag( event );
                    // Copy the sortable's position because the draggable's can potentially reflect
                    // a relative position, while sortable is always absolute, which the dragged
                    // element has now become. (#8809)
                    ui.position = sortable.position;
                }
            } else {
                // If it doesn't intersect with the sortable, and it intersected before,
                // we fake the drag stop of the sortable, but make sure it doesn't remove
                // the helper by using cancelHelperRemoval.
                if ( sortable.isOver ) {
 
                    sortable.isOver = 0;
                    sortable.cancelHelperRemoval = true;
 
                    // Calling sortable's mouseStop would trigger a revert,
                    // so revert must be temporarily false until after mouseStop is called.
                    sortable.options._revert = sortable.options.revert;
                    sortable.options.revert = false;
 
                    sortable._trigger( "out", event, sortable._uiHash( sortable ) );
                    sortable._mouseStop( event, true );
 
                    // restore sortable behaviors that were modfied
                    // when the draggable entered the sortable area (#9481)
                    sortable.options.revert = sortable.options._revert;
                    sortable.options.helper = sortable.options._helper;
 
                    if ( sortable.placeholder ) {
                        sortable.placeholder.remove();
                    }
 
                    // Restore and recalculate the draggable's offset considering the sortable
                    // may have modified them in unexpected ways. (#8809, #10669)
                    ui.helper.appendTo( draggable._parent );
                    draggable._refreshOffsets( event );
                    ui.position = draggable._generatePosition( event, true );
 
                    draggable._trigger( "fromSortable", event );
 
                    // Inform draggable that the helper is no longer in a valid drop zone
                    draggable.dropped = false;
 
                    // Need to refreshPositions of all sortables just in case removing
                    // from one sortable changes the location of other sortables (#9675)
                    $.each( draggable.sortables, function() {
                        this.refreshPositions();
                    });
                }
            }
        });
    }
});
 
$.ui.plugin.add("draggable", "cursor", {
    start: function( event, ui, instance ) {
        var t = $( "body" ),
            o = instance.options;
 
        if (t.css("cursor")) {
            o._cursor = t.css("cursor");
        }
        t.css("cursor", o.cursor);
    },
    stop: function( event, ui, instance ) {
        var o = instance.options;
        if (o._cursor) {
            $("body").css("cursor", o._cursor);
        }
    }
});
 
$.ui.plugin.add("draggable", "opacity", {
    start: function( event, ui, instance ) {
        var t = $( ui.helper ),
            o = instance.options;
        if (t.css("opacity")) {
            o._opacity = t.css("opacity");
        }
        t.css("opacity", o.opacity);
    },
    stop: function( event, ui, instance ) {
        var o = instance.options;
        if (o._opacity) {
            $(ui.helper).css("opacity", o._opacity);
        }
    }
});
 
$.ui.plugin.add("draggable", "scroll", {
    start: function( event, ui, i ) {
        if ( !i.scrollParentNotHidden ) {
            i.scrollParentNotHidden = i.helper.scrollParent( false );
        }
 
        if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
            i.overflowOffset = i.scrollParentNotHidden.offset();
        }
    },
    drag: function( event, ui, i  ) {
 
        var o = i.options,
            scrolled = false,
            scrollParent = i.scrollParentNotHidden[ 0 ],
            document = i.document[ 0 ];
 
        if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
            if ( !o.axis || o.axis !== "x" ) {
                if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
                    scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
                } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
                    scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
                }
            }
 
            if ( !o.axis || o.axis !== "y" ) {
                if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
                    scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
                } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
                    scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
                }
            }
 
        } else {
 
            if (!o.axis || o.axis !== "x") {
                if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
                    scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
                } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
                    scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
                }
            }
 
            if (!o.axis || o.axis !== "y") {
                if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
                    scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
                } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
                    scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
                }
            }
 
        }
 
        if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
            $.ui.ddmanager.prepareOffsets(i, event);
        }
 
    }
});
 
$.ui.plugin.add("draggable", "snap", {
    start: function( event, ui, i ) {
 
        var o = i.options;
 
        i.snapElements = [];
 
        $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
            var $t = $(this),
                $o = $t.offset();
            if (this !== i.element[0]) {
                i.snapElements.push({
                    item: this,
                    width: $t.outerWidth(), height: $t.outerHeight(),
                    top: $o.top, left: $o.left
                });
            }
        });
 
    },
    drag: function( event, ui, inst ) {
 
        var ts, bs, ls, rs, l, r, t, b, i, first,
            o = inst.options,
            d = o.snapTolerance,
            x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
            y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
 
        for (i = inst.snapElements.length - 1; i >= 0; i--){
 
            l = inst.snapElements[i].left - inst.margins.left;
            r = l + inst.snapElements[i].width;
            t = inst.snapElements[i].top - inst.margins.top;
            b = t + inst.snapElements[i].height;
 
            if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
                if (inst.snapElements[i].snapping) {
                    (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
                }
                inst.snapElements[i].snapping = false;
                continue;
            }
 
            if (o.snapMode !== "inner") {
                ts = Math.abs(t - y2) <= d;
                bs = Math.abs(b - y1) <= d;
                ls = Math.abs(l - x2) <= d;
                rs = Math.abs(r - x1) <= d;
                if (ts) {
                    ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
                }
                if (bs) {
                    ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
                }
                if (ls) {
                    ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
                }
                if (rs) {
                    ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
                }
            }
 
            first = (ts || bs || ls || rs);
 
            if (o.snapMode !== "outer") {
                ts = Math.abs(t - y1) <= d;
                bs = Math.abs(b - y2) <= d;
                ls = Math.abs(l - x1) <= d;
                rs = Math.abs(r - x2) <= d;
                if (ts) {
                    ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
                }
                if (bs) {
                    ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
                }
                if (ls) {
                    ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
                }
                if (rs) {
                    ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
                }
            }
 
            if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
                (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
            }
            inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
 
        }
 
    }
});
 
$.ui.plugin.add("draggable", "stack", {
    start: function( event, ui, instance ) {
        var min,
            o = instance.options,
            group = $.makeArray($(o.stack)).sort(function(a, b) {
                return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
            });
 
        if (!group.length) { return; }
 
        min = parseInt($(group[0]).css("zIndex"), 10) || 0;
        $(group).each(function(i) {
            $(this).css("zIndex", min + i);
        });
        this.css("zIndex", (min + group.length));
    }
});
 
$.ui.plugin.add("draggable", "zIndex", {
    start: function( event, ui, instance ) {
        var t = $( ui.helper ),
            o = instance.options;
 
        if (t.css("zIndex")) {
            o._zIndex = t.css("zIndex");
        }
        t.css("zIndex", o.zIndex);
    },
    stop: function( event, ui, instance ) {
        var o = instance.options;
 
        if (o._zIndex) {
            $(ui.helper).css("zIndex", o._zIndex);
        }
    }
});
 
var draggable = $.ui.draggable;
 
 
/*!
 * jQuery UI Droppable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/droppable/
 */
 
 
$.widget( "ui.droppable", {
    version: "1.11.4",
    widgetEventPrefix: "drop",
    options: {
        accept: "*",
        activeClass: false,
        addClasses: true,
        greedy: false,
        hoverClass: false,
        scope: "default",
        tolerance: "intersect",
 
        // callbacks
        activate: null,
        deactivate: null,
        drop: null,
        out: null,
        over: null
    },
    _create: function() {
 
        var proportions,
            o = this.options,
            accept = o.accept;
 
        this.isover = false;
        this.isout = true;
 
        this.accept = $.isFunction( accept ) ? accept : function( d ) {
            return d.is( accept );
        };
 
        this.proportions = function( /* valueToWrite */ ) {
            if ( arguments.length ) {
                // Store the droppable's proportions
                proportions = arguments[ 0 ];
            } else {
                // Retrieve or derive the droppable's proportions
                return proportions ?
                    proportions :
                    proportions = {
                        width: this.element[ 0 ].offsetWidth,
                        height: this.element[ 0 ].offsetHeight
                    };
            }
        };
 
        this._addToManager( o.scope );
 
        o.addClasses && this.element.addClass( "ui-droppable" );
 
    },
 
    _addToManager: function( scope ) {
        // Add the reference and positions to the manager
        $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
        $.ui.ddmanager.droppables[ scope ].push( this );
    },
 
    _splice: function( drop ) {
        var i = 0;
        for ( ; i < drop.length; i++ ) {
            if ( drop[ i ] === this ) {
                drop.splice( i, 1 );
            }
        }
    },
 
    _destroy: function() {
        var drop = $.ui.ddmanager.droppables[ this.options.scope ];
 
        this._splice( drop );
 
        this.element.removeClass( "ui-droppable ui-droppable-disabled" );
    },
 
    _setOption: function( key, value ) {
 
        if ( key === "accept" ) {
            this.accept = $.isFunction( value ) ? value : function( d ) {
                return d.is( value );
            };
        } else if ( key === "scope" ) {
            var drop = $.ui.ddmanager.droppables[ this.options.scope ];
 
            this._splice( drop );
            this._addToManager( value );
        }
 
        this._super( key, value );
    },
 
    _activate: function( event ) {
        var draggable = $.ui.ddmanager.current;
        if ( this.options.activeClass ) {
            this.element.addClass( this.options.activeClass );
        }
        if ( draggable ){
            this._trigger( "activate", event, this.ui( draggable ) );
        }
    },
 
    _deactivate: function( event ) {
        var draggable = $.ui.ddmanager.current;
        if ( this.options.activeClass ) {
            this.element.removeClass( this.options.activeClass );
        }
        if ( draggable ){
            this._trigger( "deactivate", event, this.ui( draggable ) );
        }
    },
 
    _over: function( event ) {
 
        var draggable = $.ui.ddmanager.current;
 
        // Bail if draggable and droppable are same element
        if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
            return;
        }
 
        if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
            if ( this.options.hoverClass ) {
                this.element.addClass( this.options.hoverClass );
            }
            this._trigger( "over", event, this.ui( draggable ) );
        }
 
    },
 
    _out: function( event ) {
 
        var draggable = $.ui.ddmanager.current;
 
        // Bail if draggable and droppable are same element
        if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
            return;
        }
 
        if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
            if ( this.options.hoverClass ) {
                this.element.removeClass( this.options.hoverClass );
            }
            this._trigger( "out", event, this.ui( draggable ) );
        }
 
    },
 
    _drop: function( event, custom ) {
 
        var draggable = custom || $.ui.ddmanager.current,
            childrenIntersection = false;
 
        // Bail if draggable and droppable are same element
        if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
            return false;
        }
 
        this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
            var inst = $( this ).droppable( "instance" );
            if (
                inst.options.greedy &&
                !inst.options.disabled &&
                inst.options.scope === draggable.options.scope &&
                inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
                $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
            ) { childrenIntersection = true; return false; }
        });
        if ( childrenIntersection ) {
            return false;
        }
 
        if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
            if ( this.options.activeClass ) {
                this.element.removeClass( this.options.activeClass );
            }
            if ( this.options.hoverClass ) {
                this.element.removeClass( this.options.hoverClass );
            }
            this._trigger( "drop", event, this.ui( draggable ) );
            return this.element;
        }
 
        return false;
 
    },
 
    ui: function( c ) {
        return {
            draggable: ( c.currentItem || c.element ),
            helper: c.helper,
            position: c.position,
            offset: c.positionAbs
        };
    }
 
});
 
$.ui.intersect = (function() {
    function isOverAxis( x, reference, size ) {
        return ( x >= reference ) && ( x < ( reference + size ) );
    }
 
    return function( draggable, droppable, toleranceMode, event ) {
 
        if ( !droppable.offset ) {
            return false;
        }
 
        var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
            y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
            x2 = x1 + draggable.helperProportions.width,
            y2 = y1 + draggable.helperProportions.height,
            l = droppable.offset.left,
            t = droppable.offset.top,
            r = l + droppable.proportions().width,
            b = t + droppable.proportions().height;
 
        switch ( toleranceMode ) {
        case "fit":
            return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
        case "intersect":
            return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
                x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
                t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
                y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
        case "pointer":
            return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
        case "touch":
            return (
                ( y1 >= t && y1 <= b ) || // Top edge touching
                ( y2 >= t && y2 <= b ) || // Bottom edge touching
                ( y1 < t && y2 > b ) // Surrounded vertically
            ) && (
                ( x1 >= l && x1 <= r ) || // Left edge touching
                ( x2 >= l && x2 <= r ) || // Right edge touching
                ( x1 < l && x2 > r ) // Surrounded horizontally
            );
        default:
            return false;
        }
    };
})();
 
/*
    This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
    current: null,
    droppables: { "default": [] },
    prepareOffsets: function( t, event ) {
 
        var i, j,
            m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
            type = event ? event.type : null, // workaround for #2317
            list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
 
        droppablesLoop: for ( i = 0; i < m.length; i++ ) {
 
            // No disabled and non-accepted
            if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
                continue;
            }
 
            // Filter out elements in the current dragged item
            for ( j = 0; j < list.length; j++ ) {
                if ( list[ j ] === m[ i ].element[ 0 ] ) {
                    m[ i ].proportions().height = 0;
                    continue droppablesLoop;
                }
            }
 
            m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
            if ( !m[ i ].visible ) {
                continue;
            }
 
            // Activate the droppable if used directly from draggables
            if ( type === "mousedown" ) {
                m[ i ]._activate.call( m[ i ], event );
            }
 
            m[ i ].offset = m[ i ].element.offset();
            m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
 
        }
 
    },
    drop: function( draggable, event ) {
 
        var dropped = false;
        // Create a copy of the droppables in case the list changes during the drop (#9116)
        $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
 
            if ( !this.options ) {
                return;
            }
            if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
                dropped = this._drop.call( this, event ) || dropped;
            }
 
            if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
                this.isout = true;
                this.isover = false;
                this._deactivate.call( this, event );
            }
 
        });
        return dropped;
 
    },
    dragStart: function( draggable, event ) {
        // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
        draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
            if ( !draggable.options.refreshPositions ) {
                $.ui.ddmanager.prepareOffsets( draggable, event );
            }
        });
    },
    drag: function( draggable, event ) {
 
        // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
        if ( draggable.options.refreshPositions ) {
            $.ui.ddmanager.prepareOffsets( draggable, event );
        }
 
        // Run through all droppables and check their positions based on specific tolerance options
        $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
 
            if ( this.options.disabled || this.greedyChild || !this.visible ) {
                return;
            }
 
            var parentInstance, scope, parent,
                intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
                c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
            if ( !c ) {
                return;
            }
 
            if ( this.options.greedy ) {
                // find droppable parents with same scope
                scope = this.options.scope;
                parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
                    return $( this ).droppable( "instance" ).options.scope === scope;
                });
 
                if ( parent.length ) {
                    parentInstance = $( parent[ 0 ] ).droppable( "instance" );
                    parentInstance.greedyChild = ( c === "isover" );
                }
            }
 
            // we just moved into a greedy child
            if ( parentInstance && c === "isover" ) {
                parentInstance.isover = false;
                parentInstance.isout = true;
                parentInstance._out.call( parentInstance, event );
            }
 
            this[ c ] = true;
            this[c === "isout" ? "isover" : "isout"] = false;
            this[c === "isover" ? "_over" : "_out"].call( this, event );
 
            // we just moved out of a greedy child
            if ( parentInstance && c === "isout" ) {
                parentInstance.isout = false;
                parentInstance.isover = true;
                parentInstance._over.call( parentInstance, event );
            }
        });
 
    },
    dragStop: function( draggable, event ) {
        draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
        // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
        if ( !draggable.options.refreshPositions ) {
            $.ui.ddmanager.prepareOffsets( draggable, event );
        }
    }
};
 
var droppable = $.ui.droppable;
 
 
/*!
 * jQuery UI Resizable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/resizable/
 */
 
 
$.widget("ui.resizable", $.ui.mouse, {
    version: "1.11.4",
    widgetEventPrefix: "resize",
    options: {
        alsoResize: false,
        animate: false,
        animateDuration: "slow",
        animateEasing: "swing",
        aspectRatio: false,
        autoHide: false,
        containment: false,
        ghost: false,
        grid: false,
        handles: "e,s,se",
        helper: false,
        maxHeight: null,
        maxWidth: null,
        minHeight: 10,
        minWidth: 10,
        // See #7960
        zIndex: 90,
 
        // callbacks
        resize: null,
        start: null,
        stop: null
    },
 
    _num: function( value ) {
        return parseInt( value, 10 ) || 0;
    },
 
    _isNumber: function( value ) {
        return !isNaN( parseInt( value, 10 ) );
    },
 
    _hasScroll: function( el, a ) {
 
        if ( $( el ).css( "overflow" ) === "hidden") {
            return false;
        }
 
        var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
            has = false;
 
        if ( el[ scroll ] > 0 ) {
            return true;
        }
 
        // TODO: determine which cases actually cause this to happen
        // if the element doesn't have the scroll set, see if it's possible to
        // set the scroll
        el[ scroll ] = 1;
        has = ( el[ scroll ] > 0 );
        el[ scroll ] = 0;
        return has;
    },
 
    _create: function() {
 
        var n, i, handle, axis, hname,
            that = this,
            o = this.options;
        this.element.addClass("ui-resizable");
 
        $.extend(this, {
            _aspectRatio: !!(o.aspectRatio),
            aspectRatio: o.aspectRatio,
            originalElement: this.element,
            _proportionallyResizeElements: [],
            _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
        });
 
        // Wrap the element if it cannot hold child nodes
        if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
 
            this.element.wrap(
                $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
                    position: this.element.css("position"),
                    width: this.element.outerWidth(),
                    height: this.element.outerHeight(),
                    top: this.element.css("top"),
                    left: this.element.css("left")
                })
            );
 
            this.element = this.element.parent().data(
                "ui-resizable", this.element.resizable( "instance" )
            );
 
            this.elementIsWrapper = true;
 
            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
            });
            // support: Safari
            // Prevent Safari textarea resize
            this.originalResizeStyle = this.originalElement.css("resize");
            this.originalElement.css("resize", "none");
 
            this._proportionallyResizeElements.push( this.originalElement.css({
                position: "static",
                zoom: 1,
                display: "block"
            }) );
 
            // support: IE9
            // avoid IE jump (hard set the margin)
            this.originalElement.css({ margin: this.originalElement.css("margin") });
 
            this._proportionallyResize();
        }
 
        this.handles = o.handles ||
            ( !$(".ui-resizable-handle", this.element).length ?
                "e,s,se" : {
                    n: ".ui-resizable-n",
                    e: ".ui-resizable-e",
                    s: ".ui-resizable-s",
                    w: ".ui-resizable-w",
                    se: ".ui-resizable-se",
                    sw: ".ui-resizable-sw",
                    ne: ".ui-resizable-ne",
                    nw: ".ui-resizable-nw"
                } );
 
        this._handles = $();
        if ( this.handles.constructor === String ) {
 
            if ( this.handles === "all") {
                this.handles = "n,e,s,w,se,sw,ne,nw";
            }
 
            n = this.handles.split(",");
            this.handles = {};
 
            for (i = 0; i < n.length; i++) {
 
                handle = $.trim(n[i]);
                hname = "ui-resizable-" + handle;
                axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
 
                axis.css({ zIndex: o.zIndex });
 
                // TODO : What's going on here?
                if ("se" === handle) {
                    axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
                }
 
                this.handles[handle] = ".ui-resizable-" + handle;
                this.element.append(axis);
            }
 
        }
 
        this._renderAxis = function(target) {
 
            var i, axis, padPos, padWrapper;
 
            target = target || this.element;
 
            for (i in this.handles) {
 
                if (this.handles[i].constructor === String) {
                    this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
                } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
                    this.handles[ i ] = $( this.handles[ i ] );
                    this._on( this.handles[ i ], { "mousedown": that._mouseDown });
                }
 
                if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
 
                    axis = $(this.handles[i], this.element);
 
                    padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
 
                    padPos = [ "padding",
                        /ne|nw|n/.test(i) ? "Top" :
                        /se|sw|s/.test(i) ? "Bottom" :
                        /^e$/.test(i) ? "Right" : "Left" ].join("");
 
                    target.css(padPos, padWrapper);
 
                    this._proportionallyResize();
                }
 
                this._handles = this._handles.add( this.handles[ i ] );
            }
        };
 
        // TODO: make renderAxis a prototype function
        this._renderAxis(this.element);
 
        this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
        this._handles.disableSelection();
 
        this._handles.mouseover(function() {
            if (!that.resizing) {
                if (this.className) {
                    axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
                }
                that.axis = axis && axis[1] ? axis[1] : "se";
            }
        });
 
        if (o.autoHide) {
            this._handles.hide();
            $(this.element)
                .addClass("ui-resizable-autohide")
                .mouseenter(function() {
                    if (o.disabled) {
                        return;
                    }
                    $(this).removeClass("ui-resizable-autohide");
                    that._handles.show();
                })
                .mouseleave(function() {
                    if (o.disabled) {
                        return;
                    }
                    if (!that.resizing) {
                        $(this).addClass("ui-resizable-autohide");
                        that._handles.hide();
                    }
                });
        }
 
        this._mouseInit();
    },
 
    _destroy: function() {
 
        this._mouseDestroy();
 
        var wrapper,
            _destroy = function(exp) {
                $(exp)
                    .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
                    .removeData("resizable")
                    .removeData("ui-resizable")
                    .unbind(".resizable")
                    .find(".ui-resizable-handle")
                        .remove();
            };
 
        // TODO: Unwrap at same DOM position
        if (this.elementIsWrapper) {
            _destroy(this.element);
            wrapper = this.element;
            this.originalElement.css({
                position: wrapper.css("position"),
                width: wrapper.outerWidth(),
                height: wrapper.outerHeight(),
                top: wrapper.css("top"),
                left: wrapper.css("left")
            }).insertAfter( wrapper );
            wrapper.remove();
        }
 
        this.originalElement.css("resize", this.originalResizeStyle);
        _destroy(this.originalElement);
 
        return this;
    },
 
    _mouseCapture: function(event) {
        var i, handle,
            capture = false;
 
        for (i in this.handles) {
            handle = $(this.handles[i])[0];
            if (handle === event.target || $.contains(handle, event.target)) {
                capture = true;
            }
        }
 
        return !this.options.disabled && capture;
    },
 
    _mouseStart: function(event) {
 
        var curleft, curtop, cursor,
            o = this.options,
            el = this.element;
 
        this.resizing = true;
 
        this._renderProxy();
 
        curleft = this._num(this.helper.css("left"));
        curtop = this._num(this.helper.css("top"));
 
        if (o.containment) {
            curleft += $(o.containment).scrollLeft() || 0;
            curtop += $(o.containment).scrollTop() || 0;
        }
 
        this.offset = this.helper.offset();
        this.position = { left: curleft, top: curtop };
 
        this.size = this._helper ? {
                width: this.helper.width(),
                height: this.helper.height()
            } : {
                width: el.width(),
                height: el.height()
            };
 
        this.originalSize = this._helper ? {
                width: el.outerWidth(),
                height: el.outerHeight()
            } : {
                width: el.width(),
                height: el.height()
            };
 
        this.sizeDiff = {
            width: el.outerWidth() - el.width(),
            height: el.outerHeight() - el.height()
        };
 
        this.originalPosition = { left: curleft, top: curtop };
        this.originalMousePosition = { left: event.pageX, top: event.pageY };
 
        this.aspectRatio = (typeof o.aspectRatio === "number") ?
            o.aspectRatio :
            ((this.originalSize.width / this.originalSize.height) || 1);
 
        cursor = $(".ui-resizable-" + this.axis).css("cursor");
        $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
 
        el.addClass("ui-resizable-resizing");
        this._propagate("start", event);
        return true;
    },
 
    _mouseDrag: function(event) {
 
        var data, props,
            smp = this.originalMousePosition,
            a = this.axis,
            dx = (event.pageX - smp.left) || 0,
            dy = (event.pageY - smp.top) || 0,
            trigger = this._change[a];
 
        this._updatePrevProperties();
 
        if (!trigger) {
            return false;
        }
 
        data = trigger.apply(this, [ event, dx, dy ]);
 
        this._updateVirtualBoundaries(event.shiftKey);
        if (this._aspectRatio || event.shiftKey) {
            data = this._updateRatio(data, event);
        }
 
        data = this._respectSize(data, event);
 
        this._updateCache(data);
 
        this._propagate("resize", event);
 
        props = this._applyChanges();
 
        if ( !this._helper && this._proportionallyResizeElements.length ) {
            this._proportionallyResize();
        }
 
        if ( !$.isEmptyObject( props ) ) {
            this._updatePrevProperties();
            this._trigger( "resize", event, this.ui() );
            this._applyChanges();
        }
 
        return false;
    },
 
    _mouseStop: function(event) {
 
        this.resizing = false;
        var pr, ista, soffseth, soffsetw, s, left, top,
            o = this.options, that = this;
 
        if (this._helper) {
 
            pr = this._proportionallyResizeElements;
            ista = pr.length && (/textarea/i).test(pr[0].nodeName);
            soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
            soffsetw = ista ? 0 : that.sizeDiff.width;
 
            s = {
                width: (that.helper.width()  - soffsetw),
                height: (that.helper.height() - soffseth)
            };
            left = (parseInt(that.element.css("left"), 10) +
                (that.position.left - that.originalPosition.left)) || null;
            top = (parseInt(that.element.css("top"), 10) +
                (that.position.top - that.originalPosition.top)) || null;
 
            if (!o.animate) {
                this.element.css($.extend(s, { top: top, left: left }));
            }
 
            that.helper.height(that.size.height);
            that.helper.width(that.size.width);
 
            if (this._helper && !o.animate) {
                this._proportionallyResize();
            }
        }
 
        $("body").css("cursor", "auto");
 
        this.element.removeClass("ui-resizable-resizing");
 
        this._propagate("stop", event);
 
        if (this._helper) {
            this.helper.remove();
        }
 
        return false;
 
    },
 
    _updatePrevProperties: function() {
        this.prevPosition = {
            top: this.position.top,
            left: this.position.left
        };
        this.prevSize = {
            width: this.size.width,
            height: this.size.height
        };
    },
 
    _applyChanges: function() {
        var props = {};
 
        if ( this.position.top !== this.prevPosition.top ) {
            props.top = this.position.top + "px";
        }
        if ( this.position.left !== this.prevPosition.left ) {
            props.left = this.position.left + "px";
        }
        if ( this.size.width !== this.prevSize.width ) {
            props.width = this.size.width + "px";
        }
        if ( this.size.height !== this.prevSize.height ) {
            props.height = this.size.height + "px";
        }
 
        this.helper.css( props );
 
        return props;
    },
 
    _updateVirtualBoundaries: function(forceAspectRatio) {
        var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
            o = this.options;
 
        b = {
            minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
            maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
            minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
            maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
        };
 
        if (this._aspectRatio || forceAspectRatio) {
            pMinWidth = b.minHeight * this.aspectRatio;
            pMinHeight = b.minWidth / this.aspectRatio;
            pMaxWidth = b.maxHeight * this.aspectRatio;
            pMaxHeight = b.maxWidth / this.aspectRatio;
 
            if (pMinWidth > b.minWidth) {
                b.minWidth = pMinWidth;
            }
            if (pMinHeight > b.minHeight) {
                b.minHeight = pMinHeight;
            }
            if (pMaxWidth < b.maxWidth) {
                b.maxWidth = pMaxWidth;
            }
            if (pMaxHeight < b.maxHeight) {
                b.maxHeight = pMaxHeight;
            }
        }
        this._vBoundaries = b;
    },
 
    _updateCache: function(data) {
        this.offset = this.helper.offset();
        if (this._isNumber(data.left)) {
            this.position.left = data.left;
        }
        if (this._isNumber(data.top)) {
            this.position.top = data.top;
        }
        if (this._isNumber(data.height)) {
            this.size.height = data.height;
        }
        if (this._isNumber(data.width)) {
            this.size.width = data.width;
        }
    },
 
    _updateRatio: function( data ) {
 
        var cpos = this.position,
            csize = this.size,
            a = this.axis;
 
        if (this._isNumber(data.height)) {
            data.width = (data.height * this.aspectRatio);
        } else if (this._isNumber(data.width)) {
            data.height = (data.width / this.aspectRatio);
        }
 
        if (a === "sw") {
            data.left = cpos.left + (csize.width - data.width);
            data.top = null;
        }
        if (a === "nw") {
            data.top = cpos.top + (csize.height - data.height);
            data.left = cpos.left + (csize.width - data.width);
        }
 
        return data;
    },
 
    _respectSize: function( data ) {
 
        var o = this._vBoundaries,
            a = this.axis,
            ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
            ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
            isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
            isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
            dw = this.originalPosition.left + this.originalSize.width,
            dh = this.position.top + this.size.height,
            cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
        if (isminw) {
            data.width = o.minWidth;
        }
        if (isminh) {
            data.height = o.minHeight;
        }
        if (ismaxw) {
            data.width = o.maxWidth;
        }
        if (ismaxh) {
            data.height = o.maxHeight;
        }
 
        if (isminw && cw) {
            data.left = dw - o.minWidth;
        }
        if (ismaxw && cw) {
            data.left = dw - o.maxWidth;
        }
        if (isminh && ch) {
            data.top = dh - o.minHeight;
        }
        if (ismaxh && ch) {
            data.top = dh - o.maxHeight;
        }
 
        // Fixing jump error on top/left - bug #2330
        if (!data.width && !data.height && !data.left && data.top) {
            data.top = null;
        } else if (!data.width && !data.height && !data.top && data.left) {
            data.left = null;
        }
 
        return data;
    },
 
    _getPaddingPlusBorderDimensions: function( element ) {
        var i = 0,
            widths = [],
            borders = [
                element.css( "borderTopWidth" ),
                element.css( "borderRightWidth" ),
                element.css( "borderBottomWidth" ),
                element.css( "borderLeftWidth" )
            ],
            paddings = [
                element.css( "paddingTop" ),
                element.css( "paddingRight" ),
                element.css( "paddingBottom" ),
                element.css( "paddingLeft" )
            ];
 
        for ( ; i < 4; i++ ) {
            widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
            widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
        }
 
        return {
            height: widths[ 0 ] + widths[ 2 ],
            width: widths[ 1 ] + widths[ 3 ]
        };
    },
 
    _proportionallyResize: function() {
 
        if (!this._proportionallyResizeElements.length) {
            return;
        }
 
        var prel,
            i = 0,
            element = this.helper || this.element;
 
        for ( ; i < this._proportionallyResizeElements.length; i++) {
 
            prel = this._proportionallyResizeElements[i];
 
            // TODO: Seems like a bug to cache this.outerDimensions
            // considering that we are in a loop.
            if (!this.outerDimensions) {
                this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
            }
 
            prel.css({
                height: (element.height() - this.outerDimensions.height) || 0,
                width: (element.width() - this.outerDimensions.width) || 0
            });
 
        }
 
    },
 
    _renderProxy: function() {
 
        var el = this.element, o = this.options;
        this.elementOffset = el.offset();
 
        if (this._helper) {
 
            this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
 
            this.helper.addClass(this._helper).css({
                width: this.element.outerWidth() - 1,
                height: this.element.outerHeight() - 1,
                position: "absolute",
                left: this.elementOffset.left + "px",
                top: this.elementOffset.top + "px",
                zIndex: ++o.zIndex //TODO: Don't modify option
            });
 
            this.helper
                .appendTo("body")
                .disableSelection();
 
        } else {
            this.helper = this.element;
        }
 
    },
 
    _change: {
        e: function(event, dx) {
            return { width: this.originalSize.width + dx };
        },
        w: function(event, dx) {
            var cs = this.originalSize, sp = this.originalPosition;
            return { left: sp.left + dx, width: cs.width - dx };
        },
        n: function(event, dx, dy) {
            var cs = this.originalSize, sp = this.originalPosition;
            return { top: sp.top + dy, height: cs.height - dy };
        },
        s: function(event, dx, dy) {
            return { height: this.originalSize.height + dy };
        },
        se: function(event, dx, dy) {
            return $.extend(this._change.s.apply(this, arguments),
                this._change.e.apply(this, [ event, dx, dy ]));
        },
        sw: function(event, dx, dy) {
            return $.extend(this._change.s.apply(this, arguments),
                this._change.w.apply(this, [ event, dx, dy ]));
        },
        ne: function(event, dx, dy) {
            return $.extend(this._change.n.apply(this, arguments),
                this._change.e.apply(this, [ event, dx, dy ]));
        },
        nw: function(event, dx, dy) {
            return $.extend(this._change.n.apply(this, arguments),
                this._change.w.apply(this, [ event, dx, dy ]));
        }
    },
 
    _propagate: function(n, event) {
        $.ui.plugin.call(this, n, [ event, this.ui() ]);
        (n !== "resize" && this._trigger(n, event, this.ui()));
    },
 
    plugins: {},
 
    ui: function() {
        return {
            originalElement: this.originalElement,
            element: this.element,
            helper: this.helper,
            position: this.position,
            size: this.size,
            originalSize: this.originalSize,
            originalPosition: this.originalPosition
        };
    }
 
});
 
/*
 * Resizable Extensions
 */
 
$.ui.plugin.add("resizable", "animate", {
 
    stop: function( event ) {
        var that = $(this).resizable( "instance" ),
            o = that.options,
            pr = that._proportionallyResizeElements,
            ista = pr.length && (/textarea/i).test(pr[0].nodeName),
            soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
            soffsetw = ista ? 0 : that.sizeDiff.width,
            style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
            left = (parseInt(that.element.css("left"), 10) +
                (that.position.left - that.originalPosition.left)) || null,
            top = (parseInt(that.element.css("top"), 10) +
                (that.position.top - that.originalPosition.top)) || null;
 
        that.element.animate(
            $.extend(style, top && left ? { top: top, left: left } : {}), {
                duration: o.animateDuration,
                easing: o.animateEasing,
                step: function() {
 
                    var data = {
                        width: parseInt(that.element.css("width"), 10),
                        height: parseInt(that.element.css("height"), 10),
                        top: parseInt(that.element.css("top"), 10),
                        left: parseInt(that.element.css("left"), 10)
                    };
 
                    if (pr && pr.length) {
                        $(pr[0]).css({ width: data.width, height: data.height });
                    }
 
                    // propagating resize, and updating values for each animation step
                    that._updateCache(data);
                    that._propagate("resize", event);
 
                }
            }
        );
    }
 
});
 
$.ui.plugin.add( "resizable", "containment", {
 
    start: function() {
        var element, p, co, ch, cw, width, height,
            that = $( this ).resizable( "instance" ),
            o = that.options,
            el = that.element,
            oc = o.containment,
            ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
 
        if ( !ce ) {
            return;
        }
 
        that.containerElement = $( ce );
 
        if ( /document/.test( oc ) || oc === document ) {
            that.containerOffset = {
                left: 0,
                top: 0
            };
            that.containerPosition = {
                left: 0,
                top: 0
            };
 
            that.parentData = {
                element: $( document ),
                left: 0,
                top: 0,
                width: $( document ).width(),
                height: $( document ).height() || document.body.parentNode.scrollHeight
            };
        } else {
            element = $( ce );
            p = [];
            $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
                p[ i ] = that._num( element.css( "padding" + name ) );
            });
 
            that.containerOffset = element.offset();
            that.containerPosition = element.position();
            that.containerSize = {
                height: ( element.innerHeight() - p[ 3 ] ),
                width: ( element.innerWidth() - p[ 1 ] )
            };
 
            co = that.containerOffset;
            ch = that.containerSize.height;
            cw = that.containerSize.width;
            width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
            height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
 
            that.parentData = {
                element: ce,
                left: co.left,
                top: co.top,
                width: width,
                height: height
            };
        }
    },
 
    resize: function( event ) {
        var woset, hoset, isParent, isOffsetRelative,
            that = $( this ).resizable( "instance" ),
            o = that.options,
            co = that.containerOffset,
            cp = that.position,
            pRatio = that._aspectRatio || event.shiftKey,
            cop = {
                top: 0,
                left: 0
            },
            ce = that.containerElement,
            continueResize = true;
 
        if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
            cop = co;
        }
 
        if ( cp.left < ( that._helper ? co.left : 0 ) ) {
            that.size.width = that.size.width +
                ( that._helper ?
                    ( that.position.left - co.left ) :
                    ( that.position.left - cop.left ) );
 
            if ( pRatio ) {
                that.size.height = that.size.width / that.aspectRatio;
                continueResize = false;
            }
            that.position.left = o.helper ? co.left : 0;
        }
 
        if ( cp.top < ( that._helper ? co.top : 0 ) ) {
            that.size.height = that.size.height +
                ( that._helper ?
                    ( that.position.top - co.top ) :
                    that.position.top );
 
            if ( pRatio ) {
                that.size.width = that.size.height * that.aspectRatio;
                continueResize = false;
            }
            that.position.top = that._helper ? co.top : 0;
        }
 
        isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
        isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
 
        if ( isParent && isOffsetRelative ) {
            that.offset.left = that.parentData.left + that.position.left;
            that.offset.top = that.parentData.top + that.position.top;
        } else {
            that.offset.left = that.element.offset().left;
            that.offset.top = that.element.offset().top;
        }
 
        woset = Math.abs( that.sizeDiff.width +
            (that._helper ?
                that.offset.left - cop.left :
                (that.offset.left - co.left)) );
 
        hoset = Math.abs( that.sizeDiff.height +
            (that._helper ?
                that.offset.top - cop.top :
                (that.offset.top - co.top)) );
 
        if ( woset + that.size.width >= that.parentData.width ) {
            that.size.width = that.parentData.width - woset;
            if ( pRatio ) {
                that.size.height = that.size.width / that.aspectRatio;
                continueResize = false;
            }
        }
 
        if ( hoset + that.size.height >= that.parentData.height ) {
            that.size.height = that.parentData.height - hoset;
            if ( pRatio ) {
                that.size.width = that.size.height * that.aspectRatio;
                continueResize = false;
            }
        }
 
        if ( !continueResize ) {
            that.position.left = that.prevPosition.left;
            that.position.top = that.prevPosition.top;
            that.size.width = that.prevSize.width;
            that.size.height = that.prevSize.height;
        }
    },
 
    stop: function() {
        var that = $( this ).resizable( "instance" ),
            o = that.options,
            co = that.containerOffset,
            cop = that.containerPosition,
            ce = that.containerElement,
            helper = $( that.helper ),
            ho = helper.offset(),
            w = helper.outerWidth() - that.sizeDiff.width,
            h = helper.outerHeight() - that.sizeDiff.height;
 
        if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
            $( this ).css({
                left: ho.left - cop.left - co.left,
                width: w,
                height: h
            });
        }
 
        if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
            $( this ).css({
                left: ho.left - cop.left - co.left,
                width: w,
                height: h
            });
        }
    }
});
 
$.ui.plugin.add("resizable", "alsoResize", {
 
    start: function() {
        var that = $(this).resizable( "instance" ),
            o = that.options;
 
        $(o.alsoResize).each(function() {
            var el = $(this);
            el.data("ui-resizable-alsoresize", {
                width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
                left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
            });
        });
    },
 
    resize: function(event, ui) {
        var that = $(this).resizable( "instance" ),
            o = that.options,
            os = that.originalSize,
            op = that.originalPosition,
            delta = {
                height: (that.size.height - os.height) || 0,
                width: (that.size.width - os.width) || 0,
                top: (that.position.top - op.top) || 0,
                left: (that.position.left - op.left) || 0
            };
 
            $(o.alsoResize).each(function() {
                var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
                    css = el.parents(ui.originalElement[0]).length ?
                            [ "width", "height" ] :
                            [ "width", "height", "top", "left" ];
 
                $.each(css, function(i, prop) {
                    var sum = (start[prop] || 0) + (delta[prop] || 0);
                    if (sum && sum >= 0) {
                        style[prop] = sum || null;
                    }
                });
 
                el.css(style);
            });
    },
 
    stop: function() {
        $(this).removeData("resizable-alsoresize");
    }
});
 
$.ui.plugin.add("resizable", "ghost", {
 
    start: function() {
 
        var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
 
        that.ghost = that.originalElement.clone();
        that.ghost
            .css({
                opacity: 0.25,
                display: "block",
                position: "relative",
                height: cs.height,
                width: cs.width,
                margin: 0,
                left: 0,
                top: 0
            })
            .addClass("ui-resizable-ghost")
            .addClass(typeof o.ghost === "string" ? o.ghost : "");
 
        that.ghost.appendTo(that.helper);
 
    },
 
    resize: function() {
        var that = $(this).resizable( "instance" );
        if (that.ghost) {
            that.ghost.css({
                position: "relative",
                height: that.size.height,
                width: that.size.width
            });
        }
    },
 
    stop: function() {
        var that = $(this).resizable( "instance" );
        if (that.ghost && that.helper) {
            that.helper.get(0).removeChild(that.ghost.get(0));
        }
    }
 
});
 
$.ui.plugin.add("resizable", "grid", {
 
    resize: function() {
        var outerDimensions,
            that = $(this).resizable( "instance" ),
            o = that.options,
            cs = that.size,
            os = that.originalSize,
            op = that.originalPosition,
            a = that.axis,
            grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
            gridX = (grid[0] || 1),
            gridY = (grid[1] || 1),
            ox = Math.round((cs.width - os.width) / gridX) * gridX,
            oy = Math.round((cs.height - os.height) / gridY) * gridY,
            newWidth = os.width + ox,
            newHeight = os.height + oy,
            isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
            isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
            isMinWidth = o.minWidth && (o.minWidth > newWidth),
            isMinHeight = o.minHeight && (o.minHeight > newHeight);
 
        o.grid = grid;
 
        if (isMinWidth) {
            newWidth += gridX;
        }
        if (isMinHeight) {
            newHeight += gridY;
        }
        if (isMaxWidth) {
            newWidth -= gridX;
        }
        if (isMaxHeight) {
            newHeight -= gridY;
        }
 
        if (/^(se|s|e)$/.test(a)) {
            that.size.width = newWidth;
            that.size.height = newHeight;
        } else if (/^(ne)$/.test(a)) {
            that.size.width = newWidth;
            that.size.height = newHeight;
            that.position.top = op.top - oy;
        } else if (/^(sw)$/.test(a)) {
            that.size.width = newWidth;
            that.size.height = newHeight;
            that.position.left = op.left - ox;
        } else {
            if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
                outerDimensions = that._getPaddingPlusBorderDimensions( this );
            }
 
            if ( newHeight - gridY > 0 ) {
                that.size.height = newHeight;
                that.position.top = op.top - oy;
            } else {
                newHeight = gridY - outerDimensions.height;
                that.size.height = newHeight;
                that.position.top = op.top + os.height - newHeight;
            }
            if ( newWidth - gridX > 0 ) {
                that.size.width = newWidth;
                that.position.left = op.left - ox;
            } else {
                newWidth = gridX - outerDimensions.width;
                that.size.width = newWidth;
                that.position.left = op.left + os.width - newWidth;
            }
        }
    }
 
});
 
var resizable = $.ui.resizable;
 
 
/*!
 * jQuery UI Selectable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectable/
 */
 
 
var selectable = $.widget("ui.selectable", $.ui.mouse, {
    version: "1.11.4",
    options: {
        appendTo: "body",
        autoRefresh: true,
        distance: 0,
        filter: "*",
        tolerance: "touch",
 
        // callbacks
        selected: null,
        selecting: null,
        start: null,
        stop: null,
        unselected: null,
        unselecting: null
    },
    _create: function() {
        var selectees,
            that = this;
 
        this.element.addClass("ui-selectable");
 
        this.dragged = false;
 
        // cache selectee children based on filter
        this.refresh = function() {
            selectees = $(that.options.filter, that.element[0]);
            selectees.addClass("ui-selectee");
            selectees.each(function() {
                var $this = $(this),
                    pos = $this.offset();
                $.data(this, "selectable-item", {
                    element: this,
                    $element: $this,
                    left: pos.left,
                    top: pos.top,
                    right: pos.left + $this.outerWidth(),
                    bottom: pos.top + $this.outerHeight(),
                    startselected: false,
                    selected: $this.hasClass("ui-selected"),
                    selecting: $this.hasClass("ui-selecting"),
                    unselecting: $this.hasClass("ui-unselecting")
                });
            });
        };
        this.refresh();
 
        this.selectees = selectees.addClass("ui-selectee");
 
        this._mouseInit();
 
        this.helper = $("<div class='ui-selectable-helper'></div>");
    },
 
    _destroy: function() {
        this.selectees
            .removeClass("ui-selectee")
            .removeData("selectable-item");
        this.element
            .removeClass("ui-selectable ui-selectable-disabled");
        this._mouseDestroy();
    },
 
    _mouseStart: function(event) {
        var that = this,
            options = this.options;
 
        this.opos = [ event.pageX, event.pageY ];
 
        if (this.options.disabled) {
            return;
        }
 
        this.selectees = $(options.filter, this.element[0]);
 
        this._trigger("start", event);
 
        $(options.appendTo).append(this.helper);
        // position helper (lasso)
        this.helper.css({
            "left": event.pageX,
            "top": event.pageY,
            "width": 0,
            "height": 0
        });
 
        if (options.autoRefresh) {
            this.refresh();
        }
 
        this.selectees.filter(".ui-selected").each(function() {
            var selectee = $.data(this, "selectable-item");
            selectee.startselected = true;
            if (!event.metaKey && !event.ctrlKey) {
                selectee.$element.removeClass("ui-selected");
                selectee.selected = false;
                selectee.$element.addClass("ui-unselecting");
                selectee.unselecting = true;
                // selectable UNSELECTING callback
                that._trigger("unselecting", event, {
                    unselecting: selectee.element
                });
            }
        });
 
        $(event.target).parents().addBack().each(function() {
            var doSelect,
                selectee = $.data(this, "selectable-item");
            if (selectee) {
                doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
                selectee.$element
                    .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
                    .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
                selectee.unselecting = !doSelect;
                selectee.selecting = doSelect;
                selectee.selected = doSelect;
                // selectable (UN)SELECTING callback
                if (doSelect) {
                    that._trigger("selecting", event, {
                        selecting: selectee.element
                    });
                } else {
                    that._trigger("unselecting", event, {
                        unselecting: selectee.element
                    });
                }
                return false;
            }
        });
 
    },
 
    _mouseDrag: function(event) {
 
        this.dragged = true;
 
        if (this.options.disabled) {
            return;
        }
 
        var tmp,
            that = this,
            options = this.options,
            x1 = this.opos[0],
            y1 = this.opos[1],
            x2 = event.pageX,
            y2 = event.pageY;
 
        if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
        if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
        this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
 
        this.selectees.each(function() {
            var selectee = $.data(this, "selectable-item"),
                hit = false;
 
            //prevent helper from being selected if appendTo: selectable
            if (!selectee || selectee.element === that.element[0]) {
                return;
            }
 
            if (options.tolerance === "touch") {
                hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
            } else if (options.tolerance === "fit") {
                hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
            }
 
            if (hit) {
                // SELECT
                if (selectee.selected) {
                    selectee.$element.removeClass("ui-selected");
                    selectee.selected = false;
                }
                if (selectee.unselecting) {
                    selectee.$element.removeClass("ui-unselecting");
                    selectee.unselecting = false;
                }
                if (!selectee.selecting) {
                    selectee.$element.addClass("ui-selecting");
                    selectee.selecting = true;
                    // selectable SELECTING callback
                    that._trigger("selecting", event, {
                        selecting: selectee.element
                    });
                }
            } else {
                // UNSELECT
                if (selectee.selecting) {
                    if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
                        selectee.$element.removeClass("ui-selecting");
                        selectee.selecting = false;
                        selectee.$element.addClass("ui-selected");
                        selectee.selected = true;
                    } else {
                        selectee.$element.removeClass("ui-selecting");
                        selectee.selecting = false;
                        if (selectee.startselected) {
                            selectee.$element.addClass("ui-unselecting");
                            selectee.unselecting = true;
                        }
                        // selectable UNSELECTING callback
                        that._trigger("unselecting", event, {
                            unselecting: selectee.element
                        });
                    }
                }
                if (selectee.selected) {
                    if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                        selectee.$element.removeClass("ui-selected");
                        selectee.selected = false;
 
                        selectee.$element.addClass("ui-unselecting");
                        selectee.unselecting = true;
                        // selectable UNSELECTING callback
                        that._trigger("unselecting", event, {
                            unselecting: selectee.element
                        });
                    }
                }
            }
        });
 
        return false;
    },
 
    _mouseStop: function(event) {
        var that = this;
 
        this.dragged = false;
 
        $(".ui-unselecting", this.element[0]).each(function() {
            var selectee = $.data(this, "selectable-item");
            selectee.$element.removeClass("ui-unselecting");
            selectee.unselecting = false;
            selectee.startselected = false;
            that._trigger("unselected", event, {
                unselected: selectee.element
            });
        });
        $(".ui-selecting", this.element[0]).each(function() {
            var selectee = $.data(this, "selectable-item");
            selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
            selectee.selecting = false;
            selectee.selected = true;
            selectee.startselected = true;
            that._trigger("selected", event, {
                selected: selectee.element
            });
        });
        this._trigger("stop", event);
 
        this.helper.remove();
 
        return false;
    }
 
});
 
 
/*!
 * jQuery UI Sortable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/sortable/
 */
 
 
var sortable = $.widget("ui.sortable", $.ui.mouse, {
    version: "1.11.4",
    widgetEventPrefix: "sort",
    ready: false,
    options: {
        appendTo: "parent",
        axis: false,
        connectWith: false,
        containment: false,
        cursor: "auto",
        cursorAt: false,
        dropOnEmpty: true,
        forcePlaceholderSize: false,
        forceHelperSize: false,
        grid: false,
        handle: false,
        helper: "original",
        items: "> *",
        opacity: false,
        placeholder: false,
        revert: false,
        scroll: true,
        scrollSensitivity: 20,
        scrollSpeed: 20,
        scope: "default",
        tolerance: "intersect",
        zIndex: 1000,
 
        // callbacks
        activate: null,
        beforeStop: null,
        change: null,
        deactivate: null,
        out: null,
        over: null,
        receive: null,
        remove: null,
        sort: null,
        start: null,
        stop: null,
        update: null
    },
 
    _isOverAxis: function( x, reference, size ) {
        return ( x >= reference ) && ( x < ( reference + size ) );
    },
 
    _isFloating: function( item ) {
        return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
    },
 
    _create: function() {
        this.containerCache = {};
        this.element.addClass("ui-sortable");
 
        //Get the items
        this.refresh();
 
        //Let's determine the parent's offset
        this.offset = this.element.offset();
 
        //Initialize mouse events for interaction
        this._mouseInit();
 
        this._setHandleClassName();
 
        //We're ready to go
        this.ready = true;
 
    },
 
    _setOption: function( key, value ) {
        this._super( key, value );
 
        if ( key === "handle" ) {
            this._setHandleClassName();
        }
    },
 
    _setHandleClassName: function() {
        this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
        $.each( this.items, function() {
            ( this.instance.options.handle ?
                this.item.find( this.instance.options.handle ) : this.item )
                .addClass( "ui-sortable-handle" );
        });
    },
 
    _destroy: function() {
        this.element
            .removeClass( "ui-sortable ui-sortable-disabled" )
            .find( ".ui-sortable-handle" )
                .removeClass( "ui-sortable-handle" );
        this._mouseDestroy();
 
        for ( var i = this.items.length - 1; i >= 0; i-- ) {
            this.items[i].item.removeData(this.widgetName + "-item");
        }
 
        return this;
    },
 
    _mouseCapture: function(event, overrideHandle) {
        var currentItem = null,
            validHandle = false,
            that = this;
 
        if (this.reverting) {
            return false;
        }
 
        if(this.options.disabled || this.options.type === "static") {
            return false;
        }
 
        //We have to refresh the items data once first
        this._refreshItems(event);
 
        //Find out if the clicked node (or one of its parents) is a actual item in this.items
        $(event.target).parents().each(function() {
            if($.data(this, that.widgetName + "-item") === that) {
                currentItem = $(this);
                return false;
            }
        });
        if($.data(event.target, that.widgetName + "-item") === that) {
            currentItem = $(event.target);
        }
 
        if(!currentItem) {
            return false;
        }
        if(this.options.handle && !overrideHandle) {
            $(this.options.handle, currentItem).find("*").addBack().each(function() {
                if(this === event.target) {
                    validHandle = true;
                }
            });
            if(!validHandle) {
                return false;
            }
        }
 
        this.currentItem = currentItem;
        this._removeCurrentsFromItems();
        return true;
 
    },
 
    _mouseStart: function(event, overrideHandle, noActivation) {
 
        var i, body,
            o = this.options;
 
        this.currentContainer = this;
 
        //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
        this.refreshPositions();
 
        //Create and append the visible helper
        this.helper = this._createHelper(event);
 
        //Cache the helper size
        this._cacheHelperProportions();
 
        /*
         * - Position generation -
         * This block generates everything position related - it's the core of draggables.
         */
 
        //Cache the margins of the original element
        this._cacheMargins();
 
        //Get the next scrolling parent
        this.scrollParent = this.helper.scrollParent();
 
        //The element's absolute position on the page minus margins
        this.offset = this.currentItem.offset();
        this.offset = {
            top: this.offset.top - this.margins.top,
            left: this.offset.left - this.margins.left
        };
 
        $.extend(this.offset, {
            click: { //Where the click happened, relative to the element
                left: event.pageX - this.offset.left,
                top: event.pageY - this.offset.top
            },
            parent: this._getParentOffset(),
            relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
        });
 
        // Only after we got the offset, we can change the helper's position to absolute
        // TODO: Still need to figure out a way to make relative sorting possible
        this.helper.css("position", "absolute");
        this.cssPosition = this.helper.css("position");
 
        //Generate the original position
        this.originalPosition = this._generatePosition(event);
        this.originalPageX = event.pageX;
        this.originalPageY = event.pageY;
 
        //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
        (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
 
        //Cache the former DOM position
        this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
 
        //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
        if(this.helper[0] !== this.currentItem[0]) {
            this.currentItem.hide();
        }
 
        //Create the placeholder
        this._createPlaceholder();
 
        //Set a containment if given in the options
        if(o.containment) {
            this._setContainment();
        }
 
        if( o.cursor && o.cursor !== "auto" ) { // cursor option
            body = this.document.find( "body" );
 
            // support: IE
            this.storedCursor = body.css( "cursor" );
            body.css( "cursor", o.cursor );
 
            this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
        }
 
        if(o.opacity) { // opacity option
            if (this.helper.css("opacity")) {
                this._storedOpacity = this.helper.css("opacity");
            }
            this.helper.css("opacity", o.opacity);
        }
 
        if(o.zIndex) { // zIndex option
            if (this.helper.css("zIndex")) {
                this._storedZIndex = this.helper.css("zIndex");
            }
            this.helper.css("zIndex", o.zIndex);
        }
 
        //Prepare scrolling
        if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
            this.overflowOffset = this.scrollParent.offset();
        }
 
        //Call callbacks
        this._trigger("start", event, this._uiHash());
 
        //Recache the helper size
        if(!this._preserveHelperProportions) {
            this._cacheHelperProportions();
        }
 
 
        //Post "activate" events to possible containers
        if( !noActivation ) {
            for ( i = this.containers.length - 1; i >= 0; i-- ) {
                this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
            }
        }
 
        //Prepare possible droppables
        if($.ui.ddmanager) {
            $.ui.ddmanager.current = this;
        }
 
        if ($.ui.ddmanager && !o.dropBehaviour) {
            $.ui.ddmanager.prepareOffsets(this, event);
        }
 
        this.dragging = true;
 
        this.helper.addClass("ui-sortable-helper");
        this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
        return true;
 
    },
 
    _mouseDrag: function(event) {
        var i, item, itemElement, intersection,
            o = this.options,
            scrolled = false;
 
        //Compute the helpers position
        this.position = this._generatePosition(event);
        this.positionAbs = this._convertPositionTo("absolute");
 
        if (!this.lastPositionAbs) {
            this.lastPositionAbs = this.positionAbs;
        }
 
        //Do scrolling
        if(this.options.scroll) {
            if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
 
                if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
                    this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
                } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
                    this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
                }
 
                if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
                    this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
                } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
                    this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
                }
 
            } else {
 
                if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
                    scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
                } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
                    scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
                }
 
                if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
                    scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
                } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
                    scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
                }
 
            }
 
            if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
                $.ui.ddmanager.prepareOffsets(this, event);
            }
        }
 
        //Regenerate the absolute position used for position checks
        this.positionAbs = this._convertPositionTo("absolute");
 
        //Set the helper position
        if(!this.options.axis || this.options.axis !== "y") {
            this.helper[0].style.left = this.position.left+"px";
        }
        if(!this.options.axis || this.options.axis !== "x") {
            this.helper[0].style.top = this.position.top+"px";
        }
 
        //Rearrange
        for (i = this.items.length - 1; i >= 0; i--) {
 
            //Cache variables and intersection, continue if no intersection
            item = this.items[i];
            itemElement = item.item[0];
            intersection = this._intersectsWithPointer(item);
            if (!intersection) {
                continue;
            }
 
            // Only put the placeholder inside the current Container, skip all
            // items from other containers. This works because when moving
            // an item from one container to another the
            // currentContainer is switched before the placeholder is moved.
            //
            // Without this, moving items in "sub-sortables" can cause
            // the placeholder to jitter between the outer and inner container.
            if (item.instance !== this.currentContainer) {
                continue;
            }
 
            // cannot intersect with itself
            // no useless actions that have been done before
            // no action if the item moved is the parent of the item checked
            if (itemElement !== this.currentItem[0] &&
                this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
                !$.contains(this.placeholder[0], itemElement) &&
                (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
            ) {
 
                this.direction = intersection === 1 ? "down" : "up";
 
                if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
                    this._rearrange(event, item);
                } else {
                    break;
                }
 
                this._trigger("change", event, this._uiHash());
                break;
            }
        }
 
        //Post events to containers
        this._contactContainers(event);
 
        //Interconnect with droppables
        if($.ui.ddmanager) {
            $.ui.ddmanager.drag(this, event);
        }
 
        //Call callbacks
        this._trigger("sort", event, this._uiHash());
 
        this.lastPositionAbs = this.positionAbs;
        return false;
 
    },
 
    _mouseStop: function(event, noPropagation) {
 
        if(!event) {
            return;
        }
 
        //If we are using droppables, inform the manager about the drop
        if ($.ui.ddmanager && !this.options.dropBehaviour) {
            $.ui.ddmanager.drop(this, event);
        }
 
        if(this.options.revert) {
            var that = this,
                cur = this.placeholder.offset(),
                axis = this.options.axis,
                animation = {};
 
            if ( !axis || axis === "x" ) {
                animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
            }
            if ( !axis || axis === "y" ) {
                animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
            }
            this.reverting = true;
            $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
                that._clear(event);
            });
        } else {
            this._clear(event, noPropagation);
        }
 
        return false;
 
    },
 
    cancel: function() {
 
        if(this.dragging) {
 
            this._mouseUp({ target: null });
 
            if(this.options.helper === "original") {
                this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
            } else {
                this.currentItem.show();
            }
 
            //Post deactivating events to containers
            for (var i = this.containers.length - 1; i >= 0; i--){
                this.containers[i]._trigger("deactivate", null, this._uiHash(this));
                if(this.containers[i].containerCache.over) {
                    this.containers[i]._trigger("out", null, this._uiHash(this));
                    this.containers[i].containerCache.over = 0;
                }
            }
 
        }
 
        if (this.placeholder) {
            //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
            if(this.placeholder[0].parentNode) {
                this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
            }
            if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
                this.helper.remove();
            }
 
            $.extend(this, {
                helper: null,
                dragging: false,
                reverting: false,
                _noFinalSort: null
            });
 
            if(this.domPosition.prev) {
                $(this.domPosition.prev).after(this.currentItem);
            } else {
                $(this.domPosition.parent).prepend(this.currentItem);
            }
        }
 
        return this;
 
    },
 
    serialize: function(o) {
 
        var items = this._getItemsAsjQuery(o && o.connected),
            str = [];
        o = o || {};
 
        $(items).each(function() {
            var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
            if (res) {
                str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
            }
        });
 
        if(!str.length && o.key) {
            str.push(o.key + "=");
        }
 
        return str.join("&");
 
    },
 
    toArray: function(o) {
 
        var items = this._getItemsAsjQuery(o && o.connected),
            ret = [];
 
        o = o || {};
 
        items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
        return ret;
 
    },
 
    /* Be careful with the following core functions */
    _intersectsWith: function(item) {
 
        var x1 = this.positionAbs.left,
            x2 = x1 + this.helperProportions.width,
            y1 = this.positionAbs.top,
            y2 = y1 + this.helperProportions.height,
            l = item.left,
            r = l + item.width,
            t = item.top,
            b = t + item.height,
            dyClick = this.offset.click.top,
            dxClick = this.offset.click.left,
            isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
            isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
            isOverElement = isOverElementHeight && isOverElementWidth;
 
        if ( this.options.tolerance === "pointer" ||
            this.options.forcePointerForContainers ||
            (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
        ) {
            return isOverElement;
        } else {
 
            return (l < x1 + (this.helperProportions.width / 2) && // Right Half
                x2 - (this.helperProportions.width / 2) < r && // Left Half
                t < y1 + (this.helperProportions.height / 2) && // Bottom Half
                y2 - (this.helperProportions.height / 2) < b ); // Top Half
 
        }
    },
 
    _intersectsWithPointer: function(item) {
 
        var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
            isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
            isOverElement = isOverElementHeight && isOverElementWidth,
            verticalDirection = this._getDragVerticalDirection(),
            horizontalDirection = this._getDragHorizontalDirection();
 
        if (!isOverElement) {
            return false;
        }
 
        return this.floating ?
            ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
            : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
 
    },
 
    _intersectsWithSides: function(item) {
 
        var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
            isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
            verticalDirection = this._getDragVerticalDirection(),
            horizontalDirection = this._getDragHorizontalDirection();
 
        if (this.floating && horizontalDirection) {
            return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
        } else {
            return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
        }
 
    },
 
    _getDragVerticalDirection: function() {
        var delta = this.positionAbs.top - this.lastPositionAbs.top;
        return delta !== 0 && (delta > 0 ? "down" : "up");
    },
 
    _getDragHorizontalDirection: function() {
        var delta = this.positionAbs.left - this.lastPositionAbs.left;
        return delta !== 0 && (delta > 0 ? "right" : "left");
    },
 
    refresh: function(event) {
        this._refreshItems(event);
        this._setHandleClassName();
        this.refreshPositions();
        return this;
    },
 
    _connectWith: function() {
        var options = this.options;
        return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
    },
 
    _getItemsAsjQuery: function(connected) {
 
        var i, j, cur, inst,
            items = [],
            queries = [],
            connectWith = this._connectWith();
 
        if(connectWith && connected) {
            for (i = connectWith.length - 1; i >= 0; i--){
                cur = $(connectWith[i], this.document[0]);
                for ( j = cur.length - 1; j >= 0; j--){
                    inst = $.data(cur[j], this.widgetFullName);
                    if(inst && inst !== this && !inst.options.disabled) {
                        queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
                    }
                }
            }
        }
 
        queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
 
        function addItems() {
            items.push( this );
        }
        for (i = queries.length - 1; i >= 0; i--){
            queries[i][0].each( addItems );
        }
 
        return $(items);
 
    },
 
    _removeCurrentsFromItems: function() {
 
        var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
 
        this.items = $.grep(this.items, function (item) {
            for (var j=0; j < list.length; j++) {
                if(list[j] === item.item[0]) {
                    return false;
                }
            }
            return true;
        });
 
    },
 
    _refreshItems: function(event) {
 
        this.items = [];
        this.containers = [this];
 
        var i, j, cur, inst, targetData, _queries, item, queriesLength,
            items = this.items,
            queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
            connectWith = this._connectWith();
 
        if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
            for (i = connectWith.length - 1; i >= 0; i--){
                cur = $(connectWith[i], this.document[0]);
                for (j = cur.length - 1; j >= 0; j--){
                    inst = $.data(cur[j], this.widgetFullName);
                    if(inst && inst !== this && !inst.options.disabled) {
                        queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
                        this.containers.push(inst);
                    }
                }
            }
        }
 
        for (i = queries.length - 1; i >= 0; i--) {
            targetData = queries[i][1];
            _queries = queries[i][0];
 
            for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
                item = $(_queries[j]);
 
                item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
 
                items.push({
                    item: item,
                    instance: targetData,
                    width: 0, height: 0,
                    left: 0, top: 0
                });
            }
        }
 
    },
 
    refreshPositions: function(fast) {
 
        // Determine whether items are being displayed horizontally
        this.floating = this.items.length ?
            this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
            false;
 
        //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
        if(this.offsetParent && this.helper) {
            this.offset.parent = this._getParentOffset();
        }
 
        var i, item, t, p;
 
        for (i = this.items.length - 1; i >= 0; i--){
            item = this.items[i];
 
            //We ignore calculating positions of all connected containers when we're not over them
            if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
                continue;
            }
 
            t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
 
            if (!fast) {
                item.width = t.outerWidth();
                item.height = t.outerHeight();
            }
 
            p = t.offset();
            item.left = p.left;
            item.top = p.top;
        }
 
        if(this.options.custom && this.options.custom.refreshContainers) {
            this.options.custom.refreshContainers.call(this);
        } else {
            for (i = this.containers.length - 1; i >= 0; i--){
                p = this.containers[i].element.offset();
                this.containers[i].containerCache.left = p.left;
                this.containers[i].containerCache.top = p.top;
                this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
                this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
            }
        }
 
        return this;
    },
 
    _createPlaceholder: function(that) {
        that = that || this;
        var className,
            o = that.options;
 
        if(!o.placeholder || o.placeholder.constructor === String) {
            className = o.placeholder;
            o.placeholder = {
                element: function() {
 
                    var nodeName = that.currentItem[0].nodeName.toLowerCase(),
                        element = $( "<" + nodeName + ">", that.document[0] )
                            .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
                            .removeClass("ui-sortable-helper");
 
                    if ( nodeName === "tbody" ) {
                        that._createTrPlaceholder(
                            that.currentItem.find( "tr" ).eq( 0 ),
                            $( "<tr>", that.document[ 0 ] ).appendTo( element )
                        );
                    } else if ( nodeName === "tr" ) {
                        that._createTrPlaceholder( that.currentItem, element );
                    } else if ( nodeName === "img" ) {
                        element.attr( "src", that.currentItem.attr( "src" ) );
                    }
 
                    if ( !className ) {
                        element.css( "visibility", "hidden" );
                    }
 
                    return element;
                },
                update: function(container, p) {
 
                    // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
                    // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
                    if(className && !o.forcePlaceholderSize) {
                        return;
                    }
 
                    //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
                    if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
                    if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
                }
            };
        }
 
        //Create the placeholder
        that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
 
        //Append it after the actual current item
        that.currentItem.after(that.placeholder);
 
        //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
        o.placeholder.update(that, that.placeholder);
 
    },
 
    _createTrPlaceholder: function( sourceTr, targetTr ) {
        var that = this;
 
        sourceTr.children().each(function() {
            $( "<td>&#160;</td>", that.document[ 0 ] )
                .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
                .appendTo( targetTr );
        });
    },
 
    _contactContainers: function(event) {
        var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
            innermostContainer = null,
            innermostIndex = null;
 
        // get innermost container that intersects with item
        for (i = this.containers.length - 1; i >= 0; i--) {
 
            // never consider a container that's located within the item itself
            if($.contains(this.currentItem[0], this.containers[i].element[0])) {
                continue;
            }
 
            if(this._intersectsWith(this.containers[i].containerCache)) {
 
                // if we've already found a container and it's more "inner" than this, then continue
                if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
                    continue;
                }
 
                innermostContainer = this.containers[i];
                innermostIndex = i;
 
            } else {
                // container doesn't intersect. trigger "out" event if necessary
                if(this.containers[i].containerCache.over) {
                    this.containers[i]._trigger("out", event, this._uiHash(this));
                    this.containers[i].containerCache.over = 0;
                }
            }
 
        }
 
        // if no intersecting containers found, return
        if(!innermostContainer) {
            return;
        }
 
        // move the item into the container if it's not there already
        if(this.containers.length === 1) {
            if (!this.containers[innermostIndex].containerCache.over) {
                this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                this.containers[innermostIndex].containerCache.over = 1;
            }
        } else {
 
            //When entering a new container, we will find the item with the least distance and append our item near it
            dist = 10000;
            itemWithLeastDistance = null;
            floating = innermostContainer.floating || this._isFloating(this.currentItem);
            posProperty = floating ? "left" : "top";
            sizeProperty = floating ? "width" : "height";
            axis = floating ? "clientX" : "clientY";
 
            for (j = this.items.length - 1; j >= 0; j--) {
                if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
                    continue;
                }
                if(this.items[j].item[0] === this.currentItem[0]) {
                    continue;
                }
 
                cur = this.items[j].item.offset()[posProperty];
                nearBottom = false;
                if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
                    nearBottom = true;
                }
 
                if ( Math.abs( event[ axis ] - cur ) < dist ) {
                    dist = Math.abs( event[ axis ] - cur );
                    itemWithLeastDistance = this.items[ j ];
                    this.direction = nearBottom ? "up": "down";
                }
            }
 
            //Check if dropOnEmpty is enabled
            if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
                return;
            }
 
            if(this.currentContainer === this.containers[innermostIndex]) {
                if ( !this.currentContainer.containerCache.over ) {
                    this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
                    this.currentContainer.containerCache.over = 1;
                }
                return;
            }
 
            itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
            this._trigger("change", event, this._uiHash());
            this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
            this.currentContainer = this.containers[innermostIndex];
 
            //Update the placeholder
            this.options.placeholder.update(this.currentContainer, this.placeholder);
 
            this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
            this.containers[innermostIndex].containerCache.over = 1;
        }
 
 
    },
 
    _createHelper: function(event) {
 
        var o = this.options,
            helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
 
        //Add the helper to the DOM if that didn't happen already
        if(!helper.parents("body").length) {
            $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
        }
 
        if(helper[0] === this.currentItem[0]) {
            this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
        }
 
        if(!helper[0].style.width || o.forceHelperSize) {
            helper.width(this.currentItem.width());
        }
        if(!helper[0].style.height || o.forceHelperSize) {
            helper.height(this.currentItem.height());
        }
 
        return helper;
 
    },
 
    _adjustOffsetFromHelper: function(obj) {
        if (typeof obj === "string") {
            obj = obj.split(" ");
        }
        if ($.isArray(obj)) {
            obj = {left: +obj[0], top: +obj[1] || 0};
        }
        if ("left" in obj) {
            this.offset.click.left = obj.left + this.margins.left;
        }
        if ("right" in obj) {
            this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
        }
        if ("top" in obj) {
            this.offset.click.top = obj.top + this.margins.top;
        }
        if ("bottom" in obj) {
            this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
        }
    },
 
    _getParentOffset: function() {
 
 
        //Get the offsetParent and cache its position
        this.offsetParent = this.helper.offsetParent();
        var po = this.offsetParent.offset();
 
        // This is a special case where we need to modify a offset calculated on start, since the following happened:
        // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
        // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
        //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
        if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
            po.left += this.scrollParent.scrollLeft();
            po.top += this.scrollParent.scrollTop();
        }
 
        // This needs to be actually done for all browsers, since pageX/pageY includes this information
        // with an ugly IE fix
        if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
            po = { top: 0, left: 0 };
        }
 
        return {
            top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
            left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
        };
 
    },
 
    _getRelativeOffset: function() {
 
        if(this.cssPosition === "relative") {
            var p = this.currentItem.position();
            return {
                top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
                left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
            };
        } else {
            return { top: 0, left: 0 };
        }
 
    },
 
    _cacheMargins: function() {
        this.margins = {
            left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
            top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
        };
    },
 
    _cacheHelperProportions: function() {
        this.helperProportions = {
            width: this.helper.outerWidth(),
            height: this.helper.outerHeight()
        };
    },
 
    _setContainment: function() {
 
        var ce, co, over,
            o = this.options;
        if(o.containment === "parent") {
            o.containment = this.helper[0].parentNode;
        }
        if(o.containment === "document" || o.containment === "window") {
            this.containment = [
                0 - this.offset.relative.left - this.offset.parent.left,
                0 - this.offset.relative.top - this.offset.parent.top,
                o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
                (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
            ];
        }
 
        if(!(/^(document|window|parent)$/).test(o.containment)) {
            ce = $(o.containment)[0];
            co = $(o.containment).offset();
            over = ($(ce).css("overflow") !== "hidden");
 
            this.containment = [
                co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
                co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
                co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
                co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
            ];
        }
 
    },
 
    _convertPositionTo: function(d, pos) {
 
        if(!pos) {
            pos = this.position;
        }
        var mod = d === "absolute" ? 1 : -1,
            scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
            scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
 
        return {
            top: (
                pos.top +                                                               // The absolute mouse position
                this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.top * mod -                                          // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
            ),
            left: (
                pos.left +                                                              // The absolute mouse position
                this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
            )
        };
 
    },
 
    _generatePosition: function(event) {
 
        var top, left,
            o = this.options,
            pageX = event.pageX,
            pageY = event.pageY,
            scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
 
        // This is another very weird special case that only happens for relative elements:
        // 1. If the css position is relative
        // 2. and the scroll parent is the document or similar to the offset parent
        // we have to refresh the relative offset during the scroll so there are no jumps
        if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
            this.offset.relative = this._getRelativeOffset();
        }
 
        /*
         * - Position constraining -
         * Constrain the position to a mix of grid, containment.
         */
 
        if(this.originalPosition) { //If we are not dragging yet, we won't check for options
 
            if(this.containment) {
                if(event.pageX - this.offset.click.left < this.containment[0]) {
                    pageX = this.containment[0] + this.offset.click.left;
                }
                if(event.pageY - this.offset.click.top < this.containment[1]) {
                    pageY = this.containment[1] + this.offset.click.top;
                }
                if(event.pageX - this.offset.click.left > this.containment[2]) {
                    pageX = this.containment[2] + this.offset.click.left;
                }
                if(event.pageY - this.offset.click.top > this.containment[3]) {
                    pageY = this.containment[3] + this.offset.click.top;
                }
            }
 
            if(o.grid) {
                top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
                pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
 
                left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
                pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
            }
 
        }
 
        return {
            top: (
                pageY -                                                             // The absolute mouse position
                this.offset.click.top -                                                 // Click offset (relative to the element)
                this.offset.relative.top    -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
            ),
            left: (
                pageX -                                                             // The absolute mouse position
                this.offset.click.left -                                                // Click offset (relative to the element)
                this.offset.relative.left   -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
                this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
                ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
            )
        };
 
    },
 
    _rearrange: function(event, i, a, hardRefresh) {
 
        a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
 
        //Various things done here to improve the performance:
        // 1. we create a setTimeout, that calls refreshPositions
        // 2. on the instance, we have a counter variable, that get's higher after every append
        // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
        // 4. this lets only the last addition to the timeout stack through
        this.counter = this.counter ? ++this.counter : 1;
        var counter = this.counter;
 
        this._delay(function() {
            if(counter === this.counter) {
                this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
            }
        });
 
    },
 
    _clear: function(event, noPropagation) {
 
        this.reverting = false;
        // We delay all events that have to be triggered to after the point where the placeholder has been removed and
        // everything else normalized again
        var i,
            delayedTriggers = [];
 
        // We first have to update the dom position of the actual currentItem
        // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
        if(!this._noFinalSort && this.currentItem.parent().length) {
            this.placeholder.before(this.currentItem);
        }
        this._noFinalSort = null;
 
        if(this.helper[0] === this.currentItem[0]) {
            for(i in this._storedCSS) {
                if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
                    this._storedCSS[i] = "";
                }
            }
            this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
        } else {
            this.currentItem.show();
        }
 
        if(this.fromOutside && !noPropagation) {
            delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
        }
        if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
            delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
        }
 
        // Check if the items Container has Changed and trigger appropriate
        // events.
        if (this !== this.currentContainer) {
            if(!noPropagation) {
                delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
                delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
                delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
            }
        }
 
 
        //Post events to containers
        function delayEvent( type, instance, container ) {
            return function( event ) {
                container._trigger( type, event, instance._uiHash( instance ) );
            };
        }
        for (i = this.containers.length - 1; i >= 0; i--){
            if (!noPropagation) {
                delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
            }
            if(this.containers[i].containerCache.over) {
                delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
                this.containers[i].containerCache.over = 0;
            }
        }
 
        //Do what was originally in plugins
        if ( this.storedCursor ) {
            this.document.find( "body" ).css( "cursor", this.storedCursor );
            this.storedStylesheet.remove();
        }
        if(this._storedOpacity) {
            this.helper.css("opacity", this._storedOpacity);
        }
        if(this._storedZIndex) {
            this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
        }
 
        this.dragging = false;
 
        if(!noPropagation) {
            this._trigger("beforeStop", event, this._uiHash());
        }
 
        //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
        this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
 
        if ( !this.cancelHelperRemoval ) {
            if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
                this.helper.remove();
            }
            this.helper = null;
        }
 
        if(!noPropagation) {
            for (i=0; i < delayedTriggers.length; i++) {
                delayedTriggers[i].call(this, event);
            } //Trigger all delayed events
            this._trigger("stop", event, this._uiHash());
        }
 
        this.fromOutside = false;
        return !this.cancelHelperRemoval;
 
    },
 
    _trigger: function() {
        if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
            this.cancel();
        }
    },
 
    _uiHash: function(_inst) {
        var inst = _inst || this;
        return {
            helper: inst.helper,
            placeholder: inst.placeholder || $([]),
            position: inst.position,
            originalPosition: inst.originalPosition,
            offset: inst.positionAbs,
            item: inst.currentItem,
            sender: _inst ? _inst.element : null
        };
    }
 
});
 
 
/*!
 * jQuery UI Accordion 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/accordion/
 */
 
 
var accordion = $.widget( "ui.accordion", {
    version: "1.11.4",
    options: {
        active: 0,
        animate: {},
        collapsible: false,
        event: "click",
        header: "> li > :first-child,> :not(li):even",
        heightStyle: "auto",
        icons: {
            activeHeader: "ui-icon-triangle-1-s",
            header: "ui-icon-triangle-1-e"
        },
 
        // callbacks
        activate: null,
        beforeActivate: null
    },
 
    hideProps: {
        borderTopWidth: "hide",
        borderBottomWidth: "hide",
        paddingTop: "hide",
        paddingBottom: "hide",
        height: "hide"
    },
 
    showProps: {
        borderTopWidth: "show",
        borderBottomWidth: "show",
        paddingTop: "show",
        paddingBottom: "show",
        height: "show"
    },
 
    _create: function() {
        var options = this.options;
        this.prevShow = this.prevHide = $();
        this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
            // ARIA
            .attr( "role", "tablist" );
 
        // don't allow collapsible: false and active: false / null
        if ( !options.collapsible && (options.active === false || options.active == null) ) {
            options.active = 0;
        }
 
        this._processPanels();
        // handle negative values
        if ( options.active < 0 ) {
            options.active += this.headers.length;
        }
        this._refresh();
    },
 
    _getCreateEventData: function() {
        return {
            header: this.active,
            panel: !this.active.length ? $() : this.active.next()
        };
    },
 
    _createIcons: function() {
        var icons = this.options.icons;
        if ( icons ) {
            $( "<span>" )
                .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
                .prependTo( this.headers );
            this.active.children( ".ui-accordion-header-icon" )
                .removeClass( icons.header )
                .addClass( icons.activeHeader );
            this.headers.addClass( "ui-accordion-icons" );
        }
    },
 
    _destroyIcons: function() {
        this.headers
            .removeClass( "ui-accordion-icons" )
            .children( ".ui-accordion-header-icon" )
                .remove();
    },
 
    _destroy: function() {
        var contents;
 
        // clean up main element
        this.element
            .removeClass( "ui-accordion ui-widget ui-helper-reset" )
            .removeAttr( "role" );
 
        // clean up headers
        this.headers
            .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
                "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
            .removeAttr( "role" )
            .removeAttr( "aria-expanded" )
            .removeAttr( "aria-selected" )
            .removeAttr( "aria-controls" )
            .removeAttr( "tabIndex" )
            .removeUniqueId();
 
        this._destroyIcons();
 
        // clean up content panels
        contents = this.headers.next()
            .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
                "ui-accordion-content ui-accordion-content-active ui-state-disabled" )
            .css( "display", "" )
            .removeAttr( "role" )
            .removeAttr( "aria-hidden" )
            .removeAttr( "aria-labelledby" )
            .removeUniqueId();
 
        if ( this.options.heightStyle !== "content" ) {
            contents.css( "height", "" );
        }
    },
 
    _setOption: function( key, value ) {
        if ( key === "active" ) {
            // _activate() will handle invalid values and update this.options
            this._activate( value );
            return;
        }
 
        if ( key === "event" ) {
            if ( this.options.event ) {
                this._off( this.headers, this.options.event );
            }
            this._setupEvents( value );
        }
 
        this._super( key, value );
 
        // setting collapsible: false while collapsed; open first panel
        if ( key === "collapsible" && !value && this.options.active === false ) {
            this._activate( 0 );
        }
 
        if ( key === "icons" ) {
            this._destroyIcons();
            if ( value ) {
                this._createIcons();
            }
        }
 
        // #5332 - opacity doesn't cascade to positioned elements in IE
        // so we need to add the disabled class to the headers and panels
        if ( key === "disabled" ) {
            this.element
                .toggleClass( "ui-state-disabled", !!value )
                .attr( "aria-disabled", value );
            this.headers.add( this.headers.next() )
                .toggleClass( "ui-state-disabled", !!value );
        }
    },
 
    _keydown: function( event ) {
        if ( event.altKey || event.ctrlKey ) {
            return;
        }
 
        var keyCode = $.ui.keyCode,
            length = this.headers.length,
            currentIndex = this.headers.index( event.target ),
            toFocus = false;
 
        switch ( event.keyCode ) {
            case keyCode.RIGHT:
            case keyCode.DOWN:
                toFocus = this.headers[ ( currentIndex + 1 ) % length ];
                break;
            case keyCode.LEFT:
            case keyCode.UP:
                toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
                break;
            case keyCode.SPACE:
            case keyCode.ENTER:
                this._eventHandler( event );
                break;
            case keyCode.HOME:
                toFocus = this.headers[ 0 ];
                break;
            case keyCode.END:
                toFocus = this.headers[ length - 1 ];
                break;
        }
 
        if ( toFocus ) {
            $( event.target ).attr( "tabIndex", -1 );
            $( toFocus ).attr( "tabIndex", 0 );
            toFocus.focus();
            event.preventDefault();
        }
    },
 
    _panelKeyDown: function( event ) {
        if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
            $( event.currentTarget ).prev().focus();
        }
    },
 
    refresh: function() {
        var options = this.options;
        this._processPanels();
 
        // was collapsed or no panel
        if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
            options.active = false;
            this.active = $();
        // active false only when collapsible is true
        } else if ( options.active === false ) {
            this._activate( 0 );
        // was active, but active panel is gone
        } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
            // all remaining panel are disabled
            if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
                options.active = false;
                this.active = $();
            // activate previous panel
            } else {
                this._activate( Math.max( 0, options.active - 1 ) );
            }
        // was active, active panel still exists
        } else {
            // make sure active index is correct
            options.active = this.headers.index( this.active );
        }
 
        this._destroyIcons();
 
        this._refresh();
    },
 
    _processPanels: function() {
        var prevHeaders = this.headers,
            prevPanels = this.panels;
 
        this.headers = this.element.find( this.options.header )
            .addClass( "ui-accordion-header ui-state-default ui-corner-all" );
 
        this.panels = this.headers.next()
            .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
            .filter( ":not(.ui-accordion-content-active)" )
            .hide();
 
        // Avoid memory leaks (#10056)
        if ( prevPanels ) {
            this._off( prevHeaders.not( this.headers ) );
            this._off( prevPanels.not( this.panels ) );
        }
    },
 
    _refresh: function() {
        var maxHeight,
            options = this.options,
            heightStyle = options.heightStyle,
            parent = this.element.parent();
 
        this.active = this._findActive( options.active )
            .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
            .removeClass( "ui-corner-all" );
        this.active.next()
            .addClass( "ui-accordion-content-active" )
            .show();
 
        this.headers
            .attr( "role", "tab" )
            .each(function() {
                var header = $( this ),
                    headerId = header.uniqueId().attr( "id" ),
                    panel = header.next(),
                    panelId = panel.uniqueId().attr( "id" );
                header.attr( "aria-controls", panelId );
                panel.attr( "aria-labelledby", headerId );
            })
            .next()
                .attr( "role", "tabpanel" );
 
        this.headers
            .not( this.active )
            .attr({
                "aria-selected": "false",
                "aria-expanded": "false",
                tabIndex: -1
            })
            .next()
                .attr({
                    "aria-hidden": "true"
                })
                .hide();
 
        // make sure at least one header is in the tab order
        if ( !this.active.length ) {
            this.headers.eq( 0 ).attr( "tabIndex", 0 );
        } else {
            this.active.attr({
                "aria-selected": "true",
                "aria-expanded": "true",
                tabIndex: 0
            })
            .next()
                .attr({
                    "aria-hidden": "false"
                });
        }
 
        this._createIcons();
 
        this._setupEvents( options.event );
 
        if ( heightStyle === "fill" ) {
            maxHeight = parent.height();
            this.element.siblings( ":visible" ).each(function() {
                var elem = $( this ),
                    position = elem.css( "position" );
 
                if ( position === "absolute" || position === "fixed" ) {
                    return;
                }
                maxHeight -= elem.outerHeight( true );
            });
 
            this.headers.each(function() {
                maxHeight -= $( this ).outerHeight( true );
            });
 
            this.headers.next()
                .each(function() {
                    $( this ).height( Math.max( 0, maxHeight -
                        $( this ).innerHeight() + $( this ).height() ) );
                })
                .css( "overflow", "auto" );
        } else if ( heightStyle === "auto" ) {
            maxHeight = 0;
            this.headers.next()
                .each(function() {
                    maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
                })
                .height( maxHeight );
        }
    },
 
    _activate: function( index ) {
        var active = this._findActive( index )[ 0 ];
 
        // trying to activate the already active panel
        if ( active === this.active[ 0 ] ) {
            return;
        }
 
        // trying to collapse, simulate a click on the currently active header
        active = active || this.active[ 0 ];
 
        this._eventHandler({
            target: active,
            currentTarget: active,
            preventDefault: $.noop
        });
    },
 
    _findActive: function( selector ) {
        return typeof selector === "number" ? this.headers.eq( selector ) : $();
    },
 
    _setupEvents: function( event ) {
        var events = {
            keydown: "_keydown"
        };
        if ( event ) {
            $.each( event.split( " " ), function( index, eventName ) {
                events[ eventName ] = "_eventHandler";
            });
        }
 
        this._off( this.headers.add( this.headers.next() ) );
        this._on( this.headers, events );
        this._on( this.headers.next(), { keydown: "_panelKeyDown" });
        this._hoverable( this.headers );
        this._focusable( this.headers );
    },
 
    _eventHandler: function( event ) {
        var options = this.options,
            active = this.active,
            clicked = $( event.currentTarget ),
            clickedIsActive = clicked[ 0 ] === active[ 0 ],
            collapsing = clickedIsActive && options.collapsible,
            toShow = collapsing ? $() : clicked.next(),
            toHide = active.next(),
            eventData = {
                oldHeader: active,
                oldPanel: toHide,
                newHeader: collapsing ? $() : clicked,
                newPanel: toShow
            };
 
        event.preventDefault();
 
        if (
                // click on active header, but not collapsible
                ( clickedIsActive && !options.collapsible ) ||
                // allow canceling activation
                ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
            return;
        }
 
        options.active = collapsing ? false : this.headers.index( clicked );
 
        // when the call to ._toggle() comes after the class changes
        // it causes a very odd bug in IE 8 (see #6720)
        this.active = clickedIsActive ? $() : clicked;
        this._toggle( eventData );
 
        // switch classes
        // corner classes on the previously active header stay after the animation
        active.removeClass( "ui-accordion-header-active ui-state-active" );
        if ( options.icons ) {
            active.children( ".ui-accordion-header-icon" )
                .removeClass( options.icons.activeHeader )
                .addClass( options.icons.header );
        }
 
        if ( !clickedIsActive ) {
            clicked
                .removeClass( "ui-corner-all" )
                .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
            if ( options.icons ) {
                clicked.children( ".ui-accordion-header-icon" )
                    .removeClass( options.icons.header )
                    .addClass( options.icons.activeHeader );
            }
 
            clicked
                .next()
                .addClass( "ui-accordion-content-active" );
        }
    },
 
    _toggle: function( data ) {
        var toShow = data.newPanel,
            toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
 
        // handle activating a panel during the animation for another activation
        this.prevShow.add( this.prevHide ).stop( true, true );
        this.prevShow = toShow;
        this.prevHide = toHide;
 
        if ( this.options.animate ) {
            this._animate( toShow, toHide, data );
        } else {
            toHide.hide();
            toShow.show();
            this._toggleComplete( data );
        }
 
        toHide.attr({
            "aria-hidden": "true"
        });
        toHide.prev().attr({
            "aria-selected": "false",
            "aria-expanded": "false"
        });
        // if we're switching panels, remove the old header from the tab order
        // if we're opening from collapsed state, remove the previous header from the tab order
        // if we're collapsing, then keep the collapsing header in the tab order
        if ( toShow.length && toHide.length ) {
            toHide.prev().attr({
                "tabIndex": -1,
                "aria-expanded": "false"
            });
        } else if ( toShow.length ) {
            this.headers.filter(function() {
                return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
            })
            .attr( "tabIndex", -1 );
        }
 
        toShow
            .attr( "aria-hidden", "false" )
            .prev()
                .attr({
                    "aria-selected": "true",
                    "aria-expanded": "true",
                    tabIndex: 0
                });
    },
 
    _animate: function( toShow, toHide, data ) {
        var total, easing, duration,
            that = this,
            adjust = 0,
            boxSizing = toShow.css( "box-sizing" ),
            down = toShow.length &&
                ( !toHide.length || ( toShow.index() < toHide.index() ) ),
            animate = this.options.animate || {},
            options = down && animate.down || animate,
            complete = function() {
                that._toggleComplete( data );
            };
 
        if ( typeof options === "number" ) {
            duration = options;
        }
        if ( typeof options === "string" ) {
            easing = options;
        }
        // fall back from options to animation in case of partial down settings
        easing = easing || options.easing || animate.easing;
        duration = duration || options.duration || animate.duration;
 
        if ( !toHide.length ) {
            return toShow.animate( this.showProps, duration, easing, complete );
        }
        if ( !toShow.length ) {
            return toHide.animate( this.hideProps, duration, easing, complete );
        }
 
        total = toShow.show().outerHeight();
        toHide.animate( this.hideProps, {
            duration: duration,
            easing: easing,
            step: function( now, fx ) {
                fx.now = Math.round( now );
            }
        });
        toShow
            .hide()
            .animate( this.showProps, {
                duration: duration,
                easing: easing,
                complete: complete,
                step: function( now, fx ) {
                    fx.now = Math.round( now );
                    if ( fx.prop !== "height" ) {
                        if ( boxSizing === "content-box" ) {
                            adjust += fx.now;
                        }
                    } else if ( that.options.heightStyle !== "content" ) {
                        fx.now = Math.round( total - toHide.outerHeight() - adjust );
                        adjust = 0;
                    }
                }
            });
    },
 
    _toggleComplete: function( data ) {
        var toHide = data.oldPanel;
 
        toHide
            .removeClass( "ui-accordion-content-active" )
            .prev()
                .removeClass( "ui-corner-top" )
                .addClass( "ui-corner-all" );
 
        // Work around for rendering bug in IE (#5421)
        if ( toHide.length ) {
            toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
        }
        this._trigger( "activate", null, data );
    }
});
 
 
/*!
 * jQuery UI Menu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/menu/
 */
 
 
var menu = $.widget( "ui.menu", {
    version: "1.11.4",
    defaultElement: "<ul>",
    delay: 300,
    options: {
        icons: {
            submenu: "ui-icon-carat-1-e"
        },
        items: "> *",
        menus: "ul",
        position: {
            my: "left-1 top",
            at: "right top"
        },
        role: "menu",
 
        // callbacks
        blur: null,
        focus: null,
        select: null
    },
 
    _create: function() {
        this.activeMenu = this.element;
 
        // Flag used to prevent firing of the click handler
        // as the event bubbles up through nested menus
        this.mouseHandled = false;
        this.element
            .uniqueId()
            .addClass( "ui-menu ui-widget ui-widget-content" )
            .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
            .attr({
                role: this.options.role,
                tabIndex: 0
            });
 
        if ( this.options.disabled ) {
            this.element
                .addClass( "ui-state-disabled" )
                .attr( "aria-disabled", "true" );
        }
 
        this._on({
            // Prevent focus from sticking to links inside menu after clicking
            // them (focus should always stay on UL during navigation).
            "mousedown .ui-menu-item": function( event ) {
                event.preventDefault();
            },
            "click .ui-menu-item": function( event ) {
                var target = $( event.target );
                if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
                    this.select( event );
 
                    // Only set the mouseHandled flag if the event will bubble, see #9469.
                    if ( !event.isPropagationStopped() ) {
                        this.mouseHandled = true;
                    }
 
                    // Open submenu on click
                    if ( target.has( ".ui-menu" ).length ) {
                        this.expand( event );
                    } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
 
                        // Redirect focus to the menu
                        this.element.trigger( "focus", [ true ] );
 
                        // If the active item is on the top level, let it stay active.
                        // Otherwise, blur the active item since it is no longer visible.
                        if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
                            clearTimeout( this.timer );
                        }
                    }
                }
            },
            "mouseenter .ui-menu-item": function( event ) {
                // Ignore mouse events while typeahead is active, see #10458.
                // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
                // is over an item in the menu
                if ( this.previousFilter ) {
                    return;
                }
                var target = $( event.currentTarget );
                // Remove ui-state-active class from siblings of the newly focused menu item
                // to avoid a jump caused by adjacent elements both having a class with a border
                target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
                this.focus( event, target );
            },
            mouseleave: "collapseAll",
            "mouseleave .ui-menu": "collapseAll",
            focus: function( event, keepActiveItem ) {
                // If there's already an active item, keep it active
                // If not, activate the first item
                var item = this.active || this.element.find( this.options.items ).eq( 0 );
 
                if ( !keepActiveItem ) {
                    this.focus( event, item );
                }
            },
            blur: function( event ) {
                this._delay(function() {
                    if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
                        this.collapseAll( event );
                    }
                });
            },
            keydown: "_keydown"
        });
 
        this.refresh();
 
        // Clicks outside of a menu collapse any open menus
        this._on( this.document, {
            click: function( event ) {
                if ( this._closeOnDocumentClick( event ) ) {
                    this.collapseAll( event );
                }
 
                // Reset the mouseHandled flag
                this.mouseHandled = false;
            }
        });
    },
 
    _destroy: function() {
        // Destroy (sub)menus
        this.element
            .removeAttr( "aria-activedescendant" )
            .find( ".ui-menu" ).addBack()
                .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
                .removeAttr( "role" )
                .removeAttr( "tabIndex" )
                .removeAttr( "aria-labelledby" )
                .removeAttr( "aria-expanded" )
                .removeAttr( "aria-hidden" )
                .removeAttr( "aria-disabled" )
                .removeUniqueId()
                .show();
 
        // Destroy menu items
        this.element.find( ".ui-menu-item" )
            .removeClass( "ui-menu-item" )
            .removeAttr( "role" )
            .removeAttr( "aria-disabled" )
            .removeUniqueId()
            .removeClass( "ui-state-hover" )
            .removeAttr( "tabIndex" )
            .removeAttr( "role" )
            .removeAttr( "aria-haspopup" )
            .children().each( function() {
                var elem = $( this );
                if ( elem.data( "ui-menu-submenu-carat" ) ) {
                    elem.remove();
                }
            });
 
        // Destroy menu dividers
        this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
    },
 
    _keydown: function( event ) {
        var match, prev, character, skip,
            preventDefault = true;
 
        switch ( event.keyCode ) {
        case $.ui.keyCode.PAGE_UP:
            this.previousPage( event );
            break;
        case $.ui.keyCode.PAGE_DOWN:
            this.nextPage( event );
            break;
        case $.ui.keyCode.HOME:
            this._move( "first", "first", event );
            break;
        case $.ui.keyCode.END:
            this._move( "last", "last", event );
            break;
        case $.ui.keyCode.UP:
            this.previous( event );
            break;
        case $.ui.keyCode.DOWN:
            this.next( event );
            break;
        case $.ui.keyCode.LEFT:
            this.collapse( event );
            break;
        case $.ui.keyCode.RIGHT:
            if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
                this.expand( event );
            }
            break;
        case $.ui.keyCode.ENTER:
        case $.ui.keyCode.SPACE:
            this._activate( event );
            break;
        case $.ui.keyCode.ESCAPE:
            this.collapse( event );
            break;
        default:
            preventDefault = false;
            prev = this.previousFilter || "";
            character = String.fromCharCode( event.keyCode );
            skip = false;
 
            clearTimeout( this.filterTimer );
 
            if ( character === prev ) {
                skip = true;
            } else {
                character = prev + character;
            }
 
            match = this._filterMenuItems( character );
            match = skip && match.index( this.active.next() ) !== -1 ?
                this.active.nextAll( ".ui-menu-item" ) :
                match;
 
            // If no matches on the current filter, reset to the last character pressed
            // to move down the menu to the first item that starts with that character
            if ( !match.length ) {
                character = String.fromCharCode( event.keyCode );
                match = this._filterMenuItems( character );
            }
 
            if ( match.length ) {
                this.focus( event, match );
                this.previousFilter = character;
                this.filterTimer = this._delay(function() {
                    delete this.previousFilter;
                }, 1000 );
            } else {
                delete this.previousFilter;
            }
        }
 
        if ( preventDefault ) {
            event.preventDefault();
        }
    },
 
    _activate: function( event ) {
        if ( !this.active.is( ".ui-state-disabled" ) ) {
            if ( this.active.is( "[aria-haspopup='true']" ) ) {
                this.expand( event );
            } else {
                this.select( event );
            }
        }
    },
 
    refresh: function() {
        var menus, items,
            that = this,
            icon = this.options.icons.submenu,
            submenus = this.element.find( this.options.menus );
 
        this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
 
        // Initialize nested menus
        submenus.filter( ":not(.ui-menu)" )
            .addClass( "ui-menu ui-widget ui-widget-content ui-front" )
            .hide()
            .attr({
                role: this.options.role,
                "aria-hidden": "true",
                "aria-expanded": "false"
            })
            .each(function() {
                var menu = $( this ),
                    item = menu.parent(),
                    submenuCarat = $( "<span>" )
                        .addClass( "ui-menu-icon ui-icon " + icon )
                        .data( "ui-menu-submenu-carat", true );
 
                item
                    .attr( "aria-haspopup", "true" )
                    .prepend( submenuCarat );
                menu.attr( "aria-labelledby", item.attr( "id" ) );
            });
 
        menus = submenus.add( this.element );
        items = menus.find( this.options.items );
 
        // Initialize menu-items containing spaces and/or dashes only as dividers
        items.not( ".ui-menu-item" ).each(function() {
            var item = $( this );
            if ( that._isDivider( item ) ) {
                item.addClass( "ui-widget-content ui-menu-divider" );
            }
        });
 
        // Don't refresh list items that are already adapted
        items.not( ".ui-menu-item, .ui-menu-divider" )
            .addClass( "ui-menu-item" )
            .uniqueId()
            .attr({
                tabIndex: -1,
                role: this._itemRole()
            });
 
        // Add aria-disabled attribute to any disabled menu item
        items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
 
        // If the active item has been removed, blur the menu
        if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
            this.blur();
        }
    },
 
    _itemRole: function() {
        return {
            menu: "menuitem",
            listbox: "option"
        }[ this.options.role ];
    },
 
    _setOption: function( key, value ) {
        if ( key === "icons" ) {
            this.element.find( ".ui-menu-icon" )
                .removeClass( this.options.icons.submenu )
                .addClass( value.submenu );
        }
        if ( key === "disabled" ) {
            this.element
                .toggleClass( "ui-state-disabled", !!value )
                .attr( "aria-disabled", value );
        }
        this._super( key, value );
    },
 
    focus: function( event, item ) {
        var nested, focused;
        this.blur( event, event && event.type === "focus" );
 
        this._scrollIntoView( item );
 
        this.active = item.first();
        focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
        // Only update aria-activedescendant if there's a role
        // otherwise we assume focus is managed elsewhere
        if ( this.options.role ) {
            this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
        }
 
        // Highlight active parent menu item, if any
        this.active
            .parent()
            .closest( ".ui-menu-item" )
            .addClass( "ui-state-active" );
 
        if ( event && event.type === "keydown" ) {
            this._close();
        } else {
            this.timer = this._delay(function() {
                this._close();
            }, this.delay );
        }
 
        nested = item.children( ".ui-menu" );
        if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
            this._startOpening(nested);
        }
        this.activeMenu = item.parent();
 
        this._trigger( "focus", event, { item: item } );
    },
 
    _scrollIntoView: function( item ) {
        var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
        if ( this._hasScroll() ) {
            borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
            paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
            offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
            scroll = this.activeMenu.scrollTop();
            elementHeight = this.activeMenu.height();
            itemHeight = item.outerHeight();
 
            if ( offset < 0 ) {
                this.activeMenu.scrollTop( scroll + offset );
            } else if ( offset + itemHeight > elementHeight ) {
                this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
            }
        }
    },
 
    blur: function( event, fromFocus ) {
        if ( !fromFocus ) {
            clearTimeout( this.timer );
        }
 
        if ( !this.active ) {
            return;
        }
 
        this.active.removeClass( "ui-state-focus" );
        this.active = null;
 
        this._trigger( "blur", event, { item: this.active } );
    },
 
    _startOpening: function( submenu ) {
        clearTimeout( this.timer );
 
        // Don't open if already open fixes a Firefox bug that caused a .5 pixel
        // shift in the submenu position when mousing over the carat icon
        if ( submenu.attr( "aria-hidden" ) !== "true" ) {
            return;
        }
 
        this.timer = this._delay(function() {
            this._close();
            this._open( submenu );
        }, this.delay );
    },
 
    _open: function( submenu ) {
        var position = $.extend({
            of: this.active
        }, this.options.position );
 
        clearTimeout( this.timer );
        this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
            .hide()
            .attr( "aria-hidden", "true" );
 
        submenu
            .show()
            .removeAttr( "aria-hidden" )
            .attr( "aria-expanded", "true" )
            .position( position );
    },
 
    collapseAll: function( event, all ) {
        clearTimeout( this.timer );
        this.timer = this._delay(function() {
            // If we were passed an event, look for the submenu that contains the event
            var currentMenu = all ? this.element :
                $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
 
            // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
            if ( !currentMenu.length ) {
                currentMenu = this.element;
            }
 
            this._close( currentMenu );
 
            this.blur( event );
            this.activeMenu = currentMenu;
        }, this.delay );
    },
 
    // With no arguments, closes the currently active menu - if nothing is active
    // it closes all menus.  If passed an argument, it will search for menus BELOW
    _close: function( startMenu ) {
        if ( !startMenu ) {
            startMenu = this.active ? this.active.parent() : this.element;
        }
 
        startMenu
            .find( ".ui-menu" )
                .hide()
                .attr( "aria-hidden", "true" )
                .attr( "aria-expanded", "false" )
            .end()
            .find( ".ui-state-active" ).not( ".ui-state-focus" )
                .removeClass( "ui-state-active" );
    },
 
    _closeOnDocumentClick: function( event ) {
        return !$( event.target ).closest( ".ui-menu" ).length;
    },
 
    _isDivider: function( item ) {
 
        // Match hyphen, em dash, en dash
        return !/[^\-\u2014\u2013\s]/.test( item.text() );
    },
 
    collapse: function( event ) {
        var newItem = this.active &&
            this.active.parent().closest( ".ui-menu-item", this.element );
        if ( newItem && newItem.length ) {
            this._close();
            this.focus( event, newItem );
        }
    },
 
    expand: function( event ) {
        var newItem = this.active &&
            this.active
                .children( ".ui-menu " )
                .find( this.options.items )
                .first();
 
        if ( newItem && newItem.length ) {
            this._open( newItem.parent() );
 
            // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
            this._delay(function() {
                this.focus( event, newItem );
            });
        }
    },
 
    next: function( event ) {
        this._move( "next", "first", event );
    },
 
    previous: function( event ) {
        this._move( "prev", "last", event );
    },
 
    isFirstItem: function() {
        return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
    },
 
    isLastItem: function() {
        return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
    },
 
    _move: function( direction, filter, event ) {
        var next;
        if ( this.active ) {
            if ( direction === "first" || direction === "last" ) {
                next = this.active
                    [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
                    .eq( -1 );
            } else {
                next = this.active
                    [ direction + "All" ]( ".ui-menu-item" )
                    .eq( 0 );
            }
        }
        if ( !next || !next.length || !this.active ) {
            next = this.activeMenu.find( this.options.items )[ filter ]();
        }
 
        this.focus( event, next );
    },
 
    nextPage: function( event ) {
        var item, base, height;
 
        if ( !this.active ) {
            this.next( event );
            return;
        }
        if ( this.isLastItem() ) {
            return;
        }
        if ( this._hasScroll() ) {
            base = this.active.offset().top;
            height = this.element.height();
            this.active.nextAll( ".ui-menu-item" ).each(function() {
                item = $( this );
                return item.offset().top - base - height < 0;
            });
 
            this.focus( event, item );
        } else {
            this.focus( event, this.activeMenu.find( this.options.items )
                [ !this.active ? "first" : "last" ]() );
        }
    },
 
    previousPage: function( event ) {
        var item, base, height;
        if ( !this.active ) {
            this.next( event );
            return;
        }
        if ( this.isFirstItem() ) {
            return;
        }
        if ( this._hasScroll() ) {
            base = this.active.offset().top;
            height = this.element.height();
            this.active.prevAll( ".ui-menu-item" ).each(function() {
                item = $( this );
                return item.offset().top - base + height > 0;
            });
 
            this.focus( event, item );
        } else {
            this.focus( event, this.activeMenu.find( this.options.items ).first() );
        }
    },
 
    _hasScroll: function() {
        return this.element.outerHeight() < this.element.prop( "scrollHeight" );
    },
 
    select: function( event ) {
        // TODO: It should never be possible to not have an active item at this
        // point, but the tests don't trigger mouseenter before click.
        this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
        var ui = { item: this.active };
        if ( !this.active.has( ".ui-menu" ).length ) {
            this.collapseAll( event, true );
        }
        this._trigger( "select", event, ui );
    },
 
    _filterMenuItems: function(character) {
        var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
            regex = new RegExp( "^" + escapedCharacter, "i" );
 
        return this.activeMenu
            .find( this.options.items )
 
            // Only match on items, not dividers or other content (#10571)
            .filter( ".ui-menu-item" )
            .filter(function() {
                return regex.test( $.trim( $( this ).text() ) );
            });
    }
});
 
 
/*!
 * jQuery UI Autocomplete 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/autocomplete/
 */
 
 
$.widget( "ui.autocomplete", {
    version: "1.11.4",
    defaultElement: "<input>",
    options: {
        appendTo: null,
        autoFocus: false,
        delay: 300,
        minLength: 1,
        position: {
            my: "left top",
            at: "left bottom",
            collision: "none"
        },
        source: null,
 
        // callbacks
        change: null,
        close: null,
        focus: null,
        open: null,
        response: null,
        search: null,
        select: null
    },
 
    requestIndex: 0,
    pending: 0,
 
    _create: function() {
        // Some browsers only repeat keydown events, not keypress events,
        // so we use the suppressKeyPress flag to determine if we've already
        // handled the keydown event. #7269
        // Unfortunately the code for & in keypress is the same as the up arrow,
        // so we use the suppressKeyPressRepeat flag to avoid handling keypress
        // events when we know the keydown event was used to modify the
        // search term. #7799
        var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
            nodeName = this.element[ 0 ].nodeName.toLowerCase(),
            isTextarea = nodeName === "textarea",
            isInput = nodeName === "input";
 
        this.isMultiLine =
            // Textareas are always multi-line
            isTextarea ? true :
            // Inputs are always single-line, even if inside a contentEditable element
            // IE also treats inputs as contentEditable
            isInput ? false :
            // All other element types are determined by whether or not they're contentEditable
            this.element.prop( "isContentEditable" );
 
        this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
        this.isNewMenu = true;
 
        this.element
            .addClass( "ui-autocomplete-input" )
            .attr( "autocomplete", "off" );
 
        this._on( this.element, {
            keydown: function( event ) {
                if ( this.element.prop( "readOnly" ) ) {
                    suppressKeyPress = true;
                    suppressInput = true;
                    suppressKeyPressRepeat = true;
                    return;
                }
 
                suppressKeyPress = false;
                suppressInput = false;
                suppressKeyPressRepeat = false;
                var keyCode = $.ui.keyCode;
                switch ( event.keyCode ) {
                case keyCode.PAGE_UP:
                    suppressKeyPress = true;
                    this._move( "previousPage", event );
                    break;
                case keyCode.PAGE_DOWN:
                    suppressKeyPress = true;
                    this._move( "nextPage", event );
                    break;
                case keyCode.UP:
                    suppressKeyPress = true;
                    this._keyEvent( "previous", event );
                    break;
                case keyCode.DOWN:
                    suppressKeyPress = true;
                    this._keyEvent( "next", event );
                    break;
                case keyCode.ENTER:
                    // when menu is open and has focus
                    if ( this.menu.active ) {
                        // #6055 - Opera still allows the keypress to occur
                        // which causes forms to submit
                        suppressKeyPress = true;
                        event.preventDefault();
                        this.menu.select( event );
                    }
                    break;
                case keyCode.TAB:
                    if ( this.menu.active ) {
                        this.menu.select( event );
                    }
                    break;
                case keyCode.ESCAPE:
                    if ( this.menu.element.is( ":visible" ) ) {
                        if ( !this.isMultiLine ) {
                            this._value( this.term );
                        }
                        this.close( event );
                        // Different browsers have different default behavior for escape
                        // Single press can mean undo or clear
                        // Double press in IE means clear the whole form
                        event.preventDefault();
                    }
                    break;
                default:
                    suppressKeyPressRepeat = true;
                    // search timeout should be triggered before the input value is changed
                    this._searchTimeout( event );
                    break;
                }
            },
            keypress: function( event ) {
                if ( suppressKeyPress ) {
                    suppressKeyPress = false;
                    if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
                        event.preventDefault();
                    }
                    return;
                }
                if ( suppressKeyPressRepeat ) {
                    return;
                }
 
                // replicate some key handlers to allow them to repeat in Firefox and Opera
                var keyCode = $.ui.keyCode;
                switch ( event.keyCode ) {
                case keyCode.PAGE_UP:
                    this._move( "previousPage", event );
                    break;
                case keyCode.PAGE_DOWN:
                    this._move( "nextPage", event );
                    break;
                case keyCode.UP:
                    this._keyEvent( "previous", event );
                    break;
                case keyCode.DOWN:
                    this._keyEvent( "next", event );
                    break;
                }
            },
            input: function( event ) {
                if ( suppressInput ) {
                    suppressInput = false;
                    event.preventDefault();
                    return;
                }
                this._searchTimeout( event );
            },
            focus: function() {
                this.selectedItem = null;
                this.previous = this._value();
            },
            blur: function( event ) {
                if ( this.cancelBlur ) {
                    delete this.cancelBlur;
                    return;
                }
 
                clearTimeout( this.searching );
                this.close( event );
                this._change( event );
            }
        });
 
        this._initSource();
        this.menu = $( "<ul>" )
            .addClass( "ui-autocomplete ui-front" )
            .appendTo( this._appendTo() )
            .menu({
                // disable ARIA support, the live region takes care of that
                role: null
            })
            .hide()
            .menu( "instance" );
 
        this._on( this.menu.element, {
            mousedown: function( event ) {
                // prevent moving focus out of the text field
                event.preventDefault();
 
                // IE doesn't prevent moving focus even with event.preventDefault()
                // so we set a flag to know when we should ignore the blur event
                this.cancelBlur = true;
                this._delay(function() {
                    delete this.cancelBlur;
                });
 
                // clicking on the scrollbar causes focus to shift to the body
                // but we can't detect a mouseup or a click immediately afterward
                // so we have to track the next mousedown and close the menu if
                // the user clicks somewhere outside of the autocomplete
                var menuElement = this.menu.element[ 0 ];
                if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
                    this._delay(function() {
                        var that = this;
                        this.document.one( "mousedown", function( event ) {
                            if ( event.target !== that.element[ 0 ] &&
                                    event.target !== menuElement &&
                                    !$.contains( menuElement, event.target ) ) {
                                that.close();
                            }
                        });
                    });
                }
            },
            menufocus: function( event, ui ) {
                var label, item;
                // support: Firefox
                // Prevent accidental activation of menu items in Firefox (#7024 #9118)
                if ( this.isNewMenu ) {
                    this.isNewMenu = false;
                    if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
                        this.menu.blur();
 
                        this.document.one( "mousemove", function() {
                            $( event.target ).trigger( event.originalEvent );
                        });
 
                        return;
                    }
                }
 
                item = ui.item.data( "ui-autocomplete-item" );
                if ( false !== this._trigger( "focus", event, { item: item } ) ) {
                    // use value to match what will end up in the input, if it was a key event
                    if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
                        this._value( item.value );
                    }
                }
 
                // Announce the value in the liveRegion
                label = ui.item.attr( "aria-label" ) || item.value;
                if ( label && $.trim( label ).length ) {
                    this.liveRegion.children().hide();
                    $( "<div>" ).text( label ).appendTo( this.liveRegion );
                }
            },
            menuselect: function( event, ui ) {
                var item = ui.item.data( "ui-autocomplete-item" ),
                    previous = this.previous;
 
                // only trigger when focus was lost (click on menu)
                if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
                    this.element.focus();
                    this.previous = previous;
                    // #6109 - IE triggers two focus events and the second
                    // is asynchronous, so we need to reset the previous
                    // term synchronously and asynchronously :-(
                    this._delay(function() {
                        this.previous = previous;
                        this.selectedItem = item;
                    });
                }
 
                if ( false !== this._trigger( "select", event, { item: item } ) ) {
                    this._value( item.value );
                }
                // reset the term after the select event
                // this allows custom select handling to work properly
                this.term = this._value();
 
                this.close( event );
                this.selectedItem = item;
            }
        });
 
        this.liveRegion = $( "<span>", {
                role: "status",
                "aria-live": "assertive",
                "aria-relevant": "additions"
            })
            .addClass( "ui-helper-hidden-accessible" )
            .appendTo( this.document[ 0 ].body );
 
        // turning off autocomplete prevents the browser from remembering the
        // value when navigating through history, so we re-enable autocomplete
        // if the page is unloaded before the widget is destroyed. #7790
        this._on( this.window, {
            beforeunload: function() {
                this.element.removeAttr( "autocomplete" );
            }
        });
    },
 
    _destroy: function() {
        clearTimeout( this.searching );
        this.element
            .removeClass( "ui-autocomplete-input" )
            .removeAttr( "autocomplete" );
        this.menu.element.remove();
        this.liveRegion.remove();
    },
 
    _setOption: function( key, value ) {
        this._super( key, value );
        if ( key === "source" ) {
            this._initSource();
        }
        if ( key === "appendTo" ) {
            this.menu.element.appendTo( this._appendTo() );
        }
        if ( key === "disabled" && value && this.xhr ) {
            this.xhr.abort();
        }
    },
 
    _appendTo: function() {
        var element = this.options.appendTo;
 
        if ( element ) {
            element = element.jquery || element.nodeType ?
                $( element ) :
                this.document.find( element ).eq( 0 );
        }
 
        if ( !element || !element[ 0 ] ) {
            element = this.element.closest( ".ui-front" );
        }
 
        if ( !element.length ) {
            element = this.document[ 0 ].body;
        }
 
        return element;
    },
 
    _initSource: function() {
        var array, url,
            that = this;
        if ( $.isArray( this.options.source ) ) {
            array = this.options.source;
            this.source = function( request, response ) {
                response( $.ui.autocomplete.filter( array, request.term ) );
            };
        } else if ( typeof this.options.source === "string" ) {
            url = this.options.source;
            this.source = function( request, response ) {
                if ( that.xhr ) {
                    that.xhr.abort();
                }
                that.xhr = $.ajax({
                    url: url,
                    data: request,
                    dataType: "json",
                    success: function( data ) {
                        response( data );
                    },
                    error: function() {
                        response([]);
                    }
                });
            };
        } else {
            this.source = this.options.source;
        }
    },
 
    _searchTimeout: function( event ) {
        clearTimeout( this.searching );
        this.searching = this._delay(function() {
 
            // Search if the value has changed, or if the user retypes the same value (see #7434)
            var equalValues = this.term === this._value(),
                menuVisible = this.menu.element.is( ":visible" ),
                modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
 
            if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
                this.selectedItem = null;
                this.search( null, event );
            }
        }, this.options.delay );
    },
 
    search: function( value, event ) {
        value = value != null ? value : this._value();
 
        // always save the actual value, not the one passed as an argument
        this.term = this._value();
 
        if ( value.length < this.options.minLength ) {
            return this.close( event );
        }
 
        if ( this._trigger( "search", event ) === false ) {
            return;
        }
 
        return this._search( value );
    },
 
    _search: function( value ) {
        this.pending++;
        this.element.addClass( "ui-autocomplete-loading" );
        this.cancelSearch = false;
 
        this.source( { term: value }, this._response() );
    },
 
    _response: function() {
        var index = ++this.requestIndex;
 
        return $.proxy(function( content ) {
            if ( index === this.requestIndex ) {
                this.__response( content );
            }
 
            this.pending--;
            if ( !this.pending ) {
                this.element.removeClass( "ui-autocomplete-loading" );
            }
        }, this );
    },
 
    __response: function( content ) {
        if ( content ) {
            content = this._normalize( content );
        }
        this._trigger( "response", null, { content: content } );
        if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
            this._suggest( content );
            this._trigger( "open" );
        } else {
            // use ._close() instead of .close() so we don't cancel future searches
            this._close();
        }
    },
 
    close: function( event ) {
        this.cancelSearch = true;
        this._close( event );
    },
 
    _close: function( event ) {
        if ( this.menu.element.is( ":visible" ) ) {
            this.menu.element.hide();
            this.menu.blur();
            this.isNewMenu = true;
            this._trigger( "close", event );
        }
    },
 
    _change: function( event ) {
        if ( this.previous !== this._value() ) {
            this._trigger( "change", event, { item: this.selectedItem } );
        }
    },
 
    _normalize: function( items ) {
        // assume all items have the right format when the first item is complete
        if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
            return items;
        }
        return $.map( items, function( item ) {
            if ( typeof item === "string" ) {
                return {
                    label: item,
                    value: item
                };
            }
            return $.extend( {}, item, {
                label: item.label || item.value,
                value: item.value || item.label
            });
        });
    },
 
    _suggest: function( items ) {
        var ul = this.menu.element.empty();
        this._renderMenu( ul, items );
        this.isNewMenu = true;
        this.menu.refresh();
 
        // size and position menu
        ul.show();
        this._resizeMenu();
        ul.position( $.extend({
            of: this.element
        }, this.options.position ) );
 
        if ( this.options.autoFocus ) {
            this.menu.next();
        }
    },
 
    _resizeMenu: function() {
        var ul = this.menu.element;
        ul.outerWidth( Math.max(
            // Firefox wraps long text (possibly a rounding bug)
            // so we add 1px to avoid the wrapping (#7513)
            ul.width( "" ).outerWidth() + 1,
            this.element.outerWidth()
        ) );
    },
 
    _renderMenu: function( ul, items ) {
        var that = this;
        $.each( items, function( index, item ) {
            that._renderItemData( ul, item );
        });
    },
 
    _renderItemData: function( ul, item ) {
        return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
    },
 
    _renderItem: function( ul, item ) {
        return $( "<li>" ).text( item.label ).appendTo( ul );
    },
 
    _move: function( direction, event ) {
        if ( !this.menu.element.is( ":visible" ) ) {
            this.search( null, event );
            return;
        }
        if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
                this.menu.isLastItem() && /^next/.test( direction ) ) {
 
            if ( !this.isMultiLine ) {
                this._value( this.term );
            }
 
            this.menu.blur();
            return;
        }
        this.menu[ direction ]( event );
    },
 
    widget: function() {
        return this.menu.element;
    },
 
    _value: function() {
        return this.valueMethod.apply( this.element, arguments );
    },
 
    _keyEvent: function( keyEvent, event ) {
        if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
            this._move( keyEvent, event );
 
            // prevents moving cursor to beginning/end of the text field in some browsers
            event.preventDefault();
        }
    }
});
 
$.extend( $.ui.autocomplete, {
    escapeRegex: function( value ) {
        return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
    },
    filter: function( array, term ) {
        var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
        return $.grep( array, function( value ) {
            return matcher.test( value.label || value.value || value );
        });
    }
});
 
// live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget( "ui.autocomplete", $.ui.autocomplete, {
    options: {
        messages: {
            noResults: "No search results.",
            results: function( amount ) {
                return amount + ( amount > 1 ? " results are" : " result is" ) +
                    " available, use up and down arrow keys to navigate.";
            }
        }
    },
 
    __response: function( content ) {
        var message;
        this._superApply( arguments );
        if ( this.options.disabled || this.cancelSearch ) {
            return;
        }
        if ( content && content.length ) {
            message = this.options.messages.results( content.length );
        } else {
            message = this.options.messages.noResults;
        }
        this.liveRegion.children().hide();
        $( "<div>" ).text( message ).appendTo( this.liveRegion );
    }
});
 
var autocomplete = $.ui.autocomplete;
 
 
/*!
 * jQuery UI Button 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/button/
 */
 
 
var lastActive,
    baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
    typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
    formResetHandler = function() {
        var form = $( this );
        setTimeout(function() {
            form.find( ":ui-button" ).button( "refresh" );
        }, 1 );
    },
    radioGroup = function( radio ) {
        var name = radio.name,
            form = radio.form,
            radios = $( [] );
        if ( name ) {
            name = name.replace( /'/g, "\\'" );
            if ( form ) {
                radios = $( form ).find( "[name='" + name + "'][type=radio]" );
            } else {
                radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
                    .filter(function() {
                        return !this.form;
                    });
            }
        }
        return radios;
    };
 
$.widget( "ui.button", {
    version: "1.11.4",
    defaultElement: "<button>",
    options: {
        disabled: null,
        text: true,
        label: null,
        icons: {
            primary: null,
            secondary: null
        }
    },
    _create: function() {
        this.element.closest( "form" )
            .unbind( "reset" + this.eventNamespace )
            .bind( "reset" + this.eventNamespace, formResetHandler );
 
        if ( typeof this.options.disabled !== "boolean" ) {
            this.options.disabled = !!this.element.prop( "disabled" );
        } else {
            this.element.prop( "disabled", this.options.disabled );
        }
 
        this._determineButtonType();
        this.hasTitle = !!this.buttonElement.attr( "title" );
 
        var that = this,
            options = this.options,
            toggleButton = this.type === "checkbox" || this.type === "radio",
            activeClass = !toggleButton ? "ui-state-active" : "";
 
        if ( options.label === null ) {
            options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
        }
 
        this._hoverable( this.buttonElement );
 
        this.buttonElement
            .addClass( baseClasses )
            .attr( "role", "button" )
            .bind( "mouseenter" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return;
                }
                if ( this === lastActive ) {
                    $( this ).addClass( "ui-state-active" );
                }
            })
            .bind( "mouseleave" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return;
                }
                $( this ).removeClass( activeClass );
            })
            .bind( "click" + this.eventNamespace, function( event ) {
                if ( options.disabled ) {
                    event.preventDefault();
                    event.stopImmediatePropagation();
                }
            });
 
        // Can't use _focusable() because the element that receives focus
        // and the element that gets the ui-state-focus class are different
        this._on({
            focus: function() {
                this.buttonElement.addClass( "ui-state-focus" );
            },
            blur: function() {
                this.buttonElement.removeClass( "ui-state-focus" );
            }
        });
 
        if ( toggleButton ) {
            this.element.bind( "change" + this.eventNamespace, function() {
                that.refresh();
            });
        }
 
        if ( this.type === "checkbox" ) {
            this.buttonElement.bind( "click" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return false;
                }
            });
        } else if ( this.type === "radio" ) {
            this.buttonElement.bind( "click" + this.eventNamespace, function() {
                if ( options.disabled ) {
                    return false;
                }
                $( this ).addClass( "ui-state-active" );
                that.buttonElement.attr( "aria-pressed", "true" );
 
                var radio = that.element[ 0 ];
                radioGroup( radio )
                    .not( radio )
                    .map(function() {
                        return $( this ).button( "widget" )[ 0 ];
                    })
                    .removeClass( "ui-state-active" )
                    .attr( "aria-pressed", "false" );
            });
        } else {
            this.buttonElement
                .bind( "mousedown" + this.eventNamespace, function() {
                    if ( options.disabled ) {
                        return false;
                    }
                    $( this ).addClass( "ui-state-active" );
                    lastActive = this;
                    that.document.one( "mouseup", function() {
                        lastActive = null;
                    });
                })
                .bind( "mouseup" + this.eventNamespace, function() {
                    if ( options.disabled ) {
                        return false;
                    }
                    $( this ).removeClass( "ui-state-active" );
                })
                .bind( "keydown" + this.eventNamespace, function(event) {
                    if ( options.disabled ) {
                        return false;
                    }
                    if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
                        $( this ).addClass( "ui-state-active" );
                    }
                })
                // see #8559, we bind to blur here in case the button element loses
                // focus between keydown and keyup, it would be left in an "active" state
                .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
                    $( this ).removeClass( "ui-state-active" );
                });
 
            if ( this.buttonElement.is("a") ) {
                this.buttonElement.keyup(function(event) {
                    if ( event.keyCode === $.ui.keyCode.SPACE ) {
                        // TODO pass through original event correctly (just as 2nd argument doesn't work)
                        $( this ).click();
                    }
                });
            }
        }
 
        this._setOption( "disabled", options.disabled );
        this._resetButton();
    },
 
    _determineButtonType: function() {
        var ancestor, labelSelector, checked;
 
        if ( this.element.is("[type=checkbox]") ) {
            this.type = "checkbox";
        } else if ( this.element.is("[type=radio]") ) {
            this.type = "radio";
        } else if ( this.element.is("input") ) {
            this.type = "input";
        } else {
            this.type = "button";
        }
 
        if ( this.type === "checkbox" || this.type === "radio" ) {
            // we don't search against the document in case the element
            // is disconnected from the DOM
            ancestor = this.element.parents().last();
            labelSelector = "label[for='" + this.element.attr("id") + "']";
            this.buttonElement = ancestor.find( labelSelector );
            if ( !this.buttonElement.length ) {
                ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
                this.buttonElement = ancestor.filter( labelSelector );
                if ( !this.buttonElement.length ) {
                    this.buttonElement = ancestor.find( labelSelector );
                }
            }
            this.element.addClass( "ui-helper-hidden-accessible" );
 
            checked = this.element.is( ":checked" );
            if ( checked ) {
                this.buttonElement.addClass( "ui-state-active" );
            }
            this.buttonElement.prop( "aria-pressed", checked );
        } else {
            this.buttonElement = this.element;
        }
    },
 
    widget: function() {
        return this.buttonElement;
    },
 
    _destroy: function() {
        this.element
            .removeClass( "ui-helper-hidden-accessible" );
        this.buttonElement
            .removeClass( baseClasses + " ui-state-active " + typeClasses )
            .removeAttr( "role" )
            .removeAttr( "aria-pressed" )
            .html( this.buttonElement.find(".ui-button-text").html() );
 
        if ( !this.hasTitle ) {
            this.buttonElement.removeAttr( "title" );
        }
    },
 
    _setOption: function( key, value ) {
        this._super( key, value );
        if ( key === "disabled" ) {
            this.widget().toggleClass( "ui-state-disabled", !!value );
            this.element.prop( "disabled", !!value );
            if ( value ) {
                if ( this.type === "checkbox" || this.type === "radio" ) {
                    this.buttonElement.removeClass( "ui-state-focus" );
                } else {
                    this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
                }
            }
            return;
        }
        this._resetButton();
    },
 
    refresh: function() {
        //See #8237 & #8828
        var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
 
        if ( isDisabled !== this.options.disabled ) {
            this._setOption( "disabled", isDisabled );
        }
        if ( this.type === "radio" ) {
            radioGroup( this.element[0] ).each(function() {
                if ( $( this ).is( ":checked" ) ) {
                    $( this ).button( "widget" )
                        .addClass( "ui-state-active" )
                        .attr( "aria-pressed", "true" );
                } else {
                    $( this ).button( "widget" )
                        .removeClass( "ui-state-active" )
                        .attr( "aria-pressed", "false" );
                }
            });
        } else if ( this.type === "checkbox" ) {
            if ( this.element.is( ":checked" ) ) {
                this.buttonElement
                    .addClass( "ui-state-active" )
                    .attr( "aria-pressed", "true" );
            } else {
                this.buttonElement
                    .removeClass( "ui-state-active" )
                    .attr( "aria-pressed", "false" );
            }
        }
    },
 
    _resetButton: function() {
        if ( this.type === "input" ) {
            if ( this.options.label ) {
                this.element.val( this.options.label );
            }
            return;
        }
        var buttonElement = this.buttonElement.removeClass( typeClasses ),
            buttonText = $( "<span></span>", this.document[0] )
                .addClass( "ui-button-text" )
                .html( this.options.label )
                .appendTo( buttonElement.empty() )
                .text(),
            icons = this.options.icons,
            multipleIcons = icons.primary && icons.secondary,
            buttonClasses = [];
 
        if ( icons.primary || icons.secondary ) {
            if ( this.options.text ) {
                buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
            }
 
            if ( icons.primary ) {
                buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
            }
 
            if ( icons.secondary ) {
                buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
            }
 
            if ( !this.options.text ) {
                buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
 
                if ( !this.hasTitle ) {
                    buttonElement.attr( "title", $.trim( buttonText ) );
                }
            }
        } else {
            buttonClasses.push( "ui-button-text-only" );
        }
        buttonElement.addClass( buttonClasses.join( " " ) );
    }
});
 
$.widget( "ui.buttonset", {
    version: "1.11.4",
    options: {
        items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
    },
 
    _create: function() {
        this.element.addClass( "ui-buttonset" );
    },
 
    _init: function() {
        this.refresh();
    },
 
    _setOption: function( key, value ) {
        if ( key === "disabled" ) {
            this.buttons.button( "option", key, value );
        }
 
        this._super( key, value );
    },
 
    refresh: function() {
        var rtl = this.element.css( "direction" ) === "rtl",
            allButtons = this.element.find( this.options.items ),
            existingButtons = allButtons.filter( ":ui-button" );
 
        // Initialize new buttons
        allButtons.not( ":ui-button" ).button();
 
        // Refresh existing buttons
        existingButtons.button( "refresh" );
 
        this.buttons = allButtons
            .map(function() {
                return $( this ).button( "widget" )[ 0 ];
            })
                .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
                .filter( ":first" )
                    .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
                .end()
                .filter( ":last" )
                    .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
                .end()
            .end();
    },
 
    _destroy: function() {
        this.element.removeClass( "ui-buttonset" );
        this.buttons
            .map(function() {
                return $( this ).button( "widget" )[ 0 ];
            })
                .removeClass( "ui-corner-left ui-corner-right" )
            .end()
            .button( "destroy" );
    }
});
 
var button = $.ui.button;
 
 
/*!
 * jQuery UI Datepicker 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/datepicker/
 */
 
 
$.extend($.ui, { datepicker: { version: "1.11.4" } });
 
var datepicker_instActive;
 
function datepicker_getZindex( elem ) {
    var position, value;
    while ( elem.length && elem[ 0 ] !== document ) {
        // Ignore z-index if position is set to a value where z-index is ignored by the browser
        // This makes behavior of this function consistent across browsers
        // WebKit always returns auto if the element is positioned
        position = elem.css( "position" );
        if ( position === "absolute" || position === "relative" || position === "fixed" ) {
            // IE returns 0 when zIndex is not specified
            // other browsers return a string
            // we ignore the case of nested elements with an explicit value of 0
            // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
            value = parseInt( elem.css( "zIndex" ), 10 );
            if ( !isNaN( value ) && value !== 0 ) {
                return value;
            }
        }
        elem = elem.parent();
    }
 
    return 0;
}
/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */
 
function Datepicker() {
    this._curInst = null; // The current instance in use
    this._keyEvent = false; // If the last event was a key event
    this._disabledInputs = []; // List of date picker inputs that have been disabled
    this._datepickerShowing = false; // True if the popup picker is showing , false if not
    this._inDialog = false; // True if showing within a "dialog", false if not
    this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
    this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
    this._appendClass = "ui-datepicker-append"; // The name of the append marker class
    this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
    this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
    this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
    this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
    this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
    this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
    this.regional = []; // Available regional settings, indexed by language code
    this.regional[""] = { // Default regional settings
        closeText: "Done", // Display text for close link
        prevText: "Prev", // Display text for previous month link
        nextText: "Next", // Display text for next month link
        currentText: "Today", // Display text for current month link
        monthNames: ["January","February","March","April","May","June",
            "July","August","September","October","November","December"], // Names of months for drop-down and formatting
        monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
        dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
        dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
        dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
        weekHeader: "Wk", // Column header for week of the year
        dateFormat: "mm/dd/yy", // See format options on parseDate
        firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
        isRTL: false, // True if right-to-left language, false if left-to-right
        showMonthAfterYear: false, // True if the year select precedes month, false for month then year
        yearSuffix: "" // Additional text to append to the year in the month headers
    };
    this._defaults = { // Global defaults for all the date picker instances
        showOn: "focus", // "focus" for popup on focus,
            // "button" for trigger button, or "both" for either
        showAnim: "fadeIn", // Name of jQuery animation for popup
        showOptions: {}, // Options for enhanced animations
        defaultDate: null, // Used when field is blank: actual date,
            // +/-number for offset from today, null for today
        appendText: "", // Display text following the input box, e.g. showing the format
        buttonText: "...", // Text for trigger button
        buttonImage: "", // URL for trigger button image
        buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
        hideIfNoPrevNext: false, // True to hide next/previous month links
            // if not applicable, false to just disable them
        navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
        gotoCurrent: false, // True if today link goes back to current selection instead
        changeMonth: false, // True if month can be selected directly, false if only prev/next
        changeYear: false, // True if year can be selected directly, false if only prev/next
        yearRange: "c-10:c+10", // Range of years to display in drop-down,
            // either relative to today's year (-nn:+nn), relative to currently displayed year
            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
        showOtherMonths: false, // True to show dates in other months, false to leave blank
        selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
        showWeek: false, // True to show week of the year, false to not show it
        calculateWeek: this.iso8601Week, // How to calculate the week of the year,
            // takes a Date and returns the number of the week for it
        shortYearCutoff: "+10", // Short year values < this are in the current century,
            // > this are in the previous century,
            // string value starting with "+" for current year + value
        minDate: null, // The earliest selectable date, or null for no limit
        maxDate: null, // The latest selectable date, or null for no limit
        duration: "fast", // Duration of display/closure
        beforeShowDay: null, // Function that takes a date and returns an array with
            // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
            // [2] = cell title (optional), e.g. $.datepicker.noWeekends
        beforeShow: null, // Function that takes an input field and
            // returns a set of custom settings for the date picker
        onSelect: null, // Define a callback function when a date is selected
        onChangeMonthYear: null, // Define a callback function when the month or year is changed
        onClose: null, // Define a callback function when the datepicker is closed
        numberOfMonths: 1, // Number of months to show at a time
        showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
        stepMonths: 1, // Number of months to step back/forward
        stepBigMonths: 12, // Number of months to step back/forward for the big links
        altField: "", // Selector for an alternate field to store selected dates into
        altFormat: "", // The date format to use for the alternate field
        constrainInput: true, // The input is constrained by the current date format
        showButtonPanel: false, // True to show button panel, false to not show it
        autoSize: false, // True to size the input for the date format, false to leave as is
        disabled: false // The initial disabled state
    };
    $.extend(this._defaults, this.regional[""]);
    this.regional.en = $.extend( true, {}, this.regional[ "" ]);
    this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
    this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
}
 
$.extend(Datepicker.prototype, {
    /* Class name added to elements to indicate already configured with a date picker. */
    markerClassName: "hasDatepicker",
 
    //Keep track of the maximum number of rows displayed (see #7043)
    maxRows: 4,
 
    // TODO rename to "widget" when switching to widget factory
    _widgetDatepicker: function() {
        return this.dpDiv;
    },
 
    /* Override the default settings for all instances of the date picker.
     * @param  settings  object - the new settings to use as defaults (anonymous object)
     * @return the manager object
     */
    setDefaults: function(settings) {
        datepicker_extendRemove(this._defaults, settings || {});
        return this;
    },
 
    /* Attach the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     * @param  settings  object - the new settings to use for this date picker instance (anonymous)
     */
    _attachDatepicker: function(target, settings) {
        var nodeName, inline, inst;
        nodeName = target.nodeName.toLowerCase();
        inline = (nodeName === "div" || nodeName === "span");
        if (!target.id) {
            this.uuid += 1;
            target.id = "dp" + this.uuid;
        }
        inst = this._newInst($(target), inline);
        inst.settings = $.extend({}, settings || {});
        if (nodeName === "input") {
            this._connectDatepicker(target, inst);
        } else if (inline) {
            this._inlineDatepicker(target, inst);
        }
    },
 
    /* Create a new instance object. */
    _newInst: function(target, inline) {
        var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
        return {id: id, input: target, // associated target
            selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
            drawMonth: 0, drawYear: 0, // month being drawn
            inline: inline, // is datepicker inline or not
            dpDiv: (!inline ? this.dpDiv : // presentation div
            datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
    },
 
    /* Attach the date picker to an input field. */
    _connectDatepicker: function(target, inst) {
        var input = $(target);
        inst.append = $([]);
        inst.trigger = $([]);
        if (input.hasClass(this.markerClassName)) {
            return;
        }
        this._attachments(input, inst);
        input.addClass(this.markerClassName).keydown(this._doKeyDown).
            keypress(this._doKeyPress).keyup(this._doKeyUp);
        this._autoSize(inst);
        $.data(target, "datepicker", inst);
        //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
        if( inst.settings.disabled ) {
            this._disableDatepicker( target );
        }
    },
 
    /* Make attachments based on settings. */
    _attachments: function(input, inst) {
        var showOn, buttonText, buttonImage,
            appendText = this._get(inst, "appendText"),
            isRTL = this._get(inst, "isRTL");
 
        if (inst.append) {
            inst.append.remove();
        }
        if (appendText) {
            inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
            input[isRTL ? "before" : "after"](inst.append);
        }
 
        input.unbind("focus", this._showDatepicker);
 
        if (inst.trigger) {
            inst.trigger.remove();
        }
 
        showOn = this._get(inst, "showOn");
        if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
            input.focus(this._showDatepicker);
        }
        if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
            buttonText = this._get(inst, "buttonText");
            buttonImage = this._get(inst, "buttonImage");
            inst.trigger = $(this._get(inst, "buttonImageOnly") ?
                $("<img/>").addClass(this._triggerClass).
                    attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
                $("<button type='button'></button>").addClass(this._triggerClass).
                    html(!buttonImage ? buttonText : $("<img/>").attr(
                    { src:buttonImage, alt:buttonText, title:buttonText })));
            input[isRTL ? "before" : "after"](inst.trigger);
            inst.trigger.click(function() {
                if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
                    $.datepicker._hideDatepicker();
                } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
                    $.datepicker._hideDatepicker();
                    $.datepicker._showDatepicker(input[0]);
                } else {
                    $.datepicker._showDatepicker(input[0]);
                }
                return false;
            });
        }
    },
 
    /* Apply the maximum length for the date format. */
    _autoSize: function(inst) {
        if (this._get(inst, "autoSize") && !inst.inline) {
            var findMax, max, maxI, i,
                date = new Date(2009, 12 - 1, 20), // Ensure double digits
                dateFormat = this._get(inst, "dateFormat");
 
            if (dateFormat.match(/[DM]/)) {
                findMax = function(names) {
                    max = 0;
                    maxI = 0;
                    for (i = 0; i < names.length; i++) {
                        if (names[i].length > max) {
                            max = names[i].length;
                            maxI = i;
                        }
                    }
                    return maxI;
                };
                date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
                    "monthNames" : "monthNamesShort"))));
                date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
                    "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
            }
            inst.input.attr("size", this._formatDate(inst, date).length);
        }
    },
 
    /* Attach an inline date picker to a div. */
    _inlineDatepicker: function(target, inst) {
        var divSpan = $(target);
        if (divSpan.hasClass(this.markerClassName)) {
            return;
        }
        divSpan.addClass(this.markerClassName).append(inst.dpDiv);
        $.data(target, "datepicker", inst);
        this._setDate(inst, this._getDefaultDate(inst), true);
        this._updateDatepicker(inst);
        this._updateAlternate(inst);
        //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
        if( inst.settings.disabled ) {
            this._disableDatepicker( target );
        }
        // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
        // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
        inst.dpDiv.css( "display", "block" );
    },
 
    /* Pop-up the date picker in a "dialog" box.
     * @param  input element - ignored
     * @param  date string or Date - the initial date to display
     * @param  onSelect  function - the function to call when a date is selected
     * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
     * @param  pos int[2] - coordinates for the dialog's position within the screen or
     *                  event - with x/y coordinates or
     *                  leave empty for default (screen centre)
     * @return the manager object
     */
    _dialogDatepicker: function(input, date, onSelect, settings, pos) {
        var id, browserWidth, browserHeight, scrollX, scrollY,
            inst = this._dialogInst; // internal instance
 
        if (!inst) {
            this.uuid += 1;
            id = "dp" + this.uuid;
            this._dialogInput = $("<input type='text' id='" + id +
                "' style='position: absolute; top: -100px; width: 0px;'/>");
            this._dialogInput.keydown(this._doKeyDown);
            $("body").append(this._dialogInput);
            inst = this._dialogInst = this._newInst(this._dialogInput, false);
            inst.settings = {};
            $.data(this._dialogInput[0], "datepicker", inst);
        }
        datepicker_extendRemove(inst.settings, settings || {});
        date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
        this._dialogInput.val(date);
 
        this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
        if (!this._pos) {
            browserWidth = document.documentElement.clientWidth;
            browserHeight = document.documentElement.clientHeight;
            scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            this._pos = // should use actual width/height below
                [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
        }
 
        // move input on screen for focus, but hidden behind dialog
        this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
        inst.settings.onSelect = onSelect;
        this._inDialog = true;
        this.dpDiv.addClass(this._dialogClass);
        this._showDatepicker(this._dialogInput[0]);
        if ($.blockUI) {
            $.blockUI(this.dpDiv);
        }
        $.data(this._dialogInput[0], "datepicker", inst);
        return this;
    },
 
    /* Detach a datepicker from its control.
     * @param  target   element - the target input field or division or span
     */
    _destroyDatepicker: function(target) {
        var nodeName,
            $target = $(target),
            inst = $.data(target, "datepicker");
 
        if (!$target.hasClass(this.markerClassName)) {
            return;
        }
 
        nodeName = target.nodeName.toLowerCase();
        $.removeData(target, "datepicker");
        if (nodeName === "input") {
            inst.append.remove();
            inst.trigger.remove();
            $target.removeClass(this.markerClassName).
                unbind("focus", this._showDatepicker).
                unbind("keydown", this._doKeyDown).
                unbind("keypress", this._doKeyPress).
                unbind("keyup", this._doKeyUp);
        } else if (nodeName === "div" || nodeName === "span") {
            $target.removeClass(this.markerClassName).empty();
        }
 
        if ( datepicker_instActive === inst ) {
            datepicker_instActive = null;
        }
    },
 
    /* Enable the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     */
    _enableDatepicker: function(target) {
        var nodeName, inline,
            $target = $(target),
            inst = $.data(target, "datepicker");
 
        if (!$target.hasClass(this.markerClassName)) {
            return;
        }
 
        nodeName = target.nodeName.toLowerCase();
        if (nodeName === "input") {
            target.disabled = false;
            inst.trigger.filter("button").
                each(function() { this.disabled = false; }).end().
                filter("img").css({opacity: "1.0", cursor: ""});
        } else if (nodeName === "div" || nodeName === "span") {
            inline = $target.children("." + this._inlineClass);
            inline.children().removeClass("ui-state-disabled");
            inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                prop("disabled", false);
        }
        this._disabledInputs = $.map(this._disabledInputs,
            function(value) { return (value === target ? null : value); }); // delete entry
    },
 
    /* Disable the date picker to a jQuery selection.
     * @param  target   element - the target input field or division or span
     */
    _disableDatepicker: function(target) {
        var nodeName, inline,
            $target = $(target),
            inst = $.data(target, "datepicker");
 
        if (!$target.hasClass(this.markerClassName)) {
            return;
        }
 
        nodeName = target.nodeName.toLowerCase();
        if (nodeName === "input") {
            target.disabled = true;
            inst.trigger.filter("button").
                each(function() { this.disabled = true; }).end().
                filter("img").css({opacity: "0.5", cursor: "default"});
        } else if (nodeName === "div" || nodeName === "span") {
            inline = $target.children("." + this._inlineClass);
            inline.children().addClass("ui-state-disabled");
            inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                prop("disabled", true);
        }
        this._disabledInputs = $.map(this._disabledInputs,
            function(value) { return (value === target ? null : value); }); // delete entry
        this._disabledInputs[this._disabledInputs.length] = target;
    },
 
    /* Is the first field in a jQuery collection disabled as a datepicker?
     * @param  target   element - the target input field or division or span
     * @return boolean - true if disabled, false if enabled
     */
    _isDisabledDatepicker: function(target) {
        if (!target) {
            return false;
        }
        for (var i = 0; i < this._disabledInputs.length; i++) {
            if (this._disabledInputs[i] === target) {
                return true;
            }
        }
        return false;
    },
 
    /* Retrieve the instance data for the target control.
     * @param  target  element - the target input field or division or span
     * @return  object - the associated instance data
     * @throws  error if a jQuery problem getting data
     */
    _getInst: function(target) {
        try {
            return $.data(target, "datepicker");
        }
        catch (err) {
            throw "Missing instance data for this datepicker";
        }
    },
 
    /* Update or retrieve the settings for a date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     * @param  name object - the new settings to update or
     *              string - the name of the setting to change or retrieve,
     *              when retrieving also "all" for all instance settings or
     *              "defaults" for all global defaults
     * @param  value   any - the new value for the setting
     *              (omit if above is an object or to retrieve a value)
     */
    _optionDatepicker: function(target, name, value) {
        var settings, date, minDate, maxDate,
            inst = this._getInst(target);
 
        if (arguments.length === 2 && typeof name === "string") {
            return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
                (inst ? (name === "all" ? $.extend({}, inst.settings) :
                this._get(inst, name)) : null));
        }
 
        settings = name || {};
        if (typeof name === "string") {
            settings = {};
            settings[name] = value;
        }
 
        if (inst) {
            if (this._curInst === inst) {
                this._hideDatepicker();
            }
 
            date = this._getDateDatepicker(target, true);
            minDate = this._getMinMaxDate(inst, "min");
            maxDate = this._getMinMaxDate(inst, "max");
            datepicker_extendRemove(inst.settings, settings);
            // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
            if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
                inst.settings.minDate = this._formatDate(inst, minDate);
            }
            if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
                inst.settings.maxDate = this._formatDate(inst, maxDate);
            }
            if ( "disabled" in settings ) {
                if ( settings.disabled ) {
                    this._disableDatepicker(target);
                } else {
                    this._enableDatepicker(target);
                }
            }
            this._attachments($(target), inst);
            this._autoSize(inst);
            this._setDate(inst, date);
            this._updateAlternate(inst);
            this._updateDatepicker(inst);
        }
    },
 
    // change method deprecated
    _changeDatepicker: function(target, name, value) {
        this._optionDatepicker(target, name, value);
    },
 
    /* Redraw the date picker attached to an input field or division.
     * @param  target  element - the target input field or division or span
     */
    _refreshDatepicker: function(target) {
        var inst = this._getInst(target);
        if (inst) {
            this._updateDatepicker(inst);
        }
    },
 
    /* Set the dates for a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  date Date - the new date
     */
    _setDateDatepicker: function(target, date) {
        var inst = this._getInst(target);
        if (inst) {
            this._setDate(inst, date);
            this._updateDatepicker(inst);
            this._updateAlternate(inst);
        }
    },
 
    /* Get the date(s) for the first entry in a jQuery selection.
     * @param  target element - the target input field or division or span
     * @param  noDefault boolean - true if no default date is to be used
     * @return Date - the current date
     */
    _getDateDatepicker: function(target, noDefault) {
        var inst = this._getInst(target);
        if (inst && !inst.inline) {
            this._setDateFromField(inst, noDefault);
        }
        return (inst ? this._getDate(inst) : null);
    },
 
    /* Handle keystrokes. */
    _doKeyDown: function(event) {
        var onSelect, dateStr, sel,
            inst = $.datepicker._getInst(event.target),
            handled = true,
            isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
 
        inst._keyEvent = true;
        if ($.datepicker._datepickerShowing) {
            switch (event.keyCode) {
                case 9: $.datepicker._hideDatepicker();
                        handled = false;
                        break; // hide on tab out
                case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
                                    $.datepicker._currentClass + ")", inst.dpDiv);
                        if (sel[0]) {
                            $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
                        }
 
                        onSelect = $.datepicker._get(inst, "onSelect");
                        if (onSelect) {
                            dateStr = $.datepicker._formatDate(inst);
 
                            // trigger custom callback
                            onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
                        } else {
                            $.datepicker._hideDatepicker();
                        }
 
                        return false; // don't submit the form
                case 27: $.datepicker._hideDatepicker();
                        break; // hide on escape
                case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                            -$.datepicker._get(inst, "stepBigMonths") :
                            -$.datepicker._get(inst, "stepMonths")), "M");
                        break; // previous month/year on page up/+ ctrl
                case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                            +$.datepicker._get(inst, "stepBigMonths") :
                            +$.datepicker._get(inst, "stepMonths")), "M");
                        break; // next month/year on page down/+ ctrl
                case 35: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._clearDate(event.target);
                        }
                        handled = event.ctrlKey || event.metaKey;
                        break; // clear on ctrl or command +end
                case 36: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._gotoToday(event.target);
                        }
                        handled = event.ctrlKey || event.metaKey;
                        break; // current on ctrl or command +home
                case 37: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        // -1 day on ctrl or command +left
                        if (event.originalEvent.altKey) {
                            $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                                -$.datepicker._get(inst, "stepBigMonths") :
                                -$.datepicker._get(inst, "stepMonths")), "M");
                        }
                        // next month/year on alt +left on Mac
                        break;
                case 38: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, -7, "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        break; // -1 week on ctrl or command +up
                case 39: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        // +1 day on ctrl or command +right
                        if (event.originalEvent.altKey) {
                            $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                                +$.datepicker._get(inst, "stepBigMonths") :
                                +$.datepicker._get(inst, "stepMonths")), "M");
                        }
                        // next month/year on alt +right
                        break;
                case 40: if (event.ctrlKey || event.metaKey) {
                            $.datepicker._adjustDate(event.target, +7, "D");
                        }
                        handled = event.ctrlKey || event.metaKey;
                        break; // +1 week on ctrl or command +down
                default: handled = false;
            }
        } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
            $.datepicker._showDatepicker(this);
        } else {
            handled = false;
        }
 
        if (handled) {
            event.preventDefault();
            event.stopPropagation();
        }
    },
 
    /* Filter entered characters - based on date format. */
    _doKeyPress: function(event) {
        var chars, chr,
            inst = $.datepicker._getInst(event.target);
 
        if ($.datepicker._get(inst, "constrainInput")) {
            chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
            chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
            return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
        }
    },
 
    /* Synchronise manual entry and field/alternate field. */
    _doKeyUp: function(event) {
        var date,
            inst = $.datepicker._getInst(event.target);
 
        if (inst.input.val() !== inst.lastVal) {
            try {
                date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                    (inst.input ? inst.input.val() : null),
                    $.datepicker._getFormatConfig(inst));
 
                if (date) { // only if valid
                    $.datepicker._setDateFromField(inst);
                    $.datepicker._updateAlternate(inst);
                    $.datepicker._updateDatepicker(inst);
                }
            }
            catch (err) {
            }
        }
        return true;
    },
 
    /* Pop-up the date picker for a given input field.
     * If false returned from beforeShow event handler do not show.
     * @param  input  element - the input field attached to the date picker or
     *                  event - if triggered by focus
     */
    _showDatepicker: function(input) {
        input = input.target || input;
        if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
            input = $("input", input.parentNode)[0];
        }
 
        if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
            return;
        }
 
        var inst, beforeShow, beforeShowSettings, isFixed,
            offset, showAnim, duration;
 
        inst = $.datepicker._getInst(input);
        if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
            $.datepicker._curInst.dpDiv.stop(true, true);
            if ( inst && $.datepicker._datepickerShowing ) {
                $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
            }
        }
 
        beforeShow = $.datepicker._get(inst, "beforeShow");
        beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
        if(beforeShowSettings === false){
            return;
        }
        datepicker_extendRemove(inst.settings, beforeShowSettings);
 
        inst.lastVal = null;
        $.datepicker._lastInput = input;
        $.datepicker._setDateFromField(inst);
 
        if ($.datepicker._inDialog) { // hide cursor
            input.value = "";
        }
        if (!$.datepicker._pos) { // position below input
            $.datepicker._pos = $.datepicker._findPos(input);
            $.datepicker._pos[1] += input.offsetHeight; // add the height
        }
 
        isFixed = false;
        $(input).parents().each(function() {
            isFixed |= $(this).css("position") === "fixed";
            return !isFixed;
        });
 
        offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
        $.datepicker._pos = null;
        //to avoid flashes on Firefox
        inst.dpDiv.empty();
        // determine sizing offscreen
        inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
        $.datepicker._updateDatepicker(inst);
        // fix width for dynamic number of date pickers
        // and adjust position before showing
        offset = $.datepicker._checkOffset(inst, offset, isFixed);
        inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
            "static" : (isFixed ? "fixed" : "absolute")), display: "none",
            left: offset.left + "px", top: offset.top + "px"});
 
        if (!inst.inline) {
            showAnim = $.datepicker._get(inst, "showAnim");
            duration = $.datepicker._get(inst, "duration");
            inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
            $.datepicker._datepickerShowing = true;
 
            if ( $.effects && $.effects.effect[ showAnim ] ) {
                inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
            } else {
                inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
            }
 
            if ( $.datepicker._shouldFocusInput( inst ) ) {
                inst.input.focus();
            }
 
            $.datepicker._curInst = inst;
        }
    },
 
    /* Generate the date picker content. */
    _updateDatepicker: function(inst) {
        this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
        datepicker_instActive = inst; // for delegate hover events
        inst.dpDiv.empty().append(this._generateHTML(inst));
        this._attachHandlers(inst);
 
        var origyearshtml,
            numMonths = this._getNumberOfMonths(inst),
            cols = numMonths[1],
            width = 17,
            activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
 
        if ( activeCell.length > 0 ) {
            datepicker_handleMouseover.apply( activeCell.get( 0 ) );
        }
 
        inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
        if (cols > 1) {
            inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
        }
        inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
            "Class"]("ui-datepicker-multi");
        inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
            "Class"]("ui-datepicker-rtl");
 
        if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
            inst.input.focus();
        }
 
        // deffered render of the years select (to avoid flashes on Firefox)
        if( inst.yearshtml ){
            origyearshtml = inst.yearshtml;
            setTimeout(function(){
                //assure that inst.yearshtml didn't change.
                if( origyearshtml === inst.yearshtml && inst.yearshtml ){
                    inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
                }
                origyearshtml = inst.yearshtml = null;
            }, 0);
        }
    },
 
    // #6694 - don't focus the input if it's already focused
    // this breaks the change event in IE
    // Support: IE and jQuery <1.9
    _shouldFocusInput: function( inst ) {
        return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
    },
 
    /* Check positioning to remain on screen. */
    _checkOffset: function(inst, offset, isFixed) {
        var dpWidth = inst.dpDiv.outerWidth(),
            dpHeight = inst.dpDiv.outerHeight(),
            inputWidth = inst.input ? inst.input.outerWidth() : 0,
            inputHeight = inst.input ? inst.input.outerHeight() : 0,
            viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
            viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
 
        offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
        offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
        offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
 
        // now check if datepicker is showing outside window viewport - move to a better place if so.
        offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
            Math.abs(offset.left + dpWidth - viewWidth) : 0);
        offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
            Math.abs(dpHeight + inputHeight) : 0);
 
        return offset;
    },
 
    /* Find an object's position on the screen. */
    _findPos: function(obj) {
        var position,
            inst = this._getInst(obj),
            isRTL = this._get(inst, "isRTL");
 
        while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
            obj = obj[isRTL ? "previousSibling" : "nextSibling"];
        }
 
        position = $(obj).offset();
        return [position.left, position.top];
    },
 
    /* Hide the date picker from view.
     * @param  input  element - the input field attached to the date picker
     */
    _hideDatepicker: function(input) {
        var showAnim, duration, postProcess, onClose,
            inst = this._curInst;
 
        if (!inst || (input && inst !== $.data(input, "datepicker"))) {
            return;
        }
 
        if (this._datepickerShowing) {
            showAnim = this._get(inst, "showAnim");
            duration = this._get(inst, "duration");
            postProcess = function() {
                $.datepicker._tidyDialog(inst);
            };
 
            // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
            if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
                inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
            } else {
                inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
                    (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
            }
 
            if (!showAnim) {
                postProcess();
            }
            this._datepickerShowing = false;
 
            onClose = this._get(inst, "onClose");
            if (onClose) {
                onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
            }
 
            this._lastInput = null;
            if (this._inDialog) {
                this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
                if ($.blockUI) {
                    $.unblockUI();
                    $("body").append(this.dpDiv);
                }
            }
            this._inDialog = false;
        }
    },
 
    /* Tidy up after a dialog display. */
    _tidyDialog: function(inst) {
        inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
    },
 
    /* Close date picker if clicked elsewhere. */
    _checkExternalClick: function(event) {
        if (!$.datepicker._curInst) {
            return;
        }
 
        var $target = $(event.target),
            inst = $.datepicker._getInst($target[0]);
 
        if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
                $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
                !$target.hasClass($.datepicker.markerClassName) &&
                !$target.closest("." + $.datepicker._triggerClass).length &&
                $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
            ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
                $.datepicker._hideDatepicker();
        }
    },
 
    /* Adjust one of the date sub-fields. */
    _adjustDate: function(id, offset, period) {
        var target = $(id),
            inst = this._getInst(target[0]);
 
        if (this._isDisabledDatepicker(target[0])) {
            return;
        }
        this._adjustInstDate(inst, offset +
            (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
            period);
        this._updateDatepicker(inst);
    },
 
    /* Action for current link. */
    _gotoToday: function(id) {
        var date,
            target = $(id),
            inst = this._getInst(target[0]);
 
        if (this._get(inst, "gotoCurrent") && inst.currentDay) {
            inst.selectedDay = inst.currentDay;
            inst.drawMonth = inst.selectedMonth = inst.currentMonth;
            inst.drawYear = inst.selectedYear = inst.currentYear;
        } else {
            date = new Date();
            inst.selectedDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = date.getFullYear();
        }
        this._notifyChange(inst);
        this._adjustDate(target);
    },
 
    /* Action for selecting a new month/year. */
    _selectMonthYear: function(id, select, period) {
        var target = $(id),
            inst = this._getInst(target[0]);
 
        inst["selected" + (period === "M" ? "Month" : "Year")] =
        inst["draw" + (period === "M" ? "Month" : "Year")] =
            parseInt(select.options[select.selectedIndex].value,10);
 
        this._notifyChange(inst);
        this._adjustDate(target);
    },
 
    /* Action for selecting a day. */
    _selectDay: function(id, month, year, td) {
        var inst,
            target = $(id);
 
        if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
            return;
        }
 
        inst = this._getInst(target[0]);
        inst.selectedDay = inst.currentDay = $("a", td).html();
        inst.selectedMonth = inst.currentMonth = month;
        inst.selectedYear = inst.currentYear = year;
        this._selectDate(id, this._formatDate(inst,
            inst.currentDay, inst.currentMonth, inst.currentYear));
    },
 
    /* Erase the input field and hide the date picker. */
    _clearDate: function(id) {
        var target = $(id);
        this._selectDate(target, "");
    },
 
    /* Update the input field with the selected date. */
    _selectDate: function(id, dateStr) {
        var onSelect,
            target = $(id),
            inst = this._getInst(target[0]);
 
        dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
        if (inst.input) {
            inst.input.val(dateStr);
        }
        this._updateAlternate(inst);
 
        onSelect = this._get(inst, "onSelect");
        if (onSelect) {
            onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
        } else if (inst.input) {
            inst.input.trigger("change"); // fire the change event
        }
 
        if (inst.inline){
            this._updateDatepicker(inst);
        } else {
            this._hideDatepicker();
            this._lastInput = inst.input[0];
            if (typeof(inst.input[0]) !== "object") {
                inst.input.focus(); // restore focus
            }
            this._lastInput = null;
        }
    },
 
    /* Update any alternate field to synchronise with the main field. */
    _updateAlternate: function(inst) {
        var altFormat, date, dateStr,
            altField = this._get(inst, "altField");
 
        if (altField) { // update alternate field too
            altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
            date = this._getDate(inst);
            dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
            $(altField).each(function() { $(this).val(dateStr); });
        }
    },
 
    /* Set as beforeShowDay function to prevent selection of weekends.
     * @param  date  Date - the date to customise
     * @return [boolean, string] - is this date selectable?, what is its CSS class?
     */
    noWeekends: function(date) {
        var day = date.getDay();
        return [(day > 0 && day < 6), ""];
    },
 
    /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
     * @param  date  Date - the date to get the week for
     * @return  number - the number of the week within the year that contains this date
     */
    iso8601Week: function(date) {
        var time,
            checkDate = new Date(date.getTime());
 
        // Find Thursday of this week starting on Monday
        checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
 
        time = checkDate.getTime();
        checkDate.setMonth(0); // Compare with Jan 1
        checkDate.setDate(1);
        return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
    },
 
    /* Parse a string value into a date object.
     * See formatDate below for the possible formats.
     *
     * @param  format string - the expected format of the date
     * @param  value string - the date in the above format
     * @param  settings Object - attributes include:
     *                  shortYearCutoff  number - the cutoff year for determining the century (optional)
     *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     *                  dayNames        string[7] - names of the days from Sunday (optional)
     *                  monthNamesShort string[12] - abbreviated names of the months (optional)
     *                  monthNames      string[12] - names of the months (optional)
     * @return  Date - the extracted date value or null if value is blank
     */
    parseDate: function (format, value, settings) {
        if (format == null || value == null) {
            throw "Invalid arguments";
        }
 
        value = (typeof value === "object" ? value.toString() : value + "");
        if (value === "") {
            return null;
        }
 
        var iFormat, dim, extra,
            iValue = 0,
            shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
            shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
                new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
            dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
            dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
            monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
            monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
            year = -1,
            month = -1,
            day = -1,
            doy = -1,
            literal = false,
            date,
            // Check whether a format character is doubled
            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
                return matches;
            },
            // Extract a number from the string value
            getNumber = function(match) {
                var isDoubled = lookAhead(match),
                    size = (match === "@" ? 14 : (match === "!" ? 20 :
                    (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
                    minSize = (match === "y" ? size : 1),
                    digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
                    num = value.substring(iValue).match(digits);
                if (!num) {
                    throw "Missing number at position " + iValue;
                }
                iValue += num[0].length;
                return parseInt(num[0], 10);
            },
            // Extract a name from the string value and convert to an index
            getName = function(match, shortNames, longNames) {
                var index = -1,
                    names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
                        return [ [k, v] ];
                    }).sort(function (a, b) {
                        return -(a[1].length - b[1].length);
                    });
 
                $.each(names, function (i, pair) {
                    var name = pair[1];
                    if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
                        index = pair[0];
                        iValue += name.length;
                        return false;
                    }
                });
                if (index !== -1) {
                    return index + 1;
                } else {
                    throw "Unknown name at position " + iValue;
                }
            },
            // Confirm that a literal character matches the string value
            checkLiteral = function() {
                if (value.charAt(iValue) !== format.charAt(iFormat)) {
                    throw "Unexpected literal at position " + iValue;
                }
                iValue++;
            };
 
        for (iFormat = 0; iFormat < format.length; iFormat++) {
            if (literal) {
                if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                    literal = false;
                } else {
                    checkLiteral();
                }
            } else {
                switch (format.charAt(iFormat)) {
                    case "d":
                        day = getNumber("d");
                        break;
                    case "D":
                        getName("D", dayNamesShort, dayNames);
                        break;
                    case "o":
                        doy = getNumber("o");
                        break;
                    case "m":
                        month = getNumber("m");
                        break;
                    case "M":
                        month = getName("M", monthNamesShort, monthNames);
                        break;
                    case "y":
                        year = getNumber("y");
                        break;
                    case "@":
                        date = new Date(getNumber("@"));
                        year = date.getFullYear();
                        month = date.getMonth() + 1;
                        day = date.getDate();
                        break;
                    case "!":
                        date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
                        year = date.getFullYear();
                        month = date.getMonth() + 1;
                        day = date.getDate();
                        break;
                    case "'":
                        if (lookAhead("'")){
                            checkLiteral();
                        } else {
                            literal = true;
                        }
                        break;
                    default:
                        checkLiteral();
                }
            }
        }
 
        if (iValue < value.length){
            extra = value.substr(iValue);
            if (!/^\s+/.test(extra)) {
                throw "Extra/unparsed characters found in date: " + extra;
            }
        }
 
        if (year === -1) {
            year = new Date().getFullYear();
        } else if (year < 100) {
            year += new Date().getFullYear() - new Date().getFullYear() % 100 +
                (year <= shortYearCutoff ? 0 : -100);
        }
 
        if (doy > -1) {
            month = 1;
            day = doy;
            do {
                dim = this._getDaysInMonth(year, month - 1);
                if (day <= dim) {
                    break;
                }
                month++;
                day -= dim;
            } while (true);
        }
 
        date = this._daylightSavingAdjust(new Date(year, month - 1, day));
        if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
            throw "Invalid date"; // E.g. 31/02/00
        }
        return date;
    },
 
    /* Standard date formats. */
    ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
    COOKIE: "D, dd M yy",
    ISO_8601: "yy-mm-dd",
    RFC_822: "D, d M y",
    RFC_850: "DD, dd-M-y",
    RFC_1036: "D, d M y",
    RFC_1123: "D, d M yy",
    RFC_2822: "D, d M yy",
    RSS: "D, d M y", // RFC 822
    TICKS: "!",
    TIMESTAMP: "@",
    W3C: "yy-mm-dd", // ISO 8601
 
    _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
        Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
 
    /* Format a date object into a string value.
     * The format can be combinations of the following:
     * d  - day of month (no leading zero)
     * dd - day of month (two digit)
     * o  - day of year (no leading zeros)
     * oo - day of year (three digit)
     * D  - day name short
     * DD - day name long
     * m  - month of year (no leading zero)
     * mm - month of year (two digit)
     * M  - month name short
     * MM - month name long
     * y  - year (two digit)
     * yy - year (four digit)
     * @ - Unix timestamp (ms since 01/01/1970)
     * ! - Windows ticks (100ns since 01/01/0001)
     * "..." - literal text
     * '' - single quote
     *
     * @param  format string - the desired format of the date
     * @param  date Date - the date value to format
     * @param  settings Object - attributes include:
     *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     *                  dayNames        string[7] - names of the days from Sunday (optional)
     *                  monthNamesShort string[12] - abbreviated names of the months (optional)
     *                  monthNames      string[12] - names of the months (optional)
     * @return  string - the date in the above format
     */
    formatDate: function (format, date, settings) {
        if (!date) {
            return "";
        }
 
        var iFormat,
            dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
            dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
            monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
            monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
            // Check whether a format character is doubled
            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
                return matches;
            },
            // Format a number, with leading zero if necessary
            formatNumber = function(match, value, len) {
                var num = "" + value;
                if (lookAhead(match)) {
                    while (num.length < len) {
                        num = "0" + num;
                    }
                }
                return num;
            },
            // Format a name, short or long as requested
            formatName = function(match, value, shortNames, longNames) {
                return (lookAhead(match) ? longNames[value] : shortNames[value]);
            },
            output = "",
            literal = false;
 
        if (date) {
            for (iFormat = 0; iFormat < format.length; iFormat++) {
                if (literal) {
                    if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                        literal = false;
                    } else {
                        output += format.charAt(iFormat);
                    }
                } else {
                    switch (format.charAt(iFormat)) {
                        case "d":
                            output += formatNumber("d", date.getDate(), 2);
                            break;
                        case "D":
                            output += formatName("D", date.getDay(), dayNamesShort, dayNames);
                            break;
                        case "o":
                            output += formatNumber("o",
                                Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
                            break;
                        case "m":
                            output += formatNumber("m", date.getMonth() + 1, 2);
                            break;
                        case "M":
                            output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
                            break;
                        case "y":
                            output += (lookAhead("y") ? date.getFullYear() :
                                (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
                            break;
                        case "@":
                            output += date.getTime();
                            break;
                        case "!":
                            output += date.getTime() * 10000 + this._ticksTo1970;
                            break;
                        case "'":
                            if (lookAhead("'")) {
                                output += "'";
                            } else {
                                literal = true;
                            }
                            break;
                        default:
                            output += format.charAt(iFormat);
                    }
                }
            }
        }
        return output;
    },
 
    /* Extract all possible characters from the date format. */
    _possibleChars: function (format) {
        var iFormat,
            chars = "",
            literal = false,
            // Check whether a format character is doubled
            lookAhead = function(match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                if (matches) {
                    iFormat++;
                }
                return matches;
            };
 
        for (iFormat = 0; iFormat < format.length; iFormat++) {
            if (literal) {
                if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                    literal = false;
                } else {
                    chars += format.charAt(iFormat);
                }
            } else {
                switch (format.charAt(iFormat)) {
                    case "d": case "m": case "y": case "@":
                        chars += "0123456789";
                        break;
                    case "D": case "M":
                        return null; // Accept anything
                    case "'":
                        if (lookAhead("'")) {
                            chars += "'";
                        } else {
                            literal = true;
                        }
                        break;
                    default:
                        chars += format.charAt(iFormat);
                }
            }
        }
        return chars;
    },
 
    /* Get a setting value, defaulting if necessary. */
    _get: function(inst, name) {
        return inst.settings[name] !== undefined ?
            inst.settings[name] : this._defaults[name];
    },
 
    /* Parse existing date and initialise date picker. */
    _setDateFromField: function(inst, noDefault) {
        if (inst.input.val() === inst.lastVal) {
            return;
        }
 
        var dateFormat = this._get(inst, "dateFormat"),
            dates = inst.lastVal = inst.input ? inst.input.val() : null,
            defaultDate = this._getDefaultDate(inst),
            date = defaultDate,
            settings = this._getFormatConfig(inst);
 
        try {
            date = this.parseDate(dateFormat, dates, settings) || defaultDate;
        } catch (event) {
            dates = (noDefault ? "" : dates);
        }
        inst.selectedDay = date.getDate();
        inst.drawMonth = inst.selectedMonth = date.getMonth();
        inst.drawYear = inst.selectedYear = date.getFullYear();
        inst.currentDay = (dates ? date.getDate() : 0);
        inst.currentMonth = (dates ? date.getMonth() : 0);
        inst.currentYear = (dates ? date.getFullYear() : 0);
        this._adjustInstDate(inst);
    },
 
    /* Retrieve the default date shown on opening. */
    _getDefaultDate: function(inst) {
        return this._restrictMinMax(inst,
            this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
    },
 
    /* A date may be specified as an exact value or a relative one. */
    _determineDate: function(inst, date, defaultDate) {
        var offsetNumeric = function(offset) {
                var date = new Date();
                date.setDate(date.getDate() + offset);
                return date;
            },
            offsetString = function(offset) {
                try {
                    return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                        offset, $.datepicker._getFormatConfig(inst));
                }
                catch (e) {
                    // Ignore
                }
 
                var date = (offset.toLowerCase().match(/^c/) ?
                    $.datepicker._getDate(inst) : null) || new Date(),
                    year = date.getFullYear(),
                    month = date.getMonth(),
                    day = date.getDate(),
                    pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
                    matches = pattern.exec(offset);
 
                while (matches) {
                    switch (matches[2] || "d") {
                        case "d" : case "D" :
                            day += parseInt(matches[1],10); break;
                        case "w" : case "W" :
                            day += parseInt(matches[1],10) * 7; break;
                        case "m" : case "M" :
                            month += parseInt(matches[1],10);
                            day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
                            break;
                        case "y": case "Y" :
                            year += parseInt(matches[1],10);
                            day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
                            break;
                    }
                    matches = pattern.exec(offset);
                }
                return new Date(year, month, day);
            },
            newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
                (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
 
        newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
        if (newDate) {
            newDate.setHours(0);
            newDate.setMinutes(0);
            newDate.setSeconds(0);
            newDate.setMilliseconds(0);
        }
        return this._daylightSavingAdjust(newDate);
    },
 
    /* Handle switch to/from daylight saving.
     * Hours may be non-zero on daylight saving cut-over:
     * > 12 when midnight changeover, but then cannot generate
     * midnight datetime, so jump to 1AM, otherwise reset.
     * @param  date  (Date) the date to check
     * @return  (Date) the corrected date
     */
    _daylightSavingAdjust: function(date) {
        if (!date) {
            return null;
        }
        date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
        return date;
    },
 
    /* Set the date(s) directly. */
    _setDate: function(inst, date, noChange) {
        var clear = !date,
            origMonth = inst.selectedMonth,
            origYear = inst.selectedYear,
            newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
 
        inst.selectedDay = inst.currentDay = newDate.getDate();
        inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
        inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
        if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
            this._notifyChange(inst);
        }
        this._adjustInstDate(inst);
        if (inst.input) {
            inst.input.val(clear ? "" : this._formatDate(inst));
        }
    },
 
    /* Retrieve the date(s) directly. */
    _getDate: function(inst) {
        var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
            this._daylightSavingAdjust(new Date(
            inst.currentYear, inst.currentMonth, inst.currentDay)));
            return startDate;
    },
 
    /* Attach the onxxx handlers.  These are declared statically so
     * they work with static code transformers like Caja.
     */
    _attachHandlers: function(inst) {
        var stepMonths = this._get(inst, "stepMonths"),
            id = "#" + inst.id.replace( /\\\\/g, "\\" );
        inst.dpDiv.find("[data-handler]").map(function () {
            var handler = {
                prev: function () {
                    $.datepicker._adjustDate(id, -stepMonths, "M");
                },
                next: function () {
                    $.datepicker._adjustDate(id, +stepMonths, "M");
                },
                hide: function () {
                    $.datepicker._hideDatepicker();
                },
                today: function () {
                    $.datepicker._gotoToday(id);
                },
                selectDay: function () {
                    $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
                    return false;
                },
                selectMonth: function () {
                    $.datepicker._selectMonthYear(id, this, "M");
                    return false;
                },
                selectYear: function () {
                    $.datepicker._selectMonthYear(id, this, "Y");
                    return false;
                }
            };
            $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
        });
    },
 
    /* Generate the HTML for the current state of the date picker. */
    _generateHTML: function(inst) {
        var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
            controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
            monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
            selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
            cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
            printDate, dRow, tbody, daySettings, otherMonth, unselectable,
            tempDate = new Date(),
            today = this._daylightSavingAdjust(
                new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
            isRTL = this._get(inst, "isRTL"),
            showButtonPanel = this._get(inst, "showButtonPanel"),
            hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
            navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
            numMonths = this._getNumberOfMonths(inst),
            showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
            stepMonths = this._get(inst, "stepMonths"),
            isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
            currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
                new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
            minDate = this._getMinMaxDate(inst, "min"),
            maxDate = this._getMinMaxDate(inst, "max"),
            drawMonth = inst.drawMonth - showCurrentAtPos,
            drawYear = inst.drawYear;
 
        if (drawMonth < 0) {
            drawMonth += 12;
            drawYear--;
        }
        if (maxDate) {
            maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
                maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
            maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
            while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                drawMonth--;
                if (drawMonth < 0) {
                    drawMonth = 11;
                    drawYear--;
                }
            }
        }
        inst.drawMonth = drawMonth;
        inst.drawYear = drawYear;
 
        prevText = this._get(inst, "prevText");
        prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
            this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
            this._getFormatConfig(inst)));
 
        prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
            "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
            " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
            (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
 
        nextText = this._get(inst, "nextText");
        nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
            this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
            this._getFormatConfig(inst)));
 
        next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
            "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
            " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
            (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
 
        currentText = this._get(inst, "currentText");
        gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
        currentText = (!navigationAsDateFormat ? currentText :
            this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
 
        controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
            this._get(inst, "closeText") + "</button>" : "");
 
        buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
            (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
            ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
 
        firstDay = parseInt(this._get(inst, "firstDay"),10);
        firstDay = (isNaN(firstDay) ? 0 : firstDay);
 
        showWeek = this._get(inst, "showWeek");
        dayNames = this._get(inst, "dayNames");
        dayNamesMin = this._get(inst, "dayNamesMin");
        monthNames = this._get(inst, "monthNames");
        monthNamesShort = this._get(inst, "monthNamesShort");
        beforeShowDay = this._get(inst, "beforeShowDay");
        showOtherMonths = this._get(inst, "showOtherMonths");
        selectOtherMonths = this._get(inst, "selectOtherMonths");
        defaultDate = this._getDefaultDate(inst);
        html = "";
        dow;
        for (row = 0; row < numMonths[0]; row++) {
            group = "";
            this.maxRows = 4;
            for (col = 0; col < numMonths[1]; col++) {
                selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
                cornerClass = " ui-corner-all";
                calender = "";
                if (isMultiMonth) {
                    calender += "<div class='ui-datepicker-group";
                    if (numMonths[1] > 1) {
                        switch (col) {
                            case 0: calender += " ui-datepicker-group-first";
                                cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                            case numMonths[1]-1: calender += " ui-datepicker-group-last";
                                cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
                            default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
                        }
                    }
                    calender += "'>";
                }
                calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
                    (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
                    (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
                    this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
                    row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
                    "</div><table class='ui-datepicker-calendar'><thead>" +
                    "<tr>";
                thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
                for (dow = 0; dow < 7; dow++) { // days of the week
                    day = (dow + firstDay) % 7;
                    thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
                        "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
                }
                calender += thead + "</tr></thead><tbody>";
                daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
                if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
                    inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
                }
                leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
                curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
                numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
                this.maxRows = numRows;
                printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
                for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
                    calender += "<tr>";
                    tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
                        this._get(inst, "calculateWeek")(printDate) + "</td>");
                    for (dow = 0; dow < 7; dow++) { // create date picker days
                        daySettings = (beforeShowDay ?
                            beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
                        otherMonth = (printDate.getMonth() !== drawMonth);
                        unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
                            (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
                        tbody += "<td class='" +
                            ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
                            (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
                            ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
                            (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
                            // or defaultDate is current printedDate and defaultDate is selectedDate
                            " " + this._dayOverClass : "") + // highlight selected day
                            (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
                            (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
                            (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
                            (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
                            ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
                            (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
                            (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
                            (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
                            (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
                            (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
                            (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
                            "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
                        printDate.setDate(printDate.getDate() + 1);
                        printDate = this._daylightSavingAdjust(printDate);
                    }
                    calender += tbody + "</tr>";
                }
                drawMonth++;
                if (drawMonth > 11) {
                    drawMonth = 0;
                    drawYear++;
                }
                calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
                            ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
                group += calender;
            }
            html += group;
        }
        html += buttonPanel;
        inst._keyEvent = false;
        return html;
    },
 
    /* Generate the month and year header. */
    _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
            secondary, monthNames, monthNamesShort) {
 
        var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
            changeMonth = this._get(inst, "changeMonth"),
            changeYear = this._get(inst, "changeYear"),
            showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
            html = "<div class='ui-datepicker-title'>",
            monthHtml = "";
 
        // month selection
        if (secondary || !changeMonth) {
            monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
        } else {
            inMinYear = (minDate && minDate.getFullYear() === drawYear);
            inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
            monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
            for ( month = 0; month < 12; month++) {
                if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
                    monthHtml += "<option value='" + month + "'" +
                        (month === drawMonth ? " selected='selected'" : "") +
                        ">" + monthNamesShort[month] + "</option>";
                }
            }
            monthHtml += "</select>";
        }
 
        if (!showMonthAfterYear) {
            html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
        }
 
        // year selection
        if ( !inst.yearshtml ) {
            inst.yearshtml = "";
            if (secondary || !changeYear) {
                html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
            } else {
                // determine range of years to display
                years = this._get(inst, "yearRange").split(":");
                thisYear = new Date().getFullYear();
                determineYear = function(value) {
                    var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
                        (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
                        parseInt(value, 10)));
                    return (isNaN(year) ? thisYear : year);
                };
                year = determineYear(years[0]);
                endYear = Math.max(year, determineYear(years[1] || ""));
                year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
                endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
                inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
                for (; year <= endYear; year++) {
                    inst.yearshtml += "<option value='" + year + "'" +
                        (year === drawYear ? " selected='selected'" : "") +
                        ">" + year + "</option>";
                }
                inst.yearshtml += "</select>";
 
                html += inst.yearshtml;
                inst.yearshtml = null;
            }
        }
 
        html += this._get(inst, "yearSuffix");
        if (showMonthAfterYear) {
            html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
        }
        html += "</div>"; // Close datepicker_header
        return html;
    },
 
    /* Adjust one of the date sub-fields. */
    _adjustInstDate: function(inst, offset, period) {
        var year = inst.drawYear + (period === "Y" ? offset : 0),
            month = inst.drawMonth + (period === "M" ? offset : 0),
            day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
            date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
 
        inst.selectedDay = date.getDate();
        inst.drawMonth = inst.selectedMonth = date.getMonth();
        inst.drawYear = inst.selectedYear = date.getFullYear();
        if (period === "M" || period === "Y") {
            this._notifyChange(inst);
        }
    },
 
    /* Ensure a date is within any min/max bounds. */
    _restrictMinMax: function(inst, date) {
        var minDate = this._getMinMaxDate(inst, "min"),
            maxDate = this._getMinMaxDate(inst, "max"),
            newDate = (minDate && date < minDate ? minDate : date);
        return (maxDate && newDate > maxDate ? maxDate : newDate);
    },
 
    /* Notify change of month/year. */
    _notifyChange: function(inst) {
        var onChange = this._get(inst, "onChangeMonthYear");
        if (onChange) {
            onChange.apply((inst.input ? inst.input[0] : null),
                [inst.selectedYear, inst.selectedMonth + 1, inst]);
        }
    },
 
    /* Determine the number of months to show. */
    _getNumberOfMonths: function(inst) {
        var numMonths = this._get(inst, "numberOfMonths");
        return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
    },
 
    /* Determine the current maximum date - ensure no time components are set. */
    _getMinMaxDate: function(inst, minMax) {
        return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
    },
 
    /* Find the number of days in a given month. */
    _getDaysInMonth: function(year, month) {
        return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
    },
 
    /* Find the day of the week of the first of a month. */
    _getFirstDayOfMonth: function(year, month) {
        return new Date(year, month, 1).getDay();
    },
 
    /* Determines if we should allow a "next/prev" month display change. */
    _canAdjustMonth: function(inst, offset, curYear, curMonth) {
        var numMonths = this._getNumberOfMonths(inst),
            date = this._daylightSavingAdjust(new Date(curYear,
            curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
 
        if (offset < 0) {
            date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
        }
        return this._isInRange(inst, date);
    },
 
    /* Is the given date in the accepted range? */
    _isInRange: function(inst, date) {
        var yearSplit, currentYear,
            minDate = this._getMinMaxDate(inst, "min"),
            maxDate = this._getMinMaxDate(inst, "max"),
            minYear = null,
            maxYear = null,
            years = this._get(inst, "yearRange");
            if (years){
                yearSplit = years.split(":");
                currentYear = new Date().getFullYear();
                minYear = parseInt(yearSplit[0], 10);
                maxYear = parseInt(yearSplit[1], 10);
                if ( yearSplit[0].match(/[+\-].*/) ) {
                    minYear += currentYear;
                }
                if ( yearSplit[1].match(/[+\-].*/) ) {
                    maxYear += currentYear;
                }
            }
 
        return ((!minDate || date.getTime() >= minDate.getTime()) &&
            (!maxDate || date.getTime() <= maxDate.getTime()) &&
            (!minYear || date.getFullYear() >= minYear) &&
            (!maxYear || date.getFullYear() <= maxYear));
    },
 
    /* Provide the configuration settings for formatting/parsing. */
    _getFormatConfig: function(inst) {
        var shortYearCutoff = this._get(inst, "shortYearCutoff");
        shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
            new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
        return {shortYearCutoff: shortYearCutoff,
            dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
            monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
    },
 
    /* Format the given date for display. */
    _formatDate: function(inst, day, month, year) {
        if (!day) {
            inst.currentDay = inst.selectedDay;
            inst.currentMonth = inst.selectedMonth;
            inst.currentYear = inst.selectedYear;
        }
        var date = (day ? (typeof day === "object" ? day :
            this._daylightSavingAdjust(new Date(year, month, day))) :
            this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
        return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
    }
});
 
/*
 * Bind hover events for datepicker elements.
 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
 */
function datepicker_bindHover(dpDiv) {
    var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
    return dpDiv.delegate(selector, "mouseout", function() {
            $(this).removeClass("ui-state-hover");
            if (this.className.indexOf("ui-datepicker-prev") !== -1) {
                $(this).removeClass("ui-datepicker-prev-hover");
            }
            if (this.className.indexOf("ui-datepicker-next") !== -1) {
                $(this).removeClass("ui-datepicker-next-hover");
            }
        })
        .delegate( selector, "mouseover", datepicker_handleMouseover );
}
 
function datepicker_handleMouseover() {
    if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
        $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
        $(this).addClass("ui-state-hover");
        if (this.className.indexOf("ui-datepicker-prev") !== -1) {
            $(this).addClass("ui-datepicker-prev-hover");
        }
        if (this.className.indexOf("ui-datepicker-next") !== -1) {
            $(this).addClass("ui-datepicker-next-hover");
        }
    }
}
 
/* jQuery extend now ignores nulls! */
function datepicker_extendRemove(target, props) {
    $.extend(target, props);
    for (var name in props) {
        if (props[name] == null) {
            target[name] = props[name];
        }
    }
    return target;
}
 
/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
                    Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker = function(options){
 
    /* Verify an empty collection wasn't passed - Fixes #6976 */
    if ( !this.length ) {
        return this;
    }
 
    /* Initialise the date picker. */
    if (!$.datepicker.initialized) {
        $(document).mousedown($.datepicker._checkExternalClick);
        $.datepicker.initialized = true;
    }
 
    /* Append datepicker main container to body if not exist. */
    if ($("#"+$.datepicker._mainDivId).length === 0) {
        $("body").append($.datepicker.dpDiv);
    }
 
    var otherArgs = Array.prototype.slice.call(arguments, 1);
    if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
        return $.datepicker["_" + options + "Datepicker"].
            apply($.datepicker, [this[0]].concat(otherArgs));
    }
    if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
        return $.datepicker["_" + options + "Datepicker"].
            apply($.datepicker, [this[0]].concat(otherArgs));
    }
    return this.each(function() {
        typeof options === "string" ?
            $.datepicker["_" + options + "Datepicker"].
                apply($.datepicker, [this].concat(otherArgs)) :
            $.datepicker._attachDatepicker(this, options);
    });
};
 
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.11.4";
 
var datepicker = $.datepicker;
 
 
/*!
 * jQuery UI Dialog 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/dialog/
 */
 
 
var dialog = $.widget( "ui.dialog", {
    version: "1.11.4",
    options: {
        appendTo: "body",
        autoOpen: true,
        buttons: [],
        closeOnEscape: true,
        closeText: "Close",
        dialogClass: "",
        draggable: true,
        hide: null,
        height: "auto",
        maxHeight: null,
        maxWidth: null,
        minHeight: 150,
        minWidth: 150,
        modal: false,
        position: {
            my: "center",
            at: "center",
            of: window,
            collision: "fit",
            // Ensure the titlebar is always visible
            using: function( pos ) {
                var topOffset = $( this ).css( pos ).offset().top;
                if ( topOffset < 0 ) {
                    $( this ).css( "top", pos.top - topOffset );
                }
            }
        },
        resizable: true,
        show: null,
        title: null,
        width: 300,
 
        // callbacks
        beforeClose: null,
        close: null,
        drag: null,
        dragStart: null,
        dragStop: null,
        focus: null,
        open: null,
        resize: null,
        resizeStart: null,
        resizeStop: null
    },
 
    sizeRelatedOptions: {
        buttons: true,
        height: true,
        maxHeight: true,
        maxWidth: true,
        minHeight: true,
        minWidth: true,
        width: true
    },
 
    resizableRelatedOptions: {
        maxHeight: true,
        maxWidth: true,
        minHeight: true,
        minWidth: true
    },
 
    _create: function() {
        this.originalCss = {
            display: this.element[ 0 ].style.display,
            width: this.element[ 0 ].style.width,
            minHeight: this.element[ 0 ].style.minHeight,
            maxHeight: this.element[ 0 ].style.maxHeight,
            height: this.element[ 0 ].style.height
        };
        this.originalPosition = {
            parent: this.element.parent(),
            index: this.element.parent().children().index( this.element )
        };
        this.originalTitle = this.element.attr( "title" );
        this.options.title = this.options.title || this.originalTitle;
 
        this._createWrapper();
 
        this.element
            .show()
            .removeAttr( "title" )
            .addClass( "ui-dialog-content ui-widget-content" )
            .appendTo( this.uiDialog );
 
        this._createTitlebar();
        this._createButtonPane();
 
        if ( this.options.draggable && $.fn.draggable ) {
            this._makeDraggable();
        }
        if ( this.options.resizable && $.fn.resizable ) {
            this._makeResizable();
        }
 
        this._isOpen = false;
 
        this._trackFocus();
    },
 
    _init: function() {
        if ( this.options.autoOpen ) {
            this.open();
        }
    },
 
    _appendTo: function() {
        var element = this.options.appendTo;
        if ( element && (element.jquery || element.nodeType) ) {
            return $( element );
        }
        return this.document.find( element || "body" ).eq( 0 );
    },
 
    _destroy: function() {
        var next,
            originalPosition = this.originalPosition;
 
        this._untrackInstance();
        this._destroyOverlay();
 
        this.element
            .removeUniqueId()
            .removeClass( "ui-dialog-content ui-widget-content" )
            .css( this.originalCss )
            // Without detaching first, the following becomes really slow
            .detach();
 
        this.uiDialog.stop( true, true ).remove();
 
        if ( this.originalTitle ) {
            this.element.attr( "title", this.originalTitle );
        }
 
        next = originalPosition.parent.children().eq( originalPosition.index );
        // Don't try to place the dialog next to itself (#8613)
        if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
            next.before( this.element );
        } else {
            originalPosition.parent.append( this.element );
        }
    },
 
    widget: function() {
        return this.uiDialog;
    },
 
    disable: $.noop,
    enable: $.noop,
 
    close: function( event ) {
        var activeElement,
            that = this;
 
        if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
            return;
        }
 
        this._isOpen = false;
        this._focusedElement = null;
        this._destroyOverlay();
        this._untrackInstance();
 
        if ( !this.opener.filter( ":focusable" ).focus().length ) {
 
            // support: IE9
            // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
            try {
                activeElement = this.document[ 0 ].activeElement;
 
                // Support: IE9, IE10
                // If the <body> is blurred, IE will switch windows, see #4520
                if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
 
                    // Hiding a focused element doesn't trigger blur in WebKit
                    // so in case we have nothing to focus on, explicitly blur the active element
                    // https://bugs.webkit.org/show_bug.cgi?id=47182
                    $( activeElement ).blur();
                }
            } catch ( error ) {}
        }
 
        this._hide( this.uiDialog, this.options.hide, function() {
            that._trigger( "close", event );
        });
    },
 
    isOpen: function() {
        return this._isOpen;
    },
 
    moveToTop: function() {
        this._moveToTop();
    },
 
    _moveToTop: function( event, silent ) {
        var moved = false,
            zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
                return +$( this ).css( "z-index" );
            }).get(),
            zIndexMax = Math.max.apply( null, zIndices );
 
        if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
            this.uiDialog.css( "z-index", zIndexMax + 1 );
            moved = true;
        }
 
        if ( moved && !silent ) {
            this._trigger( "focus", event );
        }
        return moved;
    },
 
    open: function() {
        var that = this;
        if ( this._isOpen ) {
            if ( this._moveToTop() ) {
                this._focusTabbable();
            }
            return;
        }
 
        this._isOpen = true;
        this.opener = $( this.document[ 0 ].activeElement );
 
        this._size();
        this._position();
        this._createOverlay();
        this._moveToTop( null, true );
 
        // Ensure the overlay is moved to the top with the dialog, but only when
        // opening. The overlay shouldn't move after the dialog is open so that
        // modeless dialogs opened after the modal dialog stack properly.
        if ( this.overlay ) {
            this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
        }
 
        this._show( this.uiDialog, this.options.show, function() {
            that._focusTabbable();
            that._trigger( "focus" );
        });
 
        // Track the dialog immediately upon openening in case a focus event
        // somehow occurs outside of the dialog before an element inside the
        // dialog is focused (#10152)
        this._makeFocusTarget();
 
        this._trigger( "open" );
    },
 
    _focusTabbable: function() {
        // Set focus to the first match:
        // 1. An element that was focused previously
        // 2. First element inside the dialog matching [autofocus]
        // 3. Tabbable element inside the content element
        // 4. Tabbable element inside the buttonpane
        // 5. The close button
        // 6. The dialog itself
        var hasFocus = this._focusedElement;
        if ( !hasFocus ) {
            hasFocus = this.element.find( "[autofocus]" );
        }
        if ( !hasFocus.length ) {
            hasFocus = this.element.find( ":tabbable" );
        }
        if ( !hasFocus.length ) {
            hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
        }
        if ( !hasFocus.length ) {
            hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
        }
        if ( !hasFocus.length ) {
            hasFocus = this.uiDialog;
        }
        hasFocus.eq( 0 ).focus();
    },
 
    _keepFocus: function( event ) {
        function checkFocus() {
            var activeElement = this.document[0].activeElement,
                isActive = this.uiDialog[0] === activeElement ||
                    $.contains( this.uiDialog[0], activeElement );
            if ( !isActive ) {
                this._focusTabbable();
            }
        }
        event.preventDefault();
        checkFocus.call( this );
        // support: IE
        // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
        // so we check again later
        this._delay( checkFocus );
    },
 
    _createWrapper: function() {
        this.uiDialog = $("<div>")
            .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
                this.options.dialogClass )
            .hide()
            .attr({
                // Setting tabIndex makes the div focusable
                tabIndex: -1,
                role: "dialog"
            })
            .appendTo( this._appendTo() );
 
        this._on( this.uiDialog, {
            keydown: function( event ) {
                if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
                        event.keyCode === $.ui.keyCode.ESCAPE ) {
                    event.preventDefault();
                    this.close( event );
                    return;
                }
 
                // prevent tabbing out of dialogs
                if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
                    return;
                }
                var tabbables = this.uiDialog.find( ":tabbable" ),
                    first = tabbables.filter( ":first" ),
                    last = tabbables.filter( ":last" );
 
                if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
                    this._delay(function() {
                        first.focus();
                    });
                    event.preventDefault();
                } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
                    this._delay(function() {
                        last.focus();
                    });
                    event.preventDefault();
                }
            },
            mousedown: function( event ) {
                if ( this._moveToTop( event ) ) {
                    this._focusTabbable();
                }
            }
        });
 
        // We assume that any existing aria-describedby attribute means
        // that the dialog content is marked up properly
        // otherwise we brute force the content as the description
        if ( !this.element.find( "[aria-describedby]" ).length ) {
            this.uiDialog.attr({
                "aria-describedby": this.element.uniqueId().attr( "id" )
            });
        }
    },
 
    _createTitlebar: function() {
        var uiDialogTitle;
 
        this.uiDialogTitlebar = $( "<div>" )
            .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
            .prependTo( this.uiDialog );
        this._on( this.uiDialogTitlebar, {
            mousedown: function( event ) {
                // Don't prevent click on close button (#8838)
                // Focusing a dialog that is partially scrolled out of view
                // causes the browser to scroll it into view, preventing the click event
                if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
                    // Dialog isn't getting focus when dragging (#8063)
                    this.uiDialog.focus();
                }
            }
        });
 
        // support: IE
        // Use type="button" to prevent enter keypresses in textboxes from closing the
        // dialog in IE (#9312)
        this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
            .button({
                label: this.options.closeText,
                icons: {
                    primary: "ui-icon-closethick"
                },
                text: false
            })
            .addClass( "ui-dialog-titlebar-close" )
            .appendTo( this.uiDialogTitlebar );
        this._on( this.uiDialogTitlebarClose, {
            click: function( event ) {
                event.preventDefault();
                this.close( event );
            }
        });
 
        uiDialogTitle = $( "<span>" )
            .uniqueId()
            .addClass( "ui-dialog-title" )
            .prependTo( this.uiDialogTitlebar );
        this._title( uiDialogTitle );
 
        this.uiDialog.attr({
            "aria-labelledby": uiDialogTitle.attr( "id" )
        });
    },
 
    _title: function( title ) {
        if ( !this.options.title ) {
            title.html( "&#160;" );
        }
        title.text( this.options.title );
    },
 
    _createButtonPane: function() {
        this.uiDialogButtonPane = $( "<div>" )
            .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
 
        this.uiButtonSet = $( "<div>" )
            .addClass( "ui-dialog-buttonset" )
            .appendTo( this.uiDialogButtonPane );
 
        this._createButtons();
    },
 
    _createButtons: function() {
        var that = this,
            buttons = this.options.buttons;
 
        // if we already have a button pane, remove it
        this.uiDialogButtonPane.remove();
        this.uiButtonSet.empty();
 
        if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
            this.uiDialog.removeClass( "ui-dialog-buttons" );
            return;
        }
 
        $.each( buttons, function( name, props ) {
            var click, buttonOptions;
            props = $.isFunction( props ) ?
                { click: props, text: name } :
                props;
            // Default to a non-submitting button
            props = $.extend( { type: "button" }, props );
            // Change the context for the click callback to be the main element
            click = props.click;
            props.click = function() {
                click.apply( that.element[ 0 ], arguments );
            };
            buttonOptions = {
                icons: props.icons,
                text: props.showText
            };
            delete props.icons;
            delete props.showText;
            $( "<button></button>", props )
                .button( buttonOptions )
                .appendTo( that.uiButtonSet );
        });
        this.uiDialog.addClass( "ui-dialog-buttons" );
        this.uiDialogButtonPane.appendTo( this.uiDialog );
    },
 
    _makeDraggable: function() {
        var that = this,
            options = this.options;
 
        function filteredUi( ui ) {
            return {
                position: ui.position,
                offset: ui.offset
            };
        }
 
        this.uiDialog.draggable({
            cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
            handle: ".ui-dialog-titlebar",
            containment: "document",
            start: function( event, ui ) {
                $( this ).addClass( "ui-dialog-dragging" );
                that._blockFrames();
                that._trigger( "dragStart", event, filteredUi( ui ) );
            },
            drag: function( event, ui ) {
                that._trigger( "drag", event, filteredUi( ui ) );
            },
            stop: function( event, ui ) {
                var left = ui.offset.left - that.document.scrollLeft(),
                    top = ui.offset.top - that.document.scrollTop();
 
                options.position = {
                    my: "left top",
                    at: "left" + (left >= 0 ? "+" : "") + left + " " +
                        "top" + (top >= 0 ? "+" : "") + top,
                    of: that.window
                };
                $( this ).removeClass( "ui-dialog-dragging" );
                that._unblockFrames();
                that._trigger( "dragStop", event, filteredUi( ui ) );
            }
        });
    },
 
    _makeResizable: function() {
        var that = this,
            options = this.options,
            handles = options.resizable,
            // .ui-resizable has position: relative defined in the stylesheet
            // but dialogs have to use absolute or fixed positioning
            position = this.uiDialog.css("position"),
            resizeHandles = typeof handles === "string" ?
                handles :
                "n,e,s,w,se,sw,ne,nw";
 
        function filteredUi( ui ) {
            return {
                originalPosition: ui.originalPosition,
                originalSize: ui.originalSize,
                position: ui.position,
                size: ui.size
            };
        }
 
        this.uiDialog.resizable({
            cancel: ".ui-dialog-content",
            containment: "document",
            alsoResize: this.element,
            maxWidth: options.maxWidth,
            maxHeight: options.maxHeight,
            minWidth: options.minWidth,
            minHeight: this._minHeight(),
            handles: resizeHandles,
            start: function( event, ui ) {
                $( this ).addClass( "ui-dialog-resizing" );
                that._blockFrames();
                that._trigger( "resizeStart", event, filteredUi( ui ) );
            },
            resize: function( event, ui ) {
                that._trigger( "resize", event, filteredUi( ui ) );
            },
            stop: function( event, ui ) {
                var offset = that.uiDialog.offset(),
                    left = offset.left - that.document.scrollLeft(),
                    top = offset.top - that.document.scrollTop();
 
                options.height = that.uiDialog.height();
                options.width = that.uiDialog.width();
                options.position = {
                    my: "left top",
                    at: "left" + (left >= 0 ? "+" : "") + left + " " +
                        "top" + (top >= 0 ? "+" : "") + top,
                    of: that.window
                };
                $( this ).removeClass( "ui-dialog-resizing" );
                that._unblockFrames();
                that._trigger( "resizeStop", event, filteredUi( ui ) );
            }
        })
        .css( "position", position );
    },
 
    _trackFocus: function() {
        this._on( this.widget(), {
            focusin: function( event ) {
                this._makeFocusTarget();
                this._focusedElement = $( event.target );
            }
        });
    },
 
    _makeFocusTarget: function() {
        this._untrackInstance();
        this._trackingInstances().unshift( this );
    },
 
    _untrackInstance: function() {
        var instances = this._trackingInstances(),
            exists = $.inArray( this, instances );
        if ( exists !== -1 ) {
            instances.splice( exists, 1 );
        }
    },
 
    _trackingInstances: function() {
        var instances = this.document.data( "ui-dialog-instances" );
        if ( !instances ) {
            instances = [];
            this.document.data( "ui-dialog-instances", instances );
        }
        return instances;
    },
 
    _minHeight: function() {
        var options = this.options;
 
        return options.height === "auto" ?
            options.minHeight :
            Math.min( options.minHeight, options.height );
    },
 
    _position: function() {
        // Need to show the dialog to get the actual offset in the position plugin
        var isVisible = this.uiDialog.is( ":visible" );
        if ( !isVisible ) {
            this.uiDialog.show();
        }
        this.uiDialog.position( this.options.position );
        if ( !isVisible ) {
            this.uiDialog.hide();
        }
    },
 
    _setOptions: function( options ) {
        var that = this,
            resize = false,
            resizableOptions = {};
 
        $.each( options, function( key, value ) {
            that._setOption( key, value );
 
            if ( key in that.sizeRelatedOptions ) {
                resize = true;
            }
            if ( key in that.resizableRelatedOptions ) {
                resizableOptions[ key ] = value;
            }
        });
 
        if ( resize ) {
            this._size();
            this._position();
        }
        if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
            this.uiDialog.resizable( "option", resizableOptions );
        }
    },
 
    _setOption: function( key, value ) {
        var isDraggable, isResizable,
            uiDialog = this.uiDialog;
 
        if ( key === "dialogClass" ) {
            uiDialog
                .removeClass( this.options.dialogClass )
                .addClass( value );
        }
 
        if ( key === "disabled" ) {
            return;
        }
 
        this._super( key, value );
 
        if ( key === "appendTo" ) {
            this.uiDialog.appendTo( this._appendTo() );
        }
 
        if ( key === "buttons" ) {
            this._createButtons();
        }
 
        if ( key === "closeText" ) {
            this.uiDialogTitlebarClose.button({
                // Ensure that we always pass a string
                label: "" + value
            });
        }
 
        if ( key === "draggable" ) {
            isDraggable = uiDialog.is( ":data(ui-draggable)" );
            if ( isDraggable && !value ) {
                uiDialog.draggable( "destroy" );
            }
 
            if ( !isDraggable && value ) {
                this._makeDraggable();
            }
        }
 
        if ( key === "position" ) {
            this._position();
        }
 
        if ( key === "resizable" ) {
            // currently resizable, becoming non-resizable
            isResizable = uiDialog.is( ":data(ui-resizable)" );
            if ( isResizable && !value ) {
                uiDialog.resizable( "destroy" );
            }
 
            // currently resizable, changing handles
            if ( isResizable && typeof value === "string" ) {
                uiDialog.resizable( "option", "handles", value );
            }
 
            // currently non-resizable, becoming resizable
            if ( !isResizable && value !== false ) {
                this._makeResizable();
            }
        }
 
        if ( key === "title" ) {
            this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
        }
    },
 
    _size: function() {
        // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
        // divs will both have width and height set, so we need to reset them
        var nonContentHeight, minContentHeight, maxContentHeight,
            options = this.options;
 
        // Reset content sizing
        this.element.show().css({
            width: "auto",
            minHeight: 0,
            maxHeight: "none",
            height: 0
        });
 
        if ( options.minWidth > options.width ) {
            options.width = options.minWidth;
        }
 
        // reset wrapper sizing
        // determine the height of all the non-content elements
        nonContentHeight = this.uiDialog.css({
                height: "auto",
                width: options.width
            })
            .outerHeight();
        minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
        maxContentHeight = typeof options.maxHeight === "number" ?
            Math.max( 0, options.maxHeight - nonContentHeight ) :
            "none";
 
        if ( options.height === "auto" ) {
            this.element.css({
                minHeight: minContentHeight,
                maxHeight: maxContentHeight,
                height: "auto"
            });
        } else {
            this.element.height( Math.max( 0, options.height - nonContentHeight ) );
        }
 
        if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
            this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
        }
    },
 
    _blockFrames: function() {
        this.iframeBlocks = this.document.find( "iframe" ).map(function() {
            var iframe = $( this );
 
            return $( "<div>" )
                .css({
                    position: "absolute",
                    width: iframe.outerWidth(),
                    height: iframe.outerHeight()
                })
                .appendTo( iframe.parent() )
                .offset( iframe.offset() )[0];
        });
    },
 
    _unblockFrames: function() {
        if ( this.iframeBlocks ) {
            this.iframeBlocks.remove();
            delete this.iframeBlocks;
        }
    },
 
    _allowInteraction: function( event ) {
        if ( $( event.target ).closest( ".ui-dialog" ).length ) {
            return true;
        }
 
        // TODO: Remove hack when datepicker implements
        // the .ui-front logic (#8989)
        return !!$( event.target ).closest( ".ui-datepicker" ).length;
    },
 
    _createOverlay: function() {
        if ( !this.options.modal ) {
            return;
        }
 
        // We use a delay in case the overlay is created from an
        // event that we're going to be cancelling (#2804)
        var isOpening = true;
        this._delay(function() {
            isOpening = false;
        });
 
        if ( !this.document.data( "ui-dialog-overlays" ) ) {
 
            // Prevent use of anchors and inputs
            // Using _on() for an event handler shared across many instances is
            // safe because the dialogs stack and must be closed in reverse order
            this._on( this.document, {
                focusin: function( event ) {
                    if ( isOpening ) {
                        return;
                    }
 
                    if ( !this._allowInteraction( event ) ) {
                        event.preventDefault();
                        this._trackingInstances()[ 0 ]._focusTabbable();
                    }
                }
            });
        }
 
        this.overlay = $( "<div>" )
            .addClass( "ui-widget-overlay ui-front" )
            .appendTo( this._appendTo() );
        this._on( this.overlay, {
            mousedown: "_keepFocus"
        });
        this.document.data( "ui-dialog-overlays",
            (this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
    },
 
    _destroyOverlay: function() {
        if ( !this.options.modal ) {
            return;
        }
 
        if ( this.overlay ) {
            var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
 
            if ( !overlays ) {
                this.document
                    .unbind( "focusin" )
                    .removeData( "ui-dialog-overlays" );
            } else {
                this.document.data( "ui-dialog-overlays", overlays );
            }
 
            this.overlay.remove();
            this.overlay = null;
        }
    }
});
 
 
/*!
 * jQuery UI Progressbar 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/progressbar/
 */
 
 
var progressbar = $.widget( "ui.progressbar", {
    version: "1.11.4",
    options: {
        max: 100,
        value: 0,
 
        change: null,
        complete: null
    },
 
    min: 0,
 
    _create: function() {
        // Constrain initial value
        this.oldValue = this.options.value = this._constrainedValue();
 
        this.element
            .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
            .attr({
                // Only set static values, aria-valuenow and aria-valuemax are
                // set inside _refreshValue()
                role: "progressbar",
                "aria-valuemin": this.min
            });
 
        this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
            .appendTo( this.element );
 
        this._refreshValue();
    },
 
    _destroy: function() {
        this.element
            .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
            .removeAttr( "role" )
            .removeAttr( "aria-valuemin" )
            .removeAttr( "aria-valuemax" )
            .removeAttr( "aria-valuenow" );
 
        this.valueDiv.remove();
    },
 
    value: function( newValue ) {
        if ( newValue === undefined ) {
            return this.options.value;
        }
 
        this.options.value = this._constrainedValue( newValue );
        this._refreshValue();
    },
 
    _constrainedValue: function( newValue ) {
        if ( newValue === undefined ) {
            newValue = this.options.value;
        }
 
        this.indeterminate = newValue === false;
 
        // sanitize value
        if ( typeof newValue !== "number" ) {
            newValue = 0;
        }
 
        return this.indeterminate ? false :
            Math.min( this.options.max, Math.max( this.min, newValue ) );
    },
 
    _setOptions: function( options ) {
        // Ensure "value" option is set after other values (like max)
        var value = options.value;
        delete options.value;
 
        this._super( options );
 
        this.options.value = this._constrainedValue( value );
        this._refreshValue();
    },
 
    _setOption: function( key, value ) {
        if ( key === "max" ) {
            // Don't allow a max less than min
            value = Math.max( this.min, value );
        }
        if ( key === "disabled" ) {
            this.element
                .toggleClass( "ui-state-disabled", !!value )
                .attr( "aria-disabled", value );
        }
        this._super( key, value );
    },
 
    _percentage: function() {
        return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
    },
 
    _refreshValue: function() {
        var value = this.options.value,
            percentage = this._percentage();
 
        this.valueDiv
            .toggle( this.indeterminate || value > this.min )
            .toggleClass( "ui-corner-right", value === this.options.max )
            .width( percentage.toFixed(0) + "%" );
 
        this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
 
        if ( this.indeterminate ) {
            this.element.removeAttr( "aria-valuenow" );
            if ( !this.overlayDiv ) {
                this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
            }
        } else {
            this.element.attr({
                "aria-valuemax": this.options.max,
                "aria-valuenow": value
            });
            if ( this.overlayDiv ) {
                this.overlayDiv.remove();
                this.overlayDiv = null;
            }
        }
 
        if ( this.oldValue !== value ) {
            this.oldValue = value;
            this._trigger( "change" );
        }
        if ( value === this.options.max ) {
            this._trigger( "complete" );
        }
    }
});
 
 
/*!
 * jQuery UI Selectmenu 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/selectmenu
 */
 
 
var selectmenu = $.widget( "ui.selectmenu", {
    version: "1.11.4",
    defaultElement: "<select>",
    options: {
        appendTo: null,
        disabled: null,
        icons: {
            button: "ui-icon-triangle-1-s"
        },
        position: {
            my: "left top",
            at: "left bottom",
            collision: "none"
        },
        width: null,
 
        // callbacks
        change: null,
        close: null,
        focus: null,
        open: null,
        select: null
    },
 
    _create: function() {
        var selectmenuId = this.element.uniqueId().attr( "id" );
        this.ids = {
            element: selectmenuId,
            button: selectmenuId + "-button",
            menu: selectmenuId + "-menu"
        };
 
        this._drawButton();
        this._drawMenu();
 
        if ( this.options.disabled ) {
            this.disable();
        }
    },
 
    _drawButton: function() {
        var that = this;
 
        // Associate existing label with the new button
        this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
        this._on( this.label, {
            click: function( event ) {
                this.button.focus();
                event.preventDefault();
            }
        });
 
        // Hide original select element
        this.element.hide();
 
        // Create button
        this.button = $( "<span>", {
            "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
            tabindex: this.options.disabled ? -1 : 0,
            id: this.ids.button,
            role: "combobox",
            "aria-expanded": "false",
            "aria-autocomplete": "list",
            "aria-owns": this.ids.menu,
            "aria-haspopup": "true"
        })
            .insertAfter( this.element );
 
        $( "<span>", {
            "class": "ui-icon " + this.options.icons.button
        })
            .prependTo( this.button );
 
        this.buttonText = $( "<span>", {
            "class": "ui-selectmenu-text"
        })
            .appendTo( this.button );
 
        this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
        this._resizeButton();
 
        this._on( this.button, this._buttonEvents );
        this.button.one( "focusin", function() {
 
            // Delay rendering the menu items until the button receives focus.
            // The menu may have already been rendered via a programmatic open.
            if ( !that.menuItems ) {
                that._refreshMenu();
            }
        });
        this._hoverable( this.button );
        this._focusable( this.button );
    },
 
    _drawMenu: function() {
        var that = this;
 
        // Create menu
        this.menu = $( "<ul>", {
            "aria-hidden": "true",
            "aria-labelledby": this.ids.button,
            id: this.ids.menu
        });
 
        // Wrap menu
        this.menuWrap = $( "<div>", {
            "class": "ui-selectmenu-menu ui-front"
        })
            .append( this.menu )
            .appendTo( this._appendTo() );
 
        // Initialize menu widget
        this.menuInstance = this.menu
            .menu({
                role: "listbox",
                select: function( event, ui ) {
                    event.preventDefault();
 
                    // support: IE8
                    // If the item was selected via a click, the text selection
                    // will be destroyed in IE
                    that._setSelection();
 
                    that._select( ui.item.data( "ui-selectmenu-item" ), event );
                },
                focus: function( event, ui ) {
                    var item = ui.item.data( "ui-selectmenu-item" );
 
                    // Prevent inital focus from firing and check if its a newly focused item
                    if ( that.focusIndex != null && item.index !== that.focusIndex ) {
                        that._trigger( "focus", event, { item: item } );
                        if ( !that.isOpen ) {
                            that._select( item, event );
                        }
                    }
                    that.focusIndex = item.index;
 
                    that.button.attr( "aria-activedescendant",
                        that.menuItems.eq( item.index ).attr( "id" ) );
                }
            })
            .menu( "instance" );
 
        // Adjust menu styles to dropdown
        this.menu
            .addClass( "ui-corner-bottom" )
            .removeClass( "ui-corner-all" );
 
        // Don't close the menu on mouseleave
        this.menuInstance._off( this.menu, "mouseleave" );
 
        // Cancel the menu's collapseAll on document click
        this.menuInstance._closeOnDocumentClick = function() {
            return false;
        };
 
        // Selects often contain empty items, but never contain dividers
        this.menuInstance._isDivider = function() {
            return false;
        };
    },
 
    refresh: function() {
        this._refreshMenu();
        this._setText( this.buttonText, this._getSelectedItem().text() );
        if ( !this.options.width ) {
            this._resizeButton();
        }
    },
 
    _refreshMenu: function() {
        this.menu.empty();
 
        var item,
            options = this.element.find( "option" );
 
        if ( !options.length ) {
            return;
        }
 
        this._parseOptions( options );
        this._renderMenu( this.menu, this.items );
 
        this.menuInstance.refresh();
        this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
 
        item = this._getSelectedItem();
 
        // Update the menu to have the correct item focused
        this.menuInstance.focus( null, item );
        this._setAria( item.data( "ui-selectmenu-item" ) );
 
        // Set disabled state
        this._setOption( "disabled", this.element.prop( "disabled" ) );
    },
 
    open: function( event ) {
        if ( this.options.disabled ) {
            return;
        }
 
        // If this is the first time the menu is being opened, render the items
        if ( !this.menuItems ) {
            this._refreshMenu();
        } else {
 
            // Menu clears focus on close, reset focus to selected item
            this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
            this.menuInstance.focus( null, this._getSelectedItem() );
        }
 
        this.isOpen = true;
        this._toggleAttr();
        this._resizeMenu();
        this._position();
 
        this._on( this.document, this._documentClick );
 
        this._trigger( "open", event );
    },
 
    _position: function() {
        this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
    },
 
    close: function( event ) {
        if ( !this.isOpen ) {
            return;
        }
 
        this.isOpen = false;
        this._toggleAttr();
 
        this.range = null;
        this._off( this.document );
 
        this._trigger( "close", event );
    },
 
    widget: function() {
        return this.button;
    },
 
    menuWidget: function() {
        return this.menu;
    },
 
    _renderMenu: function( ul, items ) {
        var that = this,
            currentOptgroup = "";
 
        $.each( items, function( index, item ) {
            if ( item.optgroup !== currentOptgroup ) {
                $( "<li>", {
                    "class": "ui-selectmenu-optgroup ui-menu-divider" +
                        ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
                            " ui-state-disabled" :
                            "" ),
                    text: item.optgroup
                })
                    .appendTo( ul );
 
                currentOptgroup = item.optgroup;
            }
 
            that._renderItemData( ul, item );
        });
    },
 
    _renderItemData: function( ul, item ) {
        return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
    },
 
    _renderItem: function( ul, item ) {
        var li = $( "<li>" );
 
        if ( item.disabled ) {
            li.addClass( "ui-state-disabled" );
        }
        this._setText( li, item.label );
 
        return li.appendTo( ul );
    },
 
    _setText: function( element, value ) {
        if ( value ) {
            element.text( value );
        } else {
            element.html( "&#160;" );
        }
    },
 
    _move: function( direction, event ) {
        var item, next,
            filter = ".ui-menu-item";
 
        if ( this.isOpen ) {
            item = this.menuItems.eq( this.focusIndex );
        } else {
            item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
            filter += ":not(.ui-state-disabled)";
        }
 
        if ( direction === "first" || direction === "last" ) {
            next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
        } else {
            next = item[ direction + "All" ]( filter ).eq( 0 );
        }
 
        if ( next.length ) {
            this.menuInstance.focus( event, next );
        }
    },
 
    _getSelectedItem: function() {
        return this.menuItems.eq( this.element[ 0 ].selectedIndex );
    },
 
    _toggle: function( event ) {
        this[ this.isOpen ? "close" : "open" ]( event );
    },
 
    _setSelection: function() {
        var selection;
 
        if ( !this.range ) {
            return;
        }
 
        if ( window.getSelection ) {
            selection = window.getSelection();
            selection.removeAllRanges();
            selection.addRange( this.range );
 
        // support: IE8
        } else {
            this.range.select();
        }
 
        // support: IE
        // Setting the text selection kills the button focus in IE, but
        // restoring the focus doesn't kill the selection.
        this.button.focus();
    },
 
    _documentClick: {
        mousedown: function( event ) {
            if ( !this.isOpen ) {
                return;
            }
 
            if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
                this.close( event );
            }
        }
    },
 
    _buttonEvents: {
 
        // Prevent text selection from being reset when interacting with the selectmenu (#10144)
        mousedown: function() {
            var selection;
 
            if ( window.getSelection ) {
                selection = window.getSelection();
                if ( selection.rangeCount ) {
                    this.range = selection.getRangeAt( 0 );
                }
 
            // support: IE8
            } else {
                this.range = document.selection.createRange();
            }
        },
 
        click: function( event ) {
            this._setSelection();
            this._toggle( event );
        },
 
        keydown: function( event ) {
            var preventDefault = true;
            switch ( event.keyCode ) {
                case $.ui.keyCode.TAB:
                case $.ui.keyCode.ESCAPE:
                    this.close( event );
                    preventDefault = false;
                    break;
                case $.ui.keyCode.ENTER:
                    if ( this.isOpen ) {
                        this._selectFocusedItem( event );
                    }
                    break;
                case $.ui.keyCode.UP:
                    if ( event.altKey ) {
                        this._toggle( event );
                    } else {
                        this._move( "prev", event );
                    }
                    break;
                case $.ui.keyCode.DOWN:
                    if ( event.altKey ) {
                        this._toggle( event );
                    } else {
                        this._move( "next", event );
                    }
                    break;
                case $.ui.keyCode.SPACE:
                    if ( this.isOpen ) {
                        this._selectFocusedItem( event );
                    } else {
                        this._toggle( event );
                    }
                    break;
                case $.ui.keyCode.LEFT:
                    this._move( "prev", event );
                    break;
                case $.ui.keyCode.RIGHT:
                    this._move( "next", event );
                    break;
                case $.ui.keyCode.HOME:
                case $.ui.keyCode.PAGE_UP:
                    this._move( "first", event );
                    break;
                case $.ui.keyCode.END:
                case $.ui.keyCode.PAGE_DOWN:
                    this._move( "last", event );
                    break;
                default:
                    this.menu.trigger( event );
                    preventDefault = false;
            }
 
            if ( preventDefault ) {
                event.preventDefault();
            }
        }
    },
 
    _selectFocusedItem: function( event ) {
        var item = this.menuItems.eq( this.focusIndex );
        if ( !item.hasClass( "ui-state-disabled" ) ) {
            this._select( item.data( "ui-selectmenu-item" ), event );
        }
    },
 
    _select: function( item, event ) {
        var oldIndex = this.element[ 0 ].selectedIndex;
 
        // Change native select element
        this.element[ 0 ].selectedIndex = item.index;
        this._setText( this.buttonText, item.label );
        this._setAria( item );
        this._trigger( "select", event, { item: item } );
 
        if ( item.index !== oldIndex ) {
            this._trigger( "change", event, { item: item } );
        }
 
        this.close( event );
    },
 
    _setAria: function( item ) {
        var id = this.menuItems.eq( item.index ).attr( "id" );
 
        this.button.attr({
            "aria-labelledby": id,
            "aria-activedescendant": id
        });
        this.menu.attr( "aria-activedescendant", id );
    },
 
    _setOption: function( key, value ) {
        if ( key === "icons" ) {
            this.button.find( "span.ui-icon" )
                .removeClass( this.options.icons.button )
                .addClass( value.button );
        }
 
        this._super( key, value );
 
        if ( key === "appendTo" ) {
            this.menuWrap.appendTo( this._appendTo() );
        }
 
        if ( key === "disabled" ) {
            this.menuInstance.option( "disabled", value );
            this.button
                .toggleClass( "ui-state-disabled", value )
                .attr( "aria-disabled", value );
 
            this.element.prop( "disabled", value );
            if ( value ) {
                this.button.attr( "tabindex", -1 );
                this.close();
            } else {
                this.button.attr( "tabindex", 0 );
            }
        }
 
        if ( key === "width" ) {
            this._resizeButton();
        }
    },
 
    _appendTo: function() {
        var element = this.options.appendTo;
 
        if ( element ) {
            element = element.jquery || element.nodeType ?
                $( element ) :
                this.document.find( element ).eq( 0 );
        }
 
        if ( !element || !element[ 0 ] ) {
            element = this.element.closest( ".ui-front" );
        }
 
        if ( !element.length ) {
            element = this.document[ 0 ].body;
        }
 
        return element;
    },
 
    _toggleAttr: function() {
        this.button
            .toggleClass( "ui-corner-top", this.isOpen )
            .toggleClass( "ui-corner-all", !this.isOpen )
            .attr( "aria-expanded", this.isOpen );
        this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
        this.menu.attr( "aria-hidden", !this.isOpen );
    },
 
    _resizeButton: function() {
        var width = this.options.width;
 
        if ( !width ) {
            width = this.element.show().outerWidth();
            this.element.hide();
        }
 
        this.button.outerWidth( width );
    },
 
    _resizeMenu: function() {
        this.menu.outerWidth( Math.max(
            this.button.outerWidth(),
 
            // support: IE10
            // IE10 wraps long text (possibly a rounding bug)
            // so we add 1px to avoid the wrapping
            this.menu.width( "" ).outerWidth() + 1
        ) );
    },
 
    _getCreateOptions: function() {
        return { disabled: this.element.prop( "disabled" ) };
    },
 
    _parseOptions: function( options ) {
        var data = [];
        options.each(function( index, item ) {
            var option = $( item ),
                optgroup = option.parent( "optgroup" );
            data.push({
                element: option,
                index: index,
                value: option.val(),
                label: option.text(),
                optgroup: optgroup.attr( "label" ) || "",
                disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
            });
        });
        this.items = data;
    },
 
    _destroy: function() {
        this.menuWrap.remove();
        this.button.remove();
        this.element.show();
        this.element.removeUniqueId();
        this.label.attr( "for", this.ids.element );
    }
});
 
 
/*!
 * jQuery UI Slider 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/slider/
 */
 
 
var slider = $.widget( "ui.slider", $.ui.mouse, {
    version: "1.11.4",
    widgetEventPrefix: "slide",
 
    options: {
        animate: false,
        distance: 0,
        max: 100,
        min: 0,
        orientation: "horizontal",
        range: false,
        step: 1,
        value: 0,
        values: null,
 
        // callbacks
        change: null,
        slide: null,
        start: null,
        stop: null
    },
 
    // number of pages in a slider
    // (how many times can you page up/down to go through the whole range)
    numPages: 5,
 
    _create: function() {
        this._keySliding = false;
        this._mouseSliding = false;
        this._animateOff = true;
        this._handleIndex = null;
        this._detectOrientation();
        this._mouseInit();
        this._calculateNewMax();
 
        this.element
            .addClass( "ui-slider" +
                " ui-slider-" + this.orientation +
                " ui-widget" +
                " ui-widget-content" +
                " ui-corner-all");
 
        this._refresh();
        this._setOption( "disabled", this.options.disabled );
 
        this._animateOff = false;
    },
 
    _refresh: function() {
        this._createRange();
        this._createHandles();
        this._setupEvents();
        this._refreshValue();
    },
 
    _createHandles: function() {
        var i, handleCount,
            options = this.options,
            existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
            handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
            handles = [];
 
        handleCount = ( options.values && options.values.length ) || 1;
 
        if ( existingHandles.length > handleCount ) {
            existingHandles.slice( handleCount ).remove();
            existingHandles = existingHandles.slice( 0, handleCount );
        }
 
        for ( i = existingHandles.length; i < handleCount; i++ ) {
            handles.push( handle );
        }
 
        this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
 
        this.handle = this.handles.eq( 0 );
 
        this.handles.each(function( i ) {
            $( this ).data( "ui-slider-handle-index", i );
        });
    },
 
    _createRange: function() {
        var options = this.options,
            classes = "";
 
        if ( options.range ) {
            if ( options.range === true ) {
                if ( !options.values ) {
                    options.values = [ this._valueMin(), this._valueMin() ];
                } else if ( options.values.length && options.values.length !== 2 ) {
                    options.values = [ options.values[0], options.values[0] ];
                } else if ( $.isArray( options.values ) ) {
                    options.values = options.values.slice(0);
                }
            }
 
            if ( !this.range || !this.range.length ) {
                this.range = $( "<div></div>" )
                    .appendTo( this.element );
 
                classes = "ui-slider-range" +
                // note: this isn't the most fittingly semantic framework class for this element,
                // but worked best visually with a variety of themes
                " ui-widget-header ui-corner-all";
            } else {
                this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
                    // Handle range switching from true to min/max
                    .css({
                        "left": "",
                        "bottom": ""
                    });
            }
 
            this.range.addClass( classes +
                ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
        } else {
            if ( this.range ) {
                this.range.remove();
            }
            this.range = null;
        }
    },
 
    _setupEvents: function() {
        this._off( this.handles );
        this._on( this.handles, this._handleEvents );
        this._hoverable( this.handles );
        this._focusable( this.handles );
    },
 
    _destroy: function() {
        this.handles.remove();
        if ( this.range ) {
            this.range.remove();
        }
 
        this.element
            .removeClass( "ui-slider" +
                " ui-slider-horizontal" +
                " ui-slider-vertical" +
                " ui-widget" +
                " ui-widget-content" +
                " ui-corner-all" );
 
        this._mouseDestroy();
    },
 
    _mouseCapture: function( event ) {
        var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
            that = this,
            o = this.options;
 
        if ( o.disabled ) {
            return false;
        }
 
        this.elementSize = {
            width: this.element.outerWidth(),
            height: this.element.outerHeight()
        };
        this.elementOffset = this.element.offset();
 
        position = { x: event.pageX, y: event.pageY };
        normValue = this._normValueFromMouse( position );
        distance = this._valueMax() - this._valueMin() + 1;
        this.handles.each(function( i ) {
            var thisDistance = Math.abs( normValue - that.values(i) );
            if (( distance > thisDistance ) ||
                ( distance === thisDistance &&
                    (i === that._lastChangedValue || that.values(i) === o.min ))) {
                distance = thisDistance;
                closestHandle = $( this );
                index = i;
            }
        });
 
        allowed = this._start( event, index );
        if ( allowed === false ) {
            return false;
        }
        this._mouseSliding = true;
 
        this._handleIndex = index;
 
        closestHandle
            .addClass( "ui-state-active" )
            .focus();
 
        offset = closestHandle.offset();
        mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
        this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
            left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
            top: event.pageY - offset.top -
                ( closestHandle.height() / 2 ) -
                ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
                ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
                ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
        };
 
        if ( !this.handles.hasClass( "ui-state-hover" ) ) {
            this._slide( event, index, normValue );
        }
        this._animateOff = true;
        return true;
    },
 
    _mouseStart: function() {
        return true;
    },
 
    _mouseDrag: function( event ) {
        var position = { x: event.pageX, y: event.pageY },
            normValue = this._normValueFromMouse( position );
 
        this._slide( event, this._handleIndex, normValue );
 
        return false;
    },
 
    _mouseStop: function( event ) {
        this.handles.removeClass( "ui-state-active" );
        this._mouseSliding = false;
 
        this._stop( event, this._handleIndex );
        this._change( event, this._handleIndex );
 
        this._handleIndex = null;
        this._clickOffset = null;
        this._animateOff = false;
 
        return false;
    },
 
    _detectOrientation: function() {
        this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
    },
 
    _normValueFromMouse: function( position ) {
        var pixelTotal,
            pixelMouse,
            percentMouse,
            valueTotal,
            valueMouse;
 
        if ( this.orientation === "horizontal" ) {
            pixelTotal = this.elementSize.width;
            pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
        } else {
            pixelTotal = this.elementSize.height;
            pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
        }
 
        percentMouse = ( pixelMouse / pixelTotal );
        if ( percentMouse > 1 ) {
            percentMouse = 1;
        }
        if ( percentMouse < 0 ) {
            percentMouse = 0;
        }
        if ( this.orientation === "vertical" ) {
            percentMouse = 1 - percentMouse;
        }
 
        valueTotal = this._valueMax() - this._valueMin();
        valueMouse = this._valueMin() + percentMouse * valueTotal;
 
        return this._trimAlignValue( valueMouse );
    },
 
    _start: function( event, index ) {
        var uiHash = {
            handle: this.handles[ index ],
            value: this.value()
        };
        if ( this.options.values && this.options.values.length ) {
            uiHash.value = this.values( index );
            uiHash.values = this.values();
        }
        return this._trigger( "start", event, uiHash );
    },
 
    _slide: function( event, index, newVal ) {
        var otherVal,
            newValues,
            allowed;
 
        if ( this.options.values && this.options.values.length ) {
            otherVal = this.values( index ? 0 : 1 );
 
            if ( ( this.options.values.length === 2 && this.options.range === true ) &&
                    ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
                ) {
                newVal = otherVal;
            }
 
            if ( newVal !== this.values( index ) ) {
                newValues = this.values();
                newValues[ index ] = newVal;
                // A slide can be canceled by returning false from the slide callback
                allowed = this._trigger( "slide", event, {
                    handle: this.handles[ index ],
                    value: newVal,
                    values: newValues
                } );
                otherVal = this.values( index ? 0 : 1 );
                if ( allowed !== false ) {
                    this.values( index, newVal );
                }
            }
        } else {
            if ( newVal !== this.value() ) {
                // A slide can be canceled by returning false from the slide callback
                allowed = this._trigger( "slide", event, {
                    handle: this.handles[ index ],
                    value: newVal
                } );
                if ( allowed !== false ) {
                    this.value( newVal );
                }
            }
        }
    },
 
    _stop: function( event, index ) {
        var uiHash = {
            handle: this.handles[ index ],
            value: this.value()
        };
        if ( this.options.values && this.options.values.length ) {
            uiHash.value = this.values( index );
            uiHash.values = this.values();
        }
 
        this._trigger( "stop", event, uiHash );
    },
 
    _change: function( event, index ) {
        if ( !this._keySliding && !this._mouseSliding ) {
            var uiHash = {
                handle: this.handles[ index ],
                value: this.value()
            };
            if ( this.options.values && this.options.values.length ) {
                uiHash.value = this.values( index );
                uiHash.values = this.values();
            }
 
            //store the last changed value index for reference when handles overlap
            this._lastChangedValue = index;
 
            this._trigger( "change", event, uiHash );
        }
    },
 
    value: function( newValue ) {
        if ( arguments.length ) {
            this.options.value = this._trimAlignValue( newValue );
            this._refreshValue();
            this._change( null, 0 );
            return;
        }
 
        return this._value();
    },
 
    values: function( index, newValue ) {
        var vals,
            newValues,
            i;
 
        if ( arguments.length > 1 ) {
            this.options.values[ index ] = this._trimAlignValue( newValue );
            this._refreshValue();
            this._change( null, index );
            return;
        }
 
        if ( arguments.length ) {
            if ( $.isArray( arguments[ 0 ] ) ) {
                vals = this.options.values;
                newValues = arguments[ 0 ];
                for ( i = 0; i < vals.length; i += 1 ) {
                    vals[ i ] = this._trimAlignValue( newValues[ i ] );
                    this._change( null, i );
                }
                this._refreshValue();
            } else {
                if ( this.options.values && this.options.values.length ) {
                    return this._values( index );
                } else {
                    return this.value();
                }
            }
        } else {
            return this._values();
        }
    },
 
    _setOption: function( key, value ) {
        var i,
            valsLength = 0;
 
        if ( key === "range" && this.options.range === true ) {
            if ( value === "min" ) {
                this.options.value = this._values( 0 );
                this.options.values = null;
            } else if ( value === "max" ) {
                this.options.value = this._values( this.options.values.length - 1 );
                this.options.values = null;
            }
        }
 
        if ( $.isArray( this.options.values ) ) {
            valsLength = this.options.values.length;
        }
 
        if ( key === "disabled" ) {
            this.element.toggleClass( "ui-state-disabled", !!value );
        }
 
        this._super( key, value );
 
        switch ( key ) {
            case "orientation":
                this._detectOrientation();
                this.element
                    .removeClass( "ui-slider-horizontal ui-slider-vertical" )
                    .addClass( "ui-slider-" + this.orientation );
                this._refreshValue();
 
                // Reset positioning from previous orientation
                this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
                break;
            case "value":
                this._animateOff = true;
                this._refreshValue();
                this._change( null, 0 );
                this._animateOff = false;
                break;
            case "values":
                this._animateOff = true;
                this._refreshValue();
                for ( i = 0; i < valsLength; i += 1 ) {
                    this._change( null, i );
                }
                this._animateOff = false;
                break;
            case "step":
            case "min":
            case "max":
                this._animateOff = true;
                this._calculateNewMax();
                this._refreshValue();
                this._animateOff = false;
                break;
            case "range":
                this._animateOff = true;
                this._refresh();
                this._animateOff = false;
                break;
        }
    },
 
    //internal value getter
    // _value() returns value trimmed by min and max, aligned by step
    _value: function() {
        var val = this.options.value;
        val = this._trimAlignValue( val );
 
        return val;
    },
 
    //internal values getter
    // _values() returns array of values trimmed by min and max, aligned by step
    // _values( index ) returns single value trimmed by min and max, aligned by step
    _values: function( index ) {
        var val,
            vals,
            i;
 
        if ( arguments.length ) {
            val = this.options.values[ index ];
            val = this._trimAlignValue( val );
 
            return val;
        } else if ( this.options.values && this.options.values.length ) {
            // .slice() creates a copy of the array
            // this copy gets trimmed by min and max and then returned
            vals = this.options.values.slice();
            for ( i = 0; i < vals.length; i += 1) {
                vals[ i ] = this._trimAlignValue( vals[ i ] );
            }
 
            return vals;
        } else {
            return [];
        }
    },
 
    // returns the step-aligned value that val is closest to, between (inclusive) min and max
    _trimAlignValue: function( val ) {
        if ( val <= this._valueMin() ) {
            return this._valueMin();
        }
        if ( val >= this._valueMax() ) {
            return this._valueMax();
        }
        var step = ( this.options.step > 0 ) ? this.options.step : 1,
            valModStep = (val - this._valueMin()) % step,
            alignValue = val - valModStep;
 
        if ( Math.abs(valModStep) * 2 >= step ) {
            alignValue += ( valModStep > 0 ) ? step : ( -step );
        }
 
        // Since JavaScript has problems with large floats, round
        // the final value to 5 digits after the decimal point (see #4124)
        return parseFloat( alignValue.toFixed(5) );
    },
 
    _calculateNewMax: function() {
        var max = this.options.max,
            min = this._valueMin(),
            step = this.options.step,
            aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
        max = aboveMin + min;
        this.max = parseFloat( max.toFixed( this._precision() ) );
    },
 
    _precision: function() {
        var precision = this._precisionOf( this.options.step );
        if ( this.options.min !== null ) {
            precision = Math.max( precision, this._precisionOf( this.options.min ) );
        }
        return precision;
    },
 
    _precisionOf: function( num ) {
        var str = num.toString(),
            decimal = str.indexOf( "." );
        return decimal === -1 ? 0 : str.length - decimal - 1;
    },
 
    _valueMin: function() {
        return this.options.min;
    },
 
    _valueMax: function() {
        return this.max;
    },
 
    _refreshValue: function() {
        var lastValPercent, valPercent, value, valueMin, valueMax,
            oRange = this.options.range,
            o = this.options,
            that = this,
            animate = ( !this._animateOff ) ? o.animate : false,
            _set = {};
 
        if ( this.options.values && this.options.values.length ) {
            this.handles.each(function( i ) {
                valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
                _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
                $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
                if ( that.options.range === true ) {
                    if ( that.orientation === "horizontal" ) {
                        if ( i === 0 ) {
                            that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
                        }
                        if ( i === 1 ) {
                            that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
                        }
                    } else {
                        if ( i === 0 ) {
                            that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
                        }
                        if ( i === 1 ) {
                            that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
                        }
                    }
                }
                lastValPercent = valPercent;
            });
        } else {
            value = this.value();
            valueMin = this._valueMin();
            valueMax = this._valueMax();
            valPercent = ( valueMax !== valueMin ) ?
                    ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
                    0;
            _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
            this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
 
            if ( oRange === "min" && this.orientation === "horizontal" ) {
                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
            }
            if ( oRange === "max" && this.orientation === "horizontal" ) {
                this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
            }
            if ( oRange === "min" && this.orientation === "vertical" ) {
                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
            }
            if ( oRange === "max" && this.orientation === "vertical" ) {
                this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
            }
        }
    },
 
    _handleEvents: {
        keydown: function( event ) {
            var allowed, curVal, newVal, step,
                index = $( event.target ).data( "ui-slider-handle-index" );
 
            switch ( event.keyCode ) {
                case $.ui.keyCode.HOME:
                case $.ui.keyCode.END:
                case $.ui.keyCode.PAGE_UP:
                case $.ui.keyCode.PAGE_DOWN:
                case $.ui.keyCode.UP:
                case $.ui.keyCode.RIGHT:
                case $.ui.keyCode.DOWN:
                case $.ui.keyCode.LEFT:
                    event.preventDefault();
                    if ( !this._keySliding ) {
                        this._keySliding = true;
                        $( event.target ).addClass( "ui-state-active" );
                        allowed = this._start( event, index );
                        if ( allowed === false ) {
                            return;
                        }
                    }
                    break;
            }
 
            step = this.options.step;
            if ( this.options.values && this.options.values.length ) {
                curVal = newVal = this.values( index );
            } else {
                curVal = newVal = this.value();
            }
 
            switch ( event.keyCode ) {
                case $.ui.keyCode.HOME:
                    newVal = this._valueMin();
                    break;
                case $.ui.keyCode.END:
                    newVal = this._valueMax();
                    break;
                case $.ui.keyCode.PAGE_UP:
                    newVal = this._trimAlignValue(
                        curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
                    );
                    break;
                case $.ui.keyCode.PAGE_DOWN:
                    newVal = this._trimAlignValue(
                        curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
                    break;
                case $.ui.keyCode.UP:
                case $.ui.keyCode.RIGHT:
                    if ( curVal === this._valueMax() ) {
                        return;
                    }
                    newVal = this._trimAlignValue( curVal + step );
                    break;
                case $.ui.keyCode.DOWN:
                case $.ui.keyCode.LEFT:
                    if ( curVal === this._valueMin() ) {
                        return;
                    }
                    newVal = this._trimAlignValue( curVal - step );
                    break;
            }
 
            this._slide( event, index, newVal );
        },
        keyup: function( event ) {
            var index = $( event.target ).data( "ui-slider-handle-index" );
 
            if ( this._keySliding ) {
                this._keySliding = false;
                this._stop( event, index );
                this._change( event, index );
                $( event.target ).removeClass( "ui-state-active" );
            }
        }
    }
});
 
 
/*!
 * jQuery UI Spinner 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/spinner/
 */
 
 
function spinner_modifier( fn ) {
    return function() {
        var previous = this.element.val();
        fn.apply( this, arguments );
        this._refresh();
        if ( previous !== this.element.val() ) {
            this._trigger( "change" );
        }
    };
}
 
var spinner = $.widget( "ui.spinner", {
    version: "1.11.4",
    defaultElement: "<input>",
    widgetEventPrefix: "spin",
    options: {
        culture: null,
        icons: {
            down: "ui-icon-triangle-1-s",
            up: "ui-icon-triangle-1-n"
        },
        incremental: true,
        max: null,
        min: null,
        numberFormat: null,
        page: 10,
        step: 1,
 
        change: null,
        spin: null,
        start: null,
        stop: null
    },
 
    _create: function() {
        // handle string values that need to be parsed
        this._setOption( "max", this.options.max );
        this._setOption( "min", this.options.min );
        this._setOption( "step", this.options.step );
 
        // Only format if there is a value, prevents the field from being marked
        // as invalid in Firefox, see #9573.
        if ( this.value() !== "" ) {
            // Format the value, but don't constrain.
            this._value( this.element.val(), true );
        }
 
        this._draw();
        this._on( this._events );
        this._refresh();
 
        // turning off autocomplete prevents the browser from remembering the
        // value when navigating through history, so we re-enable autocomplete
        // if the page is unloaded before the widget is destroyed. #7790
        this._on( this.window, {
            beforeunload: function() {
                this.element.removeAttr( "autocomplete" );
            }
        });
    },
 
    _getCreateOptions: function() {
        var options = {},
            element = this.element;
 
        $.each( [ "min", "max", "step" ], function( i, option ) {
            var value = element.attr( option );
            if ( value !== undefined && value.length ) {
                options[ option ] = value;
            }
        });
 
        return options;
    },
 
    _events: {
        keydown: function( event ) {
            if ( this._start( event ) && this._keydown( event ) ) {
                event.preventDefault();
            }
        },
        keyup: "_stop",
        focus: function() {
            this.previous = this.element.val();
        },
        blur: function( event ) {
            if ( this.cancelBlur ) {
                delete this.cancelBlur;
                return;
            }
 
            this._stop();
            this._refresh();
            if ( this.previous !== this.element.val() ) {
                this._trigger( "change", event );
            }
        },
        mousewheel: function( event, delta ) {
            if ( !delta ) {
                return;
            }
            if ( !this.spinning && !this._start( event ) ) {
                return false;
            }
 
            this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
            clearTimeout( this.mousewheelTimer );
            this.mousewheelTimer = this._delay(function() {
                if ( this.spinning ) {
                    this._stop( event );
                }
            }, 100 );
            event.preventDefault();
        },
        "mousedown .ui-spinner-button": function( event ) {
            var previous;
 
            // We never want the buttons to have focus; whenever the user is
            // interacting with the spinner, the focus should be on the input.
            // If the input is focused then this.previous is properly set from
            // when the input first received focus. If the input is not focused
            // then we need to set this.previous based on the value before spinning.
            previous = this.element[0] === this.document[0].activeElement ?
                this.previous : this.element.val();
            function checkFocus() {
                var isActive = this.element[0] === this.document[0].activeElement;
                if ( !isActive ) {
                    this.element.focus();
                    this.previous = previous;
                    // support: IE
                    // IE sets focus asynchronously, so we need to check if focus
                    // moved off of the input because the user clicked on the button.
                    this._delay(function() {
                        this.previous = previous;
                    });
                }
            }
 
            // ensure focus is on (or stays on) the text field
            event.preventDefault();
            checkFocus.call( this );
 
            // support: IE
            // IE doesn't prevent moving focus even with event.preventDefault()
            // so we set a flag to know when we should ignore the blur event
            // and check (again) if focus moved off of the input.
            this.cancelBlur = true;
            this._delay(function() {
                delete this.cancelBlur;
                checkFocus.call( this );
            });
 
            if ( this._start( event ) === false ) {
                return;
            }
 
            this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
        },
        "mouseup .ui-spinner-button": "_stop",
        "mouseenter .ui-spinner-button": function( event ) {
            // button will add ui-state-active if mouse was down while mouseleave and kept down
            if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
                return;
            }
 
            if ( this._start( event ) === false ) {
                return false;
            }
            this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
        },
        // TODO: do we really want to consider this a stop?
        // shouldn't we just stop the repeater and wait until mouseup before
        // we trigger the stop event?
        "mouseleave .ui-spinner-button": "_stop"
    },
 
    _draw: function() {
        var uiSpinner = this.uiSpinner = this.element
            .addClass( "ui-spinner-input" )
            .attr( "autocomplete", "off" )
            .wrap( this._uiSpinnerHtml() )
            .parent()
                // add buttons
                .append( this._buttonHtml() );
 
        this.element.attr( "role", "spinbutton" );
 
        // button bindings
        this.buttons = uiSpinner.find( ".ui-spinner-button" )
            .attr( "tabIndex", -1 )
            .button()
            .removeClass( "ui-corner-all" );
 
        // IE 6 doesn't understand height: 50% for the buttons
        // unless the wrapper has an explicit height
        if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
                uiSpinner.height() > 0 ) {
            uiSpinner.height( uiSpinner.height() );
        }
 
        // disable spinner if element was already disabled
        if ( this.options.disabled ) {
            this.disable();
        }
    },
 
    _keydown: function( event ) {
        var options = this.options,
            keyCode = $.ui.keyCode;
 
        switch ( event.keyCode ) {
        case keyCode.UP:
            this._repeat( null, 1, event );
            return true;
        case keyCode.DOWN:
            this._repeat( null, -1, event );
            return true;
        case keyCode.PAGE_UP:
            this._repeat( null, options.page, event );
            return true;
        case keyCode.PAGE_DOWN:
            this._repeat( null, -options.page, event );
            return true;
        }
 
        return false;
    },
 
    _uiSpinnerHtml: function() {
        return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
    },
 
    _buttonHtml: function() {
        return "" +
            "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
                "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
            "</a>" +
            "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
                "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
            "</a>";
    },
 
    _start: function( event ) {
        if ( !this.spinning && this._trigger( "start", event ) === false ) {
            return false;
        }
 
        if ( !this.counter ) {
            this.counter = 1;
        }
        this.spinning = true;
        return true;
    },
 
    _repeat: function( i, steps, event ) {
        i = i || 500;
 
        clearTimeout( this.timer );
        this.timer = this._delay(function() {
            this._repeat( 40, steps, event );
        }, i );
 
        this._spin( steps * this.options.step, event );
    },
 
    _spin: function( step, event ) {
        var value = this.value() || 0;
 
        if ( !this.counter ) {
            this.counter = 1;
        }
 
        value = this._adjustValue( value + step * this._increment( this.counter ) );
 
        if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
            this._value( value );
            this.counter++;
        }
    },
 
    _increment: function( i ) {
        var incremental = this.options.incremental;
 
        if ( incremental ) {
            return $.isFunction( incremental ) ?
                incremental( i ) :
                Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
        }
 
        return 1;
    },
 
    _precision: function() {
        var precision = this._precisionOf( this.options.step );
        if ( this.options.min !== null ) {
            precision = Math.max( precision, this._precisionOf( this.options.min ) );
        }
        return precision;
    },
 
    _precisionOf: function( num ) {
        var str = num.toString(),
            decimal = str.indexOf( "." );
        return decimal === -1 ? 0 : str.length - decimal - 1;
    },
 
    _adjustValue: function( value ) {
        var base, aboveMin,
            options = this.options;
 
        // make sure we're at a valid step
        // - find out where we are relative to the base (min or 0)
        base = options.min !== null ? options.min : 0;
        aboveMin = value - base;
        // - round to the nearest step
        aboveMin = Math.round(aboveMin / options.step) * options.step;
        // - rounding is based on 0, so adjust back to our base
        value = base + aboveMin;
 
        // fix precision from bad JS floating point math
        value = parseFloat( value.toFixed( this._precision() ) );
 
        // clamp the value
        if ( options.max !== null && value > options.max) {
            return options.max;
        }
        if ( options.min !== null && value < options.min ) {
            return options.min;
        }
 
        return value;
    },
 
    _stop: function( event ) {
        if ( !this.spinning ) {
            return;
        }
 
        clearTimeout( this.timer );
        clearTimeout( this.mousewheelTimer );
        this.counter = 0;
        this.spinning = false;
        this._trigger( "stop", event );
    },
 
    _setOption: function( key, value ) {
        if ( key === "culture" || key === "numberFormat" ) {
            var prevValue = this._parse( this.element.val() );
            this.options[ key ] = value;
            this.element.val( this._format( prevValue ) );
            return;
        }
 
        if ( key === "max" || key === "min" || key === "step" ) {
            if ( typeof value === "string" ) {
                value = this._parse( value );
            }
        }
        if ( key === "icons" ) {
            this.buttons.first().find( ".ui-icon" )
                .removeClass( this.options.icons.up )
                .addClass( value.up );
            this.buttons.last().find( ".ui-icon" )
                .removeClass( this.options.icons.down )
                .addClass( value.down );
        }
 
        this._super( key, value );
 
        if ( key === "disabled" ) {
            this.widget().toggleClass( "ui-state-disabled", !!value );
            this.element.prop( "disabled", !!value );
            this.buttons.button( value ? "disable" : "enable" );
        }
    },
 
    _setOptions: spinner_modifier(function( options ) {
        this._super( options );
    }),
 
    _parse: function( val ) {
        if ( typeof val === "string" && val !== "" ) {
            val = window.Globalize && this.options.numberFormat ?
                Globalize.parseFloat( val, 10, this.options.culture ) : +val;
        }
        return val === "" || isNaN( val ) ? null : val;
    },
 
    _format: function( value ) {
        if ( value === "" ) {
            return "";
        }
        return window.Globalize && this.options.numberFormat ?
            Globalize.format( value, this.options.numberFormat, this.options.culture ) :
            value;
    },
 
    _refresh: function() {
        this.element.attr({
            "aria-valuemin": this.options.min,
            "aria-valuemax": this.options.max,
            // TODO: what should we do with values that can't be parsed?
            "aria-valuenow": this._parse( this.element.val() )
        });
    },
 
    isValid: function() {
        var value = this.value();
 
        // null is invalid
        if ( value === null ) {
            return false;
        }
 
        // if value gets adjusted, it's invalid
        return value === this._adjustValue( value );
    },
 
    // update the value without triggering change
    _value: function( value, allowAny ) {
        var parsed;
        if ( value !== "" ) {
            parsed = this._parse( value );
            if ( parsed !== null ) {
                if ( !allowAny ) {
                    parsed = this._adjustValue( parsed );
                }
                value = this._format( parsed );
            }
        }
        this.element.val( value );
        this._refresh();
    },
 
    _destroy: function() {
        this.element
            .removeClass( "ui-spinner-input" )
            .prop( "disabled", false )
            .removeAttr( "autocomplete" )
            .removeAttr( "role" )
            .removeAttr( "aria-valuemin" )
            .removeAttr( "aria-valuemax" )
            .removeAttr( "aria-valuenow" );
        this.uiSpinner.replaceWith( this.element );
    },
 
    stepUp: spinner_modifier(function( steps ) {
        this._stepUp( steps );
    }),
    _stepUp: function( steps ) {
        if ( this._start() ) {
            this._spin( (steps || 1) * this.options.step );
            this._stop();
        }
    },
 
    stepDown: spinner_modifier(function( steps ) {
        this._stepDown( steps );
    }),
    _stepDown: function( steps ) {
        if ( this._start() ) {
            this._spin( (steps || 1) * -this.options.step );
            this._stop();
        }
    },
 
    pageUp: spinner_modifier(function( pages ) {
        this._stepUp( (pages || 1) * this.options.page );
    }),
 
    pageDown: spinner_modifier(function( pages ) {
        this._stepDown( (pages || 1) * this.options.page );
    }),
 
    value: function( newVal ) {
        if ( !arguments.length ) {
            return this._parse( this.element.val() );
        }
        spinner_modifier( this._value ).call( this, newVal );
    },
 
    widget: function() {
        return this.uiSpinner;
    }
});
 
 
/*!
 * jQuery UI Tabs 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/tabs/
 */
 
 
var tabs = $.widget( "ui.tabs", {
    version: "1.11.4",
    delay: 300,
    options: {
        active: null,
        collapsible: false,
        event: "click",
        heightStyle: "content",
        hide: null,
        show: null,
 
        // callbacks
        activate: null,
        beforeActivate: null,
        beforeLoad: null,
        load: null
    },
 
    _isLocal: (function() {
        var rhash = /#.*$/;
 
        return function( anchor ) {
            var anchorUrl, locationUrl;
 
            // support: IE7
            // IE7 doesn't normalize the href property when set via script (#9317)
            anchor = anchor.cloneNode( false );
 
            anchorUrl = anchor.href.replace( rhash, "" );
            locationUrl = location.href.replace( rhash, "" );
 
            // decoding may throw an error if the URL isn't UTF-8 (#9518)
            try {
                anchorUrl = decodeURIComponent( anchorUrl );
            } catch ( error ) {}
            try {
                locationUrl = decodeURIComponent( locationUrl );
            } catch ( error ) {}
 
            return anchor.hash.length > 1 && anchorUrl === locationUrl;
        };
    })(),
 
    _create: function() {
        var that = this,
            options = this.options;
 
        this.running = false;
 
        this.element
            .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
            .toggleClass( "ui-tabs-collapsible", options.collapsible );
 
        this._processTabs();
        options.active = this._initialActive();
 
        // Take disabling tabs via class attribute from HTML
        // into account and update option properly.
        if ( $.isArray( options.disabled ) ) {
            options.disabled = $.unique( options.disabled.concat(
                $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
                    return that.tabs.index( li );
                })
            ) ).sort();
        }
 
        // check for length avoids error when initializing empty list
        if ( this.options.active !== false && this.anchors.length ) {
            this.active = this._findActive( options.active );
        } else {
            this.active = $();
        }
 
        this._refresh();
 
        if ( this.active.length ) {
            this.load( options.active );
        }
    },
 
    _initialActive: function() {
        var active = this.options.active,
            collapsible = this.options.collapsible,
            locationHash = location.hash.substring( 1 );
 
        if ( active === null ) {
            // check the fragment identifier in the URL
            if ( locationHash ) {
                this.tabs.each(function( i, tab ) {
                    if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
                        active = i;
                        return false;
                    }
                });
            }
 
            // check for a tab marked active via a class
            if ( active === null ) {
                active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
            }
 
            // no active tab, set to false
            if ( active === null || active === -1 ) {
                active = this.tabs.length ? 0 : false;
            }
        }
 
        // handle numbers: negative, out of range
        if ( active !== false ) {
            active = this.tabs.index( this.tabs.eq( active ) );
            if ( active === -1 ) {
                active = collapsible ? false : 0;
            }
        }
 
        // don't allow collapsible: false and active: false
        if ( !collapsible && active === false && this.anchors.length ) {
            active = 0;
        }
 
        return active;
    },
 
    _getCreateEventData: function() {
        return {
            tab: this.active,
            panel: !this.active.length ? $() : this._getPanelForTab( this.active )
        };
    },
 
    _tabKeydown: function( event ) {
        var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
            selectedIndex = this.tabs.index( focusedTab ),
            goingForward = true;
 
        if ( this._handlePageNav( event ) ) {
            return;
        }
 
        switch ( event.keyCode ) {
            case $.ui.keyCode.RIGHT:
            case $.ui.keyCode.DOWN:
                selectedIndex++;
                break;
            case $.ui.keyCode.UP:
            case $.ui.keyCode.LEFT:
                goingForward = false;
                selectedIndex--;
                break;
            case $.ui.keyCode.END:
                selectedIndex = this.anchors.length - 1;
                break;
            case $.ui.keyCode.HOME:
                selectedIndex = 0;
                break;
            case $.ui.keyCode.SPACE:
                // Activate only, no collapsing
                event.preventDefault();
                clearTimeout( this.activating );
                this._activate( selectedIndex );
                return;
            case $.ui.keyCode.ENTER:
                // Toggle (cancel delayed activation, allow collapsing)
                event.preventDefault();
                clearTimeout( this.activating );
                // Determine if we should collapse or activate
                this._activate( selectedIndex === this.options.active ? false : selectedIndex );
                return;
            default:
                return;
        }
 
        // Focus the appropriate tab, based on which key was pressed
        event.preventDefault();
        clearTimeout( this.activating );
        selectedIndex = this._focusNextTab( selectedIndex, goingForward );
 
        // Navigating with control/command key will prevent automatic activation
        if ( !event.ctrlKey && !event.metaKey ) {
 
            // Update aria-selected immediately so that AT think the tab is already selected.
            // Otherwise AT may confuse the user by stating that they need to activate the tab,
            // but the tab will already be activated by the time the announcement finishes.
            focusedTab.attr( "aria-selected", "false" );
            this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
 
            this.activating = this._delay(function() {
                this.option( "active", selectedIndex );
            }, this.delay );
        }
    },
 
    _panelKeydown: function( event ) {
        if ( this._handlePageNav( event ) ) {
            return;
        }
 
        // Ctrl+up moves focus to the current tab
        if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
            event.preventDefault();
            this.active.focus();
        }
    },
 
    // Alt+page up/down moves focus to the previous/next tab (and activates)
    _handlePageNav: function( event ) {
        if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
            this._activate( this._focusNextTab( this.options.active - 1, false ) );
            return true;
        }
        if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
            this._activate( this._focusNextTab( this.options.active + 1, true ) );
            return true;
        }
    },
 
    _findNextTab: function( index, goingForward ) {
        var lastTabIndex = this.tabs.length - 1;
 
        function constrain() {
            if ( index > lastTabIndex ) {
                index = 0;
            }
            if ( index < 0 ) {
                index = lastTabIndex;
            }
            return index;
        }
 
        while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
            index = goingForward ? index + 1 : index - 1;
        }
 
        return index;
    },
 
    _focusNextTab: function( index, goingForward ) {
        index = this._findNextTab( index, goingForward );
        this.tabs.eq( index ).focus();
        return index;
    },
 
    _setOption: function( key, value ) {
        if ( key === "active" ) {
            // _activate() will handle invalid values and update this.options
            this._activate( value );
            return;
        }
 
        if ( key === "disabled" ) {
            // don't use the widget factory's disabled handling
            this._setupDisabled( value );
            return;
        }
 
        this._super( key, value);
 
        if ( key === "collapsible" ) {
            this.element.toggleClass( "ui-tabs-collapsible", value );
            // Setting collapsible: false while collapsed; open first panel
            if ( !value && this.options.active === false ) {
                this._activate( 0 );
            }
        }
 
        if ( key === "event" ) {
            this._setupEvents( value );
        }
 
        if ( key === "heightStyle" ) {
            this._setupHeightStyle( value );
        }
    },
 
    _sanitizeSelector: function( hash ) {
        return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
    },
 
    refresh: function() {
        var options = this.options,
            lis = this.tablist.children( ":has(a[href])" );
 
        // get disabled tabs from class attribute from HTML
        // this will get converted to a boolean if needed in _refresh()
        options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
            return lis.index( tab );
        });
 
        this._processTabs();
 
        // was collapsed or no tabs
        if ( options.active === false || !this.anchors.length ) {
            options.active = false;
            this.active = $();
        // was active, but active tab is gone
        } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
            // all remaining tabs are disabled
            if ( this.tabs.length === options.disabled.length ) {
                options.active = false;
                this.active = $();
            // activate previous tab
            } else {
                this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
            }
        // was active, active tab still exists
        } else {
            // make sure active index is correct
            options.active = this.tabs.index( this.active );
        }
 
        this._refresh();
    },
 
    _refresh: function() {
        this._setupDisabled( this.options.disabled );
        this._setupEvents( this.options.event );
        this._setupHeightStyle( this.options.heightStyle );
 
        this.tabs.not( this.active ).attr({
            "aria-selected": "false",
            "aria-expanded": "false",
            tabIndex: -1
        });
        this.panels.not( this._getPanelForTab( this.active ) )
            .hide()
            .attr({
                "aria-hidden": "true"
            });
 
        // Make sure one tab is in the tab order
        if ( !this.active.length ) {
            this.tabs.eq( 0 ).attr( "tabIndex", 0 );
        } else {
            this.active
                .addClass( "ui-tabs-active ui-state-active" )
                .attr({
                    "aria-selected": "true",
                    "aria-expanded": "true",
                    tabIndex: 0
                });
            this._getPanelForTab( this.active )
                .show()
                .attr({
                    "aria-hidden": "false"
                });
        }
    },
 
    _processTabs: function() {
        var that = this,
            prevTabs = this.tabs,
            prevAnchors = this.anchors,
            prevPanels = this.panels;
 
        this.tablist = this._getList()
            .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
            .attr( "role", "tablist" )
 
            // Prevent users from focusing disabled tabs via click
            .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
                if ( $( this ).is( ".ui-state-disabled" ) ) {
                    event.preventDefault();
                }
            })
 
            // support: IE <9
            // Preventing the default action in mousedown doesn't prevent IE
            // from focusing the element, so if the anchor gets focused, blur.
            // We don't have to worry about focusing the previously focused
            // element since clicking on a non-focusable element should focus
            // the body anyway.
            .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
                if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
                    this.blur();
                }
            });
 
        this.tabs = this.tablist.find( "> li:has(a[href])" )
            .addClass( "ui-state-default ui-corner-top" )
            .attr({
                role: "tab",
                tabIndex: -1
            });
 
        this.anchors = this.tabs.map(function() {
                return $( "a", this )[ 0 ];
            })
            .addClass( "ui-tabs-anchor" )
            .attr({
                role: "presentation",
                tabIndex: -1
            });
 
        this.panels = $();
 
        this.anchors.each(function( i, anchor ) {
            var selector, panel, panelId,
                anchorId = $( anchor ).uniqueId().attr( "id" ),
                tab = $( anchor ).closest( "li" ),
                originalAriaControls = tab.attr( "aria-controls" );
 
            // inline tab
            if ( that._isLocal( anchor ) ) {
                selector = anchor.hash;
                panelId = selector.substring( 1 );
                panel = that.element.find( that._sanitizeSelector( selector ) );
            // remote tab
            } else {
                // If the tab doesn't already have aria-controls,
                // generate an id by using a throw-away element
                panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
                selector = "#" + panelId;
                panel = that.element.find( selector );
                if ( !panel.length ) {
                    panel = that._createPanel( panelId );
                    panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
                }
                panel.attr( "aria-live", "polite" );
            }
 
            if ( panel.length) {
                that.panels = that.panels.add( panel );
            }
            if ( originalAriaControls ) {
                tab.data( "ui-tabs-aria-controls", originalAriaControls );
            }
            tab.attr({
                "aria-controls": panelId,
                "aria-labelledby": anchorId
            });
            panel.attr( "aria-labelledby", anchorId );
        });
 
        this.panels
            .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
            .attr( "role", "tabpanel" );
 
        // Avoid memory leaks (#10056)
        if ( prevTabs ) {
            this._off( prevTabs.not( this.tabs ) );
            this._off( prevAnchors.not( this.anchors ) );
            this._off( prevPanels.not( this.panels ) );
        }
    },
 
    // allow overriding how to find the list for rare usage scenarios (#7715)
    _getList: function() {
        return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
    },
 
    _createPanel: function( id ) {
        return $( "<div>" )
            .attr( "id", id )
            .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
            .data( "ui-tabs-destroy", true );
    },
 
    _setupDisabled: function( disabled ) {
        if ( $.isArray( disabled ) ) {
            if ( !disabled.length ) {
                disabled = false;
            } else if ( disabled.length === this.anchors.length ) {
                disabled = true;
            }
        }
 
        // disable tabs
        for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
            if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
                $( li )
                    .addClass( "ui-state-disabled" )
                    .attr( "aria-disabled", "true" );
            } else {
                $( li )
                    .removeClass( "ui-state-disabled" )
                    .removeAttr( "aria-disabled" );
            }
        }
 
        this.options.disabled = disabled;
    },
 
    _setupEvents: function( event ) {
        var events = {};
        if ( event ) {
            $.each( event.split(" "), function( index, eventName ) {
                events[ eventName ] = "_eventHandler";
            });
        }
 
        this._off( this.anchors.add( this.tabs ).add( this.panels ) );
        // Always prevent the default action, even when disabled
        this._on( true, this.anchors, {
            click: function( event ) {
                event.preventDefault();
            }
        });
        this._on( this.anchors, events );
        this._on( this.tabs, { keydown: "_tabKeydown" } );
        this._on( this.panels, { keydown: "_panelKeydown" } );
 
        this._focusable( this.tabs );
        this._hoverable( this.tabs );
    },
 
    _setupHeightStyle: function( heightStyle ) {
        var maxHeight,
            parent = this.element.parent();
 
        if ( heightStyle === "fill" ) {
            maxHeight = parent.height();
            maxHeight -= this.element.outerHeight() - this.element.height();
 
            this.element.siblings( ":visible" ).each(function() {
                var elem = $( this ),
                    position = elem.css( "position" );
 
                if ( position === "absolute" || position === "fixed" ) {
                    return;
                }
                maxHeight -= elem.outerHeight( true );
            });
 
            this.element.children().not( this.panels ).each(function() {
                maxHeight -= $( this ).outerHeight( true );
            });
 
            this.panels.each(function() {
                $( this ).height( Math.max( 0, maxHeight -
                    $( this ).innerHeight() + $( this ).height() ) );
            })
            .css( "overflow", "auto" );
        } else if ( heightStyle === "auto" ) {
            maxHeight = 0;
            this.panels.each(function() {
                maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
            }).height( maxHeight );
        }
    },
 
    _eventHandler: function( event ) {
        var options = this.options,
            active = this.active,
            anchor = $( event.currentTarget ),
            tab = anchor.closest( "li" ),
            clickedIsActive = tab[ 0 ] === active[ 0 ],
            collapsing = clickedIsActive && options.collapsible,
            toShow = collapsing ? $() : this._getPanelForTab( tab ),
            toHide = !active.length ? $() : this._getPanelForTab( active ),
            eventData = {
                oldTab: active,
                oldPanel: toHide,
                newTab: collapsing ? $() : tab,
                newPanel: toShow
            };
 
        event.preventDefault();
 
        if ( tab.hasClass( "ui-state-disabled" ) ||
                // tab is already loading
                tab.hasClass( "ui-tabs-loading" ) ||
                // can't switch durning an animation
                this.running ||
                // click on active header, but not collapsible
                ( clickedIsActive && !options.collapsible ) ||
                // allow canceling activation
                ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
            return;
        }
 
        options.active = collapsing ? false : this.tabs.index( tab );
 
        this.active = clickedIsActive ? $() : tab;
        if ( this.xhr ) {
            this.xhr.abort();
        }
 
        if ( !toHide.length && !toShow.length ) {
            $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
        }
 
        if ( toShow.length ) {
            this.load( this.tabs.index( tab ), event );
        }
        this._toggle( event, eventData );
    },
 
    // handles show/hide for selecting tabs
    _toggle: function( event, eventData ) {
        var that = this,
            toShow = eventData.newPanel,
            toHide = eventData.oldPanel;
 
        this.running = true;
 
        function complete() {
            that.running = false;
            that._trigger( "activate", event, eventData );
        }
 
        function show() {
            eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
 
            if ( toShow.length && that.options.show ) {
                that._show( toShow, that.options.show, complete );
            } else {
                toShow.show();
                complete();
            }
        }
 
        // start out by hiding, then showing, then completing
        if ( toHide.length && this.options.hide ) {
            this._hide( toHide, this.options.hide, function() {
                eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
                show();
            });
        } else {
            eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
            toHide.hide();
            show();
        }
 
        toHide.attr( "aria-hidden", "true" );
        eventData.oldTab.attr({
            "aria-selected": "false",
            "aria-expanded": "false"
        });
        // If we're switching tabs, remove the old tab from the tab order.
        // If we're opening from collapsed state, remove the previous tab from the tab order.
        // If we're collapsing, then keep the collapsing tab in the tab order.
        if ( toShow.length && toHide.length ) {
            eventData.oldTab.attr( "tabIndex", -1 );
        } else if ( toShow.length ) {
            this.tabs.filter(function() {
                return $( this ).attr( "tabIndex" ) === 0;
            })
            .attr( "tabIndex", -1 );
        }
 
        toShow.attr( "aria-hidden", "false" );
        eventData.newTab.attr({
            "aria-selected": "true",
            "aria-expanded": "true",
            tabIndex: 0
        });
    },
 
    _activate: function( index ) {
        var anchor,
            active = this._findActive( index );
 
        // trying to activate the already active panel
        if ( active[ 0 ] === this.active[ 0 ] ) {
            return;
        }
 
        // trying to collapse, simulate a click on the current active header
        if ( !active.length ) {
            active = this.active;
        }
 
        anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
        this._eventHandler({
            target: anchor,
            currentTarget: anchor,
            preventDefault: $.noop
        });
    },
 
    _findActive: function( index ) {
        return index === false ? $() : this.tabs.eq( index );
    },
 
    _getIndex: function( index ) {
        // meta-function to give users option to provide a href string instead of a numerical index.
        if ( typeof index === "string" ) {
            index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
        }
 
        return index;
    },
 
    _destroy: function() {
        if ( this.xhr ) {
            this.xhr.abort();
        }
 
        this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
 
        this.tablist
            .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
            .removeAttr( "role" );
 
        this.anchors
            .removeClass( "ui-tabs-anchor" )
            .removeAttr( "role" )
            .removeAttr( "tabIndex" )
            .removeUniqueId();
 
        this.tablist.unbind( this.eventNamespace );
 
        this.tabs.add( this.panels ).each(function() {
            if ( $.data( this, "ui-tabs-destroy" ) ) {
                $( this ).remove();
            } else {
                $( this )
                    .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
                        "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
                    .removeAttr( "tabIndex" )
                    .removeAttr( "aria-live" )
                    .removeAttr( "aria-busy" )
                    .removeAttr( "aria-selected" )
                    .removeAttr( "aria-labelledby" )
                    .removeAttr( "aria-hidden" )
                    .removeAttr( "aria-expanded" )
                    .removeAttr( "role" );
            }
        });
 
        this.tabs.each(function() {
            var li = $( this ),
                prev = li.data( "ui-tabs-aria-controls" );
            if ( prev ) {
                li
                    .attr( "aria-controls", prev )
                    .removeData( "ui-tabs-aria-controls" );
            } else {
                li.removeAttr( "aria-controls" );
            }
        });
 
        this.panels.show();
 
        if ( this.options.heightStyle !== "content" ) {
            this.panels.css( "height", "" );
        }
    },
 
    enable: function( index ) {
        var disabled = this.options.disabled;
        if ( disabled === false ) {
            return;
        }
 
        if ( index === undefined ) {
            disabled = false;
        } else {
            index = this._getIndex( index );
            if ( $.isArray( disabled ) ) {
                disabled = $.map( disabled, function( num ) {
                    return num !== index ? num : null;
                });
            } else {
                disabled = $.map( this.tabs, function( li, num ) {
                    return num !== index ? num : null;
                });
            }
        }
        this._setupDisabled( disabled );
    },
 
    disable: function( index ) {
        var disabled = this.options.disabled;
        if ( disabled === true ) {
            return;
        }
 
        if ( index === undefined ) {
            disabled = true;
        } else {
            index = this._getIndex( index );
            if ( $.inArray( index, disabled ) !== -1 ) {
                return;
            }
            if ( $.isArray( disabled ) ) {
                disabled = $.merge( [ index ], disabled ).sort();
            } else {
                disabled = [ index ];
            }
        }
        this._setupDisabled( disabled );
    },
 
    load: function( index, event ) {
        index = this._getIndex( index );
        var that = this,
            tab = this.tabs.eq( index ),
            anchor = tab.find( ".ui-tabs-anchor" ),
            panel = this._getPanelForTab( tab ),
            eventData = {
                tab: tab,
                panel: panel
            },
            complete = function( jqXHR, status ) {
                if ( status === "abort" ) {
                    that.panels.stop( false, true );
                }
 
                tab.removeClass( "ui-tabs-loading" );
                panel.removeAttr( "aria-busy" );
 
                if ( jqXHR === that.xhr ) {
                    delete that.xhr;
                }
            };
 
        // not remote
        if ( this._isLocal( anchor[ 0 ] ) ) {
            return;
        }
 
        this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
 
        // support: jQuery <1.8
        // jQuery <1.8 returns false if the request is canceled in beforeSend,
        // but as of 1.8, $.ajax() always returns a jqXHR object.
        if ( this.xhr && this.xhr.statusText !== "canceled" ) {
            tab.addClass( "ui-tabs-loading" );
            panel.attr( "aria-busy", "true" );
 
            this.xhr
                .done(function( response, status, jqXHR ) {
                    // support: jQuery <1.8
                    // http://bugs.jquery.com/ticket/11778
                    setTimeout(function() {
                        panel.html( response );
                        that._trigger( "load", event, eventData );
 
                        complete( jqXHR, status );
                    }, 1 );
                })
                .fail(function( jqXHR, status ) {
                    // support: jQuery <1.8
                    // http://bugs.jquery.com/ticket/11778
                    setTimeout(function() {
                        complete( jqXHR, status );
                    }, 1 );
                });
        }
    },
 
    _ajaxSettings: function( anchor, event, eventData ) {
        var that = this;
        return {
            url: anchor.attr( "href" ),
            beforeSend: function( jqXHR, settings ) {
                return that._trigger( "beforeLoad", event,
                    $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
            }
        };
    },
 
    _getPanelForTab: function( tab ) {
        var id = $( tab ).attr( "aria-controls" );
        return this.element.find( this._sanitizeSelector( "#" + id ) );
    }
});
 
 
/*!
 * jQuery UI Tooltip 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/tooltip/
 */
 
 
var tooltip = $.widget( "ui.tooltip", {
    version: "1.11.4",
    options: {
        content: function() {
            // support: IE<9, Opera in jQuery <1.7
            // .text() can't accept undefined, so coerce to a string
            var title = $( this ).attr( "title" ) || "";
            // Escape title, since we're going from an attribute to raw HTML
            return $( "<a>" ).text( title ).html();
        },
        hide: true,
        // Disabled elements have inconsistent behavior across browsers (#8661)
        items: "[title]:not([disabled])",
        position: {
            my: "left top+15",
            at: "left bottom",
            collision: "flipfit flip"
        },
        show: true,
        tooltipClass: null,
        track: false,
 
        // callbacks
        close: null,
        open: null
    },
 
    _addDescribedBy: function( elem, id ) {
        var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
        describedby.push( id );
        elem
            .data( "ui-tooltip-id", id )
            .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
    },
 
    _removeDescribedBy: function( elem ) {
        var id = elem.data( "ui-tooltip-id" ),
            describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
            index = $.inArray( id, describedby );
 
        if ( index !== -1 ) {
            describedby.splice( index, 1 );
        }
 
        elem.removeData( "ui-tooltip-id" );
        describedby = $.trim( describedby.join( " " ) );
        if ( describedby ) {
            elem.attr( "aria-describedby", describedby );
        } else {
            elem.removeAttr( "aria-describedby" );
        }
    },
 
    _create: function() {
        this._on({
            mouseover: "open",
            focusin: "open"
        });
 
        // IDs of generated tooltips, needed for destroy
        this.tooltips = {};
 
        // IDs of parent tooltips where we removed the title attribute
        this.parents = {};
 
        if ( this.options.disabled ) {
            this._disable();
        }
 
        // Append the aria-live region so tooltips announce correctly
        this.liveRegion = $( "<div>" )
            .attr({
                role: "log",
                "aria-live": "assertive",
                "aria-relevant": "additions"
            })
            .addClass( "ui-helper-hidden-accessible" )
            .appendTo( this.document[ 0 ].body );
    },
 
    _setOption: function( key, value ) {
        var that = this;
 
        if ( key === "disabled" ) {
            this[ value ? "_disable" : "_enable" ]();
            this.options[ key ] = value;
            // disable element style changes
            return;
        }
 
        this._super( key, value );
 
        if ( key === "content" ) {
            $.each( this.tooltips, function( id, tooltipData ) {
                that._updateContent( tooltipData.element );
            });
        }
    },
 
    _disable: function() {
        var that = this;
 
        // close open tooltips
        $.each( this.tooltips, function( id, tooltipData ) {
            var event = $.Event( "blur" );
            event.target = event.currentTarget = tooltipData.element[ 0 ];
            that.close( event, true );
        });
 
        // remove title attributes to prevent native tooltips
        this.element.find( this.options.items ).addBack().each(function() {
            var element = $( this );
            if ( element.is( "[title]" ) ) {
                element
                    .data( "ui-tooltip-title", element.attr( "title" ) )
                    .removeAttr( "title" );
            }
        });
    },
 
    _enable: function() {
        // restore title attributes
        this.element.find( this.options.items ).addBack().each(function() {
            var element = $( this );
            if ( element.data( "ui-tooltip-title" ) ) {
                element.attr( "title", element.data( "ui-tooltip-title" ) );
            }
        });
    },
 
    open: function( event ) {
        var that = this,
            target = $( event ? event.target : this.element )
                // we need closest here due to mouseover bubbling,
                // but always pointing at the same event target
                .closest( this.options.items );
 
        // No element to show a tooltip for or the tooltip is already open
        if ( !target.length || target.data( "ui-tooltip-id" ) ) {
            return;
        }
 
        if ( target.attr( "title" ) ) {
            target.data( "ui-tooltip-title", target.attr( "title" ) );
        }
 
        target.data( "ui-tooltip-open", true );
 
        // kill parent tooltips, custom or native, for hover
        if ( event && event.type === "mouseover" ) {
            target.parents().each(function() {
                var parent = $( this ),
                    blurEvent;
                if ( parent.data( "ui-tooltip-open" ) ) {
                    blurEvent = $.Event( "blur" );
                    blurEvent.target = blurEvent.currentTarget = this;
                    that.close( blurEvent, true );
                }
                if ( parent.attr( "title" ) ) {
                    parent.uniqueId();
                    that.parents[ this.id ] = {
                        element: this,
                        title: parent.attr( "title" )
                    };
                    parent.attr( "title", "" );
                }
            });
        }
 
        this._registerCloseHandlers( event, target );
        this._updateContent( target, event );
    },
 
    _updateContent: function( target, event ) {
        var content,
            contentOption = this.options.content,
            that = this,
            eventType = event ? event.type : null;
 
        if ( typeof contentOption === "string" ) {
            return this._open( event, target, contentOption );
        }
 
        content = contentOption.call( target[0], function( response ) {
 
            // IE may instantly serve a cached response for ajax requests
            // delay this call to _open so the other call to _open runs first
            that._delay(function() {
 
                // Ignore async response if tooltip was closed already
                if ( !target.data( "ui-tooltip-open" ) ) {
                    return;
                }
 
                // jQuery creates a special event for focusin when it doesn't
                // exist natively. To improve performance, the native event
                // object is reused and the type is changed. Therefore, we can't
                // rely on the type being correct after the event finished
                // bubbling, so we set it back to the previous value. (#8740)
                if ( event ) {
                    event.type = eventType;
                }
                this._open( event, target, response );
            });
        });
        if ( content ) {
            this._open( event, target, content );
        }
    },
 
    _open: function( event, target, content ) {
        var tooltipData, tooltip, delayedShow, a11yContent,
            positionOption = $.extend( {}, this.options.position );
 
        if ( !content ) {
            return;
        }
 
        // Content can be updated multiple times. If the tooltip already
        // exists, then just update the content and bail.
        tooltipData = this._find( target );
        if ( tooltipData ) {
            tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
            return;
        }
 
        // if we have a title, clear it to prevent the native tooltip
        // we have to check first to avoid defining a title if none exists
        // (we don't want to cause an element to start matching [title])
        //
        // We use removeAttr only for key events, to allow IE to export the correct
        // accessible attributes. For mouse events, set to empty string to avoid
        // native tooltip showing up (happens only when removing inside mouseover).
        if ( target.is( "[title]" ) ) {
            if ( event && event.type === "mouseover" ) {
                target.attr( "title", "" );
            } else {
                target.removeAttr( "title" );
            }
        }
 
        tooltipData = this._tooltip( target );
        tooltip = tooltipData.tooltip;
        this._addDescribedBy( target, tooltip.attr( "id" ) );
        tooltip.find( ".ui-tooltip-content" ).html( content );
 
        // Support: Voiceover on OS X, JAWS on IE <= 9
        // JAWS announces deletions even when aria-relevant="additions"
        // Voiceover will sometimes re-read the entire log region's contents from the beginning
        this.liveRegion.children().hide();
        if ( content.clone ) {
            a11yContent = content.clone();
            a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
        } else {
            a11yContent = content;
        }
        $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
 
        function position( event ) {
            positionOption.of = event;
            if ( tooltip.is( ":hidden" ) ) {
                return;
            }
            tooltip.position( positionOption );
        }
        if ( this.options.track && event && /^mouse/.test( event.type ) ) {
            this._on( this.document, {
                mousemove: position
            });
            // trigger once to override element-relative positioning
            position( event );
        } else {
            tooltip.position( $.extend({
                of: target
            }, this.options.position ) );
        }
 
        tooltip.hide();
 
        this._show( tooltip, this.options.show );
        // Handle tracking tooltips that are shown with a delay (#8644). As soon
        // as the tooltip is visible, position the tooltip using the most recent
        // event.
        if ( this.options.show && this.options.show.delay ) {
            delayedShow = this.delayedShow = setInterval(function() {
                if ( tooltip.is( ":visible" ) ) {
                    position( positionOption.of );
                    clearInterval( delayedShow );
                }
            }, $.fx.interval );
        }
 
        this._trigger( "open", event, { tooltip: tooltip } );
    },
 
    _registerCloseHandlers: function( event, target ) {
        var events = {
            keyup: function( event ) {
                if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
                    var fakeEvent = $.Event(event);
                    fakeEvent.currentTarget = target[0];
                    this.close( fakeEvent, true );
                }
            }
        };
 
        // Only bind remove handler for delegated targets. Non-delegated
        // tooltips will handle this in destroy.
        if ( target[ 0 ] !== this.element[ 0 ] ) {
            events.remove = function() {
                this._removeTooltip( this._find( target ).tooltip );
            };
        }
 
        if ( !event || event.type === "mouseover" ) {
            events.mouseleave = "close";
        }
        if ( !event || event.type === "focusin" ) {
            events.focusout = "close";
        }
        this._on( true, target, events );
    },
 
    close: function( event ) {
        var tooltip,
            that = this,
            target = $( event ? event.currentTarget : this.element ),
            tooltipData = this._find( target );
 
        // The tooltip may already be closed
        if ( !tooltipData ) {
 
            // We set ui-tooltip-open immediately upon open (in open()), but only set the
            // additional data once there's actually content to show (in _open()). So even if the
            // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
            // the period between open() and _open().
            target.removeData( "ui-tooltip-open" );
            return;
        }
 
        tooltip = tooltipData.tooltip;
 
        // disabling closes the tooltip, so we need to track when we're closing
        // to avoid an infinite loop in case the tooltip becomes disabled on close
        if ( tooltipData.closing ) {
            return;
        }
 
        // Clear the interval for delayed tracking tooltips
        clearInterval( this.delayedShow );
 
        // only set title if we had one before (see comment in _open())
        // If the title attribute has changed since open(), don't restore
        if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
            target.attr( "title", target.data( "ui-tooltip-title" ) );
        }
 
        this._removeDescribedBy( target );
 
        tooltipData.hiding = true;
        tooltip.stop( true );
        this._hide( tooltip, this.options.hide, function() {
            that._removeTooltip( $( this ) );
        });
 
        target.removeData( "ui-tooltip-open" );
        this._off( target, "mouseleave focusout keyup" );
 
        // Remove 'remove' binding only on delegated targets
        if ( target[ 0 ] !== this.element[ 0 ] ) {
            this._off( target, "remove" );
        }
        this._off( this.document, "mousemove" );
 
        if ( event && event.type === "mouseleave" ) {
            $.each( this.parents, function( id, parent ) {
                $( parent.element ).attr( "title", parent.title );
                delete that.parents[ id ];
            });
        }
 
        tooltipData.closing = true;
        this._trigger( "close", event, { tooltip: tooltip } );
        if ( !tooltipData.hiding ) {
            tooltipData.closing = false;
        }
    },
 
    _tooltip: function( element ) {
        var tooltip = $( "<div>" )
                .attr( "role", "tooltip" )
                .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
                    ( this.options.tooltipClass || "" ) ),
            id = tooltip.uniqueId().attr( "id" );
 
        $( "<div>" )
            .addClass( "ui-tooltip-content" )
            .appendTo( tooltip );
 
        tooltip.appendTo( this.document[0].body );
 
        return this.tooltips[ id ] = {
            element: element,
            tooltip: tooltip
        };
    },
 
    _find: function( target ) {
        var id = target.data( "ui-tooltip-id" );
        return id ? this.tooltips[ id ] : null;
    },
 
    _removeTooltip: function( tooltip ) {
        tooltip.remove();
        delete this.tooltips[ tooltip.attr( "id" ) ];
    },
 
    _destroy: function() {
        var that = this;
 
        // close open tooltips
        $.each( this.tooltips, function( id, tooltipData ) {
            // Delegate to close method to handle common cleanup
            var event = $.Event( "blur" ),
                element = tooltipData.element;
            event.target = event.currentTarget = element[ 0 ];
            that.close( event, true );
 
            // Remove immediately; destroying an open tooltip doesn't use the
            // hide animation
            $( "#" + id ).remove();
 
            // Restore the title
            if ( element.data( "ui-tooltip-title" ) ) {
                // If the title attribute has changed since open(), don't restore
                if ( !element.attr( "title" ) ) {
                    element.attr( "title", element.data( "ui-tooltip-title" ) );
                }
                element.removeData( "ui-tooltip-title" );
            }
        });
        this.liveRegion.remove();
    }
});
 
 
/*!
 * jQuery UI Effects 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/effects-core/
 */
 
 
var dataSpace = "ui-effects-",
 
    // Create a local jQuery because jQuery Color relies on it and the
    // global may not exist with AMD and a custom build (#10199)
    jQuery = $;
 
$.effects = {
    effect: {}
};
 
/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */
(function( jQuery, undefined ) {
 
    var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
 
    // plusequals test for += 100 -= 100
    rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
    // a set of RE's that can match strings and generate color tuples.
    stringParsers = [ {
            re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
            parse: function( execResult ) {
                return [
                    execResult[ 1 ],
                    execResult[ 2 ],
                    execResult[ 3 ],
                    execResult[ 4 ]
                ];
            }
        }, {
            re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
            parse: function( execResult ) {
                return [
                    execResult[ 1 ] * 2.55,
                    execResult[ 2 ] * 2.55,
                    execResult[ 3 ] * 2.55,
                    execResult[ 4 ]
                ];
            }
        }, {
            // this regex ignores A-F because it's compared against an already lowercased string
            re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
            parse: function( execResult ) {
                return [
                    parseInt( execResult[ 1 ], 16 ),
                    parseInt( execResult[ 2 ], 16 ),
                    parseInt( execResult[ 3 ], 16 )
                ];
            }
        }, {
            // this regex ignores A-F because it's compared against an already lowercased string
            re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
            parse: function( execResult ) {
                return [
                    parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
                    parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
                    parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
                ];
            }
        }, {
            re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
            space: "hsla",
            parse: function( execResult ) {
                return [
                    execResult[ 1 ],
                    execResult[ 2 ] / 100,
                    execResult[ 3 ] / 100,
                    execResult[ 4 ]
                ];
            }
        } ],
 
    // jQuery.Color( )
    color = jQuery.Color = function( color, green, blue, alpha ) {
        return new jQuery.Color.fn.parse( color, green, blue, alpha );
    },
    spaces = {
        rgba: {
            props: {
                red: {
                    idx: 0,
                    type: "byte"
                },
                green: {
                    idx: 1,
                    type: "byte"
                },
                blue: {
                    idx: 2,
                    type: "byte"
                }
            }
        },
 
        hsla: {
            props: {
                hue: {
                    idx: 0,
                    type: "degrees"
                },
                saturation: {
                    idx: 1,
                    type: "percent"
                },
                lightness: {
                    idx: 2,
                    type: "percent"
                }
            }
        }
    },
    propTypes = {
        "byte": {
            floor: true,
            max: 255
        },
        "percent": {
            max: 1
        },
        "degrees": {
            mod: 360,
            floor: true
        }
    },
    support = color.support = {},
 
    // element for support tests
    supportElem = jQuery( "<p>" )[ 0 ],
 
    // colors = jQuery.Color.names
    colors,
 
    // local aliases of functions called often
    each = jQuery.each;
 
// determine rgba support immediately
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
 
// define cache name and alpha properties
// for rgba and hsla spaces
each( spaces, function( spaceName, space ) {
    space.cache = "_" + spaceName;
    space.props.alpha = {
        idx: 3,
        type: "percent",
        def: 1
    };
});
 
function clamp( value, prop, allowEmpty ) {
    var type = propTypes[ prop.type ] || {};
 
    if ( value == null ) {
        return (allowEmpty || !prop.def) ? null : prop.def;
    }
 
    // ~~ is an short way of doing floor for positive numbers
    value = type.floor ? ~~value : parseFloat( value );
 
    // IE will pass in empty strings as value for alpha,
    // which will hit this case
    if ( isNaN( value ) ) {
        return prop.def;
    }
 
    if ( type.mod ) {
        // we add mod before modding to make sure that negatives values
        // get converted properly: -10 -> 350
        return (value + type.mod) % type.mod;
    }
 
    // for now all property types without mod have min and max
    return 0 > value ? 0 : type.max < value ? type.max : value;
}
 
function stringParse( string ) {
    var inst = color(),
        rgba = inst._rgba = [];
 
    string = string.toLowerCase();
 
    each( stringParsers, function( i, parser ) {
        var parsed,
            match = parser.re.exec( string ),
            values = match && parser.parse( match ),
            spaceName = parser.space || "rgba";
 
        if ( values ) {
            parsed = inst[ spaceName ]( values );
 
            // if this was an rgba parse the assignment might happen twice
            // oh well....
            inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
            rgba = inst._rgba = parsed._rgba;
 
            // exit each( stringParsers ) here because we matched
            return false;
        }
    });
 
    // Found a stringParser that handled it
    if ( rgba.length ) {
 
        // if this came from a parsed string, force "transparent" when alpha is 0
        // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
        if ( rgba.join() === "0,0,0,0" ) {
            jQuery.extend( rgba, colors.transparent );
        }
        return inst;
    }
 
    // named colors
    return colors[ string ];
}
 
color.fn = jQuery.extend( color.prototype, {
    parse: function( red, green, blue, alpha ) {
        if ( red === undefined ) {
            this._rgba = [ null, null, null, null ];
            return this;
        }
        if ( red.jquery || red.nodeType ) {
            red = jQuery( red ).css( green );
            green = undefined;
        }
 
        var inst = this,
            type = jQuery.type( red ),
            rgba = this._rgba = [];
 
        // more than 1 argument specified - assume ( red, green, blue, alpha )
        if ( green !== undefined ) {
            red = [ red, green, blue, alpha ];
            type = "array";
        }
 
        if ( type === "string" ) {
            return this.parse( stringParse( red ) || colors._default );
        }
 
        if ( type === "array" ) {
            each( spaces.rgba.props, function( key, prop ) {
                rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
            });
            return this;
        }
 
        if ( type === "object" ) {
            if ( red instanceof color ) {
                each( spaces, function( spaceName, space ) {
                    if ( red[ space.cache ] ) {
                        inst[ space.cache ] = red[ space.cache ].slice();
                    }
                });
            } else {
                each( spaces, function( spaceName, space ) {
                    var cache = space.cache;
                    each( space.props, function( key, prop ) {
 
                        // if the cache doesn't exist, and we know how to convert
                        if ( !inst[ cache ] && space.to ) {
 
                            // if the value was null, we don't need to copy it
                            // if the key was alpha, we don't need to copy it either
                            if ( key === "alpha" || red[ key ] == null ) {
                                return;
                            }
                            inst[ cache ] = space.to( inst._rgba );
                        }
 
                        // this is the only case where we allow nulls for ALL properties.
                        // call clamp with alwaysAllowEmpty
                        inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
                    });
 
                    // everything defined but alpha?
                    if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
                        // use the default of 1
                        inst[ cache ][ 3 ] = 1;
                        if ( space.from ) {
                            inst._rgba = space.from( inst[ cache ] );
                        }
                    }
                });
            }
            return this;
        }
    },
    is: function( compare ) {
        var is = color( compare ),
            same = true,
            inst = this;
 
        each( spaces, function( _, space ) {
            var localCache,
                isCache = is[ space.cache ];
            if (isCache) {
                localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
                each( space.props, function( _, prop ) {
                    if ( isCache[ prop.idx ] != null ) {
                        same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
                        return same;
                    }
                });
            }
            return same;
        });
        return same;
    },
    _space: function() {
        var used = [],
            inst = this;
        each( spaces, function( spaceName, space ) {
            if ( inst[ space.cache ] ) {
                used.push( spaceName );
            }
        });
        return used.pop();
    },
    transition: function( other, distance ) {
        var end = color( other ),
            spaceName = end._space(),
            space = spaces[ spaceName ],
            startColor = this.alpha() === 0 ? color( "transparent" ) : this,
            start = startColor[ space.cache ] || space.to( startColor._rgba ),
            result = start.slice();
 
        end = end[ space.cache ];
        each( space.props, function( key, prop ) {
            var index = prop.idx,
                startValue = start[ index ],
                endValue = end[ index ],
                type = propTypes[ prop.type ] || {};
 
            // if null, don't override start value
            if ( endValue === null ) {
                return;
            }
            // if null - use end
            if ( startValue === null ) {
                result[ index ] = endValue;
            } else {
                if ( type.mod ) {
                    if ( endValue - startValue > type.mod / 2 ) {
                        startValue += type.mod;
                    } else if ( startValue - endValue > type.mod / 2 ) {
                        startValue -= type.mod;
                    }
                }
                result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
            }
        });
        return this[ spaceName ]( result );
    },
    blend: function( opaque ) {
        // if we are already opaque - return ourself
        if ( this._rgba[ 3 ] === 1 ) {
            return this;
        }
 
        var rgb = this._rgba.slice(),
            a = rgb.pop(),
            blend = color( opaque )._rgba;
 
        return color( jQuery.map( rgb, function( v, i ) {
            return ( 1 - a ) * blend[ i ] + a * v;
        }));
    },
    toRgbaString: function() {
        var prefix = "rgba(",
            rgba = jQuery.map( this._rgba, function( v, i ) {
                return v == null ? ( i > 2 ? 1 : 0 ) : v;
            });
 
        if ( rgba[ 3 ] === 1 ) {
            rgba.pop();
            prefix = "rgb(";
        }
 
        return prefix + rgba.join() + ")";
    },
    toHslaString: function() {
        var prefix = "hsla(",
            hsla = jQuery.map( this.hsla(), function( v, i ) {
                if ( v == null ) {
                    v = i > 2 ? 1 : 0;
                }
 
                // catch 1 and 2
                if ( i && i < 3 ) {
                    v = Math.round( v * 100 ) + "%";
                }
                return v;
            });
 
        if ( hsla[ 3 ] === 1 ) {
            hsla.pop();
            prefix = "hsl(";
        }
        return prefix + hsla.join() + ")";
    },
    toHexString: function( includeAlpha ) {
        var rgba = this._rgba.slice(),
            alpha = rgba.pop();
 
        if ( includeAlpha ) {
            rgba.push( ~~( alpha * 255 ) );
        }
 
        return "#" + jQuery.map( rgba, function( v ) {
 
            // default to 0 when nulls exist
            v = ( v || 0 ).toString( 16 );
            return v.length === 1 ? "0" + v : v;
        }).join("");
    },
    toString: function() {
        return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
    }
});
color.fn.parse.prototype = color.fn;
 
// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
 
function hue2rgb( p, q, h ) {
    h = ( h + 1 ) % 1;
    if ( h * 6 < 1 ) {
        return p + ( q - p ) * h * 6;
    }
    if ( h * 2 < 1) {
        return q;
    }
    if ( h * 3 < 2 ) {
        return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
    }
    return p;
}
 
spaces.hsla.to = function( rgba ) {
    if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
        return [ null, null, null, rgba[ 3 ] ];
    }
    var r = rgba[ 0 ] / 255,
        g = rgba[ 1 ] / 255,
        b = rgba[ 2 ] / 255,
        a = rgba[ 3 ],
        max = Math.max( r, g, b ),
        min = Math.min( r, g, b ),
        diff = max - min,
        add = max + min,
        l = add * 0.5,
        h, s;
 
    if ( min === max ) {
        h = 0;
    } else if ( r === max ) {
        h = ( 60 * ( g - b ) / diff ) + 360;
    } else if ( g === max ) {
        h = ( 60 * ( b - r ) / diff ) + 120;
    } else {
        h = ( 60 * ( r - g ) / diff ) + 240;
    }
 
    // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
    // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
    if ( diff === 0 ) {
        s = 0;
    } else if ( l <= 0.5 ) {
        s = diff / add;
    } else {
        s = diff / ( 2 - add );
    }
    return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
};
 
spaces.hsla.from = function( hsla ) {
    if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
        return [ null, null, null, hsla[ 3 ] ];
    }
    var h = hsla[ 0 ] / 360,
        s = hsla[ 1 ],
        l = hsla[ 2 ],
        a = hsla[ 3 ],
        q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
        p = 2 * l - q;
 
    return [
        Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
        Math.round( hue2rgb( p, q, h ) * 255 ),
        Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
        a
    ];
};
 
each( spaces, function( spaceName, space ) {
    var props = space.props,
        cache = space.cache,
        to = space.to,
        from = space.from;
 
    // makes rgba() and hsla()
    color.fn[ spaceName ] = function( value ) {
 
        // generate a cache for this space if it doesn't exist
        if ( to && !this[ cache ] ) {
            this[ cache ] = to( this._rgba );
        }
        if ( value === undefined ) {
            return this[ cache ].slice();
        }
 
        var ret,
            type = jQuery.type( value ),
            arr = ( type === "array" || type === "object" ) ? value : arguments,
            local = this[ cache ].slice();
 
        each( props, function( key, prop ) {
            var val = arr[ type === "object" ? key : prop.idx ];
            if ( val == null ) {
                val = local[ prop.idx ];
            }
            local[ prop.idx ] = clamp( val, prop );
        });
 
        if ( from ) {
            ret = color( from( local ) );
            ret[ cache ] = local;
            return ret;
        } else {
            return color( local );
        }
    };
 
    // makes red() green() blue() alpha() hue() saturation() lightness()
    each( props, function( key, prop ) {
        // alpha is included in more than one space
        if ( color.fn[ key ] ) {
            return;
        }
        color.fn[ key ] = function( value ) {
            var vtype = jQuery.type( value ),
                fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
                local = this[ fn ](),
                cur = local[ prop.idx ],
                match;
 
            if ( vtype === "undefined" ) {
                return cur;
            }
 
            if ( vtype === "function" ) {
                value = value.call( this, cur );
                vtype = jQuery.type( value );
            }
            if ( value == null && prop.empty ) {
                return this;
            }
            if ( vtype === "string" ) {
                match = rplusequals.exec( value );
                if ( match ) {
                    value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
                }
            }
            local[ prop.idx ] = value;
            return this[ fn ]( local );
        };
    });
});
 
// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
    var hooks = hook.split( " " );
    each( hooks, function( i, hook ) {
        jQuery.cssHooks[ hook ] = {
            set: function( elem, value ) {
                var parsed, curElem,
                    backgroundColor = "";
 
                if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
                    value = color( parsed || value );
                    if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
                        curElem = hook === "backgroundColor" ? elem.parentNode : elem;
                        while (
                            (backgroundColor === "" || backgroundColor === "transparent") &&
                            curElem && curElem.style
                        ) {
                            try {
                                backgroundColor = jQuery.css( curElem, "backgroundColor" );
                                curElem = curElem.parentNode;
                            } catch ( e ) {
                            }
                        }
 
                        value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
                            backgroundColor :
                            "_default" );
                    }
 
                    value = value.toRgbaString();
                }
                try {
                    elem.style[ hook ] = value;
                } catch ( e ) {
                    // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
                }
            }
        };
        jQuery.fx.step[ hook ] = function( fx ) {
            if ( !fx.colorInit ) {
                fx.start = color( fx.elem, hook );
                fx.end = color( fx.end );
                fx.colorInit = true;
            }
            jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
        };
    });
 
};
 
color.hook( stepHooks );
 
jQuery.cssHooks.borderColor = {
    expand: function( value ) {
        var expanded = {};
 
        each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
            expanded[ "border" + part + "Color" ] = value;
        });
        return expanded;
    }
};
 
// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors = jQuery.Color.names = {
    // 4.1. Basic color keywords
    aqua: "#00ffff",
    black: "#000000",
    blue: "#0000ff",
    fuchsia: "#ff00ff",
    gray: "#808080",
    green: "#008000",
    lime: "#00ff00",
    maroon: "#800000",
    navy: "#000080",
    olive: "#808000",
    purple: "#800080",
    red: "#ff0000",
    silver: "#c0c0c0",
    teal: "#008080",
    white: "#ffffff",
    yellow: "#ffff00",
 
    // 4.2.3. "transparent" color keyword
    transparent: [ null, null, null, 0 ],
 
    _default: "#ffffff"
};
 
})( jQuery );
 
/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
(function() {
 
var classAnimationActions = [ "add", "remove", "toggle" ],
    shorthandStyles = {
        border: 1,
        borderBottom: 1,
        borderColor: 1,
        borderLeft: 1,
        borderRight: 1,
        borderTop: 1,
        borderWidth: 1,
        margin: 1,
        padding: 1
    };
 
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
    $.fx.step[ prop ] = function( fx ) {
        if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
            jQuery.style( fx.elem, prop, fx.end );
            fx.setAttr = true;
        }
    };
});
 
function getElementStyles( elem ) {
    var key, len,
        style = elem.ownerDocument.defaultView ?
            elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
            elem.currentStyle,
        styles = {};
 
    if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
        len = style.length;
        while ( len-- ) {
            key = style[ len ];
            if ( typeof style[ key ] === "string" ) {
                styles[ $.camelCase( key ) ] = style[ key ];
            }
        }
    // support: Opera, IE <9
    } else {
        for ( key in style ) {
            if ( typeof style[ key ] === "string" ) {
                styles[ key ] = style[ key ];
            }
        }
    }
 
    return styles;
}
 
function styleDifference( oldStyle, newStyle ) {
    var diff = {},
        name, value;
 
    for ( name in newStyle ) {
        value = newStyle[ name ];
        if ( oldStyle[ name ] !== value ) {
            if ( !shorthandStyles[ name ] ) {
                if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
                    diff[ name ] = value;
                }
            }
        }
    }
 
    return diff;
}
 
// support: jQuery <1.8
if ( !$.fn.addBack ) {
    $.fn.addBack = function( selector ) {
        return this.add( selector == null ?
            this.prevObject : this.prevObject.filter( selector )
        );
    };
}
 
$.effects.animateClass = function( value, duration, easing, callback ) {
    var o = $.speed( duration, easing, callback );
 
    return this.queue( function() {
        var animated = $( this ),
            baseClass = animated.attr( "class" ) || "",
            applyClassChange,
            allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
 
        // map the animated objects to store the original styles.
        allAnimations = allAnimations.map(function() {
            var el = $( this );
            return {
                el: el,
                start: getElementStyles( this )
            };
        });
 
        // apply class change
        applyClassChange = function() {
            $.each( classAnimationActions, function(i, action) {
                if ( value[ action ] ) {
                    animated[ action + "Class" ]( value[ action ] );
                }
            });
        };
        applyClassChange();
 
        // map all animated objects again - calculate new styles and diff
        allAnimations = allAnimations.map(function() {
            this.end = getElementStyles( this.el[ 0 ] );
            this.diff = styleDifference( this.start, this.end );
            return this;
        });
 
        // apply original class
        animated.attr( "class", baseClass );
 
        // map all animated objects again - this time collecting a promise
        allAnimations = allAnimations.map(function() {
            var styleInfo = this,
                dfd = $.Deferred(),
                opts = $.extend({}, o, {
                    queue: false,
                    complete: function() {
                        dfd.resolve( styleInfo );
                    }
                });
 
            this.el.animate( this.diff, opts );
            return dfd.promise();
        });
 
        // once all animations have completed:
        $.when.apply( $, allAnimations.get() ).done(function() {
 
            // set the final class
            applyClassChange();
 
            // for each animated element,
            // clear all css properties that were animated
            $.each( arguments, function() {
                var el = this.el;
                $.each( this.diff, function(key) {
                    el.css( key, "" );
                });
            });
 
            // this is guarnteed to be there if you use jQuery.speed()
            // it also handles dequeuing the next anim...
            o.complete.call( animated[ 0 ] );
        });
    });
};
 
$.fn.extend({
    addClass: (function( orig ) {
        return function( classNames, speed, easing, callback ) {
            return speed ?
                $.effects.animateClass.call( this,
                    { add: classNames }, speed, easing, callback ) :
                orig.apply( this, arguments );
        };
    })( $.fn.addClass ),
 
    removeClass: (function( orig ) {
        return function( classNames, speed, easing, callback ) {
            return arguments.length > 1 ?
                $.effects.animateClass.call( this,
                    { remove: classNames }, speed, easing, callback ) :
                orig.apply( this, arguments );
        };
    })( $.fn.removeClass ),
 
    toggleClass: (function( orig ) {
        return function( classNames, force, speed, easing, callback ) {
            if ( typeof force === "boolean" || force === undefined ) {
                if ( !speed ) {
                    // without speed parameter
                    return orig.apply( this, arguments );
                } else {
                    return $.effects.animateClass.call( this,
                        (force ? { add: classNames } : { remove: classNames }),
                        speed, easing, callback );
                }
            } else {
                // without force parameter
                return $.effects.animateClass.call( this,
                    { toggle: classNames }, force, speed, easing );
            }
        };
    })( $.fn.toggleClass ),
 
    switchClass: function( remove, add, speed, easing, callback) {
        return $.effects.animateClass.call( this, {
            add: add,
            remove: remove
        }, speed, easing, callback );
    }
});
 
})();
 
/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/
 
(function() {
 
$.extend( $.effects, {
    version: "1.11.4",
 
    // Saves a set of properties in a data storage
    save: function( element, set ) {
        for ( var i = 0; i < set.length; i++ ) {
            if ( set[ i ] !== null ) {
                element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
            }
        }
    },
 
    // Restores a set of previously saved properties from a data storage
    restore: function( element, set ) {
        var val, i;
        for ( i = 0; i < set.length; i++ ) {
            if ( set[ i ] !== null ) {
                val = element.data( dataSpace + set[ i ] );
                // support: jQuery 1.6.2
                // http://bugs.jquery.com/ticket/9917
                // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
                // We can't differentiate between "" and 0 here, so we just assume
                // empty string since it's likely to be a more common value...
                if ( val === undefined ) {
                    val = "";
                }
                element.css( set[ i ], val );
            }
        }
    },
 
    setMode: function( el, mode ) {
        if (mode === "toggle") {
            mode = el.is( ":hidden" ) ? "show" : "hide";
        }
        return mode;
    },
 
    // Translates a [top,left] array into a baseline value
    // this should be a little more flexible in the future to handle a string & hash
    getBaseline: function( origin, original ) {
        var y, x;
        switch ( origin[ 0 ] ) {
            case "top": y = 0; break;
            case "middle": y = 0.5; break;
            case "bottom": y = 1; break;
            default: y = origin[ 0 ] / original.height;
        }
        switch ( origin[ 1 ] ) {
            case "left": x = 0; break;
            case "center": x = 0.5; break;
            case "right": x = 1; break;
            default: x = origin[ 1 ] / original.width;
        }
        return {
            x: x,
            y: y
        };
    },
 
    // Wraps the element around a wrapper that copies position properties
    createWrapper: function( element ) {
 
        // if the element is already wrapped, return it
        if ( element.parent().is( ".ui-effects-wrapper" )) {
            return element.parent();
        }
 
        // wrap the element
        var props = {
                width: element.outerWidth(true),
                height: element.outerHeight(true),
                "float": element.css( "float" )
            },
            wrapper = $( "<div></div>" )
                .addClass( "ui-effects-wrapper" )
                .css({
                    fontSize: "100%",
                    background: "transparent",
                    border: "none",
                    margin: 0,
                    padding: 0
                }),
            // Store the size in case width/height are defined in % - Fixes #5245
            size = {
                width: element.width(),
                height: element.height()
            },
            active = document.activeElement;
 
        // support: Firefox
        // Firefox incorrectly exposes anonymous content
        // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
        try {
            active.id;
        } catch ( e ) {
            active = document.body;
        }
 
        element.wrap( wrapper );
 
        // Fixes #7595 - Elements lose focus when wrapped.
        if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
            $( active ).focus();
        }
 
        wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
 
        // transfer positioning properties to the wrapper
        if ( element.css( "position" ) === "static" ) {
            wrapper.css({ position: "relative" });
            element.css({ position: "relative" });
        } else {
            $.extend( props, {
                position: element.css( "position" ),
                zIndex: element.css( "z-index" )
            });
            $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
                props[ pos ] = element.css( pos );
                if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
                    props[ pos ] = "auto";
                }
            });
            element.css({
                position: "relative",
                top: 0,
                left: 0,
                right: "auto",
                bottom: "auto"
            });
        }
        element.css(size);
 
        return wrapper.css( props ).show();
    },
 
    removeWrapper: function( element ) {
        var active = document.activeElement;
 
        if ( element.parent().is( ".ui-effects-wrapper" ) ) {
            element.parent().replaceWith( element );
 
            // Fixes #7595 - Elements lose focus when wrapped.
            if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
                $( active ).focus();
            }
        }
 
        return element;
    },
 
    setTransition: function( element, list, factor, value ) {
        value = value || {};
        $.each( list, function( i, x ) {
            var unit = element.cssUnit( x );
            if ( unit[ 0 ] > 0 ) {
                value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
            }
        });
        return value;
    }
});
 
// return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {
 
    // allow passing all options as the first parameter
    if ( $.isPlainObject( effect ) ) {
        options = effect;
        effect = effect.effect;
    }
 
    // convert to an object
    effect = { effect: effect };
 
    // catch (effect, null, ...)
    if ( options == null ) {
        options = {};
    }
 
    // catch (effect, callback)
    if ( $.isFunction( options ) ) {
        callback = options;
        speed = null;
        options = {};
    }
 
    // catch (effect, speed, ?)
    if ( typeof options === "number" || $.fx.speeds[ options ] ) {
        callback = speed;
        speed = options;
        options = {};
    }
 
    // catch (effect, options, callback)
    if ( $.isFunction( speed ) ) {
        callback = speed;
        speed = null;
    }
 
    // add options to effect
    if ( options ) {
        $.extend( effect, options );
    }
 
    speed = speed || options.duration;
    effect.duration = $.fx.off ? 0 :
        typeof speed === "number" ? speed :
        speed in $.fx.speeds ? $.fx.speeds[ speed ] :
        $.fx.speeds._default;
 
    effect.complete = callback || options.complete;
 
    return effect;
}
 
function standardAnimationOption( option ) {
    // Valid standard speeds (nothing, number, named speed)
    if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
        return true;
    }
 
    // Invalid strings - treat as "normal" speed
    if ( typeof option === "string" && !$.effects.effect[ option ] ) {
        return true;
    }
 
    // Complete callback
    if ( $.isFunction( option ) ) {
        return true;
    }
 
    // Options hash (but not naming an effect)
    if ( typeof option === "object" && !option.effect ) {
        return true;
    }
 
    // Didn't match any standard API
    return false;
}
 
$.fn.extend({
    effect: function( /* effect, options, speed, callback */ ) {
        var args = _normalizeArguments.apply( this, arguments ),
            mode = args.mode,
            queue = args.queue,
            effectMethod = $.effects.effect[ args.effect ];
 
        if ( $.fx.off || !effectMethod ) {
            // delegate to the original method (e.g., .show()) if possible
            if ( mode ) {
                return this[ mode ]( args.duration, args.complete );
            } else {
                return this.each( function() {
                    if ( args.complete ) {
                        args.complete.call( this );
                    }
                });
            }
        }
 
        function run( next ) {
            var elem = $( this ),
                complete = args.complete,
                mode = args.mode;
 
            function done() {
                if ( $.isFunction( complete ) ) {
                    complete.call( elem[0] );
                }
                if ( $.isFunction( next ) ) {
                    next();
                }
            }
 
            // If the element already has the correct final state, delegate to
            // the core methods so the internal tracking of "olddisplay" works.
            if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
                elem[ mode ]();
                done();
            } else {
                effectMethod.call( elem[0], args, done );
            }
        }
 
        return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
    },
 
    show: (function( orig ) {
        return function( option ) {
            if ( standardAnimationOption( option ) ) {
                return orig.apply( this, arguments );
            } else {
                var args = _normalizeArguments.apply( this, arguments );
                args.mode = "show";
                return this.effect.call( this, args );
            }
        };
    })( $.fn.show ),
 
    hide: (function( orig ) {
        return function( option ) {
            if ( standardAnimationOption( option ) ) {
                return orig.apply( this, arguments );
            } else {
                var args = _normalizeArguments.apply( this, arguments );
                args.mode = "hide";
                return this.effect.call( this, args );
            }
        };
    })( $.fn.hide ),
 
    toggle: (function( orig ) {
        return function( option ) {
            if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
                return orig.apply( this, arguments );
            } else {
                var args = _normalizeArguments.apply( this, arguments );
                args.mode = "toggle";
                return this.effect.call( this, args );
            }
        };
    })( $.fn.toggle ),
 
    // helper functions
    cssUnit: function(key) {
        var style = this.css( key ),
            val = [];
 
        $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
            if ( style.indexOf( unit ) > 0 ) {
                val = [ parseFloat( style ), unit ];
            }
        });
        return val;
    }
});
 
})();
 
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
 
(function() {
 
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
 
var baseEasings = {};
 
$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
    baseEasings[ name ] = function( p ) {
        return Math.pow( p, i + 2 );
    };
});
 
$.extend( baseEasings, {
    Sine: function( p ) {
        return 1 - Math.cos( p * Math.PI / 2 );
    },
    Circ: function( p ) {
        return 1 - Math.sqrt( 1 - p * p );
    },
    Elastic: function( p ) {
        return p === 0 || p === 1 ? p :
            -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
    },
    Back: function( p ) {
        return p * p * ( 3 * p - 2 );
    },
    Bounce: function( p ) {
        var pow2,
            bounce = 4;
 
        while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
        return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
    }
});
 
$.each( baseEasings, function( name, easeIn ) {
    $.easing[ "easeIn" + name ] = easeIn;
    $.easing[ "easeOut" + name ] = function( p ) {
        return 1 - easeIn( 1 - p );
    };
    $.easing[ "easeInOut" + name ] = function( p ) {
        return p < 0.5 ?
            easeIn( p * 2 ) / 2 :
            1 - easeIn( p * -2 + 2 ) / 2;
    };
});
 
})();
 
var effect = $.effects;
 
 
/*!
 * jQuery UI Effects Blind 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/blind-effect/
 */
 
 
var effectBlind = $.effects.effect.blind = function( o, done ) {
    // Create element
    var el = $( this ),
        rvertical = /up|down|vertical/,
        rpositivemotion = /up|left|vertical|horizontal/,
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "hide" ),
        direction = o.direction || "up",
        vertical = rvertical.test( direction ),
        ref = vertical ? "height" : "width",
        ref2 = vertical ? "top" : "left",
        motion = rpositivemotion.test( direction ),
        animation = {},
        show = mode === "show",
        wrapper, distance, margin;
 
    // if already wrapped, the wrapper's properties are my property. #6245
    if ( el.parent().is( ".ui-effects-wrapper" ) ) {
        $.effects.save( el.parent(), props );
    } else {
        $.effects.save( el, props );
    }
    el.show();
    wrapper = $.effects.createWrapper( el ).css({
        overflow: "hidden"
    });
 
    distance = wrapper[ ref ]();
    margin = parseFloat( wrapper.css( ref2 ) ) || 0;
 
    animation[ ref ] = show ? distance : 0;
    if ( !motion ) {
        el
            .css( vertical ? "bottom" : "right", 0 )
            .css( vertical ? "top" : "left", "auto" )
            .css({ position: "absolute" });
 
        animation[ ref2 ] = show ? margin : distance + margin;
    }
 
    // start at 0 if we are showing
    if ( show ) {
        wrapper.css( ref, 0 );
        if ( !motion ) {
            wrapper.css( ref2, margin + distance );
        }
    }
 
    // Animate
    wrapper.animate( animation, {
        duration: o.duration,
        easing: o.easing,
        queue: false,
        complete: function() {
            if ( mode === "hide" ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        }
    });
};
 
 
/*!
 * jQuery UI Effects Bounce 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/bounce-effect/
 */
 
 
var effectBounce = $.effects.effect.bounce = function( o, done ) {
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
 
        // defaults:
        mode = $.effects.setMode( el, o.mode || "effect" ),
        hide = mode === "hide",
        show = mode === "show",
        direction = o.direction || "up",
        distance = o.distance,
        times = o.times || 5,
 
        // number of internal animations
        anims = times * 2 + ( show || hide ? 1 : 0 ),
        speed = o.duration / anims,
        easing = o.easing,
 
        // utility:
        ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
        motion = ( direction === "up" || direction === "left" ),
        i,
        upAnim,
        downAnim,
 
        // we will need to re-assemble the queue to stack our animations in place
        queue = el.queue(),
        queuelen = queue.length;
 
    // Avoid touching opacity to prevent clearType and PNG issues in IE
    if ( show || hide ) {
        props.push( "opacity" );
    }
 
    $.effects.save( el, props );
    el.show();
    $.effects.createWrapper( el ); // Create Wrapper
 
    // default distance for the BIGGEST bounce is the outer Distance / 3
    if ( !distance ) {
        distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
    }
 
    if ( show ) {
        downAnim = { opacity: 1 };
        downAnim[ ref ] = 0;
 
        // if we are showing, force opacity 0 and set the initial position
        // then do the "first" animation
        el.css( "opacity", 0 )
            .css( ref, motion ? -distance * 2 : distance * 2 )
            .animate( downAnim, speed, easing );
    }
 
    // start at the smallest distance if we are hiding
    if ( hide ) {
        distance = distance / Math.pow( 2, times - 1 );
    }
 
    downAnim = {};
    downAnim[ ref ] = 0;
    // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
    for ( i = 0; i < times; i++ ) {
        upAnim = {};
        upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
 
        el.animate( upAnim, speed, easing )
            .animate( downAnim, speed, easing );
 
        distance = hide ? distance * 2 : distance / 2;
    }
 
    // Last Bounce when Hiding
    if ( hide ) {
        upAnim = { opacity: 0 };
        upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
 
        el.animate( upAnim, speed, easing );
    }
 
    el.queue(function() {
        if ( hide ) {
            el.hide();
        }
        $.effects.restore( el, props );
        $.effects.removeWrapper( el );
        done();
    });
 
    // inject all the animations we just queued to be first in line (after "inprogress")
    if ( queuelen > 1) {
        queue.splice.apply( queue,
            [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
    }
    el.dequeue();
 
};
 
 
/*!
 * jQuery UI Effects Clip 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/clip-effect/
 */
 
 
var effectClip = $.effects.effect.clip = function( o, done ) {
    // Create element
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "hide" ),
        show = mode === "show",
        direction = o.direction || "vertical",
        vert = direction === "vertical",
        size = vert ? "height" : "width",
        position = vert ? "top" : "left",
        animation = {},
        wrapper, animate, distance;
 
    // Save & Show
    $.effects.save( el, props );
    el.show();
 
    // Create Wrapper
    wrapper = $.effects.createWrapper( el ).css({
        overflow: "hidden"
    });
    animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
    distance = animate[ size ]();
 
    // Shift
    if ( show ) {
        animate.css( size, 0 );
        animate.css( position, distance / 2 );
    }
 
    // Create Animation Object:
    animation[ size ] = show ? distance : 0;
    animation[ position ] = show ? 0 : distance / 2;
 
    // Animate
    animate.animate( animation, {
        queue: false,
        duration: o.duration,
        easing: o.easing,
        complete: function() {
            if ( !show ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        }
    });
 
};
 
 
/*!
 * jQuery UI Effects Drop 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/drop-effect/
 */
 
 
var effectDrop = $.effects.effect.drop = function( o, done ) {
 
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "hide" ),
        show = mode === "show",
        direction = o.direction || "left",
        ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
        motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
        animation = {
            opacity: show ? 1 : 0
        },
        distance;
 
    // Adjust
    $.effects.save( el, props );
    el.show();
    $.effects.createWrapper( el );
 
    distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
 
    if ( show ) {
        el
            .css( "opacity", 0 )
            .css( ref, motion === "pos" ? -distance : distance );
    }
 
    // Animation
    animation[ ref ] = ( show ?
        ( motion === "pos" ? "+=" : "-=" ) :
        ( motion === "pos" ? "-=" : "+=" ) ) +
        distance;
 
    // Animate
    el.animate( animation, {
        queue: false,
        duration: o.duration,
        easing: o.easing,
        complete: function() {
            if ( mode === "hide" ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        }
    });
};
 
 
/*!
 * jQuery UI Effects Explode 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/explode-effect/
 */
 
 
var effectExplode = $.effects.effect.explode = function( o, done ) {
 
    var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
        cells = rows,
        el = $( this ),
        mode = $.effects.setMode( el, o.mode || "hide" ),
        show = mode === "show",
 
        // show and then visibility:hidden the element before calculating offset
        offset = el.show().css( "visibility", "hidden" ).offset(),
 
        // width and height of a piece
        width = Math.ceil( el.outerWidth() / cells ),
        height = Math.ceil( el.outerHeight() / rows ),
        pieces = [],
 
        // loop
        i, j, left, top, mx, my;
 
    // children animate complete:
    function childComplete() {
        pieces.push( this );
        if ( pieces.length === rows * cells ) {
            animComplete();
        }
    }
 
    // clone the element for each row and cell.
    for ( i = 0; i < rows ; i++ ) { // ===>
        top = offset.top + i * height;
        my = i - ( rows - 1 ) / 2 ;
 
        for ( j = 0; j < cells ; j++ ) { // |||
            left = offset.left + j * width;
            mx = j - ( cells - 1 ) / 2 ;
 
            // Create a clone of the now hidden main element that will be absolute positioned
            // within a wrapper div off the -left and -top equal to size of our pieces
            el
                .clone()
                .appendTo( "body" )
                .wrap( "<div></div>" )
                .css({
                    position: "absolute",
                    visibility: "visible",
                    left: -j * width,
                    top: -i * height
                })
 
            // select the wrapper - make it overflow: hidden and absolute positioned based on
            // where the original was located +left and +top equal to the size of pieces
                .parent()
                .addClass( "ui-effects-explode" )
                .css({
                    position: "absolute",
                    overflow: "hidden",
                    width: width,
                    height: height,
                    left: left + ( show ? mx * width : 0 ),
                    top: top + ( show ? my * height : 0 ),
                    opacity: show ? 0 : 1
                }).animate({
                    left: left + ( show ? 0 : mx * width ),
                    top: top + ( show ? 0 : my * height ),
                    opacity: show ? 1 : 0
                }, o.duration || 500, o.easing, childComplete );
        }
    }
 
    function animComplete() {
        el.css({
            visibility: "visible"
        });
        $( pieces ).remove();
        if ( !show ) {
            el.hide();
        }
        done();
    }
};
 
 
/*!
 * jQuery UI Effects Fade 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/fade-effect/
 */
 
 
var effectFade = $.effects.effect.fade = function( o, done ) {
    var el = $( this ),
        mode = $.effects.setMode( el, o.mode || "toggle" );
 
    el.animate({
        opacity: mode
    }, {
        queue: false,
        duration: o.duration,
        easing: o.easing,
        complete: done
    });
};
 
 
/*!
 * jQuery UI Effects Fold 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/fold-effect/
 */
 
 
var effectFold = $.effects.effect.fold = function( o, done ) {
 
    // Create element
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "hide" ),
        show = mode === "show",
        hide = mode === "hide",
        size = o.size || 15,
        percent = /([0-9]+)%/.exec( size ),
        horizFirst = !!o.horizFirst,
        widthFirst = show !== horizFirst,
        ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
        duration = o.duration / 2,
        wrapper, distance,
        animation1 = {},
        animation2 = {};
 
    $.effects.save( el, props );
    el.show();
 
    // Create Wrapper
    wrapper = $.effects.createWrapper( el ).css({
        overflow: "hidden"
    });
    distance = widthFirst ?
        [ wrapper.width(), wrapper.height() ] :
        [ wrapper.height(), wrapper.width() ];
 
    if ( percent ) {
        size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
    }
    if ( show ) {
        wrapper.css( horizFirst ? {
            height: 0,
            width: size
        } : {
            height: size,
            width: 0
        });
    }
 
    // Animation
    animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
    animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
 
    // Animate
    wrapper
        .animate( animation1, duration, o.easing )
        .animate( animation2, duration, o.easing, function() {
            if ( hide ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        });
 
};
 
 
/*!
 * jQuery UI Effects Highlight 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/highlight-effect/
 */
 
 
var effectHighlight = $.effects.effect.highlight = function( o, done ) {
    var elem = $( this ),
        props = [ "backgroundImage", "backgroundColor", "opacity" ],
        mode = $.effects.setMode( elem, o.mode || "show" ),
        animation = {
            backgroundColor: elem.css( "backgroundColor" )
        };
 
    if (mode === "hide") {
        animation.opacity = 0;
    }
 
    $.effects.save( elem, props );
 
    elem
        .show()
        .css({
            backgroundImage: "none",
            backgroundColor: o.color || "#ffff99"
        })
        .animate( animation, {
            queue: false,
            duration: o.duration,
            easing: o.easing,
            complete: function() {
                if ( mode === "hide" ) {
                    elem.hide();
                }
                $.effects.restore( elem, props );
                done();
            }
        });
};
 
 
/*!
 * jQuery UI Effects Size 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/size-effect/
 */
 
 
var effectSize = $.effects.effect.size = function( o, done ) {
 
    // Create element
    var original, baseline, factor,
        el = $( this ),
        props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
 
        // Always restore
        props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
 
        // Copy for children
        props2 = [ "width", "height", "overflow" ],
        cProps = [ "fontSize" ],
        vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
        hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
 
        // Set options
        mode = $.effects.setMode( el, o.mode || "effect" ),
        restore = o.restore || mode !== "effect",
        scale = o.scale || "both",
        origin = o.origin || [ "middle", "center" ],
        position = el.css( "position" ),
        props = restore ? props0 : props1,
        zero = {
            height: 0,
            width: 0,
            outerHeight: 0,
            outerWidth: 0
        };
 
    if ( mode === "show" ) {
        el.show();
    }
    original = {
        height: el.height(),
        width: el.width(),
        outerHeight: el.outerHeight(),
        outerWidth: el.outerWidth()
    };
 
    if ( o.mode === "toggle" && mode === "show" ) {
        el.from = o.to || zero;
        el.to = o.from || original;
    } else {
        el.from = o.from || ( mode === "show" ? zero : original );
        el.to = o.to || ( mode === "hide" ? zero : original );
    }
 
    // Set scaling factor
    factor = {
        from: {
            y: el.from.height / original.height,
            x: el.from.width / original.width
        },
        to: {
            y: el.to.height / original.height,
            x: el.to.width / original.width
        }
    };
 
    // Scale the css box
    if ( scale === "box" || scale === "both" ) {
 
        // Vertical props scaling
        if ( factor.from.y !== factor.to.y ) {
            props = props.concat( vProps );
            el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
            el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
        }
 
        // Horizontal props scaling
        if ( factor.from.x !== factor.to.x ) {
            props = props.concat( hProps );
            el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
            el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
        }
    }
 
    // Scale the content
    if ( scale === "content" || scale === "both" ) {
 
        // Vertical props scaling
        if ( factor.from.y !== factor.to.y ) {
            props = props.concat( cProps ).concat( props2 );
            el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
            el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
        }
    }
 
    $.effects.save( el, props );
    el.show();
    $.effects.createWrapper( el );
    el.css( "overflow", "hidden" ).css( el.from );
 
    // Adjust
    if (origin) { // Calculate baseline shifts
        baseline = $.effects.getBaseline( origin, original );
        el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
        el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
        el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
        el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
    }
    el.css( el.from ); // set top & left
 
    // Animate
    if ( scale === "content" || scale === "both" ) { // Scale the children
 
        // Add margins/font-size
        vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
        hProps = hProps.concat([ "marginLeft", "marginRight" ]);
        props2 = props0.concat(vProps).concat(hProps);
 
        el.find( "*[width]" ).each( function() {
            var child = $( this ),
                c_original = {
                    height: child.height(),
                    width: child.width(),
                    outerHeight: child.outerHeight(),
                    outerWidth: child.outerWidth()
                };
            if (restore) {
                $.effects.save(child, props2);
            }
 
            child.from = {
                height: c_original.height * factor.from.y,
                width: c_original.width * factor.from.x,
                outerHeight: c_original.outerHeight * factor.from.y,
                outerWidth: c_original.outerWidth * factor.from.x
            };
            child.to = {
                height: c_original.height * factor.to.y,
                width: c_original.width * factor.to.x,
                outerHeight: c_original.height * factor.to.y,
                outerWidth: c_original.width * factor.to.x
            };
 
            // Vertical props scaling
            if ( factor.from.y !== factor.to.y ) {
                child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
                child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
            }
 
            // Horizontal props scaling
            if ( factor.from.x !== factor.to.x ) {
                child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
                child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
            }
 
            // Animate children
            child.css( child.from );
            child.animate( child.to, o.duration, o.easing, function() {
 
                // Restore children
                if ( restore ) {
                    $.effects.restore( child, props2 );
                }
            });
        });
    }
 
    // Animate
    el.animate( el.to, {
        queue: false,
        duration: o.duration,
        easing: o.easing,
        complete: function() {
            if ( el.to.opacity === 0 ) {
                el.css( "opacity", el.from.opacity );
            }
            if ( mode === "hide" ) {
                el.hide();
            }
            $.effects.restore( el, props );
            if ( !restore ) {
 
                // we need to calculate our new positioning based on the scaling
                if ( position === "static" ) {
                    el.css({
                        position: "relative",
                        top: el.to.top,
                        left: el.to.left
                    });
                } else {
                    $.each([ "top", "left" ], function( idx, pos ) {
                        el.css( pos, function( _, str ) {
                            var val = parseInt( str, 10 ),
                                toRef = idx ? el.to.left : el.to.top;
 
                            // if original was "auto", recalculate the new value from wrapper
                            if ( str === "auto" ) {
                                return toRef + "px";
                            }
 
                            return val + toRef + "px";
                        });
                    });
                }
            }
 
            $.effects.removeWrapper( el );
            done();
        }
    });
 
};
 
 
/*!
 * jQuery UI Effects Scale 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/scale-effect/
 */
 
 
var effectScale = $.effects.effect.scale = function( o, done ) {
 
    // Create element
    var el = $( this ),
        options = $.extend( true, {}, o ),
        mode = $.effects.setMode( el, o.mode || "effect" ),
        percent = parseInt( o.percent, 10 ) ||
            ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
        direction = o.direction || "both",
        origin = o.origin,
        original = {
            height: el.height(),
            width: el.width(),
            outerHeight: el.outerHeight(),
            outerWidth: el.outerWidth()
        },
        factor = {
            y: direction !== "horizontal" ? (percent / 100) : 1,
            x: direction !== "vertical" ? (percent / 100) : 1
        };
 
    // We are going to pass this effect to the size effect:
    options.effect = "size";
    options.queue = false;
    options.complete = done;
 
    // Set default origin and restore for show/hide
    if ( mode !== "effect" ) {
        options.origin = origin || [ "middle", "center" ];
        options.restore = true;
    }
 
    options.from = o.from || ( mode === "show" ? {
        height: 0,
        width: 0,
        outerHeight: 0,
        outerWidth: 0
    } : original );
    options.to = {
        height: original.height * factor.y,
        width: original.width * factor.x,
        outerHeight: original.outerHeight * factor.y,
        outerWidth: original.outerWidth * factor.x
    };
 
    // Fade option to support puff
    if ( options.fade ) {
        if ( mode === "show" ) {
            options.from.opacity = 0;
            options.to.opacity = 1;
        }
        if ( mode === "hide" ) {
            options.from.opacity = 1;
            options.to.opacity = 0;
        }
    }
 
    // Animate
    el.effect( options );
 
};
 
 
/*!
 * jQuery UI Effects Puff 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/puff-effect/
 */
 
 
var effectPuff = $.effects.effect.puff = function( o, done ) {
    var elem = $( this ),
        mode = $.effects.setMode( elem, o.mode || "hide" ),
        hide = mode === "hide",
        percent = parseInt( o.percent, 10 ) || 150,
        factor = percent / 100,
        original = {
            height: elem.height(),
            width: elem.width(),
            outerHeight: elem.outerHeight(),
            outerWidth: elem.outerWidth()
        };
 
    $.extend( o, {
        effect: "scale",
        queue: false,
        fade: true,
        mode: mode,
        complete: done,
        percent: hide ? percent : 100,
        from: hide ?
            original :
            {
                height: original.height * factor,
                width: original.width * factor,
                outerHeight: original.outerHeight * factor,
                outerWidth: original.outerWidth * factor
            }
    });
 
    elem.effect( o );
};
 
 
/*!
 * jQuery UI Effects Pulsate 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/pulsate-effect/
 */
 
 
var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
    var elem = $( this ),
        mode = $.effects.setMode( elem, o.mode || "show" ),
        show = mode === "show",
        hide = mode === "hide",
        showhide = ( show || mode === "hide" ),
 
        // showing or hiding leaves of the "last" animation
        anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
        duration = o.duration / anims,
        animateTo = 0,
        queue = elem.queue(),
        queuelen = queue.length,
        i;
 
    if ( show || !elem.is(":visible")) {
        elem.css( "opacity", 0 ).show();
        animateTo = 1;
    }
 
    // anims - 1 opacity "toggles"
    for ( i = 1; i < anims; i++ ) {
        elem.animate({
            opacity: animateTo
        }, duration, o.easing );
        animateTo = 1 - animateTo;
    }
 
    elem.animate({
        opacity: animateTo
    }, duration, o.easing);
 
    elem.queue(function() {
        if ( hide ) {
            elem.hide();
        }
        done();
    });
 
    // We just queued up "anims" animations, we need to put them next in the queue
    if ( queuelen > 1 ) {
        queue.splice.apply( queue,
            [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
    }
    elem.dequeue();
};
 
 
/*!
 * jQuery UI Effects Shake 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/shake-effect/
 */
 
 
var effectShake = $.effects.effect.shake = function( o, done ) {
 
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
        mode = $.effects.setMode( el, o.mode || "effect" ),
        direction = o.direction || "left",
        distance = o.distance || 20,
        times = o.times || 3,
        anims = times * 2 + 1,
        speed = Math.round( o.duration / anims ),
        ref = (direction === "up" || direction === "down") ? "top" : "left",
        positiveMotion = (direction === "up" || direction === "left"),
        animation = {},
        animation1 = {},
        animation2 = {},
        i,
 
        // we will need to re-assemble the queue to stack our animations in place
        queue = el.queue(),
        queuelen = queue.length;
 
    $.effects.save( el, props );
    el.show();
    $.effects.createWrapper( el );
 
    // Animation
    animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
    animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
    animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
 
    // Animate
    el.animate( animation, speed, o.easing );
 
    // Shakes
    for ( i = 1; i < times; i++ ) {
        el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
    }
    el
        .animate( animation1, speed, o.easing )
        .animate( animation, speed / 2, o.easing )
        .queue(function() {
            if ( mode === "hide" ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        });
 
    // inject all the animations we just queued to be first in line (after "inprogress")
    if ( queuelen > 1) {
        queue.splice.apply( queue,
            [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
    }
    el.dequeue();
 
};
 
 
/*!
 * jQuery UI Effects Slide 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/slide-effect/
 */
 
 
var effectSlide = $.effects.effect.slide = function( o, done ) {
 
    // Create element
    var el = $( this ),
        props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
        mode = $.effects.setMode( el, o.mode || "show" ),
        show = mode === "show",
        direction = o.direction || "left",
        ref = (direction === "up" || direction === "down") ? "top" : "left",
        positiveMotion = (direction === "up" || direction === "left"),
        distance,
        animation = {};
 
    // Adjust
    $.effects.save( el, props );
    el.show();
    distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
 
    $.effects.createWrapper( el ).css({
        overflow: "hidden"
    });
 
    if ( show ) {
        el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
    }
 
    // Animation
    animation[ ref ] = ( show ?
        ( positiveMotion ? "+=" : "-=") :
        ( positiveMotion ? "-=" : "+=")) +
        distance;
 
    // Animate
    el.animate( animation, {
        queue: false,
        duration: o.duration,
        easing: o.easing,
        complete: function() {
            if ( mode === "hide" ) {
                el.hide();
            }
            $.effects.restore( el, props );
            $.effects.removeWrapper( el );
            done();
        }
    });
};
 
 
/*!
 * jQuery UI Effects Transfer 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/transfer-effect/
 */
 
 
var effectTransfer = $.effects.effect.transfer = function( o, done ) {
    var elem = $( this ),
        target = $( o.to ),
        targetFixed = target.css( "position" ) === "fixed",
        body = $("body"),
        fixTop = targetFixed ? body.scrollTop() : 0,
        fixLeft = targetFixed ? body.scrollLeft() : 0,
        endPosition = target.offset(),
        animation = {
            top: endPosition.top - fixTop,
            left: endPosition.left - fixLeft,
            height: target.innerHeight(),
            width: target.innerWidth()
        },
        startPosition = elem.offset(),
        transfer = $( "<div class='ui-effects-transfer'></div>" )
            .appendTo( document.body )
            .addClass( o.className )
            .css({
                top: startPosition.top - fixTop,
                left: startPosition.left - fixLeft,
                height: elem.innerHeight(),
                width: elem.innerWidth(),
                position: targetFixed ? "fixed" : "absolute"
            })
            .animate( animation, o.duration, o.easing, function() {
                transfer.remove();
                done();
            });
};
 
 
 
}));;/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-flexbox-shiv-cssclasses-testprop-testallprops-domprefixes-load
 */
;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.flexbox=function(){return D("flexWrap")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};;// http://scrollsample.appspot.com/items
// By John Mueller: https://plus.google.com/u/0/+JohnMueller/posts
 
var next_data_url; // replaced when loading more
var prev_data_url; // replaced when loading more
var next_data_cache;
var prev_data_cache;
var last_scroll = 0;
var is_loading = 0; // simple lock to prevent loading when loading
var hide_on_load = false; // ID that can be hidden when content has been loaded
 
function loadFollowing() {
    if (next_data_url=="") {
        $('div.pagination').show();
    } else {
        is_loading = 1; // note: this will break when the server doesn't respond
        $('div.pagination').hide();
 
        function showFollowing(data) {
            $('div.listitempage:last').after(data.response);
            next_data_url = data.next_data_url;
            next_data_cache = false;
            $.getJSON(next_data_url, function(preview_data) {
                next_data_cache = preview_data;
            });
        }
        if (next_data_cache) {
            showFollowing(next_data_cache);
            is_loading = 0;
        } else {
            $.getJSON(next_data_url, function(data) {
                showFollowing(data);
                is_loading = 0;
            });
        }
    }
};
 
function loadPrevious() {
    if (prev_data_url=="") {
        $('div.pagination').show();
    } else {
        is_loading = 1; // note: this will break when the server doesn't respond
        $('div.pagination').hide();
 
        function showPrevious(data) {
            $('div.listitempage:first').before(data.response);
            var item_height = $("div.listitempage:first").height();
            window.scrollTo(0, $(window).scrollTop()+item_height); // adjust scroll
            prev_data_url = data.prev_data_url;
            prev_data_cache = false;
            $.getJSON(prev_data_url, function(preview_data) {
                prev_data_cache = preview_data;
            });
            if (hide_on_load) {
                $(hide_on_load).hide();
                hide_on_load = false;
            }
        }
        if (prev_data_cache) {
            showPrevious(prev_data_cache);
            is_loading = 0;
        } else {
            $.getJSON(prev_data_url, function(data) {
                showPrevious(data);
                is_loading = 0;
            });
        }
    }
};
 
function mostlyVisible(element) {
    // if ca 25% of element is visible
    var scroll_pos = $(window).scrollTop();
    var window_height = $(window).height();
    var el_top = $(element).offset().top;
    var el_height = $(element).height();
    var el_bottom = el_top + el_height;
    return ((el_bottom - el_height*0.25 > scroll_pos) &&
        (el_top < (scroll_pos+0.5*window_height)));
}
 
function initPaginator() {
    $(window).scroll(function() {
        // handle scroll events to update content
        var scroll_pos = $(window).scrollTop();
        if (scroll_pos >= 0.9*($(document).height() - $(window).height())) {
            if (is_loading==0) loadFollowing();
        }
        if (scroll_pos <= 0.9*$("#header").height()) {
            if (is_loading==0) loadPrevious();
        }
        // Adjust the URL based on the top item shown
        // for reasonable amounts of items
        if (Math.abs(scroll_pos - last_scroll)>$(window).height()*0.1) {
            last_scroll = scroll_pos;
            $(".listitempage").each(function(index) {
                if (mostlyVisible(this)) {
                    history.replaceState(null, null, $(this).attr("data-url"));
                    $("#pagination").html($(this).attr("data-pagination"));
                    return(false);
                }
            });
        }
    });
    $(document).ready(function () {
        // if we have enough room, load the next batch
        if ($(window).height()>$("#scrollingcontent").height()) {
            if (next_data_url!="") {
                loadFollowing();
            } else {
                var filler = document.createElement("div");
                filler.id = "filler";
                filler.style.height = ($(window).height() -
                    $("#scrollingcontent").height())+ "px";
                $("#scrollingcontent").after(filler);
                hide_on_load = "filler";
            }
        }
        // scroll down to hide empty room
        head_height = $("#header").height();
        window.scrollTo(0, head_height);
    });
}
 
function primeCache() {
    if(prev_data_url) {
        $.getJSON(prev_data_url, function(data) { prev_data_cache=data; } );
    }
    if(next_data_url) {
        $.getJSON(next_data_url, function(data) { next_data_cache=data; } );
    }
}
 
;var Ajax = (function($) {
    var my = {}, onLoad = [], isLoaded = false;
 
    my.getContent = function(url, boxId, params) {
        // defer that after page load
        onLoad.push(function() {
            var $box = $('#' + boxId);
 
            $box.html('<i class="fa fa-spinner fa-spin fa-2x"></i>').addClass('ajax-loading');
 
            $.get(url, params, function(html) {
                $box.html(html).removeClass('ajax-loading');
            });
        });
        if (isLoaded) {
            onLoad[onLoad.length - 1]();
        }
    };
 
    my.refreshPage = function(url, dialogBox) {
        // defer that after page load
        onLoad.push(function() {
            $('#' + dialogBox).modal('show');
            window.location.href = url;
        });
        if (isLoaded) {
            onLoad[onLoad.length - 1]();
        }
    };
 
    my.documentReady = function() {
        for (var i = 0; i < onLoad.length; i++) {
            onLoad[i]();
        }
        isLoaded = true;
    };
 
    return my;
}(jQuery));
 
jQuery(document).ready(Ajax.documentReady);;/*
 Google Maps
 https://developers.google.com/maps/documentation/javascript/examples/
 https://developers.google.com/maps/documentation/javascript/directions?hl=de#DisplayingResults
 */
 
function loadGoogleMap(mapId, geo, myGeoLocation, $getMyLocation, $ajaxLoad) {
    var map, directionsDisplay, directionsService, markers = [], bounds, myLocation;
 
    if (mapId == null) {
        mapId = 'map-canvas';
    }
 
    if (geo.length > 0) {
        directionsService = new google.maps.DirectionsService();
        bounds = new google.maps.LatLngBounds();
    }
 
    // Create an array of styles.
    var mapStyle = [
        {
            stylers: [
                { saturation: -100 }
            ]
        }
    ];
 
    function initialize() {
        /* Add a marker to the map and push to the array. */
        function addMarker(location, title, image, index, openByDefault, tooltip) {
            var marker = new google.maps.Marker({
                position: location,
                map: map,
                title: (tooltip ? tooltip : null),
                icon: image,
                animation: google.maps.Animation.DROP,
                zIndex: google.maps.Marker.MAX_ZINDEX + index
            });
 
            attachMessage(marker, title, openByDefault);
            bounds.extend(location);
            google.maps.event.addListener(marker, 'click', function() {
                Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
            });
            markers.push(marker);
        }
 
        /* Show Message Box */
        function attachMessage(marker, content, openByDefault) {
            var infowindow = new google.maps.InfoWindow({
                content: content
            });
            google.maps.event.addListener(marker, 'click', function() {
                infowindow.open(marker.get('map'), marker);
            });
            if (openByDefault == true) {
                infowindow.open(marker.get('map'), marker);
            }
        }
 
        function getGeoSuccess(position) {
            var markerLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">Mein Standort</div>', '/img/map_marker_green.png', 0, false);
            myLocation = position.coords.latitude + ', ' + position.coords.longitude;
            $("#routeStart").val('Mein Standort');
        }
 
        function getGeoError(errorCallback) {
 
        }
 
        /* remove a marker to the map and push to the array. */
        function removeLastMarker() {
            markers[markers.length - 1].setMap(null);
        }
 
        /* Sets the map on all markers in the array. */
        function setAllMap(map) {
            for (var i = 0; i < markers.length; i++) {
                markers[i].setMap(map);
                markers[i].showInfoWindow();
            }
        }
 
        /* Removes the markers from the map, but keeps them in the array. */
        function clearMarkers() {
            setAllMap(null);
        }
 
        var mapOptions = {}, centerLatitude, centerLongitude, markerLocation, i, index;
 
        if (geo.length == 0) {
            mapOptions = {
                zoom: 6,
                center: new google.maps.LatLng(51, 9),
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                styles: mapStyle
            };
            map = new google.maps.Map(document.getElementById(mapId), mapOptions);
        } else {
            directionsDisplay = new google.maps.DirectionsRenderer();
            if (myGeoLocation != null) {
                centerLatitude = myGeoLocation['latitude'];
                centerLongitude = myGeoLocation['longitude'];
            } else {
                centerLatitude = geo[0]['latitude'];
                centerLongitude = geo[0]['longitude'];
            }
            mapOptions = {
                zoom: 12,
                center: new google.maps.LatLng(centerLatitude, centerLongitude),
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                styles: mapStyle
            };
            map = new google.maps.Map(document.getElementById(mapId), mapOptions);
            directionsDisplay.setMap(map);
            directionsDisplay.setPanel(document.getElementById("directionsPanel-" + mapId));
            /* company marks */
            for (i = 0; i < geo.length; i++) {
                if (geo[i]['latitude'] > 0 && geo[i]['longitude'] > 0 && geo[i]['address'] != '') {
                    markerLocation = new google.maps.LatLng(geo[i]['latitude'], geo[i]['longitude']);
                }
                index = 0;
                if (geo[i]['icon'] == 'marker') {
                    index = 1;
                }
 
                if (!geo[i]['color']) {
                    geo[i]['color'] = 'red';
                }
 
                addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">' + geo[i]['address'] + '</div>', '/img/map_' + geo[i]['icon'] + '_' + geo[i]['color'] + '.png', index, false, geo[i].name);
            }
            /* own marker */
            if (myGeoLocation != null) {
                if (myGeoLocation['latitude'] > 0 && myGeoLocation['longitude'] > 0 && myGeoLocation['address'] != '') {
                    markerLocation = new google.maps.LatLng(myGeoLocation['latitude'], myGeoLocation['longitude']);
                    addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">' + myGeoLocation['address'] + '</div>', '/img/map_marker_green.png', 1, true);
                }
            }
            /* routes */
            if (typeof geo[0]['address'] !== 'undefined') {
                if ($getMyLocation == true) {
                    if (navigator.geolocation) {
                        navigator.geolocation.getCurrentPosition(getGeoSuccess, getGeoError);
                    }
                }
            }
 
            google.maps.event.addListener(map, 'click', function() {
                Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
            });
            if (geo.length > 1) {
                map.fitBounds(bounds);
            }
 
            $("#calcRoute").click(function() {
                calcRoute();
 
            });
 
            function calcRoute() {
                // get the travelmode, startpoint and via point from the form
                var travelMode = $('input[name="travelMode"]:checked').val();
                var end = $("#routeEnd").val();
                var start = $("#routeStart").val();
                if (start == 'Mein Standort' && myLocation) {
                    start = myLocation;
                }
                var via = $("#routeVia").val();
 
                if (travelMode == 'TRANSIT') {
                    via = ''; // if the travel mode is transit, don't use the via waypoint because that will not work
                }
                var waypoints = []; // init an empty waypoints array
                if (via != '') {
                    // if waypoints (via) are set, add them to the waypoints array
                    waypoints.push({
                        location: via,
                        stopover: true
                    });
                }
                var request = {
                    origin: start,
                    destination: end,
                    waypoints: waypoints,
 
                    travelMode: google.maps.DirectionsTravelMode[travelMode]
                };
                directionsService.route(request, function(response, status) {
                    if (status == google.maps.DirectionsStatus.OK) {
                        $('#directionsPanel').empty(); // clear the directions panel before adding new directions
                        directionsDisplay.setDirections(response);
                        if ($("#routeStart").val() == 'Mein Standort') {
                            $("#routeStart").val(response.routes[0].legs[0].start_address);
                        }
                    } else {
                        // alert an error message when the route could nog be calculated.
                        if (status == 'ZERO_RESULTS') {
                            alert('No route could be found between the origin and destination.');
                        } else if (status == 'UNKNOWN_ERROR') {
                            alert('A directions request could not be processed due to a server error. The request may succeed if you try again.');
                        } else if (status == 'REQUEST_DENIED') {
                            alert('This webpage is not allowed to use the directions service.');
                        } else if (status == 'OVER_QUERY_LIMIT') {
                            alert('The webpage has gone over the requests limit in too short a period of time.');
                        } else if (status == 'NOT_FOUND') {
                            alert('At least one of the origin, destination, or waypoints could not be geocoded.');
                        } else if (status == 'INVALID_REQUEST') {
                            alert('The DirectionsRequest provided was invalid.');
                        } else {
                            alert("There was an unknown error in your request. Requeststatus: nn" + status);
                        }
                    }
                });
            }
        }
    }
 
    if ($ajaxLoad) {
        $(document).ajaxStop(initialize);
    } else {
        google.maps.event.addDomListener(window, 'load', initialize);
    }
}
 
;var CompanyAjaxLoad = (function($) {
    var my = {};
 
    my.getAdditionalCompanyInfo = function($select, $companyId, $hashTag, $scrollTo, $id, $boxId) {
        $('#termin-o-reservierung-vereinbaren').hide();
        $('#additionalCompanyInfo').empty();
 
        if (!$boxId) {
            $boxId = 'additionalCompanyInfo';
        }
        Ajax.getContent('/ajax.do/additionalCompanyInfo', $boxId, {
            'select': $select,
            'companyId': $companyId
        });
 
        if ($hashTag) {
            window.location.hash = $hashTag;
        }
 
        if ($scrollTo == true) {
            $("html, body").animate({ scrollTop: $('#pageHeader').offset().top }, 1000);
        }
 
        if ($id != false) {
            $('#navigationDetailList div').removeClass('gray');
            $('#navigation_' + $id).addClass('gray');
        }
 
        $('#navigationDetailList').removeClass('in');
 
        return false;
    };
 
    my.toggleFromNavigation = function(idNavigation, idBox, $scrollTo, companyInfo) {
        $('#navigationDetailList div').removeClass('gray');
        $('#' + idNavigation).addClass('gray');
 
        $('#navigationDetailList').removeClass('in');
 
        if (companyInfo == true) {
            $('#additionalCompanyInfo').empty();
        }
 
        $('#' + idBox).show();
        $('#' + idBox + ' .panel-collapse').addClass('in');
 
        if ($scrollTo == true) {
            $("html, body").animate({ scrollTop: ($('#' + idBox).offset().top) - 50 }, 1000);
        }
        return false;
    };
 
    my.claimDuplicate = function($companyId, $userId, $boxId) {
        Ajax.getContent('/ajax.do/claimDuplicate', $boxId, {
            'userId': $userId,
            'companyId': $companyId
        });
    };
 
    return my;
}(jQuery));
 
var Gallery = (function($) {
    var my = {}, imageList = '.image-list';
 
    my.showDialog = function(imageId) {
        var $active = $('#' + imageId);
 
        $(imageList).hide();
        $active.show();
    };
 
    my.slideImage = function(direction) {
        var $active = $(imageList).filter(":visible"), $first = $(imageList).first(), $last = $(imageList).last();
 
        $(imageList).hide();
 
        if (direction == 1) {
            if ($active.attr('id') == $last.attr('id')) {
                $first.toggle("slide", { direction: "right" });
            } else {
                $active.next().toggle("slide", { direction: "right" });
            }
        }
        if (direction == 0) {
            if ($active.attr('id') == $first.attr('id')) {
                $last.toggle("slide", { direction: "left" });
            } else {
                $active.prev().toggle("slide", { direction: "left" });
            }
        }
    };
 
    return my;
}(jQuery));
;var lead = (function ($) {
    var my = {};
 
    my.send = function (formId, modalId, messageId) {
        var $form = $('#'+formId), $btn = $('button[type=submit]', $form), t = $btn.text();
        $btn.disableButton(t);
 
        $.post('/lead.do', $form.serialize(), function (d) {
            if (d.status == 'ok') {
                $('#'+formId+' #message').val('');
                $('#'+modalId).modal('hide');
 
                $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msg + '</div></div>');
                if (d.msgUser) {
                    $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msgUser + '</div></div>');
                }
                $("html, body").animate({scrollTop: 0}, "slow");
            } else {
                $('#'+messageId).append('<div class="row"><div class="alert alert-danger noMargin" role="alert">' + d.msg + '</div></div>');
            }
 
            $btn.enableButton(t);
        });
    };
    return my;
}(jQuery, window));;$(document).ready(function() {
 
    $.doAjaxRequest = function(method, request, loader) {
        loader.addClass('loader');
        return $.ajax({
            url: 'ajax/get/' + method,
            cache: false,
            type: 'POST',
            dataType: 'json',
            data: request
        });
    };
 
    $.fn.disableButton = function(text) {
        if (text) {
            text += ' ';
        }
        this.attr('disabled', 'disabled').html((text || '') + '<i class="fa fa-spinner fa-spin"></i>');
        return this;
    };
 
    $.fn.enableButton = function(text, ok) {
        var $signal, that = this;
        if (text) {
            text += ' ';
        }
 
        this.attr('disabled', false);
 
        if (ok === true) {
            $signal = $('<i class="fa fa-check"></i>');
        } else {
            if (ok === false) {
                $signal = $('<i class="fa fa-times"></i>');
            }
        }
 
        if (typeof ok !== 'undefined') {
            this.html(text || '').append($signal);
            window.setTimeout(function() {
                $signal.fadeOut(300, function() {
                    that.html(text)
                })
            }, 2000);
        } else {
            this.html(text);
        }
 
        return this;
    };
 
    $.fn.handleResponse = function(response, css_class) {
        response = response || {};
        response = response.hasOwnProperty('data') && Object.size(response.data) ? response.data[Object.keys(response.data)[0]] : false;
        var size = !!response ? Object.size(response) : 0;
        var $select = $(css_class);
        if (size) {
            $select.find('option:gt(0)').remove();
            $select.append('<option value=\"' + response + '\">' + response + '</option>');
            setTimeout(function() {
                $select.prop('disabled', false);
                $select.val(response);
                $('#ort').focus();
            }, 0);
        } else {
            $select.find('option:gt(0)').remove();
        }
    };
 
    var $form = $('.simple-form form');
    if ($form.length) {
        var timeout, needReload = true;
        $('#plz').on('keyup', function(e) {
            var $this = $(this);
            $this.val($this.val().replace(/[^0-9]/g, ''));
            var zip = $this.val().length;
            if (zip < 5) {
                needReload = true;
            }
            if (needReload) {
                $('#ort').val('').prop('disabled', true);
                if (zip == 5) {
                    clearTimeout(timeout);
                    timeout = setTimeout(function() {
                        var $loader = $('#ort').parent();
                        $.doAjaxRequest('residence', { plz: $this.val() }, $loader)
                            .success(function(response) {
                                needReload = false;
                                $this.handleResponse(response, '#ort');
                                $loader.removeClass('loader');
                            });
                    }, 100);
                }
            }
        }).trigger('keyup');
    }
 
    // find file uploads with size
    $('input[type=file]').each(function() {
        var my = $(this), maxsize = my.data('max-size');
        if (maxsize) {
            my.parents('form').submit(function() {
                if (my.get(0).files.length) {
                    if (my.get(0).files[0].size > maxsize) {
                        alert('Die Datei ist leider zu groß, bitte senden Sie nur Bilder bis zu ' + (maxsize / 1000000) + ' MB Dateigröße.');
                        return false;
                    }
                }
            });
        }
    });
 
});
 
// login module
var Login = (function(w, d, $, my) {
    var eventListener = [];
 
    my.registerListener = function(callback) {
        eventListener.push(callback);
    };
 
    my.popup = function(el) {
        var t = 300, l = 500, y = 530, x = 450;
 
        var $form = $(el).parents('form');
        /* $('.form-login-email', $form).val('[email protected]');*/
        $('.form-login-returnBlock').attr('checked', false);
        $('.form-login-terms').attr('checked', true);
 
        if (w.screen) {
            t = Math.round(w.screen.availHeight / 2 - y / 2 - 50);
            l = Math.round(w.screen.availWidth / 2 - x / 2 - 10);
 
            // chrome bug
            if (w.screenX > w.screen.availWidth) {
                l += w.screen.availWidth;
            }
        }
        w.open(my.loginUrl, 'dialo_login', 'width=' + x + ',height=' + y + ',top=' + t + ',screenY=' + t + ',left=' + l + ',screenX=' + l + ',location=no,menubar=no,status=no,toolbar=no,directories=no,dependent=yes');
    };
 
    my.popupSubmit = function(form) {
        var $form = $(form), f = new FormData(form), $btn = $('button[type=submit]', $form), t = $btn.html();
 
        $btn.attr('disabled', 'disabled').html(t + ' <i class="fa fa-spinner fa-spin"></i>');
 
        $.ajax({
            url: my.loginUrl,
            type: 'POST',
            data: f,
            cache: false,
            contentType: false,
            processData: false,
            success: function(d) {
                $btn.attr('disabled', false).html(t);
                if (d.status == 'ok') {
                    //CustomEvent workarond for IE
                    var evt = w.opener.document.createEvent("CustomEvent");
                    evt.initCustomEvent('message', false, false, {
                        a: 'dialo_login_popup_ok', d: d
                    });
 
                    w.opener.dispatchEvent(evt);
                    w.close();
                }
                if (d.status == 'error') {
                    var $msg = $('<div class="alert alert-danger">' + d.msg + '</div>').hide();
                    $('#errorMessage').append($msg);
                    $msg.slideDown(100);
                    window.setTimeout(function() {
                        $msg.slideUp(200);
                    }, 2000);
                }
            }
        });
    };
 
    my.listener = function(e) {
        if (e.detail && e.detail.a === 'dialo_login_popup_ok') {
            var d = e.detail.d;
            $('.form-login-actions').hide();
            $('.form-login-actions').next().hide(); //hide required star
            $('.form-login-email').val('[email protected]');
            $('.csrf-token').attr('name', d.token.name).val(d.token.value);
            $('.form-login-returnBlock').remove();
            $('.form-login-terms').remove();
            $('.form-login-terms-checkbox').attr('checked', true);
            $('.form-login-terms-checkbox').parent().hide();
            $('.form-login-newsletter-checkbox').parent().hide();
            $('.recaptcha-holder').addClass('recaptcha-deactivate'); // remove captcha
            $('.form-login-submit').slideDown();
 
            if (d.canClaim) {
                $('#claimBox').slideDown();
            }
 
            for (var i = 0; i < eventListener.length; i++) {
                if (typeof eventListener[i] == 'function') {
                    eventListener[i](d);
                }
            }
            if ($('#selectKeywordPayment').length || $('#companyPayment').length) {
                Payment.adpackage.login(e.detail.d.userId);
            }
        }
    };
 
    my.facebook = function(data) {
        $.ajax({
            url: my.loginUrl,
            type: 'POST',
            data: {
                fbUserId: data.profile.id,
                fbEmail: data.profile.email,
                fbAccessToken: data.auth.authResponse.accessToken
            },
            cache: false,
            success: function(d) {
                if (d.status == 'ok') {
                    //CustomEvent workarond for IE
                    var evt = w.opener.document.createEvent("CustomEvent");
                    evt.initCustomEvent('message', false, false, {
                        a: 'dialo_login_popup_ok', d: d
                    });
 
                    w.opener.dispatchEvent(evt);
                    w.close();
                }
            }
        });
    };
 
    my.facebookRegister = function(data) {
        var html = '';
 
        html += '<div class="col-md-12">Die Registrierung erfolgt über Facebook.</div>';
        html += '<input type="hidden" name="fbToken" value="' + data.auth.authResponse.accessToken + '" />';
        html += '<input type="hidden" name="fbUsername" value="' + data.profile.name + '" />';
 
        $('.form-login-options').html(html);
 
        $('.form-login-submit').slideDown();
        $('#claimBox').slideDown();
    };
 
    my.facebookConnect = function(data) {
        $('.facebook-login-button').disableButton();
 
        $.ajax({
            url: my.fbConnectUrl,
            type: 'POST',
            data: {
                fbUserId: data.profile.id,
                fbEmail: data.profile.email,
                fbAccessToken: data.auth.authResponse.accessToken
            },
            cache: false,
            success: function(d) {
                if (d.status == 'ok') {
                    $('.facebook-login-button').replaceWith('Vielen Dank für die Verknüpfung.');
                }
            }
        });
    };
 
    my.showRegister = function(el) {
        var $form = $(el).parents('form');
        $('.form-login-email', $form).val('');
        $('.form-login-email', $form).val('');
        $('.form-login-returnBlock').attr('checked', true);
        $('.form-login-terms').attr('checked', false);
    };
 
    my.checkForSend = function($el) {
        var value = $el.val();
 
        if (value.length > 4) {
            $('.form-login-submit').slideDown();
            $('#claimBox').slideDown();
        } else {
            $('.form-login-submit').slideUp();
            $('#claimBox').slideUp();
        }
    };
 
    return my;
}(window, document, jQuery, Login || {}));
 
// Popup FbApp
function FbPopup(link) {
    var t = 300, l = 500, y = 450, x = 600;
 
    if (window.screen) {
        t = Math.round(window.screen.availHeight / 2 - y / 2 - 50);
        l = Math.round(window.screen.availWidth / 2 - x / 2 - 10);
 
        // chrome bug
        if (window.screenX > window.screen.availWidth) {
            l += window.screen.availWidth;
        }
    }
    window.open(link, 'Facebook Teilen', 'width=' + x + ',height=' + y + ',top=' + t + ',screenY=' + t + ',left=' + l + ',screenX=' + l + ',location=no,menubar=no,status=no,toolbar=no,directories=no,dependent=yes');
}
 
function activateInputSlider(value, sliderId, radiusId, showRadiusId) {
    $slider = $('#' + sliderId);
    $radius = $('#' + radiusId);
    $showRadius = $('#' + showRadiusId);
 
    $slider.slider({
        range: 'max',
        min: 1,
        max: 100,
        value: value,
        slide: function(event, ui) {
            $radius.val(ui.value);
            $showRadius.text(ui.value);
        }
    });
}
 
function showSearchClearIcon(element, searchWrapper, clearIcon, additionalClass) {
    if ($(window).width() <= 768) { //for iPad & smaller devices
        var t = $(element);
        $('.' + clearIcon).toggle(Boolean(t.val()));
        if (Boolean(t.val())) {
            $('.' + searchWrapper).addClass(additionalClass);
        } else {
            $('.' + searchWrapper).removeClass(additionalClass);
        }
    }
}
 
function clearSearch(element, searchBox, searchWrapper, additionalClass) {
    if ($(window).width() <= 768) { //for iPad & smaller devices
        $('.' + searchBox).val('').focus();
        $('.' + searchWrapper).removeClass(additionalClass);
        $(element).hide();
    }
}
 
function autoresizeTextarea(element) {
    if (element != null) {
        element.style.height = '0px';
        var textareaHeight = element.scrollHeight + 10;
        if (textareaHeight == 10) {
            textareaHeight = 50;
        }
        var maxHeight = 450;
        if (textareaHeight > maxHeight) {
            element.style.height = maxHeight + 'px';
            element.style.overflow = 'auto';
        } else {
            element.style.height = textareaHeight + 'px';
        }
    }
}
 
function autoResizePlaceholderImage() {
    $('.imagePlaceholder').each(function(index, value) {
        var height = $(value).height();
 
        $(value).css({
            'font-size': (height / 1.5) + 'px',
            'line-height': height + 'px'
        });
    });
}
 
function outputFlashSession(id) {
    id = typeof id !== 'undefined' ? id : 'flashSessionOutput';
    $.get('/flashmessage.do', {}, function(html) {
        $('#' + id).html(html);
    });
}
 
function changeArrow(e) {
    clicked = $(document).find("[href='#" + $(e.target).attr('id') + "']");
    icon = clicked.find('i');
 
    if (icon.hasClass('fa-angle-down')) {
        icon.removeClass('fa-angle-down');
        icon.addClass('fa-angle-up');
    } else {
        icon.removeClass('fa-angle-up');
        icon.addClass('fa-angle-down');
    }
};;(function() {
var method, noop = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
    method = methods[length];
    if (!console[method]) console[method] = noop;
}
}());
 
;(function($){
    $(".alert .close").click(function() {
        $(this).parent().fadeTo("slow", 0.00, function(){
            $(this).slideUp();
        }); return false;
    });
})(jQuery);
 
Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) if (obj.hasOwnProperty(key)) size++;
    return size;
};
;/*
  Bootstrap - File Input
  ======================
 
  This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
 
  Converts all
  <input type="file">
  into Bootstrap buttons
  <a class="btn">Browse</a>
 
*/
$(function() {
 
$.fn.bootstrapFileInput = function() {
 
  this.each(function(i,elem){
 
    var $elem = $(elem);
 
    // Maybe some fields don't need to be standardized.
    if (typeof $elem.attr('data-bfi-disabled') != 'undefined') {
      return;
    }
 
    // Set the word to be displayed on the button
    var buttonWord = 'Browse';
 
    if (typeof $elem.attr('title') != 'undefined') {
      buttonWord = $elem.attr('title');
    }
 
    // Start by getting the HTML of the input element.
    // Thanks for the tip http://stackoverflow.com/a/1299069
    var input = $('<div>').append( $elem.eq(0).clone() ).html();
    var className = '';
 
    if (!!$elem.attr('class')) {
      className = ' ' + $elem.attr('class');
    }
 
    // Now we're going to replace that input field with a Bootstrap button.
    // The input will actually still be there, it will just be float above and transparent (done with the CSS).
    $elem.replaceWith('<a class="file-input-wrapper btn' + className + '">'+buttonWord+input+'</a>');
  })
 
  // After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
  // This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
  .promise().done( function(){
 
    // As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
    // This gives us the pointer cursor that FF denies us
    $('.file-input-wrapper').mousemove(function(cursor) {
 
      var input, wrapper,
        wrapperX, wrapperY,
        inputWidth, inputHeight,
        cursorX, cursorY;
 
      // This wrapper element (the button surround this file input)
      wrapper = $(this);
      // The invisible file input element
      input = wrapper.find("input");
      // The left-most position of the wrapper
      wrapperX = wrapper.offset().left;
      // The top-most position of the wrapper
      wrapperY = wrapper.offset().top;
      // The with of the browsers input field
      inputWidth= input.width();
      // The height of the browsers input field
      inputHeight= input.height();
      //The position of the cursor in the wrapper
      cursorX = cursor.pageX;
      cursorY = cursor.pageY;
 
      //The positions we are to move the invisible file input
      // The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
      moveInputX = cursorX - wrapperX - inputWidth + 20;
      // Slides the invisible input Browse button to be positioned middle under the cursor
      moveInputY = cursorY- wrapperY - (inputHeight/2);
 
      // Apply the positioning styles to actually move the invisible file input
      input.css({
        left:moveInputX,
        top:moveInputY
      });
    });
 
    $('.file-input-wrapper input[type=file]').change(function(){
 
      var fileName;
      fileName = $(this).val();
 
      // Remove any previous file names
      $(this).parent().next('.file-input-name').remove();
      if (!!$(this).prop('files') && $(this).prop('files').length > 1) {
        fileName = $(this)[0].files.length+' files';
        //$(this).parent().after('<span class="file-input-name">'+$(this)[0].files.length+' files</span>');
      }
      else {
        // var fakepath = 'C:\\fakepath\\';
        // fileName = $(this).val().replace('C:\\fakepath\\','');
        fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
      }
 
      $(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
    });
 
  });
 
};
 
// Add the styles before the first stylesheet
// This ensures they can be easily overridden with developer styles
var cssHtml = '<style>'+
  '.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
  '.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
  '.file-input-name { margin-left: 8px; }'+
  '</style>';
$('link[rel=stylesheet]').eq(0).before(cssHtml);
 
});;var AjaxForm = (function($, window) {
    var my = {}, dialogTemplate, windowsTemplate;
 
    dialogTemplate = '<div class="modal fade" id=":id:" tabindex="-1" role="dialog">'
        + '<div class="modal-dialog" style=":style:"><div class="modal-content">'
        + '<div class="modal-header">'
        + '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'
        + '<p class="modal-title lead"><strong>:title:</strong></p>'
        + '</div>'
        + '<div class="modal-body" id="modal-body-:id:">:text:</div>'
        + '</div>'
        + '</div></div>';
 
    windowsTemplate = '<div id=":id:">' +
        '<h3>:title:</h3>' +
        '<div>:text:</div>' +
        '</div>';
 
    function handleResponse(url, response, options, showInDialog) {
        if (typeof showInDialog === "undefined" || showInDialog === null) {
            showInDialog = true;
        }
 
        var html, $dialog, id = 'ajaxform_' + Math.ceil(Math.random() * 1000000);
        options = options || {};
        options.style = options.style || '';
 
        if (showInDialog) {
            html = dialogTemplate.replace(/:id:/g, id)
                .replace(':style:', options.style)
                .replace(':title:', response.title)
                .replace(':text:', response.html);
 
            $('body').append(html);
            $dialog = $('#' + id);
 
            $dialog.on('hidden.bs.modal', function(e) {
                // user somehow aborted -> kill the dialog
                //$dialog.remove();
            });
 
            $dialog.modal('show');
 
            //bugfix scrolling in dialog - add class to body
            $('.modal').on("hidden.bs.modal", function(e) {
                if ($('.modal:visible').length) {
                    $('body').addClass('modal-open');
                }
            });
        } else {
            html = windowsTemplate.replace(/:id:/g, id)
                .replace(':title:', response.title)
                .replace(':text:', response.html);
 
            if (options.boxId) {
                $('#' + options.boxId).append(html);
            }
 
            $dialog = $('#' + id);
        }
 
        // grab the submit
        $('form', $dialog).submit(function(e) {
            var $form = $(this), formData = new FormData($form[0]);
            e.preventDefault();
 
            $.ajax({
                url: url,
                type: 'POST',
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success: function(response) {
                    if (response.status === 'reload') {
                        window.location.reload();
                    }
                    if (response.status === 'ajax') {
                        Ajax.getContent(response.url, response.id, {});
                    } else {
                        handleResponse(url, response, options);
                    }
                }
            });
            if (showInDialog) {
                $dialog.modal('hide');
            }
        });
    }
 
    my.show = function(url, options, showInDialog) {
        if (window.event) {
            window.event.stopPropagation();
        }
        $('#dialog-waiting').modal('show');
        $.get(url, function(response) {
            handleResponse(url, response, options, showInDialog);
            $('#dialog-waiting').modal('hide');
        });
    };
 
    return my;
}(jQuery, window));
 
var Helper = (function($) {
    var my = {};
 
    my.previewImage = function(inputElement) {
        if (inputElement.files && inputElement.files[0]) {
            var reader = new FileReader();
 
            reader.onload = function(e) {
                var $el = $(inputElement), $container = $el.parent(), $preview = $('.image-preview');
 
                if ($preview.size() === 0) {
                    $preview = $('<img/>').addClass('image-preview');
                    $preview.appendTo($container);
                }
 
                $preview.attr('src', e.target.result);
            };
 
            reader.readAsDataURL(inputElement.files[0]);
        }
    };
 
    my.changeImageStatus = function(status) {
        if (status == true) {
            $('.file-manager-file-delete').val('true');
            $('.image-preview').attr('src', '');
            $('.image-preview').attr('alt', '');
            $('#image-delete').hide();
            $('#image-placeholder').show();
        } else {
            $('.file-manager-file-delete').val('false');
            $('#image-delete').show();
            $('#image-placeholder').hide();
        }
    };
 
    return my;
}(jQuery));
 
function cityAutocomplete(element, id) {
    if (!id) {
        id = 'town';
    }
    autocompleteDropDown.start('/zipcity.do', { element: element, threshold: 2 }, id);
}
 
function keywordAutocomplete(element, event, limit) {
    var code = event.keyCode || event.which;
    if (code == 32 || code == 13 || code == 188) { //space, return, comma
        event.preventDefault();
        addKeyword(element, $(element).val(), limit);
    }
}
 
function addKeyword(element, keyword, limit) {
    if (!keyword) {
        keyword = $(element).val();
    }
 
    if (keyword.trim()) {
        var keywordArray = keyword.split(',');
 
        if (typeof limit !== "undefined") {
            var $keywords = $('#keywordData').val();
            if ($keywords) {
                $keywords = JSON.parse($keywords);
                if ($keywords.length >= limit) {
                    $('#keywordError').show();
                    return;
                }
            }
 
        }
 
        $.each(keywordArray, function(index, value) {
            if (value.trim()) {
                var result = {
                    keywordType: null,
                    keyword: value
                };
 
                var $keywords = $('#keywordData'),
                    $keywordContainer = $('#keywordContainer');
 
                $keywordContainer.appendKeyword(result);
                $.updateKeywords($keywordContainer, $keywords);
                $(element).val('');
            }
        });
    }
}
 
$.fn.appendKeyword = function(data) {
    this.append('<span class="btn btn-default" data-type="' + data.keywordType + '" onclick="keywordRemove(this)">' + data.keyword + ' <i class="fa fa-times-circle"></i></span>');
};
 
$.updateKeywords = function($keywordContainer, $keywords) {
    var keywords = [];
    $keywordContainer.find('> span').each(function(i) {
        var $this = $(this);
        keywords.push({
            keywordType: $this.attr('data-type'),
            keyword: $this.text()
        });
    });
    $keywords.val(JSON.stringify(keywords));
};
 
function keywordRemove(element) {
    var $keywords = $('#keywordData');
 
    $(element).remove().data();
    $.updateKeywords($('#keywordContainer'), $keywords);
}
 
function parseKeywords() {
    var keywordRaw = $('#keywordData').val(), keyword, $keywordContainer = $('#keywordContainer');
 
    if (keywordRaw) {
        try {
            keyword = jQuery.parseJSON(keywordRaw);
        } catch (e) {
            // old broken keyword structure
            // be nice, it's not their fault
        }
 
        if ($.isArray(keyword)) {
            $.each(keyword, function(i, v) {
                $keywordContainer.appendKeyword(v);
            });
        }
    }
}
 
function branchAutocomplete(element) {
    $('#clientCategoryText').attr('data-id', '');
    $('#clientCategoryId').val('');
 
    autocomplete.start('/category.do', {
        element: element,
        threshold: 3,
        pickClass: '',
        onPick: function(element) {
            var data = $(element).data();
 
            var branchIds = [], $branches = $('#clientCategoryId'),
                $branchContainer = $('#clientCategoryText');
 
            $branchContainer.find('> span').each(function(i) {
                branchIds.push(parseInt($(this).attr('data-id')));
            });
            if ($.inArray(parseInt(data.key), branchIds) < 0) {
                var result = {
                    branch_id: data.key,
                    branch: data.value
                };
                $branchContainer.appendBranch(result);
                $.updateBranch($branchContainer, $branches);
            }
        }
    });
}
 
$.fn.appendBranch = function(data) {
    var $el = $('#clientCategoryText');
    $el.val(data.branch);
    $el.attr('data-id', data.branch_id);
};
 
$.updateBranch = function($branchContainer, $branch) {
    $branch.val($branchContainer.attr('data-id'));
};
 
function formatOpeningHours(element) {
    var data = $(element).val();
    if (data.indexOf(".") >= 0) {
        data = data.replace('.', ':');
 
        $(element).val(data);
    }
 
    var dataArray = data.split(':');
 
    if (dataArray.length > 1) {
        if (dataArray[0].length < 2) {
            data = '0' + data;
        }
        data = data.substring(0, 5);
 
        $(element).val(data);
    }
}
 
jQuery(document).ready(function() {
    parseKeywords();
 
    var $clientCategoryId = $('#clientCategoryId');
 
    if ($clientCategoryId.size()) {
        try {
            var branch = jQuery.parseJSON($clientCategoryId.val()),
                $branchContainer = $('#clientCategoryText');
 
            $.each(branch, function(i, v) {
                $branchContainer.appendBranch(v);
            });
        } catch (err) {
        }
    }
 
    // help the user with homepage input
    $('input[type=url]').blur(function() {
        var $el = $(this), val = $el.val();
 
        if (val && val.search(/^http/) === -1) {
            $el.val('http://' + val);
        }
    });
 
    /*
     $('select').each(function () {
     if ($(this).length == 1) {
     $($(this + ' option').get(0)).prop('selected', true);
     }
     });*/
});
 
function fancyButtons($addFontClass) {
    var ua = 0;
    var msie = 0; //IE 10 and older
    var trident = 0; //IE 11+
    var edge = 0;
 
    if (typeof $addFontClass === undefined) {
        ua = window.navigator.userAgent;
        msie = ua.indexOf("MSIE "); //IE 10 and older
        trident = ua.indexOf('Trident/'); //IE 11+
        edge = ua.indexOf('Edge/');
    }
 
    if ($addFontClass === false || (typeof $addFontClass === undefined && (edge > 0 || trident > 0 || msie > 0))) {
        $("input[type=checkbox]").each(function() {
            if ($(this).hasClass('fa')) {
                $(this).removeClass('fa');
            }
        });
 
        $("input[type=radio]").each(function() {
            if ($(this).hasClass('fa')) {
                $(this).removeClass('fa');
            }
        });
    }
    else  // If another browser, return 0
    {
        $("input[type=checkbox]").each(function() {
            if (!$(this).hasClass('fa')) {
                $(this).addClass('fa');
            }
        });
        $("input[type=radio]").each(function() {
            if (!$(this).hasClass('fa')) {
                $(this).addClass('fa');
            }
        });
    }
}
 
function openSocialMediaLink(element) {
    var id = $(element).attr('data-id'), val = $('#' + id).val(), link = $('#' + id + '_addon_pre').text() + val;
 
    if (val.search(/^http:/) !== -1) {
        link = val;
    }
 
    window.open(link, 'Social Media Link');
}
 
function addOpeningHoursRow(containerId, hide) {
    var $container = $('#'+containerId),
        prototype = $container.data('prototype').replace(/__name__/g, 'oh' + (Math.ceil(Math.random() * 1000000)));
 
    $container.append(prototype);
    if (hide === true) {
        $container.children().first().attr('style', 'display:none');
    }
}
 
function removeOpeningHoursRow(button) {
    var row = $(button).closest('.row').closest('.form-group'), parent = row.parent();
    row.remove();
 
    if (parent.find('.form-group').length) {
 
    } else {
        addOpeningHoursRow(parent.attr('id'), true);
    }
}
 
$(document).ready(function() {
    $('.btn-checkbox .checkbox input').each(function() {
        if (this.checked) {
            toggleActiveClass($(this).parent());
        }
    });
});
 
$(document).on('click', '.btn-checkbox .checkbox label', function(e) {
    toggleActiveClass($(this).parent());
});
 
$(document).on('click', '.btn-checkbox .checkbox', function(e) {
    toggleActiveClass(this);
});
 
function toggleActiveClass(element) {
    $(element).toggleClass("active");
    var $input = $(element).find('input');
    if ($(element).hasClass("active")) {
        $input.attr('checked', 'checked');
    } else {
        $input.removeAttr('checked');
    }
}
;Mem = (function ($, window) {
    var my = {}, autoTime, selected, prefix = '', frame = 'mainframe', source;
 
    my.init = function (listId, urlPrefix, project) {
        $('.sidebar-item .head').click(function () {
            $(this).siblings('.body').slideToggle();
        });
 
        if (listId) {
            my.selectList(listId);
        }
 
        if (urlPrefix) {
            prefix = urlPrefix;
        }
 
        if (project) {
            source = project;
        }
    };
 
    my.selectList = function (listId) {
        Ajax.getContent(prefix + 'merkliste/ajax/detail', frame, {'id': listId, 'source': source});
    };
 
    my.edit = function (listId) {
        Ajax.getContent(prefix + 'user/memoryEdit', frame, {'id': listId, 'source': source});
    };
 
    my.editCompany = function (listId) {
        Ajax.getContent(prefix + 'user/memoryEditCompany', frame, {'id': listId, 'source': source});
    };
 
    my.follow = function (btn, id) {
        var $btn = $(btn);
 
        var t = 'Nicht mehr folgen';
        $btn.attr("onclick", "Mem.unfollow(this, " + id + ")");
        $btn.disableButton(t);
 
        url = 'merkliste/ajax/follow';
 
        $.get(prefix + url, {'id': id, 'f': 1}, function (d) {
            $btn.enableButton(t, d.status == 'ok');
        });
    };
    my.unfollow = function (btn, id) {
        var $btn = $(btn);
 
        var t = 'Folgen';
        $btn.attr("onclick", "Mem.follow(this, " + id + ")");
        $btn.disableButton(t);
 
        url = 'merkliste/ajax/follow';
 
        $.get(prefix + url, {'id': id, 'f': 0}, function (d) {
            $btn.enableButton(t, d.status == 'ok');
        });
    };
 
    my.saveListSubmit = function () {
        var $form = $('#listform'), $btn = $('button[type=submit]', $form), t = $btn.text();
        var formData = new FormData($form[0]);
 
        url = 'user/memorySave';
 
        $.ajax({
            url: prefix + url,
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (d) {
                $btn.enableButton(t, d.status == 'ok');
 
                if (d.status == 'ok') {
                    my.editCompany(d.id);
                } else {
                    $('#mainframe').html(d);
                }
            }
        });
 
        return false;
    };
 
    my.searchListSubmit = function (page, searchWord, saveHistory) {
        var $form = $('#searchMemoryListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
        $btn.disableButton(t);
 
        if (searchWord != null) {
            $('#searchMemoryListName').val(searchWord);
        }
        $('#memorySearchPage').val(page);
 
        url = 'merkliste/ajax/searchMemory';
 
        $.post(prefix + url, $form.serialize(), function (d) {
            if (saveHistory == true) {
                //console.log('Input Field: ' + $('#searchMemoryListName').attr('name'));
                saveHistoryFunction("$.ajax(Ajax.getContent('" + prefix + url + "', '" + frame + "Form')).done(function() {Mem.searchListSubmit(" + $('#memorySearchPage').val() + ", '" + $('#searchMemoryListName').val() + "', false);}); setActiveSidebarEntry('searchFormLink');");
            }
 
            $btn.enableButton(t);
            $('#memoryResultFrame').html(d);
        });
    };
 
    my.deleteList = function (listId) {
        if (confirm('Möchtest du diese LieblingsListe wirklich löschen?')) {
 
            url = 'user/memoryDelete';
            urlSuccess = 'merkliste/ajax/myList';
 
            $.post(prefix + url, {'l': listId, 'source': source}, function (d) {
                if (d.status == 'ok') {
                    message('success', 'Die LieblingsListe wurde erfolgreich gelöscht.');
 
                    Ajax.getContent(prefix + urlSuccess, frame);
                }
            });
        }
    };
 
    function message(type, text) {
        var $msg = $('<div class="alert alert-' + type + '">' + text + '</div>');
        $msg.hide().appendTo($('.messages')).fadeIn();
        window.setTimeout(function () {
            $msg.fadeOut();
        }, 3000);
    }
 
    my.createCompanySubmit = function () {
        var $form = $('#addNewCompanyContainer #addCompany form'), $btn = $('button[type=submit]', $form), t = $btn.html();
        $btn.disableButton(t);
 
        url = 'user/createCompany';
 
        $.post(prefix + url, $form.serialize(), function (d) {
            $btn.enableButton(t, d.status == 'ok');
 
            if (d.status) {
                $('#companyAddError').text(d.msg).show();
                window.setTimeout(function () {
                    $('#companyAddError').fadeOut();
                }, 2000);
 
                $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
 
                $('#newCompanyErrorMsg').removeClass("hidden", 100, "easeInQuad");
                setTimeout(function () {
                    $('#newCompanyErrorMsg').addClass("hidden", 100, "easeInQuad");
                }, 3000);
 
            } else {
                selected = null;
                $('#companyList').html(d);
                $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
 
                $('#newCompanySuccessMsg').removeClass("hidden", 100, "easeInQuad");
                setTimeout(function () {
                    $('#newCompanySuccessMsg').addClass("hidden", 100, "easeInQuad");
                }, 3000);
            }
        });
    };
 
    my.addFacebookSubmit = function () {
        var $form = $('#addNewCompanyContainer #addFacebookPage form'), $btn = $('button[type=submit]', $form), t = $btn.html();
        $btn.disableButton(t);
 
        url = 'user/addFacebookPage';
 
        $.post(prefix + url, $form.serialize(), function (d) {
            $btn.enableButton(t, d.status == 'ok');
            if (d.status) {
                $('#companyAddError').text(d.msg).show();
                window.setTimeout(function () {
                    $('#companyAddError').fadeOut();
                }, 2000);
            } else {
                selected = null;
                $('#companyList').html(d);
                $('#facebookPageLink').val('');
            }
        });
    };
 
    my.add = function (btn, cid) {
        var $btn = $(btn), t = $btn.text();
        $btn.disableButton(t);
 
        $.get('/merkliste/ajax/lists', {'cid': cid}, function (d) {
            var html = '', i;
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                html += '<li class="list-group-item"><div class="row"><div class="col-xs-8">' +
                    '<input type="text" id="memoryNew" class="form-control" placeholder="Neue Merkliste anlegen" /></div><div class="col-xs-4">' +
                    '<button type="button" class="btn btn-warning" onclick="Mem.selected(0, ' + cid + ')">Neue Merkliste anlegen <i class="fa fa-check"></i></button>' +
                    '</div></div></div></li>';
 
                for (i = 0; i < d.lists.length; i++) {
                    var l = d.lists[i];
                    var clickAble = '"';
                    if (!l.isOnList) {
                        clickAble = ' clickable" onclick="Mem.selected(' + l.id + ', ' + cid + ');" ';
                    }
 
 
                    html += '<li class="list-group-item' + clickAble +
                        ' data-toggle="tooltip" data-placement="bottom" title="Zur Merkliste ' + l.title + ' hinzufügen"' +
                        '><span class="indicators">' +
                        (l.isOnList ? '<i class="fa fa-2x fa-check"></i> ' : '') +
                        '</span>' + l.title + '</li>';
                }
 
                $('#memoryAddContainer').html('<ul class="list-group">' + html + '</ul>').slideDown();
            } else {
                $('#memoryAddContainer').html(d.msg).slideDown();
            }
        });
    };
 
    my.selected = function (id, cid) {
        var t = '';
 
        if (id == 0) {
            t = $('#memoryNew').val();
 
            if (!t) {
                return;
            }
        }
 
        $('#memoryAddContainer').slideUp();
 
        $.post('/merkliste/ajax/add', {'id': id, 't': t, 'cid': cid}, function (d) {
            if (d.status == 'ok') {
                var $btn = $('#buttonAddToMemoryList');
                $btn.enableButton($btn.text(), true);
            }
        });
    };
 
 
    my.addCompanyNotice = function (companyEntryId) {
        var notice = $('#listCompanyNotice_' + companyEntryId).val(), $btn = $('#listCompanyNoticeButton_' + companyEntryId);
        $btn.disableButton();
 
        $.post('/merkliste/ajax/addCompanyNotice', {'notice': notice, 'cid': companyEntryId}, function (d) {
            if (d.status == 'ok') {
                $btn.enableButton('<i class="fa fa-check"></i>');
            }
        });
    };
 
    my.addCompanyNoticeList = function () {
        var $form = $('#memoryListCompanies'), $btn = $('button[type=submit]', $form), t = $btn.text();
        $btn.disableButton(t);
 
        $.post('/merkliste/ajax/addCompanyNoticeList', $form.serialize(), function (d) {
            if (d.status == 'ok') {
                $btn.enableButton(t);
            }
        });
    };
 
    my.addCompany = function (listId, companyId) {
        url = 'user/addCompany';
        $.get(prefix + url, {'id': listId, 'cid': companyId}, function (d) {
            if (d.status) {
                $('#companyAddError').text(d.msg).show();
                window.setTimeout(function () {
                    $('#companyAddError').fadeOut();
                }, 2000);
            } else {
                selected = null;
                $('#companyList').html(d);
            }
        });
    };
 
    my.removeCompany = function (listId, companyEntryId) {
        var $row = $('#memoryListCompany_' + companyEntryId), $rowNotice = $('#memoryListCompanyNotice_' + companyEntryId), $btn = $('button', $row), t = $btn.html();
        $btn.disableButton();
 
        $.post('/user/memoryremove', {'l': listId, 'c': companyEntryId}, function (d) {
            if (d.status == 'ok') {
                $row.fadeOut(200);
                $rowNotice.fadeOut(200);
            } else {
                $btn.enableButton(t);
            }
        });
    };
 
    my.searchCompanyListSubmit = function (boxId, page) {
        url = 'user/memorySearchCompany';
 
        var $form = $('#searchCompanyListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
        $btn.disableButton(t);
        $('#companySearchPage').val(page);
 
        $.post(prefix + url, $form.serialize(), function (d) {
            $btn.enableButton(t);
            $('#' + boxId).html(d);
            $("html, body").animate({scrollTop: ($('#searchCompanyListForm').offset().top) - 50}, 1000);
        });
    };
 
    return my;
}(jQuery, window));
 
 
//memory history for app
var historyList = [];
 
function saveHistory(element) {
    var onclickFunction = $(element).attr("onclick");
    onclickFunction = onclickFunction.replace("saveHistory(this);", "");
 
    saveHistoryFunction(onclickFunction);
}
 
function saveHistoryFunction(functionString) {
    if (functionString != null) {
 
        if (functionString.indexOf("setActiveSidebarEntry") <= 0) {
            sidebarId = $('#sidebar .btn-danger').attr('id');
            functionString = functionString + 'setActiveSidebarEntry("' + sidebarId + '");';
        }
        historyList.push(functionString);
        if (historyList.length > 1) {
            $('#backButton').show();
        }
    }
}
 
function historyBack() {
    /*
     remove the current element from the list with pop
     trigger the now last entry
     make sure there are at least 2 entries in the list (> 1)
     otherwise the current entry will be removed by pop and can not be reached in the future
     */
    if (historyList.length > 1) {
        historyList.pop();
        var lastFunction = historyList[historyList.length - 1];
 
        if (lastFunction != 'undefined') {
            eval(lastFunction);
        }
    } else {
        $('#backButton').hide();
    }
};var Categories = (function () {
    var my = {},
        firstLevelPrefix = 'first-level-',
        secondLevelPrefix = 'second-level-list-',
        categoriesPrefix = 'categories-';
 
    /* --------------------------------------------------------------*/
    /*                        categoryList                           */
 
    my.showFirstLevelName = function (firstLevelId) {
        hideElement(firstLevelId);
        $('#first-level-' + firstLevelId).slideDown();
    };
 
    my.showSecondLevelName = function (firstLevelId) {
        hideElement(firstLevelId);
 
        if ($('#' + firstLevelPrefix + firstLevelId).is(":hidden")) {
            $('#' + firstLevelPrefix + firstLevelId).slideDown();
        }
        if ($('#' + secondLevelPrefix + firstLevelId).is(":hidden")) {
            $('#' + secondLevelPrefix + firstLevelId).slideDown();
        }
    };
 
    function hideElement(id) {
        $('.first-level-name').each(function () {
            if ($(this).attr('id') != firstLevelPrefix + id) {
                $(this).slideUp();
            }
        });
        $('.second-level-list').each(function () {
            if ($(this).attr('id') != secondLevelPrefix + id) {
                $(this).slideUp();
            }
        });
    }
 
 
    /* --------------------------------------------------------------*/
    /*                      biggestCityList                          */
 
    my.showCategoryInCityList = function (cityId) {
        if ($('#' + categoriesPrefix + cityId).is(":hidden")) {
            $('.categories-in-city').each(function () {
                $(this).slideUp();
            });
 
            $('#' + categoriesPrefix + cityId).slideDown();
        }
    };
 
    return my;
}(jQuery, window));;var Navigation = (function () {
    var my = {};
 
    my.scrollTolElement = function (id) {
        $('html, body').animate({
            scrollTop: $('#' + id).offset().top
        }, 1000);
    };
 
    return my;
}(jQuery, window));;var Mobile = (function($) {
    var my = {}, isMobile = false;
 
    my.isMobile = function() {
        if ($(window).width() <= 768) { //for iPad & smaller devices
            isMobile = true;
        }
 
        return isMobile;
    };
 
    return my;
}(jQuery));;var TrackingCompany = (function () {
    var my = {}, method = 'trackcompany.do';
 
    my.send = function (action, companyId, userId) {
        return $.ajax({
            url: '/' + method,
            cache: false,
            type: 'POST',
            dataType: 'json',
            data: {
                'action': action,
                'companyId': companyId,
                'userId': userId
            }
        });
    };
 
    return my;
}(jQuery, window));;var Cookie = (function($) {
    var my = {};
    my.set = function(key, value) {
        var expires = new Date();
        expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
        document.cookie = key + '=' + value + ';path=/' + ';expires=' + expires.toUTCString();
    };
 
    my.get = function(key) {
        var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
        return keyValue ? keyValue[2] : null;
    };
 
    return my;
}(jQuery));;/**
 * fontFaceCheck v0.2
 * Roel Nieskens, November 11, 2013
 *
 * Released under the MIT License. http://www.opensource.org/licenses/mit-license.php
 *
 * http://pixelambacht.nl/2013/font-face-render-check/
 *
 * Usage:
 * 1. If you call fontFaceCheck.support(), either a fontfacerender or a no-fontfacerender class
 *    will be added to the HTML tag.
 * 2. Or use a callback function to grab the test result:
 *    fontFaceCheck.support( function(isSupported) { alert(isSupported) } );
 *
 * For IE8 and below, also pass the path to the EOT font: fontFaceCheck.support('/my/font/');
 *
 * Should work on all JavaScript-enabled browsers, old or new
 *
 * Inspired by the work of Paul Irish: http://www.paulirish.com/2009/font-face-feature-detection/
 */
var fontFaceCheck = new function() {
 
    var doc = document,
        body = doc.body || doc.documentElement.appendChild(doc.createElement("fontface")),
        tempElm = doc.createElement("span"),
        tempStyle = doc.createElement("style"),
        delay = 5,
        runs = 20,
        supported,
 
        // Gratefully taken from https://gist.github.com/padolsey/527683
        ie = (function(){
            var undef,
                v = 3,
                div = doc.createElement("div"),
                all = div.getElementsByTagName("i");
 
            while (
                div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
                    all[0]
                );
 
            return v > 4 ? v : undef;
        }()),
 
        checkSupport = function(fontPathEOT, callback) {
            // Use timeout because Gecko and Webkit load data-uri font asynchronously :(
            // setTimeout(function(){
            supported = (tempElm.offsetWidth / Math.max(1, tempElm.offsetHeight)) >= 5;
            if(!supported && runs-- > 0)
            {
                setTimeout(function(){
                    checkSupport(fontPathEOT, callback);
                }, delay);
                return;
            }
            body.removeChild(tempElm);
            // When font doesn't load, ratio will be less than or equal to 1. When loaded, it will
            // be 10. Check if it"s more than 5 to account for offsetWidth/offsetHeight wonkyness.
            if(callback) {
                callback(supported);
            } else  {
                doc.getElementsByTagName("html")[0].className += supported ? " fontfacerender" : " no-fontfacerender";
            }
        };
 
    // Check @font-face support by trying to render our test icon
    this.support = function(fontPathEOT, callback) {
        fontPathEOT = fontPathEOT || "./";
 
        tempElm.setAttribute("style", "font-family:pixelambacht !important;position:fixed;visibility:hidden");
        tempElm.innerHTML = "-";
        body.appendChild(tempElm);
 
        tempStyle.type = "text/css";
        doc.getElementsByTagName("head")[0].appendChild(tempStyle);
 
        if(ie <= 8)
        {
            // IE<8 doesn't support fonts via data-uri, so get external .eot file. To assure it's
            // present when the test is executed, download it to cache via a synchronous XHR call
            var request = new XMLHttpRequest();
            request.open("GET", fontPathEOT+"pixelambacht.eot", false);
            request.send(null);
            tempStyle.styleSheet.cssText = "@font-face{font-family:pixelambacht;src:url('"+fontPathEOT+"pixelambacht.eot');}";
        }
        else
        {
            // Load TTF via data-uri
            tempStyle.textContent = "@font-face{font-family:pixelambacht;src:url(data:font/truetype;base64,AAEAAAALAIAAAwAwT1MvMghABuMAAAC8AAAAYGNtYXAAlQDaAAABHAAAAGRnYXNw//8ABAAAAYAAAAAIZ2x5Zv8nt3kAAAGIAAAATGhlYWQQRDZ2AAAB1AAAADZoaGVhFeIT5AAAAgwAAAAkaG10eBUAAAAAAAIwAAAADGxvY2EAEAAmAAACPAAAAAhtYXhwAAUAEwAAAkQAAAAgbmFtZf0RHiMAAAJkAAAAwHBvc3QAAwAAAAADJAAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAACAALQHg/+D/4AHgACAAAAAAAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAPAAEACgAAAAGAAQAAQACACAALf//AAAAIAAt////4f/VAAEAAAAAAAAABAAoAAAABgAEAAEAAgAgAC3//wAAACAALf///+H/1QABAAAAAAAAAAAAAf//AAMAAQAAAAAAAAAAAAIADLgAAI24AASNuAH/hTE5AQAAAAABAAD/4BQAAeAABAAMuAAAjbgABI24Af+FESERIREUAOwAAeD+AAIAAAAAAAEAAAABAAC9n9JNXw889QALAgAAAAAAzqbp9AAAAADOfgvFAAD/4BQAAeAAAAAIAAIAAAAAAAAAAQAAAeD/4AAAFAAAAAAAFAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAQAAABQAAAAAAAAAABAAJgABAAAAAwAFAAEAAAAAAAIAAAAAAAAAAAAAAAwAAAAAAAAADgCwAAEAAAAAAAEAAAAAAAEAAAAAAAIAAAAAAAEAAAAAAAMAAAAAAAEAAAAAAAQAAAAAAAEAAAAAAAUAAAAAAAEAAAAAAAYAAAAAAAEAAAAAAAoAAAAAAAMAAQQJAAEAAgACAAMAAQQJAAIAAgAGAAMAAQQJAAMAAgAKAAMAAQQJAAQAAgAOAAMAAQQJAAUAAAAAAAMAAQQJAAYAAAAAAAMAAQQJAAoAAAAAAAD+/wBy/v8Ab/7/AGX+/wBsAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=)}";
        }
 
        checkSupport(fontPathEOT, callback);
    };
};;
 
    
    (function (w) {
        w['Login'] = w['Login'] || {};
        w['Login'].loginUrl = "https://www.bundes-telefonbuch.de/user/loginPopup"
    }(window));
 
 
        var onloadCallback = function () {
        $('.g-recaptcha').each(function (index, el) {
            grecaptcha.render(el, {
                'sitekey': '6Ld0RAoTAAAAAFji0CujiR0oPoPiDYZQvh21l715',
                'theme': 'light'
            });
        });
    };
    
 
    // getScript workaround for IE
    jQuery.extend({
        getScript: function (url, callback) {
            var head = document.getElementsByTagName("head")[0];
            var script = document.createElement("script");
            var done = false; // Handle Script loading
 
            script.src = url;
            script.onload = script.onreadystatechange = function () { // Attach handlers for all browsers
                if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
                    done = true;
                    if (callback) {
                        callback();
                    }
                    script.onload = script.onreadystatechange = null; // Handle memory leak in IE
                }
            };
 
            head.appendChild(script);
            return undefined; // We handle everything using the script element injection
        }
    });
 
 
    if (window.location.hash && window.location.hash == '#_=_') {
        if (window.history && history.pushState) window.history.pushState("", document.title, window.location.pathname);
        else window.location.hash = '';
    }
 
    
    $(document).ready(function () {
        if (window.location.hash == '#imageUploadForm') {
            CompanyAjaxLoad.toggleFromNavigation('navigation_images', 'imageUploadForm', true, false);
        }
 
        if ($('#companyAdvert').height() > 200) {
            $('#map-canvas').height($('#companyAdvert').height());
        }
 
        var windowWidth = $(window).width();
        if (windowWidth <= 768) { //for iPad & smaller devices
            $('.panel-collapse').removeClass('in');
        }
 
        $('.fb-page').attr('data-width', $('.fb-page').parent().width());
 
        $('textarea').each(function () {
            autoresizeTextarea(this);
        });
    });
 
    $(function () {
        $('[data-toggle="tooltip"]').tooltip({html: true});
        $('textarea').keyup(function () {
            autoresizeTextarea(this);
        });
    });
 
    function loadDatePicker($noStartDate, $id) {
        if ($id != null) {
            $field = $id;
        } else {
            $field = '.form-control.date';
        }
        if ($noStartDate == false) {
            $($field).datepicker({
                format: "dd.mm.yyyy",
                weekStart: 1,
                startDate: "23.10.2019",
                clearBtn: true,
                language: "de",
                calendarWeeks: true,
                autoclose: true
            });
        } else {
            $($field).datepicker({
                format: "dd.mm.yyyy",
                weekStart: 1,
                startDate: "22.04.2019",
                clearBtn: true,
                language: "de",
                calendarWeeks: true,
                autoclose: true
            });
        }
    }
 
 
 
    (function (G, o, O, g, L, e) {
        G[g] = G[g] || function () {
                    (G[g]['q'] = G[g]['q'] || []).push(arguments)
                }, G[g]['t'] = 1 * new Date;
        L = o.createElement(O), e = o.getElementsByTagName(O)[0];
        L.async = 1;
        L.src = '//www.google.com/adsense/search/async-ads.js';
        e.parentNode.insertBefore(L, e)
    })(window, document, 'script', '_googCsa');
 
 
    
        var googletag = googletag || {};
    googletag.cmd = googletag.cmd || [];
    (function () {
        var gads = document.createElement('script');
        gads.async = true;
        gads.type = 'text/javascript';
        var useSSL = 'https:' == document.location.protocol;
        gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
        var node = document.getElementsByTagName('script')[0];
        node.parentNode.insertBefore(gads, node);
    })();
 
    googletag.cmd.push(function () {
        
                googletag.defineSlot('/2492971/BTB.de_sonstiges_Leaderboard_Top', [728, 90], 'gpt-ad-leader-top').addService(googletag.pubads());
                        googletag.defineSlot('/2492971/BTb.de_sonstige_Leaderboard', [728, 90], 'gpt-ad-leader').addService(googletag.pubads());
                googletag.defineSlot('/2492971/BTb.de_sonstige_Medium_Rectangle', [300, 250], 'gpt-ad-rectangle1').addService(googletag.pubads());
        googletag.defineSlot('/2492971/BTb.de_sonstige_Wide_Skyscraper', [160, 600], 'gpt-ad-skyscraper').addService(googletag.pubads());
                googletag.defineSlot('/2492971/BTb.de_Startseite_Medium_Rectangle_Bilder', [300, 250], 'gpt-ad-rectangle2').addService(googletag.pubads());
                googletag.defineSlot('/2492971/BTb.de_Large_Mobile_Banner', [325, 120], 'gpt-ad-mobile-top').addService(googletag.pubads());
 
        googletag.enableServices();
    });
    
 
    function getLocation() {
        $('#myLocation').toggleClass("active");
        var output = document.getElementById("geoMsg");
        var nav = window.navigator, $btn = $('#searchButton'), t = $btn.html();
 
        function successCallback(position) {
            $btn.enableButton(t);
            $('#geoMsg').html("");
            $('#whereLat').val(position.coords.latitude);
            $('#whereLng').val(position.coords.longitude);
 
            $('#where').val("Mein Standort");
            $('#where').attr('readonly', 'readonly');
        }
 
        function errorCallback(error) {
            $btn.enableButton(t);
            var message = "";
            switch (error.code) {
                case error.PERMISSION_DENIED:
                    message = "<i class='fa fa-times-circle-o'></i> <strong class='bold text-white'>Keine Berechtigung zur Ermittlung des Standorts.</span>";
                    break;
                case error.POSITION_UNAVAILABLE:
                    message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Keine Positionsermittlung möglich.</span>";
                    break;
                case error.PERMISSION_DENIED_TIMEOUT:
                    message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Fehler: Ermittlung des Standorts dauerte zu lange.</span>";
                    break;
            }
            output.innerHTML = message;
        }
 
        if (nav != null) {
            var geoloc = nav.geolocation;
            if (geoloc != null) {
                output.innerHTML = "<i class='fa fa-question-circle-o'></i> <span class='bold text-white'>Koordinaten werden ermittelt.</span>";
                if ($('#myLocation').hasClass('active')) {
                    $btn.disableButton(t);
                    geoloc.getCurrentPosition(successCallback, errorCallback);
                } else {
                    $('#where').removeAttr('readonly');
                    $('#where').val('');
                    $('#whereLat').val('');
                    $('#whereLng').val('');
                    output.innerHTML = "";
                }
            }
            else {
                output.innerHTML = "<i class='fa fa-times-circle-o'></i> <strong class='bold text-white'>Es ist ein Fehler unterlaufen. Überprüfen Sie, ob ihr GPS aktiviert ist bzw. ob ihr Browser diese Funktion unterstützt.</span>";
                return;
            }
        }
        else {
            output.innerHTML = "<i class='fa fa-times-circle-o'></i> <strong class='bold text-white'>Es ist ein Fehler unterlaufen. Überprüfen Sie, ob ihr GPS aktiviert ist bzw. ob ihr Browser diese Funktion unterstützt.</span>";
            return;
        }
    }
 
    function removeLocation() {
        $('#myLocation').toggleClass("active");
        var output = document.getElementById("geoMsg");
 
        $('#where').removeAttr('readonly');
        $('#where').val('');
        $('#whereLat').val('');
        $('#whereLng').val('');
        output.innerHTML = "";
    }
 
    function positionSlidercontroll(id) {
        var carouselFiftyPercent = (($('#' + id).height() - 20) - ($('#' + id + ' .btn').height() / 2)) / 2;
        $('#' + id + ' .btn').css('top', carouselFiftyPercent);
    }
 
 
                        googletag.cmd.push(function() {
                            googletag.display('gpt-ad-leader-top');
                        });
                    
 
                                    googletag.cmd.push(function () {
                                        googletag.display('gpt-ad-skyscraper');
                                    });
                                
 
            $(document).ready(function () {
                var offset = $('.skyscraper').offset();
                $('.skyscraper').affix({
                    offset: {
                        top: offset.top
                    }
                });
            });
        
 
    jQuery(document).ready(function($) {
        $.get('/usermenu.do', {}, function(html) {
            $('#userMenuPlaceholder').replaceWith(html);
        });
    }(jQuery));
 
 
    if ($(window).width() <= 768) { //for iPad & smaller devices
        if ($('.search-box-what').val()) {
            $('.search-wrapper-what').addClass('input-group');
            $('.close-icon-what').show();
        }
 
        if ($('.search-box-where').val()) {
            $('.close-icon-where').show();
        }
    }
 
    /*  $('.search-box').keyup(function () {
     var t = $(this);
     $('.close-icon').toggle(Boolean(t.val()));
     if (Boolean(t.val())) {
     $('.search-wrapper').addClass('input-group');
     } else {
     $('.search-wrapper').removeClass('input-group');
     }
     });
 
     $('.close-icon').click(function () {
     $('.search-box').val('').focus();
     $('.search-wrapper').removeClass('input-group');
     $(this).hide();
     });
     */
 
 
                googletag.cmd.push(function () {
                    googletag.display('gpt-ad-mobile-top');
                });
            
 
        jQuery(document).ready(function () {
            $('#qwertzuiop').load('/office.do?u=&c=');
        });
    
 
                    jQuery(document).ready(function ($) {
                        outputFlashSession();
                    }(jQuery));
                
 
                googletag.cmd.push(function () {
                    googletag.display('gpt-ad-rectangle1');
                });
            
 
        $(document).ready(function () {
            var leaderWidth = $('.rectangleContainer1').parent().width();
            if (leaderWidth < 300) {
                $('.rectangleContainer1').hide()
            } else {
                $('.rectangleContainer1').show()
            }
        });
    
 
                    googletag.cmd.push(function () {
                        googletag.display('gpt-ad-leader');
                    });
                
 
            $(document).ready(function () {
                var leaderWidth = $('.leaderContainer').parent().width();
                if (leaderWidth < 728) {
                    $('.leaderContainer').hide()
                } else {
                    $('.leaderContainer').show()
                }
            });
        
 
        var gaProperty = 'UA-4947670-1';
        var disableStr = 'ga-disable-' + gaProperty;
 
        if (document.cookie.indexOf(disableStr + '=true') > -1) {
            window[disableStr] = true;
        }
 
        function gaOptout() {
            document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
            window[disableStr] = true;
            alert('Google Analytics ausgeschaltet');
        }
 
        (function(i, s, o, g, r, a, m) {
            i['GoogleAnalyticsObject'] = r;
            i[r] = i[r] || function() {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
            a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            m.parentNode.insertBefore(a, m)
        })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
 
        ga('create', gaProperty, 'auto');
        ga('set', 'anonymizeIp', true);
        ga('send', 'pageview');
 
        
        var gaTbUA = 'UA-61714288-4';
        var disableStrTbUA = 'ga-disable-' + gaTbUA;
 
        function gaTbOptout() {
            document.cookie = disableStrTbUA + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
            window[disableStrTbUA] = true;
            alert('google analytics disabled - tb');
        }
 
        
        $(document).ready(function() {
            $('.gaOptoutLink').click(function() {
                gaOptout();
            });
 
            $('.gaTbOptoutLink').click(function() {
                gaTbOptout();
            });
        });
    
/*DO NOT HOST THIS SCRIPT ON YOUR OWN SERVER*/
var szmvars = "";
var iom = iom || (function () {
  var dummySite = "dummy",
      baseUrlDE = "de.ioam.de/tx.io",
      baseUrlLSO = "de.ioam.de/aid.io",
      optinUrl = "de.ioam.de/optin.php?re=",
      qdsUrl = "irqs.ioam.de",
      cntBaseUrl = ".iocnt.net/tx.io",
      cntBaseUrlLSO = ".iocnt.net/aid.io",
      cntOptinUrl = ".iocnt.net/optin.php?re=",
      cntQdsUrl = "irqs.iocnt.net",
      cntSubdomain = ["at", "imarex"],
      eventList = ["", "inst", "init","open", "clse", "play", "resm", "stop", "fowa", "bakw", "recd", "paus", "forg", "bakg", "dele", "refr", "kill", "view", "alve", "fini", "mute", "aforg", "abakg", "aclse", "sple", "scvl", "serr", "spyr", "smdr", "sfpl", "sfqt", "ssqt", "stqt", "soqt", "sofc", "scfc", "scqt", "splr", "spli", "sprs", "spre", "smrs", "smre", "sors", "sore", "sack", "sapl", "sapa", "snsp"],
      LSOBlacklist = [],
      checkEvents = 1,
      tb = 0,
      sv = 1,
      lastEvent = "",
      emptyCode = "Leercode_nichtzuordnungsfaehig",
      autoEvents = {
        onfocus:"aforg",
        onblur:"abakg",
        onclose:"aclse"
      },
      nt = 2,
      cookiewhitelist = [],
      cookieName = "ioam2018",
      socioToken = "632015cbcfc384bd790454922497da97",
      frequency = 60000,
      hbiAdShort = 5000,
      hbiAdMedium = 10000,
      hbiAdLong = 30000,
      hbiShort = 10000,
      hbiMedium = 30000,
      hbiLong = 60000,
      hbiExtraLong = 300000,
      heart;
 
  var IAMPageElement = null,
      IAMQSElement = null,
      qdsParameter = {},
      qdsPopupBlockDuration = 86400000,
      result = {},
      mode,
      eventsEnabled = 0,
      surveyCalled = 0,
      inited = 0;
 
  var lsottl = 86400000,
      lsottlmin = 180000,
      ioplusurl = "me.ioam.de";
 
  function enableEvents() {
    if ((tb == 1 || result.tb == "on") && result.tb != "off" && !eventsEnabled) {
      eventsEnabled = 1;
      mode = 1;
      for(var e in autoEvents) {
        (function(e) {
          var oldEvent = window[e];
          window[e] = function() {
            if (lastEvent != autoEvents[e]) {
              lastEvent = autoEvents[e];
              event(autoEvents[e]);
            }
            if (typeof oldEvent == "function") oldEvent();
          };
        })(e);
      }
    }
  }
 
  function isDoNotTrack() {
    if ((nt & 2) ? ((typeof result.nt == "undefined") ? (nt & 1) : result.nt) : nt & 1) {
      if (window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") return true;
      if (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1")) return true;
    }
    return false;
  }
 
  var getInvitation = function (response) {
    if (response && response.hasOwnProperty("block-status")){
      var isEligibleForInvitation = ( "NONE" === response['block-status'].toUpperCase() );
      if (isEligibleForInvitation) {
        if (IAMQSElement) {
          IAMQSElement.parentNode.removeChild(IAMQSElement);
        }
        IAMQSElement = createScriptTag(response['invite-url']);
      }
    }
  };
 
  function loadSurvey() {
    szmvars = result.st + "//" + result.pt + "//" + result.cp + "//VIA_SZMNG";
    var sampleType = (result.sv == "i2") ? "in" : result.sv;
    var qdsHost = qdsUrl;
    if (result.cn) {
      sampleType += "_"+result.cn;
      if (result.cn == "at") {
        qdsHost = cntQdsUrl;
      }
    }
 
    qdsParameter = {
      siteIdentifier: result.cp,
      offerIdentifier: result.st,
      sampleType: sampleType,
      pixelType: result.pt,
      contentType: result.cp,
      host: qdsHost,
      port: "",
      isFadeoutFlash: true,
      isFadeoutFrame: true,
      isFadeoutForm: true,
      positionTop: 10,
      positionLeft: 100,
      zIndex: 1100000,
      popupBlockDuration: qdsPopupBlockDuration,
      keysForQueryParam : [
          "offerIdentifier",
          "siteIdentifier",
          "sampleType",
          "pixelType",
          "isFadeoutFlash",
          "isFadeoutFrame",
          "isFadeoutForm",
          "positionTop",
          "positionLeft",
          "zIndex"]
    };
 
    if(typeof window.iam_zindex !== 'undefined') {
      qdsParameter.zIndex = window.iam_zindex;
    }
 
    if(typeof window.iam_fadeout_flash !== 'undefined') {
      qdsParameter.isFadeoutFlash = window.iam_fadeout_flash;
    }
 
    if(typeof window.iam_fadeout_iframe !== 'undefined') {
      qdsParameter.isFadeoutFrame = window.iam_fadeout_iframe;
    }
 
    if(typeof window.iam_fadeout_form !== 'undefined') {
      qdsParameter.isFadeoutForm = window.iam_fadeout_form;
    }
 
    if(typeof window.iam_position_top !== 'undefined') {
      qdsParameter.positionTop = window.iam_position_top;
    }
 
    if(typeof window.iam_position_left !== 'undefined') {
      qdsParameter.positionLeft = window.iam_position_left;
    }
 
    var filterObjectByKeys = function (obj, keysToFilter) {
        var result = {}, key;
        var arrayLength = keysToFilter.length;
        for (var i = 0; i < arrayLength; i++) {
            key = keysToFilter[i];
            if (obj.hasOwnProperty(key)) {
                result[key] = obj[key];
            }
        }
        return result;
    };
 
    var serializeToQueryString = function (obj) {
      var str = [];
      for (var key in obj)
        if (obj.hasOwnProperty(key)) {
        str.push(encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]));
      }
      return str.join("&");
    };
 
    var createPopupcheckCookie = function (blockDuration) {
      var blockedUntilDate = new Date();
      blockedUntilDate.setTime(blockedUntilDate.getTime() + blockDuration);
      var expires = "expires=" + blockedUntilDate.toUTCString();
      document.cookie = "POPUPCHECK=" + blockedUntilDate.getTime().toString() + ";" + expires + ";path=/";
    };
 
    var hasPopupcheckCookie = function () {
      var cookie = document.cookie.split(";");
      for (var i = 0; i < cookie.length; i++) {
        if (cookie[i].match("POPUPCHECK=.*")) {
          var currentDate = new Date();
          var now = currentDate.getTime();
          currentDate.setTime(cookie[i].split("=")[1]);
          var blockedUntilTime = currentDate.getTime();
          if (now <= blockedUntilTime) {
            return true;
          }
        }
      }
      return false;
    };
 
    if (hasPopupcheckCookie()) {
      return;
    }
 
    if (sv && !surveyCalled && result.sv !== "ke" && result.sv === "dz") {
      surveyCalled = 1;
      iam_ng_nxss();
    }
 
    if (sv && !surveyCalled && result.sv !== "ke" && (result.sv === "in" || result.sv === "mo" || result.sv === "i2" )) {
      surveyCalled = 1;
      createPopupcheckCookie(qdsParameter.popupBlockDuration);
      var protocol = window.location.protocol;
      var pathOfCheckInvitation = "identitystatus";
      var queryParameter = filterObjectByKeys(qdsParameter, qdsParameter.keysForQueryParam);
      var queryParameterString = "?" + serializeToQueryString(queryParameter);
      if (window.XDomainRequest && document.documentMode === 9) {
        var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + '/identity.js' + queryParameterString+'&callback=iom.gi&c='+Math.random();
        createScriptTag(checkForInvitationUrl);
      } else {
        var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + queryParameterString+'&c='+Math.random();
        var httpRequest = new XMLHttpRequest();
        httpRequest.onreadystatechange = function () {
          if (httpRequest.readyState === XMLHttpRequest.DONE && 200 === httpRequest.status) {
            var response = JSON.parse(httpRequest.responseText);
            getInvitation(response);
          }
        };
        httpRequest.open('GET', checkForInvitationUrl, true);
        httpRequest.withCredentials = true;
        httpRequest.send(null);
      }
 
    }
  }
 
  function hash(key) {
    var hash = 0;
    for (var i=0; i<key.length; ++i) {
      hash += key.charCodeAt(i);
      hash += (hash << 10);
      hash ^= (hash >> 6);
    }
    hash += (hash << 3);
    hash ^= (hash >> 11);
    hash += (hash << 15);
    hash = Math.abs(hash & hash);
    return hash.toString(36);
  }
 
  function activeXDetect() {
    var result = "",
        componentVersion,
        components =[
                     "7790769C-0471-11D2-AF11-00C04FA35D02", "89820200-ECBD-11CF-8B85-00AA005B4340",
                     "283807B5-2C60-11D0-A31D-00AA00B92C03", "4F216970-C90C-11D1-B5C7-0000F8051515",
                     "44BBA848-CC51-11CF-AAFA-00AA00B6015C", "9381D8F2-0288-11D0-9501-00AA00B911A5",
                     "4F216970-C90C-11D1-B5C7-0000F8051515", "5A8D6EE0-3E18-11D0-821E-444553540000",
                     "89820200-ECBD-11CF-8B85-00AA005B4383", "08B0E5C0-4FCB-11CF-AAA5-00401C608555",
                     "45EA75A0-A269-11D1-B5BF-0000F8051515", "DE5AED00-A4BF-11D1-9948-00C04F98BBC9",
                     "22D6F312-B0F6-11D0-94AB-0080C74C7E95", "44BBA842-CC51-11CF-AAFA-00AA00B6015B",
                     "3AF36230-A269-11D1-B5BF-0000F8051515", "44BBA840-CC51-11CF-AAFA-00AA00B6015C",
                     "CC2A9BA0-3BDD-11D0-821E-444553540000", "08B0E5C0-4FCB-11CF-AAA5-00401C608500",
                     "D27CDB6E-AE6D-11CF-96B8-444553540000", "2A202491-F00D-11CF-87CC-0020AFEECF20"
                    ];
    document.body.addBehavior( "#default#clientCaps" );
    for (var i = 0; i < components.length; i++) {
      componentVersion = document.body.getComponentVersion('{' + components[i] + '}', 'ComponentID');
      if ( componentVersion !== null ) {
        result += componentVersion;
      } else {
        result += "null";
      }
    }
    return result;
  }
 
  function fingerprint() {
    var nav = window.navigator, t = nav.userAgent;
    t += getScreen();
    if (nav.plugins.length > 0 ) {
      for (var i = 0; i < nav.plugins.length; i++ ) {
        t += nav.plugins[i].filename + nav.plugins[i].version + nav.plugins[i].description;
      }
    }
    if (nav.mimeTypes.length > 0 ) {
      for (var i = 0; i < nav.mimeTypes.length; i++ ) {
        t += nav.mimeTypes[i].type;
      }
    }
    if ( /MSIE (\d+\.\d+);/.test(nav.userAgent) ) {
      try {
        t += activeXDetect();
      }
      catch(e) {
        // ignore
      }
    }
    return hash(t);
  }
 
  function createScriptTag(url){
    var el = document.createElement("script");
    el.type = "text/javascript";
    el.src = url;
    var head = document.getElementsByTagName("head")[0];
    if(head) {
      head.appendChild(el);
      return el;
    }
    else return false;
  }
 
  function createScriptTagAsync(url, cb){
    var el = document.createElement("script");
    el.type = "text/javascript";
    el.src = url;
    el.onload = cb;
    el.async = true;
    var head = document.getElementsByTagName("head")[0];
    if(head) {
      head.appendChild(el);
      return el;
    }
    else return false;
  }
 
  function transmitData(url, mode) {
    if (url.split("/")[2].slice(url.split("/")[2].length-8) == ".ioam.de" || url.split("/")[2].slice(url.split("/")[2].length-10) == ".iocnt.net") {
      switch (mode) {
        case 1:
          if (IAMPageElement) {
            IAMPageElement.parentNode.removeChild(IAMPageElement);
          }
          IAMPageElement = createScriptTag(url+'&mo=1');
          if (!IAMPageElement) (new Image()).src = url+'&mo=0';
          break;
        case 2:
          (new Image()).src = url+'&mo=0';
          break;
        case 3:
          var IAMsendBox = document.getElementById('iamsendbox'), sendBoxStyle;
          if (IAMsendBox) {
            document.body.removeChild(IAMsendBox);
          }
          IAMsendBox = document.createElement("iframe");
          IAMsendBox.id = "iamsendbox";
          sendBoxStyle = IAMsendBox.style;
          sendBoxStyle.position = "absolute";
          sendBoxStyle.left = sendBoxStyle.top = "-999px";
          IAMsendBox.src = url + "&mo=1";
          document.body.appendChild(IAMsendBox);
          break;
        case 0:
        default:
          document.write('<script src="'+url+'&mo=1"></script>');
      }
    }
  }
 
  function getScreen() {
    return screen.width + "x" + screen.height + "x" + screen.colorDepth;
  }
 
  function arrayContains(arr, obj) {
    var i;
    for (i=0;i<arr.length;i++) {
      if (arr[i]==obj) return true;
    }
    return false;
  }
 
  function transformVar(value) {
    if (!value) value = "";
    value = value.replace(/[?#].*/g, "");
    value = value.replace(/[^a-zA-Z0-9,_\/-]+/g, ".");
    if (value.length > 255) value = value.substr(0,254) + '+';
    return value;
  }
 
  function getRefHost() {
    var url = document.referrer.split("/");
    return (url.length >= 3) ? url[2] : "";
  }
 
  function buildResult(params) {
    result = {};
    var i;
    for (i in params) {
      if (params.hasOwnProperty(i)) {
        if (i != "cn" || (i == "cn" && arrayContains(cntSubdomain, params[i]))) {
          result[i] = params[i];
        }
      }
    }
    if (result.hasOwnProperty("fp")) {
      result.fp = (result.fp != "" && typeof result.fp != "undefined") ? result.fp : emptyCode;
      result.fp = transformVar(result.fp);
      result.pt = "FP";
    }
    if (result.hasOwnProperty("np")) {
      result.np = (result.np != "" && typeof result.np != "undefined") ? result.np : emptyCode;
      result.np = transformVar(result.np);
      result.pt = "NP";
    }
    if (result.hasOwnProperty("xp")) {
      result.xp = (result.xp != "" && typeof result.xp != "undefined") ? result.xp : emptyCode;
      result.xp = transformVar(result.xp);
      result.pt = "XP";
    }
    if (result.hasOwnProperty("cp")) {
      result.cp = (result.cp != "" && typeof result.cp != "undefined") ? result.cp : emptyCode;
      result.cp = transformVar(result.cp);
      result.pt = "CP";
    }
    if (!result.pt) {
      result.cp = emptyCode;
      result.pt = "CP";
      result.er = "N13";
    }
    if (!result.hasOwnProperty("ps")) {
      result.ps = "lin";
      result.er = "N22";
    } else {
      if (!(arrayContains(['ack', 'lin', 'pio', 'out'], result.ps))) {
        result.ps = "lin";
        result.er = "N23";
      }
    }
    result.rf = getRefHost();
    if (!result.hasOwnProperty("sur") || (result.hasOwnProperty("sur") && result.sur != "yes")) {
      result.r2 = document.referrer;
    }
    result.ur = document.location.host;
    result.xy = getScreen();
    result.lo = "US/Oregon";
    result.cb = "000d";
    result.i2 = "000dc8b3f4e3020ae5cbcfc38";
    result.ep = 1579667364;
    result.vr = "412";
    result.id = fingerprint();
    result.st = result.st ? result.st : dummySite;
    if (!result.hasOwnProperty("sc") || (result.hasOwnProperty("sc") && result.sc != "no")) {
      var cookie = getFirstPartyCookie();
      result.i3 = cookie.cookie;
      result.n1 = cookie.length;
    }
    if (((arrayContains(cookiewhitelist, result.st)) || (result.hasOwnProperty("sc") && result.sc == "yes")) && result.i3 == "nocookie") {
      result.i3 = setFirstPartyCookie();
    }
 
    if (!result.hasOwnProperty("cn") && result.st.charAt(2) == "_") {
      var cn = result.st.substr(0,2);
      if (arrayContains(cntSubdomain, cn)) {
        result.cn = cn;
      } else {
        result.er = "E12";
      }
    }
 
    // DNT dissemination survey
    try {
      result.dntt = ((window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") || (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1"))) ? "1" : "0";
    } catch(e) {
      // ignore
    }
  }
 
  function event(event) {
    var payLoad = "";
    var i;
    event = event || "";
    stopHeart();
    if (inited && !isDoNotTrack() && (!checkEvents || (checkEvents && arrayContains(eventList, event))) && result.ps !== "out") {
      result.lt = (new Date()).getTime();
      result.ev = event;
      var proto = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:";
      var baseUrl = baseUrlDE;
      if (result.cn) {
        baseUrl = result.cn + cntBaseUrl;
      }
      if ( !(arrayContains(LSOBlacklist, result.st)) && (((/iPhone/.test(window.navigator.userAgent) || /iPad/.test(window.navigator.userAgent)) && /Safari/.test(window.navigator.userAgent) && !(/Chrome/.test(window.navigator.userAgent))  && !(/CriOS/.test(window.navigator.userAgent))) || (/Maple_2011/.test(window.navigator.userAgent))) ) {
        if (result.cn) {
          baseUrl = result.cn + cntBaseUrlLSO;
        } else {
          baseUrl = baseUrlLSO;
        }
        mode = 3;
        if (result.hasOwnProperty("sur") && result.sur == "yes") {
          result.u2 = window.location.origin;
        } else {
          result.u2 = document.URL;
        }
      }
      for (i in result) {
        if (result.hasOwnProperty(i) && i!="cs" && i!="url") {
          payLoad = payLoad + encodeURIComponent(i).slice(0,8) + "=" + encodeURIComponent(result[i]).slice(0,2048) + "&";
        }
      }
      payLoad = payLoad.slice(0,4096);
      result.cs = hash(payLoad);
      result.url = proto + "//" + baseUrl + "?" + payLoad + "cs=" + result.cs;
      transmitData(result.url, mode);
      if (arrayContains(['play', 'resm', 'alve', 'mute', 'sfqt', 'ssqt', 'stqt', 'sapl', 'snsp'], event) && mode === 1 && result.hasOwnProperty('hb')) {
        startHeart();
      }
      return result;
    }
    return {};
  }
 
  function forwardToOldSZM() {
    if (result.oer === "yes" && !window.IVW && !document.IVW) {
      var SZMProtocol = (window.location.protocol.slice(0,4) === 'http') ? window.location.protocol : "https:";
      var SZMComment = (result.co) ? result.co + "_SENT_VIA_MIGRATION_TAG" : "SENT_VIA_MIGRATION_TAG";
      var SZMCode = (result.oc) ? result.oc : ((result.cp) ? ((result.cp == emptyCode) ? "" : result.cp) : "");
      var SZMContType = (result.pt !== null) ? result.pt : "CP";
      (new Image()).src = SZMProtocol + "//" + result.st + ".ivwbox.de/cgi-bin/ivw/" + SZMContType.toUpperCase() + "/" + SZMCode + ";" + SZMComment + "?r=" + escape(document.referrer) + "&d=" + (Math.random()*100000);
    }
  }
 
  function count(params, m) {
    init(params,m);
    return event(result.ev);
  }
 
  function init(params,m) {
    mode = m;
    buildResult(params);
    if (result.sv) {
      result.sv = (result.sv == "in" && mode == 1) ? "i2" : result.sv;
    }
    enableEvents();
    loadSurvey();
    inited = 1;
    forwardToOldSZM();
    return {};
  }
 
  function hybrid(params,m) {
    init(params,m);
    var ioam_smi = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_smi") : null;
    var ioam_site = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_site") : null;
    var ioam_bo = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_bo") : null;
    if ( ioam_smi !== null && ioam_site !== null && ioam_bo !== null ) {
      result.mi = ioam_smi;
      result.fs = result.st;
      result.st = ioam_site;
      result.bo = ioam_bo;
      if (result.fs == result.st) {
        result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
      } else {
        result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
      }
      return event(result.ev);
    } else if ( ioam_smi !== null && ioam_bo !== null ) {
      return {};
    } else {
      if ( window.location.protocol.slice(0,4) !== 'http' || /IOAM\/\d+\.\d+/.test(window.navigator.userAgent) ) {
        return {};
      } else {
        return event(result.ev);
      }
    }
  }
 
  function setMultiIdentifier(midentifier) {
    if ( localStorage.getItem("ioam_smi") === null || localStorage.getItem("ioam_site") === null || localStorage.getItem("ioam_bo") === null || localStorage.getItem("ioam_smi") !== midentifier ) {
      result.fs = result.st;
      var JsonMIndetifier = null;
      var NewSite = null;
      if ( typeof midentifier === 'string' && typeof JSON === 'object' && typeof JSON.parse === 'function' ) {
        try {
          JsonMIndetifier = JSON.parse(midentifier);
          if (JsonMIndetifier.hasOwnProperty( 'library' )) {
            if (JsonMIndetifier.library.hasOwnProperty( 'offerIdentifier' )) {
              if ( JsonMIndetifier.library.offerIdentifier ) {
                NewSite = JsonMIndetifier.library.offerIdentifier;
              } else {
                result.er = "JSON(E10): offerIdentifier not valid";
              }
            } else {
              result.er = "JSON(E10): no key offerIdentifier";
            }
          } else {
            result.er = "JSON(E10): no key library";
          }
        } catch(err) {
          result.er = "JSON(E10): "+err;
        }
      }
      if ( NewSite !== null ) {
        localStorage.setItem("ioam_site", NewSite);
      }
      result.st = NewSite;
      result.mi = midentifier;
      result.bo = (new Date()).getTime();
      localStorage.setItem("ioam_smi", result.mi);
      localStorage.setItem("ioam_bo", result.bo);
      if (result.fs == result.st) {
        result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
      } else {
        result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
      }
      return event(result.ev);
    }
    return {};
  }
 
  if (window.postMessage || window.JSON && {}.toString.call(window.JSON.parse) !== '[object Function]' && {}.toString.call(window.JSON.stringify) !== '[object Function]') {
    var listener = function(msg) {
      try {
        var msgdata = JSON.parse(msg.data);
      } catch(e) {
        msgdata = { type:false };
      }
      if ({}.toString.call(msgdata) === '[object Object]' && msgdata.type == "iam_data") {
        var respObj = {
                       seq : msgdata.seq,
                       iam_data : {
                                   st: result.st,
                                   cp: result.cp
                                  }
                      };
        msg.source.postMessage(JSON.stringify(respObj),msg.origin);
      }
    };
    if (window.addEventListener) {
      window.addEventListener("message", listener);
    } else {
      window.attachEvent("onmessage", listener);
    }
  }
 
  function optin() {
    var oiurl = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:" + "//" + optinUrl;
    var win = window.open(oiurl, '_blank');
    win.focus();
  }
 
  function startHeart() {
    // IE 9 Compatible
    function heartbeat() {
      return event("alve");
    }
    switch (result.hb) {
        case "adshort":
          frequency = hbiAdShort;
          break;
        case "admedium":
          frequency = hbiAdMedium;
          break;
       case "adlong":
          frequency = hbiAdLong;
          break;
        case "short":
          frequency = hbiShort;
          break;
        case "medium":
          frequency = hbiMedium;
          break;
        case "long":
          frequency = hbiLong;
          break;
        case "extralong":
          frequency = hbiExtraLong;
          break;
        default:
          frequency = 0;
    }
    if (frequency != 0) {
      try {
        heart = setInterval(heartbeat, frequency);
      } catch(e) {
        // pass
      }
    }
  }
 
  function stopHeart() {
    try {
      clearInterval(heart);
    } catch(e) {
      // pass
    }
  }
 
  function stringtohex(str) {
    var res = [];
    for (var n = 0, l = str.length; n < l; n ++) {
      var hex = Number(str.charCodeAt(n)).toString(16);
      res.push(hex);
    }
    return res.join('');
  }
 
  function getUniqueID() {
    var max = 999999999999;
    var min = 100000000000;
    return (Math.floor(Math.random() * (max - min + 1)) + min).toString(16) + (Math.floor(Math.random() * (max - min + 1)) + min).toString(16) + stringtohex(result.cb) + (Math.floor(Math.random() * (max - min + 1)) + min).toString(16);
  }
 
  function expireDays() {
    var max = 365;
    var min = 300;
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }
 
  function getFirstPartyCookie() {
    var cookie = document.cookie.split(";");
    for (var i = 0; i < cookie.length; i++) {
      if (cookie[i].match(cookieName + "=.*")) {
        var ourcookie = cookie[i].split("=")[1];
        if (hash(ourcookie.split("!")[0]) == ourcookie.split("!")[1]) {
          if (!result.hasOwnProperty("i3") || !result.i3) {
            updateFirstPartyCookie(ourcookie);
          }
          return { 
            cookie: ourcookie, 
            length: cookie.length
          };
        } else {
          // checksum failed, cookie not trusted, delete cookie
          result.er = "N19";
          try {
            setFirstPartyCookie(2000);
          } catch(e) {
            result.er = "N20";
          }
        }
      } 
    }
    return {cookie: "nocookie", length: cookie.length};
  }
 
  function checkFirstPartyCookie() {
    var cookie = getFirstPartyCookie();
    if (cookie.cookie != "nocookie") {
      return true;
    } else {
      return false;
    }
  }
 
  function getFpcd(cd) {
    var ctld ='acadaeafagaialamaoaqarasatauawaxazbabbbdbebfbgbhbibjbmbnbobrbsbtbwbybzcacccdcfcgchcickclcmcncocrcucvcwcxcyczdjdkdmdodzeceeegereseteufifjfkfmfofrgagdgegfggghgiglgmgngpgqgrgsgtgugwgyhkhmhnhrhthuidieiliminioiqirisitjejmjojpkekgkhkikmknkpkrkwkykzlalblclilklrlsltlulvlymamcmdmemgmhmkmlmmmnmompmqmrmsmtmumvmwmxmymznancnenfngninlnonpnrnunzompapepfpgphpkplpmpnprpsptpwpyqarerorsrurwsasbscsdsesgshsiskslsmsnsosrssstsvsxsysztctdtftgthtjtktltmtntotrtttvtwtzuaugukusuyuzvavcvevgvivnvuwfwsyeytzazmzw'.match(/.{1,2}(?=(.{2})+(?!.))|.{1,2}$/g),
        blkPrefixes = ['www', 'm', 'mobile'],
        urlParts = cd.split('.'),
        fpcd,
        ctldParts = [],
        hostParts = [],
        ctldPart = '',
        hostPart = '',
        i = 0,
        iLen = 0;
    if (!cd) return '';
    if (arrayContains(ctld, urlParts[urlParts.length -1])) {
      for (i = urlParts.length -1; i >= 0; i -= 1) {
        if ( i >= urlParts.length - 3 && urlParts[i].length <= 4) {
          ctldParts.push(urlParts[i]);
        } else {
          hostParts.push(urlParts[i]);
          break;
        }
      }
      ctldParts = ctldParts.reverse();
      for (i = 0, iLen = ctldParts.length;i < iLen; i += 1) {
        if (!arrayContains(blkPrefixes, ctldParts[i])) {
          ctldPart += i < iLen ? '.' + ctldParts[i] :  ctldParts[i];
        }
      }
      hostParts = hostParts.reverse();
      hostPart = hostParts[hostParts.length - 1] || '';
      if (arrayContains(blkPrefixes, hostPart)) {
        hostPart = '';
      }
    } else {
      hostPart = urlParts
        .slice(urlParts.length - 2, urlParts.length)
        .join('.') || '';
    }
    fpcd = hostPart + ctldPart;
    if (fpcd && fpcd.length > 4 && fpcd.split('.').length > 1) {
      // RFC 2109
      return 'domain=' + (fpcd[0] === '.' ? fpcd : (fpcd ? '.' + fpcd : '')) + ';';
    }
    return '';
  }
 
  function updateFirstPartyCookie(cookievalue) {
    var domain = getFpcd(location.hostname);
    var expireValue = cookievalue.split(":")[1];
    var events = parseInt(cookievalue.split(":")[4]) + 1;
    var expireDate = new Date(new Date().setTime(expireValue));
    var now = new Date();
    var cookval = cookievalue.split(":").slice(0,4).join(":") + ":" + events + ":" + now.getTime().toString();
    cookval = cookval + "!" + hash(cookval);
    document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
  }
 
  function setFirstPartyCookie(expire) {
    if (!expire) {
      expire = expireDays()*24*60*60*1000;
    }
    var domain = getFpcd(location.hostname);
    var expireDate = new Date(new Date().setTime(new Date().getTime()+expire));
    var setDate = new Date();
    var identifier;
    if (result.hasOwnProperty("i2")) {
      identifier = result.i2;
    } else {
      identifier = getUniqueID();
    }
    var cookval = identifier + ":" + expireDate.getTime().toString() + ":" + setDate.getTime().toString() + ":" + domain.replace("domain=", "").replace(";", "") + ":1:" +  setDate.getTime().toString();
    cookval = cookval + "!" + hash(cookval);
    document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
    if (!checkFirstPartyCookie()) {
      // cookie not found, try it without domain
      document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";path=/;";
      result.er = "N25";
      if (!checkFirstPartyCookie()) {
        result.er = "N26";
        return "nocookie";
      }
    }
    return cookval;
  }
 
  function createCORSRequest(method, url) {
    var xdhreq = new XMLHttpRequest();
    if ("withCredentials" in xdhreq) {
      xdhreq.open(method, url, true);
      xdhreq.withCredentials = true;
    } else if (typeof XDomainRequest != "undefined") {
      xdhreq = new XDomainRequest();
      xdhreq.open(method, url);
    } else {
      xdhreq = null;
    }
    return xdhreq;
  }
 
  function getPlus() {
    if (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') {
      if (localStorage.getItem("ioamplusdata") !== null && localStorage.getItem("ioamplusttl") !== null) {
        var currentDate = new Date();
        var now = currentDate.getTime();
        currentDate.setTime(localStorage.getItem("ioamplusttl"));
        if (now <= currentDate.getTime()) {
          return true;
        }
      }
      var checkForSocio = 'https:' + '//' + ioplusurl + '/soziodata2.php?sc=' + socioToken + '&st=' + result.st + '&id=' + result.id;
      var XHR = createCORSRequest('GET', checkForSocio);
      if (XHR) {
        XHR.onload = function() {
          var response = XHR.responseText;
          var blockedUntilDate = new Date();
          try {
            if ((response.split(":")[1].split(",")[0]) == "0") {
              blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottlmin);
              localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
              if (localStorage.getItem("ioamplusdata") == null) {
                localStorage.setItem("ioamplusdata", response);
              }
            } else {
              blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottl);
              localStorage.setItem("ioamplusdata", response);
              localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
            }
          } catch(e) {
            // pass
          }
        };
        XHR.send();
        return true;
      }
    }
    return false;
  }
 
  return {
    count: count,
    c: count,
    i: init,
    init: init,
    e: event,
    event: event,
    h: hybrid,
    hybrid: hybrid,
    setMultiIdentifier: setMultiIdentifier,
    smi: setMultiIdentifier,
    oi: optin,
    optin: optin,
    getInvitation: getInvitation,
    gi: getInvitation,
    getPlus: getPlus,
    gp: getPlus
  };
 
})();
 
 
    var iam_data = {
        "st": "dastelef",
        "cp": "TBBUND_Start",
        "sv": "in"
    };
    iom.c(iam_data);
 
/* PLEASE DO NOT COPY AND PASTE THIS CODE. */(function(){var CFG='___grecaptcha_cfg';if(!window[CFG]){window[CFG]={};}var GR='grecaptcha';if(!window[GR]){window[GR]={};}window[GR].ready=window[GR].ready||function(f){(window[CFG]['fns']=window[CFG]['fns']||[]).push(f);};(window[CFG]['fallback']=window[CFG]['fallback']||[]).push('true');(window[CFG]['render']=window[CFG]['render']||[]).push('explicit');(window[CFG]['onload']=window[CFG]['onload']||[]).push('onloadCallback');window['__google_recaptcha_client']=true;var po=document.createElement('script');po.type='text/javascript';po.async=true;po.src='https://www.gstatic.com/recaptcha/api2/v1554100419869/recaptcha__en.js';var elem=document.querySelector('script[nonce]');var n=elem&&(elem['nonce']||elem.getAttribute('nonce'));if(n){po.setAttribute('nonce',n);}var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(po, s);})();
 
    var Confirmation = (function ($) {
        var my = {'facebookCallback': null};
 
        my.registerFacebookCallback = function (cb) {
            my.facebookCallback = cb;
        };
 
        my.isConfirmed = function (by, data) {
            var email, accountname, token;
 
            if (by === 'facebook') {
                email = data.profile.email;
                accountname = data.profile.name;
                token = data.auth.authResponse.accessToken;
                $('.facebook-authinfo').val(JSON.stringify(data.auth.authResponse));
 
                if (typeof my.facebookCallback === 'function') {
                    my.facebookCallback(data.auth, data.profile);
                }
            } else {
                if (by === 'twitter') {
                    email = 'not_send';
                    accountname = 'not_send';
                    token = 'private';
                } else {
                    return;
                }
            }
 
            $('.confirm-option').hide();
            $('.confirm-info').show().children(':nth-child(2)').html('Bestätigung erfolgt über ' + by.charAt(0).toUpperCase() + by.slice(1));
            $('.privemail').val(email);
            $('.accountname').val(accountname);
            $('.accesstoken').val(token);
            $('.confirmMethod').val(by);
            $('.captchaAnswer').val('1234');
        };
 
        my.listener = function (event) {
            if (event.data === 'dialo_twitter_confirm_ok') {
                my.isConfirmed('twitter');
            }
        };
 
        return my;
    }(jQuery));
 
    if (window.addEventListener) {
        addEventListener("message", function (e) {
            if (Confirmation) {
                Confirmation.listener(e);
            }
            if (Login) {
                Login.listener(e);
            }
        }, false)
    } else {
        attachEvent("onmessage", function (e) {
            if (Confirmation) {
                Confirmation.listener(e);
            }
            if (Login) {
                Login.listener(e);
            }
        })
    }
 
    
    jQuery(window).load(function () {
        
        $('.image-defer').each(function () {
            $(this).attr('src', $(this).data('src'));
        });
    })
 
/*!
 * Bootstrap v3.3.5 (http://getbootstrap.com)
 * Copyright 2011-2016 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
 
/*!
 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=1329f33fb164b183e04b121bd6602571)
 * Config saved to config.json and https://gist.github.com/1329f33fb164b183e04b121bd6602571
 */
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||e[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),n=i.data("bs.alert");n||i.data("bs.alert",n=new o(this)),"string"==typeof e&&n[e].call(i)})}var i='[data-dismiss="alert"]',o=function(e){t(e).on("click",i,this.close)};o.VERSION="3.3.6",o.TRANSITION_DURATION=150,o.prototype.close=function(e){function i(){a.detach().trigger("closed.bs.alert").remove()}var n=t(this),s=n.attr("data-target");s||(s=n.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,""));var a=t(s);e&&e.preventDefault(),a.length||(a=n.closest(".alert")),a.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(a.removeClass("in"),t.support.transition&&a.hasClass("fade")?a.one("bsTransitionEnd",i).emulateTransitionEnd(o.TRANSITION_DURATION):i())};var n=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=o,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.bs.alert.data-api",i,o.prototype.close)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.button"),s="object"==typeof e&&e;n||o.data("bs.button",n=new i(this,s)),"toggle"==e?n.toggle():e&&n.setState(e)})}var i=function(e,o){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,o),this.isLoading=!1};i.VERSION="3.3.6",i.DEFAULTS={loadingText:"loading..."},i.prototype.setState=function(e){var i="disabled",o=this.$element,n=o.is("input")?"val":"html",s=o.data();e+="Text",null==s.resetText&&o.data("resetText",o[n]()),setTimeout(t.proxy(function(){o[n](null==s[e]?this.options[e]:s[e]),"loadingText"==e?(this.isLoading=!0,o.addClass(i).attr(i,i)):this.isLoading&&(this.isLoading=!1,o.removeClass(i).removeAttr(i))},this),0)},i.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var o=t.fn.button;t.fn.button=e,t.fn.button.Constructor=i,t.fn.button.noConflict=function(){return t.fn.button=o,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(i){var o=t(i.target);o.hasClass("btn")||(o=o.closest(".btn")),e.call(o,"toggle"),t(i.target).is('input[type="radio"]')||t(i.target).is('input[type="checkbox"]')||i.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.carousel"),s=t.extend({},i.DEFAULTS,o.data(),"object"==typeof e&&e),a="string"==typeof e?e:s.slide;n||o.data("bs.carousel",n=new i(this,s)),"number"==typeof e?n.to(e):a?n[a]():s.interval&&n.pause().cycle()})}var i=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",t.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};i.VERSION="3.3.6",i.TRANSITION_DURATION=600,i.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},i.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},i.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},i.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},i.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e),o="prev"==t&&0===i||"next"==t&&i==this.$items.length-1;if(o&&!this.options.wrap)return e;var n="prev"==t?-1:1,s=(i+n)%this.$items.length;return this.$items.eq(s)},i.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));return t>this.$items.length-1||0>t?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",this.$items.eq(t))},i.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},i.prototype.next=function(){return this.sliding?void 0:this.slide("next")},i.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},i.prototype.slide=function(e,o){var n=this.$element.find(".item.active"),s=o||this.getItemForDirection(e,n),a=this.interval,r="next"==e?"left":"right",l=this;if(s.hasClass("active"))return this.sliding=!1;var h=s[0],d=t.Event("slide.bs.carousel",{relatedTarget:h,direction:r});if(this.$element.trigger(d),!d.isDefaultPrevented()){if(this.sliding=!0,a&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var p=t(this.$indicators.children()[this.getItemIndex(s)]);p&&p.addClass("active")}var c=t.Event("slid.bs.carousel",{relatedTarget:h,direction:r});return t.support.transition&&this.$element.hasClass("slide")?(s.addClass(e),s[0].offsetWidth,n.addClass(r),s.addClass(r),n.one("bsTransitionEnd",function(){s.removeClass([e,r].join(" ")).addClass("active"),n.removeClass(["active",r].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(c)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)):(n.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(c)),a&&this.cycle(),this}};var o=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=i,t.fn.carousel.noConflict=function(){return t.fn.carousel=o,this};var n=function(i){var o,n=t(this),s=t(n.attr("data-target")||(o=n.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,""));if(s.hasClass("carousel")){var a=t.extend({},s.data(),n.data()),r=n.attr("data-slide-to");r&&(a.interval=!1),e.call(s,a),r&&s.data("bs.carousel").to(r),i.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",n).on("click.bs.carousel.data-api","[data-slide-to]",n),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var i=t(this);e.call(i,i.data())})})}(jQuery),+function(t){"use strict";function e(e){var i=e.attr("data-target");i||(i=e.attr("href"),i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,""));var o=i&&t(i);return o&&o.length?o:e.parent()}function i(i){i&&3===i.which||(t(n).remove(),t(s).each(function(){var o=t(this),n=e(o),s={relatedTarget:this};n.hasClass("open")&&(i&&"click"==i.type&&/input|textarea/i.test(i.target.tagName)&&t.contains(n[0],i.target)||(n.trigger(i=t.Event("hide.bs.dropdown",s)),i.isDefaultPrevented()||(o.attr("aria-expanded","false"),n.removeClass("open").trigger(t.Event("hidden.bs.dropdown",s)))))}))}function o(e){return this.each(function(){var i=t(this),o=i.data("bs.dropdown");o||i.data("bs.dropdown",o=new a(this)),"string"==typeof e&&o[e].call(i)})}var n=".dropdown-backdrop",s='[data-toggle="dropdown"]',a=function(e){t(e).on("click.bs.dropdown",this.toggle)};a.VERSION="3.3.6",a.prototype.toggle=function(o){var n=t(this);if(!n.is(".disabled, :disabled")){var s=e(n),a=s.hasClass("open");if(i(),!a){"ontouchstart"in document.documentElement&&!s.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",i);var r={relatedTarget:this};if(s.trigger(o=t.Event("show.bs.dropdown",r)),o.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),s.toggleClass("open").trigger(t.Event("shown.bs.dropdown",r))}return!1}},a.prototype.keydown=function(i){if(/(38|40|27|32)/.test(i.which)&&!/input|textarea/i.test(i.target.tagName)){var o=t(this);if(i.preventDefault(),i.stopPropagation(),!o.is(".disabled, :disabled")){var n=e(o),a=n.hasClass("open");if(!a&&27!=i.which||a&&27==i.which)return 27==i.which&&n.find(s).trigger("focus"),o.trigger("click");var r=" li:not(.disabled):visible a",l=n.find(".dropdown-menu"+r);if(l.length){var h=l.index(i.target);38==i.which&&h>0&&h--,40==i.which&&h<l.length-1&&h++,~h||(h=0),l.eq(h).trigger("focus")}}}};var r=t.fn.dropdown;t.fn.dropdown=o,t.fn.dropdown.Constructor=a,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=r,this},t(document).on("click.bs.dropdown.data-api",i).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",s,a.prototype.toggle).on("keydown.bs.dropdown.data-api",s,a.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",a.prototype.keydown)}(jQuery),+function(t){"use strict";function e(e,o){return this.each(function(){var n=t(this),s=n.data("bs.modal"),a=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e);s||n.data("bs.modal",s=new i(this,a)),"string"==typeof e?s[e](o):a.show&&s.show(o)})}var i=function(e,i){this.options=i,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};i.VERSION="3.3.6",i.TRANSITION_DURATION=300,i.BACKDROP_TRANSITION_DURATION=150,i.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},i.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},i.prototype.show=function(e){var o=this,n=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var n=t.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),n&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var s=t.Event("shown.bs.modal",{relatedTarget:e});n?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(i.TRANSITION_DURATION):o.$element.trigger("focus").trigger(s)}))},i.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(i.TRANSITION_DURATION):this.hideModal())},i.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},i.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},i.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},i.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},i.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},i.prototype.backdrop=function(e){var o=this,n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=t.support.transition&&n;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+n).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;s?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var a=function(){o.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",a).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):a()}else e&&e()},i.prototype.handleUpdate=function(){this.adjustDialog()},i.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},i.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},i.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},i.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},i.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},i.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var o=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=i,t.fn.modal.noConflict=function(){return t.fn.modal=o,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(i){var o=t(this),n=o.attr("href"),s=t(o.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),a=s.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},s.data(),o.data());o.is("a")&&i.preventDefault(),s.one("show.bs.modal",function(t){t.isDefaultPrevented()||s.one("hidden.bs.modal",function(){o.is(":visible")&&o.trigger("focus")})}),e.call(s,a,this)})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.tooltip"),s="object"==typeof e&&e;(n||!/destroy|hide/.test(e))&&(n||o.data("bs.tooltip",n=new i(this,s)),"string"==typeof e&&n[e]())})}var i=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};i.VERSION="3.3.6",i.TRANSITION_DURATION=150,i.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},i.prototype.init=function(e,i,o){if(this.enabled=!0,this.type=e,this.$element=t(i),this.options=this.getOptions(o),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var n=this.options.trigger.split(" "),s=n.length;s--;){var a=n[s];if("click"==a)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=a){var r="hover"==a?"mouseenter":"focusin",l="hover"==a?"mouseleave":"focusout";this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},i.prototype.getDelegateOptions=function(){var e={},i=this.getDefaults();return this._options&&t.each(this._options,function(t,o){i[t]!=o&&(e[t]=o)}),e},i.prototype.enter=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusin"==e.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState?void(i.hoverState="in"):(clearTimeout(i.timeout),i.hoverState="in",i.options.delay&&i.options.delay.show?void(i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)):i.show())},i.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},i.prototype.leave=function(e){var i=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i)),e instanceof t.Event&&(i.inState["focusout"==e.type?"focus":"hover"]=!1),i.isInStateTrue()?void 0:(clearTimeout(i.timeout),i.hoverState="out",i.options.delay&&i.options.delay.hide?void(i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)):i.hide())},i.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var o=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!o)return;var n=this,s=this.tip(),a=this.getUID(this.type);this.setContent(),s.attr("id",a),this.$element.attr("aria-describedby",a),this.options.animation&&s.addClass("fade");var r="function"==typeof this.options.placement?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,h=l.test(r);h&&(r=r.replace(l,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(r).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var d=this.getPosition(),p=s[0].offsetWidth,c=s[0].offsetHeight;if(h){var f=r,u=this.getPosition(this.$viewport);r="bottom"==r&&d.bottom+c>u.bottom?"top":"top"==r&&d.top-c<u.top?"bottom":"right"==r&&d.right+p>u.width?"left":"left"==r&&d.left-p<u.left?"right":r,s.removeClass(f).addClass(r)}var g=this.getCalculatedOffset(r,d,p,c);this.applyPlacement(g,r);var v=function(){var t=n.hoverState;n.$element.trigger("shown.bs."+n.type),n.hoverState=null,"out"==t&&n.leave(n)};t.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",v).emulateTransitionEnd(i.TRANSITION_DURATION):v()}},i.prototype.applyPlacement=function(e,i){var o=this.tip(),n=o[0].offsetWidth,s=o[0].offsetHeight,a=parseInt(o.css("margin-top"),10),r=parseInt(o.css("margin-left"),10);isNaN(a)&&(a=0),isNaN(r)&&(r=0),e.top+=a,e.left+=r,t.offset.setOffset(o[0],t.extend({using:function(t){o.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),o.addClass("in");var l=o[0].offsetWidth,h=o[0].offsetHeight;"top"==i&&h!=s&&(e.top=e.top+s-h);var d=this.getViewportAdjustedDelta(i,e,l,h);d.left?e.left+=d.left:e.top+=d.top;var p=/top|bottom/.test(i),c=p?2*d.left-n+l:2*d.top-s+h,f=p?"offsetWidth":"offsetHeight";o.offset(e),this.replaceArrow(c,o[0][f],p)},i.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},i.prototype.hide=function(e){function o(){"in"!=n.hoverState&&s.detach(),n.$element.removeAttr("aria-describedby").trigger("hidden.bs."+n.type),e&&e()}var n=this,s=t(this.$tip),a=t.Event("hide.bs."+this.type);return this.$element.trigger(a),a.isDefaultPrevented()?void 0:(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",o).emulateTransitionEnd(i.TRANSITION_DURATION):o(),this.hoverState=null,this)},i.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},i.prototype.hasContent=function(){return this.getTitle()},i.prototype.getPosition=function(e){e=e||this.$element;var i=e[0],o="BODY"==i.tagName,n=i.getBoundingClientRect();null==n.width&&(n=t.extend({},n,{width:n.right-n.left,height:n.bottom-n.top}));var s=o?{top:0,left:0}:e.offset(),a={scroll:o?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},r=o?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},n,a,r,s)},i.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},i.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},i.prototype.getTitle=function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},i.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},i.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},i.prototype.enable=function(){this.enabled=!0},i.prototype.disable=function(){this.enabled=!1},i.prototype.toggleEnabled=function(){this.enabled=!this.enabled},i.prototype.toggle=function(e){var i=this;e&&(i=t(e.currentTarget).data("bs."+this.type),i||(i=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,i))),e?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)},i.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null})};var o=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=i,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=o,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.popover"),s="object"==typeof e&&e;(n||!/destroy|hide/.test(e))&&(n||o.data("bs.popover",n=new i(this,s)),"string"==typeof e&&n[e]())})}var i=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");i.VERSION="3.3.6",i.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),i.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),i.prototype.constructor=i,i.prototype.getDefaults=function(){return i.DEFAULTS},i.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof i?"html":"append":"text"](i),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},i.prototype.hasContent=function(){return this.getTitle()||this.getContent()},i.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},i.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var o=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=i,t.fn.popover.noConflict=function(){return t.fn.popover=o,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.tab");n||o.data("bs.tab",n=new i(this)),"string"==typeof e&&n[e]()})}var i=function(e){this.element=t(e)};i.VERSION="3.3.6",i.TRANSITION_DURATION=150,i.prototype.show=function(){var e=this.element,i=e.closest("ul:not(.dropdown-menu)"),o=e.data("target");if(o||(o=e.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var n=i.find(".active:last a"),s=t.Event("hide.bs.tab",{relatedTarget:e[0]}),a=t.Event("show.bs.tab",{relatedTarget:n[0]});if(n.trigger(s),e.trigger(a),!a.isDefaultPrevented()&&!s.isDefaultPrevented()){var r=t(o);this.activate(e.closest("li"),i),this.activate(r,r.parent(),function(){n.trigger({type:"hidden.bs.tab",relatedTarget:e[0]}),e.trigger({type:"shown.bs.tab",relatedTarget:n[0]})})}}},i.prototype.activate=function(e,o,n){function s(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),e.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),r?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu").length&&e.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),n&&n()}var a=o.find("> .active"),r=n&&t.support.transition&&(a.length&&a.hasClass("fade")||!!o.find("> .fade").length);a.length&&r?a.one("bsTransitionEnd",s).emulateTransitionEnd(i.TRANSITION_DURATION):s(),a.removeClass("in")};var o=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=i,t.fn.tab.noConflict=function(){return t.fn.tab=o,this};var n=function(i){i.preventDefault(),e.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',n).on("click.bs.tab.data-api",'[data-toggle="pill"]',n)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var o=t(this),n=o.data("bs.affix"),s="object"==typeof e&&e;n||o.data("bs.affix",n=new i(this,s)),"string"==typeof e&&n[e]()})}var i=function(e,o){this.options=t.extend({},i.DEFAULTS,o),this.$target=t(this.options.target).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.6",i.RESET="affix affix-top affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return i>n?"top":!1;if("bottom"==this.affixed)return null!=i?n+this.unpin<=s.top?!1:"bottom":t-o>=n+a?!1:"bottom";var r=null==this.affixed,l=r?n:s.top,h=r?a:e;return null!=i&&i>=n?"top":null!=o&&l+h>=t-o?"bottom":!1},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),o=this.options.offset,n=o.top,s=o.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof o&&(s=n=o),"function"==typeof n&&(n=o.top(this.$element)),"function"==typeof s&&(s=o.bottom(this.$element));var r=this.getState(a,e,n,s);if(this.affixed!=r){null!=this.unpin&&this.$element.css("top","");var l="affix"+(r?"-"+r:""),h=t.Event(l+".bs.affix");if(this.$element.trigger(h),h.isDefaultPrevented())return;this.affixed=r,this.unpin="bottom"==r?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==r&&this.$element.offset({top:a-e-s})}};var o=t.fn.affix;t.fn.affix=e,t.fn.affix.Constructor=i,t.fn.affix.noConflict=function(){return t.fn.affix=o,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var i=t(this),o=i.data();o.offset=o.offset||{},null!=o.offsetBottom&&(o.offset.bottom=o.offsetBottom),null!=o.offsetTop&&(o.offset.top=o.offsetTop),e.call(i,o)})})}(jQuery),+function(t){"use strict";function e(e){var i,o=e.attr("data-target")||(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return t(o)}function i(e){return this.each(function(){var i=t(this),n=i.data("bs.collapse"),s=t.extend({},o.DEFAULTS,i.data(),"object"==typeof e&&e);!n&&s.toggle&&/show|hide/.test(e)&&(s.toggle=!1),n||i.data("bs.collapse",n=new o(this,s)),"string"==typeof e&&n[e]()})}var o=function(e,i){this.$element=t(e),this.options=t.extend({},o.DEFAULTS,i),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};o.VERSION="3.3.6",o.TRANSITION_DURATION=350,o.DEFAULTS={toggle:!0},o.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},o.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,n=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(n&&n.length&&(e=n.data("bs.collapse"),e&&e.transitioning))){var s=t.Event("show.bs.collapse");if(this.$element.trigger(s),!s.isDefaultPrevented()){n&&n.length&&(i.call(n,"hide"),e||n.data("bs.collapse",null));var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var r=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return r.call(this);var l=t.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",t.proxy(r,this)).emulateTransitionEnd(o.TRANSITION_DURATION)[a](this.$element[0][l]);
}}}},o.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var i=this.dimension();this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var n=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return t.support.transition?void this.$element[i](0).one("bsTransitionEnd",t.proxy(n,this)).emulateTransitionEnd(o.TRANSITION_DURATION):n.call(this)}}},o.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},o.prototype.getParent=function(){return t(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy(function(i,o){var n=t(o);this.addAriaAndCollapsedClass(e(n),n)},this)).end()},o.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var n=t.fn.collapse;t.fn.collapse=i,t.fn.collapse.Constructor=o,t.fn.collapse.noConflict=function(){return t.fn.collapse=n,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(o){var n=t(this);n.attr("data-target")||o.preventDefault();var s=e(n),a=s.data("bs.collapse"),r=a?"toggle":n.data();i.call(s,r)})}(jQuery),+function(t){"use strict";function e(i,o){this.$body=t(document.body),this.$scrollElement=t(t(i).is(document.body)?window:i),this.options=t.extend({},e.DEFAULTS,o),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function i(i){return this.each(function(){var o=t(this),n=o.data("bs.scrollspy"),s="object"==typeof i&&i;n||o.data("bs.scrollspy",n=new e(this,s)),"string"==typeof i&&n[i]()})}e.VERSION="3.3.6",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,i="offset",o=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(i="position",o=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var e=t(this),n=e.data("target")||e.attr("href"),s=/^#./.test(n)&&t(n);return s&&s.length&&s.is(":visible")&&[[s[i]().top+o,n]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){e.offsets.push(this[0]),e.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),e>=o)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(void 0===n[t+1]||e<n[t+1])&&this.activate(s[t])},e.prototype.activate=function(e){this.activeTarget=e,this.clear();var i=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',o=t(i).parents("li").addClass("active");o.parent(".dropdown-menu").length&&(o=o.closest("li.dropdown").addClass("active")),o.trigger("activate.bs.scrollspy")},e.prototype.clear=function(){t(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var o=t.fn.scrollspy;t.fn.scrollspy=i,t.fn.scrollspy.Constructor=e,t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=o,this},t(window).on("load.bs.scrollspy.data-api",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);i.call(e,e.data())})})}(jQuery),+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}t.fn.emulateTransitionEnd=function(e){var i=!1,o=this;t(this).one("bsTransitionEnd",function(){i=!0});var n=function(){i||t(o).trigger(t.support.transition.end)};return setTimeout(n,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery);;/* ========================================================================
 * bootstrap-switch - v3.3.2
 * http://www.bootstrap-switch.org
 * ========================================================================
 * Copyright 2012-2013 Mattia Larentis
 *
 * ========================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================================
 */
 
(function(){var t=[].slice;!function(e,i){"use strict";var n;return n=function(){function t(t,i){null==i&&(i={}),this.$element=e(t),this.options=e.extend({},e.fn.bootstrapSwitch.defaults,{state:this.$element.is(":checked"),size:this.$element.data("size"),animate:this.$element.data("animate"),disabled:this.$element.is(":disabled"),readonly:this.$element.is("[readonly]"),indeterminate:this.$element.data("indeterminate"),inverse:this.$element.data("inverse"),radioAllOff:this.$element.data("radio-all-off"),onColor:this.$element.data("on-color"),offColor:this.$element.data("off-color"),onText:this.$element.data("on-text"),offText:this.$element.data("off-text"),labelText:this.$element.data("label-text"),handleWidth:this.$element.data("handle-width"),labelWidth:this.$element.data("label-width"),baseClass:this.$element.data("base-class"),wrapperClass:this.$element.data("wrapper-class")},i),this.$wrapper=e("<div>",{"class":function(t){return function(){var e;return e=[""+t.options.baseClass].concat(t._getClasses(t.options.wrapperClass)),e.push(t.options.state?""+t.options.baseClass+"-on":""+t.options.baseClass+"-off"),null!=t.options.size&&e.push(""+t.options.baseClass+"-"+t.options.size),t.options.disabled&&e.push(""+t.options.baseClass+"-disabled"),t.options.readonly&&e.push(""+t.options.baseClass+"-readonly"),t.options.indeterminate&&e.push(""+t.options.baseClass+"-indeterminate"),t.options.inverse&&e.push(""+t.options.baseClass+"-inverse"),t.$element.attr("id")&&e.push(""+t.options.baseClass+"-id-"+t.$element.attr("id")),e.join(" ")}}(this)()}),this.$container=e("<div>",{"class":""+this.options.baseClass+"-container"}),this.$on=e("<span>",{html:this.options.onText,"class":""+this.options.baseClass+"-handle-on "+this.options.baseClass+"-"+this.options.onColor}),this.$off=e("<span>",{html:this.options.offText,"class":""+this.options.baseClass+"-handle-off "+this.options.baseClass+"-"+this.options.offColor}),this.$label=e("<span>",{html:this.options.labelText,"class":""+this.options.baseClass+"-label"}),this.$element.on("init.bootstrapSwitch",function(e){return function(){return e.options.onInit.apply(t,arguments)}}(this)),this.$element.on("switchChange.bootstrapSwitch",function(e){return function(){return e.options.onSwitchChange.apply(t,arguments)}}(this)),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop("indeterminate",!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger("init.bootstrapSwitch")}return t.prototype._constructor=t,t.prototype.state=function(t,e){return"undefined"==typeof t?this.options.state:this.options.disabled||this.options.readonly?this.$element:this.options.state&&!this.options.radioAllOff&&this.$element.is(":radio")?this.$element:(this.options.indeterminate&&this.indeterminate(!1),t=!!t,this.$element.prop("checked",t).trigger("change.bootstrapSwitch",e),this.$element)},t.prototype.toggleState=function(t){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop("checked",!this.options.state).trigger("change.bootstrapSwitch",t)},t.prototype.size=function(t){return"undefined"==typeof t?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(""+this.options.baseClass+"-"+this.options.size),t&&this.$wrapper.addClass(""+this.options.baseClass+"-"+t),this._width(),this._containerPosition(),this.options.size=t,this.$element)},t.prototype.animate=function(t){return"undefined"==typeof t?this.options.animate:(t=!!t,t===this.options.animate?this.$element:this.toggleAnimate())},t.prototype.toggleAnimate=function(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(""+this.options.baseClass+"-animate"),this.$element},t.prototype.disabled=function(t){return"undefined"==typeof t?this.options.disabled:(t=!!t,t===this.options.disabled?this.$element:this.toggleDisabled())},t.prototype.toggleDisabled=function(){return this.options.disabled=!this.options.disabled,this.$element.prop("disabled",this.options.disabled),this.$wrapper.toggleClass(""+this.options.baseClass+"-disabled"),this.$element},t.prototype.readonly=function(t){return"undefined"==typeof t?this.options.readonly:(t=!!t,t===this.options.readonly?this.$element:this.toggleReadonly())},t.prototype.toggleReadonly=function(){return this.options.readonly=!this.options.readonly,this.$element.prop("readonly",this.options.readonly),this.$wrapper.toggleClass(""+this.options.baseClass+"-readonly"),this.$element},t.prototype.indeterminate=function(t){return"undefined"==typeof t?this.options.indeterminate:(t=!!t,t===this.options.indeterminate?this.$element:this.toggleIndeterminate())},t.prototype.toggleIndeterminate=function(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop("indeterminate",this.options.indeterminate),this.$wrapper.toggleClass(""+this.options.baseClass+"-indeterminate"),this._containerPosition(),this.$element},t.prototype.inverse=function(t){return"undefined"==typeof t?this.options.inverse:(t=!!t,t===this.options.inverse?this.$element:this.toggleInverse())},t.prototype.toggleInverse=function(){var t,e;return this.$wrapper.toggleClass(""+this.options.baseClass+"-inverse"),e=this.$on.clone(!0),t=this.$off.clone(!0),this.$on.replaceWith(t),this.$off.replaceWith(e),this.$on=t,this.$off=e,this.options.inverse=!this.options.inverse,this.$element},t.prototype.onColor=function(t){var e;return e=this.options.onColor,"undefined"==typeof t?e:(null!=e&&this.$on.removeClass(""+this.options.baseClass+"-"+e),this.$on.addClass(""+this.options.baseClass+"-"+t),this.options.onColor=t,this.$element)},t.prototype.offColor=function(t){var e;return e=this.options.offColor,"undefined"==typeof t?e:(null!=e&&this.$off.removeClass(""+this.options.baseClass+"-"+e),this.$off.addClass(""+this.options.baseClass+"-"+t),this.options.offColor=t,this.$element)},t.prototype.onText=function(t){return"undefined"==typeof t?this.options.onText:(this.$on.html(t),this._width(),this._containerPosition(),this.options.onText=t,this.$element)},t.prototype.offText=function(t){return"undefined"==typeof t?this.options.offText:(this.$off.html(t),this._width(),this._containerPosition(),this.options.offText=t,this.$element)},t.prototype.labelText=function(t){return"undefined"==typeof t?this.options.labelText:(this.$label.html(t),this._width(),this.options.labelText=t,this.$element)},t.prototype.handleWidth=function(t){return"undefined"==typeof t?this.options.handleWidth:(this.options.handleWidth=t,this._width(),this._containerPosition(),this.$element)},t.prototype.labelWidth=function(t){return"undefined"==typeof t?this.options.labelWidth:(this.options.labelWidth=t,this._width(),this._containerPosition(),this.$element)},t.prototype.baseClass=function(){return this.options.baseClass},t.prototype.wrapperClass=function(t){return"undefined"==typeof t?this.options.wrapperClass:(t||(t=e.fn.bootstrapSwitch.defaults.wrapperClass),this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" ")),this.$wrapper.addClass(this._getClasses(t).join(" ")),this.options.wrapperClass=t,this.$element)},t.prototype.radioAllOff=function(t){return"undefined"==typeof t?this.options.radioAllOff:(t=!!t,t===this.options.radioAllOff?this.$element:(this.options.radioAllOff=t,this.$element))},t.prototype.onInit=function(t){return"undefined"==typeof t?this.options.onInit:(t||(t=e.fn.bootstrapSwitch.defaults.onInit),this.options.onInit=t,this.$element)},t.prototype.onSwitchChange=function(t){return"undefined"==typeof t?this.options.onSwitchChange:(t||(t=e.fn.bootstrapSwitch.defaults.onSwitchChange),this.options.onSwitchChange=t,this.$element)},t.prototype.destroy=function(){var t;return t=this.$element.closest("form"),t.length&&t.off("reset.bootstrapSwitch").removeData("bootstrap-switch"),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch"),this.$element},t.prototype._width=function(){var t,e;return t=this.$on.add(this.$off),t.add(this.$label).css("width",""),e="auto"===this.options.handleWidth?Math.max(this.$on.width(),this.$off.width()):this.options.handleWidth,t.width(e),this.$label.width(function(t){return function(i,n){return"auto"!==t.options.labelWidth?t.options.labelWidth:e>n?e:n}}(this)),this._handleWidth=this.$on.outerWidth(),this._labelWidth=this.$label.outerWidth(),this.$container.width(2*this._handleWidth+this._labelWidth),this.$wrapper.width(this._handleWidth+this._labelWidth)},t.prototype._containerPosition=function(t,e){return null==t&&(t=this.options.state),this.$container.css("margin-left",function(e){return function(){var i;return i=[0,"-"+e._handleWidth+"px"],e.options.indeterminate?"-"+e._handleWidth/2+"px":t?e.options.inverse?i[1]:i[0]:e.options.inverse?i[0]:i[1]}}(this)),e?setTimeout(function(){return e()},50):void 0},t.prototype._init=function(){var t,e;return t=function(t){return function(){return t._width(),t._containerPosition(null,function(){return t.options.animate?t.$wrapper.addClass(""+t.options.baseClass+"-animate"):void 0})}}(this),this.$wrapper.is(":visible")?t():e=i.setInterval(function(n){return function(){return n.$wrapper.is(":visible")?(t(),i.clearInterval(e)):void 0}}(this),50)},t.prototype._elementHandlers=function(){return this.$element.on({"change.bootstrapSwitch":function(t){return function(i,n){var o;return i.preventDefault(),i.stopImmediatePropagation(),o=t.$element.is(":checked"),t._containerPosition(o),o!==t.options.state?(t.options.state=o,t.$wrapper.toggleClass(""+t.options.baseClass+"-off").toggleClass(""+t.options.baseClass+"-on"),n?void 0:(t.$element.is(":radio")&&e("[name='"+t.$element.attr("name")+"']").not(t.$element).prop("checked",!1).trigger("change.bootstrapSwitch",!0),t.$element.trigger("switchChange.bootstrapSwitch",[o]))):void 0}}(this),"focus.bootstrapSwitch":function(t){return function(e){return e.preventDefault(),t.$wrapper.addClass(""+t.options.baseClass+"-focused")}}(this),"blur.bootstrapSwitch":function(t){return function(e){return e.preventDefault(),t.$wrapper.removeClass(""+t.options.baseClass+"-focused")}}(this),"keydown.bootstrapSwitch":function(t){return function(e){if(e.which&&!t.options.disabled&&!t.options.readonly)switch(e.which){case 37:return e.preventDefault(),e.stopImmediatePropagation(),t.state(!1);case 39:return e.preventDefault(),e.stopImmediatePropagation(),t.state(!0)}}}(this)})},t.prototype._handleHandlers=function(){return this.$on.on("click.bootstrapSwitch",function(t){return function(e){return e.preventDefault(),e.stopPropagation(),t.state(!1),t.$element.trigger("focus.bootstrapSwitch")}}(this)),this.$off.on("click.bootstrapSwitch",function(t){return function(e){return e.preventDefault(),e.stopPropagation(),t.state(!0),t.$element.trigger("focus.bootstrapSwitch")}}(this))},t.prototype._labelHandlers=function(){return this.$label.on({"mousedown.bootstrapSwitch touchstart.bootstrapSwitch":function(t){return function(e){return t._dragStart||t.options.disabled||t.options.readonly?void 0:(e.preventDefault(),e.stopPropagation(),t._dragStart=(e.pageX||e.originalEvent.touches[0].pageX)-parseInt(t.$container.css("margin-left"),10),t.options.animate&&t.$wrapper.removeClass(""+t.options.baseClass+"-animate"),t.$element.trigger("focus.bootstrapSwitch"))}}(this),"mousemove.bootstrapSwitch touchmove.bootstrapSwitch":function(t){return function(e){var i;if(null!=t._dragStart&&(e.preventDefault(),i=(e.pageX||e.originalEvent.touches[0].pageX)-t._dragStart,!(i<-t._handleWidth||i>0)))return t._dragEnd=i,t.$container.css("margin-left",""+t._dragEnd+"px")}}(this),"mouseup.bootstrapSwitch touchend.bootstrapSwitch":function(t){return function(e){var i;if(t._dragStart)return e.preventDefault(),t.options.animate&&t.$wrapper.addClass(""+t.options.baseClass+"-animate"),t._dragEnd?(i=t._dragEnd>-(t._handleWidth/2),t._dragEnd=!1,t.state(t.options.inverse?!i:i)):t.state(!t.options.state),t._dragStart=!1}}(this),"mouseleave.bootstrapSwitch":function(t){return function(){return t.$label.trigger("mouseup.bootstrapSwitch")}}(this)})},t.prototype._externalLabelHandler=function(){var t;return t=this.$element.closest("label"),t.on("click",function(e){return function(i){return i.preventDefault(),i.stopImmediatePropagation(),i.target===t[0]?e.toggleState():void 0}}(this))},t.prototype._formHandler=function(){var t;return t=this.$element.closest("form"),t.data("bootstrap-switch")?void 0:t.on("reset.bootstrapSwitch",function(){return i.setTimeout(function(){return t.find("input").filter(function(){return e(this).data("bootstrap-switch")}).each(function(){return e(this).bootstrapSwitch("state",this.checked)})},1)}).data("bootstrap-switch",!0)},t.prototype._getClasses=function(t){var i,n,o,s;if(!e.isArray(t))return[""+this.options.baseClass+"-"+t];for(n=[],o=0,s=t.length;s>o;o++)i=t[o],n.push(""+this.options.baseClass+"-"+i);return n},t}(),e.fn.bootstrapSwitch=function(){var i,o,s;return o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],s=this,this.each(function(){var t,a;return t=e(this),a=t.data("bootstrap-switch"),a||t.data("bootstrap-switch",a=new n(this,o)),"string"==typeof o?s=a[o].apply(a,i):void 0}),s},e.fn.bootstrapSwitch.Constructor=n,e.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:"primary",offColor:"default",onText:"ON",offText:"OFF",labelText:"&nbsp;",handleWidth:"auto",labelWidth:"auto",baseClass:"bootstrap-switch",wrapperClass:"wrapper",onInit:function(){},onSwitchChange:function(){}}}(window.jQuery,window)}).call(this);;/* ========================================================================
 * Bootstrap: affix.js v3.3.5
 * http://getbootstrap.com/javascript/#affix
 * ========================================================================
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */
 
 
+function ($) {
    'use strict';
 
    // AFFIX CLASS DEFINITION
    // ======================
 
    var Affix = function (element, options) {
        this.options = $.extend({}, Affix.DEFAULTS, options)
 
        this.$target = $(this.options.target)
            .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
            .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
 
        this.$element     = $(element)
        this.affixed      = null
        this.unpin        = null
        this.pinnedOffset = null
 
        this.checkPosition()
    }
 
    Affix.VERSION  = '3.3.5'
 
    Affix.RESET    = 'affix affix-top affix-bottom'
 
    Affix.DEFAULTS = {
        offset: 0,
        target: window
    }
 
    Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
        var scrollTop    = this.$target.scrollTop()
        var position     = this.$element.offset()
        var targetHeight = this.$target.height()
 
        if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
 
        if (this.affixed == 'bottom') {
            if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
            return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
        }
 
        var initializing   = this.affixed == null
        var colliderTop    = initializing ? scrollTop : position.top
        var colliderHeight = initializing ? targetHeight : height
 
        if (offsetTop != null && scrollTop <= offsetTop) return 'top'
        if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
 
        return false
    }
 
    Affix.prototype.getPinnedOffset = function () {
        if (this.pinnedOffset) return this.pinnedOffset
        this.$element.removeClass(Affix.RESET).addClass('affix')
        var scrollTop = this.$target.scrollTop()
        var position  = this.$element.offset()
        return (this.pinnedOffset = position.top - scrollTop)
    }
 
    Affix.prototype.checkPositionWithEventLoop = function () {
        setTimeout($.proxy(this.checkPosition, this), 1)
    }
 
    Affix.prototype.checkPosition = function () {
        if (!this.$element.is(':visible')) return
 
        var height       = this.$element.height()
        var offset       = this.options.offset
        var offsetTop    = offset.top
        var offsetBottom = offset.bottom
        var scrollHeight = Math.max($(document).height(), $(document.body).height())
 
        if (typeof offset != 'object')         offsetBottom = offsetTop = offset
        if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
        if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
 
        var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
 
        if (this.affixed != affix) {
            if (this.unpin != null) this.$element.css('top', '')
 
            var affixType = 'affix' + (affix ? '-' + affix : '')
            var e         = $.Event(affixType + '.bs.affix')
 
            this.$element.trigger(e)
 
            if (e.isDefaultPrevented()) return
 
            this.affixed = affix
            this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
 
            this.$element
                .removeClass(Affix.RESET)
                .addClass(affixType)
                .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
        }
 
        if (affix == 'bottom') {
            this.$element.offset({
                top: scrollHeight - height - offsetBottom
            })
        }
    }
 
 
    // AFFIX PLUGIN DEFINITION
    // =======================
 
    function Plugin(option) {
        return this.each(function () {
            var $this   = $(this)
            var data    = $this.data('bs.affix')
            var options = typeof option == 'object' && option
 
            if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
            if (typeof option == 'string') data[option]()
        })
    }
 
    var old = $.fn.affix
 
    $.fn.affix             = Plugin
    $.fn.affix.Constructor = Affix
 
 
    // AFFIX NO CONFLICT
    // =================
 
    $.fn.affix.noConflict = function () {
        $.fn.affix = old
        return this
    }
 
 
    // AFFIX DATA-API
    // ==============
 
    $(window).on('load', function () {
        $('[data-spy="affix"]').each(function () {
            var $spy = $(this)
            var data = $spy.data()
 
            data.offset = data.offset || {}
 
            if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
            if (data.offsetTop    != null) data.offset.top    = data.offsetTop
 
            Plugin.call($spy, data)
        })
    })
 
}(jQuery);;/*************************
 * Croppie
 * Copyright 2015
 * Foliotek
 * Version: 1.0.3
 *************************/
(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['exports', 'b'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
        // CommonJS
        factory(exports, require('b'));
    } else {
        // Browser globals
        factory((root.commonJsStrict = {}), root.b);
    }
}(this, function (exports, b) {
 
    if (typeof Promise !== 'function') {
        /*!
         * @overview es6-promise - a tiny implementation of Promises/A+.
         * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
         * @license   Licensed under MIT license
         *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
         * @version   3.0.2
         */
        (function () { "use strict"; function lib$es6$promise$utils$$objectOrFunction(x) { return typeof x === "function" || typeof x === "object" && x !== null } function lib$es6$promise$utils$$isFunction(x) { return typeof x === "function" } function lib$es6$promise$utils$$isMaybeThenable(x) { return typeof x === "object" && x !== null } var lib$es6$promise$utils$$_isArray; if (!Array.isArray) { lib$es6$promise$utils$$_isArray = function (x) { return Object.prototype.toString.call(x) === "[object Array]" } } else { lib$es6$promise$utils$$_isArray = Array.isArray } var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; var lib$es6$promise$asap$$len = 0; var lib$es6$promise$asap$$toString = {}.toString; var lib$es6$promise$asap$$vertxNext; var lib$es6$promise$asap$$customSchedulerFn; var lib$es6$promise$asap$$asap = function asap(callback, arg) { lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; lib$es6$promise$asap$$len += 2; if (lib$es6$promise$asap$$len === 2) { if (lib$es6$promise$asap$$customSchedulerFn) { lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush) } else { lib$es6$promise$asap$$scheduleFlush() } } }; function lib$es6$promise$asap$$setScheduler(scheduleFn) { lib$es6$promise$asap$$customSchedulerFn = scheduleFn } function lib$es6$promise$asap$$setAsap(asapFn) { lib$es6$promise$asap$$asap = asapFn } var lib$es6$promise$asap$$browserWindow = typeof window !== "undefined" ? window : undefined; var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; var lib$es6$promise$asap$$isNode = typeof process !== "undefined" && {}.toString.call(process) === "[object process]"; var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined"; function lib$es6$promise$asap$$useNextTick() { return function () { process.nextTick(lib$es6$promise$asap$$flush) } } function lib$es6$promise$asap$$useVertxTimer() { return function () { lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush) } } function lib$es6$promise$asap$$useMutationObserver() { var iterations = 0; var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); var node = document.createTextNode(""); observer.observe(node, { characterData: true }); return function () { node.data = iterations = ++iterations % 2 } } function lib$es6$promise$asap$$useMessageChannel() { var channel = new MessageChannel; channel.port1.onmessage = lib$es6$promise$asap$$flush; return function () { channel.port2.postMessage(0) } } function lib$es6$promise$asap$$useSetTimeout() { return function () { setTimeout(lib$es6$promise$asap$$flush, 1) } } var lib$es6$promise$asap$$queue = new Array(1e3); function lib$es6$promise$asap$$flush() { for (var i = 0; i < lib$es6$promise$asap$$len; i += 2) { var callback = lib$es6$promise$asap$$queue[i]; var arg = lib$es6$promise$asap$$queue[i + 1]; callback(arg); lib$es6$promise$asap$$queue[i] = undefined; lib$es6$promise$asap$$queue[i + 1] = undefined } lib$es6$promise$asap$$len = 0 } function lib$es6$promise$asap$$attemptVertx() { try { var r = require; var vertx = r("vertx"); lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; return lib$es6$promise$asap$$useVertxTimer() } catch (e) { return lib$es6$promise$asap$$useSetTimeout() } } var lib$es6$promise$asap$$scheduleFlush; if (lib$es6$promise$asap$$isNode) { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick() } else if (lib$es6$promise$asap$$BrowserMutationObserver) { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver() } else if (lib$es6$promise$asap$$isWorker) { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel() } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === "function") { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx() } else { lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout() } function lib$es6$promise$$internal$$noop() { } var lib$es6$promise$$internal$$PENDING = void 0; var lib$es6$promise$$internal$$FULFILLED = 1; var lib$es6$promise$$internal$$REJECTED = 2; var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject; function lib$es6$promise$$internal$$selfFulfillment() { return new TypeError("You cannot resolve a promise with itself") } function lib$es6$promise$$internal$$cannotReturnOwn() { return new TypeError("A promises callback cannot return that same promise.") } function lib$es6$promise$$internal$$getThen(promise) { try { return promise.then } catch (error) { lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; return lib$es6$promise$$internal$$GET_THEN_ERROR } } function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { try { then.call(value, fulfillmentHandler, rejectionHandler) } catch (e) { return e } } function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { lib$es6$promise$asap$$asap(function (promise) { var sealed = false; var error = lib$es6$promise$$internal$$tryThen(then, thenable, function (value) { if (sealed) { return } sealed = true; if (thenable !== value) { lib$es6$promise$$internal$$resolve(promise, value) } else { lib$es6$promise$$internal$$fulfill(promise, value) } }, function (reason) { if (sealed) { return } sealed = true; lib$es6$promise$$internal$$reject(promise, reason) }, "Settle: " + (promise._label || " unknown promise")); if (!sealed && error) { sealed = true; lib$es6$promise$$internal$$reject(promise, error) } }, promise) } function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { lib$es6$promise$$internal$$fulfill(promise, thenable._result) } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { lib$es6$promise$$internal$$reject(promise, thenable._result) } else { lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) { lib$es6$promise$$internal$$resolve(promise, value) }, function (reason) { lib$es6$promise$$internal$$reject(promise, reason) }) } } function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { if (maybeThenable.constructor === promise.constructor) { lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable) } else { var then = lib$es6$promise$$internal$$getThen(maybeThenable); if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error) } else if (then === undefined) { lib$es6$promise$$internal$$fulfill(promise, maybeThenable) } else if (lib$es6$promise$utils$$isFunction(then)) { lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then) } else { lib$es6$promise$$internal$$fulfill(promise, maybeThenable) } } } function lib$es6$promise$$internal$$resolve(promise, value) { if (promise === value) { lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment()) } else if (lib$es6$promise$utils$$objectOrFunction(value)) { lib$es6$promise$$internal$$handleMaybeThenable(promise, value) } else { lib$es6$promise$$internal$$fulfill(promise, value) } } function lib$es6$promise$$internal$$publishRejection(promise) { if (promise._onerror) { promise._onerror(promise._result) } lib$es6$promise$$internal$$publish(promise) } function lib$es6$promise$$internal$$fulfill(promise, value) { if (promise._state !== lib$es6$promise$$internal$$PENDING) { return } promise._result = value; promise._state = lib$es6$promise$$internal$$FULFILLED; if (promise._subscribers.length !== 0) { lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise) } } function lib$es6$promise$$internal$$reject(promise, reason) { if (promise._state !== lib$es6$promise$$internal$$PENDING) { return } promise._state = lib$es6$promise$$internal$$REJECTED; promise._result = reason; lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise) } function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { var subscribers = parent._subscribers; var length = subscribers.length; parent._onerror = null; subscribers[length] = child; subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; if (length === 0 && parent._state) { lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent) } } function lib$es6$promise$$internal$$publish(promise) { var subscribers = promise._subscribers; var settled = promise._state; if (subscribers.length === 0) { return } var child, callback, detail = promise._result; for (var i = 0; i < subscribers.length; i += 3) { child = subscribers[i]; callback = subscribers[i + settled]; if (child) { lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail) } else { callback(detail) } } promise._subscribers.length = 0 } function lib$es6$promise$$internal$$ErrorObject() { this.error = null } var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject; function lib$es6$promise$$internal$$tryCatch(callback, detail) { try { return callback(detail) } catch (e) { lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; return lib$es6$promise$$internal$$TRY_CATCH_ERROR } } function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { var hasCallback = lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed; if (hasCallback) { value = lib$es6$promise$$internal$$tryCatch(callback, detail); if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { failed = true; error = value.error; value = null } else { succeeded = true } if (promise === value) { lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); return } } else { value = detail; succeeded = true } if (promise._state !== lib$es6$promise$$internal$$PENDING) { } else if (hasCallback && succeeded) { lib$es6$promise$$internal$$resolve(promise, value) } else if (failed) { lib$es6$promise$$internal$$reject(promise, error) } else if (settled === lib$es6$promise$$internal$$FULFILLED) { lib$es6$promise$$internal$$fulfill(promise, value) } else if (settled === lib$es6$promise$$internal$$REJECTED) { lib$es6$promise$$internal$$reject(promise, value) } } function lib$es6$promise$$internal$$initializePromise(promise, resolver) { try { resolver(function resolvePromise(value) { lib$es6$promise$$internal$$resolve(promise, value) }, function rejectPromise(reason) { lib$es6$promise$$internal$$reject(promise, reason) }) } catch (e) { lib$es6$promise$$internal$$reject(promise, e) } } function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { var enumerator = this; enumerator._instanceConstructor = Constructor; enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); if (enumerator._validateInput(input)) { enumerator._input = input; enumerator.length = input.length; enumerator._remaining = input.length; enumerator._init(); if (enumerator.length === 0) { lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result) } else { enumerator.length = enumerator.length || 0; enumerator._enumerate(); if (enumerator._remaining === 0) { lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result) } } } else { lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()) } } lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function (input) { return lib$es6$promise$utils$$isArray(input) }; lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function () { return new Error("Array Methods must be provided an Array") }; lib$es6$promise$enumerator$$Enumerator.prototype._init = function () { this._result = new Array(this.length) }; var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function () { var enumerator = this; var length = enumerator.length; var promise = enumerator.promise; var input = enumerator._input; for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { enumerator._eachEntry(input[i], i) } }; lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function (entry, i) { var enumerator = this; var c = enumerator._instanceConstructor; if (lib$es6$promise$utils$$isMaybeThenable(entry)) { if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { entry._onerror = null; enumerator._settledAt(entry._state, i, entry._result) } else { enumerator._willSettleAt(c.resolve(entry), i) } } else { enumerator._remaining--; enumerator._result[i] = entry } }; lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function (state, i, value) { var enumerator = this; var promise = enumerator.promise; if (promise._state === lib$es6$promise$$internal$$PENDING) { enumerator._remaining--; if (state === lib$es6$promise$$internal$$REJECTED) { lib$es6$promise$$internal$$reject(promise, value) } else { enumerator._result[i] = value } } if (enumerator._remaining === 0) { lib$es6$promise$$internal$$fulfill(promise, enumerator._result) } }; lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function (promise, i) { var enumerator = this; lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) { enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value) }, function (reason) { enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason) }) }; function lib$es6$promise$promise$all$$all(entries) { return new lib$es6$promise$enumerator$$default(this, entries).promise } var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; function lib$es6$promise$promise$race$$race(entries) { var Constructor = this; var promise = new Constructor(lib$es6$promise$$internal$$noop); if (!lib$es6$promise$utils$$isArray(entries)) { lib$es6$promise$$internal$$reject(promise, new TypeError("You must pass an array to race.")); return promise } var length = entries.length; function onFulfillment(value) { lib$es6$promise$$internal$$resolve(promise, value) } function onRejection(reason) { lib$es6$promise$$internal$$reject(promise, reason) } for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection) } return promise } var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; function lib$es6$promise$promise$resolve$$resolve(object) { var Constructor = this; if (object && typeof object === "object" && object.constructor === Constructor) { return object } var promise = new Constructor(lib$es6$promise$$internal$$noop); lib$es6$promise$$internal$$resolve(promise, object); return promise } var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; function lib$es6$promise$promise$reject$$reject(reason) { var Constructor = this; var promise = new Constructor(lib$es6$promise$$internal$$noop); lib$es6$promise$$internal$$reject(promise, reason); return promise } var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; var lib$es6$promise$promise$$counter = 0; function lib$es6$promise$promise$$needsResolver() { throw new TypeError("You must pass a resolver function as the first argument to the promise constructor") } function lib$es6$promise$promise$$needsNew() { throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.") } var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; function lib$es6$promise$promise$$Promise(resolver) { this._id = lib$es6$promise$promise$$counter++; this._state = undefined; this._result = undefined; this._subscribers = []; if (lib$es6$promise$$internal$$noop !== resolver) { if (!lib$es6$promise$utils$$isFunction(resolver)) { lib$es6$promise$promise$$needsResolver() } if (!(this instanceof lib$es6$promise$promise$$Promise)) { lib$es6$promise$promise$$needsNew() } lib$es6$promise$$internal$$initializePromise(this, resolver) } } lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; lib$es6$promise$promise$$Promise.prototype = { constructor: lib$es6$promise$promise$$Promise, then: function (onFulfillment, onRejection) { var parent = this; var state = parent._state; if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { return this } var child = new this.constructor(lib$es6$promise$$internal$$noop); var result = parent._result; if (state) { var callback = arguments[state - 1]; lib$es6$promise$asap$$asap(function () { lib$es6$promise$$internal$$invokeCallback(state, child, callback, result) }) } else { lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) } return child }, "catch": function (onRejection) { return this.then(null, onRejection) } }; function lib$es6$promise$polyfill$$polyfill() { var local; if (typeof global !== "undefined") { local = global } else if (typeof self !== "undefined") { local = self } else { try { local = Function("return this")() } catch (e) { throw new Error("polyfill failed because global object is unavailable in this environment") } } var P = local.Promise; if (P && Object.prototype.toString.call(P.resolve()) === "[object Promise]" && !P.cast) { return } local.Promise = lib$es6$promise$promise$$default } var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; var lib$es6$promise$umd$$ES6Promise = { Promise: lib$es6$promise$promise$$default, polyfill: lib$es6$promise$polyfill$$default }; if (typeof define === "function" && define["amd"]) { define(function () { return lib$es6$promise$umd$$ES6Promise }) } else if (typeof module !== "undefined" && module["exports"]) { module["exports"] = lib$es6$promise$umd$$ES6Promise } else if (typeof this !== "undefined") { this["ES6Promise"] = lib$es6$promise$umd$$ES6Promise } lib$es6$promise$polyfill$$default() }).call(this);
    }
 
    var cssPrefixes = ['Webkit', 'Moz', 'ms'],
        emptyStyles = document.createElement('div').style,
        CSS_TRANS_ORG,
        CSS_TRANSFORM,
        CSS_USERSELECT;
 
    function vendorPrefix(prop) {
        if (prop in emptyStyles) {
            return prop;
        }
 
        var capProp = prop[0].toUpperCase() + prop.slice(1),
            i = cssPrefixes.length;
 
        while (i--) {
            prop = cssPrefixes[i] + capProp;
            if (prop in emptyStyles) {
                return prop;
            }
        }
    }
 
    CSS_TRANSFORM = vendorPrefix('transform');
    CSS_TRANS_ORG = vendorPrefix('transformOrigin');
    CSS_USERSELECT = vendorPrefix('userSelect');
 
 
    function deepExtend(out) {
        out = out || {};
 
        for (var i = 1; i < arguments.length; i++) {
            var obj = arguments[i];
 
            if (!obj)
                continue;
 
            for (var key in obj) {
                if (obj.hasOwnProperty(key)) {
                    if (typeof obj[key] === 'object')
                        out[key] = deepExtend({}, obj[key]);
                    else
                        out[key] = obj[key];
                }
            }
        }
        return out;
    }
 
    function debounce(func, wait, immediate) {
        var timeout;
        return function () {
            var context = this, args = arguments;
            var later = function () {
                timeout = null;
                if (!immediate) func.apply(context, args);
            };
            var callNow = immediate && !timeout;
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
            if (callNow) func.apply(context, args);
        };
    }
 
    function dispatchChange(element) {
        if ("createEvent" in document) {
            var evt = document.createEvent("HTMLEvents");
            evt.initEvent("change", false, true);
            element.dispatchEvent(evt);
        }
        else {
            element.fireEvent("onchange");
        }
    }
 
    //http://jsperf.com/vanilla-css
    function css(el, styles, val) {
        if (typeof (styles) === 'string') {
            var tmp = styles;
            styles = {};
            styles[tmp] = val;
        }
 
        for (var prop in styles) {
            el.style[prop] = styles[prop];
        }
    }
 
    /* Image Drawing Functions */
    function getHtmlImage(data) {
        var points = data.points,
            div = document.createElement('div'),
            img = document.createElement('img'),
            width = points[2] - points[0],
            height = points[3] - points[1];
        // scale = data.zoom;
 
        div.classList.add('croppie-result');
        div.appendChild(img);
        css(img, {
            left: (-1 * points[0]) + 'px',
            top: (-1 * points[1]) + 'px'
            // transform: 'scale(' + scale + ')'
        })
        img.src = data.url;
        css(div, {
            width: width + 'px',
            height: height + 'px'
        });
 
        return div;
    }
 
    function getCanvasImage(img, data) {
        var points = data.points,
            left = points[0],
            top = points[1],
            width = (points[2] - points[0]),
            height = (points[3] - points[1]),
            circle = data.circle,
            canvas = document.createElement('canvas'),
            ctx = canvas.getContext('2d'),
            outWidth = width,
            outHeight = height;
 
        if (data.outputWidth && data.outputHeight) {
            outWidth = data.outputWidth;
            outHeight = data.outputHeight;
        }
 
        canvas.width = outWidth;
        canvas.height = outHeight;
 
        if (circle) {
            ctx.save();
            ctx.beginPath();
            ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true);
            ctx.closePath();
            ctx.clip();
        }
 
        ctx.drawImage(img, left, top, width, height, 0, 0, outWidth, outHeight);
 
        return canvas.toDataURL();
    }
 
    /* Utilities */
    function loadImage(src, imageEl) {
        var img = imageEl || new Image(),
            prom;
 
        prom = new Promise(function (resolve, reject) {
            if (src.substring(0,4).toLowerCase() === 'http') {
                img.setAttribute('crossOrigin', 'anonymous');
            }
            img.onload = function () {
                setTimeout(function () {
                    resolve(img);
                }, 1);
            };
        });
 
        img.src = src;
        return prom;
    }
 
    /* CSS Transform Prototype */
    var _TRANSLATE = 'translate3d',
        _TRANSLATE_SUFFIX = ', 0px';
    var Transform = function (x, y, scale) {
        this.x = parseFloat(x);
        this.y = parseFloat(y);
        this.scale = parseFloat(scale);
    };
 
    Transform.parse = function (v) {
        if (v.style) {
            return Transform.parse(v.style[CSS_TRANSFORM]);
        }
        else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) {
            return Transform.fromMatrix(v);
        }
        else {
            return Transform.fromString(v);
        }
    };
 
    Transform.fromMatrix = function (v) {
        var vals = v.substring(7).split(',');
        if (!vals.length || v === 'none') {
            vals = [1, 0, 0, 1, 0, 0];
        }
 
        return new Transform(parseInt(vals[4], 10), parseInt(vals[5], 10), parseFloat(vals[0]));
    };
 
    Transform.fromString = function (v) {
        var values = v.split(') '),
            translate = values[0].substring(_TRANSLATE.length + 1).split(','),
            scale = values.length > 1 ? values[1].substring(6) : 1,
            x = translate.length > 1 ? translate[0] : 0,
            y = translate.length > 1 ? translate[1] : 0;
 
        return new Transform(x, y, scale);
    }
 
    Transform.prototype.toString = function () {
        return _TRANSLATE + '(' + this.x + 'px, ' + this.y + 'px' + _TRANSLATE_SUFFIX + ') scale(' + this.scale + ')';
    };
 
    var TransformOrigin = function (el) {
        if (!el || !el.style[CSS_TRANS_ORG]) {
            this.x = 0;
            this.y = 0;
            return;
        }
        var css = el.style[CSS_TRANS_ORG].split(' ');
        this.x = parseFloat(css[0]);
        this.y = parseFloat(css[1]);
    };
 
    TransformOrigin.prototype.toString = function () {
        return this.x + 'px ' + this.y + 'px';
    };
 
    /* Private Methods */
    function _create() {
        var self = this,
            contClass = ['croppie-container'],
            customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null,
            boundary, img, viewport, overlay;
 
        // Properties on class
        self.data = {};
        self.elements = {};
 
        // Generating Markup
        boundary = self.elements.boundary = document.createElement('div');
        viewport = self.elements.viewport = document.createElement('div');
        img = self.elements.img = document.createElement('img');
        overlay = self.elements.overlay = document.createElement('div');
 
        boundary.classList.add('cr-boundary');
        css(boundary, {
            width: self.options.boundary.width + 'px',
            height: self.options.boundary.height + 'px'
        });
 
        viewport.classList.add('cr-viewport');
        if (customViewportClass) {
            viewport.classList.add(customViewportClass);
        }
        css(viewport, {
            width: self.options.viewport.width + 'px',
            height: self.options.viewport.height + 'px'
        });
 
        img.classList.add('cr-image');
        overlay.classList.add('cr-overlay');
 
        self.element.appendChild(boundary);
        boundary.appendChild(img);
        boundary.appendChild(viewport);
        boundary.appendChild(overlay);
 
        self.element.classList.add(contClass);
        if (self.options.customClass) {
            self.element.classList.add(self.options.customClass);
        }
 
        // Initialize drag & zoom
        _initDraggable.call(this);
 
        if (self.options.showZoom) {
            _initializeZoom.call(self);
        }
    }
 
    function _setZoomerVal(v) {
        if (this.options.showZoom) {
            this.elements.zoomer.value = fix(v);
        }
    }
 
    function _initializeZoom() {
        var self = this,
            wrap = self.elements.zoomerWrap = document.createElement('div'),
            zoomer = self.elements.zoomer = document.createElement('input'),
            origin,
            viewportRect,
            transform;
 
        wrap.classList.add('cr-slider-wrap');
        zoomer.type = 'range';
        zoomer.classList.add('cr-slider');
        zoomer.step = '0.01';
        zoomer.value = 1;
 
        self.element.appendChild(wrap);
        wrap.appendChild(zoomer);
 
        self._currentZoom = 1;
        function start() {
            _updateCenterPoint.call(self);
            origin = new TransformOrigin(self.elements.img);
            viewportRect = self.elements.viewport.getBoundingClientRect();
            transform = Transform.parse(self.elements.img);
        }
 
        function change() {
            _onZoom.call(self, {
                value: parseFloat(zoomer.value),
                origin: origin || new TransformOrigin(self.elements.img),
                viewportRect: viewportRect || self.elements.viewport.getBoundingClientRect(),
                transform: transform || Transform.parse(self.elements.img)
            });
        }
 
        function scroll(ev) {
            var delta, targetZoom;
        
            if (ev.wheelDelta) {
                delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2
            } else if (ev.deltaY) {
                delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2
            } else if (ev.detail) {
                delta = ev.detail / 60; //delta min: -3 max: 3 // max x 10 x 2
            } else {
                delta = 0;
            }
        
            targetZoom = self._currentZoom + delta;
        
            ev.preventDefault();
            start();
            _setZoomerVal.call(self, targetZoom);
            change();
        }
 
        self.elements.zoomer.addEventListener('mousedown', start);
        self.elements.zoomer.addEventListener('touchstart', start);
 
        self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress
        self.elements.zoomer.addEventListener('change', change);
 
        if (self.options.mouseWheelZoom) {
            self.elements.boundary.addEventListener('mousewheel', scroll);
            self.elements.boundary.addEventListener('DOMMouseScroll', scroll);
        }
    }
 
    function _onZoom(ui) {
        var self = this,
            transform = ui.transform,
            vpRect = ui.viewportRect,
            origin = ui.origin;
 
        self._currentZoom = ui.value;
        transform.scale = self._currentZoom;
 
        var boundaries = _getVirtualBoundaries.call(self, vpRect),
            transBoundaries = boundaries.translate,
            oBoundaries = boundaries.origin;
 
        if (transform.x >= transBoundaries.maxX) {
            origin.x = oBoundaries.minX;
            transform.x = transBoundaries.maxX;
        }
 
        if (transform.x <= transBoundaries.minX) {
            origin.x = oBoundaries.maxX;
            transform.x = transBoundaries.minX;
        }
 
        if (transform.y >= transBoundaries.maxY) {
            origin.y = oBoundaries.minY;
            transform.y = transBoundaries.maxY;
        }
 
        if (transform.y <= transBoundaries.minY) {
            origin.y = oBoundaries.maxY;
            transform.y = transBoundaries.minY;
        }
 
        var transCss = {};
        transCss[CSS_TRANSFORM] = transform.toString();
        transCss[CSS_TRANS_ORG] = origin.toString();
        css(self.elements.img, transCss);
 
        _debouncedOverlay.call(self);
        _triggerUpdate.call(self);
    }
 
    function _getVirtualBoundaries(viewport) {
        var self = this,
            scale = self._currentZoom,
            vpWidth = viewport.width,
            vpHeight = viewport.height,
            centerFromBoundaryX = self.options.boundary.width / 2,
            centerFromBoundaryY = self.options.boundary.height / 2,
            originalImgWidth = self._originalImageWidth,
            originalImgHeight = self._originalImageHeight,
            curImgWidth = originalImgWidth * scale,
            curImgHeight = originalImgHeight * scale,
            halfWidth = vpWidth / 2,
            halfHeight = vpHeight / 2;
 
 
        var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1;
        var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale)));
 
        var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1;
        var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale)));
 
        var originMinX = (1 / scale) * halfWidth;
        var originMaxX = (curImgWidth * (1 / scale)) - originMinX;
 
        var originMinY = (1 / scale) * halfHeight;
        var originMaxY = (curImgHeight * (1 / scale)) - originMinY;
 
        return {
            translate: {
                maxX: maxX,
                minX: minX,
                maxY: maxY,
                minY: minY
            },
            origin: {
                maxX: originMaxX,
                minX: originMinX,
                maxY: originMaxY,
                minY: originMinY
            }
        };
    }
 
    function _updateCenterPoint() {
        var self = this,
            scale = self._currentZoom,
            data = self.elements.img.getBoundingClientRect(),
            vpData = self.elements.viewport.getBoundingClientRect(),
            transform = Transform.parse(self.elements.img.style[CSS_TRANSFORM]),
            pc = new TransformOrigin(self.elements.img),
            top = (vpData.top - data.top) + (vpData.height / 2),
            left = (vpData.left - data.left) + (vpData.width / 2),
            center = {},
            adj = {};
 
        center.y = top / scale;
        center.x = left / scale;
 
        adj.y = (center.y - pc.y) * (1 - scale);
        adj.x = (center.x - pc.x) * (1 - scale);
 
        transform.x -= adj.x;
        transform.y -= adj.y;
 
        var newCss = {};
        newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px';
        newCss[CSS_TRANSFORM] = transform.toString();
        css(self.elements.img, newCss);
    }
 
    function _initDraggable() {
        var self = this,
            isDragging = false,
            originalX,
            originalY,
            originalDistance,
            vpRect;
 
        function mouseDown(ev) {
            ev.preventDefault();
            if (isDragging) return;
            isDragging = true;
            originalX = ev.pageX;
            originalY = ev.pageY;
            transform = Transform.parse(self.elements.img);
            window.addEventListener('mousemove', mouseMove);
            window.addEventListener('touchmove', mouseMove);
            window.addEventListener('mouseup', mouseUp);
            window.addEventListener('touchend', mouseUp);
            document.body.style[CSS_USERSELECT] = 'none';
            vpRect = self.elements.viewport.getBoundingClientRect();
        }
 
        function mouseMove(ev) {
            ev.preventDefault();
            var pageX = ev.pageX || ev.touches[0].pageX,
                pageY = ev.pageY || ev.touches[0].pageY,
                deltaX = pageX - originalX,
                deltaY = pageY - originalY,
                imgRect = self.elements.img.getBoundingClientRect(),
                top = transform.y + deltaY,
                left = transform.x + deltaX,
                newCss = {};
 
            if (ev.type == 'touchmove') {
                if (ev.touches.length > 1) {
                    var touch1 = ev.touches[0];
                    var touch2 = ev.touches[1];
                    var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY));
 
                    if (!originalDistance) {
                        originalDistance = dist / self._currentZoom;
                    }
 
                    var scale = dist / originalDistance;
 
                    _setZoomerVal.call(self, scale);
                    dispatchChange(self.elements.zoomer);
                    return;
                }
            }
 
            if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) {
                transform.y = top;
            }
 
            if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) {
                transform.x = left;
            }
 
            newCss[CSS_TRANSFORM] = transform.toString();
            css(self.elements.img, newCss);
            _updateOverlay.call(self);
            originalY = pageY;
            originalX = pageX;
        }
 
        function mouseUp() {
            isDragging = false;
            window.removeEventListener('mousemove', mouseMove);
            window.removeEventListener('touchmove', mouseMove);
            window.removeEventListener('mouseup', mouseUp);
            window.removeEventListener('touchend', mouseUp);
            document.body.style[CSS_USERSELECT] = '';
            _updateCenterPoint.call(self);
            _triggerUpdate.call(self);
            originalDistance = 0;
        }
 
        self.elements.overlay.addEventListener('mousedown', mouseDown);
        self.elements.overlay.addEventListener('touchstart', mouseDown);
    }
 
    function _updateOverlay() {
        var self = this,
            boundRect = self.elements.boundary.getBoundingClientRect(),
            imgData = self.elements.img.getBoundingClientRect();
 
        css(self.elements.overlay, {
            width: imgData.width + 'px',
            height: imgData.height + 'px',
            top: (imgData.top - boundRect.top) + 'px',
            left: (imgData.left - boundRect.left) + 'px'
        });
    }
    var _debouncedOverlay = debounce(_updateOverlay, 500);
 
    function _triggerUpdate() {
        var self = this;
        if (_isVisible.call(self)) {
            self.options.update.call(self, self.get());
        }
    }
 
    function _isVisible() {
        return this.elements.img.offsetHeight > 0 && this.elements.img.offsetWidth > 0;
    }
 
    function _updatePropertiesFromImage() {
        var self = this,
            minZoom = 0,
            maxZoom = 1.5,
            initialZoom = 1,
            cssReset = {},
            img = self.elements.img,
            zoomer = self.elements.zoomer,
            transformReset = new Transform(0, 0, initialZoom),
            originReset = new TransformOrigin(),
            isVisible = _isVisible.call(self),
            imgData,
            vpData,
            boundaryData,
            minW,
            minH;
 
        if (!isVisible || self.data.bound) {
            // if the croppie isn't visible or it doesn't need binding
            return;
        }
 
        self.data.bound = true;
        cssReset[CSS_TRANSFORM] = transformReset.toString();
        cssReset[CSS_TRANS_ORG] = originReset.toString();
        css(img, cssReset);
 
        imgData = img.getBoundingClientRect();
        vpData = self.elements.viewport.getBoundingClientRect();
        boundaryData = self.elements.boundary.getBoundingClientRect();
        self._originalImageWidth = imgData.width;
        self._originalImageHeight = imgData.height;
 
        if (self.options.showZoom) {
            minW = vpData.width / imgData.width;
            minH = vpData.height / imgData.height;
            minZoom = Math.max(minW, minH);
 
            if (minZoom >= maxZoom) {
                maxZoom = minZoom + 1;
            }
 
            zoomer.min = fix(minZoom)
            zoomer.max = fix(maxZoom);
            initialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));
            _setZoomerVal.call(self, initialZoom);
            dispatchChange(zoomer);
        }
 
        self._currentZoom = transformReset.scale = initialZoom;
        cssReset[CSS_TRANSFORM] = transformReset.toString();
        css(img, cssReset);
 
        if (self.data.points.length) {
            _bindPoints.call(self, self.data.points);
        }
        else {
            _centerImage.call(self);
        }
 
        
        _updateOverlay.call(self);
    }
 
    function _bindPoints(points) {
        if (points.length != 4) {
            throw "Croppie - Invalid number of points supplied: " + points;
        }
        var self = this,
            pointsWidth = points[2] - points[0],
            // pointsHeight = points[3] - points[1],
            vpData = self.elements.viewport.getBoundingClientRect(),
            boundRect = self.elements.boundary.getBoundingClientRect(),
            vpOffset = {
                left: vpData.left - boundRect.left,
                top: vpData.top - boundRect.top
            },
            scale = vpData.width / pointsWidth,
            originTop = points[1],
            originLeft = points[0],
            transformTop = (-1 * points[1]) + vpOffset.top,
            transformLeft = (-1 * points[0]) + vpOffset.left,
            newCss = {};
 
        newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px';
        newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString();
        css(self.elements.img, newCss);
 
        _setZoomerVal.call(self, scale);
        self._currentZoom = scale;
    }
 
    function _centerImage() {
        var self = this,
            imgDim = self.elements.img.getBoundingClientRect(),
            vpDim = self.elements.viewport.getBoundingClientRect(),
            boundDim = self.elements.boundary.getBoundingClientRect(),
            vpLeft = vpDim.left - boundDim.left,
            vpTop = vpDim.top - boundDim.top,
            w = vpLeft - ((imgDim.width - vpDim.width) / 2),
            h = vpTop - ((imgDim.height - vpDim.height) / 2),
            transform = new Transform(w, h, self._currentZoom);
 
        css(self.elements.img, CSS_TRANSFORM, transform.toString());
    }
 
    function _bind(options, cb) {
        var self = this,
            url,
            points = [];
 
        if (typeof (options) === 'string') {
            url = options;
            options = {};
        }
        else if (Array.isArray(options)) {
            points = options.slice();
        }
        else if (typeof (options) == 'undefined' && self.data.url) { //refreshing
            _updatePropertiesFromImage.call(self);
            _triggerUpdate.call(self);
            return null;
        }
        else {
            url = options.url;
            points = options.points || [];
        }
 
        self.data.bound = false;
        self.data.url = url || self.data.url;
        self.data.points = (points || self.data.points).map(function (p) {
            return parseFloat(p);
        });
        var prom = loadImage(url, self.elements.img);
        prom.then(function () {
            _updatePropertiesFromImage.call(self);
            _triggerUpdate.call(self);
            if (cb) {
                cb();
            }
        });
        return prom;
    }
 
    function fix(v) {
        return parseFloat(v).toFixed(2);
    }
 
    function _get() {
        var self = this,
            imgData = self.elements.img.getBoundingClientRect(),
            vpData = self.elements.viewport.getBoundingClientRect(),
            x1 = vpData.left - imgData.left,
            y1 = vpData.top - imgData.top,
            x2 = x1 + vpData.width,
            y2 = y1 + vpData.height,
            scale = self._currentZoom;
 
        if (scale === Infinity || isNaN(scale)) {
            scale = 1;
        }
 
        x1 = Math.max(0, x1 / scale);
        y1 = Math.max(0, y1 / scale);
        x2 = Math.max(0, x2 / scale);
        y2 = Math.max(0, y2 / scale);
       
        return {
            points: [fix(x1), fix(y1), fix(x2), fix(y2)],
            zoom: scale
        };
    }
 
    function _result(options) {
        var self = this,
            data = _get.call(self),
            opts = options || { type: 'canvas', size: 'viewport' },
            type = (typeof (opts) === 'string' ? opts : opts.type),
            size = opts.size || 'viewport',
            vpRect,
            prom;
 
        if (size === 'viewport') {
            vpRect = self.elements.viewport.getBoundingClientRect();
            data.outputWidth = vpRect.width;
            data.outputHeight = vpRect.height;
        }
 
        data.circle = self.options.viewport.type === 'circle';
        data.url = self.data.url;
 
        prom = new Promise(function (resolve, reject) {
            if (type === 'canvas') {
                loadImage(data.url).then(function (img) {
                    resolve(getCanvasImage(img, data));
                });
            }
            else {
                resolve(getHtmlImage(data));
            }
        });
        return prom;
    }
 
    function _refresh() {
        console.warn("Croppie.refresh() is deprecated.  Please use Croppie.bind() without any arguments instead.  refresh() will be removed in a later release.");
        _updatePropertiesFromImage.call(this);
    }
 
    function _destroy() {
        var self = this;
        self.element.removeChild(self.elements.boundary);
        if (self.options.showZoom) {
            self.element.removeChild(self.elements.zoomerWrap);
        }
        delete self.elements;
    }
 
    if (this.jQuery) {
        var $ = this.jQuery;
        $.fn.croppie = function (opts) {
            var ot = typeof opts;
 
            if (ot === 'string') {
                var args = Array.prototype.slice.call(arguments, 1);
                var singleInst = $(this).data('croppie');
 
                if (opts === 'get') {
                    return singleInst.get();
                }
                else if (opts === 'result') {
                    return singleInst.result.apply(singleInst, args);
                }
 
                return this.each(function () {
                    var i = $(this).data('croppie');
                    if (!i) return;
 
                    var method = i[opts];
                    if ($.isFunction(method)) {
                        method.apply(i, args);
                        if (opts === 'destroy') {
                            $(this).removeData('croppie');
                        }
                    }
                    else {
                        throw 'Croppie ' + opts + ' method not found';
                    }
                });
            }
            else {
                return this.each(function () {
                    var i = new Croppie(this, opts);
                    $(this).data('croppie', i);
                });
            }
        };
    }
 
    function Croppie(element, opts) {
        this.element = element;
        this.options = deepExtend({}, Croppie.defaults, opts);
 
        _create.call(this);
    }
 
    Croppie.defaults = {
        viewport: {
            width: 100,
            height: 100,
            type: 'square'
        },
        boundary: {
            width: 300,
            height: 300
        },
        customClass: '',
        showZoom: true,
        mouseWheelZoom: true,
        update: function () { }
    };
 
    deepExtend(Croppie.prototype, {
        bind: function (options, cb) {
            return _bind.call(this, options, cb);
        },
        get: function () {
            return _get.call(this);
        },
        result: function (type) {
            return _result.call(this, type);
        },
        refresh: function () {
            return _refresh.call(this);
        },
        destroy: function () {
            return _destroy.call(this);
        }
    });
 
    exports.Croppie = window.Croppie = Croppie;
}));
;/* =========================================================
 * bootstrap-datepicker.js
 * Repo: https://github.com/eternicode/bootstrap-datepicker/
 * Demo: http://eternicode.github.io/bootstrap-datepicker/
 * Docs: http://bootstrap-datepicker.readthedocs.org/
 * Forked from http://www.eyecon.ro/bootstrap-datepicker
 * =========================================================
 * Started by Stefan Petre; improvements by Andrew Rowls + contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */
 
(function($, undefined){
 
    var $window = $(window);
 
    function UTCDate(){
        return new Date(Date.UTC.apply(Date, arguments));
    }
    function UTCToday(){
        var today = new Date();
        return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
    }
    function alias(method){
        return function(){
            return this[method].apply(this, arguments);
        };
    }
 
    var DateArray = (function(){
        var extras = {
            get: function(i){
                return this.slice(i)[0];
            },
            contains: function(d){
                // Array.indexOf is not cross-browser;
                // $.inArray doesn't work with Dates
                var val = d && d.valueOf();
                for (var i=0, l=this.length; i < l; i++)
                    if (this[i].valueOf() === val)
                        return i;
                return -1;
            },
            remove: function(i){
                this.splice(i,1);
            },
            replace: function(new_array){
                if (!new_array)
                    return;
                if (!$.isArray(new_array))
                    new_array = [new_array];
                this.clear();
                this.push.apply(this, new_array);
            },
            clear: function(){
                this.length = 0;
            },
            copy: function(){
                var a = new DateArray();
                a.replace(this);
                return a;
            }
        };
 
        return function(){
            var a = [];
            a.push.apply(a, arguments);
            $.extend(a, extras);
            return a;
        };
    })();
 
 
    // Picker object
 
    var Datepicker = function(element, options){
        this.dates = new DateArray();
        this.viewDate = UTCToday();
        this.focusDate = null;
 
        this._process_options(options);
 
        this.element = $(element);
        this.isInline = false;
        this.isInput = this.element.is('input');
        this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
        this.hasInput = this.component && this.element.find('input').length;
        if (this.component && this.component.length === 0)
            this.component = false;
 
        this.picker = $(DPGlobal.template);
        this._buildEvents();
        this._attachEvents();
 
        if (this.isInline){
            this.picker.addClass('datepicker-inline').appendTo(this.element);
        }
        else {
            this.picker.addClass('datepicker-dropdown dropdown-menu');
        }
 
        if (this.o.rtl){
            this.picker.addClass('datepicker-rtl');
        }
 
        this.viewMode = this.o.startView;
 
        if (this.o.calendarWeeks)
            this.picker.find('tfoot th.today')
                        .attr('colspan', function(i, val){
                            return parseInt(val) + 1;
                        });
 
        this._allow_update = false;
 
        this.setStartDate(this._o.startDate);
        this.setEndDate(this._o.endDate);
        this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
 
        this.fillDow();
        this.fillMonths();
 
        this._allow_update = true;
 
        this.update();
        this.showMode();
 
        if (this.isInline){
            this.show();
        }
    };
 
    Datepicker.prototype = {
        constructor: Datepicker,
 
        _process_options: function(opts){
            // Store raw options for reference
            this._o = $.extend({}, this._o, opts);
            // Processed options
            var o = this.o = $.extend({}, this._o);
 
            // Check if "de-DE" style date is available, if not language should
            // fallback to 2 letter code eg "de"
            var lang = o.language;
            if (!dates[lang]){
                lang = lang.split('-')[0];
                if (!dates[lang])
                    lang = defaults.language;
            }
            o.language = lang;
 
            switch (o.startView){
                case 2:
                case 'decade':
                    o.startView = 2;
                    break;
                case 1:
                case 'year':
                    o.startView = 1;
                    break;
                default:
                    o.startView = 0;
            }
 
            switch (o.minViewMode){
                case 1:
                case 'months':
                    o.minViewMode = 1;
                    break;
                case 2:
                case 'years':
                    o.minViewMode = 2;
                    break;
                default:
                    o.minViewMode = 0;
            }
 
            o.startView = Math.max(o.startView, o.minViewMode);
 
            // true, false, or Number > 0
            if (o.multidate !== true){
                o.multidate = Number(o.multidate) || false;
                if (o.multidate !== false)
                    o.multidate = Math.max(0, o.multidate);
                else
                    o.multidate = 1;
            }
            o.multidateSeparator = String(o.multidateSeparator);
 
            o.weekStart %= 7;
            o.weekEnd = ((o.weekStart + 6) % 7);
 
            var format = DPGlobal.parseFormat(o.format);
            if (o.startDate !== -Infinity){
                if (!!o.startDate){
                    if (o.startDate instanceof Date)
                        o.startDate = this._local_to_utc(this._zero_time(o.startDate));
                    else
                        o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
                }
                else {
                    o.startDate = -Infinity;
                }
            }
            if (o.endDate !== Infinity){
                if (!!o.endDate){
                    if (o.endDate instanceof Date)
                        o.endDate = this._local_to_utc(this._zero_time(o.endDate));
                    else
                        o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
                }
                else {
                    o.endDate = Infinity;
                }
            }
 
            o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
            if (!$.isArray(o.daysOfWeekDisabled))
                o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
            o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
                return parseInt(d, 10);
            });
 
            var plc = String(o.orientation).toLowerCase().split(/\s+/g),
                _plc = o.orientation.toLowerCase();
            plc = $.grep(plc, function(word){
                return (/^auto|left|right|top|bottom$/).test(word);
            });
            o.orientation = {x: 'auto', y: 'auto'};
            if (!_plc || _plc === 'auto')
                ; // no action
            else if (plc.length === 1){
                switch (plc[0]){
                    case 'top':
                    case 'bottom':
                        o.orientation.y = plc[0];
                        break;
                    case 'left':
                    case 'right':
                        o.orientation.x = plc[0];
                        break;
                }
            }
            else {
                _plc = $.grep(plc, function(word){
                    return (/^left|right$/).test(word);
                });
                o.orientation.x = _plc[0] || 'auto';
 
                _plc = $.grep(plc, function(word){
                    return (/^top|bottom$/).test(word);
                });
                o.orientation.y = _plc[0] || 'auto';
            }
        },
        _events: [],
        _secondaryEvents: [],
        _applyEvents: function(evs){
            for (var i=0, el, ch, ev; i < evs.length; i++){
                el = evs[i][0];
                if (evs[i].length === 2){
                    ch = undefined;
                    ev = evs[i][1];
                }
                else if (evs[i].length === 3){
                    ch = evs[i][1];
                    ev = evs[i][2];
                }
                el.on(ev, ch);
            }
        },
        _unapplyEvents: function(evs){
            for (var i=0, el, ev, ch; i < evs.length; i++){
                el = evs[i][0];
                if (evs[i].length === 2){
                    ch = undefined;
                    ev = evs[i][1];
                }
                else if (evs[i].length === 3){
                    ch = evs[i][1];
                    ev = evs[i][2];
                }
                el.off(ev, ch);
            }
        },
        _buildEvents: function(){
            if (this.isInput){ // single input
                this._events = [
                    [this.element, {
                        focus: $.proxy(this.show, this),
                        keyup: $.proxy(function(e){
                            if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
                                this.update();
                        }, this),
                        keydown: $.proxy(this.keydown, this)
                    }]
                ];
            }
            else if (this.component && this.hasInput){ // component: input + button
                this._events = [
                    // For components that are not readonly, allow keyboard nav
                    [this.element.find('input'), {
                        focus: $.proxy(this.show, this),
                        keyup: $.proxy(function(e){
                            if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
                                this.update();
                        }, this),
                        keydown: $.proxy(this.keydown, this)
                    }],
                    [this.component, {
                        click: $.proxy(this.show, this)
                    }]
                ];
            }
            else if (this.element.is('div')){  // inline datepicker
                this.isInline = true;
            }
            else {
                this._events = [
                    [this.element, {
                        click: $.proxy(this.show, this)
                    }]
                ];
            }
            this._events.push(
                // Component: listen for blur on element descendants
                [this.element, '*', {
                    blur: $.proxy(function(e){
                        this._focused_from = e.target;
                    }, this)
                }],
                // Input: listen for blur on element
                [this.element, {
                    blur: $.proxy(function(e){
                        this._focused_from = e.target;
                    }, this)
                }]
            );
 
            this._secondaryEvents = [
                [this.picker, {
                    click: $.proxy(this.click, this)
                }],
                [$(window), {
                    resize: $.proxy(this.place, this)
                }],
                [$(document), {
                    'mousedown touchstart': $.proxy(function(e){
                        // Clicked outside the datepicker, hide it
                        if (!(
                            this.element.is(e.target) ||
                            this.element.find(e.target).length ||
                            this.picker.is(e.target) ||
                            this.picker.find(e.target).length
                        )){
                            this.hide();
                        }
                    }, this)
                }]
            ];
        },
        _attachEvents: function(){
            this._detachEvents();
            this._applyEvents(this._events);
        },
        _detachEvents: function(){
            this._unapplyEvents(this._events);
        },
        _attachSecondaryEvents: function(){
            this._detachSecondaryEvents();
            this._applyEvents(this._secondaryEvents);
        },
        _detachSecondaryEvents: function(){
            this._unapplyEvents(this._secondaryEvents);
        },
        _trigger: function(event, altdate){
            var date = altdate || this.dates.get(-1),
                local_date = this._utc_to_local(date);
 
            this.element.trigger({
                type: event,
                date: local_date,
                dates: $.map(this.dates, this._utc_to_local),
                format: $.proxy(function(ix, format){
                    if (arguments.length === 0){
                        ix = this.dates.length - 1;
                        format = this.o.format;
                    }
                    else if (typeof ix === 'string'){
                        format = ix;
                        ix = this.dates.length - 1;
                    }
                    format = format || this.o.format;
                    var date = this.dates.get(ix);
                    return DPGlobal.formatDate(date, format, this.o.language);
                }, this)
            });
        },
 
        show: function(){
            if (!this.isInline)
                this.picker.appendTo('body');
            this.picker.show();
            this.place();
            this._attachSecondaryEvents();
            this._trigger('show');
        },
 
        hide: function(){
            if (this.isInline)
                return;
            if (!this.picker.is(':visible'))
                return;
            this.focusDate = null;
            this.picker.hide().detach();
            this._detachSecondaryEvents();
            this.viewMode = this.o.startView;
            this.showMode();
 
            if (
                this.o.forceParse &&
                (
                    this.isInput && this.element.val() ||
                    this.hasInput && this.element.find('input').val()
                )
            )
                this.setValue();
            this._trigger('hide');
        },
 
        remove: function(){
            this.hide();
            this._detachEvents();
            this._detachSecondaryEvents();
            this.picker.remove();
            delete this.element.data().datepicker;
            if (!this.isInput){
                delete this.element.data().date;
            }
        },
 
        _utc_to_local: function(utc){
            return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
        },
        _local_to_utc: function(local){
            return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
        },
        _zero_time: function(local){
            return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
        },
        _zero_utc_time: function(utc){
            return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
        },
 
        getDates: function(){
            return $.map(this.dates, this._utc_to_local);
        },
 
        getUTCDates: function(){
            return $.map(this.dates, function(d){
                return new Date(d);
            });
        },
 
        getDate: function(){
            return this._utc_to_local(this.getUTCDate());
        },
 
        getUTCDate: function(){
            return new Date(this.dates.get(-1));
        },
 
        setDates: function(){
            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
            this.update.apply(this, args);
            this._trigger('changeDate');
            this.setValue();
        },
 
        setUTCDates: function(){
            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
            this.update.apply(this, $.map(args, this._utc_to_local));
            this._trigger('changeDate');
            this.setValue();
        },
 
        setDate: alias('setDates'),
        setUTCDate: alias('setUTCDates'),
 
        setValue: function(){
            var formatted = this.getFormattedDate();
            if (!this.isInput){
                if (this.component){
                    this.element.find('input').val(formatted).change();
                }
            }
            else {
                this.element.val(formatted).change();
            }
        },
 
        getFormattedDate: function(format){
            if (format === undefined)
                format = this.o.format;
 
            var lang = this.o.language;
            return $.map(this.dates, function(d){
                return DPGlobal.formatDate(d, format, lang);
            }).join(this.o.multidateSeparator);
        },
 
        setStartDate: function(startDate){
            this._process_options({startDate: startDate});
            this.update();
            this.updateNavArrows();
        },
 
        setEndDate: function(endDate){
            this._process_options({endDate: endDate});
            this.update();
            this.updateNavArrows();
        },
 
        setDaysOfWeekDisabled: function(daysOfWeekDisabled){
            this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
            this.update();
            this.updateNavArrows();
        },
 
        place: function(){
            if (this.isInline)
                return;
            var calendarWidth = this.picker.outerWidth(),
                calendarHeight = this.picker.outerHeight(),
                visualPadding = 10,
                windowWidth = $window.width(),
                windowHeight = $window.height(),
                scrollTop = $window.scrollTop();
 
            var zIndex = parseInt(this.element.parents().filter(function(){
                    return $(this).css('z-index') !== 'auto';
                }).first().css('z-index'))+10;
            var offset = this.component ? this.component.parent().offset() : this.element.offset();
            var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
            var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
            var left = offset.left,
                top = offset.top;
 
            this.picker.removeClass(
                'datepicker-orient-top datepicker-orient-bottom '+
                'datepicker-orient-right datepicker-orient-left'
            );
 
            if (this.o.orientation.x !== 'auto'){
                this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
                if (this.o.orientation.x === 'right')
                    left -= calendarWidth - width;
            }
            // auto x orientation is best-placement: if it crosses a window
            // edge, fudge it sideways
            else {
                // Default to left
                this.picker.addClass('datepicker-orient-left');
                if (offset.left < 0)
                    left -= offset.left - visualPadding;
                else if (offset.left + calendarWidth > windowWidth)
                    left = windowWidth - calendarWidth - visualPadding;
            }
 
            // auto y orientation is best-situation: top or bottom, no fudging,
            // decision based on which shows more of the calendar
            var yorient = this.o.orientation.y,
                top_overflow, bottom_overflow;
            if (yorient === 'auto'){
                top_overflow = -scrollTop + offset.top - calendarHeight;
                bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
                if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
                    yorient = 'top';
                else
                    yorient = 'bottom';
            }
            this.picker.addClass('datepicker-orient-' + yorient);
            if (yorient === 'top')
                top += height;
            else
                top -= calendarHeight + parseInt(this.picker.css('padding-top'));
 
            this.picker.css({
                top: top,
                left: left,
                zIndex: zIndex
            });
        },
 
        _allow_update: true,
        update: function(){
            if (!this._allow_update)
                return;
 
            var oldDates = this.dates.copy(),
                dates = [],
                fromArgs = false;
            if (arguments.length){
                $.each(arguments, $.proxy(function(i, date){
                    if (date instanceof Date)
                        date = this._local_to_utc(date);
                    dates.push(date);
                }, this));
                fromArgs = true;
            }
            else {
                dates = this.isInput
                        ? this.element.val()
                        : this.element.data('date') || this.element.find('input').val();
                if (dates && this.o.multidate)
                    dates = dates.split(this.o.multidateSeparator);
                else
                    dates = [dates];
                delete this.element.data().date;
            }
 
            dates = $.map(dates, $.proxy(function(date){
                return DPGlobal.parseDate(date, this.o.format, this.o.language);
            }, this));
            dates = $.grep(dates, $.proxy(function(date){
                return (
                    date < this.o.startDate ||
                    date > this.o.endDate ||
                    !date
                );
            }, this), true);
            this.dates.replace(dates);
 
            if (this.dates.length)
                this.viewDate = new Date(this.dates.get(-1));
            else if (this.viewDate < this.o.startDate)
                this.viewDate = new Date(this.o.startDate);
            else if (this.viewDate > this.o.endDate)
                this.viewDate = new Date(this.o.endDate);
 
            if (fromArgs){
                // setting date by clicking
                this.setValue();
            }
            else if (dates.length){
                // setting date by typing
                if (String(oldDates) !== String(this.dates))
                    this._trigger('changeDate');
            }
            if (!this.dates.length && oldDates.length)
                this._trigger('clearDate');
 
            this.fill();
        },
 
        fillDow: function(){
            var dowCnt = this.o.weekStart,
                html = '<tr>';
            if (this.o.calendarWeeks){
                var cell = '<th class="cw">&nbsp;</th>';
                html += cell;
                this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
            }
            while (dowCnt < this.o.weekStart + 7){
                html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
            }
            html += '</tr>';
            this.picker.find('.datepicker-days thead').append(html);
        },
 
        fillMonths: function(){
            var html = '',
            i = 0;
            while (i < 12){
                html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
            }
            this.picker.find('.datepicker-months td').html(html);
        },
 
        setRange: function(range){
            if (!range || !range.length)
                delete this.range;
            else
                this.range = $.map(range, function(d){
                    return d.valueOf();
                });
            this.fill();
        },
 
        getClassNames: function(date){
            var cls = [],
                year = this.viewDate.getUTCFullYear(),
                month = this.viewDate.getUTCMonth(),
                today = new Date();
            if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
                cls.push('old');
            }
            else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
                cls.push('new');
            }
            if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
                cls.push('focused');
            // Compare internal UTC date with local today, not UTC today
            if (this.o.todayHighlight &&
                date.getUTCFullYear() === today.getFullYear() &&
                date.getUTCMonth() === today.getMonth() &&
                date.getUTCDate() === today.getDate()){
                cls.push('today');
            }
            if (this.dates.contains(date) !== -1)
                cls.push('active');
            if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
                $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
                cls.push('disabled');
            }
            if (this.range){
                if (date > this.range[0] && date < this.range[this.range.length-1]){
                    cls.push('range');
                }
                if ($.inArray(date.valueOf(), this.range) !== -1){
                    cls.push('selected');
                }
            }
            return cls;
        },
 
        fill: function(){
            var d = new Date(this.viewDate),
                year = d.getUTCFullYear(),
                month = d.getUTCMonth(),
                startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
                startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
                endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
                endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
                todaytxt = dates[this.o.language].today || dates['en'].today || '',
                cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
                tooltip;
            this.picker.find('.datepicker-days thead th.datepicker-switch')
                        .text(dates[this.o.language].months[month]+' '+year);
            this.picker.find('tfoot th.today')
                        .text(todaytxt)
                        .toggle(this.o.todayBtn !== false);
            this.picker.find('tfoot th.clear')
                        .text(cleartxt)
                        .toggle(this.o.clearBtn !== false);
            this.updateNavArrows();
            this.fillMonths();
            var prevMonth = UTCDate(year, month-1, 28),
                day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
            prevMonth.setUTCDate(day);
            prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
            var nextMonth = new Date(prevMonth);
            nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
            nextMonth = nextMonth.valueOf();
            var html = [];
            var clsName;
            while (prevMonth.valueOf() < nextMonth){
                if (prevMonth.getUTCDay() === this.o.weekStart){
                    html.push('<tr>');
                    if (this.o.calendarWeeks){
                        // ISO 8601: First week contains first thursday.
                        // ISO also states week starts on Monday, but we can be more abstract here.
                        var
                            // Start of current week: based on weekstart/current date
                            ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
                            // Thursday of this week
                            th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
                            // First Thursday of year, year from thursday
                            yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
                            // Calendar week: ms between thursdays, div ms per day, div 7 days
                            calWeek =  (th - yth) / 864e5 / 7 + 1;
                        html.push('<td class="cw">'+ calWeek +'</td>');
 
                    }
                }
                clsName = this.getClassNames(prevMonth);
                clsName.push('day');
 
                if (this.o.beforeShowDay !== $.noop){
                    var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
                    if (before === undefined)
                        before = {};
                    else if (typeof(before) === 'boolean')
                        before = {enabled: before};
                    else if (typeof(before) === 'string')
                        before = {classes: before};
                    if (before.enabled === false)
                        clsName.push('disabled');
                    if (before.classes)
                        clsName = clsName.concat(before.classes.split(/\s+/));
                    if (before.tooltip)
                        tooltip = before.tooltip;
                }
 
                clsName = $.unique(clsName);
                html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
                if (prevMonth.getUTCDay() === this.o.weekEnd){
                    html.push('</tr>');
                }
                prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
            }
            this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
 
            var months = this.picker.find('.datepicker-months')
                        .find('th:eq(1)')
                            .text(year)
                            .end()
                        .find('span').removeClass('active');
 
            $.each(this.dates, function(i, d){
                if (d.getUTCFullYear() === year)
                    months.eq(d.getUTCMonth()).addClass('active');
            });
 
            if (year < startYear || year > endYear){
                months.addClass('disabled');
            }
            if (year === startYear){
                months.slice(0, startMonth).addClass('disabled');
            }
            if (year === endYear){
                months.slice(endMonth+1).addClass('disabled');
            }
 
            html = '';
            year = parseInt(year/10, 10) * 10;
            var yearCont = this.picker.find('.datepicker-years')
                                .find('th:eq(1)')
                                    .text(year + '-' + (year + 9))
                                    .end()
                                .find('td');
            year -= 1;
            var years = $.map(this.dates, function(d){
                    return d.getUTCFullYear();
                }),
                classes;
            for (var i = -1; i < 11; i++){
                classes = ['year'];
                if (i === -1)
                    classes.push('old');
                else if (i === 10)
                    classes.push('new');
                if ($.inArray(year, years) !== -1)
                    classes.push('active');
                if (year < startYear || year > endYear)
                    classes.push('disabled');
                html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
                year += 1;
            }
            yearCont.html(html);
        },
 
        updateNavArrows: function(){
            if (!this._allow_update)
                return;
 
            var d = new Date(this.viewDate),
                year = d.getUTCFullYear(),
                month = d.getUTCMonth();
            switch (this.viewMode){
                case 0:
                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
                        this.picker.find('.prev').css({visibility: 'hidden'});
                    }
                    else {
                        this.picker.find('.prev').css({visibility: 'visible'});
                    }
                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
                        this.picker.find('.next').css({visibility: 'hidden'});
                    }
                    else {
                        this.picker.find('.next').css({visibility: 'visible'});
                    }
                    break;
                case 1:
                case 2:
                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
                        this.picker.find('.prev').css({visibility: 'hidden'});
                    }
                    else {
                        this.picker.find('.prev').css({visibility: 'visible'});
                    }
                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
                        this.picker.find('.next').css({visibility: 'hidden'});
                    }
                    else {
                        this.picker.find('.next').css({visibility: 'visible'});
                    }
                    break;
            }
        },
 
        click: function(e){
            e.preventDefault();
            var target = $(e.target).closest('span, td, th'),
                year, month, day;
            if (target.length === 1){
                switch (target[0].nodeName.toLowerCase()){
                    case 'th':
                        switch (target[0].className){
                            case 'datepicker-switch':
                                this.showMode(1);
                                break;
                            case 'prev':
                            case 'next':
                                var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
                                switch (this.viewMode){
                                    case 0:
                                        this.viewDate = this.moveMonth(this.viewDate, dir);
                                        this._trigger('changeMonth', this.viewDate);
                                        break;
                                    case 1:
                                    case 2:
                                        this.viewDate = this.moveYear(this.viewDate, dir);
                                        if (this.viewMode === 1)
                                            this._trigger('changeYear', this.viewDate);
                                        break;
                                }
                                this.fill();
                                break;
                            case 'today':
                                var date = new Date();
                                date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
 
                                this.showMode(-2);
                                var which = this.o.todayBtn === 'linked' ? null : 'view';
                                this._setDate(date, which);
                                break;
                            case 'clear':
                                var element;
                                if (this.isInput)
                                    element = this.element;
                                else if (this.component)
                                    element = this.element.find('input');
                                if (element)
                                    element.val("").change();
                                this.update();
                                this._trigger('changeDate');
                                if (this.o.autoclose)
                                    this.hide();
                                break;
                        }
                        break;
                    case 'span':
                        if (!target.is('.disabled')){
                            this.viewDate.setUTCDate(1);
                            if (target.is('.month')){
                                day = 1;
                                month = target.parent().find('span').index(target);
                                year = this.viewDate.getUTCFullYear();
                                this.viewDate.setUTCMonth(month);
                                this._trigger('changeMonth', this.viewDate);
                                if (this.o.minViewMode === 1){
                                    this._setDate(UTCDate(year, month, day));
                                }
                            }
                            else {
                                day = 1;
                                month = 0;
                                year = parseInt(target.text(), 10)||0;
                                this.viewDate.setUTCFullYear(year);
                                this._trigger('changeYear', this.viewDate);
                                if (this.o.minViewMode === 2){
                                    this._setDate(UTCDate(year, month, day));
                                }
                            }
                            this.showMode(-1);
                            this.fill();
                        }
                        break;
                    case 'td':
                        if (target.is('.day') && !target.is('.disabled')){
                            day = parseInt(target.text(), 10)||1;
                            year = this.viewDate.getUTCFullYear();
                            month = this.viewDate.getUTCMonth();
                            if (target.is('.old')){
                                if (month === 0){
                                    month = 11;
                                    year -= 1;
                                }
                                else {
                                    month -= 1;
                                }
                            }
                            else if (target.is('.new')){
                                if (month === 11){
                                    month = 0;
                                    year += 1;
                                }
                                else {
                                    month += 1;
                                }
                            }
                            this._setDate(UTCDate(year, month, day));
                        }
                        break;
                }
            }
            if (this.picker.is(':visible') && this._focused_from){
                $(this._focused_from).focus();
            }
            delete this._focused_from;
        },
 
        _toggle_multidate: function(date){
            var ix = this.dates.contains(date);
            if (!date){
                this.dates.clear();
            }
            if (this.o.multidate === 1 && ix === 0){
                // single datepicker, don't remove selected date
            }
            else if (ix !== -1){
                this.dates.remove(ix);
            }
            else {
                this.dates.push(date);
            }
            if (typeof this.o.multidate === 'number')
                while (this.dates.length > this.o.multidate)
                    this.dates.remove(0);
        },
 
        _setDate: function(date, which){
            if (!which || which === 'date')
                this._toggle_multidate(date && new Date(date));
            if (!which || which  === 'view')
                this.viewDate = date && new Date(date);
 
            this.fill();
            this.setValue();
            this._trigger('changeDate');
            var element;
            if (this.isInput){
                element = this.element;
            }
            else if (this.component){
                element = this.element.find('input');
            }
            if (element){
                element.change();
            }
            if (this.o.autoclose && (!which || which === 'date')){
                this.hide();
            }
        },
 
        moveMonth: function(date, dir){
            if (!date)
                return undefined;
            if (!dir)
                return date;
            var new_date = new Date(date.valueOf()),
                day = new_date.getUTCDate(),
                month = new_date.getUTCMonth(),
                mag = Math.abs(dir),
                new_month, test;
            dir = dir > 0 ? 1 : -1;
            if (mag === 1){
                test = dir === -1
                    // If going back one month, make sure month is not current month
                    // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
                    ? function(){
                        return new_date.getUTCMonth() === month;
                    }
                    // If going forward one month, make sure month is as expected
                    // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
                    : function(){
                        return new_date.getUTCMonth() !== new_month;
                    };
                new_month = month + dir;
                new_date.setUTCMonth(new_month);
                // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
                if (new_month < 0 || new_month > 11)
                    new_month = (new_month + 12) % 12;
            }
            else {
                // For magnitudes >1, move one month at a time...
                for (var i=0; i < mag; i++)
                    // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
                    new_date = this.moveMonth(new_date, dir);
                // ...then reset the day, keeping it in the new month
                new_month = new_date.getUTCMonth();
                new_date.setUTCDate(day);
                test = function(){
                    return new_month !== new_date.getUTCMonth();
                };
            }
            // Common date-resetting loop -- if date is beyond end of month, make it
            // end of month
            while (test()){
                new_date.setUTCDate(--day);
                new_date.setUTCMonth(new_month);
            }
            return new_date;
        },
 
        moveYear: function(date, dir){
            return this.moveMonth(date, dir*12);
        },
 
        dateWithinRange: function(date){
            return date >= this.o.startDate && date <= this.o.endDate;
        },
 
        keydown: function(e){
            if (this.picker.is(':not(:visible)')){
                if (e.keyCode === 27) // allow escape to hide and re-show picker
                    this.show();
                return;
            }
            var dateChanged = false,
                dir, newDate, newViewDate,
                focusDate = this.focusDate || this.viewDate;
            switch (e.keyCode){
                case 27: // escape
                    if (this.focusDate){
                        this.focusDate = null;
                        this.viewDate = this.dates.get(-1) || this.viewDate;
                        this.fill();
                    }
                    else
                        this.hide();
                    e.preventDefault();
                    break;
                case 37: // left
                case 39: // right
                    if (!this.o.keyboardNavigation)
                        break;
                    dir = e.keyCode === 37 ? -1 : 1;
                    if (e.ctrlKey){
                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveYear(focusDate, dir);
                        this._trigger('changeYear', this.viewDate);
                    }
                    else if (e.shiftKey){
                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveMonth(focusDate, dir);
                        this._trigger('changeMonth', this.viewDate);
                    }
                    else {
                        newDate = new Date(this.dates.get(-1) || UTCToday());
                        newDate.setUTCDate(newDate.getUTCDate() + dir);
                        newViewDate = new Date(focusDate);
                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
                    }
                    if (this.dateWithinRange(newDate)){
                        this.focusDate = this.viewDate = newViewDate;
                        this.setValue();
                        this.fill();
                        e.preventDefault();
                    }
                    break;
                case 38: // up
                case 40: // down
                    if (!this.o.keyboardNavigation)
                        break;
                    dir = e.keyCode === 38 ? -1 : 1;
                    if (e.ctrlKey){
                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveYear(focusDate, dir);
                        this._trigger('changeYear', this.viewDate);
                    }
                    else if (e.shiftKey){
                        newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                        newViewDate = this.moveMonth(focusDate, dir);
                        this._trigger('changeMonth', this.viewDate);
                    }
                    else {
                        newDate = new Date(this.dates.get(-1) || UTCToday());
                        newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
                        newViewDate = new Date(focusDate);
                        newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
                    }
                    if (this.dateWithinRange(newDate)){
                        this.focusDate = this.viewDate = newViewDate;
                        this.setValue();
                        this.fill();
                        e.preventDefault();
                    }
                    break;
                case 32: // spacebar
                    // Spacebar is used in manually typing dates in some formats.
                    // As such, its behavior should not be hijacked.
                    break;
                case 13: // enter
                    focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
                    this._toggle_multidate(focusDate);
                    dateChanged = true;
                    this.focusDate = null;
                    this.viewDate = this.dates.get(-1) || this.viewDate;
                    this.setValue();
                    this.fill();
                    if (this.picker.is(':visible')){
                        e.preventDefault();
                        if (this.o.autoclose)
                            this.hide();
                    }
                    break;
                case 9: // tab
                    this.focusDate = null;
                    this.viewDate = this.dates.get(-1) || this.viewDate;
                    this.fill();
                    this.hide();
                    break;
            }
            if (dateChanged){
                if (this.dates.length)
                    this._trigger('changeDate');
                else
                    this._trigger('clearDate');
                var element;
                if (this.isInput){
                    element = this.element;
                }
                else if (this.component){
                    element = this.element.find('input');
                }
                if (element){
                    element.change();
                }
            }
        },
 
        showMode: function(dir){
            if (dir){
                this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
            }
            this.picker
                .find('>div')
                .hide()
                .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
                    .css('display', 'block');
            this.updateNavArrows();
        }
    };
 
    var DateRangePicker = function(element, options){
        this.element = $(element);
        this.inputs = $.map(options.inputs, function(i){
            return i.jquery ? i[0] : i;
        });
        delete options.inputs;
 
        $(this.inputs)
            .datepicker(options)
            .bind('changeDate', $.proxy(this.dateUpdated, this));
 
        this.pickers = $.map(this.inputs, function(i){
            return $(i).data('datepicker');
        });
        this.updateDates();
    };
    DateRangePicker.prototype = {
        updateDates: function(){
            this.dates = $.map(this.pickers, function(i){
                return i.getUTCDate();
            });
            this.updateRanges();
        },
        updateRanges: function(){
            var range = $.map(this.dates, function(d){
                return d.valueOf();
            });
            $.each(this.pickers, function(i, p){
                p.setRange(range);
            });
        },
        dateUpdated: function(e){
            // `this.updating` is a workaround for preventing infinite recursion
            // between `changeDate` triggering and `setUTCDate` calling.  Until
            // there is a better mechanism.
            if (this.updating)
                return;
            this.updating = true;
 
            var dp = $(e.target).data('datepicker'),
                new_date = dp.getUTCDate(),
                i = $.inArray(e.target, this.inputs),
                l = this.inputs.length;
            if (i === -1)
                return;
 
            $.each(this.pickers, function(i, p){
                if (!p.getUTCDate())
                    p.setUTCDate(new_date);
            });
 
            if (new_date < this.dates[i]){
                // Date being moved earlier/left
                while (i >= 0 && new_date < this.dates[i]){
                    this.pickers[i--].setUTCDate(new_date);
                }
            }
            else if (new_date > this.dates[i]){
                // Date being moved later/right
                while (i < l && new_date > this.dates[i]){
                    this.pickers[i++].setUTCDate(new_date);
                }
            }
            this.updateDates();
 
            delete this.updating;
        },
        remove: function(){
            $.map(this.pickers, function(p){ p.remove(); });
            delete this.element.data().datepicker;
        }
    };
 
    function opts_from_el(el, prefix){
        // Derive options from element data-attrs
        var data = $(el).data(),
            out = {}, inkey,
            replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
        prefix = new RegExp('^' + prefix.toLowerCase());
        function re_lower(_,a){
            return a.toLowerCase();
        }
        for (var key in data)
            if (prefix.test(key)){
                inkey = key.replace(replace, re_lower);
                out[inkey] = data[key];
            }
        return out;
    }
 
    function opts_from_locale(lang){
        // Derive options from locale plugins
        var out = {};
        // Check if "de-DE" style date is available, if not language should
        // fallback to 2 letter code eg "de"
        if (!dates[lang]){
            lang = lang.split('-')[0];
            if (!dates[lang])
                return;
        }
        var d = dates[lang];
        $.each(locale_opts, function(i,k){
            if (k in d)
                out[k] = d[k];
        });
        return out;
    }
 
    var old = $.fn.datepicker;
    $.fn.datepicker = function(option){
        var args = Array.apply(null, arguments);
        args.shift();
        var internal_return;
        this.each(function(){
            var $this = $(this),
                data = $this.data('datepicker'),
                options = typeof option === 'object' && option;
            if (!data){
                var elopts = opts_from_el(this, 'date'),
                    // Preliminary otions
                    xopts = $.extend({}, defaults, elopts, options),
                    locopts = opts_from_locale(xopts.language),
                    // Options priority: js args, data-attrs, locales, defaults
                    opts = $.extend({}, defaults, locopts, elopts, options);
                if ($this.is('.input-daterange') || opts.inputs){
                    var ropts = {
                        inputs: opts.inputs || $this.find('input').toArray()
                    };
                    $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
                }
                else {
                    $this.data('datepicker', (data = new Datepicker(this, opts)));
                }
            }
            if (typeof option === 'string' && typeof data[option] === 'function'){
                internal_return = data[option].apply(data, args);
                if (internal_return !== undefined)
                    return false;
            }
        });
        if (internal_return !== undefined)
            return internal_return;
        else
            return this;
    };
 
    var defaults = $.fn.datepicker.defaults = {
        autoclose: false,
        beforeShowDay: $.noop,
        calendarWeeks: false,
        clearBtn: false,
        daysOfWeekDisabled: [],
        endDate: Infinity,
        forceParse: true,
        format: 'mm/dd/yyyy',
        keyboardNavigation: true,
        language: 'en',
        minViewMode: 0,
        multidate: false,
        multidateSeparator: ',',
        orientation: "auto",
        rtl: false,
        startDate: -Infinity,
        startView: 0,
        todayBtn: false,
        todayHighlight: false,
        weekStart: 0
    };
    var locale_opts = $.fn.datepicker.locale_opts = [
        'format',
        'rtl',
        'weekStart'
    ];
    $.fn.datepicker.Constructor = Datepicker;
    var dates = $.fn.datepicker.dates = {
        en: {
            days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
            daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
            daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
            months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
            monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
            today: "Today",
            clear: "Clear"
        }
    };
 
    var DPGlobal = {
        modes: [
            {
                clsName: 'days',
                navFnc: 'Month',
                navStep: 1
            },
            {
                clsName: 'months',
                navFnc: 'FullYear',
                navStep: 1
            },
            {
                clsName: 'years',
                navFnc: 'FullYear',
                navStep: 10
        }],
        isLeapYear: function(year){
            return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
        },
        getDaysInMonth: function(year, month){
            return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
        },
        validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
        nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
        parseFormat: function(format){
            // IE treats \0 as a string end in inputs (truncating the value),
            // so it's a bad format delimiter, anyway
            var separators = format.replace(this.validParts, '\0').split('\0'),
                parts = format.match(this.validParts);
            if (!separators || !separators.length || !parts || parts.length === 0){
                throw new Error("Invalid date format.");
            }
            return {separators: separators, parts: parts};
        },
        parseDate: function(date, format, language){
            if (!date)
                return undefined;
            if (date instanceof Date)
                return date;
            if (typeof format === 'string')
                format = DPGlobal.parseFormat(format);
            var part_re = /([\-+]\d+)([dmwy])/,
                parts = date.match(/([\-+]\d+)([dmwy])/g),
                part, dir, i;
            if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
                date = new Date();
                for (i=0; i < parts.length; i++){
                    part = part_re.exec(parts[i]);
                    dir = parseInt(part[1]);
                    switch (part[2]){
                        case 'd':
                            date.setUTCDate(date.getUTCDate() + dir);
                            break;
                        case 'm':
                            date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
                            break;
                        case 'w':
                            date.setUTCDate(date.getUTCDate() + dir * 7);
                            break;
                        case 'y':
                            date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
                            break;
                    }
                }
                return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
            }
            parts = date && date.match(this.nonpunctuation) || [];
            date = new Date();
            var parsed = {},
                setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
                setters_map = {
                    yyyy: function(d,v){
                        return d.setUTCFullYear(v);
                    },
                    yy: function(d,v){
                        return d.setUTCFullYear(2000+v);
                    },
                    m: function(d,v){
                        if (isNaN(d))
                            return d;
                        v -= 1;
                        while (v < 0) v += 12;
                        v %= 12;
                        d.setUTCMonth(v);
                        while (d.getUTCMonth() !== v)
                            d.setUTCDate(d.getUTCDate()-1);
                        return d;
                    },
                    d: function(d,v){
                        return d.setUTCDate(v);
                    }
                },
                val, filtered;
            setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
            setters_map['dd'] = setters_map['d'];
            date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
            var fparts = format.parts.slice();
            // Remove noop parts
            if (parts.length !== fparts.length){
                fparts = $(fparts).filter(function(i,p){
                    return $.inArray(p, setters_order) !== -1;
                }).toArray();
            }
            // Process remainder
            function match_part(){
                var m = this.slice(0, parts[i].length),
                    p = parts[i].slice(0, m.length);
                return m === p;
            }
            if (parts.length === fparts.length){
                var cnt;
                for (i=0, cnt = fparts.length; i < cnt; i++){
                    val = parseInt(parts[i], 10);
                    part = fparts[i];
                    if (isNaN(val)){
                        switch (part){
                            case 'MM':
                                filtered = $(dates[language].months).filter(match_part);
                                val = $.inArray(filtered[0], dates[language].months) + 1;
                                break;
                            case 'M':
                                filtered = $(dates[language].monthsShort).filter(match_part);
                                val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
                                break;
                        }
                    }
                    parsed[part] = val;
                }
                var _date, s;
                for (i=0; i < setters_order.length; i++){
                    s = setters_order[i];
                    if (s in parsed && !isNaN(parsed[s])){
                        _date = new Date(date);
                        setters_map[s](_date, parsed[s]);
                        if (!isNaN(_date))
                            date = _date;
                    }
                }
            }
            return date;
        },
        formatDate: function(date, format, language){
            if (!date)
                return '';
            if (typeof format === 'string')
                format = DPGlobal.parseFormat(format);
            var val = {
                d: date.getUTCDate(),
                D: dates[language].daysShort[date.getUTCDay()],
                DD: dates[language].days[date.getUTCDay()],
                m: date.getUTCMonth() + 1,
                M: dates[language].monthsShort[date.getUTCMonth()],
                MM: dates[language].months[date.getUTCMonth()],
                yy: date.getUTCFullYear().toString().substring(2),
                yyyy: date.getUTCFullYear()
            };
            val.dd = (val.d < 10 ? '0' : '') + val.d;
            val.mm = (val.m < 10 ? '0' : '') + val.m;
            date = [];
            var seps = $.extend([], format.separators);
            for (var i=0, cnt = format.parts.length; i <= cnt; i++){
                if (seps.length)
                    date.push(seps.shift());
                date.push(val[format.parts[i]]);
            }
            return date.join('');
        },
        headTemplate: '<thead>'+
                            '<tr>'+
                                '<th class="prev">&laquo;</th>'+
                                '<th colspan="5" class="datepicker-switch"></th>'+
                                '<th class="next">&raquo;</th>'+
                            '</tr>'+
                        '</thead>',
        contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
        footTemplate: '<tfoot>'+
                            '<tr>'+
                                '<th colspan="7" class="today"></th>'+
                            '</tr>'+
                            '<tr>'+
                                '<th colspan="7" class="clear"></th>'+
                            '</tr>'+
                        '</tfoot>'
    };
    DPGlobal.template = '<div class="datepicker">'+
                            '<div class="datepicker-days">'+
                                '<table class=" table-condensed">'+
                                    DPGlobal.headTemplate+
                                    '<tbody></tbody>'+
                                    DPGlobal.footTemplate+
                                '</table>'+
                            '</div>'+
                            '<div class="datepicker-months">'+
                                '<table class="table-condensed">'+
                                    DPGlobal.headTemplate+
                                    DPGlobal.contTemplate+
                                    DPGlobal.footTemplate+
                                '</table>'+
                            '</div>'+
                            '<div class="datepicker-years">'+
                                '<table class="table-condensed">'+
                                    DPGlobal.headTemplate+
                                    DPGlobal.contTemplate+
                                    DPGlobal.footTemplate+
                                '</table>'+
                            '</div>'+
                        '</div>';
 
    $.fn.datepicker.DPGlobal = DPGlobal;
 
 
    /* DATEPICKER NO CONFLICT
    * =================== */
 
    $.fn.datepicker.noConflict = function(){
        $.fn.datepicker = old;
        return this;
    };
 
 
    /* DATEPICKER DATA-API
    * ================== */
 
    $(document).on(
        'focus.datepicker.data-api click.datepicker.data-api',
        '[data-provide="datepicker"]',
        function(e){
            var $this = $(this);
            if ($this.data('datepicker'))
                return;
            e.preventDefault();
            // component click requires us to explicitly show it
            $this.datepicker('show');
        }
    );
    $(function(){
        $('[data-provide="datepicker-inline"]').datepicker();
    });
 
}(window.jQuery));
;/**
 * German translation for bootstrap-datepicker
 * Sam Zurcher <[email protected]>
 */
;(function($){
    $.fn.datepicker.dates['de'] = {
        days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
        daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
        daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
        months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
        monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
        today: "Heute",
        clear: "Löschen",
        weekStart: 1,
        format: "dd.mm.yyyy"
    };
}(jQuery));
;var openinghours = (function () {
    var my = {};
 
    var _days = {
        'mo': 'Montag',
        'di': 'Dienstag',
        'mi': 'Mittwoch',
        'do': 'Donnerstag',
        'fr': 'Freitag',
        'sa': 'Samstag',
        'so': 'Sonntag'
    };
 
    var _index = 1;
 
    my.parse = function (element, options) {
        var val = $(element).val(), found = [], i, line, d, d2, matches, time, hours, t, foundDay, foundTime, regEx;
 
        // each line is one statement
        val = val.toLowerCase().split("\n");
        for (i = 0; i < val.length; i++) {
            time = '';
            line = val[i];
            foundDay = false;
            foundTime = false;
 
            // find start day
            for (d in _days) {
                regEx = new RegExp('^\\s*(' + d + '|' + _days[d] + ')\\s*([:-])', 'i');
                if (matches = line.match(regEx)) {
                    time += _days[d];
                    foundDay = true;
 
                    // second day required
                    if (matches[2] == '-') {
                        for (d2 in _days) {
                            if (d2 == d) {
                                // makes no sense
                                continue;
                            }
                            regEx = new RegExp('-\\s*(' + d2 + '|' + _days[d2] + ')\\s*:', 'i');
                            if (matches = line.match(regEx)) {
                                time += ' - ' + _days[d2];
                            }
                        }
                    }
                }
            }
 
            hours = [];
            regEx = /[:,]\s*(\d\d?)(?::(\d\d?))?-(\d\d?)(?::(\d\d?))?/g;
            while (matches = regEx.exec(line)) {
                t = (matches[1].length < 2 ? '0' : '') + matches[1] + ':';
                if (matches[2]) {
                    t += (matches[2].length < 2 ? '0' : '') + matches[2];
                } else {
                    t += '00';
                }
                t += ' - ' + (matches[3].length < 2 ? '0' : '') + matches[3] + ':';
                if (matches[4]) {
                    t += (matches[4].length < 2 ? '0' : '') + matches[4];
                } else {
                    t += '00';
                }
                hours.push(t);
                foundTime = true;
            }
 
            // other
            if (line.match(/\D:\s*(Ruhe|geschl)/i)) {
                hours.push('geschlossen');
                foundTime = true;
            }
 
            if (foundDay && foundTime) {
                time += ': ' + hours.join(', ');
                found.push(time);
            }
        }
 
        if (found == '') {
            $(options.static).html("<br /><strong class='text-danger'>Ungültige Öffnungszeiten. Bitte tragen Sie ihre Öffnungszeiten im richtigen Format ein.</span>");
            return ""
        }
 
        $(options.static).html(found.join("<br>"));
        $(options.hidden).val(found.join("\n"));
    };
 
    my.addSameDay = function ($element) {
        var $row = $element.parent().parent().parent();
        var weekDayTo = $('[name="weekDayTo[]"]', $row);
 
        if (weekDayTo.val() > 0) {
            return;
        }
 
        var value = $element.val();
        weekDayTo.val(value);
    };
 
    my.addOpeningHours = function (id, index) {
        if (index > _index) {
            _index = index;
        } else {
            _index++;
        }
 
        var $newRow = $('#' + id + ' .rowFirst').clone();
 
        $newRow.attr("id", "openingHoursRow" + _index);
        $newRow.addClass('rowNext').removeClass('rowFirst').hide().appendTo($('#' + id)).slideDown(200);
        $('input, select', $newRow).val('');
    };
 
    my.removeOpeningHours = function ($btn) {
        var $row = $btn.parent().parent();
        if ($row.hasClass('rowFirst')) {
            $('input, select', $row).val('');
        } else {
            $row.slideUp(200, function () {
                $row.remove();
            });
        }
    };
 
    return my;
}());;var autocomplete = (function() {
    var my = {};
 
    my.start = function(url, config) {
        var term = $(config.element).val();
        if (term.length >= (config.threshold || 2)) {
            $.ajax(url, {
                data: { term: term },
                success: function(data) {
                    my.onServerResponse(config, data);
                }
            });
        } else {
            $(config.element).next('.autocomplete').hide();
        }
    };
 
    my.onServerResponse = function(config, data) {
        var html = [], z, key;
 
        if (data.length) {
            for (z = 0; z < data.length; z++) {
                if (typeof data[z].key !== 'undefined') {
                    key = data[z].key;
                } else {
                    key = z;
                }
                html.push('<div class="autocomplete-pick" data-key="' + key + '" data-value="' + data[z].value + '">' + data[z].display + '</div>');
            }
        } else {
            for (z in data) {
                var extra_data = '', extra;
                for (extra in data[z]) {
                    if (extra !== 'value' && extra !== 'display') {
                        extra_data += ' data-' + extra + '="' + data[z][extra] + '"';
                    }
                }
                html.push('<div class="autocomplete-pick ' + config.pickClass + '" data-key="' + z + '" data-value="' + data[z].value + '"' + extra_data + '>' + data[z].display + '</div>');
            }
        }
 
        // nothing found
        if (html.length == 0) {
            html.push('Keine Übereinstimmung gefunden');
        }
 
        var $thing = $(config.element).next('.autocomplete'), width = $thing.data('width'), $parent;
        if (!width) {
            $parent = $thing.parent();
            width = $parent.css('width').replace('px', '');
            width -= $parent.css('padding-left').replace('px', '');
            width -= $parent.css('padding-right').replace('px', '');
            $thing.data('width', width);
        }
        $thing.html(html.join('')).css('width', (width) + 'px').show();
 
        $('.autocomplete-pick', $thing).click(function() {
            $thing.hide();
            config.onPick(this);
        });
    };
 
    return my;
}());
 
var autocompleteDropDown = (function() {
    var my = {};
 
    my.start = function(url, config, id) {
        var term = $(config.element).val();
        if (term.length >= (config.threshold || 2)) {
            $.ajax(url, {
                data: { term: term },
                success: function(data) {
                    my.onServerResponse(data, id);
                }
            });
        }
    };
 
    my.onServerResponse = function(data, id) {
        var html = [], z, lastCity = '', townVal = null;
 
        if (data.length) {
            for (z = 0; z < data.length; z++) {
                if (lastCity != data[z].value) {
                    html.push('<option value="' + data[z].value + '">' + data[z].value + '</option>');
                }
                lastCity = data[z].value;
            }
        } else {
            for (z in data) {
                if (lastCity != data[z].display) {
                    html.push('<option value="' + data[z].display + '">' + data[z].display + '</option>');
                }
                lastCity = data[z].display;
            }
        }
 
        var $thing = $('#' + id);
 
        // nothing found
        if (html.length == 0) {
            html.push('<option value="">Keine Übereinstimmung gefunden</option>');
            $thing.html(html.join(''));
        } else {
            // edit form -> preselect old town
            if ($thing.val()) {
                townVal = $thing.val();
            }
 
            $thing.html(html.join(''));
            $thing.prepend('<option value="">Bitte wählen Sie eine Stadt aus.</option>');
 
            if (townVal) {
                $preSelectedOption = $('#' + id + ' option[value="' + townVal + '"]');
            } else {
                if (html.length == 1) {
                    $preSelectedOption = $($('#' + id + ' option').get(1));
                } else {
                    $preSelectedOption = $($('#' + id + ' option').get(0));
                }
            }
            $preSelectedOption.attr('selected', 'selected').change();
            $preSelectedOption.attr("rel");
        }
    };
 
    return my;
}());;var Products = (function ($, window) {
    var my = {}, delUrl = '/user/productDelete';
 
    my.create = function (cid, showDialog) {
        if (!showDialog) {
            $('#manageProducts').hide();
        }
 
        $.get('/user/createProductRequired', {'cid': cid, 'showDialog': +showDialog}, function (html) {
            $("html, body").animate({scrollTop: 0}, "slow");
            $('#productFormContainer').html(html).slideDown(300);
        });
    };
 
    my.edit = function (cid, pid, showDialog) {
        if (!showDialog) {
            $('#manageProducts').hide();
        }
        $.get('/user/editProductRequired', {'cid': cid, 'pid': pid, 'showDialog': +showDialog}, function (html) {
            $("html, body").animate({scrollTop: 0}, "slow");
            $('#productFormContainer').html(html).slideDown(300);
        });
    };
 
    my.editAdditional = function (cid, pid, showDialog) {
        var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
        var formData = new FormData($form[0]);
 
        $.ajax({
            url: '/user/editProductRequired',
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (d) {
                $btn.enableButton(t, d.status == 'ok');
 
                if (d.status == 'ok') {
                    pid = d.productId;
                    if (!showDialog) {
                        $('#manageProducts').hide();
                    }
 
                    $.get('/user/editProductAdditional', {
                        'cid': cid,
                        'pid': pid,
                        'showDialog': +showDialog
                    }, function (html) {
                        $("html, body").animate({scrollTop: 0}, "slow");
                        $('#productFormContainer').html(html).slideDown(300);
                    });
                } else {
                }
            }
        });
        outputFlashSession();
    };
 
    my.saveAdditional = function () {
        var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
        var formData = new FormData($form[0]);
 
        $.ajax({
            url: '/user/editProductAdditional',
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (d) {
                $btn.enableButton(t, d.status == 'ok');
                if (d.status == 'ok') {
                    window.location.href = d.redirect;
                }
            }
        });
        outputFlashSession();
    };
 
    my.del = function (pid, confirmText) {
        if (confirm(confirmText)) {
            $.post(delUrl, {'pid': pid}, function () {
                window.location.reload();
            })
        }
    };
 
    return my;
}(jQuery, window));
 
var Profile = (function ($) {
    var my = {};
 
    my.updateOption = function (element) {
        var $el = $(element);
 
        $.get('/user/profileOption', {o: $el.attr('name'), v: +$el.is(':checked')}, function (d) {
            var $ok = $('<span class="text-success"><i class="fa fa-check" aria-hidden="true"></i>gespeichert</span>').hide();
            $el.parent().append($ok);
            $ok.fadeIn();
            window.setTimeout(function () {
                $ok.fadeOut()
            }, 2000);
        });
    };
 
    my.removeProfileImage = function () {
        $.get('/user/deleteProfile', {}, function (d) {
                if (d.status === 'ok') {
                    $('#profileImage').remove();
                    $('#profileImageRemoveButton').remove();
                    $('#profileImagePlaceholder').show();
 
                    autoResizePlaceholderImage();
                }
            outputFlashSession();
            }
        );
 
    };
 
    return my;
}(jQuery));;/**
 * Global container for payment actions.
 */
var Payment = (function (window, document, $, my) {
    var step, progress = 0, callbacks = {
        nextStep: null,
        progress: null,
        confirm: null
    };
 
    my.data = {
        config: {'url': '', 'requests': {}},
        transaction: {'info': {}, 'order': ''}
    };
 
    my.registerCallback = function (key, callback) {
        callbacks[key] = callback;
    };
 
    my.init = function () {
        if (typeof PaymentConfig == 'undefined') {
            return;
        }
 
        my.data.config = PaymentConfig;
 
        if (PaymentData && PaymentData.order) {
            my.data.transaction.order = PaymentData.order;
            my.return.process(PaymentData);
        }
 
        window.setTimeout(function () {
            nextStep('init');
        }, 500);
    };
 
    my.fancyInOut = function ($out, $in) {
        $out.slideUp(300, function () {
            $in.slideDown(300);
        });
    };
 
    function nextStep(key) {
        var nextStep = my.moveToStep(key, true);
 
        $('.step-' + nextStep + '-progress div').addClass('btn-danger');
        $('.step-' + nextStep + '-progress div').removeClass('btn-default');
        $('.step-' + nextStep + '-progress div').removeClass('no-button');
        if (key == 'toConfirm') {
            $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToConfirm()");
        } else {
            $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToStep('" + key + "', false)");
        }
 
 
        if (typeof callbacks.progress == 'function') {
            progress = callbacks.progress(step, progress);
            $('#paymentProgress').css('width', progress + '%');
        }
    }
 
    my.moveToStep = function (key, returnNextStep) {
        var nextStep, previousStep = step;
 
        if (typeof callbacks.nextStep == 'function') {
            nextStep = callbacks.nextStep(key, step);
        }
 
        if (nextStep) {
            step = nextStep;
        }
 
        if (!previousStep || previousStep == nextStep) {
            $('.step-' + nextStep).show();
        } else {
            my.fancyInOut($('.step-' + previousStep), $('.step-' + step));
        }
 
        if (returnNextStep == true) {
            return nextStep;
        }
    };
 
    my.productSelect = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
        $btn.disableButton(t);
 
        $.post(my.data.config.url + '/productSelect', {'pid': $('#productId').val()}, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                my.data.transaction = d;
                nextStep('product');
            }
        });
    };
 
    my.register = function (form, id, showClaims) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
        $btn.disableButton(t);
 
        data.push({'name': 'order', 'value': my.data.transaction.order});
        data.push({'name': 'showClaims', 'value': showClaims});
        $.post(my.data.config.url + '/register', data, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                my.data.transaction = d;
                $('.form-login-actions').hide();
                $('#' + id).slideDown();
            }
        });
    };
 
    my.login = function (userId, id, showClaims) {
        $.post(my.data.config.url + '/login', {
            'uid': userId,
            'order': my.data.transaction.order,
            'showClaims': showClaims
        }, function (d) {
            if (d.status == 'ok') {
                my.data.transaction = d;
                $('#' + id).slideDown();
            }
        });
    };
 
    my.checkAvailability = function (data, $btn) {
        var t = $btn.html();
        $btn.disableButton(t);
        $.post(my.data.config.url + '/checkAvailability', data, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                $('#packageConfigAvailable').show();
                $('#packageConfigSubmitContainer').slideDown();
                $btn.hide();
            } else {
                $('#packageConfigNotAvailable').show();
            }
        });
 
    };
 
    my.productConfig = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
        $btn.disableButton(t);
 
        data.push({'name': 'order', 'value': my.data.transaction.order});
 
        $.post(my.data.config.url + '/productConfig', data, function (d) {
            if (form != null) {
                $btn.enableButton(t);
            }
 
            if (d.status == 'ok') {
                my.data.transaction = d;
                nextStep('productConfig');
            }
        });
    };
 
    my.companySelected = function (companyId, btn, form) {
        var $btn = $(btn), t = $btn.html(), data = [];
        $btn.disableButton(t);
 
        if (form) {
            var $form = $(form);
            data = $form.serializeArray();
        }
        data.push({'name': 'cid', 'value': companyId});
        data.push({'name': 'order', 'value': my.data.transaction.order});
 
        $.post(my.data.config.url + '/addCompany', data, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                my.data.transaction = d;
                nextStep('company');
            }
            if (form) {
                return false;
            }
        });
    };
 
    my.customerData = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
        $btn.disableButton(t);
 
        data.push({'name': 'order', 'value': my.data.transaction.order});
 
        $.post(my.data.config.url + '/customerData', data, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                my.data.transaction = d;
                nextStep('customer');
            }
        });
    };
 
    my.moveToConfirm = function () {
        var html = '', val, pt = my.data.config.paymentText;
        for (var key in my.data.transaction.info.payment) {
            val = my.data.transaction.info.payment[key];
            html += '<div class="row"><div class="col-xs-6 bold">' + pt[key] + '</div>';
            html += '<div class="col-xs-6">' + (pt[val] ? pt[val] : val) + '</div></div>';
        }
        $('#confirmPayment').html(html);
 
        if (typeof callbacks.confirm == 'function') {
            callbacks.confirm(my.data.transaction.info);
        }
 
        $('#costs').hide();
        nextStep('toConfirm');
    };
 
    my.confirm = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
        $btn.disableButton(t);
 
        data.push({'name': 'order', 'value': my.data.transaction.order});
 
        $.post(my.data.config.url + '/confirm', data, function (d) {
            $btn.enableButton(t);
 
            if (d.status == 'ok') {
                my.thanks(d);
            } else {
                if (d.status == 'redirect') {
                    $('#externalPaymentBtn').click(function () {
                        $('#externalPaymentBtn').disableButton();
                        window.location.href = d.url;
                    });
                    my.fancyInOut($('.step-' + step), $('.step-external'));
                }
            }
        });
    };
 
    my.thanks = function (response) {
        $('#thanksRefNo').text(response.info.referenceNumber);
        my.fancyInOut($('.step:visible'), $('.step-thanks'));
        $('#progressBar').hide();
        $('#invoiceLink').attr('href', $('#invoiceLink').attr('href') + '/' + response.info.referenceNumber);
    };
 
    my.error = function (response) {
        $('#paymentError').html('FEHLER: ' + response.customermessage);
    };
 
    return my;
}(window, document, jQuery, Payment || {}));
 
/**
 * Add module return to handle the different cases the user return to the payment process.
 */
var Payment = (function ($, parent) {
    var my = {};
 
    my.process = function (data) {
        if (data.returnType === 'external') {
            $('.step').hide();
 
            if (data.status === 'back') {
                externalAbort(data.order);
            } else {
                if (data.status === 'ok') {
                    externalOk(data.order);
                } else {
                    if (data.status === 'error') {
                        externalError(data.order);
                    }
                }
            }
        }
    };
 
    function externalAbort(order) {
        $('#restartExternalPaymentBtn').click(function () {
            var $btn = $(this);
            $btn.disableButton();
            $('.step-external-back .info').show();
 
            $.post(parent.data.config.url + '/restartExternal', {'order': order}, function (d) {
                if (d.status == 'redirect') {
                    window.location.href = d.url;
                } else {
                    $btn.enableButton(t);
                }
            });
        });
        $('.step-external-back').show();
    }
 
    function externalOk(order) {
        $('.step-external-ok').show();
        my.checkOrder(order);
    }
 
    my.checkOrder = function (order) {
        $.post(parent.data.config.url + '/checkOrder', {'order': order}, function (d) {
            if (d.status == 'ok') {
                if (d.isPaid === true) {
                    // we are done
                    parent.thanks(d);
                } else {
                    // try again in a few
                    window.setTimeout(function () {
                        my.checkOrder(order);
                    }, 1500);
                }
            }
        });
    };
 
    function externalError(order) {
        $('.step-external-error').show();
    }
 
    parent.return = my;
    return parent;
}(jQuery, Payment || {}));
 
/**
 * Add module methods to handle the different payment methods.
 */
var Payment = (function ($, parent) {
    var my = {};
 
    my.selected = function () {
        var type = $('#paymentSelect').val();
        $('.method').hide();
        $('.method-' + type).show();
    };
 
    function mergeParameters(request, params) {
        for (var key in parent.data.config.requests[request]) {
            params[key] = parent.data.config.requests[request][key];
        }
 
        return params;
    }
 
    function addPaymentMethod(type, data, $btn, btnText) {
        $.post(parent.data.config.url + '/addPaymentMethod', {
            'type': type,
            'order': parent.data.transaction.order,
            'data': data
        }, function (d) {
            $btn.enableButton(btnText);
 
            if (d.status == 'ok') {
                parent.data.transaction = d;
                parent.moveToConfirm();
            }
        });
    }
 
    my.creditCardCheck = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
        $btn.disableButton();
 
        var funcName = 'callbackCreditCardCheck' + Math.ceil(Math.random() * 100000000);
        window[funcName] = function (response) {
            $('#response').html(JSON.stringify(response, null, 2));
 
            if (response.status === 'ERROR') {
                $btn.enableButton(t);
                my.error(response);
            } else {
                if (response.status === 'VALID') {
                    // inform server
                    addPaymentMethod('creditcard', {
                        'pseudoCardNumber': response.pseudocardpan,
                        'truncatedCardNumber': response.truncatedcardpan
                    }, $btn, t);
                } else {
                }
            }
        };
 
        var pr = new PayoneRequest(mergeParameters('creditCardCheck', {
            'cardpan': parseInt($('#ccNumber', $form).val(), 10), // credit card number
            'cardtype': $('#ccType', $form).val(),
            'cardexpiredate': parseInt($('#ccExpire', $form).val(), 10),
            'cardcvc2': parseInt($('#ccCvc', $form).val(), 10),
            'language': 'de'
        }), {'callback_function_name': funcName});
        pr.checkAndStore();
    };
 
    my.paypalCheck = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
        $btn.disableButton();
 
        addPaymentMethod('paypal', {}, $btn, t);
    };
 
    my.invoiceCheck = function (form) {
        var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
        $btn.disableButton();
 
        addPaymentMethod('invoice', {}, $btn, t);
    };
 
    parent.method = my;
    return parent;
}(jQuery, Payment || {}));
 
Payment.banner = (function ($) {
    var my = {};
 
    my.checkDetailRival = function (url, companyId, boxId, claimId, userId) {
        $('#' + boxId + 'Advertising').hide();
        $.get(url + '/checkDetailRival', {'cid': companyId}, function (d) {
            if (d.status == 'ok') {
                $('#' + boxId).addClass('marginBottom17');
                $('#' + boxId + 'Container').addClass('marginTop17');
                my.getBanner(d.phrase, d.city, boxId, 'detail', 'df', 'leader');
 
                if ((claimId && userId) && (claimId == userId)) {
                    $('#' + boxId + 'Info').removeClass('hidden');
                }
            } else {
                $('#' + boxId + 'Advertising').show();
            }
        });
    };
 
    my.getBanner = function (phrase, city, boxId, page, trackInfo, format) {
        $.getScript('/banner.do?page=' + page + '&sp=' + phrase + '&sl=' + city + '&f=' + format + '&t=' + trackInfo + '&id=' + boxId);
    };
 
    return my;
}(jQuery));
 
jQuery(document).ready(Payment.init);;jQuery(document).ready(function() {
    $('#searchForm input[name=what]').change(function() {
        // check the "what" input for validity
        var $what = $(this), value;
 
        // there must be at least one number or one letter
        value = $what.val().replace(/[^a-z0-9]/ig, '');
 
        if (value == '') {
            this.validity.valid = false;
            this.setCustomValidity('Sie müssen mindestens einen Buchstaben oder eine Zahl eingeben.');
        } else {
            this.validity.valid = true;
            this.setCustomValidity('');
        }
    });
});
 
var Search = (function($) {
    var my = {};
 
    my.searchFilter = function(filterContentId, filterBoxClass, filterHeaderClass) {
        if (Mobile.isMobile()) {
            $('#' + filterContentId).removeClass('in');
            $('.' + filterBoxClass).addClass('panel panel-primary');
            $('.' + filterBoxClass + ' .' + filterHeaderClass).addClass('panel-heading');
            $('.' + filterBoxClass + ' h2').addClass('panel-title');
            $('.' + filterBoxClass + ' h2').removeClass('text-danger');
            $('.' + filterBoxClass + ' h2 a').removeClass('text-danger');
            $('.' + filterBoxClass + ' h2 a').html($('.search-filter-box .panel-title a').text() + '  <i class="fa fa-angle-down pull-right" aria-hidden="true"></i>');
            $('#' + filterContentId + ' .row').removeClass('row');
        }
    };
 
    return my;
}(jQuery));;var Social = (function ($) {
    var my = {}, fbApiInit = false, twApiInit = false;
 
    my.loadFacebookSDK = function (facebookAppId) {
        window.fbAsyncInit = function () {
            FB.init({appId: facebookAppId, cookie: false, xfbml: true, version: 'v2.1'});
            fbApiInit = true;
        };
 
        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s);
            js.id = id;
            js.src = "//connect.facebook.net/de_DE/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    };
 
    my.loadTwitterScript = function () {
        !function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
            if (!d.getElementById(id)) {
                js = d.createElement(s);
                js.id = id;
                js.src = p + "://platform.twitter.com/widgets.js";
                fjs.parentNode.insertBefore(js, fjs);
 
                twApiInit = true;
            }
        }(document, "script", "twitter-wjs");
 
    };
 
    my.clickToShowFacebook = function (element, facebookAppId) {
        var $btn = $(element), t = $btn.html();
        $btn.disableButton(t);
 
        my.loadFacebookSDK(facebookAppId);
 
        my.fbEnsureInit(function () {
            $btn.enableButton(t);
        });
    };
 
    my.fbEnsureInit = function (callback) {
        if (!fbApiInit) {
            setTimeout(function () {
                my.fbEnsureInit(callback);
            }, 50);
        } else {
            if (callback) {
                callback();
            }
        }
    };
 
    my.loginByFacebookStep1 = function (element, facebookAppId, fbScope, buttonText) {
        var $btn = $(element), t = $btn.html();
        $btn.disableButton(t);
        my.loadFacebookSDK(facebookAppId);
        my.fbEnsureInit(function () {
            $btn.enableButton('<i class="fa fa-facebook-square fa-2x"></i> ' + buttonText);
            $btn.removeClass('btn-default');
            $btn.addClass('btn-fb');
            $btn.attr("onclick", "Social.loginByFacebookStep2(this, '" + fbScope + "')");
        });
    };
 
    my.loginByFacebookStep2 = function (element, fbScope) {
        var $btn = $(element), t = $btn.html();
        $btn.disableButton(t);
        FB.login(facebookStatusCallback, {scope: fbScope});
        $btn.enableButton(t);
    };
 
    my.twEnsureInit = function (callback) {
        if (!twApiInit) {
            setTimeout(function () {
                my.twEnsureInit(callback);
            }, 50);
        } else {
            if (callback) {
                callback();
            }
        }
    };
 
    my.clickToShowTwitter = function (element) {
        var $btn = $(element), t = $btn.html();
        $btn.disableButton(t);
 
        my.loadTwitterScript();
 
        my.twEnsureInit(function () {
            $btn.enableButton(t);
        });
    };
 
    return my;
}(jQuery));;jQuery(document).ready(function($) {
    $('[data-track="1"]').each(function() {
        var el = $(this), url = el.data('track-url');
 
        el.click(function() {
            Tracking.trackYext(url);
        });
    })
}(jQuery));
 
var Tracking = (function($) {
    var my = {};
 
    my.trackYext = function(url) {
        $('body').append('<img src="' + url + '"/>');
    };
 
    return my;
}(jQuery));;

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎