JohnGalt14

Malicious or Legitimate

May 19th, 2019
1,648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1,005.62 KB | None | 0 0
  1. window.___gcfg = {lang: 'de'}
  2. 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,
  3. 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>");/*
  4.  gapi.loader.OBJECT_CREATE_TEST_OVERRIDE &&*/
  5. 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)&&
  6. 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,
  7. "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,
  8. "%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);
  9. 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");
  10. 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&&
  11. (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();
  12. 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=
  13. 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);
  14. 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(",")},
  15. 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="'+
  16. 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),
  17. "_",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,
  18. 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};
  19. 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"===
  20. 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-
  21. 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")||
  22. (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,
  23. 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&&
  24. 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")||
  25. 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,
  26. "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&&
  27. (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,
  28. 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,
  29. 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,
  30. "\\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]")&&
  31. !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+
  32. 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};
  33. 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):
  34. (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};
  35. 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}};
  36. 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};
  37. 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||
  38. (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,
  39. 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,
  40. 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,
  41. 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:
  42. 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,
  43. 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,
  44. 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;
  45. 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=
  46. 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=
  47. 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],
  48. 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=
  49. 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={};
  50. 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=
  51. 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||
  52. (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";
  53. 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)&&
  54. 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])};
  55. 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;
  56. 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=
  57. "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)}};
  58. 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)};
  59. 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],
  60. 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()};
  61. 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,
  62. !0)})}});return!0};H("bs0",!0,window.gapi._bs);H("bs1",!0);delete window.gapi._bs;}).call(this);
  63. 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"]}});
  64.  
  65.     window.cookieconsent_options = {
  66.         "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. ",
  67.         "dismiss": "Einverstanden",
  68.         "learnMore": "Datenschutzerklärung",
  69.         "link": "https://www.bundes-telefonbuch.de/infos/datenschutzhinweis#5",
  70.         "theme": "dark-top"
  71.     };
  72.  
  73.  
  74.  
  75. window.google = window.google || {};
  76. google.maps = google.maps || {};
  77. (function() {
  78.  
  79.   function getScript(src) {
  80.     document.write('<' + 'script src="' + src + '"><' + '/script>');
  81.   }
  82.  
  83.   var modules = google.maps.modules = {};
  84.   google.maps.__gjsload__ = function(name, text) {
  85.     modules[name] = text;
  86.   };
  87.  
  88.   google.maps.Load = function(apiLoad) {
  89.     delete google.maps.Load;
  90.     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);
  91.   };
  92.   var loadScriptTime = (new Date).getTime();
  93. })();
  94. // inlined
  95. (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";
  96. _.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)}};
  97. 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})};
  98. _.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};
  99. 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}};
  100. 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};
  101. _.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();
  102. _.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";
  103. 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)};
  104. 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};
  105. _.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)}};
  106. _.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};
  107. _.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")};
  108. _.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};
  109. _.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};
  110. 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)};
  111. 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==
  112. 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=
  113. 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)};
  114. 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};
  115. _.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)};
  116. _.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]};
  117. _.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};
  118. 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();
  119. 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)};
  120. _.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||[]};
  121. 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};
  122. _.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]};
  123. _.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)};
  124. _.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}};
  125. _.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);}})}};
  126. _.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)}};
  127. 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)};
  128. _.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)};
  129. _.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())};
  130. _.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};
  131. 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))};
  132. _.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};
  133. 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}};
  134. _.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]};
  135. _.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)}};
  136. _.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");
  137. _.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");
  138. _.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};
  139. 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)));
  140. 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&&
  141. (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")};
  142. _.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");};
  143. 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"};
  144. 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)})}))};
  145. 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()};
  146. _.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)})})};
  147. _.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)};
  148. _.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+
  149. "").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))}
  150. 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))];
  151. 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)}))};
  152. 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)};
  153. 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))};
  154. _.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")};
  155. _.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)})};
  156. _.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};
  157. _.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=
  158. 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,
  159. 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()}};
  160. 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--))};
  161. 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)};
  162. 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};
  163. $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)};
  164. 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))};
  165. _.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};
  166. 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)};
  167. 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,
  168. 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)};
  169. _.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};
  170. _.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))};
  171. 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()&&
  172. 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};
  173. 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};
  174. _.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||[]};
  175. 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)};
  176. 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,
  177. {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)};
  178. 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))};
  179. 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)};
  180. 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)};
  181. 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,
  182. _.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=
  183. 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};
  184. _.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)])};
  185. 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};
  186. 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))})})};
  187. 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");
  188. 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};
  189. 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)}};
  190. xh=function(){var a=new sh(2147483647);return function(b){return th(a,b,0)}};
  191. 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);
  192. 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.")};
  193. 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};
  194. _.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));
  195. 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};
  196. 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;
  197. 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}();
  198. 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=
  199. 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)}};
  200. 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=
  201. 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: "+
  202. 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});
  203. 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}});
  204. 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}});
  205. 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}});
  206. 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);
  207. 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});
  208. 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,
  209. 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!=
  210. 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,
  211. 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=
  212. 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});
  213. 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)};
  214. 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)}});
  215. 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}});
  216. 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)}});
  217. 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};
  218. Ea("Object.assign",function(a){return a||Qh});
  219. 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||
  220. 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;
  221. 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");
  222. 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;
  223. _.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};
  224. _.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)};
  225. _.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))}};
  226. _.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)};
  227. 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)};
  228. 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++])}};
  229. 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;
  230. _.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)};
  231. _.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)};
  232. _.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;
  233. _.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())};
  234. _.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};
  235. _.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;
  236. _.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);
  237. _.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);
  238. _.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);
  239. _.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))};
  240. _.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)};
  241. _.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;
  242. _.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;
  243. _.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;
  244. _.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;
  245. _.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);/*
  246.  
  247. Math.uuid.js (v1.4)
  248. http://www.broofa.com
  249. mailto:robert@broofa.com
  250. Copyright (c) 2010 Robert Kieffer
  251. Dual licensed under the MIT and GPL licenses.
  252. */
  253. 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;
  254. _.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;
  255. _.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)};
  256. _.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};
  257. _.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)})};
  258. _.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;
  259. 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;
  260. 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)})};
  261. _.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)})};
  262. _.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)})};
  263. _.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;
  264. 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;
  265. 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"],
  266. 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);
  267. _.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"),
  268. 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")};
  269. _.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"))};
  270. _.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});
  271. 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};
  272. _.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;
  273. 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;
  274. 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;
  275. _.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)})};
  276. _.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;
  277. _.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;
  278. 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,
  279. 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,
  280. 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,
  281. 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,
  282. 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,{});
  283.  
  284.  
  285. /*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
  286. !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){
  287. 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)),
  288. 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});
  289. ;/*! jQuery UI - v1.11.4 - 2015-05-31
  290. * http://jqueryui.com
  291. * 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
  292. * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
  293.  
  294. (function( factory ) {
  295.     if ( typeof define === "function" && define.amd ) {
  296.  
  297.         // AMD. Register as an anonymous module.
  298.         define([ "jquery" ], factory );
  299.     } else {
  300.  
  301.         // Browser globals
  302.         factory( jQuery );
  303.     }
  304. }(function( $ ) {
  305. /*!
  306.  * jQuery UI Core 1.11.4
  307.  * http://jqueryui.com
  308.  *
  309.  * Copyright jQuery Foundation and other contributors
  310.  * Released under the MIT license.
  311.  * http://jquery.org/license
  312.  *
  313.  * http://api.jqueryui.com/category/ui-core/
  314.  */
  315.  
  316.  
  317. // $.ui might exist from components with no dependencies, e.g., $.ui.position
  318. $.ui = $.ui || {};
  319.  
  320. $.extend( $.ui, {
  321.     version: "1.11.4",
  322.  
  323.     keyCode: {
  324.         BACKSPACE: 8,
  325.         COMMA: 188,
  326.         DELETE: 46,
  327.         DOWN: 40,
  328.         END: 35,
  329.         ENTER: 13,
  330.         ESCAPE: 27,
  331.         HOME: 36,
  332.         LEFT: 37,
  333.         PAGE_DOWN: 34,
  334.         PAGE_UP: 33,
  335.         PERIOD: 190,
  336.         RIGHT: 39,
  337.         SPACE: 32,
  338.         TAB: 9,
  339.         UP: 38
  340.     }
  341. });
  342.  
  343. // plugins
  344. $.fn.extend({
  345.     scrollParent: function( includeHidden ) {
  346.         var position = this.css( "position" ),
  347.             excludeStaticParent = position === "absolute",
  348.             overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  349.             scrollParent = this.parents().filter( function() {
  350.                 var parent = $( this );
  351.                 if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  352.                     return false;
  353.                 }
  354.                 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
  355.             }).eq( 0 );
  356.  
  357.         return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
  358.     },
  359.  
  360.     uniqueId: (function() {
  361.         var uuid = 0;
  362.  
  363.         return function() {
  364.             return this.each(function() {
  365.                 if ( !this.id ) {
  366.                     this.id = "ui-id-" + ( ++uuid );
  367.                 }
  368.             });
  369.         };
  370.     })(),
  371.  
  372.     removeUniqueId: function() {
  373.         return this.each(function() {
  374.             if ( /^ui-id-\d+$/.test( this.id ) ) {
  375.                 $( this ).removeAttr( "id" );
  376.             }
  377.         });
  378.     }
  379. });
  380.  
  381. // selectors
  382. function focusable( element, isTabIndexNotNaN ) {
  383.     var map, mapName, img,
  384.         nodeName = element.nodeName.toLowerCase();
  385.     if ( "area" === nodeName ) {
  386.         map = element.parentNode;
  387.         mapName = map.name;
  388.         if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  389.             return false;
  390.         }
  391.         img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
  392.         return !!img && visible( img );
  393.     }
  394.     return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
  395.         !element.disabled :
  396.         "a" === nodeName ?
  397.             element.href || isTabIndexNotNaN :
  398.             isTabIndexNotNaN) &&
  399.         // the element and all of its ancestors must be visible
  400.         visible( element );
  401. }
  402.  
  403. function visible( element ) {
  404.     return $.expr.filters.visible( element ) &&
  405.         !$( element ).parents().addBack().filter(function() {
  406.             return $.css( this, "visibility" ) === "hidden";
  407.         }).length;
  408. }
  409.  
  410. $.extend( $.expr[ ":" ], {
  411.     data: $.expr.createPseudo ?
  412.         $.expr.createPseudo(function( dataName ) {
  413.             return function( elem ) {
  414.                 return !!$.data( elem, dataName );
  415.             };
  416.         }) :
  417.         // support: jQuery <1.8
  418.         function( elem, i, match ) {
  419.             return !!$.data( elem, match[ 3 ] );
  420.         },
  421.  
  422.     focusable: function( element ) {
  423.         return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
  424.     },
  425.  
  426.     tabbable: function( element ) {
  427.         var tabIndex = $.attr( element, "tabindex" ),
  428.             isTabIndexNaN = isNaN( tabIndex );
  429.         return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
  430.     }
  431. });
  432.  
  433. // support: jQuery <1.8
  434. if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
  435.     $.each( [ "Width", "Height" ], function( i, name ) {
  436.         var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  437.             type = name.toLowerCase(),
  438.             orig = {
  439.                 innerWidth: $.fn.innerWidth,
  440.                 innerHeight: $.fn.innerHeight,
  441.                 outerWidth: $.fn.outerWidth,
  442.                 outerHeight: $.fn.outerHeight
  443.             };
  444.  
  445.         function reduce( elem, size, border, margin ) {
  446.             $.each( side, function() {
  447.                 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  448.                 if ( border ) {
  449.                     size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  450.                 }
  451.                 if ( margin ) {
  452.                     size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  453.                 }
  454.             });
  455.             return size;
  456.         }
  457.  
  458.         $.fn[ "inner" + name ] = function( size ) {
  459.             if ( size === undefined ) {
  460.                 return orig[ "inner" + name ].call( this );
  461.             }
  462.  
  463.             return this.each(function() {
  464.                 $( this ).css( type, reduce( this, size ) + "px" );
  465.             });
  466.         };
  467.  
  468.         $.fn[ "outer" + name] = function( size, margin ) {
  469.             if ( typeof size !== "number" ) {
  470.                 return orig[ "outer" + name ].call( this, size );
  471.             }
  472.  
  473.             return this.each(function() {
  474.                 $( this).css( type, reduce( this, size, true, margin ) + "px" );
  475.             });
  476.         };
  477.     });
  478. }
  479.  
  480. // support: jQuery <1.8
  481. if ( !$.fn.addBack ) {
  482.     $.fn.addBack = function( selector ) {
  483.         return this.add( selector == null ?
  484.             this.prevObject : this.prevObject.filter( selector )
  485.         );
  486.     };
  487. }
  488.  
  489. // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
  490. if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
  491.     $.fn.removeData = (function( removeData ) {
  492.         return function( key ) {
  493.             if ( arguments.length ) {
  494.                 return removeData.call( this, $.camelCase( key ) );
  495.             } else {
  496.                 return removeData.call( this );
  497.             }
  498.         };
  499.     })( $.fn.removeData );
  500. }
  501.  
  502. // deprecated
  503. $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  504.  
  505. $.fn.extend({
  506.     focus: (function( orig ) {
  507.         return function( delay, fn ) {
  508.             return typeof delay === "number" ?
  509.                 this.each(function() {
  510.                     var elem = this;
  511.                     setTimeout(function() {
  512.                         $( elem ).focus();
  513.                         if ( fn ) {
  514.                             fn.call( elem );
  515.                         }
  516.                     }, delay );
  517.                 }) :
  518.                 orig.apply( this, arguments );
  519.         };
  520.     })( $.fn.focus ),
  521.  
  522.     disableSelection: (function() {
  523.         var eventType = "onselectstart" in document.createElement( "div" ) ?
  524.             "selectstart" :
  525.             "mousedown";
  526.  
  527.         return function() {
  528.             return this.bind( eventType + ".ui-disableSelection", function( event ) {
  529.                 event.preventDefault();
  530.             });
  531.         };
  532.     })(),
  533.  
  534.     enableSelection: function() {
  535.         return this.unbind( ".ui-disableSelection" );
  536.     },
  537.  
  538.     zIndex: function( zIndex ) {
  539.         if ( zIndex !== undefined ) {
  540.             return this.css( "zIndex", zIndex );
  541.         }
  542.  
  543.         if ( this.length ) {
  544.             var elem = $( this[ 0 ] ), position, value;
  545.             while ( elem.length && elem[ 0 ] !== document ) {
  546.                 // Ignore z-index if position is set to a value where z-index is ignored by the browser
  547.                 // This makes behavior of this function consistent across browsers
  548.                 // WebKit always returns auto if the element is positioned
  549.                 position = elem.css( "position" );
  550.                 if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  551.                     // IE returns 0 when zIndex is not specified
  552.                     // other browsers return a string
  553.                     // we ignore the case of nested elements with an explicit value of 0
  554.                     // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  555.                     value = parseInt( elem.css( "zIndex" ), 10 );
  556.                     if ( !isNaN( value ) && value !== 0 ) {
  557.                         return value;
  558.                     }
  559.                 }
  560.                 elem = elem.parent();
  561.             }
  562.         }
  563.  
  564.         return 0;
  565.     }
  566. });
  567.  
  568. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  569. $.ui.plugin = {
  570.     add: function( module, option, set ) {
  571.         var i,
  572.             proto = $.ui[ module ].prototype;
  573.         for ( i in set ) {
  574.             proto.plugins[ i ] = proto.plugins[ i ] || [];
  575.             proto.plugins[ i ].push( [ option, set[ i ] ] );
  576.         }
  577.     },
  578.     call: function( instance, name, args, allowDisconnected ) {
  579.         var i,
  580.             set = instance.plugins[ name ];
  581.  
  582.         if ( !set ) {
  583.             return;
  584.         }
  585.  
  586.         if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  587.             return;
  588.         }
  589.  
  590.         for ( i = 0; i < set.length; i++ ) {
  591.             if ( instance.options[ set[ i ][ 0 ] ] ) {
  592.                 set[ i ][ 1 ].apply( instance.element, args );
  593.             }
  594.         }
  595.     }
  596. };
  597.  
  598.  
  599. /*!
  600.  * jQuery UI Widget 1.11.4
  601.  * http://jqueryui.com
  602.  *
  603.  * Copyright jQuery Foundation and other contributors
  604.  * Released under the MIT license.
  605.  * http://jquery.org/license
  606.  *
  607.  * http://api.jqueryui.com/jQuery.widget/
  608.  */
  609.  
  610.  
  611. var widget_uuid = 0,
  612.     widget_slice = Array.prototype.slice;
  613.  
  614. $.cleanData = (function( orig ) {
  615.     return function( elems ) {
  616.         var events, elem, i;
  617.         for ( i = 0; (elem = elems[i]) != null; i++ ) {
  618.             try {
  619.  
  620.                 // Only trigger remove when necessary to save time
  621.                 events = $._data( elem, "events" );
  622.                 if ( events && events.remove ) {
  623.                     $( elem ).triggerHandler( "remove" );
  624.                 }
  625.  
  626.             // http://bugs.jquery.com/ticket/8235
  627.             } catch ( e ) {}
  628.         }
  629.         orig( elems );
  630.     };
  631. })( $.cleanData );
  632.  
  633. $.widget = function( name, base, prototype ) {
  634.     var fullName, existingConstructor, constructor, basePrototype,
  635.         // proxiedPrototype allows the provided prototype to remain unmodified
  636.         // so that it can be used as a mixin for multiple widgets (#8876)
  637.         proxiedPrototype = {},
  638.         namespace = name.split( "." )[ 0 ];
  639.  
  640.     name = name.split( "." )[ 1 ];
  641.     fullName = namespace + "-" + name;
  642.  
  643.     if ( !prototype ) {
  644.         prototype = base;
  645.         base = $.Widget;
  646.     }
  647.  
  648.     // create selector for plugin
  649.     $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  650.         return !!$.data( elem, fullName );
  651.     };
  652.  
  653.     $[ namespace ] = $[ namespace ] || {};
  654.     existingConstructor = $[ namespace ][ name ];
  655.     constructor = $[ namespace ][ name ] = function( options, element ) {
  656.         // allow instantiation without "new" keyword
  657.         if ( !this._createWidget ) {
  658.             return new constructor( options, element );
  659.         }
  660.  
  661.         // allow instantiation without initializing for simple inheritance
  662.         // must use "new" keyword (the code above always passes args)
  663.         if ( arguments.length ) {
  664.             this._createWidget( options, element );
  665.         }
  666.     };
  667.     // extend with the existing constructor to carry over any static properties
  668.     $.extend( constructor, existingConstructor, {
  669.         version: prototype.version,
  670.         // copy the object used to create the prototype in case we need to
  671.         // redefine the widget later
  672.         _proto: $.extend( {}, prototype ),
  673.         // track widgets that inherit from this widget in case this widget is
  674.         // redefined after a widget inherits from it
  675.         _childConstructors: []
  676.     });
  677.  
  678.     basePrototype = new base();
  679.     // we need to make the options hash a property directly on the new instance
  680.     // otherwise we'll modify the options hash on the prototype that we're
  681.     // inheriting from
  682.     basePrototype.options = $.widget.extend( {}, basePrototype.options );
  683.     $.each( prototype, function( prop, value ) {
  684.         if ( !$.isFunction( value ) ) {
  685.             proxiedPrototype[ prop ] = value;
  686.             return;
  687.         }
  688.         proxiedPrototype[ prop ] = (function() {
  689.             var _super = function() {
  690.                     return base.prototype[ prop ].apply( this, arguments );
  691.                 },
  692.                 _superApply = function( args ) {
  693.                     return base.prototype[ prop ].apply( this, args );
  694.                 };
  695.             return function() {
  696.                 var __super = this._super,
  697.                     __superApply = this._superApply,
  698.                     returnValue;
  699.  
  700.                 this._super = _super;
  701.                 this._superApply = _superApply;
  702.  
  703.                 returnValue = value.apply( this, arguments );
  704.  
  705.                 this._super = __super;
  706.                 this._superApply = __superApply;
  707.  
  708.                 return returnValue;
  709.             };
  710.         })();
  711.     });
  712.     constructor.prototype = $.widget.extend( basePrototype, {
  713.         // TODO: remove support for widgetEventPrefix
  714.         // always use the name + a colon as the prefix, e.g., draggable:start
  715.         // don't prefix for widgets that aren't DOM-based
  716.         widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  717.     }, proxiedPrototype, {
  718.         constructor: constructor,
  719.         namespace: namespace,
  720.         widgetName: name,
  721.         widgetFullName: fullName
  722.     });
  723.  
  724.     // If this widget is being redefined then we need to find all widgets that
  725.     // are inheriting from it and redefine all of them so that they inherit from
  726.     // the new version of this widget. We're essentially trying to replace one
  727.     // level in the prototype chain.
  728.     if ( existingConstructor ) {
  729.         $.each( existingConstructor._childConstructors, function( i, child ) {
  730.             var childPrototype = child.prototype;
  731.  
  732.             // redefine the child widget using the same prototype that was
  733.             // originally used, but inherit from the new version of the base
  734.             $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
  735.         });
  736.         // remove the list of existing child constructors from the old constructor
  737.         // so the old child constructors can be garbage collected
  738.         delete existingConstructor._childConstructors;
  739.     } else {
  740.         base._childConstructors.push( constructor );
  741.     }
  742.  
  743.     $.widget.bridge( name, constructor );
  744.  
  745.     return constructor;
  746. };
  747.  
  748. $.widget.extend = function( target ) {
  749.     var input = widget_slice.call( arguments, 1 ),
  750.         inputIndex = 0,
  751.         inputLength = input.length,
  752.         key,
  753.         value;
  754.     for ( ; inputIndex < inputLength; inputIndex++ ) {
  755.         for ( key in input[ inputIndex ] ) {
  756.             value = input[ inputIndex ][ key ];
  757.             if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  758.                 // Clone objects
  759.                 if ( $.isPlainObject( value ) ) {
  760.                     target[ key ] = $.isPlainObject( target[ key ] ) ?
  761.                         $.widget.extend( {}, target[ key ], value ) :
  762.                         // Don't extend strings, arrays, etc. with objects
  763.                         $.widget.extend( {}, value );
  764.                 // Copy everything else by reference
  765.                 } else {
  766.                     target[ key ] = value;
  767.                 }
  768.             }
  769.         }
  770.     }
  771.     return target;
  772. };
  773.  
  774. $.widget.bridge = function( name, object ) {
  775.     var fullName = object.prototype.widgetFullName || name;
  776.     $.fn[ name ] = function( options ) {
  777.         var isMethodCall = typeof options === "string",
  778.             args = widget_slice.call( arguments, 1 ),
  779.             returnValue = this;
  780.  
  781.         if ( isMethodCall ) {
  782.             this.each(function() {
  783.                 var methodValue,
  784.                     instance = $.data( this, fullName );
  785.                 if ( options === "instance" ) {
  786.                     returnValue = instance;
  787.                     return false;
  788.                 }
  789.                 if ( !instance ) {
  790.                     return $.error( "cannot call methods on " + name + " prior to initialization; " +
  791.                         "attempted to call method '" + options + "'" );
  792.                 }
  793.                 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
  794.                     return $.error( "no such method '" + options + "' for " + name + " widget instance" );
  795.                 }
  796.                 methodValue = instance[ options ].apply( instance, args );
  797.                 if ( methodValue !== instance && methodValue !== undefined ) {
  798.                     returnValue = methodValue && methodValue.jquery ?
  799.                         returnValue.pushStack( methodValue.get() ) :
  800.                         methodValue;
  801.                     return false;
  802.                 }
  803.             });
  804.         } else {
  805.  
  806.             // Allow multiple hashes to be passed on init
  807.             if ( args.length ) {
  808.                 options = $.widget.extend.apply( null, [ options ].concat(args) );
  809.             }
  810.  
  811.             this.each(function() {
  812.                 var instance = $.data( this, fullName );
  813.                 if ( instance ) {
  814.                     instance.option( options || {} );
  815.                     if ( instance._init ) {
  816.                         instance._init();
  817.                     }
  818.                 } else {
  819.                     $.data( this, fullName, new object( options, this ) );
  820.                 }
  821.             });
  822.         }
  823.  
  824.         return returnValue;
  825.     };
  826. };
  827.  
  828. $.Widget = function( /* options, element */ ) {};
  829. $.Widget._childConstructors = [];
  830.  
  831. $.Widget.prototype = {
  832.     widgetName: "widget",
  833.     widgetEventPrefix: "",
  834.     defaultElement: "<div>",
  835.     options: {
  836.         disabled: false,
  837.  
  838.         // callbacks
  839.         create: null
  840.     },
  841.     _createWidget: function( options, element ) {
  842.         element = $( element || this.defaultElement || this )[ 0 ];
  843.         this.element = $( element );
  844.         this.uuid = widget_uuid++;
  845.         this.eventNamespace = "." + this.widgetName + this.uuid;
  846.  
  847.         this.bindings = $();
  848.         this.hoverable = $();
  849.         this.focusable = $();
  850.  
  851.         if ( element !== this ) {
  852.             $.data( element, this.widgetFullName, this );
  853.             this._on( true, this.element, {
  854.                 remove: function( event ) {
  855.                     if ( event.target === element ) {
  856.                         this.destroy();
  857.                     }
  858.                 }
  859.             });
  860.             this.document = $( element.style ?
  861.                 // element within the document
  862.                 element.ownerDocument :
  863.                 // element is window or document
  864.                 element.document || element );
  865.             this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
  866.         }
  867.  
  868.         this.options = $.widget.extend( {},
  869.             this.options,
  870.             this._getCreateOptions(),
  871.             options );
  872.  
  873.         this._create();
  874.         this._trigger( "create", null, this._getCreateEventData() );
  875.         this._init();
  876.     },
  877.     _getCreateOptions: $.noop,
  878.     _getCreateEventData: $.noop,
  879.     _create: $.noop,
  880.     _init: $.noop,
  881.  
  882.     destroy: function() {
  883.         this._destroy();
  884.         // we can probably remove the unbind calls in 2.0
  885.         // all event bindings should go through this._on()
  886.         this.element
  887.             .unbind( this.eventNamespace )
  888.             .removeData( this.widgetFullName )
  889.             // support: jquery <1.6.3
  890.             // http://bugs.jquery.com/ticket/9413
  891.             .removeData( $.camelCase( this.widgetFullName ) );
  892.         this.widget()
  893.             .unbind( this.eventNamespace )
  894.             .removeAttr( "aria-disabled" )
  895.             .removeClass(
  896.                 this.widgetFullName + "-disabled " +
  897.                 "ui-state-disabled" );
  898.  
  899.         // clean up events and states
  900.         this.bindings.unbind( this.eventNamespace );
  901.         this.hoverable.removeClass( "ui-state-hover" );
  902.         this.focusable.removeClass( "ui-state-focus" );
  903.     },
  904.     _destroy: $.noop,
  905.  
  906.     widget: function() {
  907.         return this.element;
  908.     },
  909.  
  910.     option: function( key, value ) {
  911.         var options = key,
  912.             parts,
  913.             curOption,
  914.             i;
  915.  
  916.         if ( arguments.length === 0 ) {
  917.             // don't return a reference to the internal hash
  918.             return $.widget.extend( {}, this.options );
  919.         }
  920.  
  921.         if ( typeof key === "string" ) {
  922.             // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  923.             options = {};
  924.             parts = key.split( "." );
  925.             key = parts.shift();
  926.             if ( parts.length ) {
  927.                 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  928.                 for ( i = 0; i < parts.length - 1; i++ ) {
  929.                     curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  930.                     curOption = curOption[ parts[ i ] ];
  931.                 }
  932.                 key = parts.pop();
  933.                 if ( arguments.length === 1 ) {
  934.                     return curOption[ key ] === undefined ? null : curOption[ key ];
  935.                 }
  936.                 curOption[ key ] = value;
  937.             } else {
  938.                 if ( arguments.length === 1 ) {
  939.                     return this.options[ key ] === undefined ? null : this.options[ key ];
  940.                 }
  941.                 options[ key ] = value;
  942.             }
  943.         }
  944.  
  945.         this._setOptions( options );
  946.  
  947.         return this;
  948.     },
  949.     _setOptions: function( options ) {
  950.         var key;
  951.  
  952.         for ( key in options ) {
  953.             this._setOption( key, options[ key ] );
  954.         }
  955.  
  956.         return this;
  957.     },
  958.     _setOption: function( key, value ) {
  959.         this.options[ key ] = value;
  960.  
  961.         if ( key === "disabled" ) {
  962.             this.widget()
  963.                 .toggleClass( this.widgetFullName + "-disabled", !!value );
  964.  
  965.             // If the widget is becoming disabled, then nothing is interactive
  966.             if ( value ) {
  967.                 this.hoverable.removeClass( "ui-state-hover" );
  968.                 this.focusable.removeClass( "ui-state-focus" );
  969.             }
  970.         }
  971.  
  972.         return this;
  973.     },
  974.  
  975.     enable: function() {
  976.         return this._setOptions({ disabled: false });
  977.     },
  978.     disable: function() {
  979.         return this._setOptions({ disabled: true });
  980.     },
  981.  
  982.     _on: function( suppressDisabledCheck, element, handlers ) {
  983.         var delegateElement,
  984.             instance = this;
  985.  
  986.         // no suppressDisabledCheck flag, shuffle arguments
  987.         if ( typeof suppressDisabledCheck !== "boolean" ) {
  988.             handlers = element;
  989.             element = suppressDisabledCheck;
  990.             suppressDisabledCheck = false;
  991.         }
  992.  
  993.         // no element argument, shuffle and use this.element
  994.         if ( !handlers ) {
  995.             handlers = element;
  996.             element = this.element;
  997.             delegateElement = this.widget();
  998.         } else {
  999.             element = delegateElement = $( element );
  1000.             this.bindings = this.bindings.add( element );
  1001.         }
  1002.  
  1003.         $.each( handlers, function( event, handler ) {
  1004.             function handlerProxy() {
  1005.                 // allow widgets to customize the disabled handling
  1006.                 // - disabled as an array instead of boolean
  1007.                 // - disabled class as method for disabling individual parts
  1008.                 if ( !suppressDisabledCheck &&
  1009.                         ( instance.options.disabled === true ||
  1010.                             $( this ).hasClass( "ui-state-disabled" ) ) ) {
  1011.                     return;
  1012.                 }
  1013.                 return ( typeof handler === "string" ? instance[ handler ] : handler )
  1014.                     .apply( instance, arguments );
  1015.             }
  1016.  
  1017.             // copy the guid so direct unbinding works
  1018.             if ( typeof handler !== "string" ) {
  1019.                 handlerProxy.guid = handler.guid =
  1020.                     handler.guid || handlerProxy.guid || $.guid++;
  1021.             }
  1022.  
  1023.             var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
  1024.                 eventName = match[1] + instance.eventNamespace,
  1025.                 selector = match[2];
  1026.             if ( selector ) {
  1027.                 delegateElement.delegate( selector, eventName, handlerProxy );
  1028.             } else {
  1029.                 element.bind( eventName, handlerProxy );
  1030.             }
  1031.         });
  1032.     },
  1033.  
  1034.     _off: function( element, eventName ) {
  1035.         eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
  1036.             this.eventNamespace;
  1037.         element.unbind( eventName ).undelegate( eventName );
  1038.  
  1039.         // Clear the stack to avoid memory leaks (#10056)
  1040.         this.bindings = $( this.bindings.not( element ).get() );
  1041.         this.focusable = $( this.focusable.not( element ).get() );
  1042.         this.hoverable = $( this.hoverable.not( element ).get() );
  1043.     },
  1044.  
  1045.     _delay: function( handler, delay ) {
  1046.         function handlerProxy() {
  1047.             return ( typeof handler === "string" ? instance[ handler ] : handler )
  1048.                 .apply( instance, arguments );
  1049.         }
  1050.         var instance = this;
  1051.         return setTimeout( handlerProxy, delay || 0 );
  1052.     },
  1053.  
  1054.     _hoverable: function( element ) {
  1055.         this.hoverable = this.hoverable.add( element );
  1056.         this._on( element, {
  1057.             mouseenter: function( event ) {
  1058.                 $( event.currentTarget ).addClass( "ui-state-hover" );
  1059.             },
  1060.             mouseleave: function( event ) {
  1061.                 $( event.currentTarget ).removeClass( "ui-state-hover" );
  1062.             }
  1063.         });
  1064.     },
  1065.  
  1066.     _focusable: function( element ) {
  1067.         this.focusable = this.focusable.add( element );
  1068.         this._on( element, {
  1069.             focusin: function( event ) {
  1070.                 $( event.currentTarget ).addClass( "ui-state-focus" );
  1071.             },
  1072.             focusout: function( event ) {
  1073.                 $( event.currentTarget ).removeClass( "ui-state-focus" );
  1074.             }
  1075.         });
  1076.     },
  1077.  
  1078.     _trigger: function( type, event, data ) {
  1079.         var prop, orig,
  1080.             callback = this.options[ type ];
  1081.  
  1082.         data = data || {};
  1083.         event = $.Event( event );
  1084.         event.type = ( type === this.widgetEventPrefix ?
  1085.             type :
  1086.             this.widgetEventPrefix + type ).toLowerCase();
  1087.         // the original event may come from any element
  1088.         // so we need to reset the target on the new event
  1089.         event.target = this.element[ 0 ];
  1090.  
  1091.         // copy original event properties over to the new event
  1092.         orig = event.originalEvent;
  1093.         if ( orig ) {
  1094.             for ( prop in orig ) {
  1095.                 if ( !( prop in event ) ) {
  1096.                     event[ prop ] = orig[ prop ];
  1097.                 }
  1098.             }
  1099.         }
  1100.  
  1101.         this.element.trigger( event, data );
  1102.         return !( $.isFunction( callback ) &&
  1103.             callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
  1104.             event.isDefaultPrevented() );
  1105.     }
  1106. };
  1107.  
  1108. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  1109.     $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  1110.         if ( typeof options === "string" ) {
  1111.             options = { effect: options };
  1112.         }
  1113.         var hasOptions,
  1114.             effectName = !options ?
  1115.                 method :
  1116.                 options === true || typeof options === "number" ?
  1117.                     defaultEffect :
  1118.                     options.effect || defaultEffect;
  1119.         options = options || {};
  1120.         if ( typeof options === "number" ) {
  1121.             options = { duration: options };
  1122.         }
  1123.         hasOptions = !$.isEmptyObject( options );
  1124.         options.complete = callback;
  1125.         if ( options.delay ) {
  1126.             element.delay( options.delay );
  1127.         }
  1128.         if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  1129.             element[ method ]( options );
  1130.         } else if ( effectName !== method && element[ effectName ] ) {
  1131.             element[ effectName ]( options.duration, options.easing, callback );
  1132.         } else {
  1133.             element.queue(function( next ) {
  1134.                 $( this )[ method ]();
  1135.                 if ( callback ) {
  1136.                     callback.call( element[ 0 ] );
  1137.                 }
  1138.                 next();
  1139.             });
  1140.         }
  1141.     };
  1142. });
  1143.  
  1144. var widget = $.widget;
  1145.  
  1146.  
  1147. /*!
  1148.  * jQuery UI Mouse 1.11.4
  1149.  * http://jqueryui.com
  1150.  *
  1151.  * Copyright jQuery Foundation and other contributors
  1152.  * Released under the MIT license.
  1153.  * http://jquery.org/license
  1154.  *
  1155.  * http://api.jqueryui.com/mouse/
  1156.  */
  1157.  
  1158.  
  1159. var mouseHandled = false;
  1160. $( document ).mouseup( function() {
  1161.     mouseHandled = false;
  1162. });
  1163.  
  1164. var mouse = $.widget("ui.mouse", {
  1165.     version: "1.11.4",
  1166.     options: {
  1167.         cancel: "input,textarea,button,select,option",
  1168.         distance: 1,
  1169.         delay: 0
  1170.     },
  1171.     _mouseInit: function() {
  1172.         var that = this;
  1173.  
  1174.         this.element
  1175.             .bind("mousedown." + this.widgetName, function(event) {
  1176.                 return that._mouseDown(event);
  1177.             })
  1178.             .bind("click." + this.widgetName, function(event) {
  1179.                 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  1180.                     $.removeData(event.target, that.widgetName + ".preventClickEvent");
  1181.                     event.stopImmediatePropagation();
  1182.                     return false;
  1183.                 }
  1184.             });
  1185.  
  1186.         this.started = false;
  1187.     },
  1188.  
  1189.     // TODO: make sure destroying one instance of mouse doesn't mess with
  1190.     // other instances of mouse
  1191.     _mouseDestroy: function() {
  1192.         this.element.unbind("." + this.widgetName);
  1193.         if ( this._mouseMoveDelegate ) {
  1194.             this.document
  1195.                 .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
  1196.                 .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
  1197.         }
  1198.     },
  1199.  
  1200.     _mouseDown: function(event) {
  1201.         // don't let more than one widget handle mouseStart
  1202.         if ( mouseHandled ) {
  1203.             return;
  1204.         }
  1205.  
  1206.         this._mouseMoved = false;
  1207.  
  1208.         // we may have missed mouseup (out of window)
  1209.         (this._mouseStarted && this._mouseUp(event));
  1210.  
  1211.         this._mouseDownEvent = event;
  1212.  
  1213.         var that = this,
  1214.             btnIsLeft = (event.which === 1),
  1215.             // event.target.nodeName works around a bug in IE 8 with
  1216.             // disabled inputs (#7620)
  1217.             elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  1218.         if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  1219.             return true;
  1220.         }
  1221.  
  1222.         this.mouseDelayMet = !this.options.delay;
  1223.         if (!this.mouseDelayMet) {
  1224.             this._mouseDelayTimer = setTimeout(function() {
  1225.                 that.mouseDelayMet = true;
  1226.             }, this.options.delay);
  1227.         }
  1228.  
  1229.         if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  1230.             this._mouseStarted = (this._mouseStart(event) !== false);
  1231.             if (!this._mouseStarted) {
  1232.                 event.preventDefault();
  1233.                 return true;
  1234.             }
  1235.         }
  1236.  
  1237.         // Click event may never have fired (Gecko & Opera)
  1238.         if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  1239.             $.removeData(event.target, this.widgetName + ".preventClickEvent");
  1240.         }
  1241.  
  1242.         // these delegates are required to keep context
  1243.         this._mouseMoveDelegate = function(event) {
  1244.             return that._mouseMove(event);
  1245.         };
  1246.         this._mouseUpDelegate = function(event) {
  1247.             return that._mouseUp(event);
  1248.         };
  1249.  
  1250.         this.document
  1251.             .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1252.             .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1253.  
  1254.         event.preventDefault();
  1255.  
  1256.         mouseHandled = true;
  1257.         return true;
  1258.     },
  1259.  
  1260.     _mouseMove: function(event) {
  1261.         // Only check for mouseups outside the document if you've moved inside the document
  1262.         // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  1263.         // fire a mousemove event if content is placed under the cursor. See #7778
  1264.         // Support: IE <9
  1265.         if ( this._mouseMoved ) {
  1266.             // IE mouseup check - mouseup happened when mouse was out of window
  1267.             if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
  1268.                 return this._mouseUp(event);
  1269.  
  1270.             // Iframe mouseup check - mouseup occurred in another document
  1271.             } else if ( !event.which ) {
  1272.                 return this._mouseUp( event );
  1273.             }
  1274.         }
  1275.  
  1276.         if ( event.which || event.button ) {
  1277.             this._mouseMoved = true;
  1278.         }
  1279.  
  1280.         if (this._mouseStarted) {
  1281.             this._mouseDrag(event);
  1282.             return event.preventDefault();
  1283.         }
  1284.  
  1285.         if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  1286.             this._mouseStarted =
  1287.                 (this._mouseStart(this._mouseDownEvent, event) !== false);
  1288.             (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  1289.         }
  1290.  
  1291.         return !this._mouseStarted;
  1292.     },
  1293.  
  1294.     _mouseUp: function(event) {
  1295.         this.document
  1296.             .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1297.             .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1298.  
  1299.         if (this._mouseStarted) {
  1300.             this._mouseStarted = false;
  1301.  
  1302.             if (event.target === this._mouseDownEvent.target) {
  1303.                 $.data(event.target, this.widgetName + ".preventClickEvent", true);
  1304.             }
  1305.  
  1306.             this._mouseStop(event);
  1307.         }
  1308.  
  1309.         mouseHandled = false;
  1310.         return false;
  1311.     },
  1312.  
  1313.     _mouseDistanceMet: function(event) {
  1314.         return (Math.max(
  1315.                 Math.abs(this._mouseDownEvent.pageX - event.pageX),
  1316.                 Math.abs(this._mouseDownEvent.pageY - event.pageY)
  1317.             ) >= this.options.distance
  1318.         );
  1319.     },
  1320.  
  1321.     _mouseDelayMet: function(/* event */) {
  1322.         return this.mouseDelayMet;
  1323.     },
  1324.  
  1325.     // These are placeholder methods, to be overriden by extending plugin
  1326.     _mouseStart: function(/* event */) {},
  1327.     _mouseDrag: function(/* event */) {},
  1328.     _mouseStop: function(/* event */) {},
  1329.     _mouseCapture: function(/* event */) { return true; }
  1330. });
  1331.  
  1332.  
  1333. /*!
  1334.  * jQuery UI Position 1.11.4
  1335.  * http://jqueryui.com
  1336.  *
  1337.  * Copyright jQuery Foundation and other contributors
  1338.  * Released under the MIT license.
  1339.  * http://jquery.org/license
  1340.  *
  1341.  * http://api.jqueryui.com/position/
  1342.  */
  1343.  
  1344. (function() {
  1345.  
  1346. $.ui = $.ui || {};
  1347.  
  1348. var cachedScrollbarWidth, supportsOffsetFractions,
  1349.     max = Math.max,
  1350.     abs = Math.abs,
  1351.     round = Math.round,
  1352.     rhorizontal = /left|center|right/,
  1353.     rvertical = /top|center|bottom/,
  1354.     roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  1355.     rposition = /^\w+/,
  1356.     rpercent = /%$/,
  1357.     _position = $.fn.position;
  1358.  
  1359. function getOffsets( offsets, width, height ) {
  1360.     return [
  1361.         parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  1362.         parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  1363.     ];
  1364. }
  1365.  
  1366. function parseCss( element, property ) {
  1367.     return parseInt( $.css( element, property ), 10 ) || 0;
  1368. }
  1369.  
  1370. function getDimensions( elem ) {
  1371.     var raw = elem[0];
  1372.     if ( raw.nodeType === 9 ) {
  1373.         return {
  1374.             width: elem.width(),
  1375.             height: elem.height(),
  1376.             offset: { top: 0, left: 0 }
  1377.         };
  1378.     }
  1379.     if ( $.isWindow( raw ) ) {
  1380.         return {
  1381.             width: elem.width(),
  1382.             height: elem.height(),
  1383.             offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  1384.         };
  1385.     }
  1386.     if ( raw.preventDefault ) {
  1387.         return {
  1388.             width: 0,
  1389.             height: 0,
  1390.             offset: { top: raw.pageY, left: raw.pageX }
  1391.         };
  1392.     }
  1393.     return {
  1394.         width: elem.outerWidth(),
  1395.         height: elem.outerHeight(),
  1396.         offset: elem.offset()
  1397.     };
  1398. }
  1399.  
  1400. $.position = {
  1401.     scrollbarWidth: function() {
  1402.         if ( cachedScrollbarWidth !== undefined ) {
  1403.             return cachedScrollbarWidth;
  1404.         }
  1405.         var w1, w2,
  1406.             div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
  1407.             innerDiv = div.children()[0];
  1408.  
  1409.         $( "body" ).append( div );
  1410.         w1 = innerDiv.offsetWidth;
  1411.         div.css( "overflow", "scroll" );
  1412.  
  1413.         w2 = innerDiv.offsetWidth;
  1414.  
  1415.         if ( w1 === w2 ) {
  1416.             w2 = div[0].clientWidth;
  1417.         }
  1418.  
  1419.         div.remove();
  1420.  
  1421.         return (cachedScrollbarWidth = w1 - w2);
  1422.     },
  1423.     getScrollInfo: function( within ) {
  1424.         var overflowX = within.isWindow || within.isDocument ? "" :
  1425.                 within.element.css( "overflow-x" ),
  1426.             overflowY = within.isWindow || within.isDocument ? "" :
  1427.                 within.element.css( "overflow-y" ),
  1428.             hasOverflowX = overflowX === "scroll" ||
  1429.                 ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
  1430.             hasOverflowY = overflowY === "scroll" ||
  1431.                 ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
  1432.         return {
  1433.             width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  1434.             height: hasOverflowX ? $.position.scrollbarWidth() : 0
  1435.         };
  1436.     },
  1437.     getWithinInfo: function( element ) {
  1438.         var withinElement = $( element || window ),
  1439.             isWindow = $.isWindow( withinElement[0] ),
  1440.             isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
  1441.         return {
  1442.             element: withinElement,
  1443.             isWindow: isWindow,
  1444.             isDocument: isDocument,
  1445.             offset: withinElement.offset() || { left: 0, top: 0 },
  1446.             scrollLeft: withinElement.scrollLeft(),
  1447.             scrollTop: withinElement.scrollTop(),
  1448.  
  1449.             // support: jQuery 1.6.x
  1450.             // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
  1451.             width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
  1452.             height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
  1453.         };
  1454.     }
  1455. };
  1456.  
  1457. $.fn.position = function( options ) {
  1458.     if ( !options || !options.of ) {
  1459.         return _position.apply( this, arguments );
  1460.     }
  1461.  
  1462.     // make a copy, we don't want to modify arguments
  1463.     options = $.extend( {}, options );
  1464.  
  1465.     var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  1466.         target = $( options.of ),
  1467.         within = $.position.getWithinInfo( options.within ),
  1468.         scrollInfo = $.position.getScrollInfo( within ),
  1469.         collision = ( options.collision || "flip" ).split( " " ),
  1470.         offsets = {};
  1471.  
  1472.     dimensions = getDimensions( target );
  1473.     if ( target[0].preventDefault ) {
  1474.         // force left top to allow flipping
  1475.         options.at = "left top";
  1476.     }
  1477.     targetWidth = dimensions.width;
  1478.     targetHeight = dimensions.height;
  1479.     targetOffset = dimensions.offset;
  1480.     // clone to reuse original targetOffset later
  1481.     basePosition = $.extend( {}, targetOffset );
  1482.  
  1483.     // force my and at to have valid horizontal and vertical positions
  1484.     // if a value is missing or invalid, it will be converted to center
  1485.     $.each( [ "my", "at" ], function() {
  1486.         var pos = ( options[ this ] || "" ).split( " " ),
  1487.             horizontalOffset,
  1488.             verticalOffset;
  1489.  
  1490.         if ( pos.length === 1) {
  1491.             pos = rhorizontal.test( pos[ 0 ] ) ?
  1492.                 pos.concat( [ "center" ] ) :
  1493.                 rvertical.test( pos[ 0 ] ) ?
  1494.                     [ "center" ].concat( pos ) :
  1495.                     [ "center", "center" ];
  1496.         }
  1497.         pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  1498.         pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  1499.  
  1500.         // calculate offsets
  1501.         horizontalOffset = roffset.exec( pos[ 0 ] );
  1502.         verticalOffset = roffset.exec( pos[ 1 ] );
  1503.         offsets[ this ] = [
  1504.             horizontalOffset ? horizontalOffset[ 0 ] : 0,
  1505.             verticalOffset ? verticalOffset[ 0 ] : 0
  1506.         ];
  1507.  
  1508.         // reduce to just the positions without the offsets
  1509.         options[ this ] = [
  1510.             rposition.exec( pos[ 0 ] )[ 0 ],
  1511.             rposition.exec( pos[ 1 ] )[ 0 ]
  1512.         ];
  1513.     });
  1514.  
  1515.     // normalize collision option
  1516.     if ( collision.length === 1 ) {
  1517.         collision[ 1 ] = collision[ 0 ];
  1518.     }
  1519.  
  1520.     if ( options.at[ 0 ] === "right" ) {
  1521.         basePosition.left += targetWidth;
  1522.     } else if ( options.at[ 0 ] === "center" ) {
  1523.         basePosition.left += targetWidth / 2;
  1524.     }
  1525.  
  1526.     if ( options.at[ 1 ] === "bottom" ) {
  1527.         basePosition.top += targetHeight;
  1528.     } else if ( options.at[ 1 ] === "center" ) {
  1529.         basePosition.top += targetHeight / 2;
  1530.     }
  1531.  
  1532.     atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  1533.     basePosition.left += atOffset[ 0 ];
  1534.     basePosition.top += atOffset[ 1 ];
  1535.  
  1536.     return this.each(function() {
  1537.         var collisionPosition, using,
  1538.             elem = $( this ),
  1539.             elemWidth = elem.outerWidth(),
  1540.             elemHeight = elem.outerHeight(),
  1541.             marginLeft = parseCss( this, "marginLeft" ),
  1542.             marginTop = parseCss( this, "marginTop" ),
  1543.             collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
  1544.             collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
  1545.             position = $.extend( {}, basePosition ),
  1546.             myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  1547.  
  1548.         if ( options.my[ 0 ] === "right" ) {
  1549.             position.left -= elemWidth;
  1550.         } else if ( options.my[ 0 ] === "center" ) {
  1551.             position.left -= elemWidth / 2;
  1552.         }
  1553.  
  1554.         if ( options.my[ 1 ] === "bottom" ) {
  1555.             position.top -= elemHeight;
  1556.         } else if ( options.my[ 1 ] === "center" ) {
  1557.             position.top -= elemHeight / 2;
  1558.         }
  1559.  
  1560.         position.left += myOffset[ 0 ];
  1561.         position.top += myOffset[ 1 ];
  1562.  
  1563.         // if the browser doesn't support fractions, then round for consistent results
  1564.         if ( !supportsOffsetFractions ) {
  1565.             position.left = round( position.left );
  1566.             position.top = round( position.top );
  1567.         }
  1568.  
  1569.         collisionPosition = {
  1570.             marginLeft: marginLeft,
  1571.             marginTop: marginTop
  1572.         };
  1573.  
  1574.         $.each( [ "left", "top" ], function( i, dir ) {
  1575.             if ( $.ui.position[ collision[ i ] ] ) {
  1576.                 $.ui.position[ collision[ i ] ][ dir ]( position, {
  1577.                     targetWidth: targetWidth,
  1578.                     targetHeight: targetHeight,
  1579.                     elemWidth: elemWidth,
  1580.                     elemHeight: elemHeight,
  1581.                     collisionPosition: collisionPosition,
  1582.                     collisionWidth: collisionWidth,
  1583.                     collisionHeight: collisionHeight,
  1584.                     offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  1585.                     my: options.my,
  1586.                     at: options.at,
  1587.                     within: within,
  1588.                     elem: elem
  1589.                 });
  1590.             }
  1591.         });
  1592.  
  1593.         if ( options.using ) {
  1594.             // adds feedback as second argument to using callback, if present
  1595.             using = function( props ) {
  1596.                 var left = targetOffset.left - position.left,
  1597.                     right = left + targetWidth - elemWidth,
  1598.                     top = targetOffset.top - position.top,
  1599.                     bottom = top + targetHeight - elemHeight,
  1600.                     feedback = {
  1601.                         target: {
  1602.                             element: target,
  1603.                             left: targetOffset.left,
  1604.                             top: targetOffset.top,
  1605.                             width: targetWidth,
  1606.                             height: targetHeight
  1607.                         },
  1608.                         element: {
  1609.                             element: elem,
  1610.                             left: position.left,
  1611.                             top: position.top,
  1612.                             width: elemWidth,
  1613.                             height: elemHeight
  1614.                         },
  1615.                         horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  1616.                         vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  1617.                     };
  1618.                 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  1619.                     feedback.horizontal = "center";
  1620.                 }
  1621.                 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  1622.                     feedback.vertical = "middle";
  1623.                 }
  1624.                 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  1625.                     feedback.important = "horizontal";
  1626.                 } else {
  1627.                     feedback.important = "vertical";
  1628.                 }
  1629.                 options.using.call( this, props, feedback );
  1630.             };
  1631.         }
  1632.  
  1633.         elem.offset( $.extend( position, { using: using } ) );
  1634.     });
  1635. };
  1636.  
  1637. $.ui.position = {
  1638.     fit: {
  1639.         left: function( position, data ) {
  1640.             var within = data.within,
  1641.                 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  1642.                 outerWidth = within.width,
  1643.                 collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1644.                 overLeft = withinOffset - collisionPosLeft,
  1645.                 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  1646.                 newOverRight;
  1647.  
  1648.             // element is wider than within
  1649.             if ( data.collisionWidth > outerWidth ) {
  1650.                 // element is initially over the left side of within
  1651.                 if ( overLeft > 0 && overRight <= 0 ) {
  1652.                     newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
  1653.                     position.left += overLeft - newOverRight;
  1654.                 // element is initially over right side of within
  1655.                 } else if ( overRight > 0 && overLeft <= 0 ) {
  1656.                     position.left = withinOffset;
  1657.                 // element is initially over both left and right sides of within
  1658.                 } else {
  1659.                     if ( overLeft > overRight ) {
  1660.                         position.left = withinOffset + outerWidth - data.collisionWidth;
  1661.                     } else {
  1662.                         position.left = withinOffset;
  1663.                     }
  1664.                 }
  1665.             // too far left -> align with left edge
  1666.             } else if ( overLeft > 0 ) {
  1667.                 position.left += overLeft;
  1668.             // too far right -> align with right edge
  1669.             } else if ( overRight > 0 ) {
  1670.                 position.left -= overRight;
  1671.             // adjust based on position and margin
  1672.             } else {
  1673.                 position.left = max( position.left - collisionPosLeft, position.left );
  1674.             }
  1675.         },
  1676.         top: function( position, data ) {
  1677.             var within = data.within,
  1678.                 withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  1679.                 outerHeight = data.within.height,
  1680.                 collisionPosTop = position.top - data.collisionPosition.marginTop,
  1681.                 overTop = withinOffset - collisionPosTop,
  1682.                 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  1683.                 newOverBottom;
  1684.  
  1685.             // element is taller than within
  1686.             if ( data.collisionHeight > outerHeight ) {
  1687.                 // element is initially over the top of within
  1688.                 if ( overTop > 0 && overBottom <= 0 ) {
  1689.                     newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
  1690.                     position.top += overTop - newOverBottom;
  1691.                 // element is initially over bottom of within
  1692.                 } else if ( overBottom > 0 && overTop <= 0 ) {
  1693.                     position.top = withinOffset;
  1694.                 // element is initially over both top and bottom of within
  1695.                 } else {
  1696.                     if ( overTop > overBottom ) {
  1697.                         position.top = withinOffset + outerHeight - data.collisionHeight;
  1698.                     } else {
  1699.                         position.top = withinOffset;
  1700.                     }
  1701.                 }
  1702.             // too far up -> align with top
  1703.             } else if ( overTop > 0 ) {
  1704.                 position.top += overTop;
  1705.             // too far down -> align with bottom edge
  1706.             } else if ( overBottom > 0 ) {
  1707.                 position.top -= overBottom;
  1708.             // adjust based on position and margin
  1709.             } else {
  1710.                 position.top = max( position.top - collisionPosTop, position.top );
  1711.             }
  1712.         }
  1713.     },
  1714.     flip: {
  1715.         left: function( position, data ) {
  1716.             var within = data.within,
  1717.                 withinOffset = within.offset.left + within.scrollLeft,
  1718.                 outerWidth = within.width,
  1719.                 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  1720.                 collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1721.                 overLeft = collisionPosLeft - offsetLeft,
  1722.                 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  1723.                 myOffset = data.my[ 0 ] === "left" ?
  1724.                     -data.elemWidth :
  1725.                     data.my[ 0 ] === "right" ?
  1726.                         data.elemWidth :
  1727.                         0,
  1728.                 atOffset = data.at[ 0 ] === "left" ?
  1729.                     data.targetWidth :
  1730.                     data.at[ 0 ] === "right" ?
  1731.                         -data.targetWidth :
  1732.                         0,
  1733.                 offset = -2 * data.offset[ 0 ],
  1734.                 newOverRight,
  1735.                 newOverLeft;
  1736.  
  1737.             if ( overLeft < 0 ) {
  1738.                 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
  1739.                 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1740.                     position.left += myOffset + atOffset + offset;
  1741.                 }
  1742.             } else if ( overRight > 0 ) {
  1743.                 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
  1744.                 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1745.                     position.left += myOffset + atOffset + offset;
  1746.                 }
  1747.             }
  1748.         },
  1749.         top: function( position, data ) {
  1750.             var within = data.within,
  1751.                 withinOffset = within.offset.top + within.scrollTop,
  1752.                 outerHeight = within.height,
  1753.                 offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1754.                 collisionPosTop = position.top - data.collisionPosition.marginTop,
  1755.                 overTop = collisionPosTop - offsetTop,
  1756.                 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1757.                 top = data.my[ 1 ] === "top",
  1758.                 myOffset = top ?
  1759.                     -data.elemHeight :
  1760.                     data.my[ 1 ] === "bottom" ?
  1761.                         data.elemHeight :
  1762.                         0,
  1763.                 atOffset = data.at[ 1 ] === "top" ?
  1764.                     data.targetHeight :
  1765.                     data.at[ 1 ] === "bottom" ?
  1766.                         -data.targetHeight :
  1767.                         0,
  1768.                 offset = -2 * data.offset[ 1 ],
  1769.                 newOverTop,
  1770.                 newOverBottom;
  1771.             if ( overTop < 0 ) {
  1772.                 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
  1773.                 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1774.                     position.top += myOffset + atOffset + offset;
  1775.                 }
  1776.             } else if ( overBottom > 0 ) {
  1777.                 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
  1778.                 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1779.                     position.top += myOffset + atOffset + offset;
  1780.                 }
  1781.             }
  1782.         }
  1783.     },
  1784.     flipfit: {
  1785.         left: function() {
  1786.             $.ui.position.flip.left.apply( this, arguments );
  1787.             $.ui.position.fit.left.apply( this, arguments );
  1788.         },
  1789.         top: function() {
  1790.             $.ui.position.flip.top.apply( this, arguments );
  1791.             $.ui.position.fit.top.apply( this, arguments );
  1792.         }
  1793.     }
  1794. };
  1795.  
  1796. // fraction support test
  1797. (function() {
  1798.     var testElement, testElementParent, testElementStyle, offsetLeft, i,
  1799.         body = document.getElementsByTagName( "body" )[ 0 ],
  1800.         div = document.createElement( "div" );
  1801.  
  1802.     //Create a "fake body" for testing based on method used in jQuery.support
  1803.     testElement = document.createElement( body ? "div" : "body" );
  1804.     testElementStyle = {
  1805.         visibility: "hidden",
  1806.         width: 0,
  1807.         height: 0,
  1808.         border: 0,
  1809.         margin: 0,
  1810.         background: "none"
  1811.     };
  1812.     if ( body ) {
  1813.         $.extend( testElementStyle, {
  1814.             position: "absolute",
  1815.             left: "-1000px",
  1816.             top: "-1000px"
  1817.         });
  1818.     }
  1819.     for ( i in testElementStyle ) {
  1820.         testElement.style[ i ] = testElementStyle[ i ];
  1821.     }
  1822.     testElement.appendChild( div );
  1823.     testElementParent = body || document.documentElement;
  1824.     testElementParent.insertBefore( testElement, testElementParent.firstChild );
  1825.  
  1826.     div.style.cssText = "position: absolute; left: 10.7432222px;";
  1827.  
  1828.     offsetLeft = $( div ).offset().left;
  1829.     supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
  1830.  
  1831.     testElement.innerHTML = "";
  1832.     testElementParent.removeChild( testElement );
  1833. })();
  1834.  
  1835. })();
  1836.  
  1837. var position = $.ui.position;
  1838.  
  1839.  
  1840. /*!
  1841.  * jQuery UI Draggable 1.11.4
  1842.  * http://jqueryui.com
  1843.  *
  1844.  * Copyright jQuery Foundation and other contributors
  1845.  * Released under the MIT license.
  1846.  * http://jquery.org/license
  1847.  *
  1848.  * http://api.jqueryui.com/draggable/
  1849.  */
  1850.  
  1851.  
  1852. $.widget("ui.draggable", $.ui.mouse, {
  1853.     version: "1.11.4",
  1854.     widgetEventPrefix: "drag",
  1855.     options: {
  1856.         addClasses: true,
  1857.         appendTo: "parent",
  1858.         axis: false,
  1859.         connectToSortable: false,
  1860.         containment: false,
  1861.         cursor: "auto",
  1862.         cursorAt: false,
  1863.         grid: false,
  1864.         handle: false,
  1865.         helper: "original",
  1866.         iframeFix: false,
  1867.         opacity: false,
  1868.         refreshPositions: false,
  1869.         revert: false,
  1870.         revertDuration: 500,
  1871.         scope: "default",
  1872.         scroll: true,
  1873.         scrollSensitivity: 20,
  1874.         scrollSpeed: 20,
  1875.         snap: false,
  1876.         snapMode: "both",
  1877.         snapTolerance: 20,
  1878.         stack: false,
  1879.         zIndex: false,
  1880.  
  1881.         // callbacks
  1882.         drag: null,
  1883.         start: null,
  1884.         stop: null
  1885.     },
  1886.     _create: function() {
  1887.  
  1888.         if ( this.options.helper === "original" ) {
  1889.             this._setPositionRelative();
  1890.         }
  1891.         if (this.options.addClasses){
  1892.             this.element.addClass("ui-draggable");
  1893.         }
  1894.         if (this.options.disabled){
  1895.             this.element.addClass("ui-draggable-disabled");
  1896.         }
  1897.         this._setHandleClassName();
  1898.  
  1899.         this._mouseInit();
  1900.     },
  1901.  
  1902.     _setOption: function( key, value ) {
  1903.         this._super( key, value );
  1904.         if ( key === "handle" ) {
  1905.             this._removeHandleClassName();
  1906.             this._setHandleClassName();
  1907.         }
  1908.     },
  1909.  
  1910.     _destroy: function() {
  1911.         if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  1912.             this.destroyOnClear = true;
  1913.             return;
  1914.         }
  1915.         this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
  1916.         this._removeHandleClassName();
  1917.         this._mouseDestroy();
  1918.     },
  1919.  
  1920.     _mouseCapture: function(event) {
  1921.         var o = this.options;
  1922.  
  1923.         this._blurActiveElement( event );
  1924.  
  1925.         // among others, prevent a drag on a resizable-handle
  1926.         if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
  1927.             return false;
  1928.         }
  1929.  
  1930.         //Quit if we're not on a valid handle
  1931.         this.handle = this._getHandle(event);
  1932.         if (!this.handle) {
  1933.             return false;
  1934.         }
  1935.  
  1936.         this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  1937.  
  1938.         return true;
  1939.  
  1940.     },
  1941.  
  1942.     _blockFrames: function( selector ) {
  1943.         this.iframeBlocks = this.document.find( selector ).map(function() {
  1944.             var iframe = $( this );
  1945.  
  1946.             return $( "<div>" )
  1947.                 .css( "position", "absolute" )
  1948.                 .appendTo( iframe.parent() )
  1949.                 .outerWidth( iframe.outerWidth() )
  1950.                 .outerHeight( iframe.outerHeight() )
  1951.                 .offset( iframe.offset() )[ 0 ];
  1952.         });
  1953.     },
  1954.  
  1955.     _unblockFrames: function() {
  1956.         if ( this.iframeBlocks ) {
  1957.             this.iframeBlocks.remove();
  1958.             delete this.iframeBlocks;
  1959.         }
  1960.     },
  1961.  
  1962.     _blurActiveElement: function( event ) {
  1963.         var document = this.document[ 0 ];
  1964.  
  1965.         // Only need to blur if the event occurred on the draggable itself, see #10527
  1966.         if ( !this.handleElement.is( event.target ) ) {
  1967.             return;
  1968.         }
  1969.  
  1970.         // support: IE9
  1971.         // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  1972.         try {
  1973.  
  1974.             // Support: IE9, IE10
  1975.             // If the <body> is blurred, IE will switch windows, see #9520
  1976.             if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
  1977.  
  1978.                 // Blur any element that currently has focus, see #4261
  1979.                 $( document.activeElement ).blur();
  1980.             }
  1981.         } catch ( error ) {}
  1982.     },
  1983.  
  1984.     _mouseStart: function(event) {
  1985.  
  1986.         var o = this.options;
  1987.  
  1988.         //Create and append the visible helper
  1989.         this.helper = this._createHelper(event);
  1990.  
  1991.         this.helper.addClass("ui-draggable-dragging");
  1992.  
  1993.         //Cache the helper size
  1994.         this._cacheHelperProportions();
  1995.  
  1996.         //If ddmanager is used for droppables, set the global draggable
  1997.         if ($.ui.ddmanager) {
  1998.             $.ui.ddmanager.current = this;
  1999.         }
  2000.  
  2001.         /*
  2002.          * - Position generation -
  2003.          * This block generates everything position related - it's the core of draggables.
  2004.          */
  2005.  
  2006.         //Cache the margins of the original element
  2007.         this._cacheMargins();
  2008.  
  2009.         //Store the helper's css position
  2010.         this.cssPosition = this.helper.css( "position" );
  2011.         this.scrollParent = this.helper.scrollParent( true );
  2012.         this.offsetParent = this.helper.offsetParent();
  2013.         this.hasFixedAncestor = this.helper.parents().filter(function() {
  2014.                 return $( this ).css( "position" ) === "fixed";
  2015.             }).length > 0;
  2016.  
  2017.         //The element's absolute position on the page minus margins
  2018.         this.positionAbs = this.element.offset();
  2019.         this._refreshOffsets( event );
  2020.  
  2021.         //Generate the original position
  2022.         this.originalPosition = this.position = this._generatePosition( event, false );
  2023.         this.originalPageX = event.pageX;
  2024.         this.originalPageY = event.pageY;
  2025.  
  2026.         //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  2027.         (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  2028.  
  2029.         //Set a containment if given in the options
  2030.         this._setContainment();
  2031.  
  2032.         //Trigger event + callbacks
  2033.         if (this._trigger("start", event) === false) {
  2034.             this._clear();
  2035.             return false;
  2036.         }
  2037.  
  2038.         //Recache the helper size
  2039.         this._cacheHelperProportions();
  2040.  
  2041.         //Prepare the droppable offsets
  2042.         if ($.ui.ddmanager && !o.dropBehaviour) {
  2043.             $.ui.ddmanager.prepareOffsets(this, event);
  2044.         }
  2045.  
  2046.         // Reset helper's right/bottom css if they're set and set explicit width/height instead
  2047.         // as this prevents resizing of elements with right/bottom set (see #7772)
  2048.         this._normalizeRightBottom();
  2049.  
  2050.         this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2051.  
  2052.         //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
  2053.         if ( $.ui.ddmanager ) {
  2054.             $.ui.ddmanager.dragStart(this, event);
  2055.         }
  2056.  
  2057.         return true;
  2058.     },
  2059.  
  2060.     _refreshOffsets: function( event ) {
  2061.         this.offset = {
  2062.             top: this.positionAbs.top - this.margins.top,
  2063.             left: this.positionAbs.left - this.margins.left,
  2064.             scroll: false,
  2065.             parent: this._getParentOffset(),
  2066.             relative: this._getRelativeOffset()
  2067.         };
  2068.  
  2069.         this.offset.click = {
  2070.             left: event.pageX - this.offset.left,
  2071.             top: event.pageY - this.offset.top
  2072.         };
  2073.     },
  2074.  
  2075.     _mouseDrag: function(event, noPropagation) {
  2076.         // reset any necessary cached properties (see #5009)
  2077.         if ( this.hasFixedAncestor ) {
  2078.             this.offset.parent = this._getParentOffset();
  2079.         }
  2080.  
  2081.         //Compute the helpers position
  2082.         this.position = this._generatePosition( event, true );
  2083.         this.positionAbs = this._convertPositionTo("absolute");
  2084.  
  2085.         //Call plugins and callbacks and use the resulting position if something is returned
  2086.         if (!noPropagation) {
  2087.             var ui = this._uiHash();
  2088.             if (this._trigger("drag", event, ui) === false) {
  2089.                 this._mouseUp({});
  2090.                 return false;
  2091.             }
  2092.             this.position = ui.position;
  2093.         }
  2094.  
  2095.         this.helper[ 0 ].style.left = this.position.left + "px";
  2096.         this.helper[ 0 ].style.top = this.position.top + "px";
  2097.  
  2098.         if ($.ui.ddmanager) {
  2099.             $.ui.ddmanager.drag(this, event);
  2100.         }
  2101.  
  2102.         return false;
  2103.     },
  2104.  
  2105.     _mouseStop: function(event) {
  2106.  
  2107.         //If we are using droppables, inform the manager about the drop
  2108.         var that = this,
  2109.             dropped = false;
  2110.         if ($.ui.ddmanager && !this.options.dropBehaviour) {
  2111.             dropped = $.ui.ddmanager.drop(this, event);
  2112.         }
  2113.  
  2114.         //if a drop comes from outside (a sortable)
  2115.         if (this.dropped) {
  2116.             dropped = this.dropped;
  2117.             this.dropped = false;
  2118.         }
  2119.  
  2120.         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))) {
  2121.             $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  2122.                 if (that._trigger("stop", event) !== false) {
  2123.                     that._clear();
  2124.                 }
  2125.             });
  2126.         } else {
  2127.             if (this._trigger("stop", event) !== false) {
  2128.                 this._clear();
  2129.             }
  2130.         }
  2131.  
  2132.         return false;
  2133.     },
  2134.  
  2135.     _mouseUp: function( event ) {
  2136.         this._unblockFrames();
  2137.  
  2138.         //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
  2139.         if ( $.ui.ddmanager ) {
  2140.             $.ui.ddmanager.dragStop(this, event);
  2141.         }
  2142.  
  2143.         // Only need to focus if the event occurred on the draggable itself, see #10527
  2144.         if ( this.handleElement.is( event.target ) ) {
  2145.             // The interaction is over; whether or not the click resulted in a drag, focus the element
  2146.             this.element.focus();
  2147.         }
  2148.  
  2149.         return $.ui.mouse.prototype._mouseUp.call(this, event);
  2150.     },
  2151.  
  2152.     cancel: function() {
  2153.  
  2154.         if (this.helper.is(".ui-draggable-dragging")) {
  2155.             this._mouseUp({});
  2156.         } else {
  2157.             this._clear();
  2158.         }
  2159.  
  2160.         return this;
  2161.  
  2162.     },
  2163.  
  2164.     _getHandle: function(event) {
  2165.         return this.options.handle ?
  2166.             !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  2167.             true;
  2168.     },
  2169.  
  2170.     _setHandleClassName: function() {
  2171.         this.handleElement = this.options.handle ?
  2172.             this.element.find( this.options.handle ) : this.element;
  2173.         this.handleElement.addClass( "ui-draggable-handle" );
  2174.     },
  2175.  
  2176.     _removeHandleClassName: function() {
  2177.         this.handleElement.removeClass( "ui-draggable-handle" );
  2178.     },
  2179.  
  2180.     _createHelper: function(event) {
  2181.  
  2182.         var o = this.options,
  2183.             helperIsFunction = $.isFunction( o.helper ),
  2184.             helper = helperIsFunction ?
  2185.                 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  2186.                 ( o.helper === "clone" ?
  2187.                     this.element.clone().removeAttr( "id" ) :
  2188.                     this.element );
  2189.  
  2190.         if (!helper.parents("body").length) {
  2191.             helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
  2192.         }
  2193.  
  2194.         // http://bugs.jqueryui.com/ticket/9446
  2195.         // a helper function can return the original element
  2196.         // which wouldn't have been set to relative in _create
  2197.         if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  2198.             this._setPositionRelative();
  2199.         }
  2200.  
  2201.         if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
  2202.             helper.css("position", "absolute");
  2203.         }
  2204.  
  2205.         return helper;
  2206.  
  2207.     },
  2208.  
  2209.     _setPositionRelative: function() {
  2210.         if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  2211.             this.element[ 0 ].style.position = "relative";
  2212.         }
  2213.     },
  2214.  
  2215.     _adjustOffsetFromHelper: function(obj) {
  2216.         if (typeof obj === "string") {
  2217.             obj = obj.split(" ");
  2218.         }
  2219.         if ($.isArray(obj)) {
  2220.             obj = { left: +obj[0], top: +obj[1] || 0 };
  2221.         }
  2222.         if ("left" in obj) {
  2223.             this.offset.click.left = obj.left + this.margins.left;
  2224.         }
  2225.         if ("right" in obj) {
  2226.             this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2227.         }
  2228.         if ("top" in obj) {
  2229.             this.offset.click.top = obj.top + this.margins.top;
  2230.         }
  2231.         if ("bottom" in obj) {
  2232.             this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2233.         }
  2234.     },
  2235.  
  2236.     _isRootNode: function( element ) {
  2237.         return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  2238.     },
  2239.  
  2240.     _getParentOffset: function() {
  2241.  
  2242.         //Get the offsetParent and cache its position
  2243.         var po = this.offsetParent.offset(),
  2244.             document = this.document[ 0 ];
  2245.  
  2246.         // This is a special case where we need to modify a offset calculated on start, since the following happened:
  2247.         // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  2248.         // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  2249.         //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  2250.         if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  2251.             po.left += this.scrollParent.scrollLeft();
  2252.             po.top += this.scrollParent.scrollTop();
  2253.         }
  2254.  
  2255.         if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  2256.             po = { top: 0, left: 0 };
  2257.         }
  2258.  
  2259.         return {
  2260.             top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  2261.             left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  2262.         };
  2263.  
  2264.     },
  2265.  
  2266.     _getRelativeOffset: function() {
  2267.         if ( this.cssPosition !== "relative" ) {
  2268.             return { top: 0, left: 0 };
  2269.         }
  2270.  
  2271.         var p = this.element.position(),
  2272.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2273.  
  2274.         return {
  2275.             top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  2276.             left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  2277.         };
  2278.  
  2279.     },
  2280.  
  2281.     _cacheMargins: function() {
  2282.         this.margins = {
  2283.             left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  2284.             top: (parseInt(this.element.css("marginTop"), 10) || 0),
  2285.             right: (parseInt(this.element.css("marginRight"), 10) || 0),
  2286.             bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  2287.         };
  2288.     },
  2289.  
  2290.     _cacheHelperProportions: function() {
  2291.         this.helperProportions = {
  2292.             width: this.helper.outerWidth(),
  2293.             height: this.helper.outerHeight()
  2294.         };
  2295.     },
  2296.  
  2297.     _setContainment: function() {
  2298.  
  2299.         var isUserScrollable, c, ce,
  2300.             o = this.options,
  2301.             document = this.document[ 0 ];
  2302.  
  2303.         this.relativeContainer = null;
  2304.  
  2305.         if ( !o.containment ) {
  2306.             this.containment = null;
  2307.             return;
  2308.         }
  2309.  
  2310.         if ( o.containment === "window" ) {
  2311.             this.containment = [
  2312.                 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  2313.                 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  2314.                 $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
  2315.                 $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  2316.             ];
  2317.             return;
  2318.         }
  2319.  
  2320.         if ( o.containment === "document") {
  2321.             this.containment = [
  2322.                 0,
  2323.                 0,
  2324.                 $( document ).width() - this.helperProportions.width - this.margins.left,
  2325.                 ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  2326.             ];
  2327.             return;
  2328.         }
  2329.  
  2330.         if ( o.containment.constructor === Array ) {
  2331.             this.containment = o.containment;
  2332.             return;
  2333.         }
  2334.  
  2335.         if ( o.containment === "parent" ) {
  2336.             o.containment = this.helper[ 0 ].parentNode;
  2337.         }
  2338.  
  2339.         c = $( o.containment );
  2340.         ce = c[ 0 ];
  2341.  
  2342.         if ( !ce ) {
  2343.             return;
  2344.         }
  2345.  
  2346.         isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  2347.  
  2348.         this.containment = [
  2349.             ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  2350.             ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  2351.             ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  2352.                 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  2353.                 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  2354.                 this.helperProportions.width -
  2355.                 this.margins.left -
  2356.                 this.margins.right,
  2357.             ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  2358.                 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  2359.                 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  2360.                 this.helperProportions.height -
  2361.                 this.margins.top -
  2362.                 this.margins.bottom
  2363.         ];
  2364.         this.relativeContainer = c;
  2365.     },
  2366.  
  2367.     _convertPositionTo: function(d, pos) {
  2368.  
  2369.         if (!pos) {
  2370.             pos = this.position;
  2371.         }
  2372.  
  2373.         var mod = d === "absolute" ? 1 : -1,
  2374.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2375.  
  2376.         return {
  2377.             top: (
  2378.                 pos.top +                                                               // The absolute mouse position
  2379.                 this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
  2380.                 this.offset.parent.top * mod -                                      // The offsetParent's offset without borders (offset + border)
  2381.                 ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
  2382.             ),
  2383.             left: (
  2384.                 pos.left +                                                              // The absolute mouse position
  2385.                 this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
  2386.                 this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
  2387.                 ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
  2388.             )
  2389.         };
  2390.  
  2391.     },
  2392.  
  2393.     _generatePosition: function( event, constrainPosition ) {
  2394.  
  2395.         var containment, co, top, left,
  2396.             o = this.options,
  2397.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  2398.             pageX = event.pageX,
  2399.             pageY = event.pageY;
  2400.  
  2401.         // Cache the scroll
  2402.         if ( !scrollIsRootNode || !this.offset.scroll ) {
  2403.             this.offset.scroll = {
  2404.                 top: this.scrollParent.scrollTop(),
  2405.                 left: this.scrollParent.scrollLeft()
  2406.             };
  2407.         }
  2408.  
  2409.         /*
  2410.          * - Position constraining -
  2411.          * Constrain the position to a mix of grid, containment.
  2412.          */
  2413.  
  2414.         // If we are not dragging yet, we won't check for options
  2415.         if ( constrainPosition ) {
  2416.             if ( this.containment ) {
  2417.                 if ( this.relativeContainer ){
  2418.                     co = this.relativeContainer.offset();
  2419.                     containment = [
  2420.                         this.containment[ 0 ] + co.left,
  2421.                         this.containment[ 1 ] + co.top,
  2422.                         this.containment[ 2 ] + co.left,
  2423.                         this.containment[ 3 ] + co.top
  2424.                     ];
  2425.                 } else {
  2426.                     containment = this.containment;
  2427.                 }
  2428.  
  2429.                 if (event.pageX - this.offset.click.left < containment[0]) {
  2430.                     pageX = containment[0] + this.offset.click.left;
  2431.                 }
  2432.                 if (event.pageY - this.offset.click.top < containment[1]) {
  2433.                     pageY = containment[1] + this.offset.click.top;
  2434.                 }
  2435.                 if (event.pageX - this.offset.click.left > containment[2]) {
  2436.                     pageX = containment[2] + this.offset.click.left;
  2437.                 }
  2438.                 if (event.pageY - this.offset.click.top > containment[3]) {
  2439.                     pageY = containment[3] + this.offset.click.top;
  2440.                 }
  2441.             }
  2442.  
  2443.             if (o.grid) {
  2444.                 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
  2445.                 top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  2446.                 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;
  2447.  
  2448.                 left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
  2449.                 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;
  2450.             }
  2451.  
  2452.             if ( o.axis === "y" ) {
  2453.                 pageX = this.originalPageX;
  2454.             }
  2455.  
  2456.             if ( o.axis === "x" ) {
  2457.                 pageY = this.originalPageY;
  2458.             }
  2459.         }
  2460.  
  2461.         return {
  2462.             top: (
  2463.                 pageY -                                                                 // The absolute mouse position
  2464.                 this.offset.click.top   -                                               // Click offset (relative to the element)
  2465.                 this.offset.relative.top -                                              // Only for relative positioned nodes: Relative offset from element to offset parent
  2466.                 this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
  2467.                 ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  2468.             ),
  2469.             left: (
  2470.                 pageX -                                                                 // The absolute mouse position
  2471.                 this.offset.click.left -                                                // Click offset (relative to the element)
  2472.                 this.offset.relative.left -                                             // Only for relative positioned nodes: Relative offset from element to offset parent
  2473.                 this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
  2474.                 ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  2475.             )
  2476.         };
  2477.  
  2478.     },
  2479.  
  2480.     _clear: function() {
  2481.         this.helper.removeClass("ui-draggable-dragging");
  2482.         if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  2483.             this.helper.remove();
  2484.         }
  2485.         this.helper = null;
  2486.         this.cancelHelperRemoval = false;
  2487.         if ( this.destroyOnClear ) {
  2488.             this.destroy();
  2489.         }
  2490.     },
  2491.  
  2492.     _normalizeRightBottom: function() {
  2493.         if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
  2494.             this.helper.width( this.helper.width() );
  2495.             this.helper.css( "right", "auto" );
  2496.         }
  2497.         if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
  2498.             this.helper.height( this.helper.height() );
  2499.             this.helper.css( "bottom", "auto" );
  2500.         }
  2501.     },
  2502.  
  2503.     // From now on bulk stuff - mainly helpers
  2504.  
  2505.     _trigger: function( type, event, ui ) {
  2506.         ui = ui || this._uiHash();
  2507.         $.ui.plugin.call( this, type, [ event, ui, this ], true );
  2508.  
  2509.         // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  2510.         if ( /^(drag|start|stop)/.test( type ) ) {
  2511.             this.positionAbs = this._convertPositionTo( "absolute" );
  2512.             ui.offset = this.positionAbs;
  2513.         }
  2514.         return $.Widget.prototype._trigger.call( this, type, event, ui );
  2515.     },
  2516.  
  2517.     plugins: {},
  2518.  
  2519.     _uiHash: function() {
  2520.         return {
  2521.             helper: this.helper,
  2522.             position: this.position,
  2523.             originalPosition: this.originalPosition,
  2524.             offset: this.positionAbs
  2525.         };
  2526.     }
  2527.  
  2528. });
  2529.  
  2530. $.ui.plugin.add( "draggable", "connectToSortable", {
  2531.     start: function( event, ui, draggable ) {
  2532.         var uiSortable = $.extend( {}, ui, {
  2533.             item: draggable.element
  2534.         });
  2535.  
  2536.         draggable.sortables = [];
  2537.         $( draggable.options.connectToSortable ).each(function() {
  2538.             var sortable = $( this ).sortable( "instance" );
  2539.  
  2540.             if ( sortable && !sortable.options.disabled ) {
  2541.                 draggable.sortables.push( sortable );
  2542.  
  2543.                 // refreshPositions is called at drag start to refresh the containerCache
  2544.                 // which is used in drag. This ensures it's initialized and synchronized
  2545.                 // with any changes that might have happened on the page since initialization.
  2546.                 sortable.refreshPositions();
  2547.                 sortable._trigger("activate", event, uiSortable);
  2548.             }
  2549.         });
  2550.     },
  2551.     stop: function( event, ui, draggable ) {
  2552.         var uiSortable = $.extend( {}, ui, {
  2553.             item: draggable.element
  2554.         });
  2555.  
  2556.         draggable.cancelHelperRemoval = false;
  2557.  
  2558.         $.each( draggable.sortables, function() {
  2559.             var sortable = this;
  2560.  
  2561.             if ( sortable.isOver ) {
  2562.                 sortable.isOver = 0;
  2563.  
  2564.                 // Allow this sortable to handle removing the helper
  2565.                 draggable.cancelHelperRemoval = true;
  2566.                 sortable.cancelHelperRemoval = false;
  2567.  
  2568.                 // Use _storedCSS To restore properties in the sortable,
  2569.                 // as this also handles revert (#9675) since the draggable
  2570.                 // may have modified them in unexpected ways (#8809)
  2571.                 sortable._storedCSS = {
  2572.                     position: sortable.placeholder.css( "position" ),
  2573.                     top: sortable.placeholder.css( "top" ),
  2574.                     left: sortable.placeholder.css( "left" )
  2575.                 };
  2576.  
  2577.                 sortable._mouseStop(event);
  2578.  
  2579.                 // Once drag has ended, the sortable should return to using
  2580.                 // its original helper, not the shared helper from draggable
  2581.                 sortable.options.helper = sortable.options._helper;
  2582.             } else {
  2583.                 // Prevent this Sortable from removing the helper.
  2584.                 // However, don't set the draggable to remove the helper
  2585.                 // either as another connected Sortable may yet handle the removal.
  2586.                 sortable.cancelHelperRemoval = true;
  2587.  
  2588.                 sortable._trigger( "deactivate", event, uiSortable );
  2589.             }
  2590.         });
  2591.     },
  2592.     drag: function( event, ui, draggable ) {
  2593.         $.each( draggable.sortables, function() {
  2594.             var innermostIntersecting = false,
  2595.                 sortable = this;
  2596.  
  2597.             // Copy over variables that sortable's _intersectsWith uses
  2598.             sortable.positionAbs = draggable.positionAbs;
  2599.             sortable.helperProportions = draggable.helperProportions;
  2600.             sortable.offset.click = draggable.offset.click;
  2601.  
  2602.             if ( sortable._intersectsWith( sortable.containerCache ) ) {
  2603.                 innermostIntersecting = true;
  2604.  
  2605.                 $.each( draggable.sortables, function() {
  2606.                     // Copy over variables that sortable's _intersectsWith uses
  2607.                     this.positionAbs = draggable.positionAbs;
  2608.                     this.helperProportions = draggable.helperProportions;
  2609.                     this.offset.click = draggable.offset.click;
  2610.  
  2611.                     if ( this !== sortable &&
  2612.                             this._intersectsWith( this.containerCache ) &&
  2613.                             $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  2614.                         innermostIntersecting = false;
  2615.                     }
  2616.  
  2617.                     return innermostIntersecting;
  2618.                 });
  2619.             }
  2620.  
  2621.             if ( innermostIntersecting ) {
  2622.                 // If it intersects, we use a little isOver variable and set it once,
  2623.                 // so that the move-in stuff gets fired only once.
  2624.                 if ( !sortable.isOver ) {
  2625.                     sortable.isOver = 1;
  2626.  
  2627.                     // Store draggable's parent in case we need to reappend to it later.
  2628.                     draggable._parent = ui.helper.parent();
  2629.  
  2630.                     sortable.currentItem = ui.helper
  2631.                         .appendTo( sortable.element )
  2632.                         .data( "ui-sortable-item", true );
  2633.  
  2634.                     // Store helper option to later restore it
  2635.                     sortable.options._helper = sortable.options.helper;
  2636.  
  2637.                     sortable.options.helper = function() {
  2638.                         return ui.helper[ 0 ];
  2639.                     };
  2640.  
  2641.                     // Fire the start events of the sortable with our passed browser event,
  2642.                     // and our own helper (so it doesn't create a new one)
  2643.                     event.target = sortable.currentItem[ 0 ];
  2644.                     sortable._mouseCapture( event, true );
  2645.                     sortable._mouseStart( event, true, true );
  2646.  
  2647.                     // Because the browser event is way off the new appended portlet,
  2648.                     // modify necessary variables to reflect the changes
  2649.                     sortable.offset.click.top = draggable.offset.click.top;
  2650.                     sortable.offset.click.left = draggable.offset.click.left;
  2651.                     sortable.offset.parent.left -= draggable.offset.parent.left -
  2652.                         sortable.offset.parent.left;
  2653.                     sortable.offset.parent.top -= draggable.offset.parent.top -
  2654.                         sortable.offset.parent.top;
  2655.  
  2656.                     draggable._trigger( "toSortable", event );
  2657.  
  2658.                     // Inform draggable that the helper is in a valid drop zone,
  2659.                     // used solely in the revert option to handle "valid/invalid".
  2660.                     draggable.dropped = sortable.element;
  2661.  
  2662.                     // Need to refreshPositions of all sortables in the case that
  2663.                     // adding to one sortable changes the location of the other sortables (#9675)
  2664.                     $.each( draggable.sortables, function() {
  2665.                         this.refreshPositions();
  2666.                     });
  2667.  
  2668.                     // hack so receive/update callbacks work (mostly)
  2669.                     draggable.currentItem = draggable.element;
  2670.                     sortable.fromOutside = draggable;
  2671.                 }
  2672.  
  2673.                 if ( sortable.currentItem ) {
  2674.                     sortable._mouseDrag( event );
  2675.                     // Copy the sortable's position because the draggable's can potentially reflect
  2676.                     // a relative position, while sortable is always absolute, which the dragged
  2677.                     // element has now become. (#8809)
  2678.                     ui.position = sortable.position;
  2679.                 }
  2680.             } else {
  2681.                 // If it doesn't intersect with the sortable, and it intersected before,
  2682.                 // we fake the drag stop of the sortable, but make sure it doesn't remove
  2683.                 // the helper by using cancelHelperRemoval.
  2684.                 if ( sortable.isOver ) {
  2685.  
  2686.                     sortable.isOver = 0;
  2687.                     sortable.cancelHelperRemoval = true;
  2688.  
  2689.                     // Calling sortable's mouseStop would trigger a revert,
  2690.                     // so revert must be temporarily false until after mouseStop is called.
  2691.                     sortable.options._revert = sortable.options.revert;
  2692.                     sortable.options.revert = false;
  2693.  
  2694.                     sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  2695.                     sortable._mouseStop( event, true );
  2696.  
  2697.                     // restore sortable behaviors that were modfied
  2698.                     // when the draggable entered the sortable area (#9481)
  2699.                     sortable.options.revert = sortable.options._revert;
  2700.                     sortable.options.helper = sortable.options._helper;
  2701.  
  2702.                     if ( sortable.placeholder ) {
  2703.                         sortable.placeholder.remove();
  2704.                     }
  2705.  
  2706.                     // Restore and recalculate the draggable's offset considering the sortable
  2707.                     // may have modified them in unexpected ways. (#8809, #10669)
  2708.                     ui.helper.appendTo( draggable._parent );
  2709.                     draggable._refreshOffsets( event );
  2710.                     ui.position = draggable._generatePosition( event, true );
  2711.  
  2712.                     draggable._trigger( "fromSortable", event );
  2713.  
  2714.                     // Inform draggable that the helper is no longer in a valid drop zone
  2715.                     draggable.dropped = false;
  2716.  
  2717.                     // Need to refreshPositions of all sortables just in case removing
  2718.                     // from one sortable changes the location of other sortables (#9675)
  2719.                     $.each( draggable.sortables, function() {
  2720.                         this.refreshPositions();
  2721.                     });
  2722.                 }
  2723.             }
  2724.         });
  2725.     }
  2726. });
  2727.  
  2728. $.ui.plugin.add("draggable", "cursor", {
  2729.     start: function( event, ui, instance ) {
  2730.         var t = $( "body" ),
  2731.             o = instance.options;
  2732.  
  2733.         if (t.css("cursor")) {
  2734.             o._cursor = t.css("cursor");
  2735.         }
  2736.         t.css("cursor", o.cursor);
  2737.     },
  2738.     stop: function( event, ui, instance ) {
  2739.         var o = instance.options;
  2740.         if (o._cursor) {
  2741.             $("body").css("cursor", o._cursor);
  2742.         }
  2743.     }
  2744. });
  2745.  
  2746. $.ui.plugin.add("draggable", "opacity", {
  2747.     start: function( event, ui, instance ) {
  2748.         var t = $( ui.helper ),
  2749.             o = instance.options;
  2750.         if (t.css("opacity")) {
  2751.             o._opacity = t.css("opacity");
  2752.         }
  2753.         t.css("opacity", o.opacity);
  2754.     },
  2755.     stop: function( event, ui, instance ) {
  2756.         var o = instance.options;
  2757.         if (o._opacity) {
  2758.             $(ui.helper).css("opacity", o._opacity);
  2759.         }
  2760.     }
  2761. });
  2762.  
  2763. $.ui.plugin.add("draggable", "scroll", {
  2764.     start: function( event, ui, i ) {
  2765.         if ( !i.scrollParentNotHidden ) {
  2766.             i.scrollParentNotHidden = i.helper.scrollParent( false );
  2767.         }
  2768.  
  2769.         if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  2770.             i.overflowOffset = i.scrollParentNotHidden.offset();
  2771.         }
  2772.     },
  2773.     drag: function( event, ui, i  ) {
  2774.  
  2775.         var o = i.options,
  2776.             scrolled = false,
  2777.             scrollParent = i.scrollParentNotHidden[ 0 ],
  2778.             document = i.document[ 0 ];
  2779.  
  2780.         if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  2781.             if ( !o.axis || o.axis !== "x" ) {
  2782.                 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
  2783.                     scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  2784.                 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  2785.                     scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  2786.                 }
  2787.             }
  2788.  
  2789.             if ( !o.axis || o.axis !== "y" ) {
  2790.                 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
  2791.                     scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  2792.                 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  2793.                     scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  2794.                 }
  2795.             }
  2796.  
  2797.         } else {
  2798.  
  2799.             if (!o.axis || o.axis !== "x") {
  2800.                 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  2801.                     scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2802.                 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
  2803.                     scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2804.                 }
  2805.             }
  2806.  
  2807.             if (!o.axis || o.axis !== "y") {
  2808.                 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  2809.                     scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2810.                 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
  2811.                     scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2812.                 }
  2813.             }
  2814.  
  2815.         }
  2816.  
  2817.         if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  2818.             $.ui.ddmanager.prepareOffsets(i, event);
  2819.         }
  2820.  
  2821.     }
  2822. });
  2823.  
  2824. $.ui.plugin.add("draggable", "snap", {
  2825.     start: function( event, ui, i ) {
  2826.  
  2827.         var o = i.options;
  2828.  
  2829.         i.snapElements = [];
  2830.  
  2831.         $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
  2832.             var $t = $(this),
  2833.                 $o = $t.offset();
  2834.             if (this !== i.element[0]) {
  2835.                 i.snapElements.push({
  2836.                     item: this,
  2837.                     width: $t.outerWidth(), height: $t.outerHeight(),
  2838.                     top: $o.top, left: $o.left
  2839.                 });
  2840.             }
  2841.         });
  2842.  
  2843.     },
  2844.     drag: function( event, ui, inst ) {
  2845.  
  2846.         var ts, bs, ls, rs, l, r, t, b, i, first,
  2847.             o = inst.options,
  2848.             d = o.snapTolerance,
  2849.             x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  2850.             y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  2851.  
  2852.         for (i = inst.snapElements.length - 1; i >= 0; i--){
  2853.  
  2854.             l = inst.snapElements[i].left - inst.margins.left;
  2855.             r = l + inst.snapElements[i].width;
  2856.             t = inst.snapElements[i].top - inst.margins.top;
  2857.             b = t + inst.snapElements[i].height;
  2858.  
  2859.             if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
  2860.                 if (inst.snapElements[i].snapping) {
  2861.                     (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  2862.                 }
  2863.                 inst.snapElements[i].snapping = false;
  2864.                 continue;
  2865.             }
  2866.  
  2867.             if (o.snapMode !== "inner") {
  2868.                 ts = Math.abs(t - y2) <= d;
  2869.                 bs = Math.abs(b - y1) <= d;
  2870.                 ls = Math.abs(l - x2) <= d;
  2871.                 rs = Math.abs(r - x1) <= d;
  2872.                 if (ts) {
  2873.                     ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
  2874.                 }
  2875.                 if (bs) {
  2876.                     ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
  2877.                 }
  2878.                 if (ls) {
  2879.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
  2880.                 }
  2881.                 if (rs) {
  2882.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
  2883.                 }
  2884.             }
  2885.  
  2886.             first = (ts || bs || ls || rs);
  2887.  
  2888.             if (o.snapMode !== "outer") {
  2889.                 ts = Math.abs(t - y1) <= d;
  2890.                 bs = Math.abs(b - y2) <= d;
  2891.                 ls = Math.abs(l - x1) <= d;
  2892.                 rs = Math.abs(r - x2) <= d;
  2893.                 if (ts) {
  2894.                     ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
  2895.                 }
  2896.                 if (bs) {
  2897.                     ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
  2898.                 }
  2899.                 if (ls) {
  2900.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
  2901.                 }
  2902.                 if (rs) {
  2903.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
  2904.                 }
  2905.             }
  2906.  
  2907.             if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  2908.                 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  2909.             }
  2910.             inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  2911.  
  2912.         }
  2913.  
  2914.     }
  2915. });
  2916.  
  2917. $.ui.plugin.add("draggable", "stack", {
  2918.     start: function( event, ui, instance ) {
  2919.         var min,
  2920.             o = instance.options,
  2921.             group = $.makeArray($(o.stack)).sort(function(a, b) {
  2922.                 return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
  2923.             });
  2924.  
  2925.         if (!group.length) { return; }
  2926.  
  2927.         min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  2928.         $(group).each(function(i) {
  2929.             $(this).css("zIndex", min + i);
  2930.         });
  2931.         this.css("zIndex", (min + group.length));
  2932.     }
  2933. });
  2934.  
  2935. $.ui.plugin.add("draggable", "zIndex", {
  2936.     start: function( event, ui, instance ) {
  2937.         var t = $( ui.helper ),
  2938.             o = instance.options;
  2939.  
  2940.         if (t.css("zIndex")) {
  2941.             o._zIndex = t.css("zIndex");
  2942.         }
  2943.         t.css("zIndex", o.zIndex);
  2944.     },
  2945.     stop: function( event, ui, instance ) {
  2946.         var o = instance.options;
  2947.  
  2948.         if (o._zIndex) {
  2949.             $(ui.helper).css("zIndex", o._zIndex);
  2950.         }
  2951.     }
  2952. });
  2953.  
  2954. var draggable = $.ui.draggable;
  2955.  
  2956.  
  2957. /*!
  2958.  * jQuery UI Droppable 1.11.4
  2959.  * http://jqueryui.com
  2960.  *
  2961.  * Copyright jQuery Foundation and other contributors
  2962.  * Released under the MIT license.
  2963.  * http://jquery.org/license
  2964.  *
  2965.  * http://api.jqueryui.com/droppable/
  2966.  */
  2967.  
  2968.  
  2969. $.widget( "ui.droppable", {
  2970.     version: "1.11.4",
  2971.     widgetEventPrefix: "drop",
  2972.     options: {
  2973.         accept: "*",
  2974.         activeClass: false,
  2975.         addClasses: true,
  2976.         greedy: false,
  2977.         hoverClass: false,
  2978.         scope: "default",
  2979.         tolerance: "intersect",
  2980.  
  2981.         // callbacks
  2982.         activate: null,
  2983.         deactivate: null,
  2984.         drop: null,
  2985.         out: null,
  2986.         over: null
  2987.     },
  2988.     _create: function() {
  2989.  
  2990.         var proportions,
  2991.             o = this.options,
  2992.             accept = o.accept;
  2993.  
  2994.         this.isover = false;
  2995.         this.isout = true;
  2996.  
  2997.         this.accept = $.isFunction( accept ) ? accept : function( d ) {
  2998.             return d.is( accept );
  2999.         };
  3000.  
  3001.         this.proportions = function( /* valueToWrite */ ) {
  3002.             if ( arguments.length ) {
  3003.                 // Store the droppable's proportions
  3004.                 proportions = arguments[ 0 ];
  3005.             } else {
  3006.                 // Retrieve or derive the droppable's proportions
  3007.                 return proportions ?
  3008.                     proportions :
  3009.                     proportions = {
  3010.                         width: this.element[ 0 ].offsetWidth,
  3011.                         height: this.element[ 0 ].offsetHeight
  3012.                     };
  3013.             }
  3014.         };
  3015.  
  3016.         this._addToManager( o.scope );
  3017.  
  3018.         o.addClasses && this.element.addClass( "ui-droppable" );
  3019.  
  3020.     },
  3021.  
  3022.     _addToManager: function( scope ) {
  3023.         // Add the reference and positions to the manager
  3024.         $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  3025.         $.ui.ddmanager.droppables[ scope ].push( this );
  3026.     },
  3027.  
  3028.     _splice: function( drop ) {
  3029.         var i = 0;
  3030.         for ( ; i < drop.length; i++ ) {
  3031.             if ( drop[ i ] === this ) {
  3032.                 drop.splice( i, 1 );
  3033.             }
  3034.         }
  3035.     },
  3036.  
  3037.     _destroy: function() {
  3038.         var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  3039.  
  3040.         this._splice( drop );
  3041.  
  3042.         this.element.removeClass( "ui-droppable ui-droppable-disabled" );
  3043.     },
  3044.  
  3045.     _setOption: function( key, value ) {
  3046.  
  3047.         if ( key === "accept" ) {
  3048.             this.accept = $.isFunction( value ) ? value : function( d ) {
  3049.                 return d.is( value );
  3050.             };
  3051.         } else if ( key === "scope" ) {
  3052.             var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  3053.  
  3054.             this._splice( drop );
  3055.             this._addToManager( value );
  3056.         }
  3057.  
  3058.         this._super( key, value );
  3059.     },
  3060.  
  3061.     _activate: function( event ) {
  3062.         var draggable = $.ui.ddmanager.current;
  3063.         if ( this.options.activeClass ) {
  3064.             this.element.addClass( this.options.activeClass );
  3065.         }
  3066.         if ( draggable ){
  3067.             this._trigger( "activate", event, this.ui( draggable ) );
  3068.         }
  3069.     },
  3070.  
  3071.     _deactivate: function( event ) {
  3072.         var draggable = $.ui.ddmanager.current;
  3073.         if ( this.options.activeClass ) {
  3074.             this.element.removeClass( this.options.activeClass );
  3075.         }
  3076.         if ( draggable ){
  3077.             this._trigger( "deactivate", event, this.ui( draggable ) );
  3078.         }
  3079.     },
  3080.  
  3081.     _over: function( event ) {
  3082.  
  3083.         var draggable = $.ui.ddmanager.current;
  3084.  
  3085.         // Bail if draggable and droppable are same element
  3086.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3087.             return;
  3088.         }
  3089.  
  3090.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3091.             if ( this.options.hoverClass ) {
  3092.                 this.element.addClass( this.options.hoverClass );
  3093.             }
  3094.             this._trigger( "over", event, this.ui( draggable ) );
  3095.         }
  3096.  
  3097.     },
  3098.  
  3099.     _out: function( event ) {
  3100.  
  3101.         var draggable = $.ui.ddmanager.current;
  3102.  
  3103.         // Bail if draggable and droppable are same element
  3104.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3105.             return;
  3106.         }
  3107.  
  3108.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3109.             if ( this.options.hoverClass ) {
  3110.                 this.element.removeClass( this.options.hoverClass );
  3111.             }
  3112.             this._trigger( "out", event, this.ui( draggable ) );
  3113.         }
  3114.  
  3115.     },
  3116.  
  3117.     _drop: function( event, custom ) {
  3118.  
  3119.         var draggable = custom || $.ui.ddmanager.current,
  3120.             childrenIntersection = false;
  3121.  
  3122.         // Bail if draggable and droppable are same element
  3123.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3124.             return false;
  3125.         }
  3126.  
  3127.         this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
  3128.             var inst = $( this ).droppable( "instance" );
  3129.             if (
  3130.                 inst.options.greedy &&
  3131.                 !inst.options.disabled &&
  3132.                 inst.options.scope === draggable.options.scope &&
  3133.                 inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
  3134.                 $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
  3135.             ) { childrenIntersection = true; return false; }
  3136.         });
  3137.         if ( childrenIntersection ) {
  3138.             return false;
  3139.         }
  3140.  
  3141.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3142.             if ( this.options.activeClass ) {
  3143.                 this.element.removeClass( this.options.activeClass );
  3144.             }
  3145.             if ( this.options.hoverClass ) {
  3146.                 this.element.removeClass( this.options.hoverClass );
  3147.             }
  3148.             this._trigger( "drop", event, this.ui( draggable ) );
  3149.             return this.element;
  3150.         }
  3151.  
  3152.         return false;
  3153.  
  3154.     },
  3155.  
  3156.     ui: function( c ) {
  3157.         return {
  3158.             draggable: ( c.currentItem || c.element ),
  3159.             helper: c.helper,
  3160.             position: c.position,
  3161.             offset: c.positionAbs
  3162.         };
  3163.     }
  3164.  
  3165. });
  3166.  
  3167. $.ui.intersect = (function() {
  3168.     function isOverAxis( x, reference, size ) {
  3169.         return ( x >= reference ) && ( x < ( reference + size ) );
  3170.     }
  3171.  
  3172.     return function( draggable, droppable, toleranceMode, event ) {
  3173.  
  3174.         if ( !droppable.offset ) {
  3175.             return false;
  3176.         }
  3177.  
  3178.         var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
  3179.             y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
  3180.             x2 = x1 + draggable.helperProportions.width,
  3181.             y2 = y1 + draggable.helperProportions.height,
  3182.             l = droppable.offset.left,
  3183.             t = droppable.offset.top,
  3184.             r = l + droppable.proportions().width,
  3185.             b = t + droppable.proportions().height;
  3186.  
  3187.         switch ( toleranceMode ) {
  3188.         case "fit":
  3189.             return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  3190.         case "intersect":
  3191.             return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  3192.                 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  3193.                 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  3194.                 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  3195.         case "pointer":
  3196.             return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
  3197.         case "touch":
  3198.             return (
  3199.                 ( y1 >= t && y1 <= b ) || // Top edge touching
  3200.                 ( y2 >= t && y2 <= b ) || // Bottom edge touching
  3201.                 ( y1 < t && y2 > b ) // Surrounded vertically
  3202.             ) && (
  3203.                 ( x1 >= l && x1 <= r ) || // Left edge touching
  3204.                 ( x2 >= l && x2 <= r ) || // Right edge touching
  3205.                 ( x1 < l && x2 > r ) // Surrounded horizontally
  3206.             );
  3207.         default:
  3208.             return false;
  3209.         }
  3210.     };
  3211. })();
  3212.  
  3213. /*
  3214.     This manager tracks offsets of draggables and droppables
  3215. */
  3216. $.ui.ddmanager = {
  3217.     current: null,
  3218.     droppables: { "default": [] },
  3219.     prepareOffsets: function( t, event ) {
  3220.  
  3221.         var i, j,
  3222.             m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  3223.             type = event ? event.type : null, // workaround for #2317
  3224.             list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  3225.  
  3226.         droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  3227.  
  3228.             // No disabled and non-accepted
  3229.             if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
  3230.                 continue;
  3231.             }
  3232.  
  3233.             // Filter out elements in the current dragged item
  3234.             for ( j = 0; j < list.length; j++ ) {
  3235.                 if ( list[ j ] === m[ i ].element[ 0 ] ) {
  3236.                     m[ i ].proportions().height = 0;
  3237.                     continue droppablesLoop;
  3238.                 }
  3239.             }
  3240.  
  3241.             m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  3242.             if ( !m[ i ].visible ) {
  3243.                 continue;
  3244.             }
  3245.  
  3246.             // Activate the droppable if used directly from draggables
  3247.             if ( type === "mousedown" ) {
  3248.                 m[ i ]._activate.call( m[ i ], event );
  3249.             }
  3250.  
  3251.             m[ i ].offset = m[ i ].element.offset();
  3252.             m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
  3253.  
  3254.         }
  3255.  
  3256.     },
  3257.     drop: function( draggable, event ) {
  3258.  
  3259.         var dropped = false;
  3260.         // Create a copy of the droppables in case the list changes during the drop (#9116)
  3261.         $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  3262.  
  3263.             if ( !this.options ) {
  3264.                 return;
  3265.             }
  3266.             if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
  3267.                 dropped = this._drop.call( this, event ) || dropped;
  3268.             }
  3269.  
  3270.             if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3271.                 this.isout = true;
  3272.                 this.isover = false;
  3273.                 this._deactivate.call( this, event );
  3274.             }
  3275.  
  3276.         });
  3277.         return dropped;
  3278.  
  3279.     },
  3280.     dragStart: function( draggable, event ) {
  3281.         // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
  3282.         draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
  3283.             if ( !draggable.options.refreshPositions ) {
  3284.                 $.ui.ddmanager.prepareOffsets( draggable, event );
  3285.             }
  3286.         });
  3287.     },
  3288.     drag: function( draggable, event ) {
  3289.  
  3290.         // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  3291.         if ( draggable.options.refreshPositions ) {
  3292.             $.ui.ddmanager.prepareOffsets( draggable, event );
  3293.         }
  3294.  
  3295.         // Run through all droppables and check their positions based on specific tolerance options
  3296.         $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  3297.  
  3298.             if ( this.options.disabled || this.greedyChild || !this.visible ) {
  3299.                 return;
  3300.             }
  3301.  
  3302.             var parentInstance, scope, parent,
  3303.                 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
  3304.                 c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
  3305.             if ( !c ) {
  3306.                 return;
  3307.             }
  3308.  
  3309.             if ( this.options.greedy ) {
  3310.                 // find droppable parents with same scope
  3311.                 scope = this.options.scope;
  3312.                 parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
  3313.                     return $( this ).droppable( "instance" ).options.scope === scope;
  3314.                 });
  3315.  
  3316.                 if ( parent.length ) {
  3317.                     parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  3318.                     parentInstance.greedyChild = ( c === "isover" );
  3319.                 }
  3320.             }
  3321.  
  3322.             // we just moved into a greedy child
  3323.             if ( parentInstance && c === "isover" ) {
  3324.                 parentInstance.isover = false;
  3325.                 parentInstance.isout = true;
  3326.                 parentInstance._out.call( parentInstance, event );
  3327.             }
  3328.  
  3329.             this[ c ] = true;
  3330.             this[c === "isout" ? "isover" : "isout"] = false;
  3331.             this[c === "isover" ? "_over" : "_out"].call( this, event );
  3332.  
  3333.             // we just moved out of a greedy child
  3334.             if ( parentInstance && c === "isout" ) {
  3335.                 parentInstance.isout = false;
  3336.                 parentInstance.isover = true;
  3337.                 parentInstance._over.call( parentInstance, event );
  3338.             }
  3339.         });
  3340.  
  3341.     },
  3342.     dragStop: function( draggable, event ) {
  3343.         draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
  3344.         // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
  3345.         if ( !draggable.options.refreshPositions ) {
  3346.             $.ui.ddmanager.prepareOffsets( draggable, event );
  3347.         }
  3348.     }
  3349. };
  3350.  
  3351. var droppable = $.ui.droppable;
  3352.  
  3353.  
  3354. /*!
  3355.  * jQuery UI Resizable 1.11.4
  3356.  * http://jqueryui.com
  3357.  *
  3358.  * Copyright jQuery Foundation and other contributors
  3359.  * Released under the MIT license.
  3360.  * http://jquery.org/license
  3361.  *
  3362.  * http://api.jqueryui.com/resizable/
  3363.  */
  3364.  
  3365.  
  3366. $.widget("ui.resizable", $.ui.mouse, {
  3367.     version: "1.11.4",
  3368.     widgetEventPrefix: "resize",
  3369.     options: {
  3370.         alsoResize: false,
  3371.         animate: false,
  3372.         animateDuration: "slow",
  3373.         animateEasing: "swing",
  3374.         aspectRatio: false,
  3375.         autoHide: false,
  3376.         containment: false,
  3377.         ghost: false,
  3378.         grid: false,
  3379.         handles: "e,s,se",
  3380.         helper: false,
  3381.         maxHeight: null,
  3382.         maxWidth: null,
  3383.         minHeight: 10,
  3384.         minWidth: 10,
  3385.         // See #7960
  3386.         zIndex: 90,
  3387.  
  3388.         // callbacks
  3389.         resize: null,
  3390.         start: null,
  3391.         stop: null
  3392.     },
  3393.  
  3394.     _num: function( value ) {
  3395.         return parseInt( value, 10 ) || 0;
  3396.     },
  3397.  
  3398.     _isNumber: function( value ) {
  3399.         return !isNaN( parseInt( value, 10 ) );
  3400.     },
  3401.  
  3402.     _hasScroll: function( el, a ) {
  3403.  
  3404.         if ( $( el ).css( "overflow" ) === "hidden") {
  3405.             return false;
  3406.         }
  3407.  
  3408.         var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  3409.             has = false;
  3410.  
  3411.         if ( el[ scroll ] > 0 ) {
  3412.             return true;
  3413.         }
  3414.  
  3415.         // TODO: determine which cases actually cause this to happen
  3416.         // if the element doesn't have the scroll set, see if it's possible to
  3417.         // set the scroll
  3418.         el[ scroll ] = 1;
  3419.         has = ( el[ scroll ] > 0 );
  3420.         el[ scroll ] = 0;
  3421.         return has;
  3422.     },
  3423.  
  3424.     _create: function() {
  3425.  
  3426.         var n, i, handle, axis, hname,
  3427.             that = this,
  3428.             o = this.options;
  3429.         this.element.addClass("ui-resizable");
  3430.  
  3431.         $.extend(this, {
  3432.             _aspectRatio: !!(o.aspectRatio),
  3433.             aspectRatio: o.aspectRatio,
  3434.             originalElement: this.element,
  3435.             _proportionallyResizeElements: [],
  3436.             _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  3437.         });
  3438.  
  3439.         // Wrap the element if it cannot hold child nodes
  3440.         if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
  3441.  
  3442.             this.element.wrap(
  3443.                 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
  3444.                     position: this.element.css("position"),
  3445.                     width: this.element.outerWidth(),
  3446.                     height: this.element.outerHeight(),
  3447.                     top: this.element.css("top"),
  3448.                     left: this.element.css("left")
  3449.                 })
  3450.             );
  3451.  
  3452.             this.element = this.element.parent().data(
  3453.                 "ui-resizable", this.element.resizable( "instance" )
  3454.             );
  3455.  
  3456.             this.elementIsWrapper = true;
  3457.  
  3458.             this.element.css({
  3459.                 marginLeft: this.originalElement.css("marginLeft"),
  3460.                 marginTop: this.originalElement.css("marginTop"),
  3461.                 marginRight: this.originalElement.css("marginRight"),
  3462.                 marginBottom: this.originalElement.css("marginBottom")
  3463.             });
  3464.             this.originalElement.css({
  3465.                 marginLeft: 0,
  3466.                 marginTop: 0,
  3467.                 marginRight: 0,
  3468.                 marginBottom: 0
  3469.             });
  3470.             // support: Safari
  3471.             // Prevent Safari textarea resize
  3472.             this.originalResizeStyle = this.originalElement.css("resize");
  3473.             this.originalElement.css("resize", "none");
  3474.  
  3475.             this._proportionallyResizeElements.push( this.originalElement.css({
  3476.                 position: "static",
  3477.                 zoom: 1,
  3478.                 display: "block"
  3479.             }) );
  3480.  
  3481.             // support: IE9
  3482.             // avoid IE jump (hard set the margin)
  3483.             this.originalElement.css({ margin: this.originalElement.css("margin") });
  3484.  
  3485.             this._proportionallyResize();
  3486.         }
  3487.  
  3488.         this.handles = o.handles ||
  3489.             ( !$(".ui-resizable-handle", this.element).length ?
  3490.                 "e,s,se" : {
  3491.                     n: ".ui-resizable-n",
  3492.                     e: ".ui-resizable-e",
  3493.                     s: ".ui-resizable-s",
  3494.                     w: ".ui-resizable-w",
  3495.                     se: ".ui-resizable-se",
  3496.                     sw: ".ui-resizable-sw",
  3497.                     ne: ".ui-resizable-ne",
  3498.                     nw: ".ui-resizable-nw"
  3499.                 } );
  3500.  
  3501.         this._handles = $();
  3502.         if ( this.handles.constructor === String ) {
  3503.  
  3504.             if ( this.handles === "all") {
  3505.                 this.handles = "n,e,s,w,se,sw,ne,nw";
  3506.             }
  3507.  
  3508.             n = this.handles.split(",");
  3509.             this.handles = {};
  3510.  
  3511.             for (i = 0; i < n.length; i++) {
  3512.  
  3513.                 handle = $.trim(n[i]);
  3514.                 hname = "ui-resizable-" + handle;
  3515.                 axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
  3516.  
  3517.                 axis.css({ zIndex: o.zIndex });
  3518.  
  3519.                 // TODO : What's going on here?
  3520.                 if ("se" === handle) {
  3521.                     axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
  3522.                 }
  3523.  
  3524.                 this.handles[handle] = ".ui-resizable-" + handle;
  3525.                 this.element.append(axis);
  3526.             }
  3527.  
  3528.         }
  3529.  
  3530.         this._renderAxis = function(target) {
  3531.  
  3532.             var i, axis, padPos, padWrapper;
  3533.  
  3534.             target = target || this.element;
  3535.  
  3536.             for (i in this.handles) {
  3537.  
  3538.                 if (this.handles[i].constructor === String) {
  3539.                     this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
  3540.                 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
  3541.                     this.handles[ i ] = $( this.handles[ i ] );
  3542.                     this._on( this.handles[ i ], { "mousedown": that._mouseDown });
  3543.                 }
  3544.  
  3545.                 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
  3546.  
  3547.                     axis = $(this.handles[i], this.element);
  3548.  
  3549.                     padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  3550.  
  3551.                     padPos = [ "padding",
  3552.                         /ne|nw|n/.test(i) ? "Top" :
  3553.                         /se|sw|s/.test(i) ? "Bottom" :
  3554.                         /^e$/.test(i) ? "Right" : "Left" ].join("");
  3555.  
  3556.                     target.css(padPos, padWrapper);
  3557.  
  3558.                     this._proportionallyResize();
  3559.                 }
  3560.  
  3561.                 this._handles = this._handles.add( this.handles[ i ] );
  3562.             }
  3563.         };
  3564.  
  3565.         // TODO: make renderAxis a prototype function
  3566.         this._renderAxis(this.element);
  3567.  
  3568.         this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
  3569.         this._handles.disableSelection();
  3570.  
  3571.         this._handles.mouseover(function() {
  3572.             if (!that.resizing) {
  3573.                 if (this.className) {
  3574.                     axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  3575.                 }
  3576.                 that.axis = axis && axis[1] ? axis[1] : "se";
  3577.             }
  3578.         });
  3579.  
  3580.         if (o.autoHide) {
  3581.             this._handles.hide();
  3582.             $(this.element)
  3583.                 .addClass("ui-resizable-autohide")
  3584.                 .mouseenter(function() {
  3585.                     if (o.disabled) {
  3586.                         return;
  3587.                     }
  3588.                     $(this).removeClass("ui-resizable-autohide");
  3589.                     that._handles.show();
  3590.                 })
  3591.                 .mouseleave(function() {
  3592.                     if (o.disabled) {
  3593.                         return;
  3594.                     }
  3595.                     if (!that.resizing) {
  3596.                         $(this).addClass("ui-resizable-autohide");
  3597.                         that._handles.hide();
  3598.                     }
  3599.                 });
  3600.         }
  3601.  
  3602.         this._mouseInit();
  3603.     },
  3604.  
  3605.     _destroy: function() {
  3606.  
  3607.         this._mouseDestroy();
  3608.  
  3609.         var wrapper,
  3610.             _destroy = function(exp) {
  3611.                 $(exp)
  3612.                     .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  3613.                     .removeData("resizable")
  3614.                     .removeData("ui-resizable")
  3615.                     .unbind(".resizable")
  3616.                     .find(".ui-resizable-handle")
  3617.                         .remove();
  3618.             };
  3619.  
  3620.         // TODO: Unwrap at same DOM position
  3621.         if (this.elementIsWrapper) {
  3622.             _destroy(this.element);
  3623.             wrapper = this.element;
  3624.             this.originalElement.css({
  3625.                 position: wrapper.css("position"),
  3626.                 width: wrapper.outerWidth(),
  3627.                 height: wrapper.outerHeight(),
  3628.                 top: wrapper.css("top"),
  3629.                 left: wrapper.css("left")
  3630.             }).insertAfter( wrapper );
  3631.             wrapper.remove();
  3632.         }
  3633.  
  3634.         this.originalElement.css("resize", this.originalResizeStyle);
  3635.         _destroy(this.originalElement);
  3636.  
  3637.         return this;
  3638.     },
  3639.  
  3640.     _mouseCapture: function(event) {
  3641.         var i, handle,
  3642.             capture = false;
  3643.  
  3644.         for (i in this.handles) {
  3645.             handle = $(this.handles[i])[0];
  3646.             if (handle === event.target || $.contains(handle, event.target)) {
  3647.                 capture = true;
  3648.             }
  3649.         }
  3650.  
  3651.         return !this.options.disabled && capture;
  3652.     },
  3653.  
  3654.     _mouseStart: function(event) {
  3655.  
  3656.         var curleft, curtop, cursor,
  3657.             o = this.options,
  3658.             el = this.element;
  3659.  
  3660.         this.resizing = true;
  3661.  
  3662.         this._renderProxy();
  3663.  
  3664.         curleft = this._num(this.helper.css("left"));
  3665.         curtop = this._num(this.helper.css("top"));
  3666.  
  3667.         if (o.containment) {
  3668.             curleft += $(o.containment).scrollLeft() || 0;
  3669.             curtop += $(o.containment).scrollTop() || 0;
  3670.         }
  3671.  
  3672.         this.offset = this.helper.offset();
  3673.         this.position = { left: curleft, top: curtop };
  3674.  
  3675.         this.size = this._helper ? {
  3676.                 width: this.helper.width(),
  3677.                 height: this.helper.height()
  3678.             } : {
  3679.                 width: el.width(),
  3680.                 height: el.height()
  3681.             };
  3682.  
  3683.         this.originalSize = this._helper ? {
  3684.                 width: el.outerWidth(),
  3685.                 height: el.outerHeight()
  3686.             } : {
  3687.                 width: el.width(),
  3688.                 height: el.height()
  3689.             };
  3690.  
  3691.         this.sizeDiff = {
  3692.             width: el.outerWidth() - el.width(),
  3693.             height: el.outerHeight() - el.height()
  3694.         };
  3695.  
  3696.         this.originalPosition = { left: curleft, top: curtop };
  3697.         this.originalMousePosition = { left: event.pageX, top: event.pageY };
  3698.  
  3699.         this.aspectRatio = (typeof o.aspectRatio === "number") ?
  3700.             o.aspectRatio :
  3701.             ((this.originalSize.width / this.originalSize.height) || 1);
  3702.  
  3703.         cursor = $(".ui-resizable-" + this.axis).css("cursor");
  3704.         $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
  3705.  
  3706.         el.addClass("ui-resizable-resizing");
  3707.         this._propagate("start", event);
  3708.         return true;
  3709.     },
  3710.  
  3711.     _mouseDrag: function(event) {
  3712.  
  3713.         var data, props,
  3714.             smp = this.originalMousePosition,
  3715.             a = this.axis,
  3716.             dx = (event.pageX - smp.left) || 0,
  3717.             dy = (event.pageY - smp.top) || 0,
  3718.             trigger = this._change[a];
  3719.  
  3720.         this._updatePrevProperties();
  3721.  
  3722.         if (!trigger) {
  3723.             return false;
  3724.         }
  3725.  
  3726.         data = trigger.apply(this, [ event, dx, dy ]);
  3727.  
  3728.         this._updateVirtualBoundaries(event.shiftKey);
  3729.         if (this._aspectRatio || event.shiftKey) {
  3730.             data = this._updateRatio(data, event);
  3731.         }
  3732.  
  3733.         data = this._respectSize(data, event);
  3734.  
  3735.         this._updateCache(data);
  3736.  
  3737.         this._propagate("resize", event);
  3738.  
  3739.         props = this._applyChanges();
  3740.  
  3741.         if ( !this._helper && this._proportionallyResizeElements.length ) {
  3742.             this._proportionallyResize();
  3743.         }
  3744.  
  3745.         if ( !$.isEmptyObject( props ) ) {
  3746.             this._updatePrevProperties();
  3747.             this._trigger( "resize", event, this.ui() );
  3748.             this._applyChanges();
  3749.         }
  3750.  
  3751.         return false;
  3752.     },
  3753.  
  3754.     _mouseStop: function(event) {
  3755.  
  3756.         this.resizing = false;
  3757.         var pr, ista, soffseth, soffsetw, s, left, top,
  3758.             o = this.options, that = this;
  3759.  
  3760.         if (this._helper) {
  3761.  
  3762.             pr = this._proportionallyResizeElements;
  3763.             ista = pr.length && (/textarea/i).test(pr[0].nodeName);
  3764.             soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
  3765.             soffsetw = ista ? 0 : that.sizeDiff.width;
  3766.  
  3767.             s = {
  3768.                 width: (that.helper.width()  - soffsetw),
  3769.                 height: (that.helper.height() - soffseth)
  3770.             };
  3771.             left = (parseInt(that.element.css("left"), 10) +
  3772.                 (that.position.left - that.originalPosition.left)) || null;
  3773.             top = (parseInt(that.element.css("top"), 10) +
  3774.                 (that.position.top - that.originalPosition.top)) || null;
  3775.  
  3776.             if (!o.animate) {
  3777.                 this.element.css($.extend(s, { top: top, left: left }));
  3778.             }
  3779.  
  3780.             that.helper.height(that.size.height);
  3781.             that.helper.width(that.size.width);
  3782.  
  3783.             if (this._helper && !o.animate) {
  3784.                 this._proportionallyResize();
  3785.             }
  3786.         }
  3787.  
  3788.         $("body").css("cursor", "auto");
  3789.  
  3790.         this.element.removeClass("ui-resizable-resizing");
  3791.  
  3792.         this._propagate("stop", event);
  3793.  
  3794.         if (this._helper) {
  3795.             this.helper.remove();
  3796.         }
  3797.  
  3798.         return false;
  3799.  
  3800.     },
  3801.  
  3802.     _updatePrevProperties: function() {
  3803.         this.prevPosition = {
  3804.             top: this.position.top,
  3805.             left: this.position.left
  3806.         };
  3807.         this.prevSize = {
  3808.             width: this.size.width,
  3809.             height: this.size.height
  3810.         };
  3811.     },
  3812.  
  3813.     _applyChanges: function() {
  3814.         var props = {};
  3815.  
  3816.         if ( this.position.top !== this.prevPosition.top ) {
  3817.             props.top = this.position.top + "px";
  3818.         }
  3819.         if ( this.position.left !== this.prevPosition.left ) {
  3820.             props.left = this.position.left + "px";
  3821.         }
  3822.         if ( this.size.width !== this.prevSize.width ) {
  3823.             props.width = this.size.width + "px";
  3824.         }
  3825.         if ( this.size.height !== this.prevSize.height ) {
  3826.             props.height = this.size.height + "px";
  3827.         }
  3828.  
  3829.         this.helper.css( props );
  3830.  
  3831.         return props;
  3832.     },
  3833.  
  3834.     _updateVirtualBoundaries: function(forceAspectRatio) {
  3835.         var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  3836.             o = this.options;
  3837.  
  3838.         b = {
  3839.             minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
  3840.             maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
  3841.             minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
  3842.             maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
  3843.         };
  3844.  
  3845.         if (this._aspectRatio || forceAspectRatio) {
  3846.             pMinWidth = b.minHeight * this.aspectRatio;
  3847.             pMinHeight = b.minWidth / this.aspectRatio;
  3848.             pMaxWidth = b.maxHeight * this.aspectRatio;
  3849.             pMaxHeight = b.maxWidth / this.aspectRatio;
  3850.  
  3851.             if (pMinWidth > b.minWidth) {
  3852.                 b.minWidth = pMinWidth;
  3853.             }
  3854.             if (pMinHeight > b.minHeight) {
  3855.                 b.minHeight = pMinHeight;
  3856.             }
  3857.             if (pMaxWidth < b.maxWidth) {
  3858.                 b.maxWidth = pMaxWidth;
  3859.             }
  3860.             if (pMaxHeight < b.maxHeight) {
  3861.                 b.maxHeight = pMaxHeight;
  3862.             }
  3863.         }
  3864.         this._vBoundaries = b;
  3865.     },
  3866.  
  3867.     _updateCache: function(data) {
  3868.         this.offset = this.helper.offset();
  3869.         if (this._isNumber(data.left)) {
  3870.             this.position.left = data.left;
  3871.         }
  3872.         if (this._isNumber(data.top)) {
  3873.             this.position.top = data.top;
  3874.         }
  3875.         if (this._isNumber(data.height)) {
  3876.             this.size.height = data.height;
  3877.         }
  3878.         if (this._isNumber(data.width)) {
  3879.             this.size.width = data.width;
  3880.         }
  3881.     },
  3882.  
  3883.     _updateRatio: function( data ) {
  3884.  
  3885.         var cpos = this.position,
  3886.             csize = this.size,
  3887.             a = this.axis;
  3888.  
  3889.         if (this._isNumber(data.height)) {
  3890.             data.width = (data.height * this.aspectRatio);
  3891.         } else if (this._isNumber(data.width)) {
  3892.             data.height = (data.width / this.aspectRatio);
  3893.         }
  3894.  
  3895.         if (a === "sw") {
  3896.             data.left = cpos.left + (csize.width - data.width);
  3897.             data.top = null;
  3898.         }
  3899.         if (a === "nw") {
  3900.             data.top = cpos.top + (csize.height - data.height);
  3901.             data.left = cpos.left + (csize.width - data.width);
  3902.         }
  3903.  
  3904.         return data;
  3905.     },
  3906.  
  3907.     _respectSize: function( data ) {
  3908.  
  3909.         var o = this._vBoundaries,
  3910.             a = this.axis,
  3911.             ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
  3912.             ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  3913.             isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
  3914.             isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
  3915.             dw = this.originalPosition.left + this.originalSize.width,
  3916.             dh = this.position.top + this.size.height,
  3917.             cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  3918.         if (isminw) {
  3919.             data.width = o.minWidth;
  3920.         }
  3921.         if (isminh) {
  3922.             data.height = o.minHeight;
  3923.         }
  3924.         if (ismaxw) {
  3925.             data.width = o.maxWidth;
  3926.         }
  3927.         if (ismaxh) {
  3928.             data.height = o.maxHeight;
  3929.         }
  3930.  
  3931.         if (isminw && cw) {
  3932.             data.left = dw - o.minWidth;
  3933.         }
  3934.         if (ismaxw && cw) {
  3935.             data.left = dw - o.maxWidth;
  3936.         }
  3937.         if (isminh && ch) {
  3938.             data.top = dh - o.minHeight;
  3939.         }
  3940.         if (ismaxh && ch) {
  3941.             data.top = dh - o.maxHeight;
  3942.         }
  3943.  
  3944.         // Fixing jump error on top/left - bug #2330
  3945.         if (!data.width && !data.height && !data.left && data.top) {
  3946.             data.top = null;
  3947.         } else if (!data.width && !data.height && !data.top && data.left) {
  3948.             data.left = null;
  3949.         }
  3950.  
  3951.         return data;
  3952.     },
  3953.  
  3954.     _getPaddingPlusBorderDimensions: function( element ) {
  3955.         var i = 0,
  3956.             widths = [],
  3957.             borders = [
  3958.                 element.css( "borderTopWidth" ),
  3959.                 element.css( "borderRightWidth" ),
  3960.                 element.css( "borderBottomWidth" ),
  3961.                 element.css( "borderLeftWidth" )
  3962.             ],
  3963.             paddings = [
  3964.                 element.css( "paddingTop" ),
  3965.                 element.css( "paddingRight" ),
  3966.                 element.css( "paddingBottom" ),
  3967.                 element.css( "paddingLeft" )
  3968.             ];
  3969.  
  3970.         for ( ; i < 4; i++ ) {
  3971.             widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
  3972.             widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
  3973.         }
  3974.  
  3975.         return {
  3976.             height: widths[ 0 ] + widths[ 2 ],
  3977.             width: widths[ 1 ] + widths[ 3 ]
  3978.         };
  3979.     },
  3980.  
  3981.     _proportionallyResize: function() {
  3982.  
  3983.         if (!this._proportionallyResizeElements.length) {
  3984.             return;
  3985.         }
  3986.  
  3987.         var prel,
  3988.             i = 0,
  3989.             element = this.helper || this.element;
  3990.  
  3991.         for ( ; i < this._proportionallyResizeElements.length; i++) {
  3992.  
  3993.             prel = this._proportionallyResizeElements[i];
  3994.  
  3995.             // TODO: Seems like a bug to cache this.outerDimensions
  3996.             // considering that we are in a loop.
  3997.             if (!this.outerDimensions) {
  3998.                 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
  3999.             }
  4000.  
  4001.             prel.css({
  4002.                 height: (element.height() - this.outerDimensions.height) || 0,
  4003.                 width: (element.width() - this.outerDimensions.width) || 0
  4004.             });
  4005.  
  4006.         }
  4007.  
  4008.     },
  4009.  
  4010.     _renderProxy: function() {
  4011.  
  4012.         var el = this.element, o = this.options;
  4013.         this.elementOffset = el.offset();
  4014.  
  4015.         if (this._helper) {
  4016.  
  4017.             this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
  4018.  
  4019.             this.helper.addClass(this._helper).css({
  4020.                 width: this.element.outerWidth() - 1,
  4021.                 height: this.element.outerHeight() - 1,
  4022.                 position: "absolute",
  4023.                 left: this.elementOffset.left + "px",
  4024.                 top: this.elementOffset.top + "px",
  4025.                 zIndex: ++o.zIndex //TODO: Don't modify option
  4026.             });
  4027.  
  4028.             this.helper
  4029.                 .appendTo("body")
  4030.                 .disableSelection();
  4031.  
  4032.         } else {
  4033.             this.helper = this.element;
  4034.         }
  4035.  
  4036.     },
  4037.  
  4038.     _change: {
  4039.         e: function(event, dx) {
  4040.             return { width: this.originalSize.width + dx };
  4041.         },
  4042.         w: function(event, dx) {
  4043.             var cs = this.originalSize, sp = this.originalPosition;
  4044.             return { left: sp.left + dx, width: cs.width - dx };
  4045.         },
  4046.         n: function(event, dx, dy) {
  4047.             var cs = this.originalSize, sp = this.originalPosition;
  4048.             return { top: sp.top + dy, height: cs.height - dy };
  4049.         },
  4050.         s: function(event, dx, dy) {
  4051.             return { height: this.originalSize.height + dy };
  4052.         },
  4053.         se: function(event, dx, dy) {
  4054.             return $.extend(this._change.s.apply(this, arguments),
  4055.                 this._change.e.apply(this, [ event, dx, dy ]));
  4056.         },
  4057.         sw: function(event, dx, dy) {
  4058.             return $.extend(this._change.s.apply(this, arguments),
  4059.                 this._change.w.apply(this, [ event, dx, dy ]));
  4060.         },
  4061.         ne: function(event, dx, dy) {
  4062.             return $.extend(this._change.n.apply(this, arguments),
  4063.                 this._change.e.apply(this, [ event, dx, dy ]));
  4064.         },
  4065.         nw: function(event, dx, dy) {
  4066.             return $.extend(this._change.n.apply(this, arguments),
  4067.                 this._change.w.apply(this, [ event, dx, dy ]));
  4068.         }
  4069.     },
  4070.  
  4071.     _propagate: function(n, event) {
  4072.         $.ui.plugin.call(this, n, [ event, this.ui() ]);
  4073.         (n !== "resize" && this._trigger(n, event, this.ui()));
  4074.     },
  4075.  
  4076.     plugins: {},
  4077.  
  4078.     ui: function() {
  4079.         return {
  4080.             originalElement: this.originalElement,
  4081.             element: this.element,
  4082.             helper: this.helper,
  4083.             position: this.position,
  4084.             size: this.size,
  4085.             originalSize: this.originalSize,
  4086.             originalPosition: this.originalPosition
  4087.         };
  4088.     }
  4089.  
  4090. });
  4091.  
  4092. /*
  4093.  * Resizable Extensions
  4094.  */
  4095.  
  4096. $.ui.plugin.add("resizable", "animate", {
  4097.  
  4098.     stop: function( event ) {
  4099.         var that = $(this).resizable( "instance" ),
  4100.             o = that.options,
  4101.             pr = that._proportionallyResizeElements,
  4102.             ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  4103.             soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
  4104.             soffsetw = ista ? 0 : that.sizeDiff.width,
  4105.             style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
  4106.             left = (parseInt(that.element.css("left"), 10) +
  4107.                 (that.position.left - that.originalPosition.left)) || null,
  4108.             top = (parseInt(that.element.css("top"), 10) +
  4109.                 (that.position.top - that.originalPosition.top)) || null;
  4110.  
  4111.         that.element.animate(
  4112.             $.extend(style, top && left ? { top: top, left: left } : {}), {
  4113.                 duration: o.animateDuration,
  4114.                 easing: o.animateEasing,
  4115.                 step: function() {
  4116.  
  4117.                     var data = {
  4118.                         width: parseInt(that.element.css("width"), 10),
  4119.                         height: parseInt(that.element.css("height"), 10),
  4120.                         top: parseInt(that.element.css("top"), 10),
  4121.                         left: parseInt(that.element.css("left"), 10)
  4122.                     };
  4123.  
  4124.                     if (pr && pr.length) {
  4125.                         $(pr[0]).css({ width: data.width, height: data.height });
  4126.                     }
  4127.  
  4128.                     // propagating resize, and updating values for each animation step
  4129.                     that._updateCache(data);
  4130.                     that._propagate("resize", event);
  4131.  
  4132.                 }
  4133.             }
  4134.         );
  4135.     }
  4136.  
  4137. });
  4138.  
  4139. $.ui.plugin.add( "resizable", "containment", {
  4140.  
  4141.     start: function() {
  4142.         var element, p, co, ch, cw, width, height,
  4143.             that = $( this ).resizable( "instance" ),
  4144.             o = that.options,
  4145.             el = that.element,
  4146.             oc = o.containment,
  4147.             ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
  4148.  
  4149.         if ( !ce ) {
  4150.             return;
  4151.         }
  4152.  
  4153.         that.containerElement = $( ce );
  4154.  
  4155.         if ( /document/.test( oc ) || oc === document ) {
  4156.             that.containerOffset = {
  4157.                 left: 0,
  4158.                 top: 0
  4159.             };
  4160.             that.containerPosition = {
  4161.                 left: 0,
  4162.                 top: 0
  4163.             };
  4164.  
  4165.             that.parentData = {
  4166.                 element: $( document ),
  4167.                 left: 0,
  4168.                 top: 0,
  4169.                 width: $( document ).width(),
  4170.                 height: $( document ).height() || document.body.parentNode.scrollHeight
  4171.             };
  4172.         } else {
  4173.             element = $( ce );
  4174.             p = [];
  4175.             $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
  4176.                 p[ i ] = that._num( element.css( "padding" + name ) );
  4177.             });
  4178.  
  4179.             that.containerOffset = element.offset();
  4180.             that.containerPosition = element.position();
  4181.             that.containerSize = {
  4182.                 height: ( element.innerHeight() - p[ 3 ] ),
  4183.                 width: ( element.innerWidth() - p[ 1 ] )
  4184.             };
  4185.  
  4186.             co = that.containerOffset;
  4187.             ch = that.containerSize.height;
  4188.             cw = that.containerSize.width;
  4189.             width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
  4190.             height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
  4191.  
  4192.             that.parentData = {
  4193.                 element: ce,
  4194.                 left: co.left,
  4195.                 top: co.top,
  4196.                 width: width,
  4197.                 height: height
  4198.             };
  4199.         }
  4200.     },
  4201.  
  4202.     resize: function( event ) {
  4203.         var woset, hoset, isParent, isOffsetRelative,
  4204.             that = $( this ).resizable( "instance" ),
  4205.             o = that.options,
  4206.             co = that.containerOffset,
  4207.             cp = that.position,
  4208.             pRatio = that._aspectRatio || event.shiftKey,
  4209.             cop = {
  4210.                 top: 0,
  4211.                 left: 0
  4212.             },
  4213.             ce = that.containerElement,
  4214.             continueResize = true;
  4215.  
  4216.         if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
  4217.             cop = co;
  4218.         }
  4219.  
  4220.         if ( cp.left < ( that._helper ? co.left : 0 ) ) {
  4221.             that.size.width = that.size.width +
  4222.                 ( that._helper ?
  4223.                     ( that.position.left - co.left ) :
  4224.                     ( that.position.left - cop.left ) );
  4225.  
  4226.             if ( pRatio ) {
  4227.                 that.size.height = that.size.width / that.aspectRatio;
  4228.                 continueResize = false;
  4229.             }
  4230.             that.position.left = o.helper ? co.left : 0;
  4231.         }
  4232.  
  4233.         if ( cp.top < ( that._helper ? co.top : 0 ) ) {
  4234.             that.size.height = that.size.height +
  4235.                 ( that._helper ?
  4236.                     ( that.position.top - co.top ) :
  4237.                     that.position.top );
  4238.  
  4239.             if ( pRatio ) {
  4240.                 that.size.width = that.size.height * that.aspectRatio;
  4241.                 continueResize = false;
  4242.             }
  4243.             that.position.top = that._helper ? co.top : 0;
  4244.         }
  4245.  
  4246.         isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
  4247.         isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
  4248.  
  4249.         if ( isParent && isOffsetRelative ) {
  4250.             that.offset.left = that.parentData.left + that.position.left;
  4251.             that.offset.top = that.parentData.top + that.position.top;
  4252.         } else {
  4253.             that.offset.left = that.element.offset().left;
  4254.             that.offset.top = that.element.offset().top;
  4255.         }
  4256.  
  4257.         woset = Math.abs( that.sizeDiff.width +
  4258.             (that._helper ?
  4259.                 that.offset.left - cop.left :
  4260.                 (that.offset.left - co.left)) );
  4261.  
  4262.         hoset = Math.abs( that.sizeDiff.height +
  4263.             (that._helper ?
  4264.                 that.offset.top - cop.top :
  4265.                 (that.offset.top - co.top)) );
  4266.  
  4267.         if ( woset + that.size.width >= that.parentData.width ) {
  4268.             that.size.width = that.parentData.width - woset;
  4269.             if ( pRatio ) {
  4270.                 that.size.height = that.size.width / that.aspectRatio;
  4271.                 continueResize = false;
  4272.             }
  4273.         }
  4274.  
  4275.         if ( hoset + that.size.height >= that.parentData.height ) {
  4276.             that.size.height = that.parentData.height - hoset;
  4277.             if ( pRatio ) {
  4278.                 that.size.width = that.size.height * that.aspectRatio;
  4279.                 continueResize = false;
  4280.             }
  4281.         }
  4282.  
  4283.         if ( !continueResize ) {
  4284.             that.position.left = that.prevPosition.left;
  4285.             that.position.top = that.prevPosition.top;
  4286.             that.size.width = that.prevSize.width;
  4287.             that.size.height = that.prevSize.height;
  4288.         }
  4289.     },
  4290.  
  4291.     stop: function() {
  4292.         var that = $( this ).resizable( "instance" ),
  4293.             o = that.options,
  4294.             co = that.containerOffset,
  4295.             cop = that.containerPosition,
  4296.             ce = that.containerElement,
  4297.             helper = $( that.helper ),
  4298.             ho = helper.offset(),
  4299.             w = helper.outerWidth() - that.sizeDiff.width,
  4300.             h = helper.outerHeight() - that.sizeDiff.height;
  4301.  
  4302.         if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
  4303.             $( this ).css({
  4304.                 left: ho.left - cop.left - co.left,
  4305.                 width: w,
  4306.                 height: h
  4307.             });
  4308.         }
  4309.  
  4310.         if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
  4311.             $( this ).css({
  4312.                 left: ho.left - cop.left - co.left,
  4313.                 width: w,
  4314.                 height: h
  4315.             });
  4316.         }
  4317.     }
  4318. });
  4319.  
  4320. $.ui.plugin.add("resizable", "alsoResize", {
  4321.  
  4322.     start: function() {
  4323.         var that = $(this).resizable( "instance" ),
  4324.             o = that.options;
  4325.  
  4326.         $(o.alsoResize).each(function() {
  4327.             var el = $(this);
  4328.             el.data("ui-resizable-alsoresize", {
  4329.                 width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
  4330.                 left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
  4331.             });
  4332.         });
  4333.     },
  4334.  
  4335.     resize: function(event, ui) {
  4336.         var that = $(this).resizable( "instance" ),
  4337.             o = that.options,
  4338.             os = that.originalSize,
  4339.             op = that.originalPosition,
  4340.             delta = {
  4341.                 height: (that.size.height - os.height) || 0,
  4342.                 width: (that.size.width - os.width) || 0,
  4343.                 top: (that.position.top - op.top) || 0,
  4344.                 left: (that.position.left - op.left) || 0
  4345.             };
  4346.  
  4347.             $(o.alsoResize).each(function() {
  4348.                 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
  4349.                     css = el.parents(ui.originalElement[0]).length ?
  4350.                             [ "width", "height" ] :
  4351.                             [ "width", "height", "top", "left" ];
  4352.  
  4353.                 $.each(css, function(i, prop) {
  4354.                     var sum = (start[prop] || 0) + (delta[prop] || 0);
  4355.                     if (sum && sum >= 0) {
  4356.                         style[prop] = sum || null;
  4357.                     }
  4358.                 });
  4359.  
  4360.                 el.css(style);
  4361.             });
  4362.     },
  4363.  
  4364.     stop: function() {
  4365.         $(this).removeData("resizable-alsoresize");
  4366.     }
  4367. });
  4368.  
  4369. $.ui.plugin.add("resizable", "ghost", {
  4370.  
  4371.     start: function() {
  4372.  
  4373.         var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
  4374.  
  4375.         that.ghost = that.originalElement.clone();
  4376.         that.ghost
  4377.             .css({
  4378.                 opacity: 0.25,
  4379.                 display: "block",
  4380.                 position: "relative",
  4381.                 height: cs.height,
  4382.                 width: cs.width,
  4383.                 margin: 0,
  4384.                 left: 0,
  4385.                 top: 0
  4386.             })
  4387.             .addClass("ui-resizable-ghost")
  4388.             .addClass(typeof o.ghost === "string" ? o.ghost : "");
  4389.  
  4390.         that.ghost.appendTo(that.helper);
  4391.  
  4392.     },
  4393.  
  4394.     resize: function() {
  4395.         var that = $(this).resizable( "instance" );
  4396.         if (that.ghost) {
  4397.             that.ghost.css({
  4398.                 position: "relative",
  4399.                 height: that.size.height,
  4400.                 width: that.size.width
  4401.             });
  4402.         }
  4403.     },
  4404.  
  4405.     stop: function() {
  4406.         var that = $(this).resizable( "instance" );
  4407.         if (that.ghost && that.helper) {
  4408.             that.helper.get(0).removeChild(that.ghost.get(0));
  4409.         }
  4410.     }
  4411.  
  4412. });
  4413.  
  4414. $.ui.plugin.add("resizable", "grid", {
  4415.  
  4416.     resize: function() {
  4417.         var outerDimensions,
  4418.             that = $(this).resizable( "instance" ),
  4419.             o = that.options,
  4420.             cs = that.size,
  4421.             os = that.originalSize,
  4422.             op = that.originalPosition,
  4423.             a = that.axis,
  4424.             grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
  4425.             gridX = (grid[0] || 1),
  4426.             gridY = (grid[1] || 1),
  4427.             ox = Math.round((cs.width - os.width) / gridX) * gridX,
  4428.             oy = Math.round((cs.height - os.height) / gridY) * gridY,
  4429.             newWidth = os.width + ox,
  4430.             newHeight = os.height + oy,
  4431.             isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
  4432.             isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
  4433.             isMinWidth = o.minWidth && (o.minWidth > newWidth),
  4434.             isMinHeight = o.minHeight && (o.minHeight > newHeight);
  4435.  
  4436.         o.grid = grid;
  4437.  
  4438.         if (isMinWidth) {
  4439.             newWidth += gridX;
  4440.         }
  4441.         if (isMinHeight) {
  4442.             newHeight += gridY;
  4443.         }
  4444.         if (isMaxWidth) {
  4445.             newWidth -= gridX;
  4446.         }
  4447.         if (isMaxHeight) {
  4448.             newHeight -= gridY;
  4449.         }
  4450.  
  4451.         if (/^(se|s|e)$/.test(a)) {
  4452.             that.size.width = newWidth;
  4453.             that.size.height = newHeight;
  4454.         } else if (/^(ne)$/.test(a)) {
  4455.             that.size.width = newWidth;
  4456.             that.size.height = newHeight;
  4457.             that.position.top = op.top - oy;
  4458.         } else if (/^(sw)$/.test(a)) {
  4459.             that.size.width = newWidth;
  4460.             that.size.height = newHeight;
  4461.             that.position.left = op.left - ox;
  4462.         } else {
  4463.             if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
  4464.                 outerDimensions = that._getPaddingPlusBorderDimensions( this );
  4465.             }
  4466.  
  4467.             if ( newHeight - gridY > 0 ) {
  4468.                 that.size.height = newHeight;
  4469.                 that.position.top = op.top - oy;
  4470.             } else {
  4471.                 newHeight = gridY - outerDimensions.height;
  4472.                 that.size.height = newHeight;
  4473.                 that.position.top = op.top + os.height - newHeight;
  4474.             }
  4475.             if ( newWidth - gridX > 0 ) {
  4476.                 that.size.width = newWidth;
  4477.                 that.position.left = op.left - ox;
  4478.             } else {
  4479.                 newWidth = gridX - outerDimensions.width;
  4480.                 that.size.width = newWidth;
  4481.                 that.position.left = op.left + os.width - newWidth;
  4482.             }
  4483.         }
  4484.     }
  4485.  
  4486. });
  4487.  
  4488. var resizable = $.ui.resizable;
  4489.  
  4490.  
  4491. /*!
  4492.  * jQuery UI Selectable 1.11.4
  4493.  * http://jqueryui.com
  4494.  *
  4495.  * Copyright jQuery Foundation and other contributors
  4496.  * Released under the MIT license.
  4497.  * http://jquery.org/license
  4498.  *
  4499.  * http://api.jqueryui.com/selectable/
  4500.  */
  4501.  
  4502.  
  4503. var selectable = $.widget("ui.selectable", $.ui.mouse, {
  4504.     version: "1.11.4",
  4505.     options: {
  4506.         appendTo: "body",
  4507.         autoRefresh: true,
  4508.         distance: 0,
  4509.         filter: "*",
  4510.         tolerance: "touch",
  4511.  
  4512.         // callbacks
  4513.         selected: null,
  4514.         selecting: null,
  4515.         start: null,
  4516.         stop: null,
  4517.         unselected: null,
  4518.         unselecting: null
  4519.     },
  4520.     _create: function() {
  4521.         var selectees,
  4522.             that = this;
  4523.  
  4524.         this.element.addClass("ui-selectable");
  4525.  
  4526.         this.dragged = false;
  4527.  
  4528.         // cache selectee children based on filter
  4529.         this.refresh = function() {
  4530.             selectees = $(that.options.filter, that.element[0]);
  4531.             selectees.addClass("ui-selectee");
  4532.             selectees.each(function() {
  4533.                 var $this = $(this),
  4534.                     pos = $this.offset();
  4535.                 $.data(this, "selectable-item", {
  4536.                     element: this,
  4537.                     $element: $this,
  4538.                     left: pos.left,
  4539.                     top: pos.top,
  4540.                     right: pos.left + $this.outerWidth(),
  4541.                     bottom: pos.top + $this.outerHeight(),
  4542.                     startselected: false,
  4543.                     selected: $this.hasClass("ui-selected"),
  4544.                     selecting: $this.hasClass("ui-selecting"),
  4545.                     unselecting: $this.hasClass("ui-unselecting")
  4546.                 });
  4547.             });
  4548.         };
  4549.         this.refresh();
  4550.  
  4551.         this.selectees = selectees.addClass("ui-selectee");
  4552.  
  4553.         this._mouseInit();
  4554.  
  4555.         this.helper = $("<div class='ui-selectable-helper'></div>");
  4556.     },
  4557.  
  4558.     _destroy: function() {
  4559.         this.selectees
  4560.             .removeClass("ui-selectee")
  4561.             .removeData("selectable-item");
  4562.         this.element
  4563.             .removeClass("ui-selectable ui-selectable-disabled");
  4564.         this._mouseDestroy();
  4565.     },
  4566.  
  4567.     _mouseStart: function(event) {
  4568.         var that = this,
  4569.             options = this.options;
  4570.  
  4571.         this.opos = [ event.pageX, event.pageY ];
  4572.  
  4573.         if (this.options.disabled) {
  4574.             return;
  4575.         }
  4576.  
  4577.         this.selectees = $(options.filter, this.element[0]);
  4578.  
  4579.         this._trigger("start", event);
  4580.  
  4581.         $(options.appendTo).append(this.helper);
  4582.         // position helper (lasso)
  4583.         this.helper.css({
  4584.             "left": event.pageX,
  4585.             "top": event.pageY,
  4586.             "width": 0,
  4587.             "height": 0
  4588.         });
  4589.  
  4590.         if (options.autoRefresh) {
  4591.             this.refresh();
  4592.         }
  4593.  
  4594.         this.selectees.filter(".ui-selected").each(function() {
  4595.             var selectee = $.data(this, "selectable-item");
  4596.             selectee.startselected = true;
  4597.             if (!event.metaKey && !event.ctrlKey) {
  4598.                 selectee.$element.removeClass("ui-selected");
  4599.                 selectee.selected = false;
  4600.                 selectee.$element.addClass("ui-unselecting");
  4601.                 selectee.unselecting = true;
  4602.                 // selectable UNSELECTING callback
  4603.                 that._trigger("unselecting", event, {
  4604.                     unselecting: selectee.element
  4605.                 });
  4606.             }
  4607.         });
  4608.  
  4609.         $(event.target).parents().addBack().each(function() {
  4610.             var doSelect,
  4611.                 selectee = $.data(this, "selectable-item");
  4612.             if (selectee) {
  4613.                 doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
  4614.                 selectee.$element
  4615.                     .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
  4616.                     .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
  4617.                 selectee.unselecting = !doSelect;
  4618.                 selectee.selecting = doSelect;
  4619.                 selectee.selected = doSelect;
  4620.                 // selectable (UN)SELECTING callback
  4621.                 if (doSelect) {
  4622.                     that._trigger("selecting", event, {
  4623.                         selecting: selectee.element
  4624.                     });
  4625.                 } else {
  4626.                     that._trigger("unselecting", event, {
  4627.                         unselecting: selectee.element
  4628.                     });
  4629.                 }
  4630.                 return false;
  4631.             }
  4632.         });
  4633.  
  4634.     },
  4635.  
  4636.     _mouseDrag: function(event) {
  4637.  
  4638.         this.dragged = true;
  4639.  
  4640.         if (this.options.disabled) {
  4641.             return;
  4642.         }
  4643.  
  4644.         var tmp,
  4645.             that = this,
  4646.             options = this.options,
  4647.             x1 = this.opos[0],
  4648.             y1 = this.opos[1],
  4649.             x2 = event.pageX,
  4650.             y2 = event.pageY;
  4651.  
  4652.         if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
  4653.         if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
  4654.         this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
  4655.  
  4656.         this.selectees.each(function() {
  4657.             var selectee = $.data(this, "selectable-item"),
  4658.                 hit = false;
  4659.  
  4660.             //prevent helper from being selected if appendTo: selectable
  4661.             if (!selectee || selectee.element === that.element[0]) {
  4662.                 return;
  4663.             }
  4664.  
  4665.             if (options.tolerance === "touch") {
  4666.                 hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  4667.             } else if (options.tolerance === "fit") {
  4668.                 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  4669.             }
  4670.  
  4671.             if (hit) {
  4672.                 // SELECT
  4673.                 if (selectee.selected) {
  4674.                     selectee.$element.removeClass("ui-selected");
  4675.                     selectee.selected = false;
  4676.                 }
  4677.                 if (selectee.unselecting) {
  4678.                     selectee.$element.removeClass("ui-unselecting");
  4679.                     selectee.unselecting = false;
  4680.                 }
  4681.                 if (!selectee.selecting) {
  4682.                     selectee.$element.addClass("ui-selecting");
  4683.                     selectee.selecting = true;
  4684.                     // selectable SELECTING callback
  4685.                     that._trigger("selecting", event, {
  4686.                         selecting: selectee.element
  4687.                     });
  4688.                 }
  4689.             } else {
  4690.                 // UNSELECT
  4691.                 if (selectee.selecting) {
  4692.                     if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
  4693.                         selectee.$element.removeClass("ui-selecting");
  4694.                         selectee.selecting = false;
  4695.                         selectee.$element.addClass("ui-selected");
  4696.                         selectee.selected = true;
  4697.                     } else {
  4698.                         selectee.$element.removeClass("ui-selecting");
  4699.                         selectee.selecting = false;
  4700.                         if (selectee.startselected) {
  4701.                             selectee.$element.addClass("ui-unselecting");
  4702.                             selectee.unselecting = true;
  4703.                         }
  4704.                         // selectable UNSELECTING callback
  4705.                         that._trigger("unselecting", event, {
  4706.                             unselecting: selectee.element
  4707.                         });
  4708.                     }
  4709.                 }
  4710.                 if (selectee.selected) {
  4711.                     if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
  4712.                         selectee.$element.removeClass("ui-selected");
  4713.                         selectee.selected = false;
  4714.  
  4715.                         selectee.$element.addClass("ui-unselecting");
  4716.                         selectee.unselecting = true;
  4717.                         // selectable UNSELECTING callback
  4718.                         that._trigger("unselecting", event, {
  4719.                             unselecting: selectee.element
  4720.                         });
  4721.                     }
  4722.                 }
  4723.             }
  4724.         });
  4725.  
  4726.         return false;
  4727.     },
  4728.  
  4729.     _mouseStop: function(event) {
  4730.         var that = this;
  4731.  
  4732.         this.dragged = false;
  4733.  
  4734.         $(".ui-unselecting", this.element[0]).each(function() {
  4735.             var selectee = $.data(this, "selectable-item");
  4736.             selectee.$element.removeClass("ui-unselecting");
  4737.             selectee.unselecting = false;
  4738.             selectee.startselected = false;
  4739.             that._trigger("unselected", event, {
  4740.                 unselected: selectee.element
  4741.             });
  4742.         });
  4743.         $(".ui-selecting", this.element[0]).each(function() {
  4744.             var selectee = $.data(this, "selectable-item");
  4745.             selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
  4746.             selectee.selecting = false;
  4747.             selectee.selected = true;
  4748.             selectee.startselected = true;
  4749.             that._trigger("selected", event, {
  4750.                 selected: selectee.element
  4751.             });
  4752.         });
  4753.         this._trigger("stop", event);
  4754.  
  4755.         this.helper.remove();
  4756.  
  4757.         return false;
  4758.     }
  4759.  
  4760. });
  4761.  
  4762.  
  4763. /*!
  4764.  * jQuery UI Sortable 1.11.4
  4765.  * http://jqueryui.com
  4766.  *
  4767.  * Copyright jQuery Foundation and other contributors
  4768.  * Released under the MIT license.
  4769.  * http://jquery.org/license
  4770.  *
  4771.  * http://api.jqueryui.com/sortable/
  4772.  */
  4773.  
  4774.  
  4775. var sortable = $.widget("ui.sortable", $.ui.mouse, {
  4776.     version: "1.11.4",
  4777.     widgetEventPrefix: "sort",
  4778.     ready: false,
  4779.     options: {
  4780.         appendTo: "parent",
  4781.         axis: false,
  4782.         connectWith: false,
  4783.         containment: false,
  4784.         cursor: "auto",
  4785.         cursorAt: false,
  4786.         dropOnEmpty: true,
  4787.         forcePlaceholderSize: false,
  4788.         forceHelperSize: false,
  4789.         grid: false,
  4790.         handle: false,
  4791.         helper: "original",
  4792.         items: "> *",
  4793.         opacity: false,
  4794.         placeholder: false,
  4795.         revert: false,
  4796.         scroll: true,
  4797.         scrollSensitivity: 20,
  4798.         scrollSpeed: 20,
  4799.         scope: "default",
  4800.         tolerance: "intersect",
  4801.         zIndex: 1000,
  4802.  
  4803.         // callbacks
  4804.         activate: null,
  4805.         beforeStop: null,
  4806.         change: null,
  4807.         deactivate: null,
  4808.         out: null,
  4809.         over: null,
  4810.         receive: null,
  4811.         remove: null,
  4812.         sort: null,
  4813.         start: null,
  4814.         stop: null,
  4815.         update: null
  4816.     },
  4817.  
  4818.     _isOverAxis: function( x, reference, size ) {
  4819.         return ( x >= reference ) && ( x < ( reference + size ) );
  4820.     },
  4821.  
  4822.     _isFloating: function( item ) {
  4823.         return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  4824.     },
  4825.  
  4826.     _create: function() {
  4827.         this.containerCache = {};
  4828.         this.element.addClass("ui-sortable");
  4829.  
  4830.         //Get the items
  4831.         this.refresh();
  4832.  
  4833.         //Let's determine the parent's offset
  4834.         this.offset = this.element.offset();
  4835.  
  4836.         //Initialize mouse events for interaction
  4837.         this._mouseInit();
  4838.  
  4839.         this._setHandleClassName();
  4840.  
  4841.         //We're ready to go
  4842.         this.ready = true;
  4843.  
  4844.     },
  4845.  
  4846.     _setOption: function( key, value ) {
  4847.         this._super( key, value );
  4848.  
  4849.         if ( key === "handle" ) {
  4850.             this._setHandleClassName();
  4851.         }
  4852.     },
  4853.  
  4854.     _setHandleClassName: function() {
  4855.         this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
  4856.         $.each( this.items, function() {
  4857.             ( this.instance.options.handle ?
  4858.                 this.item.find( this.instance.options.handle ) : this.item )
  4859.                 .addClass( "ui-sortable-handle" );
  4860.         });
  4861.     },
  4862.  
  4863.     _destroy: function() {
  4864.         this.element
  4865.             .removeClass( "ui-sortable ui-sortable-disabled" )
  4866.             .find( ".ui-sortable-handle" )
  4867.                 .removeClass( "ui-sortable-handle" );
  4868.         this._mouseDestroy();
  4869.  
  4870.         for ( var i = this.items.length - 1; i >= 0; i-- ) {
  4871.             this.items[i].item.removeData(this.widgetName + "-item");
  4872.         }
  4873.  
  4874.         return this;
  4875.     },
  4876.  
  4877.     _mouseCapture: function(event, overrideHandle) {
  4878.         var currentItem = null,
  4879.             validHandle = false,
  4880.             that = this;
  4881.  
  4882.         if (this.reverting) {
  4883.             return false;
  4884.         }
  4885.  
  4886.         if(this.options.disabled || this.options.type === "static") {
  4887.             return false;
  4888.         }
  4889.  
  4890.         //We have to refresh the items data once first
  4891.         this._refreshItems(event);
  4892.  
  4893.         //Find out if the clicked node (or one of its parents) is a actual item in this.items
  4894.         $(event.target).parents().each(function() {
  4895.             if($.data(this, that.widgetName + "-item") === that) {
  4896.                 currentItem = $(this);
  4897.                 return false;
  4898.             }
  4899.         });
  4900.         if($.data(event.target, that.widgetName + "-item") === that) {
  4901.             currentItem = $(event.target);
  4902.         }
  4903.  
  4904.         if(!currentItem) {
  4905.             return false;
  4906.         }
  4907.         if(this.options.handle && !overrideHandle) {
  4908.             $(this.options.handle, currentItem).find("*").addBack().each(function() {
  4909.                 if(this === event.target) {
  4910.                     validHandle = true;
  4911.                 }
  4912.             });
  4913.             if(!validHandle) {
  4914.                 return false;
  4915.             }
  4916.         }
  4917.  
  4918.         this.currentItem = currentItem;
  4919.         this._removeCurrentsFromItems();
  4920.         return true;
  4921.  
  4922.     },
  4923.  
  4924.     _mouseStart: function(event, overrideHandle, noActivation) {
  4925.  
  4926.         var i, body,
  4927.             o = this.options;
  4928.  
  4929.         this.currentContainer = this;
  4930.  
  4931.         //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  4932.         this.refreshPositions();
  4933.  
  4934.         //Create and append the visible helper
  4935.         this.helper = this._createHelper(event);
  4936.  
  4937.         //Cache the helper size
  4938.         this._cacheHelperProportions();
  4939.  
  4940.         /*
  4941.          * - Position generation -
  4942.          * This block generates everything position related - it's the core of draggables.
  4943.          */
  4944.  
  4945.         //Cache the margins of the original element
  4946.         this._cacheMargins();
  4947.  
  4948.         //Get the next scrolling parent
  4949.         this.scrollParent = this.helper.scrollParent();
  4950.  
  4951.         //The element's absolute position on the page minus margins
  4952.         this.offset = this.currentItem.offset();
  4953.         this.offset = {
  4954.             top: this.offset.top - this.margins.top,
  4955.             left: this.offset.left - this.margins.left
  4956.         };
  4957.  
  4958.         $.extend(this.offset, {
  4959.             click: { //Where the click happened, relative to the element
  4960.                 left: event.pageX - this.offset.left,
  4961.                 top: event.pageY - this.offset.top
  4962.             },
  4963.             parent: this._getParentOffset(),
  4964.             relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  4965.         });
  4966.  
  4967.         // Only after we got the offset, we can change the helper's position to absolute
  4968.         // TODO: Still need to figure out a way to make relative sorting possible
  4969.         this.helper.css("position", "absolute");
  4970.         this.cssPosition = this.helper.css("position");
  4971.  
  4972.         //Generate the original position
  4973.         this.originalPosition = this._generatePosition(event);
  4974.         this.originalPageX = event.pageX;
  4975.         this.originalPageY = event.pageY;
  4976.  
  4977.         //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  4978.         (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  4979.  
  4980.         //Cache the former DOM position
  4981.         this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  4982.  
  4983.         //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
  4984.         if(this.helper[0] !== this.currentItem[0]) {
  4985.             this.currentItem.hide();
  4986.         }
  4987.  
  4988.         //Create the placeholder
  4989.         this._createPlaceholder();
  4990.  
  4991.         //Set a containment if given in the options
  4992.         if(o.containment) {
  4993.             this._setContainment();
  4994.         }
  4995.  
  4996.         if( o.cursor && o.cursor !== "auto" ) { // cursor option
  4997.             body = this.document.find( "body" );
  4998.  
  4999.             // support: IE
  5000.             this.storedCursor = body.css( "cursor" );
  5001.             body.css( "cursor", o.cursor );
  5002.  
  5003.             this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
  5004.         }
  5005.  
  5006.         if(o.opacity) { // opacity option
  5007.             if (this.helper.css("opacity")) {
  5008.                 this._storedOpacity = this.helper.css("opacity");
  5009.             }
  5010.             this.helper.css("opacity", o.opacity);
  5011.         }
  5012.  
  5013.         if(o.zIndex) { // zIndex option
  5014.             if (this.helper.css("zIndex")) {
  5015.                 this._storedZIndex = this.helper.css("zIndex");
  5016.             }
  5017.             this.helper.css("zIndex", o.zIndex);
  5018.         }
  5019.  
  5020.         //Prepare scrolling
  5021.         if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  5022.             this.overflowOffset = this.scrollParent.offset();
  5023.         }
  5024.  
  5025.         //Call callbacks
  5026.         this._trigger("start", event, this._uiHash());
  5027.  
  5028.         //Recache the helper size
  5029.         if(!this._preserveHelperProportions) {
  5030.             this._cacheHelperProportions();
  5031.         }
  5032.  
  5033.  
  5034.         //Post "activate" events to possible containers
  5035.         if( !noActivation ) {
  5036.             for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5037.                 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  5038.             }
  5039.         }
  5040.  
  5041.         //Prepare possible droppables
  5042.         if($.ui.ddmanager) {
  5043.             $.ui.ddmanager.current = this;
  5044.         }
  5045.  
  5046.         if ($.ui.ddmanager && !o.dropBehaviour) {
  5047.             $.ui.ddmanager.prepareOffsets(this, event);
  5048.         }
  5049.  
  5050.         this.dragging = true;
  5051.  
  5052.         this.helper.addClass("ui-sortable-helper");
  5053.         this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  5054.         return true;
  5055.  
  5056.     },
  5057.  
  5058.     _mouseDrag: function(event) {
  5059.         var i, item, itemElement, intersection,
  5060.             o = this.options,
  5061.             scrolled = false;
  5062.  
  5063.         //Compute the helpers position
  5064.         this.position = this._generatePosition(event);
  5065.         this.positionAbs = this._convertPositionTo("absolute");
  5066.  
  5067.         if (!this.lastPositionAbs) {
  5068.             this.lastPositionAbs = this.positionAbs;
  5069.         }
  5070.  
  5071.         //Do scrolling
  5072.         if(this.options.scroll) {
  5073.             if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  5074.  
  5075.                 if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  5076.                     this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  5077.                 } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  5078.                     this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  5079.                 }
  5080.  
  5081.                 if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  5082.                     this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  5083.                 } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  5084.                     this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  5085.                 }
  5086.  
  5087.             } else {
  5088.  
  5089.                 if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  5090.                     scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  5091.                 } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  5092.                     scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  5093.                 }
  5094.  
  5095.                 if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  5096.                     scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  5097.                 } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  5098.                     scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  5099.                 }
  5100.  
  5101.             }
  5102.  
  5103.             if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  5104.                 $.ui.ddmanager.prepareOffsets(this, event);
  5105.             }
  5106.         }
  5107.  
  5108.         //Regenerate the absolute position used for position checks
  5109.         this.positionAbs = this._convertPositionTo("absolute");
  5110.  
  5111.         //Set the helper position
  5112.         if(!this.options.axis || this.options.axis !== "y") {
  5113.             this.helper[0].style.left = this.position.left+"px";
  5114.         }
  5115.         if(!this.options.axis || this.options.axis !== "x") {
  5116.             this.helper[0].style.top = this.position.top+"px";
  5117.         }
  5118.  
  5119.         //Rearrange
  5120.         for (i = this.items.length - 1; i >= 0; i--) {
  5121.  
  5122.             //Cache variables and intersection, continue if no intersection
  5123.             item = this.items[i];
  5124.             itemElement = item.item[0];
  5125.             intersection = this._intersectsWithPointer(item);
  5126.             if (!intersection) {
  5127.                 continue;
  5128.             }
  5129.  
  5130.             // Only put the placeholder inside the current Container, skip all
  5131.             // items from other containers. This works because when moving
  5132.             // an item from one container to another the
  5133.             // currentContainer is switched before the placeholder is moved.
  5134.             //
  5135.             // Without this, moving items in "sub-sortables" can cause
  5136.             // the placeholder to jitter between the outer and inner container.
  5137.             if (item.instance !== this.currentContainer) {
  5138.                 continue;
  5139.             }
  5140.  
  5141.             // cannot intersect with itself
  5142.             // no useless actions that have been done before
  5143.             // no action if the item moved is the parent of the item checked
  5144.             if (itemElement !== this.currentItem[0] &&
  5145.                 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  5146.                 !$.contains(this.placeholder[0], itemElement) &&
  5147.                 (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
  5148.             ) {
  5149.  
  5150.                 this.direction = intersection === 1 ? "down" : "up";
  5151.  
  5152.                 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  5153.                     this._rearrange(event, item);
  5154.                 } else {
  5155.                     break;
  5156.                 }
  5157.  
  5158.                 this._trigger("change", event, this._uiHash());
  5159.                 break;
  5160.             }
  5161.         }
  5162.  
  5163.         //Post events to containers
  5164.         this._contactContainers(event);
  5165.  
  5166.         //Interconnect with droppables
  5167.         if($.ui.ddmanager) {
  5168.             $.ui.ddmanager.drag(this, event);
  5169.         }
  5170.  
  5171.         //Call callbacks
  5172.         this._trigger("sort", event, this._uiHash());
  5173.  
  5174.         this.lastPositionAbs = this.positionAbs;
  5175.         return false;
  5176.  
  5177.     },
  5178.  
  5179.     _mouseStop: function(event, noPropagation) {
  5180.  
  5181.         if(!event) {
  5182.             return;
  5183.         }
  5184.  
  5185.         //If we are using droppables, inform the manager about the drop
  5186.         if ($.ui.ddmanager && !this.options.dropBehaviour) {
  5187.             $.ui.ddmanager.drop(this, event);
  5188.         }
  5189.  
  5190.         if(this.options.revert) {
  5191.             var that = this,
  5192.                 cur = this.placeholder.offset(),
  5193.                 axis = this.options.axis,
  5194.                 animation = {};
  5195.  
  5196.             if ( !axis || axis === "x" ) {
  5197.                 animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  5198.             }
  5199.             if ( !axis || axis === "y" ) {
  5200.                 animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  5201.             }
  5202.             this.reverting = true;
  5203.             $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
  5204.                 that._clear(event);
  5205.             });
  5206.         } else {
  5207.             this._clear(event, noPropagation);
  5208.         }
  5209.  
  5210.         return false;
  5211.  
  5212.     },
  5213.  
  5214.     cancel: function() {
  5215.  
  5216.         if(this.dragging) {
  5217.  
  5218.             this._mouseUp({ target: null });
  5219.  
  5220.             if(this.options.helper === "original") {
  5221.                 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  5222.             } else {
  5223.                 this.currentItem.show();
  5224.             }
  5225.  
  5226.             //Post deactivating events to containers
  5227.             for (var i = this.containers.length - 1; i >= 0; i--){
  5228.                 this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  5229.                 if(this.containers[i].containerCache.over) {
  5230.                     this.containers[i]._trigger("out", null, this._uiHash(this));
  5231.                     this.containers[i].containerCache.over = 0;
  5232.                 }
  5233.             }
  5234.  
  5235.         }
  5236.  
  5237.         if (this.placeholder) {
  5238.             //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  5239.             if(this.placeholder[0].parentNode) {
  5240.                 this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  5241.             }
  5242.             if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  5243.                 this.helper.remove();
  5244.             }
  5245.  
  5246.             $.extend(this, {
  5247.                 helper: null,
  5248.                 dragging: false,
  5249.                 reverting: false,
  5250.                 _noFinalSort: null
  5251.             });
  5252.  
  5253.             if(this.domPosition.prev) {
  5254.                 $(this.domPosition.prev).after(this.currentItem);
  5255.             } else {
  5256.                 $(this.domPosition.parent).prepend(this.currentItem);
  5257.             }
  5258.         }
  5259.  
  5260.         return this;
  5261.  
  5262.     },
  5263.  
  5264.     serialize: function(o) {
  5265.  
  5266.         var items = this._getItemsAsjQuery(o && o.connected),
  5267.             str = [];
  5268.         o = o || {};
  5269.  
  5270.         $(items).each(function() {
  5271.             var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  5272.             if (res) {
  5273.                 str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
  5274.             }
  5275.         });
  5276.  
  5277.         if(!str.length && o.key) {
  5278.             str.push(o.key + "=");
  5279.         }
  5280.  
  5281.         return str.join("&");
  5282.  
  5283.     },
  5284.  
  5285.     toArray: function(o) {
  5286.  
  5287.         var items = this._getItemsAsjQuery(o && o.connected),
  5288.             ret = [];
  5289.  
  5290.         o = o || {};
  5291.  
  5292.         items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
  5293.         return ret;
  5294.  
  5295.     },
  5296.  
  5297.     /* Be careful with the following core functions */
  5298.     _intersectsWith: function(item) {
  5299.  
  5300.         var x1 = this.positionAbs.left,
  5301.             x2 = x1 + this.helperProportions.width,
  5302.             y1 = this.positionAbs.top,
  5303.             y2 = y1 + this.helperProportions.height,
  5304.             l = item.left,
  5305.             r = l + item.width,
  5306.             t = item.top,
  5307.             b = t + item.height,
  5308.             dyClick = this.offset.click.top,
  5309.             dxClick = this.offset.click.left,
  5310.             isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
  5311.             isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
  5312.             isOverElement = isOverElementHeight && isOverElementWidth;
  5313.  
  5314.         if ( this.options.tolerance === "pointer" ||
  5315.             this.options.forcePointerForContainers ||
  5316.             (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
  5317.         ) {
  5318.             return isOverElement;
  5319.         } else {
  5320.  
  5321.             return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  5322.                 x2 - (this.helperProportions.width / 2) < r && // Left Half
  5323.                 t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  5324.                 y2 - (this.helperProportions.height / 2) < b ); // Top Half
  5325.  
  5326.         }
  5327.     },
  5328.  
  5329.     _intersectsWithPointer: function(item) {
  5330.  
  5331.         var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  5332.             isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  5333.             isOverElement = isOverElementHeight && isOverElementWidth,
  5334.             verticalDirection = this._getDragVerticalDirection(),
  5335.             horizontalDirection = this._getDragHorizontalDirection();
  5336.  
  5337.         if (!isOverElement) {
  5338.             return false;
  5339.         }
  5340.  
  5341.         return this.floating ?
  5342.             ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
  5343.             : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
  5344.  
  5345.     },
  5346.  
  5347.     _intersectsWithSides: function(item) {
  5348.  
  5349.         var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  5350.             isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  5351.             verticalDirection = this._getDragVerticalDirection(),
  5352.             horizontalDirection = this._getDragHorizontalDirection();
  5353.  
  5354.         if (this.floating && horizontalDirection) {
  5355.             return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  5356.         } else {
  5357.             return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  5358.         }
  5359.  
  5360.     },
  5361.  
  5362.     _getDragVerticalDirection: function() {
  5363.         var delta = this.positionAbs.top - this.lastPositionAbs.top;
  5364.         return delta !== 0 && (delta > 0 ? "down" : "up");
  5365.     },
  5366.  
  5367.     _getDragHorizontalDirection: function() {
  5368.         var delta = this.positionAbs.left - this.lastPositionAbs.left;
  5369.         return delta !== 0 && (delta > 0 ? "right" : "left");
  5370.     },
  5371.  
  5372.     refresh: function(event) {
  5373.         this._refreshItems(event);
  5374.         this._setHandleClassName();
  5375.         this.refreshPositions();
  5376.         return this;
  5377.     },
  5378.  
  5379.     _connectWith: function() {
  5380.         var options = this.options;
  5381.         return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  5382.     },
  5383.  
  5384.     _getItemsAsjQuery: function(connected) {
  5385.  
  5386.         var i, j, cur, inst,
  5387.             items = [],
  5388.             queries = [],
  5389.             connectWith = this._connectWith();
  5390.  
  5391.         if(connectWith && connected) {
  5392.             for (i = connectWith.length - 1; i >= 0; i--){
  5393.                 cur = $(connectWith[i], this.document[0]);
  5394.                 for ( j = cur.length - 1; j >= 0; j--){
  5395.                     inst = $.data(cur[j], this.widgetFullName);
  5396.                     if(inst && inst !== this && !inst.options.disabled) {
  5397.                         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]);
  5398.                     }
  5399.                 }
  5400.             }
  5401.         }
  5402.  
  5403.         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]);
  5404.  
  5405.         function addItems() {
  5406.             items.push( this );
  5407.         }
  5408.         for (i = queries.length - 1; i >= 0; i--){
  5409.             queries[i][0].each( addItems );
  5410.         }
  5411.  
  5412.         return $(items);
  5413.  
  5414.     },
  5415.  
  5416.     _removeCurrentsFromItems: function() {
  5417.  
  5418.         var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  5419.  
  5420.         this.items = $.grep(this.items, function (item) {
  5421.             for (var j=0; j < list.length; j++) {
  5422.                 if(list[j] === item.item[0]) {
  5423.                     return false;
  5424.                 }
  5425.             }
  5426.             return true;
  5427.         });
  5428.  
  5429.     },
  5430.  
  5431.     _refreshItems: function(event) {
  5432.  
  5433.         this.items = [];
  5434.         this.containers = [this];
  5435.  
  5436.         var i, j, cur, inst, targetData, _queries, item, queriesLength,
  5437.             items = this.items,
  5438.             queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
  5439.             connectWith = this._connectWith();
  5440.  
  5441.         if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
  5442.             for (i = connectWith.length - 1; i >= 0; i--){
  5443.                 cur = $(connectWith[i], this.document[0]);
  5444.                 for (j = cur.length - 1; j >= 0; j--){
  5445.                     inst = $.data(cur[j], this.widgetFullName);
  5446.                     if(inst && inst !== this && !inst.options.disabled) {
  5447.                         queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  5448.                         this.containers.push(inst);
  5449.                     }
  5450.                 }
  5451.             }
  5452.         }
  5453.  
  5454.         for (i = queries.length - 1; i >= 0; i--) {
  5455.             targetData = queries[i][1];
  5456.             _queries = queries[i][0];
  5457.  
  5458.             for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  5459.                 item = $(_queries[j]);
  5460.  
  5461.                 item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
  5462.  
  5463.                 items.push({
  5464.                     item: item,
  5465.                     instance: targetData,
  5466.                     width: 0, height: 0,
  5467.                     left: 0, top: 0
  5468.                 });
  5469.             }
  5470.         }
  5471.  
  5472.     },
  5473.  
  5474.     refreshPositions: function(fast) {
  5475.  
  5476.         // Determine whether items are being displayed horizontally
  5477.         this.floating = this.items.length ?
  5478.             this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  5479.             false;
  5480.  
  5481.         //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  5482.         if(this.offsetParent && this.helper) {
  5483.             this.offset.parent = this._getParentOffset();
  5484.         }
  5485.  
  5486.         var i, item, t, p;
  5487.  
  5488.         for (i = this.items.length - 1; i >= 0; i--){
  5489.             item = this.items[i];
  5490.  
  5491.             //We ignore calculating positions of all connected containers when we're not over them
  5492.             if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
  5493.                 continue;
  5494.             }
  5495.  
  5496.             t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  5497.  
  5498.             if (!fast) {
  5499.                 item.width = t.outerWidth();
  5500.                 item.height = t.outerHeight();
  5501.             }
  5502.  
  5503.             p = t.offset();
  5504.             item.left = p.left;
  5505.             item.top = p.top;
  5506.         }
  5507.  
  5508.         if(this.options.custom && this.options.custom.refreshContainers) {
  5509.             this.options.custom.refreshContainers.call(this);
  5510.         } else {
  5511.             for (i = this.containers.length - 1; i >= 0; i--){
  5512.                 p = this.containers[i].element.offset();
  5513.                 this.containers[i].containerCache.left = p.left;
  5514.                 this.containers[i].containerCache.top = p.top;
  5515.                 this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  5516.                 this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  5517.             }
  5518.         }
  5519.  
  5520.         return this;
  5521.     },
  5522.  
  5523.     _createPlaceholder: function(that) {
  5524.         that = that || this;
  5525.         var className,
  5526.             o = that.options;
  5527.  
  5528.         if(!o.placeholder || o.placeholder.constructor === String) {
  5529.             className = o.placeholder;
  5530.             o.placeholder = {
  5531.                 element: function() {
  5532.  
  5533.                     var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  5534.                         element = $( "<" + nodeName + ">", that.document[0] )
  5535.                             .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
  5536.                             .removeClass("ui-sortable-helper");
  5537.  
  5538.                     if ( nodeName === "tbody" ) {
  5539.                         that._createTrPlaceholder(
  5540.                             that.currentItem.find( "tr" ).eq( 0 ),
  5541.                             $( "<tr>", that.document[ 0 ] ).appendTo( element )
  5542.                         );
  5543.                     } else if ( nodeName === "tr" ) {
  5544.                         that._createTrPlaceholder( that.currentItem, element );
  5545.                     } else if ( nodeName === "img" ) {
  5546.                         element.attr( "src", that.currentItem.attr( "src" ) );
  5547.                     }
  5548.  
  5549.                     if ( !className ) {
  5550.                         element.css( "visibility", "hidden" );
  5551.                     }
  5552.  
  5553.                     return element;
  5554.                 },
  5555.                 update: function(container, p) {
  5556.  
  5557.                     // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  5558.                     // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  5559.                     if(className && !o.forcePlaceholderSize) {
  5560.                         return;
  5561.                     }
  5562.  
  5563.                     //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
  5564.                     if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
  5565.                     if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
  5566.                 }
  5567.             };
  5568.         }
  5569.  
  5570.         //Create the placeholder
  5571.         that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  5572.  
  5573.         //Append it after the actual current item
  5574.         that.currentItem.after(that.placeholder);
  5575.  
  5576.         //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  5577.         o.placeholder.update(that, that.placeholder);
  5578.  
  5579.     },
  5580.  
  5581.     _createTrPlaceholder: function( sourceTr, targetTr ) {
  5582.         var that = this;
  5583.  
  5584.         sourceTr.children().each(function() {
  5585.             $( "<td>&#160;</td>", that.document[ 0 ] )
  5586.                 .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  5587.                 .appendTo( targetTr );
  5588.         });
  5589.     },
  5590.  
  5591.     _contactContainers: function(event) {
  5592.         var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  5593.             innermostContainer = null,
  5594.             innermostIndex = null;
  5595.  
  5596.         // get innermost container that intersects with item
  5597.         for (i = this.containers.length - 1; i >= 0; i--) {
  5598.  
  5599.             // never consider a container that's located within the item itself
  5600.             if($.contains(this.currentItem[0], this.containers[i].element[0])) {
  5601.                 continue;
  5602.             }
  5603.  
  5604.             if(this._intersectsWith(this.containers[i].containerCache)) {
  5605.  
  5606.                 // if we've already found a container and it's more "inner" than this, then continue
  5607.                 if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  5608.                     continue;
  5609.                 }
  5610.  
  5611.                 innermostContainer = this.containers[i];
  5612.                 innermostIndex = i;
  5613.  
  5614.             } else {
  5615.                 // container doesn't intersect. trigger "out" event if necessary
  5616.                 if(this.containers[i].containerCache.over) {
  5617.                     this.containers[i]._trigger("out", event, this._uiHash(this));
  5618.                     this.containers[i].containerCache.over = 0;
  5619.                 }
  5620.             }
  5621.  
  5622.         }
  5623.  
  5624.         // if no intersecting containers found, return
  5625.         if(!innermostContainer) {
  5626.             return;
  5627.         }
  5628.  
  5629.         // move the item into the container if it's not there already
  5630.         if(this.containers.length === 1) {
  5631.             if (!this.containers[innermostIndex].containerCache.over) {
  5632.                 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  5633.                 this.containers[innermostIndex].containerCache.over = 1;
  5634.             }
  5635.         } else {
  5636.  
  5637.             //When entering a new container, we will find the item with the least distance and append our item near it
  5638.             dist = 10000;
  5639.             itemWithLeastDistance = null;
  5640.             floating = innermostContainer.floating || this._isFloating(this.currentItem);
  5641.             posProperty = floating ? "left" : "top";
  5642.             sizeProperty = floating ? "width" : "height";
  5643.             axis = floating ? "clientX" : "clientY";
  5644.  
  5645.             for (j = this.items.length - 1; j >= 0; j--) {
  5646.                 if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  5647.                     continue;
  5648.                 }
  5649.                 if(this.items[j].item[0] === this.currentItem[0]) {
  5650.                     continue;
  5651.                 }
  5652.  
  5653.                 cur = this.items[j].item.offset()[posProperty];
  5654.                 nearBottom = false;
  5655.                 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  5656.                     nearBottom = true;
  5657.                 }
  5658.  
  5659.                 if ( Math.abs( event[ axis ] - cur ) < dist ) {
  5660.                     dist = Math.abs( event[ axis ] - cur );
  5661.                     itemWithLeastDistance = this.items[ j ];
  5662.                     this.direction = nearBottom ? "up": "down";
  5663.                 }
  5664.             }
  5665.  
  5666.             //Check if dropOnEmpty is enabled
  5667.             if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
  5668.                 return;
  5669.             }
  5670.  
  5671.             if(this.currentContainer === this.containers[innermostIndex]) {
  5672.                 if ( !this.currentContainer.containerCache.over ) {
  5673.                     this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  5674.                     this.currentContainer.containerCache.over = 1;
  5675.                 }
  5676.                 return;
  5677.             }
  5678.  
  5679.             itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  5680.             this._trigger("change", event, this._uiHash());
  5681.             this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  5682.             this.currentContainer = this.containers[innermostIndex];
  5683.  
  5684.             //Update the placeholder
  5685.             this.options.placeholder.update(this.currentContainer, this.placeholder);
  5686.  
  5687.             this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  5688.             this.containers[innermostIndex].containerCache.over = 1;
  5689.         }
  5690.  
  5691.  
  5692.     },
  5693.  
  5694.     _createHelper: function(event) {
  5695.  
  5696.         var o = this.options,
  5697.             helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  5698.  
  5699.         //Add the helper to the DOM if that didn't happen already
  5700.         if(!helper.parents("body").length) {
  5701.             $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  5702.         }
  5703.  
  5704.         if(helper[0] === this.currentItem[0]) {
  5705.             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") };
  5706.         }
  5707.  
  5708.         if(!helper[0].style.width || o.forceHelperSize) {
  5709.             helper.width(this.currentItem.width());
  5710.         }
  5711.         if(!helper[0].style.height || o.forceHelperSize) {
  5712.             helper.height(this.currentItem.height());
  5713.         }
  5714.  
  5715.         return helper;
  5716.  
  5717.     },
  5718.  
  5719.     _adjustOffsetFromHelper: function(obj) {
  5720.         if (typeof obj === "string") {
  5721.             obj = obj.split(" ");
  5722.         }
  5723.         if ($.isArray(obj)) {
  5724.             obj = {left: +obj[0], top: +obj[1] || 0};
  5725.         }
  5726.         if ("left" in obj) {
  5727.             this.offset.click.left = obj.left + this.margins.left;
  5728.         }
  5729.         if ("right" in obj) {
  5730.             this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  5731.         }
  5732.         if ("top" in obj) {
  5733.             this.offset.click.top = obj.top + this.margins.top;
  5734.         }
  5735.         if ("bottom" in obj) {
  5736.             this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  5737.         }
  5738.     },
  5739.  
  5740.     _getParentOffset: function() {
  5741.  
  5742.  
  5743.         //Get the offsetParent and cache its position
  5744.         this.offsetParent = this.helper.offsetParent();
  5745.         var po = this.offsetParent.offset();
  5746.  
  5747.         // This is a special case where we need to modify a offset calculated on start, since the following happened:
  5748.         // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  5749.         // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  5750.         //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  5751.         if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  5752.             po.left += this.scrollParent.scrollLeft();
  5753.             po.top += this.scrollParent.scrollTop();
  5754.         }
  5755.  
  5756.         // This needs to be actually done for all browsers, since pageX/pageY includes this information
  5757.         // with an ugly IE fix
  5758.         if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  5759.             po = { top: 0, left: 0 };
  5760.         }
  5761.  
  5762.         return {
  5763.             top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  5764.             left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  5765.         };
  5766.  
  5767.     },
  5768.  
  5769.     _getRelativeOffset: function() {
  5770.  
  5771.         if(this.cssPosition === "relative") {
  5772.             var p = this.currentItem.position();
  5773.             return {
  5774.                 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  5775.                 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  5776.             };
  5777.         } else {
  5778.             return { top: 0, left: 0 };
  5779.         }
  5780.  
  5781.     },
  5782.  
  5783.     _cacheMargins: function() {
  5784.         this.margins = {
  5785.             left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  5786.             top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  5787.         };
  5788.     },
  5789.  
  5790.     _cacheHelperProportions: function() {
  5791.         this.helperProportions = {
  5792.             width: this.helper.outerWidth(),
  5793.             height: this.helper.outerHeight()
  5794.         };
  5795.     },
  5796.  
  5797.     _setContainment: function() {
  5798.  
  5799.         var ce, co, over,
  5800.             o = this.options;
  5801.         if(o.containment === "parent") {
  5802.             o.containment = this.helper[0].parentNode;
  5803.         }
  5804.         if(o.containment === "document" || o.containment === "window") {
  5805.             this.containment = [
  5806.                 0 - this.offset.relative.left - this.offset.parent.left,
  5807.                 0 - this.offset.relative.top - this.offset.parent.top,
  5808.                 o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
  5809.                 (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  5810.             ];
  5811.         }
  5812.  
  5813.         if(!(/^(document|window|parent)$/).test(o.containment)) {
  5814.             ce = $(o.containment)[0];
  5815.             co = $(o.containment).offset();
  5816.             over = ($(ce).css("overflow") !== "hidden");
  5817.  
  5818.             this.containment = [
  5819.                 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  5820.                 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  5821.                 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,
  5822.                 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
  5823.             ];
  5824.         }
  5825.  
  5826.     },
  5827.  
  5828.     _convertPositionTo: function(d, pos) {
  5829.  
  5830.         if(!pos) {
  5831.             pos = this.position;
  5832.         }
  5833.         var mod = d === "absolute" ? 1 : -1,
  5834.             scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  5835.             scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  5836.  
  5837.         return {
  5838.             top: (
  5839.                 pos.top +                                                               // The absolute mouse position
  5840.                 this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
  5841.                 this.offset.parent.top * mod -                                          // The offsetParent's offset without borders (offset + border)
  5842.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  5843.             ),
  5844.             left: (
  5845.                 pos.left +                                                              // The absolute mouse position
  5846.                 this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
  5847.                 this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
  5848.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  5849.             )
  5850.         };
  5851.  
  5852.     },
  5853.  
  5854.     _generatePosition: function(event) {
  5855.  
  5856.         var top, left,
  5857.             o = this.options,
  5858.             pageX = event.pageX,
  5859.             pageY = event.pageY,
  5860.             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);
  5861.  
  5862.         // This is another very weird special case that only happens for relative elements:
  5863.         // 1. If the css position is relative
  5864.         // 2. and the scroll parent is the document or similar to the offset parent
  5865.         // we have to refresh the relative offset during the scroll so there are no jumps
  5866.         if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  5867.             this.offset.relative = this._getRelativeOffset();
  5868.         }
  5869.  
  5870.         /*
  5871.          * - Position constraining -
  5872.          * Constrain the position to a mix of grid, containment.
  5873.          */
  5874.  
  5875.         if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  5876.  
  5877.             if(this.containment) {
  5878.                 if(event.pageX - this.offset.click.left < this.containment[0]) {
  5879.                     pageX = this.containment[0] + this.offset.click.left;
  5880.                 }
  5881.                 if(event.pageY - this.offset.click.top < this.containment[1]) {
  5882.                     pageY = this.containment[1] + this.offset.click.top;
  5883.                 }
  5884.                 if(event.pageX - this.offset.click.left > this.containment[2]) {
  5885.                     pageX = this.containment[2] + this.offset.click.left;
  5886.                 }
  5887.                 if(event.pageY - this.offset.click.top > this.containment[3]) {
  5888.                     pageY = this.containment[3] + this.offset.click.top;
  5889.                 }
  5890.             }
  5891.  
  5892.             if(o.grid) {
  5893.                 top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  5894.                 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;
  5895.  
  5896.                 left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  5897.                 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;
  5898.             }
  5899.  
  5900.         }
  5901.  
  5902.         return {
  5903.             top: (
  5904.                 pageY -                                                             // The absolute mouse position
  5905.                 this.offset.click.top -                                                 // Click offset (relative to the element)
  5906.                 this.offset.relative.top    -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
  5907.                 this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
  5908.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  5909.             ),
  5910.             left: (
  5911.                 pageX -                                                             // The absolute mouse position
  5912.                 this.offset.click.left -                                                // Click offset (relative to the element)
  5913.                 this.offset.relative.left   -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
  5914.                 this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
  5915.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  5916.             )
  5917.         };
  5918.  
  5919.     },
  5920.  
  5921.     _rearrange: function(event, i, a, hardRefresh) {
  5922.  
  5923.         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));
  5924.  
  5925.         //Various things done here to improve the performance:
  5926.         // 1. we create a setTimeout, that calls refreshPositions
  5927.         // 2. on the instance, we have a counter variable, that get's higher after every append
  5928.         // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  5929.         // 4. this lets only the last addition to the timeout stack through
  5930.         this.counter = this.counter ? ++this.counter : 1;
  5931.         var counter = this.counter;
  5932.  
  5933.         this._delay(function() {
  5934.             if(counter === this.counter) {
  5935.                 this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  5936.             }
  5937.         });
  5938.  
  5939.     },
  5940.  
  5941.     _clear: function(event, noPropagation) {
  5942.  
  5943.         this.reverting = false;
  5944.         // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  5945.         // everything else normalized again
  5946.         var i,
  5947.             delayedTriggers = [];
  5948.  
  5949.         // We first have to update the dom position of the actual currentItem
  5950.         // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  5951.         if(!this._noFinalSort && this.currentItem.parent().length) {
  5952.             this.placeholder.before(this.currentItem);
  5953.         }
  5954.         this._noFinalSort = null;
  5955.  
  5956.         if(this.helper[0] === this.currentItem[0]) {
  5957.             for(i in this._storedCSS) {
  5958.                 if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  5959.                     this._storedCSS[i] = "";
  5960.                 }
  5961.             }
  5962.             this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  5963.         } else {
  5964.             this.currentItem.show();
  5965.         }
  5966.  
  5967.         if(this.fromOutside && !noPropagation) {
  5968.             delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  5969.         }
  5970.         if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  5971.             delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  5972.         }
  5973.  
  5974.         // Check if the items Container has Changed and trigger appropriate
  5975.         // events.
  5976.         if (this !== this.currentContainer) {
  5977.             if(!noPropagation) {
  5978.                 delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  5979.                 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
  5980.                 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
  5981.             }
  5982.         }
  5983.  
  5984.  
  5985.         //Post events to containers
  5986.         function delayEvent( type, instance, container ) {
  5987.             return function( event ) {
  5988.                 container._trigger( type, event, instance._uiHash( instance ) );
  5989.             };
  5990.         }
  5991.         for (i = this.containers.length - 1; i >= 0; i--){
  5992.             if (!noPropagation) {
  5993.                 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  5994.             }
  5995.             if(this.containers[i].containerCache.over) {
  5996.                 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  5997.                 this.containers[i].containerCache.over = 0;
  5998.             }
  5999.         }
  6000.  
  6001.         //Do what was originally in plugins
  6002.         if ( this.storedCursor ) {
  6003.             this.document.find( "body" ).css( "cursor", this.storedCursor );
  6004.             this.storedStylesheet.remove();
  6005.         }
  6006.         if(this._storedOpacity) {
  6007.             this.helper.css("opacity", this._storedOpacity);
  6008.         }
  6009.         if(this._storedZIndex) {
  6010.             this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  6011.         }
  6012.  
  6013.         this.dragging = false;
  6014.  
  6015.         if(!noPropagation) {
  6016.             this._trigger("beforeStop", event, this._uiHash());
  6017.         }
  6018.  
  6019.         //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  6020.         this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  6021.  
  6022.         if ( !this.cancelHelperRemoval ) {
  6023.             if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  6024.                 this.helper.remove();
  6025.             }
  6026.             this.helper = null;
  6027.         }
  6028.  
  6029.         if(!noPropagation) {
  6030.             for (i=0; i < delayedTriggers.length; i++) {
  6031.                 delayedTriggers[i].call(this, event);
  6032.             } //Trigger all delayed events
  6033.             this._trigger("stop", event, this._uiHash());
  6034.         }
  6035.  
  6036.         this.fromOutside = false;
  6037.         return !this.cancelHelperRemoval;
  6038.  
  6039.     },
  6040.  
  6041.     _trigger: function() {
  6042.         if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  6043.             this.cancel();
  6044.         }
  6045.     },
  6046.  
  6047.     _uiHash: function(_inst) {
  6048.         var inst = _inst || this;
  6049.         return {
  6050.             helper: inst.helper,
  6051.             placeholder: inst.placeholder || $([]),
  6052.             position: inst.position,
  6053.             originalPosition: inst.originalPosition,
  6054.             offset: inst.positionAbs,
  6055.             item: inst.currentItem,
  6056.             sender: _inst ? _inst.element : null
  6057.         };
  6058.     }
  6059.  
  6060. });
  6061.  
  6062.  
  6063. /*!
  6064.  * jQuery UI Accordion 1.11.4
  6065.  * http://jqueryui.com
  6066.  *
  6067.  * Copyright jQuery Foundation and other contributors
  6068.  * Released under the MIT license.
  6069.  * http://jquery.org/license
  6070.  *
  6071.  * http://api.jqueryui.com/accordion/
  6072.  */
  6073.  
  6074.  
  6075. var accordion = $.widget( "ui.accordion", {
  6076.     version: "1.11.4",
  6077.     options: {
  6078.         active: 0,
  6079.         animate: {},
  6080.         collapsible: false,
  6081.         event: "click",
  6082.         header: "> li > :first-child,> :not(li):even",
  6083.         heightStyle: "auto",
  6084.         icons: {
  6085.             activeHeader: "ui-icon-triangle-1-s",
  6086.             header: "ui-icon-triangle-1-e"
  6087.         },
  6088.  
  6089.         // callbacks
  6090.         activate: null,
  6091.         beforeActivate: null
  6092.     },
  6093.  
  6094.     hideProps: {
  6095.         borderTopWidth: "hide",
  6096.         borderBottomWidth: "hide",
  6097.         paddingTop: "hide",
  6098.         paddingBottom: "hide",
  6099.         height: "hide"
  6100.     },
  6101.  
  6102.     showProps: {
  6103.         borderTopWidth: "show",
  6104.         borderBottomWidth: "show",
  6105.         paddingTop: "show",
  6106.         paddingBottom: "show",
  6107.         height: "show"
  6108.     },
  6109.  
  6110.     _create: function() {
  6111.         var options = this.options;
  6112.         this.prevShow = this.prevHide = $();
  6113.         this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
  6114.             // ARIA
  6115.             .attr( "role", "tablist" );
  6116.  
  6117.         // don't allow collapsible: false and active: false / null
  6118.         if ( !options.collapsible && (options.active === false || options.active == null) ) {
  6119.             options.active = 0;
  6120.         }
  6121.  
  6122.         this._processPanels();
  6123.         // handle negative values
  6124.         if ( options.active < 0 ) {
  6125.             options.active += this.headers.length;
  6126.         }
  6127.         this._refresh();
  6128.     },
  6129.  
  6130.     _getCreateEventData: function() {
  6131.         return {
  6132.             header: this.active,
  6133.             panel: !this.active.length ? $() : this.active.next()
  6134.         };
  6135.     },
  6136.  
  6137.     _createIcons: function() {
  6138.         var icons = this.options.icons;
  6139.         if ( icons ) {
  6140.             $( "<span>" )
  6141.                 .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
  6142.                 .prependTo( this.headers );
  6143.             this.active.children( ".ui-accordion-header-icon" )
  6144.                 .removeClass( icons.header )
  6145.                 .addClass( icons.activeHeader );
  6146.             this.headers.addClass( "ui-accordion-icons" );
  6147.         }
  6148.     },
  6149.  
  6150.     _destroyIcons: function() {
  6151.         this.headers
  6152.             .removeClass( "ui-accordion-icons" )
  6153.             .children( ".ui-accordion-header-icon" )
  6154.                 .remove();
  6155.     },
  6156.  
  6157.     _destroy: function() {
  6158.         var contents;
  6159.  
  6160.         // clean up main element
  6161.         this.element
  6162.             .removeClass( "ui-accordion ui-widget ui-helper-reset" )
  6163.             .removeAttr( "role" );
  6164.  
  6165.         // clean up headers
  6166.         this.headers
  6167.             .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
  6168.                 "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  6169.             .removeAttr( "role" )
  6170.             .removeAttr( "aria-expanded" )
  6171.             .removeAttr( "aria-selected" )
  6172.             .removeAttr( "aria-controls" )
  6173.             .removeAttr( "tabIndex" )
  6174.             .removeUniqueId();
  6175.  
  6176.         this._destroyIcons();
  6177.  
  6178.         // clean up content panels
  6179.         contents = this.headers.next()
  6180.             .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
  6181.                 "ui-accordion-content ui-accordion-content-active ui-state-disabled" )
  6182.             .css( "display", "" )
  6183.             .removeAttr( "role" )
  6184.             .removeAttr( "aria-hidden" )
  6185.             .removeAttr( "aria-labelledby" )
  6186.             .removeUniqueId();
  6187.  
  6188.         if ( this.options.heightStyle !== "content" ) {
  6189.             contents.css( "height", "" );
  6190.         }
  6191.     },
  6192.  
  6193.     _setOption: function( key, value ) {
  6194.         if ( key === "active" ) {
  6195.             // _activate() will handle invalid values and update this.options
  6196.             this._activate( value );
  6197.             return;
  6198.         }
  6199.  
  6200.         if ( key === "event" ) {
  6201.             if ( this.options.event ) {
  6202.                 this._off( this.headers, this.options.event );
  6203.             }
  6204.             this._setupEvents( value );
  6205.         }
  6206.  
  6207.         this._super( key, value );
  6208.  
  6209.         // setting collapsible: false while collapsed; open first panel
  6210.         if ( key === "collapsible" && !value && this.options.active === false ) {
  6211.             this._activate( 0 );
  6212.         }
  6213.  
  6214.         if ( key === "icons" ) {
  6215.             this._destroyIcons();
  6216.             if ( value ) {
  6217.                 this._createIcons();
  6218.             }
  6219.         }
  6220.  
  6221.         // #5332 - opacity doesn't cascade to positioned elements in IE
  6222.         // so we need to add the disabled class to the headers and panels
  6223.         if ( key === "disabled" ) {
  6224.             this.element
  6225.                 .toggleClass( "ui-state-disabled", !!value )
  6226.                 .attr( "aria-disabled", value );
  6227.             this.headers.add( this.headers.next() )
  6228.                 .toggleClass( "ui-state-disabled", !!value );
  6229.         }
  6230.     },
  6231.  
  6232.     _keydown: function( event ) {
  6233.         if ( event.altKey || event.ctrlKey ) {
  6234.             return;
  6235.         }
  6236.  
  6237.         var keyCode = $.ui.keyCode,
  6238.             length = this.headers.length,
  6239.             currentIndex = this.headers.index( event.target ),
  6240.             toFocus = false;
  6241.  
  6242.         switch ( event.keyCode ) {
  6243.             case keyCode.RIGHT:
  6244.             case keyCode.DOWN:
  6245.                 toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  6246.                 break;
  6247.             case keyCode.LEFT:
  6248.             case keyCode.UP:
  6249.                 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  6250.                 break;
  6251.             case keyCode.SPACE:
  6252.             case keyCode.ENTER:
  6253.                 this._eventHandler( event );
  6254.                 break;
  6255.             case keyCode.HOME:
  6256.                 toFocus = this.headers[ 0 ];
  6257.                 break;
  6258.             case keyCode.END:
  6259.                 toFocus = this.headers[ length - 1 ];
  6260.                 break;
  6261.         }
  6262.  
  6263.         if ( toFocus ) {
  6264.             $( event.target ).attr( "tabIndex", -1 );
  6265.             $( toFocus ).attr( "tabIndex", 0 );
  6266.             toFocus.focus();
  6267.             event.preventDefault();
  6268.         }
  6269.     },
  6270.  
  6271.     _panelKeyDown: function( event ) {
  6272.         if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  6273.             $( event.currentTarget ).prev().focus();
  6274.         }
  6275.     },
  6276.  
  6277.     refresh: function() {
  6278.         var options = this.options;
  6279.         this._processPanels();
  6280.  
  6281.         // was collapsed or no panel
  6282.         if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
  6283.             options.active = false;
  6284.             this.active = $();
  6285.         // active false only when collapsible is true
  6286.         } else if ( options.active === false ) {
  6287.             this._activate( 0 );
  6288.         // was active, but active panel is gone
  6289.         } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6290.             // all remaining panel are disabled
  6291.             if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
  6292.                 options.active = false;
  6293.                 this.active = $();
  6294.             // activate previous panel
  6295.             } else {
  6296.                 this._activate( Math.max( 0, options.active - 1 ) );
  6297.             }
  6298.         // was active, active panel still exists
  6299.         } else {
  6300.             // make sure active index is correct
  6301.             options.active = this.headers.index( this.active );
  6302.         }
  6303.  
  6304.         this._destroyIcons();
  6305.  
  6306.         this._refresh();
  6307.     },
  6308.  
  6309.     _processPanels: function() {
  6310.         var prevHeaders = this.headers,
  6311.             prevPanels = this.panels;
  6312.  
  6313.         this.headers = this.element.find( this.options.header )
  6314.             .addClass( "ui-accordion-header ui-state-default ui-corner-all" );
  6315.  
  6316.         this.panels = this.headers.next()
  6317.             .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
  6318.             .filter( ":not(.ui-accordion-content-active)" )
  6319.             .hide();
  6320.  
  6321.         // Avoid memory leaks (#10056)
  6322.         if ( prevPanels ) {
  6323.             this._off( prevHeaders.not( this.headers ) );
  6324.             this._off( prevPanels.not( this.panels ) );
  6325.         }
  6326.     },
  6327.  
  6328.     _refresh: function() {
  6329.         var maxHeight,
  6330.             options = this.options,
  6331.             heightStyle = options.heightStyle,
  6332.             parent = this.element.parent();
  6333.  
  6334.         this.active = this._findActive( options.active )
  6335.             .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
  6336.             .removeClass( "ui-corner-all" );
  6337.         this.active.next()
  6338.             .addClass( "ui-accordion-content-active" )
  6339.             .show();
  6340.  
  6341.         this.headers
  6342.             .attr( "role", "tab" )
  6343.             .each(function() {
  6344.                 var header = $( this ),
  6345.                     headerId = header.uniqueId().attr( "id" ),
  6346.                     panel = header.next(),
  6347.                     panelId = panel.uniqueId().attr( "id" );
  6348.                 header.attr( "aria-controls", panelId );
  6349.                 panel.attr( "aria-labelledby", headerId );
  6350.             })
  6351.             .next()
  6352.                 .attr( "role", "tabpanel" );
  6353.  
  6354.         this.headers
  6355.             .not( this.active )
  6356.             .attr({
  6357.                 "aria-selected": "false",
  6358.                 "aria-expanded": "false",
  6359.                 tabIndex: -1
  6360.             })
  6361.             .next()
  6362.                 .attr({
  6363.                     "aria-hidden": "true"
  6364.                 })
  6365.                 .hide();
  6366.  
  6367.         // make sure at least one header is in the tab order
  6368.         if ( !this.active.length ) {
  6369.             this.headers.eq( 0 ).attr( "tabIndex", 0 );
  6370.         } else {
  6371.             this.active.attr({
  6372.                 "aria-selected": "true",
  6373.                 "aria-expanded": "true",
  6374.                 tabIndex: 0
  6375.             })
  6376.             .next()
  6377.                 .attr({
  6378.                     "aria-hidden": "false"
  6379.                 });
  6380.         }
  6381.  
  6382.         this._createIcons();
  6383.  
  6384.         this._setupEvents( options.event );
  6385.  
  6386.         if ( heightStyle === "fill" ) {
  6387.             maxHeight = parent.height();
  6388.             this.element.siblings( ":visible" ).each(function() {
  6389.                 var elem = $( this ),
  6390.                     position = elem.css( "position" );
  6391.  
  6392.                 if ( position === "absolute" || position === "fixed" ) {
  6393.                     return;
  6394.                 }
  6395.                 maxHeight -= elem.outerHeight( true );
  6396.             });
  6397.  
  6398.             this.headers.each(function() {
  6399.                 maxHeight -= $( this ).outerHeight( true );
  6400.             });
  6401.  
  6402.             this.headers.next()
  6403.                 .each(function() {
  6404.                     $( this ).height( Math.max( 0, maxHeight -
  6405.                         $( this ).innerHeight() + $( this ).height() ) );
  6406.                 })
  6407.                 .css( "overflow", "auto" );
  6408.         } else if ( heightStyle === "auto" ) {
  6409.             maxHeight = 0;
  6410.             this.headers.next()
  6411.                 .each(function() {
  6412.                     maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
  6413.                 })
  6414.                 .height( maxHeight );
  6415.         }
  6416.     },
  6417.  
  6418.     _activate: function( index ) {
  6419.         var active = this._findActive( index )[ 0 ];
  6420.  
  6421.         // trying to activate the already active panel
  6422.         if ( active === this.active[ 0 ] ) {
  6423.             return;
  6424.         }
  6425.  
  6426.         // trying to collapse, simulate a click on the currently active header
  6427.         active = active || this.active[ 0 ];
  6428.  
  6429.         this._eventHandler({
  6430.             target: active,
  6431.             currentTarget: active,
  6432.             preventDefault: $.noop
  6433.         });
  6434.     },
  6435.  
  6436.     _findActive: function( selector ) {
  6437.         return typeof selector === "number" ? this.headers.eq( selector ) : $();
  6438.     },
  6439.  
  6440.     _setupEvents: function( event ) {
  6441.         var events = {
  6442.             keydown: "_keydown"
  6443.         };
  6444.         if ( event ) {
  6445.             $.each( event.split( " " ), function( index, eventName ) {
  6446.                 events[ eventName ] = "_eventHandler";
  6447.             });
  6448.         }
  6449.  
  6450.         this._off( this.headers.add( this.headers.next() ) );
  6451.         this._on( this.headers, events );
  6452.         this._on( this.headers.next(), { keydown: "_panelKeyDown" });
  6453.         this._hoverable( this.headers );
  6454.         this._focusable( this.headers );
  6455.     },
  6456.  
  6457.     _eventHandler: function( event ) {
  6458.         var options = this.options,
  6459.             active = this.active,
  6460.             clicked = $( event.currentTarget ),
  6461.             clickedIsActive = clicked[ 0 ] === active[ 0 ],
  6462.             collapsing = clickedIsActive && options.collapsible,
  6463.             toShow = collapsing ? $() : clicked.next(),
  6464.             toHide = active.next(),
  6465.             eventData = {
  6466.                 oldHeader: active,
  6467.                 oldPanel: toHide,
  6468.                 newHeader: collapsing ? $() : clicked,
  6469.                 newPanel: toShow
  6470.             };
  6471.  
  6472.         event.preventDefault();
  6473.  
  6474.         if (
  6475.                 // click on active header, but not collapsible
  6476.                 ( clickedIsActive && !options.collapsible ) ||
  6477.                 // allow canceling activation
  6478.                 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  6479.             return;
  6480.         }
  6481.  
  6482.         options.active = collapsing ? false : this.headers.index( clicked );
  6483.  
  6484.         // when the call to ._toggle() comes after the class changes
  6485.         // it causes a very odd bug in IE 8 (see #6720)
  6486.         this.active = clickedIsActive ? $() : clicked;
  6487.         this._toggle( eventData );
  6488.  
  6489.         // switch classes
  6490.         // corner classes on the previously active header stay after the animation
  6491.         active.removeClass( "ui-accordion-header-active ui-state-active" );
  6492.         if ( options.icons ) {
  6493.             active.children( ".ui-accordion-header-icon" )
  6494.                 .removeClass( options.icons.activeHeader )
  6495.                 .addClass( options.icons.header );
  6496.         }
  6497.  
  6498.         if ( !clickedIsActive ) {
  6499.             clicked
  6500.                 .removeClass( "ui-corner-all" )
  6501.                 .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
  6502.             if ( options.icons ) {
  6503.                 clicked.children( ".ui-accordion-header-icon" )
  6504.                     .removeClass( options.icons.header )
  6505.                     .addClass( options.icons.activeHeader );
  6506.             }
  6507.  
  6508.             clicked
  6509.                 .next()
  6510.                 .addClass( "ui-accordion-content-active" );
  6511.         }
  6512.     },
  6513.  
  6514.     _toggle: function( data ) {
  6515.         var toShow = data.newPanel,
  6516.             toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  6517.  
  6518.         // handle activating a panel during the animation for another activation
  6519.         this.prevShow.add( this.prevHide ).stop( true, true );
  6520.         this.prevShow = toShow;
  6521.         this.prevHide = toHide;
  6522.  
  6523.         if ( this.options.animate ) {
  6524.             this._animate( toShow, toHide, data );
  6525.         } else {
  6526.             toHide.hide();
  6527.             toShow.show();
  6528.             this._toggleComplete( data );
  6529.         }
  6530.  
  6531.         toHide.attr({
  6532.             "aria-hidden": "true"
  6533.         });
  6534.         toHide.prev().attr({
  6535.             "aria-selected": "false",
  6536.             "aria-expanded": "false"
  6537.         });
  6538.         // if we're switching panels, remove the old header from the tab order
  6539.         // if we're opening from collapsed state, remove the previous header from the tab order
  6540.         // if we're collapsing, then keep the collapsing header in the tab order
  6541.         if ( toShow.length && toHide.length ) {
  6542.             toHide.prev().attr({
  6543.                 "tabIndex": -1,
  6544.                 "aria-expanded": "false"
  6545.             });
  6546.         } else if ( toShow.length ) {
  6547.             this.headers.filter(function() {
  6548.                 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  6549.             })
  6550.             .attr( "tabIndex", -1 );
  6551.         }
  6552.  
  6553.         toShow
  6554.             .attr( "aria-hidden", "false" )
  6555.             .prev()
  6556.                 .attr({
  6557.                     "aria-selected": "true",
  6558.                     "aria-expanded": "true",
  6559.                     tabIndex: 0
  6560.                 });
  6561.     },
  6562.  
  6563.     _animate: function( toShow, toHide, data ) {
  6564.         var total, easing, duration,
  6565.             that = this,
  6566.             adjust = 0,
  6567.             boxSizing = toShow.css( "box-sizing" ),
  6568.             down = toShow.length &&
  6569.                 ( !toHide.length || ( toShow.index() < toHide.index() ) ),
  6570.             animate = this.options.animate || {},
  6571.             options = down && animate.down || animate,
  6572.             complete = function() {
  6573.                 that._toggleComplete( data );
  6574.             };
  6575.  
  6576.         if ( typeof options === "number" ) {
  6577.             duration = options;
  6578.         }
  6579.         if ( typeof options === "string" ) {
  6580.             easing = options;
  6581.         }
  6582.         // fall back from options to animation in case of partial down settings
  6583.         easing = easing || options.easing || animate.easing;
  6584.         duration = duration || options.duration || animate.duration;
  6585.  
  6586.         if ( !toHide.length ) {
  6587.             return toShow.animate( this.showProps, duration, easing, complete );
  6588.         }
  6589.         if ( !toShow.length ) {
  6590.             return toHide.animate( this.hideProps, duration, easing, complete );
  6591.         }
  6592.  
  6593.         total = toShow.show().outerHeight();
  6594.         toHide.animate( this.hideProps, {
  6595.             duration: duration,
  6596.             easing: easing,
  6597.             step: function( now, fx ) {
  6598.                 fx.now = Math.round( now );
  6599.             }
  6600.         });
  6601.         toShow
  6602.             .hide()
  6603.             .animate( this.showProps, {
  6604.                 duration: duration,
  6605.                 easing: easing,
  6606.                 complete: complete,
  6607.                 step: function( now, fx ) {
  6608.                     fx.now = Math.round( now );
  6609.                     if ( fx.prop !== "height" ) {
  6610.                         if ( boxSizing === "content-box" ) {
  6611.                             adjust += fx.now;
  6612.                         }
  6613.                     } else if ( that.options.heightStyle !== "content" ) {
  6614.                         fx.now = Math.round( total - toHide.outerHeight() - adjust );
  6615.                         adjust = 0;
  6616.                     }
  6617.                 }
  6618.             });
  6619.     },
  6620.  
  6621.     _toggleComplete: function( data ) {
  6622.         var toHide = data.oldPanel;
  6623.  
  6624.         toHide
  6625.             .removeClass( "ui-accordion-content-active" )
  6626.             .prev()
  6627.                 .removeClass( "ui-corner-top" )
  6628.                 .addClass( "ui-corner-all" );
  6629.  
  6630.         // Work around for rendering bug in IE (#5421)
  6631.         if ( toHide.length ) {
  6632.             toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  6633.         }
  6634.         this._trigger( "activate", null, data );
  6635.     }
  6636. });
  6637.  
  6638.  
  6639. /*!
  6640.  * jQuery UI Menu 1.11.4
  6641.  * http://jqueryui.com
  6642.  *
  6643.  * Copyright jQuery Foundation and other contributors
  6644.  * Released under the MIT license.
  6645.  * http://jquery.org/license
  6646.  *
  6647.  * http://api.jqueryui.com/menu/
  6648.  */
  6649.  
  6650.  
  6651. var menu = $.widget( "ui.menu", {
  6652.     version: "1.11.4",
  6653.     defaultElement: "<ul>",
  6654.     delay: 300,
  6655.     options: {
  6656.         icons: {
  6657.             submenu: "ui-icon-carat-1-e"
  6658.         },
  6659.         items: "> *",
  6660.         menus: "ul",
  6661.         position: {
  6662.             my: "left-1 top",
  6663.             at: "right top"
  6664.         },
  6665.         role: "menu",
  6666.  
  6667.         // callbacks
  6668.         blur: null,
  6669.         focus: null,
  6670.         select: null
  6671.     },
  6672.  
  6673.     _create: function() {
  6674.         this.activeMenu = this.element;
  6675.  
  6676.         // Flag used to prevent firing of the click handler
  6677.         // as the event bubbles up through nested menus
  6678.         this.mouseHandled = false;
  6679.         this.element
  6680.             .uniqueId()
  6681.             .addClass( "ui-menu ui-widget ui-widget-content" )
  6682.             .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
  6683.             .attr({
  6684.                 role: this.options.role,
  6685.                 tabIndex: 0
  6686.             });
  6687.  
  6688.         if ( this.options.disabled ) {
  6689.             this.element
  6690.                 .addClass( "ui-state-disabled" )
  6691.                 .attr( "aria-disabled", "true" );
  6692.         }
  6693.  
  6694.         this._on({
  6695.             // Prevent focus from sticking to links inside menu after clicking
  6696.             // them (focus should always stay on UL during navigation).
  6697.             "mousedown .ui-menu-item": function( event ) {
  6698.                 event.preventDefault();
  6699.             },
  6700.             "click .ui-menu-item": function( event ) {
  6701.                 var target = $( event.target );
  6702.                 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  6703.                     this.select( event );
  6704.  
  6705.                     // Only set the mouseHandled flag if the event will bubble, see #9469.
  6706.                     if ( !event.isPropagationStopped() ) {
  6707.                         this.mouseHandled = true;
  6708.                     }
  6709.  
  6710.                     // Open submenu on click
  6711.                     if ( target.has( ".ui-menu" ).length ) {
  6712.                         this.expand( event );
  6713.                     } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
  6714.  
  6715.                         // Redirect focus to the menu
  6716.                         this.element.trigger( "focus", [ true ] );
  6717.  
  6718.                         // If the active item is on the top level, let it stay active.
  6719.                         // Otherwise, blur the active item since it is no longer visible.
  6720.                         if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  6721.                             clearTimeout( this.timer );
  6722.                         }
  6723.                     }
  6724.                 }
  6725.             },
  6726.             "mouseenter .ui-menu-item": function( event ) {
  6727.                 // Ignore mouse events while typeahead is active, see #10458.
  6728.                 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  6729.                 // is over an item in the menu
  6730.                 if ( this.previousFilter ) {
  6731.                     return;
  6732.                 }
  6733.                 var target = $( event.currentTarget );
  6734.                 // Remove ui-state-active class from siblings of the newly focused menu item
  6735.                 // to avoid a jump caused by adjacent elements both having a class with a border
  6736.                 target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
  6737.                 this.focus( event, target );
  6738.             },
  6739.             mouseleave: "collapseAll",
  6740.             "mouseleave .ui-menu": "collapseAll",
  6741.             focus: function( event, keepActiveItem ) {
  6742.                 // If there's already an active item, keep it active
  6743.                 // If not, activate the first item
  6744.                 var item = this.active || this.element.find( this.options.items ).eq( 0 );
  6745.  
  6746.                 if ( !keepActiveItem ) {
  6747.                     this.focus( event, item );
  6748.                 }
  6749.             },
  6750.             blur: function( event ) {
  6751.                 this._delay(function() {
  6752.                     if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
  6753.                         this.collapseAll( event );
  6754.                     }
  6755.                 });
  6756.             },
  6757.             keydown: "_keydown"
  6758.         });
  6759.  
  6760.         this.refresh();
  6761.  
  6762.         // Clicks outside of a menu collapse any open menus
  6763.         this._on( this.document, {
  6764.             click: function( event ) {
  6765.                 if ( this._closeOnDocumentClick( event ) ) {
  6766.                     this.collapseAll( event );
  6767.                 }
  6768.  
  6769.                 // Reset the mouseHandled flag
  6770.                 this.mouseHandled = false;
  6771.             }
  6772.         });
  6773.     },
  6774.  
  6775.     _destroy: function() {
  6776.         // Destroy (sub)menus
  6777.         this.element
  6778.             .removeAttr( "aria-activedescendant" )
  6779.             .find( ".ui-menu" ).addBack()
  6780.                 .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
  6781.                 .removeAttr( "role" )
  6782.                 .removeAttr( "tabIndex" )
  6783.                 .removeAttr( "aria-labelledby" )
  6784.                 .removeAttr( "aria-expanded" )
  6785.                 .removeAttr( "aria-hidden" )
  6786.                 .removeAttr( "aria-disabled" )
  6787.                 .removeUniqueId()
  6788.                 .show();
  6789.  
  6790.         // Destroy menu items
  6791.         this.element.find( ".ui-menu-item" )
  6792.             .removeClass( "ui-menu-item" )
  6793.             .removeAttr( "role" )
  6794.             .removeAttr( "aria-disabled" )
  6795.             .removeUniqueId()
  6796.             .removeClass( "ui-state-hover" )
  6797.             .removeAttr( "tabIndex" )
  6798.             .removeAttr( "role" )
  6799.             .removeAttr( "aria-haspopup" )
  6800.             .children().each( function() {
  6801.                 var elem = $( this );
  6802.                 if ( elem.data( "ui-menu-submenu-carat" ) ) {
  6803.                     elem.remove();
  6804.                 }
  6805.             });
  6806.  
  6807.         // Destroy menu dividers
  6808.         this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
  6809.     },
  6810.  
  6811.     _keydown: function( event ) {
  6812.         var match, prev, character, skip,
  6813.             preventDefault = true;
  6814.  
  6815.         switch ( event.keyCode ) {
  6816.         case $.ui.keyCode.PAGE_UP:
  6817.             this.previousPage( event );
  6818.             break;
  6819.         case $.ui.keyCode.PAGE_DOWN:
  6820.             this.nextPage( event );
  6821.             break;
  6822.         case $.ui.keyCode.HOME:
  6823.             this._move( "first", "first", event );
  6824.             break;
  6825.         case $.ui.keyCode.END:
  6826.             this._move( "last", "last", event );
  6827.             break;
  6828.         case $.ui.keyCode.UP:
  6829.             this.previous( event );
  6830.             break;
  6831.         case $.ui.keyCode.DOWN:
  6832.             this.next( event );
  6833.             break;
  6834.         case $.ui.keyCode.LEFT:
  6835.             this.collapse( event );
  6836.             break;
  6837.         case $.ui.keyCode.RIGHT:
  6838.             if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6839.                 this.expand( event );
  6840.             }
  6841.             break;
  6842.         case $.ui.keyCode.ENTER:
  6843.         case $.ui.keyCode.SPACE:
  6844.             this._activate( event );
  6845.             break;
  6846.         case $.ui.keyCode.ESCAPE:
  6847.             this.collapse( event );
  6848.             break;
  6849.         default:
  6850.             preventDefault = false;
  6851.             prev = this.previousFilter || "";
  6852.             character = String.fromCharCode( event.keyCode );
  6853.             skip = false;
  6854.  
  6855.             clearTimeout( this.filterTimer );
  6856.  
  6857.             if ( character === prev ) {
  6858.                 skip = true;
  6859.             } else {
  6860.                 character = prev + character;
  6861.             }
  6862.  
  6863.             match = this._filterMenuItems( character );
  6864.             match = skip && match.index( this.active.next() ) !== -1 ?
  6865.                 this.active.nextAll( ".ui-menu-item" ) :
  6866.                 match;
  6867.  
  6868.             // If no matches on the current filter, reset to the last character pressed
  6869.             // to move down the menu to the first item that starts with that character
  6870.             if ( !match.length ) {
  6871.                 character = String.fromCharCode( event.keyCode );
  6872.                 match = this._filterMenuItems( character );
  6873.             }
  6874.  
  6875.             if ( match.length ) {
  6876.                 this.focus( event, match );
  6877.                 this.previousFilter = character;
  6878.                 this.filterTimer = this._delay(function() {
  6879.                     delete this.previousFilter;
  6880.                 }, 1000 );
  6881.             } else {
  6882.                 delete this.previousFilter;
  6883.             }
  6884.         }
  6885.  
  6886.         if ( preventDefault ) {
  6887.             event.preventDefault();
  6888.         }
  6889.     },
  6890.  
  6891.     _activate: function( event ) {
  6892.         if ( !this.active.is( ".ui-state-disabled" ) ) {
  6893.             if ( this.active.is( "[aria-haspopup='true']" ) ) {
  6894.                 this.expand( event );
  6895.             } else {
  6896.                 this.select( event );
  6897.             }
  6898.         }
  6899.     },
  6900.  
  6901.     refresh: function() {
  6902.         var menus, items,
  6903.             that = this,
  6904.             icon = this.options.icons.submenu,
  6905.             submenus = this.element.find( this.options.menus );
  6906.  
  6907.         this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
  6908.  
  6909.         // Initialize nested menus
  6910.         submenus.filter( ":not(.ui-menu)" )
  6911.             .addClass( "ui-menu ui-widget ui-widget-content ui-front" )
  6912.             .hide()
  6913.             .attr({
  6914.                 role: this.options.role,
  6915.                 "aria-hidden": "true",
  6916.                 "aria-expanded": "false"
  6917.             })
  6918.             .each(function() {
  6919.                 var menu = $( this ),
  6920.                     item = menu.parent(),
  6921.                     submenuCarat = $( "<span>" )
  6922.                         .addClass( "ui-menu-icon ui-icon " + icon )
  6923.                         .data( "ui-menu-submenu-carat", true );
  6924.  
  6925.                 item
  6926.                     .attr( "aria-haspopup", "true" )
  6927.                     .prepend( submenuCarat );
  6928.                 menu.attr( "aria-labelledby", item.attr( "id" ) );
  6929.             });
  6930.  
  6931.         menus = submenus.add( this.element );
  6932.         items = menus.find( this.options.items );
  6933.  
  6934.         // Initialize menu-items containing spaces and/or dashes only as dividers
  6935.         items.not( ".ui-menu-item" ).each(function() {
  6936.             var item = $( this );
  6937.             if ( that._isDivider( item ) ) {
  6938.                 item.addClass( "ui-widget-content ui-menu-divider" );
  6939.             }
  6940.         });
  6941.  
  6942.         // Don't refresh list items that are already adapted
  6943.         items.not( ".ui-menu-item, .ui-menu-divider" )
  6944.             .addClass( "ui-menu-item" )
  6945.             .uniqueId()
  6946.             .attr({
  6947.                 tabIndex: -1,
  6948.                 role: this._itemRole()
  6949.             });
  6950.  
  6951.         // Add aria-disabled attribute to any disabled menu item
  6952.         items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  6953.  
  6954.         // If the active item has been removed, blur the menu
  6955.         if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6956.             this.blur();
  6957.         }
  6958.     },
  6959.  
  6960.     _itemRole: function() {
  6961.         return {
  6962.             menu: "menuitem",
  6963.             listbox: "option"
  6964.         }[ this.options.role ];
  6965.     },
  6966.  
  6967.     _setOption: function( key, value ) {
  6968.         if ( key === "icons" ) {
  6969.             this.element.find( ".ui-menu-icon" )
  6970.                 .removeClass( this.options.icons.submenu )
  6971.                 .addClass( value.submenu );
  6972.         }
  6973.         if ( key === "disabled" ) {
  6974.             this.element
  6975.                 .toggleClass( "ui-state-disabled", !!value )
  6976.                 .attr( "aria-disabled", value );
  6977.         }
  6978.         this._super( key, value );
  6979.     },
  6980.  
  6981.     focus: function( event, item ) {
  6982.         var nested, focused;
  6983.         this.blur( event, event && event.type === "focus" );
  6984.  
  6985.         this._scrollIntoView( item );
  6986.  
  6987.         this.active = item.first();
  6988.         focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
  6989.         // Only update aria-activedescendant if there's a role
  6990.         // otherwise we assume focus is managed elsewhere
  6991.         if ( this.options.role ) {
  6992.             this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  6993.         }
  6994.  
  6995.         // Highlight active parent menu item, if any
  6996.         this.active
  6997.             .parent()
  6998.             .closest( ".ui-menu-item" )
  6999.             .addClass( "ui-state-active" );
  7000.  
  7001.         if ( event && event.type === "keydown" ) {
  7002.             this._close();
  7003.         } else {
  7004.             this.timer = this._delay(function() {
  7005.                 this._close();
  7006.             }, this.delay );
  7007.         }
  7008.  
  7009.         nested = item.children( ".ui-menu" );
  7010.         if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  7011.             this._startOpening(nested);
  7012.         }
  7013.         this.activeMenu = item.parent();
  7014.  
  7015.         this._trigger( "focus", event, { item: item } );
  7016.     },
  7017.  
  7018.     _scrollIntoView: function( item ) {
  7019.         var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  7020.         if ( this._hasScroll() ) {
  7021.             borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
  7022.             paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
  7023.             offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  7024.             scroll = this.activeMenu.scrollTop();
  7025.             elementHeight = this.activeMenu.height();
  7026.             itemHeight = item.outerHeight();
  7027.  
  7028.             if ( offset < 0 ) {
  7029.                 this.activeMenu.scrollTop( scroll + offset );
  7030.             } else if ( offset + itemHeight > elementHeight ) {
  7031.                 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  7032.             }
  7033.         }
  7034.     },
  7035.  
  7036.     blur: function( event, fromFocus ) {
  7037.         if ( !fromFocus ) {
  7038.             clearTimeout( this.timer );
  7039.         }
  7040.  
  7041.         if ( !this.active ) {
  7042.             return;
  7043.         }
  7044.  
  7045.         this.active.removeClass( "ui-state-focus" );
  7046.         this.active = null;
  7047.  
  7048.         this._trigger( "blur", event, { item: this.active } );
  7049.     },
  7050.  
  7051.     _startOpening: function( submenu ) {
  7052.         clearTimeout( this.timer );
  7053.  
  7054.         // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  7055.         // shift in the submenu position when mousing over the carat icon
  7056.         if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  7057.             return;
  7058.         }
  7059.  
  7060.         this.timer = this._delay(function() {
  7061.             this._close();
  7062.             this._open( submenu );
  7063.         }, this.delay );
  7064.     },
  7065.  
  7066.     _open: function( submenu ) {
  7067.         var position = $.extend({
  7068.             of: this.active
  7069.         }, this.options.position );
  7070.  
  7071.         clearTimeout( this.timer );
  7072.         this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  7073.             .hide()
  7074.             .attr( "aria-hidden", "true" );
  7075.  
  7076.         submenu
  7077.             .show()
  7078.             .removeAttr( "aria-hidden" )
  7079.             .attr( "aria-expanded", "true" )
  7080.             .position( position );
  7081.     },
  7082.  
  7083.     collapseAll: function( event, all ) {
  7084.         clearTimeout( this.timer );
  7085.         this.timer = this._delay(function() {
  7086.             // If we were passed an event, look for the submenu that contains the event
  7087.             var currentMenu = all ? this.element :
  7088.                 $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  7089.  
  7090.             // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
  7091.             if ( !currentMenu.length ) {
  7092.                 currentMenu = this.element;
  7093.             }
  7094.  
  7095.             this._close( currentMenu );
  7096.  
  7097.             this.blur( event );
  7098.             this.activeMenu = currentMenu;
  7099.         }, this.delay );
  7100.     },
  7101.  
  7102.     // With no arguments, closes the currently active menu - if nothing is active
  7103.     // it closes all menus.  If passed an argument, it will search for menus BELOW
  7104.     _close: function( startMenu ) {
  7105.         if ( !startMenu ) {
  7106.             startMenu = this.active ? this.active.parent() : this.element;
  7107.         }
  7108.  
  7109.         startMenu
  7110.             .find( ".ui-menu" )
  7111.                 .hide()
  7112.                 .attr( "aria-hidden", "true" )
  7113.                 .attr( "aria-expanded", "false" )
  7114.             .end()
  7115.             .find( ".ui-state-active" ).not( ".ui-state-focus" )
  7116.                 .removeClass( "ui-state-active" );
  7117.     },
  7118.  
  7119.     _closeOnDocumentClick: function( event ) {
  7120.         return !$( event.target ).closest( ".ui-menu" ).length;
  7121.     },
  7122.  
  7123.     _isDivider: function( item ) {
  7124.  
  7125.         // Match hyphen, em dash, en dash
  7126.         return !/[^\-\u2014\u2013\s]/.test( item.text() );
  7127.     },
  7128.  
  7129.     collapse: function( event ) {
  7130.         var newItem = this.active &&
  7131.             this.active.parent().closest( ".ui-menu-item", this.element );
  7132.         if ( newItem && newItem.length ) {
  7133.             this._close();
  7134.             this.focus( event, newItem );
  7135.         }
  7136.     },
  7137.  
  7138.     expand: function( event ) {
  7139.         var newItem = this.active &&
  7140.             this.active
  7141.                 .children( ".ui-menu " )
  7142.                 .find( this.options.items )
  7143.                 .first();
  7144.  
  7145.         if ( newItem && newItem.length ) {
  7146.             this._open( newItem.parent() );
  7147.  
  7148.             // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  7149.             this._delay(function() {
  7150.                 this.focus( event, newItem );
  7151.             });
  7152.         }
  7153.     },
  7154.  
  7155.     next: function( event ) {
  7156.         this._move( "next", "first", event );
  7157.     },
  7158.  
  7159.     previous: function( event ) {
  7160.         this._move( "prev", "last", event );
  7161.     },
  7162.  
  7163.     isFirstItem: function() {
  7164.         return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  7165.     },
  7166.  
  7167.     isLastItem: function() {
  7168.         return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  7169.     },
  7170.  
  7171.     _move: function( direction, filter, event ) {
  7172.         var next;
  7173.         if ( this.active ) {
  7174.             if ( direction === "first" || direction === "last" ) {
  7175.                 next = this.active
  7176.                     [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  7177.                     .eq( -1 );
  7178.             } else {
  7179.                 next = this.active
  7180.                     [ direction + "All" ]( ".ui-menu-item" )
  7181.                     .eq( 0 );
  7182.             }
  7183.         }
  7184.         if ( !next || !next.length || !this.active ) {
  7185.             next = this.activeMenu.find( this.options.items )[ filter ]();
  7186.         }
  7187.  
  7188.         this.focus( event, next );
  7189.     },
  7190.  
  7191.     nextPage: function( event ) {
  7192.         var item, base, height;
  7193.  
  7194.         if ( !this.active ) {
  7195.             this.next( event );
  7196.             return;
  7197.         }
  7198.         if ( this.isLastItem() ) {
  7199.             return;
  7200.         }
  7201.         if ( this._hasScroll() ) {
  7202.             base = this.active.offset().top;
  7203.             height = this.element.height();
  7204.             this.active.nextAll( ".ui-menu-item" ).each(function() {
  7205.                 item = $( this );
  7206.                 return item.offset().top - base - height < 0;
  7207.             });
  7208.  
  7209.             this.focus( event, item );
  7210.         } else {
  7211.             this.focus( event, this.activeMenu.find( this.options.items )
  7212.                 [ !this.active ? "first" : "last" ]() );
  7213.         }
  7214.     },
  7215.  
  7216.     previousPage: function( event ) {
  7217.         var item, base, height;
  7218.         if ( !this.active ) {
  7219.             this.next( event );
  7220.             return;
  7221.         }
  7222.         if ( this.isFirstItem() ) {
  7223.             return;
  7224.         }
  7225.         if ( this._hasScroll() ) {
  7226.             base = this.active.offset().top;
  7227.             height = this.element.height();
  7228.             this.active.prevAll( ".ui-menu-item" ).each(function() {
  7229.                 item = $( this );
  7230.                 return item.offset().top - base + height > 0;
  7231.             });
  7232.  
  7233.             this.focus( event, item );
  7234.         } else {
  7235.             this.focus( event, this.activeMenu.find( this.options.items ).first() );
  7236.         }
  7237.     },
  7238.  
  7239.     _hasScroll: function() {
  7240.         return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  7241.     },
  7242.  
  7243.     select: function( event ) {
  7244.         // TODO: It should never be possible to not have an active item at this
  7245.         // point, but the tests don't trigger mouseenter before click.
  7246.         this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  7247.         var ui = { item: this.active };
  7248.         if ( !this.active.has( ".ui-menu" ).length ) {
  7249.             this.collapseAll( event, true );
  7250.         }
  7251.         this._trigger( "select", event, ui );
  7252.     },
  7253.  
  7254.     _filterMenuItems: function(character) {
  7255.         var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  7256.             regex = new RegExp( "^" + escapedCharacter, "i" );
  7257.  
  7258.         return this.activeMenu
  7259.             .find( this.options.items )
  7260.  
  7261.             // Only match on items, not dividers or other content (#10571)
  7262.             .filter( ".ui-menu-item" )
  7263.             .filter(function() {
  7264.                 return regex.test( $.trim( $( this ).text() ) );
  7265.             });
  7266.     }
  7267. });
  7268.  
  7269.  
  7270. /*!
  7271.  * jQuery UI Autocomplete 1.11.4
  7272.  * http://jqueryui.com
  7273.  *
  7274.  * Copyright jQuery Foundation and other contributors
  7275.  * Released under the MIT license.
  7276.  * http://jquery.org/license
  7277.  *
  7278.  * http://api.jqueryui.com/autocomplete/
  7279.  */
  7280.  
  7281.  
  7282. $.widget( "ui.autocomplete", {
  7283.     version: "1.11.4",
  7284.     defaultElement: "<input>",
  7285.     options: {
  7286.         appendTo: null,
  7287.         autoFocus: false,
  7288.         delay: 300,
  7289.         minLength: 1,
  7290.         position: {
  7291.             my: "left top",
  7292.             at: "left bottom",
  7293.             collision: "none"
  7294.         },
  7295.         source: null,
  7296.  
  7297.         // callbacks
  7298.         change: null,
  7299.         close: null,
  7300.         focus: null,
  7301.         open: null,
  7302.         response: null,
  7303.         search: null,
  7304.         select: null
  7305.     },
  7306.  
  7307.     requestIndex: 0,
  7308.     pending: 0,
  7309.  
  7310.     _create: function() {
  7311.         // Some browsers only repeat keydown events, not keypress events,
  7312.         // so we use the suppressKeyPress flag to determine if we've already
  7313.         // handled the keydown event. #7269
  7314.         // Unfortunately the code for & in keypress is the same as the up arrow,
  7315.         // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  7316.         // events when we know the keydown event was used to modify the
  7317.         // search term. #7799
  7318.         var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  7319.             nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  7320.             isTextarea = nodeName === "textarea",
  7321.             isInput = nodeName === "input";
  7322.  
  7323.         this.isMultiLine =
  7324.             // Textareas are always multi-line
  7325.             isTextarea ? true :
  7326.             // Inputs are always single-line, even if inside a contentEditable element
  7327.             // IE also treats inputs as contentEditable
  7328.             isInput ? false :
  7329.             // All other element types are determined by whether or not they're contentEditable
  7330.             this.element.prop( "isContentEditable" );
  7331.  
  7332.         this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  7333.         this.isNewMenu = true;
  7334.  
  7335.         this.element
  7336.             .addClass( "ui-autocomplete-input" )
  7337.             .attr( "autocomplete", "off" );
  7338.  
  7339.         this._on( this.element, {
  7340.             keydown: function( event ) {
  7341.                 if ( this.element.prop( "readOnly" ) ) {
  7342.                     suppressKeyPress = true;
  7343.                     suppressInput = true;
  7344.                     suppressKeyPressRepeat = true;
  7345.                     return;
  7346.                 }
  7347.  
  7348.                 suppressKeyPress = false;
  7349.                 suppressInput = false;
  7350.                 suppressKeyPressRepeat = false;
  7351.                 var keyCode = $.ui.keyCode;
  7352.                 switch ( event.keyCode ) {
  7353.                 case keyCode.PAGE_UP:
  7354.                     suppressKeyPress = true;
  7355.                     this._move( "previousPage", event );
  7356.                     break;
  7357.                 case keyCode.PAGE_DOWN:
  7358.                     suppressKeyPress = true;
  7359.                     this._move( "nextPage", event );
  7360.                     break;
  7361.                 case keyCode.UP:
  7362.                     suppressKeyPress = true;
  7363.                     this._keyEvent( "previous", event );
  7364.                     break;
  7365.                 case keyCode.DOWN:
  7366.                     suppressKeyPress = true;
  7367.                     this._keyEvent( "next", event );
  7368.                     break;
  7369.                 case keyCode.ENTER:
  7370.                     // when menu is open and has focus
  7371.                     if ( this.menu.active ) {
  7372.                         // #6055 - Opera still allows the keypress to occur
  7373.                         // which causes forms to submit
  7374.                         suppressKeyPress = true;
  7375.                         event.preventDefault();
  7376.                         this.menu.select( event );
  7377.                     }
  7378.                     break;
  7379.                 case keyCode.TAB:
  7380.                     if ( this.menu.active ) {
  7381.                         this.menu.select( event );
  7382.                     }
  7383.                     break;
  7384.                 case keyCode.ESCAPE:
  7385.                     if ( this.menu.element.is( ":visible" ) ) {
  7386.                         if ( !this.isMultiLine ) {
  7387.                             this._value( this.term );
  7388.                         }
  7389.                         this.close( event );
  7390.                         // Different browsers have different default behavior for escape
  7391.                         // Single press can mean undo or clear
  7392.                         // Double press in IE means clear the whole form
  7393.                         event.preventDefault();
  7394.                     }
  7395.                     break;
  7396.                 default:
  7397.                     suppressKeyPressRepeat = true;
  7398.                     // search timeout should be triggered before the input value is changed
  7399.                     this._searchTimeout( event );
  7400.                     break;
  7401.                 }
  7402.             },
  7403.             keypress: function( event ) {
  7404.                 if ( suppressKeyPress ) {
  7405.                     suppressKeyPress = false;
  7406.                     if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7407.                         event.preventDefault();
  7408.                     }
  7409.                     return;
  7410.                 }
  7411.                 if ( suppressKeyPressRepeat ) {
  7412.                     return;
  7413.                 }
  7414.  
  7415.                 // replicate some key handlers to allow them to repeat in Firefox and Opera
  7416.                 var keyCode = $.ui.keyCode;
  7417.                 switch ( event.keyCode ) {
  7418.                 case keyCode.PAGE_UP:
  7419.                     this._move( "previousPage", event );
  7420.                     break;
  7421.                 case keyCode.PAGE_DOWN:
  7422.                     this._move( "nextPage", event );
  7423.                     break;
  7424.                 case keyCode.UP:
  7425.                     this._keyEvent( "previous", event );
  7426.                     break;
  7427.                 case keyCode.DOWN:
  7428.                     this._keyEvent( "next", event );
  7429.                     break;
  7430.                 }
  7431.             },
  7432.             input: function( event ) {
  7433.                 if ( suppressInput ) {
  7434.                     suppressInput = false;
  7435.                     event.preventDefault();
  7436.                     return;
  7437.                 }
  7438.                 this._searchTimeout( event );
  7439.             },
  7440.             focus: function() {
  7441.                 this.selectedItem = null;
  7442.                 this.previous = this._value();
  7443.             },
  7444.             blur: function( event ) {
  7445.                 if ( this.cancelBlur ) {
  7446.                     delete this.cancelBlur;
  7447.                     return;
  7448.                 }
  7449.  
  7450.                 clearTimeout( this.searching );
  7451.                 this.close( event );
  7452.                 this._change( event );
  7453.             }
  7454.         });
  7455.  
  7456.         this._initSource();
  7457.         this.menu = $( "<ul>" )
  7458.             .addClass( "ui-autocomplete ui-front" )
  7459.             .appendTo( this._appendTo() )
  7460.             .menu({
  7461.                 // disable ARIA support, the live region takes care of that
  7462.                 role: null
  7463.             })
  7464.             .hide()
  7465.             .menu( "instance" );
  7466.  
  7467.         this._on( this.menu.element, {
  7468.             mousedown: function( event ) {
  7469.                 // prevent moving focus out of the text field
  7470.                 event.preventDefault();
  7471.  
  7472.                 // IE doesn't prevent moving focus even with event.preventDefault()
  7473.                 // so we set a flag to know when we should ignore the blur event
  7474.                 this.cancelBlur = true;
  7475.                 this._delay(function() {
  7476.                     delete this.cancelBlur;
  7477.                 });
  7478.  
  7479.                 // clicking on the scrollbar causes focus to shift to the body
  7480.                 // but we can't detect a mouseup or a click immediately afterward
  7481.                 // so we have to track the next mousedown and close the menu if
  7482.                 // the user clicks somewhere outside of the autocomplete
  7483.                 var menuElement = this.menu.element[ 0 ];
  7484.                 if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  7485.                     this._delay(function() {
  7486.                         var that = this;
  7487.                         this.document.one( "mousedown", function( event ) {
  7488.                             if ( event.target !== that.element[ 0 ] &&
  7489.                                     event.target !== menuElement &&
  7490.                                     !$.contains( menuElement, event.target ) ) {
  7491.                                 that.close();
  7492.                             }
  7493.                         });
  7494.                     });
  7495.                 }
  7496.             },
  7497.             menufocus: function( event, ui ) {
  7498.                 var label, item;
  7499.                 // support: Firefox
  7500.                 // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  7501.                 if ( this.isNewMenu ) {
  7502.                     this.isNewMenu = false;
  7503.                     if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  7504.                         this.menu.blur();
  7505.  
  7506.                         this.document.one( "mousemove", function() {
  7507.                             $( event.target ).trigger( event.originalEvent );
  7508.                         });
  7509.  
  7510.                         return;
  7511.                     }
  7512.                 }
  7513.  
  7514.                 item = ui.item.data( "ui-autocomplete-item" );
  7515.                 if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  7516.                     // use value to match what will end up in the input, if it was a key event
  7517.                     if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  7518.                         this._value( item.value );
  7519.                     }
  7520.                 }
  7521.  
  7522.                 // Announce the value in the liveRegion
  7523.                 label = ui.item.attr( "aria-label" ) || item.value;
  7524.                 if ( label && $.trim( label ).length ) {
  7525.                     this.liveRegion.children().hide();
  7526.                     $( "<div>" ).text( label ).appendTo( this.liveRegion );
  7527.                 }
  7528.             },
  7529.             menuselect: function( event, ui ) {
  7530.                 var item = ui.item.data( "ui-autocomplete-item" ),
  7531.                     previous = this.previous;
  7532.  
  7533.                 // only trigger when focus was lost (click on menu)
  7534.                 if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
  7535.                     this.element.focus();
  7536.                     this.previous = previous;
  7537.                     // #6109 - IE triggers two focus events and the second
  7538.                     // is asynchronous, so we need to reset the previous
  7539.                     // term synchronously and asynchronously :-(
  7540.                     this._delay(function() {
  7541.                         this.previous = previous;
  7542.                         this.selectedItem = item;
  7543.                     });
  7544.                 }
  7545.  
  7546.                 if ( false !== this._trigger( "select", event, { item: item } ) ) {
  7547.                     this._value( item.value );
  7548.                 }
  7549.                 // reset the term after the select event
  7550.                 // this allows custom select handling to work properly
  7551.                 this.term = this._value();
  7552.  
  7553.                 this.close( event );
  7554.                 this.selectedItem = item;
  7555.             }
  7556.         });
  7557.  
  7558.         this.liveRegion = $( "<span>", {
  7559.                 role: "status",
  7560.                 "aria-live": "assertive",
  7561.                 "aria-relevant": "additions"
  7562.             })
  7563.             .addClass( "ui-helper-hidden-accessible" )
  7564.             .appendTo( this.document[ 0 ].body );
  7565.  
  7566.         // turning off autocomplete prevents the browser from remembering the
  7567.         // value when navigating through history, so we re-enable autocomplete
  7568.         // if the page is unloaded before the widget is destroyed. #7790
  7569.         this._on( this.window, {
  7570.             beforeunload: function() {
  7571.                 this.element.removeAttr( "autocomplete" );
  7572.             }
  7573.         });
  7574.     },
  7575.  
  7576.     _destroy: function() {
  7577.         clearTimeout( this.searching );
  7578.         this.element
  7579.             .removeClass( "ui-autocomplete-input" )
  7580.             .removeAttr( "autocomplete" );
  7581.         this.menu.element.remove();
  7582.         this.liveRegion.remove();
  7583.     },
  7584.  
  7585.     _setOption: function( key, value ) {
  7586.         this._super( key, value );
  7587.         if ( key === "source" ) {
  7588.             this._initSource();
  7589.         }
  7590.         if ( key === "appendTo" ) {
  7591.             this.menu.element.appendTo( this._appendTo() );
  7592.         }
  7593.         if ( key === "disabled" && value && this.xhr ) {
  7594.             this.xhr.abort();
  7595.         }
  7596.     },
  7597.  
  7598.     _appendTo: function() {
  7599.         var element = this.options.appendTo;
  7600.  
  7601.         if ( element ) {
  7602.             element = element.jquery || element.nodeType ?
  7603.                 $( element ) :
  7604.                 this.document.find( element ).eq( 0 );
  7605.         }
  7606.  
  7607.         if ( !element || !element[ 0 ] ) {
  7608.             element = this.element.closest( ".ui-front" );
  7609.         }
  7610.  
  7611.         if ( !element.length ) {
  7612.             element = this.document[ 0 ].body;
  7613.         }
  7614.  
  7615.         return element;
  7616.     },
  7617.  
  7618.     _initSource: function() {
  7619.         var array, url,
  7620.             that = this;
  7621.         if ( $.isArray( this.options.source ) ) {
  7622.             array = this.options.source;
  7623.             this.source = function( request, response ) {
  7624.                 response( $.ui.autocomplete.filter( array, request.term ) );
  7625.             };
  7626.         } else if ( typeof this.options.source === "string" ) {
  7627.             url = this.options.source;
  7628.             this.source = function( request, response ) {
  7629.                 if ( that.xhr ) {
  7630.                     that.xhr.abort();
  7631.                 }
  7632.                 that.xhr = $.ajax({
  7633.                     url: url,
  7634.                     data: request,
  7635.                     dataType: "json",
  7636.                     success: function( data ) {
  7637.                         response( data );
  7638.                     },
  7639.                     error: function() {
  7640.                         response([]);
  7641.                     }
  7642.                 });
  7643.             };
  7644.         } else {
  7645.             this.source = this.options.source;
  7646.         }
  7647.     },
  7648.  
  7649.     _searchTimeout: function( event ) {
  7650.         clearTimeout( this.searching );
  7651.         this.searching = this._delay(function() {
  7652.  
  7653.             // Search if the value has changed, or if the user retypes the same value (see #7434)
  7654.             var equalValues = this.term === this._value(),
  7655.                 menuVisible = this.menu.element.is( ":visible" ),
  7656.                 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  7657.  
  7658.             if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  7659.                 this.selectedItem = null;
  7660.                 this.search( null, event );
  7661.             }
  7662.         }, this.options.delay );
  7663.     },
  7664.  
  7665.     search: function( value, event ) {
  7666.         value = value != null ? value : this._value();
  7667.  
  7668.         // always save the actual value, not the one passed as an argument
  7669.         this.term = this._value();
  7670.  
  7671.         if ( value.length < this.options.minLength ) {
  7672.             return this.close( event );
  7673.         }
  7674.  
  7675.         if ( this._trigger( "search", event ) === false ) {
  7676.             return;
  7677.         }
  7678.  
  7679.         return this._search( value );
  7680.     },
  7681.  
  7682.     _search: function( value ) {
  7683.         this.pending++;
  7684.         this.element.addClass( "ui-autocomplete-loading" );
  7685.         this.cancelSearch = false;
  7686.  
  7687.         this.source( { term: value }, this._response() );
  7688.     },
  7689.  
  7690.     _response: function() {
  7691.         var index = ++this.requestIndex;
  7692.  
  7693.         return $.proxy(function( content ) {
  7694.             if ( index === this.requestIndex ) {
  7695.                 this.__response( content );
  7696.             }
  7697.  
  7698.             this.pending--;
  7699.             if ( !this.pending ) {
  7700.                 this.element.removeClass( "ui-autocomplete-loading" );
  7701.             }
  7702.         }, this );
  7703.     },
  7704.  
  7705.     __response: function( content ) {
  7706.         if ( content ) {
  7707.             content = this._normalize( content );
  7708.         }
  7709.         this._trigger( "response", null, { content: content } );
  7710.         if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  7711.             this._suggest( content );
  7712.             this._trigger( "open" );
  7713.         } else {
  7714.             // use ._close() instead of .close() so we don't cancel future searches
  7715.             this._close();
  7716.         }
  7717.     },
  7718.  
  7719.     close: function( event ) {
  7720.         this.cancelSearch = true;
  7721.         this._close( event );
  7722.     },
  7723.  
  7724.     _close: function( event ) {
  7725.         if ( this.menu.element.is( ":visible" ) ) {
  7726.             this.menu.element.hide();
  7727.             this.menu.blur();
  7728.             this.isNewMenu = true;
  7729.             this._trigger( "close", event );
  7730.         }
  7731.     },
  7732.  
  7733.     _change: function( event ) {
  7734.         if ( this.previous !== this._value() ) {
  7735.             this._trigger( "change", event, { item: this.selectedItem } );
  7736.         }
  7737.     },
  7738.  
  7739.     _normalize: function( items ) {
  7740.         // assume all items have the right format when the first item is complete
  7741.         if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  7742.             return items;
  7743.         }
  7744.         return $.map( items, function( item ) {
  7745.             if ( typeof item === "string" ) {
  7746.                 return {
  7747.                     label: item,
  7748.                     value: item
  7749.                 };
  7750.             }
  7751.             return $.extend( {}, item, {
  7752.                 label: item.label || item.value,
  7753.                 value: item.value || item.label
  7754.             });
  7755.         });
  7756.     },
  7757.  
  7758.     _suggest: function( items ) {
  7759.         var ul = this.menu.element.empty();
  7760.         this._renderMenu( ul, items );
  7761.         this.isNewMenu = true;
  7762.         this.menu.refresh();
  7763.  
  7764.         // size and position menu
  7765.         ul.show();
  7766.         this._resizeMenu();
  7767.         ul.position( $.extend({
  7768.             of: this.element
  7769.         }, this.options.position ) );
  7770.  
  7771.         if ( this.options.autoFocus ) {
  7772.             this.menu.next();
  7773.         }
  7774.     },
  7775.  
  7776.     _resizeMenu: function() {
  7777.         var ul = this.menu.element;
  7778.         ul.outerWidth( Math.max(
  7779.             // Firefox wraps long text (possibly a rounding bug)
  7780.             // so we add 1px to avoid the wrapping (#7513)
  7781.             ul.width( "" ).outerWidth() + 1,
  7782.             this.element.outerWidth()
  7783.         ) );
  7784.     },
  7785.  
  7786.     _renderMenu: function( ul, items ) {
  7787.         var that = this;
  7788.         $.each( items, function( index, item ) {
  7789.             that._renderItemData( ul, item );
  7790.         });
  7791.     },
  7792.  
  7793.     _renderItemData: function( ul, item ) {
  7794.         return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  7795.     },
  7796.  
  7797.     _renderItem: function( ul, item ) {
  7798.         return $( "<li>" ).text( item.label ).appendTo( ul );
  7799.     },
  7800.  
  7801.     _move: function( direction, event ) {
  7802.         if ( !this.menu.element.is( ":visible" ) ) {
  7803.             this.search( null, event );
  7804.             return;
  7805.         }
  7806.         if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  7807.                 this.menu.isLastItem() && /^next/.test( direction ) ) {
  7808.  
  7809.             if ( !this.isMultiLine ) {
  7810.                 this._value( this.term );
  7811.             }
  7812.  
  7813.             this.menu.blur();
  7814.             return;
  7815.         }
  7816.         this.menu[ direction ]( event );
  7817.     },
  7818.  
  7819.     widget: function() {
  7820.         return this.menu.element;
  7821.     },
  7822.  
  7823.     _value: function() {
  7824.         return this.valueMethod.apply( this.element, arguments );
  7825.     },
  7826.  
  7827.     _keyEvent: function( keyEvent, event ) {
  7828.         if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7829.             this._move( keyEvent, event );
  7830.  
  7831.             // prevents moving cursor to beginning/end of the text field in some browsers
  7832.             event.preventDefault();
  7833.         }
  7834.     }
  7835. });
  7836.  
  7837. $.extend( $.ui.autocomplete, {
  7838.     escapeRegex: function( value ) {
  7839.         return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  7840.     },
  7841.     filter: function( array, term ) {
  7842.         var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  7843.         return $.grep( array, function( value ) {
  7844.             return matcher.test( value.label || value.value || value );
  7845.         });
  7846.     }
  7847. });
  7848.  
  7849. // live region extension, adding a `messages` option
  7850. // NOTE: This is an experimental API. We are still investigating
  7851. // a full solution for string manipulation and internationalization.
  7852. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  7853.     options: {
  7854.         messages: {
  7855.             noResults: "No search results.",
  7856.             results: function( amount ) {
  7857.                 return amount + ( amount > 1 ? " results are" : " result is" ) +
  7858.                     " available, use up and down arrow keys to navigate.";
  7859.             }
  7860.         }
  7861.     },
  7862.  
  7863.     __response: function( content ) {
  7864.         var message;
  7865.         this._superApply( arguments );
  7866.         if ( this.options.disabled || this.cancelSearch ) {
  7867.             return;
  7868.         }
  7869.         if ( content && content.length ) {
  7870.             message = this.options.messages.results( content.length );
  7871.         } else {
  7872.             message = this.options.messages.noResults;
  7873.         }
  7874.         this.liveRegion.children().hide();
  7875.         $( "<div>" ).text( message ).appendTo( this.liveRegion );
  7876.     }
  7877. });
  7878.  
  7879. var autocomplete = $.ui.autocomplete;
  7880.  
  7881.  
  7882. /*!
  7883.  * jQuery UI Button 1.11.4
  7884.  * http://jqueryui.com
  7885.  *
  7886.  * Copyright jQuery Foundation and other contributors
  7887.  * Released under the MIT license.
  7888.  * http://jquery.org/license
  7889.  *
  7890.  * http://api.jqueryui.com/button/
  7891.  */
  7892.  
  7893.  
  7894. var lastActive,
  7895.     baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  7896.     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",
  7897.     formResetHandler = function() {
  7898.         var form = $( this );
  7899.         setTimeout(function() {
  7900.             form.find( ":ui-button" ).button( "refresh" );
  7901.         }, 1 );
  7902.     },
  7903.     radioGroup = function( radio ) {
  7904.         var name = radio.name,
  7905.             form = radio.form,
  7906.             radios = $( [] );
  7907.         if ( name ) {
  7908.             name = name.replace( /'/g, "\\'" );
  7909.             if ( form ) {
  7910.                 radios = $( form ).find( "[name='" + name + "'][type=radio]" );
  7911.             } else {
  7912.                 radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
  7913.                     .filter(function() {
  7914.                         return !this.form;
  7915.                     });
  7916.             }
  7917.         }
  7918.         return radios;
  7919.     };
  7920.  
  7921. $.widget( "ui.button", {
  7922.     version: "1.11.4",
  7923.     defaultElement: "<button>",
  7924.     options: {
  7925.         disabled: null,
  7926.         text: true,
  7927.         label: null,
  7928.         icons: {
  7929.             primary: null,
  7930.             secondary: null
  7931.         }
  7932.     },
  7933.     _create: function() {
  7934.         this.element.closest( "form" )
  7935.             .unbind( "reset" + this.eventNamespace )
  7936.             .bind( "reset" + this.eventNamespace, formResetHandler );
  7937.  
  7938.         if ( typeof this.options.disabled !== "boolean" ) {
  7939.             this.options.disabled = !!this.element.prop( "disabled" );
  7940.         } else {
  7941.             this.element.prop( "disabled", this.options.disabled );
  7942.         }
  7943.  
  7944.         this._determineButtonType();
  7945.         this.hasTitle = !!this.buttonElement.attr( "title" );
  7946.  
  7947.         var that = this,
  7948.             options = this.options,
  7949.             toggleButton = this.type === "checkbox" || this.type === "radio",
  7950.             activeClass = !toggleButton ? "ui-state-active" : "";
  7951.  
  7952.         if ( options.label === null ) {
  7953.             options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
  7954.         }
  7955.  
  7956.         this._hoverable( this.buttonElement );
  7957.  
  7958.         this.buttonElement
  7959.             .addClass( baseClasses )
  7960.             .attr( "role", "button" )
  7961.             .bind( "mouseenter" + this.eventNamespace, function() {
  7962.                 if ( options.disabled ) {
  7963.                     return;
  7964.                 }
  7965.                 if ( this === lastActive ) {
  7966.                     $( this ).addClass( "ui-state-active" );
  7967.                 }
  7968.             })
  7969.             .bind( "mouseleave" + this.eventNamespace, function() {
  7970.                 if ( options.disabled ) {
  7971.                     return;
  7972.                 }
  7973.                 $( this ).removeClass( activeClass );
  7974.             })
  7975.             .bind( "click" + this.eventNamespace, function( event ) {
  7976.                 if ( options.disabled ) {
  7977.                     event.preventDefault();
  7978.                     event.stopImmediatePropagation();
  7979.                 }
  7980.             });
  7981.  
  7982.         // Can't use _focusable() because the element that receives focus
  7983.         // and the element that gets the ui-state-focus class are different
  7984.         this._on({
  7985.             focus: function() {
  7986.                 this.buttonElement.addClass( "ui-state-focus" );
  7987.             },
  7988.             blur: function() {
  7989.                 this.buttonElement.removeClass( "ui-state-focus" );
  7990.             }
  7991.         });
  7992.  
  7993.         if ( toggleButton ) {
  7994.             this.element.bind( "change" + this.eventNamespace, function() {
  7995.                 that.refresh();
  7996.             });
  7997.         }
  7998.  
  7999.         if ( this.type === "checkbox" ) {
  8000.             this.buttonElement.bind( "click" + this.eventNamespace, function() {
  8001.                 if ( options.disabled ) {
  8002.                     return false;
  8003.                 }
  8004.             });
  8005.         } else if ( this.type === "radio" ) {
  8006.             this.buttonElement.bind( "click" + this.eventNamespace, function() {
  8007.                 if ( options.disabled ) {
  8008.                     return false;
  8009.                 }
  8010.                 $( this ).addClass( "ui-state-active" );
  8011.                 that.buttonElement.attr( "aria-pressed", "true" );
  8012.  
  8013.                 var radio = that.element[ 0 ];
  8014.                 radioGroup( radio )
  8015.                     .not( radio )
  8016.                     .map(function() {
  8017.                         return $( this ).button( "widget" )[ 0 ];
  8018.                     })
  8019.                     .removeClass( "ui-state-active" )
  8020.                     .attr( "aria-pressed", "false" );
  8021.             });
  8022.         } else {
  8023.             this.buttonElement
  8024.                 .bind( "mousedown" + this.eventNamespace, function() {
  8025.                     if ( options.disabled ) {
  8026.                         return false;
  8027.                     }
  8028.                     $( this ).addClass( "ui-state-active" );
  8029.                     lastActive = this;
  8030.                     that.document.one( "mouseup", function() {
  8031.                         lastActive = null;
  8032.                     });
  8033.                 })
  8034.                 .bind( "mouseup" + this.eventNamespace, function() {
  8035.                     if ( options.disabled ) {
  8036.                         return false;
  8037.                     }
  8038.                     $( this ).removeClass( "ui-state-active" );
  8039.                 })
  8040.                 .bind( "keydown" + this.eventNamespace, function(event) {
  8041.                     if ( options.disabled ) {
  8042.                         return false;
  8043.                     }
  8044.                     if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
  8045.                         $( this ).addClass( "ui-state-active" );
  8046.                     }
  8047.                 })
  8048.                 // see #8559, we bind to blur here in case the button element loses
  8049.                 // focus between keydown and keyup, it would be left in an "active" state
  8050.                 .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
  8051.                     $( this ).removeClass( "ui-state-active" );
  8052.                 });
  8053.  
  8054.             if ( this.buttonElement.is("a") ) {
  8055.                 this.buttonElement.keyup(function(event) {
  8056.                     if ( event.keyCode === $.ui.keyCode.SPACE ) {
  8057.                         // TODO pass through original event correctly (just as 2nd argument doesn't work)
  8058.                         $( this ).click();
  8059.                     }
  8060.                 });
  8061.             }
  8062.         }
  8063.  
  8064.         this._setOption( "disabled", options.disabled );
  8065.         this._resetButton();
  8066.     },
  8067.  
  8068.     _determineButtonType: function() {
  8069.         var ancestor, labelSelector, checked;
  8070.  
  8071.         if ( this.element.is("[type=checkbox]") ) {
  8072.             this.type = "checkbox";
  8073.         } else if ( this.element.is("[type=radio]") ) {
  8074.             this.type = "radio";
  8075.         } else if ( this.element.is("input") ) {
  8076.             this.type = "input";
  8077.         } else {
  8078.             this.type = "button";
  8079.         }
  8080.  
  8081.         if ( this.type === "checkbox" || this.type === "radio" ) {
  8082.             // we don't search against the document in case the element
  8083.             // is disconnected from the DOM
  8084.             ancestor = this.element.parents().last();
  8085.             labelSelector = "label[for='" + this.element.attr("id") + "']";
  8086.             this.buttonElement = ancestor.find( labelSelector );
  8087.             if ( !this.buttonElement.length ) {
  8088.                 ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
  8089.                 this.buttonElement = ancestor.filter( labelSelector );
  8090.                 if ( !this.buttonElement.length ) {
  8091.                     this.buttonElement = ancestor.find( labelSelector );
  8092.                 }
  8093.             }
  8094.             this.element.addClass( "ui-helper-hidden-accessible" );
  8095.  
  8096.             checked = this.element.is( ":checked" );
  8097.             if ( checked ) {
  8098.                 this.buttonElement.addClass( "ui-state-active" );
  8099.             }
  8100.             this.buttonElement.prop( "aria-pressed", checked );
  8101.         } else {
  8102.             this.buttonElement = this.element;
  8103.         }
  8104.     },
  8105.  
  8106.     widget: function() {
  8107.         return this.buttonElement;
  8108.     },
  8109.  
  8110.     _destroy: function() {
  8111.         this.element
  8112.             .removeClass( "ui-helper-hidden-accessible" );
  8113.         this.buttonElement
  8114.             .removeClass( baseClasses + " ui-state-active " + typeClasses )
  8115.             .removeAttr( "role" )
  8116.             .removeAttr( "aria-pressed" )
  8117.             .html( this.buttonElement.find(".ui-button-text").html() );
  8118.  
  8119.         if ( !this.hasTitle ) {
  8120.             this.buttonElement.removeAttr( "title" );
  8121.         }
  8122.     },
  8123.  
  8124.     _setOption: function( key, value ) {
  8125.         this._super( key, value );
  8126.         if ( key === "disabled" ) {
  8127.             this.widget().toggleClass( "ui-state-disabled", !!value );
  8128.             this.element.prop( "disabled", !!value );
  8129.             if ( value ) {
  8130.                 if ( this.type === "checkbox" || this.type === "radio" ) {
  8131.                     this.buttonElement.removeClass( "ui-state-focus" );
  8132.                 } else {
  8133.                     this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
  8134.                 }
  8135.             }
  8136.             return;
  8137.         }
  8138.         this._resetButton();
  8139.     },
  8140.  
  8141.     refresh: function() {
  8142.         //See #8237 & #8828
  8143.         var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
  8144.  
  8145.         if ( isDisabled !== this.options.disabled ) {
  8146.             this._setOption( "disabled", isDisabled );
  8147.         }
  8148.         if ( this.type === "radio" ) {
  8149.             radioGroup( this.element[0] ).each(function() {
  8150.                 if ( $( this ).is( ":checked" ) ) {
  8151.                     $( this ).button( "widget" )
  8152.                         .addClass( "ui-state-active" )
  8153.                         .attr( "aria-pressed", "true" );
  8154.                 } else {
  8155.                     $( this ).button( "widget" )
  8156.                         .removeClass( "ui-state-active" )
  8157.                         .attr( "aria-pressed", "false" );
  8158.                 }
  8159.             });
  8160.         } else if ( this.type === "checkbox" ) {
  8161.             if ( this.element.is( ":checked" ) ) {
  8162.                 this.buttonElement
  8163.                     .addClass( "ui-state-active" )
  8164.                     .attr( "aria-pressed", "true" );
  8165.             } else {
  8166.                 this.buttonElement
  8167.                     .removeClass( "ui-state-active" )
  8168.                     .attr( "aria-pressed", "false" );
  8169.             }
  8170.         }
  8171.     },
  8172.  
  8173.     _resetButton: function() {
  8174.         if ( this.type === "input" ) {
  8175.             if ( this.options.label ) {
  8176.                 this.element.val( this.options.label );
  8177.             }
  8178.             return;
  8179.         }
  8180.         var buttonElement = this.buttonElement.removeClass( typeClasses ),
  8181.             buttonText = $( "<span></span>", this.document[0] )
  8182.                 .addClass( "ui-button-text" )
  8183.                 .html( this.options.label )
  8184.                 .appendTo( buttonElement.empty() )
  8185.                 .text(),
  8186.             icons = this.options.icons,
  8187.             multipleIcons = icons.primary && icons.secondary,
  8188.             buttonClasses = [];
  8189.  
  8190.         if ( icons.primary || icons.secondary ) {
  8191.             if ( this.options.text ) {
  8192.                 buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
  8193.             }
  8194.  
  8195.             if ( icons.primary ) {
  8196.                 buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
  8197.             }
  8198.  
  8199.             if ( icons.secondary ) {
  8200.                 buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
  8201.             }
  8202.  
  8203.             if ( !this.options.text ) {
  8204.                 buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
  8205.  
  8206.                 if ( !this.hasTitle ) {
  8207.                     buttonElement.attr( "title", $.trim( buttonText ) );
  8208.                 }
  8209.             }
  8210.         } else {
  8211.             buttonClasses.push( "ui-button-text-only" );
  8212.         }
  8213.         buttonElement.addClass( buttonClasses.join( " " ) );
  8214.     }
  8215. });
  8216.  
  8217. $.widget( "ui.buttonset", {
  8218.     version: "1.11.4",
  8219.     options: {
  8220.         items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
  8221.     },
  8222.  
  8223.     _create: function() {
  8224.         this.element.addClass( "ui-buttonset" );
  8225.     },
  8226.  
  8227.     _init: function() {
  8228.         this.refresh();
  8229.     },
  8230.  
  8231.     _setOption: function( key, value ) {
  8232.         if ( key === "disabled" ) {
  8233.             this.buttons.button( "option", key, value );
  8234.         }
  8235.  
  8236.         this._super( key, value );
  8237.     },
  8238.  
  8239.     refresh: function() {
  8240.         var rtl = this.element.css( "direction" ) === "rtl",
  8241.             allButtons = this.element.find( this.options.items ),
  8242.             existingButtons = allButtons.filter( ":ui-button" );
  8243.  
  8244.         // Initialize new buttons
  8245.         allButtons.not( ":ui-button" ).button();
  8246.  
  8247.         // Refresh existing buttons
  8248.         existingButtons.button( "refresh" );
  8249.  
  8250.         this.buttons = allButtons
  8251.             .map(function() {
  8252.                 return $( this ).button( "widget" )[ 0 ];
  8253.             })
  8254.                 .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  8255.                 .filter( ":first" )
  8256.                     .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
  8257.                 .end()
  8258.                 .filter( ":last" )
  8259.                     .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
  8260.                 .end()
  8261.             .end();
  8262.     },
  8263.  
  8264.     _destroy: function() {
  8265.         this.element.removeClass( "ui-buttonset" );
  8266.         this.buttons
  8267.             .map(function() {
  8268.                 return $( this ).button( "widget" )[ 0 ];
  8269.             })
  8270.                 .removeClass( "ui-corner-left ui-corner-right" )
  8271.             .end()
  8272.             .button( "destroy" );
  8273.     }
  8274. });
  8275.  
  8276. var button = $.ui.button;
  8277.  
  8278.  
  8279. /*!
  8280.  * jQuery UI Datepicker 1.11.4
  8281.  * http://jqueryui.com
  8282.  *
  8283.  * Copyright jQuery Foundation and other contributors
  8284.  * Released under the MIT license.
  8285.  * http://jquery.org/license
  8286.  *
  8287.  * http://api.jqueryui.com/datepicker/
  8288.  */
  8289.  
  8290.  
  8291. $.extend($.ui, { datepicker: { version: "1.11.4" } });
  8292.  
  8293. var datepicker_instActive;
  8294.  
  8295. function datepicker_getZindex( elem ) {
  8296.     var position, value;
  8297.     while ( elem.length && elem[ 0 ] !== document ) {
  8298.         // Ignore z-index if position is set to a value where z-index is ignored by the browser
  8299.         // This makes behavior of this function consistent across browsers
  8300.         // WebKit always returns auto if the element is positioned
  8301.         position = elem.css( "position" );
  8302.         if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  8303.             // IE returns 0 when zIndex is not specified
  8304.             // other browsers return a string
  8305.             // we ignore the case of nested elements with an explicit value of 0
  8306.             // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  8307.             value = parseInt( elem.css( "zIndex" ), 10 );
  8308.             if ( !isNaN( value ) && value !== 0 ) {
  8309.                 return value;
  8310.             }
  8311.         }
  8312.         elem = elem.parent();
  8313.     }
  8314.  
  8315.     return 0;
  8316. }
  8317. /* Date picker manager.
  8318.    Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  8319.    Settings for (groups of) date pickers are maintained in an instance object,
  8320.    allowing multiple different settings on the same page. */
  8321.  
  8322. function Datepicker() {
  8323.     this._curInst = null; // The current instance in use
  8324.     this._keyEvent = false; // If the last event was a key event
  8325.     this._disabledInputs = []; // List of date picker inputs that have been disabled
  8326.     this._datepickerShowing = false; // True if the popup picker is showing , false if not
  8327.     this._inDialog = false; // True if showing within a "dialog", false if not
  8328.     this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  8329.     this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  8330.     this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  8331.     this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  8332.     this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  8333.     this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  8334.     this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  8335.     this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  8336.     this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  8337.     this.regional = []; // Available regional settings, indexed by language code
  8338.     this.regional[""] = { // Default regional settings
  8339.         closeText: "Done", // Display text for close link
  8340.         prevText: "Prev", // Display text for previous month link
  8341.         nextText: "Next", // Display text for next month link
  8342.         currentText: "Today", // Display text for current month link
  8343.         monthNames: ["January","February","March","April","May","June",
  8344.             "July","August","September","October","November","December"], // Names of months for drop-down and formatting
  8345.         monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
  8346.         dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
  8347.         dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
  8348.         dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
  8349.         weekHeader: "Wk", // Column header for week of the year
  8350.         dateFormat: "mm/dd/yy", // See format options on parseDate
  8351.         firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  8352.         isRTL: false, // True if right-to-left language, false if left-to-right
  8353.         showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  8354.         yearSuffix: "" // Additional text to append to the year in the month headers
  8355.     };
  8356.     this._defaults = { // Global defaults for all the date picker instances
  8357.         showOn: "focus", // "focus" for popup on focus,
  8358.             // "button" for trigger button, or "both" for either
  8359.         showAnim: "fadeIn", // Name of jQuery animation for popup
  8360.         showOptions: {}, // Options for enhanced animations
  8361.         defaultDate: null, // Used when field is blank: actual date,
  8362.             // +/-number for offset from today, null for today
  8363.         appendText: "", // Display text following the input box, e.g. showing the format
  8364.         buttonText: "...", // Text for trigger button
  8365.         buttonImage: "", // URL for trigger button image
  8366.         buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  8367.         hideIfNoPrevNext: false, // True to hide next/previous month links
  8368.             // if not applicable, false to just disable them
  8369.         navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  8370.         gotoCurrent: false, // True if today link goes back to current selection instead
  8371.         changeMonth: false, // True if month can be selected directly, false if only prev/next
  8372.         changeYear: false, // True if year can be selected directly, false if only prev/next
  8373.         yearRange: "c-10:c+10", // Range of years to display in drop-down,
  8374.             // either relative to today's year (-nn:+nn), relative to currently displayed year
  8375.             // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  8376.         showOtherMonths: false, // True to show dates in other months, false to leave blank
  8377.         selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  8378.         showWeek: false, // True to show week of the year, false to not show it
  8379.         calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  8380.             // takes a Date and returns the number of the week for it
  8381.         shortYearCutoff: "+10", // Short year values < this are in the current century,
  8382.             // > this are in the previous century,
  8383.             // string value starting with "+" for current year + value
  8384.         minDate: null, // The earliest selectable date, or null for no limit
  8385.         maxDate: null, // The latest selectable date, or null for no limit
  8386.         duration: "fast", // Duration of display/closure
  8387.         beforeShowDay: null, // Function that takes a date and returns an array with
  8388.             // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  8389.             // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  8390.         beforeShow: null, // Function that takes an input field and
  8391.             // returns a set of custom settings for the date picker
  8392.         onSelect: null, // Define a callback function when a date is selected
  8393.         onChangeMonthYear: null, // Define a callback function when the month or year is changed
  8394.         onClose: null, // Define a callback function when the datepicker is closed
  8395.         numberOfMonths: 1, // Number of months to show at a time
  8396.         showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  8397.         stepMonths: 1, // Number of months to step back/forward
  8398.         stepBigMonths: 12, // Number of months to step back/forward for the big links
  8399.         altField: "", // Selector for an alternate field to store selected dates into
  8400.         altFormat: "", // The date format to use for the alternate field
  8401.         constrainInput: true, // The input is constrained by the current date format
  8402.         showButtonPanel: false, // True to show button panel, false to not show it
  8403.         autoSize: false, // True to size the input for the date format, false to leave as is
  8404.         disabled: false // The initial disabled state
  8405.     };
  8406.     $.extend(this._defaults, this.regional[""]);
  8407.     this.regional.en = $.extend( true, {}, this.regional[ "" ]);
  8408.     this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
  8409.     this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  8410. }
  8411.  
  8412. $.extend(Datepicker.prototype, {
  8413.     /* Class name added to elements to indicate already configured with a date picker. */
  8414.     markerClassName: "hasDatepicker",
  8415.  
  8416.     //Keep track of the maximum number of rows displayed (see #7043)
  8417.     maxRows: 4,
  8418.  
  8419.     // TODO rename to "widget" when switching to widget factory
  8420.     _widgetDatepicker: function() {
  8421.         return this.dpDiv;
  8422.     },
  8423.  
  8424.     /* Override the default settings for all instances of the date picker.
  8425.      * @param  settings  object - the new settings to use as defaults (anonymous object)
  8426.      * @return the manager object
  8427.      */
  8428.     setDefaults: function(settings) {
  8429.         datepicker_extendRemove(this._defaults, settings || {});
  8430.         return this;
  8431.     },
  8432.  
  8433.     /* Attach the date picker to a jQuery selection.
  8434.      * @param  target   element - the target input field or division or span
  8435.      * @param  settings  object - the new settings to use for this date picker instance (anonymous)
  8436.      */
  8437.     _attachDatepicker: function(target, settings) {
  8438.         var nodeName, inline, inst;
  8439.         nodeName = target.nodeName.toLowerCase();
  8440.         inline = (nodeName === "div" || nodeName === "span");
  8441.         if (!target.id) {
  8442.             this.uuid += 1;
  8443.             target.id = "dp" + this.uuid;
  8444.         }
  8445.         inst = this._newInst($(target), inline);
  8446.         inst.settings = $.extend({}, settings || {});
  8447.         if (nodeName === "input") {
  8448.             this._connectDatepicker(target, inst);
  8449.         } else if (inline) {
  8450.             this._inlineDatepicker(target, inst);
  8451.         }
  8452.     },
  8453.  
  8454.     /* Create a new instance object. */
  8455.     _newInst: function(target, inline) {
  8456.         var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
  8457.         return {id: id, input: target, // associated target
  8458.             selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  8459.             drawMonth: 0, drawYear: 0, // month being drawn
  8460.             inline: inline, // is datepicker inline or not
  8461.             dpDiv: (!inline ? this.dpDiv : // presentation div
  8462.             datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
  8463.     },
  8464.  
  8465.     /* Attach the date picker to an input field. */
  8466.     _connectDatepicker: function(target, inst) {
  8467.         var input = $(target);
  8468.         inst.append = $([]);
  8469.         inst.trigger = $([]);
  8470.         if (input.hasClass(this.markerClassName)) {
  8471.             return;
  8472.         }
  8473.         this._attachments(input, inst);
  8474.         input.addClass(this.markerClassName).keydown(this._doKeyDown).
  8475.             keypress(this._doKeyPress).keyup(this._doKeyUp);
  8476.         this._autoSize(inst);
  8477.         $.data(target, "datepicker", inst);
  8478.         //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  8479.         if( inst.settings.disabled ) {
  8480.             this._disableDatepicker( target );
  8481.         }
  8482.     },
  8483.  
  8484.     /* Make attachments based on settings. */
  8485.     _attachments: function(input, inst) {
  8486.         var showOn, buttonText, buttonImage,
  8487.             appendText = this._get(inst, "appendText"),
  8488.             isRTL = this._get(inst, "isRTL");
  8489.  
  8490.         if (inst.append) {
  8491.             inst.append.remove();
  8492.         }
  8493.         if (appendText) {
  8494.             inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
  8495.             input[isRTL ? "before" : "after"](inst.append);
  8496.         }
  8497.  
  8498.         input.unbind("focus", this._showDatepicker);
  8499.  
  8500.         if (inst.trigger) {
  8501.             inst.trigger.remove();
  8502.         }
  8503.  
  8504.         showOn = this._get(inst, "showOn");
  8505.         if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
  8506.             input.focus(this._showDatepicker);
  8507.         }
  8508.         if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
  8509.             buttonText = this._get(inst, "buttonText");
  8510.             buttonImage = this._get(inst, "buttonImage");
  8511.             inst.trigger = $(this._get(inst, "buttonImageOnly") ?
  8512.                 $("<img/>").addClass(this._triggerClass).
  8513.                     attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  8514.                 $("<button type='button'></button>").addClass(this._triggerClass).
  8515.                     html(!buttonImage ? buttonText : $("<img/>").attr(
  8516.                     { src:buttonImage, alt:buttonText, title:buttonText })));
  8517.             input[isRTL ? "before" : "after"](inst.trigger);
  8518.             inst.trigger.click(function() {
  8519.                 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
  8520.                     $.datepicker._hideDatepicker();
  8521.                 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
  8522.                     $.datepicker._hideDatepicker();
  8523.                     $.datepicker._showDatepicker(input[0]);
  8524.                 } else {
  8525.                     $.datepicker._showDatepicker(input[0]);
  8526.                 }
  8527.                 return false;
  8528.             });
  8529.         }
  8530.     },
  8531.  
  8532.     /* Apply the maximum length for the date format. */
  8533.     _autoSize: function(inst) {
  8534.         if (this._get(inst, "autoSize") && !inst.inline) {
  8535.             var findMax, max, maxI, i,
  8536.                 date = new Date(2009, 12 - 1, 20), // Ensure double digits
  8537.                 dateFormat = this._get(inst, "dateFormat");
  8538.  
  8539.             if (dateFormat.match(/[DM]/)) {
  8540.                 findMax = function(names) {
  8541.                     max = 0;
  8542.                     maxI = 0;
  8543.                     for (i = 0; i < names.length; i++) {
  8544.                         if (names[i].length > max) {
  8545.                             max = names[i].length;
  8546.                             maxI = i;
  8547.                         }
  8548.                     }
  8549.                     return maxI;
  8550.                 };
  8551.                 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  8552.                     "monthNames" : "monthNamesShort"))));
  8553.                 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  8554.                     "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
  8555.             }
  8556.             inst.input.attr("size", this._formatDate(inst, date).length);
  8557.         }
  8558.     },
  8559.  
  8560.     /* Attach an inline date picker to a div. */
  8561.     _inlineDatepicker: function(target, inst) {
  8562.         var divSpan = $(target);
  8563.         if (divSpan.hasClass(this.markerClassName)) {
  8564.             return;
  8565.         }
  8566.         divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  8567.         $.data(target, "datepicker", inst);
  8568.         this._setDate(inst, this._getDefaultDate(inst), true);
  8569.         this._updateDatepicker(inst);
  8570.         this._updateAlternate(inst);
  8571.         //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  8572.         if( inst.settings.disabled ) {
  8573.             this._disableDatepicker( target );
  8574.         }
  8575.         // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  8576.         // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  8577.         inst.dpDiv.css( "display", "block" );
  8578.     },
  8579.  
  8580.     /* Pop-up the date picker in a "dialog" box.
  8581.      * @param  input element - ignored
  8582.      * @param  date string or Date - the initial date to display
  8583.      * @param  onSelect  function - the function to call when a date is selected
  8584.      * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
  8585.      * @param  pos int[2] - coordinates for the dialog's position within the screen or
  8586.      *                  event - with x/y coordinates or
  8587.      *                  leave empty for default (screen centre)
  8588.      * @return the manager object
  8589.      */
  8590.     _dialogDatepicker: function(input, date, onSelect, settings, pos) {
  8591.         var id, browserWidth, browserHeight, scrollX, scrollY,
  8592.             inst = this._dialogInst; // internal instance
  8593.  
  8594.         if (!inst) {
  8595.             this.uuid += 1;
  8596.             id = "dp" + this.uuid;
  8597.             this._dialogInput = $("<input type='text' id='" + id +
  8598.                 "' style='position: absolute; top: -100px; width: 0px;'/>");
  8599.             this._dialogInput.keydown(this._doKeyDown);
  8600.             $("body").append(this._dialogInput);
  8601.             inst = this._dialogInst = this._newInst(this._dialogInput, false);
  8602.             inst.settings = {};
  8603.             $.data(this._dialogInput[0], "datepicker", inst);
  8604.         }
  8605.         datepicker_extendRemove(inst.settings, settings || {});
  8606.         date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  8607.         this._dialogInput.val(date);
  8608.  
  8609.         this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  8610.         if (!this._pos) {
  8611.             browserWidth = document.documentElement.clientWidth;
  8612.             browserHeight = document.documentElement.clientHeight;
  8613.             scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  8614.             scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  8615.             this._pos = // should use actual width/height below
  8616.                 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  8617.         }
  8618.  
  8619.         // move input on screen for focus, but hidden behind dialog
  8620.         this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
  8621.         inst.settings.onSelect = onSelect;
  8622.         this._inDialog = true;
  8623.         this.dpDiv.addClass(this._dialogClass);
  8624.         this._showDatepicker(this._dialogInput[0]);
  8625.         if ($.blockUI) {
  8626.             $.blockUI(this.dpDiv);
  8627.         }
  8628.         $.data(this._dialogInput[0], "datepicker", inst);
  8629.         return this;
  8630.     },
  8631.  
  8632.     /* Detach a datepicker from its control.
  8633.      * @param  target   element - the target input field or division or span
  8634.      */
  8635.     _destroyDatepicker: function(target) {
  8636.         var nodeName,
  8637.             $target = $(target),
  8638.             inst = $.data(target, "datepicker");
  8639.  
  8640.         if (!$target.hasClass(this.markerClassName)) {
  8641.             return;
  8642.         }
  8643.  
  8644.         nodeName = target.nodeName.toLowerCase();
  8645.         $.removeData(target, "datepicker");
  8646.         if (nodeName === "input") {
  8647.             inst.append.remove();
  8648.             inst.trigger.remove();
  8649.             $target.removeClass(this.markerClassName).
  8650.                 unbind("focus", this._showDatepicker).
  8651.                 unbind("keydown", this._doKeyDown).
  8652.                 unbind("keypress", this._doKeyPress).
  8653.                 unbind("keyup", this._doKeyUp);
  8654.         } else if (nodeName === "div" || nodeName === "span") {
  8655.             $target.removeClass(this.markerClassName).empty();
  8656.         }
  8657.  
  8658.         if ( datepicker_instActive === inst ) {
  8659.             datepicker_instActive = null;
  8660.         }
  8661.     },
  8662.  
  8663.     /* Enable the date picker to a jQuery selection.
  8664.      * @param  target   element - the target input field or division or span
  8665.      */
  8666.     _enableDatepicker: function(target) {
  8667.         var nodeName, inline,
  8668.             $target = $(target),
  8669.             inst = $.data(target, "datepicker");
  8670.  
  8671.         if (!$target.hasClass(this.markerClassName)) {
  8672.             return;
  8673.         }
  8674.  
  8675.         nodeName = target.nodeName.toLowerCase();
  8676.         if (nodeName === "input") {
  8677.             target.disabled = false;
  8678.             inst.trigger.filter("button").
  8679.                 each(function() { this.disabled = false; }).end().
  8680.                 filter("img").css({opacity: "1.0", cursor: ""});
  8681.         } else if (nodeName === "div" || nodeName === "span") {
  8682.             inline = $target.children("." + this._inlineClass);
  8683.             inline.children().removeClass("ui-state-disabled");
  8684.             inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
  8685.                 prop("disabled", false);
  8686.         }
  8687.         this._disabledInputs = $.map(this._disabledInputs,
  8688.             function(value) { return (value === target ? null : value); }); // delete entry
  8689.     },
  8690.  
  8691.     /* Disable the date picker to a jQuery selection.
  8692.      * @param  target   element - the target input field or division or span
  8693.      */
  8694.     _disableDatepicker: function(target) {
  8695.         var nodeName, inline,
  8696.             $target = $(target),
  8697.             inst = $.data(target, "datepicker");
  8698.  
  8699.         if (!$target.hasClass(this.markerClassName)) {
  8700.             return;
  8701.         }
  8702.  
  8703.         nodeName = target.nodeName.toLowerCase();
  8704.         if (nodeName === "input") {
  8705.             target.disabled = true;
  8706.             inst.trigger.filter("button").
  8707.                 each(function() { this.disabled = true; }).end().
  8708.                 filter("img").css({opacity: "0.5", cursor: "default"});
  8709.         } else if (nodeName === "div" || nodeName === "span") {
  8710.             inline = $target.children("." + this._inlineClass);
  8711.             inline.children().addClass("ui-state-disabled");
  8712.             inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
  8713.                 prop("disabled", true);
  8714.         }
  8715.         this._disabledInputs = $.map(this._disabledInputs,
  8716.             function(value) { return (value === target ? null : value); }); // delete entry
  8717.         this._disabledInputs[this._disabledInputs.length] = target;
  8718.     },
  8719.  
  8720.     /* Is the first field in a jQuery collection disabled as a datepicker?
  8721.      * @param  target   element - the target input field or division or span
  8722.      * @return boolean - true if disabled, false if enabled
  8723.      */
  8724.     _isDisabledDatepicker: function(target) {
  8725.         if (!target) {
  8726.             return false;
  8727.         }
  8728.         for (var i = 0; i < this._disabledInputs.length; i++) {
  8729.             if (this._disabledInputs[i] === target) {
  8730.                 return true;
  8731.             }
  8732.         }
  8733.         return false;
  8734.     },
  8735.  
  8736.     /* Retrieve the instance data for the target control.
  8737.      * @param  target  element - the target input field or division or span
  8738.      * @return  object - the associated instance data
  8739.      * @throws  error if a jQuery problem getting data
  8740.      */
  8741.     _getInst: function(target) {
  8742.         try {
  8743.             return $.data(target, "datepicker");
  8744.         }
  8745.         catch (err) {
  8746.             throw "Missing instance data for this datepicker";
  8747.         }
  8748.     },
  8749.  
  8750.     /* Update or retrieve the settings for a date picker attached to an input field or division.
  8751.      * @param  target  element - the target input field or division or span
  8752.      * @param  name object - the new settings to update or
  8753.      *              string - the name of the setting to change or retrieve,
  8754.      *              when retrieving also "all" for all instance settings or
  8755.      *              "defaults" for all global defaults
  8756.      * @param  value   any - the new value for the setting
  8757.      *              (omit if above is an object or to retrieve a value)
  8758.      */
  8759.     _optionDatepicker: function(target, name, value) {
  8760.         var settings, date, minDate, maxDate,
  8761.             inst = this._getInst(target);
  8762.  
  8763.         if (arguments.length === 2 && typeof name === "string") {
  8764.             return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
  8765.                 (inst ? (name === "all" ? $.extend({}, inst.settings) :
  8766.                 this._get(inst, name)) : null));
  8767.         }
  8768.  
  8769.         settings = name || {};
  8770.         if (typeof name === "string") {
  8771.             settings = {};
  8772.             settings[name] = value;
  8773.         }
  8774.  
  8775.         if (inst) {
  8776.             if (this._curInst === inst) {
  8777.                 this._hideDatepicker();
  8778.             }
  8779.  
  8780.             date = this._getDateDatepicker(target, true);
  8781.             minDate = this._getMinMaxDate(inst, "min");
  8782.             maxDate = this._getMinMaxDate(inst, "max");
  8783.             datepicker_extendRemove(inst.settings, settings);
  8784.             // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  8785.             if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  8786.                 inst.settings.minDate = this._formatDate(inst, minDate);
  8787.             }
  8788.             if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  8789.                 inst.settings.maxDate = this._formatDate(inst, maxDate);
  8790.             }
  8791.             if ( "disabled" in settings ) {
  8792.                 if ( settings.disabled ) {
  8793.                     this._disableDatepicker(target);
  8794.                 } else {
  8795.                     this._enableDatepicker(target);
  8796.                 }
  8797.             }
  8798.             this._attachments($(target), inst);
  8799.             this._autoSize(inst);
  8800.             this._setDate(inst, date);
  8801.             this._updateAlternate(inst);
  8802.             this._updateDatepicker(inst);
  8803.         }
  8804.     },
  8805.  
  8806.     // change method deprecated
  8807.     _changeDatepicker: function(target, name, value) {
  8808.         this._optionDatepicker(target, name, value);
  8809.     },
  8810.  
  8811.     /* Redraw the date picker attached to an input field or division.
  8812.      * @param  target  element - the target input field or division or span
  8813.      */
  8814.     _refreshDatepicker: function(target) {
  8815.         var inst = this._getInst(target);
  8816.         if (inst) {
  8817.             this._updateDatepicker(inst);
  8818.         }
  8819.     },
  8820.  
  8821.     /* Set the dates for a jQuery selection.
  8822.      * @param  target element - the target input field or division or span
  8823.      * @param  date Date - the new date
  8824.      */
  8825.     _setDateDatepicker: function(target, date) {
  8826.         var inst = this._getInst(target);
  8827.         if (inst) {
  8828.             this._setDate(inst, date);
  8829.             this._updateDatepicker(inst);
  8830.             this._updateAlternate(inst);
  8831.         }
  8832.     },
  8833.  
  8834.     /* Get the date(s) for the first entry in a jQuery selection.
  8835.      * @param  target element - the target input field or division or span
  8836.      * @param  noDefault boolean - true if no default date is to be used
  8837.      * @return Date - the current date
  8838.      */
  8839.     _getDateDatepicker: function(target, noDefault) {
  8840.         var inst = this._getInst(target);
  8841.         if (inst && !inst.inline) {
  8842.             this._setDateFromField(inst, noDefault);
  8843.         }
  8844.         return (inst ? this._getDate(inst) : null);
  8845.     },
  8846.  
  8847.     /* Handle keystrokes. */
  8848.     _doKeyDown: function(event) {
  8849.         var onSelect, dateStr, sel,
  8850.             inst = $.datepicker._getInst(event.target),
  8851.             handled = true,
  8852.             isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
  8853.  
  8854.         inst._keyEvent = true;
  8855.         if ($.datepicker._datepickerShowing) {
  8856.             switch (event.keyCode) {
  8857.                 case 9: $.datepicker._hideDatepicker();
  8858.                         handled = false;
  8859.                         break; // hide on tab out
  8860.                 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
  8861.                                     $.datepicker._currentClass + ")", inst.dpDiv);
  8862.                         if (sel[0]) {
  8863.                             $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  8864.                         }
  8865.  
  8866.                         onSelect = $.datepicker._get(inst, "onSelect");
  8867.                         if (onSelect) {
  8868.                             dateStr = $.datepicker._formatDate(inst);
  8869.  
  8870.                             // trigger custom callback
  8871.                             onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
  8872.                         } else {
  8873.                             $.datepicker._hideDatepicker();
  8874.                         }
  8875.  
  8876.                         return false; // don't submit the form
  8877.                 case 27: $.datepicker._hideDatepicker();
  8878.                         break; // hide on escape
  8879.                 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8880.                             -$.datepicker._get(inst, "stepBigMonths") :
  8881.                             -$.datepicker._get(inst, "stepMonths")), "M");
  8882.                         break; // previous month/year on page up/+ ctrl
  8883.                 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8884.                             +$.datepicker._get(inst, "stepBigMonths") :
  8885.                             +$.datepicker._get(inst, "stepMonths")), "M");
  8886.                         break; // next month/year on page down/+ ctrl
  8887.                 case 35: if (event.ctrlKey || event.metaKey) {
  8888.                             $.datepicker._clearDate(event.target);
  8889.                         }
  8890.                         handled = event.ctrlKey || event.metaKey;
  8891.                         break; // clear on ctrl or command +end
  8892.                 case 36: if (event.ctrlKey || event.metaKey) {
  8893.                             $.datepicker._gotoToday(event.target);
  8894.                         }
  8895.                         handled = event.ctrlKey || event.metaKey;
  8896.                         break; // current on ctrl or command +home
  8897.                 case 37: if (event.ctrlKey || event.metaKey) {
  8898.                             $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
  8899.                         }
  8900.                         handled = event.ctrlKey || event.metaKey;
  8901.                         // -1 day on ctrl or command +left
  8902.                         if (event.originalEvent.altKey) {
  8903.                             $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8904.                                 -$.datepicker._get(inst, "stepBigMonths") :
  8905.                                 -$.datepicker._get(inst, "stepMonths")), "M");
  8906.                         }
  8907.                         // next month/year on alt +left on Mac
  8908.                         break;
  8909.                 case 38: if (event.ctrlKey || event.metaKey) {
  8910.                             $.datepicker._adjustDate(event.target, -7, "D");
  8911.                         }
  8912.                         handled = event.ctrlKey || event.metaKey;
  8913.                         break; // -1 week on ctrl or command +up
  8914.                 case 39: if (event.ctrlKey || event.metaKey) {
  8915.                             $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
  8916.                         }
  8917.                         handled = event.ctrlKey || event.metaKey;
  8918.                         // +1 day on ctrl or command +right
  8919.                         if (event.originalEvent.altKey) {
  8920.                             $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8921.                                 +$.datepicker._get(inst, "stepBigMonths") :
  8922.                                 +$.datepicker._get(inst, "stepMonths")), "M");
  8923.                         }
  8924.                         // next month/year on alt +right
  8925.                         break;
  8926.                 case 40: if (event.ctrlKey || event.metaKey) {
  8927.                             $.datepicker._adjustDate(event.target, +7, "D");
  8928.                         }
  8929.                         handled = event.ctrlKey || event.metaKey;
  8930.                         break; // +1 week on ctrl or command +down
  8931.                 default: handled = false;
  8932.             }
  8933.         } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
  8934.             $.datepicker._showDatepicker(this);
  8935.         } else {
  8936.             handled = false;
  8937.         }
  8938.  
  8939.         if (handled) {
  8940.             event.preventDefault();
  8941.             event.stopPropagation();
  8942.         }
  8943.     },
  8944.  
  8945.     /* Filter entered characters - based on date format. */
  8946.     _doKeyPress: function(event) {
  8947.         var chars, chr,
  8948.             inst = $.datepicker._getInst(event.target);
  8949.  
  8950.         if ($.datepicker._get(inst, "constrainInput")) {
  8951.             chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
  8952.             chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
  8953.             return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
  8954.         }
  8955.     },
  8956.  
  8957.     /* Synchronise manual entry and field/alternate field. */
  8958.     _doKeyUp: function(event) {
  8959.         var date,
  8960.             inst = $.datepicker._getInst(event.target);
  8961.  
  8962.         if (inst.input.val() !== inst.lastVal) {
  8963.             try {
  8964.                 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  8965.                     (inst.input ? inst.input.val() : null),
  8966.                     $.datepicker._getFormatConfig(inst));
  8967.  
  8968.                 if (date) { // only if valid
  8969.                     $.datepicker._setDateFromField(inst);
  8970.                     $.datepicker._updateAlternate(inst);
  8971.                     $.datepicker._updateDatepicker(inst);
  8972.                 }
  8973.             }
  8974.             catch (err) {
  8975.             }
  8976.         }
  8977.         return true;
  8978.     },
  8979.  
  8980.     /* Pop-up the date picker for a given input field.
  8981.      * If false returned from beforeShow event handler do not show.
  8982.      * @param  input  element - the input field attached to the date picker or
  8983.      *                  event - if triggered by focus
  8984.      */
  8985.     _showDatepicker: function(input) {
  8986.         input = input.target || input;
  8987.         if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
  8988.             input = $("input", input.parentNode)[0];
  8989.         }
  8990.  
  8991.         if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
  8992.             return;
  8993.         }
  8994.  
  8995.         var inst, beforeShow, beforeShowSettings, isFixed,
  8996.             offset, showAnim, duration;
  8997.  
  8998.         inst = $.datepicker._getInst(input);
  8999.         if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
  9000.             $.datepicker._curInst.dpDiv.stop(true, true);
  9001.             if ( inst && $.datepicker._datepickerShowing ) {
  9002.                 $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
  9003.             }
  9004.         }
  9005.  
  9006.         beforeShow = $.datepicker._get(inst, "beforeShow");
  9007.         beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  9008.         if(beforeShowSettings === false){
  9009.             return;
  9010.         }
  9011.         datepicker_extendRemove(inst.settings, beforeShowSettings);
  9012.  
  9013.         inst.lastVal = null;
  9014.         $.datepicker._lastInput = input;
  9015.         $.datepicker._setDateFromField(inst);
  9016.  
  9017.         if ($.datepicker._inDialog) { // hide cursor
  9018.             input.value = "";
  9019.         }
  9020.         if (!$.datepicker._pos) { // position below input
  9021.             $.datepicker._pos = $.datepicker._findPos(input);
  9022.             $.datepicker._pos[1] += input.offsetHeight; // add the height
  9023.         }
  9024.  
  9025.         isFixed = false;
  9026.         $(input).parents().each(function() {
  9027.             isFixed |= $(this).css("position") === "fixed";
  9028.             return !isFixed;
  9029.         });
  9030.  
  9031.         offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  9032.         $.datepicker._pos = null;
  9033.         //to avoid flashes on Firefox
  9034.         inst.dpDiv.empty();
  9035.         // determine sizing offscreen
  9036.         inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
  9037.         $.datepicker._updateDatepicker(inst);
  9038.         // fix width for dynamic number of date pickers
  9039.         // and adjust position before showing
  9040.         offset = $.datepicker._checkOffset(inst, offset, isFixed);
  9041.         inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  9042.             "static" : (isFixed ? "fixed" : "absolute")), display: "none",
  9043.             left: offset.left + "px", top: offset.top + "px"});
  9044.  
  9045.         if (!inst.inline) {
  9046.             showAnim = $.datepicker._get(inst, "showAnim");
  9047.             duration = $.datepicker._get(inst, "duration");
  9048.             inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  9049.             $.datepicker._datepickerShowing = true;
  9050.  
  9051.             if ( $.effects && $.effects.effect[ showAnim ] ) {
  9052.                 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  9053.             } else {
  9054.                 inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
  9055.             }
  9056.  
  9057.             if ( $.datepicker._shouldFocusInput( inst ) ) {
  9058.                 inst.input.focus();
  9059.             }
  9060.  
  9061.             $.datepicker._curInst = inst;
  9062.         }
  9063.     },
  9064.  
  9065.     /* Generate the date picker content. */
  9066.     _updateDatepicker: function(inst) {
  9067.         this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  9068.         datepicker_instActive = inst; // for delegate hover events
  9069.         inst.dpDiv.empty().append(this._generateHTML(inst));
  9070.         this._attachHandlers(inst);
  9071.  
  9072.         var origyearshtml,
  9073.             numMonths = this._getNumberOfMonths(inst),
  9074.             cols = numMonths[1],
  9075.             width = 17,
  9076.             activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
  9077.  
  9078.         if ( activeCell.length > 0 ) {
  9079.             datepicker_handleMouseover.apply( activeCell.get( 0 ) );
  9080.         }
  9081.  
  9082.         inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  9083.         if (cols > 1) {
  9084.             inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  9085.         }
  9086.         inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
  9087.             "Class"]("ui-datepicker-multi");
  9088.         inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
  9089.             "Class"]("ui-datepicker-rtl");
  9090.  
  9091.         if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
  9092.             inst.input.focus();
  9093.         }
  9094.  
  9095.         // deffered render of the years select (to avoid flashes on Firefox)
  9096.         if( inst.yearshtml ){
  9097.             origyearshtml = inst.yearshtml;
  9098.             setTimeout(function(){
  9099.                 //assure that inst.yearshtml didn't change.
  9100.                 if( origyearshtml === inst.yearshtml && inst.yearshtml ){
  9101.                     inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
  9102.                 }
  9103.                 origyearshtml = inst.yearshtml = null;
  9104.             }, 0);
  9105.         }
  9106.     },
  9107.  
  9108.     // #6694 - don't focus the input if it's already focused
  9109.     // this breaks the change event in IE
  9110.     // Support: IE and jQuery <1.9
  9111.     _shouldFocusInput: function( inst ) {
  9112.         return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
  9113.     },
  9114.  
  9115.     /* Check positioning to remain on screen. */
  9116.     _checkOffset: function(inst, offset, isFixed) {
  9117.         var dpWidth = inst.dpDiv.outerWidth(),
  9118.             dpHeight = inst.dpDiv.outerHeight(),
  9119.             inputWidth = inst.input ? inst.input.outerWidth() : 0,
  9120.             inputHeight = inst.input ? inst.input.outerHeight() : 0,
  9121.             viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
  9122.             viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
  9123.  
  9124.         offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
  9125.         offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
  9126.         offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  9127.  
  9128.         // now check if datepicker is showing outside window viewport - move to a better place if so.
  9129.         offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  9130.             Math.abs(offset.left + dpWidth - viewWidth) : 0);
  9131.         offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  9132.             Math.abs(dpHeight + inputHeight) : 0);
  9133.  
  9134.         return offset;
  9135.     },
  9136.  
  9137.     /* Find an object's position on the screen. */
  9138.     _findPos: function(obj) {
  9139.         var position,
  9140.             inst = this._getInst(obj),
  9141.             isRTL = this._get(inst, "isRTL");
  9142.  
  9143.         while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
  9144.             obj = obj[isRTL ? "previousSibling" : "nextSibling"];
  9145.         }
  9146.  
  9147.         position = $(obj).offset();
  9148.         return [position.left, position.top];
  9149.     },
  9150.  
  9151.     /* Hide the date picker from view.
  9152.      * @param  input  element - the input field attached to the date picker
  9153.      */
  9154.     _hideDatepicker: function(input) {
  9155.         var showAnim, duration, postProcess, onClose,
  9156.             inst = this._curInst;
  9157.  
  9158.         if (!inst || (input && inst !== $.data(input, "datepicker"))) {
  9159.             return;
  9160.         }
  9161.  
  9162.         if (this._datepickerShowing) {
  9163.             showAnim = this._get(inst, "showAnim");
  9164.             duration = this._get(inst, "duration");
  9165.             postProcess = function() {
  9166.                 $.datepicker._tidyDialog(inst);
  9167.             };
  9168.  
  9169.             // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  9170.             if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
  9171.                 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
  9172.             } else {
  9173.                 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
  9174.                     (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
  9175.             }
  9176.  
  9177.             if (!showAnim) {
  9178.                 postProcess();
  9179.             }
  9180.             this._datepickerShowing = false;
  9181.  
  9182.             onClose = this._get(inst, "onClose");
  9183.             if (onClose) {
  9184.                 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
  9185.             }
  9186.  
  9187.             this._lastInput = null;
  9188.             if (this._inDialog) {
  9189.                 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
  9190.                 if ($.blockUI) {
  9191.                     $.unblockUI();
  9192.                     $("body").append(this.dpDiv);
  9193.                 }
  9194.             }
  9195.             this._inDialog = false;
  9196.         }
  9197.     },
  9198.  
  9199.     /* Tidy up after a dialog display. */
  9200.     _tidyDialog: function(inst) {
  9201.         inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
  9202.     },
  9203.  
  9204.     /* Close date picker if clicked elsewhere. */
  9205.     _checkExternalClick: function(event) {
  9206.         if (!$.datepicker._curInst) {
  9207.             return;
  9208.         }
  9209.  
  9210.         var $target = $(event.target),
  9211.             inst = $.datepicker._getInst($target[0]);
  9212.  
  9213.         if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
  9214.                 $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
  9215.                 !$target.hasClass($.datepicker.markerClassName) &&
  9216.                 !$target.closest("." + $.datepicker._triggerClass).length &&
  9217.                 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
  9218.             ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
  9219.                 $.datepicker._hideDatepicker();
  9220.         }
  9221.     },
  9222.  
  9223.     /* Adjust one of the date sub-fields. */
  9224.     _adjustDate: function(id, offset, period) {
  9225.         var target = $(id),
  9226.             inst = this._getInst(target[0]);
  9227.  
  9228.         if (this._isDisabledDatepicker(target[0])) {
  9229.             return;
  9230.         }
  9231.         this._adjustInstDate(inst, offset +
  9232.             (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
  9233.             period);
  9234.         this._updateDatepicker(inst);
  9235.     },
  9236.  
  9237.     /* Action for current link. */
  9238.     _gotoToday: function(id) {
  9239.         var date,
  9240.             target = $(id),
  9241.             inst = this._getInst(target[0]);
  9242.  
  9243.         if (this._get(inst, "gotoCurrent") && inst.currentDay) {
  9244.             inst.selectedDay = inst.currentDay;
  9245.             inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  9246.             inst.drawYear = inst.selectedYear = inst.currentYear;
  9247.         } else {
  9248.             date = new Date();
  9249.             inst.selectedDay = date.getDate();
  9250.             inst.drawMonth = inst.selectedMonth = date.getMonth();
  9251.             inst.drawYear = inst.selectedYear = date.getFullYear();
  9252.         }
  9253.         this._notifyChange(inst);
  9254.         this._adjustDate(target);
  9255.     },
  9256.  
  9257.     /* Action for selecting a new month/year. */
  9258.     _selectMonthYear: function(id, select, period) {
  9259.         var target = $(id),
  9260.             inst = this._getInst(target[0]);
  9261.  
  9262.         inst["selected" + (period === "M" ? "Month" : "Year")] =
  9263.         inst["draw" + (period === "M" ? "Month" : "Year")] =
  9264.             parseInt(select.options[select.selectedIndex].value,10);
  9265.  
  9266.         this._notifyChange(inst);
  9267.         this._adjustDate(target);
  9268.     },
  9269.  
  9270.     /* Action for selecting a day. */
  9271.     _selectDay: function(id, month, year, td) {
  9272.         var inst,
  9273.             target = $(id);
  9274.  
  9275.         if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  9276.             return;
  9277.         }
  9278.  
  9279.         inst = this._getInst(target[0]);
  9280.         inst.selectedDay = inst.currentDay = $("a", td).html();
  9281.         inst.selectedMonth = inst.currentMonth = month;
  9282.         inst.selectedYear = inst.currentYear = year;
  9283.         this._selectDate(id, this._formatDate(inst,
  9284.             inst.currentDay, inst.currentMonth, inst.currentYear));
  9285.     },
  9286.  
  9287.     /* Erase the input field and hide the date picker. */
  9288.     _clearDate: function(id) {
  9289.         var target = $(id);
  9290.         this._selectDate(target, "");
  9291.     },
  9292.  
  9293.     /* Update the input field with the selected date. */
  9294.     _selectDate: function(id, dateStr) {
  9295.         var onSelect,
  9296.             target = $(id),
  9297.             inst = this._getInst(target[0]);
  9298.  
  9299.         dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  9300.         if (inst.input) {
  9301.             inst.input.val(dateStr);
  9302.         }
  9303.         this._updateAlternate(inst);
  9304.  
  9305.         onSelect = this._get(inst, "onSelect");
  9306.         if (onSelect) {
  9307.             onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
  9308.         } else if (inst.input) {
  9309.             inst.input.trigger("change"); // fire the change event
  9310.         }
  9311.  
  9312.         if (inst.inline){
  9313.             this._updateDatepicker(inst);
  9314.         } else {
  9315.             this._hideDatepicker();
  9316.             this._lastInput = inst.input[0];
  9317.             if (typeof(inst.input[0]) !== "object") {
  9318.                 inst.input.focus(); // restore focus
  9319.             }
  9320.             this._lastInput = null;
  9321.         }
  9322.     },
  9323.  
  9324.     /* Update any alternate field to synchronise with the main field. */
  9325.     _updateAlternate: function(inst) {
  9326.         var altFormat, date, dateStr,
  9327.             altField = this._get(inst, "altField");
  9328.  
  9329.         if (altField) { // update alternate field too
  9330.             altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
  9331.             date = this._getDate(inst);
  9332.             dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  9333.             $(altField).each(function() { $(this).val(dateStr); });
  9334.         }
  9335.     },
  9336.  
  9337.     /* Set as beforeShowDay function to prevent selection of weekends.
  9338.      * @param  date  Date - the date to customise
  9339.      * @return [boolean, string] - is this date selectable?, what is its CSS class?
  9340.      */
  9341.     noWeekends: function(date) {
  9342.         var day = date.getDay();
  9343.         return [(day > 0 && day < 6), ""];
  9344.     },
  9345.  
  9346.     /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  9347.      * @param  date  Date - the date to get the week for
  9348.      * @return  number - the number of the week within the year that contains this date
  9349.      */
  9350.     iso8601Week: function(date) {
  9351.         var time,
  9352.             checkDate = new Date(date.getTime());
  9353.  
  9354.         // Find Thursday of this week starting on Monday
  9355.         checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  9356.  
  9357.         time = checkDate.getTime();
  9358.         checkDate.setMonth(0); // Compare with Jan 1
  9359.         checkDate.setDate(1);
  9360.         return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  9361.     },
  9362.  
  9363.     /* Parse a string value into a date object.
  9364.      * See formatDate below for the possible formats.
  9365.      *
  9366.      * @param  format string - the expected format of the date
  9367.      * @param  value string - the date in the above format
  9368.      * @param  settings Object - attributes include:
  9369.      *                  shortYearCutoff  number - the cutoff year for determining the century (optional)
  9370.      *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
  9371.      *                  dayNames        string[7] - names of the days from Sunday (optional)
  9372.      *                  monthNamesShort string[12] - abbreviated names of the months (optional)
  9373.      *                  monthNames      string[12] - names of the months (optional)
  9374.      * @return  Date - the extracted date value or null if value is blank
  9375.      */
  9376.     parseDate: function (format, value, settings) {
  9377.         if (format == null || value == null) {
  9378.             throw "Invalid arguments";
  9379.         }
  9380.  
  9381.         value = (typeof value === "object" ? value.toString() : value + "");
  9382.         if (value === "") {
  9383.             return null;
  9384.         }
  9385.  
  9386.         var iFormat, dim, extra,
  9387.             iValue = 0,
  9388.             shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
  9389.             shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  9390.                 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
  9391.             dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  9392.             dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  9393.             monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  9394.             monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  9395.             year = -1,
  9396.             month = -1,
  9397.             day = -1,
  9398.             doy = -1,
  9399.             literal = false,
  9400.             date,
  9401.             // Check whether a format character is doubled
  9402.             lookAhead = function(match) {
  9403.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9404.                 if (matches) {
  9405.                     iFormat++;
  9406.                 }
  9407.                 return matches;
  9408.             },
  9409.             // Extract a number from the string value
  9410.             getNumber = function(match) {
  9411.                 var isDoubled = lookAhead(match),
  9412.                     size = (match === "@" ? 14 : (match === "!" ? 20 :
  9413.                     (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
  9414.                     minSize = (match === "y" ? size : 1),
  9415.                     digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
  9416.                     num = value.substring(iValue).match(digits);
  9417.                 if (!num) {
  9418.                     throw "Missing number at position " + iValue;
  9419.                 }
  9420.                 iValue += num[0].length;
  9421.                 return parseInt(num[0], 10);
  9422.             },
  9423.             // Extract a name from the string value and convert to an index
  9424.             getName = function(match, shortNames, longNames) {
  9425.                 var index = -1,
  9426.                     names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
  9427.                         return [ [k, v] ];
  9428.                     }).sort(function (a, b) {
  9429.                         return -(a[1].length - b[1].length);
  9430.                     });
  9431.  
  9432.                 $.each(names, function (i, pair) {
  9433.                     var name = pair[1];
  9434.                     if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
  9435.                         index = pair[0];
  9436.                         iValue += name.length;
  9437.                         return false;
  9438.                     }
  9439.                 });
  9440.                 if (index !== -1) {
  9441.                     return index + 1;
  9442.                 } else {
  9443.                     throw "Unknown name at position " + iValue;
  9444.                 }
  9445.             },
  9446.             // Confirm that a literal character matches the string value
  9447.             checkLiteral = function() {
  9448.                 if (value.charAt(iValue) !== format.charAt(iFormat)) {
  9449.                     throw "Unexpected literal at position " + iValue;
  9450.                 }
  9451.                 iValue++;
  9452.             };
  9453.  
  9454.         for (iFormat = 0; iFormat < format.length; iFormat++) {
  9455.             if (literal) {
  9456.                 if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9457.                     literal = false;
  9458.                 } else {
  9459.                     checkLiteral();
  9460.                 }
  9461.             } else {
  9462.                 switch (format.charAt(iFormat)) {
  9463.                     case "d":
  9464.                         day = getNumber("d");
  9465.                         break;
  9466.                     case "D":
  9467.                         getName("D", dayNamesShort, dayNames);
  9468.                         break;
  9469.                     case "o":
  9470.                         doy = getNumber("o");
  9471.                         break;
  9472.                     case "m":
  9473.                         month = getNumber("m");
  9474.                         break;
  9475.                     case "M":
  9476.                         month = getName("M", monthNamesShort, monthNames);
  9477.                         break;
  9478.                     case "y":
  9479.                         year = getNumber("y");
  9480.                         break;
  9481.                     case "@":
  9482.                         date = new Date(getNumber("@"));
  9483.                         year = date.getFullYear();
  9484.                         month = date.getMonth() + 1;
  9485.                         day = date.getDate();
  9486.                         break;
  9487.                     case "!":
  9488.                         date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
  9489.                         year = date.getFullYear();
  9490.                         month = date.getMonth() + 1;
  9491.                         day = date.getDate();
  9492.                         break;
  9493.                     case "'":
  9494.                         if (lookAhead("'")){
  9495.                             checkLiteral();
  9496.                         } else {
  9497.                             literal = true;
  9498.                         }
  9499.                         break;
  9500.                     default:
  9501.                         checkLiteral();
  9502.                 }
  9503.             }
  9504.         }
  9505.  
  9506.         if (iValue < value.length){
  9507.             extra = value.substr(iValue);
  9508.             if (!/^\s+/.test(extra)) {
  9509.                 throw "Extra/unparsed characters found in date: " + extra;
  9510.             }
  9511.         }
  9512.  
  9513.         if (year === -1) {
  9514.             year = new Date().getFullYear();
  9515.         } else if (year < 100) {
  9516.             year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  9517.                 (year <= shortYearCutoff ? 0 : -100);
  9518.         }
  9519.  
  9520.         if (doy > -1) {
  9521.             month = 1;
  9522.             day = doy;
  9523.             do {
  9524.                 dim = this._getDaysInMonth(year, month - 1);
  9525.                 if (day <= dim) {
  9526.                     break;
  9527.                 }
  9528.                 month++;
  9529.                 day -= dim;
  9530.             } while (true);
  9531.         }
  9532.  
  9533.         date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  9534.         if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
  9535.             throw "Invalid date"; // E.g. 31/02/00
  9536.         }
  9537.         return date;
  9538.     },
  9539.  
  9540.     /* Standard date formats. */
  9541.     ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  9542.     COOKIE: "D, dd M yy",
  9543.     ISO_8601: "yy-mm-dd",
  9544.     RFC_822: "D, d M y",
  9545.     RFC_850: "DD, dd-M-y",
  9546.     RFC_1036: "D, d M y",
  9547.     RFC_1123: "D, d M yy",
  9548.     RFC_2822: "D, d M yy",
  9549.     RSS: "D, d M y", // RFC 822
  9550.     TICKS: "!",
  9551.     TIMESTAMP: "@",
  9552.     W3C: "yy-mm-dd", // ISO 8601
  9553.  
  9554.     _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  9555.         Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  9556.  
  9557.     /* Format a date object into a string value.
  9558.      * The format can be combinations of the following:
  9559.      * d  - day of month (no leading zero)
  9560.      * dd - day of month (two digit)
  9561.      * o  - day of year (no leading zeros)
  9562.      * oo - day of year (three digit)
  9563.      * D  - day name short
  9564.      * DD - day name long
  9565.      * m  - month of year (no leading zero)
  9566.      * mm - month of year (two digit)
  9567.      * M  - month name short
  9568.      * MM - month name long
  9569.      * y  - year (two digit)
  9570.      * yy - year (four digit)
  9571.      * @ - Unix timestamp (ms since 01/01/1970)
  9572.      * ! - Windows ticks (100ns since 01/01/0001)
  9573.      * "..." - literal text
  9574.      * '' - single quote
  9575.      *
  9576.      * @param  format string - the desired format of the date
  9577.      * @param  date Date - the date value to format
  9578.      * @param  settings Object - attributes include:
  9579.      *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
  9580.      *                  dayNames        string[7] - names of the days from Sunday (optional)
  9581.      *                  monthNamesShort string[12] - abbreviated names of the months (optional)
  9582.      *                  monthNames      string[12] - names of the months (optional)
  9583.      * @return  string - the date in the above format
  9584.      */
  9585.     formatDate: function (format, date, settings) {
  9586.         if (!date) {
  9587.             return "";
  9588.         }
  9589.  
  9590.         var iFormat,
  9591.             dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  9592.             dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  9593.             monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  9594.             monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  9595.             // Check whether a format character is doubled
  9596.             lookAhead = function(match) {
  9597.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9598.                 if (matches) {
  9599.                     iFormat++;
  9600.                 }
  9601.                 return matches;
  9602.             },
  9603.             // Format a number, with leading zero if necessary
  9604.             formatNumber = function(match, value, len) {
  9605.                 var num = "" + value;
  9606.                 if (lookAhead(match)) {
  9607.                     while (num.length < len) {
  9608.                         num = "0" + num;
  9609.                     }
  9610.                 }
  9611.                 return num;
  9612.             },
  9613.             // Format a name, short or long as requested
  9614.             formatName = function(match, value, shortNames, longNames) {
  9615.                 return (lookAhead(match) ? longNames[value] : shortNames[value]);
  9616.             },
  9617.             output = "",
  9618.             literal = false;
  9619.  
  9620.         if (date) {
  9621.             for (iFormat = 0; iFormat < format.length; iFormat++) {
  9622.                 if (literal) {
  9623.                     if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9624.                         literal = false;
  9625.                     } else {
  9626.                         output += format.charAt(iFormat);
  9627.                     }
  9628.                 } else {
  9629.                     switch (format.charAt(iFormat)) {
  9630.                         case "d":
  9631.                             output += formatNumber("d", date.getDate(), 2);
  9632.                             break;
  9633.                         case "D":
  9634.                             output += formatName("D", date.getDay(), dayNamesShort, dayNames);
  9635.                             break;
  9636.                         case "o":
  9637.                             output += formatNumber("o",
  9638.                                 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
  9639.                             break;
  9640.                         case "m":
  9641.                             output += formatNumber("m", date.getMonth() + 1, 2);
  9642.                             break;
  9643.                         case "M":
  9644.                             output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
  9645.                             break;
  9646.                         case "y":
  9647.                             output += (lookAhead("y") ? date.getFullYear() :
  9648.                                 (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
  9649.                             break;
  9650.                         case "@":
  9651.                             output += date.getTime();
  9652.                             break;
  9653.                         case "!":
  9654.                             output += date.getTime() * 10000 + this._ticksTo1970;
  9655.                             break;
  9656.                         case "'":
  9657.                             if (lookAhead("'")) {
  9658.                                 output += "'";
  9659.                             } else {
  9660.                                 literal = true;
  9661.                             }
  9662.                             break;
  9663.                         default:
  9664.                             output += format.charAt(iFormat);
  9665.                     }
  9666.                 }
  9667.             }
  9668.         }
  9669.         return output;
  9670.     },
  9671.  
  9672.     /* Extract all possible characters from the date format. */
  9673.     _possibleChars: function (format) {
  9674.         var iFormat,
  9675.             chars = "",
  9676.             literal = false,
  9677.             // Check whether a format character is doubled
  9678.             lookAhead = function(match) {
  9679.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9680.                 if (matches) {
  9681.                     iFormat++;
  9682.                 }
  9683.                 return matches;
  9684.             };
  9685.  
  9686.         for (iFormat = 0; iFormat < format.length; iFormat++) {
  9687.             if (literal) {
  9688.                 if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9689.                     literal = false;
  9690.                 } else {
  9691.                     chars += format.charAt(iFormat);
  9692.                 }
  9693.             } else {
  9694.                 switch (format.charAt(iFormat)) {
  9695.                     case "d": case "m": case "y": case "@":
  9696.                         chars += "0123456789";
  9697.                         break;
  9698.                     case "D": case "M":
  9699.                         return null; // Accept anything
  9700.                     case "'":
  9701.                         if (lookAhead("'")) {
  9702.                             chars += "'";
  9703.                         } else {
  9704.                             literal = true;
  9705.                         }
  9706.                         break;
  9707.                     default:
  9708.                         chars += format.charAt(iFormat);
  9709.                 }
  9710.             }
  9711.         }
  9712.         return chars;
  9713.     },
  9714.  
  9715.     /* Get a setting value, defaulting if necessary. */
  9716.     _get: function(inst, name) {
  9717.         return inst.settings[name] !== undefined ?
  9718.             inst.settings[name] : this._defaults[name];
  9719.     },
  9720.  
  9721.     /* Parse existing date and initialise date picker. */
  9722.     _setDateFromField: function(inst, noDefault) {
  9723.         if (inst.input.val() === inst.lastVal) {
  9724.             return;
  9725.         }
  9726.  
  9727.         var dateFormat = this._get(inst, "dateFormat"),
  9728.             dates = inst.lastVal = inst.input ? inst.input.val() : null,
  9729.             defaultDate = this._getDefaultDate(inst),
  9730.             date = defaultDate,
  9731.             settings = this._getFormatConfig(inst);
  9732.  
  9733.         try {
  9734.             date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  9735.         } catch (event) {
  9736.             dates = (noDefault ? "" : dates);
  9737.         }
  9738.         inst.selectedDay = date.getDate();
  9739.         inst.drawMonth = inst.selectedMonth = date.getMonth();
  9740.         inst.drawYear = inst.selectedYear = date.getFullYear();
  9741.         inst.currentDay = (dates ? date.getDate() : 0);
  9742.         inst.currentMonth = (dates ? date.getMonth() : 0);
  9743.         inst.currentYear = (dates ? date.getFullYear() : 0);
  9744.         this._adjustInstDate(inst);
  9745.     },
  9746.  
  9747.     /* Retrieve the default date shown on opening. */
  9748.     _getDefaultDate: function(inst) {
  9749.         return this._restrictMinMax(inst,
  9750.             this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
  9751.     },
  9752.  
  9753.     /* A date may be specified as an exact value or a relative one. */
  9754.     _determineDate: function(inst, date, defaultDate) {
  9755.         var offsetNumeric = function(offset) {
  9756.                 var date = new Date();
  9757.                 date.setDate(date.getDate() + offset);
  9758.                 return date;
  9759.             },
  9760.             offsetString = function(offset) {
  9761.                 try {
  9762.                     return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  9763.                         offset, $.datepicker._getFormatConfig(inst));
  9764.                 }
  9765.                 catch (e) {
  9766.                     // Ignore
  9767.                 }
  9768.  
  9769.                 var date = (offset.toLowerCase().match(/^c/) ?
  9770.                     $.datepicker._getDate(inst) : null) || new Date(),
  9771.                     year = date.getFullYear(),
  9772.                     month = date.getMonth(),
  9773.                     day = date.getDate(),
  9774.                     pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  9775.                     matches = pattern.exec(offset);
  9776.  
  9777.                 while (matches) {
  9778.                     switch (matches[2] || "d") {
  9779.                         case "d" : case "D" :
  9780.                             day += parseInt(matches[1],10); break;
  9781.                         case "w" : case "W" :
  9782.                             day += parseInt(matches[1],10) * 7; break;
  9783.                         case "m" : case "M" :
  9784.                             month += parseInt(matches[1],10);
  9785.                             day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  9786.                             break;
  9787.                         case "y": case "Y" :
  9788.                             year += parseInt(matches[1],10);
  9789.                             day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  9790.                             break;
  9791.                     }
  9792.                     matches = pattern.exec(offset);
  9793.                 }
  9794.                 return new Date(year, month, day);
  9795.             },
  9796.             newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
  9797.                 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  9798.  
  9799.         newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
  9800.         if (newDate) {
  9801.             newDate.setHours(0);
  9802.             newDate.setMinutes(0);
  9803.             newDate.setSeconds(0);
  9804.             newDate.setMilliseconds(0);
  9805.         }
  9806.         return this._daylightSavingAdjust(newDate);
  9807.     },
  9808.  
  9809.     /* Handle switch to/from daylight saving.
  9810.      * Hours may be non-zero on daylight saving cut-over:
  9811.      * > 12 when midnight changeover, but then cannot generate
  9812.      * midnight datetime, so jump to 1AM, otherwise reset.
  9813.      * @param  date  (Date) the date to check
  9814.      * @return  (Date) the corrected date
  9815.      */
  9816.     _daylightSavingAdjust: function(date) {
  9817.         if (!date) {
  9818.             return null;
  9819.         }
  9820.         date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  9821.         return date;
  9822.     },
  9823.  
  9824.     /* Set the date(s) directly. */
  9825.     _setDate: function(inst, date, noChange) {
  9826.         var clear = !date,
  9827.             origMonth = inst.selectedMonth,
  9828.             origYear = inst.selectedYear,
  9829.             newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  9830.  
  9831.         inst.selectedDay = inst.currentDay = newDate.getDate();
  9832.         inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  9833.         inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  9834.         if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
  9835.             this._notifyChange(inst);
  9836.         }
  9837.         this._adjustInstDate(inst);
  9838.         if (inst.input) {
  9839.             inst.input.val(clear ? "" : this._formatDate(inst));
  9840.         }
  9841.     },
  9842.  
  9843.     /* Retrieve the date(s) directly. */
  9844.     _getDate: function(inst) {
  9845.         var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
  9846.             this._daylightSavingAdjust(new Date(
  9847.             inst.currentYear, inst.currentMonth, inst.currentDay)));
  9848.             return startDate;
  9849.     },
  9850.  
  9851.     /* Attach the onxxx handlers.  These are declared statically so
  9852.      * they work with static code transformers like Caja.
  9853.      */
  9854.     _attachHandlers: function(inst) {
  9855.         var stepMonths = this._get(inst, "stepMonths"),
  9856.             id = "#" + inst.id.replace( /\\\\/g, "\\" );
  9857.         inst.dpDiv.find("[data-handler]").map(function () {
  9858.             var handler = {
  9859.                 prev: function () {
  9860.                     $.datepicker._adjustDate(id, -stepMonths, "M");
  9861.                 },
  9862.                 next: function () {
  9863.                     $.datepicker._adjustDate(id, +stepMonths, "M");
  9864.                 },
  9865.                 hide: function () {
  9866.                     $.datepicker._hideDatepicker();
  9867.                 },
  9868.                 today: function () {
  9869.                     $.datepicker._gotoToday(id);
  9870.                 },
  9871.                 selectDay: function () {
  9872.                     $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
  9873.                     return false;
  9874.                 },
  9875.                 selectMonth: function () {
  9876.                     $.datepicker._selectMonthYear(id, this, "M");
  9877.                     return false;
  9878.                 },
  9879.                 selectYear: function () {
  9880.                     $.datepicker._selectMonthYear(id, this, "Y");
  9881.                     return false;
  9882.                 }
  9883.             };
  9884.             $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
  9885.         });
  9886.     },
  9887.  
  9888.     /* Generate the HTML for the current state of the date picker. */
  9889.     _generateHTML: function(inst) {
  9890.         var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  9891.             controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  9892.             monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  9893.             selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  9894.             cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  9895.             printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  9896.             tempDate = new Date(),
  9897.             today = this._daylightSavingAdjust(
  9898.                 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
  9899.             isRTL = this._get(inst, "isRTL"),
  9900.             showButtonPanel = this._get(inst, "showButtonPanel"),
  9901.             hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
  9902.             navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
  9903.             numMonths = this._getNumberOfMonths(inst),
  9904.             showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
  9905.             stepMonths = this._get(inst, "stepMonths"),
  9906.             isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
  9907.             currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  9908.                 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
  9909.             minDate = this._getMinMaxDate(inst, "min"),
  9910.             maxDate = this._getMinMaxDate(inst, "max"),
  9911.             drawMonth = inst.drawMonth - showCurrentAtPos,
  9912.             drawYear = inst.drawYear;
  9913.  
  9914.         if (drawMonth < 0) {
  9915.             drawMonth += 12;
  9916.             drawYear--;
  9917.         }
  9918.         if (maxDate) {
  9919.             maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  9920.                 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  9921.             maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  9922.             while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  9923.                 drawMonth--;
  9924.                 if (drawMonth < 0) {
  9925.                     drawMonth = 11;
  9926.                     drawYear--;
  9927.                 }
  9928.             }
  9929.         }
  9930.         inst.drawMonth = drawMonth;
  9931.         inst.drawYear = drawYear;
  9932.  
  9933.         prevText = this._get(inst, "prevText");
  9934.         prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  9935.             this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  9936.             this._getFormatConfig(inst)));
  9937.  
  9938.         prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  9939.             "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
  9940.             " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
  9941.             (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>"));
  9942.  
  9943.         nextText = this._get(inst, "nextText");
  9944.         nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  9945.             this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  9946.             this._getFormatConfig(inst)));
  9947.  
  9948.         next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  9949.             "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
  9950.             " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
  9951.             (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>"));
  9952.  
  9953.         currentText = this._get(inst, "currentText");
  9954.         gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
  9955.         currentText = (!navigationAsDateFormat ? currentText :
  9956.             this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  9957.  
  9958.         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'>" +
  9959.             this._get(inst, "closeText") + "</button>" : "");
  9960.  
  9961.         buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
  9962.             (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'" +
  9963.             ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
  9964.  
  9965.         firstDay = parseInt(this._get(inst, "firstDay"),10);
  9966.         firstDay = (isNaN(firstDay) ? 0 : firstDay);
  9967.  
  9968.         showWeek = this._get(inst, "showWeek");
  9969.         dayNames = this._get(inst, "dayNames");
  9970.         dayNamesMin = this._get(inst, "dayNamesMin");
  9971.         monthNames = this._get(inst, "monthNames");
  9972.         monthNamesShort = this._get(inst, "monthNamesShort");
  9973.         beforeShowDay = this._get(inst, "beforeShowDay");
  9974.         showOtherMonths = this._get(inst, "showOtherMonths");
  9975.         selectOtherMonths = this._get(inst, "selectOtherMonths");
  9976.         defaultDate = this._getDefaultDate(inst);
  9977.         html = "";
  9978.         dow;
  9979.         for (row = 0; row < numMonths[0]; row++) {
  9980.             group = "";
  9981.             this.maxRows = 4;
  9982.             for (col = 0; col < numMonths[1]; col++) {
  9983.                 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  9984.                 cornerClass = " ui-corner-all";
  9985.                 calender = "";
  9986.                 if (isMultiMonth) {
  9987.                     calender += "<div class='ui-datepicker-group";
  9988.                     if (numMonths[1] > 1) {
  9989.                         switch (col) {
  9990.                             case 0: calender += " ui-datepicker-group-first";
  9991.                                 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
  9992.                             case numMonths[1]-1: calender += " ui-datepicker-group-last";
  9993.                                 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
  9994.                             default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
  9995.                         }
  9996.                     }
  9997.                     calender += "'>";
  9998.                 }
  9999.                 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  10000.                     (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
  10001.                     (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
  10002.                     this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  10003.                     row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  10004.                     "</div><table class='ui-datepicker-calendar'><thead>" +
  10005.                     "<tr>";
  10006.                 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  10007.                 for (dow = 0; dow < 7; dow++) { // days of the week
  10008.                     day = (dow + firstDay) % 7;
  10009.                     thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
  10010.                         "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  10011.                 }
  10012.                 calender += thead + "</tr></thead><tbody>";
  10013.                 daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  10014.                 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  10015.                     inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  10016.                 }
  10017.                 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  10018.                 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
  10019.                 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
  10020.                 this.maxRows = numRows;
  10021.                 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  10022.                 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  10023.                     calender += "<tr>";
  10024.                     tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  10025.                         this._get(inst, "calculateWeek")(printDate) + "</td>");
  10026.                     for (dow = 0; dow < 7; dow++) { // create date picker days
  10027.                         daySettings = (beforeShowDay ?
  10028.                             beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
  10029.                         otherMonth = (printDate.getMonth() !== drawMonth);
  10030.                         unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  10031.                             (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  10032.                         tbody += "<td class='" +
  10033.                             ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
  10034.                             (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
  10035.                             ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
  10036.                             (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
  10037.                             // or defaultDate is current printedDate and defaultDate is selectedDate
  10038.                             " " + this._dayOverClass : "") + // highlight selected day
  10039.                             (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
  10040.                             (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
  10041.                             (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
  10042.                             (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
  10043.                             ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
  10044.                             (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
  10045.                             (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  10046.                             (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  10047.                             (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
  10048.                             (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
  10049.                             (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
  10050.                             "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
  10051.                         printDate.setDate(printDate.getDate() + 1);
  10052.                         printDate = this._daylightSavingAdjust(printDate);
  10053.                     }
  10054.                     calender += tbody + "</tr>";
  10055.                 }
  10056.                 drawMonth++;
  10057.                 if (drawMonth > 11) {
  10058.                     drawMonth = 0;
  10059.                     drawYear++;
  10060.                 }
  10061.                 calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
  10062.                             ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
  10063.                 group += calender;
  10064.             }
  10065.             html += group;
  10066.         }
  10067.         html += buttonPanel;
  10068.         inst._keyEvent = false;
  10069.         return html;
  10070.     },
  10071.  
  10072.     /* Generate the month and year header. */
  10073.     _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  10074.             secondary, monthNames, monthNamesShort) {
  10075.  
  10076.         var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  10077.             changeMonth = this._get(inst, "changeMonth"),
  10078.             changeYear = this._get(inst, "changeYear"),
  10079.             showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
  10080.             html = "<div class='ui-datepicker-title'>",
  10081.             monthHtml = "";
  10082.  
  10083.         // month selection
  10084.         if (secondary || !changeMonth) {
  10085.             monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
  10086.         } else {
  10087.             inMinYear = (minDate && minDate.getFullYear() === drawYear);
  10088.             inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
  10089.             monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
  10090.             for ( month = 0; month < 12; month++) {
  10091.                 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
  10092.                     monthHtml += "<option value='" + month + "'" +
  10093.                         (month === drawMonth ? " selected='selected'" : "") +
  10094.                         ">" + monthNamesShort[month] + "</option>";
  10095.                 }
  10096.             }
  10097.             monthHtml += "</select>";
  10098.         }
  10099.  
  10100.         if (!showMonthAfterYear) {
  10101.             html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
  10102.         }
  10103.  
  10104.         // year selection
  10105.         if ( !inst.yearshtml ) {
  10106.             inst.yearshtml = "";
  10107.             if (secondary || !changeYear) {
  10108.                 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  10109.             } else {
  10110.                 // determine range of years to display
  10111.                 years = this._get(inst, "yearRange").split(":");
  10112.                 thisYear = new Date().getFullYear();
  10113.                 determineYear = function(value) {
  10114.                     var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  10115.                         (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
  10116.                         parseInt(value, 10)));
  10117.                     return (isNaN(year) ? thisYear : year);
  10118.                 };
  10119.                 year = determineYear(years[0]);
  10120.                 endYear = Math.max(year, determineYear(years[1] || ""));
  10121.                 year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  10122.                 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  10123.                 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
  10124.                 for (; year <= endYear; year++) {
  10125.                     inst.yearshtml += "<option value='" + year + "'" +
  10126.                         (year === drawYear ? " selected='selected'" : "") +
  10127.                         ">" + year + "</option>";
  10128.                 }
  10129.                 inst.yearshtml += "</select>";
  10130.  
  10131.                 html += inst.yearshtml;
  10132.                 inst.yearshtml = null;
  10133.             }
  10134.         }
  10135.  
  10136.         html += this._get(inst, "yearSuffix");
  10137.         if (showMonthAfterYear) {
  10138.             html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
  10139.         }
  10140.         html += "</div>"; // Close datepicker_header
  10141.         return html;
  10142.     },
  10143.  
  10144.     /* Adjust one of the date sub-fields. */
  10145.     _adjustInstDate: function(inst, offset, period) {
  10146.         var year = inst.drawYear + (period === "Y" ? offset : 0),
  10147.             month = inst.drawMonth + (period === "M" ? offset : 0),
  10148.             day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
  10149.             date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
  10150.  
  10151.         inst.selectedDay = date.getDate();
  10152.         inst.drawMonth = inst.selectedMonth = date.getMonth();
  10153.         inst.drawYear = inst.selectedYear = date.getFullYear();
  10154.         if (period === "M" || period === "Y") {
  10155.             this._notifyChange(inst);
  10156.         }
  10157.     },
  10158.  
  10159.     /* Ensure a date is within any min/max bounds. */
  10160.     _restrictMinMax: function(inst, date) {
  10161.         var minDate = this._getMinMaxDate(inst, "min"),
  10162.             maxDate = this._getMinMaxDate(inst, "max"),
  10163.             newDate = (minDate && date < minDate ? minDate : date);
  10164.         return (maxDate && newDate > maxDate ? maxDate : newDate);
  10165.     },
  10166.  
  10167.     /* Notify change of month/year. */
  10168.     _notifyChange: function(inst) {
  10169.         var onChange = this._get(inst, "onChangeMonthYear");
  10170.         if (onChange) {
  10171.             onChange.apply((inst.input ? inst.input[0] : null),
  10172.                 [inst.selectedYear, inst.selectedMonth + 1, inst]);
  10173.         }
  10174.     },
  10175.  
  10176.     /* Determine the number of months to show. */
  10177.     _getNumberOfMonths: function(inst) {
  10178.         var numMonths = this._get(inst, "numberOfMonths");
  10179.         return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
  10180.     },
  10181.  
  10182.     /* Determine the current maximum date - ensure no time components are set. */
  10183.     _getMinMaxDate: function(inst, minMax) {
  10184.         return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
  10185.     },
  10186.  
  10187.     /* Find the number of days in a given month. */
  10188.     _getDaysInMonth: function(year, month) {
  10189.         return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
  10190.     },
  10191.  
  10192.     /* Find the day of the week of the first of a month. */
  10193.     _getFirstDayOfMonth: function(year, month) {
  10194.         return new Date(year, month, 1).getDay();
  10195.     },
  10196.  
  10197.     /* Determines if we should allow a "next/prev" month display change. */
  10198.     _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  10199.         var numMonths = this._getNumberOfMonths(inst),
  10200.             date = this._daylightSavingAdjust(new Date(curYear,
  10201.             curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  10202.  
  10203.         if (offset < 0) {
  10204.             date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  10205.         }
  10206.         return this._isInRange(inst, date);
  10207.     },
  10208.  
  10209.     /* Is the given date in the accepted range? */
  10210.     _isInRange: function(inst, date) {
  10211.         var yearSplit, currentYear,
  10212.             minDate = this._getMinMaxDate(inst, "min"),
  10213.             maxDate = this._getMinMaxDate(inst, "max"),
  10214.             minYear = null,
  10215.             maxYear = null,
  10216.             years = this._get(inst, "yearRange");
  10217.             if (years){
  10218.                 yearSplit = years.split(":");
  10219.                 currentYear = new Date().getFullYear();
  10220.                 minYear = parseInt(yearSplit[0], 10);
  10221.                 maxYear = parseInt(yearSplit[1], 10);
  10222.                 if ( yearSplit[0].match(/[+\-].*/) ) {
  10223.                     minYear += currentYear;
  10224.                 }
  10225.                 if ( yearSplit[1].match(/[+\-].*/) ) {
  10226.                     maxYear += currentYear;
  10227.                 }
  10228.             }
  10229.  
  10230.         return ((!minDate || date.getTime() >= minDate.getTime()) &&
  10231.             (!maxDate || date.getTime() <= maxDate.getTime()) &&
  10232.             (!minYear || date.getFullYear() >= minYear) &&
  10233.             (!maxYear || date.getFullYear() <= maxYear));
  10234.     },
  10235.  
  10236.     /* Provide the configuration settings for formatting/parsing. */
  10237.     _getFormatConfig: function(inst) {
  10238.         var shortYearCutoff = this._get(inst, "shortYearCutoff");
  10239.         shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
  10240.             new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  10241.         return {shortYearCutoff: shortYearCutoff,
  10242.             dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
  10243.             monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
  10244.     },
  10245.  
  10246.     /* Format the given date for display. */
  10247.     _formatDate: function(inst, day, month, year) {
  10248.         if (!day) {
  10249.             inst.currentDay = inst.selectedDay;
  10250.             inst.currentMonth = inst.selectedMonth;
  10251.             inst.currentYear = inst.selectedYear;
  10252.         }
  10253.         var date = (day ? (typeof day === "object" ? day :
  10254.             this._daylightSavingAdjust(new Date(year, month, day))) :
  10255.             this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  10256.         return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
  10257.     }
  10258. });
  10259.  
  10260. /*
  10261.  * Bind hover events for datepicker elements.
  10262.  * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  10263.  * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  10264.  */
  10265. function datepicker_bindHover(dpDiv) {
  10266.     var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  10267.     return dpDiv.delegate(selector, "mouseout", function() {
  10268.             $(this).removeClass("ui-state-hover");
  10269.             if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  10270.                 $(this).removeClass("ui-datepicker-prev-hover");
  10271.             }
  10272.             if (this.className.indexOf("ui-datepicker-next") !== -1) {
  10273.                 $(this).removeClass("ui-datepicker-next-hover");
  10274.             }
  10275.         })
  10276.         .delegate( selector, "mouseover", datepicker_handleMouseover );
  10277. }
  10278.  
  10279. function datepicker_handleMouseover() {
  10280.     if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
  10281.         $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
  10282.         $(this).addClass("ui-state-hover");
  10283.         if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  10284.             $(this).addClass("ui-datepicker-prev-hover");
  10285.         }
  10286.         if (this.className.indexOf("ui-datepicker-next") !== -1) {
  10287.             $(this).addClass("ui-datepicker-next-hover");
  10288.         }
  10289.     }
  10290. }
  10291.  
  10292. /* jQuery extend now ignores nulls! */
  10293. function datepicker_extendRemove(target, props) {
  10294.     $.extend(target, props);
  10295.     for (var name in props) {
  10296.         if (props[name] == null) {
  10297.             target[name] = props[name];
  10298.         }
  10299.     }
  10300.     return target;
  10301. }
  10302.  
  10303. /* Invoke the datepicker functionality.
  10304.    @param  options  string - a command, optionally followed by additional parameters or
  10305.                     Object - settings for attaching new datepicker functionality
  10306.    @return  jQuery object */
  10307. $.fn.datepicker = function(options){
  10308.  
  10309.     /* Verify an empty collection wasn't passed - Fixes #6976 */
  10310.     if ( !this.length ) {
  10311.         return this;
  10312.     }
  10313.  
  10314.     /* Initialise the date picker. */
  10315.     if (!$.datepicker.initialized) {
  10316.         $(document).mousedown($.datepicker._checkExternalClick);
  10317.         $.datepicker.initialized = true;
  10318.     }
  10319.  
  10320.     /* Append datepicker main container to body if not exist. */
  10321.     if ($("#"+$.datepicker._mainDivId).length === 0) {
  10322.         $("body").append($.datepicker.dpDiv);
  10323.     }
  10324.  
  10325.     var otherArgs = Array.prototype.slice.call(arguments, 1);
  10326.     if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
  10327.         return $.datepicker["_" + options + "Datepicker"].
  10328.             apply($.datepicker, [this[0]].concat(otherArgs));
  10329.     }
  10330.     if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
  10331.         return $.datepicker["_" + options + "Datepicker"].
  10332.             apply($.datepicker, [this[0]].concat(otherArgs));
  10333.     }
  10334.     return this.each(function() {
  10335.         typeof options === "string" ?
  10336.             $.datepicker["_" + options + "Datepicker"].
  10337.                 apply($.datepicker, [this].concat(otherArgs)) :
  10338.             $.datepicker._attachDatepicker(this, options);
  10339.     });
  10340. };
  10341.  
  10342. $.datepicker = new Datepicker(); // singleton instance
  10343. $.datepicker.initialized = false;
  10344. $.datepicker.uuid = new Date().getTime();
  10345. $.datepicker.version = "1.11.4";
  10346.  
  10347. var datepicker = $.datepicker;
  10348.  
  10349.  
  10350. /*!
  10351.  * jQuery UI Dialog 1.11.4
  10352.  * http://jqueryui.com
  10353.  *
  10354.  * Copyright jQuery Foundation and other contributors
  10355.  * Released under the MIT license.
  10356.  * http://jquery.org/license
  10357.  *
  10358.  * http://api.jqueryui.com/dialog/
  10359.  */
  10360.  
  10361.  
  10362. var dialog = $.widget( "ui.dialog", {
  10363.     version: "1.11.4",
  10364.     options: {
  10365.         appendTo: "body",
  10366.         autoOpen: true,
  10367.         buttons: [],
  10368.         closeOnEscape: true,
  10369.         closeText: "Close",
  10370.         dialogClass: "",
  10371.         draggable: true,
  10372.         hide: null,
  10373.         height: "auto",
  10374.         maxHeight: null,
  10375.         maxWidth: null,
  10376.         minHeight: 150,
  10377.         minWidth: 150,
  10378.         modal: false,
  10379.         position: {
  10380.             my: "center",
  10381.             at: "center",
  10382.             of: window,
  10383.             collision: "fit",
  10384.             // Ensure the titlebar is always visible
  10385.             using: function( pos ) {
  10386.                 var topOffset = $( this ).css( pos ).offset().top;
  10387.                 if ( topOffset < 0 ) {
  10388.                     $( this ).css( "top", pos.top - topOffset );
  10389.                 }
  10390.             }
  10391.         },
  10392.         resizable: true,
  10393.         show: null,
  10394.         title: null,
  10395.         width: 300,
  10396.  
  10397.         // callbacks
  10398.         beforeClose: null,
  10399.         close: null,
  10400.         drag: null,
  10401.         dragStart: null,
  10402.         dragStop: null,
  10403.         focus: null,
  10404.         open: null,
  10405.         resize: null,
  10406.         resizeStart: null,
  10407.         resizeStop: null
  10408.     },
  10409.  
  10410.     sizeRelatedOptions: {
  10411.         buttons: true,
  10412.         height: true,
  10413.         maxHeight: true,
  10414.         maxWidth: true,
  10415.         minHeight: true,
  10416.         minWidth: true,
  10417.         width: true
  10418.     },
  10419.  
  10420.     resizableRelatedOptions: {
  10421.         maxHeight: true,
  10422.         maxWidth: true,
  10423.         minHeight: true,
  10424.         minWidth: true
  10425.     },
  10426.  
  10427.     _create: function() {
  10428.         this.originalCss = {
  10429.             display: this.element[ 0 ].style.display,
  10430.             width: this.element[ 0 ].style.width,
  10431.             minHeight: this.element[ 0 ].style.minHeight,
  10432.             maxHeight: this.element[ 0 ].style.maxHeight,
  10433.             height: this.element[ 0 ].style.height
  10434.         };
  10435.         this.originalPosition = {
  10436.             parent: this.element.parent(),
  10437.             index: this.element.parent().children().index( this.element )
  10438.         };
  10439.         this.originalTitle = this.element.attr( "title" );
  10440.         this.options.title = this.options.title || this.originalTitle;
  10441.  
  10442.         this._createWrapper();
  10443.  
  10444.         this.element
  10445.             .show()
  10446.             .removeAttr( "title" )
  10447.             .addClass( "ui-dialog-content ui-widget-content" )
  10448.             .appendTo( this.uiDialog );
  10449.  
  10450.         this._createTitlebar();
  10451.         this._createButtonPane();
  10452.  
  10453.         if ( this.options.draggable && $.fn.draggable ) {
  10454.             this._makeDraggable();
  10455.         }
  10456.         if ( this.options.resizable && $.fn.resizable ) {
  10457.             this._makeResizable();
  10458.         }
  10459.  
  10460.         this._isOpen = false;
  10461.  
  10462.         this._trackFocus();
  10463.     },
  10464.  
  10465.     _init: function() {
  10466.         if ( this.options.autoOpen ) {
  10467.             this.open();
  10468.         }
  10469.     },
  10470.  
  10471.     _appendTo: function() {
  10472.         var element = this.options.appendTo;
  10473.         if ( element && (element.jquery || element.nodeType) ) {
  10474.             return $( element );
  10475.         }
  10476.         return this.document.find( element || "body" ).eq( 0 );
  10477.     },
  10478.  
  10479.     _destroy: function() {
  10480.         var next,
  10481.             originalPosition = this.originalPosition;
  10482.  
  10483.         this._untrackInstance();
  10484.         this._destroyOverlay();
  10485.  
  10486.         this.element
  10487.             .removeUniqueId()
  10488.             .removeClass( "ui-dialog-content ui-widget-content" )
  10489.             .css( this.originalCss )
  10490.             // Without detaching first, the following becomes really slow
  10491.             .detach();
  10492.  
  10493.         this.uiDialog.stop( true, true ).remove();
  10494.  
  10495.         if ( this.originalTitle ) {
  10496.             this.element.attr( "title", this.originalTitle );
  10497.         }
  10498.  
  10499.         next = originalPosition.parent.children().eq( originalPosition.index );
  10500.         // Don't try to place the dialog next to itself (#8613)
  10501.         if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  10502.             next.before( this.element );
  10503.         } else {
  10504.             originalPosition.parent.append( this.element );
  10505.         }
  10506.     },
  10507.  
  10508.     widget: function() {
  10509.         return this.uiDialog;
  10510.     },
  10511.  
  10512.     disable: $.noop,
  10513.     enable: $.noop,
  10514.  
  10515.     close: function( event ) {
  10516.         var activeElement,
  10517.             that = this;
  10518.  
  10519.         if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  10520.             return;
  10521.         }
  10522.  
  10523.         this._isOpen = false;
  10524.         this._focusedElement = null;
  10525.         this._destroyOverlay();
  10526.         this._untrackInstance();
  10527.  
  10528.         if ( !this.opener.filter( ":focusable" ).focus().length ) {
  10529.  
  10530.             // support: IE9
  10531.             // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  10532.             try {
  10533.                 activeElement = this.document[ 0 ].activeElement;
  10534.  
  10535.                 // Support: IE9, IE10
  10536.                 // If the <body> is blurred, IE will switch windows, see #4520
  10537.                 if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
  10538.  
  10539.                     // Hiding a focused element doesn't trigger blur in WebKit
  10540.                     // so in case we have nothing to focus on, explicitly blur the active element
  10541.                     // https://bugs.webkit.org/show_bug.cgi?id=47182
  10542.                     $( activeElement ).blur();
  10543.                 }
  10544.             } catch ( error ) {}
  10545.         }
  10546.  
  10547.         this._hide( this.uiDialog, this.options.hide, function() {
  10548.             that._trigger( "close", event );
  10549.         });
  10550.     },
  10551.  
  10552.     isOpen: function() {
  10553.         return this._isOpen;
  10554.     },
  10555.  
  10556.     moveToTop: function() {
  10557.         this._moveToTop();
  10558.     },
  10559.  
  10560.     _moveToTop: function( event, silent ) {
  10561.         var moved = false,
  10562.             zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
  10563.                 return +$( this ).css( "z-index" );
  10564.             }).get(),
  10565.             zIndexMax = Math.max.apply( null, zIndices );
  10566.  
  10567.         if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
  10568.             this.uiDialog.css( "z-index", zIndexMax + 1 );
  10569.             moved = true;
  10570.         }
  10571.  
  10572.         if ( moved && !silent ) {
  10573.             this._trigger( "focus", event );
  10574.         }
  10575.         return moved;
  10576.     },
  10577.  
  10578.     open: function() {
  10579.         var that = this;
  10580.         if ( this._isOpen ) {
  10581.             if ( this._moveToTop() ) {
  10582.                 this._focusTabbable();
  10583.             }
  10584.             return;
  10585.         }
  10586.  
  10587.         this._isOpen = true;
  10588.         this.opener = $( this.document[ 0 ].activeElement );
  10589.  
  10590.         this._size();
  10591.         this._position();
  10592.         this._createOverlay();
  10593.         this._moveToTop( null, true );
  10594.  
  10595.         // Ensure the overlay is moved to the top with the dialog, but only when
  10596.         // opening. The overlay shouldn't move after the dialog is open so that
  10597.         // modeless dialogs opened after the modal dialog stack properly.
  10598.         if ( this.overlay ) {
  10599.             this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
  10600.         }
  10601.  
  10602.         this._show( this.uiDialog, this.options.show, function() {
  10603.             that._focusTabbable();
  10604.             that._trigger( "focus" );
  10605.         });
  10606.  
  10607.         // Track the dialog immediately upon openening in case a focus event
  10608.         // somehow occurs outside of the dialog before an element inside the
  10609.         // dialog is focused (#10152)
  10610.         this._makeFocusTarget();
  10611.  
  10612.         this._trigger( "open" );
  10613.     },
  10614.  
  10615.     _focusTabbable: function() {
  10616.         // Set focus to the first match:
  10617.         // 1. An element that was focused previously
  10618.         // 2. First element inside the dialog matching [autofocus]
  10619.         // 3. Tabbable element inside the content element
  10620.         // 4. Tabbable element inside the buttonpane
  10621.         // 5. The close button
  10622.         // 6. The dialog itself
  10623.         var hasFocus = this._focusedElement;
  10624.         if ( !hasFocus ) {
  10625.             hasFocus = this.element.find( "[autofocus]" );
  10626.         }
  10627.         if ( !hasFocus.length ) {
  10628.             hasFocus = this.element.find( ":tabbable" );
  10629.         }
  10630.         if ( !hasFocus.length ) {
  10631.             hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  10632.         }
  10633.         if ( !hasFocus.length ) {
  10634.             hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  10635.         }
  10636.         if ( !hasFocus.length ) {
  10637.             hasFocus = this.uiDialog;
  10638.         }
  10639.         hasFocus.eq( 0 ).focus();
  10640.     },
  10641.  
  10642.     _keepFocus: function( event ) {
  10643.         function checkFocus() {
  10644.             var activeElement = this.document[0].activeElement,
  10645.                 isActive = this.uiDialog[0] === activeElement ||
  10646.                     $.contains( this.uiDialog[0], activeElement );
  10647.             if ( !isActive ) {
  10648.                 this._focusTabbable();
  10649.             }
  10650.         }
  10651.         event.preventDefault();
  10652.         checkFocus.call( this );
  10653.         // support: IE
  10654.         // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10655.         // so we check again later
  10656.         this._delay( checkFocus );
  10657.     },
  10658.  
  10659.     _createWrapper: function() {
  10660.         this.uiDialog = $("<div>")
  10661.             .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
  10662.                 this.options.dialogClass )
  10663.             .hide()
  10664.             .attr({
  10665.                 // Setting tabIndex makes the div focusable
  10666.                 tabIndex: -1,
  10667.                 role: "dialog"
  10668.             })
  10669.             .appendTo( this._appendTo() );
  10670.  
  10671.         this._on( this.uiDialog, {
  10672.             keydown: function( event ) {
  10673.                 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10674.                         event.keyCode === $.ui.keyCode.ESCAPE ) {
  10675.                     event.preventDefault();
  10676.                     this.close( event );
  10677.                     return;
  10678.                 }
  10679.  
  10680.                 // prevent tabbing out of dialogs
  10681.                 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  10682.                     return;
  10683.                 }
  10684.                 var tabbables = this.uiDialog.find( ":tabbable" ),
  10685.                     first = tabbables.filter( ":first" ),
  10686.                     last = tabbables.filter( ":last" );
  10687.  
  10688.                 if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
  10689.                     this._delay(function() {
  10690.                         first.focus();
  10691.                     });
  10692.                     event.preventDefault();
  10693.                 } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
  10694.                     this._delay(function() {
  10695.                         last.focus();
  10696.                     });
  10697.                     event.preventDefault();
  10698.                 }
  10699.             },
  10700.             mousedown: function( event ) {
  10701.                 if ( this._moveToTop( event ) ) {
  10702.                     this._focusTabbable();
  10703.                 }
  10704.             }
  10705.         });
  10706.  
  10707.         // We assume that any existing aria-describedby attribute means
  10708.         // that the dialog content is marked up properly
  10709.         // otherwise we brute force the content as the description
  10710.         if ( !this.element.find( "[aria-describedby]" ).length ) {
  10711.             this.uiDialog.attr({
  10712.                 "aria-describedby": this.element.uniqueId().attr( "id" )
  10713.             });
  10714.         }
  10715.     },
  10716.  
  10717.     _createTitlebar: function() {
  10718.         var uiDialogTitle;
  10719.  
  10720.         this.uiDialogTitlebar = $( "<div>" )
  10721.             .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
  10722.             .prependTo( this.uiDialog );
  10723.         this._on( this.uiDialogTitlebar, {
  10724.             mousedown: function( event ) {
  10725.                 // Don't prevent click on close button (#8838)
  10726.                 // Focusing a dialog that is partially scrolled out of view
  10727.                 // causes the browser to scroll it into view, preventing the click event
  10728.                 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  10729.                     // Dialog isn't getting focus when dragging (#8063)
  10730.                     this.uiDialog.focus();
  10731.                 }
  10732.             }
  10733.         });
  10734.  
  10735.         // support: IE
  10736.         // Use type="button" to prevent enter keypresses in textboxes from closing the
  10737.         // dialog in IE (#9312)
  10738.         this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  10739.             .button({
  10740.                 label: this.options.closeText,
  10741.                 icons: {
  10742.                     primary: "ui-icon-closethick"
  10743.                 },
  10744.                 text: false
  10745.             })
  10746.             .addClass( "ui-dialog-titlebar-close" )
  10747.             .appendTo( this.uiDialogTitlebar );
  10748.         this._on( this.uiDialogTitlebarClose, {
  10749.             click: function( event ) {
  10750.                 event.preventDefault();
  10751.                 this.close( event );
  10752.             }
  10753.         });
  10754.  
  10755.         uiDialogTitle = $( "<span>" )
  10756.             .uniqueId()
  10757.             .addClass( "ui-dialog-title" )
  10758.             .prependTo( this.uiDialogTitlebar );
  10759.         this._title( uiDialogTitle );
  10760.  
  10761.         this.uiDialog.attr({
  10762.             "aria-labelledby": uiDialogTitle.attr( "id" )
  10763.         });
  10764.     },
  10765.  
  10766.     _title: function( title ) {
  10767.         if ( !this.options.title ) {
  10768.             title.html( "&#160;" );
  10769.         }
  10770.         title.text( this.options.title );
  10771.     },
  10772.  
  10773.     _createButtonPane: function() {
  10774.         this.uiDialogButtonPane = $( "<div>" )
  10775.             .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
  10776.  
  10777.         this.uiButtonSet = $( "<div>" )
  10778.             .addClass( "ui-dialog-buttonset" )
  10779.             .appendTo( this.uiDialogButtonPane );
  10780.  
  10781.         this._createButtons();
  10782.     },
  10783.  
  10784.     _createButtons: function() {
  10785.         var that = this,
  10786.             buttons = this.options.buttons;
  10787.  
  10788.         // if we already have a button pane, remove it
  10789.         this.uiDialogButtonPane.remove();
  10790.         this.uiButtonSet.empty();
  10791.  
  10792.         if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
  10793.             this.uiDialog.removeClass( "ui-dialog-buttons" );
  10794.             return;
  10795.         }
  10796.  
  10797.         $.each( buttons, function( name, props ) {
  10798.             var click, buttonOptions;
  10799.             props = $.isFunction( props ) ?
  10800.                 { click: props, text: name } :
  10801.                 props;
  10802.             // Default to a non-submitting button
  10803.             props = $.extend( { type: "button" }, props );
  10804.             // Change the context for the click callback to be the main element
  10805.             click = props.click;
  10806.             props.click = function() {
  10807.                 click.apply( that.element[ 0 ], arguments );
  10808.             };
  10809.             buttonOptions = {
  10810.                 icons: props.icons,
  10811.                 text: props.showText
  10812.             };
  10813.             delete props.icons;
  10814.             delete props.showText;
  10815.             $( "<button></button>", props )
  10816.                 .button( buttonOptions )
  10817.                 .appendTo( that.uiButtonSet );
  10818.         });
  10819.         this.uiDialog.addClass( "ui-dialog-buttons" );
  10820.         this.uiDialogButtonPane.appendTo( this.uiDialog );
  10821.     },
  10822.  
  10823.     _makeDraggable: function() {
  10824.         var that = this,
  10825.             options = this.options;
  10826.  
  10827.         function filteredUi( ui ) {
  10828.             return {
  10829.                 position: ui.position,
  10830.                 offset: ui.offset
  10831.             };
  10832.         }
  10833.  
  10834.         this.uiDialog.draggable({
  10835.             cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10836.             handle: ".ui-dialog-titlebar",
  10837.             containment: "document",
  10838.             start: function( event, ui ) {
  10839.                 $( this ).addClass( "ui-dialog-dragging" );
  10840.                 that._blockFrames();
  10841.                 that._trigger( "dragStart", event, filteredUi( ui ) );
  10842.             },
  10843.             drag: function( event, ui ) {
  10844.                 that._trigger( "drag", event, filteredUi( ui ) );
  10845.             },
  10846.             stop: function( event, ui ) {
  10847.                 var left = ui.offset.left - that.document.scrollLeft(),
  10848.                     top = ui.offset.top - that.document.scrollTop();
  10849.  
  10850.                 options.position = {
  10851.                     my: "left top",
  10852.                     at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10853.                         "top" + (top >= 0 ? "+" : "") + top,
  10854.                     of: that.window
  10855.                 };
  10856.                 $( this ).removeClass( "ui-dialog-dragging" );
  10857.                 that._unblockFrames();
  10858.                 that._trigger( "dragStop", event, filteredUi( ui ) );
  10859.             }
  10860.         });
  10861.     },
  10862.  
  10863.     _makeResizable: function() {
  10864.         var that = this,
  10865.             options = this.options,
  10866.             handles = options.resizable,
  10867.             // .ui-resizable has position: relative defined in the stylesheet
  10868.             // but dialogs have to use absolute or fixed positioning
  10869.             position = this.uiDialog.css("position"),
  10870.             resizeHandles = typeof handles === "string" ?
  10871.                 handles :
  10872.                 "n,e,s,w,se,sw,ne,nw";
  10873.  
  10874.         function filteredUi( ui ) {
  10875.             return {
  10876.                 originalPosition: ui.originalPosition,
  10877.                 originalSize: ui.originalSize,
  10878.                 position: ui.position,
  10879.                 size: ui.size
  10880.             };
  10881.         }
  10882.  
  10883.         this.uiDialog.resizable({
  10884.             cancel: ".ui-dialog-content",
  10885.             containment: "document",
  10886.             alsoResize: this.element,
  10887.             maxWidth: options.maxWidth,
  10888.             maxHeight: options.maxHeight,
  10889.             minWidth: options.minWidth,
  10890.             minHeight: this._minHeight(),
  10891.             handles: resizeHandles,
  10892.             start: function( event, ui ) {
  10893.                 $( this ).addClass( "ui-dialog-resizing" );
  10894.                 that._blockFrames();
  10895.                 that._trigger( "resizeStart", event, filteredUi( ui ) );
  10896.             },
  10897.             resize: function( event, ui ) {
  10898.                 that._trigger( "resize", event, filteredUi( ui ) );
  10899.             },
  10900.             stop: function( event, ui ) {
  10901.                 var offset = that.uiDialog.offset(),
  10902.                     left = offset.left - that.document.scrollLeft(),
  10903.                     top = offset.top - that.document.scrollTop();
  10904.  
  10905.                 options.height = that.uiDialog.height();
  10906.                 options.width = that.uiDialog.width();
  10907.                 options.position = {
  10908.                     my: "left top",
  10909.                     at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10910.                         "top" + (top >= 0 ? "+" : "") + top,
  10911.                     of: that.window
  10912.                 };
  10913.                 $( this ).removeClass( "ui-dialog-resizing" );
  10914.                 that._unblockFrames();
  10915.                 that._trigger( "resizeStop", event, filteredUi( ui ) );
  10916.             }
  10917.         })
  10918.         .css( "position", position );
  10919.     },
  10920.  
  10921.     _trackFocus: function() {
  10922.         this._on( this.widget(), {
  10923.             focusin: function( event ) {
  10924.                 this._makeFocusTarget();
  10925.                 this._focusedElement = $( event.target );
  10926.             }
  10927.         });
  10928.     },
  10929.  
  10930.     _makeFocusTarget: function() {
  10931.         this._untrackInstance();
  10932.         this._trackingInstances().unshift( this );
  10933.     },
  10934.  
  10935.     _untrackInstance: function() {
  10936.         var instances = this._trackingInstances(),
  10937.             exists = $.inArray( this, instances );
  10938.         if ( exists !== -1 ) {
  10939.             instances.splice( exists, 1 );
  10940.         }
  10941.     },
  10942.  
  10943.     _trackingInstances: function() {
  10944.         var instances = this.document.data( "ui-dialog-instances" );
  10945.         if ( !instances ) {
  10946.             instances = [];
  10947.             this.document.data( "ui-dialog-instances", instances );
  10948.         }
  10949.         return instances;
  10950.     },
  10951.  
  10952.     _minHeight: function() {
  10953.         var options = this.options;
  10954.  
  10955.         return options.height === "auto" ?
  10956.             options.minHeight :
  10957.             Math.min( options.minHeight, options.height );
  10958.     },
  10959.  
  10960.     _position: function() {
  10961.         // Need to show the dialog to get the actual offset in the position plugin
  10962.         var isVisible = this.uiDialog.is( ":visible" );
  10963.         if ( !isVisible ) {
  10964.             this.uiDialog.show();
  10965.         }
  10966.         this.uiDialog.position( this.options.position );
  10967.         if ( !isVisible ) {
  10968.             this.uiDialog.hide();
  10969.         }
  10970.     },
  10971.  
  10972.     _setOptions: function( options ) {
  10973.         var that = this,
  10974.             resize = false,
  10975.             resizableOptions = {};
  10976.  
  10977.         $.each( options, function( key, value ) {
  10978.             that._setOption( key, value );
  10979.  
  10980.             if ( key in that.sizeRelatedOptions ) {
  10981.                 resize = true;
  10982.             }
  10983.             if ( key in that.resizableRelatedOptions ) {
  10984.                 resizableOptions[ key ] = value;
  10985.             }
  10986.         });
  10987.  
  10988.         if ( resize ) {
  10989.             this._size();
  10990.             this._position();
  10991.         }
  10992.         if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10993.             this.uiDialog.resizable( "option", resizableOptions );
  10994.         }
  10995.     },
  10996.  
  10997.     _setOption: function( key, value ) {
  10998.         var isDraggable, isResizable,
  10999.             uiDialog = this.uiDialog;
  11000.  
  11001.         if ( key === "dialogClass" ) {
  11002.             uiDialog
  11003.                 .removeClass( this.options.dialogClass )
  11004.                 .addClass( value );
  11005.         }
  11006.  
  11007.         if ( key === "disabled" ) {
  11008.             return;
  11009.         }
  11010.  
  11011.         this._super( key, value );
  11012.  
  11013.         if ( key === "appendTo" ) {
  11014.             this.uiDialog.appendTo( this._appendTo() );
  11015.         }
  11016.  
  11017.         if ( key === "buttons" ) {
  11018.             this._createButtons();
  11019.         }
  11020.  
  11021.         if ( key === "closeText" ) {
  11022.             this.uiDialogTitlebarClose.button({
  11023.                 // Ensure that we always pass a string
  11024.                 label: "" + value
  11025.             });
  11026.         }
  11027.  
  11028.         if ( key === "draggable" ) {
  11029.             isDraggable = uiDialog.is( ":data(ui-draggable)" );
  11030.             if ( isDraggable && !value ) {
  11031.                 uiDialog.draggable( "destroy" );
  11032.             }
  11033.  
  11034.             if ( !isDraggable && value ) {
  11035.                 this._makeDraggable();
  11036.             }
  11037.         }
  11038.  
  11039.         if ( key === "position" ) {
  11040.             this._position();
  11041.         }
  11042.  
  11043.         if ( key === "resizable" ) {
  11044.             // currently resizable, becoming non-resizable
  11045.             isResizable = uiDialog.is( ":data(ui-resizable)" );
  11046.             if ( isResizable && !value ) {
  11047.                 uiDialog.resizable( "destroy" );
  11048.             }
  11049.  
  11050.             // currently resizable, changing handles
  11051.             if ( isResizable && typeof value === "string" ) {
  11052.                 uiDialog.resizable( "option", "handles", value );
  11053.             }
  11054.  
  11055.             // currently non-resizable, becoming resizable
  11056.             if ( !isResizable && value !== false ) {
  11057.                 this._makeResizable();
  11058.             }
  11059.         }
  11060.  
  11061.         if ( key === "title" ) {
  11062.             this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
  11063.         }
  11064.     },
  11065.  
  11066.     _size: function() {
  11067.         // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  11068.         // divs will both have width and height set, so we need to reset them
  11069.         var nonContentHeight, minContentHeight, maxContentHeight,
  11070.             options = this.options;
  11071.  
  11072.         // Reset content sizing
  11073.         this.element.show().css({
  11074.             width: "auto",
  11075.             minHeight: 0,
  11076.             maxHeight: "none",
  11077.             height: 0
  11078.         });
  11079.  
  11080.         if ( options.minWidth > options.width ) {
  11081.             options.width = options.minWidth;
  11082.         }
  11083.  
  11084.         // reset wrapper sizing
  11085.         // determine the height of all the non-content elements
  11086.         nonContentHeight = this.uiDialog.css({
  11087.                 height: "auto",
  11088.                 width: options.width
  11089.             })
  11090.             .outerHeight();
  11091.         minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  11092.         maxContentHeight = typeof options.maxHeight === "number" ?
  11093.             Math.max( 0, options.maxHeight - nonContentHeight ) :
  11094.             "none";
  11095.  
  11096.         if ( options.height === "auto" ) {
  11097.             this.element.css({
  11098.                 minHeight: minContentHeight,
  11099.                 maxHeight: maxContentHeight,
  11100.                 height: "auto"
  11101.             });
  11102.         } else {
  11103.             this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  11104.         }
  11105.  
  11106.         if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  11107.             this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  11108.         }
  11109.     },
  11110.  
  11111.     _blockFrames: function() {
  11112.         this.iframeBlocks = this.document.find( "iframe" ).map(function() {
  11113.             var iframe = $( this );
  11114.  
  11115.             return $( "<div>" )
  11116.                 .css({
  11117.                     position: "absolute",
  11118.                     width: iframe.outerWidth(),
  11119.                     height: iframe.outerHeight()
  11120.                 })
  11121.                 .appendTo( iframe.parent() )
  11122.                 .offset( iframe.offset() )[0];
  11123.         });
  11124.     },
  11125.  
  11126.     _unblockFrames: function() {
  11127.         if ( this.iframeBlocks ) {
  11128.             this.iframeBlocks.remove();
  11129.             delete this.iframeBlocks;
  11130.         }
  11131.     },
  11132.  
  11133.     _allowInteraction: function( event ) {
  11134.         if ( $( event.target ).closest( ".ui-dialog" ).length ) {
  11135.             return true;
  11136.         }
  11137.  
  11138.         // TODO: Remove hack when datepicker implements
  11139.         // the .ui-front logic (#8989)
  11140.         return !!$( event.target ).closest( ".ui-datepicker" ).length;
  11141.     },
  11142.  
  11143.     _createOverlay: function() {
  11144.         if ( !this.options.modal ) {
  11145.             return;
  11146.         }
  11147.  
  11148.         // We use a delay in case the overlay is created from an
  11149.         // event that we're going to be cancelling (#2804)
  11150.         var isOpening = true;
  11151.         this._delay(function() {
  11152.             isOpening = false;
  11153.         });
  11154.  
  11155.         if ( !this.document.data( "ui-dialog-overlays" ) ) {
  11156.  
  11157.             // Prevent use of anchors and inputs
  11158.             // Using _on() for an event handler shared across many instances is
  11159.             // safe because the dialogs stack and must be closed in reverse order
  11160.             this._on( this.document, {
  11161.                 focusin: function( event ) {
  11162.                     if ( isOpening ) {
  11163.                         return;
  11164.                     }
  11165.  
  11166.                     if ( !this._allowInteraction( event ) ) {
  11167.                         event.preventDefault();
  11168.                         this._trackingInstances()[ 0 ]._focusTabbable();
  11169.                     }
  11170.                 }
  11171.             });
  11172.         }
  11173.  
  11174.         this.overlay = $( "<div>" )
  11175.             .addClass( "ui-widget-overlay ui-front" )
  11176.             .appendTo( this._appendTo() );
  11177.         this._on( this.overlay, {
  11178.             mousedown: "_keepFocus"
  11179.         });
  11180.         this.document.data( "ui-dialog-overlays",
  11181.             (this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
  11182.     },
  11183.  
  11184.     _destroyOverlay: function() {
  11185.         if ( !this.options.modal ) {
  11186.             return;
  11187.         }
  11188.  
  11189.         if ( this.overlay ) {
  11190.             var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
  11191.  
  11192.             if ( !overlays ) {
  11193.                 this.document
  11194.                     .unbind( "focusin" )
  11195.                     .removeData( "ui-dialog-overlays" );
  11196.             } else {
  11197.                 this.document.data( "ui-dialog-overlays", overlays );
  11198.             }
  11199.  
  11200.             this.overlay.remove();
  11201.             this.overlay = null;
  11202.         }
  11203.     }
  11204. });
  11205.  
  11206.  
  11207. /*!
  11208.  * jQuery UI Progressbar 1.11.4
  11209.  * http://jqueryui.com
  11210.  *
  11211.  * Copyright jQuery Foundation and other contributors
  11212.  * Released under the MIT license.
  11213.  * http://jquery.org/license
  11214.  *
  11215.  * http://api.jqueryui.com/progressbar/
  11216.  */
  11217.  
  11218.  
  11219. var progressbar = $.widget( "ui.progressbar", {
  11220.     version: "1.11.4",
  11221.     options: {
  11222.         max: 100,
  11223.         value: 0,
  11224.  
  11225.         change: null,
  11226.         complete: null
  11227.     },
  11228.  
  11229.     min: 0,
  11230.  
  11231.     _create: function() {
  11232.         // Constrain initial value
  11233.         this.oldValue = this.options.value = this._constrainedValue();
  11234.  
  11235.         this.element
  11236.             .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  11237.             .attr({
  11238.                 // Only set static values, aria-valuenow and aria-valuemax are
  11239.                 // set inside _refreshValue()
  11240.                 role: "progressbar",
  11241.                 "aria-valuemin": this.min
  11242.             });
  11243.  
  11244.         this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  11245.             .appendTo( this.element );
  11246.  
  11247.         this._refreshValue();
  11248.     },
  11249.  
  11250.     _destroy: function() {
  11251.         this.element
  11252.             .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  11253.             .removeAttr( "role" )
  11254.             .removeAttr( "aria-valuemin" )
  11255.             .removeAttr( "aria-valuemax" )
  11256.             .removeAttr( "aria-valuenow" );
  11257.  
  11258.         this.valueDiv.remove();
  11259.     },
  11260.  
  11261.     value: function( newValue ) {
  11262.         if ( newValue === undefined ) {
  11263.             return this.options.value;
  11264.         }
  11265.  
  11266.         this.options.value = this._constrainedValue( newValue );
  11267.         this._refreshValue();
  11268.     },
  11269.  
  11270.     _constrainedValue: function( newValue ) {
  11271.         if ( newValue === undefined ) {
  11272.             newValue = this.options.value;
  11273.         }
  11274.  
  11275.         this.indeterminate = newValue === false;
  11276.  
  11277.         // sanitize value
  11278.         if ( typeof newValue !== "number" ) {
  11279.             newValue = 0;
  11280.         }
  11281.  
  11282.         return this.indeterminate ? false :
  11283.             Math.min( this.options.max, Math.max( this.min, newValue ) );
  11284.     },
  11285.  
  11286.     _setOptions: function( options ) {
  11287.         // Ensure "value" option is set after other values (like max)
  11288.         var value = options.value;
  11289.         delete options.value;
  11290.  
  11291.         this._super( options );
  11292.  
  11293.         this.options.value = this._constrainedValue( value );
  11294.         this._refreshValue();
  11295.     },
  11296.  
  11297.     _setOption: function( key, value ) {
  11298.         if ( key === "max" ) {
  11299.             // Don't allow a max less than min
  11300.             value = Math.max( this.min, value );
  11301.         }
  11302.         if ( key === "disabled" ) {
  11303.             this.element
  11304.                 .toggleClass( "ui-state-disabled", !!value )
  11305.                 .attr( "aria-disabled", value );
  11306.         }
  11307.         this._super( key, value );
  11308.     },
  11309.  
  11310.     _percentage: function() {
  11311.         return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  11312.     },
  11313.  
  11314.     _refreshValue: function() {
  11315.         var value = this.options.value,
  11316.             percentage = this._percentage();
  11317.  
  11318.         this.valueDiv
  11319.             .toggle( this.indeterminate || value > this.min )
  11320.             .toggleClass( "ui-corner-right", value === this.options.max )
  11321.             .width( percentage.toFixed(0) + "%" );
  11322.  
  11323.         this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
  11324.  
  11325.         if ( this.indeterminate ) {
  11326.             this.element.removeAttr( "aria-valuenow" );
  11327.             if ( !this.overlayDiv ) {
  11328.                 this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
  11329.             }
  11330.         } else {
  11331.             this.element.attr({
  11332.                 "aria-valuemax": this.options.max,
  11333.                 "aria-valuenow": value
  11334.             });
  11335.             if ( this.overlayDiv ) {
  11336.                 this.overlayDiv.remove();
  11337.                 this.overlayDiv = null;
  11338.             }
  11339.         }
  11340.  
  11341.         if ( this.oldValue !== value ) {
  11342.             this.oldValue = value;
  11343.             this._trigger( "change" );
  11344.         }
  11345.         if ( value === this.options.max ) {
  11346.             this._trigger( "complete" );
  11347.         }
  11348.     }
  11349. });
  11350.  
  11351.  
  11352. /*!
  11353.  * jQuery UI Selectmenu 1.11.4
  11354.  * http://jqueryui.com
  11355.  *
  11356.  * Copyright jQuery Foundation and other contributors
  11357.  * Released under the MIT license.
  11358.  * http://jquery.org/license
  11359.  *
  11360.  * http://api.jqueryui.com/selectmenu
  11361.  */
  11362.  
  11363.  
  11364. var selectmenu = $.widget( "ui.selectmenu", {
  11365.     version: "1.11.4",
  11366.     defaultElement: "<select>",
  11367.     options: {
  11368.         appendTo: null,
  11369.         disabled: null,
  11370.         icons: {
  11371.             button: "ui-icon-triangle-1-s"
  11372.         },
  11373.         position: {
  11374.             my: "left top",
  11375.             at: "left bottom",
  11376.             collision: "none"
  11377.         },
  11378.         width: null,
  11379.  
  11380.         // callbacks
  11381.         change: null,
  11382.         close: null,
  11383.         focus: null,
  11384.         open: null,
  11385.         select: null
  11386.     },
  11387.  
  11388.     _create: function() {
  11389.         var selectmenuId = this.element.uniqueId().attr( "id" );
  11390.         this.ids = {
  11391.             element: selectmenuId,
  11392.             button: selectmenuId + "-button",
  11393.             menu: selectmenuId + "-menu"
  11394.         };
  11395.  
  11396.         this._drawButton();
  11397.         this._drawMenu();
  11398.  
  11399.         if ( this.options.disabled ) {
  11400.             this.disable();
  11401.         }
  11402.     },
  11403.  
  11404.     _drawButton: function() {
  11405.         var that = this;
  11406.  
  11407.         // Associate existing label with the new button
  11408.         this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
  11409.         this._on( this.label, {
  11410.             click: function( event ) {
  11411.                 this.button.focus();
  11412.                 event.preventDefault();
  11413.             }
  11414.         });
  11415.  
  11416.         // Hide original select element
  11417.         this.element.hide();
  11418.  
  11419.         // Create button
  11420.         this.button = $( "<span>", {
  11421.             "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
  11422.             tabindex: this.options.disabled ? -1 : 0,
  11423.             id: this.ids.button,
  11424.             role: "combobox",
  11425.             "aria-expanded": "false",
  11426.             "aria-autocomplete": "list",
  11427.             "aria-owns": this.ids.menu,
  11428.             "aria-haspopup": "true"
  11429.         })
  11430.             .insertAfter( this.element );
  11431.  
  11432.         $( "<span>", {
  11433.             "class": "ui-icon " + this.options.icons.button
  11434.         })
  11435.             .prependTo( this.button );
  11436.  
  11437.         this.buttonText = $( "<span>", {
  11438.             "class": "ui-selectmenu-text"
  11439.         })
  11440.             .appendTo( this.button );
  11441.  
  11442.         this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
  11443.         this._resizeButton();
  11444.  
  11445.         this._on( this.button, this._buttonEvents );
  11446.         this.button.one( "focusin", function() {
  11447.  
  11448.             // Delay rendering the menu items until the button receives focus.
  11449.             // The menu may have already been rendered via a programmatic open.
  11450.             if ( !that.menuItems ) {
  11451.                 that._refreshMenu();
  11452.             }
  11453.         });
  11454.         this._hoverable( this.button );
  11455.         this._focusable( this.button );
  11456.     },
  11457.  
  11458.     _drawMenu: function() {
  11459.         var that = this;
  11460.  
  11461.         // Create menu
  11462.         this.menu = $( "<ul>", {
  11463.             "aria-hidden": "true",
  11464.             "aria-labelledby": this.ids.button,
  11465.             id: this.ids.menu
  11466.         });
  11467.  
  11468.         // Wrap menu
  11469.         this.menuWrap = $( "<div>", {
  11470.             "class": "ui-selectmenu-menu ui-front"
  11471.         })
  11472.             .append( this.menu )
  11473.             .appendTo( this._appendTo() );
  11474.  
  11475.         // Initialize menu widget
  11476.         this.menuInstance = this.menu
  11477.             .menu({
  11478.                 role: "listbox",
  11479.                 select: function( event, ui ) {
  11480.                     event.preventDefault();
  11481.  
  11482.                     // support: IE8
  11483.                     // If the item was selected via a click, the text selection
  11484.                     // will be destroyed in IE
  11485.                     that._setSelection();
  11486.  
  11487.                     that._select( ui.item.data( "ui-selectmenu-item" ), event );
  11488.                 },
  11489.                 focus: function( event, ui ) {
  11490.                     var item = ui.item.data( "ui-selectmenu-item" );
  11491.  
  11492.                     // Prevent inital focus from firing and check if its a newly focused item
  11493.                     if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  11494.                         that._trigger( "focus", event, { item: item } );
  11495.                         if ( !that.isOpen ) {
  11496.                             that._select( item, event );
  11497.                         }
  11498.                     }
  11499.                     that.focusIndex = item.index;
  11500.  
  11501.                     that.button.attr( "aria-activedescendant",
  11502.                         that.menuItems.eq( item.index ).attr( "id" ) );
  11503.                 }
  11504.             })
  11505.             .menu( "instance" );
  11506.  
  11507.         // Adjust menu styles to dropdown
  11508.         this.menu
  11509.             .addClass( "ui-corner-bottom" )
  11510.             .removeClass( "ui-corner-all" );
  11511.  
  11512.         // Don't close the menu on mouseleave
  11513.         this.menuInstance._off( this.menu, "mouseleave" );
  11514.  
  11515.         // Cancel the menu's collapseAll on document click
  11516.         this.menuInstance._closeOnDocumentClick = function() {
  11517.             return false;
  11518.         };
  11519.  
  11520.         // Selects often contain empty items, but never contain dividers
  11521.         this.menuInstance._isDivider = function() {
  11522.             return false;
  11523.         };
  11524.     },
  11525.  
  11526.     refresh: function() {
  11527.         this._refreshMenu();
  11528.         this._setText( this.buttonText, this._getSelectedItem().text() );
  11529.         if ( !this.options.width ) {
  11530.             this._resizeButton();
  11531.         }
  11532.     },
  11533.  
  11534.     _refreshMenu: function() {
  11535.         this.menu.empty();
  11536.  
  11537.         var item,
  11538.             options = this.element.find( "option" );
  11539.  
  11540.         if ( !options.length ) {
  11541.             return;
  11542.         }
  11543.  
  11544.         this._parseOptions( options );
  11545.         this._renderMenu( this.menu, this.items );
  11546.  
  11547.         this.menuInstance.refresh();
  11548.         this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
  11549.  
  11550.         item = this._getSelectedItem();
  11551.  
  11552.         // Update the menu to have the correct item focused
  11553.         this.menuInstance.focus( null, item );
  11554.         this._setAria( item.data( "ui-selectmenu-item" ) );
  11555.  
  11556.         // Set disabled state
  11557.         this._setOption( "disabled", this.element.prop( "disabled" ) );
  11558.     },
  11559.  
  11560.     open: function( event ) {
  11561.         if ( this.options.disabled ) {
  11562.             return;
  11563.         }
  11564.  
  11565.         // If this is the first time the menu is being opened, render the items
  11566.         if ( !this.menuItems ) {
  11567.             this._refreshMenu();
  11568.         } else {
  11569.  
  11570.             // Menu clears focus on close, reset focus to selected item
  11571.             this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
  11572.             this.menuInstance.focus( null, this._getSelectedItem() );
  11573.         }
  11574.  
  11575.         this.isOpen = true;
  11576.         this._toggleAttr();
  11577.         this._resizeMenu();
  11578.         this._position();
  11579.  
  11580.         this._on( this.document, this._documentClick );
  11581.  
  11582.         this._trigger( "open", event );
  11583.     },
  11584.  
  11585.     _position: function() {
  11586.         this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  11587.     },
  11588.  
  11589.     close: function( event ) {
  11590.         if ( !this.isOpen ) {
  11591.             return;
  11592.         }
  11593.  
  11594.         this.isOpen = false;
  11595.         this._toggleAttr();
  11596.  
  11597.         this.range = null;
  11598.         this._off( this.document );
  11599.  
  11600.         this._trigger( "close", event );
  11601.     },
  11602.  
  11603.     widget: function() {
  11604.         return this.button;
  11605.     },
  11606.  
  11607.     menuWidget: function() {
  11608.         return this.menu;
  11609.     },
  11610.  
  11611.     _renderMenu: function( ul, items ) {
  11612.         var that = this,
  11613.             currentOptgroup = "";
  11614.  
  11615.         $.each( items, function( index, item ) {
  11616.             if ( item.optgroup !== currentOptgroup ) {
  11617.                 $( "<li>", {
  11618.                     "class": "ui-selectmenu-optgroup ui-menu-divider" +
  11619.                         ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  11620.                             " ui-state-disabled" :
  11621.                             "" ),
  11622.                     text: item.optgroup
  11623.                 })
  11624.                     .appendTo( ul );
  11625.  
  11626.                 currentOptgroup = item.optgroup;
  11627.             }
  11628.  
  11629.             that._renderItemData( ul, item );
  11630.         });
  11631.     },
  11632.  
  11633.     _renderItemData: function( ul, item ) {
  11634.         return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  11635.     },
  11636.  
  11637.     _renderItem: function( ul, item ) {
  11638.         var li = $( "<li>" );
  11639.  
  11640.         if ( item.disabled ) {
  11641.             li.addClass( "ui-state-disabled" );
  11642.         }
  11643.         this._setText( li, item.label );
  11644.  
  11645.         return li.appendTo( ul );
  11646.     },
  11647.  
  11648.     _setText: function( element, value ) {
  11649.         if ( value ) {
  11650.             element.text( value );
  11651.         } else {
  11652.             element.html( "&#160;" );
  11653.         }
  11654.     },
  11655.  
  11656.     _move: function( direction, event ) {
  11657.         var item, next,
  11658.             filter = ".ui-menu-item";
  11659.  
  11660.         if ( this.isOpen ) {
  11661.             item = this.menuItems.eq( this.focusIndex );
  11662.         } else {
  11663.             item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
  11664.             filter += ":not(.ui-state-disabled)";
  11665.         }
  11666.  
  11667.         if ( direction === "first" || direction === "last" ) {
  11668.             next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  11669.         } else {
  11670.             next = item[ direction + "All" ]( filter ).eq( 0 );
  11671.         }
  11672.  
  11673.         if ( next.length ) {
  11674.             this.menuInstance.focus( event, next );
  11675.         }
  11676.     },
  11677.  
  11678.     _getSelectedItem: function() {
  11679.         return this.menuItems.eq( this.element[ 0 ].selectedIndex );
  11680.     },
  11681.  
  11682.     _toggle: function( event ) {
  11683.         this[ this.isOpen ? "close" : "open" ]( event );
  11684.     },
  11685.  
  11686.     _setSelection: function() {
  11687.         var selection;
  11688.  
  11689.         if ( !this.range ) {
  11690.             return;
  11691.         }
  11692.  
  11693.         if ( window.getSelection ) {
  11694.             selection = window.getSelection();
  11695.             selection.removeAllRanges();
  11696.             selection.addRange( this.range );
  11697.  
  11698.         // support: IE8
  11699.         } else {
  11700.             this.range.select();
  11701.         }
  11702.  
  11703.         // support: IE
  11704.         // Setting the text selection kills the button focus in IE, but
  11705.         // restoring the focus doesn't kill the selection.
  11706.         this.button.focus();
  11707.     },
  11708.  
  11709.     _documentClick: {
  11710.         mousedown: function( event ) {
  11711.             if ( !this.isOpen ) {
  11712.                 return;
  11713.             }
  11714.  
  11715.             if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
  11716.                 this.close( event );
  11717.             }
  11718.         }
  11719.     },
  11720.  
  11721.     _buttonEvents: {
  11722.  
  11723.         // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11724.         mousedown: function() {
  11725.             var selection;
  11726.  
  11727.             if ( window.getSelection ) {
  11728.                 selection = window.getSelection();
  11729.                 if ( selection.rangeCount ) {
  11730.                     this.range = selection.getRangeAt( 0 );
  11731.                 }
  11732.  
  11733.             // support: IE8
  11734.             } else {
  11735.                 this.range = document.selection.createRange();
  11736.             }
  11737.         },
  11738.  
  11739.         click: function( event ) {
  11740.             this._setSelection();
  11741.             this._toggle( event );
  11742.         },
  11743.  
  11744.         keydown: function( event ) {
  11745.             var preventDefault = true;
  11746.             switch ( event.keyCode ) {
  11747.                 case $.ui.keyCode.TAB:
  11748.                 case $.ui.keyCode.ESCAPE:
  11749.                     this.close( event );
  11750.                     preventDefault = false;
  11751.                     break;
  11752.                 case $.ui.keyCode.ENTER:
  11753.                     if ( this.isOpen ) {
  11754.                         this._selectFocusedItem( event );
  11755.                     }
  11756.                     break;
  11757.                 case $.ui.keyCode.UP:
  11758.                     if ( event.altKey ) {
  11759.                         this._toggle( event );
  11760.                     } else {
  11761.                         this._move( "prev", event );
  11762.                     }
  11763.                     break;
  11764.                 case $.ui.keyCode.DOWN:
  11765.                     if ( event.altKey ) {
  11766.                         this._toggle( event );
  11767.                     } else {
  11768.                         this._move( "next", event );
  11769.                     }
  11770.                     break;
  11771.                 case $.ui.keyCode.SPACE:
  11772.                     if ( this.isOpen ) {
  11773.                         this._selectFocusedItem( event );
  11774.                     } else {
  11775.                         this._toggle( event );
  11776.                     }
  11777.                     break;
  11778.                 case $.ui.keyCode.LEFT:
  11779.                     this._move( "prev", event );
  11780.                     break;
  11781.                 case $.ui.keyCode.RIGHT:
  11782.                     this._move( "next", event );
  11783.                     break;
  11784.                 case $.ui.keyCode.HOME:
  11785.                 case $.ui.keyCode.PAGE_UP:
  11786.                     this._move( "first", event );
  11787.                     break;
  11788.                 case $.ui.keyCode.END:
  11789.                 case $.ui.keyCode.PAGE_DOWN:
  11790.                     this._move( "last", event );
  11791.                     break;
  11792.                 default:
  11793.                     this.menu.trigger( event );
  11794.                     preventDefault = false;
  11795.             }
  11796.  
  11797.             if ( preventDefault ) {
  11798.                 event.preventDefault();
  11799.             }
  11800.         }
  11801.     },
  11802.  
  11803.     _selectFocusedItem: function( event ) {
  11804.         var item = this.menuItems.eq( this.focusIndex );
  11805.         if ( !item.hasClass( "ui-state-disabled" ) ) {
  11806.             this._select( item.data( "ui-selectmenu-item" ), event );
  11807.         }
  11808.     },
  11809.  
  11810.     _select: function( item, event ) {
  11811.         var oldIndex = this.element[ 0 ].selectedIndex;
  11812.  
  11813.         // Change native select element
  11814.         this.element[ 0 ].selectedIndex = item.index;
  11815.         this._setText( this.buttonText, item.label );
  11816.         this._setAria( item );
  11817.         this._trigger( "select", event, { item: item } );
  11818.  
  11819.         if ( item.index !== oldIndex ) {
  11820.             this._trigger( "change", event, { item: item } );
  11821.         }
  11822.  
  11823.         this.close( event );
  11824.     },
  11825.  
  11826.     _setAria: function( item ) {
  11827.         var id = this.menuItems.eq( item.index ).attr( "id" );
  11828.  
  11829.         this.button.attr({
  11830.             "aria-labelledby": id,
  11831.             "aria-activedescendant": id
  11832.         });
  11833.         this.menu.attr( "aria-activedescendant", id );
  11834.     },
  11835.  
  11836.     _setOption: function( key, value ) {
  11837.         if ( key === "icons" ) {
  11838.             this.button.find( "span.ui-icon" )
  11839.                 .removeClass( this.options.icons.button )
  11840.                 .addClass( value.button );
  11841.         }
  11842.  
  11843.         this._super( key, value );
  11844.  
  11845.         if ( key === "appendTo" ) {
  11846.             this.menuWrap.appendTo( this._appendTo() );
  11847.         }
  11848.  
  11849.         if ( key === "disabled" ) {
  11850.             this.menuInstance.option( "disabled", value );
  11851.             this.button
  11852.                 .toggleClass( "ui-state-disabled", value )
  11853.                 .attr( "aria-disabled", value );
  11854.  
  11855.             this.element.prop( "disabled", value );
  11856.             if ( value ) {
  11857.                 this.button.attr( "tabindex", -1 );
  11858.                 this.close();
  11859.             } else {
  11860.                 this.button.attr( "tabindex", 0 );
  11861.             }
  11862.         }
  11863.  
  11864.         if ( key === "width" ) {
  11865.             this._resizeButton();
  11866.         }
  11867.     },
  11868.  
  11869.     _appendTo: function() {
  11870.         var element = this.options.appendTo;
  11871.  
  11872.         if ( element ) {
  11873.             element = element.jquery || element.nodeType ?
  11874.                 $( element ) :
  11875.                 this.document.find( element ).eq( 0 );
  11876.         }
  11877.  
  11878.         if ( !element || !element[ 0 ] ) {
  11879.             element = this.element.closest( ".ui-front" );
  11880.         }
  11881.  
  11882.         if ( !element.length ) {
  11883.             element = this.document[ 0 ].body;
  11884.         }
  11885.  
  11886.         return element;
  11887.     },
  11888.  
  11889.     _toggleAttr: function() {
  11890.         this.button
  11891.             .toggleClass( "ui-corner-top", this.isOpen )
  11892.             .toggleClass( "ui-corner-all", !this.isOpen )
  11893.             .attr( "aria-expanded", this.isOpen );
  11894.         this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
  11895.         this.menu.attr( "aria-hidden", !this.isOpen );
  11896.     },
  11897.  
  11898.     _resizeButton: function() {
  11899.         var width = this.options.width;
  11900.  
  11901.         if ( !width ) {
  11902.             width = this.element.show().outerWidth();
  11903.             this.element.hide();
  11904.         }
  11905.  
  11906.         this.button.outerWidth( width );
  11907.     },
  11908.  
  11909.     _resizeMenu: function() {
  11910.         this.menu.outerWidth( Math.max(
  11911.             this.button.outerWidth(),
  11912.  
  11913.             // support: IE10
  11914.             // IE10 wraps long text (possibly a rounding bug)
  11915.             // so we add 1px to avoid the wrapping
  11916.             this.menu.width( "" ).outerWidth() + 1
  11917.         ) );
  11918.     },
  11919.  
  11920.     _getCreateOptions: function() {
  11921.         return { disabled: this.element.prop( "disabled" ) };
  11922.     },
  11923.  
  11924.     _parseOptions: function( options ) {
  11925.         var data = [];
  11926.         options.each(function( index, item ) {
  11927.             var option = $( item ),
  11928.                 optgroup = option.parent( "optgroup" );
  11929.             data.push({
  11930.                 element: option,
  11931.                 index: index,
  11932.                 value: option.val(),
  11933.                 label: option.text(),
  11934.                 optgroup: optgroup.attr( "label" ) || "",
  11935.                 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  11936.             });
  11937.         });
  11938.         this.items = data;
  11939.     },
  11940.  
  11941.     _destroy: function() {
  11942.         this.menuWrap.remove();
  11943.         this.button.remove();
  11944.         this.element.show();
  11945.         this.element.removeUniqueId();
  11946.         this.label.attr( "for", this.ids.element );
  11947.     }
  11948. });
  11949.  
  11950.  
  11951. /*!
  11952.  * jQuery UI Slider 1.11.4
  11953.  * http://jqueryui.com
  11954.  *
  11955.  * Copyright jQuery Foundation and other contributors
  11956.  * Released under the MIT license.
  11957.  * http://jquery.org/license
  11958.  *
  11959.  * http://api.jqueryui.com/slider/
  11960.  */
  11961.  
  11962.  
  11963. var slider = $.widget( "ui.slider", $.ui.mouse, {
  11964.     version: "1.11.4",
  11965.     widgetEventPrefix: "slide",
  11966.  
  11967.     options: {
  11968.         animate: false,
  11969.         distance: 0,
  11970.         max: 100,
  11971.         min: 0,
  11972.         orientation: "horizontal",
  11973.         range: false,
  11974.         step: 1,
  11975.         value: 0,
  11976.         values: null,
  11977.  
  11978.         // callbacks
  11979.         change: null,
  11980.         slide: null,
  11981.         start: null,
  11982.         stop: null
  11983.     },
  11984.  
  11985.     // number of pages in a slider
  11986.     // (how many times can you page up/down to go through the whole range)
  11987.     numPages: 5,
  11988.  
  11989.     _create: function() {
  11990.         this._keySliding = false;
  11991.         this._mouseSliding = false;
  11992.         this._animateOff = true;
  11993.         this._handleIndex = null;
  11994.         this._detectOrientation();
  11995.         this._mouseInit();
  11996.         this._calculateNewMax();
  11997.  
  11998.         this.element
  11999.             .addClass( "ui-slider" +
  12000.                 " ui-slider-" + this.orientation +
  12001.                 " ui-widget" +
  12002.                 " ui-widget-content" +
  12003.                 " ui-corner-all");
  12004.  
  12005.         this._refresh();
  12006.         this._setOption( "disabled", this.options.disabled );
  12007.  
  12008.         this._animateOff = false;
  12009.     },
  12010.  
  12011.     _refresh: function() {
  12012.         this._createRange();
  12013.         this._createHandles();
  12014.         this._setupEvents();
  12015.         this._refreshValue();
  12016.     },
  12017.  
  12018.     _createHandles: function() {
  12019.         var i, handleCount,
  12020.             options = this.options,
  12021.             existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
  12022.             handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
  12023.             handles = [];
  12024.  
  12025.         handleCount = ( options.values && options.values.length ) || 1;
  12026.  
  12027.         if ( existingHandles.length > handleCount ) {
  12028.             existingHandles.slice( handleCount ).remove();
  12029.             existingHandles = existingHandles.slice( 0, handleCount );
  12030.         }
  12031.  
  12032.         for ( i = existingHandles.length; i < handleCount; i++ ) {
  12033.             handles.push( handle );
  12034.         }
  12035.  
  12036.         this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  12037.  
  12038.         this.handle = this.handles.eq( 0 );
  12039.  
  12040.         this.handles.each(function( i ) {
  12041.             $( this ).data( "ui-slider-handle-index", i );
  12042.         });
  12043.     },
  12044.  
  12045.     _createRange: function() {
  12046.         var options = this.options,
  12047.             classes = "";
  12048.  
  12049.         if ( options.range ) {
  12050.             if ( options.range === true ) {
  12051.                 if ( !options.values ) {
  12052.                     options.values = [ this._valueMin(), this._valueMin() ];
  12053.                 } else if ( options.values.length && options.values.length !== 2 ) {
  12054.                     options.values = [ options.values[0], options.values[0] ];
  12055.                 } else if ( $.isArray( options.values ) ) {
  12056.                     options.values = options.values.slice(0);
  12057.                 }
  12058.             }
  12059.  
  12060.             if ( !this.range || !this.range.length ) {
  12061.                 this.range = $( "<div></div>" )
  12062.                     .appendTo( this.element );
  12063.  
  12064.                 classes = "ui-slider-range" +
  12065.                 // note: this isn't the most fittingly semantic framework class for this element,
  12066.                 // but worked best visually with a variety of themes
  12067.                 " ui-widget-header ui-corner-all";
  12068.             } else {
  12069.                 this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
  12070.                     // Handle range switching from true to min/max
  12071.                     .css({
  12072.                         "left": "",
  12073.                         "bottom": ""
  12074.                     });
  12075.             }
  12076.  
  12077.             this.range.addClass( classes +
  12078.                 ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
  12079.         } else {
  12080.             if ( this.range ) {
  12081.                 this.range.remove();
  12082.             }
  12083.             this.range = null;
  12084.         }
  12085.     },
  12086.  
  12087.     _setupEvents: function() {
  12088.         this._off( this.handles );
  12089.         this._on( this.handles, this._handleEvents );
  12090.         this._hoverable( this.handles );
  12091.         this._focusable( this.handles );
  12092.     },
  12093.  
  12094.     _destroy: function() {
  12095.         this.handles.remove();
  12096.         if ( this.range ) {
  12097.             this.range.remove();
  12098.         }
  12099.  
  12100.         this.element
  12101.             .removeClass( "ui-slider" +
  12102.                 " ui-slider-horizontal" +
  12103.                 " ui-slider-vertical" +
  12104.                 " ui-widget" +
  12105.                 " ui-widget-content" +
  12106.                 " ui-corner-all" );
  12107.  
  12108.         this._mouseDestroy();
  12109.     },
  12110.  
  12111.     _mouseCapture: function( event ) {
  12112.         var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  12113.             that = this,
  12114.             o = this.options;
  12115.  
  12116.         if ( o.disabled ) {
  12117.             return false;
  12118.         }
  12119.  
  12120.         this.elementSize = {
  12121.             width: this.element.outerWidth(),
  12122.             height: this.element.outerHeight()
  12123.         };
  12124.         this.elementOffset = this.element.offset();
  12125.  
  12126.         position = { x: event.pageX, y: event.pageY };
  12127.         normValue = this._normValueFromMouse( position );
  12128.         distance = this._valueMax() - this._valueMin() + 1;
  12129.         this.handles.each(function( i ) {
  12130.             var thisDistance = Math.abs( normValue - that.values(i) );
  12131.             if (( distance > thisDistance ) ||
  12132.                 ( distance === thisDistance &&
  12133.                     (i === that._lastChangedValue || that.values(i) === o.min ))) {
  12134.                 distance = thisDistance;
  12135.                 closestHandle = $( this );
  12136.                 index = i;
  12137.             }
  12138.         });
  12139.  
  12140.         allowed = this._start( event, index );
  12141.         if ( allowed === false ) {
  12142.             return false;
  12143.         }
  12144.         this._mouseSliding = true;
  12145.  
  12146.         this._handleIndex = index;
  12147.  
  12148.         closestHandle
  12149.             .addClass( "ui-state-active" )
  12150.             .focus();
  12151.  
  12152.         offset = closestHandle.offset();
  12153.         mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  12154.         this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  12155.             left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  12156.             top: event.pageY - offset.top -
  12157.                 ( closestHandle.height() / 2 ) -
  12158.                 ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
  12159.                 ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
  12160.                 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
  12161.         };
  12162.  
  12163.         if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  12164.             this._slide( event, index, normValue );
  12165.         }
  12166.         this._animateOff = true;
  12167.         return true;
  12168.     },
  12169.  
  12170.     _mouseStart: function() {
  12171.         return true;
  12172.     },
  12173.  
  12174.     _mouseDrag: function( event ) {
  12175.         var position = { x: event.pageX, y: event.pageY },
  12176.             normValue = this._normValueFromMouse( position );
  12177.  
  12178.         this._slide( event, this._handleIndex, normValue );
  12179.  
  12180.         return false;
  12181.     },
  12182.  
  12183.     _mouseStop: function( event ) {
  12184.         this.handles.removeClass( "ui-state-active" );
  12185.         this._mouseSliding = false;
  12186.  
  12187.         this._stop( event, this._handleIndex );
  12188.         this._change( event, this._handleIndex );
  12189.  
  12190.         this._handleIndex = null;
  12191.         this._clickOffset = null;
  12192.         this._animateOff = false;
  12193.  
  12194.         return false;
  12195.     },
  12196.  
  12197.     _detectOrientation: function() {
  12198.         this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  12199.     },
  12200.  
  12201.     _normValueFromMouse: function( position ) {
  12202.         var pixelTotal,
  12203.             pixelMouse,
  12204.             percentMouse,
  12205.             valueTotal,
  12206.             valueMouse;
  12207.  
  12208.         if ( this.orientation === "horizontal" ) {
  12209.             pixelTotal = this.elementSize.width;
  12210.             pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
  12211.         } else {
  12212.             pixelTotal = this.elementSize.height;
  12213.             pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
  12214.         }
  12215.  
  12216.         percentMouse = ( pixelMouse / pixelTotal );
  12217.         if ( percentMouse > 1 ) {
  12218.             percentMouse = 1;
  12219.         }
  12220.         if ( percentMouse < 0 ) {
  12221.             percentMouse = 0;
  12222.         }
  12223.         if ( this.orientation === "vertical" ) {
  12224.             percentMouse = 1 - percentMouse;
  12225.         }
  12226.  
  12227.         valueTotal = this._valueMax() - this._valueMin();
  12228.         valueMouse = this._valueMin() + percentMouse * valueTotal;
  12229.  
  12230.         return this._trimAlignValue( valueMouse );
  12231.     },
  12232.  
  12233.     _start: function( event, index ) {
  12234.         var uiHash = {
  12235.             handle: this.handles[ index ],
  12236.             value: this.value()
  12237.         };
  12238.         if ( this.options.values && this.options.values.length ) {
  12239.             uiHash.value = this.values( index );
  12240.             uiHash.values = this.values();
  12241.         }
  12242.         return this._trigger( "start", event, uiHash );
  12243.     },
  12244.  
  12245.     _slide: function( event, index, newVal ) {
  12246.         var otherVal,
  12247.             newValues,
  12248.             allowed;
  12249.  
  12250.         if ( this.options.values && this.options.values.length ) {
  12251.             otherVal = this.values( index ? 0 : 1 );
  12252.  
  12253.             if ( ( this.options.values.length === 2 && this.options.range === true ) &&
  12254.                     ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
  12255.                 ) {
  12256.                 newVal = otherVal;
  12257.             }
  12258.  
  12259.             if ( newVal !== this.values( index ) ) {
  12260.                 newValues = this.values();
  12261.                 newValues[ index ] = newVal;
  12262.                 // A slide can be canceled by returning false from the slide callback
  12263.                 allowed = this._trigger( "slide", event, {
  12264.                     handle: this.handles[ index ],
  12265.                     value: newVal,
  12266.                     values: newValues
  12267.                 } );
  12268.                 otherVal = this.values( index ? 0 : 1 );
  12269.                 if ( allowed !== false ) {
  12270.                     this.values( index, newVal );
  12271.                 }
  12272.             }
  12273.         } else {
  12274.             if ( newVal !== this.value() ) {
  12275.                 // A slide can be canceled by returning false from the slide callback
  12276.                 allowed = this._trigger( "slide", event, {
  12277.                     handle: this.handles[ index ],
  12278.                     value: newVal
  12279.                 } );
  12280.                 if ( allowed !== false ) {
  12281.                     this.value( newVal );
  12282.                 }
  12283.             }
  12284.         }
  12285.     },
  12286.  
  12287.     _stop: function( event, index ) {
  12288.         var uiHash = {
  12289.             handle: this.handles[ index ],
  12290.             value: this.value()
  12291.         };
  12292.         if ( this.options.values && this.options.values.length ) {
  12293.             uiHash.value = this.values( index );
  12294.             uiHash.values = this.values();
  12295.         }
  12296.  
  12297.         this._trigger( "stop", event, uiHash );
  12298.     },
  12299.  
  12300.     _change: function( event, index ) {
  12301.         if ( !this._keySliding && !this._mouseSliding ) {
  12302.             var uiHash = {
  12303.                 handle: this.handles[ index ],
  12304.                 value: this.value()
  12305.             };
  12306.             if ( this.options.values && this.options.values.length ) {
  12307.                 uiHash.value = this.values( index );
  12308.                 uiHash.values = this.values();
  12309.             }
  12310.  
  12311.             //store the last changed value index for reference when handles overlap
  12312.             this._lastChangedValue = index;
  12313.  
  12314.             this._trigger( "change", event, uiHash );
  12315.         }
  12316.     },
  12317.  
  12318.     value: function( newValue ) {
  12319.         if ( arguments.length ) {
  12320.             this.options.value = this._trimAlignValue( newValue );
  12321.             this._refreshValue();
  12322.             this._change( null, 0 );
  12323.             return;
  12324.         }
  12325.  
  12326.         return this._value();
  12327.     },
  12328.  
  12329.     values: function( index, newValue ) {
  12330.         var vals,
  12331.             newValues,
  12332.             i;
  12333.  
  12334.         if ( arguments.length > 1 ) {
  12335.             this.options.values[ index ] = this._trimAlignValue( newValue );
  12336.             this._refreshValue();
  12337.             this._change( null, index );
  12338.             return;
  12339.         }
  12340.  
  12341.         if ( arguments.length ) {
  12342.             if ( $.isArray( arguments[ 0 ] ) ) {
  12343.                 vals = this.options.values;
  12344.                 newValues = arguments[ 0 ];
  12345.                 for ( i = 0; i < vals.length; i += 1 ) {
  12346.                     vals[ i ] = this._trimAlignValue( newValues[ i ] );
  12347.                     this._change( null, i );
  12348.                 }
  12349.                 this._refreshValue();
  12350.             } else {
  12351.                 if ( this.options.values && this.options.values.length ) {
  12352.                     return this._values( index );
  12353.                 } else {
  12354.                     return this.value();
  12355.                 }
  12356.             }
  12357.         } else {
  12358.             return this._values();
  12359.         }
  12360.     },
  12361.  
  12362.     _setOption: function( key, value ) {
  12363.         var i,
  12364.             valsLength = 0;
  12365.  
  12366.         if ( key === "range" && this.options.range === true ) {
  12367.             if ( value === "min" ) {
  12368.                 this.options.value = this._values( 0 );
  12369.                 this.options.values = null;
  12370.             } else if ( value === "max" ) {
  12371.                 this.options.value = this._values( this.options.values.length - 1 );
  12372.                 this.options.values = null;
  12373.             }
  12374.         }
  12375.  
  12376.         if ( $.isArray( this.options.values ) ) {
  12377.             valsLength = this.options.values.length;
  12378.         }
  12379.  
  12380.         if ( key === "disabled" ) {
  12381.             this.element.toggleClass( "ui-state-disabled", !!value );
  12382.         }
  12383.  
  12384.         this._super( key, value );
  12385.  
  12386.         switch ( key ) {
  12387.             case "orientation":
  12388.                 this._detectOrientation();
  12389.                 this.element
  12390.                     .removeClass( "ui-slider-horizontal ui-slider-vertical" )
  12391.                     .addClass( "ui-slider-" + this.orientation );
  12392.                 this._refreshValue();
  12393.  
  12394.                 // Reset positioning from previous orientation
  12395.                 this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  12396.                 break;
  12397.             case "value":
  12398.                 this._animateOff = true;
  12399.                 this._refreshValue();
  12400.                 this._change( null, 0 );
  12401.                 this._animateOff = false;
  12402.                 break;
  12403.             case "values":
  12404.                 this._animateOff = true;
  12405.                 this._refreshValue();
  12406.                 for ( i = 0; i < valsLength; i += 1 ) {
  12407.                     this._change( null, i );
  12408.                 }
  12409.                 this._animateOff = false;
  12410.                 break;
  12411.             case "step":
  12412.             case "min":
  12413.             case "max":
  12414.                 this._animateOff = true;
  12415.                 this._calculateNewMax();
  12416.                 this._refreshValue();
  12417.                 this._animateOff = false;
  12418.                 break;
  12419.             case "range":
  12420.                 this._animateOff = true;
  12421.                 this._refresh();
  12422.                 this._animateOff = false;
  12423.                 break;
  12424.         }
  12425.     },
  12426.  
  12427.     //internal value getter
  12428.     // _value() returns value trimmed by min and max, aligned by step
  12429.     _value: function() {
  12430.         var val = this.options.value;
  12431.         val = this._trimAlignValue( val );
  12432.  
  12433.         return val;
  12434.     },
  12435.  
  12436.     //internal values getter
  12437.     // _values() returns array of values trimmed by min and max, aligned by step
  12438.     // _values( index ) returns single value trimmed by min and max, aligned by step
  12439.     _values: function( index ) {
  12440.         var val,
  12441.             vals,
  12442.             i;
  12443.  
  12444.         if ( arguments.length ) {
  12445.             val = this.options.values[ index ];
  12446.             val = this._trimAlignValue( val );
  12447.  
  12448.             return val;
  12449.         } else if ( this.options.values && this.options.values.length ) {
  12450.             // .slice() creates a copy of the array
  12451.             // this copy gets trimmed by min and max and then returned
  12452.             vals = this.options.values.slice();
  12453.             for ( i = 0; i < vals.length; i += 1) {
  12454.                 vals[ i ] = this._trimAlignValue( vals[ i ] );
  12455.             }
  12456.  
  12457.             return vals;
  12458.         } else {
  12459.             return [];
  12460.         }
  12461.     },
  12462.  
  12463.     // returns the step-aligned value that val is closest to, between (inclusive) min and max
  12464.     _trimAlignValue: function( val ) {
  12465.         if ( val <= this._valueMin() ) {
  12466.             return this._valueMin();
  12467.         }
  12468.         if ( val >= this._valueMax() ) {
  12469.             return this._valueMax();
  12470.         }
  12471.         var step = ( this.options.step > 0 ) ? this.options.step : 1,
  12472.             valModStep = (val - this._valueMin()) % step,
  12473.             alignValue = val - valModStep;
  12474.  
  12475.         if ( Math.abs(valModStep) * 2 >= step ) {
  12476.             alignValue += ( valModStep > 0 ) ? step : ( -step );
  12477.         }
  12478.  
  12479.         // Since JavaScript has problems with large floats, round
  12480.         // the final value to 5 digits after the decimal point (see #4124)
  12481.         return parseFloat( alignValue.toFixed(5) );
  12482.     },
  12483.  
  12484.     _calculateNewMax: function() {
  12485.         var max = this.options.max,
  12486.             min = this._valueMin(),
  12487.             step = this.options.step,
  12488.             aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
  12489.         max = aboveMin + min;
  12490.         this.max = parseFloat( max.toFixed( this._precision() ) );
  12491.     },
  12492.  
  12493.     _precision: function() {
  12494.         var precision = this._precisionOf( this.options.step );
  12495.         if ( this.options.min !== null ) {
  12496.             precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12497.         }
  12498.         return precision;
  12499.     },
  12500.  
  12501.     _precisionOf: function( num ) {
  12502.         var str = num.toString(),
  12503.             decimal = str.indexOf( "." );
  12504.         return decimal === -1 ? 0 : str.length - decimal - 1;
  12505.     },
  12506.  
  12507.     _valueMin: function() {
  12508.         return this.options.min;
  12509.     },
  12510.  
  12511.     _valueMax: function() {
  12512.         return this.max;
  12513.     },
  12514.  
  12515.     _refreshValue: function() {
  12516.         var lastValPercent, valPercent, value, valueMin, valueMax,
  12517.             oRange = this.options.range,
  12518.             o = this.options,
  12519.             that = this,
  12520.             animate = ( !this._animateOff ) ? o.animate : false,
  12521.             _set = {};
  12522.  
  12523.         if ( this.options.values && this.options.values.length ) {
  12524.             this.handles.each(function( i ) {
  12525.                 valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
  12526.                 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12527.                 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12528.                 if ( that.options.range === true ) {
  12529.                     if ( that.orientation === "horizontal" ) {
  12530.                         if ( i === 0 ) {
  12531.                             that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
  12532.                         }
  12533.                         if ( i === 1 ) {
  12534.                             that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  12535.                         }
  12536.                     } else {
  12537.                         if ( i === 0 ) {
  12538.                             that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
  12539.                         }
  12540.                         if ( i === 1 ) {
  12541.                             that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  12542.                         }
  12543.                     }
  12544.                 }
  12545.                 lastValPercent = valPercent;
  12546.             });
  12547.         } else {
  12548.             value = this.value();
  12549.             valueMin = this._valueMin();
  12550.             valueMax = this._valueMax();
  12551.             valPercent = ( valueMax !== valueMin ) ?
  12552.                     ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  12553.                     0;
  12554.             _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12555.             this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12556.  
  12557.             if ( oRange === "min" && this.orientation === "horizontal" ) {
  12558.                 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
  12559.             }
  12560.             if ( oRange === "max" && this.orientation === "horizontal" ) {
  12561.                 this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  12562.             }
  12563.             if ( oRange === "min" && this.orientation === "vertical" ) {
  12564.                 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
  12565.             }
  12566.             if ( oRange === "max" && this.orientation === "vertical" ) {
  12567.                 this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  12568.             }
  12569.         }
  12570.     },
  12571.  
  12572.     _handleEvents: {
  12573.         keydown: function( event ) {
  12574.             var allowed, curVal, newVal, step,
  12575.                 index = $( event.target ).data( "ui-slider-handle-index" );
  12576.  
  12577.             switch ( event.keyCode ) {
  12578.                 case $.ui.keyCode.HOME:
  12579.                 case $.ui.keyCode.END:
  12580.                 case $.ui.keyCode.PAGE_UP:
  12581.                 case $.ui.keyCode.PAGE_DOWN:
  12582.                 case $.ui.keyCode.UP:
  12583.                 case $.ui.keyCode.RIGHT:
  12584.                 case $.ui.keyCode.DOWN:
  12585.                 case $.ui.keyCode.LEFT:
  12586.                     event.preventDefault();
  12587.                     if ( !this._keySliding ) {
  12588.                         this._keySliding = true;
  12589.                         $( event.target ).addClass( "ui-state-active" );
  12590.                         allowed = this._start( event, index );
  12591.                         if ( allowed === false ) {
  12592.                             return;
  12593.                         }
  12594.                     }
  12595.                     break;
  12596.             }
  12597.  
  12598.             step = this.options.step;
  12599.             if ( this.options.values && this.options.values.length ) {
  12600.                 curVal = newVal = this.values( index );
  12601.             } else {
  12602.                 curVal = newVal = this.value();
  12603.             }
  12604.  
  12605.             switch ( event.keyCode ) {
  12606.                 case $.ui.keyCode.HOME:
  12607.                     newVal = this._valueMin();
  12608.                     break;
  12609.                 case $.ui.keyCode.END:
  12610.                     newVal = this._valueMax();
  12611.                     break;
  12612.                 case $.ui.keyCode.PAGE_UP:
  12613.                     newVal = this._trimAlignValue(
  12614.                         curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  12615.                     );
  12616.                     break;
  12617.                 case $.ui.keyCode.PAGE_DOWN:
  12618.                     newVal = this._trimAlignValue(
  12619.                         curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
  12620.                     break;
  12621.                 case $.ui.keyCode.UP:
  12622.                 case $.ui.keyCode.RIGHT:
  12623.                     if ( curVal === this._valueMax() ) {
  12624.                         return;
  12625.                     }
  12626.                     newVal = this._trimAlignValue( curVal + step );
  12627.                     break;
  12628.                 case $.ui.keyCode.DOWN:
  12629.                 case $.ui.keyCode.LEFT:
  12630.                     if ( curVal === this._valueMin() ) {
  12631.                         return;
  12632.                     }
  12633.                     newVal = this._trimAlignValue( curVal - step );
  12634.                     break;
  12635.             }
  12636.  
  12637.             this._slide( event, index, newVal );
  12638.         },
  12639.         keyup: function( event ) {
  12640.             var index = $( event.target ).data( "ui-slider-handle-index" );
  12641.  
  12642.             if ( this._keySliding ) {
  12643.                 this._keySliding = false;
  12644.                 this._stop( event, index );
  12645.                 this._change( event, index );
  12646.                 $( event.target ).removeClass( "ui-state-active" );
  12647.             }
  12648.         }
  12649.     }
  12650. });
  12651.  
  12652.  
  12653. /*!
  12654.  * jQuery UI Spinner 1.11.4
  12655.  * http://jqueryui.com
  12656.  *
  12657.  * Copyright jQuery Foundation and other contributors
  12658.  * Released under the MIT license.
  12659.  * http://jquery.org/license
  12660.  *
  12661.  * http://api.jqueryui.com/spinner/
  12662.  */
  12663.  
  12664.  
  12665. function spinner_modifier( fn ) {
  12666.     return function() {
  12667.         var previous = this.element.val();
  12668.         fn.apply( this, arguments );
  12669.         this._refresh();
  12670.         if ( previous !== this.element.val() ) {
  12671.             this._trigger( "change" );
  12672.         }
  12673.     };
  12674. }
  12675.  
  12676. var spinner = $.widget( "ui.spinner", {
  12677.     version: "1.11.4",
  12678.     defaultElement: "<input>",
  12679.     widgetEventPrefix: "spin",
  12680.     options: {
  12681.         culture: null,
  12682.         icons: {
  12683.             down: "ui-icon-triangle-1-s",
  12684.             up: "ui-icon-triangle-1-n"
  12685.         },
  12686.         incremental: true,
  12687.         max: null,
  12688.         min: null,
  12689.         numberFormat: null,
  12690.         page: 10,
  12691.         step: 1,
  12692.  
  12693.         change: null,
  12694.         spin: null,
  12695.         start: null,
  12696.         stop: null
  12697.     },
  12698.  
  12699.     _create: function() {
  12700.         // handle string values that need to be parsed
  12701.         this._setOption( "max", this.options.max );
  12702.         this._setOption( "min", this.options.min );
  12703.         this._setOption( "step", this.options.step );
  12704.  
  12705.         // Only format if there is a value, prevents the field from being marked
  12706.         // as invalid in Firefox, see #9573.
  12707.         if ( this.value() !== "" ) {
  12708.             // Format the value, but don't constrain.
  12709.             this._value( this.element.val(), true );
  12710.         }
  12711.  
  12712.         this._draw();
  12713.         this._on( this._events );
  12714.         this._refresh();
  12715.  
  12716.         // turning off autocomplete prevents the browser from remembering the
  12717.         // value when navigating through history, so we re-enable autocomplete
  12718.         // if the page is unloaded before the widget is destroyed. #7790
  12719.         this._on( this.window, {
  12720.             beforeunload: function() {
  12721.                 this.element.removeAttr( "autocomplete" );
  12722.             }
  12723.         });
  12724.     },
  12725.  
  12726.     _getCreateOptions: function() {
  12727.         var options = {},
  12728.             element = this.element;
  12729.  
  12730.         $.each( [ "min", "max", "step" ], function( i, option ) {
  12731.             var value = element.attr( option );
  12732.             if ( value !== undefined && value.length ) {
  12733.                 options[ option ] = value;
  12734.             }
  12735.         });
  12736.  
  12737.         return options;
  12738.     },
  12739.  
  12740.     _events: {
  12741.         keydown: function( event ) {
  12742.             if ( this._start( event ) && this._keydown( event ) ) {
  12743.                 event.preventDefault();
  12744.             }
  12745.         },
  12746.         keyup: "_stop",
  12747.         focus: function() {
  12748.             this.previous = this.element.val();
  12749.         },
  12750.         blur: function( event ) {
  12751.             if ( this.cancelBlur ) {
  12752.                 delete this.cancelBlur;
  12753.                 return;
  12754.             }
  12755.  
  12756.             this._stop();
  12757.             this._refresh();
  12758.             if ( this.previous !== this.element.val() ) {
  12759.                 this._trigger( "change", event );
  12760.             }
  12761.         },
  12762.         mousewheel: function( event, delta ) {
  12763.             if ( !delta ) {
  12764.                 return;
  12765.             }
  12766.             if ( !this.spinning && !this._start( event ) ) {
  12767.                 return false;
  12768.             }
  12769.  
  12770.             this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
  12771.             clearTimeout( this.mousewheelTimer );
  12772.             this.mousewheelTimer = this._delay(function() {
  12773.                 if ( this.spinning ) {
  12774.                     this._stop( event );
  12775.                 }
  12776.             }, 100 );
  12777.             event.preventDefault();
  12778.         },
  12779.         "mousedown .ui-spinner-button": function( event ) {
  12780.             var previous;
  12781.  
  12782.             // We never want the buttons to have focus; whenever the user is
  12783.             // interacting with the spinner, the focus should be on the input.
  12784.             // If the input is focused then this.previous is properly set from
  12785.             // when the input first received focus. If the input is not focused
  12786.             // then we need to set this.previous based on the value before spinning.
  12787.             previous = this.element[0] === this.document[0].activeElement ?
  12788.                 this.previous : this.element.val();
  12789.             function checkFocus() {
  12790.                 var isActive = this.element[0] === this.document[0].activeElement;
  12791.                 if ( !isActive ) {
  12792.                     this.element.focus();
  12793.                     this.previous = previous;
  12794.                     // support: IE
  12795.                     // IE sets focus asynchronously, so we need to check if focus
  12796.                     // moved off of the input because the user clicked on the button.
  12797.                     this._delay(function() {
  12798.                         this.previous = previous;
  12799.                     });
  12800.                 }
  12801.             }
  12802.  
  12803.             // ensure focus is on (or stays on) the text field
  12804.             event.preventDefault();
  12805.             checkFocus.call( this );
  12806.  
  12807.             // support: IE
  12808.             // IE doesn't prevent moving focus even with event.preventDefault()
  12809.             // so we set a flag to know when we should ignore the blur event
  12810.             // and check (again) if focus moved off of the input.
  12811.             this.cancelBlur = true;
  12812.             this._delay(function() {
  12813.                 delete this.cancelBlur;
  12814.                 checkFocus.call( this );
  12815.             });
  12816.  
  12817.             if ( this._start( event ) === false ) {
  12818.                 return;
  12819.             }
  12820.  
  12821.             this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12822.         },
  12823.         "mouseup .ui-spinner-button": "_stop",
  12824.         "mouseenter .ui-spinner-button": function( event ) {
  12825.             // button will add ui-state-active if mouse was down while mouseleave and kept down
  12826.             if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
  12827.                 return;
  12828.             }
  12829.  
  12830.             if ( this._start( event ) === false ) {
  12831.                 return false;
  12832.             }
  12833.             this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12834.         },
  12835.         // TODO: do we really want to consider this a stop?
  12836.         // shouldn't we just stop the repeater and wait until mouseup before
  12837.         // we trigger the stop event?
  12838.         "mouseleave .ui-spinner-button": "_stop"
  12839.     },
  12840.  
  12841.     _draw: function() {
  12842.         var uiSpinner = this.uiSpinner = this.element
  12843.             .addClass( "ui-spinner-input" )
  12844.             .attr( "autocomplete", "off" )
  12845.             .wrap( this._uiSpinnerHtml() )
  12846.             .parent()
  12847.                 // add buttons
  12848.                 .append( this._buttonHtml() );
  12849.  
  12850.         this.element.attr( "role", "spinbutton" );
  12851.  
  12852.         // button bindings
  12853.         this.buttons = uiSpinner.find( ".ui-spinner-button" )
  12854.             .attr( "tabIndex", -1 )
  12855.             .button()
  12856.             .removeClass( "ui-corner-all" );
  12857.  
  12858.         // IE 6 doesn't understand height: 50% for the buttons
  12859.         // unless the wrapper has an explicit height
  12860.         if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
  12861.                 uiSpinner.height() > 0 ) {
  12862.             uiSpinner.height( uiSpinner.height() );
  12863.         }
  12864.  
  12865.         // disable spinner if element was already disabled
  12866.         if ( this.options.disabled ) {
  12867.             this.disable();
  12868.         }
  12869.     },
  12870.  
  12871.     _keydown: function( event ) {
  12872.         var options = this.options,
  12873.             keyCode = $.ui.keyCode;
  12874.  
  12875.         switch ( event.keyCode ) {
  12876.         case keyCode.UP:
  12877.             this._repeat( null, 1, event );
  12878.             return true;
  12879.         case keyCode.DOWN:
  12880.             this._repeat( null, -1, event );
  12881.             return true;
  12882.         case keyCode.PAGE_UP:
  12883.             this._repeat( null, options.page, event );
  12884.             return true;
  12885.         case keyCode.PAGE_DOWN:
  12886.             this._repeat( null, -options.page, event );
  12887.             return true;
  12888.         }
  12889.  
  12890.         return false;
  12891.     },
  12892.  
  12893.     _uiSpinnerHtml: function() {
  12894.         return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
  12895.     },
  12896.  
  12897.     _buttonHtml: function() {
  12898.         return "" +
  12899.             "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
  12900.                 "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
  12901.             "</a>" +
  12902.             "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
  12903.                 "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
  12904.             "</a>";
  12905.     },
  12906.  
  12907.     _start: function( event ) {
  12908.         if ( !this.spinning && this._trigger( "start", event ) === false ) {
  12909.             return false;
  12910.         }
  12911.  
  12912.         if ( !this.counter ) {
  12913.             this.counter = 1;
  12914.         }
  12915.         this.spinning = true;
  12916.         return true;
  12917.     },
  12918.  
  12919.     _repeat: function( i, steps, event ) {
  12920.         i = i || 500;
  12921.  
  12922.         clearTimeout( this.timer );
  12923.         this.timer = this._delay(function() {
  12924.             this._repeat( 40, steps, event );
  12925.         }, i );
  12926.  
  12927.         this._spin( steps * this.options.step, event );
  12928.     },
  12929.  
  12930.     _spin: function( step, event ) {
  12931.         var value = this.value() || 0;
  12932.  
  12933.         if ( !this.counter ) {
  12934.             this.counter = 1;
  12935.         }
  12936.  
  12937.         value = this._adjustValue( value + step * this._increment( this.counter ) );
  12938.  
  12939.         if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
  12940.             this._value( value );
  12941.             this.counter++;
  12942.         }
  12943.     },
  12944.  
  12945.     _increment: function( i ) {
  12946.         var incremental = this.options.incremental;
  12947.  
  12948.         if ( incremental ) {
  12949.             return $.isFunction( incremental ) ?
  12950.                 incremental( i ) :
  12951.                 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
  12952.         }
  12953.  
  12954.         return 1;
  12955.     },
  12956.  
  12957.     _precision: function() {
  12958.         var precision = this._precisionOf( this.options.step );
  12959.         if ( this.options.min !== null ) {
  12960.             precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12961.         }
  12962.         return precision;
  12963.     },
  12964.  
  12965.     _precisionOf: function( num ) {
  12966.         var str = num.toString(),
  12967.             decimal = str.indexOf( "." );
  12968.         return decimal === -1 ? 0 : str.length - decimal - 1;
  12969.     },
  12970.  
  12971.     _adjustValue: function( value ) {
  12972.         var base, aboveMin,
  12973.             options = this.options;
  12974.  
  12975.         // make sure we're at a valid step
  12976.         // - find out where we are relative to the base (min or 0)
  12977.         base = options.min !== null ? options.min : 0;
  12978.         aboveMin = value - base;
  12979.         // - round to the nearest step
  12980.         aboveMin = Math.round(aboveMin / options.step) * options.step;
  12981.         // - rounding is based on 0, so adjust back to our base
  12982.         value = base + aboveMin;
  12983.  
  12984.         // fix precision from bad JS floating point math
  12985.         value = parseFloat( value.toFixed( this._precision() ) );
  12986.  
  12987.         // clamp the value
  12988.         if ( options.max !== null && value > options.max) {
  12989.             return options.max;
  12990.         }
  12991.         if ( options.min !== null && value < options.min ) {
  12992.             return options.min;
  12993.         }
  12994.  
  12995.         return value;
  12996.     },
  12997.  
  12998.     _stop: function( event ) {
  12999.         if ( !this.spinning ) {
  13000.             return;
  13001.         }
  13002.  
  13003.         clearTimeout( this.timer );
  13004.         clearTimeout( this.mousewheelTimer );
  13005.         this.counter = 0;
  13006.         this.spinning = false;
  13007.         this._trigger( "stop", event );
  13008.     },
  13009.  
  13010.     _setOption: function( key, value ) {
  13011.         if ( key === "culture" || key === "numberFormat" ) {
  13012.             var prevValue = this._parse( this.element.val() );
  13013.             this.options[ key ] = value;
  13014.             this.element.val( this._format( prevValue ) );
  13015.             return;
  13016.         }
  13017.  
  13018.         if ( key === "max" || key === "min" || key === "step" ) {
  13019.             if ( typeof value === "string" ) {
  13020.                 value = this._parse( value );
  13021.             }
  13022.         }
  13023.         if ( key === "icons" ) {
  13024.             this.buttons.first().find( ".ui-icon" )
  13025.                 .removeClass( this.options.icons.up )
  13026.                 .addClass( value.up );
  13027.             this.buttons.last().find( ".ui-icon" )
  13028.                 .removeClass( this.options.icons.down )
  13029.                 .addClass( value.down );
  13030.         }
  13031.  
  13032.         this._super( key, value );
  13033.  
  13034.         if ( key === "disabled" ) {
  13035.             this.widget().toggleClass( "ui-state-disabled", !!value );
  13036.             this.element.prop( "disabled", !!value );
  13037.             this.buttons.button( value ? "disable" : "enable" );
  13038.         }
  13039.     },
  13040.  
  13041.     _setOptions: spinner_modifier(function( options ) {
  13042.         this._super( options );
  13043.     }),
  13044.  
  13045.     _parse: function( val ) {
  13046.         if ( typeof val === "string" && val !== "" ) {
  13047.             val = window.Globalize && this.options.numberFormat ?
  13048.                 Globalize.parseFloat( val, 10, this.options.culture ) : +val;
  13049.         }
  13050.         return val === "" || isNaN( val ) ? null : val;
  13051.     },
  13052.  
  13053.     _format: function( value ) {
  13054.         if ( value === "" ) {
  13055.             return "";
  13056.         }
  13057.         return window.Globalize && this.options.numberFormat ?
  13058.             Globalize.format( value, this.options.numberFormat, this.options.culture ) :
  13059.             value;
  13060.     },
  13061.  
  13062.     _refresh: function() {
  13063.         this.element.attr({
  13064.             "aria-valuemin": this.options.min,
  13065.             "aria-valuemax": this.options.max,
  13066.             // TODO: what should we do with values that can't be parsed?
  13067.             "aria-valuenow": this._parse( this.element.val() )
  13068.         });
  13069.     },
  13070.  
  13071.     isValid: function() {
  13072.         var value = this.value();
  13073.  
  13074.         // null is invalid
  13075.         if ( value === null ) {
  13076.             return false;
  13077.         }
  13078.  
  13079.         // if value gets adjusted, it's invalid
  13080.         return value === this._adjustValue( value );
  13081.     },
  13082.  
  13083.     // update the value without triggering change
  13084.     _value: function( value, allowAny ) {
  13085.         var parsed;
  13086.         if ( value !== "" ) {
  13087.             parsed = this._parse( value );
  13088.             if ( parsed !== null ) {
  13089.                 if ( !allowAny ) {
  13090.                     parsed = this._adjustValue( parsed );
  13091.                 }
  13092.                 value = this._format( parsed );
  13093.             }
  13094.         }
  13095.         this.element.val( value );
  13096.         this._refresh();
  13097.     },
  13098.  
  13099.     _destroy: function() {
  13100.         this.element
  13101.             .removeClass( "ui-spinner-input" )
  13102.             .prop( "disabled", false )
  13103.             .removeAttr( "autocomplete" )
  13104.             .removeAttr( "role" )
  13105.             .removeAttr( "aria-valuemin" )
  13106.             .removeAttr( "aria-valuemax" )
  13107.             .removeAttr( "aria-valuenow" );
  13108.         this.uiSpinner.replaceWith( this.element );
  13109.     },
  13110.  
  13111.     stepUp: spinner_modifier(function( steps ) {
  13112.         this._stepUp( steps );
  13113.     }),
  13114.     _stepUp: function( steps ) {
  13115.         if ( this._start() ) {
  13116.             this._spin( (steps || 1) * this.options.step );
  13117.             this._stop();
  13118.         }
  13119.     },
  13120.  
  13121.     stepDown: spinner_modifier(function( steps ) {
  13122.         this._stepDown( steps );
  13123.     }),
  13124.     _stepDown: function( steps ) {
  13125.         if ( this._start() ) {
  13126.             this._spin( (steps || 1) * -this.options.step );
  13127.             this._stop();
  13128.         }
  13129.     },
  13130.  
  13131.     pageUp: spinner_modifier(function( pages ) {
  13132.         this._stepUp( (pages || 1) * this.options.page );
  13133.     }),
  13134.  
  13135.     pageDown: spinner_modifier(function( pages ) {
  13136.         this._stepDown( (pages || 1) * this.options.page );
  13137.     }),
  13138.  
  13139.     value: function( newVal ) {
  13140.         if ( !arguments.length ) {
  13141.             return this._parse( this.element.val() );
  13142.         }
  13143.         spinner_modifier( this._value ).call( this, newVal );
  13144.     },
  13145.  
  13146.     widget: function() {
  13147.         return this.uiSpinner;
  13148.     }
  13149. });
  13150.  
  13151.  
  13152. /*!
  13153.  * jQuery UI Tabs 1.11.4
  13154.  * http://jqueryui.com
  13155.  *
  13156.  * Copyright jQuery Foundation and other contributors
  13157.  * Released under the MIT license.
  13158.  * http://jquery.org/license
  13159.  *
  13160.  * http://api.jqueryui.com/tabs/
  13161.  */
  13162.  
  13163.  
  13164. var tabs = $.widget( "ui.tabs", {
  13165.     version: "1.11.4",
  13166.     delay: 300,
  13167.     options: {
  13168.         active: null,
  13169.         collapsible: false,
  13170.         event: "click",
  13171.         heightStyle: "content",
  13172.         hide: null,
  13173.         show: null,
  13174.  
  13175.         // callbacks
  13176.         activate: null,
  13177.         beforeActivate: null,
  13178.         beforeLoad: null,
  13179.         load: null
  13180.     },
  13181.  
  13182.     _isLocal: (function() {
  13183.         var rhash = /#.*$/;
  13184.  
  13185.         return function( anchor ) {
  13186.             var anchorUrl, locationUrl;
  13187.  
  13188.             // support: IE7
  13189.             // IE7 doesn't normalize the href property when set via script (#9317)
  13190.             anchor = anchor.cloneNode( false );
  13191.  
  13192.             anchorUrl = anchor.href.replace( rhash, "" );
  13193.             locationUrl = location.href.replace( rhash, "" );
  13194.  
  13195.             // decoding may throw an error if the URL isn't UTF-8 (#9518)
  13196.             try {
  13197.                 anchorUrl = decodeURIComponent( anchorUrl );
  13198.             } catch ( error ) {}
  13199.             try {
  13200.                 locationUrl = decodeURIComponent( locationUrl );
  13201.             } catch ( error ) {}
  13202.  
  13203.             return anchor.hash.length > 1 && anchorUrl === locationUrl;
  13204.         };
  13205.     })(),
  13206.  
  13207.     _create: function() {
  13208.         var that = this,
  13209.             options = this.options;
  13210.  
  13211.         this.running = false;
  13212.  
  13213.         this.element
  13214.             .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
  13215.             .toggleClass( "ui-tabs-collapsible", options.collapsible );
  13216.  
  13217.         this._processTabs();
  13218.         options.active = this._initialActive();
  13219.  
  13220.         // Take disabling tabs via class attribute from HTML
  13221.         // into account and update option properly.
  13222.         if ( $.isArray( options.disabled ) ) {
  13223.             options.disabled = $.unique( options.disabled.concat(
  13224.                 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
  13225.                     return that.tabs.index( li );
  13226.                 })
  13227.             ) ).sort();
  13228.         }
  13229.  
  13230.         // check for length avoids error when initializing empty list
  13231.         if ( this.options.active !== false && this.anchors.length ) {
  13232.             this.active = this._findActive( options.active );
  13233.         } else {
  13234.             this.active = $();
  13235.         }
  13236.  
  13237.         this._refresh();
  13238.  
  13239.         if ( this.active.length ) {
  13240.             this.load( options.active );
  13241.         }
  13242.     },
  13243.  
  13244.     _initialActive: function() {
  13245.         var active = this.options.active,
  13246.             collapsible = this.options.collapsible,
  13247.             locationHash = location.hash.substring( 1 );
  13248.  
  13249.         if ( active === null ) {
  13250.             // check the fragment identifier in the URL
  13251.             if ( locationHash ) {
  13252.                 this.tabs.each(function( i, tab ) {
  13253.                     if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
  13254.                         active = i;
  13255.                         return false;
  13256.                     }
  13257.                 });
  13258.             }
  13259.  
  13260.             // check for a tab marked active via a class
  13261.             if ( active === null ) {
  13262.                 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
  13263.             }
  13264.  
  13265.             // no active tab, set to false
  13266.             if ( active === null || active === -1 ) {
  13267.                 active = this.tabs.length ? 0 : false;
  13268.             }
  13269.         }
  13270.  
  13271.         // handle numbers: negative, out of range
  13272.         if ( active !== false ) {
  13273.             active = this.tabs.index( this.tabs.eq( active ) );
  13274.             if ( active === -1 ) {
  13275.                 active = collapsible ? false : 0;
  13276.             }
  13277.         }
  13278.  
  13279.         // don't allow collapsible: false and active: false
  13280.         if ( !collapsible && active === false && this.anchors.length ) {
  13281.             active = 0;
  13282.         }
  13283.  
  13284.         return active;
  13285.     },
  13286.  
  13287.     _getCreateEventData: function() {
  13288.         return {
  13289.             tab: this.active,
  13290.             panel: !this.active.length ? $() : this._getPanelForTab( this.active )
  13291.         };
  13292.     },
  13293.  
  13294.     _tabKeydown: function( event ) {
  13295.         var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
  13296.             selectedIndex = this.tabs.index( focusedTab ),
  13297.             goingForward = true;
  13298.  
  13299.         if ( this._handlePageNav( event ) ) {
  13300.             return;
  13301.         }
  13302.  
  13303.         switch ( event.keyCode ) {
  13304.             case $.ui.keyCode.RIGHT:
  13305.             case $.ui.keyCode.DOWN:
  13306.                 selectedIndex++;
  13307.                 break;
  13308.             case $.ui.keyCode.UP:
  13309.             case $.ui.keyCode.LEFT:
  13310.                 goingForward = false;
  13311.                 selectedIndex--;
  13312.                 break;
  13313.             case $.ui.keyCode.END:
  13314.                 selectedIndex = this.anchors.length - 1;
  13315.                 break;
  13316.             case $.ui.keyCode.HOME:
  13317.                 selectedIndex = 0;
  13318.                 break;
  13319.             case $.ui.keyCode.SPACE:
  13320.                 // Activate only, no collapsing
  13321.                 event.preventDefault();
  13322.                 clearTimeout( this.activating );
  13323.                 this._activate( selectedIndex );
  13324.                 return;
  13325.             case $.ui.keyCode.ENTER:
  13326.                 // Toggle (cancel delayed activation, allow collapsing)
  13327.                 event.preventDefault();
  13328.                 clearTimeout( this.activating );
  13329.                 // Determine if we should collapse or activate
  13330.                 this._activate( selectedIndex === this.options.active ? false : selectedIndex );
  13331.                 return;
  13332.             default:
  13333.                 return;
  13334.         }
  13335.  
  13336.         // Focus the appropriate tab, based on which key was pressed
  13337.         event.preventDefault();
  13338.         clearTimeout( this.activating );
  13339.         selectedIndex = this._focusNextTab( selectedIndex, goingForward );
  13340.  
  13341.         // Navigating with control/command key will prevent automatic activation
  13342.         if ( !event.ctrlKey && !event.metaKey ) {
  13343.  
  13344.             // Update aria-selected immediately so that AT think the tab is already selected.
  13345.             // Otherwise AT may confuse the user by stating that they need to activate the tab,
  13346.             // but the tab will already be activated by the time the announcement finishes.
  13347.             focusedTab.attr( "aria-selected", "false" );
  13348.             this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
  13349.  
  13350.             this.activating = this._delay(function() {
  13351.                 this.option( "active", selectedIndex );
  13352.             }, this.delay );
  13353.         }
  13354.     },
  13355.  
  13356.     _panelKeydown: function( event ) {
  13357.         if ( this._handlePageNav( event ) ) {
  13358.             return;
  13359.         }
  13360.  
  13361.         // Ctrl+up moves focus to the current tab
  13362.         if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
  13363.             event.preventDefault();
  13364.             this.active.focus();
  13365.         }
  13366.     },
  13367.  
  13368.     // Alt+page up/down moves focus to the previous/next tab (and activates)
  13369.     _handlePageNav: function( event ) {
  13370.         if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
  13371.             this._activate( this._focusNextTab( this.options.active - 1, false ) );
  13372.             return true;
  13373.         }
  13374.         if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
  13375.             this._activate( this._focusNextTab( this.options.active + 1, true ) );
  13376.             return true;
  13377.         }
  13378.     },
  13379.  
  13380.     _findNextTab: function( index, goingForward ) {
  13381.         var lastTabIndex = this.tabs.length - 1;
  13382.  
  13383.         function constrain() {
  13384.             if ( index > lastTabIndex ) {
  13385.                 index = 0;
  13386.             }
  13387.             if ( index < 0 ) {
  13388.                 index = lastTabIndex;
  13389.             }
  13390.             return index;
  13391.         }
  13392.  
  13393.         while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
  13394.             index = goingForward ? index + 1 : index - 1;
  13395.         }
  13396.  
  13397.         return index;
  13398.     },
  13399.  
  13400.     _focusNextTab: function( index, goingForward ) {
  13401.         index = this._findNextTab( index, goingForward );
  13402.         this.tabs.eq( index ).focus();
  13403.         return index;
  13404.     },
  13405.  
  13406.     _setOption: function( key, value ) {
  13407.         if ( key === "active" ) {
  13408.             // _activate() will handle invalid values and update this.options
  13409.             this._activate( value );
  13410.             return;
  13411.         }
  13412.  
  13413.         if ( key === "disabled" ) {
  13414.             // don't use the widget factory's disabled handling
  13415.             this._setupDisabled( value );
  13416.             return;
  13417.         }
  13418.  
  13419.         this._super( key, value);
  13420.  
  13421.         if ( key === "collapsible" ) {
  13422.             this.element.toggleClass( "ui-tabs-collapsible", value );
  13423.             // Setting collapsible: false while collapsed; open first panel
  13424.             if ( !value && this.options.active === false ) {
  13425.                 this._activate( 0 );
  13426.             }
  13427.         }
  13428.  
  13429.         if ( key === "event" ) {
  13430.             this._setupEvents( value );
  13431.         }
  13432.  
  13433.         if ( key === "heightStyle" ) {
  13434.             this._setupHeightStyle( value );
  13435.         }
  13436.     },
  13437.  
  13438.     _sanitizeSelector: function( hash ) {
  13439.         return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
  13440.     },
  13441.  
  13442.     refresh: function() {
  13443.         var options = this.options,
  13444.             lis = this.tablist.children( ":has(a[href])" );
  13445.  
  13446.         // get disabled tabs from class attribute from HTML
  13447.         // this will get converted to a boolean if needed in _refresh()
  13448.         options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
  13449.             return lis.index( tab );
  13450.         });
  13451.  
  13452.         this._processTabs();
  13453.  
  13454.         // was collapsed or no tabs
  13455.         if ( options.active === false || !this.anchors.length ) {
  13456.             options.active = false;
  13457.             this.active = $();
  13458.         // was active, but active tab is gone
  13459.         } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
  13460.             // all remaining tabs are disabled
  13461.             if ( this.tabs.length === options.disabled.length ) {
  13462.                 options.active = false;
  13463.                 this.active = $();
  13464.             // activate previous tab
  13465.             } else {
  13466.                 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
  13467.             }
  13468.         // was active, active tab still exists
  13469.         } else {
  13470.             // make sure active index is correct
  13471.             options.active = this.tabs.index( this.active );
  13472.         }
  13473.  
  13474.         this._refresh();
  13475.     },
  13476.  
  13477.     _refresh: function() {
  13478.         this._setupDisabled( this.options.disabled );
  13479.         this._setupEvents( this.options.event );
  13480.         this._setupHeightStyle( this.options.heightStyle );
  13481.  
  13482.         this.tabs.not( this.active ).attr({
  13483.             "aria-selected": "false",
  13484.             "aria-expanded": "false",
  13485.             tabIndex: -1
  13486.         });
  13487.         this.panels.not( this._getPanelForTab( this.active ) )
  13488.             .hide()
  13489.             .attr({
  13490.                 "aria-hidden": "true"
  13491.             });
  13492.  
  13493.         // Make sure one tab is in the tab order
  13494.         if ( !this.active.length ) {
  13495.             this.tabs.eq( 0 ).attr( "tabIndex", 0 );
  13496.         } else {
  13497.             this.active
  13498.                 .addClass( "ui-tabs-active ui-state-active" )
  13499.                 .attr({
  13500.                     "aria-selected": "true",
  13501.                     "aria-expanded": "true",
  13502.                     tabIndex: 0
  13503.                 });
  13504.             this._getPanelForTab( this.active )
  13505.                 .show()
  13506.                 .attr({
  13507.                     "aria-hidden": "false"
  13508.                 });
  13509.         }
  13510.     },
  13511.  
  13512.     _processTabs: function() {
  13513.         var that = this,
  13514.             prevTabs = this.tabs,
  13515.             prevAnchors = this.anchors,
  13516.             prevPanels = this.panels;
  13517.  
  13518.         this.tablist = this._getList()
  13519.             .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
  13520.             .attr( "role", "tablist" )
  13521.  
  13522.             // Prevent users from focusing disabled tabs via click
  13523.             .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
  13524.                 if ( $( this ).is( ".ui-state-disabled" ) ) {
  13525.                     event.preventDefault();
  13526.                 }
  13527.             })
  13528.  
  13529.             // support: IE <9
  13530.             // Preventing the default action in mousedown doesn't prevent IE
  13531.             // from focusing the element, so if the anchor gets focused, blur.
  13532.             // We don't have to worry about focusing the previously focused
  13533.             // element since clicking on a non-focusable element should focus
  13534.             // the body anyway.
  13535.             .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
  13536.                 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
  13537.                     this.blur();
  13538.                 }
  13539.             });
  13540.  
  13541.         this.tabs = this.tablist.find( "> li:has(a[href])" )
  13542.             .addClass( "ui-state-default ui-corner-top" )
  13543.             .attr({
  13544.                 role: "tab",
  13545.                 tabIndex: -1
  13546.             });
  13547.  
  13548.         this.anchors = this.tabs.map(function() {
  13549.                 return $( "a", this )[ 0 ];
  13550.             })
  13551.             .addClass( "ui-tabs-anchor" )
  13552.             .attr({
  13553.                 role: "presentation",
  13554.                 tabIndex: -1
  13555.             });
  13556.  
  13557.         this.panels = $();
  13558.  
  13559.         this.anchors.each(function( i, anchor ) {
  13560.             var selector, panel, panelId,
  13561.                 anchorId = $( anchor ).uniqueId().attr( "id" ),
  13562.                 tab = $( anchor ).closest( "li" ),
  13563.                 originalAriaControls = tab.attr( "aria-controls" );
  13564.  
  13565.             // inline tab
  13566.             if ( that._isLocal( anchor ) ) {
  13567.                 selector = anchor.hash;
  13568.                 panelId = selector.substring( 1 );
  13569.                 panel = that.element.find( that._sanitizeSelector( selector ) );
  13570.             // remote tab
  13571.             } else {
  13572.                 // If the tab doesn't already have aria-controls,
  13573.                 // generate an id by using a throw-away element
  13574.                 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
  13575.                 selector = "#" + panelId;
  13576.                 panel = that.element.find( selector );
  13577.                 if ( !panel.length ) {
  13578.                     panel = that._createPanel( panelId );
  13579.                     panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
  13580.                 }
  13581.                 panel.attr( "aria-live", "polite" );
  13582.             }
  13583.  
  13584.             if ( panel.length) {
  13585.                 that.panels = that.panels.add( panel );
  13586.             }
  13587.             if ( originalAriaControls ) {
  13588.                 tab.data( "ui-tabs-aria-controls", originalAriaControls );
  13589.             }
  13590.             tab.attr({
  13591.                 "aria-controls": panelId,
  13592.                 "aria-labelledby": anchorId
  13593.             });
  13594.             panel.attr( "aria-labelledby", anchorId );
  13595.         });
  13596.  
  13597.         this.panels
  13598.             .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  13599.             .attr( "role", "tabpanel" );
  13600.  
  13601.         // Avoid memory leaks (#10056)
  13602.         if ( prevTabs ) {
  13603.             this._off( prevTabs.not( this.tabs ) );
  13604.             this._off( prevAnchors.not( this.anchors ) );
  13605.             this._off( prevPanels.not( this.panels ) );
  13606.         }
  13607.     },
  13608.  
  13609.     // allow overriding how to find the list for rare usage scenarios (#7715)
  13610.     _getList: function() {
  13611.         return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
  13612.     },
  13613.  
  13614.     _createPanel: function( id ) {
  13615.         return $( "<div>" )
  13616.             .attr( "id", id )
  13617.             .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  13618.             .data( "ui-tabs-destroy", true );
  13619.     },
  13620.  
  13621.     _setupDisabled: function( disabled ) {
  13622.         if ( $.isArray( disabled ) ) {
  13623.             if ( !disabled.length ) {
  13624.                 disabled = false;
  13625.             } else if ( disabled.length === this.anchors.length ) {
  13626.                 disabled = true;
  13627.             }
  13628.         }
  13629.  
  13630.         // disable tabs
  13631.         for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
  13632.             if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
  13633.                 $( li )
  13634.                     .addClass( "ui-state-disabled" )
  13635.                     .attr( "aria-disabled", "true" );
  13636.             } else {
  13637.                 $( li )
  13638.                     .removeClass( "ui-state-disabled" )
  13639.                     .removeAttr( "aria-disabled" );
  13640.             }
  13641.         }
  13642.  
  13643.         this.options.disabled = disabled;
  13644.     },
  13645.  
  13646.     _setupEvents: function( event ) {
  13647.         var events = {};
  13648.         if ( event ) {
  13649.             $.each( event.split(" "), function( index, eventName ) {
  13650.                 events[ eventName ] = "_eventHandler";
  13651.             });
  13652.         }
  13653.  
  13654.         this._off( this.anchors.add( this.tabs ).add( this.panels ) );
  13655.         // Always prevent the default action, even when disabled
  13656.         this._on( true, this.anchors, {
  13657.             click: function( event ) {
  13658.                 event.preventDefault();
  13659.             }
  13660.         });
  13661.         this._on( this.anchors, events );
  13662.         this._on( this.tabs, { keydown: "_tabKeydown" } );
  13663.         this._on( this.panels, { keydown: "_panelKeydown" } );
  13664.  
  13665.         this._focusable( this.tabs );
  13666.         this._hoverable( this.tabs );
  13667.     },
  13668.  
  13669.     _setupHeightStyle: function( heightStyle ) {
  13670.         var maxHeight,
  13671.             parent = this.element.parent();
  13672.  
  13673.         if ( heightStyle === "fill" ) {
  13674.             maxHeight = parent.height();
  13675.             maxHeight -= this.element.outerHeight() - this.element.height();
  13676.  
  13677.             this.element.siblings( ":visible" ).each(function() {
  13678.                 var elem = $( this ),
  13679.                     position = elem.css( "position" );
  13680.  
  13681.                 if ( position === "absolute" || position === "fixed" ) {
  13682.                     return;
  13683.                 }
  13684.                 maxHeight -= elem.outerHeight( true );
  13685.             });
  13686.  
  13687.             this.element.children().not( this.panels ).each(function() {
  13688.                 maxHeight -= $( this ).outerHeight( true );
  13689.             });
  13690.  
  13691.             this.panels.each(function() {
  13692.                 $( this ).height( Math.max( 0, maxHeight -
  13693.                     $( this ).innerHeight() + $( this ).height() ) );
  13694.             })
  13695.             .css( "overflow", "auto" );
  13696.         } else if ( heightStyle === "auto" ) {
  13697.             maxHeight = 0;
  13698.             this.panels.each(function() {
  13699.                 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  13700.             }).height( maxHeight );
  13701.         }
  13702.     },
  13703.  
  13704.     _eventHandler: function( event ) {
  13705.         var options = this.options,
  13706.             active = this.active,
  13707.             anchor = $( event.currentTarget ),
  13708.             tab = anchor.closest( "li" ),
  13709.             clickedIsActive = tab[ 0 ] === active[ 0 ],
  13710.             collapsing = clickedIsActive && options.collapsible,
  13711.             toShow = collapsing ? $() : this._getPanelForTab( tab ),
  13712.             toHide = !active.length ? $() : this._getPanelForTab( active ),
  13713.             eventData = {
  13714.                 oldTab: active,
  13715.                 oldPanel: toHide,
  13716.                 newTab: collapsing ? $() : tab,
  13717.                 newPanel: toShow
  13718.             };
  13719.  
  13720.         event.preventDefault();
  13721.  
  13722.         if ( tab.hasClass( "ui-state-disabled" ) ||
  13723.                 // tab is already loading
  13724.                 tab.hasClass( "ui-tabs-loading" ) ||
  13725.                 // can't switch durning an animation
  13726.                 this.running ||
  13727.                 // click on active header, but not collapsible
  13728.                 ( clickedIsActive && !options.collapsible ) ||
  13729.                 // allow canceling activation
  13730.                 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  13731.             return;
  13732.         }
  13733.  
  13734.         options.active = collapsing ? false : this.tabs.index( tab );
  13735.  
  13736.         this.active = clickedIsActive ? $() : tab;
  13737.         if ( this.xhr ) {
  13738.             this.xhr.abort();
  13739.         }
  13740.  
  13741.         if ( !toHide.length && !toShow.length ) {
  13742.             $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
  13743.         }
  13744.  
  13745.         if ( toShow.length ) {
  13746.             this.load( this.tabs.index( tab ), event );
  13747.         }
  13748.         this._toggle( event, eventData );
  13749.     },
  13750.  
  13751.     // handles show/hide for selecting tabs
  13752.     _toggle: function( event, eventData ) {
  13753.         var that = this,
  13754.             toShow = eventData.newPanel,
  13755.             toHide = eventData.oldPanel;
  13756.  
  13757.         this.running = true;
  13758.  
  13759.         function complete() {
  13760.             that.running = false;
  13761.             that._trigger( "activate", event, eventData );
  13762.         }
  13763.  
  13764.         function show() {
  13765.             eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
  13766.  
  13767.             if ( toShow.length && that.options.show ) {
  13768.                 that._show( toShow, that.options.show, complete );
  13769.             } else {
  13770.                 toShow.show();
  13771.                 complete();
  13772.             }
  13773.         }
  13774.  
  13775.         // start out by hiding, then showing, then completing
  13776.         if ( toHide.length && this.options.hide ) {
  13777.             this._hide( toHide, this.options.hide, function() {
  13778.                 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
  13779.                 show();
  13780.             });
  13781.         } else {
  13782.             eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
  13783.             toHide.hide();
  13784.             show();
  13785.         }
  13786.  
  13787.         toHide.attr( "aria-hidden", "true" );
  13788.         eventData.oldTab.attr({
  13789.             "aria-selected": "false",
  13790.             "aria-expanded": "false"
  13791.         });
  13792.         // If we're switching tabs, remove the old tab from the tab order.
  13793.         // If we're opening from collapsed state, remove the previous tab from the tab order.
  13794.         // If we're collapsing, then keep the collapsing tab in the tab order.
  13795.         if ( toShow.length && toHide.length ) {
  13796.             eventData.oldTab.attr( "tabIndex", -1 );
  13797.         } else if ( toShow.length ) {
  13798.             this.tabs.filter(function() {
  13799.                 return $( this ).attr( "tabIndex" ) === 0;
  13800.             })
  13801.             .attr( "tabIndex", -1 );
  13802.         }
  13803.  
  13804.         toShow.attr( "aria-hidden", "false" );
  13805.         eventData.newTab.attr({
  13806.             "aria-selected": "true",
  13807.             "aria-expanded": "true",
  13808.             tabIndex: 0
  13809.         });
  13810.     },
  13811.  
  13812.     _activate: function( index ) {
  13813.         var anchor,
  13814.             active = this._findActive( index );
  13815.  
  13816.         // trying to activate the already active panel
  13817.         if ( active[ 0 ] === this.active[ 0 ] ) {
  13818.             return;
  13819.         }
  13820.  
  13821.         // trying to collapse, simulate a click on the current active header
  13822.         if ( !active.length ) {
  13823.             active = this.active;
  13824.         }
  13825.  
  13826.         anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
  13827.         this._eventHandler({
  13828.             target: anchor,
  13829.             currentTarget: anchor,
  13830.             preventDefault: $.noop
  13831.         });
  13832.     },
  13833.  
  13834.     _findActive: function( index ) {
  13835.         return index === false ? $() : this.tabs.eq( index );
  13836.     },
  13837.  
  13838.     _getIndex: function( index ) {
  13839.         // meta-function to give users option to provide a href string instead of a numerical index.
  13840.         if ( typeof index === "string" ) {
  13841.             index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
  13842.         }
  13843.  
  13844.         return index;
  13845.     },
  13846.  
  13847.     _destroy: function() {
  13848.         if ( this.xhr ) {
  13849.             this.xhr.abort();
  13850.         }
  13851.  
  13852.         this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
  13853.  
  13854.         this.tablist
  13855.             .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
  13856.             .removeAttr( "role" );
  13857.  
  13858.         this.anchors
  13859.             .removeClass( "ui-tabs-anchor" )
  13860.             .removeAttr( "role" )
  13861.             .removeAttr( "tabIndex" )
  13862.             .removeUniqueId();
  13863.  
  13864.         this.tablist.unbind( this.eventNamespace );
  13865.  
  13866.         this.tabs.add( this.panels ).each(function() {
  13867.             if ( $.data( this, "ui-tabs-destroy" ) ) {
  13868.                 $( this ).remove();
  13869.             } else {
  13870.                 $( this )
  13871.                     .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
  13872.                         "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
  13873.                     .removeAttr( "tabIndex" )
  13874.                     .removeAttr( "aria-live" )
  13875.                     .removeAttr( "aria-busy" )
  13876.                     .removeAttr( "aria-selected" )
  13877.                     .removeAttr( "aria-labelledby" )
  13878.                     .removeAttr( "aria-hidden" )
  13879.                     .removeAttr( "aria-expanded" )
  13880.                     .removeAttr( "role" );
  13881.             }
  13882.         });
  13883.  
  13884.         this.tabs.each(function() {
  13885.             var li = $( this ),
  13886.                 prev = li.data( "ui-tabs-aria-controls" );
  13887.             if ( prev ) {
  13888.                 li
  13889.                     .attr( "aria-controls", prev )
  13890.                     .removeData( "ui-tabs-aria-controls" );
  13891.             } else {
  13892.                 li.removeAttr( "aria-controls" );
  13893.             }
  13894.         });
  13895.  
  13896.         this.panels.show();
  13897.  
  13898.         if ( this.options.heightStyle !== "content" ) {
  13899.             this.panels.css( "height", "" );
  13900.         }
  13901.     },
  13902.  
  13903.     enable: function( index ) {
  13904.         var disabled = this.options.disabled;
  13905.         if ( disabled === false ) {
  13906.             return;
  13907.         }
  13908.  
  13909.         if ( index === undefined ) {
  13910.             disabled = false;
  13911.         } else {
  13912.             index = this._getIndex( index );
  13913.             if ( $.isArray( disabled ) ) {
  13914.                 disabled = $.map( disabled, function( num ) {
  13915.                     return num !== index ? num : null;
  13916.                 });
  13917.             } else {
  13918.                 disabled = $.map( this.tabs, function( li, num ) {
  13919.                     return num !== index ? num : null;
  13920.                 });
  13921.             }
  13922.         }
  13923.         this._setupDisabled( disabled );
  13924.     },
  13925.  
  13926.     disable: function( index ) {
  13927.         var disabled = this.options.disabled;
  13928.         if ( disabled === true ) {
  13929.             return;
  13930.         }
  13931.  
  13932.         if ( index === undefined ) {
  13933.             disabled = true;
  13934.         } else {
  13935.             index = this._getIndex( index );
  13936.             if ( $.inArray( index, disabled ) !== -1 ) {
  13937.                 return;
  13938.             }
  13939.             if ( $.isArray( disabled ) ) {
  13940.                 disabled = $.merge( [ index ], disabled ).sort();
  13941.             } else {
  13942.                 disabled = [ index ];
  13943.             }
  13944.         }
  13945.         this._setupDisabled( disabled );
  13946.     },
  13947.  
  13948.     load: function( index, event ) {
  13949.         index = this._getIndex( index );
  13950.         var that = this,
  13951.             tab = this.tabs.eq( index ),
  13952.             anchor = tab.find( ".ui-tabs-anchor" ),
  13953.             panel = this._getPanelForTab( tab ),
  13954.             eventData = {
  13955.                 tab: tab,
  13956.                 panel: panel
  13957.             },
  13958.             complete = function( jqXHR, status ) {
  13959.                 if ( status === "abort" ) {
  13960.                     that.panels.stop( false, true );
  13961.                 }
  13962.  
  13963.                 tab.removeClass( "ui-tabs-loading" );
  13964.                 panel.removeAttr( "aria-busy" );
  13965.  
  13966.                 if ( jqXHR === that.xhr ) {
  13967.                     delete that.xhr;
  13968.                 }
  13969.             };
  13970.  
  13971.         // not remote
  13972.         if ( this._isLocal( anchor[ 0 ] ) ) {
  13973.             return;
  13974.         }
  13975.  
  13976.         this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
  13977.  
  13978.         // support: jQuery <1.8
  13979.         // jQuery <1.8 returns false if the request is canceled in beforeSend,
  13980.         // but as of 1.8, $.ajax() always returns a jqXHR object.
  13981.         if ( this.xhr && this.xhr.statusText !== "canceled" ) {
  13982.             tab.addClass( "ui-tabs-loading" );
  13983.             panel.attr( "aria-busy", "true" );
  13984.  
  13985.             this.xhr
  13986.                 .done(function( response, status, jqXHR ) {
  13987.                     // support: jQuery <1.8
  13988.                     // http://bugs.jquery.com/ticket/11778
  13989.                     setTimeout(function() {
  13990.                         panel.html( response );
  13991.                         that._trigger( "load", event, eventData );
  13992.  
  13993.                         complete( jqXHR, status );
  13994.                     }, 1 );
  13995.                 })
  13996.                 .fail(function( jqXHR, status ) {
  13997.                     // support: jQuery <1.8
  13998.                     // http://bugs.jquery.com/ticket/11778
  13999.                     setTimeout(function() {
  14000.                         complete( jqXHR, status );
  14001.                     }, 1 );
  14002.                 });
  14003.         }
  14004.     },
  14005.  
  14006.     _ajaxSettings: function( anchor, event, eventData ) {
  14007.         var that = this;
  14008.         return {
  14009.             url: anchor.attr( "href" ),
  14010.             beforeSend: function( jqXHR, settings ) {
  14011.                 return that._trigger( "beforeLoad", event,
  14012.                     $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
  14013.             }
  14014.         };
  14015.     },
  14016.  
  14017.     _getPanelForTab: function( tab ) {
  14018.         var id = $( tab ).attr( "aria-controls" );
  14019.         return this.element.find( this._sanitizeSelector( "#" + id ) );
  14020.     }
  14021. });
  14022.  
  14023.  
  14024. /*!
  14025.  * jQuery UI Tooltip 1.11.4
  14026.  * http://jqueryui.com
  14027.  *
  14028.  * Copyright jQuery Foundation and other contributors
  14029.  * Released under the MIT license.
  14030.  * http://jquery.org/license
  14031.  *
  14032.  * http://api.jqueryui.com/tooltip/
  14033.  */
  14034.  
  14035.  
  14036. var tooltip = $.widget( "ui.tooltip", {
  14037.     version: "1.11.4",
  14038.     options: {
  14039.         content: function() {
  14040.             // support: IE<9, Opera in jQuery <1.7
  14041.             // .text() can't accept undefined, so coerce to a string
  14042.             var title = $( this ).attr( "title" ) || "";
  14043.             // Escape title, since we're going from an attribute to raw HTML
  14044.             return $( "<a>" ).text( title ).html();
  14045.         },
  14046.         hide: true,
  14047.         // Disabled elements have inconsistent behavior across browsers (#8661)
  14048.         items: "[title]:not([disabled])",
  14049.         position: {
  14050.             my: "left top+15",
  14051.             at: "left bottom",
  14052.             collision: "flipfit flip"
  14053.         },
  14054.         show: true,
  14055.         tooltipClass: null,
  14056.         track: false,
  14057.  
  14058.         // callbacks
  14059.         close: null,
  14060.         open: null
  14061.     },
  14062.  
  14063.     _addDescribedBy: function( elem, id ) {
  14064.         var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
  14065.         describedby.push( id );
  14066.         elem
  14067.             .data( "ui-tooltip-id", id )
  14068.             .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
  14069.     },
  14070.  
  14071.     _removeDescribedBy: function( elem ) {
  14072.         var id = elem.data( "ui-tooltip-id" ),
  14073.             describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
  14074.             index = $.inArray( id, describedby );
  14075.  
  14076.         if ( index !== -1 ) {
  14077.             describedby.splice( index, 1 );
  14078.         }
  14079.  
  14080.         elem.removeData( "ui-tooltip-id" );
  14081.         describedby = $.trim( describedby.join( " " ) );
  14082.         if ( describedby ) {
  14083.             elem.attr( "aria-describedby", describedby );
  14084.         } else {
  14085.             elem.removeAttr( "aria-describedby" );
  14086.         }
  14087.     },
  14088.  
  14089.     _create: function() {
  14090.         this._on({
  14091.             mouseover: "open",
  14092.             focusin: "open"
  14093.         });
  14094.  
  14095.         // IDs of generated tooltips, needed for destroy
  14096.         this.tooltips = {};
  14097.  
  14098.         // IDs of parent tooltips where we removed the title attribute
  14099.         this.parents = {};
  14100.  
  14101.         if ( this.options.disabled ) {
  14102.             this._disable();
  14103.         }
  14104.  
  14105.         // Append the aria-live region so tooltips announce correctly
  14106.         this.liveRegion = $( "<div>" )
  14107.             .attr({
  14108.                 role: "log",
  14109.                 "aria-live": "assertive",
  14110.                 "aria-relevant": "additions"
  14111.             })
  14112.             .addClass( "ui-helper-hidden-accessible" )
  14113.             .appendTo( this.document[ 0 ].body );
  14114.     },
  14115.  
  14116.     _setOption: function( key, value ) {
  14117.         var that = this;
  14118.  
  14119.         if ( key === "disabled" ) {
  14120.             this[ value ? "_disable" : "_enable" ]();
  14121.             this.options[ key ] = value;
  14122.             // disable element style changes
  14123.             return;
  14124.         }
  14125.  
  14126.         this._super( key, value );
  14127.  
  14128.         if ( key === "content" ) {
  14129.             $.each( this.tooltips, function( id, tooltipData ) {
  14130.                 that._updateContent( tooltipData.element );
  14131.             });
  14132.         }
  14133.     },
  14134.  
  14135.     _disable: function() {
  14136.         var that = this;
  14137.  
  14138.         // close open tooltips
  14139.         $.each( this.tooltips, function( id, tooltipData ) {
  14140.             var event = $.Event( "blur" );
  14141.             event.target = event.currentTarget = tooltipData.element[ 0 ];
  14142.             that.close( event, true );
  14143.         });
  14144.  
  14145.         // remove title attributes to prevent native tooltips
  14146.         this.element.find( this.options.items ).addBack().each(function() {
  14147.             var element = $( this );
  14148.             if ( element.is( "[title]" ) ) {
  14149.                 element
  14150.                     .data( "ui-tooltip-title", element.attr( "title" ) )
  14151.                     .removeAttr( "title" );
  14152.             }
  14153.         });
  14154.     },
  14155.  
  14156.     _enable: function() {
  14157.         // restore title attributes
  14158.         this.element.find( this.options.items ).addBack().each(function() {
  14159.             var element = $( this );
  14160.             if ( element.data( "ui-tooltip-title" ) ) {
  14161.                 element.attr( "title", element.data( "ui-tooltip-title" ) );
  14162.             }
  14163.         });
  14164.     },
  14165.  
  14166.     open: function( event ) {
  14167.         var that = this,
  14168.             target = $( event ? event.target : this.element )
  14169.                 // we need closest here due to mouseover bubbling,
  14170.                 // but always pointing at the same event target
  14171.                 .closest( this.options.items );
  14172.  
  14173.         // No element to show a tooltip for or the tooltip is already open
  14174.         if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  14175.             return;
  14176.         }
  14177.  
  14178.         if ( target.attr( "title" ) ) {
  14179.             target.data( "ui-tooltip-title", target.attr( "title" ) );
  14180.         }
  14181.  
  14182.         target.data( "ui-tooltip-open", true );
  14183.  
  14184.         // kill parent tooltips, custom or native, for hover
  14185.         if ( event && event.type === "mouseover" ) {
  14186.             target.parents().each(function() {
  14187.                 var parent = $( this ),
  14188.                     blurEvent;
  14189.                 if ( parent.data( "ui-tooltip-open" ) ) {
  14190.                     blurEvent = $.Event( "blur" );
  14191.                     blurEvent.target = blurEvent.currentTarget = this;
  14192.                     that.close( blurEvent, true );
  14193.                 }
  14194.                 if ( parent.attr( "title" ) ) {
  14195.                     parent.uniqueId();
  14196.                     that.parents[ this.id ] = {
  14197.                         element: this,
  14198.                         title: parent.attr( "title" )
  14199.                     };
  14200.                     parent.attr( "title", "" );
  14201.                 }
  14202.             });
  14203.         }
  14204.  
  14205.         this._registerCloseHandlers( event, target );
  14206.         this._updateContent( target, event );
  14207.     },
  14208.  
  14209.     _updateContent: function( target, event ) {
  14210.         var content,
  14211.             contentOption = this.options.content,
  14212.             that = this,
  14213.             eventType = event ? event.type : null;
  14214.  
  14215.         if ( typeof contentOption === "string" ) {
  14216.             return this._open( event, target, contentOption );
  14217.         }
  14218.  
  14219.         content = contentOption.call( target[0], function( response ) {
  14220.  
  14221.             // IE may instantly serve a cached response for ajax requests
  14222.             // delay this call to _open so the other call to _open runs first
  14223.             that._delay(function() {
  14224.  
  14225.                 // Ignore async response if tooltip was closed already
  14226.                 if ( !target.data( "ui-tooltip-open" ) ) {
  14227.                     return;
  14228.                 }
  14229.  
  14230.                 // jQuery creates a special event for focusin when it doesn't
  14231.                 // exist natively. To improve performance, the native event
  14232.                 // object is reused and the type is changed. Therefore, we can't
  14233.                 // rely on the type being correct after the event finished
  14234.                 // bubbling, so we set it back to the previous value. (#8740)
  14235.                 if ( event ) {
  14236.                     event.type = eventType;
  14237.                 }
  14238.                 this._open( event, target, response );
  14239.             });
  14240.         });
  14241.         if ( content ) {
  14242.             this._open( event, target, content );
  14243.         }
  14244.     },
  14245.  
  14246.     _open: function( event, target, content ) {
  14247.         var tooltipData, tooltip, delayedShow, a11yContent,
  14248.             positionOption = $.extend( {}, this.options.position );
  14249.  
  14250.         if ( !content ) {
  14251.             return;
  14252.         }
  14253.  
  14254.         // Content can be updated multiple times. If the tooltip already
  14255.         // exists, then just update the content and bail.
  14256.         tooltipData = this._find( target );
  14257.         if ( tooltipData ) {
  14258.             tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  14259.             return;
  14260.         }
  14261.  
  14262.         // if we have a title, clear it to prevent the native tooltip
  14263.         // we have to check first to avoid defining a title if none exists
  14264.         // (we don't want to cause an element to start matching [title])
  14265.         //
  14266.         // We use removeAttr only for key events, to allow IE to export the correct
  14267.         // accessible attributes. For mouse events, set to empty string to avoid
  14268.         // native tooltip showing up (happens only when removing inside mouseover).
  14269.         if ( target.is( "[title]" ) ) {
  14270.             if ( event && event.type === "mouseover" ) {
  14271.                 target.attr( "title", "" );
  14272.             } else {
  14273.                 target.removeAttr( "title" );
  14274.             }
  14275.         }
  14276.  
  14277.         tooltipData = this._tooltip( target );
  14278.         tooltip = tooltipData.tooltip;
  14279.         this._addDescribedBy( target, tooltip.attr( "id" ) );
  14280.         tooltip.find( ".ui-tooltip-content" ).html( content );
  14281.  
  14282.         // Support: Voiceover on OS X, JAWS on IE <= 9
  14283.         // JAWS announces deletions even when aria-relevant="additions"
  14284.         // Voiceover will sometimes re-read the entire log region's contents from the beginning
  14285.         this.liveRegion.children().hide();
  14286.         if ( content.clone ) {
  14287.             a11yContent = content.clone();
  14288.             a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  14289.         } else {
  14290.             a11yContent = content;
  14291.         }
  14292.         $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
  14293.  
  14294.         function position( event ) {
  14295.             positionOption.of = event;
  14296.             if ( tooltip.is( ":hidden" ) ) {
  14297.                 return;
  14298.             }
  14299.             tooltip.position( positionOption );
  14300.         }
  14301.         if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  14302.             this._on( this.document, {
  14303.                 mousemove: position
  14304.             });
  14305.             // trigger once to override element-relative positioning
  14306.             position( event );
  14307.         } else {
  14308.             tooltip.position( $.extend({
  14309.                 of: target
  14310.             }, this.options.position ) );
  14311.         }
  14312.  
  14313.         tooltip.hide();
  14314.  
  14315.         this._show( tooltip, this.options.show );
  14316.         // Handle tracking tooltips that are shown with a delay (#8644). As soon
  14317.         // as the tooltip is visible, position the tooltip using the most recent
  14318.         // event.
  14319.         if ( this.options.show && this.options.show.delay ) {
  14320.             delayedShow = this.delayedShow = setInterval(function() {
  14321.                 if ( tooltip.is( ":visible" ) ) {
  14322.                     position( positionOption.of );
  14323.                     clearInterval( delayedShow );
  14324.                 }
  14325.             }, $.fx.interval );
  14326.         }
  14327.  
  14328.         this._trigger( "open", event, { tooltip: tooltip } );
  14329.     },
  14330.  
  14331.     _registerCloseHandlers: function( event, target ) {
  14332.         var events = {
  14333.             keyup: function( event ) {
  14334.                 if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  14335.                     var fakeEvent = $.Event(event);
  14336.                     fakeEvent.currentTarget = target[0];
  14337.                     this.close( fakeEvent, true );
  14338.                 }
  14339.             }
  14340.         };
  14341.  
  14342.         // Only bind remove handler for delegated targets. Non-delegated
  14343.         // tooltips will handle this in destroy.
  14344.         if ( target[ 0 ] !== this.element[ 0 ] ) {
  14345.             events.remove = function() {
  14346.                 this._removeTooltip( this._find( target ).tooltip );
  14347.             };
  14348.         }
  14349.  
  14350.         if ( !event || event.type === "mouseover" ) {
  14351.             events.mouseleave = "close";
  14352.         }
  14353.         if ( !event || event.type === "focusin" ) {
  14354.             events.focusout = "close";
  14355.         }
  14356.         this._on( true, target, events );
  14357.     },
  14358.  
  14359.     close: function( event ) {
  14360.         var tooltip,
  14361.             that = this,
  14362.             target = $( event ? event.currentTarget : this.element ),
  14363.             tooltipData = this._find( target );
  14364.  
  14365.         // The tooltip may already be closed
  14366.         if ( !tooltipData ) {
  14367.  
  14368.             // We set ui-tooltip-open immediately upon open (in open()), but only set the
  14369.             // additional data once there's actually content to show (in _open()). So even if the
  14370.             // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  14371.             // the period between open() and _open().
  14372.             target.removeData( "ui-tooltip-open" );
  14373.             return;
  14374.         }
  14375.  
  14376.         tooltip = tooltipData.tooltip;
  14377.  
  14378.         // disabling closes the tooltip, so we need to track when we're closing
  14379.         // to avoid an infinite loop in case the tooltip becomes disabled on close
  14380.         if ( tooltipData.closing ) {
  14381.             return;
  14382.         }
  14383.  
  14384.         // Clear the interval for delayed tracking tooltips
  14385.         clearInterval( this.delayedShow );
  14386.  
  14387.         // only set title if we had one before (see comment in _open())
  14388.         // If the title attribute has changed since open(), don't restore
  14389.         if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  14390.             target.attr( "title", target.data( "ui-tooltip-title" ) );
  14391.         }
  14392.  
  14393.         this._removeDescribedBy( target );
  14394.  
  14395.         tooltipData.hiding = true;
  14396.         tooltip.stop( true );
  14397.         this._hide( tooltip, this.options.hide, function() {
  14398.             that._removeTooltip( $( this ) );
  14399.         });
  14400.  
  14401.         target.removeData( "ui-tooltip-open" );
  14402.         this._off( target, "mouseleave focusout keyup" );
  14403.  
  14404.         // Remove 'remove' binding only on delegated targets
  14405.         if ( target[ 0 ] !== this.element[ 0 ] ) {
  14406.             this._off( target, "remove" );
  14407.         }
  14408.         this._off( this.document, "mousemove" );
  14409.  
  14410.         if ( event && event.type === "mouseleave" ) {
  14411.             $.each( this.parents, function( id, parent ) {
  14412.                 $( parent.element ).attr( "title", parent.title );
  14413.                 delete that.parents[ id ];
  14414.             });
  14415.         }
  14416.  
  14417.         tooltipData.closing = true;
  14418.         this._trigger( "close", event, { tooltip: tooltip } );
  14419.         if ( !tooltipData.hiding ) {
  14420.             tooltipData.closing = false;
  14421.         }
  14422.     },
  14423.  
  14424.     _tooltip: function( element ) {
  14425.         var tooltip = $( "<div>" )
  14426.                 .attr( "role", "tooltip" )
  14427.                 .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
  14428.                     ( this.options.tooltipClass || "" ) ),
  14429.             id = tooltip.uniqueId().attr( "id" );
  14430.  
  14431.         $( "<div>" )
  14432.             .addClass( "ui-tooltip-content" )
  14433.             .appendTo( tooltip );
  14434.  
  14435.         tooltip.appendTo( this.document[0].body );
  14436.  
  14437.         return this.tooltips[ id ] = {
  14438.             element: element,
  14439.             tooltip: tooltip
  14440.         };
  14441.     },
  14442.  
  14443.     _find: function( target ) {
  14444.         var id = target.data( "ui-tooltip-id" );
  14445.         return id ? this.tooltips[ id ] : null;
  14446.     },
  14447.  
  14448.     _removeTooltip: function( tooltip ) {
  14449.         tooltip.remove();
  14450.         delete this.tooltips[ tooltip.attr( "id" ) ];
  14451.     },
  14452.  
  14453.     _destroy: function() {
  14454.         var that = this;
  14455.  
  14456.         // close open tooltips
  14457.         $.each( this.tooltips, function( id, tooltipData ) {
  14458.             // Delegate to close method to handle common cleanup
  14459.             var event = $.Event( "blur" ),
  14460.                 element = tooltipData.element;
  14461.             event.target = event.currentTarget = element[ 0 ];
  14462.             that.close( event, true );
  14463.  
  14464.             // Remove immediately; destroying an open tooltip doesn't use the
  14465.             // hide animation
  14466.             $( "#" + id ).remove();
  14467.  
  14468.             // Restore the title
  14469.             if ( element.data( "ui-tooltip-title" ) ) {
  14470.                 // If the title attribute has changed since open(), don't restore
  14471.                 if ( !element.attr( "title" ) ) {
  14472.                     element.attr( "title", element.data( "ui-tooltip-title" ) );
  14473.                 }
  14474.                 element.removeData( "ui-tooltip-title" );
  14475.             }
  14476.         });
  14477.         this.liveRegion.remove();
  14478.     }
  14479. });
  14480.  
  14481.  
  14482. /*!
  14483.  * jQuery UI Effects 1.11.4
  14484.  * http://jqueryui.com
  14485.  *
  14486.  * Copyright jQuery Foundation and other contributors
  14487.  * Released under the MIT license.
  14488.  * http://jquery.org/license
  14489.  *
  14490.  * http://api.jqueryui.com/category/effects-core/
  14491.  */
  14492.  
  14493.  
  14494. var dataSpace = "ui-effects-",
  14495.  
  14496.     // Create a local jQuery because jQuery Color relies on it and the
  14497.     // global may not exist with AMD and a custom build (#10199)
  14498.     jQuery = $;
  14499.  
  14500. $.effects = {
  14501.     effect: {}
  14502. };
  14503.  
  14504. /*!
  14505.  * jQuery Color Animations v2.1.2
  14506.  * https://github.com/jquery/jquery-color
  14507.  *
  14508.  * Copyright 2014 jQuery Foundation and other contributors
  14509.  * Released under the MIT license.
  14510.  * http://jquery.org/license
  14511.  *
  14512.  * Date: Wed Jan 16 08:47:09 2013 -0600
  14513.  */
  14514. (function( jQuery, undefined ) {
  14515.  
  14516.     var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  14517.  
  14518.     // plusequals test for += 100 -= 100
  14519.     rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  14520.     // a set of RE's that can match strings and generate color tuples.
  14521.     stringParsers = [ {
  14522.             re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14523.             parse: function( execResult ) {
  14524.                 return [
  14525.                     execResult[ 1 ],
  14526.                     execResult[ 2 ],
  14527.                     execResult[ 3 ],
  14528.                     execResult[ 4 ]
  14529.                 ];
  14530.             }
  14531.         }, {
  14532.             re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14533.             parse: function( execResult ) {
  14534.                 return [
  14535.                     execResult[ 1 ] * 2.55,
  14536.                     execResult[ 2 ] * 2.55,
  14537.                     execResult[ 3 ] * 2.55,
  14538.                     execResult[ 4 ]
  14539.                 ];
  14540.             }
  14541.         }, {
  14542.             // this regex ignores A-F because it's compared against an already lowercased string
  14543.             re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  14544.             parse: function( execResult ) {
  14545.                 return [
  14546.                     parseInt( execResult[ 1 ], 16 ),
  14547.                     parseInt( execResult[ 2 ], 16 ),
  14548.                     parseInt( execResult[ 3 ], 16 )
  14549.                 ];
  14550.             }
  14551.         }, {
  14552.             // this regex ignores A-F because it's compared against an already lowercased string
  14553.             re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  14554.             parse: function( execResult ) {
  14555.                 return [
  14556.                     parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  14557.                     parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  14558.                     parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  14559.                 ];
  14560.             }
  14561.         }, {
  14562.             re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14563.             space: "hsla",
  14564.             parse: function( execResult ) {
  14565.                 return [
  14566.                     execResult[ 1 ],
  14567.                     execResult[ 2 ] / 100,
  14568.                     execResult[ 3 ] / 100,
  14569.                     execResult[ 4 ]
  14570.                 ];
  14571.             }
  14572.         } ],
  14573.  
  14574.     // jQuery.Color( )
  14575.     color = jQuery.Color = function( color, green, blue, alpha ) {
  14576.         return new jQuery.Color.fn.parse( color, green, blue, alpha );
  14577.     },
  14578.     spaces = {
  14579.         rgba: {
  14580.             props: {
  14581.                 red: {
  14582.                     idx: 0,
  14583.                     type: "byte"
  14584.                 },
  14585.                 green: {
  14586.                     idx: 1,
  14587.                     type: "byte"
  14588.                 },
  14589.                 blue: {
  14590.                     idx: 2,
  14591.                     type: "byte"
  14592.                 }
  14593.             }
  14594.         },
  14595.  
  14596.         hsla: {
  14597.             props: {
  14598.                 hue: {
  14599.                     idx: 0,
  14600.                     type: "degrees"
  14601.                 },
  14602.                 saturation: {
  14603.                     idx: 1,
  14604.                     type: "percent"
  14605.                 },
  14606.                 lightness: {
  14607.                     idx: 2,
  14608.                     type: "percent"
  14609.                 }
  14610.             }
  14611.         }
  14612.     },
  14613.     propTypes = {
  14614.         "byte": {
  14615.             floor: true,
  14616.             max: 255
  14617.         },
  14618.         "percent": {
  14619.             max: 1
  14620.         },
  14621.         "degrees": {
  14622.             mod: 360,
  14623.             floor: true
  14624.         }
  14625.     },
  14626.     support = color.support = {},
  14627.  
  14628.     // element for support tests
  14629.     supportElem = jQuery( "<p>" )[ 0 ],
  14630.  
  14631.     // colors = jQuery.Color.names
  14632.     colors,
  14633.  
  14634.     // local aliases of functions called often
  14635.     each = jQuery.each;
  14636.  
  14637. // determine rgba support immediately
  14638. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  14639. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  14640.  
  14641. // define cache name and alpha properties
  14642. // for rgba and hsla spaces
  14643. each( spaces, function( spaceName, space ) {
  14644.     space.cache = "_" + spaceName;
  14645.     space.props.alpha = {
  14646.         idx: 3,
  14647.         type: "percent",
  14648.         def: 1
  14649.     };
  14650. });
  14651.  
  14652. function clamp( value, prop, allowEmpty ) {
  14653.     var type = propTypes[ prop.type ] || {};
  14654.  
  14655.     if ( value == null ) {
  14656.         return (allowEmpty || !prop.def) ? null : prop.def;
  14657.     }
  14658.  
  14659.     // ~~ is an short way of doing floor for positive numbers
  14660.     value = type.floor ? ~~value : parseFloat( value );
  14661.  
  14662.     // IE will pass in empty strings as value for alpha,
  14663.     // which will hit this case
  14664.     if ( isNaN( value ) ) {
  14665.         return prop.def;
  14666.     }
  14667.  
  14668.     if ( type.mod ) {
  14669.         // we add mod before modding to make sure that negatives values
  14670.         // get converted properly: -10 -> 350
  14671.         return (value + type.mod) % type.mod;
  14672.     }
  14673.  
  14674.     // for now all property types without mod have min and max
  14675.     return 0 > value ? 0 : type.max < value ? type.max : value;
  14676. }
  14677.  
  14678. function stringParse( string ) {
  14679.     var inst = color(),
  14680.         rgba = inst._rgba = [];
  14681.  
  14682.     string = string.toLowerCase();
  14683.  
  14684.     each( stringParsers, function( i, parser ) {
  14685.         var parsed,
  14686.             match = parser.re.exec( string ),
  14687.             values = match && parser.parse( match ),
  14688.             spaceName = parser.space || "rgba";
  14689.  
  14690.         if ( values ) {
  14691.             parsed = inst[ spaceName ]( values );
  14692.  
  14693.             // if this was an rgba parse the assignment might happen twice
  14694.             // oh well....
  14695.             inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  14696.             rgba = inst._rgba = parsed._rgba;
  14697.  
  14698.             // exit each( stringParsers ) here because we matched
  14699.             return false;
  14700.         }
  14701.     });
  14702.  
  14703.     // Found a stringParser that handled it
  14704.     if ( rgba.length ) {
  14705.  
  14706.         // if this came from a parsed string, force "transparent" when alpha is 0
  14707.         // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  14708.         if ( rgba.join() === "0,0,0,0" ) {
  14709.             jQuery.extend( rgba, colors.transparent );
  14710.         }
  14711.         return inst;
  14712.     }
  14713.  
  14714.     // named colors
  14715.     return colors[ string ];
  14716. }
  14717.  
  14718. color.fn = jQuery.extend( color.prototype, {
  14719.     parse: function( red, green, blue, alpha ) {
  14720.         if ( red === undefined ) {
  14721.             this._rgba = [ null, null, null, null ];
  14722.             return this;
  14723.         }
  14724.         if ( red.jquery || red.nodeType ) {
  14725.             red = jQuery( red ).css( green );
  14726.             green = undefined;
  14727.         }
  14728.  
  14729.         var inst = this,
  14730.             type = jQuery.type( red ),
  14731.             rgba = this._rgba = [];
  14732.  
  14733.         // more than 1 argument specified - assume ( red, green, blue, alpha )
  14734.         if ( green !== undefined ) {
  14735.             red = [ red, green, blue, alpha ];
  14736.             type = "array";
  14737.         }
  14738.  
  14739.         if ( type === "string" ) {
  14740.             return this.parse( stringParse( red ) || colors._default );
  14741.         }
  14742.  
  14743.         if ( type === "array" ) {
  14744.             each( spaces.rgba.props, function( key, prop ) {
  14745.                 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  14746.             });
  14747.             return this;
  14748.         }
  14749.  
  14750.         if ( type === "object" ) {
  14751.             if ( red instanceof color ) {
  14752.                 each( spaces, function( spaceName, space ) {
  14753.                     if ( red[ space.cache ] ) {
  14754.                         inst[ space.cache ] = red[ space.cache ].slice();
  14755.                     }
  14756.                 });
  14757.             } else {
  14758.                 each( spaces, function( spaceName, space ) {
  14759.                     var cache = space.cache;
  14760.                     each( space.props, function( key, prop ) {
  14761.  
  14762.                         // if the cache doesn't exist, and we know how to convert
  14763.                         if ( !inst[ cache ] && space.to ) {
  14764.  
  14765.                             // if the value was null, we don't need to copy it
  14766.                             // if the key was alpha, we don't need to copy it either
  14767.                             if ( key === "alpha" || red[ key ] == null ) {
  14768.                                 return;
  14769.                             }
  14770.                             inst[ cache ] = space.to( inst._rgba );
  14771.                         }
  14772.  
  14773.                         // this is the only case where we allow nulls for ALL properties.
  14774.                         // call clamp with alwaysAllowEmpty
  14775.                         inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  14776.                     });
  14777.  
  14778.                     // everything defined but alpha?
  14779.                     if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  14780.                         // use the default of 1
  14781.                         inst[ cache ][ 3 ] = 1;
  14782.                         if ( space.from ) {
  14783.                             inst._rgba = space.from( inst[ cache ] );
  14784.                         }
  14785.                     }
  14786.                 });
  14787.             }
  14788.             return this;
  14789.         }
  14790.     },
  14791.     is: function( compare ) {
  14792.         var is = color( compare ),
  14793.             same = true,
  14794.             inst = this;
  14795.  
  14796.         each( spaces, function( _, space ) {
  14797.             var localCache,
  14798.                 isCache = is[ space.cache ];
  14799.             if (isCache) {
  14800.                 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  14801.                 each( space.props, function( _, prop ) {
  14802.                     if ( isCache[ prop.idx ] != null ) {
  14803.                         same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  14804.                         return same;
  14805.                     }
  14806.                 });
  14807.             }
  14808.             return same;
  14809.         });
  14810.         return same;
  14811.     },
  14812.     _space: function() {
  14813.         var used = [],
  14814.             inst = this;
  14815.         each( spaces, function( spaceName, space ) {
  14816.             if ( inst[ space.cache ] ) {
  14817.                 used.push( spaceName );
  14818.             }
  14819.         });
  14820.         return used.pop();
  14821.     },
  14822.     transition: function( other, distance ) {
  14823.         var end = color( other ),
  14824.             spaceName = end._space(),
  14825.             space = spaces[ spaceName ],
  14826.             startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  14827.             start = startColor[ space.cache ] || space.to( startColor._rgba ),
  14828.             result = start.slice();
  14829.  
  14830.         end = end[ space.cache ];
  14831.         each( space.props, function( key, prop ) {
  14832.             var index = prop.idx,
  14833.                 startValue = start[ index ],
  14834.                 endValue = end[ index ],
  14835.                 type = propTypes[ prop.type ] || {};
  14836.  
  14837.             // if null, don't override start value
  14838.             if ( endValue === null ) {
  14839.                 return;
  14840.             }
  14841.             // if null - use end
  14842.             if ( startValue === null ) {
  14843.                 result[ index ] = endValue;
  14844.             } else {
  14845.                 if ( type.mod ) {
  14846.                     if ( endValue - startValue > type.mod / 2 ) {
  14847.                         startValue += type.mod;
  14848.                     } else if ( startValue - endValue > type.mod / 2 ) {
  14849.                         startValue -= type.mod;
  14850.                     }
  14851.                 }
  14852.                 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  14853.             }
  14854.         });
  14855.         return this[ spaceName ]( result );
  14856.     },
  14857.     blend: function( opaque ) {
  14858.         // if we are already opaque - return ourself
  14859.         if ( this._rgba[ 3 ] === 1 ) {
  14860.             return this;
  14861.         }
  14862.  
  14863.         var rgb = this._rgba.slice(),
  14864.             a = rgb.pop(),
  14865.             blend = color( opaque )._rgba;
  14866.  
  14867.         return color( jQuery.map( rgb, function( v, i ) {
  14868.             return ( 1 - a ) * blend[ i ] + a * v;
  14869.         }));
  14870.     },
  14871.     toRgbaString: function() {
  14872.         var prefix = "rgba(",
  14873.             rgba = jQuery.map( this._rgba, function( v, i ) {
  14874.                 return v == null ? ( i > 2 ? 1 : 0 ) : v;
  14875.             });
  14876.  
  14877.         if ( rgba[ 3 ] === 1 ) {
  14878.             rgba.pop();
  14879.             prefix = "rgb(";
  14880.         }
  14881.  
  14882.         return prefix + rgba.join() + ")";
  14883.     },
  14884.     toHslaString: function() {
  14885.         var prefix = "hsla(",
  14886.             hsla = jQuery.map( this.hsla(), function( v, i ) {
  14887.                 if ( v == null ) {
  14888.                     v = i > 2 ? 1 : 0;
  14889.                 }
  14890.  
  14891.                 // catch 1 and 2
  14892.                 if ( i && i < 3 ) {
  14893.                     v = Math.round( v * 100 ) + "%";
  14894.                 }
  14895.                 return v;
  14896.             });
  14897.  
  14898.         if ( hsla[ 3 ] === 1 ) {
  14899.             hsla.pop();
  14900.             prefix = "hsl(";
  14901.         }
  14902.         return prefix + hsla.join() + ")";
  14903.     },
  14904.     toHexString: function( includeAlpha ) {
  14905.         var rgba = this._rgba.slice(),
  14906.             alpha = rgba.pop();
  14907.  
  14908.         if ( includeAlpha ) {
  14909.             rgba.push( ~~( alpha * 255 ) );
  14910.         }
  14911.  
  14912.         return "#" + jQuery.map( rgba, function( v ) {
  14913.  
  14914.             // default to 0 when nulls exist
  14915.             v = ( v || 0 ).toString( 16 );
  14916.             return v.length === 1 ? "0" + v : v;
  14917.         }).join("");
  14918.     },
  14919.     toString: function() {
  14920.         return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  14921.     }
  14922. });
  14923. color.fn.parse.prototype = color.fn;
  14924.  
  14925. // hsla conversions adapted from:
  14926. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  14927.  
  14928. function hue2rgb( p, q, h ) {
  14929.     h = ( h + 1 ) % 1;
  14930.     if ( h * 6 < 1 ) {
  14931.         return p + ( q - p ) * h * 6;
  14932.     }
  14933.     if ( h * 2 < 1) {
  14934.         return q;
  14935.     }
  14936.     if ( h * 3 < 2 ) {
  14937.         return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  14938.     }
  14939.     return p;
  14940. }
  14941.  
  14942. spaces.hsla.to = function( rgba ) {
  14943.     if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  14944.         return [ null, null, null, rgba[ 3 ] ];
  14945.     }
  14946.     var r = rgba[ 0 ] / 255,
  14947.         g = rgba[ 1 ] / 255,
  14948.         b = rgba[ 2 ] / 255,
  14949.         a = rgba[ 3 ],
  14950.         max = Math.max( r, g, b ),
  14951.         min = Math.min( r, g, b ),
  14952.         diff = max - min,
  14953.         add = max + min,
  14954.         l = add * 0.5,
  14955.         h, s;
  14956.  
  14957.     if ( min === max ) {
  14958.         h = 0;
  14959.     } else if ( r === max ) {
  14960.         h = ( 60 * ( g - b ) / diff ) + 360;
  14961.     } else if ( g === max ) {
  14962.         h = ( 60 * ( b - r ) / diff ) + 120;
  14963.     } else {
  14964.         h = ( 60 * ( r - g ) / diff ) + 240;
  14965.     }
  14966.  
  14967.     // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  14968.     // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  14969.     if ( diff === 0 ) {
  14970.         s = 0;
  14971.     } else if ( l <= 0.5 ) {
  14972.         s = diff / add;
  14973.     } else {
  14974.         s = diff / ( 2 - add );
  14975.     }
  14976.     return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  14977. };
  14978.  
  14979. spaces.hsla.from = function( hsla ) {
  14980.     if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  14981.         return [ null, null, null, hsla[ 3 ] ];
  14982.     }
  14983.     var h = hsla[ 0 ] / 360,
  14984.         s = hsla[ 1 ],
  14985.         l = hsla[ 2 ],
  14986.         a = hsla[ 3 ],
  14987.         q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  14988.         p = 2 * l - q;
  14989.  
  14990.     return [
  14991.         Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  14992.         Math.round( hue2rgb( p, q, h ) * 255 ),
  14993.         Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  14994.         a
  14995.     ];
  14996. };
  14997.  
  14998. each( spaces, function( spaceName, space ) {
  14999.     var props = space.props,
  15000.         cache = space.cache,
  15001.         to = space.to,
  15002.         from = space.from;
  15003.  
  15004.     // makes rgba() and hsla()
  15005.     color.fn[ spaceName ] = function( value ) {
  15006.  
  15007.         // generate a cache for this space if it doesn't exist
  15008.         if ( to && !this[ cache ] ) {
  15009.             this[ cache ] = to( this._rgba );
  15010.         }
  15011.         if ( value === undefined ) {
  15012.             return this[ cache ].slice();
  15013.         }
  15014.  
  15015.         var ret,
  15016.             type = jQuery.type( value ),
  15017.             arr = ( type === "array" || type === "object" ) ? value : arguments,
  15018.             local = this[ cache ].slice();
  15019.  
  15020.         each( props, function( key, prop ) {
  15021.             var val = arr[ type === "object" ? key : prop.idx ];
  15022.             if ( val == null ) {
  15023.                 val = local[ prop.idx ];
  15024.             }
  15025.             local[ prop.idx ] = clamp( val, prop );
  15026.         });
  15027.  
  15028.         if ( from ) {
  15029.             ret = color( from( local ) );
  15030.             ret[ cache ] = local;
  15031.             return ret;
  15032.         } else {
  15033.             return color( local );
  15034.         }
  15035.     };
  15036.  
  15037.     // makes red() green() blue() alpha() hue() saturation() lightness()
  15038.     each( props, function( key, prop ) {
  15039.         // alpha is included in more than one space
  15040.         if ( color.fn[ key ] ) {
  15041.             return;
  15042.         }
  15043.         color.fn[ key ] = function( value ) {
  15044.             var vtype = jQuery.type( value ),
  15045.                 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  15046.                 local = this[ fn ](),
  15047.                 cur = local[ prop.idx ],
  15048.                 match;
  15049.  
  15050.             if ( vtype === "undefined" ) {
  15051.                 return cur;
  15052.             }
  15053.  
  15054.             if ( vtype === "function" ) {
  15055.                 value = value.call( this, cur );
  15056.                 vtype = jQuery.type( value );
  15057.             }
  15058.             if ( value == null && prop.empty ) {
  15059.                 return this;
  15060.             }
  15061.             if ( vtype === "string" ) {
  15062.                 match = rplusequals.exec( value );
  15063.                 if ( match ) {
  15064.                     value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  15065.                 }
  15066.             }
  15067.             local[ prop.idx ] = value;
  15068.             return this[ fn ]( local );
  15069.         };
  15070.     });
  15071. });
  15072.  
  15073. // add cssHook and .fx.step function for each named hook.
  15074. // accept a space separated string of properties
  15075. color.hook = function( hook ) {
  15076.     var hooks = hook.split( " " );
  15077.     each( hooks, function( i, hook ) {
  15078.         jQuery.cssHooks[ hook ] = {
  15079.             set: function( elem, value ) {
  15080.                 var parsed, curElem,
  15081.                     backgroundColor = "";
  15082.  
  15083.                 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  15084.                     value = color( parsed || value );
  15085.                     if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  15086.                         curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  15087.                         while (
  15088.                             (backgroundColor === "" || backgroundColor === "transparent") &&
  15089.                             curElem && curElem.style
  15090.                         ) {
  15091.                             try {
  15092.                                 backgroundColor = jQuery.css( curElem, "backgroundColor" );
  15093.                                 curElem = curElem.parentNode;
  15094.                             } catch ( e ) {
  15095.                             }
  15096.                         }
  15097.  
  15098.                         value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  15099.                             backgroundColor :
  15100.                             "_default" );
  15101.                     }
  15102.  
  15103.                     value = value.toRgbaString();
  15104.                 }
  15105.                 try {
  15106.                     elem.style[ hook ] = value;
  15107.                 } catch ( e ) {
  15108.                     // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  15109.                 }
  15110.             }
  15111.         };
  15112.         jQuery.fx.step[ hook ] = function( fx ) {
  15113.             if ( !fx.colorInit ) {
  15114.                 fx.start = color( fx.elem, hook );
  15115.                 fx.end = color( fx.end );
  15116.                 fx.colorInit = true;
  15117.             }
  15118.             jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  15119.         };
  15120.     });
  15121.  
  15122. };
  15123.  
  15124. color.hook( stepHooks );
  15125.  
  15126. jQuery.cssHooks.borderColor = {
  15127.     expand: function( value ) {
  15128.         var expanded = {};
  15129.  
  15130.         each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  15131.             expanded[ "border" + part + "Color" ] = value;
  15132.         });
  15133.         return expanded;
  15134.     }
  15135. };
  15136.  
  15137. // Basic color names only.
  15138. // Usage of any of the other color names requires adding yourself or including
  15139. // jquery.color.svg-names.js.
  15140. colors = jQuery.Color.names = {
  15141.     // 4.1. Basic color keywords
  15142.     aqua: "#00ffff",
  15143.     black: "#000000",
  15144.     blue: "#0000ff",
  15145.     fuchsia: "#ff00ff",
  15146.     gray: "#808080",
  15147.     green: "#008000",
  15148.     lime: "#00ff00",
  15149.     maroon: "#800000",
  15150.     navy: "#000080",
  15151.     olive: "#808000",
  15152.     purple: "#800080",
  15153.     red: "#ff0000",
  15154.     silver: "#c0c0c0",
  15155.     teal: "#008080",
  15156.     white: "#ffffff",
  15157.     yellow: "#ffff00",
  15158.  
  15159.     // 4.2.3. "transparent" color keyword
  15160.     transparent: [ null, null, null, 0 ],
  15161.  
  15162.     _default: "#ffffff"
  15163. };
  15164.  
  15165. })( jQuery );
  15166.  
  15167. /******************************************************************************/
  15168. /****************************** CLASS ANIMATIONS ******************************/
  15169. /******************************************************************************/
  15170. (function() {
  15171.  
  15172. var classAnimationActions = [ "add", "remove", "toggle" ],
  15173.     shorthandStyles = {
  15174.         border: 1,
  15175.         borderBottom: 1,
  15176.         borderColor: 1,
  15177.         borderLeft: 1,
  15178.         borderRight: 1,
  15179.         borderTop: 1,
  15180.         borderWidth: 1,
  15181.         margin: 1,
  15182.         padding: 1
  15183.     };
  15184.  
  15185. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  15186.     $.fx.step[ prop ] = function( fx ) {
  15187.         if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  15188.             jQuery.style( fx.elem, prop, fx.end );
  15189.             fx.setAttr = true;
  15190.         }
  15191.     };
  15192. });
  15193.  
  15194. function getElementStyles( elem ) {
  15195.     var key, len,
  15196.         style = elem.ownerDocument.defaultView ?
  15197.             elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  15198.             elem.currentStyle,
  15199.         styles = {};
  15200.  
  15201.     if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  15202.         len = style.length;
  15203.         while ( len-- ) {
  15204.             key = style[ len ];
  15205.             if ( typeof style[ key ] === "string" ) {
  15206.                 styles[ $.camelCase( key ) ] = style[ key ];
  15207.             }
  15208.         }
  15209.     // support: Opera, IE <9
  15210.     } else {
  15211.         for ( key in style ) {
  15212.             if ( typeof style[ key ] === "string" ) {
  15213.                 styles[ key ] = style[ key ];
  15214.             }
  15215.         }
  15216.     }
  15217.  
  15218.     return styles;
  15219. }
  15220.  
  15221. function styleDifference( oldStyle, newStyle ) {
  15222.     var diff = {},
  15223.         name, value;
  15224.  
  15225.     for ( name in newStyle ) {
  15226.         value = newStyle[ name ];
  15227.         if ( oldStyle[ name ] !== value ) {
  15228.             if ( !shorthandStyles[ name ] ) {
  15229.                 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  15230.                     diff[ name ] = value;
  15231.                 }
  15232.             }
  15233.         }
  15234.     }
  15235.  
  15236.     return diff;
  15237. }
  15238.  
  15239. // support: jQuery <1.8
  15240. if ( !$.fn.addBack ) {
  15241.     $.fn.addBack = function( selector ) {
  15242.         return this.add( selector == null ?
  15243.             this.prevObject : this.prevObject.filter( selector )
  15244.         );
  15245.     };
  15246. }
  15247.  
  15248. $.effects.animateClass = function( value, duration, easing, callback ) {
  15249.     var o = $.speed( duration, easing, callback );
  15250.  
  15251.     return this.queue( function() {
  15252.         var animated = $( this ),
  15253.             baseClass = animated.attr( "class" ) || "",
  15254.             applyClassChange,
  15255.             allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  15256.  
  15257.         // map the animated objects to store the original styles.
  15258.         allAnimations = allAnimations.map(function() {
  15259.             var el = $( this );
  15260.             return {
  15261.                 el: el,
  15262.                 start: getElementStyles( this )
  15263.             };
  15264.         });
  15265.  
  15266.         // apply class change
  15267.         applyClassChange = function() {
  15268.             $.each( classAnimationActions, function(i, action) {
  15269.                 if ( value[ action ] ) {
  15270.                     animated[ action + "Class" ]( value[ action ] );
  15271.                 }
  15272.             });
  15273.         };
  15274.         applyClassChange();
  15275.  
  15276.         // map all animated objects again - calculate new styles and diff
  15277.         allAnimations = allAnimations.map(function() {
  15278.             this.end = getElementStyles( this.el[ 0 ] );
  15279.             this.diff = styleDifference( this.start, this.end );
  15280.             return this;
  15281.         });
  15282.  
  15283.         // apply original class
  15284.         animated.attr( "class", baseClass );
  15285.  
  15286.         // map all animated objects again - this time collecting a promise
  15287.         allAnimations = allAnimations.map(function() {
  15288.             var styleInfo = this,
  15289.                 dfd = $.Deferred(),
  15290.                 opts = $.extend({}, o, {
  15291.                     queue: false,
  15292.                     complete: function() {
  15293.                         dfd.resolve( styleInfo );
  15294.                     }
  15295.                 });
  15296.  
  15297.             this.el.animate( this.diff, opts );
  15298.             return dfd.promise();
  15299.         });
  15300.  
  15301.         // once all animations have completed:
  15302.         $.when.apply( $, allAnimations.get() ).done(function() {
  15303.  
  15304.             // set the final class
  15305.             applyClassChange();
  15306.  
  15307.             // for each animated element,
  15308.             // clear all css properties that were animated
  15309.             $.each( arguments, function() {
  15310.                 var el = this.el;
  15311.                 $.each( this.diff, function(key) {
  15312.                     el.css( key, "" );
  15313.                 });
  15314.             });
  15315.  
  15316.             // this is guarnteed to be there if you use jQuery.speed()
  15317.             // it also handles dequeuing the next anim...
  15318.             o.complete.call( animated[ 0 ] );
  15319.         });
  15320.     });
  15321. };
  15322.  
  15323. $.fn.extend({
  15324.     addClass: (function( orig ) {
  15325.         return function( classNames, speed, easing, callback ) {
  15326.             return speed ?
  15327.                 $.effects.animateClass.call( this,
  15328.                     { add: classNames }, speed, easing, callback ) :
  15329.                 orig.apply( this, arguments );
  15330.         };
  15331.     })( $.fn.addClass ),
  15332.  
  15333.     removeClass: (function( orig ) {
  15334.         return function( classNames, speed, easing, callback ) {
  15335.             return arguments.length > 1 ?
  15336.                 $.effects.animateClass.call( this,
  15337.                     { remove: classNames }, speed, easing, callback ) :
  15338.                 orig.apply( this, arguments );
  15339.         };
  15340.     })( $.fn.removeClass ),
  15341.  
  15342.     toggleClass: (function( orig ) {
  15343.         return function( classNames, force, speed, easing, callback ) {
  15344.             if ( typeof force === "boolean" || force === undefined ) {
  15345.                 if ( !speed ) {
  15346.                     // without speed parameter
  15347.                     return orig.apply( this, arguments );
  15348.                 } else {
  15349.                     return $.effects.animateClass.call( this,
  15350.                         (force ? { add: classNames } : { remove: classNames }),
  15351.                         speed, easing, callback );
  15352.                 }
  15353.             } else {
  15354.                 // without force parameter
  15355.                 return $.effects.animateClass.call( this,
  15356.                     { toggle: classNames }, force, speed, easing );
  15357.             }
  15358.         };
  15359.     })( $.fn.toggleClass ),
  15360.  
  15361.     switchClass: function( remove, add, speed, easing, callback) {
  15362.         return $.effects.animateClass.call( this, {
  15363.             add: add,
  15364.             remove: remove
  15365.         }, speed, easing, callback );
  15366.     }
  15367. });
  15368.  
  15369. })();
  15370.  
  15371. /******************************************************************************/
  15372. /*********************************** EFFECTS **********************************/
  15373. /******************************************************************************/
  15374.  
  15375. (function() {
  15376.  
  15377. $.extend( $.effects, {
  15378.     version: "1.11.4",
  15379.  
  15380.     // Saves a set of properties in a data storage
  15381.     save: function( element, set ) {
  15382.         for ( var i = 0; i < set.length; i++ ) {
  15383.             if ( set[ i ] !== null ) {
  15384.                 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  15385.             }
  15386.         }
  15387.     },
  15388.  
  15389.     // Restores a set of previously saved properties from a data storage
  15390.     restore: function( element, set ) {
  15391.         var val, i;
  15392.         for ( i = 0; i < set.length; i++ ) {
  15393.             if ( set[ i ] !== null ) {
  15394.                 val = element.data( dataSpace + set[ i ] );
  15395.                 // support: jQuery 1.6.2
  15396.                 // http://bugs.jquery.com/ticket/9917
  15397.                 // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  15398.                 // We can't differentiate between "" and 0 here, so we just assume
  15399.                 // empty string since it's likely to be a more common value...
  15400.                 if ( val === undefined ) {
  15401.                     val = "";
  15402.                 }
  15403.                 element.css( set[ i ], val );
  15404.             }
  15405.         }
  15406.     },
  15407.  
  15408.     setMode: function( el, mode ) {
  15409.         if (mode === "toggle") {
  15410.             mode = el.is( ":hidden" ) ? "show" : "hide";
  15411.         }
  15412.         return mode;
  15413.     },
  15414.  
  15415.     // Translates a [top,left] array into a baseline value
  15416.     // this should be a little more flexible in the future to handle a string & hash
  15417.     getBaseline: function( origin, original ) {
  15418.         var y, x;
  15419.         switch ( origin[ 0 ] ) {
  15420.             case "top": y = 0; break;
  15421.             case "middle": y = 0.5; break;
  15422.             case "bottom": y = 1; break;
  15423.             default: y = origin[ 0 ] / original.height;
  15424.         }
  15425.         switch ( origin[ 1 ] ) {
  15426.             case "left": x = 0; break;
  15427.             case "center": x = 0.5; break;
  15428.             case "right": x = 1; break;
  15429.             default: x = origin[ 1 ] / original.width;
  15430.         }
  15431.         return {
  15432.             x: x,
  15433.             y: y
  15434.         };
  15435.     },
  15436.  
  15437.     // Wraps the element around a wrapper that copies position properties
  15438.     createWrapper: function( element ) {
  15439.  
  15440.         // if the element is already wrapped, return it
  15441.         if ( element.parent().is( ".ui-effects-wrapper" )) {
  15442.             return element.parent();
  15443.         }
  15444.  
  15445.         // wrap the element
  15446.         var props = {
  15447.                 width: element.outerWidth(true),
  15448.                 height: element.outerHeight(true),
  15449.                 "float": element.css( "float" )
  15450.             },
  15451.             wrapper = $( "<div></div>" )
  15452.                 .addClass( "ui-effects-wrapper" )
  15453.                 .css({
  15454.                     fontSize: "100%",
  15455.                     background: "transparent",
  15456.                     border: "none",
  15457.                     margin: 0,
  15458.                     padding: 0
  15459.                 }),
  15460.             // Store the size in case width/height are defined in % - Fixes #5245
  15461.             size = {
  15462.                 width: element.width(),
  15463.                 height: element.height()
  15464.             },
  15465.             active = document.activeElement;
  15466.  
  15467.         // support: Firefox
  15468.         // Firefox incorrectly exposes anonymous content
  15469.         // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  15470.         try {
  15471.             active.id;
  15472.         } catch ( e ) {
  15473.             active = document.body;
  15474.         }
  15475.  
  15476.         element.wrap( wrapper );
  15477.  
  15478.         // Fixes #7595 - Elements lose focus when wrapped.
  15479.         if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  15480.             $( active ).focus();
  15481.         }
  15482.  
  15483.         wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  15484.  
  15485.         // transfer positioning properties to the wrapper
  15486.         if ( element.css( "position" ) === "static" ) {
  15487.             wrapper.css({ position: "relative" });
  15488.             element.css({ position: "relative" });
  15489.         } else {
  15490.             $.extend( props, {
  15491.                 position: element.css( "position" ),
  15492.                 zIndex: element.css( "z-index" )
  15493.             });
  15494.             $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  15495.                 props[ pos ] = element.css( pos );
  15496.                 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  15497.                     props[ pos ] = "auto";
  15498.                 }
  15499.             });
  15500.             element.css({
  15501.                 position: "relative",
  15502.                 top: 0,
  15503.                 left: 0,
  15504.                 right: "auto",
  15505.                 bottom: "auto"
  15506.             });
  15507.         }
  15508.         element.css(size);
  15509.  
  15510.         return wrapper.css( props ).show();
  15511.     },
  15512.  
  15513.     removeWrapper: function( element ) {
  15514.         var active = document.activeElement;
  15515.  
  15516.         if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  15517.             element.parent().replaceWith( element );
  15518.  
  15519.             // Fixes #7595 - Elements lose focus when wrapped.
  15520.             if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  15521.                 $( active ).focus();
  15522.             }
  15523.         }
  15524.  
  15525.         return element;
  15526.     },
  15527.  
  15528.     setTransition: function( element, list, factor, value ) {
  15529.         value = value || {};
  15530.         $.each( list, function( i, x ) {
  15531.             var unit = element.cssUnit( x );
  15532.             if ( unit[ 0 ] > 0 ) {
  15533.                 value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  15534.             }
  15535.         });
  15536.         return value;
  15537.     }
  15538. });
  15539.  
  15540. // return an effect options object for the given parameters:
  15541. function _normalizeArguments( effect, options, speed, callback ) {
  15542.  
  15543.     // allow passing all options as the first parameter
  15544.     if ( $.isPlainObject( effect ) ) {
  15545.         options = effect;
  15546.         effect = effect.effect;
  15547.     }
  15548.  
  15549.     // convert to an object
  15550.     effect = { effect: effect };
  15551.  
  15552.     // catch (effect, null, ...)
  15553.     if ( options == null ) {
  15554.         options = {};
  15555.     }
  15556.  
  15557.     // catch (effect, callback)
  15558.     if ( $.isFunction( options ) ) {
  15559.         callback = options;
  15560.         speed = null;
  15561.         options = {};
  15562.     }
  15563.  
  15564.     // catch (effect, speed, ?)
  15565.     if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  15566.         callback = speed;
  15567.         speed = options;
  15568.         options = {};
  15569.     }
  15570.  
  15571.     // catch (effect, options, callback)
  15572.     if ( $.isFunction( speed ) ) {
  15573.         callback = speed;
  15574.         speed = null;
  15575.     }
  15576.  
  15577.     // add options to effect
  15578.     if ( options ) {
  15579.         $.extend( effect, options );
  15580.     }
  15581.  
  15582.     speed = speed || options.duration;
  15583.     effect.duration = $.fx.off ? 0 :
  15584.         typeof speed === "number" ? speed :
  15585.         speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  15586.         $.fx.speeds._default;
  15587.  
  15588.     effect.complete = callback || options.complete;
  15589.  
  15590.     return effect;
  15591. }
  15592.  
  15593. function standardAnimationOption( option ) {
  15594.     // Valid standard speeds (nothing, number, named speed)
  15595.     if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  15596.         return true;
  15597.     }
  15598.  
  15599.     // Invalid strings - treat as "normal" speed
  15600.     if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  15601.         return true;
  15602.     }
  15603.  
  15604.     // Complete callback
  15605.     if ( $.isFunction( option ) ) {
  15606.         return true;
  15607.     }
  15608.  
  15609.     // Options hash (but not naming an effect)
  15610.     if ( typeof option === "object" && !option.effect ) {
  15611.         return true;
  15612.     }
  15613.  
  15614.     // Didn't match any standard API
  15615.     return false;
  15616. }
  15617.  
  15618. $.fn.extend({
  15619.     effect: function( /* effect, options, speed, callback */ ) {
  15620.         var args = _normalizeArguments.apply( this, arguments ),
  15621.             mode = args.mode,
  15622.             queue = args.queue,
  15623.             effectMethod = $.effects.effect[ args.effect ];
  15624.  
  15625.         if ( $.fx.off || !effectMethod ) {
  15626.             // delegate to the original method (e.g., .show()) if possible
  15627.             if ( mode ) {
  15628.                 return this[ mode ]( args.duration, args.complete );
  15629.             } else {
  15630.                 return this.each( function() {
  15631.                     if ( args.complete ) {
  15632.                         args.complete.call( this );
  15633.                     }
  15634.                 });
  15635.             }
  15636.         }
  15637.  
  15638.         function run( next ) {
  15639.             var elem = $( this ),
  15640.                 complete = args.complete,
  15641.                 mode = args.mode;
  15642.  
  15643.             function done() {
  15644.                 if ( $.isFunction( complete ) ) {
  15645.                     complete.call( elem[0] );
  15646.                 }
  15647.                 if ( $.isFunction( next ) ) {
  15648.                     next();
  15649.                 }
  15650.             }
  15651.  
  15652.             // If the element already has the correct final state, delegate to
  15653.             // the core methods so the internal tracking of "olddisplay" works.
  15654.             if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  15655.                 elem[ mode ]();
  15656.                 done();
  15657.             } else {
  15658.                 effectMethod.call( elem[0], args, done );
  15659.             }
  15660.         }
  15661.  
  15662.         return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  15663.     },
  15664.  
  15665.     show: (function( orig ) {
  15666.         return function( option ) {
  15667.             if ( standardAnimationOption( option ) ) {
  15668.                 return orig.apply( this, arguments );
  15669.             } else {
  15670.                 var args = _normalizeArguments.apply( this, arguments );
  15671.                 args.mode = "show";
  15672.                 return this.effect.call( this, args );
  15673.             }
  15674.         };
  15675.     })( $.fn.show ),
  15676.  
  15677.     hide: (function( orig ) {
  15678.         return function( option ) {
  15679.             if ( standardAnimationOption( option ) ) {
  15680.                 return orig.apply( this, arguments );
  15681.             } else {
  15682.                 var args = _normalizeArguments.apply( this, arguments );
  15683.                 args.mode = "hide";
  15684.                 return this.effect.call( this, args );
  15685.             }
  15686.         };
  15687.     })( $.fn.hide ),
  15688.  
  15689.     toggle: (function( orig ) {
  15690.         return function( option ) {
  15691.             if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  15692.                 return orig.apply( this, arguments );
  15693.             } else {
  15694.                 var args = _normalizeArguments.apply( this, arguments );
  15695.                 args.mode = "toggle";
  15696.                 return this.effect.call( this, args );
  15697.             }
  15698.         };
  15699.     })( $.fn.toggle ),
  15700.  
  15701.     // helper functions
  15702.     cssUnit: function(key) {
  15703.         var style = this.css( key ),
  15704.             val = [];
  15705.  
  15706.         $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  15707.             if ( style.indexOf( unit ) > 0 ) {
  15708.                 val = [ parseFloat( style ), unit ];
  15709.             }
  15710.         });
  15711.         return val;
  15712.     }
  15713. });
  15714.  
  15715. })();
  15716.  
  15717. /******************************************************************************/
  15718. /*********************************** EASING ***********************************/
  15719. /******************************************************************************/
  15720.  
  15721. (function() {
  15722.  
  15723. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  15724.  
  15725. var baseEasings = {};
  15726.  
  15727. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  15728.     baseEasings[ name ] = function( p ) {
  15729.         return Math.pow( p, i + 2 );
  15730.     };
  15731. });
  15732.  
  15733. $.extend( baseEasings, {
  15734.     Sine: function( p ) {
  15735.         return 1 - Math.cos( p * Math.PI / 2 );
  15736.     },
  15737.     Circ: function( p ) {
  15738.         return 1 - Math.sqrt( 1 - p * p );
  15739.     },
  15740.     Elastic: function( p ) {
  15741.         return p === 0 || p === 1 ? p :
  15742.             -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  15743.     },
  15744.     Back: function( p ) {
  15745.         return p * p * ( 3 * p - 2 );
  15746.     },
  15747.     Bounce: function( p ) {
  15748.         var pow2,
  15749.             bounce = 4;
  15750.  
  15751.         while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  15752.         return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  15753.     }
  15754. });
  15755.  
  15756. $.each( baseEasings, function( name, easeIn ) {
  15757.     $.easing[ "easeIn" + name ] = easeIn;
  15758.     $.easing[ "easeOut" + name ] = function( p ) {
  15759.         return 1 - easeIn( 1 - p );
  15760.     };
  15761.     $.easing[ "easeInOut" + name ] = function( p ) {
  15762.         return p < 0.5 ?
  15763.             easeIn( p * 2 ) / 2 :
  15764.             1 - easeIn( p * -2 + 2 ) / 2;
  15765.     };
  15766. });
  15767.  
  15768. })();
  15769.  
  15770. var effect = $.effects;
  15771.  
  15772.  
  15773. /*!
  15774.  * jQuery UI Effects Blind 1.11.4
  15775.  * http://jqueryui.com
  15776.  *
  15777.  * Copyright jQuery Foundation and other contributors
  15778.  * Released under the MIT license.
  15779.  * http://jquery.org/license
  15780.  *
  15781.  * http://api.jqueryui.com/blind-effect/
  15782.  */
  15783.  
  15784.  
  15785. var effectBlind = $.effects.effect.blind = function( o, done ) {
  15786.     // Create element
  15787.     var el = $( this ),
  15788.         rvertical = /up|down|vertical/,
  15789.         rpositivemotion = /up|left|vertical|horizontal/,
  15790.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15791.         mode = $.effects.setMode( el, o.mode || "hide" ),
  15792.         direction = o.direction || "up",
  15793.         vertical = rvertical.test( direction ),
  15794.         ref = vertical ? "height" : "width",
  15795.         ref2 = vertical ? "top" : "left",
  15796.         motion = rpositivemotion.test( direction ),
  15797.         animation = {},
  15798.         show = mode === "show",
  15799.         wrapper, distance, margin;
  15800.  
  15801.     // if already wrapped, the wrapper's properties are my property. #6245
  15802.     if ( el.parent().is( ".ui-effects-wrapper" ) ) {
  15803.         $.effects.save( el.parent(), props );
  15804.     } else {
  15805.         $.effects.save( el, props );
  15806.     }
  15807.     el.show();
  15808.     wrapper = $.effects.createWrapper( el ).css({
  15809.         overflow: "hidden"
  15810.     });
  15811.  
  15812.     distance = wrapper[ ref ]();
  15813.     margin = parseFloat( wrapper.css( ref2 ) ) || 0;
  15814.  
  15815.     animation[ ref ] = show ? distance : 0;
  15816.     if ( !motion ) {
  15817.         el
  15818.             .css( vertical ? "bottom" : "right", 0 )
  15819.             .css( vertical ? "top" : "left", "auto" )
  15820.             .css({ position: "absolute" });
  15821.  
  15822.         animation[ ref2 ] = show ? margin : distance + margin;
  15823.     }
  15824.  
  15825.     // start at 0 if we are showing
  15826.     if ( show ) {
  15827.         wrapper.css( ref, 0 );
  15828.         if ( !motion ) {
  15829.             wrapper.css( ref2, margin + distance );
  15830.         }
  15831.     }
  15832.  
  15833.     // Animate
  15834.     wrapper.animate( animation, {
  15835.         duration: o.duration,
  15836.         easing: o.easing,
  15837.         queue: false,
  15838.         complete: function() {
  15839.             if ( mode === "hide" ) {
  15840.                 el.hide();
  15841.             }
  15842.             $.effects.restore( el, props );
  15843.             $.effects.removeWrapper( el );
  15844.             done();
  15845.         }
  15846.     });
  15847. };
  15848.  
  15849.  
  15850. /*!
  15851.  * jQuery UI Effects Bounce 1.11.4
  15852.  * http://jqueryui.com
  15853.  *
  15854.  * Copyright jQuery Foundation and other contributors
  15855.  * Released under the MIT license.
  15856.  * http://jquery.org/license
  15857.  *
  15858.  * http://api.jqueryui.com/bounce-effect/
  15859.  */
  15860.  
  15861.  
  15862. var effectBounce = $.effects.effect.bounce = function( o, done ) {
  15863.     var el = $( this ),
  15864.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15865.  
  15866.         // defaults:
  15867.         mode = $.effects.setMode( el, o.mode || "effect" ),
  15868.         hide = mode === "hide",
  15869.         show = mode === "show",
  15870.         direction = o.direction || "up",
  15871.         distance = o.distance,
  15872.         times = o.times || 5,
  15873.  
  15874.         // number of internal animations
  15875.         anims = times * 2 + ( show || hide ? 1 : 0 ),
  15876.         speed = o.duration / anims,
  15877.         easing = o.easing,
  15878.  
  15879.         // utility:
  15880.         ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15881.         motion = ( direction === "up" || direction === "left" ),
  15882.         i,
  15883.         upAnim,
  15884.         downAnim,
  15885.  
  15886.         // we will need to re-assemble the queue to stack our animations in place
  15887.         queue = el.queue(),
  15888.         queuelen = queue.length;
  15889.  
  15890.     // Avoid touching opacity to prevent clearType and PNG issues in IE
  15891.     if ( show || hide ) {
  15892.         props.push( "opacity" );
  15893.     }
  15894.  
  15895.     $.effects.save( el, props );
  15896.     el.show();
  15897.     $.effects.createWrapper( el ); // Create Wrapper
  15898.  
  15899.     // default distance for the BIGGEST bounce is the outer Distance / 3
  15900.     if ( !distance ) {
  15901.         distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
  15902.     }
  15903.  
  15904.     if ( show ) {
  15905.         downAnim = { opacity: 1 };
  15906.         downAnim[ ref ] = 0;
  15907.  
  15908.         // if we are showing, force opacity 0 and set the initial position
  15909.         // then do the "first" animation
  15910.         el.css( "opacity", 0 )
  15911.             .css( ref, motion ? -distance * 2 : distance * 2 )
  15912.             .animate( downAnim, speed, easing );
  15913.     }
  15914.  
  15915.     // start at the smallest distance if we are hiding
  15916.     if ( hide ) {
  15917.         distance = distance / Math.pow( 2, times - 1 );
  15918.     }
  15919.  
  15920.     downAnim = {};
  15921.     downAnim[ ref ] = 0;
  15922.     // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  15923.     for ( i = 0; i < times; i++ ) {
  15924.         upAnim = {};
  15925.         upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15926.  
  15927.         el.animate( upAnim, speed, easing )
  15928.             .animate( downAnim, speed, easing );
  15929.  
  15930.         distance = hide ? distance * 2 : distance / 2;
  15931.     }
  15932.  
  15933.     // Last Bounce when Hiding
  15934.     if ( hide ) {
  15935.         upAnim = { opacity: 0 };
  15936.         upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15937.  
  15938.         el.animate( upAnim, speed, easing );
  15939.     }
  15940.  
  15941.     el.queue(function() {
  15942.         if ( hide ) {
  15943.             el.hide();
  15944.         }
  15945.         $.effects.restore( el, props );
  15946.         $.effects.removeWrapper( el );
  15947.         done();
  15948.     });
  15949.  
  15950.     // inject all the animations we just queued to be first in line (after "inprogress")
  15951.     if ( queuelen > 1) {
  15952.         queue.splice.apply( queue,
  15953.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  15954.     }
  15955.     el.dequeue();
  15956.  
  15957. };
  15958.  
  15959.  
  15960. /*!
  15961.  * jQuery UI Effects Clip 1.11.4
  15962.  * http://jqueryui.com
  15963.  *
  15964.  * Copyright jQuery Foundation and other contributors
  15965.  * Released under the MIT license.
  15966.  * http://jquery.org/license
  15967.  *
  15968.  * http://api.jqueryui.com/clip-effect/
  15969.  */
  15970.  
  15971.  
  15972. var effectClip = $.effects.effect.clip = function( o, done ) {
  15973.     // Create element
  15974.     var el = $( this ),
  15975.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15976.         mode = $.effects.setMode( el, o.mode || "hide" ),
  15977.         show = mode === "show",
  15978.         direction = o.direction || "vertical",
  15979.         vert = direction === "vertical",
  15980.         size = vert ? "height" : "width",
  15981.         position = vert ? "top" : "left",
  15982.         animation = {},
  15983.         wrapper, animate, distance;
  15984.  
  15985.     // Save & Show
  15986.     $.effects.save( el, props );
  15987.     el.show();
  15988.  
  15989.     // Create Wrapper
  15990.     wrapper = $.effects.createWrapper( el ).css({
  15991.         overflow: "hidden"
  15992.     });
  15993.     animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
  15994.     distance = animate[ size ]();
  15995.  
  15996.     // Shift
  15997.     if ( show ) {
  15998.         animate.css( size, 0 );
  15999.         animate.css( position, distance / 2 );
  16000.     }
  16001.  
  16002.     // Create Animation Object:
  16003.     animation[ size ] = show ? distance : 0;
  16004.     animation[ position ] = show ? 0 : distance / 2;
  16005.  
  16006.     // Animate
  16007.     animate.animate( animation, {
  16008.         queue: false,
  16009.         duration: o.duration,
  16010.         easing: o.easing,
  16011.         complete: function() {
  16012.             if ( !show ) {
  16013.                 el.hide();
  16014.             }
  16015.             $.effects.restore( el, props );
  16016.             $.effects.removeWrapper( el );
  16017.             done();
  16018.         }
  16019.     });
  16020.  
  16021. };
  16022.  
  16023.  
  16024. /*!
  16025.  * jQuery UI Effects Drop 1.11.4
  16026.  * http://jqueryui.com
  16027.  *
  16028.  * Copyright jQuery Foundation and other contributors
  16029.  * Released under the MIT license.
  16030.  * http://jquery.org/license
  16031.  *
  16032.  * http://api.jqueryui.com/drop-effect/
  16033.  */
  16034.  
  16035.  
  16036. var effectDrop = $.effects.effect.drop = function( o, done ) {
  16037.  
  16038.     var el = $( this ),
  16039.         props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
  16040.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16041.         show = mode === "show",
  16042.         direction = o.direction || "left",
  16043.         ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  16044.         motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
  16045.         animation = {
  16046.             opacity: show ? 1 : 0
  16047.         },
  16048.         distance;
  16049.  
  16050.     // Adjust
  16051.     $.effects.save( el, props );
  16052.     el.show();
  16053.     $.effects.createWrapper( el );
  16054.  
  16055.     distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  16056.  
  16057.     if ( show ) {
  16058.         el
  16059.             .css( "opacity", 0 )
  16060.             .css( ref, motion === "pos" ? -distance : distance );
  16061.     }
  16062.  
  16063.     // Animation
  16064.     animation[ ref ] = ( show ?
  16065.         ( motion === "pos" ? "+=" : "-=" ) :
  16066.         ( motion === "pos" ? "-=" : "+=" ) ) +
  16067.         distance;
  16068.  
  16069.     // Animate
  16070.     el.animate( animation, {
  16071.         queue: false,
  16072.         duration: o.duration,
  16073.         easing: o.easing,
  16074.         complete: function() {
  16075.             if ( mode === "hide" ) {
  16076.                 el.hide();
  16077.             }
  16078.             $.effects.restore( el, props );
  16079.             $.effects.removeWrapper( el );
  16080.             done();
  16081.         }
  16082.     });
  16083. };
  16084.  
  16085.  
  16086. /*!
  16087.  * jQuery UI Effects Explode 1.11.4
  16088.  * http://jqueryui.com
  16089.  *
  16090.  * Copyright jQuery Foundation and other contributors
  16091.  * Released under the MIT license.
  16092.  * http://jquery.org/license
  16093.  *
  16094.  * http://api.jqueryui.com/explode-effect/
  16095.  */
  16096.  
  16097.  
  16098. var effectExplode = $.effects.effect.explode = function( o, done ) {
  16099.  
  16100.     var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
  16101.         cells = rows,
  16102.         el = $( this ),
  16103.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16104.         show = mode === "show",
  16105.  
  16106.         // show and then visibility:hidden the element before calculating offset
  16107.         offset = el.show().css( "visibility", "hidden" ).offset(),
  16108.  
  16109.         // width and height of a piece
  16110.         width = Math.ceil( el.outerWidth() / cells ),
  16111.         height = Math.ceil( el.outerHeight() / rows ),
  16112.         pieces = [],
  16113.  
  16114.         // loop
  16115.         i, j, left, top, mx, my;
  16116.  
  16117.     // children animate complete:
  16118.     function childComplete() {
  16119.         pieces.push( this );
  16120.         if ( pieces.length === rows * cells ) {
  16121.             animComplete();
  16122.         }
  16123.     }
  16124.  
  16125.     // clone the element for each row and cell.
  16126.     for ( i = 0; i < rows ; i++ ) { // ===>
  16127.         top = offset.top + i * height;
  16128.         my = i - ( rows - 1 ) / 2 ;
  16129.  
  16130.         for ( j = 0; j < cells ; j++ ) { // |||
  16131.             left = offset.left + j * width;
  16132.             mx = j - ( cells - 1 ) / 2 ;
  16133.  
  16134.             // Create a clone of the now hidden main element that will be absolute positioned
  16135.             // within a wrapper div off the -left and -top equal to size of our pieces
  16136.             el
  16137.                 .clone()
  16138.                 .appendTo( "body" )
  16139.                 .wrap( "<div></div>" )
  16140.                 .css({
  16141.                     position: "absolute",
  16142.                     visibility: "visible",
  16143.                     left: -j * width,
  16144.                     top: -i * height
  16145.                 })
  16146.  
  16147.             // select the wrapper - make it overflow: hidden and absolute positioned based on
  16148.             // where the original was located +left and +top equal to the size of pieces
  16149.                 .parent()
  16150.                 .addClass( "ui-effects-explode" )
  16151.                 .css({
  16152.                     position: "absolute",
  16153.                     overflow: "hidden",
  16154.                     width: width,
  16155.                     height: height,
  16156.                     left: left + ( show ? mx * width : 0 ),
  16157.                     top: top + ( show ? my * height : 0 ),
  16158.                     opacity: show ? 0 : 1
  16159.                 }).animate({
  16160.                     left: left + ( show ? 0 : mx * width ),
  16161.                     top: top + ( show ? 0 : my * height ),
  16162.                     opacity: show ? 1 : 0
  16163.                 }, o.duration || 500, o.easing, childComplete );
  16164.         }
  16165.     }
  16166.  
  16167.     function animComplete() {
  16168.         el.css({
  16169.             visibility: "visible"
  16170.         });
  16171.         $( pieces ).remove();
  16172.         if ( !show ) {
  16173.             el.hide();
  16174.         }
  16175.         done();
  16176.     }
  16177. };
  16178.  
  16179.  
  16180. /*!
  16181.  * jQuery UI Effects Fade 1.11.4
  16182.  * http://jqueryui.com
  16183.  *
  16184.  * Copyright jQuery Foundation and other contributors
  16185.  * Released under the MIT license.
  16186.  * http://jquery.org/license
  16187.  *
  16188.  * http://api.jqueryui.com/fade-effect/
  16189.  */
  16190.  
  16191.  
  16192. var effectFade = $.effects.effect.fade = function( o, done ) {
  16193.     var el = $( this ),
  16194.         mode = $.effects.setMode( el, o.mode || "toggle" );
  16195.  
  16196.     el.animate({
  16197.         opacity: mode
  16198.     }, {
  16199.         queue: false,
  16200.         duration: o.duration,
  16201.         easing: o.easing,
  16202.         complete: done
  16203.     });
  16204. };
  16205.  
  16206.  
  16207. /*!
  16208.  * jQuery UI Effects Fold 1.11.4
  16209.  * http://jqueryui.com
  16210.  *
  16211.  * Copyright jQuery Foundation and other contributors
  16212.  * Released under the MIT license.
  16213.  * http://jquery.org/license
  16214.  *
  16215.  * http://api.jqueryui.com/fold-effect/
  16216.  */
  16217.  
  16218.  
  16219. var effectFold = $.effects.effect.fold = function( o, done ) {
  16220.  
  16221.     // Create element
  16222.     var el = $( this ),
  16223.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  16224.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16225.         show = mode === "show",
  16226.         hide = mode === "hide",
  16227.         size = o.size || 15,
  16228.         percent = /([0-9]+)%/.exec( size ),
  16229.         horizFirst = !!o.horizFirst,
  16230.         widthFirst = show !== horizFirst,
  16231.         ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
  16232.         duration = o.duration / 2,
  16233.         wrapper, distance,
  16234.         animation1 = {},
  16235.         animation2 = {};
  16236.  
  16237.     $.effects.save( el, props );
  16238.     el.show();
  16239.  
  16240.     // Create Wrapper
  16241.     wrapper = $.effects.createWrapper( el ).css({
  16242.         overflow: "hidden"
  16243.     });
  16244.     distance = widthFirst ?
  16245.         [ wrapper.width(), wrapper.height() ] :
  16246.         [ wrapper.height(), wrapper.width() ];
  16247.  
  16248.     if ( percent ) {
  16249.         size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  16250.     }
  16251.     if ( show ) {
  16252.         wrapper.css( horizFirst ? {
  16253.             height: 0,
  16254.             width: size
  16255.         } : {
  16256.             height: size,
  16257.             width: 0
  16258.         });
  16259.     }
  16260.  
  16261.     // Animation
  16262.     animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
  16263.     animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
  16264.  
  16265.     // Animate
  16266.     wrapper
  16267.         .animate( animation1, duration, o.easing )
  16268.         .animate( animation2, duration, o.easing, function() {
  16269.             if ( hide ) {
  16270.                 el.hide();
  16271.             }
  16272.             $.effects.restore( el, props );
  16273.             $.effects.removeWrapper( el );
  16274.             done();
  16275.         });
  16276.  
  16277. };
  16278.  
  16279.  
  16280. /*!
  16281.  * jQuery UI Effects Highlight 1.11.4
  16282.  * http://jqueryui.com
  16283.  *
  16284.  * Copyright jQuery Foundation and other contributors
  16285.  * Released under the MIT license.
  16286.  * http://jquery.org/license
  16287.  *
  16288.  * http://api.jqueryui.com/highlight-effect/
  16289.  */
  16290.  
  16291.  
  16292. var effectHighlight = $.effects.effect.highlight = function( o, done ) {
  16293.     var elem = $( this ),
  16294.         props = [ "backgroundImage", "backgroundColor", "opacity" ],
  16295.         mode = $.effects.setMode( elem, o.mode || "show" ),
  16296.         animation = {
  16297.             backgroundColor: elem.css( "backgroundColor" )
  16298.         };
  16299.  
  16300.     if (mode === "hide") {
  16301.         animation.opacity = 0;
  16302.     }
  16303.  
  16304.     $.effects.save( elem, props );
  16305.  
  16306.     elem
  16307.         .show()
  16308.         .css({
  16309.             backgroundImage: "none",
  16310.             backgroundColor: o.color || "#ffff99"
  16311.         })
  16312.         .animate( animation, {
  16313.             queue: false,
  16314.             duration: o.duration,
  16315.             easing: o.easing,
  16316.             complete: function() {
  16317.                 if ( mode === "hide" ) {
  16318.                     elem.hide();
  16319.                 }
  16320.                 $.effects.restore( elem, props );
  16321.                 done();
  16322.             }
  16323.         });
  16324. };
  16325.  
  16326.  
  16327. /*!
  16328.  * jQuery UI Effects Size 1.11.4
  16329.  * http://jqueryui.com
  16330.  *
  16331.  * Copyright jQuery Foundation and other contributors
  16332.  * Released under the MIT license.
  16333.  * http://jquery.org/license
  16334.  *
  16335.  * http://api.jqueryui.com/size-effect/
  16336.  */
  16337.  
  16338.  
  16339. var effectSize = $.effects.effect.size = function( o, done ) {
  16340.  
  16341.     // Create element
  16342.     var original, baseline, factor,
  16343.         el = $( this ),
  16344.         props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
  16345.  
  16346.         // Always restore
  16347.         props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
  16348.  
  16349.         // Copy for children
  16350.         props2 = [ "width", "height", "overflow" ],
  16351.         cProps = [ "fontSize" ],
  16352.         vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  16353.         hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  16354.  
  16355.         // Set options
  16356.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16357.         restore = o.restore || mode !== "effect",
  16358.         scale = o.scale || "both",
  16359.         origin = o.origin || [ "middle", "center" ],
  16360.         position = el.css( "position" ),
  16361.         props = restore ? props0 : props1,
  16362.         zero = {
  16363.             height: 0,
  16364.             width: 0,
  16365.             outerHeight: 0,
  16366.             outerWidth: 0
  16367.         };
  16368.  
  16369.     if ( mode === "show" ) {
  16370.         el.show();
  16371.     }
  16372.     original = {
  16373.         height: el.height(),
  16374.         width: el.width(),
  16375.         outerHeight: el.outerHeight(),
  16376.         outerWidth: el.outerWidth()
  16377.     };
  16378.  
  16379.     if ( o.mode === "toggle" && mode === "show" ) {
  16380.         el.from = o.to || zero;
  16381.         el.to = o.from || original;
  16382.     } else {
  16383.         el.from = o.from || ( mode === "show" ? zero : original );
  16384.         el.to = o.to || ( mode === "hide" ? zero : original );
  16385.     }
  16386.  
  16387.     // Set scaling factor
  16388.     factor = {
  16389.         from: {
  16390.             y: el.from.height / original.height,
  16391.             x: el.from.width / original.width
  16392.         },
  16393.         to: {
  16394.             y: el.to.height / original.height,
  16395.             x: el.to.width / original.width
  16396.         }
  16397.     };
  16398.  
  16399.     // Scale the css box
  16400.     if ( scale === "box" || scale === "both" ) {
  16401.  
  16402.         // Vertical props scaling
  16403.         if ( factor.from.y !== factor.to.y ) {
  16404.             props = props.concat( vProps );
  16405.             el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
  16406.             el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
  16407.         }
  16408.  
  16409.         // Horizontal props scaling
  16410.         if ( factor.from.x !== factor.to.x ) {
  16411.             props = props.concat( hProps );
  16412.             el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
  16413.             el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
  16414.         }
  16415.     }
  16416.  
  16417.     // Scale the content
  16418.     if ( scale === "content" || scale === "both" ) {
  16419.  
  16420.         // Vertical props scaling
  16421.         if ( factor.from.y !== factor.to.y ) {
  16422.             props = props.concat( cProps ).concat( props2 );
  16423.             el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
  16424.             el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
  16425.         }
  16426.     }
  16427.  
  16428.     $.effects.save( el, props );
  16429.     el.show();
  16430.     $.effects.createWrapper( el );
  16431.     el.css( "overflow", "hidden" ).css( el.from );
  16432.  
  16433.     // Adjust
  16434.     if (origin) { // Calculate baseline shifts
  16435.         baseline = $.effects.getBaseline( origin, original );
  16436.         el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
  16437.         el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
  16438.         el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
  16439.         el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
  16440.     }
  16441.     el.css( el.from ); // set top & left
  16442.  
  16443.     // Animate
  16444.     if ( scale === "content" || scale === "both" ) { // Scale the children
  16445.  
  16446.         // Add margins/font-size
  16447.         vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
  16448.         hProps = hProps.concat([ "marginLeft", "marginRight" ]);
  16449.         props2 = props0.concat(vProps).concat(hProps);
  16450.  
  16451.         el.find( "*[width]" ).each( function() {
  16452.             var child = $( this ),
  16453.                 c_original = {
  16454.                     height: child.height(),
  16455.                     width: child.width(),
  16456.                     outerHeight: child.outerHeight(),
  16457.                     outerWidth: child.outerWidth()
  16458.                 };
  16459.             if (restore) {
  16460.                 $.effects.save(child, props2);
  16461.             }
  16462.  
  16463.             child.from = {
  16464.                 height: c_original.height * factor.from.y,
  16465.                 width: c_original.width * factor.from.x,
  16466.                 outerHeight: c_original.outerHeight * factor.from.y,
  16467.                 outerWidth: c_original.outerWidth * factor.from.x
  16468.             };
  16469.             child.to = {
  16470.                 height: c_original.height * factor.to.y,
  16471.                 width: c_original.width * factor.to.x,
  16472.                 outerHeight: c_original.height * factor.to.y,
  16473.                 outerWidth: c_original.width * factor.to.x
  16474.             };
  16475.  
  16476.             // Vertical props scaling
  16477.             if ( factor.from.y !== factor.to.y ) {
  16478.                 child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
  16479.                 child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
  16480.             }
  16481.  
  16482.             // Horizontal props scaling
  16483.             if ( factor.from.x !== factor.to.x ) {
  16484.                 child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
  16485.                 child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
  16486.             }
  16487.  
  16488.             // Animate children
  16489.             child.css( child.from );
  16490.             child.animate( child.to, o.duration, o.easing, function() {
  16491.  
  16492.                 // Restore children
  16493.                 if ( restore ) {
  16494.                     $.effects.restore( child, props2 );
  16495.                 }
  16496.             });
  16497.         });
  16498.     }
  16499.  
  16500.     // Animate
  16501.     el.animate( el.to, {
  16502.         queue: false,
  16503.         duration: o.duration,
  16504.         easing: o.easing,
  16505.         complete: function() {
  16506.             if ( el.to.opacity === 0 ) {
  16507.                 el.css( "opacity", el.from.opacity );
  16508.             }
  16509.             if ( mode === "hide" ) {
  16510.                 el.hide();
  16511.             }
  16512.             $.effects.restore( el, props );
  16513.             if ( !restore ) {
  16514.  
  16515.                 // we need to calculate our new positioning based on the scaling
  16516.                 if ( position === "static" ) {
  16517.                     el.css({
  16518.                         position: "relative",
  16519.                         top: el.to.top,
  16520.                         left: el.to.left
  16521.                     });
  16522.                 } else {
  16523.                     $.each([ "top", "left" ], function( idx, pos ) {
  16524.                         el.css( pos, function( _, str ) {
  16525.                             var val = parseInt( str, 10 ),
  16526.                                 toRef = idx ? el.to.left : el.to.top;
  16527.  
  16528.                             // if original was "auto", recalculate the new value from wrapper
  16529.                             if ( str === "auto" ) {
  16530.                                 return toRef + "px";
  16531.                             }
  16532.  
  16533.                             return val + toRef + "px";
  16534.                         });
  16535.                     });
  16536.                 }
  16537.             }
  16538.  
  16539.             $.effects.removeWrapper( el );
  16540.             done();
  16541.         }
  16542.     });
  16543.  
  16544. };
  16545.  
  16546.  
  16547. /*!
  16548.  * jQuery UI Effects Scale 1.11.4
  16549.  * http://jqueryui.com
  16550.  *
  16551.  * Copyright jQuery Foundation and other contributors
  16552.  * Released under the MIT license.
  16553.  * http://jquery.org/license
  16554.  *
  16555.  * http://api.jqueryui.com/scale-effect/
  16556.  */
  16557.  
  16558.  
  16559. var effectScale = $.effects.effect.scale = function( o, done ) {
  16560.  
  16561.     // Create element
  16562.     var el = $( this ),
  16563.         options = $.extend( true, {}, o ),
  16564.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16565.         percent = parseInt( o.percent, 10 ) ||
  16566.             ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
  16567.         direction = o.direction || "both",
  16568.         origin = o.origin,
  16569.         original = {
  16570.             height: el.height(),
  16571.             width: el.width(),
  16572.             outerHeight: el.outerHeight(),
  16573.             outerWidth: el.outerWidth()
  16574.         },
  16575.         factor = {
  16576.             y: direction !== "horizontal" ? (percent / 100) : 1,
  16577.             x: direction !== "vertical" ? (percent / 100) : 1
  16578.         };
  16579.  
  16580.     // We are going to pass this effect to the size effect:
  16581.     options.effect = "size";
  16582.     options.queue = false;
  16583.     options.complete = done;
  16584.  
  16585.     // Set default origin and restore for show/hide
  16586.     if ( mode !== "effect" ) {
  16587.         options.origin = origin || [ "middle", "center" ];
  16588.         options.restore = true;
  16589.     }
  16590.  
  16591.     options.from = o.from || ( mode === "show" ? {
  16592.         height: 0,
  16593.         width: 0,
  16594.         outerHeight: 0,
  16595.         outerWidth: 0
  16596.     } : original );
  16597.     options.to = {
  16598.         height: original.height * factor.y,
  16599.         width: original.width * factor.x,
  16600.         outerHeight: original.outerHeight * factor.y,
  16601.         outerWidth: original.outerWidth * factor.x
  16602.     };
  16603.  
  16604.     // Fade option to support puff
  16605.     if ( options.fade ) {
  16606.         if ( mode === "show" ) {
  16607.             options.from.opacity = 0;
  16608.             options.to.opacity = 1;
  16609.         }
  16610.         if ( mode === "hide" ) {
  16611.             options.from.opacity = 1;
  16612.             options.to.opacity = 0;
  16613.         }
  16614.     }
  16615.  
  16616.     // Animate
  16617.     el.effect( options );
  16618.  
  16619. };
  16620.  
  16621.  
  16622. /*!
  16623.  * jQuery UI Effects Puff 1.11.4
  16624.  * http://jqueryui.com
  16625.  *
  16626.  * Copyright jQuery Foundation and other contributors
  16627.  * Released under the MIT license.
  16628.  * http://jquery.org/license
  16629.  *
  16630.  * http://api.jqueryui.com/puff-effect/
  16631.  */
  16632.  
  16633.  
  16634. var effectPuff = $.effects.effect.puff = function( o, done ) {
  16635.     var elem = $( this ),
  16636.         mode = $.effects.setMode( elem, o.mode || "hide" ),
  16637.         hide = mode === "hide",
  16638.         percent = parseInt( o.percent, 10 ) || 150,
  16639.         factor = percent / 100,
  16640.         original = {
  16641.             height: elem.height(),
  16642.             width: elem.width(),
  16643.             outerHeight: elem.outerHeight(),
  16644.             outerWidth: elem.outerWidth()
  16645.         };
  16646.  
  16647.     $.extend( o, {
  16648.         effect: "scale",
  16649.         queue: false,
  16650.         fade: true,
  16651.         mode: mode,
  16652.         complete: done,
  16653.         percent: hide ? percent : 100,
  16654.         from: hide ?
  16655.             original :
  16656.             {
  16657.                 height: original.height * factor,
  16658.                 width: original.width * factor,
  16659.                 outerHeight: original.outerHeight * factor,
  16660.                 outerWidth: original.outerWidth * factor
  16661.             }
  16662.     });
  16663.  
  16664.     elem.effect( o );
  16665. };
  16666.  
  16667.  
  16668. /*!
  16669.  * jQuery UI Effects Pulsate 1.11.4
  16670.  * http://jqueryui.com
  16671.  *
  16672.  * Copyright jQuery Foundation and other contributors
  16673.  * Released under the MIT license.
  16674.  * http://jquery.org/license
  16675.  *
  16676.  * http://api.jqueryui.com/pulsate-effect/
  16677.  */
  16678.  
  16679.  
  16680. var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
  16681.     var elem = $( this ),
  16682.         mode = $.effects.setMode( elem, o.mode || "show" ),
  16683.         show = mode === "show",
  16684.         hide = mode === "hide",
  16685.         showhide = ( show || mode === "hide" ),
  16686.  
  16687.         // showing or hiding leaves of the "last" animation
  16688.         anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  16689.         duration = o.duration / anims,
  16690.         animateTo = 0,
  16691.         queue = elem.queue(),
  16692.         queuelen = queue.length,
  16693.         i;
  16694.  
  16695.     if ( show || !elem.is(":visible")) {
  16696.         elem.css( "opacity", 0 ).show();
  16697.         animateTo = 1;
  16698.     }
  16699.  
  16700.     // anims - 1 opacity "toggles"
  16701.     for ( i = 1; i < anims; i++ ) {
  16702.         elem.animate({
  16703.             opacity: animateTo
  16704.         }, duration, o.easing );
  16705.         animateTo = 1 - animateTo;
  16706.     }
  16707.  
  16708.     elem.animate({
  16709.         opacity: animateTo
  16710.     }, duration, o.easing);
  16711.  
  16712.     elem.queue(function() {
  16713.         if ( hide ) {
  16714.             elem.hide();
  16715.         }
  16716.         done();
  16717.     });
  16718.  
  16719.     // We just queued up "anims" animations, we need to put them next in the queue
  16720.     if ( queuelen > 1 ) {
  16721.         queue.splice.apply( queue,
  16722.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  16723.     }
  16724.     elem.dequeue();
  16725. };
  16726.  
  16727.  
  16728. /*!
  16729.  * jQuery UI Effects Shake 1.11.4
  16730.  * http://jqueryui.com
  16731.  *
  16732.  * Copyright jQuery Foundation and other contributors
  16733.  * Released under the MIT license.
  16734.  * http://jquery.org/license
  16735.  *
  16736.  * http://api.jqueryui.com/shake-effect/
  16737.  */
  16738.  
  16739.  
  16740. var effectShake = $.effects.effect.shake = function( o, done ) {
  16741.  
  16742.     var el = $( this ),
  16743.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  16744.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16745.         direction = o.direction || "left",
  16746.         distance = o.distance || 20,
  16747.         times = o.times || 3,
  16748.         anims = times * 2 + 1,
  16749.         speed = Math.round( o.duration / anims ),
  16750.         ref = (direction === "up" || direction === "down") ? "top" : "left",
  16751.         positiveMotion = (direction === "up" || direction === "left"),
  16752.         animation = {},
  16753.         animation1 = {},
  16754.         animation2 = {},
  16755.         i,
  16756.  
  16757.         // we will need to re-assemble the queue to stack our animations in place
  16758.         queue = el.queue(),
  16759.         queuelen = queue.length;
  16760.  
  16761.     $.effects.save( el, props );
  16762.     el.show();
  16763.     $.effects.createWrapper( el );
  16764.  
  16765.     // Animation
  16766.     animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
  16767.     animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
  16768.     animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
  16769.  
  16770.     // Animate
  16771.     el.animate( animation, speed, o.easing );
  16772.  
  16773.     // Shakes
  16774.     for ( i = 1; i < times; i++ ) {
  16775.         el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
  16776.     }
  16777.     el
  16778.         .animate( animation1, speed, o.easing )
  16779.         .animate( animation, speed / 2, o.easing )
  16780.         .queue(function() {
  16781.             if ( mode === "hide" ) {
  16782.                 el.hide();
  16783.             }
  16784.             $.effects.restore( el, props );
  16785.             $.effects.removeWrapper( el );
  16786.             done();
  16787.         });
  16788.  
  16789.     // inject all the animations we just queued to be first in line (after "inprogress")
  16790.     if ( queuelen > 1) {
  16791.         queue.splice.apply( queue,
  16792.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  16793.     }
  16794.     el.dequeue();
  16795.  
  16796. };
  16797.  
  16798.  
  16799. /*!
  16800.  * jQuery UI Effects Slide 1.11.4
  16801.  * http://jqueryui.com
  16802.  *
  16803.  * Copyright jQuery Foundation and other contributors
  16804.  * Released under the MIT license.
  16805.  * http://jquery.org/license
  16806.  *
  16807.  * http://api.jqueryui.com/slide-effect/
  16808.  */
  16809.  
  16810.  
  16811. var effectSlide = $.effects.effect.slide = function( o, done ) {
  16812.  
  16813.     // Create element
  16814.     var el = $( this ),
  16815.         props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
  16816.         mode = $.effects.setMode( el, o.mode || "show" ),
  16817.         show = mode === "show",
  16818.         direction = o.direction || "left",
  16819.         ref = (direction === "up" || direction === "down") ? "top" : "left",
  16820.         positiveMotion = (direction === "up" || direction === "left"),
  16821.         distance,
  16822.         animation = {};
  16823.  
  16824.     // Adjust
  16825.     $.effects.save( el, props );
  16826.     el.show();
  16827.     distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
  16828.  
  16829.     $.effects.createWrapper( el ).css({
  16830.         overflow: "hidden"
  16831.     });
  16832.  
  16833.     if ( show ) {
  16834.         el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
  16835.     }
  16836.  
  16837.     // Animation
  16838.     animation[ ref ] = ( show ?
  16839.         ( positiveMotion ? "+=" : "-=") :
  16840.         ( positiveMotion ? "-=" : "+=")) +
  16841.         distance;
  16842.  
  16843.     // Animate
  16844.     el.animate( animation, {
  16845.         queue: false,
  16846.         duration: o.duration,
  16847.         easing: o.easing,
  16848.         complete: function() {
  16849.             if ( mode === "hide" ) {
  16850.                 el.hide();
  16851.             }
  16852.             $.effects.restore( el, props );
  16853.             $.effects.removeWrapper( el );
  16854.             done();
  16855.         }
  16856.     });
  16857. };
  16858.  
  16859.  
  16860. /*!
  16861.  * jQuery UI Effects Transfer 1.11.4
  16862.  * http://jqueryui.com
  16863.  *
  16864.  * Copyright jQuery Foundation and other contributors
  16865.  * Released under the MIT license.
  16866.  * http://jquery.org/license
  16867.  *
  16868.  * http://api.jqueryui.com/transfer-effect/
  16869.  */
  16870.  
  16871.  
  16872. var effectTransfer = $.effects.effect.transfer = function( o, done ) {
  16873.     var elem = $( this ),
  16874.         target = $( o.to ),
  16875.         targetFixed = target.css( "position" ) === "fixed",
  16876.         body = $("body"),
  16877.         fixTop = targetFixed ? body.scrollTop() : 0,
  16878.         fixLeft = targetFixed ? body.scrollLeft() : 0,
  16879.         endPosition = target.offset(),
  16880.         animation = {
  16881.             top: endPosition.top - fixTop,
  16882.             left: endPosition.left - fixLeft,
  16883.             height: target.innerHeight(),
  16884.             width: target.innerWidth()
  16885.         },
  16886.         startPosition = elem.offset(),
  16887.         transfer = $( "<div class='ui-effects-transfer'></div>" )
  16888.             .appendTo( document.body )
  16889.             .addClass( o.className )
  16890.             .css({
  16891.                 top: startPosition.top - fixTop,
  16892.                 left: startPosition.left - fixLeft,
  16893.                 height: elem.innerHeight(),
  16894.                 width: elem.innerWidth(),
  16895.                 position: targetFixed ? "fixed" : "absolute"
  16896.             })
  16897.             .animate( animation, o.duration, o.easing, function() {
  16898.                 transfer.remove();
  16899.                 done();
  16900.             });
  16901. };
  16902.  
  16903.  
  16904.  
  16905. }));;/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
  16906.  * Build: http://modernizr.com/download/#-flexbox-shiv-cssclasses-testprop-testallprops-domprefixes-load
  16907.  */
  16908. ;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
  16909. // By John Mueller: https://plus.google.com/u/0/+JohnMueller/posts
  16910.  
  16911. var next_data_url; // replaced when loading more
  16912. var prev_data_url; // replaced when loading more
  16913. var next_data_cache;
  16914. var prev_data_cache;
  16915. var last_scroll = 0;
  16916. var is_loading = 0; // simple lock to prevent loading when loading
  16917. var hide_on_load = false; // ID that can be hidden when content has been loaded
  16918.  
  16919. function loadFollowing() {
  16920.     if (next_data_url=="") {
  16921.         $('div.pagination').show();
  16922.     } else {
  16923.         is_loading = 1; // note: this will break when the server doesn't respond
  16924.         $('div.pagination').hide();
  16925.  
  16926.         function showFollowing(data) {
  16927.             $('div.listitempage:last').after(data.response);
  16928.             next_data_url = data.next_data_url;
  16929.             next_data_cache = false;
  16930.             $.getJSON(next_data_url, function(preview_data) {
  16931.                 next_data_cache = preview_data;
  16932.             });
  16933.         }
  16934.         if (next_data_cache) {
  16935.             showFollowing(next_data_cache);
  16936.             is_loading = 0;
  16937.         } else {
  16938.             $.getJSON(next_data_url, function(data) {
  16939.                 showFollowing(data);
  16940.                 is_loading = 0;
  16941.             });
  16942.         }
  16943.     }
  16944. };
  16945.  
  16946. function loadPrevious() {
  16947.     if (prev_data_url=="") {
  16948.         $('div.pagination').show();
  16949.     } else {
  16950.         is_loading = 1; // note: this will break when the server doesn't respond
  16951.         $('div.pagination').hide();
  16952.  
  16953.         function showPrevious(data) {
  16954.             $('div.listitempage:first').before(data.response);
  16955.             var item_height = $("div.listitempage:first").height();
  16956.             window.scrollTo(0, $(window).scrollTop()+item_height); // adjust scroll
  16957.             prev_data_url = data.prev_data_url;
  16958.             prev_data_cache = false;
  16959.             $.getJSON(prev_data_url, function(preview_data) {
  16960.                 prev_data_cache = preview_data;
  16961.             });
  16962.             if (hide_on_load) {
  16963.                 $(hide_on_load).hide();
  16964.                 hide_on_load = false;
  16965.             }
  16966.         }
  16967.         if (prev_data_cache) {
  16968.             showPrevious(prev_data_cache);
  16969.             is_loading = 0;
  16970.         } else {
  16971.             $.getJSON(prev_data_url, function(data) {
  16972.                 showPrevious(data);
  16973.                 is_loading = 0;
  16974.             });
  16975.         }
  16976.     }
  16977. };
  16978.  
  16979. function mostlyVisible(element) {
  16980.     // if ca 25% of element is visible
  16981.     var scroll_pos = $(window).scrollTop();
  16982.     var window_height = $(window).height();
  16983.     var el_top = $(element).offset().top;
  16984.     var el_height = $(element).height();
  16985.     var el_bottom = el_top + el_height;
  16986.     return ((el_bottom - el_height*0.25 > scroll_pos) &&
  16987.         (el_top < (scroll_pos+0.5*window_height)));
  16988. }
  16989.  
  16990. function initPaginator() {
  16991.     $(window).scroll(function() {
  16992.         // handle scroll events to update content
  16993.         var scroll_pos = $(window).scrollTop();
  16994.         if (scroll_pos >= 0.9*($(document).height() - $(window).height())) {
  16995.             if (is_loading==0) loadFollowing();
  16996.         }
  16997.         if (scroll_pos <= 0.9*$("#header").height()) {
  16998.             if (is_loading==0) loadPrevious();
  16999.         }
  17000.         // Adjust the URL based on the top item shown
  17001.         // for reasonable amounts of items
  17002.         if (Math.abs(scroll_pos - last_scroll)>$(window).height()*0.1) {
  17003.             last_scroll = scroll_pos;
  17004.             $(".listitempage").each(function(index) {
  17005.                 if (mostlyVisible(this)) {
  17006.                     history.replaceState(null, null, $(this).attr("data-url"));
  17007.                     $("#pagination").html($(this).attr("data-pagination"));
  17008.                     return(false);
  17009.                 }
  17010.             });
  17011.         }
  17012.     });
  17013.     $(document).ready(function () {
  17014.         // if we have enough room, load the next batch
  17015.         if ($(window).height()>$("#scrollingcontent").height()) {
  17016.             if (next_data_url!="") {
  17017.                 loadFollowing();
  17018.             } else {
  17019.                 var filler = document.createElement("div");
  17020.                 filler.id = "filler";
  17021.                 filler.style.height = ($(window).height() -
  17022.                     $("#scrollingcontent").height())+ "px";
  17023.                 $("#scrollingcontent").after(filler);
  17024.                 hide_on_load = "filler";
  17025.             }
  17026.         }
  17027.         // scroll down to hide empty room
  17028.         head_height = $("#header").height();
  17029.         window.scrollTo(0, head_height);
  17030.     });
  17031. }
  17032.  
  17033. function primeCache() {
  17034.     if(prev_data_url) {
  17035.         $.getJSON(prev_data_url, function(data) { prev_data_cache=data; } );
  17036.     }
  17037.     if(next_data_url) {
  17038.         $.getJSON(next_data_url, function(data) { next_data_cache=data; } );
  17039.     }
  17040. }
  17041.  
  17042. ;var Ajax = (function($) {
  17043.     var my = {}, onLoad = [], isLoaded = false;
  17044.  
  17045.     my.getContent = function(url, boxId, params) {
  17046.         // defer that after page load
  17047.         onLoad.push(function() {
  17048.             var $box = $('#' + boxId);
  17049.  
  17050.             $box.html('<i class="fa fa-spinner fa-spin fa-2x"></i>').addClass('ajax-loading');
  17051.  
  17052.             $.get(url, params, function(html) {
  17053.                 $box.html(html).removeClass('ajax-loading');
  17054.             });
  17055.         });
  17056.         if (isLoaded) {
  17057.             onLoad[onLoad.length - 1]();
  17058.         }
  17059.     };
  17060.  
  17061.     my.refreshPage = function(url, dialogBox) {
  17062.         // defer that after page load
  17063.         onLoad.push(function() {
  17064.             $('#' + dialogBox).modal('show');
  17065.             window.location.href = url;
  17066.         });
  17067.         if (isLoaded) {
  17068.             onLoad[onLoad.length - 1]();
  17069.         }
  17070.     };
  17071.  
  17072.     my.documentReady = function() {
  17073.         for (var i = 0; i < onLoad.length; i++) {
  17074.             onLoad[i]();
  17075.         }
  17076.         isLoaded = true;
  17077.     };
  17078.  
  17079.     return my;
  17080. }(jQuery));
  17081.  
  17082. jQuery(document).ready(Ajax.documentReady);;/*
  17083.  Google Maps
  17084.  https://developers.google.com/maps/documentation/javascript/examples/
  17085.  https://developers.google.com/maps/documentation/javascript/directions?hl=de#DisplayingResults
  17086.  */
  17087.  
  17088. function loadGoogleMap(mapId, geo, myGeoLocation, $getMyLocation, $ajaxLoad) {
  17089.     var map, directionsDisplay, directionsService, markers = [], bounds, myLocation;
  17090.  
  17091.     if (mapId == null) {
  17092.         mapId = 'map-canvas';
  17093.     }
  17094.  
  17095.     if (geo.length > 0) {
  17096.         directionsService = new google.maps.DirectionsService();
  17097.         bounds = new google.maps.LatLngBounds();
  17098.     }
  17099.  
  17100.     // Create an array of styles.
  17101.     var mapStyle = [
  17102.         {
  17103.             stylers: [
  17104.                 { saturation: -100 }
  17105.             ]
  17106.         }
  17107.     ];
  17108.  
  17109.     function initialize() {
  17110.         /* Add a marker to the map and push to the array. */
  17111.         function addMarker(location, title, image, index, openByDefault, tooltip) {
  17112.             var marker = new google.maps.Marker({
  17113.                 position: location,
  17114.                 map: map,
  17115.                 title: (tooltip ? tooltip : null),
  17116.                 icon: image,
  17117.                 animation: google.maps.Animation.DROP,
  17118.                 zIndex: google.maps.Marker.MAX_ZINDEX + index
  17119.             });
  17120.  
  17121.             attachMessage(marker, title, openByDefault);
  17122.             bounds.extend(location);
  17123.             google.maps.event.addListener(marker, 'click', function() {
  17124.                 Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
  17125.             });
  17126.             markers.push(marker);
  17127.         }
  17128.  
  17129.         /* Show Message Box */
  17130.         function attachMessage(marker, content, openByDefault) {
  17131.             var infowindow = new google.maps.InfoWindow({
  17132.                 content: content
  17133.             });
  17134.             google.maps.event.addListener(marker, 'click', function() {
  17135.                 infowindow.open(marker.get('map'), marker);
  17136.             });
  17137.             if (openByDefault == true) {
  17138.                 infowindow.open(marker.get('map'), marker);
  17139.             }
  17140.         }
  17141.  
  17142.         function getGeoSuccess(position) {
  17143.             var markerLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  17144.             addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">Mein Standort</div>', '/img/map_marker_green.png', 0, false);
  17145.             myLocation = position.coords.latitude + ', ' + position.coords.longitude;
  17146.             $("#routeStart").val('Mein Standort');
  17147.         }
  17148.  
  17149.         function getGeoError(errorCallback) {
  17150.  
  17151.         }
  17152.  
  17153.         /* remove a marker to the map and push to the array. */
  17154.         function removeLastMarker() {
  17155.             markers[markers.length - 1].setMap(null);
  17156.         }
  17157.  
  17158.         /* Sets the map on all markers in the array. */
  17159.         function setAllMap(map) {
  17160.             for (var i = 0; i < markers.length; i++) {
  17161.                 markers[i].setMap(map);
  17162.                 markers[i].showInfoWindow();
  17163.             }
  17164.         }
  17165.  
  17166.         /* Removes the markers from the map, but keeps them in the array. */
  17167.         function clearMarkers() {
  17168.             setAllMap(null);
  17169.         }
  17170.  
  17171.         var mapOptions = {}, centerLatitude, centerLongitude, markerLocation, i, index;
  17172.  
  17173.         if (geo.length == 0) {
  17174.             mapOptions = {
  17175.                 zoom: 6,
  17176.                 center: new google.maps.LatLng(51, 9),
  17177.                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  17178.                 styles: mapStyle
  17179.             };
  17180.             map = new google.maps.Map(document.getElementById(mapId), mapOptions);
  17181.         } else {
  17182.             directionsDisplay = new google.maps.DirectionsRenderer();
  17183.             if (myGeoLocation != null) {
  17184.                 centerLatitude = myGeoLocation['latitude'];
  17185.                 centerLongitude = myGeoLocation['longitude'];
  17186.             } else {
  17187.                 centerLatitude = geo[0]['latitude'];
  17188.                 centerLongitude = geo[0]['longitude'];
  17189.             }
  17190.             mapOptions = {
  17191.                 zoom: 12,
  17192.                 center: new google.maps.LatLng(centerLatitude, centerLongitude),
  17193.                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  17194.                 styles: mapStyle
  17195.             };
  17196.             map = new google.maps.Map(document.getElementById(mapId), mapOptions);
  17197.             directionsDisplay.setMap(map);
  17198.             directionsDisplay.setPanel(document.getElementById("directionsPanel-" + mapId));
  17199.             /* company marks */
  17200.             for (i = 0; i < geo.length; i++) {
  17201.                 if (geo[i]['latitude'] > 0 && geo[i]['longitude'] > 0 && geo[i]['address'] != '') {
  17202.                     markerLocation = new google.maps.LatLng(geo[i]['latitude'], geo[i]['longitude']);
  17203.                 }
  17204.                 index = 0;
  17205.                 if (geo[i]['icon'] == 'marker') {
  17206.                     index = 1;
  17207.                 }
  17208.  
  17209.                 if (!geo[i]['color']) {
  17210.                     geo[i]['color'] = 'red';
  17211.                 }
  17212.  
  17213.                 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);
  17214.             }
  17215.             /* own marker */
  17216.             if (myGeoLocation != null) {
  17217.                 if (myGeoLocation['latitude'] > 0 && myGeoLocation['longitude'] > 0 && myGeoLocation['address'] != '') {
  17218.                     markerLocation = new google.maps.LatLng(myGeoLocation['latitude'], myGeoLocation['longitude']);
  17219.                     addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">' + myGeoLocation['address'] + '</div>', '/img/map_marker_green.png', 1, true);
  17220.                 }
  17221.             }
  17222.             /* routes */
  17223.             if (typeof geo[0]['address'] !== 'undefined') {
  17224.                 if ($getMyLocation == true) {
  17225.                     if (navigator.geolocation) {
  17226.                         navigator.geolocation.getCurrentPosition(getGeoSuccess, getGeoError);
  17227.                     }
  17228.                 }
  17229.             }
  17230.  
  17231.             google.maps.event.addListener(map, 'click', function() {
  17232.                 Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
  17233.             });
  17234.             if (geo.length > 1) {
  17235.                 map.fitBounds(bounds);
  17236.             }
  17237.  
  17238.             $("#calcRoute").click(function() {
  17239.                 calcRoute();
  17240.  
  17241.             });
  17242.  
  17243.             function calcRoute() {
  17244.                 // get the travelmode, startpoint and via point from the form
  17245.                 var travelMode = $('input[name="travelMode"]:checked').val();
  17246.                 var end = $("#routeEnd").val();
  17247.                 var start = $("#routeStart").val();
  17248.                 if (start == 'Mein Standort' && myLocation) {
  17249.                     start = myLocation;
  17250.                 }
  17251.                 var via = $("#routeVia").val();
  17252.  
  17253.                 if (travelMode == 'TRANSIT') {
  17254.                     via = ''; // if the travel mode is transit, don't use the via waypoint because that will not work
  17255.                 }
  17256.                 var waypoints = []; // init an empty waypoints array
  17257.                 if (via != '') {
  17258.                     // if waypoints (via) are set, add them to the waypoints array
  17259.                     waypoints.push({
  17260.                         location: via,
  17261.                         stopover: true
  17262.                     });
  17263.                 }
  17264.                 var request = {
  17265.                     origin: start,
  17266.                     destination: end,
  17267.                     waypoints: waypoints,
  17268.  
  17269.                     travelMode: google.maps.DirectionsTravelMode[travelMode]
  17270.                 };
  17271.                 directionsService.route(request, function(response, status) {
  17272.                     if (status == google.maps.DirectionsStatus.OK) {
  17273.                         $('#directionsPanel').empty(); // clear the directions panel before adding new directions
  17274.                         directionsDisplay.setDirections(response);
  17275.                         if ($("#routeStart").val() == 'Mein Standort') {
  17276.                             $("#routeStart").val(response.routes[0].legs[0].start_address);
  17277.                         }
  17278.                     } else {
  17279.                         // alert an error message when the route could nog be calculated.
  17280.                         if (status == 'ZERO_RESULTS') {
  17281.                             alert('No route could be found between the origin and destination.');
  17282.                         } else if (status == 'UNKNOWN_ERROR') {
  17283.                             alert('A directions request could not be processed due to a server error. The request may succeed if you try again.');
  17284.                         } else if (status == 'REQUEST_DENIED') {
  17285.                             alert('This webpage is not allowed to use the directions service.');
  17286.                         } else if (status == 'OVER_QUERY_LIMIT') {
  17287.                             alert('The webpage has gone over the requests limit in too short a period of time.');
  17288.                         } else if (status == 'NOT_FOUND') {
  17289.                             alert('At least one of the origin, destination, or waypoints could not be geocoded.');
  17290.                         } else if (status == 'INVALID_REQUEST') {
  17291.                             alert('The DirectionsRequest provided was invalid.');
  17292.                         } else {
  17293.                             alert("There was an unknown error in your request. Requeststatus: nn" + status);
  17294.                         }
  17295.                     }
  17296.                 });
  17297.             }
  17298.         }
  17299.     }
  17300.  
  17301.     if ($ajaxLoad) {
  17302.         $(document).ajaxStop(initialize);
  17303.     } else {
  17304.         google.maps.event.addDomListener(window, 'load', initialize);
  17305.     }
  17306. }
  17307.  
  17308. ;var CompanyAjaxLoad = (function($) {
  17309.     var my = {};
  17310.  
  17311.     my.getAdditionalCompanyInfo = function($select, $companyId, $hashTag, $scrollTo, $id, $boxId) {
  17312.         $('#termin-o-reservierung-vereinbaren').hide();
  17313.         $('#additionalCompanyInfo').empty();
  17314.  
  17315.         if (!$boxId) {
  17316.             $boxId = 'additionalCompanyInfo';
  17317.         }
  17318.         Ajax.getContent('/ajax.do/additionalCompanyInfo', $boxId, {
  17319.             'select': $select,
  17320.             'companyId': $companyId
  17321.         });
  17322.  
  17323.         if ($hashTag) {
  17324.             window.location.hash = $hashTag;
  17325.         }
  17326.  
  17327.         if ($scrollTo == true) {
  17328.             $("html, body").animate({ scrollTop: $('#pageHeader').offset().top }, 1000);
  17329.         }
  17330.  
  17331.         if ($id != false) {
  17332.             $('#navigationDetailList div').removeClass('gray');
  17333.             $('#navigation_' + $id).addClass('gray');
  17334.         }
  17335.  
  17336.         $('#navigationDetailList').removeClass('in');
  17337.  
  17338.         return false;
  17339.     };
  17340.  
  17341.     my.toggleFromNavigation = function(idNavigation, idBox, $scrollTo, companyInfo) {
  17342.         $('#navigationDetailList div').removeClass('gray');
  17343.         $('#' + idNavigation).addClass('gray');
  17344.  
  17345.         $('#navigationDetailList').removeClass('in');
  17346.  
  17347.         if (companyInfo == true) {
  17348.             $('#additionalCompanyInfo').empty();
  17349.         }
  17350.  
  17351.         $('#' + idBox).show();
  17352.         $('#' + idBox + ' .panel-collapse').addClass('in');
  17353.  
  17354.         if ($scrollTo == true) {
  17355.             $("html, body").animate({ scrollTop: ($('#' + idBox).offset().top) - 50 }, 1000);
  17356.         }
  17357.         return false;
  17358.     };
  17359.  
  17360.     my.claimDuplicate = function($companyId, $userId, $boxId) {
  17361.         Ajax.getContent('/ajax.do/claimDuplicate', $boxId, {
  17362.             'userId': $userId,
  17363.             'companyId': $companyId
  17364.         });
  17365.     };
  17366.  
  17367.     return my;
  17368. }(jQuery));
  17369.  
  17370. var Gallery = (function($) {
  17371.     var my = {}, imageList = '.image-list';
  17372.  
  17373.     my.showDialog = function(imageId) {
  17374.         var $active = $('#' + imageId);
  17375.  
  17376.         $(imageList).hide();
  17377.         $active.show();
  17378.     };
  17379.  
  17380.     my.slideImage = function(direction) {
  17381.         var $active = $(imageList).filter(":visible"), $first = $(imageList).first(), $last = $(imageList).last();
  17382.  
  17383.         $(imageList).hide();
  17384.  
  17385.         if (direction == 1) {
  17386.             if ($active.attr('id') == $last.attr('id')) {
  17387.                 $first.toggle("slide", { direction: "right" });
  17388.             } else {
  17389.                 $active.next().toggle("slide", { direction: "right" });
  17390.             }
  17391.         }
  17392.         if (direction == 0) {
  17393.             if ($active.attr('id') == $first.attr('id')) {
  17394.                 $last.toggle("slide", { direction: "left" });
  17395.             } else {
  17396.                 $active.prev().toggle("slide", { direction: "left" });
  17397.             }
  17398.         }
  17399.     };
  17400.  
  17401.     return my;
  17402. }(jQuery));
  17403. ;var lead = (function ($) {
  17404.     var my = {};
  17405.  
  17406.     my.send = function (formId, modalId, messageId) {
  17407.         var $form = $('#'+formId), $btn = $('button[type=submit]', $form), t = $btn.text();
  17408.         $btn.disableButton(t);
  17409.  
  17410.         $.post('/lead.do', $form.serialize(), function (d) {
  17411.             if (d.status == 'ok') {
  17412.                 $('#'+formId+' #message').val('');
  17413.                 $('#'+modalId).modal('hide');
  17414.  
  17415.                 $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msg + '</div></div>');
  17416.                 if (d.msgUser) {
  17417.                     $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msgUser + '</div></div>');
  17418.                 }
  17419.                 $("html, body").animate({scrollTop: 0}, "slow");
  17420.             } else {
  17421.                 $('#'+messageId).append('<div class="row"><div class="alert alert-danger noMargin" role="alert">' + d.msg + '</div></div>');
  17422.             }
  17423.  
  17424.             $btn.enableButton(t);
  17425.         });
  17426.     };
  17427.     return my;
  17428. }(jQuery, window));;$(document).ready(function() {
  17429.  
  17430.     $.doAjaxRequest = function(method, request, loader) {
  17431.         loader.addClass('loader');
  17432.         return $.ajax({
  17433.             url: 'ajax/get/' + method,
  17434.             cache: false,
  17435.             type: 'POST',
  17436.             dataType: 'json',
  17437.             data: request
  17438.         });
  17439.     };
  17440.  
  17441.     $.fn.disableButton = function(text) {
  17442.         if (text) {
  17443.             text += ' ';
  17444.         }
  17445.         this.attr('disabled', 'disabled').html((text || '') + '<i class="fa fa-spinner fa-spin"></i>');
  17446.         return this;
  17447.     };
  17448.  
  17449.     $.fn.enableButton = function(text, ok) {
  17450.         var $signal, that = this;
  17451.         if (text) {
  17452.             text += ' ';
  17453.         }
  17454.  
  17455.         this.attr('disabled', false);
  17456.  
  17457.         if (ok === true) {
  17458.             $signal = $('<i class="fa fa-check"></i>');
  17459.         } else {
  17460.             if (ok === false) {
  17461.                 $signal = $('<i class="fa fa-times"></i>');
  17462.             }
  17463.         }
  17464.  
  17465.         if (typeof ok !== 'undefined') {
  17466.             this.html(text || '').append($signal);
  17467.             window.setTimeout(function() {
  17468.                 $signal.fadeOut(300, function() {
  17469.                     that.html(text)
  17470.                 })
  17471.             }, 2000);
  17472.         } else {
  17473.             this.html(text);
  17474.         }
  17475.  
  17476.         return this;
  17477.     };
  17478.  
  17479.     $.fn.handleResponse = function(response, css_class) {
  17480.         response = response || {};
  17481.         response = response.hasOwnProperty('data') && Object.size(response.data) ? response.data[Object.keys(response.data)[0]] : false;
  17482.         var size = !!response ? Object.size(response) : 0;
  17483.         var $select = $(css_class);
  17484.         if (size) {
  17485.             $select.find('option:gt(0)').remove();
  17486.             $select.append('<option value=\"' + response + '\">' + response + '</option>');
  17487.             setTimeout(function() {
  17488.                 $select.prop('disabled', false);
  17489.                 $select.val(response);
  17490.                 $('#ort').focus();
  17491.             }, 0);
  17492.         } else {
  17493.             $select.find('option:gt(0)').remove();
  17494.         }
  17495.     };
  17496.  
  17497.     var $form = $('.simple-form form');
  17498.     if ($form.length) {
  17499.         var timeout, needReload = true;
  17500.         $('#plz').on('keyup', function(e) {
  17501.             var $this = $(this);
  17502.             $this.val($this.val().replace(/[^0-9]/g, ''));
  17503.             var zip = $this.val().length;
  17504.             if (zip < 5) {
  17505.                 needReload = true;
  17506.             }
  17507.             if (needReload) {
  17508.                 $('#ort').val('').prop('disabled', true);
  17509.                 if (zip == 5) {
  17510.                     clearTimeout(timeout);
  17511.                     timeout = setTimeout(function() {
  17512.                         var $loader = $('#ort').parent();
  17513.                         $.doAjaxRequest('residence', { plz: $this.val() }, $loader)
  17514.                             .success(function(response) {
  17515.                                 needReload = false;
  17516.                                 $this.handleResponse(response, '#ort');
  17517.                                 $loader.removeClass('loader');
  17518.                             });
  17519.                     }, 100);
  17520.                 }
  17521.             }
  17522.         }).trigger('keyup');
  17523.     }
  17524.  
  17525.     // find file uploads with size
  17526.     $('input[type=file]').each(function() {
  17527.         var my = $(this), maxsize = my.data('max-size');
  17528.         if (maxsize) {
  17529.             my.parents('form').submit(function() {
  17530.                 if (my.get(0).files.length) {
  17531.                     if (my.get(0).files[0].size > maxsize) {
  17532.                         alert('Die Datei ist leider zu groß, bitte senden Sie nur Bilder bis zu ' + (maxsize / 1000000) + ' MB Dateigröße.');
  17533.                         return false;
  17534.                     }
  17535.                 }
  17536.             });
  17537.         }
  17538.     });
  17539.  
  17540. });
  17541.  
  17542. // login module
  17543. var Login = (function(w, d, $, my) {
  17544.     var eventListener = [];
  17545.  
  17546.     my.registerListener = function(callback) {
  17547.         eventListener.push(callback);
  17548.     };
  17549.  
  17550.     my.popup = function(el) {
  17551.         var t = 300, l = 500, y = 530, x = 450;
  17552.  
  17553.         var $form = $(el).parents('form');
  17554.         /* $('.form-login-email', $form).val('email@example.com');*/
  17555.         $('.form-login-returnBlock').attr('checked', false);
  17556.         $('.form-login-terms').attr('checked', true);
  17557.  
  17558.         if (w.screen) {
  17559.             t = Math.round(w.screen.availHeight / 2 - y / 2 - 50);
  17560.             l = Math.round(w.screen.availWidth / 2 - x / 2 - 10);
  17561.  
  17562.             // chrome bug
  17563.             if (w.screenX > w.screen.availWidth) {
  17564.                 l += w.screen.availWidth;
  17565.             }
  17566.         }
  17567.         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');
  17568.     };
  17569.  
  17570.     my.popupSubmit = function(form) {
  17571.         var $form = $(form), f = new FormData(form), $btn = $('button[type=submit]', $form), t = $btn.html();
  17572.  
  17573.         $btn.attr('disabled', 'disabled').html(t + ' <i class="fa fa-spinner fa-spin"></i>');
  17574.  
  17575.         $.ajax({
  17576.             url: my.loginUrl,
  17577.             type: 'POST',
  17578.             data: f,
  17579.             cache: false,
  17580.             contentType: false,
  17581.             processData: false,
  17582.             success: function(d) {
  17583.                 $btn.attr('disabled', false).html(t);
  17584.                 if (d.status == 'ok') {
  17585.                     //CustomEvent workarond for IE
  17586.                     var evt = w.opener.document.createEvent("CustomEvent");
  17587.                     evt.initCustomEvent('message', false, false, {
  17588.                         a: 'dialo_login_popup_ok', d: d
  17589.                     });
  17590.  
  17591.                     w.opener.dispatchEvent(evt);
  17592.                     w.close();
  17593.                 }
  17594.                 if (d.status == 'error') {
  17595.                     var $msg = $('<div class="alert alert-danger">' + d.msg + '</div>').hide();
  17596.                     $('#errorMessage').append($msg);
  17597.                     $msg.slideDown(100);
  17598.                     window.setTimeout(function() {
  17599.                         $msg.slideUp(200);
  17600.                     }, 2000);
  17601.                 }
  17602.             }
  17603.         });
  17604.     };
  17605.  
  17606.     my.listener = function(e) {
  17607.         if (e.detail && e.detail.a === 'dialo_login_popup_ok') {
  17608.             var d = e.detail.d;
  17609.             $('.form-login-actions').hide();
  17610.             $('.form-login-actions').next().hide(); //hide required star
  17611.             $('.form-login-email').val('email@example.com');
  17612.             $('.csrf-token').attr('name', d.token.name).val(d.token.value);
  17613.             $('.form-login-returnBlock').remove();
  17614.             $('.form-login-terms').remove();
  17615.             $('.form-login-terms-checkbox').attr('checked', true);
  17616.             $('.form-login-terms-checkbox').parent().hide();
  17617.             $('.form-login-newsletter-checkbox').parent().hide();
  17618.             $('.recaptcha-holder').addClass('recaptcha-deactivate'); // remove captcha
  17619.             $('.form-login-submit').slideDown();
  17620.  
  17621.             if (d.canClaim) {
  17622.                 $('#claimBox').slideDown();
  17623.             }
  17624.  
  17625.             for (var i = 0; i < eventListener.length; i++) {
  17626.                 if (typeof eventListener[i] == 'function') {
  17627.                     eventListener[i](d);
  17628.                 }
  17629.             }
  17630.             if ($('#selectKeywordPayment').length || $('#companyPayment').length) {
  17631.                 Payment.adpackage.login(e.detail.d.userId);
  17632.             }
  17633.         }
  17634.     };
  17635.  
  17636.     my.facebook = function(data) {
  17637.         $.ajax({
  17638.             url: my.loginUrl,
  17639.             type: 'POST',
  17640.             data: {
  17641.                 fbUserId: data.profile.id,
  17642.                 fbEmail: data.profile.email,
  17643.                 fbAccessToken: data.auth.authResponse.accessToken
  17644.             },
  17645.             cache: false,
  17646.             success: function(d) {
  17647.                 if (d.status == 'ok') {
  17648.                     //CustomEvent workarond for IE
  17649.                     var evt = w.opener.document.createEvent("CustomEvent");
  17650.                     evt.initCustomEvent('message', false, false, {
  17651.                         a: 'dialo_login_popup_ok', d: d
  17652.                     });
  17653.  
  17654.                     w.opener.dispatchEvent(evt);
  17655.                     w.close();
  17656.                 }
  17657.             }
  17658.         });
  17659.     };
  17660.  
  17661.     my.facebookRegister = function(data) {
  17662.         var html = '';
  17663.  
  17664.         html += '<div class="col-md-12">Die Registrierung erfolgt über Facebook.</div>';
  17665.         html += '<input type="hidden" name="fbToken" value="' + data.auth.authResponse.accessToken + '" />';
  17666.         html += '<input type="hidden" name="fbUsername" value="' + data.profile.name + '" />';
  17667.  
  17668.         $('.form-login-options').html(html);
  17669.  
  17670.         $('.form-login-submit').slideDown();
  17671.         $('#claimBox').slideDown();
  17672.     };
  17673.  
  17674.     my.facebookConnect = function(data) {
  17675.         $('.facebook-login-button').disableButton();
  17676.  
  17677.         $.ajax({
  17678.             url: my.fbConnectUrl,
  17679.             type: 'POST',
  17680.             data: {
  17681.                 fbUserId: data.profile.id,
  17682.                 fbEmail: data.profile.email,
  17683.                 fbAccessToken: data.auth.authResponse.accessToken
  17684.             },
  17685.             cache: false,
  17686.             success: function(d) {
  17687.                 if (d.status == 'ok') {
  17688.                     $('.facebook-login-button').replaceWith('Vielen Dank für die Verknüpfung.');
  17689.                 }
  17690.             }
  17691.         });
  17692.     };
  17693.  
  17694.     my.showRegister = function(el) {
  17695.         var $form = $(el).parents('form');
  17696.         $('.form-login-email', $form).val('');
  17697.         $('.form-login-email', $form).val('');
  17698.         $('.form-login-returnBlock').attr('checked', true);
  17699.         $('.form-login-terms').attr('checked', false);
  17700.     };
  17701.  
  17702.     my.checkForSend = function($el) {
  17703.         var value = $el.val();
  17704.  
  17705.         if (value.length > 4) {
  17706.             $('.form-login-submit').slideDown();
  17707.             $('#claimBox').slideDown();
  17708.         } else {
  17709.             $('.form-login-submit').slideUp();
  17710.             $('#claimBox').slideUp();
  17711.         }
  17712.     };
  17713.  
  17714.     return my;
  17715. }(window, document, jQuery, Login || {}));
  17716.  
  17717. // Popup FbApp
  17718. function FbPopup(link) {
  17719.     var t = 300, l = 500, y = 450, x = 600;
  17720.  
  17721.     if (window.screen) {
  17722.         t = Math.round(window.screen.availHeight / 2 - y / 2 - 50);
  17723.         l = Math.round(window.screen.availWidth / 2 - x / 2 - 10);
  17724.  
  17725.         // chrome bug
  17726.         if (window.screenX > window.screen.availWidth) {
  17727.             l += window.screen.availWidth;
  17728.         }
  17729.     }
  17730.     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');
  17731. }
  17732.  
  17733. function activateInputSlider(value, sliderId, radiusId, showRadiusId) {
  17734.     $slider = $('#' + sliderId);
  17735.     $radius = $('#' + radiusId);
  17736.     $showRadius = $('#' + showRadiusId);
  17737.  
  17738.     $slider.slider({
  17739.         range: 'max',
  17740.         min: 1,
  17741.         max: 100,
  17742.         value: value,
  17743.         slide: function(event, ui) {
  17744.             $radius.val(ui.value);
  17745.             $showRadius.text(ui.value);
  17746.         }
  17747.     });
  17748. }
  17749.  
  17750. function showSearchClearIcon(element, searchWrapper, clearIcon, additionalClass) {
  17751.     if ($(window).width() <= 768) { //for iPad & smaller devices
  17752.         var t = $(element);
  17753.         $('.' + clearIcon).toggle(Boolean(t.val()));
  17754.         if (Boolean(t.val())) {
  17755.             $('.' + searchWrapper).addClass(additionalClass);
  17756.         } else {
  17757.             $('.' + searchWrapper).removeClass(additionalClass);
  17758.         }
  17759.     }
  17760. }
  17761.  
  17762. function clearSearch(element, searchBox, searchWrapper, additionalClass) {
  17763.     if ($(window).width() <= 768) { //for iPad & smaller devices
  17764.         $('.' + searchBox).val('').focus();
  17765.         $('.' + searchWrapper).removeClass(additionalClass);
  17766.         $(element).hide();
  17767.     }
  17768. }
  17769.  
  17770. function autoresizeTextarea(element) {
  17771.     if (element != null) {
  17772.         element.style.height = '0px';
  17773.         var textareaHeight = element.scrollHeight + 10;
  17774.         if (textareaHeight == 10) {
  17775.             textareaHeight = 50;
  17776.         }
  17777.         var maxHeight = 450;
  17778.         if (textareaHeight > maxHeight) {
  17779.             element.style.height = maxHeight + 'px';
  17780.             element.style.overflow = 'auto';
  17781.         } else {
  17782.             element.style.height = textareaHeight + 'px';
  17783.         }
  17784.     }
  17785. }
  17786.  
  17787. function autoResizePlaceholderImage() {
  17788.     $('.imagePlaceholder').each(function(index, value) {
  17789.         var height = $(value).height();
  17790.  
  17791.         $(value).css({
  17792.             'font-size': (height / 1.5) + 'px',
  17793.             'line-height': height + 'px'
  17794.         });
  17795.     });
  17796. }
  17797.  
  17798. function outputFlashSession(id) {
  17799.     id = typeof id !== 'undefined' ? id : 'flashSessionOutput';
  17800.     $.get('/flashmessage.do', {}, function(html) {
  17801.         $('#' + id).html(html);
  17802.     });
  17803. }
  17804.  
  17805. function changeArrow(e) {
  17806.     clicked = $(document).find("[href='#" + $(e.target).attr('id') + "']");
  17807.     icon = clicked.find('i');
  17808.  
  17809.     if (icon.hasClass('fa-angle-down')) {
  17810.         icon.removeClass('fa-angle-down');
  17811.         icon.addClass('fa-angle-up');
  17812.     } else {
  17813.         icon.removeClass('fa-angle-up');
  17814.         icon.addClass('fa-angle-down');
  17815.     }
  17816. };;(function() {
  17817. var method, noop = function() {};
  17818. var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
  17819. var length = methods.length;
  17820. var console = (window.console = window.console || {});
  17821. while (length--) {
  17822.     method = methods[length];
  17823.     if (!console[method]) console[method] = noop;
  17824. }
  17825. }());
  17826.  
  17827. ;(function($){
  17828.     $(".alert .close").click(function() {
  17829.         $(this).parent().fadeTo("slow", 0.00, function(){
  17830.             $(this).slideUp();
  17831.         }); return false;
  17832.     });
  17833. })(jQuery);
  17834.  
  17835. Object.size = function(obj) {
  17836.     var size = 0, key;
  17837.     for (key in obj) if (obj.hasOwnProperty(key)) size++;
  17838.     return size;
  17839. };
  17840. ;/*
  17841.   Bootstrap - File Input
  17842.   ======================
  17843.  
  17844.   This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
  17845.  
  17846.   Converts all
  17847.   <input type="file">
  17848.   into Bootstrap buttons
  17849.   <a class="btn">Browse</a>
  17850.  
  17851. */
  17852. $(function() {
  17853.  
  17854. $.fn.bootstrapFileInput = function() {
  17855.  
  17856.   this.each(function(i,elem){
  17857.  
  17858.     var $elem = $(elem);
  17859.  
  17860.     // Maybe some fields don't need to be standardized.
  17861.     if (typeof $elem.attr('data-bfi-disabled') != 'undefined') {
  17862.       return;
  17863.     }
  17864.  
  17865.     // Set the word to be displayed on the button
  17866.     var buttonWord = 'Browse';
  17867.  
  17868.     if (typeof $elem.attr('title') != 'undefined') {
  17869.       buttonWord = $elem.attr('title');
  17870.     }
  17871.  
  17872.     // Start by getting the HTML of the input element.
  17873.     // Thanks for the tip http://stackoverflow.com/a/1299069
  17874.     var input = $('<div>').append( $elem.eq(0).clone() ).html();
  17875.     var className = '';
  17876.  
  17877.     if (!!$elem.attr('class')) {
  17878.       className = ' ' + $elem.attr('class');
  17879.     }
  17880.  
  17881.     // Now we're going to replace that input field with a Bootstrap button.
  17882.     // The input will actually still be there, it will just be float above and transparent (done with the CSS).
  17883.     $elem.replaceWith('<a class="file-input-wrapper btn' + className + '">'+buttonWord+input+'</a>');
  17884.   })
  17885.  
  17886.   // After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
  17887.   // 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.
  17888.   .promise().done( function(){
  17889.  
  17890.     // 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.
  17891.     // This gives us the pointer cursor that FF denies us
  17892.     $('.file-input-wrapper').mousemove(function(cursor) {
  17893.  
  17894.       var input, wrapper,
  17895.         wrapperX, wrapperY,
  17896.         inputWidth, inputHeight,
  17897.         cursorX, cursorY;
  17898.  
  17899.       // This wrapper element (the button surround this file input)
  17900.       wrapper = $(this);
  17901.       // The invisible file input element
  17902.       input = wrapper.find("input");
  17903.       // The left-most position of the wrapper
  17904.       wrapperX = wrapper.offset().left;
  17905.       // The top-most position of the wrapper
  17906.       wrapperY = wrapper.offset().top;
  17907.       // The with of the browsers input field
  17908.       inputWidth= input.width();
  17909.       // The height of the browsers input field
  17910.       inputHeight= input.height();
  17911.       //The position of the cursor in the wrapper
  17912.       cursorX = cursor.pageX;
  17913.       cursorY = cursor.pageY;
  17914.  
  17915.       //The positions we are to move the invisible file input
  17916.       // 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
  17917.       moveInputX = cursorX - wrapperX - inputWidth + 20;
  17918.       // Slides the invisible input Browse button to be positioned middle under the cursor
  17919.       moveInputY = cursorY- wrapperY - (inputHeight/2);
  17920.  
  17921.       // Apply the positioning styles to actually move the invisible file input
  17922.       input.css({
  17923.         left:moveInputX,
  17924.         top:moveInputY
  17925.       });
  17926.     });
  17927.  
  17928.     $('.file-input-wrapper input[type=file]').change(function(){
  17929.  
  17930.       var fileName;
  17931.       fileName = $(this).val();
  17932.  
  17933.       // Remove any previous file names
  17934.       $(this).parent().next('.file-input-name').remove();
  17935.       if (!!$(this).prop('files') && $(this).prop('files').length > 1) {
  17936.         fileName = $(this)[0].files.length+' files';
  17937.         //$(this).parent().after('<span class="file-input-name">'+$(this)[0].files.length+' files</span>');
  17938.       }
  17939.       else {
  17940.         // var fakepath = 'C:\\fakepath\\';
  17941.         // fileName = $(this).val().replace('C:\\fakepath\\','');
  17942.         fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
  17943.       }
  17944.  
  17945.       $(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
  17946.     });
  17947.  
  17948.   });
  17949.  
  17950. };
  17951.  
  17952. // Add the styles before the first stylesheet
  17953. // This ensures they can be easily overridden with developer styles
  17954. var cssHtml = '<style>'+
  17955.   '.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
  17956.   '.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; }'+
  17957.   '.file-input-name { margin-left: 8px; }'+
  17958.   '</style>';
  17959. $('link[rel=stylesheet]').eq(0).before(cssHtml);
  17960.  
  17961. });;var AjaxForm = (function($, window) {
  17962.     var my = {}, dialogTemplate, windowsTemplate;
  17963.  
  17964.     dialogTemplate = '<div class="modal fade" id=":id:" tabindex="-1" role="dialog">'
  17965.         + '<div class="modal-dialog" style=":style:"><div class="modal-content">'
  17966.         + '<div class="modal-header">'
  17967.         + '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'
  17968.         + '<p class="modal-title lead"><strong>:title:</strong></p>'
  17969.         + '</div>'
  17970.         + '<div class="modal-body" id="modal-body-:id:">:text:</div>'
  17971.         + '</div>'
  17972.         + '</div></div>';
  17973.  
  17974.     windowsTemplate = '<div id=":id:">' +
  17975.         '<h3>:title:</h3>' +
  17976.         '<div>:text:</div>' +
  17977.         '</div>';
  17978.  
  17979.     function handleResponse(url, response, options, showInDialog) {
  17980.         if (typeof showInDialog === "undefined" || showInDialog === null) {
  17981.             showInDialog = true;
  17982.         }
  17983.  
  17984.         var html, $dialog, id = 'ajaxform_' + Math.ceil(Math.random() * 1000000);
  17985.         options = options || {};
  17986.         options.style = options.style || '';
  17987.  
  17988.         if (showInDialog) {
  17989.             html = dialogTemplate.replace(/:id:/g, id)
  17990.                 .replace(':style:', options.style)
  17991.                 .replace(':title:', response.title)
  17992.                 .replace(':text:', response.html);
  17993.  
  17994.             $('body').append(html);
  17995.             $dialog = $('#' + id);
  17996.  
  17997.             $dialog.on('hidden.bs.modal', function(e) {
  17998.                 // user somehow aborted -> kill the dialog
  17999.                 //$dialog.remove();
  18000.             });
  18001.  
  18002.             $dialog.modal('show');
  18003.  
  18004.             //bugfix scrolling in dialog - add class to body
  18005.             $('.modal').on("hidden.bs.modal", function(e) {
  18006.                 if ($('.modal:visible').length) {
  18007.                     $('body').addClass('modal-open');
  18008.                 }
  18009.             });
  18010.         } else {
  18011.             html = windowsTemplate.replace(/:id:/g, id)
  18012.                 .replace(':title:', response.title)
  18013.                 .replace(':text:', response.html);
  18014.  
  18015.             if (options.boxId) {
  18016.                 $('#' + options.boxId).append(html);
  18017.             }
  18018.  
  18019.             $dialog = $('#' + id);
  18020.         }
  18021.  
  18022.         // grab the submit
  18023.         $('form', $dialog).submit(function(e) {
  18024.             var $form = $(this), formData = new FormData($form[0]);
  18025.             e.preventDefault();
  18026.  
  18027.             $.ajax({
  18028.                 url: url,
  18029.                 type: 'POST',
  18030.                 data: formData,
  18031.                 async: false,
  18032.                 cache: false,
  18033.                 contentType: false,
  18034.                 processData: false,
  18035.                 success: function(response) {
  18036.                     if (response.status === 'reload') {
  18037.                         window.location.reload();
  18038.                     }
  18039.                     if (response.status === 'ajax') {
  18040.                         Ajax.getContent(response.url, response.id, {});
  18041.                     } else {
  18042.                         handleResponse(url, response, options);
  18043.                     }
  18044.                 }
  18045.             });
  18046.             if (showInDialog) {
  18047.                 $dialog.modal('hide');
  18048.             }
  18049.         });
  18050.     }
  18051.  
  18052.     my.show = function(url, options, showInDialog) {
  18053.         if (window.event) {
  18054.             window.event.stopPropagation();
  18055.         }
  18056.         $('#dialog-waiting').modal('show');
  18057.         $.get(url, function(response) {
  18058.             handleResponse(url, response, options, showInDialog);
  18059.             $('#dialog-waiting').modal('hide');
  18060.         });
  18061.     };
  18062.  
  18063.     return my;
  18064. }(jQuery, window));
  18065.  
  18066. var Helper = (function($) {
  18067.     var my = {};
  18068.  
  18069.     my.previewImage = function(inputElement) {
  18070.         if (inputElement.files && inputElement.files[0]) {
  18071.             var reader = new FileReader();
  18072.  
  18073.             reader.onload = function(e) {
  18074.                 var $el = $(inputElement), $container = $el.parent(), $preview = $('.image-preview');
  18075.  
  18076.                 if ($preview.size() === 0) {
  18077.                     $preview = $('<img/>').addClass('image-preview');
  18078.                     $preview.appendTo($container);
  18079.                 }
  18080.  
  18081.                 $preview.attr('src', e.target.result);
  18082.             };
  18083.  
  18084.             reader.readAsDataURL(inputElement.files[0]);
  18085.         }
  18086.     };
  18087.  
  18088.     my.changeImageStatus = function(status) {
  18089.         if (status == true) {
  18090.             $('.file-manager-file-delete').val('true');
  18091.             $('.image-preview').attr('src', '');
  18092.             $('.image-preview').attr('alt', '');
  18093.             $('#image-delete').hide();
  18094.             $('#image-placeholder').show();
  18095.         } else {
  18096.             $('.file-manager-file-delete').val('false');
  18097.             $('#image-delete').show();
  18098.             $('#image-placeholder').hide();
  18099.         }
  18100.     };
  18101.  
  18102.     return my;
  18103. }(jQuery));
  18104.  
  18105. function cityAutocomplete(element, id) {
  18106.     if (!id) {
  18107.         id = 'town';
  18108.     }
  18109.     autocompleteDropDown.start('/zipcity.do', { element: element, threshold: 2 }, id);
  18110. }
  18111.  
  18112. function keywordAutocomplete(element, event, limit) {
  18113.     var code = event.keyCode || event.which;
  18114.     if (code == 32 || code == 13 || code == 188) { //space, return, comma
  18115.         event.preventDefault();
  18116.         addKeyword(element, $(element).val(), limit);
  18117.     }
  18118. }
  18119.  
  18120. function addKeyword(element, keyword, limit) {
  18121.     if (!keyword) {
  18122.         keyword = $(element).val();
  18123.     }
  18124.  
  18125.     if (keyword.trim()) {
  18126.         var keywordArray = keyword.split(',');
  18127.  
  18128.         if (typeof limit !== "undefined") {
  18129.             var $keywords = $('#keywordData').val();
  18130.             if ($keywords) {
  18131.                 $keywords = JSON.parse($keywords);
  18132.                 if ($keywords.length >= limit) {
  18133.                     $('#keywordError').show();
  18134.                     return;
  18135.                 }
  18136.             }
  18137.  
  18138.         }
  18139.  
  18140.         $.each(keywordArray, function(index, value) {
  18141.             if (value.trim()) {
  18142.                 var result = {
  18143.                     keywordType: null,
  18144.                     keyword: value
  18145.                 };
  18146.  
  18147.                 var $keywords = $('#keywordData'),
  18148.                     $keywordContainer = $('#keywordContainer');
  18149.  
  18150.                 $keywordContainer.appendKeyword(result);
  18151.                 $.updateKeywords($keywordContainer, $keywords);
  18152.                 $(element).val('');
  18153.             }
  18154.         });
  18155.     }
  18156. }
  18157.  
  18158. $.fn.appendKeyword = function(data) {
  18159.     this.append('<span class="btn btn-default" data-type="' + data.keywordType + '" onclick="keywordRemove(this)">' + data.keyword + ' <i class="fa fa-times-circle"></i></span>');
  18160. };
  18161.  
  18162. $.updateKeywords = function($keywordContainer, $keywords) {
  18163.     var keywords = [];
  18164.     $keywordContainer.find('> span').each(function(i) {
  18165.         var $this = $(this);
  18166.         keywords.push({
  18167.             keywordType: $this.attr('data-type'),
  18168.             keyword: $this.text()
  18169.         });
  18170.     });
  18171.     $keywords.val(JSON.stringify(keywords));
  18172. };
  18173.  
  18174. function keywordRemove(element) {
  18175.     var $keywords = $('#keywordData');
  18176.  
  18177.     $(element).remove().data();
  18178.     $.updateKeywords($('#keywordContainer'), $keywords);
  18179. }
  18180.  
  18181. function parseKeywords() {
  18182.     var keywordRaw = $('#keywordData').val(), keyword, $keywordContainer = $('#keywordContainer');
  18183.  
  18184.     if (keywordRaw) {
  18185.         try {
  18186.             keyword = jQuery.parseJSON(keywordRaw);
  18187.         } catch (e) {
  18188.             // old broken keyword structure
  18189.             // be nice, it's not their fault
  18190.         }
  18191.  
  18192.         if ($.isArray(keyword)) {
  18193.             $.each(keyword, function(i, v) {
  18194.                 $keywordContainer.appendKeyword(v);
  18195.             });
  18196.         }
  18197.     }
  18198. }
  18199.  
  18200. function branchAutocomplete(element) {
  18201.     $('#clientCategoryText').attr('data-id', '');
  18202.     $('#clientCategoryId').val('');
  18203.  
  18204.     autocomplete.start('/category.do', {
  18205.         element: element,
  18206.         threshold: 3,
  18207.         pickClass: '',
  18208.         onPick: function(element) {
  18209.             var data = $(element).data();
  18210.  
  18211.             var branchIds = [], $branches = $('#clientCategoryId'),
  18212.                 $branchContainer = $('#clientCategoryText');
  18213.  
  18214.             $branchContainer.find('> span').each(function(i) {
  18215.                 branchIds.push(parseInt($(this).attr('data-id')));
  18216.             });
  18217.             if ($.inArray(parseInt(data.key), branchIds) < 0) {
  18218.                 var result = {
  18219.                     branch_id: data.key,
  18220.                     branch: data.value
  18221.                 };
  18222.                 $branchContainer.appendBranch(result);
  18223.                 $.updateBranch($branchContainer, $branches);
  18224.             }
  18225.         }
  18226.     });
  18227. }
  18228.  
  18229. $.fn.appendBranch = function(data) {
  18230.     var $el = $('#clientCategoryText');
  18231.     $el.val(data.branch);
  18232.     $el.attr('data-id', data.branch_id);
  18233. };
  18234.  
  18235. $.updateBranch = function($branchContainer, $branch) {
  18236.     $branch.val($branchContainer.attr('data-id'));
  18237. };
  18238.  
  18239. function formatOpeningHours(element) {
  18240.     var data = $(element).val();
  18241.     if (data.indexOf(".") >= 0) {
  18242.         data = data.replace('.', ':');
  18243.  
  18244.         $(element).val(data);
  18245.     }
  18246.  
  18247.     var dataArray = data.split(':');
  18248.  
  18249.     if (dataArray.length > 1) {
  18250.         if (dataArray[0].length < 2) {
  18251.             data = '0' + data;
  18252.         }
  18253.         data = data.substring(0, 5);
  18254.  
  18255.         $(element).val(data);
  18256.     }
  18257. }
  18258.  
  18259. jQuery(document).ready(function() {
  18260.     parseKeywords();
  18261.  
  18262.     var $clientCategoryId = $('#clientCategoryId');
  18263.  
  18264.     if ($clientCategoryId.size()) {
  18265.         try {
  18266.             var branch = jQuery.parseJSON($clientCategoryId.val()),
  18267.                 $branchContainer = $('#clientCategoryText');
  18268.  
  18269.             $.each(branch, function(i, v) {
  18270.                 $branchContainer.appendBranch(v);
  18271.             });
  18272.         } catch (err) {
  18273.         }
  18274.     }
  18275.  
  18276.     // help the user with homepage input
  18277.     $('input[type=url]').blur(function() {
  18278.         var $el = $(this), val = $el.val();
  18279.  
  18280.         if (val && val.search(/^http/) === -1) {
  18281.             $el.val('http://' + val);
  18282.         }
  18283.     });
  18284.  
  18285.     /*
  18286.      $('select').each(function () {
  18287.      if ($(this).length == 1) {
  18288.      $($(this + ' option').get(0)).prop('selected', true);
  18289.      }
  18290.      });*/
  18291. });
  18292.  
  18293. function fancyButtons($addFontClass) {
  18294.     var ua = 0;
  18295.     var msie = 0; //IE 10 and older
  18296.     var trident = 0; //IE 11+
  18297.     var edge = 0;
  18298.  
  18299.     if (typeof $addFontClass === undefined) {
  18300.         ua = window.navigator.userAgent;
  18301.         msie = ua.indexOf("MSIE "); //IE 10 and older
  18302.         trident = ua.indexOf('Trident/'); //IE 11+
  18303.         edge = ua.indexOf('Edge/');
  18304.     }
  18305.  
  18306.     if ($addFontClass === false || (typeof $addFontClass === undefined && (edge > 0 || trident > 0 || msie > 0))) {
  18307.         $("input[type=checkbox]").each(function() {
  18308.             if ($(this).hasClass('fa')) {
  18309.                 $(this).removeClass('fa');
  18310.             }
  18311.         });
  18312.  
  18313.         $("input[type=radio]").each(function() {
  18314.             if ($(this).hasClass('fa')) {
  18315.                 $(this).removeClass('fa');
  18316.             }
  18317.         });
  18318.     }
  18319.     else  // If another browser, return 0
  18320.     {
  18321.         $("input[type=checkbox]").each(function() {
  18322.             if (!$(this).hasClass('fa')) {
  18323.                 $(this).addClass('fa');
  18324.             }
  18325.         });
  18326.         $("input[type=radio]").each(function() {
  18327.             if (!$(this).hasClass('fa')) {
  18328.                 $(this).addClass('fa');
  18329.             }
  18330.         });
  18331.     }
  18332. }
  18333.  
  18334. function openSocialMediaLink(element) {
  18335.     var id = $(element).attr('data-id'), val = $('#' + id).val(), link = $('#' + id + '_addon_pre').text() + val;
  18336.  
  18337.     if (val.search(/^http:/) !== -1) {
  18338.         link = val;
  18339.     }
  18340.  
  18341.     window.open(link, 'Social Media Link');
  18342. }
  18343.  
  18344. function addOpeningHoursRow(containerId, hide) {
  18345.     var $container = $('#'+containerId),
  18346.         prototype = $container.data('prototype').replace(/__name__/g, 'oh' + (Math.ceil(Math.random() * 1000000)));
  18347.  
  18348.     $container.append(prototype);
  18349.     if (hide === true) {
  18350.         $container.children().first().attr('style', 'display:none');
  18351.     }
  18352. }
  18353.  
  18354. function removeOpeningHoursRow(button) {
  18355.     var row = $(button).closest('.row').closest('.form-group'), parent = row.parent();
  18356.     row.remove();
  18357.  
  18358.     if (parent.find('.form-group').length) {
  18359.  
  18360.     } else {
  18361.         addOpeningHoursRow(parent.attr('id'), true);
  18362.     }
  18363. }
  18364.  
  18365. $(document).ready(function() {
  18366.     $('.btn-checkbox .checkbox input').each(function() {
  18367.         if (this.checked) {
  18368.             toggleActiveClass($(this).parent());
  18369.         }
  18370.     });
  18371. });
  18372.  
  18373. $(document).on('click', '.btn-checkbox .checkbox label', function(e) {
  18374.     toggleActiveClass($(this).parent());
  18375. });
  18376.  
  18377. $(document).on('click', '.btn-checkbox .checkbox', function(e) {
  18378.     toggleActiveClass(this);
  18379. });
  18380.  
  18381. function toggleActiveClass(element) {
  18382.     $(element).toggleClass("active");
  18383.     var $input = $(element).find('input');
  18384.     if ($(element).hasClass("active")) {
  18385.         $input.attr('checked', 'checked');
  18386.     } else {
  18387.         $input.removeAttr('checked');
  18388.     }
  18389. }
  18390. ;Mem = (function ($, window) {
  18391.     var my = {}, autoTime, selected, prefix = '', frame = 'mainframe', source;
  18392.  
  18393.     my.init = function (listId, urlPrefix, project) {
  18394.         $('.sidebar-item .head').click(function () {
  18395.             $(this).siblings('.body').slideToggle();
  18396.         });
  18397.  
  18398.         if (listId) {
  18399.             my.selectList(listId);
  18400.         }
  18401.  
  18402.         if (urlPrefix) {
  18403.             prefix = urlPrefix;
  18404.         }
  18405.  
  18406.         if (project) {
  18407.             source = project;
  18408.         }
  18409.     };
  18410.  
  18411.     my.selectList = function (listId) {
  18412.         Ajax.getContent(prefix + 'merkliste/ajax/detail', frame, {'id': listId, 'source': source});
  18413.     };
  18414.  
  18415.     my.edit = function (listId) {
  18416.         Ajax.getContent(prefix + 'user/memoryEdit', frame, {'id': listId, 'source': source});
  18417.     };
  18418.  
  18419.     my.editCompany = function (listId) {
  18420.         Ajax.getContent(prefix + 'user/memoryEditCompany', frame, {'id': listId, 'source': source});
  18421.     };
  18422.  
  18423.     my.follow = function (btn, id) {
  18424.         var $btn = $(btn);
  18425.  
  18426.         var t = 'Nicht mehr folgen';
  18427.         $btn.attr("onclick", "Mem.unfollow(this, " + id + ")");
  18428.         $btn.disableButton(t);
  18429.  
  18430.         url = 'merkliste/ajax/follow';
  18431.  
  18432.         $.get(prefix + url, {'id': id, 'f': 1}, function (d) {
  18433.             $btn.enableButton(t, d.status == 'ok');
  18434.         });
  18435.     };
  18436.     my.unfollow = function (btn, id) {
  18437.         var $btn = $(btn);
  18438.  
  18439.         var t = 'Folgen';
  18440.         $btn.attr("onclick", "Mem.follow(this, " + id + ")");
  18441.         $btn.disableButton(t);
  18442.  
  18443.         url = 'merkliste/ajax/follow';
  18444.  
  18445.         $.get(prefix + url, {'id': id, 'f': 0}, function (d) {
  18446.             $btn.enableButton(t, d.status == 'ok');
  18447.         });
  18448.     };
  18449.  
  18450.     my.saveListSubmit = function () {
  18451.         var $form = $('#listform'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18452.         var formData = new FormData($form[0]);
  18453.  
  18454.         url = 'user/memorySave';
  18455.  
  18456.         $.ajax({
  18457.             url: prefix + url,
  18458.             type: 'POST',
  18459.             data: formData,
  18460.             async: false,
  18461.             cache: false,
  18462.             contentType: false,
  18463.             processData: false,
  18464.             success: function (d) {
  18465.                 $btn.enableButton(t, d.status == 'ok');
  18466.  
  18467.                 if (d.status == 'ok') {
  18468.                     my.editCompany(d.id);
  18469.                 } else {
  18470.                     $('#mainframe').html(d);
  18471.                 }
  18472.             }
  18473.         });
  18474.  
  18475.         return false;
  18476.     };
  18477.  
  18478.     my.searchListSubmit = function (page, searchWord, saveHistory) {
  18479.         var $form = $('#searchMemoryListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18480.         $btn.disableButton(t);
  18481.  
  18482.         if (searchWord != null) {
  18483.             $('#searchMemoryListName').val(searchWord);
  18484.         }
  18485.         $('#memorySearchPage').val(page);
  18486.  
  18487.         url = 'merkliste/ajax/searchMemory';
  18488.  
  18489.         $.post(prefix + url, $form.serialize(), function (d) {
  18490.             if (saveHistory == true) {
  18491.                 //console.log('Input Field: ' + $('#searchMemoryListName').attr('name'));
  18492.                 saveHistoryFunction("$.ajax(Ajax.getContent('" + prefix + url + "', '" + frame + "Form')).done(function() {Mem.searchListSubmit(" + $('#memorySearchPage').val() + ", '" + $('#searchMemoryListName').val() + "', false);}); setActiveSidebarEntry('searchFormLink');");
  18493.             }
  18494.  
  18495.             $btn.enableButton(t);
  18496.             $('#memoryResultFrame').html(d);
  18497.         });
  18498.     };
  18499.  
  18500.     my.deleteList = function (listId) {
  18501.         if (confirm('Möchtest du diese LieblingsListe wirklich löschen?')) {
  18502.  
  18503.             url = 'user/memoryDelete';
  18504.             urlSuccess = 'merkliste/ajax/myList';
  18505.  
  18506.             $.post(prefix + url, {'l': listId, 'source': source}, function (d) {
  18507.                 if (d.status == 'ok') {
  18508.                     message('success', 'Die LieblingsListe wurde erfolgreich gelöscht.');
  18509.  
  18510.                     Ajax.getContent(prefix + urlSuccess, frame);
  18511.                 }
  18512.             });
  18513.         }
  18514.     };
  18515.  
  18516.     function message(type, text) {
  18517.         var $msg = $('<div class="alert alert-' + type + '">' + text + '</div>');
  18518.         $msg.hide().appendTo($('.messages')).fadeIn();
  18519.         window.setTimeout(function () {
  18520.             $msg.fadeOut();
  18521.         }, 3000);
  18522.     }
  18523.  
  18524.     my.createCompanySubmit = function () {
  18525.         var $form = $('#addNewCompanyContainer #addCompany form'), $btn = $('button[type=submit]', $form), t = $btn.html();
  18526.         $btn.disableButton(t);
  18527.  
  18528.         url = 'user/createCompany';
  18529.  
  18530.         $.post(prefix + url, $form.serialize(), function (d) {
  18531.             $btn.enableButton(t, d.status == 'ok');
  18532.  
  18533.             if (d.status) {
  18534.                 $('#companyAddError').text(d.msg).show();
  18535.                 window.setTimeout(function () {
  18536.                     $('#companyAddError').fadeOut();
  18537.                 }, 2000);
  18538.  
  18539.                 $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
  18540.  
  18541.                 $('#newCompanyErrorMsg').removeClass("hidden", 100, "easeInQuad");
  18542.                 setTimeout(function () {
  18543.                     $('#newCompanyErrorMsg').addClass("hidden", 100, "easeInQuad");
  18544.                 }, 3000);
  18545.  
  18546.             } else {
  18547.                 selected = null;
  18548.                 $('#companyList').html(d);
  18549.                 $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
  18550.  
  18551.                 $('#newCompanySuccessMsg').removeClass("hidden", 100, "easeInQuad");
  18552.                 setTimeout(function () {
  18553.                     $('#newCompanySuccessMsg').addClass("hidden", 100, "easeInQuad");
  18554.                 }, 3000);
  18555.             }
  18556.         });
  18557.     };
  18558.  
  18559.     my.addFacebookSubmit = function () {
  18560.         var $form = $('#addNewCompanyContainer #addFacebookPage form'), $btn = $('button[type=submit]', $form), t = $btn.html();
  18561.         $btn.disableButton(t);
  18562.  
  18563.         url = 'user/addFacebookPage';
  18564.  
  18565.         $.post(prefix + url, $form.serialize(), function (d) {
  18566.             $btn.enableButton(t, d.status == 'ok');
  18567.             if (d.status) {
  18568.                 $('#companyAddError').text(d.msg).show();
  18569.                 window.setTimeout(function () {
  18570.                     $('#companyAddError').fadeOut();
  18571.                 }, 2000);
  18572.             } else {
  18573.                 selected = null;
  18574.                 $('#companyList').html(d);
  18575.                 $('#facebookPageLink').val('');
  18576.             }
  18577.         });
  18578.     };
  18579.  
  18580.     my.add = function (btn, cid) {
  18581.         var $btn = $(btn), t = $btn.text();
  18582.         $btn.disableButton(t);
  18583.  
  18584.         $.get('/merkliste/ajax/lists', {'cid': cid}, function (d) {
  18585.             var html = '', i;
  18586.             $btn.enableButton(t);
  18587.  
  18588.             if (d.status == 'ok') {
  18589.                 html += '<li class="list-group-item"><div class="row"><div class="col-xs-8">' +
  18590.                     '<input type="text" id="memoryNew" class="form-control" placeholder="Neue Merkliste anlegen" /></div><div class="col-xs-4">' +
  18591.                     '<button type="button" class="btn btn-warning" onclick="Mem.selected(0, ' + cid + ')">Neue Merkliste anlegen <i class="fa fa-check"></i></button>' +
  18592.                     '</div></div></div></li>';
  18593.  
  18594.                 for (i = 0; i < d.lists.length; i++) {
  18595.                     var l = d.lists[i];
  18596.                     var clickAble = '"';
  18597.                     if (!l.isOnList) {
  18598.                         clickAble = ' clickable" onclick="Mem.selected(' + l.id + ', ' + cid + ');" ';
  18599.                     }
  18600.  
  18601.  
  18602.                     html += '<li class="list-group-item' + clickAble +
  18603.                         ' data-toggle="tooltip" data-placement="bottom" title="Zur Merkliste ' + l.title + ' hinzufügen"' +
  18604.                         '><span class="indicators">' +
  18605.                         (l.isOnList ? '<i class="fa fa-2x fa-check"></i> ' : '') +
  18606.                         '</span>' + l.title + '</li>';
  18607.                 }
  18608.  
  18609.                 $('#memoryAddContainer').html('<ul class="list-group">' + html + '</ul>').slideDown();
  18610.             } else {
  18611.                 $('#memoryAddContainer').html(d.msg).slideDown();
  18612.             }
  18613.         });
  18614.     };
  18615.  
  18616.     my.selected = function (id, cid) {
  18617.         var t = '';
  18618.  
  18619.         if (id == 0) {
  18620.             t = $('#memoryNew').val();
  18621.  
  18622.             if (!t) {
  18623.                 return;
  18624.             }
  18625.         }
  18626.  
  18627.         $('#memoryAddContainer').slideUp();
  18628.  
  18629.         $.post('/merkliste/ajax/add', {'id': id, 't': t, 'cid': cid}, function (d) {
  18630.             if (d.status == 'ok') {
  18631.                 var $btn = $('#buttonAddToMemoryList');
  18632.                 $btn.enableButton($btn.text(), true);
  18633.             }
  18634.         });
  18635.     };
  18636.  
  18637.  
  18638.     my.addCompanyNotice = function (companyEntryId) {
  18639.         var notice = $('#listCompanyNotice_' + companyEntryId).val(), $btn = $('#listCompanyNoticeButton_' + companyEntryId);
  18640.         $btn.disableButton();
  18641.  
  18642.         $.post('/merkliste/ajax/addCompanyNotice', {'notice': notice, 'cid': companyEntryId}, function (d) {
  18643.             if (d.status == 'ok') {
  18644.                 $btn.enableButton('<i class="fa fa-check"></i>');
  18645.             }
  18646.         });
  18647.     };
  18648.  
  18649.     my.addCompanyNoticeList = function () {
  18650.         var $form = $('#memoryListCompanies'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18651.         $btn.disableButton(t);
  18652.  
  18653.         $.post('/merkliste/ajax/addCompanyNoticeList', $form.serialize(), function (d) {
  18654.             if (d.status == 'ok') {
  18655.                 $btn.enableButton(t);
  18656.             }
  18657.         });
  18658.     };
  18659.  
  18660.     my.addCompany = function (listId, companyId) {
  18661.         url = 'user/addCompany';
  18662.         $.get(prefix + url, {'id': listId, 'cid': companyId}, function (d) {
  18663.             if (d.status) {
  18664.                 $('#companyAddError').text(d.msg).show();
  18665.                 window.setTimeout(function () {
  18666.                     $('#companyAddError').fadeOut();
  18667.                 }, 2000);
  18668.             } else {
  18669.                 selected = null;
  18670.                 $('#companyList').html(d);
  18671.             }
  18672.         });
  18673.     };
  18674.  
  18675.     my.removeCompany = function (listId, companyEntryId) {
  18676.         var $row = $('#memoryListCompany_' + companyEntryId), $rowNotice = $('#memoryListCompanyNotice_' + companyEntryId), $btn = $('button', $row), t = $btn.html();
  18677.         $btn.disableButton();
  18678.  
  18679.         $.post('/user/memoryremove', {'l': listId, 'c': companyEntryId}, function (d) {
  18680.             if (d.status == 'ok') {
  18681.                 $row.fadeOut(200);
  18682.                 $rowNotice.fadeOut(200);
  18683.             } else {
  18684.                 $btn.enableButton(t);
  18685.             }
  18686.         });
  18687.     };
  18688.  
  18689.     my.searchCompanyListSubmit = function (boxId, page) {
  18690.         url = 'user/memorySearchCompany';
  18691.  
  18692.         var $form = $('#searchCompanyListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18693.         $btn.disableButton(t);
  18694.         $('#companySearchPage').val(page);
  18695.  
  18696.         $.post(prefix + url, $form.serialize(), function (d) {
  18697.             $btn.enableButton(t);
  18698.             $('#' + boxId).html(d);
  18699.             $("html, body").animate({scrollTop: ($('#searchCompanyListForm').offset().top) - 50}, 1000);
  18700.         });
  18701.     };
  18702.  
  18703.     return my;
  18704. }(jQuery, window));
  18705.  
  18706.  
  18707. //memory history for app
  18708. var historyList = [];
  18709.  
  18710. function saveHistory(element) {
  18711.     var onclickFunction = $(element).attr("onclick");
  18712.     onclickFunction = onclickFunction.replace("saveHistory(this);", "");
  18713.  
  18714.     saveHistoryFunction(onclickFunction);
  18715. }
  18716.  
  18717. function saveHistoryFunction(functionString) {
  18718.     if (functionString != null) {
  18719.  
  18720.         if (functionString.indexOf("setActiveSidebarEntry") <= 0) {
  18721.             sidebarId = $('#sidebar .btn-danger').attr('id');
  18722.             functionString = functionString + 'setActiveSidebarEntry("' + sidebarId + '");';
  18723.         }
  18724.         historyList.push(functionString);
  18725.         if (historyList.length > 1) {
  18726.             $('#backButton').show();
  18727.         }
  18728.     }
  18729. }
  18730.  
  18731. function historyBack() {
  18732.     /*
  18733.      remove the current element from the list with pop
  18734.      trigger the now last entry
  18735.      make sure there are at least 2 entries in the list (> 1)
  18736.      otherwise the current entry will be removed by pop and can not be reached in the future
  18737.      */
  18738.     if (historyList.length > 1) {
  18739.         historyList.pop();
  18740.         var lastFunction = historyList[historyList.length - 1];
  18741.  
  18742.         if (lastFunction != 'undefined') {
  18743.             eval(lastFunction);
  18744.         }
  18745.     } else {
  18746.         $('#backButton').hide();
  18747.     }
  18748. };var Categories = (function () {
  18749.     var my = {},
  18750.         firstLevelPrefix = 'first-level-',
  18751.         secondLevelPrefix = 'second-level-list-',
  18752.         categoriesPrefix = 'categories-';
  18753.  
  18754.     /* --------------------------------------------------------------*/
  18755.     /*                        categoryList                           */
  18756.  
  18757.     my.showFirstLevelName = function (firstLevelId) {
  18758.         hideElement(firstLevelId);
  18759.         $('#first-level-' + firstLevelId).slideDown();
  18760.     };
  18761.  
  18762.     my.showSecondLevelName = function (firstLevelId) {
  18763.         hideElement(firstLevelId);
  18764.  
  18765.         if ($('#' + firstLevelPrefix + firstLevelId).is(":hidden")) {
  18766.             $('#' + firstLevelPrefix + firstLevelId).slideDown();
  18767.         }
  18768.         if ($('#' + secondLevelPrefix + firstLevelId).is(":hidden")) {
  18769.             $('#' + secondLevelPrefix + firstLevelId).slideDown();
  18770.         }
  18771.     };
  18772.  
  18773.     function hideElement(id) {
  18774.         $('.first-level-name').each(function () {
  18775.             if ($(this).attr('id') != firstLevelPrefix + id) {
  18776.                 $(this).slideUp();
  18777.             }
  18778.         });
  18779.         $('.second-level-list').each(function () {
  18780.             if ($(this).attr('id') != secondLevelPrefix + id) {
  18781.                 $(this).slideUp();
  18782.             }
  18783.         });
  18784.     }
  18785.  
  18786.  
  18787.     /* --------------------------------------------------------------*/
  18788.     /*                      biggestCityList                          */
  18789.  
  18790.     my.showCategoryInCityList = function (cityId) {
  18791.         if ($('#' + categoriesPrefix + cityId).is(":hidden")) {
  18792.             $('.categories-in-city').each(function () {
  18793.                 $(this).slideUp();
  18794.             });
  18795.  
  18796.             $('#' + categoriesPrefix + cityId).slideDown();
  18797.         }
  18798.     };
  18799.  
  18800.     return my;
  18801. }(jQuery, window));;var Navigation = (function () {
  18802.     var my = {};
  18803.  
  18804.     my.scrollTolElement = function (id) {
  18805.         $('html, body').animate({
  18806.             scrollTop: $('#' + id).offset().top
  18807.         }, 1000);
  18808.     };
  18809.  
  18810.     return my;
  18811. }(jQuery, window));;var Mobile = (function($) {
  18812.     var my = {}, isMobile = false;
  18813.  
  18814.     my.isMobile = function() {
  18815.         if ($(window).width() <= 768) { //for iPad & smaller devices
  18816.             isMobile = true;
  18817.         }
  18818.  
  18819.         return isMobile;
  18820.     };
  18821.  
  18822.     return my;
  18823. }(jQuery));;var TrackingCompany = (function () {
  18824.     var my = {}, method = 'trackcompany.do';
  18825.  
  18826.     my.send = function (action, companyId, userId) {
  18827.         return $.ajax({
  18828.             url: '/' + method,
  18829.             cache: false,
  18830.             type: 'POST',
  18831.             dataType: 'json',
  18832.             data: {
  18833.                 'action': action,
  18834.                 'companyId': companyId,
  18835.                 'userId': userId
  18836.             }
  18837.         });
  18838.     };
  18839.  
  18840.     return my;
  18841. }(jQuery, window));;var Cookie = (function($) {
  18842.     var my = {};
  18843.     my.set = function(key, value) {
  18844.         var expires = new Date();
  18845.         expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
  18846.         document.cookie = key + '=' + value + ';path=/' + ';expires=' + expires.toUTCString();
  18847.     };
  18848.  
  18849.     my.get = function(key) {
  18850.         var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
  18851.         return keyValue ? keyValue[2] : null;
  18852.     };
  18853.  
  18854.     return my;
  18855. }(jQuery));;/**
  18856.  * fontFaceCheck v0.2
  18857.  * Roel Nieskens, November 11, 2013
  18858.  *
  18859.  * Released under the MIT License. http://www.opensource.org/licenses/mit-license.php
  18860.  *
  18861.  * http://pixelambacht.nl/2013/font-face-render-check/
  18862.  *
  18863.  * Usage:
  18864.  * 1. If you call fontFaceCheck.support(), either a fontfacerender or a no-fontfacerender class
  18865.  *    will be added to the HTML tag.
  18866.  * 2. Or use a callback function to grab the test result:
  18867.  *    fontFaceCheck.support( function(isSupported) { alert(isSupported) } );
  18868.  *
  18869.  * For IE8 and below, also pass the path to the EOT font: fontFaceCheck.support('/my/font/');
  18870.  *
  18871.  * Should work on all JavaScript-enabled browsers, old or new
  18872.  *
  18873.  * Inspired by the work of Paul Irish: http://www.paulirish.com/2009/font-face-feature-detection/
  18874.  */
  18875. var fontFaceCheck = new function() {
  18876.  
  18877.     var doc = document,
  18878.         body = doc.body || doc.documentElement.appendChild(doc.createElement("fontface")),
  18879.         tempElm = doc.createElement("span"),
  18880.         tempStyle = doc.createElement("style"),
  18881.         delay = 5,
  18882.         runs = 20,
  18883.         supported,
  18884.  
  18885.         // Gratefully taken from https://gist.github.com/padolsey/527683
  18886.         ie = (function(){
  18887.             var undef,
  18888.                 v = 3,
  18889.                 div = doc.createElement("div"),
  18890.                 all = div.getElementsByTagName("i");
  18891.  
  18892.             while (
  18893.                 div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
  18894.                     all[0]
  18895.                 );
  18896.  
  18897.             return v > 4 ? v : undef;
  18898.         }()),
  18899.  
  18900.         checkSupport = function(fontPathEOT, callback) {
  18901.             // Use timeout because Gecko and Webkit load data-uri font asynchronously :(
  18902.             // setTimeout(function(){
  18903.             supported = (tempElm.offsetWidth / Math.max(1, tempElm.offsetHeight)) >= 5;
  18904.             if(!supported && runs-- > 0)
  18905.             {
  18906.                 setTimeout(function(){
  18907.                     checkSupport(fontPathEOT, callback);
  18908.                 }, delay);
  18909.                 return;
  18910.             }
  18911.             body.removeChild(tempElm);
  18912.             // When font doesn't load, ratio will be less than or equal to 1. When loaded, it will
  18913.             // be 10. Check if it"s more than 5 to account for offsetWidth/offsetHeight wonkyness.
  18914.             if(callback) {
  18915.                 callback(supported);
  18916.             } else  {
  18917.                 doc.getElementsByTagName("html")[0].className += supported ? " fontfacerender" : " no-fontfacerender";
  18918.             }
  18919.         };
  18920.  
  18921.     // Check @font-face support by trying to render our test icon
  18922.     this.support = function(fontPathEOT, callback) {
  18923.         fontPathEOT = fontPathEOT || "./";
  18924.  
  18925.         tempElm.setAttribute("style", "font-family:pixelambacht !important;position:fixed;visibility:hidden");
  18926.         tempElm.innerHTML = "-";
  18927.         body.appendChild(tempElm);
  18928.  
  18929.         tempStyle.type = "text/css";
  18930.         doc.getElementsByTagName("head")[0].appendChild(tempStyle);
  18931.  
  18932.         if(ie <= 8)
  18933.         {
  18934.             // IE<8 doesn't support fonts via data-uri, so get external .eot file. To assure it's
  18935.             // present when the test is executed, download it to cache via a synchronous XHR call
  18936.             var request = new XMLHttpRequest();
  18937.             request.open("GET", fontPathEOT+"pixelambacht.eot", false);
  18938.             request.send(null);
  18939.             tempStyle.styleSheet.cssText = "@font-face{font-family:pixelambacht;src:url('"+fontPathEOT+"pixelambacht.eot');}";
  18940.         }
  18941.         else
  18942.         {
  18943.             // Load TTF via data-uri
  18944.             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=)}";
  18945.         }
  18946.  
  18947.         checkSupport(fontPathEOT, callback);
  18948.     };
  18949. };;
  18950.  
  18951.    
  18952.     (function (w) {
  18953.         w['Login'] = w['Login'] || {};
  18954.         w['Login'].loginUrl = "https://www.bundes-telefonbuch.de/user/loginPopup"
  18955.     }(window));
  18956.  
  18957.  
  18958.         var onloadCallback = function () {
  18959.         $('.g-recaptcha').each(function (index, el) {
  18960.             grecaptcha.render(el, {
  18961.                 'sitekey': '6Ld0RAoTAAAAAFji0CujiR0oPoPiDYZQvh21l715',
  18962.                 'theme': 'light'
  18963.             });
  18964.         });
  18965.     };
  18966.    
  18967.  
  18968.     // getScript workaround for IE
  18969.     jQuery.extend({
  18970.         getScript: function (url, callback) {
  18971.             var head = document.getElementsByTagName("head")[0];
  18972.             var script = document.createElement("script");
  18973.             var done = false; // Handle Script loading
  18974.  
  18975.             script.src = url;
  18976.             script.onload = script.onreadystatechange = function () { // Attach handlers for all browsers
  18977.                 if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
  18978.                     done = true;
  18979.                     if (callback) {
  18980.                         callback();
  18981.                     }
  18982.                     script.onload = script.onreadystatechange = null; // Handle memory leak in IE
  18983.                 }
  18984.             };
  18985.  
  18986.             head.appendChild(script);
  18987.             return undefined; // We handle everything using the script element injection
  18988.         }
  18989.     });
  18990.  
  18991.  
  18992.     if (window.location.hash && window.location.hash == '#_=_') {
  18993.         if (window.history && history.pushState) window.history.pushState("", document.title, window.location.pathname);
  18994.         else window.location.hash = '';
  18995.     }
  18996.  
  18997.    
  18998.     $(document).ready(function () {
  18999.         if (window.location.hash == '#imageUploadForm') {
  19000.             CompanyAjaxLoad.toggleFromNavigation('navigation_images', 'imageUploadForm', true, false);
  19001.         }
  19002.  
  19003.         if ($('#companyAdvert').height() > 200) {
  19004.             $('#map-canvas').height($('#companyAdvert').height());
  19005.         }
  19006.  
  19007.         var windowWidth = $(window).width();
  19008.         if (windowWidth <= 768) { //for iPad & smaller devices
  19009.             $('.panel-collapse').removeClass('in');
  19010.         }
  19011.  
  19012.         $('.fb-page').attr('data-width', $('.fb-page').parent().width());
  19013.  
  19014.         $('textarea').each(function () {
  19015.             autoresizeTextarea(this);
  19016.         });
  19017.     });
  19018.  
  19019.     $(function () {
  19020.         $('[data-toggle="tooltip"]').tooltip({html: true});
  19021.         $('textarea').keyup(function () {
  19022.             autoresizeTextarea(this);
  19023.         });
  19024.     });
  19025.  
  19026.     function loadDatePicker($noStartDate, $id) {
  19027.         if ($id != null) {
  19028.             $field = $id;
  19029.         } else {
  19030.             $field = '.form-control.date';
  19031.         }
  19032.         if ($noStartDate == false) {
  19033.             $($field).datepicker({
  19034.                 format: "dd.mm.yyyy",
  19035.                 weekStart: 1,
  19036.                 startDate: "23.10.2019",
  19037.                 clearBtn: true,
  19038.                 language: "de",
  19039.                 calendarWeeks: true,
  19040.                 autoclose: true
  19041.             });
  19042.         } else {
  19043.             $($field).datepicker({
  19044.                 format: "dd.mm.yyyy",
  19045.                 weekStart: 1,
  19046.                 startDate: "22.04.2019",
  19047.                 clearBtn: true,
  19048.                 language: "de",
  19049.                 calendarWeeks: true,
  19050.                 autoclose: true
  19051.             });
  19052.         }
  19053.     }
  19054.  
  19055.  
  19056.  
  19057.     (function (G, o, O, g, L, e) {
  19058.         G[g] = G[g] || function () {
  19059.                     (G[g]['q'] = G[g]['q'] || []).push(arguments)
  19060.                 }, G[g]['t'] = 1 * new Date;
  19061.         L = o.createElement(O), e = o.getElementsByTagName(O)[0];
  19062.         L.async = 1;
  19063.         L.src = '//www.google.com/adsense/search/async-ads.js';
  19064.         e.parentNode.insertBefore(L, e)
  19065.     })(window, document, 'script', '_googCsa');
  19066.  
  19067.  
  19068.    
  19069.         var googletag = googletag || {};
  19070.     googletag.cmd = googletag.cmd || [];
  19071.     (function () {
  19072.         var gads = document.createElement('script');
  19073.         gads.async = true;
  19074.         gads.type = 'text/javascript';
  19075.         var useSSL = 'https:' == document.location.protocol;
  19076.         gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
  19077.         var node = document.getElementsByTagName('script')[0];
  19078.         node.parentNode.insertBefore(gads, node);
  19079.     })();
  19080.  
  19081.     googletag.cmd.push(function () {
  19082.        
  19083.                 googletag.defineSlot('/2492971/BTB.de_sonstiges_Leaderboard_Top', [728, 90], 'gpt-ad-leader-top').addService(googletag.pubads());
  19084.                         googletag.defineSlot('/2492971/BTb.de_sonstige_Leaderboard', [728, 90], 'gpt-ad-leader').addService(googletag.pubads());
  19085.                 googletag.defineSlot('/2492971/BTb.de_sonstige_Medium_Rectangle', [300, 250], 'gpt-ad-rectangle1').addService(googletag.pubads());
  19086.         googletag.defineSlot('/2492971/BTb.de_sonstige_Wide_Skyscraper', [160, 600], 'gpt-ad-skyscraper').addService(googletag.pubads());
  19087.                 googletag.defineSlot('/2492971/BTb.de_Startseite_Medium_Rectangle_Bilder', [300, 250], 'gpt-ad-rectangle2').addService(googletag.pubads());
  19088.                 googletag.defineSlot('/2492971/BTb.de_Large_Mobile_Banner', [325, 120], 'gpt-ad-mobile-top').addService(googletag.pubads());
  19089.  
  19090.         googletag.enableServices();
  19091.     });
  19092.    
  19093.  
  19094.     function getLocation() {
  19095.         $('#myLocation').toggleClass("active");
  19096.         var output = document.getElementById("geoMsg");
  19097.         var nav = window.navigator, $btn = $('#searchButton'), t = $btn.html();
  19098.  
  19099.         function successCallback(position) {
  19100.             $btn.enableButton(t);
  19101.             $('#geoMsg').html("");
  19102.             $('#whereLat').val(position.coords.latitude);
  19103.             $('#whereLng').val(position.coords.longitude);
  19104.  
  19105.             $('#where').val("Mein Standort");
  19106.             $('#where').attr('readonly', 'readonly');
  19107.         }
  19108.  
  19109.         function errorCallback(error) {
  19110.             $btn.enableButton(t);
  19111.             var message = "";
  19112.             switch (error.code) {
  19113.                 case error.PERMISSION_DENIED:
  19114.                     message = "<i class='fa fa-times-circle-o'></i> <strong class='bold text-white'>Keine Berechtigung zur Ermittlung des Standorts.</span>";
  19115.                     break;
  19116.                 case error.POSITION_UNAVAILABLE:
  19117.                     message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Keine Positionsermittlung möglich.</span>";
  19118.                     break;
  19119.                 case error.PERMISSION_DENIED_TIMEOUT:
  19120.                     message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Fehler: Ermittlung des Standorts dauerte zu lange.</span>";
  19121.                     break;
  19122.             }
  19123.             output.innerHTML = message;
  19124.         }
  19125.  
  19126.         if (nav != null) {
  19127.             var geoloc = nav.geolocation;
  19128.             if (geoloc != null) {
  19129.                 output.innerHTML = "<i class='fa fa-question-circle-o'></i> <span class='bold text-white'>Koordinaten werden ermittelt.</span>";
  19130.                 if ($('#myLocation').hasClass('active')) {
  19131.                     $btn.disableButton(t);
  19132.                     geoloc.getCurrentPosition(successCallback, errorCallback);
  19133.                 } else {
  19134.                     $('#where').removeAttr('readonly');
  19135.                     $('#where').val('');
  19136.                     $('#whereLat').val('');
  19137.                     $('#whereLng').val('');
  19138.                     output.innerHTML = "";
  19139.                 }
  19140.             }
  19141.             else {
  19142.                 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>";
  19143.                 return;
  19144.             }
  19145.         }
  19146.         else {
  19147.             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>";
  19148.             return;
  19149.         }
  19150.     }
  19151.  
  19152.     function removeLocation() {
  19153.         $('#myLocation').toggleClass("active");
  19154.         var output = document.getElementById("geoMsg");
  19155.  
  19156.         $('#where').removeAttr('readonly');
  19157.         $('#where').val('');
  19158.         $('#whereLat').val('');
  19159.         $('#whereLng').val('');
  19160.         output.innerHTML = "";
  19161.     }
  19162.  
  19163.     function positionSlidercontroll(id) {
  19164.         var carouselFiftyPercent = (($('#' + id).height() - 20) - ($('#' + id + ' .btn').height() / 2)) / 2;
  19165.         $('#' + id + ' .btn').css('top', carouselFiftyPercent);
  19166.     }
  19167.  
  19168.  
  19169.                         googletag.cmd.push(function() {
  19170.                             googletag.display('gpt-ad-leader-top');
  19171.                         });
  19172.                    
  19173.  
  19174.                                     googletag.cmd.push(function () {
  19175.                                         googletag.display('gpt-ad-skyscraper');
  19176.                                     });
  19177.                                
  19178.  
  19179.             $(document).ready(function () {
  19180.                 var offset = $('.skyscraper').offset();
  19181.                 $('.skyscraper').affix({
  19182.                     offset: {
  19183.                         top: offset.top
  19184.                     }
  19185.                 });
  19186.             });
  19187.        
  19188.  
  19189.     jQuery(document).ready(function($) {
  19190.         $.get('/usermenu.do', {}, function(html) {
  19191.             $('#userMenuPlaceholder').replaceWith(html);
  19192.         });
  19193.     }(jQuery));
  19194.  
  19195.  
  19196.     if ($(window).width() <= 768) { //for iPad & smaller devices
  19197.         if ($('.search-box-what').val()) {
  19198.             $('.search-wrapper-what').addClass('input-group');
  19199.             $('.close-icon-what').show();
  19200.         }
  19201.  
  19202.         if ($('.search-box-where').val()) {
  19203.             $('.close-icon-where').show();
  19204.         }
  19205.     }
  19206.  
  19207.     /*  $('.search-box').keyup(function () {
  19208.      var t = $(this);
  19209.      $('.close-icon').toggle(Boolean(t.val()));
  19210.      if (Boolean(t.val())) {
  19211.      $('.search-wrapper').addClass('input-group');
  19212.      } else {
  19213.      $('.search-wrapper').removeClass('input-group');
  19214.      }
  19215.      });
  19216.  
  19217.      $('.close-icon').click(function () {
  19218.      $('.search-box').val('').focus();
  19219.      $('.search-wrapper').removeClass('input-group');
  19220.      $(this).hide();
  19221.      });
  19222.      */
  19223.  
  19224.  
  19225.                 googletag.cmd.push(function () {
  19226.                     googletag.display('gpt-ad-mobile-top');
  19227.                 });
  19228.            
  19229.  
  19230.         jQuery(document).ready(function () {
  19231.             $('#qwertzuiop').load('/office.do?u=&c=');
  19232.         });
  19233.    
  19234.  
  19235.                     jQuery(document).ready(function ($) {
  19236.                         outputFlashSession();
  19237.                     }(jQuery));
  19238.                
  19239.  
  19240.                 googletag.cmd.push(function () {
  19241.                     googletag.display('gpt-ad-rectangle1');
  19242.                 });
  19243.            
  19244.  
  19245.         $(document).ready(function () {
  19246.             var leaderWidth = $('.rectangleContainer1').parent().width();
  19247.             if (leaderWidth < 300) {
  19248.                 $('.rectangleContainer1').hide()
  19249.             } else {
  19250.                 $('.rectangleContainer1').show()
  19251.             }
  19252.         });
  19253.    
  19254.  
  19255.                     googletag.cmd.push(function () {
  19256.                         googletag.display('gpt-ad-leader');
  19257.                     });
  19258.                
  19259.  
  19260.             $(document).ready(function () {
  19261.                 var leaderWidth = $('.leaderContainer').parent().width();
  19262.                 if (leaderWidth < 728) {
  19263.                     $('.leaderContainer').hide()
  19264.                 } else {
  19265.                     $('.leaderContainer').show()
  19266.                 }
  19267.             });
  19268.        
  19269.  
  19270.         var gaProperty = 'UA-4947670-1';
  19271.         var disableStr = 'ga-disable-' + gaProperty;
  19272.  
  19273.         if (document.cookie.indexOf(disableStr + '=true') > -1) {
  19274.             window[disableStr] = true;
  19275.         }
  19276.  
  19277.         function gaOptout() {
  19278.             document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  19279.             window[disableStr] = true;
  19280.             alert('Google Analytics ausgeschaltet');
  19281.         }
  19282.  
  19283.         (function(i, s, o, g, r, a, m) {
  19284.             i['GoogleAnalyticsObject'] = r;
  19285.             i[r] = i[r] || function() {
  19286.                 (i[r].q = i[r].q || []).push(arguments)
  19287.             }, i[r].l = 1 * new Date();
  19288.             a = s.createElement(o),
  19289.                 m = s.getElementsByTagName(o)[0];
  19290.             a.async = 1;
  19291.             a.src = g;
  19292.             m.parentNode.insertBefore(a, m)
  19293.         })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  19294.  
  19295.         ga('create', gaProperty, 'auto');
  19296.         ga('set', 'anonymizeIp', true);
  19297.         ga('send', 'pageview');
  19298.  
  19299.        
  19300.         var gaTbUA = 'UA-61714288-4';
  19301.         var disableStrTbUA = 'ga-disable-' + gaTbUA;
  19302.  
  19303.         function gaTbOptout() {
  19304.             document.cookie = disableStrTbUA + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  19305.             window[disableStrTbUA] = true;
  19306.             alert('google analytics disabled - tb');
  19307.         }
  19308.  
  19309.        
  19310.         $(document).ready(function() {
  19311.             $('.gaOptoutLink').click(function() {
  19312.                 gaOptout();
  19313.             });
  19314.  
  19315.             $('.gaTbOptoutLink').click(function() {
  19316.                 gaTbOptout();
  19317.             });
  19318.         });
  19319.    
  19320. /*DO NOT HOST THIS SCRIPT ON YOUR OWN SERVER*/
  19321. var szmvars = "";
  19322. var iom = iom || (function () {
  19323.   var dummySite = "dummy",
  19324.       baseUrlDE = "de.ioam.de/tx.io",
  19325.       baseUrlLSO = "de.ioam.de/aid.io",
  19326.       optinUrl = "de.ioam.de/optin.php?re=",
  19327.       qdsUrl = "irqs.ioam.de",
  19328.       cntBaseUrl = ".iocnt.net/tx.io",
  19329.       cntBaseUrlLSO = ".iocnt.net/aid.io",
  19330.       cntOptinUrl = ".iocnt.net/optin.php?re=",
  19331.       cntQdsUrl = "irqs.iocnt.net",
  19332.       cntSubdomain = ["at", "imarex"],
  19333.       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"],
  19334.       LSOBlacklist = [],
  19335.       checkEvents = 1,
  19336.       tb = 0,
  19337.       sv = 1,
  19338.       lastEvent = "",
  19339.       emptyCode = "Leercode_nichtzuordnungsfaehig",
  19340.       autoEvents = {
  19341.         onfocus:"aforg",
  19342.         onblur:"abakg",
  19343.         onclose:"aclse"
  19344.       },
  19345.       nt = 2,
  19346.       cookiewhitelist = [],
  19347.       cookieName = "ioam2018",
  19348.       socioToken = "632015cbcfc384bd790454922497da97",
  19349.       frequency = 60000,
  19350.       hbiAdShort = 5000,
  19351.       hbiAdMedium = 10000,
  19352.       hbiAdLong = 30000,
  19353.       hbiShort = 10000,
  19354.       hbiMedium = 30000,
  19355.       hbiLong = 60000,
  19356.       hbiExtraLong = 300000,
  19357.       heart;
  19358.  
  19359.   var IAMPageElement = null,
  19360.       IAMQSElement = null,
  19361.       qdsParameter = {},
  19362.       qdsPopupBlockDuration = 86400000,
  19363.       result = {},
  19364.       mode,
  19365.       eventsEnabled = 0,
  19366.       surveyCalled = 0,
  19367.       inited = 0;
  19368.  
  19369.   var lsottl = 86400000,
  19370.       lsottlmin = 180000,
  19371.       ioplusurl = "me.ioam.de";
  19372.  
  19373.   function enableEvents() {
  19374.     if ((tb == 1 || result.tb == "on") && result.tb != "off" && !eventsEnabled) {
  19375.       eventsEnabled = 1;
  19376.       mode = 1;
  19377.       for(var e in autoEvents) {
  19378.         (function(e) {
  19379.           var oldEvent = window[e];
  19380.           window[e] = function() {
  19381.             if (lastEvent != autoEvents[e]) {
  19382.               lastEvent = autoEvents[e];
  19383.               event(autoEvents[e]);
  19384.             }
  19385.             if (typeof oldEvent == "function") oldEvent();
  19386.           };
  19387.         })(e);
  19388.       }
  19389.     }
  19390.   }
  19391.  
  19392.   function isDoNotTrack() {
  19393.     if ((nt & 2) ? ((typeof result.nt == "undefined") ? (nt & 1) : result.nt) : nt & 1) {
  19394.       if (window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") return true;
  19395.       if (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1")) return true;
  19396.     }
  19397.     return false;
  19398.   }
  19399.  
  19400.   var getInvitation = function (response) {
  19401.     if (response && response.hasOwnProperty("block-status")){
  19402.       var isEligibleForInvitation = ( "NONE" === response['block-status'].toUpperCase() );
  19403.       if (isEligibleForInvitation) {
  19404.         if (IAMQSElement) {
  19405.           IAMQSElement.parentNode.removeChild(IAMQSElement);
  19406.         }
  19407.         IAMQSElement = createScriptTag(response['invite-url']);
  19408.       }
  19409.     }
  19410.   };
  19411.  
  19412.   function loadSurvey() {
  19413.     szmvars = result.st + "//" + result.pt + "//" + result.cp + "//VIA_SZMNG";
  19414.     var sampleType = (result.sv == "i2") ? "in" : result.sv;
  19415.     var qdsHost = qdsUrl;
  19416.     if (result.cn) {
  19417.       sampleType += "_"+result.cn;
  19418.       if (result.cn == "at") {
  19419.         qdsHost = cntQdsUrl;
  19420.       }
  19421.     }
  19422.  
  19423.     qdsParameter = {
  19424.       siteIdentifier: result.cp,
  19425.       offerIdentifier: result.st,
  19426.       sampleType: sampleType,
  19427.       pixelType: result.pt,
  19428.       contentType: result.cp,
  19429.       host: qdsHost,
  19430.       port: "",
  19431.       isFadeoutFlash: true,
  19432.       isFadeoutFrame: true,
  19433.       isFadeoutForm: true,
  19434.       positionTop: 10,
  19435.       positionLeft: 100,
  19436.       zIndex: 1100000,
  19437.       popupBlockDuration: qdsPopupBlockDuration,
  19438.       keysForQueryParam : [
  19439.           "offerIdentifier",
  19440.           "siteIdentifier",
  19441.           "sampleType",
  19442.           "pixelType",
  19443.           "isFadeoutFlash",
  19444.           "isFadeoutFrame",
  19445.           "isFadeoutForm",
  19446.           "positionTop",
  19447.           "positionLeft",
  19448.           "zIndex"]
  19449.     };
  19450.  
  19451.     if(typeof window.iam_zindex !== 'undefined') {
  19452.       qdsParameter.zIndex = window.iam_zindex;
  19453.     }
  19454.  
  19455.     if(typeof window.iam_fadeout_flash !== 'undefined') {
  19456.       qdsParameter.isFadeoutFlash = window.iam_fadeout_flash;
  19457.     }
  19458.  
  19459.     if(typeof window.iam_fadeout_iframe !== 'undefined') {
  19460.       qdsParameter.isFadeoutFrame = window.iam_fadeout_iframe;
  19461.     }
  19462.  
  19463.     if(typeof window.iam_fadeout_form !== 'undefined') {
  19464.       qdsParameter.isFadeoutForm = window.iam_fadeout_form;
  19465.     }
  19466.  
  19467.     if(typeof window.iam_position_top !== 'undefined') {
  19468.       qdsParameter.positionTop = window.iam_position_top;
  19469.     }
  19470.  
  19471.     if(typeof window.iam_position_left !== 'undefined') {
  19472.       qdsParameter.positionLeft = window.iam_position_left;
  19473.     }
  19474.  
  19475.     var filterObjectByKeys = function (obj, keysToFilter) {
  19476.         var result = {}, key;
  19477.         var arrayLength = keysToFilter.length;
  19478.         for (var i = 0; i < arrayLength; i++) {
  19479.             key = keysToFilter[i];
  19480.             if (obj.hasOwnProperty(key)) {
  19481.                 result[key] = obj[key];
  19482.             }
  19483.         }
  19484.         return result;
  19485.     };
  19486.  
  19487.     var serializeToQueryString = function (obj) {
  19488.       var str = [];
  19489.       for (var key in obj)
  19490.         if (obj.hasOwnProperty(key)) {
  19491.         str.push(encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]));
  19492.       }
  19493.       return str.join("&");
  19494.     };
  19495.  
  19496.     var createPopupcheckCookie = function (blockDuration) {
  19497.       var blockedUntilDate = new Date();
  19498.       blockedUntilDate.setTime(blockedUntilDate.getTime() + blockDuration);
  19499.       var expires = "expires=" + blockedUntilDate.toUTCString();
  19500.       document.cookie = "POPUPCHECK=" + blockedUntilDate.getTime().toString() + ";" + expires + ";path=/";
  19501.     };
  19502.  
  19503.     var hasPopupcheckCookie = function () {
  19504.       var cookie = document.cookie.split(";");
  19505.       for (var i = 0; i < cookie.length; i++) {
  19506.         if (cookie[i].match("POPUPCHECK=.*")) {
  19507.           var currentDate = new Date();
  19508.           var now = currentDate.getTime();
  19509.           currentDate.setTime(cookie[i].split("=")[1]);
  19510.           var blockedUntilTime = currentDate.getTime();
  19511.           if (now <= blockedUntilTime) {
  19512.             return true;
  19513.           }
  19514.         }
  19515.       }
  19516.       return false;
  19517.     };
  19518.  
  19519.     if (hasPopupcheckCookie()) {
  19520.       return;
  19521.     }
  19522.  
  19523.     if (sv && !surveyCalled && result.sv !== "ke" && result.sv === "dz") {
  19524.       surveyCalled = 1;
  19525.       iam_ng_nxss();
  19526.     }
  19527.  
  19528.     if (sv && !surveyCalled && result.sv !== "ke" && (result.sv === "in" || result.sv === "mo" || result.sv === "i2" )) {
  19529.       surveyCalled = 1;
  19530.       createPopupcheckCookie(qdsParameter.popupBlockDuration);
  19531.       var protocol = window.location.protocol;
  19532.       var pathOfCheckInvitation = "identitystatus";
  19533.       var queryParameter = filterObjectByKeys(qdsParameter, qdsParameter.keysForQueryParam);
  19534.       var queryParameterString = "?" + serializeToQueryString(queryParameter);
  19535.       if (window.XDomainRequest && document.documentMode === 9) {
  19536.         var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + '/identity.js' + queryParameterString+'&callback=iom.gi&c='+Math.random();
  19537.         createScriptTag(checkForInvitationUrl);
  19538.       } else {
  19539.         var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + queryParameterString+'&c='+Math.random();
  19540.         var httpRequest = new XMLHttpRequest();
  19541.         httpRequest.onreadystatechange = function () {
  19542.           if (httpRequest.readyState === XMLHttpRequest.DONE && 200 === httpRequest.status) {
  19543.             var response = JSON.parse(httpRequest.responseText);
  19544.             getInvitation(response);
  19545.           }
  19546.         };
  19547.         httpRequest.open('GET', checkForInvitationUrl, true);
  19548.         httpRequest.withCredentials = true;
  19549.         httpRequest.send(null);
  19550.       }
  19551.  
  19552.     }
  19553.   }
  19554.  
  19555.   function hash(key) {
  19556.     var hash = 0;
  19557.     for (var i=0; i<key.length; ++i) {
  19558.       hash += key.charCodeAt(i);
  19559.       hash += (hash << 10);
  19560.       hash ^= (hash >> 6);
  19561.     }
  19562.     hash += (hash << 3);
  19563.     hash ^= (hash >> 11);
  19564.     hash += (hash << 15);
  19565.     hash = Math.abs(hash & hash);
  19566.     return hash.toString(36);
  19567.   }
  19568.  
  19569.   function activeXDetect() {
  19570.     var result = "",
  19571.         componentVersion,
  19572.         components =[
  19573.                      "7790769C-0471-11D2-AF11-00C04FA35D02", "89820200-ECBD-11CF-8B85-00AA005B4340",
  19574.                      "283807B5-2C60-11D0-A31D-00AA00B92C03", "4F216970-C90C-11D1-B5C7-0000F8051515",
  19575.                      "44BBA848-CC51-11CF-AAFA-00AA00B6015C", "9381D8F2-0288-11D0-9501-00AA00B911A5",
  19576.                      "4F216970-C90C-11D1-B5C7-0000F8051515", "5A8D6EE0-3E18-11D0-821E-444553540000",
  19577.                      "89820200-ECBD-11CF-8B85-00AA005B4383", "08B0E5C0-4FCB-11CF-AAA5-00401C608555",
  19578.                      "45EA75A0-A269-11D1-B5BF-0000F8051515", "DE5AED00-A4BF-11D1-9948-00C04F98BBC9",
  19579.                      "22D6F312-B0F6-11D0-94AB-0080C74C7E95", "44BBA842-CC51-11CF-AAFA-00AA00B6015B",
  19580.                      "3AF36230-A269-11D1-B5BF-0000F8051515", "44BBA840-CC51-11CF-AAFA-00AA00B6015C",
  19581.                      "CC2A9BA0-3BDD-11D0-821E-444553540000", "08B0E5C0-4FCB-11CF-AAA5-00401C608500",
  19582.                      "D27CDB6E-AE6D-11CF-96B8-444553540000", "2A202491-F00D-11CF-87CC-0020AFEECF20"
  19583.                     ];
  19584.     document.body.addBehavior( "#default#clientCaps" );
  19585.     for (var i = 0; i < components.length; i++) {
  19586.       componentVersion = document.body.getComponentVersion('{' + components[i] + '}', 'ComponentID');
  19587.       if ( componentVersion !== null ) {
  19588.         result += componentVersion;
  19589.       } else {
  19590.         result += "null";
  19591.       }
  19592.     }
  19593.     return result;
  19594.   }
  19595.  
  19596.   function fingerprint() {
  19597.     var nav = window.navigator, t = nav.userAgent;
  19598.     t += getScreen();
  19599.     if (nav.plugins.length > 0 ) {
  19600.       for (var i = 0; i < nav.plugins.length; i++ ) {
  19601.         t += nav.plugins[i].filename + nav.plugins[i].version + nav.plugins[i].description;
  19602.       }
  19603.     }
  19604.     if (nav.mimeTypes.length > 0 ) {
  19605.       for (var i = 0; i < nav.mimeTypes.length; i++ ) {
  19606.         t += nav.mimeTypes[i].type;
  19607.       }
  19608.     }
  19609.     if ( /MSIE (\d+\.\d+);/.test(nav.userAgent) ) {
  19610.       try {
  19611.         t += activeXDetect();
  19612.       }
  19613.       catch(e) {
  19614.         // ignore
  19615.       }
  19616.     }
  19617.     return hash(t);
  19618.   }
  19619.  
  19620.   function createScriptTag(url){
  19621.     var el = document.createElement("script");
  19622.     el.type = "text/javascript";
  19623.     el.src = url;
  19624.     var head = document.getElementsByTagName("head")[0];
  19625.     if(head) {
  19626.       head.appendChild(el);
  19627.       return el;
  19628.     }
  19629.     else return false;
  19630.   }
  19631.  
  19632.   function createScriptTagAsync(url, cb){
  19633.     var el = document.createElement("script");
  19634.     el.type = "text/javascript";
  19635.     el.src = url;
  19636.     el.onload = cb;
  19637.     el.async = true;
  19638.     var head = document.getElementsByTagName("head")[0];
  19639.     if(head) {
  19640.       head.appendChild(el);
  19641.       return el;
  19642.     }
  19643.     else return false;
  19644.   }
  19645.  
  19646.   function transmitData(url, mode) {
  19647.     if (url.split("/")[2].slice(url.split("/")[2].length-8) == ".ioam.de" || url.split("/")[2].slice(url.split("/")[2].length-10) == ".iocnt.net") {
  19648.       switch (mode) {
  19649.         case 1:
  19650.           if (IAMPageElement) {
  19651.             IAMPageElement.parentNode.removeChild(IAMPageElement);
  19652.           }
  19653.           IAMPageElement = createScriptTag(url+'&mo=1');
  19654.           if (!IAMPageElement) (new Image()).src = url+'&mo=0';
  19655.           break;
  19656.         case 2:
  19657.           (new Image()).src = url+'&mo=0';
  19658.           break;
  19659.         case 3:
  19660.           var IAMsendBox = document.getElementById('iamsendbox'), sendBoxStyle;
  19661.           if (IAMsendBox) {
  19662.             document.body.removeChild(IAMsendBox);
  19663.           }
  19664.           IAMsendBox = document.createElement("iframe");
  19665.           IAMsendBox.id = "iamsendbox";
  19666.           sendBoxStyle = IAMsendBox.style;
  19667.           sendBoxStyle.position = "absolute";
  19668.           sendBoxStyle.left = sendBoxStyle.top = "-999px";
  19669.           IAMsendBox.src = url + "&mo=1";
  19670.           document.body.appendChild(IAMsendBox);
  19671.           break;
  19672.         case 0:
  19673.         default:
  19674.           document.write('<script src="'+url+'&mo=1"></script>');
  19675.       }
  19676.     }
  19677.   }
  19678.  
  19679.   function getScreen() {
  19680.     return screen.width + "x" + screen.height + "x" + screen.colorDepth;
  19681.   }
  19682.  
  19683.   function arrayContains(arr, obj) {
  19684.     var i;
  19685.     for (i=0;i<arr.length;i++) {
  19686.       if (arr[i]==obj) return true;
  19687.     }
  19688.     return false;
  19689.   }
  19690.  
  19691.   function transformVar(value) {
  19692.     if (!value) value = "";
  19693.     value = value.replace(/[?#].*/g, "");
  19694.     value = value.replace(/[^a-zA-Z0-9,_\/-]+/g, ".");
  19695.     if (value.length > 255) value = value.substr(0,254) + '+';
  19696.     return value;
  19697.   }
  19698.  
  19699.   function getRefHost() {
  19700.     var url = document.referrer.split("/");
  19701.     return (url.length >= 3) ? url[2] : "";
  19702.   }
  19703.  
  19704.   function buildResult(params) {
  19705.     result = {};
  19706.     var i;
  19707.     for (i in params) {
  19708.       if (params.hasOwnProperty(i)) {
  19709.         if (i != "cn" || (i == "cn" && arrayContains(cntSubdomain, params[i]))) {
  19710.           result[i] = params[i];
  19711.         }
  19712.       }
  19713.     }
  19714.     if (result.hasOwnProperty("fp")) {
  19715.       result.fp = (result.fp != "" && typeof result.fp != "undefined") ? result.fp : emptyCode;
  19716.       result.fp = transformVar(result.fp);
  19717.       result.pt = "FP";
  19718.     }
  19719.     if (result.hasOwnProperty("np")) {
  19720.       result.np = (result.np != "" && typeof result.np != "undefined") ? result.np : emptyCode;
  19721.       result.np = transformVar(result.np);
  19722.       result.pt = "NP";
  19723.     }
  19724.     if (result.hasOwnProperty("xp")) {
  19725.       result.xp = (result.xp != "" && typeof result.xp != "undefined") ? result.xp : emptyCode;
  19726.       result.xp = transformVar(result.xp);
  19727.       result.pt = "XP";
  19728.     }
  19729.     if (result.hasOwnProperty("cp")) {
  19730.       result.cp = (result.cp != "" && typeof result.cp != "undefined") ? result.cp : emptyCode;
  19731.       result.cp = transformVar(result.cp);
  19732.       result.pt = "CP";
  19733.     }
  19734.     if (!result.pt) {
  19735.       result.cp = emptyCode;
  19736.       result.pt = "CP";
  19737.       result.er = "N13";
  19738.     }
  19739.     if (!result.hasOwnProperty("ps")) {
  19740.       result.ps = "lin";
  19741.       result.er = "N22";
  19742.     } else {
  19743.       if (!(arrayContains(['ack', 'lin', 'pio', 'out'], result.ps))) {
  19744.         result.ps = "lin";
  19745.         result.er = "N23";
  19746.       }
  19747.     }
  19748.     result.rf = getRefHost();
  19749.     if (!result.hasOwnProperty("sur") || (result.hasOwnProperty("sur") && result.sur != "yes")) {
  19750.       result.r2 = document.referrer;
  19751.     }
  19752.     result.ur = document.location.host;
  19753.     result.xy = getScreen();
  19754.     result.lo = "US/Oregon";
  19755.     result.cb = "000d";
  19756.     result.i2 = "000dc8b3f4e3020ae5cbcfc38";
  19757.     result.ep = 1579667364;
  19758.     result.vr = "412";
  19759.     result.id = fingerprint();
  19760.     result.st = result.st ? result.st : dummySite;
  19761.     if (!result.hasOwnProperty("sc") || (result.hasOwnProperty("sc") && result.sc != "no")) {
  19762.       var cookie = getFirstPartyCookie();
  19763.       result.i3 = cookie.cookie;
  19764.       result.n1 = cookie.length;
  19765.     }
  19766.     if (((arrayContains(cookiewhitelist, result.st)) || (result.hasOwnProperty("sc") && result.sc == "yes")) && result.i3 == "nocookie") {
  19767.       result.i3 = setFirstPartyCookie();
  19768.     }
  19769.  
  19770.     if (!result.hasOwnProperty("cn") && result.st.charAt(2) == "_") {
  19771.       var cn = result.st.substr(0,2);
  19772.       if (arrayContains(cntSubdomain, cn)) {
  19773.         result.cn = cn;
  19774.       } else {
  19775.         result.er = "E12";
  19776.       }
  19777.     }
  19778.  
  19779.     // DNT dissemination survey
  19780.     try {
  19781.       result.dntt = ((window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") || (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1"))) ? "1" : "0";
  19782.     } catch(e) {
  19783.       // ignore
  19784.     }
  19785.   }
  19786.  
  19787.   function event(event) {
  19788.     var payLoad = "";
  19789.     var i;
  19790.     event = event || "";
  19791.     stopHeart();
  19792.     if (inited && !isDoNotTrack() && (!checkEvents || (checkEvents && arrayContains(eventList, event))) && result.ps !== "out") {
  19793.       result.lt = (new Date()).getTime();
  19794.       result.ev = event;
  19795.       var proto = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:";
  19796.       var baseUrl = baseUrlDE;
  19797.       if (result.cn) {
  19798.         baseUrl = result.cn + cntBaseUrl;
  19799.       }
  19800.       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))) ) {
  19801.         if (result.cn) {
  19802.           baseUrl = result.cn + cntBaseUrlLSO;
  19803.         } else {
  19804.           baseUrl = baseUrlLSO;
  19805.         }
  19806.         mode = 3;
  19807.         if (result.hasOwnProperty("sur") && result.sur == "yes") {
  19808.           result.u2 = window.location.origin;
  19809.         } else {
  19810.           result.u2 = document.URL;
  19811.         }
  19812.       }
  19813.       for (i in result) {
  19814.         if (result.hasOwnProperty(i) && i!="cs" && i!="url") {
  19815.           payLoad = payLoad + encodeURIComponent(i).slice(0,8) + "=" + encodeURIComponent(result[i]).slice(0,2048) + "&";
  19816.         }
  19817.       }
  19818.       payLoad = payLoad.slice(0,4096);
  19819.       result.cs = hash(payLoad);
  19820.       result.url = proto + "//" + baseUrl + "?" + payLoad + "cs=" + result.cs;
  19821.       transmitData(result.url, mode);
  19822.       if (arrayContains(['play', 'resm', 'alve', 'mute', 'sfqt', 'ssqt', 'stqt', 'sapl', 'snsp'], event) && mode === 1 && result.hasOwnProperty('hb')) {
  19823.         startHeart();
  19824.       }
  19825.       return result;
  19826.     }
  19827.     return {};
  19828.   }
  19829.  
  19830.   function forwardToOldSZM() {
  19831.     if (result.oer === "yes" && !window.IVW && !document.IVW) {
  19832.       var SZMProtocol = (window.location.protocol.slice(0,4) === 'http') ? window.location.protocol : "https:";
  19833.       var SZMComment = (result.co) ? result.co + "_SENT_VIA_MIGRATION_TAG" : "SENT_VIA_MIGRATION_TAG";
  19834.       var SZMCode = (result.oc) ? result.oc : ((result.cp) ? ((result.cp == emptyCode) ? "" : result.cp) : "");
  19835.       var SZMContType = (result.pt !== null) ? result.pt : "CP";
  19836.       (new Image()).src = SZMProtocol + "//" + result.st + ".ivwbox.de/cgi-bin/ivw/" + SZMContType.toUpperCase() + "/" + SZMCode + ";" + SZMComment + "?r=" + escape(document.referrer) + "&d=" + (Math.random()*100000);
  19837.     }
  19838.   }
  19839.  
  19840.   function count(params, m) {
  19841.     init(params,m);
  19842.     return event(result.ev);
  19843.   }
  19844.  
  19845.   function init(params,m) {
  19846.     mode = m;
  19847.     buildResult(params);
  19848.     if (result.sv) {
  19849.       result.sv = (result.sv == "in" && mode == 1) ? "i2" : result.sv;
  19850.     }
  19851.     enableEvents();
  19852.     loadSurvey();
  19853.     inited = 1;
  19854.     forwardToOldSZM();
  19855.     return {};
  19856.   }
  19857.  
  19858.   function hybrid(params,m) {
  19859.     init(params,m);
  19860.     var ioam_smi = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_smi") : null;
  19861.     var ioam_site = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_site") : null;
  19862.     var ioam_bo = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_bo") : null;
  19863.     if ( ioam_smi !== null && ioam_site !== null && ioam_bo !== null ) {
  19864.       result.mi = ioam_smi;
  19865.       result.fs = result.st;
  19866.       result.st = ioam_site;
  19867.       result.bo = ioam_bo;
  19868.       if (result.fs == result.st) {
  19869.         result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
  19870.       } else {
  19871.         result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
  19872.       }
  19873.       return event(result.ev);
  19874.     } else if ( ioam_smi !== null && ioam_bo !== null ) {
  19875.       return {};
  19876.     } else {
  19877.       if ( window.location.protocol.slice(0,4) !== 'http' || /IOAM\/\d+\.\d+/.test(window.navigator.userAgent) ) {
  19878.         return {};
  19879.       } else {
  19880.         return event(result.ev);
  19881.       }
  19882.     }
  19883.   }
  19884.  
  19885.   function setMultiIdentifier(midentifier) {
  19886.     if ( localStorage.getItem("ioam_smi") === null || localStorage.getItem("ioam_site") === null || localStorage.getItem("ioam_bo") === null || localStorage.getItem("ioam_smi") !== midentifier ) {
  19887.       result.fs = result.st;
  19888.       var JsonMIndetifier = null;
  19889.       var NewSite = null;
  19890.       if ( typeof midentifier === 'string' && typeof JSON === 'object' && typeof JSON.parse === 'function' ) {
  19891.         try {
  19892.           JsonMIndetifier = JSON.parse(midentifier);
  19893.           if (JsonMIndetifier.hasOwnProperty( 'library' )) {
  19894.             if (JsonMIndetifier.library.hasOwnProperty( 'offerIdentifier' )) {
  19895.               if ( JsonMIndetifier.library.offerIdentifier ) {
  19896.                 NewSite = JsonMIndetifier.library.offerIdentifier;
  19897.               } else {
  19898.                 result.er = "JSON(E10): offerIdentifier not valid";
  19899.               }
  19900.             } else {
  19901.               result.er = "JSON(E10): no key offerIdentifier";
  19902.             }
  19903.           } else {
  19904.             result.er = "JSON(E10): no key library";
  19905.           }
  19906.         } catch(err) {
  19907.           result.er = "JSON(E10): "+err;
  19908.         }
  19909.       }
  19910.       if ( NewSite !== null ) {
  19911.         localStorage.setItem("ioam_site", NewSite);
  19912.       }
  19913.       result.st = NewSite;
  19914.       result.mi = midentifier;
  19915.       result.bo = (new Date()).getTime();
  19916.       localStorage.setItem("ioam_smi", result.mi);
  19917.       localStorage.setItem("ioam_bo", result.bo);
  19918.       if (result.fs == result.st) {
  19919.         result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
  19920.       } else {
  19921.         result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
  19922.       }
  19923.       return event(result.ev);
  19924.     }
  19925.     return {};
  19926.   }
  19927.  
  19928.   if (window.postMessage || window.JSON && {}.toString.call(window.JSON.parse) !== '[object Function]' && {}.toString.call(window.JSON.stringify) !== '[object Function]') {
  19929.     var listener = function(msg) {
  19930.       try {
  19931.         var msgdata = JSON.parse(msg.data);
  19932.       } catch(e) {
  19933.         msgdata = { type:false };
  19934.       }
  19935.       if ({}.toString.call(msgdata) === '[object Object]' && msgdata.type == "iam_data") {
  19936.         var respObj = {
  19937.                        seq : msgdata.seq,
  19938.                        iam_data : {
  19939.                                    st: result.st,
  19940.                                    cp: result.cp
  19941.                                   }
  19942.                       };
  19943.         msg.source.postMessage(JSON.stringify(respObj),msg.origin);
  19944.       }
  19945.     };
  19946.     if (window.addEventListener) {
  19947.       window.addEventListener("message", listener);
  19948.     } else {
  19949.       window.attachEvent("onmessage", listener);
  19950.     }
  19951.   }
  19952.  
  19953.   function optin() {
  19954.     var oiurl = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:" + "//" + optinUrl;
  19955.     var win = window.open(oiurl, '_blank');
  19956.     win.focus();
  19957.   }
  19958.  
  19959.   function startHeart() {
  19960.     // IE 9 Compatible
  19961.     function heartbeat() {
  19962.       return event("alve");
  19963.     }
  19964.     switch (result.hb) {
  19965.         case "adshort":
  19966.           frequency = hbiAdShort;
  19967.           break;
  19968.         case "admedium":
  19969.           frequency = hbiAdMedium;
  19970.           break;
  19971.        case "adlong":
  19972.           frequency = hbiAdLong;
  19973.           break;
  19974.         case "short":
  19975.           frequency = hbiShort;
  19976.           break;
  19977.         case "medium":
  19978.           frequency = hbiMedium;
  19979.           break;
  19980.         case "long":
  19981.           frequency = hbiLong;
  19982.           break;
  19983.         case "extralong":
  19984.           frequency = hbiExtraLong;
  19985.           break;
  19986.         default:
  19987.           frequency = 0;
  19988.     }
  19989.     if (frequency != 0) {
  19990.       try {
  19991.         heart = setInterval(heartbeat, frequency);
  19992.       } catch(e) {
  19993.         // pass
  19994.       }
  19995.     }
  19996.   }
  19997.  
  19998.   function stopHeart() {
  19999.     try {
  20000.       clearInterval(heart);
  20001.     } catch(e) {
  20002.       // pass
  20003.     }
  20004.   }
  20005.  
  20006.   function stringtohex(str) {
  20007.     var res = [];
  20008.     for (var n = 0, l = str.length; n < l; n ++) {
  20009.       var hex = Number(str.charCodeAt(n)).toString(16);
  20010.       res.push(hex);
  20011.     }
  20012.     return res.join('');
  20013.   }
  20014.  
  20015.   function getUniqueID() {
  20016.     var max = 999999999999;
  20017.     var min = 100000000000;
  20018.     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);
  20019.   }
  20020.  
  20021.   function expireDays() {
  20022.     var max = 365;
  20023.     var min = 300;
  20024.     return Math.floor(Math.random() * (max - min + 1)) + min;
  20025.   }
  20026.  
  20027.   function getFirstPartyCookie() {
  20028.     var cookie = document.cookie.split(";");
  20029.     for (var i = 0; i < cookie.length; i++) {
  20030.       if (cookie[i].match(cookieName + "=.*")) {
  20031.         var ourcookie = cookie[i].split("=")[1];
  20032.         if (hash(ourcookie.split("!")[0]) == ourcookie.split("!")[1]) {
  20033.           if (!result.hasOwnProperty("i3") || !result.i3) {
  20034.             updateFirstPartyCookie(ourcookie);
  20035.           }
  20036.           return {
  20037.             cookie: ourcookie,
  20038.             length: cookie.length
  20039.           };
  20040.         } else {
  20041.           // checksum failed, cookie not trusted, delete cookie
  20042.           result.er = "N19";
  20043.           try {
  20044.             setFirstPartyCookie(2000);
  20045.           } catch(e) {
  20046.             result.er = "N20";
  20047.           }
  20048.         }
  20049.       }
  20050.     }
  20051.     return {cookie: "nocookie", length: cookie.length};
  20052.   }
  20053.  
  20054.   function checkFirstPartyCookie() {
  20055.     var cookie = getFirstPartyCookie();
  20056.     if (cookie.cookie != "nocookie") {
  20057.       return true;
  20058.     } else {
  20059.       return false;
  20060.     }
  20061.   }
  20062.  
  20063.   function getFpcd(cd) {
  20064.     var ctld ='acadaeafagaialamaoaqarasatauawaxazbabbbdbebfbgbhbibjbmbnbobrbsbtbwbybzcacccdcfcgchcickclcmcncocrcucvcwcxcyczdjdkdmdodzeceeegereseteufifjfkfmfofrgagdgegfggghgiglgmgngpgqgrgsgtgugwgyhkhmhnhrhthuidieiliminioiqirisitjejmjojpkekgkhkikmknkpkrkwkykzlalblclilklrlsltlulvlymamcmdmemgmhmkmlmmmnmompmqmrmsmtmumvmwmxmymznancnenfngninlnonpnrnunzompapepfpgphpkplpmpnprpsptpwpyqarerorsrurwsasbscsdsesgshsiskslsmsnsosrssstsvsxsysztctdtftgthtjtktltmtntotrtttvtwtzuaugukusuyuzvavcvevgvivnvuwfwsyeytzazmzw'.match(/.{1,2}(?=(.{2})+(?!.))|.{1,2}$/g),
  20065.         blkPrefixes = ['www', 'm', 'mobile'],
  20066.         urlParts = cd.split('.'),
  20067.         fpcd,
  20068.         ctldParts = [],
  20069.         hostParts = [],
  20070.         ctldPart = '',
  20071.         hostPart = '',
  20072.         i = 0,
  20073.         iLen = 0;
  20074.     if (!cd) return '';
  20075.     if (arrayContains(ctld, urlParts[urlParts.length -1])) {
  20076.       for (i = urlParts.length -1; i >= 0; i -= 1) {
  20077.         if ( i >= urlParts.length - 3 && urlParts[i].length <= 4) {
  20078.           ctldParts.push(urlParts[i]);
  20079.         } else {
  20080.           hostParts.push(urlParts[i]);
  20081.           break;
  20082.         }
  20083.       }
  20084.       ctldParts = ctldParts.reverse();
  20085.       for (i = 0, iLen = ctldParts.length;i < iLen; i += 1) {
  20086.         if (!arrayContains(blkPrefixes, ctldParts[i])) {
  20087.           ctldPart += i < iLen ? '.' + ctldParts[i] :  ctldParts[i];
  20088.         }
  20089.       }
  20090.       hostParts = hostParts.reverse();
  20091.       hostPart = hostParts[hostParts.length - 1] || '';
  20092.       if (arrayContains(blkPrefixes, hostPart)) {
  20093.         hostPart = '';
  20094.       }
  20095.     } else {
  20096.       hostPart = urlParts
  20097.         .slice(urlParts.length - 2, urlParts.length)
  20098.         .join('.') || '';
  20099.     }
  20100.     fpcd = hostPart + ctldPart;
  20101.     if (fpcd && fpcd.length > 4 && fpcd.split('.').length > 1) {
  20102.       // RFC 2109
  20103.       return 'domain=' + (fpcd[0] === '.' ? fpcd : (fpcd ? '.' + fpcd : '')) + ';';
  20104.     }
  20105.     return '';
  20106.   }
  20107.  
  20108.   function updateFirstPartyCookie(cookievalue) {
  20109.     var domain = getFpcd(location.hostname);
  20110.     var expireValue = cookievalue.split(":")[1];
  20111.     var events = parseInt(cookievalue.split(":")[4]) + 1;
  20112.     var expireDate = new Date(new Date().setTime(expireValue));
  20113.     var now = new Date();
  20114.     var cookval = cookievalue.split(":").slice(0,4).join(":") + ":" + events + ":" + now.getTime().toString();
  20115.     cookval = cookval + "!" + hash(cookval);
  20116.     document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
  20117.   }
  20118.  
  20119.   function setFirstPartyCookie(expire) {
  20120.     if (!expire) {
  20121.       expire = expireDays()*24*60*60*1000;
  20122.     }
  20123.     var domain = getFpcd(location.hostname);
  20124.     var expireDate = new Date(new Date().setTime(new Date().getTime()+expire));
  20125.     var setDate = new Date();
  20126.     var identifier;
  20127.     if (result.hasOwnProperty("i2")) {
  20128.       identifier = result.i2;
  20129.     } else {
  20130.       identifier = getUniqueID();
  20131.     }
  20132.     var cookval = identifier + ":" + expireDate.getTime().toString() + ":" + setDate.getTime().toString() + ":" + domain.replace("domain=", "").replace(";", "") + ":1:" +  setDate.getTime().toString();
  20133.     cookval = cookval + "!" + hash(cookval);
  20134.     document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
  20135.     if (!checkFirstPartyCookie()) {
  20136.       // cookie not found, try it without domain
  20137.       document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";path=/;";
  20138.       result.er = "N25";
  20139.       if (!checkFirstPartyCookie()) {
  20140.         result.er = "N26";
  20141.         return "nocookie";
  20142.       }
  20143.     }
  20144.     return cookval;
  20145.   }
  20146.  
  20147.   function createCORSRequest(method, url) {
  20148.     var xdhreq = new XMLHttpRequest();
  20149.     if ("withCredentials" in xdhreq) {
  20150.       xdhreq.open(method, url, true);
  20151.       xdhreq.withCredentials = true;
  20152.     } else if (typeof XDomainRequest != "undefined") {
  20153.       xdhreq = new XDomainRequest();
  20154.       xdhreq.open(method, url);
  20155.     } else {
  20156.       xdhreq = null;
  20157.     }
  20158.     return xdhreq;
  20159.   }
  20160.  
  20161.   function getPlus() {
  20162.     if (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') {
  20163.       if (localStorage.getItem("ioamplusdata") !== null && localStorage.getItem("ioamplusttl") !== null) {
  20164.         var currentDate = new Date();
  20165.         var now = currentDate.getTime();
  20166.         currentDate.setTime(localStorage.getItem("ioamplusttl"));
  20167.         if (now <= currentDate.getTime()) {
  20168.           return true;
  20169.         }
  20170.       }
  20171.       var checkForSocio = 'https:' + '//' + ioplusurl + '/soziodata2.php?sc=' + socioToken + '&st=' + result.st + '&id=' + result.id;
  20172.       var XHR = createCORSRequest('GET', checkForSocio);
  20173.       if (XHR) {
  20174.         XHR.onload = function() {
  20175.           var response = XHR.responseText;
  20176.           var blockedUntilDate = new Date();
  20177.           try {
  20178.             if ((response.split(":")[1].split(",")[0]) == "0") {
  20179.               blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottlmin);
  20180.               localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
  20181.               if (localStorage.getItem("ioamplusdata") == null) {
  20182.                 localStorage.setItem("ioamplusdata", response);
  20183.               }
  20184.             } else {
  20185.               blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottl);
  20186.               localStorage.setItem("ioamplusdata", response);
  20187.               localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
  20188.             }
  20189.           } catch(e) {
  20190.             // pass
  20191.           }
  20192.         };
  20193.         XHR.send();
  20194.         return true;
  20195.       }
  20196.     }
  20197.     return false;
  20198.   }
  20199.  
  20200.   return {
  20201.     count: count,
  20202.     c: count,
  20203.     i: init,
  20204.     init: init,
  20205.     e: event,
  20206.     event: event,
  20207.     h: hybrid,
  20208.     hybrid: hybrid,
  20209.     setMultiIdentifier: setMultiIdentifier,
  20210.     smi: setMultiIdentifier,
  20211.     oi: optin,
  20212.     optin: optin,
  20213.     getInvitation: getInvitation,
  20214.     gi: getInvitation,
  20215.     getPlus: getPlus,
  20216.     gp: getPlus
  20217.   };
  20218.  
  20219. })();
  20220.  
  20221.  
  20222.     var iam_data = {
  20223.         "st": "dastelef",
  20224.         "cp": "TBBUND_Start",
  20225.         "sv": "in"
  20226.     };
  20227.     iom.c(iam_data);
  20228.  
  20229. /* 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);})();
  20230.  
  20231.     var Confirmation = (function ($) {
  20232.         var my = {'facebookCallback': null};
  20233.  
  20234.         my.registerFacebookCallback = function (cb) {
  20235.             my.facebookCallback = cb;
  20236.         };
  20237.  
  20238.         my.isConfirmed = function (by, data) {
  20239.             var email, accountname, token;
  20240.  
  20241.             if (by === 'facebook') {
  20242.                 email = data.profile.email;
  20243.                 accountname = data.profile.name;
  20244.                 token = data.auth.authResponse.accessToken;
  20245.                 $('.facebook-authinfo').val(JSON.stringify(data.auth.authResponse));
  20246.  
  20247.                 if (typeof my.facebookCallback === 'function') {
  20248.                     my.facebookCallback(data.auth, data.profile);
  20249.                 }
  20250.             } else {
  20251.                 if (by === 'twitter') {
  20252.                     email = 'not_send';
  20253.                     accountname = 'not_send';
  20254.                     token = 'private';
  20255.                 } else {
  20256.                     return;
  20257.                 }
  20258.             }
  20259.  
  20260.             $('.confirm-option').hide();
  20261.             $('.confirm-info').show().children(':nth-child(2)').html('Bestätigung erfolgt über ' + by.charAt(0).toUpperCase() + by.slice(1));
  20262.             $('.privemail').val(email);
  20263.             $('.accountname').val(accountname);
  20264.             $('.accesstoken').val(token);
  20265.             $('.confirmMethod').val(by);
  20266.             $('.captchaAnswer').val('1234');
  20267.         };
  20268.  
  20269.         my.listener = function (event) {
  20270.             if (event.data === 'dialo_twitter_confirm_ok') {
  20271.                 my.isConfirmed('twitter');
  20272.             }
  20273.         };
  20274.  
  20275.         return my;
  20276.     }(jQuery));
  20277.  
  20278.     if (window.addEventListener) {
  20279.         addEventListener("message", function (e) {
  20280.             if (Confirmation) {
  20281.                 Confirmation.listener(e);
  20282.             }
  20283.             if (Login) {
  20284.                 Login.listener(e);
  20285.             }
  20286.         }, false)
  20287.     } else {
  20288.         attachEvent("onmessage", function (e) {
  20289.             if (Confirmation) {
  20290.                 Confirmation.listener(e);
  20291.             }
  20292.             if (Login) {
  20293.                 Login.listener(e);
  20294.             }
  20295.         })
  20296.     }
  20297.  
  20298.    
  20299.     jQuery(window).load(function () {
  20300.        
  20301.         $('.image-defer').each(function () {
  20302.             $(this).attr('src', $(this).data('src'));
  20303.         });
  20304.     })
  20305.  
  20306. /*!
  20307.  * Bootstrap v3.3.5 (http://getbootstrap.com)
  20308.  * Copyright 2011-2016 Twitter, Inc.
  20309.  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  20310.  */
  20311.  
  20312. /*!
  20313.  * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=1329f33fb164b183e04b121bd6602571)
  20314.  * Config saved to config.json and https://gist.github.com/1329f33fb164b183e04b121bd6602571
  20315.  */
  20316. 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]);
  20317. }}}},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);;/* ========================================================================
  20318.  * bootstrap-switch - v3.3.2
  20319.  * http://www.bootstrap-switch.org
  20320.  * ========================================================================
  20321.  * Copyright 2012-2013 Mattia Larentis
  20322.  *
  20323.  * ========================================================================
  20324.  * Licensed under the Apache License, Version 2.0 (the "License");
  20325.  * you may not use this file except in compliance with the License.
  20326.  * You may obtain a copy of the License at
  20327.  *
  20328.  *     http://www.apache.org/licenses/LICENSE-2.0
  20329.  *
  20330.  * Unless required by applicable law or agreed to in writing, software
  20331.  * distributed under the License is distributed on an "AS IS" BASIS,
  20332.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20333.  * See the License for the specific language governing permissions and
  20334.  * limitations under the License.
  20335.  * ========================================================================
  20336.  */
  20337.  
  20338. (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);;/* ========================================================================
  20339.  * Bootstrap: affix.js v3.3.5
  20340.  * http://getbootstrap.com/javascript/#affix
  20341.  * ========================================================================
  20342.  * Copyright 2011-2015 Twitter, Inc.
  20343.  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  20344.  * ======================================================================== */
  20345.  
  20346.  
  20347. +function ($) {
  20348.     'use strict';
  20349.  
  20350.     // AFFIX CLASS DEFINITION
  20351.     // ======================
  20352.  
  20353.     var Affix = function (element, options) {
  20354.         this.options = $.extend({}, Affix.DEFAULTS, options)
  20355.  
  20356.         this.$target = $(this.options.target)
  20357.             .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  20358.             .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
  20359.  
  20360.         this.$element     = $(element)
  20361.         this.affixed      = null
  20362.         this.unpin        = null
  20363.         this.pinnedOffset = null
  20364.  
  20365.         this.checkPosition()
  20366.     }
  20367.  
  20368.     Affix.VERSION  = '3.3.5'
  20369.  
  20370.     Affix.RESET    = 'affix affix-top affix-bottom'
  20371.  
  20372.     Affix.DEFAULTS = {
  20373.         offset: 0,
  20374.         target: window
  20375.     }
  20376.  
  20377.     Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  20378.         var scrollTop    = this.$target.scrollTop()
  20379.         var position     = this.$element.offset()
  20380.         var targetHeight = this.$target.height()
  20381.  
  20382.         if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  20383.  
  20384.         if (this.affixed == 'bottom') {
  20385.             if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  20386.             return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  20387.         }
  20388.  
  20389.         var initializing   = this.affixed == null
  20390.         var colliderTop    = initializing ? scrollTop : position.top
  20391.         var colliderHeight = initializing ? targetHeight : height
  20392.  
  20393.         if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  20394.         if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  20395.  
  20396.         return false
  20397.     }
  20398.  
  20399.     Affix.prototype.getPinnedOffset = function () {
  20400.         if (this.pinnedOffset) return this.pinnedOffset
  20401.         this.$element.removeClass(Affix.RESET).addClass('affix')
  20402.         var scrollTop = this.$target.scrollTop()
  20403.         var position  = this.$element.offset()
  20404.         return (this.pinnedOffset = position.top - scrollTop)
  20405.     }
  20406.  
  20407.     Affix.prototype.checkPositionWithEventLoop = function () {
  20408.         setTimeout($.proxy(this.checkPosition, this), 1)
  20409.     }
  20410.  
  20411.     Affix.prototype.checkPosition = function () {
  20412.         if (!this.$element.is(':visible')) return
  20413.  
  20414.         var height       = this.$element.height()
  20415.         var offset       = this.options.offset
  20416.         var offsetTop    = offset.top
  20417.         var offsetBottom = offset.bottom
  20418.         var scrollHeight = Math.max($(document).height(), $(document.body).height())
  20419.  
  20420.         if (typeof offset != 'object')         offsetBottom = offsetTop = offset
  20421.         if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
  20422.         if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  20423.  
  20424.         var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  20425.  
  20426.         if (this.affixed != affix) {
  20427.             if (this.unpin != null) this.$element.css('top', '')
  20428.  
  20429.             var affixType = 'affix' + (affix ? '-' + affix : '')
  20430.             var e         = $.Event(affixType + '.bs.affix')
  20431.  
  20432.             this.$element.trigger(e)
  20433.  
  20434.             if (e.isDefaultPrevented()) return
  20435.  
  20436.             this.affixed = affix
  20437.             this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  20438.  
  20439.             this.$element
  20440.                 .removeClass(Affix.RESET)
  20441.                 .addClass(affixType)
  20442.                 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  20443.         }
  20444.  
  20445.         if (affix == 'bottom') {
  20446.             this.$element.offset({
  20447.                 top: scrollHeight - height - offsetBottom
  20448.             })
  20449.         }
  20450.     }
  20451.  
  20452.  
  20453.     // AFFIX PLUGIN DEFINITION
  20454.     // =======================
  20455.  
  20456.     function Plugin(option) {
  20457.         return this.each(function () {
  20458.             var $this   = $(this)
  20459.             var data    = $this.data('bs.affix')
  20460.             var options = typeof option == 'object' && option
  20461.  
  20462.             if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  20463.             if (typeof option == 'string') data[option]()
  20464.         })
  20465.     }
  20466.  
  20467.     var old = $.fn.affix
  20468.  
  20469.     $.fn.affix             = Plugin
  20470.     $.fn.affix.Constructor = Affix
  20471.  
  20472.  
  20473.     // AFFIX NO CONFLICT
  20474.     // =================
  20475.  
  20476.     $.fn.affix.noConflict = function () {
  20477.         $.fn.affix = old
  20478.         return this
  20479.     }
  20480.  
  20481.  
  20482.     // AFFIX DATA-API
  20483.     // ==============
  20484.  
  20485.     $(window).on('load', function () {
  20486.         $('[data-spy="affix"]').each(function () {
  20487.             var $spy = $(this)
  20488.             var data = $spy.data()
  20489.  
  20490.             data.offset = data.offset || {}
  20491.  
  20492.             if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  20493.             if (data.offsetTop    != null) data.offset.top    = data.offsetTop
  20494.  
  20495.             Plugin.call($spy, data)
  20496.         })
  20497.     })
  20498.  
  20499. }(jQuery);;/*************************
  20500.  * Croppie
  20501.  * Copyright 2015
  20502.  * Foliotek
  20503.  * Version: 1.0.3
  20504.  *************************/
  20505. (function (root, factory) {
  20506.     if (typeof define === 'function' && define.amd) {
  20507.         // AMD. Register as an anonymous module.
  20508.         define(['exports', 'b'], factory);
  20509.     } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
  20510.         // CommonJS
  20511.         factory(exports, require('b'));
  20512.     } else {
  20513.         // Browser globals
  20514.         factory((root.commonJsStrict = {}), root.b);
  20515.     }
  20516. }(this, function (exports, b) {
  20517.  
  20518.     if (typeof Promise !== 'function') {
  20519.         /*!
  20520.          * @overview es6-promise - a tiny implementation of Promises/A+.
  20521.          * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  20522.          * @license   Licensed under MIT license
  20523.          *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  20524.          * @version   3.0.2
  20525.          */
  20526.         (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);
  20527.     }
  20528.  
  20529.     var cssPrefixes = ['Webkit', 'Moz', 'ms'],
  20530.         emptyStyles = document.createElement('div').style,
  20531.         CSS_TRANS_ORG,
  20532.         CSS_TRANSFORM,
  20533.         CSS_USERSELECT;
  20534.  
  20535.     function vendorPrefix(prop) {
  20536.         if (prop in emptyStyles) {
  20537.             return prop;
  20538.         }
  20539.  
  20540.         var capProp = prop[0].toUpperCase() + prop.slice(1),
  20541.             i = cssPrefixes.length;
  20542.  
  20543.         while (i--) {
  20544.             prop = cssPrefixes[i] + capProp;
  20545.             if (prop in emptyStyles) {
  20546.                 return prop;
  20547.             }
  20548.         }
  20549.     }
  20550.  
  20551.     CSS_TRANSFORM = vendorPrefix('transform');
  20552.     CSS_TRANS_ORG = vendorPrefix('transformOrigin');
  20553.     CSS_USERSELECT = vendorPrefix('userSelect');
  20554.  
  20555.  
  20556.     function deepExtend(out) {
  20557.         out = out || {};
  20558.  
  20559.         for (var i = 1; i < arguments.length; i++) {
  20560.             var obj = arguments[i];
  20561.  
  20562.             if (!obj)
  20563.                 continue;
  20564.  
  20565.             for (var key in obj) {
  20566.                 if (obj.hasOwnProperty(key)) {
  20567.                     if (typeof obj[key] === 'object')
  20568.                         out[key] = deepExtend({}, obj[key]);
  20569.                     else
  20570.                         out[key] = obj[key];
  20571.                 }
  20572.             }
  20573.         }
  20574.         return out;
  20575.     }
  20576.  
  20577.     function debounce(func, wait, immediate) {
  20578.         var timeout;
  20579.         return function () {
  20580.             var context = this, args = arguments;
  20581.             var later = function () {
  20582.                 timeout = null;
  20583.                 if (!immediate) func.apply(context, args);
  20584.             };
  20585.             var callNow = immediate && !timeout;
  20586.             clearTimeout(timeout);
  20587.             timeout = setTimeout(later, wait);
  20588.             if (callNow) func.apply(context, args);
  20589.         };
  20590.     }
  20591.  
  20592.     function dispatchChange(element) {
  20593.         if ("createEvent" in document) {
  20594.             var evt = document.createEvent("HTMLEvents");
  20595.             evt.initEvent("change", false, true);
  20596.             element.dispatchEvent(evt);
  20597.         }
  20598.         else {
  20599.             element.fireEvent("onchange");
  20600.         }
  20601.     }
  20602.  
  20603.     //http://jsperf.com/vanilla-css
  20604.     function css(el, styles, val) {
  20605.         if (typeof (styles) === 'string') {
  20606.             var tmp = styles;
  20607.             styles = {};
  20608.             styles[tmp] = val;
  20609.         }
  20610.  
  20611.         for (var prop in styles) {
  20612.             el.style[prop] = styles[prop];
  20613.         }
  20614.     }
  20615.  
  20616.     /* Image Drawing Functions */
  20617.     function getHtmlImage(data) {
  20618.         var points = data.points,
  20619.             div = document.createElement('div'),
  20620.             img = document.createElement('img'),
  20621.             width = points[2] - points[0],
  20622.             height = points[3] - points[1];
  20623.         // scale = data.zoom;
  20624.  
  20625.         div.classList.add('croppie-result');
  20626.         div.appendChild(img);
  20627.         css(img, {
  20628.             left: (-1 * points[0]) + 'px',
  20629.             top: (-1 * points[1]) + 'px'
  20630.             // transform: 'scale(' + scale + ')'
  20631.         })
  20632.         img.src = data.url;
  20633.         css(div, {
  20634.             width: width + 'px',
  20635.             height: height + 'px'
  20636.         });
  20637.  
  20638.         return div;
  20639.     }
  20640.  
  20641.     function getCanvasImage(img, data) {
  20642.         var points = data.points,
  20643.             left = points[0],
  20644.             top = points[1],
  20645.             width = (points[2] - points[0]),
  20646.             height = (points[3] - points[1]),
  20647.             circle = data.circle,
  20648.             canvas = document.createElement('canvas'),
  20649.             ctx = canvas.getContext('2d'),
  20650.             outWidth = width,
  20651.             outHeight = height;
  20652.  
  20653.         if (data.outputWidth && data.outputHeight) {
  20654.             outWidth = data.outputWidth;
  20655.             outHeight = data.outputHeight;
  20656.         }
  20657.  
  20658.         canvas.width = outWidth;
  20659.         canvas.height = outHeight;
  20660.  
  20661.         if (circle) {
  20662.             ctx.save();
  20663.             ctx.beginPath();
  20664.             ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true);
  20665.             ctx.closePath();
  20666.             ctx.clip();
  20667.         }
  20668.  
  20669.         ctx.drawImage(img, left, top, width, height, 0, 0, outWidth, outHeight);
  20670.  
  20671.         return canvas.toDataURL();
  20672.     }
  20673.  
  20674.     /* Utilities */
  20675.     function loadImage(src, imageEl) {
  20676.         var img = imageEl || new Image(),
  20677.             prom;
  20678.  
  20679.         prom = new Promise(function (resolve, reject) {
  20680.             if (src.substring(0,4).toLowerCase() === 'http') {
  20681.                 img.setAttribute('crossOrigin', 'anonymous');
  20682.             }
  20683.             img.onload = function () {
  20684.                 setTimeout(function () {
  20685.                     resolve(img);
  20686.                 }, 1);
  20687.             };
  20688.         });
  20689.  
  20690.         img.src = src;
  20691.         return prom;
  20692.     }
  20693.  
  20694.     /* CSS Transform Prototype */
  20695.     var _TRANSLATE = 'translate3d',
  20696.         _TRANSLATE_SUFFIX = ', 0px';
  20697.     var Transform = function (x, y, scale) {
  20698.         this.x = parseFloat(x);
  20699.         this.y = parseFloat(y);
  20700.         this.scale = parseFloat(scale);
  20701.     };
  20702.  
  20703.     Transform.parse = function (v) {
  20704.         if (v.style) {
  20705.             return Transform.parse(v.style[CSS_TRANSFORM]);
  20706.         }
  20707.         else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) {
  20708.             return Transform.fromMatrix(v);
  20709.         }
  20710.         else {
  20711.             return Transform.fromString(v);
  20712.         }
  20713.     };
  20714.  
  20715.     Transform.fromMatrix = function (v) {
  20716.         var vals = v.substring(7).split(',');
  20717.         if (!vals.length || v === 'none') {
  20718.             vals = [1, 0, 0, 1, 0, 0];
  20719.         }
  20720.  
  20721.         return new Transform(parseInt(vals[4], 10), parseInt(vals[5], 10), parseFloat(vals[0]));
  20722.     };
  20723.  
  20724.     Transform.fromString = function (v) {
  20725.         var values = v.split(') '),
  20726.             translate = values[0].substring(_TRANSLATE.length + 1).split(','),
  20727.             scale = values.length > 1 ? values[1].substring(6) : 1,
  20728.             x = translate.length > 1 ? translate[0] : 0,
  20729.             y = translate.length > 1 ? translate[1] : 0;
  20730.  
  20731.         return new Transform(x, y, scale);
  20732.     }
  20733.  
  20734.     Transform.prototype.toString = function () {
  20735.         return _TRANSLATE + '(' + this.x + 'px, ' + this.y + 'px' + _TRANSLATE_SUFFIX + ') scale(' + this.scale + ')';
  20736.     };
  20737.  
  20738.     var TransformOrigin = function (el) {
  20739.         if (!el || !el.style[CSS_TRANS_ORG]) {
  20740.             this.x = 0;
  20741.             this.y = 0;
  20742.             return;
  20743.         }
  20744.         var css = el.style[CSS_TRANS_ORG].split(' ');
  20745.         this.x = parseFloat(css[0]);
  20746.         this.y = parseFloat(css[1]);
  20747.     };
  20748.  
  20749.     TransformOrigin.prototype.toString = function () {
  20750.         return this.x + 'px ' + this.y + 'px';
  20751.     };
  20752.  
  20753.     /* Private Methods */
  20754.     function _create() {
  20755.         var self = this,
  20756.             contClass = ['croppie-container'],
  20757.             customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null,
  20758.             boundary, img, viewport, overlay;
  20759.  
  20760.         // Properties on class
  20761.         self.data = {};
  20762.         self.elements = {};
  20763.  
  20764.         // Generating Markup
  20765.         boundary = self.elements.boundary = document.createElement('div');
  20766.         viewport = self.elements.viewport = document.createElement('div');
  20767.         img = self.elements.img = document.createElement('img');
  20768.         overlay = self.elements.overlay = document.createElement('div');
  20769.  
  20770.         boundary.classList.add('cr-boundary');
  20771.         css(boundary, {
  20772.             width: self.options.boundary.width + 'px',
  20773.             height: self.options.boundary.height + 'px'
  20774.         });
  20775.  
  20776.         viewport.classList.add('cr-viewport');
  20777.         if (customViewportClass) {
  20778.             viewport.classList.add(customViewportClass);
  20779.         }
  20780.         css(viewport, {
  20781.             width: self.options.viewport.width + 'px',
  20782.             height: self.options.viewport.height + 'px'
  20783.         });
  20784.  
  20785.         img.classList.add('cr-image');
  20786.         overlay.classList.add('cr-overlay');
  20787.  
  20788.         self.element.appendChild(boundary);
  20789.         boundary.appendChild(img);
  20790.         boundary.appendChild(viewport);
  20791.         boundary.appendChild(overlay);
  20792.  
  20793.         self.element.classList.add(contClass);
  20794.         if (self.options.customClass) {
  20795.             self.element.classList.add(self.options.customClass);
  20796.         }
  20797.  
  20798.         // Initialize drag & zoom
  20799.         _initDraggable.call(this);
  20800.  
  20801.         if (self.options.showZoom) {
  20802.             _initializeZoom.call(self);
  20803.         }
  20804.     }
  20805.  
  20806.     function _setZoomerVal(v) {
  20807.         if (this.options.showZoom) {
  20808.             this.elements.zoomer.value = fix(v);
  20809.         }
  20810.     }
  20811.  
  20812.     function _initializeZoom() {
  20813.         var self = this,
  20814.             wrap = self.elements.zoomerWrap = document.createElement('div'),
  20815.             zoomer = self.elements.zoomer = document.createElement('input'),
  20816.             origin,
  20817.             viewportRect,
  20818.             transform;
  20819.  
  20820.         wrap.classList.add('cr-slider-wrap');
  20821.         zoomer.type = 'range';
  20822.         zoomer.classList.add('cr-slider');
  20823.         zoomer.step = '0.01';
  20824.         zoomer.value = 1;
  20825.  
  20826.         self.element.appendChild(wrap);
  20827.         wrap.appendChild(zoomer);
  20828.  
  20829.         self._currentZoom = 1;
  20830.         function start() {
  20831.             _updateCenterPoint.call(self);
  20832.             origin = new TransformOrigin(self.elements.img);
  20833.             viewportRect = self.elements.viewport.getBoundingClientRect();
  20834.             transform = Transform.parse(self.elements.img);
  20835.         }
  20836.  
  20837.         function change() {
  20838.             _onZoom.call(self, {
  20839.                 value: parseFloat(zoomer.value),
  20840.                 origin: origin || new TransformOrigin(self.elements.img),
  20841.                 viewportRect: viewportRect || self.elements.viewport.getBoundingClientRect(),
  20842.                 transform: transform || Transform.parse(self.elements.img)
  20843.             });
  20844.         }
  20845.  
  20846.         function scroll(ev) {
  20847.             var delta, targetZoom;
  20848.        
  20849.             if (ev.wheelDelta) {
  20850.                 delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2
  20851.             } else if (ev.deltaY) {
  20852.                 delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2
  20853.             } else if (ev.detail) {
  20854.                 delta = ev.detail / 60; //delta min: -3 max: 3 // max x 10 x 2
  20855.             } else {
  20856.                 delta = 0;
  20857.             }
  20858.        
  20859.             targetZoom = self._currentZoom + delta;
  20860.        
  20861.             ev.preventDefault();
  20862.             start();
  20863.             _setZoomerVal.call(self, targetZoom);
  20864.             change();
  20865.         }
  20866.  
  20867.         self.elements.zoomer.addEventListener('mousedown', start);
  20868.         self.elements.zoomer.addEventListener('touchstart', start);
  20869.  
  20870.         self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress
  20871.         self.elements.zoomer.addEventListener('change', change);
  20872.  
  20873.         if (self.options.mouseWheelZoom) {
  20874.             self.elements.boundary.addEventListener('mousewheel', scroll);
  20875.             self.elements.boundary.addEventListener('DOMMouseScroll', scroll);
  20876.         }
  20877.     }
  20878.  
  20879.     function _onZoom(ui) {
  20880.         var self = this,
  20881.             transform = ui.transform,
  20882.             vpRect = ui.viewportRect,
  20883.             origin = ui.origin;
  20884.  
  20885.         self._currentZoom = ui.value;
  20886.         transform.scale = self._currentZoom;
  20887.  
  20888.         var boundaries = _getVirtualBoundaries.call(self, vpRect),
  20889.             transBoundaries = boundaries.translate,
  20890.             oBoundaries = boundaries.origin;
  20891.  
  20892.         if (transform.x >= transBoundaries.maxX) {
  20893.             origin.x = oBoundaries.minX;
  20894.             transform.x = transBoundaries.maxX;
  20895.         }
  20896.  
  20897.         if (transform.x <= transBoundaries.minX) {
  20898.             origin.x = oBoundaries.maxX;
  20899.             transform.x = transBoundaries.minX;
  20900.         }
  20901.  
  20902.         if (transform.y >= transBoundaries.maxY) {
  20903.             origin.y = oBoundaries.minY;
  20904.             transform.y = transBoundaries.maxY;
  20905.         }
  20906.  
  20907.         if (transform.y <= transBoundaries.minY) {
  20908.             origin.y = oBoundaries.maxY;
  20909.             transform.y = transBoundaries.minY;
  20910.         }
  20911.  
  20912.         var transCss = {};
  20913.         transCss[CSS_TRANSFORM] = transform.toString();
  20914.         transCss[CSS_TRANS_ORG] = origin.toString();
  20915.         css(self.elements.img, transCss);
  20916.  
  20917.         _debouncedOverlay.call(self);
  20918.         _triggerUpdate.call(self);
  20919.     }
  20920.  
  20921.     function _getVirtualBoundaries(viewport) {
  20922.         var self = this,
  20923.             scale = self._currentZoom,
  20924.             vpWidth = viewport.width,
  20925.             vpHeight = viewport.height,
  20926.             centerFromBoundaryX = self.options.boundary.width / 2,
  20927.             centerFromBoundaryY = self.options.boundary.height / 2,
  20928.             originalImgWidth = self._originalImageWidth,
  20929.             originalImgHeight = self._originalImageHeight,
  20930.             curImgWidth = originalImgWidth * scale,
  20931.             curImgHeight = originalImgHeight * scale,
  20932.             halfWidth = vpWidth / 2,
  20933.             halfHeight = vpHeight / 2;
  20934.  
  20935.  
  20936.         var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1;
  20937.         var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale)));
  20938.  
  20939.         var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1;
  20940.         var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale)));
  20941.  
  20942.         var originMinX = (1 / scale) * halfWidth;
  20943.         var originMaxX = (curImgWidth * (1 / scale)) - originMinX;
  20944.  
  20945.         var originMinY = (1 / scale) * halfHeight;
  20946.         var originMaxY = (curImgHeight * (1 / scale)) - originMinY;
  20947.  
  20948.         return {
  20949.             translate: {
  20950.                 maxX: maxX,
  20951.                 minX: minX,
  20952.                 maxY: maxY,
  20953.                 minY: minY
  20954.             },
  20955.             origin: {
  20956.                 maxX: originMaxX,
  20957.                 minX: originMinX,
  20958.                 maxY: originMaxY,
  20959.                 minY: originMinY
  20960.             }
  20961.         };
  20962.     }
  20963.  
  20964.     function _updateCenterPoint() {
  20965.         var self = this,
  20966.             scale = self._currentZoom,
  20967.             data = self.elements.img.getBoundingClientRect(),
  20968.             vpData = self.elements.viewport.getBoundingClientRect(),
  20969.             transform = Transform.parse(self.elements.img.style[CSS_TRANSFORM]),
  20970.             pc = new TransformOrigin(self.elements.img),
  20971.             top = (vpData.top - data.top) + (vpData.height / 2),
  20972.             left = (vpData.left - data.left) + (vpData.width / 2),
  20973.             center = {},
  20974.             adj = {};
  20975.  
  20976.         center.y = top / scale;
  20977.         center.x = left / scale;
  20978.  
  20979.         adj.y = (center.y - pc.y) * (1 - scale);
  20980.         adj.x = (center.x - pc.x) * (1 - scale);
  20981.  
  20982.         transform.x -= adj.x;
  20983.         transform.y -= adj.y;
  20984.  
  20985.         var newCss = {};
  20986.         newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px';
  20987.         newCss[CSS_TRANSFORM] = transform.toString();
  20988.         css(self.elements.img, newCss);
  20989.     }
  20990.  
  20991.     function _initDraggable() {
  20992.         var self = this,
  20993.             isDragging = false,
  20994.             originalX,
  20995.             originalY,
  20996.             originalDistance,
  20997.             vpRect;
  20998.  
  20999.         function mouseDown(ev) {
  21000.             ev.preventDefault();
  21001.             if (isDragging) return;
  21002.             isDragging = true;
  21003.             originalX = ev.pageX;
  21004.             originalY = ev.pageY;
  21005.             transform = Transform.parse(self.elements.img);
  21006.             window.addEventListener('mousemove', mouseMove);
  21007.             window.addEventListener('touchmove', mouseMove);
  21008.             window.addEventListener('mouseup', mouseUp);
  21009.             window.addEventListener('touchend', mouseUp);
  21010.             document.body.style[CSS_USERSELECT] = 'none';
  21011.             vpRect = self.elements.viewport.getBoundingClientRect();
  21012.         }
  21013.  
  21014.         function mouseMove(ev) {
  21015.             ev.preventDefault();
  21016.             var pageX = ev.pageX || ev.touches[0].pageX,
  21017.                 pageY = ev.pageY || ev.touches[0].pageY,
  21018.                 deltaX = pageX - originalX,
  21019.                 deltaY = pageY - originalY,
  21020.                 imgRect = self.elements.img.getBoundingClientRect(),
  21021.                 top = transform.y + deltaY,
  21022.                 left = transform.x + deltaX,
  21023.                 newCss = {};
  21024.  
  21025.             if (ev.type == 'touchmove') {
  21026.                 if (ev.touches.length > 1) {
  21027.                     var touch1 = ev.touches[0];
  21028.                     var touch2 = ev.touches[1];
  21029.                     var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY));
  21030.  
  21031.                     if (!originalDistance) {
  21032.                         originalDistance = dist / self._currentZoom;
  21033.                     }
  21034.  
  21035.                     var scale = dist / originalDistance;
  21036.  
  21037.                     _setZoomerVal.call(self, scale);
  21038.                     dispatchChange(self.elements.zoomer);
  21039.                     return;
  21040.                 }
  21041.             }
  21042.  
  21043.             if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) {
  21044.                 transform.y = top;
  21045.             }
  21046.  
  21047.             if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) {
  21048.                 transform.x = left;
  21049.             }
  21050.  
  21051.             newCss[CSS_TRANSFORM] = transform.toString();
  21052.             css(self.elements.img, newCss);
  21053.             _updateOverlay.call(self);
  21054.             originalY = pageY;
  21055.             originalX = pageX;
  21056.         }
  21057.  
  21058.         function mouseUp() {
  21059.             isDragging = false;
  21060.             window.removeEventListener('mousemove', mouseMove);
  21061.             window.removeEventListener('touchmove', mouseMove);
  21062.             window.removeEventListener('mouseup', mouseUp);
  21063.             window.removeEventListener('touchend', mouseUp);
  21064.             document.body.style[CSS_USERSELECT] = '';
  21065.             _updateCenterPoint.call(self);
  21066.             _triggerUpdate.call(self);
  21067.             originalDistance = 0;
  21068.         }
  21069.  
  21070.         self.elements.overlay.addEventListener('mousedown', mouseDown);
  21071.         self.elements.overlay.addEventListener('touchstart', mouseDown);
  21072.     }
  21073.  
  21074.     function _updateOverlay() {
  21075.         var self = this,
  21076.             boundRect = self.elements.boundary.getBoundingClientRect(),
  21077.             imgData = self.elements.img.getBoundingClientRect();
  21078.  
  21079.         css(self.elements.overlay, {
  21080.             width: imgData.width + 'px',
  21081.             height: imgData.height + 'px',
  21082.             top: (imgData.top - boundRect.top) + 'px',
  21083.             left: (imgData.left - boundRect.left) + 'px'
  21084.         });
  21085.     }
  21086.     var _debouncedOverlay = debounce(_updateOverlay, 500);
  21087.  
  21088.     function _triggerUpdate() {
  21089.         var self = this;
  21090.         if (_isVisible.call(self)) {
  21091.             self.options.update.call(self, self.get());
  21092.         }
  21093.     }
  21094.  
  21095.     function _isVisible() {
  21096.         return this.elements.img.offsetHeight > 0 && this.elements.img.offsetWidth > 0;
  21097.     }
  21098.  
  21099.     function _updatePropertiesFromImage() {
  21100.         var self = this,
  21101.             minZoom = 0,
  21102.             maxZoom = 1.5,
  21103.             initialZoom = 1,
  21104.             cssReset = {},
  21105.             img = self.elements.img,
  21106.             zoomer = self.elements.zoomer,
  21107.             transformReset = new Transform(0, 0, initialZoom),
  21108.             originReset = new TransformOrigin(),
  21109.             isVisible = _isVisible.call(self),
  21110.             imgData,
  21111.             vpData,
  21112.             boundaryData,
  21113.             minW,
  21114.             minH;
  21115.  
  21116.         if (!isVisible || self.data.bound) {
  21117.             // if the croppie isn't visible or it doesn't need binding
  21118.             return;
  21119.         }
  21120.  
  21121.         self.data.bound = true;
  21122.         cssReset[CSS_TRANSFORM] = transformReset.toString();
  21123.         cssReset[CSS_TRANS_ORG] = originReset.toString();
  21124.         css(img, cssReset);
  21125.  
  21126.         imgData = img.getBoundingClientRect();
  21127.         vpData = self.elements.viewport.getBoundingClientRect();
  21128.         boundaryData = self.elements.boundary.getBoundingClientRect();
  21129.         self._originalImageWidth = imgData.width;
  21130.         self._originalImageHeight = imgData.height;
  21131.  
  21132.         if (self.options.showZoom) {
  21133.             minW = vpData.width / imgData.width;
  21134.             minH = vpData.height / imgData.height;
  21135.             minZoom = Math.max(minW, minH);
  21136.  
  21137.             if (minZoom >= maxZoom) {
  21138.                 maxZoom = minZoom + 1;
  21139.             }
  21140.  
  21141.             zoomer.min = fix(minZoom)
  21142.             zoomer.max = fix(maxZoom);
  21143.             initialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));
  21144.             _setZoomerVal.call(self, initialZoom);
  21145.             dispatchChange(zoomer);
  21146.         }
  21147.  
  21148.         self._currentZoom = transformReset.scale = initialZoom;
  21149.         cssReset[CSS_TRANSFORM] = transformReset.toString();
  21150.         css(img, cssReset);
  21151.  
  21152.         if (self.data.points.length) {
  21153.             _bindPoints.call(self, self.data.points);
  21154.         }
  21155.         else {
  21156.             _centerImage.call(self);
  21157.         }
  21158.  
  21159.        
  21160.         _updateOverlay.call(self);
  21161.     }
  21162.  
  21163.     function _bindPoints(points) {
  21164.         if (points.length != 4) {
  21165.             throw "Croppie - Invalid number of points supplied: " + points;
  21166.         }
  21167.         var self = this,
  21168.             pointsWidth = points[2] - points[0],
  21169.             // pointsHeight = points[3] - points[1],
  21170.             vpData = self.elements.viewport.getBoundingClientRect(),
  21171.             boundRect = self.elements.boundary.getBoundingClientRect(),
  21172.             vpOffset = {
  21173.                 left: vpData.left - boundRect.left,
  21174.                 top: vpData.top - boundRect.top
  21175.             },
  21176.             scale = vpData.width / pointsWidth,
  21177.             originTop = points[1],
  21178.             originLeft = points[0],
  21179.             transformTop = (-1 * points[1]) + vpOffset.top,
  21180.             transformLeft = (-1 * points[0]) + vpOffset.left,
  21181.             newCss = {};
  21182.  
  21183.         newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px';
  21184.         newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString();
  21185.         css(self.elements.img, newCss);
  21186.  
  21187.         _setZoomerVal.call(self, scale);
  21188.         self._currentZoom = scale;
  21189.     }
  21190.  
  21191.     function _centerImage() {
  21192.         var self = this,
  21193.             imgDim = self.elements.img.getBoundingClientRect(),
  21194.             vpDim = self.elements.viewport.getBoundingClientRect(),
  21195.             boundDim = self.elements.boundary.getBoundingClientRect(),
  21196.             vpLeft = vpDim.left - boundDim.left,
  21197.             vpTop = vpDim.top - boundDim.top,
  21198.             w = vpLeft - ((imgDim.width - vpDim.width) / 2),
  21199.             h = vpTop - ((imgDim.height - vpDim.height) / 2),
  21200.             transform = new Transform(w, h, self._currentZoom);
  21201.  
  21202.         css(self.elements.img, CSS_TRANSFORM, transform.toString());
  21203.     }
  21204.  
  21205.     function _bind(options, cb) {
  21206.         var self = this,
  21207.             url,
  21208.             points = [];
  21209.  
  21210.         if (typeof (options) === 'string') {
  21211.             url = options;
  21212.             options = {};
  21213.         }
  21214.         else if (Array.isArray(options)) {
  21215.             points = options.slice();
  21216.         }
  21217.         else if (typeof (options) == 'undefined' && self.data.url) { //refreshing
  21218.             _updatePropertiesFromImage.call(self);
  21219.             _triggerUpdate.call(self);
  21220.             return null;
  21221.         }
  21222.         else {
  21223.             url = options.url;
  21224.             points = options.points || [];
  21225.         }
  21226.  
  21227.         self.data.bound = false;
  21228.         self.data.url = url || self.data.url;
  21229.         self.data.points = (points || self.data.points).map(function (p) {
  21230.             return parseFloat(p);
  21231.         });
  21232.         var prom = loadImage(url, self.elements.img);
  21233.         prom.then(function () {
  21234.             _updatePropertiesFromImage.call(self);
  21235.             _triggerUpdate.call(self);
  21236.             if (cb) {
  21237.                 cb();
  21238.             }
  21239.         });
  21240.         return prom;
  21241.     }
  21242.  
  21243.     function fix(v) {
  21244.         return parseFloat(v).toFixed(2);
  21245.     }
  21246.  
  21247.     function _get() {
  21248.         var self = this,
  21249.             imgData = self.elements.img.getBoundingClientRect(),
  21250.             vpData = self.elements.viewport.getBoundingClientRect(),
  21251.             x1 = vpData.left - imgData.left,
  21252.             y1 = vpData.top - imgData.top,
  21253.             x2 = x1 + vpData.width,
  21254.             y2 = y1 + vpData.height,
  21255.             scale = self._currentZoom;
  21256.  
  21257.         if (scale === Infinity || isNaN(scale)) {
  21258.             scale = 1;
  21259.         }
  21260.  
  21261.         x1 = Math.max(0, x1 / scale);
  21262.         y1 = Math.max(0, y1 / scale);
  21263.         x2 = Math.max(0, x2 / scale);
  21264.         y2 = Math.max(0, y2 / scale);
  21265.        
  21266.         return {
  21267.             points: [fix(x1), fix(y1), fix(x2), fix(y2)],
  21268.             zoom: scale
  21269.         };
  21270.     }
  21271.  
  21272.     function _result(options) {
  21273.         var self = this,
  21274.             data = _get.call(self),
  21275.             opts = options || { type: 'canvas', size: 'viewport' },
  21276.             type = (typeof (opts) === 'string' ? opts : opts.type),
  21277.             size = opts.size || 'viewport',
  21278.             vpRect,
  21279.             prom;
  21280.  
  21281.         if (size === 'viewport') {
  21282.             vpRect = self.elements.viewport.getBoundingClientRect();
  21283.             data.outputWidth = vpRect.width;
  21284.             data.outputHeight = vpRect.height;
  21285.         }
  21286.  
  21287.         data.circle = self.options.viewport.type === 'circle';
  21288.         data.url = self.data.url;
  21289.  
  21290.         prom = new Promise(function (resolve, reject) {
  21291.             if (type === 'canvas') {
  21292.                 loadImage(data.url).then(function (img) {
  21293.                     resolve(getCanvasImage(img, data));
  21294.                 });
  21295.             }
  21296.             else {
  21297.                 resolve(getHtmlImage(data));
  21298.             }
  21299.         });
  21300.         return prom;
  21301.     }
  21302.  
  21303.     function _refresh() {
  21304.         console.warn("Croppie.refresh() is deprecated.  Please use Croppie.bind() without any arguments instead.  refresh() will be removed in a later release.");
  21305.         _updatePropertiesFromImage.call(this);
  21306.     }
  21307.  
  21308.     function _destroy() {
  21309.         var self = this;
  21310.         self.element.removeChild(self.elements.boundary);
  21311.         if (self.options.showZoom) {
  21312.             self.element.removeChild(self.elements.zoomerWrap);
  21313.         }
  21314.         delete self.elements;
  21315.     }
  21316.  
  21317.     if (this.jQuery) {
  21318.         var $ = this.jQuery;
  21319.         $.fn.croppie = function (opts) {
  21320.             var ot = typeof opts;
  21321.  
  21322.             if (ot === 'string') {
  21323.                 var args = Array.prototype.slice.call(arguments, 1);
  21324.                 var singleInst = $(this).data('croppie');
  21325.  
  21326.                 if (opts === 'get') {
  21327.                     return singleInst.get();
  21328.                 }
  21329.                 else if (opts === 'result') {
  21330.                     return singleInst.result.apply(singleInst, args);
  21331.                 }
  21332.  
  21333.                 return this.each(function () {
  21334.                     var i = $(this).data('croppie');
  21335.                     if (!i) return;
  21336.  
  21337.                     var method = i[opts];
  21338.                     if ($.isFunction(method)) {
  21339.                         method.apply(i, args);
  21340.                         if (opts === 'destroy') {
  21341.                             $(this).removeData('croppie');
  21342.                         }
  21343.                     }
  21344.                     else {
  21345.                         throw 'Croppie ' + opts + ' method not found';
  21346.                     }
  21347.                 });
  21348.             }
  21349.             else {
  21350.                 return this.each(function () {
  21351.                     var i = new Croppie(this, opts);
  21352.                     $(this).data('croppie', i);
  21353.                 });
  21354.             }
  21355.         };
  21356.     }
  21357.  
  21358.     function Croppie(element, opts) {
  21359.         this.element = element;
  21360.         this.options = deepExtend({}, Croppie.defaults, opts);
  21361.  
  21362.         _create.call(this);
  21363.     }
  21364.  
  21365.     Croppie.defaults = {
  21366.         viewport: {
  21367.             width: 100,
  21368.             height: 100,
  21369.             type: 'square'
  21370.         },
  21371.         boundary: {
  21372.             width: 300,
  21373.             height: 300
  21374.         },
  21375.         customClass: '',
  21376.         showZoom: true,
  21377.         mouseWheelZoom: true,
  21378.         update: function () { }
  21379.     };
  21380.  
  21381.     deepExtend(Croppie.prototype, {
  21382.         bind: function (options, cb) {
  21383.             return _bind.call(this, options, cb);
  21384.         },
  21385.         get: function () {
  21386.             return _get.call(this);
  21387.         },
  21388.         result: function (type) {
  21389.             return _result.call(this, type);
  21390.         },
  21391.         refresh: function () {
  21392.             return _refresh.call(this);
  21393.         },
  21394.         destroy: function () {
  21395.             return _destroy.call(this);
  21396.         }
  21397.     });
  21398.  
  21399.     exports.Croppie = window.Croppie = Croppie;
  21400. }));
  21401. ;/* =========================================================
  21402.  * bootstrap-datepicker.js
  21403.  * Repo: https://github.com/eternicode/bootstrap-datepicker/
  21404.  * Demo: http://eternicode.github.io/bootstrap-datepicker/
  21405.  * Docs: http://bootstrap-datepicker.readthedocs.org/
  21406.  * Forked from http://www.eyecon.ro/bootstrap-datepicker
  21407.  * =========================================================
  21408.  * Started by Stefan Petre; improvements by Andrew Rowls + contributors
  21409.  *
  21410.  * Licensed under the Apache License, Version 2.0 (the "License");
  21411.  * you may not use this file except in compliance with the License.
  21412.  * You may obtain a copy of the License at
  21413.  *
  21414.  * http://www.apache.org/licenses/LICENSE-2.0
  21415.  *
  21416.  * Unless required by applicable law or agreed to in writing, software
  21417.  * distributed under the License is distributed on an "AS IS" BASIS,
  21418.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21419.  * See the License for the specific language governing permissions and
  21420.  * limitations under the License.
  21421.  * ========================================================= */
  21422.  
  21423. (function($, undefined){
  21424.  
  21425.     var $window = $(window);
  21426.  
  21427.     function UTCDate(){
  21428.         return new Date(Date.UTC.apply(Date, arguments));
  21429.     }
  21430.     function UTCToday(){
  21431.         var today = new Date();
  21432.         return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
  21433.     }
  21434.     function alias(method){
  21435.         return function(){
  21436.             return this[method].apply(this, arguments);
  21437.         };
  21438.     }
  21439.  
  21440.     var DateArray = (function(){
  21441.         var extras = {
  21442.             get: function(i){
  21443.                 return this.slice(i)[0];
  21444.             },
  21445.             contains: function(d){
  21446.                 // Array.indexOf is not cross-browser;
  21447.                 // $.inArray doesn't work with Dates
  21448.                 var val = d && d.valueOf();
  21449.                 for (var i=0, l=this.length; i < l; i++)
  21450.                     if (this[i].valueOf() === val)
  21451.                         return i;
  21452.                 return -1;
  21453.             },
  21454.             remove: function(i){
  21455.                 this.splice(i,1);
  21456.             },
  21457.             replace: function(new_array){
  21458.                 if (!new_array)
  21459.                     return;
  21460.                 if (!$.isArray(new_array))
  21461.                     new_array = [new_array];
  21462.                 this.clear();
  21463.                 this.push.apply(this, new_array);
  21464.             },
  21465.             clear: function(){
  21466.                 this.length = 0;
  21467.             },
  21468.             copy: function(){
  21469.                 var a = new DateArray();
  21470.                 a.replace(this);
  21471.                 return a;
  21472.             }
  21473.         };
  21474.  
  21475.         return function(){
  21476.             var a = [];
  21477.             a.push.apply(a, arguments);
  21478.             $.extend(a, extras);
  21479.             return a;
  21480.         };
  21481.     })();
  21482.  
  21483.  
  21484.     // Picker object
  21485.  
  21486.     var Datepicker = function(element, options){
  21487.         this.dates = new DateArray();
  21488.         this.viewDate = UTCToday();
  21489.         this.focusDate = null;
  21490.  
  21491.         this._process_options(options);
  21492.  
  21493.         this.element = $(element);
  21494.         this.isInline = false;
  21495.         this.isInput = this.element.is('input');
  21496.         this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
  21497.         this.hasInput = this.component && this.element.find('input').length;
  21498.         if (this.component && this.component.length === 0)
  21499.             this.component = false;
  21500.  
  21501.         this.picker = $(DPGlobal.template);
  21502.         this._buildEvents();
  21503.         this._attachEvents();
  21504.  
  21505.         if (this.isInline){
  21506.             this.picker.addClass('datepicker-inline').appendTo(this.element);
  21507.         }
  21508.         else {
  21509.             this.picker.addClass('datepicker-dropdown dropdown-menu');
  21510.         }
  21511.  
  21512.         if (this.o.rtl){
  21513.             this.picker.addClass('datepicker-rtl');
  21514.         }
  21515.  
  21516.         this.viewMode = this.o.startView;
  21517.  
  21518.         if (this.o.calendarWeeks)
  21519.             this.picker.find('tfoot th.today')
  21520.                         .attr('colspan', function(i, val){
  21521.                             return parseInt(val) + 1;
  21522.                         });
  21523.  
  21524.         this._allow_update = false;
  21525.  
  21526.         this.setStartDate(this._o.startDate);
  21527.         this.setEndDate(this._o.endDate);
  21528.         this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
  21529.  
  21530.         this.fillDow();
  21531.         this.fillMonths();
  21532.  
  21533.         this._allow_update = true;
  21534.  
  21535.         this.update();
  21536.         this.showMode();
  21537.  
  21538.         if (this.isInline){
  21539.             this.show();
  21540.         }
  21541.     };
  21542.  
  21543.     Datepicker.prototype = {
  21544.         constructor: Datepicker,
  21545.  
  21546.         _process_options: function(opts){
  21547.             // Store raw options for reference
  21548.             this._o = $.extend({}, this._o, opts);
  21549.             // Processed options
  21550.             var o = this.o = $.extend({}, this._o);
  21551.  
  21552.             // Check if "de-DE" style date is available, if not language should
  21553.             // fallback to 2 letter code eg "de"
  21554.             var lang = o.language;
  21555.             if (!dates[lang]){
  21556.                 lang = lang.split('-')[0];
  21557.                 if (!dates[lang])
  21558.                     lang = defaults.language;
  21559.             }
  21560.             o.language = lang;
  21561.  
  21562.             switch (o.startView){
  21563.                 case 2:
  21564.                 case 'decade':
  21565.                     o.startView = 2;
  21566.                     break;
  21567.                 case 1:
  21568.                 case 'year':
  21569.                     o.startView = 1;
  21570.                     break;
  21571.                 default:
  21572.                     o.startView = 0;
  21573.             }
  21574.  
  21575.             switch (o.minViewMode){
  21576.                 case 1:
  21577.                 case 'months':
  21578.                     o.minViewMode = 1;
  21579.                     break;
  21580.                 case 2:
  21581.                 case 'years':
  21582.                     o.minViewMode = 2;
  21583.                     break;
  21584.                 default:
  21585.                     o.minViewMode = 0;
  21586.             }
  21587.  
  21588.             o.startView = Math.max(o.startView, o.minViewMode);
  21589.  
  21590.             // true, false, or Number > 0
  21591.             if (o.multidate !== true){
  21592.                 o.multidate = Number(o.multidate) || false;
  21593.                 if (o.multidate !== false)
  21594.                     o.multidate = Math.max(0, o.multidate);
  21595.                 else
  21596.                     o.multidate = 1;
  21597.             }
  21598.             o.multidateSeparator = String(o.multidateSeparator);
  21599.  
  21600.             o.weekStart %= 7;
  21601.             o.weekEnd = ((o.weekStart + 6) % 7);
  21602.  
  21603.             var format = DPGlobal.parseFormat(o.format);
  21604.             if (o.startDate !== -Infinity){
  21605.                 if (!!o.startDate){
  21606.                     if (o.startDate instanceof Date)
  21607.                         o.startDate = this._local_to_utc(this._zero_time(o.startDate));
  21608.                     else
  21609.                         o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
  21610.                 }
  21611.                 else {
  21612.                     o.startDate = -Infinity;
  21613.                 }
  21614.             }
  21615.             if (o.endDate !== Infinity){
  21616.                 if (!!o.endDate){
  21617.                     if (o.endDate instanceof Date)
  21618.                         o.endDate = this._local_to_utc(this._zero_time(o.endDate));
  21619.                     else
  21620.                         o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
  21621.                 }
  21622.                 else {
  21623.                     o.endDate = Infinity;
  21624.                 }
  21625.             }
  21626.  
  21627.             o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
  21628.             if (!$.isArray(o.daysOfWeekDisabled))
  21629.                 o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
  21630.             o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
  21631.                 return parseInt(d, 10);
  21632.             });
  21633.  
  21634.             var plc = String(o.orientation).toLowerCase().split(/\s+/g),
  21635.                 _plc = o.orientation.toLowerCase();
  21636.             plc = $.grep(plc, function(word){
  21637.                 return (/^auto|left|right|top|bottom$/).test(word);
  21638.             });
  21639.             o.orientation = {x: 'auto', y: 'auto'};
  21640.             if (!_plc || _plc === 'auto')
  21641.                 ; // no action
  21642.             else if (plc.length === 1){
  21643.                 switch (plc[0]){
  21644.                     case 'top':
  21645.                     case 'bottom':
  21646.                         o.orientation.y = plc[0];
  21647.                         break;
  21648.                     case 'left':
  21649.                     case 'right':
  21650.                         o.orientation.x = plc[0];
  21651.                         break;
  21652.                 }
  21653.             }
  21654.             else {
  21655.                 _plc = $.grep(plc, function(word){
  21656.                     return (/^left|right$/).test(word);
  21657.                 });
  21658.                 o.orientation.x = _plc[0] || 'auto';
  21659.  
  21660.                 _plc = $.grep(plc, function(word){
  21661.                     return (/^top|bottom$/).test(word);
  21662.                 });
  21663.                 o.orientation.y = _plc[0] || 'auto';
  21664.             }
  21665.         },
  21666.         _events: [],
  21667.         _secondaryEvents: [],
  21668.         _applyEvents: function(evs){
  21669.             for (var i=0, el, ch, ev; i < evs.length; i++){
  21670.                 el = evs[i][0];
  21671.                 if (evs[i].length === 2){
  21672.                     ch = undefined;
  21673.                     ev = evs[i][1];
  21674.                 }
  21675.                 else if (evs[i].length === 3){
  21676.                     ch = evs[i][1];
  21677.                     ev = evs[i][2];
  21678.                 }
  21679.                 el.on(ev, ch);
  21680.             }
  21681.         },
  21682.         _unapplyEvents: function(evs){
  21683.             for (var i=0, el, ev, ch; i < evs.length; i++){
  21684.                 el = evs[i][0];
  21685.                 if (evs[i].length === 2){
  21686.                     ch = undefined;
  21687.                     ev = evs[i][1];
  21688.                 }
  21689.                 else if (evs[i].length === 3){
  21690.                     ch = evs[i][1];
  21691.                     ev = evs[i][2];
  21692.                 }
  21693.                 el.off(ev, ch);
  21694.             }
  21695.         },
  21696.         _buildEvents: function(){
  21697.             if (this.isInput){ // single input
  21698.                 this._events = [
  21699.                     [this.element, {
  21700.                         focus: $.proxy(this.show, this),
  21701.                         keyup: $.proxy(function(e){
  21702.                             if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
  21703.                                 this.update();
  21704.                         }, this),
  21705.                         keydown: $.proxy(this.keydown, this)
  21706.                     }]
  21707.                 ];
  21708.             }
  21709.             else if (this.component && this.hasInput){ // component: input + button
  21710.                 this._events = [
  21711.                     // For components that are not readonly, allow keyboard nav
  21712.                     [this.element.find('input'), {
  21713.                         focus: $.proxy(this.show, this),
  21714.                         keyup: $.proxy(function(e){
  21715.                             if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
  21716.                                 this.update();
  21717.                         }, this),
  21718.                         keydown: $.proxy(this.keydown, this)
  21719.                     }],
  21720.                     [this.component, {
  21721.                         click: $.proxy(this.show, this)
  21722.                     }]
  21723.                 ];
  21724.             }
  21725.             else if (this.element.is('div')){  // inline datepicker
  21726.                 this.isInline = true;
  21727.             }
  21728.             else {
  21729.                 this._events = [
  21730.                     [this.element, {
  21731.                         click: $.proxy(this.show, this)
  21732.                     }]
  21733.                 ];
  21734.             }
  21735.             this._events.push(
  21736.                 // Component: listen for blur on element descendants
  21737.                 [this.element, '*', {
  21738.                     blur: $.proxy(function(e){
  21739.                         this._focused_from = e.target;
  21740.                     }, this)
  21741.                 }],
  21742.                 // Input: listen for blur on element
  21743.                 [this.element, {
  21744.                     blur: $.proxy(function(e){
  21745.                         this._focused_from = e.target;
  21746.                     }, this)
  21747.                 }]
  21748.             );
  21749.  
  21750.             this._secondaryEvents = [
  21751.                 [this.picker, {
  21752.                     click: $.proxy(this.click, this)
  21753.                 }],
  21754.                 [$(window), {
  21755.                     resize: $.proxy(this.place, this)
  21756.                 }],
  21757.                 [$(document), {
  21758.                     'mousedown touchstart': $.proxy(function(e){
  21759.                         // Clicked outside the datepicker, hide it
  21760.                         if (!(
  21761.                             this.element.is(e.target) ||
  21762.                             this.element.find(e.target).length ||
  21763.                             this.picker.is(e.target) ||
  21764.                             this.picker.find(e.target).length
  21765.                         )){
  21766.                             this.hide();
  21767.                         }
  21768.                     }, this)
  21769.                 }]
  21770.             ];
  21771.         },
  21772.         _attachEvents: function(){
  21773.             this._detachEvents();
  21774.             this._applyEvents(this._events);
  21775.         },
  21776.         _detachEvents: function(){
  21777.             this._unapplyEvents(this._events);
  21778.         },
  21779.         _attachSecondaryEvents: function(){
  21780.             this._detachSecondaryEvents();
  21781.             this._applyEvents(this._secondaryEvents);
  21782.         },
  21783.         _detachSecondaryEvents: function(){
  21784.             this._unapplyEvents(this._secondaryEvents);
  21785.         },
  21786.         _trigger: function(event, altdate){
  21787.             var date = altdate || this.dates.get(-1),
  21788.                 local_date = this._utc_to_local(date);
  21789.  
  21790.             this.element.trigger({
  21791.                 type: event,
  21792.                 date: local_date,
  21793.                 dates: $.map(this.dates, this._utc_to_local),
  21794.                 format: $.proxy(function(ix, format){
  21795.                     if (arguments.length === 0){
  21796.                         ix = this.dates.length - 1;
  21797.                         format = this.o.format;
  21798.                     }
  21799.                     else if (typeof ix === 'string'){
  21800.                         format = ix;
  21801.                         ix = this.dates.length - 1;
  21802.                     }
  21803.                     format = format || this.o.format;
  21804.                     var date = this.dates.get(ix);
  21805.                     return DPGlobal.formatDate(date, format, this.o.language);
  21806.                 }, this)
  21807.             });
  21808.         },
  21809.  
  21810.         show: function(){
  21811.             if (!this.isInline)
  21812.                 this.picker.appendTo('body');
  21813.             this.picker.show();
  21814.             this.place();
  21815.             this._attachSecondaryEvents();
  21816.             this._trigger('show');
  21817.         },
  21818.  
  21819.         hide: function(){
  21820.             if (this.isInline)
  21821.                 return;
  21822.             if (!this.picker.is(':visible'))
  21823.                 return;
  21824.             this.focusDate = null;
  21825.             this.picker.hide().detach();
  21826.             this._detachSecondaryEvents();
  21827.             this.viewMode = this.o.startView;
  21828.             this.showMode();
  21829.  
  21830.             if (
  21831.                 this.o.forceParse &&
  21832.                 (
  21833.                     this.isInput && this.element.val() ||
  21834.                     this.hasInput && this.element.find('input').val()
  21835.                 )
  21836.             )
  21837.                 this.setValue();
  21838.             this._trigger('hide');
  21839.         },
  21840.  
  21841.         remove: function(){
  21842.             this.hide();
  21843.             this._detachEvents();
  21844.             this._detachSecondaryEvents();
  21845.             this.picker.remove();
  21846.             delete this.element.data().datepicker;
  21847.             if (!this.isInput){
  21848.                 delete this.element.data().date;
  21849.             }
  21850.         },
  21851.  
  21852.         _utc_to_local: function(utc){
  21853.             return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
  21854.         },
  21855.         _local_to_utc: function(local){
  21856.             return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
  21857.         },
  21858.         _zero_time: function(local){
  21859.             return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
  21860.         },
  21861.         _zero_utc_time: function(utc){
  21862.             return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
  21863.         },
  21864.  
  21865.         getDates: function(){
  21866.             return $.map(this.dates, this._utc_to_local);
  21867.         },
  21868.  
  21869.         getUTCDates: function(){
  21870.             return $.map(this.dates, function(d){
  21871.                 return new Date(d);
  21872.             });
  21873.         },
  21874.  
  21875.         getDate: function(){
  21876.             return this._utc_to_local(this.getUTCDate());
  21877.         },
  21878.  
  21879.         getUTCDate: function(){
  21880.             return new Date(this.dates.get(-1));
  21881.         },
  21882.  
  21883.         setDates: function(){
  21884.             var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
  21885.             this.update.apply(this, args);
  21886.             this._trigger('changeDate');
  21887.             this.setValue();
  21888.         },
  21889.  
  21890.         setUTCDates: function(){
  21891.             var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
  21892.             this.update.apply(this, $.map(args, this._utc_to_local));
  21893.             this._trigger('changeDate');
  21894.             this.setValue();
  21895.         },
  21896.  
  21897.         setDate: alias('setDates'),
  21898.         setUTCDate: alias('setUTCDates'),
  21899.  
  21900.         setValue: function(){
  21901.             var formatted = this.getFormattedDate();
  21902.             if (!this.isInput){
  21903.                 if (this.component){
  21904.                     this.element.find('input').val(formatted).change();
  21905.                 }
  21906.             }
  21907.             else {
  21908.                 this.element.val(formatted).change();
  21909.             }
  21910.         },
  21911.  
  21912.         getFormattedDate: function(format){
  21913.             if (format === undefined)
  21914.                 format = this.o.format;
  21915.  
  21916.             var lang = this.o.language;
  21917.             return $.map(this.dates, function(d){
  21918.                 return DPGlobal.formatDate(d, format, lang);
  21919.             }).join(this.o.multidateSeparator);
  21920.         },
  21921.  
  21922.         setStartDate: function(startDate){
  21923.             this._process_options({startDate: startDate});
  21924.             this.update();
  21925.             this.updateNavArrows();
  21926.         },
  21927.  
  21928.         setEndDate: function(endDate){
  21929.             this._process_options({endDate: endDate});
  21930.             this.update();
  21931.             this.updateNavArrows();
  21932.         },
  21933.  
  21934.         setDaysOfWeekDisabled: function(daysOfWeekDisabled){
  21935.             this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
  21936.             this.update();
  21937.             this.updateNavArrows();
  21938.         },
  21939.  
  21940.         place: function(){
  21941.             if (this.isInline)
  21942.                 return;
  21943.             var calendarWidth = this.picker.outerWidth(),
  21944.                 calendarHeight = this.picker.outerHeight(),
  21945.                 visualPadding = 10,
  21946.                 windowWidth = $window.width(),
  21947.                 windowHeight = $window.height(),
  21948.                 scrollTop = $window.scrollTop();
  21949.  
  21950.             var zIndex = parseInt(this.element.parents().filter(function(){
  21951.                     return $(this).css('z-index') !== 'auto';
  21952.                 }).first().css('z-index'))+10;
  21953.             var offset = this.component ? this.component.parent().offset() : this.element.offset();
  21954.             var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
  21955.             var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
  21956.             var left = offset.left,
  21957.                 top = offset.top;
  21958.  
  21959.             this.picker.removeClass(
  21960.                 'datepicker-orient-top datepicker-orient-bottom '+
  21961.                 'datepicker-orient-right datepicker-orient-left'
  21962.             );
  21963.  
  21964.             if (this.o.orientation.x !== 'auto'){
  21965.                 this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
  21966.                 if (this.o.orientation.x === 'right')
  21967.                     left -= calendarWidth - width;
  21968.             }
  21969.             // auto x orientation is best-placement: if it crosses a window
  21970.             // edge, fudge it sideways
  21971.             else {
  21972.                 // Default to left
  21973.                 this.picker.addClass('datepicker-orient-left');
  21974.                 if (offset.left < 0)
  21975.                     left -= offset.left - visualPadding;
  21976.                 else if (offset.left + calendarWidth > windowWidth)
  21977.                     left = windowWidth - calendarWidth - visualPadding;
  21978.             }
  21979.  
  21980.             // auto y orientation is best-situation: top or bottom, no fudging,
  21981.             // decision based on which shows more of the calendar
  21982.             var yorient = this.o.orientation.y,
  21983.                 top_overflow, bottom_overflow;
  21984.             if (yorient === 'auto'){
  21985.                 top_overflow = -scrollTop + offset.top - calendarHeight;
  21986.                 bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
  21987.                 if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
  21988.                     yorient = 'top';
  21989.                 else
  21990.                     yorient = 'bottom';
  21991.             }
  21992.             this.picker.addClass('datepicker-orient-' + yorient);
  21993.             if (yorient === 'top')
  21994.                 top += height;
  21995.             else
  21996.                 top -= calendarHeight + parseInt(this.picker.css('padding-top'));
  21997.  
  21998.             this.picker.css({
  21999.                 top: top,
  22000.                 left: left,
  22001.                 zIndex: zIndex
  22002.             });
  22003.         },
  22004.  
  22005.         _allow_update: true,
  22006.         update: function(){
  22007.             if (!this._allow_update)
  22008.                 return;
  22009.  
  22010.             var oldDates = this.dates.copy(),
  22011.                 dates = [],
  22012.                 fromArgs = false;
  22013.             if (arguments.length){
  22014.                 $.each(arguments, $.proxy(function(i, date){
  22015.                     if (date instanceof Date)
  22016.                         date = this._local_to_utc(date);
  22017.                     dates.push(date);
  22018.                 }, this));
  22019.                 fromArgs = true;
  22020.             }
  22021.             else {
  22022.                 dates = this.isInput
  22023.                         ? this.element.val()
  22024.                         : this.element.data('date') || this.element.find('input').val();
  22025.                 if (dates && this.o.multidate)
  22026.                     dates = dates.split(this.o.multidateSeparator);
  22027.                 else
  22028.                     dates = [dates];
  22029.                 delete this.element.data().date;
  22030.             }
  22031.  
  22032.             dates = $.map(dates, $.proxy(function(date){
  22033.                 return DPGlobal.parseDate(date, this.o.format, this.o.language);
  22034.             }, this));
  22035.             dates = $.grep(dates, $.proxy(function(date){
  22036.                 return (
  22037.                     date < this.o.startDate ||
  22038.                     date > this.o.endDate ||
  22039.                     !date
  22040.                 );
  22041.             }, this), true);
  22042.             this.dates.replace(dates);
  22043.  
  22044.             if (this.dates.length)
  22045.                 this.viewDate = new Date(this.dates.get(-1));
  22046.             else if (this.viewDate < this.o.startDate)
  22047.                 this.viewDate = new Date(this.o.startDate);
  22048.             else if (this.viewDate > this.o.endDate)
  22049.                 this.viewDate = new Date(this.o.endDate);
  22050.  
  22051.             if (fromArgs){
  22052.                 // setting date by clicking
  22053.                 this.setValue();
  22054.             }
  22055.             else if (dates.length){
  22056.                 // setting date by typing
  22057.                 if (String(oldDates) !== String(this.dates))
  22058.                     this._trigger('changeDate');
  22059.             }
  22060.             if (!this.dates.length && oldDates.length)
  22061.                 this._trigger('clearDate');
  22062.  
  22063.             this.fill();
  22064.         },
  22065.  
  22066.         fillDow: function(){
  22067.             var dowCnt = this.o.weekStart,
  22068.                 html = '<tr>';
  22069.             if (this.o.calendarWeeks){
  22070.                 var cell = '<th class="cw">&nbsp;</th>';
  22071.                 html += cell;
  22072.                 this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
  22073.             }
  22074.             while (dowCnt < this.o.weekStart + 7){
  22075.                 html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
  22076.             }
  22077.             html += '</tr>';
  22078.             this.picker.find('.datepicker-days thead').append(html);
  22079.         },
  22080.  
  22081.         fillMonths: function(){
  22082.             var html = '',
  22083.             i = 0;
  22084.             while (i < 12){
  22085.                 html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
  22086.             }
  22087.             this.picker.find('.datepicker-months td').html(html);
  22088.         },
  22089.  
  22090.         setRange: function(range){
  22091.             if (!range || !range.length)
  22092.                 delete this.range;
  22093.             else
  22094.                 this.range = $.map(range, function(d){
  22095.                     return d.valueOf();
  22096.                 });
  22097.             this.fill();
  22098.         },
  22099.  
  22100.         getClassNames: function(date){
  22101.             var cls = [],
  22102.                 year = this.viewDate.getUTCFullYear(),
  22103.                 month = this.viewDate.getUTCMonth(),
  22104.                 today = new Date();
  22105.             if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
  22106.                 cls.push('old');
  22107.             }
  22108.             else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
  22109.                 cls.push('new');
  22110.             }
  22111.             if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
  22112.                 cls.push('focused');
  22113.             // Compare internal UTC date with local today, not UTC today
  22114.             if (this.o.todayHighlight &&
  22115.                 date.getUTCFullYear() === today.getFullYear() &&
  22116.                 date.getUTCMonth() === today.getMonth() &&
  22117.                 date.getUTCDate() === today.getDate()){
  22118.                 cls.push('today');
  22119.             }
  22120.             if (this.dates.contains(date) !== -1)
  22121.                 cls.push('active');
  22122.             if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
  22123.                 $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
  22124.                 cls.push('disabled');
  22125.             }
  22126.             if (this.range){
  22127.                 if (date > this.range[0] && date < this.range[this.range.length-1]){
  22128.                     cls.push('range');
  22129.                 }
  22130.                 if ($.inArray(date.valueOf(), this.range) !== -1){
  22131.                     cls.push('selected');
  22132.                 }
  22133.             }
  22134.             return cls;
  22135.         },
  22136.  
  22137.         fill: function(){
  22138.             var d = new Date(this.viewDate),
  22139.                 year = d.getUTCFullYear(),
  22140.                 month = d.getUTCMonth(),
  22141.                 startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
  22142.                 startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
  22143.                 endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
  22144.                 endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
  22145.                 todaytxt = dates[this.o.language].today || dates['en'].today || '',
  22146.                 cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
  22147.                 tooltip;
  22148.             this.picker.find('.datepicker-days thead th.datepicker-switch')
  22149.                         .text(dates[this.o.language].months[month]+' '+year);
  22150.             this.picker.find('tfoot th.today')
  22151.                         .text(todaytxt)
  22152.                         .toggle(this.o.todayBtn !== false);
  22153.             this.picker.find('tfoot th.clear')
  22154.                         .text(cleartxt)
  22155.                         .toggle(this.o.clearBtn !== false);
  22156.             this.updateNavArrows();
  22157.             this.fillMonths();
  22158.             var prevMonth = UTCDate(year, month-1, 28),
  22159.                 day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
  22160.             prevMonth.setUTCDate(day);
  22161.             prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
  22162.             var nextMonth = new Date(prevMonth);
  22163.             nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
  22164.             nextMonth = nextMonth.valueOf();
  22165.             var html = [];
  22166.             var clsName;
  22167.             while (prevMonth.valueOf() < nextMonth){
  22168.                 if (prevMonth.getUTCDay() === this.o.weekStart){
  22169.                     html.push('<tr>');
  22170.                     if (this.o.calendarWeeks){
  22171.                         // ISO 8601: First week contains first thursday.
  22172.                         // ISO also states week starts on Monday, but we can be more abstract here.
  22173.                         var
  22174.                             // Start of current week: based on weekstart/current date
  22175.                             ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
  22176.                             // Thursday of this week
  22177.                             th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
  22178.                             // First Thursday of year, year from thursday
  22179.                             yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
  22180.                             // Calendar week: ms between thursdays, div ms per day, div 7 days
  22181.                             calWeek =  (th - yth) / 864e5 / 7 + 1;
  22182.                         html.push('<td class="cw">'+ calWeek +'</td>');
  22183.  
  22184.                     }
  22185.                 }
  22186.                 clsName = this.getClassNames(prevMonth);
  22187.                 clsName.push('day');
  22188.  
  22189.                 if (this.o.beforeShowDay !== $.noop){
  22190.                     var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
  22191.                     if (before === undefined)
  22192.                         before = {};
  22193.                     else if (typeof(before) === 'boolean')
  22194.                         before = {enabled: before};
  22195.                     else if (typeof(before) === 'string')
  22196.                         before = {classes: before};
  22197.                     if (before.enabled === false)
  22198.                         clsName.push('disabled');
  22199.                     if (before.classes)
  22200.                         clsName = clsName.concat(before.classes.split(/\s+/));
  22201.                     if (before.tooltip)
  22202.                         tooltip = before.tooltip;
  22203.                 }
  22204.  
  22205.                 clsName = $.unique(clsName);
  22206.                 html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
  22207.                 if (prevMonth.getUTCDay() === this.o.weekEnd){
  22208.                     html.push('</tr>');
  22209.                 }
  22210.                 prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
  22211.             }
  22212.             this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
  22213.  
  22214.             var months = this.picker.find('.datepicker-months')
  22215.                         .find('th:eq(1)')
  22216.                             .text(year)
  22217.                             .end()
  22218.                         .find('span').removeClass('active');
  22219.  
  22220.             $.each(this.dates, function(i, d){
  22221.                 if (d.getUTCFullYear() === year)
  22222.                     months.eq(d.getUTCMonth()).addClass('active');
  22223.             });
  22224.  
  22225.             if (year < startYear || year > endYear){
  22226.                 months.addClass('disabled');
  22227.             }
  22228.             if (year === startYear){
  22229.                 months.slice(0, startMonth).addClass('disabled');
  22230.             }
  22231.             if (year === endYear){
  22232.                 months.slice(endMonth+1).addClass('disabled');
  22233.             }
  22234.  
  22235.             html = '';
  22236.             year = parseInt(year/10, 10) * 10;
  22237.             var yearCont = this.picker.find('.datepicker-years')
  22238.                                 .find('th:eq(1)')
  22239.                                     .text(year + '-' + (year + 9))
  22240.                                     .end()
  22241.                                 .find('td');
  22242.             year -= 1;
  22243.             var years = $.map(this.dates, function(d){
  22244.                     return d.getUTCFullYear();
  22245.                 }),
  22246.                 classes;
  22247.             for (var i = -1; i < 11; i++){
  22248.                 classes = ['year'];
  22249.                 if (i === -1)
  22250.                     classes.push('old');
  22251.                 else if (i === 10)
  22252.                     classes.push('new');
  22253.                 if ($.inArray(year, years) !== -1)
  22254.                     classes.push('active');
  22255.                 if (year < startYear || year > endYear)
  22256.                     classes.push('disabled');
  22257.                 html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
  22258.                 year += 1;
  22259.             }
  22260.             yearCont.html(html);
  22261.         },
  22262.  
  22263.         updateNavArrows: function(){
  22264.             if (!this._allow_update)
  22265.                 return;
  22266.  
  22267.             var d = new Date(this.viewDate),
  22268.                 year = d.getUTCFullYear(),
  22269.                 month = d.getUTCMonth();
  22270.             switch (this.viewMode){
  22271.                 case 0:
  22272.                     if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
  22273.                         this.picker.find('.prev').css({visibility: 'hidden'});
  22274.                     }
  22275.                     else {
  22276.                         this.picker.find('.prev').css({visibility: 'visible'});
  22277.                     }
  22278.                     if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
  22279.                         this.picker.find('.next').css({visibility: 'hidden'});
  22280.                     }
  22281.                     else {
  22282.                         this.picker.find('.next').css({visibility: 'visible'});
  22283.                     }
  22284.                     break;
  22285.                 case 1:
  22286.                 case 2:
  22287.                     if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
  22288.                         this.picker.find('.prev').css({visibility: 'hidden'});
  22289.                     }
  22290.                     else {
  22291.                         this.picker.find('.prev').css({visibility: 'visible'});
  22292.                     }
  22293.                     if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
  22294.                         this.picker.find('.next').css({visibility: 'hidden'});
  22295.                     }
  22296.                     else {
  22297.                         this.picker.find('.next').css({visibility: 'visible'});
  22298.                     }
  22299.                     break;
  22300.             }
  22301.         },
  22302.  
  22303.         click: function(e){
  22304.             e.preventDefault();
  22305.             var target = $(e.target).closest('span, td, th'),
  22306.                 year, month, day;
  22307.             if (target.length === 1){
  22308.                 switch (target[0].nodeName.toLowerCase()){
  22309.                     case 'th':
  22310.                         switch (target[0].className){
  22311.                             case 'datepicker-switch':
  22312.                                 this.showMode(1);
  22313.                                 break;
  22314.                             case 'prev':
  22315.                             case 'next':
  22316.                                 var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
  22317.                                 switch (this.viewMode){
  22318.                                     case 0:
  22319.                                         this.viewDate = this.moveMonth(this.viewDate, dir);
  22320.                                         this._trigger('changeMonth', this.viewDate);
  22321.                                         break;
  22322.                                     case 1:
  22323.                                     case 2:
  22324.                                         this.viewDate = this.moveYear(this.viewDate, dir);
  22325.                                         if (this.viewMode === 1)
  22326.                                             this._trigger('changeYear', this.viewDate);
  22327.                                         break;
  22328.                                 }
  22329.                                 this.fill();
  22330.                                 break;
  22331.                             case 'today':
  22332.                                 var date = new Date();
  22333.                                 date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  22334.  
  22335.                                 this.showMode(-2);
  22336.                                 var which = this.o.todayBtn === 'linked' ? null : 'view';
  22337.                                 this._setDate(date, which);
  22338.                                 break;
  22339.                             case 'clear':
  22340.                                 var element;
  22341.                                 if (this.isInput)
  22342.                                     element = this.element;
  22343.                                 else if (this.component)
  22344.                                     element = this.element.find('input');
  22345.                                 if (element)
  22346.                                     element.val("").change();
  22347.                                 this.update();
  22348.                                 this._trigger('changeDate');
  22349.                                 if (this.o.autoclose)
  22350.                                     this.hide();
  22351.                                 break;
  22352.                         }
  22353.                         break;
  22354.                     case 'span':
  22355.                         if (!target.is('.disabled')){
  22356.                             this.viewDate.setUTCDate(1);
  22357.                             if (target.is('.month')){
  22358.                                 day = 1;
  22359.                                 month = target.parent().find('span').index(target);
  22360.                                 year = this.viewDate.getUTCFullYear();
  22361.                                 this.viewDate.setUTCMonth(month);
  22362.                                 this._trigger('changeMonth', this.viewDate);
  22363.                                 if (this.o.minViewMode === 1){
  22364.                                     this._setDate(UTCDate(year, month, day));
  22365.                                 }
  22366.                             }
  22367.                             else {
  22368.                                 day = 1;
  22369.                                 month = 0;
  22370.                                 year = parseInt(target.text(), 10)||0;
  22371.                                 this.viewDate.setUTCFullYear(year);
  22372.                                 this._trigger('changeYear', this.viewDate);
  22373.                                 if (this.o.minViewMode === 2){
  22374.                                     this._setDate(UTCDate(year, month, day));
  22375.                                 }
  22376.                             }
  22377.                             this.showMode(-1);
  22378.                             this.fill();
  22379.                         }
  22380.                         break;
  22381.                     case 'td':
  22382.                         if (target.is('.day') && !target.is('.disabled')){
  22383.                             day = parseInt(target.text(), 10)||1;
  22384.                             year = this.viewDate.getUTCFullYear();
  22385.                             month = this.viewDate.getUTCMonth();
  22386.                             if (target.is('.old')){
  22387.                                 if (month === 0){
  22388.                                     month = 11;
  22389.                                     year -= 1;
  22390.                                 }
  22391.                                 else {
  22392.                                     month -= 1;
  22393.                                 }
  22394.                             }
  22395.                             else if (target.is('.new')){
  22396.                                 if (month === 11){
  22397.                                     month = 0;
  22398.                                     year += 1;
  22399.                                 }
  22400.                                 else {
  22401.                                     month += 1;
  22402.                                 }
  22403.                             }
  22404.                             this._setDate(UTCDate(year, month, day));
  22405.                         }
  22406.                         break;
  22407.                 }
  22408.             }
  22409.             if (this.picker.is(':visible') && this._focused_from){
  22410.                 $(this._focused_from).focus();
  22411.             }
  22412.             delete this._focused_from;
  22413.         },
  22414.  
  22415.         _toggle_multidate: function(date){
  22416.             var ix = this.dates.contains(date);
  22417.             if (!date){
  22418.                 this.dates.clear();
  22419.             }
  22420.             if (this.o.multidate === 1 && ix === 0){
  22421.                 // single datepicker, don't remove selected date
  22422.             }
  22423.             else if (ix !== -1){
  22424.                 this.dates.remove(ix);
  22425.             }
  22426.             else {
  22427.                 this.dates.push(date);
  22428.             }
  22429.             if (typeof this.o.multidate === 'number')
  22430.                 while (this.dates.length > this.o.multidate)
  22431.                     this.dates.remove(0);
  22432.         },
  22433.  
  22434.         _setDate: function(date, which){
  22435.             if (!which || which === 'date')
  22436.                 this._toggle_multidate(date && new Date(date));
  22437.             if (!which || which  === 'view')
  22438.                 this.viewDate = date && new Date(date);
  22439.  
  22440.             this.fill();
  22441.             this.setValue();
  22442.             this._trigger('changeDate');
  22443.             var element;
  22444.             if (this.isInput){
  22445.                 element = this.element;
  22446.             }
  22447.             else if (this.component){
  22448.                 element = this.element.find('input');
  22449.             }
  22450.             if (element){
  22451.                 element.change();
  22452.             }
  22453.             if (this.o.autoclose && (!which || which === 'date')){
  22454.                 this.hide();
  22455.             }
  22456.         },
  22457.  
  22458.         moveMonth: function(date, dir){
  22459.             if (!date)
  22460.                 return undefined;
  22461.             if (!dir)
  22462.                 return date;
  22463.             var new_date = new Date(date.valueOf()),
  22464.                 day = new_date.getUTCDate(),
  22465.                 month = new_date.getUTCMonth(),
  22466.                 mag = Math.abs(dir),
  22467.                 new_month, test;
  22468.             dir = dir > 0 ? 1 : -1;
  22469.             if (mag === 1){
  22470.                 test = dir === -1
  22471.                     // If going back one month, make sure month is not current month
  22472.                     // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
  22473.                     ? function(){
  22474.                         return new_date.getUTCMonth() === month;
  22475.                     }
  22476.                     // If going forward one month, make sure month is as expected
  22477.                     // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
  22478.                     : function(){
  22479.                         return new_date.getUTCMonth() !== new_month;
  22480.                     };
  22481.                 new_month = month + dir;
  22482.                 new_date.setUTCMonth(new_month);
  22483.                 // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
  22484.                 if (new_month < 0 || new_month > 11)
  22485.                     new_month = (new_month + 12) % 12;
  22486.             }
  22487.             else {
  22488.                 // For magnitudes >1, move one month at a time...
  22489.                 for (var i=0; i < mag; i++)
  22490.                     // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
  22491.                     new_date = this.moveMonth(new_date, dir);
  22492.                 // ...then reset the day, keeping it in the new month
  22493.                 new_month = new_date.getUTCMonth();
  22494.                 new_date.setUTCDate(day);
  22495.                 test = function(){
  22496.                     return new_month !== new_date.getUTCMonth();
  22497.                 };
  22498.             }
  22499.             // Common date-resetting loop -- if date is beyond end of month, make it
  22500.             // end of month
  22501.             while (test()){
  22502.                 new_date.setUTCDate(--day);
  22503.                 new_date.setUTCMonth(new_month);
  22504.             }
  22505.             return new_date;
  22506.         },
  22507.  
  22508.         moveYear: function(date, dir){
  22509.             return this.moveMonth(date, dir*12);
  22510.         },
  22511.  
  22512.         dateWithinRange: function(date){
  22513.             return date >= this.o.startDate && date <= this.o.endDate;
  22514.         },
  22515.  
  22516.         keydown: function(e){
  22517.             if (this.picker.is(':not(:visible)')){
  22518.                 if (e.keyCode === 27) // allow escape to hide and re-show picker
  22519.                     this.show();
  22520.                 return;
  22521.             }
  22522.             var dateChanged = false,
  22523.                 dir, newDate, newViewDate,
  22524.                 focusDate = this.focusDate || this.viewDate;
  22525.             switch (e.keyCode){
  22526.                 case 27: // escape
  22527.                     if (this.focusDate){
  22528.                         this.focusDate = null;
  22529.                         this.viewDate = this.dates.get(-1) || this.viewDate;
  22530.                         this.fill();
  22531.                     }
  22532.                     else
  22533.                         this.hide();
  22534.                     e.preventDefault();
  22535.                     break;
  22536.                 case 37: // left
  22537.                 case 39: // right
  22538.                     if (!this.o.keyboardNavigation)
  22539.                         break;
  22540.                     dir = e.keyCode === 37 ? -1 : 1;
  22541.                     if (e.ctrlKey){
  22542.                         newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
  22543.                         newViewDate = this.moveYear(focusDate, dir);
  22544.                         this._trigger('changeYear', this.viewDate);
  22545.                     }
  22546.                     else if (e.shiftKey){
  22547.                         newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
  22548.                         newViewDate = this.moveMonth(focusDate, dir);
  22549.                         this._trigger('changeMonth', this.viewDate);
  22550.                     }
  22551.                     else {
  22552.                         newDate = new Date(this.dates.get(-1) || UTCToday());
  22553.                         newDate.setUTCDate(newDate.getUTCDate() + dir);
  22554.                         newViewDate = new Date(focusDate);
  22555.                         newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
  22556.                     }
  22557.                     if (this.dateWithinRange(newDate)){
  22558.                         this.focusDate = this.viewDate = newViewDate;
  22559.                         this.setValue();
  22560.                         this.fill();
  22561.                         e.preventDefault();
  22562.                     }
  22563.                     break;
  22564.                 case 38: // up
  22565.                 case 40: // down
  22566.                     if (!this.o.keyboardNavigation)
  22567.                         break;
  22568.                     dir = e.keyCode === 38 ? -1 : 1;
  22569.                     if (e.ctrlKey){
  22570.                         newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
  22571.                         newViewDate = this.moveYear(focusDate, dir);
  22572.                         this._trigger('changeYear', this.viewDate);
  22573.                     }
  22574.                     else if (e.shiftKey){
  22575.                         newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
  22576.                         newViewDate = this.moveMonth(focusDate, dir);
  22577.                         this._trigger('changeMonth', this.viewDate);
  22578.                     }
  22579.                     else {
  22580.                         newDate = new Date(this.dates.get(-1) || UTCToday());
  22581.                         newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
  22582.                         newViewDate = new Date(focusDate);
  22583.                         newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
  22584.                     }
  22585.                     if (this.dateWithinRange(newDate)){
  22586.                         this.focusDate = this.viewDate = newViewDate;
  22587.                         this.setValue();
  22588.                         this.fill();
  22589.                         e.preventDefault();
  22590.                     }
  22591.                     break;
  22592.                 case 32: // spacebar
  22593.                     // Spacebar is used in manually typing dates in some formats.
  22594.                     // As such, its behavior should not be hijacked.
  22595.                     break;
  22596.                 case 13: // enter
  22597.                     focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
  22598.                     this._toggle_multidate(focusDate);
  22599.                     dateChanged = true;
  22600.                     this.focusDate = null;
  22601.                     this.viewDate = this.dates.get(-1) || this.viewDate;
  22602.                     this.setValue();
  22603.                     this.fill();
  22604.                     if (this.picker.is(':visible')){
  22605.                         e.preventDefault();
  22606.                         if (this.o.autoclose)
  22607.                             this.hide();
  22608.                     }
  22609.                     break;
  22610.                 case 9: // tab
  22611.                     this.focusDate = null;
  22612.                     this.viewDate = this.dates.get(-1) || this.viewDate;
  22613.                     this.fill();
  22614.                     this.hide();
  22615.                     break;
  22616.             }
  22617.             if (dateChanged){
  22618.                 if (this.dates.length)
  22619.                     this._trigger('changeDate');
  22620.                 else
  22621.                     this._trigger('clearDate');
  22622.                 var element;
  22623.                 if (this.isInput){
  22624.                     element = this.element;
  22625.                 }
  22626.                 else if (this.component){
  22627.                     element = this.element.find('input');
  22628.                 }
  22629.                 if (element){
  22630.                     element.change();
  22631.                 }
  22632.             }
  22633.         },
  22634.  
  22635.         showMode: function(dir){
  22636.             if (dir){
  22637.                 this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
  22638.             }
  22639.             this.picker
  22640.                 .find('>div')
  22641.                 .hide()
  22642.                 .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
  22643.                     .css('display', 'block');
  22644.             this.updateNavArrows();
  22645.         }
  22646.     };
  22647.  
  22648.     var DateRangePicker = function(element, options){
  22649.         this.element = $(element);
  22650.         this.inputs = $.map(options.inputs, function(i){
  22651.             return i.jquery ? i[0] : i;
  22652.         });
  22653.         delete options.inputs;
  22654.  
  22655.         $(this.inputs)
  22656.             .datepicker(options)
  22657.             .bind('changeDate', $.proxy(this.dateUpdated, this));
  22658.  
  22659.         this.pickers = $.map(this.inputs, function(i){
  22660.             return $(i).data('datepicker');
  22661.         });
  22662.         this.updateDates();
  22663.     };
  22664.     DateRangePicker.prototype = {
  22665.         updateDates: function(){
  22666.             this.dates = $.map(this.pickers, function(i){
  22667.                 return i.getUTCDate();
  22668.             });
  22669.             this.updateRanges();
  22670.         },
  22671.         updateRanges: function(){
  22672.             var range = $.map(this.dates, function(d){
  22673.                 return d.valueOf();
  22674.             });
  22675.             $.each(this.pickers, function(i, p){
  22676.                 p.setRange(range);
  22677.             });
  22678.         },
  22679.         dateUpdated: function(e){
  22680.             // `this.updating` is a workaround for preventing infinite recursion
  22681.             // between `changeDate` triggering and `setUTCDate` calling.  Until
  22682.             // there is a better mechanism.
  22683.             if (this.updating)
  22684.                 return;
  22685.             this.updating = true;
  22686.  
  22687.             var dp = $(e.target).data('datepicker'),
  22688.                 new_date = dp.getUTCDate(),
  22689.                 i = $.inArray(e.target, this.inputs),
  22690.                 l = this.inputs.length;
  22691.             if (i === -1)
  22692.                 return;
  22693.  
  22694.             $.each(this.pickers, function(i, p){
  22695.                 if (!p.getUTCDate())
  22696.                     p.setUTCDate(new_date);
  22697.             });
  22698.  
  22699.             if (new_date < this.dates[i]){
  22700.                 // Date being moved earlier/left
  22701.                 while (i >= 0 && new_date < this.dates[i]){
  22702.                     this.pickers[i--].setUTCDate(new_date);
  22703.                 }
  22704.             }
  22705.             else if (new_date > this.dates[i]){
  22706.                 // Date being moved later/right
  22707.                 while (i < l && new_date > this.dates[i]){
  22708.                     this.pickers[i++].setUTCDate(new_date);
  22709.                 }
  22710.             }
  22711.             this.updateDates();
  22712.  
  22713.             delete this.updating;
  22714.         },
  22715.         remove: function(){
  22716.             $.map(this.pickers, function(p){ p.remove(); });
  22717.             delete this.element.data().datepicker;
  22718.         }
  22719.     };
  22720.  
  22721.     function opts_from_el(el, prefix){
  22722.         // Derive options from element data-attrs
  22723.         var data = $(el).data(),
  22724.             out = {}, inkey,
  22725.             replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
  22726.         prefix = new RegExp('^' + prefix.toLowerCase());
  22727.         function re_lower(_,a){
  22728.             return a.toLowerCase();
  22729.         }
  22730.         for (var key in data)
  22731.             if (prefix.test(key)){
  22732.                 inkey = key.replace(replace, re_lower);
  22733.                 out[inkey] = data[key];
  22734.             }
  22735.         return out;
  22736.     }
  22737.  
  22738.     function opts_from_locale(lang){
  22739.         // Derive options from locale plugins
  22740.         var out = {};
  22741.         // Check if "de-DE" style date is available, if not language should
  22742.         // fallback to 2 letter code eg "de"
  22743.         if (!dates[lang]){
  22744.             lang = lang.split('-')[0];
  22745.             if (!dates[lang])
  22746.                 return;
  22747.         }
  22748.         var d = dates[lang];
  22749.         $.each(locale_opts, function(i,k){
  22750.             if (k in d)
  22751.                 out[k] = d[k];
  22752.         });
  22753.         return out;
  22754.     }
  22755.  
  22756.     var old = $.fn.datepicker;
  22757.     $.fn.datepicker = function(option){
  22758.         var args = Array.apply(null, arguments);
  22759.         args.shift();
  22760.         var internal_return;
  22761.         this.each(function(){
  22762.             var $this = $(this),
  22763.                 data = $this.data('datepicker'),
  22764.                 options = typeof option === 'object' && option;
  22765.             if (!data){
  22766.                 var elopts = opts_from_el(this, 'date'),
  22767.                     // Preliminary otions
  22768.                     xopts = $.extend({}, defaults, elopts, options),
  22769.                     locopts = opts_from_locale(xopts.language),
  22770.                     // Options priority: js args, data-attrs, locales, defaults
  22771.                     opts = $.extend({}, defaults, locopts, elopts, options);
  22772.                 if ($this.is('.input-daterange') || opts.inputs){
  22773.                     var ropts = {
  22774.                         inputs: opts.inputs || $this.find('input').toArray()
  22775.                     };
  22776.                     $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
  22777.                 }
  22778.                 else {
  22779.                     $this.data('datepicker', (data = new Datepicker(this, opts)));
  22780.                 }
  22781.             }
  22782.             if (typeof option === 'string' && typeof data[option] === 'function'){
  22783.                 internal_return = data[option].apply(data, args);
  22784.                 if (internal_return !== undefined)
  22785.                     return false;
  22786.             }
  22787.         });
  22788.         if (internal_return !== undefined)
  22789.             return internal_return;
  22790.         else
  22791.             return this;
  22792.     };
  22793.  
  22794.     var defaults = $.fn.datepicker.defaults = {
  22795.         autoclose: false,
  22796.         beforeShowDay: $.noop,
  22797.         calendarWeeks: false,
  22798.         clearBtn: false,
  22799.         daysOfWeekDisabled: [],
  22800.         endDate: Infinity,
  22801.         forceParse: true,
  22802.         format: 'mm/dd/yyyy',
  22803.         keyboardNavigation: true,
  22804.         language: 'en',
  22805.         minViewMode: 0,
  22806.         multidate: false,
  22807.         multidateSeparator: ',',
  22808.         orientation: "auto",
  22809.         rtl: false,
  22810.         startDate: -Infinity,
  22811.         startView: 0,
  22812.         todayBtn: false,
  22813.         todayHighlight: false,
  22814.         weekStart: 0
  22815.     };
  22816.     var locale_opts = $.fn.datepicker.locale_opts = [
  22817.         'format',
  22818.         'rtl',
  22819.         'weekStart'
  22820.     ];
  22821.     $.fn.datepicker.Constructor = Datepicker;
  22822.     var dates = $.fn.datepicker.dates = {
  22823.         en: {
  22824.             days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
  22825.             daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  22826.             daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
  22827.             months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  22828.             monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  22829.             today: "Today",
  22830.             clear: "Clear"
  22831.         }
  22832.     };
  22833.  
  22834.     var DPGlobal = {
  22835.         modes: [
  22836.             {
  22837.                 clsName: 'days',
  22838.                 navFnc: 'Month',
  22839.                 navStep: 1
  22840.             },
  22841.             {
  22842.                 clsName: 'months',
  22843.                 navFnc: 'FullYear',
  22844.                 navStep: 1
  22845.             },
  22846.             {
  22847.                 clsName: 'years',
  22848.                 navFnc: 'FullYear',
  22849.                 navStep: 10
  22850.         }],
  22851.         isLeapYear: function(year){
  22852.             return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
  22853.         },
  22854.         getDaysInMonth: function(year, month){
  22855.             return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  22856.         },
  22857.         validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
  22858.         nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
  22859.         parseFormat: function(format){
  22860.             // IE treats \0 as a string end in inputs (truncating the value),
  22861.             // so it's a bad format delimiter, anyway
  22862.             var separators = format.replace(this.validParts, '\0').split('\0'),
  22863.                 parts = format.match(this.validParts);
  22864.             if (!separators || !separators.length || !parts || parts.length === 0){
  22865.                 throw new Error("Invalid date format.");
  22866.             }
  22867.             return {separators: separators, parts: parts};
  22868.         },
  22869.         parseDate: function(date, format, language){
  22870.             if (!date)
  22871.                 return undefined;
  22872.             if (date instanceof Date)
  22873.                 return date;
  22874.             if (typeof format === 'string')
  22875.                 format = DPGlobal.parseFormat(format);
  22876.             var part_re = /([\-+]\d+)([dmwy])/,
  22877.                 parts = date.match(/([\-+]\d+)([dmwy])/g),
  22878.                 part, dir, i;
  22879.             if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
  22880.                 date = new Date();
  22881.                 for (i=0; i < parts.length; i++){
  22882.                     part = part_re.exec(parts[i]);
  22883.                     dir = parseInt(part[1]);
  22884.                     switch (part[2]){
  22885.                         case 'd':
  22886.                             date.setUTCDate(date.getUTCDate() + dir);
  22887.                             break;
  22888.                         case 'm':
  22889.                             date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
  22890.                             break;
  22891.                         case 'w':
  22892.                             date.setUTCDate(date.getUTCDate() + dir * 7);
  22893.                             break;
  22894.                         case 'y':
  22895.                             date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
  22896.                             break;
  22897.                     }
  22898.                 }
  22899.                 return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
  22900.             }
  22901.             parts = date && date.match(this.nonpunctuation) || [];
  22902.             date = new Date();
  22903.             var parsed = {},
  22904.                 setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
  22905.                 setters_map = {
  22906.                     yyyy: function(d,v){
  22907.                         return d.setUTCFullYear(v);
  22908.                     },
  22909.                     yy: function(d,v){
  22910.                         return d.setUTCFullYear(2000+v);
  22911.                     },
  22912.                     m: function(d,v){
  22913.                         if (isNaN(d))
  22914.                             return d;
  22915.                         v -= 1;
  22916.                         while (v < 0) v += 12;
  22917.                         v %= 12;
  22918.                         d.setUTCMonth(v);
  22919.                         while (d.getUTCMonth() !== v)
  22920.                             d.setUTCDate(d.getUTCDate()-1);
  22921.                         return d;
  22922.                     },
  22923.                     d: function(d,v){
  22924.                         return d.setUTCDate(v);
  22925.                     }
  22926.                 },
  22927.                 val, filtered;
  22928.             setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
  22929.             setters_map['dd'] = setters_map['d'];
  22930.             date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  22931.             var fparts = format.parts.slice();
  22932.             // Remove noop parts
  22933.             if (parts.length !== fparts.length){
  22934.                 fparts = $(fparts).filter(function(i,p){
  22935.                     return $.inArray(p, setters_order) !== -1;
  22936.                 }).toArray();
  22937.             }
  22938.             // Process remainder
  22939.             function match_part(){
  22940.                 var m = this.slice(0, parts[i].length),
  22941.                     p = parts[i].slice(0, m.length);
  22942.                 return m === p;
  22943.             }
  22944.             if (parts.length === fparts.length){
  22945.                 var cnt;
  22946.                 for (i=0, cnt = fparts.length; i < cnt; i++){
  22947.                     val = parseInt(parts[i], 10);
  22948.                     part = fparts[i];
  22949.                     if (isNaN(val)){
  22950.                         switch (part){
  22951.                             case 'MM':
  22952.                                 filtered = $(dates[language].months).filter(match_part);
  22953.                                 val = $.inArray(filtered[0], dates[language].months) + 1;
  22954.                                 break;
  22955.                             case 'M':
  22956.                                 filtered = $(dates[language].monthsShort).filter(match_part);
  22957.                                 val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
  22958.                                 break;
  22959.                         }
  22960.                     }
  22961.                     parsed[part] = val;
  22962.                 }
  22963.                 var _date, s;
  22964.                 for (i=0; i < setters_order.length; i++){
  22965.                     s = setters_order[i];
  22966.                     if (s in parsed && !isNaN(parsed[s])){
  22967.                         _date = new Date(date);
  22968.                         setters_map[s](_date, parsed[s]);
  22969.                         if (!isNaN(_date))
  22970.                             date = _date;
  22971.                     }
  22972.                 }
  22973.             }
  22974.             return date;
  22975.         },
  22976.         formatDate: function(date, format, language){
  22977.             if (!date)
  22978.                 return '';
  22979.             if (typeof format === 'string')
  22980.                 format = DPGlobal.parseFormat(format);
  22981.             var val = {
  22982.                 d: date.getUTCDate(),
  22983.                 D: dates[language].daysShort[date.getUTCDay()],
  22984.                 DD: dates[language].days[date.getUTCDay()],
  22985.                 m: date.getUTCMonth() + 1,
  22986.                 M: dates[language].monthsShort[date.getUTCMonth()],
  22987.                 MM: dates[language].months[date.getUTCMonth()],
  22988.                 yy: date.getUTCFullYear().toString().substring(2),
  22989.                 yyyy: date.getUTCFullYear()
  22990.             };
  22991.             val.dd = (val.d < 10 ? '0' : '') + val.d;
  22992.             val.mm = (val.m < 10 ? '0' : '') + val.m;
  22993.             date = [];
  22994.             var seps = $.extend([], format.separators);
  22995.             for (var i=0, cnt = format.parts.length; i <= cnt; i++){
  22996.                 if (seps.length)
  22997.                     date.push(seps.shift());
  22998.                 date.push(val[format.parts[i]]);
  22999.             }
  23000.             return date.join('');
  23001.         },
  23002.         headTemplate: '<thead>'+
  23003.                             '<tr>'+
  23004.                                 '<th class="prev">&laquo;</th>'+
  23005.                                 '<th colspan="5" class="datepicker-switch"></th>'+
  23006.                                 '<th class="next">&raquo;</th>'+
  23007.                             '</tr>'+
  23008.                         '</thead>',
  23009.         contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
  23010.         footTemplate: '<tfoot>'+
  23011.                             '<tr>'+
  23012.                                 '<th colspan="7" class="today"></th>'+
  23013.                             '</tr>'+
  23014.                             '<tr>'+
  23015.                                 '<th colspan="7" class="clear"></th>'+
  23016.                             '</tr>'+
  23017.                         '</tfoot>'
  23018.     };
  23019.     DPGlobal.template = '<div class="datepicker">'+
  23020.                             '<div class="datepicker-days">'+
  23021.                                 '<table class=" table-condensed">'+
  23022.                                     DPGlobal.headTemplate+
  23023.                                     '<tbody></tbody>'+
  23024.                                     DPGlobal.footTemplate+
  23025.                                 '</table>'+
  23026.                             '</div>'+
  23027.                             '<div class="datepicker-months">'+
  23028.                                 '<table class="table-condensed">'+
  23029.                                     DPGlobal.headTemplate+
  23030.                                     DPGlobal.contTemplate+
  23031.                                     DPGlobal.footTemplate+
  23032.                                 '</table>'+
  23033.                             '</div>'+
  23034.                             '<div class="datepicker-years">'+
  23035.                                 '<table class="table-condensed">'+
  23036.                                     DPGlobal.headTemplate+
  23037.                                     DPGlobal.contTemplate+
  23038.                                     DPGlobal.footTemplate+
  23039.                                 '</table>'+
  23040.                             '</div>'+
  23041.                         '</div>';
  23042.  
  23043.     $.fn.datepicker.DPGlobal = DPGlobal;
  23044.  
  23045.  
  23046.     /* DATEPICKER NO CONFLICT
  23047.     * =================== */
  23048.  
  23049.     $.fn.datepicker.noConflict = function(){
  23050.         $.fn.datepicker = old;
  23051.         return this;
  23052.     };
  23053.  
  23054.  
  23055.     /* DATEPICKER DATA-API
  23056.     * ================== */
  23057.  
  23058.     $(document).on(
  23059.         'focus.datepicker.data-api click.datepicker.data-api',
  23060.         '[data-provide="datepicker"]',
  23061.         function(e){
  23062.             var $this = $(this);
  23063.             if ($this.data('datepicker'))
  23064.                 return;
  23065.             e.preventDefault();
  23066.             // component click requires us to explicitly show it
  23067.             $this.datepicker('show');
  23068.         }
  23069.     );
  23070.     $(function(){
  23071.         $('[data-provide="datepicker-inline"]').datepicker();
  23072.     });
  23073.  
  23074. }(window.jQuery));
  23075. ;/**
  23076.  * German translation for bootstrap-datepicker
  23077.  * Sam Zurcher <sam@orelias.ch>
  23078.  */
  23079. ;(function($){
  23080.     $.fn.datepicker.dates['de'] = {
  23081.         days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
  23082.         daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
  23083.         daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
  23084.         months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
  23085.         monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
  23086.         today: "Heute",
  23087.         clear: "Löschen",
  23088.         weekStart: 1,
  23089.         format: "dd.mm.yyyy"
  23090.     };
  23091. }(jQuery));
  23092. ;var openinghours = (function () {
  23093.     var my = {};
  23094.  
  23095.     var _days = {
  23096.         'mo': 'Montag',
  23097.         'di': 'Dienstag',
  23098.         'mi': 'Mittwoch',
  23099.         'do': 'Donnerstag',
  23100.         'fr': 'Freitag',
  23101.         'sa': 'Samstag',
  23102.         'so': 'Sonntag'
  23103.     };
  23104.  
  23105.     var _index = 1;
  23106.  
  23107.     my.parse = function (element, options) {
  23108.         var val = $(element).val(), found = [], i, line, d, d2, matches, time, hours, t, foundDay, foundTime, regEx;
  23109.  
  23110.         // each line is one statement
  23111.         val = val.toLowerCase().split("\n");
  23112.         for (i = 0; i < val.length; i++) {
  23113.             time = '';
  23114.             line = val[i];
  23115.             foundDay = false;
  23116.             foundTime = false;
  23117.  
  23118.             // find start day
  23119.             for (d in _days) {
  23120.                 regEx = new RegExp('^\\s*(' + d + '|' + _days[d] + ')\\s*([:-])', 'i');
  23121.                 if (matches = line.match(regEx)) {
  23122.                     time += _days[d];
  23123.                     foundDay = true;
  23124.  
  23125.                     // second day required
  23126.                     if (matches[2] == '-') {
  23127.                         for (d2 in _days) {
  23128.                             if (d2 == d) {
  23129.                                 // makes no sense
  23130.                                 continue;
  23131.                             }
  23132.                             regEx = new RegExp('-\\s*(' + d2 + '|' + _days[d2] + ')\\s*:', 'i');
  23133.                             if (matches = line.match(regEx)) {
  23134.                                 time += ' - ' + _days[d2];
  23135.                             }
  23136.                         }
  23137.                     }
  23138.                 }
  23139.             }
  23140.  
  23141.             hours = [];
  23142.             regEx = /[:,]\s*(\d\d?)(?::(\d\d?))?-(\d\d?)(?::(\d\d?))?/g;
  23143.             while (matches = regEx.exec(line)) {
  23144.                 t = (matches[1].length < 2 ? '0' : '') + matches[1] + ':';
  23145.                 if (matches[2]) {
  23146.                     t += (matches[2].length < 2 ? '0' : '') + matches[2];
  23147.                 } else {
  23148.                     t += '00';
  23149.                 }
  23150.                 t += ' - ' + (matches[3].length < 2 ? '0' : '') + matches[3] + ':';
  23151.                 if (matches[4]) {
  23152.                     t += (matches[4].length < 2 ? '0' : '') + matches[4];
  23153.                 } else {
  23154.                     t += '00';
  23155.                 }
  23156.                 hours.push(t);
  23157.                 foundTime = true;
  23158.             }
  23159.  
  23160.             // other
  23161.             if (line.match(/\D:\s*(Ruhe|geschl)/i)) {
  23162.                 hours.push('geschlossen');
  23163.                 foundTime = true;
  23164.             }
  23165.  
  23166.             if (foundDay && foundTime) {
  23167.                 time += ': ' + hours.join(', ');
  23168.                 found.push(time);
  23169.             }
  23170.         }
  23171.  
  23172.         if (found == '') {
  23173.             $(options.static).html("<br /><strong class='text-danger'>Ungültige Öffnungszeiten. Bitte tragen Sie ihre Öffnungszeiten im richtigen Format ein.</span>");
  23174.             return ""
  23175.         }
  23176.  
  23177.         $(options.static).html(found.join("<br>"));
  23178.         $(options.hidden).val(found.join("\n"));
  23179.     };
  23180.  
  23181.     my.addSameDay = function ($element) {
  23182.         var $row = $element.parent().parent().parent();
  23183.         var weekDayTo = $('[name="weekDayTo[]"]', $row);
  23184.  
  23185.         if (weekDayTo.val() > 0) {
  23186.             return;
  23187.         }
  23188.  
  23189.         var value = $element.val();
  23190.         weekDayTo.val(value);
  23191.     };
  23192.  
  23193.     my.addOpeningHours = function (id, index) {
  23194.         if (index > _index) {
  23195.             _index = index;
  23196.         } else {
  23197.             _index++;
  23198.         }
  23199.  
  23200.         var $newRow = $('#' + id + ' .rowFirst').clone();
  23201.  
  23202.         $newRow.attr("id", "openingHoursRow" + _index);
  23203.         $newRow.addClass('rowNext').removeClass('rowFirst').hide().appendTo($('#' + id)).slideDown(200);
  23204.         $('input, select', $newRow).val('');
  23205.     };
  23206.  
  23207.     my.removeOpeningHours = function ($btn) {
  23208.         var $row = $btn.parent().parent();
  23209.         if ($row.hasClass('rowFirst')) {
  23210.             $('input, select', $row).val('');
  23211.         } else {
  23212.             $row.slideUp(200, function () {
  23213.                 $row.remove();
  23214.             });
  23215.         }
  23216.     };
  23217.  
  23218.     return my;
  23219. }());;var autocomplete = (function() {
  23220.     var my = {};
  23221.  
  23222.     my.start = function(url, config) {
  23223.         var term = $(config.element).val();
  23224.         if (term.length >= (config.threshold || 2)) {
  23225.             $.ajax(url, {
  23226.                 data: { term: term },
  23227.                 success: function(data) {
  23228.                     my.onServerResponse(config, data);
  23229.                 }
  23230.             });
  23231.         } else {
  23232.             $(config.element).next('.autocomplete').hide();
  23233.         }
  23234.     };
  23235.  
  23236.     my.onServerResponse = function(config, data) {
  23237.         var html = [], z, key;
  23238.  
  23239.         if (data.length) {
  23240.             for (z = 0; z < data.length; z++) {
  23241.                 if (typeof data[z].key !== 'undefined') {
  23242.                     key = data[z].key;
  23243.                 } else {
  23244.                     key = z;
  23245.                 }
  23246.                 html.push('<div class="autocomplete-pick" data-key="' + key + '" data-value="' + data[z].value + '">' + data[z].display + '</div>');
  23247.             }
  23248.         } else {
  23249.             for (z in data) {
  23250.                 var extra_data = '', extra;
  23251.                 for (extra in data[z]) {
  23252.                     if (extra !== 'value' && extra !== 'display') {
  23253.                         extra_data += ' data-' + extra + '="' + data[z][extra] + '"';
  23254.                     }
  23255.                 }
  23256.                 html.push('<div class="autocomplete-pick ' + config.pickClass + '" data-key="' + z + '" data-value="' + data[z].value + '"' + extra_data + '>' + data[z].display + '</div>');
  23257.             }
  23258.         }
  23259.  
  23260.         // nothing found
  23261.         if (html.length == 0) {
  23262.             html.push('Keine Übereinstimmung gefunden');
  23263.         }
  23264.  
  23265.         var $thing = $(config.element).next('.autocomplete'), width = $thing.data('width'), $parent;
  23266.         if (!width) {
  23267.             $parent = $thing.parent();
  23268.             width = $parent.css('width').replace('px', '');
  23269.             width -= $parent.css('padding-left').replace('px', '');
  23270.             width -= $parent.css('padding-right').replace('px', '');
  23271.             $thing.data('width', width);
  23272.         }
  23273.         $thing.html(html.join('')).css('width', (width) + 'px').show();
  23274.  
  23275.         $('.autocomplete-pick', $thing).click(function() {
  23276.             $thing.hide();
  23277.             config.onPick(this);
  23278.         });
  23279.     };
  23280.  
  23281.     return my;
  23282. }());
  23283.  
  23284. var autocompleteDropDown = (function() {
  23285.     var my = {};
  23286.  
  23287.     my.start = function(url, config, id) {
  23288.         var term = $(config.element).val();
  23289.         if (term.length >= (config.threshold || 2)) {
  23290.             $.ajax(url, {
  23291.                 data: { term: term },
  23292.                 success: function(data) {
  23293.                     my.onServerResponse(data, id);
  23294.                 }
  23295.             });
  23296.         }
  23297.     };
  23298.  
  23299.     my.onServerResponse = function(data, id) {
  23300.         var html = [], z, lastCity = '', townVal = null;
  23301.  
  23302.         if (data.length) {
  23303.             for (z = 0; z < data.length; z++) {
  23304.                 if (lastCity != data[z].value) {
  23305.                     html.push('<option value="' + data[z].value + '">' + data[z].value + '</option>');
  23306.                 }
  23307.                 lastCity = data[z].value;
  23308.             }
  23309.         } else {
  23310.             for (z in data) {
  23311.                 if (lastCity != data[z].display) {
  23312.                     html.push('<option value="' + data[z].display + '">' + data[z].display + '</option>');
  23313.                 }
  23314.                 lastCity = data[z].display;
  23315.             }
  23316.         }
  23317.  
  23318.         var $thing = $('#' + id);
  23319.  
  23320.         // nothing found
  23321.         if (html.length == 0) {
  23322.             html.push('<option value="">Keine Übereinstimmung gefunden</option>');
  23323.             $thing.html(html.join(''));
  23324.         } else {
  23325.             // edit form -> preselect old town
  23326.             if ($thing.val()) {
  23327.                 townVal = $thing.val();
  23328.             }
  23329.  
  23330.             $thing.html(html.join(''));
  23331.             $thing.prepend('<option value="">Bitte wählen Sie eine Stadt aus.</option>');
  23332.  
  23333.             if (townVal) {
  23334.                 $preSelectedOption = $('#' + id + ' option[value="' + townVal + '"]');
  23335.             } else {
  23336.                 if (html.length == 1) {
  23337.                     $preSelectedOption = $($('#' + id + ' option').get(1));
  23338.                 } else {
  23339.                     $preSelectedOption = $($('#' + id + ' option').get(0));
  23340.                 }
  23341.             }
  23342.             $preSelectedOption.attr('selected', 'selected').change();
  23343.             $preSelectedOption.attr("rel");
  23344.         }
  23345.     };
  23346.  
  23347.     return my;
  23348. }());;var Products = (function ($, window) {
  23349.     var my = {}, delUrl = '/user/productDelete';
  23350.  
  23351.     my.create = function (cid, showDialog) {
  23352.         if (!showDialog) {
  23353.             $('#manageProducts').hide();
  23354.         }
  23355.  
  23356.         $.get('/user/createProductRequired', {'cid': cid, 'showDialog': +showDialog}, function (html) {
  23357.             $("html, body").animate({scrollTop: 0}, "slow");
  23358.             $('#productFormContainer').html(html).slideDown(300);
  23359.         });
  23360.     };
  23361.  
  23362.     my.edit = function (cid, pid, showDialog) {
  23363.         if (!showDialog) {
  23364.             $('#manageProducts').hide();
  23365.         }
  23366.         $.get('/user/editProductRequired', {'cid': cid, 'pid': pid, 'showDialog': +showDialog}, function (html) {
  23367.             $("html, body").animate({scrollTop: 0}, "slow");
  23368.             $('#productFormContainer').html(html).slideDown(300);
  23369.         });
  23370.     };
  23371.  
  23372.     my.editAdditional = function (cid, pid, showDialog) {
  23373.         var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  23374.         var formData = new FormData($form[0]);
  23375.  
  23376.         $.ajax({
  23377.             url: '/user/editProductRequired',
  23378.             type: 'POST',
  23379.             data: formData,
  23380.             async: false,
  23381.             cache: false,
  23382.             contentType: false,
  23383.             processData: false,
  23384.             success: function (d) {
  23385.                 $btn.enableButton(t, d.status == 'ok');
  23386.  
  23387.                 if (d.status == 'ok') {
  23388.                     pid = d.productId;
  23389.                     if (!showDialog) {
  23390.                         $('#manageProducts').hide();
  23391.                     }
  23392.  
  23393.                     $.get('/user/editProductAdditional', {
  23394.                         'cid': cid,
  23395.                         'pid': pid,
  23396.                         'showDialog': +showDialog
  23397.                     }, function (html) {
  23398.                         $("html, body").animate({scrollTop: 0}, "slow");
  23399.                         $('#productFormContainer').html(html).slideDown(300);
  23400.                     });
  23401.                 } else {
  23402.                 }
  23403.             }
  23404.         });
  23405.         outputFlashSession();
  23406.     };
  23407.  
  23408.     my.saveAdditional = function () {
  23409.         var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  23410.         var formData = new FormData($form[0]);
  23411.  
  23412.         $.ajax({
  23413.             url: '/user/editProductAdditional',
  23414.             type: 'POST',
  23415.             data: formData,
  23416.             async: false,
  23417.             cache: false,
  23418.             contentType: false,
  23419.             processData: false,
  23420.             success: function (d) {
  23421.                 $btn.enableButton(t, d.status == 'ok');
  23422.                 if (d.status == 'ok') {
  23423.                     window.location.href = d.redirect;
  23424.                 }
  23425.             }
  23426.         });
  23427.         outputFlashSession();
  23428.     };
  23429.  
  23430.     my.del = function (pid, confirmText) {
  23431.         if (confirm(confirmText)) {
  23432.             $.post(delUrl, {'pid': pid}, function () {
  23433.                 window.location.reload();
  23434.             })
  23435.         }
  23436.     };
  23437.  
  23438.     return my;
  23439. }(jQuery, window));
  23440.  
  23441. var Profile = (function ($) {
  23442.     var my = {};
  23443.  
  23444.     my.updateOption = function (element) {
  23445.         var $el = $(element);
  23446.  
  23447.         $.get('/user/profileOption', {o: $el.attr('name'), v: +$el.is(':checked')}, function (d) {
  23448.             var $ok = $('<span class="text-success"><i class="fa fa-check" aria-hidden="true"></i>gespeichert</span>').hide();
  23449.             $el.parent().append($ok);
  23450.             $ok.fadeIn();
  23451.             window.setTimeout(function () {
  23452.                 $ok.fadeOut()
  23453.             }, 2000);
  23454.         });
  23455.     };
  23456.  
  23457.     my.removeProfileImage = function () {
  23458.         $.get('/user/deleteProfile', {}, function (d) {
  23459.                 if (d.status === 'ok') {
  23460.                     $('#profileImage').remove();
  23461.                     $('#profileImageRemoveButton').remove();
  23462.                     $('#profileImagePlaceholder').show();
  23463.  
  23464.                     autoResizePlaceholderImage();
  23465.                 }
  23466.             outputFlashSession();
  23467.             }
  23468.         );
  23469.  
  23470.     };
  23471.  
  23472.     return my;
  23473. }(jQuery));;/**
  23474.  * Global container for payment actions.
  23475.  */
  23476. var Payment = (function (window, document, $, my) {
  23477.     var step, progress = 0, callbacks = {
  23478.         nextStep: null,
  23479.         progress: null,
  23480.         confirm: null
  23481.     };
  23482.  
  23483.     my.data = {
  23484.         config: {'url': '', 'requests': {}},
  23485.         transaction: {'info': {}, 'order': ''}
  23486.     };
  23487.  
  23488.     my.registerCallback = function (key, callback) {
  23489.         callbacks[key] = callback;
  23490.     };
  23491.  
  23492.     my.init = function () {
  23493.         if (typeof PaymentConfig == 'undefined') {
  23494.             return;
  23495.         }
  23496.  
  23497.         my.data.config = PaymentConfig;
  23498.  
  23499.         if (PaymentData && PaymentData.order) {
  23500.             my.data.transaction.order = PaymentData.order;
  23501.             my.return.process(PaymentData);
  23502.         }
  23503.  
  23504.         window.setTimeout(function () {
  23505.             nextStep('init');
  23506.         }, 500);
  23507.     };
  23508.  
  23509.     my.fancyInOut = function ($out, $in) {
  23510.         $out.slideUp(300, function () {
  23511.             $in.slideDown(300);
  23512.         });
  23513.     };
  23514.  
  23515.     function nextStep(key) {
  23516.         var nextStep = my.moveToStep(key, true);
  23517.  
  23518.         $('.step-' + nextStep + '-progress div').addClass('btn-danger');
  23519.         $('.step-' + nextStep + '-progress div').removeClass('btn-default');
  23520.         $('.step-' + nextStep + '-progress div').removeClass('no-button');
  23521.         if (key == 'toConfirm') {
  23522.             $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToConfirm()");
  23523.         } else {
  23524.             $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToStep('" + key + "', false)");
  23525.         }
  23526.  
  23527.  
  23528.         if (typeof callbacks.progress == 'function') {
  23529.             progress = callbacks.progress(step, progress);
  23530.             $('#paymentProgress').css('width', progress + '%');
  23531.         }
  23532.     }
  23533.  
  23534.     my.moveToStep = function (key, returnNextStep) {
  23535.         var nextStep, previousStep = step;
  23536.  
  23537.         if (typeof callbacks.nextStep == 'function') {
  23538.             nextStep = callbacks.nextStep(key, step);
  23539.         }
  23540.  
  23541.         if (nextStep) {
  23542.             step = nextStep;
  23543.         }
  23544.  
  23545.         if (!previousStep || previousStep == nextStep) {
  23546.             $('.step-' + nextStep).show();
  23547.         } else {
  23548.             my.fancyInOut($('.step-' + previousStep), $('.step-' + step));
  23549.         }
  23550.  
  23551.         if (returnNextStep == true) {
  23552.             return nextStep;
  23553.         }
  23554.     };
  23555.  
  23556.     my.productSelect = function (form) {
  23557.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23558.         $btn.disableButton(t);
  23559.  
  23560.         $.post(my.data.config.url + '/productSelect', {'pid': $('#productId').val()}, function (d) {
  23561.             $btn.enableButton(t);
  23562.  
  23563.             if (d.status == 'ok') {
  23564.                 my.data.transaction = d;
  23565.                 nextStep('product');
  23566.             }
  23567.         });
  23568.     };
  23569.  
  23570.     my.register = function (form, id, showClaims) {
  23571.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23572.         $btn.disableButton(t);
  23573.  
  23574.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23575.         data.push({'name': 'showClaims', 'value': showClaims});
  23576.         $.post(my.data.config.url + '/register', data, function (d) {
  23577.             $btn.enableButton(t);
  23578.  
  23579.             if (d.status == 'ok') {
  23580.                 my.data.transaction = d;
  23581.                 $('.form-login-actions').hide();
  23582.                 $('#' + id).slideDown();
  23583.             }
  23584.         });
  23585.     };
  23586.  
  23587.     my.login = function (userId, id, showClaims) {
  23588.         $.post(my.data.config.url + '/login', {
  23589.             'uid': userId,
  23590.             'order': my.data.transaction.order,
  23591.             'showClaims': showClaims
  23592.         }, function (d) {
  23593.             if (d.status == 'ok') {
  23594.                 my.data.transaction = d;
  23595.                 $('#' + id).slideDown();
  23596.             }
  23597.         });
  23598.     };
  23599.  
  23600.     my.checkAvailability = function (data, $btn) {
  23601.         var t = $btn.html();
  23602.         $btn.disableButton(t);
  23603.         $.post(my.data.config.url + '/checkAvailability', data, function (d) {
  23604.             $btn.enableButton(t);
  23605.  
  23606.             if (d.status == 'ok') {
  23607.                 $('#packageConfigAvailable').show();
  23608.                 $('#packageConfigSubmitContainer').slideDown();
  23609.                 $btn.hide();
  23610.             } else {
  23611.                 $('#packageConfigNotAvailable').show();
  23612.             }
  23613.         });
  23614.  
  23615.     };
  23616.  
  23617.     my.productConfig = function (form) {
  23618.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23619.         $btn.disableButton(t);
  23620.  
  23621.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23622.  
  23623.         $.post(my.data.config.url + '/productConfig', data, function (d) {
  23624.             if (form != null) {
  23625.                 $btn.enableButton(t);
  23626.             }
  23627.  
  23628.             if (d.status == 'ok') {
  23629.                 my.data.transaction = d;
  23630.                 nextStep('productConfig');
  23631.             }
  23632.         });
  23633.     };
  23634.  
  23635.     my.companySelected = function (companyId, btn, form) {
  23636.         var $btn = $(btn), t = $btn.html(), data = [];
  23637.         $btn.disableButton(t);
  23638.  
  23639.         if (form) {
  23640.             var $form = $(form);
  23641.             data = $form.serializeArray();
  23642.         }
  23643.         data.push({'name': 'cid', 'value': companyId});
  23644.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23645.  
  23646.         $.post(my.data.config.url + '/addCompany', data, function (d) {
  23647.             $btn.enableButton(t);
  23648.  
  23649.             if (d.status == 'ok') {
  23650.                 my.data.transaction = d;
  23651.                 nextStep('company');
  23652.             }
  23653.             if (form) {
  23654.                 return false;
  23655.             }
  23656.         });
  23657.     };
  23658.  
  23659.     my.customerData = function (form) {
  23660.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23661.         $btn.disableButton(t);
  23662.  
  23663.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23664.  
  23665.         $.post(my.data.config.url + '/customerData', data, function (d) {
  23666.             $btn.enableButton(t);
  23667.  
  23668.             if (d.status == 'ok') {
  23669.                 my.data.transaction = d;
  23670.                 nextStep('customer');
  23671.             }
  23672.         });
  23673.     };
  23674.  
  23675.     my.moveToConfirm = function () {
  23676.         var html = '', val, pt = my.data.config.paymentText;
  23677.         for (var key in my.data.transaction.info.payment) {
  23678.             val = my.data.transaction.info.payment[key];
  23679.             html += '<div class="row"><div class="col-xs-6 bold">' + pt[key] + '</div>';
  23680.             html += '<div class="col-xs-6">' + (pt[val] ? pt[val] : val) + '</div></div>';
  23681.         }
  23682.         $('#confirmPayment').html(html);
  23683.  
  23684.         if (typeof callbacks.confirm == 'function') {
  23685.             callbacks.confirm(my.data.transaction.info);
  23686.         }
  23687.  
  23688.         $('#costs').hide();
  23689.         nextStep('toConfirm');
  23690.     };
  23691.  
  23692.     my.confirm = function (form) {
  23693.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23694.         $btn.disableButton(t);
  23695.  
  23696.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23697.  
  23698.         $.post(my.data.config.url + '/confirm', data, function (d) {
  23699.             $btn.enableButton(t);
  23700.  
  23701.             if (d.status == 'ok') {
  23702.                 my.thanks(d);
  23703.             } else {
  23704.                 if (d.status == 'redirect') {
  23705.                     $('#externalPaymentBtn').click(function () {
  23706.                         $('#externalPaymentBtn').disableButton();
  23707.                         window.location.href = d.url;
  23708.                     });
  23709.                     my.fancyInOut($('.step-' + step), $('.step-external'));
  23710.                 }
  23711.             }
  23712.         });
  23713.     };
  23714.  
  23715.     my.thanks = function (response) {
  23716.         $('#thanksRefNo').text(response.info.referenceNumber);
  23717.         my.fancyInOut($('.step:visible'), $('.step-thanks'));
  23718.         $('#progressBar').hide();
  23719.         $('#invoiceLink').attr('href', $('#invoiceLink').attr('href') + '/' + response.info.referenceNumber);
  23720.     };
  23721.  
  23722.     my.error = function (response) {
  23723.         $('#paymentError').html('FEHLER: ' + response.customermessage);
  23724.     };
  23725.  
  23726.     return my;
  23727. }(window, document, jQuery, Payment || {}));
  23728.  
  23729. /**
  23730.  * Add module return to handle the different cases the user return to the payment process.
  23731.  */
  23732. var Payment = (function ($, parent) {
  23733.     var my = {};
  23734.  
  23735.     my.process = function (data) {
  23736.         if (data.returnType === 'external') {
  23737.             $('.step').hide();
  23738.  
  23739.             if (data.status === 'back') {
  23740.                 externalAbort(data.order);
  23741.             } else {
  23742.                 if (data.status === 'ok') {
  23743.                     externalOk(data.order);
  23744.                 } else {
  23745.                     if (data.status === 'error') {
  23746.                         externalError(data.order);
  23747.                     }
  23748.                 }
  23749.             }
  23750.         }
  23751.     };
  23752.  
  23753.     function externalAbort(order) {
  23754.         $('#restartExternalPaymentBtn').click(function () {
  23755.             var $btn = $(this);
  23756.             $btn.disableButton();
  23757.             $('.step-external-back .info').show();
  23758.  
  23759.             $.post(parent.data.config.url + '/restartExternal', {'order': order}, function (d) {
  23760.                 if (d.status == 'redirect') {
  23761.                     window.location.href = d.url;
  23762.                 } else {
  23763.                     $btn.enableButton(t);
  23764.                 }
  23765.             });
  23766.         });
  23767.         $('.step-external-back').show();
  23768.     }
  23769.  
  23770.     function externalOk(order) {
  23771.         $('.step-external-ok').show();
  23772.         my.checkOrder(order);
  23773.     }
  23774.  
  23775.     my.checkOrder = function (order) {
  23776.         $.post(parent.data.config.url + '/checkOrder', {'order': order}, function (d) {
  23777.             if (d.status == 'ok') {
  23778.                 if (d.isPaid === true) {
  23779.                     // we are done
  23780.                     parent.thanks(d);
  23781.                 } else {
  23782.                     // try again in a few
  23783.                     window.setTimeout(function () {
  23784.                         my.checkOrder(order);
  23785.                     }, 1500);
  23786.                 }
  23787.             }
  23788.         });
  23789.     };
  23790.  
  23791.     function externalError(order) {
  23792.         $('.step-external-error').show();
  23793.     }
  23794.  
  23795.     parent.return = my;
  23796.     return parent;
  23797. }(jQuery, Payment || {}));
  23798.  
  23799. /**
  23800.  * Add module methods to handle the different payment methods.
  23801.  */
  23802. var Payment = (function ($, parent) {
  23803.     var my = {};
  23804.  
  23805.     my.selected = function () {
  23806.         var type = $('#paymentSelect').val();
  23807.         $('.method').hide();
  23808.         $('.method-' + type).show();
  23809.     };
  23810.  
  23811.     function mergeParameters(request, params) {
  23812.         for (var key in parent.data.config.requests[request]) {
  23813.             params[key] = parent.data.config.requests[request][key];
  23814.         }
  23815.  
  23816.         return params;
  23817.     }
  23818.  
  23819.     function addPaymentMethod(type, data, $btn, btnText) {
  23820.         $.post(parent.data.config.url + '/addPaymentMethod', {
  23821.             'type': type,
  23822.             'order': parent.data.transaction.order,
  23823.             'data': data
  23824.         }, function (d) {
  23825.             $btn.enableButton(btnText);
  23826.  
  23827.             if (d.status == 'ok') {
  23828.                 parent.data.transaction = d;
  23829.                 parent.moveToConfirm();
  23830.             }
  23831.         });
  23832.     }
  23833.  
  23834.     my.creditCardCheck = function (form) {
  23835.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23836.         $btn.disableButton();
  23837.  
  23838.         var funcName = 'callbackCreditCardCheck' + Math.ceil(Math.random() * 100000000);
  23839.         window[funcName] = function (response) {
  23840.             $('#response').html(JSON.stringify(response, null, 2));
  23841.  
  23842.             if (response.status === 'ERROR') {
  23843.                 $btn.enableButton(t);
  23844.                 my.error(response);
  23845.             } else {
  23846.                 if (response.status === 'VALID') {
  23847.                     // inform server
  23848.                     addPaymentMethod('creditcard', {
  23849.                         'pseudoCardNumber': response.pseudocardpan,
  23850.                         'truncatedCardNumber': response.truncatedcardpan
  23851.                     }, $btn, t);
  23852.                 } else {
  23853.                 }
  23854.             }
  23855.         };
  23856.  
  23857.         var pr = new PayoneRequest(mergeParameters('creditCardCheck', {
  23858.             'cardpan': parseInt($('#ccNumber', $form).val(), 10), // credit card number
  23859.             'cardtype': $('#ccType', $form).val(),
  23860.             'cardexpiredate': parseInt($('#ccExpire', $form).val(), 10),
  23861.             'cardcvc2': parseInt($('#ccCvc', $form).val(), 10),
  23862.             'language': 'de'
  23863.         }), {'callback_function_name': funcName});
  23864.         pr.checkAndStore();
  23865.     };
  23866.  
  23867.     my.paypalCheck = function (form) {
  23868.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23869.         $btn.disableButton();
  23870.  
  23871.         addPaymentMethod('paypal', {}, $btn, t);
  23872.     };
  23873.  
  23874.     my.invoiceCheck = function (form) {
  23875.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23876.         $btn.disableButton();
  23877.  
  23878.         addPaymentMethod('invoice', {}, $btn, t);
  23879.     };
  23880.  
  23881.     parent.method = my;
  23882.     return parent;
  23883. }(jQuery, Payment || {}));
  23884.  
  23885. Payment.banner = (function ($) {
  23886.     var my = {};
  23887.  
  23888.     my.checkDetailRival = function (url, companyId, boxId, claimId, userId) {
  23889.         $('#' + boxId + 'Advertising').hide();
  23890.         $.get(url + '/checkDetailRival', {'cid': companyId}, function (d) {
  23891.             if (d.status == 'ok') {
  23892.                 $('#' + boxId).addClass('marginBottom17');
  23893.                 $('#' + boxId + 'Container').addClass('marginTop17');
  23894.                 my.getBanner(d.phrase, d.city, boxId, 'detail', 'df', 'leader');
  23895.  
  23896.                 if ((claimId && userId) && (claimId == userId)) {
  23897.                     $('#' + boxId + 'Info').removeClass('hidden');
  23898.                 }
  23899.             } else {
  23900.                 $('#' + boxId + 'Advertising').show();
  23901.             }
  23902.         });
  23903.     };
  23904.  
  23905.     my.getBanner = function (phrase, city, boxId, page, trackInfo, format) {
  23906.         $.getScript('/banner.do?page=' + page + '&sp=' + phrase + '&sl=' + city + '&f=' + format + '&t=' + trackInfo + '&id=' + boxId);
  23907.     };
  23908.  
  23909.     return my;
  23910. }(jQuery));
  23911.  
  23912. jQuery(document).ready(Payment.init);;jQuery(document).ready(function() {
  23913.     $('#searchForm input[name=what]').change(function() {
  23914.         // check the "what" input for validity
  23915.         var $what = $(this), value;
  23916.  
  23917.         // there must be at least one number or one letter
  23918.         value = $what.val().replace(/[^a-z0-9]/ig, '');
  23919.  
  23920.         if (value == '') {
  23921.             this.validity.valid = false;
  23922.             this.setCustomValidity('Sie müssen mindestens einen Buchstaben oder eine Zahl eingeben.');
  23923.         } else {
  23924.             this.validity.valid = true;
  23925.             this.setCustomValidity('');
  23926.         }
  23927.     });
  23928. });
  23929.  
  23930. var Search = (function($) {
  23931.     var my = {};
  23932.  
  23933.     my.searchFilter = function(filterContentId, filterBoxClass, filterHeaderClass) {
  23934.         if (Mobile.isMobile()) {
  23935.             $('#' + filterContentId).removeClass('in');
  23936.             $('.' + filterBoxClass).addClass('panel panel-primary');
  23937.             $('.' + filterBoxClass + ' .' + filterHeaderClass).addClass('panel-heading');
  23938.             $('.' + filterBoxClass + ' h2').addClass('panel-title');
  23939.             $('.' + filterBoxClass + ' h2').removeClass('text-danger');
  23940.             $('.' + filterBoxClass + ' h2 a').removeClass('text-danger');
  23941.             $('.' + filterBoxClass + ' h2 a').html($('.search-filter-box .panel-title a').text() + '  <i class="fa fa-angle-down pull-right" aria-hidden="true"></i>');
  23942.             $('#' + filterContentId + ' .row').removeClass('row');
  23943.         }
  23944.     };
  23945.  
  23946.     return my;
  23947. }(jQuery));;var Social = (function ($) {
  23948.     var my = {}, fbApiInit = false, twApiInit = false;
  23949.  
  23950.     my.loadFacebookSDK = function (facebookAppId) {
  23951.         window.fbAsyncInit = function () {
  23952.             FB.init({appId: facebookAppId, cookie: false, xfbml: true, version: 'v2.1'});
  23953.             fbApiInit = true;
  23954.         };
  23955.  
  23956.         (function (d, s, id) {
  23957.             var js, fjs = d.getElementsByTagName(s)[0];
  23958.             if (d.getElementById(id)) return;
  23959.             js = d.createElement(s);
  23960.             js.id = id;
  23961.             js.src = "//connect.facebook.net/de_DE/sdk.js";
  23962.             fjs.parentNode.insertBefore(js, fjs);
  23963.         }(document, 'script', 'facebook-jssdk'));
  23964.     };
  23965.  
  23966.     my.loadTwitterScript = function () {
  23967.         !function (d, s, id) {
  23968.             var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
  23969.             if (!d.getElementById(id)) {
  23970.                 js = d.createElement(s);
  23971.                 js.id = id;
  23972.                 js.src = p + "://platform.twitter.com/widgets.js";
  23973.                 fjs.parentNode.insertBefore(js, fjs);
  23974.  
  23975.                 twApiInit = true;
  23976.             }
  23977.         }(document, "script", "twitter-wjs");
  23978.  
  23979.     };
  23980.  
  23981.     my.clickToShowFacebook = function (element, facebookAppId) {
  23982.         var $btn = $(element), t = $btn.html();
  23983.         $btn.disableButton(t);
  23984.  
  23985.         my.loadFacebookSDK(facebookAppId);
  23986.  
  23987.         my.fbEnsureInit(function () {
  23988.             $btn.enableButton(t);
  23989.         });
  23990.     };
  23991.  
  23992.     my.fbEnsureInit = function (callback) {
  23993.         if (!fbApiInit) {
  23994.             setTimeout(function () {
  23995.                 my.fbEnsureInit(callback);
  23996.             }, 50);
  23997.         } else {
  23998.             if (callback) {
  23999.                 callback();
  24000.             }
  24001.         }
  24002.     };
  24003.  
  24004.     my.loginByFacebookStep1 = function (element, facebookAppId, fbScope, buttonText) {
  24005.         var $btn = $(element), t = $btn.html();
  24006.         $btn.disableButton(t);
  24007.         my.loadFacebookSDK(facebookAppId);
  24008.         my.fbEnsureInit(function () {
  24009.             $btn.enableButton('<i class="fa fa-facebook-square fa-2x"></i> ' + buttonText);
  24010.             $btn.removeClass('btn-default');
  24011.             $btn.addClass('btn-fb');
  24012.             $btn.attr("onclick", "Social.loginByFacebookStep2(this, '" + fbScope + "')");
  24013.         });
  24014.     };
  24015.  
  24016.     my.loginByFacebookStep2 = function (element, fbScope) {
  24017.         var $btn = $(element), t = $btn.html();
  24018.         $btn.disableButton(t);
  24019.         FB.login(facebookStatusCallback, {scope: fbScope});
  24020.         $btn.enableButton(t);
  24021.     };
  24022.  
  24023.     my.twEnsureInit = function (callback) {
  24024.         if (!twApiInit) {
  24025.             setTimeout(function () {
  24026.                 my.twEnsureInit(callback);
  24027.             }, 50);
  24028.         } else {
  24029.             if (callback) {
  24030.                 callback();
  24031.             }
  24032.         }
  24033.     };
  24034.  
  24035.     my.clickToShowTwitter = function (element) {
  24036.         var $btn = $(element), t = $btn.html();
  24037.         $btn.disableButton(t);
  24038.  
  24039.         my.loadTwitterScript();
  24040.  
  24041.         my.twEnsureInit(function () {
  24042.             $btn.enableButton(t);
  24043.         });
  24044.     };
  24045.  
  24046.     return my;
  24047. }(jQuery));;jQuery(document).ready(function($) {
  24048.     $('[data-track="1"]').each(function() {
  24049.         var el = $(this), url = el.data('track-url');
  24050.  
  24051.         el.click(function() {
  24052.             Tracking.trackYext(url);
  24053.         });
  24054.     })
  24055. }(jQuery));
  24056.  
  24057. var Tracking = (function($) {
  24058.     var my = {};
  24059.  
  24060.     my.trackYext = function(url) {
  24061.         $('body').append('<img src="' + url + '"/>');
  24062.     };
  24063.  
  24064.     return my;
  24065. }(jQuery));;
Add Comment
Please, Sign In to add comment