JohnGalt14

Malicious or Legitimate

May 19th, 2019
1,716
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. Copyright (c) 2010 Robert Kieffer
  250. Dual licensed under the MIT and GPL licenses.
  251. */
  252. 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;
  253. _.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;
  254. _.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)};
  255. _.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};
  256. _.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)})};
  257. _.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;
  258. 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;
  259. 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)})};
  260. _.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)})};
  261. _.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)})};
  262. _.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;
  263. 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;
  264. 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"],
  265. 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);
  266. _.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"),
  267. 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")};
  268. _.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"))};
  269. _.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});
  270. 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};
  271. _.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;
  272. 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;
  273. 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;
  274. _.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)})};
  275. _.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;
  276. _.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;
  277. 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,
  278. 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,
  279. 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,
  280. 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,
  281. 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,{});
  282.  
  283.  
  284. /*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
  285. !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){
  286. 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)),
  287. 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});
  288. ;/*! jQuery UI - v1.11.4 - 2015-05-31
  289. * http://jqueryui.com
  290. * 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
  291. * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
  292.  
  293. (function( factory ) {
  294.     if ( typeof define === "function" && define.amd ) {
  295.  
  296.         // AMD. Register as an anonymous module.
  297.         define([ "jquery" ], factory );
  298.     } else {
  299.  
  300.         // Browser globals
  301.         factory( jQuery );
  302.     }
  303. }(function( $ ) {
  304. /*!
  305.  * jQuery UI Core 1.11.4
  306.  * http://jqueryui.com
  307.  *
  308.  * Copyright jQuery Foundation and other contributors
  309.  * Released under the MIT license.
  310.  * http://jquery.org/license
  311.  *
  312.  * http://api.jqueryui.com/category/ui-core/
  313.  */
  314.  
  315.  
  316. // $.ui might exist from components with no dependencies, e.g., $.ui.position
  317. $.ui = $.ui || {};
  318.  
  319. $.extend( $.ui, {
  320.     version: "1.11.4",
  321.  
  322.     keyCode: {
  323.         BACKSPACE: 8,
  324.         COMMA: 188,
  325.         DELETE: 46,
  326.         DOWN: 40,
  327.         END: 35,
  328.         ENTER: 13,
  329.         ESCAPE: 27,
  330.         HOME: 36,
  331.         LEFT: 37,
  332.         PAGE_DOWN: 34,
  333.         PAGE_UP: 33,
  334.         PERIOD: 190,
  335.         RIGHT: 39,
  336.         SPACE: 32,
  337.         TAB: 9,
  338.         UP: 38
  339.     }
  340. });
  341.  
  342. // plugins
  343. $.fn.extend({
  344.     scrollParent: function( includeHidden ) {
  345.         var position = this.css( "position" ),
  346.             excludeStaticParent = position === "absolute",
  347.             overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  348.             scrollParent = this.parents().filter( function() {
  349.                 var parent = $( this );
  350.                 if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  351.                     return false;
  352.                 }
  353.                 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
  354.             }).eq( 0 );
  355.  
  356.         return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
  357.     },
  358.  
  359.     uniqueId: (function() {
  360.         var uuid = 0;
  361.  
  362.         return function() {
  363.             return this.each(function() {
  364.                 if ( !this.id ) {
  365.                     this.id = "ui-id-" + ( ++uuid );
  366.                 }
  367.             });
  368.         };
  369.     })(),
  370.  
  371.     removeUniqueId: function() {
  372.         return this.each(function() {
  373.             if ( /^ui-id-\d+$/.test( this.id ) ) {
  374.                 $( this ).removeAttr( "id" );
  375.             }
  376.         });
  377.     }
  378. });
  379.  
  380. // selectors
  381. function focusable( element, isTabIndexNotNaN ) {
  382.     var map, mapName, img,
  383.         nodeName = element.nodeName.toLowerCase();
  384.     if ( "area" === nodeName ) {
  385.         map = element.parentNode;
  386.         mapName = map.name;
  387.         if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  388.             return false;
  389.         }
  390.         img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
  391.         return !!img && visible( img );
  392.     }
  393.     return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ?
  394.         !element.disabled :
  395.         "a" === nodeName ?
  396.             element.href || isTabIndexNotNaN :
  397.             isTabIndexNotNaN) &&
  398.         // the element and all of its ancestors must be visible
  399.         visible( element );
  400. }
  401.  
  402. function visible( element ) {
  403.     return $.expr.filters.visible( element ) &&
  404.         !$( element ).parents().addBack().filter(function() {
  405.             return $.css( this, "visibility" ) === "hidden";
  406.         }).length;
  407. }
  408.  
  409. $.extend( $.expr[ ":" ], {
  410.     data: $.expr.createPseudo ?
  411.         $.expr.createPseudo(function( dataName ) {
  412.             return function( elem ) {
  413.                 return !!$.data( elem, dataName );
  414.             };
  415.         }) :
  416.         // support: jQuery <1.8
  417.         function( elem, i, match ) {
  418.             return !!$.data( elem, match[ 3 ] );
  419.         },
  420.  
  421.     focusable: function( element ) {
  422.         return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
  423.     },
  424.  
  425.     tabbable: function( element ) {
  426.         var tabIndex = $.attr( element, "tabindex" ),
  427.             isTabIndexNaN = isNaN( tabIndex );
  428.         return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
  429.     }
  430. });
  431.  
  432. // support: jQuery <1.8
  433. if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
  434.     $.each( [ "Width", "Height" ], function( i, name ) {
  435.         var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  436.             type = name.toLowerCase(),
  437.             orig = {
  438.                 innerWidth: $.fn.innerWidth,
  439.                 innerHeight: $.fn.innerHeight,
  440.                 outerWidth: $.fn.outerWidth,
  441.                 outerHeight: $.fn.outerHeight
  442.             };
  443.  
  444.         function reduce( elem, size, border, margin ) {
  445.             $.each( side, function() {
  446.                 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  447.                 if ( border ) {
  448.                     size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  449.                 }
  450.                 if ( margin ) {
  451.                     size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  452.                 }
  453.             });
  454.             return size;
  455.         }
  456.  
  457.         $.fn[ "inner" + name ] = function( size ) {
  458.             if ( size === undefined ) {
  459.                 return orig[ "inner" + name ].call( this );
  460.             }
  461.  
  462.             return this.each(function() {
  463.                 $( this ).css( type, reduce( this, size ) + "px" );
  464.             });
  465.         };
  466.  
  467.         $.fn[ "outer" + name] = function( size, margin ) {
  468.             if ( typeof size !== "number" ) {
  469.                 return orig[ "outer" + name ].call( this, size );
  470.             }
  471.  
  472.             return this.each(function() {
  473.                 $( this).css( type, reduce( this, size, true, margin ) + "px" );
  474.             });
  475.         };
  476.     });
  477. }
  478.  
  479. // support: jQuery <1.8
  480. if ( !$.fn.addBack ) {
  481.     $.fn.addBack = function( selector ) {
  482.         return this.add( selector == null ?
  483.             this.prevObject : this.prevObject.filter( selector )
  484.         );
  485.     };
  486. }
  487.  
  488. // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
  489. if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
  490.     $.fn.removeData = (function( removeData ) {
  491.         return function( key ) {
  492.             if ( arguments.length ) {
  493.                 return removeData.call( this, $.camelCase( key ) );
  494.             } else {
  495.                 return removeData.call( this );
  496.             }
  497.         };
  498.     })( $.fn.removeData );
  499. }
  500.  
  501. // deprecated
  502. $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  503.  
  504. $.fn.extend({
  505.     focus: (function( orig ) {
  506.         return function( delay, fn ) {
  507.             return typeof delay === "number" ?
  508.                 this.each(function() {
  509.                     var elem = this;
  510.                     setTimeout(function() {
  511.                         $( elem ).focus();
  512.                         if ( fn ) {
  513.                             fn.call( elem );
  514.                         }
  515.                     }, delay );
  516.                 }) :
  517.                 orig.apply( this, arguments );
  518.         };
  519.     })( $.fn.focus ),
  520.  
  521.     disableSelection: (function() {
  522.         var eventType = "onselectstart" in document.createElement( "div" ) ?
  523.             "selectstart" :
  524.             "mousedown";
  525.  
  526.         return function() {
  527.             return this.bind( eventType + ".ui-disableSelection", function( event ) {
  528.                 event.preventDefault();
  529.             });
  530.         };
  531.     })(),
  532.  
  533.     enableSelection: function() {
  534.         return this.unbind( ".ui-disableSelection" );
  535.     },
  536.  
  537.     zIndex: function( zIndex ) {
  538.         if ( zIndex !== undefined ) {
  539.             return this.css( "zIndex", zIndex );
  540.         }
  541.  
  542.         if ( this.length ) {
  543.             var elem = $( this[ 0 ] ), position, value;
  544.             while ( elem.length && elem[ 0 ] !== document ) {
  545.                 // Ignore z-index if position is set to a value where z-index is ignored by the browser
  546.                 // This makes behavior of this function consistent across browsers
  547.                 // WebKit always returns auto if the element is positioned
  548.                 position = elem.css( "position" );
  549.                 if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  550.                     // IE returns 0 when zIndex is not specified
  551.                     // other browsers return a string
  552.                     // we ignore the case of nested elements with an explicit value of 0
  553.                     // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  554.                     value = parseInt( elem.css( "zIndex" ), 10 );
  555.                     if ( !isNaN( value ) && value !== 0 ) {
  556.                         return value;
  557.                     }
  558.                 }
  559.                 elem = elem.parent();
  560.             }
  561.         }
  562.  
  563.         return 0;
  564.     }
  565. });
  566.  
  567. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  568. $.ui.plugin = {
  569.     add: function( module, option, set ) {
  570.         var i,
  571.             proto = $.ui[ module ].prototype;
  572.         for ( i in set ) {
  573.             proto.plugins[ i ] = proto.plugins[ i ] || [];
  574.             proto.plugins[ i ].push( [ option, set[ i ] ] );
  575.         }
  576.     },
  577.     call: function( instance, name, args, allowDisconnected ) {
  578.         var i,
  579.             set = instance.plugins[ name ];
  580.  
  581.         if ( !set ) {
  582.             return;
  583.         }
  584.  
  585.         if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  586.             return;
  587.         }
  588.  
  589.         for ( i = 0; i < set.length; i++ ) {
  590.             if ( instance.options[ set[ i ][ 0 ] ] ) {
  591.                 set[ i ][ 1 ].apply( instance.element, args );
  592.             }
  593.         }
  594.     }
  595. };
  596.  
  597.  
  598. /*!
  599.  * jQuery UI Widget 1.11.4
  600.  * http://jqueryui.com
  601.  *
  602.  * Copyright jQuery Foundation and other contributors
  603.  * Released under the MIT license.
  604.  * http://jquery.org/license
  605.  *
  606.  * http://api.jqueryui.com/jQuery.widget/
  607.  */
  608.  
  609.  
  610. var widget_uuid = 0,
  611.     widget_slice = Array.prototype.slice;
  612.  
  613. $.cleanData = (function( orig ) {
  614.     return function( elems ) {
  615.         var events, elem, i;
  616.         for ( i = 0; (elem = elems[i]) != null; i++ ) {
  617.             try {
  618.  
  619.                 // Only trigger remove when necessary to save time
  620.                 events = $._data( elem, "events" );
  621.                 if ( events && events.remove ) {
  622.                     $( elem ).triggerHandler( "remove" );
  623.                 }
  624.  
  625.             // http://bugs.jquery.com/ticket/8235
  626.             } catch ( e ) {}
  627.         }
  628.         orig( elems );
  629.     };
  630. })( $.cleanData );
  631.  
  632. $.widget = function( name, base, prototype ) {
  633.     var fullName, existingConstructor, constructor, basePrototype,
  634.         // proxiedPrototype allows the provided prototype to remain unmodified
  635.         // so that it can be used as a mixin for multiple widgets (#8876)
  636.         proxiedPrototype = {},
  637.         namespace = name.split( "." )[ 0 ];
  638.  
  639.     name = name.split( "." )[ 1 ];
  640.     fullName = namespace + "-" + name;
  641.  
  642.     if ( !prototype ) {
  643.         prototype = base;
  644.         base = $.Widget;
  645.     }
  646.  
  647.     // create selector for plugin
  648.     $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
  649.         return !!$.data( elem, fullName );
  650.     };
  651.  
  652.     $[ namespace ] = $[ namespace ] || {};
  653.     existingConstructor = $[ namespace ][ name ];
  654.     constructor = $[ namespace ][ name ] = function( options, element ) {
  655.         // allow instantiation without "new" keyword
  656.         if ( !this._createWidget ) {
  657.             return new constructor( options, element );
  658.         }
  659.  
  660.         // allow instantiation without initializing for simple inheritance
  661.         // must use "new" keyword (the code above always passes args)
  662.         if ( arguments.length ) {
  663.             this._createWidget( options, element );
  664.         }
  665.     };
  666.     // extend with the existing constructor to carry over any static properties
  667.     $.extend( constructor, existingConstructor, {
  668.         version: prototype.version,
  669.         // copy the object used to create the prototype in case we need to
  670.         // redefine the widget later
  671.         _proto: $.extend( {}, prototype ),
  672.         // track widgets that inherit from this widget in case this widget is
  673.         // redefined after a widget inherits from it
  674.         _childConstructors: []
  675.     });
  676.  
  677.     basePrototype = new base();
  678.     // we need to make the options hash a property directly on the new instance
  679.     // otherwise we'll modify the options hash on the prototype that we're
  680.     // inheriting from
  681.     basePrototype.options = $.widget.extend( {}, basePrototype.options );
  682.     $.each( prototype, function( prop, value ) {
  683.         if ( !$.isFunction( value ) ) {
  684.             proxiedPrototype[ prop ] = value;
  685.             return;
  686.         }
  687.         proxiedPrototype[ prop ] = (function() {
  688.             var _super = function() {
  689.                     return base.prototype[ prop ].apply( this, arguments );
  690.                 },
  691.                 _superApply = function( args ) {
  692.                     return base.prototype[ prop ].apply( this, args );
  693.                 };
  694.             return function() {
  695.                 var __super = this._super,
  696.                     __superApply = this._superApply,
  697.                     returnValue;
  698.  
  699.                 this._super = _super;
  700.                 this._superApply = _superApply;
  701.  
  702.                 returnValue = value.apply( this, arguments );
  703.  
  704.                 this._super = __super;
  705.                 this._superApply = __superApply;
  706.  
  707.                 return returnValue;
  708.             };
  709.         })();
  710.     });
  711.     constructor.prototype = $.widget.extend( basePrototype, {
  712.         // TODO: remove support for widgetEventPrefix
  713.         // always use the name + a colon as the prefix, e.g., draggable:start
  714.         // don't prefix for widgets that aren't DOM-based
  715.         widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  716.     }, proxiedPrototype, {
  717.         constructor: constructor,
  718.         namespace: namespace,
  719.         widgetName: name,
  720.         widgetFullName: fullName
  721.     });
  722.  
  723.     // If this widget is being redefined then we need to find all widgets that
  724.     // are inheriting from it and redefine all of them so that they inherit from
  725.     // the new version of this widget. We're essentially trying to replace one
  726.     // level in the prototype chain.
  727.     if ( existingConstructor ) {
  728.         $.each( existingConstructor._childConstructors, function( i, child ) {
  729.             var childPrototype = child.prototype;
  730.  
  731.             // redefine the child widget using the same prototype that was
  732.             // originally used, but inherit from the new version of the base
  733.             $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
  734.         });
  735.         // remove the list of existing child constructors from the old constructor
  736.         // so the old child constructors can be garbage collected
  737.         delete existingConstructor._childConstructors;
  738.     } else {
  739.         base._childConstructors.push( constructor );
  740.     }
  741.  
  742.     $.widget.bridge( name, constructor );
  743.  
  744.     return constructor;
  745. };
  746.  
  747. $.widget.extend = function( target ) {
  748.     var input = widget_slice.call( arguments, 1 ),
  749.         inputIndex = 0,
  750.         inputLength = input.length,
  751.         key,
  752.         value;
  753.     for ( ; inputIndex < inputLength; inputIndex++ ) {
  754.         for ( key in input[ inputIndex ] ) {
  755.             value = input[ inputIndex ][ key ];
  756.             if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
  757.                 // Clone objects
  758.                 if ( $.isPlainObject( value ) ) {
  759.                     target[ key ] = $.isPlainObject( target[ key ] ) ?
  760.                         $.widget.extend( {}, target[ key ], value ) :
  761.                         // Don't extend strings, arrays, etc. with objects
  762.                         $.widget.extend( {}, value );
  763.                 // Copy everything else by reference
  764.                 } else {
  765.                     target[ key ] = value;
  766.                 }
  767.             }
  768.         }
  769.     }
  770.     return target;
  771. };
  772.  
  773. $.widget.bridge = function( name, object ) {
  774.     var fullName = object.prototype.widgetFullName || name;
  775.     $.fn[ name ] = function( options ) {
  776.         var isMethodCall = typeof options === "string",
  777.             args = widget_slice.call( arguments, 1 ),
  778.             returnValue = this;
  779.  
  780.         if ( isMethodCall ) {
  781.             this.each(function() {
  782.                 var methodValue,
  783.                     instance = $.data( this, fullName );
  784.                 if ( options === "instance" ) {
  785.                     returnValue = instance;
  786.                     return false;
  787.                 }
  788.                 if ( !instance ) {
  789.                     return $.error( "cannot call methods on " + name + " prior to initialization; " +
  790.                         "attempted to call method '" + options + "'" );
  791.                 }
  792.                 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
  793.                     return $.error( "no such method '" + options + "' for " + name + " widget instance" );
  794.                 }
  795.                 methodValue = instance[ options ].apply( instance, args );
  796.                 if ( methodValue !== instance && methodValue !== undefined ) {
  797.                     returnValue = methodValue && methodValue.jquery ?
  798.                         returnValue.pushStack( methodValue.get() ) :
  799.                         methodValue;
  800.                     return false;
  801.                 }
  802.             });
  803.         } else {
  804.  
  805.             // Allow multiple hashes to be passed on init
  806.             if ( args.length ) {
  807.                 options = $.widget.extend.apply( null, [ options ].concat(args) );
  808.             }
  809.  
  810.             this.each(function() {
  811.                 var instance = $.data( this, fullName );
  812.                 if ( instance ) {
  813.                     instance.option( options || {} );
  814.                     if ( instance._init ) {
  815.                         instance._init();
  816.                     }
  817.                 } else {
  818.                     $.data( this, fullName, new object( options, this ) );
  819.                 }
  820.             });
  821.         }
  822.  
  823.         return returnValue;
  824.     };
  825. };
  826.  
  827. $.Widget = function( /* options, element */ ) {};
  828. $.Widget._childConstructors = [];
  829.  
  830. $.Widget.prototype = {
  831.     widgetName: "widget",
  832.     widgetEventPrefix: "",
  833.     defaultElement: "<div>",
  834.     options: {
  835.         disabled: false,
  836.  
  837.         // callbacks
  838.         create: null
  839.     },
  840.     _createWidget: function( options, element ) {
  841.         element = $( element || this.defaultElement || this )[ 0 ];
  842.         this.element = $( element );
  843.         this.uuid = widget_uuid++;
  844.         this.eventNamespace = "." + this.widgetName + this.uuid;
  845.  
  846.         this.bindings = $();
  847.         this.hoverable = $();
  848.         this.focusable = $();
  849.  
  850.         if ( element !== this ) {
  851.             $.data( element, this.widgetFullName, this );
  852.             this._on( true, this.element, {
  853.                 remove: function( event ) {
  854.                     if ( event.target === element ) {
  855.                         this.destroy();
  856.                     }
  857.                 }
  858.             });
  859.             this.document = $( element.style ?
  860.                 // element within the document
  861.                 element.ownerDocument :
  862.                 // element is window or document
  863.                 element.document || element );
  864.             this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
  865.         }
  866.  
  867.         this.options = $.widget.extend( {},
  868.             this.options,
  869.             this._getCreateOptions(),
  870.             options );
  871.  
  872.         this._create();
  873.         this._trigger( "create", null, this._getCreateEventData() );
  874.         this._init();
  875.     },
  876.     _getCreateOptions: $.noop,
  877.     _getCreateEventData: $.noop,
  878.     _create: $.noop,
  879.     _init: $.noop,
  880.  
  881.     destroy: function() {
  882.         this._destroy();
  883.         // we can probably remove the unbind calls in 2.0
  884.         // all event bindings should go through this._on()
  885.         this.element
  886.             .unbind( this.eventNamespace )
  887.             .removeData( this.widgetFullName )
  888.             // support: jquery <1.6.3
  889.             // http://bugs.jquery.com/ticket/9413
  890.             .removeData( $.camelCase( this.widgetFullName ) );
  891.         this.widget()
  892.             .unbind( this.eventNamespace )
  893.             .removeAttr( "aria-disabled" )
  894.             .removeClass(
  895.                 this.widgetFullName + "-disabled " +
  896.                 "ui-state-disabled" );
  897.  
  898.         // clean up events and states
  899.         this.bindings.unbind( this.eventNamespace );
  900.         this.hoverable.removeClass( "ui-state-hover" );
  901.         this.focusable.removeClass( "ui-state-focus" );
  902.     },
  903.     _destroy: $.noop,
  904.  
  905.     widget: function() {
  906.         return this.element;
  907.     },
  908.  
  909.     option: function( key, value ) {
  910.         var options = key,
  911.             parts,
  912.             curOption,
  913.             i;
  914.  
  915.         if ( arguments.length === 0 ) {
  916.             // don't return a reference to the internal hash
  917.             return $.widget.extend( {}, this.options );
  918.         }
  919.  
  920.         if ( typeof key === "string" ) {
  921.             // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  922.             options = {};
  923.             parts = key.split( "." );
  924.             key = parts.shift();
  925.             if ( parts.length ) {
  926.                 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  927.                 for ( i = 0; i < parts.length - 1; i++ ) {
  928.                     curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  929.                     curOption = curOption[ parts[ i ] ];
  930.                 }
  931.                 key = parts.pop();
  932.                 if ( arguments.length === 1 ) {
  933.                     return curOption[ key ] === undefined ? null : curOption[ key ];
  934.                 }
  935.                 curOption[ key ] = value;
  936.             } else {
  937.                 if ( arguments.length === 1 ) {
  938.                     return this.options[ key ] === undefined ? null : this.options[ key ];
  939.                 }
  940.                 options[ key ] = value;
  941.             }
  942.         }
  943.  
  944.         this._setOptions( options );
  945.  
  946.         return this;
  947.     },
  948.     _setOptions: function( options ) {
  949.         var key;
  950.  
  951.         for ( key in options ) {
  952.             this._setOption( key, options[ key ] );
  953.         }
  954.  
  955.         return this;
  956.     },
  957.     _setOption: function( key, value ) {
  958.         this.options[ key ] = value;
  959.  
  960.         if ( key === "disabled" ) {
  961.             this.widget()
  962.                 .toggleClass( this.widgetFullName + "-disabled", !!value );
  963.  
  964.             // If the widget is becoming disabled, then nothing is interactive
  965.             if ( value ) {
  966.                 this.hoverable.removeClass( "ui-state-hover" );
  967.                 this.focusable.removeClass( "ui-state-focus" );
  968.             }
  969.         }
  970.  
  971.         return this;
  972.     },
  973.  
  974.     enable: function() {
  975.         return this._setOptions({ disabled: false });
  976.     },
  977.     disable: function() {
  978.         return this._setOptions({ disabled: true });
  979.     },
  980.  
  981.     _on: function( suppressDisabledCheck, element, handlers ) {
  982.         var delegateElement,
  983.             instance = this;
  984.  
  985.         // no suppressDisabledCheck flag, shuffle arguments
  986.         if ( typeof suppressDisabledCheck !== "boolean" ) {
  987.             handlers = element;
  988.             element = suppressDisabledCheck;
  989.             suppressDisabledCheck = false;
  990.         }
  991.  
  992.         // no element argument, shuffle and use this.element
  993.         if ( !handlers ) {
  994.             handlers = element;
  995.             element = this.element;
  996.             delegateElement = this.widget();
  997.         } else {
  998.             element = delegateElement = $( element );
  999.             this.bindings = this.bindings.add( element );
  1000.         }
  1001.  
  1002.         $.each( handlers, function( event, handler ) {
  1003.             function handlerProxy() {
  1004.                 // allow widgets to customize the disabled handling
  1005.                 // - disabled as an array instead of boolean
  1006.                 // - disabled class as method for disabling individual parts
  1007.                 if ( !suppressDisabledCheck &&
  1008.                         ( instance.options.disabled === true ||
  1009.                             $( this ).hasClass( "ui-state-disabled" ) ) ) {
  1010.                     return;
  1011.                 }
  1012.                 return ( typeof handler === "string" ? instance[ handler ] : handler )
  1013.                     .apply( instance, arguments );
  1014.             }
  1015.  
  1016.             // copy the guid so direct unbinding works
  1017.             if ( typeof handler !== "string" ) {
  1018.                 handlerProxy.guid = handler.guid =
  1019.                     handler.guid || handlerProxy.guid || $.guid++;
  1020.             }
  1021.  
  1022.             var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
  1023.                 eventName = match[1] + instance.eventNamespace,
  1024.                 selector = match[2];
  1025.             if ( selector ) {
  1026.                 delegateElement.delegate( selector, eventName, handlerProxy );
  1027.             } else {
  1028.                 element.bind( eventName, handlerProxy );
  1029.             }
  1030.         });
  1031.     },
  1032.  
  1033.     _off: function( element, eventName ) {
  1034.         eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
  1035.             this.eventNamespace;
  1036.         element.unbind( eventName ).undelegate( eventName );
  1037.  
  1038.         // Clear the stack to avoid memory leaks (#10056)
  1039.         this.bindings = $( this.bindings.not( element ).get() );
  1040.         this.focusable = $( this.focusable.not( element ).get() );
  1041.         this.hoverable = $( this.hoverable.not( element ).get() );
  1042.     },
  1043.  
  1044.     _delay: function( handler, delay ) {
  1045.         function handlerProxy() {
  1046.             return ( typeof handler === "string" ? instance[ handler ] : handler )
  1047.                 .apply( instance, arguments );
  1048.         }
  1049.         var instance = this;
  1050.         return setTimeout( handlerProxy, delay || 0 );
  1051.     },
  1052.  
  1053.     _hoverable: function( element ) {
  1054.         this.hoverable = this.hoverable.add( element );
  1055.         this._on( element, {
  1056.             mouseenter: function( event ) {
  1057.                 $( event.currentTarget ).addClass( "ui-state-hover" );
  1058.             },
  1059.             mouseleave: function( event ) {
  1060.                 $( event.currentTarget ).removeClass( "ui-state-hover" );
  1061.             }
  1062.         });
  1063.     },
  1064.  
  1065.     _focusable: function( element ) {
  1066.         this.focusable = this.focusable.add( element );
  1067.         this._on( element, {
  1068.             focusin: function( event ) {
  1069.                 $( event.currentTarget ).addClass( "ui-state-focus" );
  1070.             },
  1071.             focusout: function( event ) {
  1072.                 $( event.currentTarget ).removeClass( "ui-state-focus" );
  1073.             }
  1074.         });
  1075.     },
  1076.  
  1077.     _trigger: function( type, event, data ) {
  1078.         var prop, orig,
  1079.             callback = this.options[ type ];
  1080.  
  1081.         data = data || {};
  1082.         event = $.Event( event );
  1083.         event.type = ( type === this.widgetEventPrefix ?
  1084.             type :
  1085.             this.widgetEventPrefix + type ).toLowerCase();
  1086.         // the original event may come from any element
  1087.         // so we need to reset the target on the new event
  1088.         event.target = this.element[ 0 ];
  1089.  
  1090.         // copy original event properties over to the new event
  1091.         orig = event.originalEvent;
  1092.         if ( orig ) {
  1093.             for ( prop in orig ) {
  1094.                 if ( !( prop in event ) ) {
  1095.                     event[ prop ] = orig[ prop ];
  1096.                 }
  1097.             }
  1098.         }
  1099.  
  1100.         this.element.trigger( event, data );
  1101.         return !( $.isFunction( callback ) &&
  1102.             callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
  1103.             event.isDefaultPrevented() );
  1104.     }
  1105. };
  1106.  
  1107. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  1108.     $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  1109.         if ( typeof options === "string" ) {
  1110.             options = { effect: options };
  1111.         }
  1112.         var hasOptions,
  1113.             effectName = !options ?
  1114.                 method :
  1115.                 options === true || typeof options === "number" ?
  1116.                     defaultEffect :
  1117.                     options.effect || defaultEffect;
  1118.         options = options || {};
  1119.         if ( typeof options === "number" ) {
  1120.             options = { duration: options };
  1121.         }
  1122.         hasOptions = !$.isEmptyObject( options );
  1123.         options.complete = callback;
  1124.         if ( options.delay ) {
  1125.             element.delay( options.delay );
  1126.         }
  1127.         if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  1128.             element[ method ]( options );
  1129.         } else if ( effectName !== method && element[ effectName ] ) {
  1130.             element[ effectName ]( options.duration, options.easing, callback );
  1131.         } else {
  1132.             element.queue(function( next ) {
  1133.                 $( this )[ method ]();
  1134.                 if ( callback ) {
  1135.                     callback.call( element[ 0 ] );
  1136.                 }
  1137.                 next();
  1138.             });
  1139.         }
  1140.     };
  1141. });
  1142.  
  1143. var widget = $.widget;
  1144.  
  1145.  
  1146. /*!
  1147.  * jQuery UI Mouse 1.11.4
  1148.  * http://jqueryui.com
  1149.  *
  1150.  * Copyright jQuery Foundation and other contributors
  1151.  * Released under the MIT license.
  1152.  * http://jquery.org/license
  1153.  *
  1154.  * http://api.jqueryui.com/mouse/
  1155.  */
  1156.  
  1157.  
  1158. var mouseHandled = false;
  1159. $( document ).mouseup( function() {
  1160.     mouseHandled = false;
  1161. });
  1162.  
  1163. var mouse = $.widget("ui.mouse", {
  1164.     version: "1.11.4",
  1165.     options: {
  1166.         cancel: "input,textarea,button,select,option",
  1167.         distance: 1,
  1168.         delay: 0
  1169.     },
  1170.     _mouseInit: function() {
  1171.         var that = this;
  1172.  
  1173.         this.element
  1174.             .bind("mousedown." + this.widgetName, function(event) {
  1175.                 return that._mouseDown(event);
  1176.             })
  1177.             .bind("click." + this.widgetName, function(event) {
  1178.                 if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  1179.                     $.removeData(event.target, that.widgetName + ".preventClickEvent");
  1180.                     event.stopImmediatePropagation();
  1181.                     return false;
  1182.                 }
  1183.             });
  1184.  
  1185.         this.started = false;
  1186.     },
  1187.  
  1188.     // TODO: make sure destroying one instance of mouse doesn't mess with
  1189.     // other instances of mouse
  1190.     _mouseDestroy: function() {
  1191.         this.element.unbind("." + this.widgetName);
  1192.         if ( this._mouseMoveDelegate ) {
  1193.             this.document
  1194.                 .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
  1195.                 .unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
  1196.         }
  1197.     },
  1198.  
  1199.     _mouseDown: function(event) {
  1200.         // don't let more than one widget handle mouseStart
  1201.         if ( mouseHandled ) {
  1202.             return;
  1203.         }
  1204.  
  1205.         this._mouseMoved = false;
  1206.  
  1207.         // we may have missed mouseup (out of window)
  1208.         (this._mouseStarted && this._mouseUp(event));
  1209.  
  1210.         this._mouseDownEvent = event;
  1211.  
  1212.         var that = this,
  1213.             btnIsLeft = (event.which === 1),
  1214.             // event.target.nodeName works around a bug in IE 8 with
  1215.             // disabled inputs (#7620)
  1216.             elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  1217.         if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  1218.             return true;
  1219.         }
  1220.  
  1221.         this.mouseDelayMet = !this.options.delay;
  1222.         if (!this.mouseDelayMet) {
  1223.             this._mouseDelayTimer = setTimeout(function() {
  1224.                 that.mouseDelayMet = true;
  1225.             }, this.options.delay);
  1226.         }
  1227.  
  1228.         if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  1229.             this._mouseStarted = (this._mouseStart(event) !== false);
  1230.             if (!this._mouseStarted) {
  1231.                 event.preventDefault();
  1232.                 return true;
  1233.             }
  1234.         }
  1235.  
  1236.         // Click event may never have fired (Gecko & Opera)
  1237.         if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  1238.             $.removeData(event.target, this.widgetName + ".preventClickEvent");
  1239.         }
  1240.  
  1241.         // these delegates are required to keep context
  1242.         this._mouseMoveDelegate = function(event) {
  1243.             return that._mouseMove(event);
  1244.         };
  1245.         this._mouseUpDelegate = function(event) {
  1246.             return that._mouseUp(event);
  1247.         };
  1248.  
  1249.         this.document
  1250.             .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1251.             .bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1252.  
  1253.         event.preventDefault();
  1254.  
  1255.         mouseHandled = true;
  1256.         return true;
  1257.     },
  1258.  
  1259.     _mouseMove: function(event) {
  1260.         // Only check for mouseups outside the document if you've moved inside the document
  1261.         // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  1262.         // fire a mousemove event if content is placed under the cursor. See #7778
  1263.         // Support: IE <9
  1264.         if ( this._mouseMoved ) {
  1265.             // IE mouseup check - mouseup happened when mouse was out of window
  1266.             if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
  1267.                 return this._mouseUp(event);
  1268.  
  1269.             // Iframe mouseup check - mouseup occurred in another document
  1270.             } else if ( !event.which ) {
  1271.                 return this._mouseUp( event );
  1272.             }
  1273.         }
  1274.  
  1275.         if ( event.which || event.button ) {
  1276.             this._mouseMoved = true;
  1277.         }
  1278.  
  1279.         if (this._mouseStarted) {
  1280.             this._mouseDrag(event);
  1281.             return event.preventDefault();
  1282.         }
  1283.  
  1284.         if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  1285.             this._mouseStarted =
  1286.                 (this._mouseStart(this._mouseDownEvent, event) !== false);
  1287.             (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  1288.         }
  1289.  
  1290.         return !this._mouseStarted;
  1291.     },
  1292.  
  1293.     _mouseUp: function(event) {
  1294.         this.document
  1295.             .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1296.             .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1297.  
  1298.         if (this._mouseStarted) {
  1299.             this._mouseStarted = false;
  1300.  
  1301.             if (event.target === this._mouseDownEvent.target) {
  1302.                 $.data(event.target, this.widgetName + ".preventClickEvent", true);
  1303.             }
  1304.  
  1305.             this._mouseStop(event);
  1306.         }
  1307.  
  1308.         mouseHandled = false;
  1309.         return false;
  1310.     },
  1311.  
  1312.     _mouseDistanceMet: function(event) {
  1313.         return (Math.max(
  1314.                 Math.abs(this._mouseDownEvent.pageX - event.pageX),
  1315.                 Math.abs(this._mouseDownEvent.pageY - event.pageY)
  1316.             ) >= this.options.distance
  1317.         );
  1318.     },
  1319.  
  1320.     _mouseDelayMet: function(/* event */) {
  1321.         return this.mouseDelayMet;
  1322.     },
  1323.  
  1324.     // These are placeholder methods, to be overriden by extending plugin
  1325.     _mouseStart: function(/* event */) {},
  1326.     _mouseDrag: function(/* event */) {},
  1327.     _mouseStop: function(/* event */) {},
  1328.     _mouseCapture: function(/* event */) { return true; }
  1329. });
  1330.  
  1331.  
  1332. /*!
  1333.  * jQuery UI Position 1.11.4
  1334.  * http://jqueryui.com
  1335.  *
  1336.  * Copyright jQuery Foundation and other contributors
  1337.  * Released under the MIT license.
  1338.  * http://jquery.org/license
  1339.  *
  1340.  * http://api.jqueryui.com/position/
  1341.  */
  1342.  
  1343. (function() {
  1344.  
  1345. $.ui = $.ui || {};
  1346.  
  1347. var cachedScrollbarWidth, supportsOffsetFractions,
  1348.     max = Math.max,
  1349.     abs = Math.abs,
  1350.     round = Math.round,
  1351.     rhorizontal = /left|center|right/,
  1352.     rvertical = /top|center|bottom/,
  1353.     roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  1354.     rposition = /^\w+/,
  1355.     rpercent = /%$/,
  1356.     _position = $.fn.position;
  1357.  
  1358. function getOffsets( offsets, width, height ) {
  1359.     return [
  1360.         parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  1361.         parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  1362.     ];
  1363. }
  1364.  
  1365. function parseCss( element, property ) {
  1366.     return parseInt( $.css( element, property ), 10 ) || 0;
  1367. }
  1368.  
  1369. function getDimensions( elem ) {
  1370.     var raw = elem[0];
  1371.     if ( raw.nodeType === 9 ) {
  1372.         return {
  1373.             width: elem.width(),
  1374.             height: elem.height(),
  1375.             offset: { top: 0, left: 0 }
  1376.         };
  1377.     }
  1378.     if ( $.isWindow( raw ) ) {
  1379.         return {
  1380.             width: elem.width(),
  1381.             height: elem.height(),
  1382.             offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  1383.         };
  1384.     }
  1385.     if ( raw.preventDefault ) {
  1386.         return {
  1387.             width: 0,
  1388.             height: 0,
  1389.             offset: { top: raw.pageY, left: raw.pageX }
  1390.         };
  1391.     }
  1392.     return {
  1393.         width: elem.outerWidth(),
  1394.         height: elem.outerHeight(),
  1395.         offset: elem.offset()
  1396.     };
  1397. }
  1398.  
  1399. $.position = {
  1400.     scrollbarWidth: function() {
  1401.         if ( cachedScrollbarWidth !== undefined ) {
  1402.             return cachedScrollbarWidth;
  1403.         }
  1404.         var w1, w2,
  1405.             div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
  1406.             innerDiv = div.children()[0];
  1407.  
  1408.         $( "body" ).append( div );
  1409.         w1 = innerDiv.offsetWidth;
  1410.         div.css( "overflow", "scroll" );
  1411.  
  1412.         w2 = innerDiv.offsetWidth;
  1413.  
  1414.         if ( w1 === w2 ) {
  1415.             w2 = div[0].clientWidth;
  1416.         }
  1417.  
  1418.         div.remove();
  1419.  
  1420.         return (cachedScrollbarWidth = w1 - w2);
  1421.     },
  1422.     getScrollInfo: function( within ) {
  1423.         var overflowX = within.isWindow || within.isDocument ? "" :
  1424.                 within.element.css( "overflow-x" ),
  1425.             overflowY = within.isWindow || within.isDocument ? "" :
  1426.                 within.element.css( "overflow-y" ),
  1427.             hasOverflowX = overflowX === "scroll" ||
  1428.                 ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
  1429.             hasOverflowY = overflowY === "scroll" ||
  1430.                 ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
  1431.         return {
  1432.             width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  1433.             height: hasOverflowX ? $.position.scrollbarWidth() : 0
  1434.         };
  1435.     },
  1436.     getWithinInfo: function( element ) {
  1437.         var withinElement = $( element || window ),
  1438.             isWindow = $.isWindow( withinElement[0] ),
  1439.             isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
  1440.         return {
  1441.             element: withinElement,
  1442.             isWindow: isWindow,
  1443.             isDocument: isDocument,
  1444.             offset: withinElement.offset() || { left: 0, top: 0 },
  1445.             scrollLeft: withinElement.scrollLeft(),
  1446.             scrollTop: withinElement.scrollTop(),
  1447.  
  1448.             // support: jQuery 1.6.x
  1449.             // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
  1450.             width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
  1451.             height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
  1452.         };
  1453.     }
  1454. };
  1455.  
  1456. $.fn.position = function( options ) {
  1457.     if ( !options || !options.of ) {
  1458.         return _position.apply( this, arguments );
  1459.     }
  1460.  
  1461.     // make a copy, we don't want to modify arguments
  1462.     options = $.extend( {}, options );
  1463.  
  1464.     var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  1465.         target = $( options.of ),
  1466.         within = $.position.getWithinInfo( options.within ),
  1467.         scrollInfo = $.position.getScrollInfo( within ),
  1468.         collision = ( options.collision || "flip" ).split( " " ),
  1469.         offsets = {};
  1470.  
  1471.     dimensions = getDimensions( target );
  1472.     if ( target[0].preventDefault ) {
  1473.         // force left top to allow flipping
  1474.         options.at = "left top";
  1475.     }
  1476.     targetWidth = dimensions.width;
  1477.     targetHeight = dimensions.height;
  1478.     targetOffset = dimensions.offset;
  1479.     // clone to reuse original targetOffset later
  1480.     basePosition = $.extend( {}, targetOffset );
  1481.  
  1482.     // force my and at to have valid horizontal and vertical positions
  1483.     // if a value is missing or invalid, it will be converted to center
  1484.     $.each( [ "my", "at" ], function() {
  1485.         var pos = ( options[ this ] || "" ).split( " " ),
  1486.             horizontalOffset,
  1487.             verticalOffset;
  1488.  
  1489.         if ( pos.length === 1) {
  1490.             pos = rhorizontal.test( pos[ 0 ] ) ?
  1491.                 pos.concat( [ "center" ] ) :
  1492.                 rvertical.test( pos[ 0 ] ) ?
  1493.                     [ "center" ].concat( pos ) :
  1494.                     [ "center", "center" ];
  1495.         }
  1496.         pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  1497.         pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  1498.  
  1499.         // calculate offsets
  1500.         horizontalOffset = roffset.exec( pos[ 0 ] );
  1501.         verticalOffset = roffset.exec( pos[ 1 ] );
  1502.         offsets[ this ] = [
  1503.             horizontalOffset ? horizontalOffset[ 0 ] : 0,
  1504.             verticalOffset ? verticalOffset[ 0 ] : 0
  1505.         ];
  1506.  
  1507.         // reduce to just the positions without the offsets
  1508.         options[ this ] = [
  1509.             rposition.exec( pos[ 0 ] )[ 0 ],
  1510.             rposition.exec( pos[ 1 ] )[ 0 ]
  1511.         ];
  1512.     });
  1513.  
  1514.     // normalize collision option
  1515.     if ( collision.length === 1 ) {
  1516.         collision[ 1 ] = collision[ 0 ];
  1517.     }
  1518.  
  1519.     if ( options.at[ 0 ] === "right" ) {
  1520.         basePosition.left += targetWidth;
  1521.     } else if ( options.at[ 0 ] === "center" ) {
  1522.         basePosition.left += targetWidth / 2;
  1523.     }
  1524.  
  1525.     if ( options.at[ 1 ] === "bottom" ) {
  1526.         basePosition.top += targetHeight;
  1527.     } else if ( options.at[ 1 ] === "center" ) {
  1528.         basePosition.top += targetHeight / 2;
  1529.     }
  1530.  
  1531.     atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  1532.     basePosition.left += atOffset[ 0 ];
  1533.     basePosition.top += atOffset[ 1 ];
  1534.  
  1535.     return this.each(function() {
  1536.         var collisionPosition, using,
  1537.             elem = $( this ),
  1538.             elemWidth = elem.outerWidth(),
  1539.             elemHeight = elem.outerHeight(),
  1540.             marginLeft = parseCss( this, "marginLeft" ),
  1541.             marginTop = parseCss( this, "marginTop" ),
  1542.             collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
  1543.             collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
  1544.             position = $.extend( {}, basePosition ),
  1545.             myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  1546.  
  1547.         if ( options.my[ 0 ] === "right" ) {
  1548.             position.left -= elemWidth;
  1549.         } else if ( options.my[ 0 ] === "center" ) {
  1550.             position.left -= elemWidth / 2;
  1551.         }
  1552.  
  1553.         if ( options.my[ 1 ] === "bottom" ) {
  1554.             position.top -= elemHeight;
  1555.         } else if ( options.my[ 1 ] === "center" ) {
  1556.             position.top -= elemHeight / 2;
  1557.         }
  1558.  
  1559.         position.left += myOffset[ 0 ];
  1560.         position.top += myOffset[ 1 ];
  1561.  
  1562.         // if the browser doesn't support fractions, then round for consistent results
  1563.         if ( !supportsOffsetFractions ) {
  1564.             position.left = round( position.left );
  1565.             position.top = round( position.top );
  1566.         }
  1567.  
  1568.         collisionPosition = {
  1569.             marginLeft: marginLeft,
  1570.             marginTop: marginTop
  1571.         };
  1572.  
  1573.         $.each( [ "left", "top" ], function( i, dir ) {
  1574.             if ( $.ui.position[ collision[ i ] ] ) {
  1575.                 $.ui.position[ collision[ i ] ][ dir ]( position, {
  1576.                     targetWidth: targetWidth,
  1577.                     targetHeight: targetHeight,
  1578.                     elemWidth: elemWidth,
  1579.                     elemHeight: elemHeight,
  1580.                     collisionPosition: collisionPosition,
  1581.                     collisionWidth: collisionWidth,
  1582.                     collisionHeight: collisionHeight,
  1583.                     offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  1584.                     my: options.my,
  1585.                     at: options.at,
  1586.                     within: within,
  1587.                     elem: elem
  1588.                 });
  1589.             }
  1590.         });
  1591.  
  1592.         if ( options.using ) {
  1593.             // adds feedback as second argument to using callback, if present
  1594.             using = function( props ) {
  1595.                 var left = targetOffset.left - position.left,
  1596.                     right = left + targetWidth - elemWidth,
  1597.                     top = targetOffset.top - position.top,
  1598.                     bottom = top + targetHeight - elemHeight,
  1599.                     feedback = {
  1600.                         target: {
  1601.                             element: target,
  1602.                             left: targetOffset.left,
  1603.                             top: targetOffset.top,
  1604.                             width: targetWidth,
  1605.                             height: targetHeight
  1606.                         },
  1607.                         element: {
  1608.                             element: elem,
  1609.                             left: position.left,
  1610.                             top: position.top,
  1611.                             width: elemWidth,
  1612.                             height: elemHeight
  1613.                         },
  1614.                         horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  1615.                         vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  1616.                     };
  1617.                 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  1618.                     feedback.horizontal = "center";
  1619.                 }
  1620.                 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  1621.                     feedback.vertical = "middle";
  1622.                 }
  1623.                 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  1624.                     feedback.important = "horizontal";
  1625.                 } else {
  1626.                     feedback.important = "vertical";
  1627.                 }
  1628.                 options.using.call( this, props, feedback );
  1629.             };
  1630.         }
  1631.  
  1632.         elem.offset( $.extend( position, { using: using } ) );
  1633.     });
  1634. };
  1635.  
  1636. $.ui.position = {
  1637.     fit: {
  1638.         left: function( position, data ) {
  1639.             var within = data.within,
  1640.                 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  1641.                 outerWidth = within.width,
  1642.                 collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1643.                 overLeft = withinOffset - collisionPosLeft,
  1644.                 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  1645.                 newOverRight;
  1646.  
  1647.             // element is wider than within
  1648.             if ( data.collisionWidth > outerWidth ) {
  1649.                 // element is initially over the left side of within
  1650.                 if ( overLeft > 0 && overRight <= 0 ) {
  1651.                     newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
  1652.                     position.left += overLeft - newOverRight;
  1653.                 // element is initially over right side of within
  1654.                 } else if ( overRight > 0 && overLeft <= 0 ) {
  1655.                     position.left = withinOffset;
  1656.                 // element is initially over both left and right sides of within
  1657.                 } else {
  1658.                     if ( overLeft > overRight ) {
  1659.                         position.left = withinOffset + outerWidth - data.collisionWidth;
  1660.                     } else {
  1661.                         position.left = withinOffset;
  1662.                     }
  1663.                 }
  1664.             // too far left -> align with left edge
  1665.             } else if ( overLeft > 0 ) {
  1666.                 position.left += overLeft;
  1667.             // too far right -> align with right edge
  1668.             } else if ( overRight > 0 ) {
  1669.                 position.left -= overRight;
  1670.             // adjust based on position and margin
  1671.             } else {
  1672.                 position.left = max( position.left - collisionPosLeft, position.left );
  1673.             }
  1674.         },
  1675.         top: function( position, data ) {
  1676.             var within = data.within,
  1677.                 withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  1678.                 outerHeight = data.within.height,
  1679.                 collisionPosTop = position.top - data.collisionPosition.marginTop,
  1680.                 overTop = withinOffset - collisionPosTop,
  1681.                 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  1682.                 newOverBottom;
  1683.  
  1684.             // element is taller than within
  1685.             if ( data.collisionHeight > outerHeight ) {
  1686.                 // element is initially over the top of within
  1687.                 if ( overTop > 0 && overBottom <= 0 ) {
  1688.                     newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
  1689.                     position.top += overTop - newOverBottom;
  1690.                 // element is initially over bottom of within
  1691.                 } else if ( overBottom > 0 && overTop <= 0 ) {
  1692.                     position.top = withinOffset;
  1693.                 // element is initially over both top and bottom of within
  1694.                 } else {
  1695.                     if ( overTop > overBottom ) {
  1696.                         position.top = withinOffset + outerHeight - data.collisionHeight;
  1697.                     } else {
  1698.                         position.top = withinOffset;
  1699.                     }
  1700.                 }
  1701.             // too far up -> align with top
  1702.             } else if ( overTop > 0 ) {
  1703.                 position.top += overTop;
  1704.             // too far down -> align with bottom edge
  1705.             } else if ( overBottom > 0 ) {
  1706.                 position.top -= overBottom;
  1707.             // adjust based on position and margin
  1708.             } else {
  1709.                 position.top = max( position.top - collisionPosTop, position.top );
  1710.             }
  1711.         }
  1712.     },
  1713.     flip: {
  1714.         left: function( position, data ) {
  1715.             var within = data.within,
  1716.                 withinOffset = within.offset.left + within.scrollLeft,
  1717.                 outerWidth = within.width,
  1718.                 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  1719.                 collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1720.                 overLeft = collisionPosLeft - offsetLeft,
  1721.                 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  1722.                 myOffset = data.my[ 0 ] === "left" ?
  1723.                     -data.elemWidth :
  1724.                     data.my[ 0 ] === "right" ?
  1725.                         data.elemWidth :
  1726.                         0,
  1727.                 atOffset = data.at[ 0 ] === "left" ?
  1728.                     data.targetWidth :
  1729.                     data.at[ 0 ] === "right" ?
  1730.                         -data.targetWidth :
  1731.                         0,
  1732.                 offset = -2 * data.offset[ 0 ],
  1733.                 newOverRight,
  1734.                 newOverLeft;
  1735.  
  1736.             if ( overLeft < 0 ) {
  1737.                 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
  1738.                 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1739.                     position.left += myOffset + atOffset + offset;
  1740.                 }
  1741.             } else if ( overRight > 0 ) {
  1742.                 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
  1743.                 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1744.                     position.left += myOffset + atOffset + offset;
  1745.                 }
  1746.             }
  1747.         },
  1748.         top: function( position, data ) {
  1749.             var within = data.within,
  1750.                 withinOffset = within.offset.top + within.scrollTop,
  1751.                 outerHeight = within.height,
  1752.                 offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1753.                 collisionPosTop = position.top - data.collisionPosition.marginTop,
  1754.                 overTop = collisionPosTop - offsetTop,
  1755.                 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1756.                 top = data.my[ 1 ] === "top",
  1757.                 myOffset = top ?
  1758.                     -data.elemHeight :
  1759.                     data.my[ 1 ] === "bottom" ?
  1760.                         data.elemHeight :
  1761.                         0,
  1762.                 atOffset = data.at[ 1 ] === "top" ?
  1763.                     data.targetHeight :
  1764.                     data.at[ 1 ] === "bottom" ?
  1765.                         -data.targetHeight :
  1766.                         0,
  1767.                 offset = -2 * data.offset[ 1 ],
  1768.                 newOverTop,
  1769.                 newOverBottom;
  1770.             if ( overTop < 0 ) {
  1771.                 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
  1772.                 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1773.                     position.top += myOffset + atOffset + offset;
  1774.                 }
  1775.             } else if ( overBottom > 0 ) {
  1776.                 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
  1777.                 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1778.                     position.top += myOffset + atOffset + offset;
  1779.                 }
  1780.             }
  1781.         }
  1782.     },
  1783.     flipfit: {
  1784.         left: function() {
  1785.             $.ui.position.flip.left.apply( this, arguments );
  1786.             $.ui.position.fit.left.apply( this, arguments );
  1787.         },
  1788.         top: function() {
  1789.             $.ui.position.flip.top.apply( this, arguments );
  1790.             $.ui.position.fit.top.apply( this, arguments );
  1791.         }
  1792.     }
  1793. };
  1794.  
  1795. // fraction support test
  1796. (function() {
  1797.     var testElement, testElementParent, testElementStyle, offsetLeft, i,
  1798.         body = document.getElementsByTagName( "body" )[ 0 ],
  1799.         div = document.createElement( "div" );
  1800.  
  1801.     //Create a "fake body" for testing based on method used in jQuery.support
  1802.     testElement = document.createElement( body ? "div" : "body" );
  1803.     testElementStyle = {
  1804.         visibility: "hidden",
  1805.         width: 0,
  1806.         height: 0,
  1807.         border: 0,
  1808.         margin: 0,
  1809.         background: "none"
  1810.     };
  1811.     if ( body ) {
  1812.         $.extend( testElementStyle, {
  1813.             position: "absolute",
  1814.             left: "-1000px",
  1815.             top: "-1000px"
  1816.         });
  1817.     }
  1818.     for ( i in testElementStyle ) {
  1819.         testElement.style[ i ] = testElementStyle[ i ];
  1820.     }
  1821.     testElement.appendChild( div );
  1822.     testElementParent = body || document.documentElement;
  1823.     testElementParent.insertBefore( testElement, testElementParent.firstChild );
  1824.  
  1825.     div.style.cssText = "position: absolute; left: 10.7432222px;";
  1826.  
  1827.     offsetLeft = $( div ).offset().left;
  1828.     supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
  1829.  
  1830.     testElement.innerHTML = "";
  1831.     testElementParent.removeChild( testElement );
  1832. })();
  1833.  
  1834. })();
  1835.  
  1836. var position = $.ui.position;
  1837.  
  1838.  
  1839. /*!
  1840.  * jQuery UI Draggable 1.11.4
  1841.  * http://jqueryui.com
  1842.  *
  1843.  * Copyright jQuery Foundation and other contributors
  1844.  * Released under the MIT license.
  1845.  * http://jquery.org/license
  1846.  *
  1847.  * http://api.jqueryui.com/draggable/
  1848.  */
  1849.  
  1850.  
  1851. $.widget("ui.draggable", $.ui.mouse, {
  1852.     version: "1.11.4",
  1853.     widgetEventPrefix: "drag",
  1854.     options: {
  1855.         addClasses: true,
  1856.         appendTo: "parent",
  1857.         axis: false,
  1858.         connectToSortable: false,
  1859.         containment: false,
  1860.         cursor: "auto",
  1861.         cursorAt: false,
  1862.         grid: false,
  1863.         handle: false,
  1864.         helper: "original",
  1865.         iframeFix: false,
  1866.         opacity: false,
  1867.         refreshPositions: false,
  1868.         revert: false,
  1869.         revertDuration: 500,
  1870.         scope: "default",
  1871.         scroll: true,
  1872.         scrollSensitivity: 20,
  1873.         scrollSpeed: 20,
  1874.         snap: false,
  1875.         snapMode: "both",
  1876.         snapTolerance: 20,
  1877.         stack: false,
  1878.         zIndex: false,
  1879.  
  1880.         // callbacks
  1881.         drag: null,
  1882.         start: null,
  1883.         stop: null
  1884.     },
  1885.     _create: function() {
  1886.  
  1887.         if ( this.options.helper === "original" ) {
  1888.             this._setPositionRelative();
  1889.         }
  1890.         if (this.options.addClasses){
  1891.             this.element.addClass("ui-draggable");
  1892.         }
  1893.         if (this.options.disabled){
  1894.             this.element.addClass("ui-draggable-disabled");
  1895.         }
  1896.         this._setHandleClassName();
  1897.  
  1898.         this._mouseInit();
  1899.     },
  1900.  
  1901.     _setOption: function( key, value ) {
  1902.         this._super( key, value );
  1903.         if ( key === "handle" ) {
  1904.             this._removeHandleClassName();
  1905.             this._setHandleClassName();
  1906.         }
  1907.     },
  1908.  
  1909.     _destroy: function() {
  1910.         if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  1911.             this.destroyOnClear = true;
  1912.             return;
  1913.         }
  1914.         this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
  1915.         this._removeHandleClassName();
  1916.         this._mouseDestroy();
  1917.     },
  1918.  
  1919.     _mouseCapture: function(event) {
  1920.         var o = this.options;
  1921.  
  1922.         this._blurActiveElement( event );
  1923.  
  1924.         // among others, prevent a drag on a resizable-handle
  1925.         if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
  1926.             return false;
  1927.         }
  1928.  
  1929.         //Quit if we're not on a valid handle
  1930.         this.handle = this._getHandle(event);
  1931.         if (!this.handle) {
  1932.             return false;
  1933.         }
  1934.  
  1935.         this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  1936.  
  1937.         return true;
  1938.  
  1939.     },
  1940.  
  1941.     _blockFrames: function( selector ) {
  1942.         this.iframeBlocks = this.document.find( selector ).map(function() {
  1943.             var iframe = $( this );
  1944.  
  1945.             return $( "<div>" )
  1946.                 .css( "position", "absolute" )
  1947.                 .appendTo( iframe.parent() )
  1948.                 .outerWidth( iframe.outerWidth() )
  1949.                 .outerHeight( iframe.outerHeight() )
  1950.                 .offset( iframe.offset() )[ 0 ];
  1951.         });
  1952.     },
  1953.  
  1954.     _unblockFrames: function() {
  1955.         if ( this.iframeBlocks ) {
  1956.             this.iframeBlocks.remove();
  1957.             delete this.iframeBlocks;
  1958.         }
  1959.     },
  1960.  
  1961.     _blurActiveElement: function( event ) {
  1962.         var document = this.document[ 0 ];
  1963.  
  1964.         // Only need to blur if the event occurred on the draggable itself, see #10527
  1965.         if ( !this.handleElement.is( event.target ) ) {
  1966.             return;
  1967.         }
  1968.  
  1969.         // support: IE9
  1970.         // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  1971.         try {
  1972.  
  1973.             // Support: IE9, IE10
  1974.             // If the <body> is blurred, IE will switch windows, see #9520
  1975.             if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
  1976.  
  1977.                 // Blur any element that currently has focus, see #4261
  1978.                 $( document.activeElement ).blur();
  1979.             }
  1980.         } catch ( error ) {}
  1981.     },
  1982.  
  1983.     _mouseStart: function(event) {
  1984.  
  1985.         var o = this.options;
  1986.  
  1987.         //Create and append the visible helper
  1988.         this.helper = this._createHelper(event);
  1989.  
  1990.         this.helper.addClass("ui-draggable-dragging");
  1991.  
  1992.         //Cache the helper size
  1993.         this._cacheHelperProportions();
  1994.  
  1995.         //If ddmanager is used for droppables, set the global draggable
  1996.         if ($.ui.ddmanager) {
  1997.             $.ui.ddmanager.current = this;
  1998.         }
  1999.  
  2000.         /*
  2001.          * - Position generation -
  2002.          * This block generates everything position related - it's the core of draggables.
  2003.          */
  2004.  
  2005.         //Cache the margins of the original element
  2006.         this._cacheMargins();
  2007.  
  2008.         //Store the helper's css position
  2009.         this.cssPosition = this.helper.css( "position" );
  2010.         this.scrollParent = this.helper.scrollParent( true );
  2011.         this.offsetParent = this.helper.offsetParent();
  2012.         this.hasFixedAncestor = this.helper.parents().filter(function() {
  2013.                 return $( this ).css( "position" ) === "fixed";
  2014.             }).length > 0;
  2015.  
  2016.         //The element's absolute position on the page minus margins
  2017.         this.positionAbs = this.element.offset();
  2018.         this._refreshOffsets( event );
  2019.  
  2020.         //Generate the original position
  2021.         this.originalPosition = this.position = this._generatePosition( event, false );
  2022.         this.originalPageX = event.pageX;
  2023.         this.originalPageY = event.pageY;
  2024.  
  2025.         //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  2026.         (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  2027.  
  2028.         //Set a containment if given in the options
  2029.         this._setContainment();
  2030.  
  2031.         //Trigger event + callbacks
  2032.         if (this._trigger("start", event) === false) {
  2033.             this._clear();
  2034.             return false;
  2035.         }
  2036.  
  2037.         //Recache the helper size
  2038.         this._cacheHelperProportions();
  2039.  
  2040.         //Prepare the droppable offsets
  2041.         if ($.ui.ddmanager && !o.dropBehaviour) {
  2042.             $.ui.ddmanager.prepareOffsets(this, event);
  2043.         }
  2044.  
  2045.         // Reset helper's right/bottom css if they're set and set explicit width/height instead
  2046.         // as this prevents resizing of elements with right/bottom set (see #7772)
  2047.         this._normalizeRightBottom();
  2048.  
  2049.         this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2050.  
  2051.         //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
  2052.         if ( $.ui.ddmanager ) {
  2053.             $.ui.ddmanager.dragStart(this, event);
  2054.         }
  2055.  
  2056.         return true;
  2057.     },
  2058.  
  2059.     _refreshOffsets: function( event ) {
  2060.         this.offset = {
  2061.             top: this.positionAbs.top - this.margins.top,
  2062.             left: this.positionAbs.left - this.margins.left,
  2063.             scroll: false,
  2064.             parent: this._getParentOffset(),
  2065.             relative: this._getRelativeOffset()
  2066.         };
  2067.  
  2068.         this.offset.click = {
  2069.             left: event.pageX - this.offset.left,
  2070.             top: event.pageY - this.offset.top
  2071.         };
  2072.     },
  2073.  
  2074.     _mouseDrag: function(event, noPropagation) {
  2075.         // reset any necessary cached properties (see #5009)
  2076.         if ( this.hasFixedAncestor ) {
  2077.             this.offset.parent = this._getParentOffset();
  2078.         }
  2079.  
  2080.         //Compute the helpers position
  2081.         this.position = this._generatePosition( event, true );
  2082.         this.positionAbs = this._convertPositionTo("absolute");
  2083.  
  2084.         //Call plugins and callbacks and use the resulting position if something is returned
  2085.         if (!noPropagation) {
  2086.             var ui = this._uiHash();
  2087.             if (this._trigger("drag", event, ui) === false) {
  2088.                 this._mouseUp({});
  2089.                 return false;
  2090.             }
  2091.             this.position = ui.position;
  2092.         }
  2093.  
  2094.         this.helper[ 0 ].style.left = this.position.left + "px";
  2095.         this.helper[ 0 ].style.top = this.position.top + "px";
  2096.  
  2097.         if ($.ui.ddmanager) {
  2098.             $.ui.ddmanager.drag(this, event);
  2099.         }
  2100.  
  2101.         return false;
  2102.     },
  2103.  
  2104.     _mouseStop: function(event) {
  2105.  
  2106.         //If we are using droppables, inform the manager about the drop
  2107.         var that = this,
  2108.             dropped = false;
  2109.         if ($.ui.ddmanager && !this.options.dropBehaviour) {
  2110.             dropped = $.ui.ddmanager.drop(this, event);
  2111.         }
  2112.  
  2113.         //if a drop comes from outside (a sortable)
  2114.         if (this.dropped) {
  2115.             dropped = this.dropped;
  2116.             this.dropped = false;
  2117.         }
  2118.  
  2119.         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))) {
  2120.             $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  2121.                 if (that._trigger("stop", event) !== false) {
  2122.                     that._clear();
  2123.                 }
  2124.             });
  2125.         } else {
  2126.             if (this._trigger("stop", event) !== false) {
  2127.                 this._clear();
  2128.             }
  2129.         }
  2130.  
  2131.         return false;
  2132.     },
  2133.  
  2134.     _mouseUp: function( event ) {
  2135.         this._unblockFrames();
  2136.  
  2137.         //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
  2138.         if ( $.ui.ddmanager ) {
  2139.             $.ui.ddmanager.dragStop(this, event);
  2140.         }
  2141.  
  2142.         // Only need to focus if the event occurred on the draggable itself, see #10527
  2143.         if ( this.handleElement.is( event.target ) ) {
  2144.             // The interaction is over; whether or not the click resulted in a drag, focus the element
  2145.             this.element.focus();
  2146.         }
  2147.  
  2148.         return $.ui.mouse.prototype._mouseUp.call(this, event);
  2149.     },
  2150.  
  2151.     cancel: function() {
  2152.  
  2153.         if (this.helper.is(".ui-draggable-dragging")) {
  2154.             this._mouseUp({});
  2155.         } else {
  2156.             this._clear();
  2157.         }
  2158.  
  2159.         return this;
  2160.  
  2161.     },
  2162.  
  2163.     _getHandle: function(event) {
  2164.         return this.options.handle ?
  2165.             !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  2166.             true;
  2167.     },
  2168.  
  2169.     _setHandleClassName: function() {
  2170.         this.handleElement = this.options.handle ?
  2171.             this.element.find( this.options.handle ) : this.element;
  2172.         this.handleElement.addClass( "ui-draggable-handle" );
  2173.     },
  2174.  
  2175.     _removeHandleClassName: function() {
  2176.         this.handleElement.removeClass( "ui-draggable-handle" );
  2177.     },
  2178.  
  2179.     _createHelper: function(event) {
  2180.  
  2181.         var o = this.options,
  2182.             helperIsFunction = $.isFunction( o.helper ),
  2183.             helper = helperIsFunction ?
  2184.                 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  2185.                 ( o.helper === "clone" ?
  2186.                     this.element.clone().removeAttr( "id" ) :
  2187.                     this.element );
  2188.  
  2189.         if (!helper.parents("body").length) {
  2190.             helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
  2191.         }
  2192.  
  2193.         // http://bugs.jqueryui.com/ticket/9446
  2194.         // a helper function can return the original element
  2195.         // which wouldn't have been set to relative in _create
  2196.         if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  2197.             this._setPositionRelative();
  2198.         }
  2199.  
  2200.         if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
  2201.             helper.css("position", "absolute");
  2202.         }
  2203.  
  2204.         return helper;
  2205.  
  2206.     },
  2207.  
  2208.     _setPositionRelative: function() {
  2209.         if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  2210.             this.element[ 0 ].style.position = "relative";
  2211.         }
  2212.     },
  2213.  
  2214.     _adjustOffsetFromHelper: function(obj) {
  2215.         if (typeof obj === "string") {
  2216.             obj = obj.split(" ");
  2217.         }
  2218.         if ($.isArray(obj)) {
  2219.             obj = { left: +obj[0], top: +obj[1] || 0 };
  2220.         }
  2221.         if ("left" in obj) {
  2222.             this.offset.click.left = obj.left + this.margins.left;
  2223.         }
  2224.         if ("right" in obj) {
  2225.             this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2226.         }
  2227.         if ("top" in obj) {
  2228.             this.offset.click.top = obj.top + this.margins.top;
  2229.         }
  2230.         if ("bottom" in obj) {
  2231.             this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2232.         }
  2233.     },
  2234.  
  2235.     _isRootNode: function( element ) {
  2236.         return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  2237.     },
  2238.  
  2239.     _getParentOffset: function() {
  2240.  
  2241.         //Get the offsetParent and cache its position
  2242.         var po = this.offsetParent.offset(),
  2243.             document = this.document[ 0 ];
  2244.  
  2245.         // This is a special case where we need to modify a offset calculated on start, since the following happened:
  2246.         // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  2247.         // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  2248.         //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  2249.         if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  2250.             po.left += this.scrollParent.scrollLeft();
  2251.             po.top += this.scrollParent.scrollTop();
  2252.         }
  2253.  
  2254.         if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  2255.             po = { top: 0, left: 0 };
  2256.         }
  2257.  
  2258.         return {
  2259.             top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  2260.             left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  2261.         };
  2262.  
  2263.     },
  2264.  
  2265.     _getRelativeOffset: function() {
  2266.         if ( this.cssPosition !== "relative" ) {
  2267.             return { top: 0, left: 0 };
  2268.         }
  2269.  
  2270.         var p = this.element.position(),
  2271.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2272.  
  2273.         return {
  2274.             top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  2275.             left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  2276.         };
  2277.  
  2278.     },
  2279.  
  2280.     _cacheMargins: function() {
  2281.         this.margins = {
  2282.             left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  2283.             top: (parseInt(this.element.css("marginTop"), 10) || 0),
  2284.             right: (parseInt(this.element.css("marginRight"), 10) || 0),
  2285.             bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  2286.         };
  2287.     },
  2288.  
  2289.     _cacheHelperProportions: function() {
  2290.         this.helperProportions = {
  2291.             width: this.helper.outerWidth(),
  2292.             height: this.helper.outerHeight()
  2293.         };
  2294.     },
  2295.  
  2296.     _setContainment: function() {
  2297.  
  2298.         var isUserScrollable, c, ce,
  2299.             o = this.options,
  2300.             document = this.document[ 0 ];
  2301.  
  2302.         this.relativeContainer = null;
  2303.  
  2304.         if ( !o.containment ) {
  2305.             this.containment = null;
  2306.             return;
  2307.         }
  2308.  
  2309.         if ( o.containment === "window" ) {
  2310.             this.containment = [
  2311.                 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  2312.                 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  2313.                 $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
  2314.                 $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  2315.             ];
  2316.             return;
  2317.         }
  2318.  
  2319.         if ( o.containment === "document") {
  2320.             this.containment = [
  2321.                 0,
  2322.                 0,
  2323.                 $( document ).width() - this.helperProportions.width - this.margins.left,
  2324.                 ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
  2325.             ];
  2326.             return;
  2327.         }
  2328.  
  2329.         if ( o.containment.constructor === Array ) {
  2330.             this.containment = o.containment;
  2331.             return;
  2332.         }
  2333.  
  2334.         if ( o.containment === "parent" ) {
  2335.             o.containment = this.helper[ 0 ].parentNode;
  2336.         }
  2337.  
  2338.         c = $( o.containment );
  2339.         ce = c[ 0 ];
  2340.  
  2341.         if ( !ce ) {
  2342.             return;
  2343.         }
  2344.  
  2345.         isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  2346.  
  2347.         this.containment = [
  2348.             ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  2349.             ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  2350.             ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  2351.                 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  2352.                 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  2353.                 this.helperProportions.width -
  2354.                 this.margins.left -
  2355.                 this.margins.right,
  2356.             ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  2357.                 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  2358.                 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  2359.                 this.helperProportions.height -
  2360.                 this.margins.top -
  2361.                 this.margins.bottom
  2362.         ];
  2363.         this.relativeContainer = c;
  2364.     },
  2365.  
  2366.     _convertPositionTo: function(d, pos) {
  2367.  
  2368.         if (!pos) {
  2369.             pos = this.position;
  2370.         }
  2371.  
  2372.         var mod = d === "absolute" ? 1 : -1,
  2373.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2374.  
  2375.         return {
  2376.             top: (
  2377.                 pos.top +                                                               // The absolute mouse position
  2378.                 this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
  2379.                 this.offset.parent.top * mod -                                      // The offsetParent's offset without borders (offset + border)
  2380.                 ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
  2381.             ),
  2382.             left: (
  2383.                 pos.left +                                                              // The absolute mouse position
  2384.                 this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
  2385.                 this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
  2386.                 ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
  2387.             )
  2388.         };
  2389.  
  2390.     },
  2391.  
  2392.     _generatePosition: function( event, constrainPosition ) {
  2393.  
  2394.         var containment, co, top, left,
  2395.             o = this.options,
  2396.             scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  2397.             pageX = event.pageX,
  2398.             pageY = event.pageY;
  2399.  
  2400.         // Cache the scroll
  2401.         if ( !scrollIsRootNode || !this.offset.scroll ) {
  2402.             this.offset.scroll = {
  2403.                 top: this.scrollParent.scrollTop(),
  2404.                 left: this.scrollParent.scrollLeft()
  2405.             };
  2406.         }
  2407.  
  2408.         /*
  2409.          * - Position constraining -
  2410.          * Constrain the position to a mix of grid, containment.
  2411.          */
  2412.  
  2413.         // If we are not dragging yet, we won't check for options
  2414.         if ( constrainPosition ) {
  2415.             if ( this.containment ) {
  2416.                 if ( this.relativeContainer ){
  2417.                     co = this.relativeContainer.offset();
  2418.                     containment = [
  2419.                         this.containment[ 0 ] + co.left,
  2420.                         this.containment[ 1 ] + co.top,
  2421.                         this.containment[ 2 ] + co.left,
  2422.                         this.containment[ 3 ] + co.top
  2423.                     ];
  2424.                 } else {
  2425.                     containment = this.containment;
  2426.                 }
  2427.  
  2428.                 if (event.pageX - this.offset.click.left < containment[0]) {
  2429.                     pageX = containment[0] + this.offset.click.left;
  2430.                 }
  2431.                 if (event.pageY - this.offset.click.top < containment[1]) {
  2432.                     pageY = containment[1] + this.offset.click.top;
  2433.                 }
  2434.                 if (event.pageX - this.offset.click.left > containment[2]) {
  2435.                     pageX = containment[2] + this.offset.click.left;
  2436.                 }
  2437.                 if (event.pageY - this.offset.click.top > containment[3]) {
  2438.                     pageY = containment[3] + this.offset.click.top;
  2439.                 }
  2440.             }
  2441.  
  2442.             if (o.grid) {
  2443.                 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
  2444.                 top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  2445.                 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;
  2446.  
  2447.                 left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
  2448.                 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;
  2449.             }
  2450.  
  2451.             if ( o.axis === "y" ) {
  2452.                 pageX = this.originalPageX;
  2453.             }
  2454.  
  2455.             if ( o.axis === "x" ) {
  2456.                 pageY = this.originalPageY;
  2457.             }
  2458.         }
  2459.  
  2460.         return {
  2461.             top: (
  2462.                 pageY -                                                                 // The absolute mouse position
  2463.                 this.offset.click.top   -                                               // Click offset (relative to the element)
  2464.                 this.offset.relative.top -                                              // Only for relative positioned nodes: Relative offset from element to offset parent
  2465.                 this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
  2466.                 ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  2467.             ),
  2468.             left: (
  2469.                 pageX -                                                                 // The absolute mouse position
  2470.                 this.offset.click.left -                                                // Click offset (relative to the element)
  2471.                 this.offset.relative.left -                                             // Only for relative positioned nodes: Relative offset from element to offset parent
  2472.                 this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
  2473.                 ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  2474.             )
  2475.         };
  2476.  
  2477.     },
  2478.  
  2479.     _clear: function() {
  2480.         this.helper.removeClass("ui-draggable-dragging");
  2481.         if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  2482.             this.helper.remove();
  2483.         }
  2484.         this.helper = null;
  2485.         this.cancelHelperRemoval = false;
  2486.         if ( this.destroyOnClear ) {
  2487.             this.destroy();
  2488.         }
  2489.     },
  2490.  
  2491.     _normalizeRightBottom: function() {
  2492.         if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
  2493.             this.helper.width( this.helper.width() );
  2494.             this.helper.css( "right", "auto" );
  2495.         }
  2496.         if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
  2497.             this.helper.height( this.helper.height() );
  2498.             this.helper.css( "bottom", "auto" );
  2499.         }
  2500.     },
  2501.  
  2502.     // From now on bulk stuff - mainly helpers
  2503.  
  2504.     _trigger: function( type, event, ui ) {
  2505.         ui = ui || this._uiHash();
  2506.         $.ui.plugin.call( this, type, [ event, ui, this ], true );
  2507.  
  2508.         // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  2509.         if ( /^(drag|start|stop)/.test( type ) ) {
  2510.             this.positionAbs = this._convertPositionTo( "absolute" );
  2511.             ui.offset = this.positionAbs;
  2512.         }
  2513.         return $.Widget.prototype._trigger.call( this, type, event, ui );
  2514.     },
  2515.  
  2516.     plugins: {},
  2517.  
  2518.     _uiHash: function() {
  2519.         return {
  2520.             helper: this.helper,
  2521.             position: this.position,
  2522.             originalPosition: this.originalPosition,
  2523.             offset: this.positionAbs
  2524.         };
  2525.     }
  2526.  
  2527. });
  2528.  
  2529. $.ui.plugin.add( "draggable", "connectToSortable", {
  2530.     start: function( event, ui, draggable ) {
  2531.         var uiSortable = $.extend( {}, ui, {
  2532.             item: draggable.element
  2533.         });
  2534.  
  2535.         draggable.sortables = [];
  2536.         $( draggable.options.connectToSortable ).each(function() {
  2537.             var sortable = $( this ).sortable( "instance" );
  2538.  
  2539.             if ( sortable && !sortable.options.disabled ) {
  2540.                 draggable.sortables.push( sortable );
  2541.  
  2542.                 // refreshPositions is called at drag start to refresh the containerCache
  2543.                 // which is used in drag. This ensures it's initialized and synchronized
  2544.                 // with any changes that might have happened on the page since initialization.
  2545.                 sortable.refreshPositions();
  2546.                 sortable._trigger("activate", event, uiSortable);
  2547.             }
  2548.         });
  2549.     },
  2550.     stop: function( event, ui, draggable ) {
  2551.         var uiSortable = $.extend( {}, ui, {
  2552.             item: draggable.element
  2553.         });
  2554.  
  2555.         draggable.cancelHelperRemoval = false;
  2556.  
  2557.         $.each( draggable.sortables, function() {
  2558.             var sortable = this;
  2559.  
  2560.             if ( sortable.isOver ) {
  2561.                 sortable.isOver = 0;
  2562.  
  2563.                 // Allow this sortable to handle removing the helper
  2564.                 draggable.cancelHelperRemoval = true;
  2565.                 sortable.cancelHelperRemoval = false;
  2566.  
  2567.                 // Use _storedCSS To restore properties in the sortable,
  2568.                 // as this also handles revert (#9675) since the draggable
  2569.                 // may have modified them in unexpected ways (#8809)
  2570.                 sortable._storedCSS = {
  2571.                     position: sortable.placeholder.css( "position" ),
  2572.                     top: sortable.placeholder.css( "top" ),
  2573.                     left: sortable.placeholder.css( "left" )
  2574.                 };
  2575.  
  2576.                 sortable._mouseStop(event);
  2577.  
  2578.                 // Once drag has ended, the sortable should return to using
  2579.                 // its original helper, not the shared helper from draggable
  2580.                 sortable.options.helper = sortable.options._helper;
  2581.             } else {
  2582.                 // Prevent this Sortable from removing the helper.
  2583.                 // However, don't set the draggable to remove the helper
  2584.                 // either as another connected Sortable may yet handle the removal.
  2585.                 sortable.cancelHelperRemoval = true;
  2586.  
  2587.                 sortable._trigger( "deactivate", event, uiSortable );
  2588.             }
  2589.         });
  2590.     },
  2591.     drag: function( event, ui, draggable ) {
  2592.         $.each( draggable.sortables, function() {
  2593.             var innermostIntersecting = false,
  2594.                 sortable = this;
  2595.  
  2596.             // Copy over variables that sortable's _intersectsWith uses
  2597.             sortable.positionAbs = draggable.positionAbs;
  2598.             sortable.helperProportions = draggable.helperProportions;
  2599.             sortable.offset.click = draggable.offset.click;
  2600.  
  2601.             if ( sortable._intersectsWith( sortable.containerCache ) ) {
  2602.                 innermostIntersecting = true;
  2603.  
  2604.                 $.each( draggable.sortables, function() {
  2605.                     // Copy over variables that sortable's _intersectsWith uses
  2606.                     this.positionAbs = draggable.positionAbs;
  2607.                     this.helperProportions = draggable.helperProportions;
  2608.                     this.offset.click = draggable.offset.click;
  2609.  
  2610.                     if ( this !== sortable &&
  2611.                             this._intersectsWith( this.containerCache ) &&
  2612.                             $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  2613.                         innermostIntersecting = false;
  2614.                     }
  2615.  
  2616.                     return innermostIntersecting;
  2617.                 });
  2618.             }
  2619.  
  2620.             if ( innermostIntersecting ) {
  2621.                 // If it intersects, we use a little isOver variable and set it once,
  2622.                 // so that the move-in stuff gets fired only once.
  2623.                 if ( !sortable.isOver ) {
  2624.                     sortable.isOver = 1;
  2625.  
  2626.                     // Store draggable's parent in case we need to reappend to it later.
  2627.                     draggable._parent = ui.helper.parent();
  2628.  
  2629.                     sortable.currentItem = ui.helper
  2630.                         .appendTo( sortable.element )
  2631.                         .data( "ui-sortable-item", true );
  2632.  
  2633.                     // Store helper option to later restore it
  2634.                     sortable.options._helper = sortable.options.helper;
  2635.  
  2636.                     sortable.options.helper = function() {
  2637.                         return ui.helper[ 0 ];
  2638.                     };
  2639.  
  2640.                     // Fire the start events of the sortable with our passed browser event,
  2641.                     // and our own helper (so it doesn't create a new one)
  2642.                     event.target = sortable.currentItem[ 0 ];
  2643.                     sortable._mouseCapture( event, true );
  2644.                     sortable._mouseStart( event, true, true );
  2645.  
  2646.                     // Because the browser event is way off the new appended portlet,
  2647.                     // modify necessary variables to reflect the changes
  2648.                     sortable.offset.click.top = draggable.offset.click.top;
  2649.                     sortable.offset.click.left = draggable.offset.click.left;
  2650.                     sortable.offset.parent.left -= draggable.offset.parent.left -
  2651.                         sortable.offset.parent.left;
  2652.                     sortable.offset.parent.top -= draggable.offset.parent.top -
  2653.                         sortable.offset.parent.top;
  2654.  
  2655.                     draggable._trigger( "toSortable", event );
  2656.  
  2657.                     // Inform draggable that the helper is in a valid drop zone,
  2658.                     // used solely in the revert option to handle "valid/invalid".
  2659.                     draggable.dropped = sortable.element;
  2660.  
  2661.                     // Need to refreshPositions of all sortables in the case that
  2662.                     // adding to one sortable changes the location of the other sortables (#9675)
  2663.                     $.each( draggable.sortables, function() {
  2664.                         this.refreshPositions();
  2665.                     });
  2666.  
  2667.                     // hack so receive/update callbacks work (mostly)
  2668.                     draggable.currentItem = draggable.element;
  2669.                     sortable.fromOutside = draggable;
  2670.                 }
  2671.  
  2672.                 if ( sortable.currentItem ) {
  2673.                     sortable._mouseDrag( event );
  2674.                     // Copy the sortable's position because the draggable's can potentially reflect
  2675.                     // a relative position, while sortable is always absolute, which the dragged
  2676.                     // element has now become. (#8809)
  2677.                     ui.position = sortable.position;
  2678.                 }
  2679.             } else {
  2680.                 // If it doesn't intersect with the sortable, and it intersected before,
  2681.                 // we fake the drag stop of the sortable, but make sure it doesn't remove
  2682.                 // the helper by using cancelHelperRemoval.
  2683.                 if ( sortable.isOver ) {
  2684.  
  2685.                     sortable.isOver = 0;
  2686.                     sortable.cancelHelperRemoval = true;
  2687.  
  2688.                     // Calling sortable's mouseStop would trigger a revert,
  2689.                     // so revert must be temporarily false until after mouseStop is called.
  2690.                     sortable.options._revert = sortable.options.revert;
  2691.                     sortable.options.revert = false;
  2692.  
  2693.                     sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  2694.                     sortable._mouseStop( event, true );
  2695.  
  2696.                     // restore sortable behaviors that were modfied
  2697.                     // when the draggable entered the sortable area (#9481)
  2698.                     sortable.options.revert = sortable.options._revert;
  2699.                     sortable.options.helper = sortable.options._helper;
  2700.  
  2701.                     if ( sortable.placeholder ) {
  2702.                         sortable.placeholder.remove();
  2703.                     }
  2704.  
  2705.                     // Restore and recalculate the draggable's offset considering the sortable
  2706.                     // may have modified them in unexpected ways. (#8809, #10669)
  2707.                     ui.helper.appendTo( draggable._parent );
  2708.                     draggable._refreshOffsets( event );
  2709.                     ui.position = draggable._generatePosition( event, true );
  2710.  
  2711.                     draggable._trigger( "fromSortable", event );
  2712.  
  2713.                     // Inform draggable that the helper is no longer in a valid drop zone
  2714.                     draggable.dropped = false;
  2715.  
  2716.                     // Need to refreshPositions of all sortables just in case removing
  2717.                     // from one sortable changes the location of other sortables (#9675)
  2718.                     $.each( draggable.sortables, function() {
  2719.                         this.refreshPositions();
  2720.                     });
  2721.                 }
  2722.             }
  2723.         });
  2724.     }
  2725. });
  2726.  
  2727. $.ui.plugin.add("draggable", "cursor", {
  2728.     start: function( event, ui, instance ) {
  2729.         var t = $( "body" ),
  2730.             o = instance.options;
  2731.  
  2732.         if (t.css("cursor")) {
  2733.             o._cursor = t.css("cursor");
  2734.         }
  2735.         t.css("cursor", o.cursor);
  2736.     },
  2737.     stop: function( event, ui, instance ) {
  2738.         var o = instance.options;
  2739.         if (o._cursor) {
  2740.             $("body").css("cursor", o._cursor);
  2741.         }
  2742.     }
  2743. });
  2744.  
  2745. $.ui.plugin.add("draggable", "opacity", {
  2746.     start: function( event, ui, instance ) {
  2747.         var t = $( ui.helper ),
  2748.             o = instance.options;
  2749.         if (t.css("opacity")) {
  2750.             o._opacity = t.css("opacity");
  2751.         }
  2752.         t.css("opacity", o.opacity);
  2753.     },
  2754.     stop: function( event, ui, instance ) {
  2755.         var o = instance.options;
  2756.         if (o._opacity) {
  2757.             $(ui.helper).css("opacity", o._opacity);
  2758.         }
  2759.     }
  2760. });
  2761.  
  2762. $.ui.plugin.add("draggable", "scroll", {
  2763.     start: function( event, ui, i ) {
  2764.         if ( !i.scrollParentNotHidden ) {
  2765.             i.scrollParentNotHidden = i.helper.scrollParent( false );
  2766.         }
  2767.  
  2768.         if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  2769.             i.overflowOffset = i.scrollParentNotHidden.offset();
  2770.         }
  2771.     },
  2772.     drag: function( event, ui, i  ) {
  2773.  
  2774.         var o = i.options,
  2775.             scrolled = false,
  2776.             scrollParent = i.scrollParentNotHidden[ 0 ],
  2777.             document = i.document[ 0 ];
  2778.  
  2779.         if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  2780.             if ( !o.axis || o.axis !== "x" ) {
  2781.                 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
  2782.                     scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  2783.                 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  2784.                     scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  2785.                 }
  2786.             }
  2787.  
  2788.             if ( !o.axis || o.axis !== "y" ) {
  2789.                 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
  2790.                     scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  2791.                 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  2792.                     scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  2793.                 }
  2794.             }
  2795.  
  2796.         } else {
  2797.  
  2798.             if (!o.axis || o.axis !== "x") {
  2799.                 if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  2800.                     scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2801.                 } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
  2802.                     scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2803.                 }
  2804.             }
  2805.  
  2806.             if (!o.axis || o.axis !== "y") {
  2807.                 if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  2808.                     scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2809.                 } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
  2810.                     scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2811.                 }
  2812.             }
  2813.  
  2814.         }
  2815.  
  2816.         if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  2817.             $.ui.ddmanager.prepareOffsets(i, event);
  2818.         }
  2819.  
  2820.     }
  2821. });
  2822.  
  2823. $.ui.plugin.add("draggable", "snap", {
  2824.     start: function( event, ui, i ) {
  2825.  
  2826.         var o = i.options;
  2827.  
  2828.         i.snapElements = [];
  2829.  
  2830.         $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
  2831.             var $t = $(this),
  2832.                 $o = $t.offset();
  2833.             if (this !== i.element[0]) {
  2834.                 i.snapElements.push({
  2835.                     item: this,
  2836.                     width: $t.outerWidth(), height: $t.outerHeight(),
  2837.                     top: $o.top, left: $o.left
  2838.                 });
  2839.             }
  2840.         });
  2841.  
  2842.     },
  2843.     drag: function( event, ui, inst ) {
  2844.  
  2845.         var ts, bs, ls, rs, l, r, t, b, i, first,
  2846.             o = inst.options,
  2847.             d = o.snapTolerance,
  2848.             x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  2849.             y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  2850.  
  2851.         for (i = inst.snapElements.length - 1; i >= 0; i--){
  2852.  
  2853.             l = inst.snapElements[i].left - inst.margins.left;
  2854.             r = l + inst.snapElements[i].width;
  2855.             t = inst.snapElements[i].top - inst.margins.top;
  2856.             b = t + inst.snapElements[i].height;
  2857.  
  2858.             if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
  2859.                 if (inst.snapElements[i].snapping) {
  2860.                     (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  2861.                 }
  2862.                 inst.snapElements[i].snapping = false;
  2863.                 continue;
  2864.             }
  2865.  
  2866.             if (o.snapMode !== "inner") {
  2867.                 ts = Math.abs(t - y2) <= d;
  2868.                 bs = Math.abs(b - y1) <= d;
  2869.                 ls = Math.abs(l - x2) <= d;
  2870.                 rs = Math.abs(r - x1) <= d;
  2871.                 if (ts) {
  2872.                     ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
  2873.                 }
  2874.                 if (bs) {
  2875.                     ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
  2876.                 }
  2877.                 if (ls) {
  2878.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
  2879.                 }
  2880.                 if (rs) {
  2881.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
  2882.                 }
  2883.             }
  2884.  
  2885.             first = (ts || bs || ls || rs);
  2886.  
  2887.             if (o.snapMode !== "outer") {
  2888.                 ts = Math.abs(t - y1) <= d;
  2889.                 bs = Math.abs(b - y2) <= d;
  2890.                 ls = Math.abs(l - x1) <= d;
  2891.                 rs = Math.abs(r - x2) <= d;
  2892.                 if (ts) {
  2893.                     ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
  2894.                 }
  2895.                 if (bs) {
  2896.                     ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
  2897.                 }
  2898.                 if (ls) {
  2899.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
  2900.                 }
  2901.                 if (rs) {
  2902.                     ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
  2903.                 }
  2904.             }
  2905.  
  2906.             if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  2907.                 (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  2908.             }
  2909.             inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  2910.  
  2911.         }
  2912.  
  2913.     }
  2914. });
  2915.  
  2916. $.ui.plugin.add("draggable", "stack", {
  2917.     start: function( event, ui, instance ) {
  2918.         var min,
  2919.             o = instance.options,
  2920.             group = $.makeArray($(o.stack)).sort(function(a, b) {
  2921.                 return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
  2922.             });
  2923.  
  2924.         if (!group.length) { return; }
  2925.  
  2926.         min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  2927.         $(group).each(function(i) {
  2928.             $(this).css("zIndex", min + i);
  2929.         });
  2930.         this.css("zIndex", (min + group.length));
  2931.     }
  2932. });
  2933.  
  2934. $.ui.plugin.add("draggable", "zIndex", {
  2935.     start: function( event, ui, instance ) {
  2936.         var t = $( ui.helper ),
  2937.             o = instance.options;
  2938.  
  2939.         if (t.css("zIndex")) {
  2940.             o._zIndex = t.css("zIndex");
  2941.         }
  2942.         t.css("zIndex", o.zIndex);
  2943.     },
  2944.     stop: function( event, ui, instance ) {
  2945.         var o = instance.options;
  2946.  
  2947.         if (o._zIndex) {
  2948.             $(ui.helper).css("zIndex", o._zIndex);
  2949.         }
  2950.     }
  2951. });
  2952.  
  2953. var draggable = $.ui.draggable;
  2954.  
  2955.  
  2956. /*!
  2957.  * jQuery UI Droppable 1.11.4
  2958.  * http://jqueryui.com
  2959.  *
  2960.  * Copyright jQuery Foundation and other contributors
  2961.  * Released under the MIT license.
  2962.  * http://jquery.org/license
  2963.  *
  2964.  * http://api.jqueryui.com/droppable/
  2965.  */
  2966.  
  2967.  
  2968. $.widget( "ui.droppable", {
  2969.     version: "1.11.4",
  2970.     widgetEventPrefix: "drop",
  2971.     options: {
  2972.         accept: "*",
  2973.         activeClass: false,
  2974.         addClasses: true,
  2975.         greedy: false,
  2976.         hoverClass: false,
  2977.         scope: "default",
  2978.         tolerance: "intersect",
  2979.  
  2980.         // callbacks
  2981.         activate: null,
  2982.         deactivate: null,
  2983.         drop: null,
  2984.         out: null,
  2985.         over: null
  2986.     },
  2987.     _create: function() {
  2988.  
  2989.         var proportions,
  2990.             o = this.options,
  2991.             accept = o.accept;
  2992.  
  2993.         this.isover = false;
  2994.         this.isout = true;
  2995.  
  2996.         this.accept = $.isFunction( accept ) ? accept : function( d ) {
  2997.             return d.is( accept );
  2998.         };
  2999.  
  3000.         this.proportions = function( /* valueToWrite */ ) {
  3001.             if ( arguments.length ) {
  3002.                 // Store the droppable's proportions
  3003.                 proportions = arguments[ 0 ];
  3004.             } else {
  3005.                 // Retrieve or derive the droppable's proportions
  3006.                 return proportions ?
  3007.                     proportions :
  3008.                     proportions = {
  3009.                         width: this.element[ 0 ].offsetWidth,
  3010.                         height: this.element[ 0 ].offsetHeight
  3011.                     };
  3012.             }
  3013.         };
  3014.  
  3015.         this._addToManager( o.scope );
  3016.  
  3017.         o.addClasses && this.element.addClass( "ui-droppable" );
  3018.  
  3019.     },
  3020.  
  3021.     _addToManager: function( scope ) {
  3022.         // Add the reference and positions to the manager
  3023.         $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  3024.         $.ui.ddmanager.droppables[ scope ].push( this );
  3025.     },
  3026.  
  3027.     _splice: function( drop ) {
  3028.         var i = 0;
  3029.         for ( ; i < drop.length; i++ ) {
  3030.             if ( drop[ i ] === this ) {
  3031.                 drop.splice( i, 1 );
  3032.             }
  3033.         }
  3034.     },
  3035.  
  3036.     _destroy: function() {
  3037.         var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  3038.  
  3039.         this._splice( drop );
  3040.  
  3041.         this.element.removeClass( "ui-droppable ui-droppable-disabled" );
  3042.     },
  3043.  
  3044.     _setOption: function( key, value ) {
  3045.  
  3046.         if ( key === "accept" ) {
  3047.             this.accept = $.isFunction( value ) ? value : function( d ) {
  3048.                 return d.is( value );
  3049.             };
  3050.         } else if ( key === "scope" ) {
  3051.             var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  3052.  
  3053.             this._splice( drop );
  3054.             this._addToManager( value );
  3055.         }
  3056.  
  3057.         this._super( key, value );
  3058.     },
  3059.  
  3060.     _activate: function( event ) {
  3061.         var draggable = $.ui.ddmanager.current;
  3062.         if ( this.options.activeClass ) {
  3063.             this.element.addClass( this.options.activeClass );
  3064.         }
  3065.         if ( draggable ){
  3066.             this._trigger( "activate", event, this.ui( draggable ) );
  3067.         }
  3068.     },
  3069.  
  3070.     _deactivate: function( event ) {
  3071.         var draggable = $.ui.ddmanager.current;
  3072.         if ( this.options.activeClass ) {
  3073.             this.element.removeClass( this.options.activeClass );
  3074.         }
  3075.         if ( draggable ){
  3076.             this._trigger( "deactivate", event, this.ui( draggable ) );
  3077.         }
  3078.     },
  3079.  
  3080.     _over: function( event ) {
  3081.  
  3082.         var draggable = $.ui.ddmanager.current;
  3083.  
  3084.         // Bail if draggable and droppable are same element
  3085.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3086.             return;
  3087.         }
  3088.  
  3089.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3090.             if ( this.options.hoverClass ) {
  3091.                 this.element.addClass( this.options.hoverClass );
  3092.             }
  3093.             this._trigger( "over", event, this.ui( draggable ) );
  3094.         }
  3095.  
  3096.     },
  3097.  
  3098.     _out: function( event ) {
  3099.  
  3100.         var draggable = $.ui.ddmanager.current;
  3101.  
  3102.         // Bail if draggable and droppable are same element
  3103.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3104.             return;
  3105.         }
  3106.  
  3107.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3108.             if ( this.options.hoverClass ) {
  3109.                 this.element.removeClass( this.options.hoverClass );
  3110.             }
  3111.             this._trigger( "out", event, this.ui( draggable ) );
  3112.         }
  3113.  
  3114.     },
  3115.  
  3116.     _drop: function( event, custom ) {
  3117.  
  3118.         var draggable = custom || $.ui.ddmanager.current,
  3119.             childrenIntersection = false;
  3120.  
  3121.         // Bail if draggable and droppable are same element
  3122.         if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
  3123.             return false;
  3124.         }
  3125.  
  3126.         this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
  3127.             var inst = $( this ).droppable( "instance" );
  3128.             if (
  3129.                 inst.options.greedy &&
  3130.                 !inst.options.disabled &&
  3131.                 inst.options.scope === draggable.options.scope &&
  3132.                 inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
  3133.                 $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
  3134.             ) { childrenIntersection = true; return false; }
  3135.         });
  3136.         if ( childrenIntersection ) {
  3137.             return false;
  3138.         }
  3139.  
  3140.         if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3141.             if ( this.options.activeClass ) {
  3142.                 this.element.removeClass( this.options.activeClass );
  3143.             }
  3144.             if ( this.options.hoverClass ) {
  3145.                 this.element.removeClass( this.options.hoverClass );
  3146.             }
  3147.             this._trigger( "drop", event, this.ui( draggable ) );
  3148.             return this.element;
  3149.         }
  3150.  
  3151.         return false;
  3152.  
  3153.     },
  3154.  
  3155.     ui: function( c ) {
  3156.         return {
  3157.             draggable: ( c.currentItem || c.element ),
  3158.             helper: c.helper,
  3159.             position: c.position,
  3160.             offset: c.positionAbs
  3161.         };
  3162.     }
  3163.  
  3164. });
  3165.  
  3166. $.ui.intersect = (function() {
  3167.     function isOverAxis( x, reference, size ) {
  3168.         return ( x >= reference ) && ( x < ( reference + size ) );
  3169.     }
  3170.  
  3171.     return function( draggable, droppable, toleranceMode, event ) {
  3172.  
  3173.         if ( !droppable.offset ) {
  3174.             return false;
  3175.         }
  3176.  
  3177.         var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
  3178.             y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
  3179.             x2 = x1 + draggable.helperProportions.width,
  3180.             y2 = y1 + draggable.helperProportions.height,
  3181.             l = droppable.offset.left,
  3182.             t = droppable.offset.top,
  3183.             r = l + droppable.proportions().width,
  3184.             b = t + droppable.proportions().height;
  3185.  
  3186.         switch ( toleranceMode ) {
  3187.         case "fit":
  3188.             return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  3189.         case "intersect":
  3190.             return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  3191.                 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  3192.                 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  3193.                 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  3194.         case "pointer":
  3195.             return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
  3196.         case "touch":
  3197.             return (
  3198.                 ( y1 >= t && y1 <= b ) || // Top edge touching
  3199.                 ( y2 >= t && y2 <= b ) || // Bottom edge touching
  3200.                 ( y1 < t && y2 > b ) // Surrounded vertically
  3201.             ) && (
  3202.                 ( x1 >= l && x1 <= r ) || // Left edge touching
  3203.                 ( x2 >= l && x2 <= r ) || // Right edge touching
  3204.                 ( x1 < l && x2 > r ) // Surrounded horizontally
  3205.             );
  3206.         default:
  3207.             return false;
  3208.         }
  3209.     };
  3210. })();
  3211.  
  3212. /*
  3213.     This manager tracks offsets of draggables and droppables
  3214. */
  3215. $.ui.ddmanager = {
  3216.     current: null,
  3217.     droppables: { "default": [] },
  3218.     prepareOffsets: function( t, event ) {
  3219.  
  3220.         var i, j,
  3221.             m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  3222.             type = event ? event.type : null, // workaround for #2317
  3223.             list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  3224.  
  3225.         droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  3226.  
  3227.             // No disabled and non-accepted
  3228.             if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
  3229.                 continue;
  3230.             }
  3231.  
  3232.             // Filter out elements in the current dragged item
  3233.             for ( j = 0; j < list.length; j++ ) {
  3234.                 if ( list[ j ] === m[ i ].element[ 0 ] ) {
  3235.                     m[ i ].proportions().height = 0;
  3236.                     continue droppablesLoop;
  3237.                 }
  3238.             }
  3239.  
  3240.             m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  3241.             if ( !m[ i ].visible ) {
  3242.                 continue;
  3243.             }
  3244.  
  3245.             // Activate the droppable if used directly from draggables
  3246.             if ( type === "mousedown" ) {
  3247.                 m[ i ]._activate.call( m[ i ], event );
  3248.             }
  3249.  
  3250.             m[ i ].offset = m[ i ].element.offset();
  3251.             m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
  3252.  
  3253.         }
  3254.  
  3255.     },
  3256.     drop: function( draggable, event ) {
  3257.  
  3258.         var dropped = false;
  3259.         // Create a copy of the droppables in case the list changes during the drop (#9116)
  3260.         $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  3261.  
  3262.             if ( !this.options ) {
  3263.                 return;
  3264.             }
  3265.             if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
  3266.                 dropped = this._drop.call( this, event ) || dropped;
  3267.             }
  3268.  
  3269.             if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
  3270.                 this.isout = true;
  3271.                 this.isover = false;
  3272.                 this._deactivate.call( this, event );
  3273.             }
  3274.  
  3275.         });
  3276.         return dropped;
  3277.  
  3278.     },
  3279.     dragStart: function( draggable, event ) {
  3280.         // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
  3281.         draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
  3282.             if ( !draggable.options.refreshPositions ) {
  3283.                 $.ui.ddmanager.prepareOffsets( draggable, event );
  3284.             }
  3285.         });
  3286.     },
  3287.     drag: function( draggable, event ) {
  3288.  
  3289.         // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  3290.         if ( draggable.options.refreshPositions ) {
  3291.             $.ui.ddmanager.prepareOffsets( draggable, event );
  3292.         }
  3293.  
  3294.         // Run through all droppables and check their positions based on specific tolerance options
  3295.         $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  3296.  
  3297.             if ( this.options.disabled || this.greedyChild || !this.visible ) {
  3298.                 return;
  3299.             }
  3300.  
  3301.             var parentInstance, scope, parent,
  3302.                 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
  3303.                 c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
  3304.             if ( !c ) {
  3305.                 return;
  3306.             }
  3307.  
  3308.             if ( this.options.greedy ) {
  3309.                 // find droppable parents with same scope
  3310.                 scope = this.options.scope;
  3311.                 parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
  3312.                     return $( this ).droppable( "instance" ).options.scope === scope;
  3313.                 });
  3314.  
  3315.                 if ( parent.length ) {
  3316.                     parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  3317.                     parentInstance.greedyChild = ( c === "isover" );
  3318.                 }
  3319.             }
  3320.  
  3321.             // we just moved into a greedy child
  3322.             if ( parentInstance && c === "isover" ) {
  3323.                 parentInstance.isover = false;
  3324.                 parentInstance.isout = true;
  3325.                 parentInstance._out.call( parentInstance, event );
  3326.             }
  3327.  
  3328.             this[ c ] = true;
  3329.             this[c === "isout" ? "isover" : "isout"] = false;
  3330.             this[c === "isover" ? "_over" : "_out"].call( this, event );
  3331.  
  3332.             // we just moved out of a greedy child
  3333.             if ( parentInstance && c === "isout" ) {
  3334.                 parentInstance.isout = false;
  3335.                 parentInstance.isover = true;
  3336.                 parentInstance._over.call( parentInstance, event );
  3337.             }
  3338.         });
  3339.  
  3340.     },
  3341.     dragStop: function( draggable, event ) {
  3342.         draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
  3343.         // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
  3344.         if ( !draggable.options.refreshPositions ) {
  3345.             $.ui.ddmanager.prepareOffsets( draggable, event );
  3346.         }
  3347.     }
  3348. };
  3349.  
  3350. var droppable = $.ui.droppable;
  3351.  
  3352.  
  3353. /*!
  3354.  * jQuery UI Resizable 1.11.4
  3355.  * http://jqueryui.com
  3356.  *
  3357.  * Copyright jQuery Foundation and other contributors
  3358.  * Released under the MIT license.
  3359.  * http://jquery.org/license
  3360.  *
  3361.  * http://api.jqueryui.com/resizable/
  3362.  */
  3363.  
  3364.  
  3365. $.widget("ui.resizable", $.ui.mouse, {
  3366.     version: "1.11.4",
  3367.     widgetEventPrefix: "resize",
  3368.     options: {
  3369.         alsoResize: false,
  3370.         animate: false,
  3371.         animateDuration: "slow",
  3372.         animateEasing: "swing",
  3373.         aspectRatio: false,
  3374.         autoHide: false,
  3375.         containment: false,
  3376.         ghost: false,
  3377.         grid: false,
  3378.         handles: "e,s,se",
  3379.         helper: false,
  3380.         maxHeight: null,
  3381.         maxWidth: null,
  3382.         minHeight: 10,
  3383.         minWidth: 10,
  3384.         // See #7960
  3385.         zIndex: 90,
  3386.  
  3387.         // callbacks
  3388.         resize: null,
  3389.         start: null,
  3390.         stop: null
  3391.     },
  3392.  
  3393.     _num: function( value ) {
  3394.         return parseInt( value, 10 ) || 0;
  3395.     },
  3396.  
  3397.     _isNumber: function( value ) {
  3398.         return !isNaN( parseInt( value, 10 ) );
  3399.     },
  3400.  
  3401.     _hasScroll: function( el, a ) {
  3402.  
  3403.         if ( $( el ).css( "overflow" ) === "hidden") {
  3404.             return false;
  3405.         }
  3406.  
  3407.         var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  3408.             has = false;
  3409.  
  3410.         if ( el[ scroll ] > 0 ) {
  3411.             return true;
  3412.         }
  3413.  
  3414.         // TODO: determine which cases actually cause this to happen
  3415.         // if the element doesn't have the scroll set, see if it's possible to
  3416.         // set the scroll
  3417.         el[ scroll ] = 1;
  3418.         has = ( el[ scroll ] > 0 );
  3419.         el[ scroll ] = 0;
  3420.         return has;
  3421.     },
  3422.  
  3423.     _create: function() {
  3424.  
  3425.         var n, i, handle, axis, hname,
  3426.             that = this,
  3427.             o = this.options;
  3428.         this.element.addClass("ui-resizable");
  3429.  
  3430.         $.extend(this, {
  3431.             _aspectRatio: !!(o.aspectRatio),
  3432.             aspectRatio: o.aspectRatio,
  3433.             originalElement: this.element,
  3434.             _proportionallyResizeElements: [],
  3435.             _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  3436.         });
  3437.  
  3438.         // Wrap the element if it cannot hold child nodes
  3439.         if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
  3440.  
  3441.             this.element.wrap(
  3442.                 $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
  3443.                     position: this.element.css("position"),
  3444.                     width: this.element.outerWidth(),
  3445.                     height: this.element.outerHeight(),
  3446.                     top: this.element.css("top"),
  3447.                     left: this.element.css("left")
  3448.                 })
  3449.             );
  3450.  
  3451.             this.element = this.element.parent().data(
  3452.                 "ui-resizable", this.element.resizable( "instance" )
  3453.             );
  3454.  
  3455.             this.elementIsWrapper = true;
  3456.  
  3457.             this.element.css({
  3458.                 marginLeft: this.originalElement.css("marginLeft"),
  3459.                 marginTop: this.originalElement.css("marginTop"),
  3460.                 marginRight: this.originalElement.css("marginRight"),
  3461.                 marginBottom: this.originalElement.css("marginBottom")
  3462.             });
  3463.             this.originalElement.css({
  3464.                 marginLeft: 0,
  3465.                 marginTop: 0,
  3466.                 marginRight: 0,
  3467.                 marginBottom: 0
  3468.             });
  3469.             // support: Safari
  3470.             // Prevent Safari textarea resize
  3471.             this.originalResizeStyle = this.originalElement.css("resize");
  3472.             this.originalElement.css("resize", "none");
  3473.  
  3474.             this._proportionallyResizeElements.push( this.originalElement.css({
  3475.                 position: "static",
  3476.                 zoom: 1,
  3477.                 display: "block"
  3478.             }) );
  3479.  
  3480.             // support: IE9
  3481.             // avoid IE jump (hard set the margin)
  3482.             this.originalElement.css({ margin: this.originalElement.css("margin") });
  3483.  
  3484.             this._proportionallyResize();
  3485.         }
  3486.  
  3487.         this.handles = o.handles ||
  3488.             ( !$(".ui-resizable-handle", this.element).length ?
  3489.                 "e,s,se" : {
  3490.                     n: ".ui-resizable-n",
  3491.                     e: ".ui-resizable-e",
  3492.                     s: ".ui-resizable-s",
  3493.                     w: ".ui-resizable-w",
  3494.                     se: ".ui-resizable-se",
  3495.                     sw: ".ui-resizable-sw",
  3496.                     ne: ".ui-resizable-ne",
  3497.                     nw: ".ui-resizable-nw"
  3498.                 } );
  3499.  
  3500.         this._handles = $();
  3501.         if ( this.handles.constructor === String ) {
  3502.  
  3503.             if ( this.handles === "all") {
  3504.                 this.handles = "n,e,s,w,se,sw,ne,nw";
  3505.             }
  3506.  
  3507.             n = this.handles.split(",");
  3508.             this.handles = {};
  3509.  
  3510.             for (i = 0; i < n.length; i++) {
  3511.  
  3512.                 handle = $.trim(n[i]);
  3513.                 hname = "ui-resizable-" + handle;
  3514.                 axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
  3515.  
  3516.                 axis.css({ zIndex: o.zIndex });
  3517.  
  3518.                 // TODO : What's going on here?
  3519.                 if ("se" === handle) {
  3520.                     axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
  3521.                 }
  3522.  
  3523.                 this.handles[handle] = ".ui-resizable-" + handle;
  3524.                 this.element.append(axis);
  3525.             }
  3526.  
  3527.         }
  3528.  
  3529.         this._renderAxis = function(target) {
  3530.  
  3531.             var i, axis, padPos, padWrapper;
  3532.  
  3533.             target = target || this.element;
  3534.  
  3535.             for (i in this.handles) {
  3536.  
  3537.                 if (this.handles[i].constructor === String) {
  3538.                     this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
  3539.                 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
  3540.                     this.handles[ i ] = $( this.handles[ i ] );
  3541.                     this._on( this.handles[ i ], { "mousedown": that._mouseDown });
  3542.                 }
  3543.  
  3544.                 if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
  3545.  
  3546.                     axis = $(this.handles[i], this.element);
  3547.  
  3548.                     padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  3549.  
  3550.                     padPos = [ "padding",
  3551.                         /ne|nw|n/.test(i) ? "Top" :
  3552.                         /se|sw|s/.test(i) ? "Bottom" :
  3553.                         /^e$/.test(i) ? "Right" : "Left" ].join("");
  3554.  
  3555.                     target.css(padPos, padWrapper);
  3556.  
  3557.                     this._proportionallyResize();
  3558.                 }
  3559.  
  3560.                 this._handles = this._handles.add( this.handles[ i ] );
  3561.             }
  3562.         };
  3563.  
  3564.         // TODO: make renderAxis a prototype function
  3565.         this._renderAxis(this.element);
  3566.  
  3567.         this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
  3568.         this._handles.disableSelection();
  3569.  
  3570.         this._handles.mouseover(function() {
  3571.             if (!that.resizing) {
  3572.                 if (this.className) {
  3573.                     axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  3574.                 }
  3575.                 that.axis = axis && axis[1] ? axis[1] : "se";
  3576.             }
  3577.         });
  3578.  
  3579.         if (o.autoHide) {
  3580.             this._handles.hide();
  3581.             $(this.element)
  3582.                 .addClass("ui-resizable-autohide")
  3583.                 .mouseenter(function() {
  3584.                     if (o.disabled) {
  3585.                         return;
  3586.                     }
  3587.                     $(this).removeClass("ui-resizable-autohide");
  3588.                     that._handles.show();
  3589.                 })
  3590.                 .mouseleave(function() {
  3591.                     if (o.disabled) {
  3592.                         return;
  3593.                     }
  3594.                     if (!that.resizing) {
  3595.                         $(this).addClass("ui-resizable-autohide");
  3596.                         that._handles.hide();
  3597.                     }
  3598.                 });
  3599.         }
  3600.  
  3601.         this._mouseInit();
  3602.     },
  3603.  
  3604.     _destroy: function() {
  3605.  
  3606.         this._mouseDestroy();
  3607.  
  3608.         var wrapper,
  3609.             _destroy = function(exp) {
  3610.                 $(exp)
  3611.                     .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  3612.                     .removeData("resizable")
  3613.                     .removeData("ui-resizable")
  3614.                     .unbind(".resizable")
  3615.                     .find(".ui-resizable-handle")
  3616.                         .remove();
  3617.             };
  3618.  
  3619.         // TODO: Unwrap at same DOM position
  3620.         if (this.elementIsWrapper) {
  3621.             _destroy(this.element);
  3622.             wrapper = this.element;
  3623.             this.originalElement.css({
  3624.                 position: wrapper.css("position"),
  3625.                 width: wrapper.outerWidth(),
  3626.                 height: wrapper.outerHeight(),
  3627.                 top: wrapper.css("top"),
  3628.                 left: wrapper.css("left")
  3629.             }).insertAfter( wrapper );
  3630.             wrapper.remove();
  3631.         }
  3632.  
  3633.         this.originalElement.css("resize", this.originalResizeStyle);
  3634.         _destroy(this.originalElement);
  3635.  
  3636.         return this;
  3637.     },
  3638.  
  3639.     _mouseCapture: function(event) {
  3640.         var i, handle,
  3641.             capture = false;
  3642.  
  3643.         for (i in this.handles) {
  3644.             handle = $(this.handles[i])[0];
  3645.             if (handle === event.target || $.contains(handle, event.target)) {
  3646.                 capture = true;
  3647.             }
  3648.         }
  3649.  
  3650.         return !this.options.disabled && capture;
  3651.     },
  3652.  
  3653.     _mouseStart: function(event) {
  3654.  
  3655.         var curleft, curtop, cursor,
  3656.             o = this.options,
  3657.             el = this.element;
  3658.  
  3659.         this.resizing = true;
  3660.  
  3661.         this._renderProxy();
  3662.  
  3663.         curleft = this._num(this.helper.css("left"));
  3664.         curtop = this._num(this.helper.css("top"));
  3665.  
  3666.         if (o.containment) {
  3667.             curleft += $(o.containment).scrollLeft() || 0;
  3668.             curtop += $(o.containment).scrollTop() || 0;
  3669.         }
  3670.  
  3671.         this.offset = this.helper.offset();
  3672.         this.position = { left: curleft, top: curtop };
  3673.  
  3674.         this.size = this._helper ? {
  3675.                 width: this.helper.width(),
  3676.                 height: this.helper.height()
  3677.             } : {
  3678.                 width: el.width(),
  3679.                 height: el.height()
  3680.             };
  3681.  
  3682.         this.originalSize = this._helper ? {
  3683.                 width: el.outerWidth(),
  3684.                 height: el.outerHeight()
  3685.             } : {
  3686.                 width: el.width(),
  3687.                 height: el.height()
  3688.             };
  3689.  
  3690.         this.sizeDiff = {
  3691.             width: el.outerWidth() - el.width(),
  3692.             height: el.outerHeight() - el.height()
  3693.         };
  3694.  
  3695.         this.originalPosition = { left: curleft, top: curtop };
  3696.         this.originalMousePosition = { left: event.pageX, top: event.pageY };
  3697.  
  3698.         this.aspectRatio = (typeof o.aspectRatio === "number") ?
  3699.             o.aspectRatio :
  3700.             ((this.originalSize.width / this.originalSize.height) || 1);
  3701.  
  3702.         cursor = $(".ui-resizable-" + this.axis).css("cursor");
  3703.         $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
  3704.  
  3705.         el.addClass("ui-resizable-resizing");
  3706.         this._propagate("start", event);
  3707.         return true;
  3708.     },
  3709.  
  3710.     _mouseDrag: function(event) {
  3711.  
  3712.         var data, props,
  3713.             smp = this.originalMousePosition,
  3714.             a = this.axis,
  3715.             dx = (event.pageX - smp.left) || 0,
  3716.             dy = (event.pageY - smp.top) || 0,
  3717.             trigger = this._change[a];
  3718.  
  3719.         this._updatePrevProperties();
  3720.  
  3721.         if (!trigger) {
  3722.             return false;
  3723.         }
  3724.  
  3725.         data = trigger.apply(this, [ event, dx, dy ]);
  3726.  
  3727.         this._updateVirtualBoundaries(event.shiftKey);
  3728.         if (this._aspectRatio || event.shiftKey) {
  3729.             data = this._updateRatio(data, event);
  3730.         }
  3731.  
  3732.         data = this._respectSize(data, event);
  3733.  
  3734.         this._updateCache(data);
  3735.  
  3736.         this._propagate("resize", event);
  3737.  
  3738.         props = this._applyChanges();
  3739.  
  3740.         if ( !this._helper && this._proportionallyResizeElements.length ) {
  3741.             this._proportionallyResize();
  3742.         }
  3743.  
  3744.         if ( !$.isEmptyObject( props ) ) {
  3745.             this._updatePrevProperties();
  3746.             this._trigger( "resize", event, this.ui() );
  3747.             this._applyChanges();
  3748.         }
  3749.  
  3750.         return false;
  3751.     },
  3752.  
  3753.     _mouseStop: function(event) {
  3754.  
  3755.         this.resizing = false;
  3756.         var pr, ista, soffseth, soffsetw, s, left, top,
  3757.             o = this.options, that = this;
  3758.  
  3759.         if (this._helper) {
  3760.  
  3761.             pr = this._proportionallyResizeElements;
  3762.             ista = pr.length && (/textarea/i).test(pr[0].nodeName);
  3763.             soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
  3764.             soffsetw = ista ? 0 : that.sizeDiff.width;
  3765.  
  3766.             s = {
  3767.                 width: (that.helper.width()  - soffsetw),
  3768.                 height: (that.helper.height() - soffseth)
  3769.             };
  3770.             left = (parseInt(that.element.css("left"), 10) +
  3771.                 (that.position.left - that.originalPosition.left)) || null;
  3772.             top = (parseInt(that.element.css("top"), 10) +
  3773.                 (that.position.top - that.originalPosition.top)) || null;
  3774.  
  3775.             if (!o.animate) {
  3776.                 this.element.css($.extend(s, { top: top, left: left }));
  3777.             }
  3778.  
  3779.             that.helper.height(that.size.height);
  3780.             that.helper.width(that.size.width);
  3781.  
  3782.             if (this._helper && !o.animate) {
  3783.                 this._proportionallyResize();
  3784.             }
  3785.         }
  3786.  
  3787.         $("body").css("cursor", "auto");
  3788.  
  3789.         this.element.removeClass("ui-resizable-resizing");
  3790.  
  3791.         this._propagate("stop", event);
  3792.  
  3793.         if (this._helper) {
  3794.             this.helper.remove();
  3795.         }
  3796.  
  3797.         return false;
  3798.  
  3799.     },
  3800.  
  3801.     _updatePrevProperties: function() {
  3802.         this.prevPosition = {
  3803.             top: this.position.top,
  3804.             left: this.position.left
  3805.         };
  3806.         this.prevSize = {
  3807.             width: this.size.width,
  3808.             height: this.size.height
  3809.         };
  3810.     },
  3811.  
  3812.     _applyChanges: function() {
  3813.         var props = {};
  3814.  
  3815.         if ( this.position.top !== this.prevPosition.top ) {
  3816.             props.top = this.position.top + "px";
  3817.         }
  3818.         if ( this.position.left !== this.prevPosition.left ) {
  3819.             props.left = this.position.left + "px";
  3820.         }
  3821.         if ( this.size.width !== this.prevSize.width ) {
  3822.             props.width = this.size.width + "px";
  3823.         }
  3824.         if ( this.size.height !== this.prevSize.height ) {
  3825.             props.height = this.size.height + "px";
  3826.         }
  3827.  
  3828.         this.helper.css( props );
  3829.  
  3830.         return props;
  3831.     },
  3832.  
  3833.     _updateVirtualBoundaries: function(forceAspectRatio) {
  3834.         var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  3835.             o = this.options;
  3836.  
  3837.         b = {
  3838.             minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
  3839.             maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
  3840.             minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
  3841.             maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
  3842.         };
  3843.  
  3844.         if (this._aspectRatio || forceAspectRatio) {
  3845.             pMinWidth = b.minHeight * this.aspectRatio;
  3846.             pMinHeight = b.minWidth / this.aspectRatio;
  3847.             pMaxWidth = b.maxHeight * this.aspectRatio;
  3848.             pMaxHeight = b.maxWidth / this.aspectRatio;
  3849.  
  3850.             if (pMinWidth > b.minWidth) {
  3851.                 b.minWidth = pMinWidth;
  3852.             }
  3853.             if (pMinHeight > b.minHeight) {
  3854.                 b.minHeight = pMinHeight;
  3855.             }
  3856.             if (pMaxWidth < b.maxWidth) {
  3857.                 b.maxWidth = pMaxWidth;
  3858.             }
  3859.             if (pMaxHeight < b.maxHeight) {
  3860.                 b.maxHeight = pMaxHeight;
  3861.             }
  3862.         }
  3863.         this._vBoundaries = b;
  3864.     },
  3865.  
  3866.     _updateCache: function(data) {
  3867.         this.offset = this.helper.offset();
  3868.         if (this._isNumber(data.left)) {
  3869.             this.position.left = data.left;
  3870.         }
  3871.         if (this._isNumber(data.top)) {
  3872.             this.position.top = data.top;
  3873.         }
  3874.         if (this._isNumber(data.height)) {
  3875.             this.size.height = data.height;
  3876.         }
  3877.         if (this._isNumber(data.width)) {
  3878.             this.size.width = data.width;
  3879.         }
  3880.     },
  3881.  
  3882.     _updateRatio: function( data ) {
  3883.  
  3884.         var cpos = this.position,
  3885.             csize = this.size,
  3886.             a = this.axis;
  3887.  
  3888.         if (this._isNumber(data.height)) {
  3889.             data.width = (data.height * this.aspectRatio);
  3890.         } else if (this._isNumber(data.width)) {
  3891.             data.height = (data.width / this.aspectRatio);
  3892.         }
  3893.  
  3894.         if (a === "sw") {
  3895.             data.left = cpos.left + (csize.width - data.width);
  3896.             data.top = null;
  3897.         }
  3898.         if (a === "nw") {
  3899.             data.top = cpos.top + (csize.height - data.height);
  3900.             data.left = cpos.left + (csize.width - data.width);
  3901.         }
  3902.  
  3903.         return data;
  3904.     },
  3905.  
  3906.     _respectSize: function( data ) {
  3907.  
  3908.         var o = this._vBoundaries,
  3909.             a = this.axis,
  3910.             ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
  3911.             ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  3912.             isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
  3913.             isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
  3914.             dw = this.originalPosition.left + this.originalSize.width,
  3915.             dh = this.position.top + this.size.height,
  3916.             cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  3917.         if (isminw) {
  3918.             data.width = o.minWidth;
  3919.         }
  3920.         if (isminh) {
  3921.             data.height = o.minHeight;
  3922.         }
  3923.         if (ismaxw) {
  3924.             data.width = o.maxWidth;
  3925.         }
  3926.         if (ismaxh) {
  3927.             data.height = o.maxHeight;
  3928.         }
  3929.  
  3930.         if (isminw && cw) {
  3931.             data.left = dw - o.minWidth;
  3932.         }
  3933.         if (ismaxw && cw) {
  3934.             data.left = dw - o.maxWidth;
  3935.         }
  3936.         if (isminh && ch) {
  3937.             data.top = dh - o.minHeight;
  3938.         }
  3939.         if (ismaxh && ch) {
  3940.             data.top = dh - o.maxHeight;
  3941.         }
  3942.  
  3943.         // Fixing jump error on top/left - bug #2330
  3944.         if (!data.width && !data.height && !data.left && data.top) {
  3945.             data.top = null;
  3946.         } else if (!data.width && !data.height && !data.top && data.left) {
  3947.             data.left = null;
  3948.         }
  3949.  
  3950.         return data;
  3951.     },
  3952.  
  3953.     _getPaddingPlusBorderDimensions: function( element ) {
  3954.         var i = 0,
  3955.             widths = [],
  3956.             borders = [
  3957.                 element.css( "borderTopWidth" ),
  3958.                 element.css( "borderRightWidth" ),
  3959.                 element.css( "borderBottomWidth" ),
  3960.                 element.css( "borderLeftWidth" )
  3961.             ],
  3962.             paddings = [
  3963.                 element.css( "paddingTop" ),
  3964.                 element.css( "paddingRight" ),
  3965.                 element.css( "paddingBottom" ),
  3966.                 element.css( "paddingLeft" )
  3967.             ];
  3968.  
  3969.         for ( ; i < 4; i++ ) {
  3970.             widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
  3971.             widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
  3972.         }
  3973.  
  3974.         return {
  3975.             height: widths[ 0 ] + widths[ 2 ],
  3976.             width: widths[ 1 ] + widths[ 3 ]
  3977.         };
  3978.     },
  3979.  
  3980.     _proportionallyResize: function() {
  3981.  
  3982.         if (!this._proportionallyResizeElements.length) {
  3983.             return;
  3984.         }
  3985.  
  3986.         var prel,
  3987.             i = 0,
  3988.             element = this.helper || this.element;
  3989.  
  3990.         for ( ; i < this._proportionallyResizeElements.length; i++) {
  3991.  
  3992.             prel = this._proportionallyResizeElements[i];
  3993.  
  3994.             // TODO: Seems like a bug to cache this.outerDimensions
  3995.             // considering that we are in a loop.
  3996.             if (!this.outerDimensions) {
  3997.                 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
  3998.             }
  3999.  
  4000.             prel.css({
  4001.                 height: (element.height() - this.outerDimensions.height) || 0,
  4002.                 width: (element.width() - this.outerDimensions.width) || 0
  4003.             });
  4004.  
  4005.         }
  4006.  
  4007.     },
  4008.  
  4009.     _renderProxy: function() {
  4010.  
  4011.         var el = this.element, o = this.options;
  4012.         this.elementOffset = el.offset();
  4013.  
  4014.         if (this._helper) {
  4015.  
  4016.             this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
  4017.  
  4018.             this.helper.addClass(this._helper).css({
  4019.                 width: this.element.outerWidth() - 1,
  4020.                 height: this.element.outerHeight() - 1,
  4021.                 position: "absolute",
  4022.                 left: this.elementOffset.left + "px",
  4023.                 top: this.elementOffset.top + "px",
  4024.                 zIndex: ++o.zIndex //TODO: Don't modify option
  4025.             });
  4026.  
  4027.             this.helper
  4028.                 .appendTo("body")
  4029.                 .disableSelection();
  4030.  
  4031.         } else {
  4032.             this.helper = this.element;
  4033.         }
  4034.  
  4035.     },
  4036.  
  4037.     _change: {
  4038.         e: function(event, dx) {
  4039.             return { width: this.originalSize.width + dx };
  4040.         },
  4041.         w: function(event, dx) {
  4042.             var cs = this.originalSize, sp = this.originalPosition;
  4043.             return { left: sp.left + dx, width: cs.width - dx };
  4044.         },
  4045.         n: function(event, dx, dy) {
  4046.             var cs = this.originalSize, sp = this.originalPosition;
  4047.             return { top: sp.top + dy, height: cs.height - dy };
  4048.         },
  4049.         s: function(event, dx, dy) {
  4050.             return { height: this.originalSize.height + dy };
  4051.         },
  4052.         se: function(event, dx, dy) {
  4053.             return $.extend(this._change.s.apply(this, arguments),
  4054.                 this._change.e.apply(this, [ event, dx, dy ]));
  4055.         },
  4056.         sw: function(event, dx, dy) {
  4057.             return $.extend(this._change.s.apply(this, arguments),
  4058.                 this._change.w.apply(this, [ event, dx, dy ]));
  4059.         },
  4060.         ne: function(event, dx, dy) {
  4061.             return $.extend(this._change.n.apply(this, arguments),
  4062.                 this._change.e.apply(this, [ event, dx, dy ]));
  4063.         },
  4064.         nw: function(event, dx, dy) {
  4065.             return $.extend(this._change.n.apply(this, arguments),
  4066.                 this._change.w.apply(this, [ event, dx, dy ]));
  4067.         }
  4068.     },
  4069.  
  4070.     _propagate: function(n, event) {
  4071.         $.ui.plugin.call(this, n, [ event, this.ui() ]);
  4072.         (n !== "resize" && this._trigger(n, event, this.ui()));
  4073.     },
  4074.  
  4075.     plugins: {},
  4076.  
  4077.     ui: function() {
  4078.         return {
  4079.             originalElement: this.originalElement,
  4080.             element: this.element,
  4081.             helper: this.helper,
  4082.             position: this.position,
  4083.             size: this.size,
  4084.             originalSize: this.originalSize,
  4085.             originalPosition: this.originalPosition
  4086.         };
  4087.     }
  4088.  
  4089. });
  4090.  
  4091. /*
  4092.  * Resizable Extensions
  4093.  */
  4094.  
  4095. $.ui.plugin.add("resizable", "animate", {
  4096.  
  4097.     stop: function( event ) {
  4098.         var that = $(this).resizable( "instance" ),
  4099.             o = that.options,
  4100.             pr = that._proportionallyResizeElements,
  4101.             ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  4102.             soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
  4103.             soffsetw = ista ? 0 : that.sizeDiff.width,
  4104.             style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
  4105.             left = (parseInt(that.element.css("left"), 10) +
  4106.                 (that.position.left - that.originalPosition.left)) || null,
  4107.             top = (parseInt(that.element.css("top"), 10) +
  4108.                 (that.position.top - that.originalPosition.top)) || null;
  4109.  
  4110.         that.element.animate(
  4111.             $.extend(style, top && left ? { top: top, left: left } : {}), {
  4112.                 duration: o.animateDuration,
  4113.                 easing: o.animateEasing,
  4114.                 step: function() {
  4115.  
  4116.                     var data = {
  4117.                         width: parseInt(that.element.css("width"), 10),
  4118.                         height: parseInt(that.element.css("height"), 10),
  4119.                         top: parseInt(that.element.css("top"), 10),
  4120.                         left: parseInt(that.element.css("left"), 10)
  4121.                     };
  4122.  
  4123.                     if (pr && pr.length) {
  4124.                         $(pr[0]).css({ width: data.width, height: data.height });
  4125.                     }
  4126.  
  4127.                     // propagating resize, and updating values for each animation step
  4128.                     that._updateCache(data);
  4129.                     that._propagate("resize", event);
  4130.  
  4131.                 }
  4132.             }
  4133.         );
  4134.     }
  4135.  
  4136. });
  4137.  
  4138. $.ui.plugin.add( "resizable", "containment", {
  4139.  
  4140.     start: function() {
  4141.         var element, p, co, ch, cw, width, height,
  4142.             that = $( this ).resizable( "instance" ),
  4143.             o = that.options,
  4144.             el = that.element,
  4145.             oc = o.containment,
  4146.             ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
  4147.  
  4148.         if ( !ce ) {
  4149.             return;
  4150.         }
  4151.  
  4152.         that.containerElement = $( ce );
  4153.  
  4154.         if ( /document/.test( oc ) || oc === document ) {
  4155.             that.containerOffset = {
  4156.                 left: 0,
  4157.                 top: 0
  4158.             };
  4159.             that.containerPosition = {
  4160.                 left: 0,
  4161.                 top: 0
  4162.             };
  4163.  
  4164.             that.parentData = {
  4165.                 element: $( document ),
  4166.                 left: 0,
  4167.                 top: 0,
  4168.                 width: $( document ).width(),
  4169.                 height: $( document ).height() || document.body.parentNode.scrollHeight
  4170.             };
  4171.         } else {
  4172.             element = $( ce );
  4173.             p = [];
  4174.             $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
  4175.                 p[ i ] = that._num( element.css( "padding" + name ) );
  4176.             });
  4177.  
  4178.             that.containerOffset = element.offset();
  4179.             that.containerPosition = element.position();
  4180.             that.containerSize = {
  4181.                 height: ( element.innerHeight() - p[ 3 ] ),
  4182.                 width: ( element.innerWidth() - p[ 1 ] )
  4183.             };
  4184.  
  4185.             co = that.containerOffset;
  4186.             ch = that.containerSize.height;
  4187.             cw = that.containerSize.width;
  4188.             width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
  4189.             height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
  4190.  
  4191.             that.parentData = {
  4192.                 element: ce,
  4193.                 left: co.left,
  4194.                 top: co.top,
  4195.                 width: width,
  4196.                 height: height
  4197.             };
  4198.         }
  4199.     },
  4200.  
  4201.     resize: function( event ) {
  4202.         var woset, hoset, isParent, isOffsetRelative,
  4203.             that = $( this ).resizable( "instance" ),
  4204.             o = that.options,
  4205.             co = that.containerOffset,
  4206.             cp = that.position,
  4207.             pRatio = that._aspectRatio || event.shiftKey,
  4208.             cop = {
  4209.                 top: 0,
  4210.                 left: 0
  4211.             },
  4212.             ce = that.containerElement,
  4213.             continueResize = true;
  4214.  
  4215.         if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
  4216.             cop = co;
  4217.         }
  4218.  
  4219.         if ( cp.left < ( that._helper ? co.left : 0 ) ) {
  4220.             that.size.width = that.size.width +
  4221.                 ( that._helper ?
  4222.                     ( that.position.left - co.left ) :
  4223.                     ( that.position.left - cop.left ) );
  4224.  
  4225.             if ( pRatio ) {
  4226.                 that.size.height = that.size.width / that.aspectRatio;
  4227.                 continueResize = false;
  4228.             }
  4229.             that.position.left = o.helper ? co.left : 0;
  4230.         }
  4231.  
  4232.         if ( cp.top < ( that._helper ? co.top : 0 ) ) {
  4233.             that.size.height = that.size.height +
  4234.                 ( that._helper ?
  4235.                     ( that.position.top - co.top ) :
  4236.                     that.position.top );
  4237.  
  4238.             if ( pRatio ) {
  4239.                 that.size.width = that.size.height * that.aspectRatio;
  4240.                 continueResize = false;
  4241.             }
  4242.             that.position.top = that._helper ? co.top : 0;
  4243.         }
  4244.  
  4245.         isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
  4246.         isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
  4247.  
  4248.         if ( isParent && isOffsetRelative ) {
  4249.             that.offset.left = that.parentData.left + that.position.left;
  4250.             that.offset.top = that.parentData.top + that.position.top;
  4251.         } else {
  4252.             that.offset.left = that.element.offset().left;
  4253.             that.offset.top = that.element.offset().top;
  4254.         }
  4255.  
  4256.         woset = Math.abs( that.sizeDiff.width +
  4257.             (that._helper ?
  4258.                 that.offset.left - cop.left :
  4259.                 (that.offset.left - co.left)) );
  4260.  
  4261.         hoset = Math.abs( that.sizeDiff.height +
  4262.             (that._helper ?
  4263.                 that.offset.top - cop.top :
  4264.                 (that.offset.top - co.top)) );
  4265.  
  4266.         if ( woset + that.size.width >= that.parentData.width ) {
  4267.             that.size.width = that.parentData.width - woset;
  4268.             if ( pRatio ) {
  4269.                 that.size.height = that.size.width / that.aspectRatio;
  4270.                 continueResize = false;
  4271.             }
  4272.         }
  4273.  
  4274.         if ( hoset + that.size.height >= that.parentData.height ) {
  4275.             that.size.height = that.parentData.height - hoset;
  4276.             if ( pRatio ) {
  4277.                 that.size.width = that.size.height * that.aspectRatio;
  4278.                 continueResize = false;
  4279.             }
  4280.         }
  4281.  
  4282.         if ( !continueResize ) {
  4283.             that.position.left = that.prevPosition.left;
  4284.             that.position.top = that.prevPosition.top;
  4285.             that.size.width = that.prevSize.width;
  4286.             that.size.height = that.prevSize.height;
  4287.         }
  4288.     },
  4289.  
  4290.     stop: function() {
  4291.         var that = $( this ).resizable( "instance" ),
  4292.             o = that.options,
  4293.             co = that.containerOffset,
  4294.             cop = that.containerPosition,
  4295.             ce = that.containerElement,
  4296.             helper = $( that.helper ),
  4297.             ho = helper.offset(),
  4298.             w = helper.outerWidth() - that.sizeDiff.width,
  4299.             h = helper.outerHeight() - that.sizeDiff.height;
  4300.  
  4301.         if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
  4302.             $( this ).css({
  4303.                 left: ho.left - cop.left - co.left,
  4304.                 width: w,
  4305.                 height: h
  4306.             });
  4307.         }
  4308.  
  4309.         if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
  4310.             $( this ).css({
  4311.                 left: ho.left - cop.left - co.left,
  4312.                 width: w,
  4313.                 height: h
  4314.             });
  4315.         }
  4316.     }
  4317. });
  4318.  
  4319. $.ui.plugin.add("resizable", "alsoResize", {
  4320.  
  4321.     start: function() {
  4322.         var that = $(this).resizable( "instance" ),
  4323.             o = that.options;
  4324.  
  4325.         $(o.alsoResize).each(function() {
  4326.             var el = $(this);
  4327.             el.data("ui-resizable-alsoresize", {
  4328.                 width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
  4329.                 left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
  4330.             });
  4331.         });
  4332.     },
  4333.  
  4334.     resize: function(event, ui) {
  4335.         var that = $(this).resizable( "instance" ),
  4336.             o = that.options,
  4337.             os = that.originalSize,
  4338.             op = that.originalPosition,
  4339.             delta = {
  4340.                 height: (that.size.height - os.height) || 0,
  4341.                 width: (that.size.width - os.width) || 0,
  4342.                 top: (that.position.top - op.top) || 0,
  4343.                 left: (that.position.left - op.left) || 0
  4344.             };
  4345.  
  4346.             $(o.alsoResize).each(function() {
  4347.                 var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
  4348.                     css = el.parents(ui.originalElement[0]).length ?
  4349.                             [ "width", "height" ] :
  4350.                             [ "width", "height", "top", "left" ];
  4351.  
  4352.                 $.each(css, function(i, prop) {
  4353.                     var sum = (start[prop] || 0) + (delta[prop] || 0);
  4354.                     if (sum && sum >= 0) {
  4355.                         style[prop] = sum || null;
  4356.                     }
  4357.                 });
  4358.  
  4359.                 el.css(style);
  4360.             });
  4361.     },
  4362.  
  4363.     stop: function() {
  4364.         $(this).removeData("resizable-alsoresize");
  4365.     }
  4366. });
  4367.  
  4368. $.ui.plugin.add("resizable", "ghost", {
  4369.  
  4370.     start: function() {
  4371.  
  4372.         var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
  4373.  
  4374.         that.ghost = that.originalElement.clone();
  4375.         that.ghost
  4376.             .css({
  4377.                 opacity: 0.25,
  4378.                 display: "block",
  4379.                 position: "relative",
  4380.                 height: cs.height,
  4381.                 width: cs.width,
  4382.                 margin: 0,
  4383.                 left: 0,
  4384.                 top: 0
  4385.             })
  4386.             .addClass("ui-resizable-ghost")
  4387.             .addClass(typeof o.ghost === "string" ? o.ghost : "");
  4388.  
  4389.         that.ghost.appendTo(that.helper);
  4390.  
  4391.     },
  4392.  
  4393.     resize: function() {
  4394.         var that = $(this).resizable( "instance" );
  4395.         if (that.ghost) {
  4396.             that.ghost.css({
  4397.                 position: "relative",
  4398.                 height: that.size.height,
  4399.                 width: that.size.width
  4400.             });
  4401.         }
  4402.     },
  4403.  
  4404.     stop: function() {
  4405.         var that = $(this).resizable( "instance" );
  4406.         if (that.ghost && that.helper) {
  4407.             that.helper.get(0).removeChild(that.ghost.get(0));
  4408.         }
  4409.     }
  4410.  
  4411. });
  4412.  
  4413. $.ui.plugin.add("resizable", "grid", {
  4414.  
  4415.     resize: function() {
  4416.         var outerDimensions,
  4417.             that = $(this).resizable( "instance" ),
  4418.             o = that.options,
  4419.             cs = that.size,
  4420.             os = that.originalSize,
  4421.             op = that.originalPosition,
  4422.             a = that.axis,
  4423.             grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
  4424.             gridX = (grid[0] || 1),
  4425.             gridY = (grid[1] || 1),
  4426.             ox = Math.round((cs.width - os.width) / gridX) * gridX,
  4427.             oy = Math.round((cs.height - os.height) / gridY) * gridY,
  4428.             newWidth = os.width + ox,
  4429.             newHeight = os.height + oy,
  4430.             isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
  4431.             isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
  4432.             isMinWidth = o.minWidth && (o.minWidth > newWidth),
  4433.             isMinHeight = o.minHeight && (o.minHeight > newHeight);
  4434.  
  4435.         o.grid = grid;
  4436.  
  4437.         if (isMinWidth) {
  4438.             newWidth += gridX;
  4439.         }
  4440.         if (isMinHeight) {
  4441.             newHeight += gridY;
  4442.         }
  4443.         if (isMaxWidth) {
  4444.             newWidth -= gridX;
  4445.         }
  4446.         if (isMaxHeight) {
  4447.             newHeight -= gridY;
  4448.         }
  4449.  
  4450.         if (/^(se|s|e)$/.test(a)) {
  4451.             that.size.width = newWidth;
  4452.             that.size.height = newHeight;
  4453.         } else if (/^(ne)$/.test(a)) {
  4454.             that.size.width = newWidth;
  4455.             that.size.height = newHeight;
  4456.             that.position.top = op.top - oy;
  4457.         } else if (/^(sw)$/.test(a)) {
  4458.             that.size.width = newWidth;
  4459.             that.size.height = newHeight;
  4460.             that.position.left = op.left - ox;
  4461.         } else {
  4462.             if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
  4463.                 outerDimensions = that._getPaddingPlusBorderDimensions( this );
  4464.             }
  4465.  
  4466.             if ( newHeight - gridY > 0 ) {
  4467.                 that.size.height = newHeight;
  4468.                 that.position.top = op.top - oy;
  4469.             } else {
  4470.                 newHeight = gridY - outerDimensions.height;
  4471.                 that.size.height = newHeight;
  4472.                 that.position.top = op.top + os.height - newHeight;
  4473.             }
  4474.             if ( newWidth - gridX > 0 ) {
  4475.                 that.size.width = newWidth;
  4476.                 that.position.left = op.left - ox;
  4477.             } else {
  4478.                 newWidth = gridX - outerDimensions.width;
  4479.                 that.size.width = newWidth;
  4480.                 that.position.left = op.left + os.width - newWidth;
  4481.             }
  4482.         }
  4483.     }
  4484.  
  4485. });
  4486.  
  4487. var resizable = $.ui.resizable;
  4488.  
  4489.  
  4490. /*!
  4491.  * jQuery UI Selectable 1.11.4
  4492.  * http://jqueryui.com
  4493.  *
  4494.  * Copyright jQuery Foundation and other contributors
  4495.  * Released under the MIT license.
  4496.  * http://jquery.org/license
  4497.  *
  4498.  * http://api.jqueryui.com/selectable/
  4499.  */
  4500.  
  4501.  
  4502. var selectable = $.widget("ui.selectable", $.ui.mouse, {
  4503.     version: "1.11.4",
  4504.     options: {
  4505.         appendTo: "body",
  4506.         autoRefresh: true,
  4507.         distance: 0,
  4508.         filter: "*",
  4509.         tolerance: "touch",
  4510.  
  4511.         // callbacks
  4512.         selected: null,
  4513.         selecting: null,
  4514.         start: null,
  4515.         stop: null,
  4516.         unselected: null,
  4517.         unselecting: null
  4518.     },
  4519.     _create: function() {
  4520.         var selectees,
  4521.             that = this;
  4522.  
  4523.         this.element.addClass("ui-selectable");
  4524.  
  4525.         this.dragged = false;
  4526.  
  4527.         // cache selectee children based on filter
  4528.         this.refresh = function() {
  4529.             selectees = $(that.options.filter, that.element[0]);
  4530.             selectees.addClass("ui-selectee");
  4531.             selectees.each(function() {
  4532.                 var $this = $(this),
  4533.                     pos = $this.offset();
  4534.                 $.data(this, "selectable-item", {
  4535.                     element: this,
  4536.                     $element: $this,
  4537.                     left: pos.left,
  4538.                     top: pos.top,
  4539.                     right: pos.left + $this.outerWidth(),
  4540.                     bottom: pos.top + $this.outerHeight(),
  4541.                     startselected: false,
  4542.                     selected: $this.hasClass("ui-selected"),
  4543.                     selecting: $this.hasClass("ui-selecting"),
  4544.                     unselecting: $this.hasClass("ui-unselecting")
  4545.                 });
  4546.             });
  4547.         };
  4548.         this.refresh();
  4549.  
  4550.         this.selectees = selectees.addClass("ui-selectee");
  4551.  
  4552.         this._mouseInit();
  4553.  
  4554.         this.helper = $("<div class='ui-selectable-helper'></div>");
  4555.     },
  4556.  
  4557.     _destroy: function() {
  4558.         this.selectees
  4559.             .removeClass("ui-selectee")
  4560.             .removeData("selectable-item");
  4561.         this.element
  4562.             .removeClass("ui-selectable ui-selectable-disabled");
  4563.         this._mouseDestroy();
  4564.     },
  4565.  
  4566.     _mouseStart: function(event) {
  4567.         var that = this,
  4568.             options = this.options;
  4569.  
  4570.         this.opos = [ event.pageX, event.pageY ];
  4571.  
  4572.         if (this.options.disabled) {
  4573.             return;
  4574.         }
  4575.  
  4576.         this.selectees = $(options.filter, this.element[0]);
  4577.  
  4578.         this._trigger("start", event);
  4579.  
  4580.         $(options.appendTo).append(this.helper);
  4581.         // position helper (lasso)
  4582.         this.helper.css({
  4583.             "left": event.pageX,
  4584.             "top": event.pageY,
  4585.             "width": 0,
  4586.             "height": 0
  4587.         });
  4588.  
  4589.         if (options.autoRefresh) {
  4590.             this.refresh();
  4591.         }
  4592.  
  4593.         this.selectees.filter(".ui-selected").each(function() {
  4594.             var selectee = $.data(this, "selectable-item");
  4595.             selectee.startselected = true;
  4596.             if (!event.metaKey && !event.ctrlKey) {
  4597.                 selectee.$element.removeClass("ui-selected");
  4598.                 selectee.selected = false;
  4599.                 selectee.$element.addClass("ui-unselecting");
  4600.                 selectee.unselecting = true;
  4601.                 // selectable UNSELECTING callback
  4602.                 that._trigger("unselecting", event, {
  4603.                     unselecting: selectee.element
  4604.                 });
  4605.             }
  4606.         });
  4607.  
  4608.         $(event.target).parents().addBack().each(function() {
  4609.             var doSelect,
  4610.                 selectee = $.data(this, "selectable-item");
  4611.             if (selectee) {
  4612.                 doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
  4613.                 selectee.$element
  4614.                     .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
  4615.                     .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
  4616.                 selectee.unselecting = !doSelect;
  4617.                 selectee.selecting = doSelect;
  4618.                 selectee.selected = doSelect;
  4619.                 // selectable (UN)SELECTING callback
  4620.                 if (doSelect) {
  4621.                     that._trigger("selecting", event, {
  4622.                         selecting: selectee.element
  4623.                     });
  4624.                 } else {
  4625.                     that._trigger("unselecting", event, {
  4626.                         unselecting: selectee.element
  4627.                     });
  4628.                 }
  4629.                 return false;
  4630.             }
  4631.         });
  4632.  
  4633.     },
  4634.  
  4635.     _mouseDrag: function(event) {
  4636.  
  4637.         this.dragged = true;
  4638.  
  4639.         if (this.options.disabled) {
  4640.             return;
  4641.         }
  4642.  
  4643.         var tmp,
  4644.             that = this,
  4645.             options = this.options,
  4646.             x1 = this.opos[0],
  4647.             y1 = this.opos[1],
  4648.             x2 = event.pageX,
  4649.             y2 = event.pageY;
  4650.  
  4651.         if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
  4652.         if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
  4653.         this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
  4654.  
  4655.         this.selectees.each(function() {
  4656.             var selectee = $.data(this, "selectable-item"),
  4657.                 hit = false;
  4658.  
  4659.             //prevent helper from being selected if appendTo: selectable
  4660.             if (!selectee || selectee.element === that.element[0]) {
  4661.                 return;
  4662.             }
  4663.  
  4664.             if (options.tolerance === "touch") {
  4665.                 hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  4666.             } else if (options.tolerance === "fit") {
  4667.                 hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  4668.             }
  4669.  
  4670.             if (hit) {
  4671.                 // SELECT
  4672.                 if (selectee.selected) {
  4673.                     selectee.$element.removeClass("ui-selected");
  4674.                     selectee.selected = false;
  4675.                 }
  4676.                 if (selectee.unselecting) {
  4677.                     selectee.$element.removeClass("ui-unselecting");
  4678.                     selectee.unselecting = false;
  4679.                 }
  4680.                 if (!selectee.selecting) {
  4681.                     selectee.$element.addClass("ui-selecting");
  4682.                     selectee.selecting = true;
  4683.                     // selectable SELECTING callback
  4684.                     that._trigger("selecting", event, {
  4685.                         selecting: selectee.element
  4686.                     });
  4687.                 }
  4688.             } else {
  4689.                 // UNSELECT
  4690.                 if (selectee.selecting) {
  4691.                     if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
  4692.                         selectee.$element.removeClass("ui-selecting");
  4693.                         selectee.selecting = false;
  4694.                         selectee.$element.addClass("ui-selected");
  4695.                         selectee.selected = true;
  4696.                     } else {
  4697.                         selectee.$element.removeClass("ui-selecting");
  4698.                         selectee.selecting = false;
  4699.                         if (selectee.startselected) {
  4700.                             selectee.$element.addClass("ui-unselecting");
  4701.                             selectee.unselecting = true;
  4702.                         }
  4703.                         // selectable UNSELECTING callback
  4704.                         that._trigger("unselecting", event, {
  4705.                             unselecting: selectee.element
  4706.                         });
  4707.                     }
  4708.                 }
  4709.                 if (selectee.selected) {
  4710.                     if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
  4711.                         selectee.$element.removeClass("ui-selected");
  4712.                         selectee.selected = false;
  4713.  
  4714.                         selectee.$element.addClass("ui-unselecting");
  4715.                         selectee.unselecting = true;
  4716.                         // selectable UNSELECTING callback
  4717.                         that._trigger("unselecting", event, {
  4718.                             unselecting: selectee.element
  4719.                         });
  4720.                     }
  4721.                 }
  4722.             }
  4723.         });
  4724.  
  4725.         return false;
  4726.     },
  4727.  
  4728.     _mouseStop: function(event) {
  4729.         var that = this;
  4730.  
  4731.         this.dragged = false;
  4732.  
  4733.         $(".ui-unselecting", this.element[0]).each(function() {
  4734.             var selectee = $.data(this, "selectable-item");
  4735.             selectee.$element.removeClass("ui-unselecting");
  4736.             selectee.unselecting = false;
  4737.             selectee.startselected = false;
  4738.             that._trigger("unselected", event, {
  4739.                 unselected: selectee.element
  4740.             });
  4741.         });
  4742.         $(".ui-selecting", this.element[0]).each(function() {
  4743.             var selectee = $.data(this, "selectable-item");
  4744.             selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
  4745.             selectee.selecting = false;
  4746.             selectee.selected = true;
  4747.             selectee.startselected = true;
  4748.             that._trigger("selected", event, {
  4749.                 selected: selectee.element
  4750.             });
  4751.         });
  4752.         this._trigger("stop", event);
  4753.  
  4754.         this.helper.remove();
  4755.  
  4756.         return false;
  4757.     }
  4758.  
  4759. });
  4760.  
  4761.  
  4762. /*!
  4763.  * jQuery UI Sortable 1.11.4
  4764.  * http://jqueryui.com
  4765.  *
  4766.  * Copyright jQuery Foundation and other contributors
  4767.  * Released under the MIT license.
  4768.  * http://jquery.org/license
  4769.  *
  4770.  * http://api.jqueryui.com/sortable/
  4771.  */
  4772.  
  4773.  
  4774. var sortable = $.widget("ui.sortable", $.ui.mouse, {
  4775.     version: "1.11.4",
  4776.     widgetEventPrefix: "sort",
  4777.     ready: false,
  4778.     options: {
  4779.         appendTo: "parent",
  4780.         axis: false,
  4781.         connectWith: false,
  4782.         containment: false,
  4783.         cursor: "auto",
  4784.         cursorAt: false,
  4785.         dropOnEmpty: true,
  4786.         forcePlaceholderSize: false,
  4787.         forceHelperSize: false,
  4788.         grid: false,
  4789.         handle: false,
  4790.         helper: "original",
  4791.         items: "> *",
  4792.         opacity: false,
  4793.         placeholder: false,
  4794.         revert: false,
  4795.         scroll: true,
  4796.         scrollSensitivity: 20,
  4797.         scrollSpeed: 20,
  4798.         scope: "default",
  4799.         tolerance: "intersect",
  4800.         zIndex: 1000,
  4801.  
  4802.         // callbacks
  4803.         activate: null,
  4804.         beforeStop: null,
  4805.         change: null,
  4806.         deactivate: null,
  4807.         out: null,
  4808.         over: null,
  4809.         receive: null,
  4810.         remove: null,
  4811.         sort: null,
  4812.         start: null,
  4813.         stop: null,
  4814.         update: null
  4815.     },
  4816.  
  4817.     _isOverAxis: function( x, reference, size ) {
  4818.         return ( x >= reference ) && ( x < ( reference + size ) );
  4819.     },
  4820.  
  4821.     _isFloating: function( item ) {
  4822.         return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  4823.     },
  4824.  
  4825.     _create: function() {
  4826.         this.containerCache = {};
  4827.         this.element.addClass("ui-sortable");
  4828.  
  4829.         //Get the items
  4830.         this.refresh();
  4831.  
  4832.         //Let's determine the parent's offset
  4833.         this.offset = this.element.offset();
  4834.  
  4835.         //Initialize mouse events for interaction
  4836.         this._mouseInit();
  4837.  
  4838.         this._setHandleClassName();
  4839.  
  4840.         //We're ready to go
  4841.         this.ready = true;
  4842.  
  4843.     },
  4844.  
  4845.     _setOption: function( key, value ) {
  4846.         this._super( key, value );
  4847.  
  4848.         if ( key === "handle" ) {
  4849.             this._setHandleClassName();
  4850.         }
  4851.     },
  4852.  
  4853.     _setHandleClassName: function() {
  4854.         this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
  4855.         $.each( this.items, function() {
  4856.             ( this.instance.options.handle ?
  4857.                 this.item.find( this.instance.options.handle ) : this.item )
  4858.                 .addClass( "ui-sortable-handle" );
  4859.         });
  4860.     },
  4861.  
  4862.     _destroy: function() {
  4863.         this.element
  4864.             .removeClass( "ui-sortable ui-sortable-disabled" )
  4865.             .find( ".ui-sortable-handle" )
  4866.                 .removeClass( "ui-sortable-handle" );
  4867.         this._mouseDestroy();
  4868.  
  4869.         for ( var i = this.items.length - 1; i >= 0; i-- ) {
  4870.             this.items[i].item.removeData(this.widgetName + "-item");
  4871.         }
  4872.  
  4873.         return this;
  4874.     },
  4875.  
  4876.     _mouseCapture: function(event, overrideHandle) {
  4877.         var currentItem = null,
  4878.             validHandle = false,
  4879.             that = this;
  4880.  
  4881.         if (this.reverting) {
  4882.             return false;
  4883.         }
  4884.  
  4885.         if(this.options.disabled || this.options.type === "static") {
  4886.             return false;
  4887.         }
  4888.  
  4889.         //We have to refresh the items data once first
  4890.         this._refreshItems(event);
  4891.  
  4892.         //Find out if the clicked node (or one of its parents) is a actual item in this.items
  4893.         $(event.target).parents().each(function() {
  4894.             if($.data(this, that.widgetName + "-item") === that) {
  4895.                 currentItem = $(this);
  4896.                 return false;
  4897.             }
  4898.         });
  4899.         if($.data(event.target, that.widgetName + "-item") === that) {
  4900.             currentItem = $(event.target);
  4901.         }
  4902.  
  4903.         if(!currentItem) {
  4904.             return false;
  4905.         }
  4906.         if(this.options.handle && !overrideHandle) {
  4907.             $(this.options.handle, currentItem).find("*").addBack().each(function() {
  4908.                 if(this === event.target) {
  4909.                     validHandle = true;
  4910.                 }
  4911.             });
  4912.             if(!validHandle) {
  4913.                 return false;
  4914.             }
  4915.         }
  4916.  
  4917.         this.currentItem = currentItem;
  4918.         this._removeCurrentsFromItems();
  4919.         return true;
  4920.  
  4921.     },
  4922.  
  4923.     _mouseStart: function(event, overrideHandle, noActivation) {
  4924.  
  4925.         var i, body,
  4926.             o = this.options;
  4927.  
  4928.         this.currentContainer = this;
  4929.  
  4930.         //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  4931.         this.refreshPositions();
  4932.  
  4933.         //Create and append the visible helper
  4934.         this.helper = this._createHelper(event);
  4935.  
  4936.         //Cache the helper size
  4937.         this._cacheHelperProportions();
  4938.  
  4939.         /*
  4940.          * - Position generation -
  4941.          * This block generates everything position related - it's the core of draggables.
  4942.          */
  4943.  
  4944.         //Cache the margins of the original element
  4945.         this._cacheMargins();
  4946.  
  4947.         //Get the next scrolling parent
  4948.         this.scrollParent = this.helper.scrollParent();
  4949.  
  4950.         //The element's absolute position on the page minus margins
  4951.         this.offset = this.currentItem.offset();
  4952.         this.offset = {
  4953.             top: this.offset.top - this.margins.top,
  4954.             left: this.offset.left - this.margins.left
  4955.         };
  4956.  
  4957.         $.extend(this.offset, {
  4958.             click: { //Where the click happened, relative to the element
  4959.                 left: event.pageX - this.offset.left,
  4960.                 top: event.pageY - this.offset.top
  4961.             },
  4962.             parent: this._getParentOffset(),
  4963.             relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  4964.         });
  4965.  
  4966.         // Only after we got the offset, we can change the helper's position to absolute
  4967.         // TODO: Still need to figure out a way to make relative sorting possible
  4968.         this.helper.css("position", "absolute");
  4969.         this.cssPosition = this.helper.css("position");
  4970.  
  4971.         //Generate the original position
  4972.         this.originalPosition = this._generatePosition(event);
  4973.         this.originalPageX = event.pageX;
  4974.         this.originalPageY = event.pageY;
  4975.  
  4976.         //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  4977.         (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  4978.  
  4979.         //Cache the former DOM position
  4980.         this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  4981.  
  4982.         //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
  4983.         if(this.helper[0] !== this.currentItem[0]) {
  4984.             this.currentItem.hide();
  4985.         }
  4986.  
  4987.         //Create the placeholder
  4988.         this._createPlaceholder();
  4989.  
  4990.         //Set a containment if given in the options
  4991.         if(o.containment) {
  4992.             this._setContainment();
  4993.         }
  4994.  
  4995.         if( o.cursor && o.cursor !== "auto" ) { // cursor option
  4996.             body = this.document.find( "body" );
  4997.  
  4998.             // support: IE
  4999.             this.storedCursor = body.css( "cursor" );
  5000.             body.css( "cursor", o.cursor );
  5001.  
  5002.             this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
  5003.         }
  5004.  
  5005.         if(o.opacity) { // opacity option
  5006.             if (this.helper.css("opacity")) {
  5007.                 this._storedOpacity = this.helper.css("opacity");
  5008.             }
  5009.             this.helper.css("opacity", o.opacity);
  5010.         }
  5011.  
  5012.         if(o.zIndex) { // zIndex option
  5013.             if (this.helper.css("zIndex")) {
  5014.                 this._storedZIndex = this.helper.css("zIndex");
  5015.             }
  5016.             this.helper.css("zIndex", o.zIndex);
  5017.         }
  5018.  
  5019.         //Prepare scrolling
  5020.         if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  5021.             this.overflowOffset = this.scrollParent.offset();
  5022.         }
  5023.  
  5024.         //Call callbacks
  5025.         this._trigger("start", event, this._uiHash());
  5026.  
  5027.         //Recache the helper size
  5028.         if(!this._preserveHelperProportions) {
  5029.             this._cacheHelperProportions();
  5030.         }
  5031.  
  5032.  
  5033.         //Post "activate" events to possible containers
  5034.         if( !noActivation ) {
  5035.             for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5036.                 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  5037.             }
  5038.         }
  5039.  
  5040.         //Prepare possible droppables
  5041.         if($.ui.ddmanager) {
  5042.             $.ui.ddmanager.current = this;
  5043.         }
  5044.  
  5045.         if ($.ui.ddmanager && !o.dropBehaviour) {
  5046.             $.ui.ddmanager.prepareOffsets(this, event);
  5047.         }
  5048.  
  5049.         this.dragging = true;
  5050.  
  5051.         this.helper.addClass("ui-sortable-helper");
  5052.         this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  5053.         return true;
  5054.  
  5055.     },
  5056.  
  5057.     _mouseDrag: function(event) {
  5058.         var i, item, itemElement, intersection,
  5059.             o = this.options,
  5060.             scrolled = false;
  5061.  
  5062.         //Compute the helpers position
  5063.         this.position = this._generatePosition(event);
  5064.         this.positionAbs = this._convertPositionTo("absolute");
  5065.  
  5066.         if (!this.lastPositionAbs) {
  5067.             this.lastPositionAbs = this.positionAbs;
  5068.         }
  5069.  
  5070.         //Do scrolling
  5071.         if(this.options.scroll) {
  5072.             if(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  5073.  
  5074.                 if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  5075.                     this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  5076.                 } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  5077.                     this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  5078.                 }
  5079.  
  5080.                 if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  5081.                     this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  5082.                 } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  5083.                     this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  5084.                 }
  5085.  
  5086.             } else {
  5087.  
  5088.                 if(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  5089.                     scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  5090.                 } else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  5091.                     scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  5092.                 }
  5093.  
  5094.                 if(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  5095.                     scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  5096.                 } else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  5097.                     scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  5098.                 }
  5099.  
  5100.             }
  5101.  
  5102.             if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  5103.                 $.ui.ddmanager.prepareOffsets(this, event);
  5104.             }
  5105.         }
  5106.  
  5107.         //Regenerate the absolute position used for position checks
  5108.         this.positionAbs = this._convertPositionTo("absolute");
  5109.  
  5110.         //Set the helper position
  5111.         if(!this.options.axis || this.options.axis !== "y") {
  5112.             this.helper[0].style.left = this.position.left+"px";
  5113.         }
  5114.         if(!this.options.axis || this.options.axis !== "x") {
  5115.             this.helper[0].style.top = this.position.top+"px";
  5116.         }
  5117.  
  5118.         //Rearrange
  5119.         for (i = this.items.length - 1; i >= 0; i--) {
  5120.  
  5121.             //Cache variables and intersection, continue if no intersection
  5122.             item = this.items[i];
  5123.             itemElement = item.item[0];
  5124.             intersection = this._intersectsWithPointer(item);
  5125.             if (!intersection) {
  5126.                 continue;
  5127.             }
  5128.  
  5129.             // Only put the placeholder inside the current Container, skip all
  5130.             // items from other containers. This works because when moving
  5131.             // an item from one container to another the
  5132.             // currentContainer is switched before the placeholder is moved.
  5133.             //
  5134.             // Without this, moving items in "sub-sortables" can cause
  5135.             // the placeholder to jitter between the outer and inner container.
  5136.             if (item.instance !== this.currentContainer) {
  5137.                 continue;
  5138.             }
  5139.  
  5140.             // cannot intersect with itself
  5141.             // no useless actions that have been done before
  5142.             // no action if the item moved is the parent of the item checked
  5143.             if (itemElement !== this.currentItem[0] &&
  5144.                 this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  5145.                 !$.contains(this.placeholder[0], itemElement) &&
  5146.                 (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
  5147.             ) {
  5148.  
  5149.                 this.direction = intersection === 1 ? "down" : "up";
  5150.  
  5151.                 if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  5152.                     this._rearrange(event, item);
  5153.                 } else {
  5154.                     break;
  5155.                 }
  5156.  
  5157.                 this._trigger("change", event, this._uiHash());
  5158.                 break;
  5159.             }
  5160.         }
  5161.  
  5162.         //Post events to containers
  5163.         this._contactContainers(event);
  5164.  
  5165.         //Interconnect with droppables
  5166.         if($.ui.ddmanager) {
  5167.             $.ui.ddmanager.drag(this, event);
  5168.         }
  5169.  
  5170.         //Call callbacks
  5171.         this._trigger("sort", event, this._uiHash());
  5172.  
  5173.         this.lastPositionAbs = this.positionAbs;
  5174.         return false;
  5175.  
  5176.     },
  5177.  
  5178.     _mouseStop: function(event, noPropagation) {
  5179.  
  5180.         if(!event) {
  5181.             return;
  5182.         }
  5183.  
  5184.         //If we are using droppables, inform the manager about the drop
  5185.         if ($.ui.ddmanager && !this.options.dropBehaviour) {
  5186.             $.ui.ddmanager.drop(this, event);
  5187.         }
  5188.  
  5189.         if(this.options.revert) {
  5190.             var that = this,
  5191.                 cur = this.placeholder.offset(),
  5192.                 axis = this.options.axis,
  5193.                 animation = {};
  5194.  
  5195.             if ( !axis || axis === "x" ) {
  5196.                 animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  5197.             }
  5198.             if ( !axis || axis === "y" ) {
  5199.                 animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  5200.             }
  5201.             this.reverting = true;
  5202.             $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
  5203.                 that._clear(event);
  5204.             });
  5205.         } else {
  5206.             this._clear(event, noPropagation);
  5207.         }
  5208.  
  5209.         return false;
  5210.  
  5211.     },
  5212.  
  5213.     cancel: function() {
  5214.  
  5215.         if(this.dragging) {
  5216.  
  5217.             this._mouseUp({ target: null });
  5218.  
  5219.             if(this.options.helper === "original") {
  5220.                 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  5221.             } else {
  5222.                 this.currentItem.show();
  5223.             }
  5224.  
  5225.             //Post deactivating events to containers
  5226.             for (var i = this.containers.length - 1; i >= 0; i--){
  5227.                 this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  5228.                 if(this.containers[i].containerCache.over) {
  5229.                     this.containers[i]._trigger("out", null, this._uiHash(this));
  5230.                     this.containers[i].containerCache.over = 0;
  5231.                 }
  5232.             }
  5233.  
  5234.         }
  5235.  
  5236.         if (this.placeholder) {
  5237.             //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  5238.             if(this.placeholder[0].parentNode) {
  5239.                 this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  5240.             }
  5241.             if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  5242.                 this.helper.remove();
  5243.             }
  5244.  
  5245.             $.extend(this, {
  5246.                 helper: null,
  5247.                 dragging: false,
  5248.                 reverting: false,
  5249.                 _noFinalSort: null
  5250.             });
  5251.  
  5252.             if(this.domPosition.prev) {
  5253.                 $(this.domPosition.prev).after(this.currentItem);
  5254.             } else {
  5255.                 $(this.domPosition.parent).prepend(this.currentItem);
  5256.             }
  5257.         }
  5258.  
  5259.         return this;
  5260.  
  5261.     },
  5262.  
  5263.     serialize: function(o) {
  5264.  
  5265.         var items = this._getItemsAsjQuery(o && o.connected),
  5266.             str = [];
  5267.         o = o || {};
  5268.  
  5269.         $(items).each(function() {
  5270.             var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  5271.             if (res) {
  5272.                 str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
  5273.             }
  5274.         });
  5275.  
  5276.         if(!str.length && o.key) {
  5277.             str.push(o.key + "=");
  5278.         }
  5279.  
  5280.         return str.join("&");
  5281.  
  5282.     },
  5283.  
  5284.     toArray: function(o) {
  5285.  
  5286.         var items = this._getItemsAsjQuery(o && o.connected),
  5287.             ret = [];
  5288.  
  5289.         o = o || {};
  5290.  
  5291.         items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
  5292.         return ret;
  5293.  
  5294.     },
  5295.  
  5296.     /* Be careful with the following core functions */
  5297.     _intersectsWith: function(item) {
  5298.  
  5299.         var x1 = this.positionAbs.left,
  5300.             x2 = x1 + this.helperProportions.width,
  5301.             y1 = this.positionAbs.top,
  5302.             y2 = y1 + this.helperProportions.height,
  5303.             l = item.left,
  5304.             r = l + item.width,
  5305.             t = item.top,
  5306.             b = t + item.height,
  5307.             dyClick = this.offset.click.top,
  5308.             dxClick = this.offset.click.left,
  5309.             isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
  5310.             isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
  5311.             isOverElement = isOverElementHeight && isOverElementWidth;
  5312.  
  5313.         if ( this.options.tolerance === "pointer" ||
  5314.             this.options.forcePointerForContainers ||
  5315.             (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
  5316.         ) {
  5317.             return isOverElement;
  5318.         } else {
  5319.  
  5320.             return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  5321.                 x2 - (this.helperProportions.width / 2) < r && // Left Half
  5322.                 t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  5323.                 y2 - (this.helperProportions.height / 2) < b ); // Top Half
  5324.  
  5325.         }
  5326.     },
  5327.  
  5328.     _intersectsWithPointer: function(item) {
  5329.  
  5330.         var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  5331.             isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  5332.             isOverElement = isOverElementHeight && isOverElementWidth,
  5333.             verticalDirection = this._getDragVerticalDirection(),
  5334.             horizontalDirection = this._getDragHorizontalDirection();
  5335.  
  5336.         if (!isOverElement) {
  5337.             return false;
  5338.         }
  5339.  
  5340.         return this.floating ?
  5341.             ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
  5342.             : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
  5343.  
  5344.     },
  5345.  
  5346.     _intersectsWithSides: function(item) {
  5347.  
  5348.         var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  5349.             isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  5350.             verticalDirection = this._getDragVerticalDirection(),
  5351.             horizontalDirection = this._getDragHorizontalDirection();
  5352.  
  5353.         if (this.floating && horizontalDirection) {
  5354.             return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  5355.         } else {
  5356.             return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  5357.         }
  5358.  
  5359.     },
  5360.  
  5361.     _getDragVerticalDirection: function() {
  5362.         var delta = this.positionAbs.top - this.lastPositionAbs.top;
  5363.         return delta !== 0 && (delta > 0 ? "down" : "up");
  5364.     },
  5365.  
  5366.     _getDragHorizontalDirection: function() {
  5367.         var delta = this.positionAbs.left - this.lastPositionAbs.left;
  5368.         return delta !== 0 && (delta > 0 ? "right" : "left");
  5369.     },
  5370.  
  5371.     refresh: function(event) {
  5372.         this._refreshItems(event);
  5373.         this._setHandleClassName();
  5374.         this.refreshPositions();
  5375.         return this;
  5376.     },
  5377.  
  5378.     _connectWith: function() {
  5379.         var options = this.options;
  5380.         return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  5381.     },
  5382.  
  5383.     _getItemsAsjQuery: function(connected) {
  5384.  
  5385.         var i, j, cur, inst,
  5386.             items = [],
  5387.             queries = [],
  5388.             connectWith = this._connectWith();
  5389.  
  5390.         if(connectWith && connected) {
  5391.             for (i = connectWith.length - 1; i >= 0; i--){
  5392.                 cur = $(connectWith[i], this.document[0]);
  5393.                 for ( j = cur.length - 1; j >= 0; j--){
  5394.                     inst = $.data(cur[j], this.widgetFullName);
  5395.                     if(inst && inst !== this && !inst.options.disabled) {
  5396.                         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]);
  5397.                     }
  5398.                 }
  5399.             }
  5400.         }
  5401.  
  5402.         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]);
  5403.  
  5404.         function addItems() {
  5405.             items.push( this );
  5406.         }
  5407.         for (i = queries.length - 1; i >= 0; i--){
  5408.             queries[i][0].each( addItems );
  5409.         }
  5410.  
  5411.         return $(items);
  5412.  
  5413.     },
  5414.  
  5415.     _removeCurrentsFromItems: function() {
  5416.  
  5417.         var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  5418.  
  5419.         this.items = $.grep(this.items, function (item) {
  5420.             for (var j=0; j < list.length; j++) {
  5421.                 if(list[j] === item.item[0]) {
  5422.                     return false;
  5423.                 }
  5424.             }
  5425.             return true;
  5426.         });
  5427.  
  5428.     },
  5429.  
  5430.     _refreshItems: function(event) {
  5431.  
  5432.         this.items = [];
  5433.         this.containers = [this];
  5434.  
  5435.         var i, j, cur, inst, targetData, _queries, item, queriesLength,
  5436.             items = this.items,
  5437.             queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
  5438.             connectWith = this._connectWith();
  5439.  
  5440.         if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
  5441.             for (i = connectWith.length - 1; i >= 0; i--){
  5442.                 cur = $(connectWith[i], this.document[0]);
  5443.                 for (j = cur.length - 1; j >= 0; j--){
  5444.                     inst = $.data(cur[j], this.widgetFullName);
  5445.                     if(inst && inst !== this && !inst.options.disabled) {
  5446.                         queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  5447.                         this.containers.push(inst);
  5448.                     }
  5449.                 }
  5450.             }
  5451.         }
  5452.  
  5453.         for (i = queries.length - 1; i >= 0; i--) {
  5454.             targetData = queries[i][1];
  5455.             _queries = queries[i][0];
  5456.  
  5457.             for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  5458.                 item = $(_queries[j]);
  5459.  
  5460.                 item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
  5461.  
  5462.                 items.push({
  5463.                     item: item,
  5464.                     instance: targetData,
  5465.                     width: 0, height: 0,
  5466.                     left: 0, top: 0
  5467.                 });
  5468.             }
  5469.         }
  5470.  
  5471.     },
  5472.  
  5473.     refreshPositions: function(fast) {
  5474.  
  5475.         // Determine whether items are being displayed horizontally
  5476.         this.floating = this.items.length ?
  5477.             this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  5478.             false;
  5479.  
  5480.         //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  5481.         if(this.offsetParent && this.helper) {
  5482.             this.offset.parent = this._getParentOffset();
  5483.         }
  5484.  
  5485.         var i, item, t, p;
  5486.  
  5487.         for (i = this.items.length - 1; i >= 0; i--){
  5488.             item = this.items[i];
  5489.  
  5490.             //We ignore calculating positions of all connected containers when we're not over them
  5491.             if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
  5492.                 continue;
  5493.             }
  5494.  
  5495.             t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  5496.  
  5497.             if (!fast) {
  5498.                 item.width = t.outerWidth();
  5499.                 item.height = t.outerHeight();
  5500.             }
  5501.  
  5502.             p = t.offset();
  5503.             item.left = p.left;
  5504.             item.top = p.top;
  5505.         }
  5506.  
  5507.         if(this.options.custom && this.options.custom.refreshContainers) {
  5508.             this.options.custom.refreshContainers.call(this);
  5509.         } else {
  5510.             for (i = this.containers.length - 1; i >= 0; i--){
  5511.                 p = this.containers[i].element.offset();
  5512.                 this.containers[i].containerCache.left = p.left;
  5513.                 this.containers[i].containerCache.top = p.top;
  5514.                 this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  5515.                 this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  5516.             }
  5517.         }
  5518.  
  5519.         return this;
  5520.     },
  5521.  
  5522.     _createPlaceholder: function(that) {
  5523.         that = that || this;
  5524.         var className,
  5525.             o = that.options;
  5526.  
  5527.         if(!o.placeholder || o.placeholder.constructor === String) {
  5528.             className = o.placeholder;
  5529.             o.placeholder = {
  5530.                 element: function() {
  5531.  
  5532.                     var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  5533.                         element = $( "<" + nodeName + ">", that.document[0] )
  5534.                             .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
  5535.                             .removeClass("ui-sortable-helper");
  5536.  
  5537.                     if ( nodeName === "tbody" ) {
  5538.                         that._createTrPlaceholder(
  5539.                             that.currentItem.find( "tr" ).eq( 0 ),
  5540.                             $( "<tr>", that.document[ 0 ] ).appendTo( element )
  5541.                         );
  5542.                     } else if ( nodeName === "tr" ) {
  5543.                         that._createTrPlaceholder( that.currentItem, element );
  5544.                     } else if ( nodeName === "img" ) {
  5545.                         element.attr( "src", that.currentItem.attr( "src" ) );
  5546.                     }
  5547.  
  5548.                     if ( !className ) {
  5549.                         element.css( "visibility", "hidden" );
  5550.                     }
  5551.  
  5552.                     return element;
  5553.                 },
  5554.                 update: function(container, p) {
  5555.  
  5556.                     // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  5557.                     // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  5558.                     if(className && !o.forcePlaceholderSize) {
  5559.                         return;
  5560.                     }
  5561.  
  5562.                     //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
  5563.                     if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
  5564.                     if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
  5565.                 }
  5566.             };
  5567.         }
  5568.  
  5569.         //Create the placeholder
  5570.         that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  5571.  
  5572.         //Append it after the actual current item
  5573.         that.currentItem.after(that.placeholder);
  5574.  
  5575.         //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  5576.         o.placeholder.update(that, that.placeholder);
  5577.  
  5578.     },
  5579.  
  5580.     _createTrPlaceholder: function( sourceTr, targetTr ) {
  5581.         var that = this;
  5582.  
  5583.         sourceTr.children().each(function() {
  5584.             $( "<td>&#160;</td>", that.document[ 0 ] )
  5585.                 .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  5586.                 .appendTo( targetTr );
  5587.         });
  5588.     },
  5589.  
  5590.     _contactContainers: function(event) {
  5591.         var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  5592.             innermostContainer = null,
  5593.             innermostIndex = null;
  5594.  
  5595.         // get innermost container that intersects with item
  5596.         for (i = this.containers.length - 1; i >= 0; i--) {
  5597.  
  5598.             // never consider a container that's located within the item itself
  5599.             if($.contains(this.currentItem[0], this.containers[i].element[0])) {
  5600.                 continue;
  5601.             }
  5602.  
  5603.             if(this._intersectsWith(this.containers[i].containerCache)) {
  5604.  
  5605.                 // if we've already found a container and it's more "inner" than this, then continue
  5606.                 if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  5607.                     continue;
  5608.                 }
  5609.  
  5610.                 innermostContainer = this.containers[i];
  5611.                 innermostIndex = i;
  5612.  
  5613.             } else {
  5614.                 // container doesn't intersect. trigger "out" event if necessary
  5615.                 if(this.containers[i].containerCache.over) {
  5616.                     this.containers[i]._trigger("out", event, this._uiHash(this));
  5617.                     this.containers[i].containerCache.over = 0;
  5618.                 }
  5619.             }
  5620.  
  5621.         }
  5622.  
  5623.         // if no intersecting containers found, return
  5624.         if(!innermostContainer) {
  5625.             return;
  5626.         }
  5627.  
  5628.         // move the item into the container if it's not there already
  5629.         if(this.containers.length === 1) {
  5630.             if (!this.containers[innermostIndex].containerCache.over) {
  5631.                 this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  5632.                 this.containers[innermostIndex].containerCache.over = 1;
  5633.             }
  5634.         } else {
  5635.  
  5636.             //When entering a new container, we will find the item with the least distance and append our item near it
  5637.             dist = 10000;
  5638.             itemWithLeastDistance = null;
  5639.             floating = innermostContainer.floating || this._isFloating(this.currentItem);
  5640.             posProperty = floating ? "left" : "top";
  5641.             sizeProperty = floating ? "width" : "height";
  5642.             axis = floating ? "clientX" : "clientY";
  5643.  
  5644.             for (j = this.items.length - 1; j >= 0; j--) {
  5645.                 if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  5646.                     continue;
  5647.                 }
  5648.                 if(this.items[j].item[0] === this.currentItem[0]) {
  5649.                     continue;
  5650.                 }
  5651.  
  5652.                 cur = this.items[j].item.offset()[posProperty];
  5653.                 nearBottom = false;
  5654.                 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  5655.                     nearBottom = true;
  5656.                 }
  5657.  
  5658.                 if ( Math.abs( event[ axis ] - cur ) < dist ) {
  5659.                     dist = Math.abs( event[ axis ] - cur );
  5660.                     itemWithLeastDistance = this.items[ j ];
  5661.                     this.direction = nearBottom ? "up": "down";
  5662.                 }
  5663.             }
  5664.  
  5665.             //Check if dropOnEmpty is enabled
  5666.             if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
  5667.                 return;
  5668.             }
  5669.  
  5670.             if(this.currentContainer === this.containers[innermostIndex]) {
  5671.                 if ( !this.currentContainer.containerCache.over ) {
  5672.                     this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  5673.                     this.currentContainer.containerCache.over = 1;
  5674.                 }
  5675.                 return;
  5676.             }
  5677.  
  5678.             itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  5679.             this._trigger("change", event, this._uiHash());
  5680.             this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  5681.             this.currentContainer = this.containers[innermostIndex];
  5682.  
  5683.             //Update the placeholder
  5684.             this.options.placeholder.update(this.currentContainer, this.placeholder);
  5685.  
  5686.             this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  5687.             this.containers[innermostIndex].containerCache.over = 1;
  5688.         }
  5689.  
  5690.  
  5691.     },
  5692.  
  5693.     _createHelper: function(event) {
  5694.  
  5695.         var o = this.options,
  5696.             helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  5697.  
  5698.         //Add the helper to the DOM if that didn't happen already
  5699.         if(!helper.parents("body").length) {
  5700.             $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  5701.         }
  5702.  
  5703.         if(helper[0] === this.currentItem[0]) {
  5704.             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") };
  5705.         }
  5706.  
  5707.         if(!helper[0].style.width || o.forceHelperSize) {
  5708.             helper.width(this.currentItem.width());
  5709.         }
  5710.         if(!helper[0].style.height || o.forceHelperSize) {
  5711.             helper.height(this.currentItem.height());
  5712.         }
  5713.  
  5714.         return helper;
  5715.  
  5716.     },
  5717.  
  5718.     _adjustOffsetFromHelper: function(obj) {
  5719.         if (typeof obj === "string") {
  5720.             obj = obj.split(" ");
  5721.         }
  5722.         if ($.isArray(obj)) {
  5723.             obj = {left: +obj[0], top: +obj[1] || 0};
  5724.         }
  5725.         if ("left" in obj) {
  5726.             this.offset.click.left = obj.left + this.margins.left;
  5727.         }
  5728.         if ("right" in obj) {
  5729.             this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  5730.         }
  5731.         if ("top" in obj) {
  5732.             this.offset.click.top = obj.top + this.margins.top;
  5733.         }
  5734.         if ("bottom" in obj) {
  5735.             this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  5736.         }
  5737.     },
  5738.  
  5739.     _getParentOffset: function() {
  5740.  
  5741.  
  5742.         //Get the offsetParent and cache its position
  5743.         this.offsetParent = this.helper.offsetParent();
  5744.         var po = this.offsetParent.offset();
  5745.  
  5746.         // This is a special case where we need to modify a offset calculated on start, since the following happened:
  5747.         // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  5748.         // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  5749.         //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  5750.         if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  5751.             po.left += this.scrollParent.scrollLeft();
  5752.             po.top += this.scrollParent.scrollTop();
  5753.         }
  5754.  
  5755.         // This needs to be actually done for all browsers, since pageX/pageY includes this information
  5756.         // with an ugly IE fix
  5757.         if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  5758.             po = { top: 0, left: 0 };
  5759.         }
  5760.  
  5761.         return {
  5762.             top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  5763.             left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  5764.         };
  5765.  
  5766.     },
  5767.  
  5768.     _getRelativeOffset: function() {
  5769.  
  5770.         if(this.cssPosition === "relative") {
  5771.             var p = this.currentItem.position();
  5772.             return {
  5773.                 top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  5774.                 left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  5775.             };
  5776.         } else {
  5777.             return { top: 0, left: 0 };
  5778.         }
  5779.  
  5780.     },
  5781.  
  5782.     _cacheMargins: function() {
  5783.         this.margins = {
  5784.             left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  5785.             top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  5786.         };
  5787.     },
  5788.  
  5789.     _cacheHelperProportions: function() {
  5790.         this.helperProportions = {
  5791.             width: this.helper.outerWidth(),
  5792.             height: this.helper.outerHeight()
  5793.         };
  5794.     },
  5795.  
  5796.     _setContainment: function() {
  5797.  
  5798.         var ce, co, over,
  5799.             o = this.options;
  5800.         if(o.containment === "parent") {
  5801.             o.containment = this.helper[0].parentNode;
  5802.         }
  5803.         if(o.containment === "document" || o.containment === "window") {
  5804.             this.containment = [
  5805.                 0 - this.offset.relative.left - this.offset.parent.left,
  5806.                 0 - this.offset.relative.top - this.offset.parent.top,
  5807.                 o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
  5808.                 (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  5809.             ];
  5810.         }
  5811.  
  5812.         if(!(/^(document|window|parent)$/).test(o.containment)) {
  5813.             ce = $(o.containment)[0];
  5814.             co = $(o.containment).offset();
  5815.             over = ($(ce).css("overflow") !== "hidden");
  5816.  
  5817.             this.containment = [
  5818.                 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  5819.                 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  5820.                 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,
  5821.                 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
  5822.             ];
  5823.         }
  5824.  
  5825.     },
  5826.  
  5827.     _convertPositionTo: function(d, pos) {
  5828.  
  5829.         if(!pos) {
  5830.             pos = this.position;
  5831.         }
  5832.         var mod = d === "absolute" ? 1 : -1,
  5833.             scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  5834.             scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  5835.  
  5836.         return {
  5837.             top: (
  5838.                 pos.top +                                                               // The absolute mouse position
  5839.                 this.offset.relative.top * mod +                                        // Only for relative positioned nodes: Relative offset from element to offset parent
  5840.                 this.offset.parent.top * mod -                                          // The offsetParent's offset without borders (offset + border)
  5841.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  5842.             ),
  5843.             left: (
  5844.                 pos.left +                                                              // The absolute mouse position
  5845.                 this.offset.relative.left * mod +                                       // Only for relative positioned nodes: Relative offset from element to offset parent
  5846.                 this.offset.parent.left * mod   -                                       // The offsetParent's offset without borders (offset + border)
  5847.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  5848.             )
  5849.         };
  5850.  
  5851.     },
  5852.  
  5853.     _generatePosition: function(event) {
  5854.  
  5855.         var top, left,
  5856.             o = this.options,
  5857.             pageX = event.pageX,
  5858.             pageY = event.pageY,
  5859.             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);
  5860.  
  5861.         // This is another very weird special case that only happens for relative elements:
  5862.         // 1. If the css position is relative
  5863.         // 2. and the scroll parent is the document or similar to the offset parent
  5864.         // we have to refresh the relative offset during the scroll so there are no jumps
  5865.         if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  5866.             this.offset.relative = this._getRelativeOffset();
  5867.         }
  5868.  
  5869.         /*
  5870.          * - Position constraining -
  5871.          * Constrain the position to a mix of grid, containment.
  5872.          */
  5873.  
  5874.         if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  5875.  
  5876.             if(this.containment) {
  5877.                 if(event.pageX - this.offset.click.left < this.containment[0]) {
  5878.                     pageX = this.containment[0] + this.offset.click.left;
  5879.                 }
  5880.                 if(event.pageY - this.offset.click.top < this.containment[1]) {
  5881.                     pageY = this.containment[1] + this.offset.click.top;
  5882.                 }
  5883.                 if(event.pageX - this.offset.click.left > this.containment[2]) {
  5884.                     pageX = this.containment[2] + this.offset.click.left;
  5885.                 }
  5886.                 if(event.pageY - this.offset.click.top > this.containment[3]) {
  5887.                     pageY = this.containment[3] + this.offset.click.top;
  5888.                 }
  5889.             }
  5890.  
  5891.             if(o.grid) {
  5892.                 top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  5893.                 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;
  5894.  
  5895.                 left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  5896.                 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;
  5897.             }
  5898.  
  5899.         }
  5900.  
  5901.         return {
  5902.             top: (
  5903.                 pageY -                                                             // The absolute mouse position
  5904.                 this.offset.click.top -                                                 // Click offset (relative to the element)
  5905.                 this.offset.relative.top    -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
  5906.                 this.offset.parent.top +                                                // The offsetParent's offset without borders (offset + border)
  5907.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  5908.             ),
  5909.             left: (
  5910.                 pageX -                                                             // The absolute mouse position
  5911.                 this.offset.click.left -                                                // Click offset (relative to the element)
  5912.                 this.offset.relative.left   -                                           // Only for relative positioned nodes: Relative offset from element to offset parent
  5913.                 this.offset.parent.left +                                               // The offsetParent's offset without borders (offset + border)
  5914.                 ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  5915.             )
  5916.         };
  5917.  
  5918.     },
  5919.  
  5920.     _rearrange: function(event, i, a, hardRefresh) {
  5921.  
  5922.         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));
  5923.  
  5924.         //Various things done here to improve the performance:
  5925.         // 1. we create a setTimeout, that calls refreshPositions
  5926.         // 2. on the instance, we have a counter variable, that get's higher after every append
  5927.         // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  5928.         // 4. this lets only the last addition to the timeout stack through
  5929.         this.counter = this.counter ? ++this.counter : 1;
  5930.         var counter = this.counter;
  5931.  
  5932.         this._delay(function() {
  5933.             if(counter === this.counter) {
  5934.                 this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  5935.             }
  5936.         });
  5937.  
  5938.     },
  5939.  
  5940.     _clear: function(event, noPropagation) {
  5941.  
  5942.         this.reverting = false;
  5943.         // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  5944.         // everything else normalized again
  5945.         var i,
  5946.             delayedTriggers = [];
  5947.  
  5948.         // We first have to update the dom position of the actual currentItem
  5949.         // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  5950.         if(!this._noFinalSort && this.currentItem.parent().length) {
  5951.             this.placeholder.before(this.currentItem);
  5952.         }
  5953.         this._noFinalSort = null;
  5954.  
  5955.         if(this.helper[0] === this.currentItem[0]) {
  5956.             for(i in this._storedCSS) {
  5957.                 if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  5958.                     this._storedCSS[i] = "";
  5959.                 }
  5960.             }
  5961.             this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  5962.         } else {
  5963.             this.currentItem.show();
  5964.         }
  5965.  
  5966.         if(this.fromOutside && !noPropagation) {
  5967.             delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  5968.         }
  5969.         if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  5970.             delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  5971.         }
  5972.  
  5973.         // Check if the items Container has Changed and trigger appropriate
  5974.         // events.
  5975.         if (this !== this.currentContainer) {
  5976.             if(!noPropagation) {
  5977.                 delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  5978.                 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
  5979.                 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
  5980.             }
  5981.         }
  5982.  
  5983.  
  5984.         //Post events to containers
  5985.         function delayEvent( type, instance, container ) {
  5986.             return function( event ) {
  5987.                 container._trigger( type, event, instance._uiHash( instance ) );
  5988.             };
  5989.         }
  5990.         for (i = this.containers.length - 1; i >= 0; i--){
  5991.             if (!noPropagation) {
  5992.                 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  5993.             }
  5994.             if(this.containers[i].containerCache.over) {
  5995.                 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  5996.                 this.containers[i].containerCache.over = 0;
  5997.             }
  5998.         }
  5999.  
  6000.         //Do what was originally in plugins
  6001.         if ( this.storedCursor ) {
  6002.             this.document.find( "body" ).css( "cursor", this.storedCursor );
  6003.             this.storedStylesheet.remove();
  6004.         }
  6005.         if(this._storedOpacity) {
  6006.             this.helper.css("opacity", this._storedOpacity);
  6007.         }
  6008.         if(this._storedZIndex) {
  6009.             this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  6010.         }
  6011.  
  6012.         this.dragging = false;
  6013.  
  6014.         if(!noPropagation) {
  6015.             this._trigger("beforeStop", event, this._uiHash());
  6016.         }
  6017.  
  6018.         //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  6019.         this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  6020.  
  6021.         if ( !this.cancelHelperRemoval ) {
  6022.             if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  6023.                 this.helper.remove();
  6024.             }
  6025.             this.helper = null;
  6026.         }
  6027.  
  6028.         if(!noPropagation) {
  6029.             for (i=0; i < delayedTriggers.length; i++) {
  6030.                 delayedTriggers[i].call(this, event);
  6031.             } //Trigger all delayed events
  6032.             this._trigger("stop", event, this._uiHash());
  6033.         }
  6034.  
  6035.         this.fromOutside = false;
  6036.         return !this.cancelHelperRemoval;
  6037.  
  6038.     },
  6039.  
  6040.     _trigger: function() {
  6041.         if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  6042.             this.cancel();
  6043.         }
  6044.     },
  6045.  
  6046.     _uiHash: function(_inst) {
  6047.         var inst = _inst || this;
  6048.         return {
  6049.             helper: inst.helper,
  6050.             placeholder: inst.placeholder || $([]),
  6051.             position: inst.position,
  6052.             originalPosition: inst.originalPosition,
  6053.             offset: inst.positionAbs,
  6054.             item: inst.currentItem,
  6055.             sender: _inst ? _inst.element : null
  6056.         };
  6057.     }
  6058.  
  6059. });
  6060.  
  6061.  
  6062. /*!
  6063.  * jQuery UI Accordion 1.11.4
  6064.  * http://jqueryui.com
  6065.  *
  6066.  * Copyright jQuery Foundation and other contributors
  6067.  * Released under the MIT license.
  6068.  * http://jquery.org/license
  6069.  *
  6070.  * http://api.jqueryui.com/accordion/
  6071.  */
  6072.  
  6073.  
  6074. var accordion = $.widget( "ui.accordion", {
  6075.     version: "1.11.4",
  6076.     options: {
  6077.         active: 0,
  6078.         animate: {},
  6079.         collapsible: false,
  6080.         event: "click",
  6081.         header: "> li > :first-child,> :not(li):even",
  6082.         heightStyle: "auto",
  6083.         icons: {
  6084.             activeHeader: "ui-icon-triangle-1-s",
  6085.             header: "ui-icon-triangle-1-e"
  6086.         },
  6087.  
  6088.         // callbacks
  6089.         activate: null,
  6090.         beforeActivate: null
  6091.     },
  6092.  
  6093.     hideProps: {
  6094.         borderTopWidth: "hide",
  6095.         borderBottomWidth: "hide",
  6096.         paddingTop: "hide",
  6097.         paddingBottom: "hide",
  6098.         height: "hide"
  6099.     },
  6100.  
  6101.     showProps: {
  6102.         borderTopWidth: "show",
  6103.         borderBottomWidth: "show",
  6104.         paddingTop: "show",
  6105.         paddingBottom: "show",
  6106.         height: "show"
  6107.     },
  6108.  
  6109.     _create: function() {
  6110.         var options = this.options;
  6111.         this.prevShow = this.prevHide = $();
  6112.         this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
  6113.             // ARIA
  6114.             .attr( "role", "tablist" );
  6115.  
  6116.         // don't allow collapsible: false and active: false / null
  6117.         if ( !options.collapsible && (options.active === false || options.active == null) ) {
  6118.             options.active = 0;
  6119.         }
  6120.  
  6121.         this._processPanels();
  6122.         // handle negative values
  6123.         if ( options.active < 0 ) {
  6124.             options.active += this.headers.length;
  6125.         }
  6126.         this._refresh();
  6127.     },
  6128.  
  6129.     _getCreateEventData: function() {
  6130.         return {
  6131.             header: this.active,
  6132.             panel: !this.active.length ? $() : this.active.next()
  6133.         };
  6134.     },
  6135.  
  6136.     _createIcons: function() {
  6137.         var icons = this.options.icons;
  6138.         if ( icons ) {
  6139.             $( "<span>" )
  6140.                 .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
  6141.                 .prependTo( this.headers );
  6142.             this.active.children( ".ui-accordion-header-icon" )
  6143.                 .removeClass( icons.header )
  6144.                 .addClass( icons.activeHeader );
  6145.             this.headers.addClass( "ui-accordion-icons" );
  6146.         }
  6147.     },
  6148.  
  6149.     _destroyIcons: function() {
  6150.         this.headers
  6151.             .removeClass( "ui-accordion-icons" )
  6152.             .children( ".ui-accordion-header-icon" )
  6153.                 .remove();
  6154.     },
  6155.  
  6156.     _destroy: function() {
  6157.         var contents;
  6158.  
  6159.         // clean up main element
  6160.         this.element
  6161.             .removeClass( "ui-accordion ui-widget ui-helper-reset" )
  6162.             .removeAttr( "role" );
  6163.  
  6164.         // clean up headers
  6165.         this.headers
  6166.             .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
  6167.                 "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  6168.             .removeAttr( "role" )
  6169.             .removeAttr( "aria-expanded" )
  6170.             .removeAttr( "aria-selected" )
  6171.             .removeAttr( "aria-controls" )
  6172.             .removeAttr( "tabIndex" )
  6173.             .removeUniqueId();
  6174.  
  6175.         this._destroyIcons();
  6176.  
  6177.         // clean up content panels
  6178.         contents = this.headers.next()
  6179.             .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
  6180.                 "ui-accordion-content ui-accordion-content-active ui-state-disabled" )
  6181.             .css( "display", "" )
  6182.             .removeAttr( "role" )
  6183.             .removeAttr( "aria-hidden" )
  6184.             .removeAttr( "aria-labelledby" )
  6185.             .removeUniqueId();
  6186.  
  6187.         if ( this.options.heightStyle !== "content" ) {
  6188.             contents.css( "height", "" );
  6189.         }
  6190.     },
  6191.  
  6192.     _setOption: function( key, value ) {
  6193.         if ( key === "active" ) {
  6194.             // _activate() will handle invalid values and update this.options
  6195.             this._activate( value );
  6196.             return;
  6197.         }
  6198.  
  6199.         if ( key === "event" ) {
  6200.             if ( this.options.event ) {
  6201.                 this._off( this.headers, this.options.event );
  6202.             }
  6203.             this._setupEvents( value );
  6204.         }
  6205.  
  6206.         this._super( key, value );
  6207.  
  6208.         // setting collapsible: false while collapsed; open first panel
  6209.         if ( key === "collapsible" && !value && this.options.active === false ) {
  6210.             this._activate( 0 );
  6211.         }
  6212.  
  6213.         if ( key === "icons" ) {
  6214.             this._destroyIcons();
  6215.             if ( value ) {
  6216.                 this._createIcons();
  6217.             }
  6218.         }
  6219.  
  6220.         // #5332 - opacity doesn't cascade to positioned elements in IE
  6221.         // so we need to add the disabled class to the headers and panels
  6222.         if ( key === "disabled" ) {
  6223.             this.element
  6224.                 .toggleClass( "ui-state-disabled", !!value )
  6225.                 .attr( "aria-disabled", value );
  6226.             this.headers.add( this.headers.next() )
  6227.                 .toggleClass( "ui-state-disabled", !!value );
  6228.         }
  6229.     },
  6230.  
  6231.     _keydown: function( event ) {
  6232.         if ( event.altKey || event.ctrlKey ) {
  6233.             return;
  6234.         }
  6235.  
  6236.         var keyCode = $.ui.keyCode,
  6237.             length = this.headers.length,
  6238.             currentIndex = this.headers.index( event.target ),
  6239.             toFocus = false;
  6240.  
  6241.         switch ( event.keyCode ) {
  6242.             case keyCode.RIGHT:
  6243.             case keyCode.DOWN:
  6244.                 toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  6245.                 break;
  6246.             case keyCode.LEFT:
  6247.             case keyCode.UP:
  6248.                 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  6249.                 break;
  6250.             case keyCode.SPACE:
  6251.             case keyCode.ENTER:
  6252.                 this._eventHandler( event );
  6253.                 break;
  6254.             case keyCode.HOME:
  6255.                 toFocus = this.headers[ 0 ];
  6256.                 break;
  6257.             case keyCode.END:
  6258.                 toFocus = this.headers[ length - 1 ];
  6259.                 break;
  6260.         }
  6261.  
  6262.         if ( toFocus ) {
  6263.             $( event.target ).attr( "tabIndex", -1 );
  6264.             $( toFocus ).attr( "tabIndex", 0 );
  6265.             toFocus.focus();
  6266.             event.preventDefault();
  6267.         }
  6268.     },
  6269.  
  6270.     _panelKeyDown: function( event ) {
  6271.         if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  6272.             $( event.currentTarget ).prev().focus();
  6273.         }
  6274.     },
  6275.  
  6276.     refresh: function() {
  6277.         var options = this.options;
  6278.         this._processPanels();
  6279.  
  6280.         // was collapsed or no panel
  6281.         if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
  6282.             options.active = false;
  6283.             this.active = $();
  6284.         // active false only when collapsible is true
  6285.         } else if ( options.active === false ) {
  6286.             this._activate( 0 );
  6287.         // was active, but active panel is gone
  6288.         } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6289.             // all remaining panel are disabled
  6290.             if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
  6291.                 options.active = false;
  6292.                 this.active = $();
  6293.             // activate previous panel
  6294.             } else {
  6295.                 this._activate( Math.max( 0, options.active - 1 ) );
  6296.             }
  6297.         // was active, active panel still exists
  6298.         } else {
  6299.             // make sure active index is correct
  6300.             options.active = this.headers.index( this.active );
  6301.         }
  6302.  
  6303.         this._destroyIcons();
  6304.  
  6305.         this._refresh();
  6306.     },
  6307.  
  6308.     _processPanels: function() {
  6309.         var prevHeaders = this.headers,
  6310.             prevPanels = this.panels;
  6311.  
  6312.         this.headers = this.element.find( this.options.header )
  6313.             .addClass( "ui-accordion-header ui-state-default ui-corner-all" );
  6314.  
  6315.         this.panels = this.headers.next()
  6316.             .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
  6317.             .filter( ":not(.ui-accordion-content-active)" )
  6318.             .hide();
  6319.  
  6320.         // Avoid memory leaks (#10056)
  6321.         if ( prevPanels ) {
  6322.             this._off( prevHeaders.not( this.headers ) );
  6323.             this._off( prevPanels.not( this.panels ) );
  6324.         }
  6325.     },
  6326.  
  6327.     _refresh: function() {
  6328.         var maxHeight,
  6329.             options = this.options,
  6330.             heightStyle = options.heightStyle,
  6331.             parent = this.element.parent();
  6332.  
  6333.         this.active = this._findActive( options.active )
  6334.             .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
  6335.             .removeClass( "ui-corner-all" );
  6336.         this.active.next()
  6337.             .addClass( "ui-accordion-content-active" )
  6338.             .show();
  6339.  
  6340.         this.headers
  6341.             .attr( "role", "tab" )
  6342.             .each(function() {
  6343.                 var header = $( this ),
  6344.                     headerId = header.uniqueId().attr( "id" ),
  6345.                     panel = header.next(),
  6346.                     panelId = panel.uniqueId().attr( "id" );
  6347.                 header.attr( "aria-controls", panelId );
  6348.                 panel.attr( "aria-labelledby", headerId );
  6349.             })
  6350.             .next()
  6351.                 .attr( "role", "tabpanel" );
  6352.  
  6353.         this.headers
  6354.             .not( this.active )
  6355.             .attr({
  6356.                 "aria-selected": "false",
  6357.                 "aria-expanded": "false",
  6358.                 tabIndex: -1
  6359.             })
  6360.             .next()
  6361.                 .attr({
  6362.                     "aria-hidden": "true"
  6363.                 })
  6364.                 .hide();
  6365.  
  6366.         // make sure at least one header is in the tab order
  6367.         if ( !this.active.length ) {
  6368.             this.headers.eq( 0 ).attr( "tabIndex", 0 );
  6369.         } else {
  6370.             this.active.attr({
  6371.                 "aria-selected": "true",
  6372.                 "aria-expanded": "true",
  6373.                 tabIndex: 0
  6374.             })
  6375.             .next()
  6376.                 .attr({
  6377.                     "aria-hidden": "false"
  6378.                 });
  6379.         }
  6380.  
  6381.         this._createIcons();
  6382.  
  6383.         this._setupEvents( options.event );
  6384.  
  6385.         if ( heightStyle === "fill" ) {
  6386.             maxHeight = parent.height();
  6387.             this.element.siblings( ":visible" ).each(function() {
  6388.                 var elem = $( this ),
  6389.                     position = elem.css( "position" );
  6390.  
  6391.                 if ( position === "absolute" || position === "fixed" ) {
  6392.                     return;
  6393.                 }
  6394.                 maxHeight -= elem.outerHeight( true );
  6395.             });
  6396.  
  6397.             this.headers.each(function() {
  6398.                 maxHeight -= $( this ).outerHeight( true );
  6399.             });
  6400.  
  6401.             this.headers.next()
  6402.                 .each(function() {
  6403.                     $( this ).height( Math.max( 0, maxHeight -
  6404.                         $( this ).innerHeight() + $( this ).height() ) );
  6405.                 })
  6406.                 .css( "overflow", "auto" );
  6407.         } else if ( heightStyle === "auto" ) {
  6408.             maxHeight = 0;
  6409.             this.headers.next()
  6410.                 .each(function() {
  6411.                     maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
  6412.                 })
  6413.                 .height( maxHeight );
  6414.         }
  6415.     },
  6416.  
  6417.     _activate: function( index ) {
  6418.         var active = this._findActive( index )[ 0 ];
  6419.  
  6420.         // trying to activate the already active panel
  6421.         if ( active === this.active[ 0 ] ) {
  6422.             return;
  6423.         }
  6424.  
  6425.         // trying to collapse, simulate a click on the currently active header
  6426.         active = active || this.active[ 0 ];
  6427.  
  6428.         this._eventHandler({
  6429.             target: active,
  6430.             currentTarget: active,
  6431.             preventDefault: $.noop
  6432.         });
  6433.     },
  6434.  
  6435.     _findActive: function( selector ) {
  6436.         return typeof selector === "number" ? this.headers.eq( selector ) : $();
  6437.     },
  6438.  
  6439.     _setupEvents: function( event ) {
  6440.         var events = {
  6441.             keydown: "_keydown"
  6442.         };
  6443.         if ( event ) {
  6444.             $.each( event.split( " " ), function( index, eventName ) {
  6445.                 events[ eventName ] = "_eventHandler";
  6446.             });
  6447.         }
  6448.  
  6449.         this._off( this.headers.add( this.headers.next() ) );
  6450.         this._on( this.headers, events );
  6451.         this._on( this.headers.next(), { keydown: "_panelKeyDown" });
  6452.         this._hoverable( this.headers );
  6453.         this._focusable( this.headers );
  6454.     },
  6455.  
  6456.     _eventHandler: function( event ) {
  6457.         var options = this.options,
  6458.             active = this.active,
  6459.             clicked = $( event.currentTarget ),
  6460.             clickedIsActive = clicked[ 0 ] === active[ 0 ],
  6461.             collapsing = clickedIsActive && options.collapsible,
  6462.             toShow = collapsing ? $() : clicked.next(),
  6463.             toHide = active.next(),
  6464.             eventData = {
  6465.                 oldHeader: active,
  6466.                 oldPanel: toHide,
  6467.                 newHeader: collapsing ? $() : clicked,
  6468.                 newPanel: toShow
  6469.             };
  6470.  
  6471.         event.preventDefault();
  6472.  
  6473.         if (
  6474.                 // click on active header, but not collapsible
  6475.                 ( clickedIsActive && !options.collapsible ) ||
  6476.                 // allow canceling activation
  6477.                 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  6478.             return;
  6479.         }
  6480.  
  6481.         options.active = collapsing ? false : this.headers.index( clicked );
  6482.  
  6483.         // when the call to ._toggle() comes after the class changes
  6484.         // it causes a very odd bug in IE 8 (see #6720)
  6485.         this.active = clickedIsActive ? $() : clicked;
  6486.         this._toggle( eventData );
  6487.  
  6488.         // switch classes
  6489.         // corner classes on the previously active header stay after the animation
  6490.         active.removeClass( "ui-accordion-header-active ui-state-active" );
  6491.         if ( options.icons ) {
  6492.             active.children( ".ui-accordion-header-icon" )
  6493.                 .removeClass( options.icons.activeHeader )
  6494.                 .addClass( options.icons.header );
  6495.         }
  6496.  
  6497.         if ( !clickedIsActive ) {
  6498.             clicked
  6499.                 .removeClass( "ui-corner-all" )
  6500.                 .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
  6501.             if ( options.icons ) {
  6502.                 clicked.children( ".ui-accordion-header-icon" )
  6503.                     .removeClass( options.icons.header )
  6504.                     .addClass( options.icons.activeHeader );
  6505.             }
  6506.  
  6507.             clicked
  6508.                 .next()
  6509.                 .addClass( "ui-accordion-content-active" );
  6510.         }
  6511.     },
  6512.  
  6513.     _toggle: function( data ) {
  6514.         var toShow = data.newPanel,
  6515.             toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  6516.  
  6517.         // handle activating a panel during the animation for another activation
  6518.         this.prevShow.add( this.prevHide ).stop( true, true );
  6519.         this.prevShow = toShow;
  6520.         this.prevHide = toHide;
  6521.  
  6522.         if ( this.options.animate ) {
  6523.             this._animate( toShow, toHide, data );
  6524.         } else {
  6525.             toHide.hide();
  6526.             toShow.show();
  6527.             this._toggleComplete( data );
  6528.         }
  6529.  
  6530.         toHide.attr({
  6531.             "aria-hidden": "true"
  6532.         });
  6533.         toHide.prev().attr({
  6534.             "aria-selected": "false",
  6535.             "aria-expanded": "false"
  6536.         });
  6537.         // if we're switching panels, remove the old header from the tab order
  6538.         // if we're opening from collapsed state, remove the previous header from the tab order
  6539.         // if we're collapsing, then keep the collapsing header in the tab order
  6540.         if ( toShow.length && toHide.length ) {
  6541.             toHide.prev().attr({
  6542.                 "tabIndex": -1,
  6543.                 "aria-expanded": "false"
  6544.             });
  6545.         } else if ( toShow.length ) {
  6546.             this.headers.filter(function() {
  6547.                 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  6548.             })
  6549.             .attr( "tabIndex", -1 );
  6550.         }
  6551.  
  6552.         toShow
  6553.             .attr( "aria-hidden", "false" )
  6554.             .prev()
  6555.                 .attr({
  6556.                     "aria-selected": "true",
  6557.                     "aria-expanded": "true",
  6558.                     tabIndex: 0
  6559.                 });
  6560.     },
  6561.  
  6562.     _animate: function( toShow, toHide, data ) {
  6563.         var total, easing, duration,
  6564.             that = this,
  6565.             adjust = 0,
  6566.             boxSizing = toShow.css( "box-sizing" ),
  6567.             down = toShow.length &&
  6568.                 ( !toHide.length || ( toShow.index() < toHide.index() ) ),
  6569.             animate = this.options.animate || {},
  6570.             options = down && animate.down || animate,
  6571.             complete = function() {
  6572.                 that._toggleComplete( data );
  6573.             };
  6574.  
  6575.         if ( typeof options === "number" ) {
  6576.             duration = options;
  6577.         }
  6578.         if ( typeof options === "string" ) {
  6579.             easing = options;
  6580.         }
  6581.         // fall back from options to animation in case of partial down settings
  6582.         easing = easing || options.easing || animate.easing;
  6583.         duration = duration || options.duration || animate.duration;
  6584.  
  6585.         if ( !toHide.length ) {
  6586.             return toShow.animate( this.showProps, duration, easing, complete );
  6587.         }
  6588.         if ( !toShow.length ) {
  6589.             return toHide.animate( this.hideProps, duration, easing, complete );
  6590.         }
  6591.  
  6592.         total = toShow.show().outerHeight();
  6593.         toHide.animate( this.hideProps, {
  6594.             duration: duration,
  6595.             easing: easing,
  6596.             step: function( now, fx ) {
  6597.                 fx.now = Math.round( now );
  6598.             }
  6599.         });
  6600.         toShow
  6601.             .hide()
  6602.             .animate( this.showProps, {
  6603.                 duration: duration,
  6604.                 easing: easing,
  6605.                 complete: complete,
  6606.                 step: function( now, fx ) {
  6607.                     fx.now = Math.round( now );
  6608.                     if ( fx.prop !== "height" ) {
  6609.                         if ( boxSizing === "content-box" ) {
  6610.                             adjust += fx.now;
  6611.                         }
  6612.                     } else if ( that.options.heightStyle !== "content" ) {
  6613.                         fx.now = Math.round( total - toHide.outerHeight() - adjust );
  6614.                         adjust = 0;
  6615.                     }
  6616.                 }
  6617.             });
  6618.     },
  6619.  
  6620.     _toggleComplete: function( data ) {
  6621.         var toHide = data.oldPanel;
  6622.  
  6623.         toHide
  6624.             .removeClass( "ui-accordion-content-active" )
  6625.             .prev()
  6626.                 .removeClass( "ui-corner-top" )
  6627.                 .addClass( "ui-corner-all" );
  6628.  
  6629.         // Work around for rendering bug in IE (#5421)
  6630.         if ( toHide.length ) {
  6631.             toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  6632.         }
  6633.         this._trigger( "activate", null, data );
  6634.     }
  6635. });
  6636.  
  6637.  
  6638. /*!
  6639.  * jQuery UI Menu 1.11.4
  6640.  * http://jqueryui.com
  6641.  *
  6642.  * Copyright jQuery Foundation and other contributors
  6643.  * Released under the MIT license.
  6644.  * http://jquery.org/license
  6645.  *
  6646.  * http://api.jqueryui.com/menu/
  6647.  */
  6648.  
  6649.  
  6650. var menu = $.widget( "ui.menu", {
  6651.     version: "1.11.4",
  6652.     defaultElement: "<ul>",
  6653.     delay: 300,
  6654.     options: {
  6655.         icons: {
  6656.             submenu: "ui-icon-carat-1-e"
  6657.         },
  6658.         items: "> *",
  6659.         menus: "ul",
  6660.         position: {
  6661.             my: "left-1 top",
  6662.             at: "right top"
  6663.         },
  6664.         role: "menu",
  6665.  
  6666.         // callbacks
  6667.         blur: null,
  6668.         focus: null,
  6669.         select: null
  6670.     },
  6671.  
  6672.     _create: function() {
  6673.         this.activeMenu = this.element;
  6674.  
  6675.         // Flag used to prevent firing of the click handler
  6676.         // as the event bubbles up through nested menus
  6677.         this.mouseHandled = false;
  6678.         this.element
  6679.             .uniqueId()
  6680.             .addClass( "ui-menu ui-widget ui-widget-content" )
  6681.             .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
  6682.             .attr({
  6683.                 role: this.options.role,
  6684.                 tabIndex: 0
  6685.             });
  6686.  
  6687.         if ( this.options.disabled ) {
  6688.             this.element
  6689.                 .addClass( "ui-state-disabled" )
  6690.                 .attr( "aria-disabled", "true" );
  6691.         }
  6692.  
  6693.         this._on({
  6694.             // Prevent focus from sticking to links inside menu after clicking
  6695.             // them (focus should always stay on UL during navigation).
  6696.             "mousedown .ui-menu-item": function( event ) {
  6697.                 event.preventDefault();
  6698.             },
  6699.             "click .ui-menu-item": function( event ) {
  6700.                 var target = $( event.target );
  6701.                 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  6702.                     this.select( event );
  6703.  
  6704.                     // Only set the mouseHandled flag if the event will bubble, see #9469.
  6705.                     if ( !event.isPropagationStopped() ) {
  6706.                         this.mouseHandled = true;
  6707.                     }
  6708.  
  6709.                     // Open submenu on click
  6710.                     if ( target.has( ".ui-menu" ).length ) {
  6711.                         this.expand( event );
  6712.                     } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
  6713.  
  6714.                         // Redirect focus to the menu
  6715.                         this.element.trigger( "focus", [ true ] );
  6716.  
  6717.                         // If the active item is on the top level, let it stay active.
  6718.                         // Otherwise, blur the active item since it is no longer visible.
  6719.                         if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  6720.                             clearTimeout( this.timer );
  6721.                         }
  6722.                     }
  6723.                 }
  6724.             },
  6725.             "mouseenter .ui-menu-item": function( event ) {
  6726.                 // Ignore mouse events while typeahead is active, see #10458.
  6727.                 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  6728.                 // is over an item in the menu
  6729.                 if ( this.previousFilter ) {
  6730.                     return;
  6731.                 }
  6732.                 var target = $( event.currentTarget );
  6733.                 // Remove ui-state-active class from siblings of the newly focused menu item
  6734.                 // to avoid a jump caused by adjacent elements both having a class with a border
  6735.                 target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
  6736.                 this.focus( event, target );
  6737.             },
  6738.             mouseleave: "collapseAll",
  6739.             "mouseleave .ui-menu": "collapseAll",
  6740.             focus: function( event, keepActiveItem ) {
  6741.                 // If there's already an active item, keep it active
  6742.                 // If not, activate the first item
  6743.                 var item = this.active || this.element.find( this.options.items ).eq( 0 );
  6744.  
  6745.                 if ( !keepActiveItem ) {
  6746.                     this.focus( event, item );
  6747.                 }
  6748.             },
  6749.             blur: function( event ) {
  6750.                 this._delay(function() {
  6751.                     if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
  6752.                         this.collapseAll( event );
  6753.                     }
  6754.                 });
  6755.             },
  6756.             keydown: "_keydown"
  6757.         });
  6758.  
  6759.         this.refresh();
  6760.  
  6761.         // Clicks outside of a menu collapse any open menus
  6762.         this._on( this.document, {
  6763.             click: function( event ) {
  6764.                 if ( this._closeOnDocumentClick( event ) ) {
  6765.                     this.collapseAll( event );
  6766.                 }
  6767.  
  6768.                 // Reset the mouseHandled flag
  6769.                 this.mouseHandled = false;
  6770.             }
  6771.         });
  6772.     },
  6773.  
  6774.     _destroy: function() {
  6775.         // Destroy (sub)menus
  6776.         this.element
  6777.             .removeAttr( "aria-activedescendant" )
  6778.             .find( ".ui-menu" ).addBack()
  6779.                 .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
  6780.                 .removeAttr( "role" )
  6781.                 .removeAttr( "tabIndex" )
  6782.                 .removeAttr( "aria-labelledby" )
  6783.                 .removeAttr( "aria-expanded" )
  6784.                 .removeAttr( "aria-hidden" )
  6785.                 .removeAttr( "aria-disabled" )
  6786.                 .removeUniqueId()
  6787.                 .show();
  6788.  
  6789.         // Destroy menu items
  6790.         this.element.find( ".ui-menu-item" )
  6791.             .removeClass( "ui-menu-item" )
  6792.             .removeAttr( "role" )
  6793.             .removeAttr( "aria-disabled" )
  6794.             .removeUniqueId()
  6795.             .removeClass( "ui-state-hover" )
  6796.             .removeAttr( "tabIndex" )
  6797.             .removeAttr( "role" )
  6798.             .removeAttr( "aria-haspopup" )
  6799.             .children().each( function() {
  6800.                 var elem = $( this );
  6801.                 if ( elem.data( "ui-menu-submenu-carat" ) ) {
  6802.                     elem.remove();
  6803.                 }
  6804.             });
  6805.  
  6806.         // Destroy menu dividers
  6807.         this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
  6808.     },
  6809.  
  6810.     _keydown: function( event ) {
  6811.         var match, prev, character, skip,
  6812.             preventDefault = true;
  6813.  
  6814.         switch ( event.keyCode ) {
  6815.         case $.ui.keyCode.PAGE_UP:
  6816.             this.previousPage( event );
  6817.             break;
  6818.         case $.ui.keyCode.PAGE_DOWN:
  6819.             this.nextPage( event );
  6820.             break;
  6821.         case $.ui.keyCode.HOME:
  6822.             this._move( "first", "first", event );
  6823.             break;
  6824.         case $.ui.keyCode.END:
  6825.             this._move( "last", "last", event );
  6826.             break;
  6827.         case $.ui.keyCode.UP:
  6828.             this.previous( event );
  6829.             break;
  6830.         case $.ui.keyCode.DOWN:
  6831.             this.next( event );
  6832.             break;
  6833.         case $.ui.keyCode.LEFT:
  6834.             this.collapse( event );
  6835.             break;
  6836.         case $.ui.keyCode.RIGHT:
  6837.             if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6838.                 this.expand( event );
  6839.             }
  6840.             break;
  6841.         case $.ui.keyCode.ENTER:
  6842.         case $.ui.keyCode.SPACE:
  6843.             this._activate( event );
  6844.             break;
  6845.         case $.ui.keyCode.ESCAPE:
  6846.             this.collapse( event );
  6847.             break;
  6848.         default:
  6849.             preventDefault = false;
  6850.             prev = this.previousFilter || "";
  6851.             character = String.fromCharCode( event.keyCode );
  6852.             skip = false;
  6853.  
  6854.             clearTimeout( this.filterTimer );
  6855.  
  6856.             if ( character === prev ) {
  6857.                 skip = true;
  6858.             } else {
  6859.                 character = prev + character;
  6860.             }
  6861.  
  6862.             match = this._filterMenuItems( character );
  6863.             match = skip && match.index( this.active.next() ) !== -1 ?
  6864.                 this.active.nextAll( ".ui-menu-item" ) :
  6865.                 match;
  6866.  
  6867.             // If no matches on the current filter, reset to the last character pressed
  6868.             // to move down the menu to the first item that starts with that character
  6869.             if ( !match.length ) {
  6870.                 character = String.fromCharCode( event.keyCode );
  6871.                 match = this._filterMenuItems( character );
  6872.             }
  6873.  
  6874.             if ( match.length ) {
  6875.                 this.focus( event, match );
  6876.                 this.previousFilter = character;
  6877.                 this.filterTimer = this._delay(function() {
  6878.                     delete this.previousFilter;
  6879.                 }, 1000 );
  6880.             } else {
  6881.                 delete this.previousFilter;
  6882.             }
  6883.         }
  6884.  
  6885.         if ( preventDefault ) {
  6886.             event.preventDefault();
  6887.         }
  6888.     },
  6889.  
  6890.     _activate: function( event ) {
  6891.         if ( !this.active.is( ".ui-state-disabled" ) ) {
  6892.             if ( this.active.is( "[aria-haspopup='true']" ) ) {
  6893.                 this.expand( event );
  6894.             } else {
  6895.                 this.select( event );
  6896.             }
  6897.         }
  6898.     },
  6899.  
  6900.     refresh: function() {
  6901.         var menus, items,
  6902.             that = this,
  6903.             icon = this.options.icons.submenu,
  6904.             submenus = this.element.find( this.options.menus );
  6905.  
  6906.         this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
  6907.  
  6908.         // Initialize nested menus
  6909.         submenus.filter( ":not(.ui-menu)" )
  6910.             .addClass( "ui-menu ui-widget ui-widget-content ui-front" )
  6911.             .hide()
  6912.             .attr({
  6913.                 role: this.options.role,
  6914.                 "aria-hidden": "true",
  6915.                 "aria-expanded": "false"
  6916.             })
  6917.             .each(function() {
  6918.                 var menu = $( this ),
  6919.                     item = menu.parent(),
  6920.                     submenuCarat = $( "<span>" )
  6921.                         .addClass( "ui-menu-icon ui-icon " + icon )
  6922.                         .data( "ui-menu-submenu-carat", true );
  6923.  
  6924.                 item
  6925.                     .attr( "aria-haspopup", "true" )
  6926.                     .prepend( submenuCarat );
  6927.                 menu.attr( "aria-labelledby", item.attr( "id" ) );
  6928.             });
  6929.  
  6930.         menus = submenus.add( this.element );
  6931.         items = menus.find( this.options.items );
  6932.  
  6933.         // Initialize menu-items containing spaces and/or dashes only as dividers
  6934.         items.not( ".ui-menu-item" ).each(function() {
  6935.             var item = $( this );
  6936.             if ( that._isDivider( item ) ) {
  6937.                 item.addClass( "ui-widget-content ui-menu-divider" );
  6938.             }
  6939.         });
  6940.  
  6941.         // Don't refresh list items that are already adapted
  6942.         items.not( ".ui-menu-item, .ui-menu-divider" )
  6943.             .addClass( "ui-menu-item" )
  6944.             .uniqueId()
  6945.             .attr({
  6946.                 tabIndex: -1,
  6947.                 role: this._itemRole()
  6948.             });
  6949.  
  6950.         // Add aria-disabled attribute to any disabled menu item
  6951.         items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  6952.  
  6953.         // If the active item has been removed, blur the menu
  6954.         if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6955.             this.blur();
  6956.         }
  6957.     },
  6958.  
  6959.     _itemRole: function() {
  6960.         return {
  6961.             menu: "menuitem",
  6962.             listbox: "option"
  6963.         }[ this.options.role ];
  6964.     },
  6965.  
  6966.     _setOption: function( key, value ) {
  6967.         if ( key === "icons" ) {
  6968.             this.element.find( ".ui-menu-icon" )
  6969.                 .removeClass( this.options.icons.submenu )
  6970.                 .addClass( value.submenu );
  6971.         }
  6972.         if ( key === "disabled" ) {
  6973.             this.element
  6974.                 .toggleClass( "ui-state-disabled", !!value )
  6975.                 .attr( "aria-disabled", value );
  6976.         }
  6977.         this._super( key, value );
  6978.     },
  6979.  
  6980.     focus: function( event, item ) {
  6981.         var nested, focused;
  6982.         this.blur( event, event && event.type === "focus" );
  6983.  
  6984.         this._scrollIntoView( item );
  6985.  
  6986.         this.active = item.first();
  6987.         focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
  6988.         // Only update aria-activedescendant if there's a role
  6989.         // otherwise we assume focus is managed elsewhere
  6990.         if ( this.options.role ) {
  6991.             this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  6992.         }
  6993.  
  6994.         // Highlight active parent menu item, if any
  6995.         this.active
  6996.             .parent()
  6997.             .closest( ".ui-menu-item" )
  6998.             .addClass( "ui-state-active" );
  6999.  
  7000.         if ( event && event.type === "keydown" ) {
  7001.             this._close();
  7002.         } else {
  7003.             this.timer = this._delay(function() {
  7004.                 this._close();
  7005.             }, this.delay );
  7006.         }
  7007.  
  7008.         nested = item.children( ".ui-menu" );
  7009.         if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  7010.             this._startOpening(nested);
  7011.         }
  7012.         this.activeMenu = item.parent();
  7013.  
  7014.         this._trigger( "focus", event, { item: item } );
  7015.     },
  7016.  
  7017.     _scrollIntoView: function( item ) {
  7018.         var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  7019.         if ( this._hasScroll() ) {
  7020.             borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
  7021.             paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
  7022.             offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  7023.             scroll = this.activeMenu.scrollTop();
  7024.             elementHeight = this.activeMenu.height();
  7025.             itemHeight = item.outerHeight();
  7026.  
  7027.             if ( offset < 0 ) {
  7028.                 this.activeMenu.scrollTop( scroll + offset );
  7029.             } else if ( offset + itemHeight > elementHeight ) {
  7030.                 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  7031.             }
  7032.         }
  7033.     },
  7034.  
  7035.     blur: function( event, fromFocus ) {
  7036.         if ( !fromFocus ) {
  7037.             clearTimeout( this.timer );
  7038.         }
  7039.  
  7040.         if ( !this.active ) {
  7041.             return;
  7042.         }
  7043.  
  7044.         this.active.removeClass( "ui-state-focus" );
  7045.         this.active = null;
  7046.  
  7047.         this._trigger( "blur", event, { item: this.active } );
  7048.     },
  7049.  
  7050.     _startOpening: function( submenu ) {
  7051.         clearTimeout( this.timer );
  7052.  
  7053.         // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  7054.         // shift in the submenu position when mousing over the carat icon
  7055.         if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  7056.             return;
  7057.         }
  7058.  
  7059.         this.timer = this._delay(function() {
  7060.             this._close();
  7061.             this._open( submenu );
  7062.         }, this.delay );
  7063.     },
  7064.  
  7065.     _open: function( submenu ) {
  7066.         var position = $.extend({
  7067.             of: this.active
  7068.         }, this.options.position );
  7069.  
  7070.         clearTimeout( this.timer );
  7071.         this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  7072.             .hide()
  7073.             .attr( "aria-hidden", "true" );
  7074.  
  7075.         submenu
  7076.             .show()
  7077.             .removeAttr( "aria-hidden" )
  7078.             .attr( "aria-expanded", "true" )
  7079.             .position( position );
  7080.     },
  7081.  
  7082.     collapseAll: function( event, all ) {
  7083.         clearTimeout( this.timer );
  7084.         this.timer = this._delay(function() {
  7085.             // If we were passed an event, look for the submenu that contains the event
  7086.             var currentMenu = all ? this.element :
  7087.                 $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  7088.  
  7089.             // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
  7090.             if ( !currentMenu.length ) {
  7091.                 currentMenu = this.element;
  7092.             }
  7093.  
  7094.             this._close( currentMenu );
  7095.  
  7096.             this.blur( event );
  7097.             this.activeMenu = currentMenu;
  7098.         }, this.delay );
  7099.     },
  7100.  
  7101.     // With no arguments, closes the currently active menu - if nothing is active
  7102.     // it closes all menus.  If passed an argument, it will search for menus BELOW
  7103.     _close: function( startMenu ) {
  7104.         if ( !startMenu ) {
  7105.             startMenu = this.active ? this.active.parent() : this.element;
  7106.         }
  7107.  
  7108.         startMenu
  7109.             .find( ".ui-menu" )
  7110.                 .hide()
  7111.                 .attr( "aria-hidden", "true" )
  7112.                 .attr( "aria-expanded", "false" )
  7113.             .end()
  7114.             .find( ".ui-state-active" ).not( ".ui-state-focus" )
  7115.                 .removeClass( "ui-state-active" );
  7116.     },
  7117.  
  7118.     _closeOnDocumentClick: function( event ) {
  7119.         return !$( event.target ).closest( ".ui-menu" ).length;
  7120.     },
  7121.  
  7122.     _isDivider: function( item ) {
  7123.  
  7124.         // Match hyphen, em dash, en dash
  7125.         return !/[^\-\u2014\u2013\s]/.test( item.text() );
  7126.     },
  7127.  
  7128.     collapse: function( event ) {
  7129.         var newItem = this.active &&
  7130.             this.active.parent().closest( ".ui-menu-item", this.element );
  7131.         if ( newItem && newItem.length ) {
  7132.             this._close();
  7133.             this.focus( event, newItem );
  7134.         }
  7135.     },
  7136.  
  7137.     expand: function( event ) {
  7138.         var newItem = this.active &&
  7139.             this.active
  7140.                 .children( ".ui-menu " )
  7141.                 .find( this.options.items )
  7142.                 .first();
  7143.  
  7144.         if ( newItem && newItem.length ) {
  7145.             this._open( newItem.parent() );
  7146.  
  7147.             // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  7148.             this._delay(function() {
  7149.                 this.focus( event, newItem );
  7150.             });
  7151.         }
  7152.     },
  7153.  
  7154.     next: function( event ) {
  7155.         this._move( "next", "first", event );
  7156.     },
  7157.  
  7158.     previous: function( event ) {
  7159.         this._move( "prev", "last", event );
  7160.     },
  7161.  
  7162.     isFirstItem: function() {
  7163.         return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  7164.     },
  7165.  
  7166.     isLastItem: function() {
  7167.         return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  7168.     },
  7169.  
  7170.     _move: function( direction, filter, event ) {
  7171.         var next;
  7172.         if ( this.active ) {
  7173.             if ( direction === "first" || direction === "last" ) {
  7174.                 next = this.active
  7175.                     [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  7176.                     .eq( -1 );
  7177.             } else {
  7178.                 next = this.active
  7179.                     [ direction + "All" ]( ".ui-menu-item" )
  7180.                     .eq( 0 );
  7181.             }
  7182.         }
  7183.         if ( !next || !next.length || !this.active ) {
  7184.             next = this.activeMenu.find( this.options.items )[ filter ]();
  7185.         }
  7186.  
  7187.         this.focus( event, next );
  7188.     },
  7189.  
  7190.     nextPage: function( event ) {
  7191.         var item, base, height;
  7192.  
  7193.         if ( !this.active ) {
  7194.             this.next( event );
  7195.             return;
  7196.         }
  7197.         if ( this.isLastItem() ) {
  7198.             return;
  7199.         }
  7200.         if ( this._hasScroll() ) {
  7201.             base = this.active.offset().top;
  7202.             height = this.element.height();
  7203.             this.active.nextAll( ".ui-menu-item" ).each(function() {
  7204.                 item = $( this );
  7205.                 return item.offset().top - base - height < 0;
  7206.             });
  7207.  
  7208.             this.focus( event, item );
  7209.         } else {
  7210.             this.focus( event, this.activeMenu.find( this.options.items )
  7211.                 [ !this.active ? "first" : "last" ]() );
  7212.         }
  7213.     },
  7214.  
  7215.     previousPage: function( event ) {
  7216.         var item, base, height;
  7217.         if ( !this.active ) {
  7218.             this.next( event );
  7219.             return;
  7220.         }
  7221.         if ( this.isFirstItem() ) {
  7222.             return;
  7223.         }
  7224.         if ( this._hasScroll() ) {
  7225.             base = this.active.offset().top;
  7226.             height = this.element.height();
  7227.             this.active.prevAll( ".ui-menu-item" ).each(function() {
  7228.                 item = $( this );
  7229.                 return item.offset().top - base + height > 0;
  7230.             });
  7231.  
  7232.             this.focus( event, item );
  7233.         } else {
  7234.             this.focus( event, this.activeMenu.find( this.options.items ).first() );
  7235.         }
  7236.     },
  7237.  
  7238.     _hasScroll: function() {
  7239.         return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  7240.     },
  7241.  
  7242.     select: function( event ) {
  7243.         // TODO: It should never be possible to not have an active item at this
  7244.         // point, but the tests don't trigger mouseenter before click.
  7245.         this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  7246.         var ui = { item: this.active };
  7247.         if ( !this.active.has( ".ui-menu" ).length ) {
  7248.             this.collapseAll( event, true );
  7249.         }
  7250.         this._trigger( "select", event, ui );
  7251.     },
  7252.  
  7253.     _filterMenuItems: function(character) {
  7254.         var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  7255.             regex = new RegExp( "^" + escapedCharacter, "i" );
  7256.  
  7257.         return this.activeMenu
  7258.             .find( this.options.items )
  7259.  
  7260.             // Only match on items, not dividers or other content (#10571)
  7261.             .filter( ".ui-menu-item" )
  7262.             .filter(function() {
  7263.                 return regex.test( $.trim( $( this ).text() ) );
  7264.             });
  7265.     }
  7266. });
  7267.  
  7268.  
  7269. /*!
  7270.  * jQuery UI Autocomplete 1.11.4
  7271.  * http://jqueryui.com
  7272.  *
  7273.  * Copyright jQuery Foundation and other contributors
  7274.  * Released under the MIT license.
  7275.  * http://jquery.org/license
  7276.  *
  7277.  * http://api.jqueryui.com/autocomplete/
  7278.  */
  7279.  
  7280.  
  7281. $.widget( "ui.autocomplete", {
  7282.     version: "1.11.4",
  7283.     defaultElement: "<input>",
  7284.     options: {
  7285.         appendTo: null,
  7286.         autoFocus: false,
  7287.         delay: 300,
  7288.         minLength: 1,
  7289.         position: {
  7290.             my: "left top",
  7291.             at: "left bottom",
  7292.             collision: "none"
  7293.         },
  7294.         source: null,
  7295.  
  7296.         // callbacks
  7297.         change: null,
  7298.         close: null,
  7299.         focus: null,
  7300.         open: null,
  7301.         response: null,
  7302.         search: null,
  7303.         select: null
  7304.     },
  7305.  
  7306.     requestIndex: 0,
  7307.     pending: 0,
  7308.  
  7309.     _create: function() {
  7310.         // Some browsers only repeat keydown events, not keypress events,
  7311.         // so we use the suppressKeyPress flag to determine if we've already
  7312.         // handled the keydown event. #7269
  7313.         // Unfortunately the code for & in keypress is the same as the up arrow,
  7314.         // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  7315.         // events when we know the keydown event was used to modify the
  7316.         // search term. #7799
  7317.         var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  7318.             nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  7319.             isTextarea = nodeName === "textarea",
  7320.             isInput = nodeName === "input";
  7321.  
  7322.         this.isMultiLine =
  7323.             // Textareas are always multi-line
  7324.             isTextarea ? true :
  7325.             // Inputs are always single-line, even if inside a contentEditable element
  7326.             // IE also treats inputs as contentEditable
  7327.             isInput ? false :
  7328.             // All other element types are determined by whether or not they're contentEditable
  7329.             this.element.prop( "isContentEditable" );
  7330.  
  7331.         this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  7332.         this.isNewMenu = true;
  7333.  
  7334.         this.element
  7335.             .addClass( "ui-autocomplete-input" )
  7336.             .attr( "autocomplete", "off" );
  7337.  
  7338.         this._on( this.element, {
  7339.             keydown: function( event ) {
  7340.                 if ( this.element.prop( "readOnly" ) ) {
  7341.                     suppressKeyPress = true;
  7342.                     suppressInput = true;
  7343.                     suppressKeyPressRepeat = true;
  7344.                     return;
  7345.                 }
  7346.  
  7347.                 suppressKeyPress = false;
  7348.                 suppressInput = false;
  7349.                 suppressKeyPressRepeat = false;
  7350.                 var keyCode = $.ui.keyCode;
  7351.                 switch ( event.keyCode ) {
  7352.                 case keyCode.PAGE_UP:
  7353.                     suppressKeyPress = true;
  7354.                     this._move( "previousPage", event );
  7355.                     break;
  7356.                 case keyCode.PAGE_DOWN:
  7357.                     suppressKeyPress = true;
  7358.                     this._move( "nextPage", event );
  7359.                     break;
  7360.                 case keyCode.UP:
  7361.                     suppressKeyPress = true;
  7362.                     this._keyEvent( "previous", event );
  7363.                     break;
  7364.                 case keyCode.DOWN:
  7365.                     suppressKeyPress = true;
  7366.                     this._keyEvent( "next", event );
  7367.                     break;
  7368.                 case keyCode.ENTER:
  7369.                     // when menu is open and has focus
  7370.                     if ( this.menu.active ) {
  7371.                         // #6055 - Opera still allows the keypress to occur
  7372.                         // which causes forms to submit
  7373.                         suppressKeyPress = true;
  7374.                         event.preventDefault();
  7375.                         this.menu.select( event );
  7376.                     }
  7377.                     break;
  7378.                 case keyCode.TAB:
  7379.                     if ( this.menu.active ) {
  7380.                         this.menu.select( event );
  7381.                     }
  7382.                     break;
  7383.                 case keyCode.ESCAPE:
  7384.                     if ( this.menu.element.is( ":visible" ) ) {
  7385.                         if ( !this.isMultiLine ) {
  7386.                             this._value( this.term );
  7387.                         }
  7388.                         this.close( event );
  7389.                         // Different browsers have different default behavior for escape
  7390.                         // Single press can mean undo or clear
  7391.                         // Double press in IE means clear the whole form
  7392.                         event.preventDefault();
  7393.                     }
  7394.                     break;
  7395.                 default:
  7396.                     suppressKeyPressRepeat = true;
  7397.                     // search timeout should be triggered before the input value is changed
  7398.                     this._searchTimeout( event );
  7399.                     break;
  7400.                 }
  7401.             },
  7402.             keypress: function( event ) {
  7403.                 if ( suppressKeyPress ) {
  7404.                     suppressKeyPress = false;
  7405.                     if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7406.                         event.preventDefault();
  7407.                     }
  7408.                     return;
  7409.                 }
  7410.                 if ( suppressKeyPressRepeat ) {
  7411.                     return;
  7412.                 }
  7413.  
  7414.                 // replicate some key handlers to allow them to repeat in Firefox and Opera
  7415.                 var keyCode = $.ui.keyCode;
  7416.                 switch ( event.keyCode ) {
  7417.                 case keyCode.PAGE_UP:
  7418.                     this._move( "previousPage", event );
  7419.                     break;
  7420.                 case keyCode.PAGE_DOWN:
  7421.                     this._move( "nextPage", event );
  7422.                     break;
  7423.                 case keyCode.UP:
  7424.                     this._keyEvent( "previous", event );
  7425.                     break;
  7426.                 case keyCode.DOWN:
  7427.                     this._keyEvent( "next", event );
  7428.                     break;
  7429.                 }
  7430.             },
  7431.             input: function( event ) {
  7432.                 if ( suppressInput ) {
  7433.                     suppressInput = false;
  7434.                     event.preventDefault();
  7435.                     return;
  7436.                 }
  7437.                 this._searchTimeout( event );
  7438.             },
  7439.             focus: function() {
  7440.                 this.selectedItem = null;
  7441.                 this.previous = this._value();
  7442.             },
  7443.             blur: function( event ) {
  7444.                 if ( this.cancelBlur ) {
  7445.                     delete this.cancelBlur;
  7446.                     return;
  7447.                 }
  7448.  
  7449.                 clearTimeout( this.searching );
  7450.                 this.close( event );
  7451.                 this._change( event );
  7452.             }
  7453.         });
  7454.  
  7455.         this._initSource();
  7456.         this.menu = $( "<ul>" )
  7457.             .addClass( "ui-autocomplete ui-front" )
  7458.             .appendTo( this._appendTo() )
  7459.             .menu({
  7460.                 // disable ARIA support, the live region takes care of that
  7461.                 role: null
  7462.             })
  7463.             .hide()
  7464.             .menu( "instance" );
  7465.  
  7466.         this._on( this.menu.element, {
  7467.             mousedown: function( event ) {
  7468.                 // prevent moving focus out of the text field
  7469.                 event.preventDefault();
  7470.  
  7471.                 // IE doesn't prevent moving focus even with event.preventDefault()
  7472.                 // so we set a flag to know when we should ignore the blur event
  7473.                 this.cancelBlur = true;
  7474.                 this._delay(function() {
  7475.                     delete this.cancelBlur;
  7476.                 });
  7477.  
  7478.                 // clicking on the scrollbar causes focus to shift to the body
  7479.                 // but we can't detect a mouseup or a click immediately afterward
  7480.                 // so we have to track the next mousedown and close the menu if
  7481.                 // the user clicks somewhere outside of the autocomplete
  7482.                 var menuElement = this.menu.element[ 0 ];
  7483.                 if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  7484.                     this._delay(function() {
  7485.                         var that = this;
  7486.                         this.document.one( "mousedown", function( event ) {
  7487.                             if ( event.target !== that.element[ 0 ] &&
  7488.                                     event.target !== menuElement &&
  7489.                                     !$.contains( menuElement, event.target ) ) {
  7490.                                 that.close();
  7491.                             }
  7492.                         });
  7493.                     });
  7494.                 }
  7495.             },
  7496.             menufocus: function( event, ui ) {
  7497.                 var label, item;
  7498.                 // support: Firefox
  7499.                 // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  7500.                 if ( this.isNewMenu ) {
  7501.                     this.isNewMenu = false;
  7502.                     if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  7503.                         this.menu.blur();
  7504.  
  7505.                         this.document.one( "mousemove", function() {
  7506.                             $( event.target ).trigger( event.originalEvent );
  7507.                         });
  7508.  
  7509.                         return;
  7510.                     }
  7511.                 }
  7512.  
  7513.                 item = ui.item.data( "ui-autocomplete-item" );
  7514.                 if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  7515.                     // use value to match what will end up in the input, if it was a key event
  7516.                     if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  7517.                         this._value( item.value );
  7518.                     }
  7519.                 }
  7520.  
  7521.                 // Announce the value in the liveRegion
  7522.                 label = ui.item.attr( "aria-label" ) || item.value;
  7523.                 if ( label && $.trim( label ).length ) {
  7524.                     this.liveRegion.children().hide();
  7525.                     $( "<div>" ).text( label ).appendTo( this.liveRegion );
  7526.                 }
  7527.             },
  7528.             menuselect: function( event, ui ) {
  7529.                 var item = ui.item.data( "ui-autocomplete-item" ),
  7530.                     previous = this.previous;
  7531.  
  7532.                 // only trigger when focus was lost (click on menu)
  7533.                 if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
  7534.                     this.element.focus();
  7535.                     this.previous = previous;
  7536.                     // #6109 - IE triggers two focus events and the second
  7537.                     // is asynchronous, so we need to reset the previous
  7538.                     // term synchronously and asynchronously :-(
  7539.                     this._delay(function() {
  7540.                         this.previous = previous;
  7541.                         this.selectedItem = item;
  7542.                     });
  7543.                 }
  7544.  
  7545.                 if ( false !== this._trigger( "select", event, { item: item } ) ) {
  7546.                     this._value( item.value );
  7547.                 }
  7548.                 // reset the term after the select event
  7549.                 // this allows custom select handling to work properly
  7550.                 this.term = this._value();
  7551.  
  7552.                 this.close( event );
  7553.                 this.selectedItem = item;
  7554.             }
  7555.         });
  7556.  
  7557.         this.liveRegion = $( "<span>", {
  7558.                 role: "status",
  7559.                 "aria-live": "assertive",
  7560.                 "aria-relevant": "additions"
  7561.             })
  7562.             .addClass( "ui-helper-hidden-accessible" )
  7563.             .appendTo( this.document[ 0 ].body );
  7564.  
  7565.         // turning off autocomplete prevents the browser from remembering the
  7566.         // value when navigating through history, so we re-enable autocomplete
  7567.         // if the page is unloaded before the widget is destroyed. #7790
  7568.         this._on( this.window, {
  7569.             beforeunload: function() {
  7570.                 this.element.removeAttr( "autocomplete" );
  7571.             }
  7572.         });
  7573.     },
  7574.  
  7575.     _destroy: function() {
  7576.         clearTimeout( this.searching );
  7577.         this.element
  7578.             .removeClass( "ui-autocomplete-input" )
  7579.             .removeAttr( "autocomplete" );
  7580.         this.menu.element.remove();
  7581.         this.liveRegion.remove();
  7582.     },
  7583.  
  7584.     _setOption: function( key, value ) {
  7585.         this._super( key, value );
  7586.         if ( key === "source" ) {
  7587.             this._initSource();
  7588.         }
  7589.         if ( key === "appendTo" ) {
  7590.             this.menu.element.appendTo( this._appendTo() );
  7591.         }
  7592.         if ( key === "disabled" && value && this.xhr ) {
  7593.             this.xhr.abort();
  7594.         }
  7595.     },
  7596.  
  7597.     _appendTo: function() {
  7598.         var element = this.options.appendTo;
  7599.  
  7600.         if ( element ) {
  7601.             element = element.jquery || element.nodeType ?
  7602.                 $( element ) :
  7603.                 this.document.find( element ).eq( 0 );
  7604.         }
  7605.  
  7606.         if ( !element || !element[ 0 ] ) {
  7607.             element = this.element.closest( ".ui-front" );
  7608.         }
  7609.  
  7610.         if ( !element.length ) {
  7611.             element = this.document[ 0 ].body;
  7612.         }
  7613.  
  7614.         return element;
  7615.     },
  7616.  
  7617.     _initSource: function() {
  7618.         var array, url,
  7619.             that = this;
  7620.         if ( $.isArray( this.options.source ) ) {
  7621.             array = this.options.source;
  7622.             this.source = function( request, response ) {
  7623.                 response( $.ui.autocomplete.filter( array, request.term ) );
  7624.             };
  7625.         } else if ( typeof this.options.source === "string" ) {
  7626.             url = this.options.source;
  7627.             this.source = function( request, response ) {
  7628.                 if ( that.xhr ) {
  7629.                     that.xhr.abort();
  7630.                 }
  7631.                 that.xhr = $.ajax({
  7632.                     url: url,
  7633.                     data: request,
  7634.                     dataType: "json",
  7635.                     success: function( data ) {
  7636.                         response( data );
  7637.                     },
  7638.                     error: function() {
  7639.                         response([]);
  7640.                     }
  7641.                 });
  7642.             };
  7643.         } else {
  7644.             this.source = this.options.source;
  7645.         }
  7646.     },
  7647.  
  7648.     _searchTimeout: function( event ) {
  7649.         clearTimeout( this.searching );
  7650.         this.searching = this._delay(function() {
  7651.  
  7652.             // Search if the value has changed, or if the user retypes the same value (see #7434)
  7653.             var equalValues = this.term === this._value(),
  7654.                 menuVisible = this.menu.element.is( ":visible" ),
  7655.                 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  7656.  
  7657.             if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  7658.                 this.selectedItem = null;
  7659.                 this.search( null, event );
  7660.             }
  7661.         }, this.options.delay );
  7662.     },
  7663.  
  7664.     search: function( value, event ) {
  7665.         value = value != null ? value : this._value();
  7666.  
  7667.         // always save the actual value, not the one passed as an argument
  7668.         this.term = this._value();
  7669.  
  7670.         if ( value.length < this.options.minLength ) {
  7671.             return this.close( event );
  7672.         }
  7673.  
  7674.         if ( this._trigger( "search", event ) === false ) {
  7675.             return;
  7676.         }
  7677.  
  7678.         return this._search( value );
  7679.     },
  7680.  
  7681.     _search: function( value ) {
  7682.         this.pending++;
  7683.         this.element.addClass( "ui-autocomplete-loading" );
  7684.         this.cancelSearch = false;
  7685.  
  7686.         this.source( { term: value }, this._response() );
  7687.     },
  7688.  
  7689.     _response: function() {
  7690.         var index = ++this.requestIndex;
  7691.  
  7692.         return $.proxy(function( content ) {
  7693.             if ( index === this.requestIndex ) {
  7694.                 this.__response( content );
  7695.             }
  7696.  
  7697.             this.pending--;
  7698.             if ( !this.pending ) {
  7699.                 this.element.removeClass( "ui-autocomplete-loading" );
  7700.             }
  7701.         }, this );
  7702.     },
  7703.  
  7704.     __response: function( content ) {
  7705.         if ( content ) {
  7706.             content = this._normalize( content );
  7707.         }
  7708.         this._trigger( "response", null, { content: content } );
  7709.         if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  7710.             this._suggest( content );
  7711.             this._trigger( "open" );
  7712.         } else {
  7713.             // use ._close() instead of .close() so we don't cancel future searches
  7714.             this._close();
  7715.         }
  7716.     },
  7717.  
  7718.     close: function( event ) {
  7719.         this.cancelSearch = true;
  7720.         this._close( event );
  7721.     },
  7722.  
  7723.     _close: function( event ) {
  7724.         if ( this.menu.element.is( ":visible" ) ) {
  7725.             this.menu.element.hide();
  7726.             this.menu.blur();
  7727.             this.isNewMenu = true;
  7728.             this._trigger( "close", event );
  7729.         }
  7730.     },
  7731.  
  7732.     _change: function( event ) {
  7733.         if ( this.previous !== this._value() ) {
  7734.             this._trigger( "change", event, { item: this.selectedItem } );
  7735.         }
  7736.     },
  7737.  
  7738.     _normalize: function( items ) {
  7739.         // assume all items have the right format when the first item is complete
  7740.         if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  7741.             return items;
  7742.         }
  7743.         return $.map( items, function( item ) {
  7744.             if ( typeof item === "string" ) {
  7745.                 return {
  7746.                     label: item,
  7747.                     value: item
  7748.                 };
  7749.             }
  7750.             return $.extend( {}, item, {
  7751.                 label: item.label || item.value,
  7752.                 value: item.value || item.label
  7753.             });
  7754.         });
  7755.     },
  7756.  
  7757.     _suggest: function( items ) {
  7758.         var ul = this.menu.element.empty();
  7759.         this._renderMenu( ul, items );
  7760.         this.isNewMenu = true;
  7761.         this.menu.refresh();
  7762.  
  7763.         // size and position menu
  7764.         ul.show();
  7765.         this._resizeMenu();
  7766.         ul.position( $.extend({
  7767.             of: this.element
  7768.         }, this.options.position ) );
  7769.  
  7770.         if ( this.options.autoFocus ) {
  7771.             this.menu.next();
  7772.         }
  7773.     },
  7774.  
  7775.     _resizeMenu: function() {
  7776.         var ul = this.menu.element;
  7777.         ul.outerWidth( Math.max(
  7778.             // Firefox wraps long text (possibly a rounding bug)
  7779.             // so we add 1px to avoid the wrapping (#7513)
  7780.             ul.width( "" ).outerWidth() + 1,
  7781.             this.element.outerWidth()
  7782.         ) );
  7783.     },
  7784.  
  7785.     _renderMenu: function( ul, items ) {
  7786.         var that = this;
  7787.         $.each( items, function( index, item ) {
  7788.             that._renderItemData( ul, item );
  7789.         });
  7790.     },
  7791.  
  7792.     _renderItemData: function( ul, item ) {
  7793.         return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  7794.     },
  7795.  
  7796.     _renderItem: function( ul, item ) {
  7797.         return $( "<li>" ).text( item.label ).appendTo( ul );
  7798.     },
  7799.  
  7800.     _move: function( direction, event ) {
  7801.         if ( !this.menu.element.is( ":visible" ) ) {
  7802.             this.search( null, event );
  7803.             return;
  7804.         }
  7805.         if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  7806.                 this.menu.isLastItem() && /^next/.test( direction ) ) {
  7807.  
  7808.             if ( !this.isMultiLine ) {
  7809.                 this._value( this.term );
  7810.             }
  7811.  
  7812.             this.menu.blur();
  7813.             return;
  7814.         }
  7815.         this.menu[ direction ]( event );
  7816.     },
  7817.  
  7818.     widget: function() {
  7819.         return this.menu.element;
  7820.     },
  7821.  
  7822.     _value: function() {
  7823.         return this.valueMethod.apply( this.element, arguments );
  7824.     },
  7825.  
  7826.     _keyEvent: function( keyEvent, event ) {
  7827.         if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7828.             this._move( keyEvent, event );
  7829.  
  7830.             // prevents moving cursor to beginning/end of the text field in some browsers
  7831.             event.preventDefault();
  7832.         }
  7833.     }
  7834. });
  7835.  
  7836. $.extend( $.ui.autocomplete, {
  7837.     escapeRegex: function( value ) {
  7838.         return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  7839.     },
  7840.     filter: function( array, term ) {
  7841.         var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  7842.         return $.grep( array, function( value ) {
  7843.             return matcher.test( value.label || value.value || value );
  7844.         });
  7845.     }
  7846. });
  7847.  
  7848. // live region extension, adding a `messages` option
  7849. // NOTE: This is an experimental API. We are still investigating
  7850. // a full solution for string manipulation and internationalization.
  7851. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  7852.     options: {
  7853.         messages: {
  7854.             noResults: "No search results.",
  7855.             results: function( amount ) {
  7856.                 return amount + ( amount > 1 ? " results are" : " result is" ) +
  7857.                     " available, use up and down arrow keys to navigate.";
  7858.             }
  7859.         }
  7860.     },
  7861.  
  7862.     __response: function( content ) {
  7863.         var message;
  7864.         this._superApply( arguments );
  7865.         if ( this.options.disabled || this.cancelSearch ) {
  7866.             return;
  7867.         }
  7868.         if ( content && content.length ) {
  7869.             message = this.options.messages.results( content.length );
  7870.         } else {
  7871.             message = this.options.messages.noResults;
  7872.         }
  7873.         this.liveRegion.children().hide();
  7874.         $( "<div>" ).text( message ).appendTo( this.liveRegion );
  7875.     }
  7876. });
  7877.  
  7878. var autocomplete = $.ui.autocomplete;
  7879.  
  7880.  
  7881. /*!
  7882.  * jQuery UI Button 1.11.4
  7883.  * http://jqueryui.com
  7884.  *
  7885.  * Copyright jQuery Foundation and other contributors
  7886.  * Released under the MIT license.
  7887.  * http://jquery.org/license
  7888.  *
  7889.  * http://api.jqueryui.com/button/
  7890.  */
  7891.  
  7892.  
  7893. var lastActive,
  7894.     baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  7895.     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",
  7896.     formResetHandler = function() {
  7897.         var form = $( this );
  7898.         setTimeout(function() {
  7899.             form.find( ":ui-button" ).button( "refresh" );
  7900.         }, 1 );
  7901.     },
  7902.     radioGroup = function( radio ) {
  7903.         var name = radio.name,
  7904.             form = radio.form,
  7905.             radios = $( [] );
  7906.         if ( name ) {
  7907.             name = name.replace( /'/g, "\\'" );
  7908.             if ( form ) {
  7909.                 radios = $( form ).find( "[name='" + name + "'][type=radio]" );
  7910.             } else {
  7911.                 radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
  7912.                     .filter(function() {
  7913.                         return !this.form;
  7914.                     });
  7915.             }
  7916.         }
  7917.         return radios;
  7918.     };
  7919.  
  7920. $.widget( "ui.button", {
  7921.     version: "1.11.4",
  7922.     defaultElement: "<button>",
  7923.     options: {
  7924.         disabled: null,
  7925.         text: true,
  7926.         label: null,
  7927.         icons: {
  7928.             primary: null,
  7929.             secondary: null
  7930.         }
  7931.     },
  7932.     _create: function() {
  7933.         this.element.closest( "form" )
  7934.             .unbind( "reset" + this.eventNamespace )
  7935.             .bind( "reset" + this.eventNamespace, formResetHandler );
  7936.  
  7937.         if ( typeof this.options.disabled !== "boolean" ) {
  7938.             this.options.disabled = !!this.element.prop( "disabled" );
  7939.         } else {
  7940.             this.element.prop( "disabled", this.options.disabled );
  7941.         }
  7942.  
  7943.         this._determineButtonType();
  7944.         this.hasTitle = !!this.buttonElement.attr( "title" );
  7945.  
  7946.         var that = this,
  7947.             options = this.options,
  7948.             toggleButton = this.type === "checkbox" || this.type === "radio",
  7949.             activeClass = !toggleButton ? "ui-state-active" : "";
  7950.  
  7951.         if ( options.label === null ) {
  7952.             options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
  7953.         }
  7954.  
  7955.         this._hoverable( this.buttonElement );
  7956.  
  7957.         this.buttonElement
  7958.             .addClass( baseClasses )
  7959.             .attr( "role", "button" )
  7960.             .bind( "mouseenter" + this.eventNamespace, function() {
  7961.                 if ( options.disabled ) {
  7962.                     return;
  7963.                 }
  7964.                 if ( this === lastActive ) {
  7965.                     $( this ).addClass( "ui-state-active" );
  7966.                 }
  7967.             })
  7968.             .bind( "mouseleave" + this.eventNamespace, function() {
  7969.                 if ( options.disabled ) {
  7970.                     return;
  7971.                 }
  7972.                 $( this ).removeClass( activeClass );
  7973.             })
  7974.             .bind( "click" + this.eventNamespace, function( event ) {
  7975.                 if ( options.disabled ) {
  7976.                     event.preventDefault();
  7977.                     event.stopImmediatePropagation();
  7978.                 }
  7979.             });
  7980.  
  7981.         // Can't use _focusable() because the element that receives focus
  7982.         // and the element that gets the ui-state-focus class are different
  7983.         this._on({
  7984.             focus: function() {
  7985.                 this.buttonElement.addClass( "ui-state-focus" );
  7986.             },
  7987.             blur: function() {
  7988.                 this.buttonElement.removeClass( "ui-state-focus" );
  7989.             }
  7990.         });
  7991.  
  7992.         if ( toggleButton ) {
  7993.             this.element.bind( "change" + this.eventNamespace, function() {
  7994.                 that.refresh();
  7995.             });
  7996.         }
  7997.  
  7998.         if ( this.type === "checkbox" ) {
  7999.             this.buttonElement.bind( "click" + this.eventNamespace, function() {
  8000.                 if ( options.disabled ) {
  8001.                     return false;
  8002.                 }
  8003.             });
  8004.         } else if ( this.type === "radio" ) {
  8005.             this.buttonElement.bind( "click" + this.eventNamespace, function() {
  8006.                 if ( options.disabled ) {
  8007.                     return false;
  8008.                 }
  8009.                 $( this ).addClass( "ui-state-active" );
  8010.                 that.buttonElement.attr( "aria-pressed", "true" );
  8011.  
  8012.                 var radio = that.element[ 0 ];
  8013.                 radioGroup( radio )
  8014.                     .not( radio )
  8015.                     .map(function() {
  8016.                         return $( this ).button( "widget" )[ 0 ];
  8017.                     })
  8018.                     .removeClass( "ui-state-active" )
  8019.                     .attr( "aria-pressed", "false" );
  8020.             });
  8021.         } else {
  8022.             this.buttonElement
  8023.                 .bind( "mousedown" + this.eventNamespace, function() {
  8024.                     if ( options.disabled ) {
  8025.                         return false;
  8026.                     }
  8027.                     $( this ).addClass( "ui-state-active" );
  8028.                     lastActive = this;
  8029.                     that.document.one( "mouseup", function() {
  8030.                         lastActive = null;
  8031.                     });
  8032.                 })
  8033.                 .bind( "mouseup" + this.eventNamespace, function() {
  8034.                     if ( options.disabled ) {
  8035.                         return false;
  8036.                     }
  8037.                     $( this ).removeClass( "ui-state-active" );
  8038.                 })
  8039.                 .bind( "keydown" + this.eventNamespace, function(event) {
  8040.                     if ( options.disabled ) {
  8041.                         return false;
  8042.                     }
  8043.                     if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
  8044.                         $( this ).addClass( "ui-state-active" );
  8045.                     }
  8046.                 })
  8047.                 // see #8559, we bind to blur here in case the button element loses
  8048.                 // focus between keydown and keyup, it would be left in an "active" state
  8049.                 .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
  8050.                     $( this ).removeClass( "ui-state-active" );
  8051.                 });
  8052.  
  8053.             if ( this.buttonElement.is("a") ) {
  8054.                 this.buttonElement.keyup(function(event) {
  8055.                     if ( event.keyCode === $.ui.keyCode.SPACE ) {
  8056.                         // TODO pass through original event correctly (just as 2nd argument doesn't work)
  8057.                         $( this ).click();
  8058.                     }
  8059.                 });
  8060.             }
  8061.         }
  8062.  
  8063.         this._setOption( "disabled", options.disabled );
  8064.         this._resetButton();
  8065.     },
  8066.  
  8067.     _determineButtonType: function() {
  8068.         var ancestor, labelSelector, checked;
  8069.  
  8070.         if ( this.element.is("[type=checkbox]") ) {
  8071.             this.type = "checkbox";
  8072.         } else if ( this.element.is("[type=radio]") ) {
  8073.             this.type = "radio";
  8074.         } else if ( this.element.is("input") ) {
  8075.             this.type = "input";
  8076.         } else {
  8077.             this.type = "button";
  8078.         }
  8079.  
  8080.         if ( this.type === "checkbox" || this.type === "radio" ) {
  8081.             // we don't search against the document in case the element
  8082.             // is disconnected from the DOM
  8083.             ancestor = this.element.parents().last();
  8084.             labelSelector = "label[for='" + this.element.attr("id") + "']";
  8085.             this.buttonElement = ancestor.find( labelSelector );
  8086.             if ( !this.buttonElement.length ) {
  8087.                 ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
  8088.                 this.buttonElement = ancestor.filter( labelSelector );
  8089.                 if ( !this.buttonElement.length ) {
  8090.                     this.buttonElement = ancestor.find( labelSelector );
  8091.                 }
  8092.             }
  8093.             this.element.addClass( "ui-helper-hidden-accessible" );
  8094.  
  8095.             checked = this.element.is( ":checked" );
  8096.             if ( checked ) {
  8097.                 this.buttonElement.addClass( "ui-state-active" );
  8098.             }
  8099.             this.buttonElement.prop( "aria-pressed", checked );
  8100.         } else {
  8101.             this.buttonElement = this.element;
  8102.         }
  8103.     },
  8104.  
  8105.     widget: function() {
  8106.         return this.buttonElement;
  8107.     },
  8108.  
  8109.     _destroy: function() {
  8110.         this.element
  8111.             .removeClass( "ui-helper-hidden-accessible" );
  8112.         this.buttonElement
  8113.             .removeClass( baseClasses + " ui-state-active " + typeClasses )
  8114.             .removeAttr( "role" )
  8115.             .removeAttr( "aria-pressed" )
  8116.             .html( this.buttonElement.find(".ui-button-text").html() );
  8117.  
  8118.         if ( !this.hasTitle ) {
  8119.             this.buttonElement.removeAttr( "title" );
  8120.         }
  8121.     },
  8122.  
  8123.     _setOption: function( key, value ) {
  8124.         this._super( key, value );
  8125.         if ( key === "disabled" ) {
  8126.             this.widget().toggleClass( "ui-state-disabled", !!value );
  8127.             this.element.prop( "disabled", !!value );
  8128.             if ( value ) {
  8129.                 if ( this.type === "checkbox" || this.type === "radio" ) {
  8130.                     this.buttonElement.removeClass( "ui-state-focus" );
  8131.                 } else {
  8132.                     this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
  8133.                 }
  8134.             }
  8135.             return;
  8136.         }
  8137.         this._resetButton();
  8138.     },
  8139.  
  8140.     refresh: function() {
  8141.         //See #8237 & #8828
  8142.         var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
  8143.  
  8144.         if ( isDisabled !== this.options.disabled ) {
  8145.             this._setOption( "disabled", isDisabled );
  8146.         }
  8147.         if ( this.type === "radio" ) {
  8148.             radioGroup( this.element[0] ).each(function() {
  8149.                 if ( $( this ).is( ":checked" ) ) {
  8150.                     $( this ).button( "widget" )
  8151.                         .addClass( "ui-state-active" )
  8152.                         .attr( "aria-pressed", "true" );
  8153.                 } else {
  8154.                     $( this ).button( "widget" )
  8155.                         .removeClass( "ui-state-active" )
  8156.                         .attr( "aria-pressed", "false" );
  8157.                 }
  8158.             });
  8159.         } else if ( this.type === "checkbox" ) {
  8160.             if ( this.element.is( ":checked" ) ) {
  8161.                 this.buttonElement
  8162.                     .addClass( "ui-state-active" )
  8163.                     .attr( "aria-pressed", "true" );
  8164.             } else {
  8165.                 this.buttonElement
  8166.                     .removeClass( "ui-state-active" )
  8167.                     .attr( "aria-pressed", "false" );
  8168.             }
  8169.         }
  8170.     },
  8171.  
  8172.     _resetButton: function() {
  8173.         if ( this.type === "input" ) {
  8174.             if ( this.options.label ) {
  8175.                 this.element.val( this.options.label );
  8176.             }
  8177.             return;
  8178.         }
  8179.         var buttonElement = this.buttonElement.removeClass( typeClasses ),
  8180.             buttonText = $( "<span></span>", this.document[0] )
  8181.                 .addClass( "ui-button-text" )
  8182.                 .html( this.options.label )
  8183.                 .appendTo( buttonElement.empty() )
  8184.                 .text(),
  8185.             icons = this.options.icons,
  8186.             multipleIcons = icons.primary && icons.secondary,
  8187.             buttonClasses = [];
  8188.  
  8189.         if ( icons.primary || icons.secondary ) {
  8190.             if ( this.options.text ) {
  8191.                 buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
  8192.             }
  8193.  
  8194.             if ( icons.primary ) {
  8195.                 buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
  8196.             }
  8197.  
  8198.             if ( icons.secondary ) {
  8199.                 buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
  8200.             }
  8201.  
  8202.             if ( !this.options.text ) {
  8203.                 buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
  8204.  
  8205.                 if ( !this.hasTitle ) {
  8206.                     buttonElement.attr( "title", $.trim( buttonText ) );
  8207.                 }
  8208.             }
  8209.         } else {
  8210.             buttonClasses.push( "ui-button-text-only" );
  8211.         }
  8212.         buttonElement.addClass( buttonClasses.join( " " ) );
  8213.     }
  8214. });
  8215.  
  8216. $.widget( "ui.buttonset", {
  8217.     version: "1.11.4",
  8218.     options: {
  8219.         items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
  8220.     },
  8221.  
  8222.     _create: function() {
  8223.         this.element.addClass( "ui-buttonset" );
  8224.     },
  8225.  
  8226.     _init: function() {
  8227.         this.refresh();
  8228.     },
  8229.  
  8230.     _setOption: function( key, value ) {
  8231.         if ( key === "disabled" ) {
  8232.             this.buttons.button( "option", key, value );
  8233.         }
  8234.  
  8235.         this._super( key, value );
  8236.     },
  8237.  
  8238.     refresh: function() {
  8239.         var rtl = this.element.css( "direction" ) === "rtl",
  8240.             allButtons = this.element.find( this.options.items ),
  8241.             existingButtons = allButtons.filter( ":ui-button" );
  8242.  
  8243.         // Initialize new buttons
  8244.         allButtons.not( ":ui-button" ).button();
  8245.  
  8246.         // Refresh existing buttons
  8247.         existingButtons.button( "refresh" );
  8248.  
  8249.         this.buttons = allButtons
  8250.             .map(function() {
  8251.                 return $( this ).button( "widget" )[ 0 ];
  8252.             })
  8253.                 .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  8254.                 .filter( ":first" )
  8255.                     .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
  8256.                 .end()
  8257.                 .filter( ":last" )
  8258.                     .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
  8259.                 .end()
  8260.             .end();
  8261.     },
  8262.  
  8263.     _destroy: function() {
  8264.         this.element.removeClass( "ui-buttonset" );
  8265.         this.buttons
  8266.             .map(function() {
  8267.                 return $( this ).button( "widget" )[ 0 ];
  8268.             })
  8269.                 .removeClass( "ui-corner-left ui-corner-right" )
  8270.             .end()
  8271.             .button( "destroy" );
  8272.     }
  8273. });
  8274.  
  8275. var button = $.ui.button;
  8276.  
  8277.  
  8278. /*!
  8279.  * jQuery UI Datepicker 1.11.4
  8280.  * http://jqueryui.com
  8281.  *
  8282.  * Copyright jQuery Foundation and other contributors
  8283.  * Released under the MIT license.
  8284.  * http://jquery.org/license
  8285.  *
  8286.  * http://api.jqueryui.com/datepicker/
  8287.  */
  8288.  
  8289.  
  8290. $.extend($.ui, { datepicker: { version: "1.11.4" } });
  8291.  
  8292. var datepicker_instActive;
  8293.  
  8294. function datepicker_getZindex( elem ) {
  8295.     var position, value;
  8296.     while ( elem.length && elem[ 0 ] !== document ) {
  8297.         // Ignore z-index if position is set to a value where z-index is ignored by the browser
  8298.         // This makes behavior of this function consistent across browsers
  8299.         // WebKit always returns auto if the element is positioned
  8300.         position = elem.css( "position" );
  8301.         if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  8302.             // IE returns 0 when zIndex is not specified
  8303.             // other browsers return a string
  8304.             // we ignore the case of nested elements with an explicit value of 0
  8305.             // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  8306.             value = parseInt( elem.css( "zIndex" ), 10 );
  8307.             if ( !isNaN( value ) && value !== 0 ) {
  8308.                 return value;
  8309.             }
  8310.         }
  8311.         elem = elem.parent();
  8312.     }
  8313.  
  8314.     return 0;
  8315. }
  8316. /* Date picker manager.
  8317.    Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  8318.    Settings for (groups of) date pickers are maintained in an instance object,
  8319.    allowing multiple different settings on the same page. */
  8320.  
  8321. function Datepicker() {
  8322.     this._curInst = null; // The current instance in use
  8323.     this._keyEvent = false; // If the last event was a key event
  8324.     this._disabledInputs = []; // List of date picker inputs that have been disabled
  8325.     this._datepickerShowing = false; // True if the popup picker is showing , false if not
  8326.     this._inDialog = false; // True if showing within a "dialog", false if not
  8327.     this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  8328.     this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  8329.     this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  8330.     this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  8331.     this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  8332.     this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  8333.     this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  8334.     this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  8335.     this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  8336.     this.regional = []; // Available regional settings, indexed by language code
  8337.     this.regional[""] = { // Default regional settings
  8338.         closeText: "Done", // Display text for close link
  8339.         prevText: "Prev", // Display text for previous month link
  8340.         nextText: "Next", // Display text for next month link
  8341.         currentText: "Today", // Display text for current month link
  8342.         monthNames: ["January","February","March","April","May","June",
  8343.             "July","August","September","October","November","December"], // Names of months for drop-down and formatting
  8344.         monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
  8345.         dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
  8346.         dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
  8347.         dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
  8348.         weekHeader: "Wk", // Column header for week of the year
  8349.         dateFormat: "mm/dd/yy", // See format options on parseDate
  8350.         firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  8351.         isRTL: false, // True if right-to-left language, false if left-to-right
  8352.         showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  8353.         yearSuffix: "" // Additional text to append to the year in the month headers
  8354.     };
  8355.     this._defaults = { // Global defaults for all the date picker instances
  8356.         showOn: "focus", // "focus" for popup on focus,
  8357.             // "button" for trigger button, or "both" for either
  8358.         showAnim: "fadeIn", // Name of jQuery animation for popup
  8359.         showOptions: {}, // Options for enhanced animations
  8360.         defaultDate: null, // Used when field is blank: actual date,
  8361.             // +/-number for offset from today, null for today
  8362.         appendText: "", // Display text following the input box, e.g. showing the format
  8363.         buttonText: "...", // Text for trigger button
  8364.         buttonImage: "", // URL for trigger button image
  8365.         buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  8366.         hideIfNoPrevNext: false, // True to hide next/previous month links
  8367.             // if not applicable, false to just disable them
  8368.         navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  8369.         gotoCurrent: false, // True if today link goes back to current selection instead
  8370.         changeMonth: false, // True if month can be selected directly, false if only prev/next
  8371.         changeYear: false, // True if year can be selected directly, false if only prev/next
  8372.         yearRange: "c-10:c+10", // Range of years to display in drop-down,
  8373.             // either relative to today's year (-nn:+nn), relative to currently displayed year
  8374.             // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  8375.         showOtherMonths: false, // True to show dates in other months, false to leave blank
  8376.         selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  8377.         showWeek: false, // True to show week of the year, false to not show it
  8378.         calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  8379.             // takes a Date and returns the number of the week for it
  8380.         shortYearCutoff: "+10", // Short year values < this are in the current century,
  8381.             // > this are in the previous century,
  8382.             // string value starting with "+" for current year + value
  8383.         minDate: null, // The earliest selectable date, or null for no limit
  8384.         maxDate: null, // The latest selectable date, or null for no limit
  8385.         duration: "fast", // Duration of display/closure
  8386.         beforeShowDay: null, // Function that takes a date and returns an array with
  8387.             // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  8388.             // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  8389.         beforeShow: null, // Function that takes an input field and
  8390.             // returns a set of custom settings for the date picker
  8391.         onSelect: null, // Define a callback function when a date is selected
  8392.         onChangeMonthYear: null, // Define a callback function when the month or year is changed
  8393.         onClose: null, // Define a callback function when the datepicker is closed
  8394.         numberOfMonths: 1, // Number of months to show at a time
  8395.         showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  8396.         stepMonths: 1, // Number of months to step back/forward
  8397.         stepBigMonths: 12, // Number of months to step back/forward for the big links
  8398.         altField: "", // Selector for an alternate field to store selected dates into
  8399.         altFormat: "", // The date format to use for the alternate field
  8400.         constrainInput: true, // The input is constrained by the current date format
  8401.         showButtonPanel: false, // True to show button panel, false to not show it
  8402.         autoSize: false, // True to size the input for the date format, false to leave as is
  8403.         disabled: false // The initial disabled state
  8404.     };
  8405.     $.extend(this._defaults, this.regional[""]);
  8406.     this.regional.en = $.extend( true, {}, this.regional[ "" ]);
  8407.     this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
  8408.     this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  8409. }
  8410.  
  8411. $.extend(Datepicker.prototype, {
  8412.     /* Class name added to elements to indicate already configured with a date picker. */
  8413.     markerClassName: "hasDatepicker",
  8414.  
  8415.     //Keep track of the maximum number of rows displayed (see #7043)
  8416.     maxRows: 4,
  8417.  
  8418.     // TODO rename to "widget" when switching to widget factory
  8419.     _widgetDatepicker: function() {
  8420.         return this.dpDiv;
  8421.     },
  8422.  
  8423.     /* Override the default settings for all instances of the date picker.
  8424.      * @param  settings  object - the new settings to use as defaults (anonymous object)
  8425.      * @return the manager object
  8426.      */
  8427.     setDefaults: function(settings) {
  8428.         datepicker_extendRemove(this._defaults, settings || {});
  8429.         return this;
  8430.     },
  8431.  
  8432.     /* Attach the date picker to a jQuery selection.
  8433.      * @param  target   element - the target input field or division or span
  8434.      * @param  settings  object - the new settings to use for this date picker instance (anonymous)
  8435.      */
  8436.     _attachDatepicker: function(target, settings) {
  8437.         var nodeName, inline, inst;
  8438.         nodeName = target.nodeName.toLowerCase();
  8439.         inline = (nodeName === "div" || nodeName === "span");
  8440.         if (!target.id) {
  8441.             this.uuid += 1;
  8442.             target.id = "dp" + this.uuid;
  8443.         }
  8444.         inst = this._newInst($(target), inline);
  8445.         inst.settings = $.extend({}, settings || {});
  8446.         if (nodeName === "input") {
  8447.             this._connectDatepicker(target, inst);
  8448.         } else if (inline) {
  8449.             this._inlineDatepicker(target, inst);
  8450.         }
  8451.     },
  8452.  
  8453.     /* Create a new instance object. */
  8454.     _newInst: function(target, inline) {
  8455.         var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
  8456.         return {id: id, input: target, // associated target
  8457.             selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  8458.             drawMonth: 0, drawYear: 0, // month being drawn
  8459.             inline: inline, // is datepicker inline or not
  8460.             dpDiv: (!inline ? this.dpDiv : // presentation div
  8461.             datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
  8462.     },
  8463.  
  8464.     /* Attach the date picker to an input field. */
  8465.     _connectDatepicker: function(target, inst) {
  8466.         var input = $(target);
  8467.         inst.append = $([]);
  8468.         inst.trigger = $([]);
  8469.         if (input.hasClass(this.markerClassName)) {
  8470.             return;
  8471.         }
  8472.         this._attachments(input, inst);
  8473.         input.addClass(this.markerClassName).keydown(this._doKeyDown).
  8474.             keypress(this._doKeyPress).keyup(this._doKeyUp);
  8475.         this._autoSize(inst);
  8476.         $.data(target, "datepicker", inst);
  8477.         //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  8478.         if( inst.settings.disabled ) {
  8479.             this._disableDatepicker( target );
  8480.         }
  8481.     },
  8482.  
  8483.     /* Make attachments based on settings. */
  8484.     _attachments: function(input, inst) {
  8485.         var showOn, buttonText, buttonImage,
  8486.             appendText = this._get(inst, "appendText"),
  8487.             isRTL = this._get(inst, "isRTL");
  8488.  
  8489.         if (inst.append) {
  8490.             inst.append.remove();
  8491.         }
  8492.         if (appendText) {
  8493.             inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
  8494.             input[isRTL ? "before" : "after"](inst.append);
  8495.         }
  8496.  
  8497.         input.unbind("focus", this._showDatepicker);
  8498.  
  8499.         if (inst.trigger) {
  8500.             inst.trigger.remove();
  8501.         }
  8502.  
  8503.         showOn = this._get(inst, "showOn");
  8504.         if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
  8505.             input.focus(this._showDatepicker);
  8506.         }
  8507.         if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
  8508.             buttonText = this._get(inst, "buttonText");
  8509.             buttonImage = this._get(inst, "buttonImage");
  8510.             inst.trigger = $(this._get(inst, "buttonImageOnly") ?
  8511.                 $("<img/>").addClass(this._triggerClass).
  8512.                     attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  8513.                 $("<button type='button'></button>").addClass(this._triggerClass).
  8514.                     html(!buttonImage ? buttonText : $("<img/>").attr(
  8515.                     { src:buttonImage, alt:buttonText, title:buttonText })));
  8516.             input[isRTL ? "before" : "after"](inst.trigger);
  8517.             inst.trigger.click(function() {
  8518.                 if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
  8519.                     $.datepicker._hideDatepicker();
  8520.                 } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
  8521.                     $.datepicker._hideDatepicker();
  8522.                     $.datepicker._showDatepicker(input[0]);
  8523.                 } else {
  8524.                     $.datepicker._showDatepicker(input[0]);
  8525.                 }
  8526.                 return false;
  8527.             });
  8528.         }
  8529.     },
  8530.  
  8531.     /* Apply the maximum length for the date format. */
  8532.     _autoSize: function(inst) {
  8533.         if (this._get(inst, "autoSize") && !inst.inline) {
  8534.             var findMax, max, maxI, i,
  8535.                 date = new Date(2009, 12 - 1, 20), // Ensure double digits
  8536.                 dateFormat = this._get(inst, "dateFormat");
  8537.  
  8538.             if (dateFormat.match(/[DM]/)) {
  8539.                 findMax = function(names) {
  8540.                     max = 0;
  8541.                     maxI = 0;
  8542.                     for (i = 0; i < names.length; i++) {
  8543.                         if (names[i].length > max) {
  8544.                             max = names[i].length;
  8545.                             maxI = i;
  8546.                         }
  8547.                     }
  8548.                     return maxI;
  8549.                 };
  8550.                 date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  8551.                     "monthNames" : "monthNamesShort"))));
  8552.                 date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  8553.                     "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
  8554.             }
  8555.             inst.input.attr("size", this._formatDate(inst, date).length);
  8556.         }
  8557.     },
  8558.  
  8559.     /* Attach an inline date picker to a div. */
  8560.     _inlineDatepicker: function(target, inst) {
  8561.         var divSpan = $(target);
  8562.         if (divSpan.hasClass(this.markerClassName)) {
  8563.             return;
  8564.         }
  8565.         divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  8566.         $.data(target, "datepicker", inst);
  8567.         this._setDate(inst, this._getDefaultDate(inst), true);
  8568.         this._updateDatepicker(inst);
  8569.         this._updateAlternate(inst);
  8570.         //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  8571.         if( inst.settings.disabled ) {
  8572.             this._disableDatepicker( target );
  8573.         }
  8574.         // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  8575.         // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  8576.         inst.dpDiv.css( "display", "block" );
  8577.     },
  8578.  
  8579.     /* Pop-up the date picker in a "dialog" box.
  8580.      * @param  input element - ignored
  8581.      * @param  date string or Date - the initial date to display
  8582.      * @param  onSelect  function - the function to call when a date is selected
  8583.      * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
  8584.      * @param  pos int[2] - coordinates for the dialog's position within the screen or
  8585.      *                  event - with x/y coordinates or
  8586.      *                  leave empty for default (screen centre)
  8587.      * @return the manager object
  8588.      */
  8589.     _dialogDatepicker: function(input, date, onSelect, settings, pos) {
  8590.         var id, browserWidth, browserHeight, scrollX, scrollY,
  8591.             inst = this._dialogInst; // internal instance
  8592.  
  8593.         if (!inst) {
  8594.             this.uuid += 1;
  8595.             id = "dp" + this.uuid;
  8596.             this._dialogInput = $("<input type='text' id='" + id +
  8597.                 "' style='position: absolute; top: -100px; width: 0px;'/>");
  8598.             this._dialogInput.keydown(this._doKeyDown);
  8599.             $("body").append(this._dialogInput);
  8600.             inst = this._dialogInst = this._newInst(this._dialogInput, false);
  8601.             inst.settings = {};
  8602.             $.data(this._dialogInput[0], "datepicker", inst);
  8603.         }
  8604.         datepicker_extendRemove(inst.settings, settings || {});
  8605.         date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  8606.         this._dialogInput.val(date);
  8607.  
  8608.         this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  8609.         if (!this._pos) {
  8610.             browserWidth = document.documentElement.clientWidth;
  8611.             browserHeight = document.documentElement.clientHeight;
  8612.             scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  8613.             scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  8614.             this._pos = // should use actual width/height below
  8615.                 [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  8616.         }
  8617.  
  8618.         // move input on screen for focus, but hidden behind dialog
  8619.         this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
  8620.         inst.settings.onSelect = onSelect;
  8621.         this._inDialog = true;
  8622.         this.dpDiv.addClass(this._dialogClass);
  8623.         this._showDatepicker(this._dialogInput[0]);
  8624.         if ($.blockUI) {
  8625.             $.blockUI(this.dpDiv);
  8626.         }
  8627.         $.data(this._dialogInput[0], "datepicker", inst);
  8628.         return this;
  8629.     },
  8630.  
  8631.     /* Detach a datepicker from its control.
  8632.      * @param  target   element - the target input field or division or span
  8633.      */
  8634.     _destroyDatepicker: function(target) {
  8635.         var nodeName,
  8636.             $target = $(target),
  8637.             inst = $.data(target, "datepicker");
  8638.  
  8639.         if (!$target.hasClass(this.markerClassName)) {
  8640.             return;
  8641.         }
  8642.  
  8643.         nodeName = target.nodeName.toLowerCase();
  8644.         $.removeData(target, "datepicker");
  8645.         if (nodeName === "input") {
  8646.             inst.append.remove();
  8647.             inst.trigger.remove();
  8648.             $target.removeClass(this.markerClassName).
  8649.                 unbind("focus", this._showDatepicker).
  8650.                 unbind("keydown", this._doKeyDown).
  8651.                 unbind("keypress", this._doKeyPress).
  8652.                 unbind("keyup", this._doKeyUp);
  8653.         } else if (nodeName === "div" || nodeName === "span") {
  8654.             $target.removeClass(this.markerClassName).empty();
  8655.         }
  8656.  
  8657.         if ( datepicker_instActive === inst ) {
  8658.             datepicker_instActive = null;
  8659.         }
  8660.     },
  8661.  
  8662.     /* Enable the date picker to a jQuery selection.
  8663.      * @param  target   element - the target input field or division or span
  8664.      */
  8665.     _enableDatepicker: function(target) {
  8666.         var nodeName, inline,
  8667.             $target = $(target),
  8668.             inst = $.data(target, "datepicker");
  8669.  
  8670.         if (!$target.hasClass(this.markerClassName)) {
  8671.             return;
  8672.         }
  8673.  
  8674.         nodeName = target.nodeName.toLowerCase();
  8675.         if (nodeName === "input") {
  8676.             target.disabled = false;
  8677.             inst.trigger.filter("button").
  8678.                 each(function() { this.disabled = false; }).end().
  8679.                 filter("img").css({opacity: "1.0", cursor: ""});
  8680.         } else if (nodeName === "div" || nodeName === "span") {
  8681.             inline = $target.children("." + this._inlineClass);
  8682.             inline.children().removeClass("ui-state-disabled");
  8683.             inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
  8684.                 prop("disabled", false);
  8685.         }
  8686.         this._disabledInputs = $.map(this._disabledInputs,
  8687.             function(value) { return (value === target ? null : value); }); // delete entry
  8688.     },
  8689.  
  8690.     /* Disable the date picker to a jQuery selection.
  8691.      * @param  target   element - the target input field or division or span
  8692.      */
  8693.     _disableDatepicker: function(target) {
  8694.         var nodeName, inline,
  8695.             $target = $(target),
  8696.             inst = $.data(target, "datepicker");
  8697.  
  8698.         if (!$target.hasClass(this.markerClassName)) {
  8699.             return;
  8700.         }
  8701.  
  8702.         nodeName = target.nodeName.toLowerCase();
  8703.         if (nodeName === "input") {
  8704.             target.disabled = true;
  8705.             inst.trigger.filter("button").
  8706.                 each(function() { this.disabled = true; }).end().
  8707.                 filter("img").css({opacity: "0.5", cursor: "default"});
  8708.         } else if (nodeName === "div" || nodeName === "span") {
  8709.             inline = $target.children("." + this._inlineClass);
  8710.             inline.children().addClass("ui-state-disabled");
  8711.             inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
  8712.                 prop("disabled", true);
  8713.         }
  8714.         this._disabledInputs = $.map(this._disabledInputs,
  8715.             function(value) { return (value === target ? null : value); }); // delete entry
  8716.         this._disabledInputs[this._disabledInputs.length] = target;
  8717.     },
  8718.  
  8719.     /* Is the first field in a jQuery collection disabled as a datepicker?
  8720.      * @param  target   element - the target input field or division or span
  8721.      * @return boolean - true if disabled, false if enabled
  8722.      */
  8723.     _isDisabledDatepicker: function(target) {
  8724.         if (!target) {
  8725.             return false;
  8726.         }
  8727.         for (var i = 0; i < this._disabledInputs.length; i++) {
  8728.             if (this._disabledInputs[i] === target) {
  8729.                 return true;
  8730.             }
  8731.         }
  8732.         return false;
  8733.     },
  8734.  
  8735.     /* Retrieve the instance data for the target control.
  8736.      * @param  target  element - the target input field or division or span
  8737.      * @return  object - the associated instance data
  8738.      * @throws  error if a jQuery problem getting data
  8739.      */
  8740.     _getInst: function(target) {
  8741.         try {
  8742.             return $.data(target, "datepicker");
  8743.         }
  8744.         catch (err) {
  8745.             throw "Missing instance data for this datepicker";
  8746.         }
  8747.     },
  8748.  
  8749.     /* Update or retrieve the settings for a date picker attached to an input field or division.
  8750.      * @param  target  element - the target input field or division or span
  8751.      * @param  name object - the new settings to update or
  8752.      *              string - the name of the setting to change or retrieve,
  8753.      *              when retrieving also "all" for all instance settings or
  8754.      *              "defaults" for all global defaults
  8755.      * @param  value   any - the new value for the setting
  8756.      *              (omit if above is an object or to retrieve a value)
  8757.      */
  8758.     _optionDatepicker: function(target, name, value) {
  8759.         var settings, date, minDate, maxDate,
  8760.             inst = this._getInst(target);
  8761.  
  8762.         if (arguments.length === 2 && typeof name === "string") {
  8763.             return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
  8764.                 (inst ? (name === "all" ? $.extend({}, inst.settings) :
  8765.                 this._get(inst, name)) : null));
  8766.         }
  8767.  
  8768.         settings = name || {};
  8769.         if (typeof name === "string") {
  8770.             settings = {};
  8771.             settings[name] = value;
  8772.         }
  8773.  
  8774.         if (inst) {
  8775.             if (this._curInst === inst) {
  8776.                 this._hideDatepicker();
  8777.             }
  8778.  
  8779.             date = this._getDateDatepicker(target, true);
  8780.             minDate = this._getMinMaxDate(inst, "min");
  8781.             maxDate = this._getMinMaxDate(inst, "max");
  8782.             datepicker_extendRemove(inst.settings, settings);
  8783.             // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  8784.             if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  8785.                 inst.settings.minDate = this._formatDate(inst, minDate);
  8786.             }
  8787.             if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  8788.                 inst.settings.maxDate = this._formatDate(inst, maxDate);
  8789.             }
  8790.             if ( "disabled" in settings ) {
  8791.                 if ( settings.disabled ) {
  8792.                     this._disableDatepicker(target);
  8793.                 } else {
  8794.                     this._enableDatepicker(target);
  8795.                 }
  8796.             }
  8797.             this._attachments($(target), inst);
  8798.             this._autoSize(inst);
  8799.             this._setDate(inst, date);
  8800.             this._updateAlternate(inst);
  8801.             this._updateDatepicker(inst);
  8802.         }
  8803.     },
  8804.  
  8805.     // change method deprecated
  8806.     _changeDatepicker: function(target, name, value) {
  8807.         this._optionDatepicker(target, name, value);
  8808.     },
  8809.  
  8810.     /* Redraw the date picker attached to an input field or division.
  8811.      * @param  target  element - the target input field or division or span
  8812.      */
  8813.     _refreshDatepicker: function(target) {
  8814.         var inst = this._getInst(target);
  8815.         if (inst) {
  8816.             this._updateDatepicker(inst);
  8817.         }
  8818.     },
  8819.  
  8820.     /* Set the dates for a jQuery selection.
  8821.      * @param  target element - the target input field or division or span
  8822.      * @param  date Date - the new date
  8823.      */
  8824.     _setDateDatepicker: function(target, date) {
  8825.         var inst = this._getInst(target);
  8826.         if (inst) {
  8827.             this._setDate(inst, date);
  8828.             this._updateDatepicker(inst);
  8829.             this._updateAlternate(inst);
  8830.         }
  8831.     },
  8832.  
  8833.     /* Get the date(s) for the first entry in a jQuery selection.
  8834.      * @param  target element - the target input field or division or span
  8835.      * @param  noDefault boolean - true if no default date is to be used
  8836.      * @return Date - the current date
  8837.      */
  8838.     _getDateDatepicker: function(target, noDefault) {
  8839.         var inst = this._getInst(target);
  8840.         if (inst && !inst.inline) {
  8841.             this._setDateFromField(inst, noDefault);
  8842.         }
  8843.         return (inst ? this._getDate(inst) : null);
  8844.     },
  8845.  
  8846.     /* Handle keystrokes. */
  8847.     _doKeyDown: function(event) {
  8848.         var onSelect, dateStr, sel,
  8849.             inst = $.datepicker._getInst(event.target),
  8850.             handled = true,
  8851.             isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
  8852.  
  8853.         inst._keyEvent = true;
  8854.         if ($.datepicker._datepickerShowing) {
  8855.             switch (event.keyCode) {
  8856.                 case 9: $.datepicker._hideDatepicker();
  8857.                         handled = false;
  8858.                         break; // hide on tab out
  8859.                 case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
  8860.                                     $.datepicker._currentClass + ")", inst.dpDiv);
  8861.                         if (sel[0]) {
  8862.                             $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  8863.                         }
  8864.  
  8865.                         onSelect = $.datepicker._get(inst, "onSelect");
  8866.                         if (onSelect) {
  8867.                             dateStr = $.datepicker._formatDate(inst);
  8868.  
  8869.                             // trigger custom callback
  8870.                             onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
  8871.                         } else {
  8872.                             $.datepicker._hideDatepicker();
  8873.                         }
  8874.  
  8875.                         return false; // don't submit the form
  8876.                 case 27: $.datepicker._hideDatepicker();
  8877.                         break; // hide on escape
  8878.                 case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8879.                             -$.datepicker._get(inst, "stepBigMonths") :
  8880.                             -$.datepicker._get(inst, "stepMonths")), "M");
  8881.                         break; // previous month/year on page up/+ ctrl
  8882.                 case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8883.                             +$.datepicker._get(inst, "stepBigMonths") :
  8884.                             +$.datepicker._get(inst, "stepMonths")), "M");
  8885.                         break; // next month/year on page down/+ ctrl
  8886.                 case 35: if (event.ctrlKey || event.metaKey) {
  8887.                             $.datepicker._clearDate(event.target);
  8888.                         }
  8889.                         handled = event.ctrlKey || event.metaKey;
  8890.                         break; // clear on ctrl or command +end
  8891.                 case 36: if (event.ctrlKey || event.metaKey) {
  8892.                             $.datepicker._gotoToday(event.target);
  8893.                         }
  8894.                         handled = event.ctrlKey || event.metaKey;
  8895.                         break; // current on ctrl or command +home
  8896.                 case 37: if (event.ctrlKey || event.metaKey) {
  8897.                             $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
  8898.                         }
  8899.                         handled = event.ctrlKey || event.metaKey;
  8900.                         // -1 day on ctrl or command +left
  8901.                         if (event.originalEvent.altKey) {
  8902.                             $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8903.                                 -$.datepicker._get(inst, "stepBigMonths") :
  8904.                                 -$.datepicker._get(inst, "stepMonths")), "M");
  8905.                         }
  8906.                         // next month/year on alt +left on Mac
  8907.                         break;
  8908.                 case 38: if (event.ctrlKey || event.metaKey) {
  8909.                             $.datepicker._adjustDate(event.target, -7, "D");
  8910.                         }
  8911.                         handled = event.ctrlKey || event.metaKey;
  8912.                         break; // -1 week on ctrl or command +up
  8913.                 case 39: if (event.ctrlKey || event.metaKey) {
  8914.                             $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
  8915.                         }
  8916.                         handled = event.ctrlKey || event.metaKey;
  8917.                         // +1 day on ctrl or command +right
  8918.                         if (event.originalEvent.altKey) {
  8919.                             $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  8920.                                 +$.datepicker._get(inst, "stepBigMonths") :
  8921.                                 +$.datepicker._get(inst, "stepMonths")), "M");
  8922.                         }
  8923.                         // next month/year on alt +right
  8924.                         break;
  8925.                 case 40: if (event.ctrlKey || event.metaKey) {
  8926.                             $.datepicker._adjustDate(event.target, +7, "D");
  8927.                         }
  8928.                         handled = event.ctrlKey || event.metaKey;
  8929.                         break; // +1 week on ctrl or command +down
  8930.                 default: handled = false;
  8931.             }
  8932.         } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
  8933.             $.datepicker._showDatepicker(this);
  8934.         } else {
  8935.             handled = false;
  8936.         }
  8937.  
  8938.         if (handled) {
  8939.             event.preventDefault();
  8940.             event.stopPropagation();
  8941.         }
  8942.     },
  8943.  
  8944.     /* Filter entered characters - based on date format. */
  8945.     _doKeyPress: function(event) {
  8946.         var chars, chr,
  8947.             inst = $.datepicker._getInst(event.target);
  8948.  
  8949.         if ($.datepicker._get(inst, "constrainInput")) {
  8950.             chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
  8951.             chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
  8952.             return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
  8953.         }
  8954.     },
  8955.  
  8956.     /* Synchronise manual entry and field/alternate field. */
  8957.     _doKeyUp: function(event) {
  8958.         var date,
  8959.             inst = $.datepicker._getInst(event.target);
  8960.  
  8961.         if (inst.input.val() !== inst.lastVal) {
  8962.             try {
  8963.                 date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  8964.                     (inst.input ? inst.input.val() : null),
  8965.                     $.datepicker._getFormatConfig(inst));
  8966.  
  8967.                 if (date) { // only if valid
  8968.                     $.datepicker._setDateFromField(inst);
  8969.                     $.datepicker._updateAlternate(inst);
  8970.                     $.datepicker._updateDatepicker(inst);
  8971.                 }
  8972.             }
  8973.             catch (err) {
  8974.             }
  8975.         }
  8976.         return true;
  8977.     },
  8978.  
  8979.     /* Pop-up the date picker for a given input field.
  8980.      * If false returned from beforeShow event handler do not show.
  8981.      * @param  input  element - the input field attached to the date picker or
  8982.      *                  event - if triggered by focus
  8983.      */
  8984.     _showDatepicker: function(input) {
  8985.         input = input.target || input;
  8986.         if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
  8987.             input = $("input", input.parentNode)[0];
  8988.         }
  8989.  
  8990.         if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
  8991.             return;
  8992.         }
  8993.  
  8994.         var inst, beforeShow, beforeShowSettings, isFixed,
  8995.             offset, showAnim, duration;
  8996.  
  8997.         inst = $.datepicker._getInst(input);
  8998.         if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
  8999.             $.datepicker._curInst.dpDiv.stop(true, true);
  9000.             if ( inst && $.datepicker._datepickerShowing ) {
  9001.                 $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
  9002.             }
  9003.         }
  9004.  
  9005.         beforeShow = $.datepicker._get(inst, "beforeShow");
  9006.         beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  9007.         if(beforeShowSettings === false){
  9008.             return;
  9009.         }
  9010.         datepicker_extendRemove(inst.settings, beforeShowSettings);
  9011.  
  9012.         inst.lastVal = null;
  9013.         $.datepicker._lastInput = input;
  9014.         $.datepicker._setDateFromField(inst);
  9015.  
  9016.         if ($.datepicker._inDialog) { // hide cursor
  9017.             input.value = "";
  9018.         }
  9019.         if (!$.datepicker._pos) { // position below input
  9020.             $.datepicker._pos = $.datepicker._findPos(input);
  9021.             $.datepicker._pos[1] += input.offsetHeight; // add the height
  9022.         }
  9023.  
  9024.         isFixed = false;
  9025.         $(input).parents().each(function() {
  9026.             isFixed |= $(this).css("position") === "fixed";
  9027.             return !isFixed;
  9028.         });
  9029.  
  9030.         offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  9031.         $.datepicker._pos = null;
  9032.         //to avoid flashes on Firefox
  9033.         inst.dpDiv.empty();
  9034.         // determine sizing offscreen
  9035.         inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
  9036.         $.datepicker._updateDatepicker(inst);
  9037.         // fix width for dynamic number of date pickers
  9038.         // and adjust position before showing
  9039.         offset = $.datepicker._checkOffset(inst, offset, isFixed);
  9040.         inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  9041.             "static" : (isFixed ? "fixed" : "absolute")), display: "none",
  9042.             left: offset.left + "px", top: offset.top + "px"});
  9043.  
  9044.         if (!inst.inline) {
  9045.             showAnim = $.datepicker._get(inst, "showAnim");
  9046.             duration = $.datepicker._get(inst, "duration");
  9047.             inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  9048.             $.datepicker._datepickerShowing = true;
  9049.  
  9050.             if ( $.effects && $.effects.effect[ showAnim ] ) {
  9051.                 inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  9052.             } else {
  9053.                 inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
  9054.             }
  9055.  
  9056.             if ( $.datepicker._shouldFocusInput( inst ) ) {
  9057.                 inst.input.focus();
  9058.             }
  9059.  
  9060.             $.datepicker._curInst = inst;
  9061.         }
  9062.     },
  9063.  
  9064.     /* Generate the date picker content. */
  9065.     _updateDatepicker: function(inst) {
  9066.         this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  9067.         datepicker_instActive = inst; // for delegate hover events
  9068.         inst.dpDiv.empty().append(this._generateHTML(inst));
  9069.         this._attachHandlers(inst);
  9070.  
  9071.         var origyearshtml,
  9072.             numMonths = this._getNumberOfMonths(inst),
  9073.             cols = numMonths[1],
  9074.             width = 17,
  9075.             activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
  9076.  
  9077.         if ( activeCell.length > 0 ) {
  9078.             datepicker_handleMouseover.apply( activeCell.get( 0 ) );
  9079.         }
  9080.  
  9081.         inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  9082.         if (cols > 1) {
  9083.             inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  9084.         }
  9085.         inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
  9086.             "Class"]("ui-datepicker-multi");
  9087.         inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
  9088.             "Class"]("ui-datepicker-rtl");
  9089.  
  9090.         if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
  9091.             inst.input.focus();
  9092.         }
  9093.  
  9094.         // deffered render of the years select (to avoid flashes on Firefox)
  9095.         if( inst.yearshtml ){
  9096.             origyearshtml = inst.yearshtml;
  9097.             setTimeout(function(){
  9098.                 //assure that inst.yearshtml didn't change.
  9099.                 if( origyearshtml === inst.yearshtml && inst.yearshtml ){
  9100.                     inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
  9101.                 }
  9102.                 origyearshtml = inst.yearshtml = null;
  9103.             }, 0);
  9104.         }
  9105.     },
  9106.  
  9107.     // #6694 - don't focus the input if it's already focused
  9108.     // this breaks the change event in IE
  9109.     // Support: IE and jQuery <1.9
  9110.     _shouldFocusInput: function( inst ) {
  9111.         return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
  9112.     },
  9113.  
  9114.     /* Check positioning to remain on screen. */
  9115.     _checkOffset: function(inst, offset, isFixed) {
  9116.         var dpWidth = inst.dpDiv.outerWidth(),
  9117.             dpHeight = inst.dpDiv.outerHeight(),
  9118.             inputWidth = inst.input ? inst.input.outerWidth() : 0,
  9119.             inputHeight = inst.input ? inst.input.outerHeight() : 0,
  9120.             viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
  9121.             viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
  9122.  
  9123.         offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
  9124.         offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
  9125.         offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  9126.  
  9127.         // now check if datepicker is showing outside window viewport - move to a better place if so.
  9128.         offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  9129.             Math.abs(offset.left + dpWidth - viewWidth) : 0);
  9130.         offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  9131.             Math.abs(dpHeight + inputHeight) : 0);
  9132.  
  9133.         return offset;
  9134.     },
  9135.  
  9136.     /* Find an object's position on the screen. */
  9137.     _findPos: function(obj) {
  9138.         var position,
  9139.             inst = this._getInst(obj),
  9140.             isRTL = this._get(inst, "isRTL");
  9141.  
  9142.         while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
  9143.             obj = obj[isRTL ? "previousSibling" : "nextSibling"];
  9144.         }
  9145.  
  9146.         position = $(obj).offset();
  9147.         return [position.left, position.top];
  9148.     },
  9149.  
  9150.     /* Hide the date picker from view.
  9151.      * @param  input  element - the input field attached to the date picker
  9152.      */
  9153.     _hideDatepicker: function(input) {
  9154.         var showAnim, duration, postProcess, onClose,
  9155.             inst = this._curInst;
  9156.  
  9157.         if (!inst || (input && inst !== $.data(input, "datepicker"))) {
  9158.             return;
  9159.         }
  9160.  
  9161.         if (this._datepickerShowing) {
  9162.             showAnim = this._get(inst, "showAnim");
  9163.             duration = this._get(inst, "duration");
  9164.             postProcess = function() {
  9165.                 $.datepicker._tidyDialog(inst);
  9166.             };
  9167.  
  9168.             // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  9169.             if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
  9170.                 inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
  9171.             } else {
  9172.                 inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
  9173.                     (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
  9174.             }
  9175.  
  9176.             if (!showAnim) {
  9177.                 postProcess();
  9178.             }
  9179.             this._datepickerShowing = false;
  9180.  
  9181.             onClose = this._get(inst, "onClose");
  9182.             if (onClose) {
  9183.                 onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
  9184.             }
  9185.  
  9186.             this._lastInput = null;
  9187.             if (this._inDialog) {
  9188.                 this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
  9189.                 if ($.blockUI) {
  9190.                     $.unblockUI();
  9191.                     $("body").append(this.dpDiv);
  9192.                 }
  9193.             }
  9194.             this._inDialog = false;
  9195.         }
  9196.     },
  9197.  
  9198.     /* Tidy up after a dialog display. */
  9199.     _tidyDialog: function(inst) {
  9200.         inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
  9201.     },
  9202.  
  9203.     /* Close date picker if clicked elsewhere. */
  9204.     _checkExternalClick: function(event) {
  9205.         if (!$.datepicker._curInst) {
  9206.             return;
  9207.         }
  9208.  
  9209.         var $target = $(event.target),
  9210.             inst = $.datepicker._getInst($target[0]);
  9211.  
  9212.         if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
  9213.                 $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
  9214.                 !$target.hasClass($.datepicker.markerClassName) &&
  9215.                 !$target.closest("." + $.datepicker._triggerClass).length &&
  9216.                 $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
  9217.             ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
  9218.                 $.datepicker._hideDatepicker();
  9219.         }
  9220.     },
  9221.  
  9222.     /* Adjust one of the date sub-fields. */
  9223.     _adjustDate: function(id, offset, period) {
  9224.         var target = $(id),
  9225.             inst = this._getInst(target[0]);
  9226.  
  9227.         if (this._isDisabledDatepicker(target[0])) {
  9228.             return;
  9229.         }
  9230.         this._adjustInstDate(inst, offset +
  9231.             (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
  9232.             period);
  9233.         this._updateDatepicker(inst);
  9234.     },
  9235.  
  9236.     /* Action for current link. */
  9237.     _gotoToday: function(id) {
  9238.         var date,
  9239.             target = $(id),
  9240.             inst = this._getInst(target[0]);
  9241.  
  9242.         if (this._get(inst, "gotoCurrent") && inst.currentDay) {
  9243.             inst.selectedDay = inst.currentDay;
  9244.             inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  9245.             inst.drawYear = inst.selectedYear = inst.currentYear;
  9246.         } else {
  9247.             date = new Date();
  9248.             inst.selectedDay = date.getDate();
  9249.             inst.drawMonth = inst.selectedMonth = date.getMonth();
  9250.             inst.drawYear = inst.selectedYear = date.getFullYear();
  9251.         }
  9252.         this._notifyChange(inst);
  9253.         this._adjustDate(target);
  9254.     },
  9255.  
  9256.     /* Action for selecting a new month/year. */
  9257.     _selectMonthYear: function(id, select, period) {
  9258.         var target = $(id),
  9259.             inst = this._getInst(target[0]);
  9260.  
  9261.         inst["selected" + (period === "M" ? "Month" : "Year")] =
  9262.         inst["draw" + (period === "M" ? "Month" : "Year")] =
  9263.             parseInt(select.options[select.selectedIndex].value,10);
  9264.  
  9265.         this._notifyChange(inst);
  9266.         this._adjustDate(target);
  9267.     },
  9268.  
  9269.     /* Action for selecting a day. */
  9270.     _selectDay: function(id, month, year, td) {
  9271.         var inst,
  9272.             target = $(id);
  9273.  
  9274.         if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  9275.             return;
  9276.         }
  9277.  
  9278.         inst = this._getInst(target[0]);
  9279.         inst.selectedDay = inst.currentDay = $("a", td).html();
  9280.         inst.selectedMonth = inst.currentMonth = month;
  9281.         inst.selectedYear = inst.currentYear = year;
  9282.         this._selectDate(id, this._formatDate(inst,
  9283.             inst.currentDay, inst.currentMonth, inst.currentYear));
  9284.     },
  9285.  
  9286.     /* Erase the input field and hide the date picker. */
  9287.     _clearDate: function(id) {
  9288.         var target = $(id);
  9289.         this._selectDate(target, "");
  9290.     },
  9291.  
  9292.     /* Update the input field with the selected date. */
  9293.     _selectDate: function(id, dateStr) {
  9294.         var onSelect,
  9295.             target = $(id),
  9296.             inst = this._getInst(target[0]);
  9297.  
  9298.         dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  9299.         if (inst.input) {
  9300.             inst.input.val(dateStr);
  9301.         }
  9302.         this._updateAlternate(inst);
  9303.  
  9304.         onSelect = this._get(inst, "onSelect");
  9305.         if (onSelect) {
  9306.             onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
  9307.         } else if (inst.input) {
  9308.             inst.input.trigger("change"); // fire the change event
  9309.         }
  9310.  
  9311.         if (inst.inline){
  9312.             this._updateDatepicker(inst);
  9313.         } else {
  9314.             this._hideDatepicker();
  9315.             this._lastInput = inst.input[0];
  9316.             if (typeof(inst.input[0]) !== "object") {
  9317.                 inst.input.focus(); // restore focus
  9318.             }
  9319.             this._lastInput = null;
  9320.         }
  9321.     },
  9322.  
  9323.     /* Update any alternate field to synchronise with the main field. */
  9324.     _updateAlternate: function(inst) {
  9325.         var altFormat, date, dateStr,
  9326.             altField = this._get(inst, "altField");
  9327.  
  9328.         if (altField) { // update alternate field too
  9329.             altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
  9330.             date = this._getDate(inst);
  9331.             dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  9332.             $(altField).each(function() { $(this).val(dateStr); });
  9333.         }
  9334.     },
  9335.  
  9336.     /* Set as beforeShowDay function to prevent selection of weekends.
  9337.      * @param  date  Date - the date to customise
  9338.      * @return [boolean, string] - is this date selectable?, what is its CSS class?
  9339.      */
  9340.     noWeekends: function(date) {
  9341.         var day = date.getDay();
  9342.         return [(day > 0 && day < 6), ""];
  9343.     },
  9344.  
  9345.     /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  9346.      * @param  date  Date - the date to get the week for
  9347.      * @return  number - the number of the week within the year that contains this date
  9348.      */
  9349.     iso8601Week: function(date) {
  9350.         var time,
  9351.             checkDate = new Date(date.getTime());
  9352.  
  9353.         // Find Thursday of this week starting on Monday
  9354.         checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  9355.  
  9356.         time = checkDate.getTime();
  9357.         checkDate.setMonth(0); // Compare with Jan 1
  9358.         checkDate.setDate(1);
  9359.         return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  9360.     },
  9361.  
  9362.     /* Parse a string value into a date object.
  9363.      * See formatDate below for the possible formats.
  9364.      *
  9365.      * @param  format string - the expected format of the date
  9366.      * @param  value string - the date in the above format
  9367.      * @param  settings Object - attributes include:
  9368.      *                  shortYearCutoff  number - the cutoff year for determining the century (optional)
  9369.      *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
  9370.      *                  dayNames        string[7] - names of the days from Sunday (optional)
  9371.      *                  monthNamesShort string[12] - abbreviated names of the months (optional)
  9372.      *                  monthNames      string[12] - names of the months (optional)
  9373.      * @return  Date - the extracted date value or null if value is blank
  9374.      */
  9375.     parseDate: function (format, value, settings) {
  9376.         if (format == null || value == null) {
  9377.             throw "Invalid arguments";
  9378.         }
  9379.  
  9380.         value = (typeof value === "object" ? value.toString() : value + "");
  9381.         if (value === "") {
  9382.             return null;
  9383.         }
  9384.  
  9385.         var iFormat, dim, extra,
  9386.             iValue = 0,
  9387.             shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
  9388.             shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  9389.                 new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
  9390.             dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  9391.             dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  9392.             monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  9393.             monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  9394.             year = -1,
  9395.             month = -1,
  9396.             day = -1,
  9397.             doy = -1,
  9398.             literal = false,
  9399.             date,
  9400.             // Check whether a format character is doubled
  9401.             lookAhead = function(match) {
  9402.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9403.                 if (matches) {
  9404.                     iFormat++;
  9405.                 }
  9406.                 return matches;
  9407.             },
  9408.             // Extract a number from the string value
  9409.             getNumber = function(match) {
  9410.                 var isDoubled = lookAhead(match),
  9411.                     size = (match === "@" ? 14 : (match === "!" ? 20 :
  9412.                     (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
  9413.                     minSize = (match === "y" ? size : 1),
  9414.                     digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
  9415.                     num = value.substring(iValue).match(digits);
  9416.                 if (!num) {
  9417.                     throw "Missing number at position " + iValue;
  9418.                 }
  9419.                 iValue += num[0].length;
  9420.                 return parseInt(num[0], 10);
  9421.             },
  9422.             // Extract a name from the string value and convert to an index
  9423.             getName = function(match, shortNames, longNames) {
  9424.                 var index = -1,
  9425.                     names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
  9426.                         return [ [k, v] ];
  9427.                     }).sort(function (a, b) {
  9428.                         return -(a[1].length - b[1].length);
  9429.                     });
  9430.  
  9431.                 $.each(names, function (i, pair) {
  9432.                     var name = pair[1];
  9433.                     if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
  9434.                         index = pair[0];
  9435.                         iValue += name.length;
  9436.                         return false;
  9437.                     }
  9438.                 });
  9439.                 if (index !== -1) {
  9440.                     return index + 1;
  9441.                 } else {
  9442.                     throw "Unknown name at position " + iValue;
  9443.                 }
  9444.             },
  9445.             // Confirm that a literal character matches the string value
  9446.             checkLiteral = function() {
  9447.                 if (value.charAt(iValue) !== format.charAt(iFormat)) {
  9448.                     throw "Unexpected literal at position " + iValue;
  9449.                 }
  9450.                 iValue++;
  9451.             };
  9452.  
  9453.         for (iFormat = 0; iFormat < format.length; iFormat++) {
  9454.             if (literal) {
  9455.                 if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9456.                     literal = false;
  9457.                 } else {
  9458.                     checkLiteral();
  9459.                 }
  9460.             } else {
  9461.                 switch (format.charAt(iFormat)) {
  9462.                     case "d":
  9463.                         day = getNumber("d");
  9464.                         break;
  9465.                     case "D":
  9466.                         getName("D", dayNamesShort, dayNames);
  9467.                         break;
  9468.                     case "o":
  9469.                         doy = getNumber("o");
  9470.                         break;
  9471.                     case "m":
  9472.                         month = getNumber("m");
  9473.                         break;
  9474.                     case "M":
  9475.                         month = getName("M", monthNamesShort, monthNames);
  9476.                         break;
  9477.                     case "y":
  9478.                         year = getNumber("y");
  9479.                         break;
  9480.                     case "@":
  9481.                         date = new Date(getNumber("@"));
  9482.                         year = date.getFullYear();
  9483.                         month = date.getMonth() + 1;
  9484.                         day = date.getDate();
  9485.                         break;
  9486.                     case "!":
  9487.                         date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
  9488.                         year = date.getFullYear();
  9489.                         month = date.getMonth() + 1;
  9490.                         day = date.getDate();
  9491.                         break;
  9492.                     case "'":
  9493.                         if (lookAhead("'")){
  9494.                             checkLiteral();
  9495.                         } else {
  9496.                             literal = true;
  9497.                         }
  9498.                         break;
  9499.                     default:
  9500.                         checkLiteral();
  9501.                 }
  9502.             }
  9503.         }
  9504.  
  9505.         if (iValue < value.length){
  9506.             extra = value.substr(iValue);
  9507.             if (!/^\s+/.test(extra)) {
  9508.                 throw "Extra/unparsed characters found in date: " + extra;
  9509.             }
  9510.         }
  9511.  
  9512.         if (year === -1) {
  9513.             year = new Date().getFullYear();
  9514.         } else if (year < 100) {
  9515.             year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  9516.                 (year <= shortYearCutoff ? 0 : -100);
  9517.         }
  9518.  
  9519.         if (doy > -1) {
  9520.             month = 1;
  9521.             day = doy;
  9522.             do {
  9523.                 dim = this._getDaysInMonth(year, month - 1);
  9524.                 if (day <= dim) {
  9525.                     break;
  9526.                 }
  9527.                 month++;
  9528.                 day -= dim;
  9529.             } while (true);
  9530.         }
  9531.  
  9532.         date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  9533.         if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
  9534.             throw "Invalid date"; // E.g. 31/02/00
  9535.         }
  9536.         return date;
  9537.     },
  9538.  
  9539.     /* Standard date formats. */
  9540.     ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  9541.     COOKIE: "D, dd M yy",
  9542.     ISO_8601: "yy-mm-dd",
  9543.     RFC_822: "D, d M y",
  9544.     RFC_850: "DD, dd-M-y",
  9545.     RFC_1036: "D, d M y",
  9546.     RFC_1123: "D, d M yy",
  9547.     RFC_2822: "D, d M yy",
  9548.     RSS: "D, d M y", // RFC 822
  9549.     TICKS: "!",
  9550.     TIMESTAMP: "@",
  9551.     W3C: "yy-mm-dd", // ISO 8601
  9552.  
  9553.     _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  9554.         Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  9555.  
  9556.     /* Format a date object into a string value.
  9557.      * The format can be combinations of the following:
  9558.      * d  - day of month (no leading zero)
  9559.      * dd - day of month (two digit)
  9560.      * o  - day of year (no leading zeros)
  9561.      * oo - day of year (three digit)
  9562.      * D  - day name short
  9563.      * DD - day name long
  9564.      * m  - month of year (no leading zero)
  9565.      * mm - month of year (two digit)
  9566.      * M  - month name short
  9567.      * MM - month name long
  9568.      * y  - year (two digit)
  9569.      * yy - year (four digit)
  9570.      * @ - Unix timestamp (ms since 01/01/1970)
  9571.      * ! - Windows ticks (100ns since 01/01/0001)
  9572.      * "..." - literal text
  9573.      * '' - single quote
  9574.      *
  9575.      * @param  format string - the desired format of the date
  9576.      * @param  date Date - the date value to format
  9577.      * @param  settings Object - attributes include:
  9578.      *                  dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
  9579.      *                  dayNames        string[7] - names of the days from Sunday (optional)
  9580.      *                  monthNamesShort string[12] - abbreviated names of the months (optional)
  9581.      *                  monthNames      string[12] - names of the months (optional)
  9582.      * @return  string - the date in the above format
  9583.      */
  9584.     formatDate: function (format, date, settings) {
  9585.         if (!date) {
  9586.             return "";
  9587.         }
  9588.  
  9589.         var iFormat,
  9590.             dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  9591.             dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  9592.             monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  9593.             monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  9594.             // Check whether a format character is doubled
  9595.             lookAhead = function(match) {
  9596.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9597.                 if (matches) {
  9598.                     iFormat++;
  9599.                 }
  9600.                 return matches;
  9601.             },
  9602.             // Format a number, with leading zero if necessary
  9603.             formatNumber = function(match, value, len) {
  9604.                 var num = "" + value;
  9605.                 if (lookAhead(match)) {
  9606.                     while (num.length < len) {
  9607.                         num = "0" + num;
  9608.                     }
  9609.                 }
  9610.                 return num;
  9611.             },
  9612.             // Format a name, short or long as requested
  9613.             formatName = function(match, value, shortNames, longNames) {
  9614.                 return (lookAhead(match) ? longNames[value] : shortNames[value]);
  9615.             },
  9616.             output = "",
  9617.             literal = false;
  9618.  
  9619.         if (date) {
  9620.             for (iFormat = 0; iFormat < format.length; iFormat++) {
  9621.                 if (literal) {
  9622.                     if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9623.                         literal = false;
  9624.                     } else {
  9625.                         output += format.charAt(iFormat);
  9626.                     }
  9627.                 } else {
  9628.                     switch (format.charAt(iFormat)) {
  9629.                         case "d":
  9630.                             output += formatNumber("d", date.getDate(), 2);
  9631.                             break;
  9632.                         case "D":
  9633.                             output += formatName("D", date.getDay(), dayNamesShort, dayNames);
  9634.                             break;
  9635.                         case "o":
  9636.                             output += formatNumber("o",
  9637.                                 Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
  9638.                             break;
  9639.                         case "m":
  9640.                             output += formatNumber("m", date.getMonth() + 1, 2);
  9641.                             break;
  9642.                         case "M":
  9643.                             output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
  9644.                             break;
  9645.                         case "y":
  9646.                             output += (lookAhead("y") ? date.getFullYear() :
  9647.                                 (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
  9648.                             break;
  9649.                         case "@":
  9650.                             output += date.getTime();
  9651.                             break;
  9652.                         case "!":
  9653.                             output += date.getTime() * 10000 + this._ticksTo1970;
  9654.                             break;
  9655.                         case "'":
  9656.                             if (lookAhead("'")) {
  9657.                                 output += "'";
  9658.                             } else {
  9659.                                 literal = true;
  9660.                             }
  9661.                             break;
  9662.                         default:
  9663.                             output += format.charAt(iFormat);
  9664.                     }
  9665.                 }
  9666.             }
  9667.         }
  9668.         return output;
  9669.     },
  9670.  
  9671.     /* Extract all possible characters from the date format. */
  9672.     _possibleChars: function (format) {
  9673.         var iFormat,
  9674.             chars = "",
  9675.             literal = false,
  9676.             // Check whether a format character is doubled
  9677.             lookAhead = function(match) {
  9678.                 var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  9679.                 if (matches) {
  9680.                     iFormat++;
  9681.                 }
  9682.                 return matches;
  9683.             };
  9684.  
  9685.         for (iFormat = 0; iFormat < format.length; iFormat++) {
  9686.             if (literal) {
  9687.                 if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  9688.                     literal = false;
  9689.                 } else {
  9690.                     chars += format.charAt(iFormat);
  9691.                 }
  9692.             } else {
  9693.                 switch (format.charAt(iFormat)) {
  9694.                     case "d": case "m": case "y": case "@":
  9695.                         chars += "0123456789";
  9696.                         break;
  9697.                     case "D": case "M":
  9698.                         return null; // Accept anything
  9699.                     case "'":
  9700.                         if (lookAhead("'")) {
  9701.                             chars += "'";
  9702.                         } else {
  9703.                             literal = true;
  9704.                         }
  9705.                         break;
  9706.                     default:
  9707.                         chars += format.charAt(iFormat);
  9708.                 }
  9709.             }
  9710.         }
  9711.         return chars;
  9712.     },
  9713.  
  9714.     /* Get a setting value, defaulting if necessary. */
  9715.     _get: function(inst, name) {
  9716.         return inst.settings[name] !== undefined ?
  9717.             inst.settings[name] : this._defaults[name];
  9718.     },
  9719.  
  9720.     /* Parse existing date and initialise date picker. */
  9721.     _setDateFromField: function(inst, noDefault) {
  9722.         if (inst.input.val() === inst.lastVal) {
  9723.             return;
  9724.         }
  9725.  
  9726.         var dateFormat = this._get(inst, "dateFormat"),
  9727.             dates = inst.lastVal = inst.input ? inst.input.val() : null,
  9728.             defaultDate = this._getDefaultDate(inst),
  9729.             date = defaultDate,
  9730.             settings = this._getFormatConfig(inst);
  9731.  
  9732.         try {
  9733.             date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  9734.         } catch (event) {
  9735.             dates = (noDefault ? "" : dates);
  9736.         }
  9737.         inst.selectedDay = date.getDate();
  9738.         inst.drawMonth = inst.selectedMonth = date.getMonth();
  9739.         inst.drawYear = inst.selectedYear = date.getFullYear();
  9740.         inst.currentDay = (dates ? date.getDate() : 0);
  9741.         inst.currentMonth = (dates ? date.getMonth() : 0);
  9742.         inst.currentYear = (dates ? date.getFullYear() : 0);
  9743.         this._adjustInstDate(inst);
  9744.     },
  9745.  
  9746.     /* Retrieve the default date shown on opening. */
  9747.     _getDefaultDate: function(inst) {
  9748.         return this._restrictMinMax(inst,
  9749.             this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
  9750.     },
  9751.  
  9752.     /* A date may be specified as an exact value or a relative one. */
  9753.     _determineDate: function(inst, date, defaultDate) {
  9754.         var offsetNumeric = function(offset) {
  9755.                 var date = new Date();
  9756.                 date.setDate(date.getDate() + offset);
  9757.                 return date;
  9758.             },
  9759.             offsetString = function(offset) {
  9760.                 try {
  9761.                     return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  9762.                         offset, $.datepicker._getFormatConfig(inst));
  9763.                 }
  9764.                 catch (e) {
  9765.                     // Ignore
  9766.                 }
  9767.  
  9768.                 var date = (offset.toLowerCase().match(/^c/) ?
  9769.                     $.datepicker._getDate(inst) : null) || new Date(),
  9770.                     year = date.getFullYear(),
  9771.                     month = date.getMonth(),
  9772.                     day = date.getDate(),
  9773.                     pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  9774.                     matches = pattern.exec(offset);
  9775.  
  9776.                 while (matches) {
  9777.                     switch (matches[2] || "d") {
  9778.                         case "d" : case "D" :
  9779.                             day += parseInt(matches[1],10); break;
  9780.                         case "w" : case "W" :
  9781.                             day += parseInt(matches[1],10) * 7; break;
  9782.                         case "m" : case "M" :
  9783.                             month += parseInt(matches[1],10);
  9784.                             day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  9785.                             break;
  9786.                         case "y": case "Y" :
  9787.                             year += parseInt(matches[1],10);
  9788.                             day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  9789.                             break;
  9790.                     }
  9791.                     matches = pattern.exec(offset);
  9792.                 }
  9793.                 return new Date(year, month, day);
  9794.             },
  9795.             newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
  9796.                 (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  9797.  
  9798.         newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
  9799.         if (newDate) {
  9800.             newDate.setHours(0);
  9801.             newDate.setMinutes(0);
  9802.             newDate.setSeconds(0);
  9803.             newDate.setMilliseconds(0);
  9804.         }
  9805.         return this._daylightSavingAdjust(newDate);
  9806.     },
  9807.  
  9808.     /* Handle switch to/from daylight saving.
  9809.      * Hours may be non-zero on daylight saving cut-over:
  9810.      * > 12 when midnight changeover, but then cannot generate
  9811.      * midnight datetime, so jump to 1AM, otherwise reset.
  9812.      * @param  date  (Date) the date to check
  9813.      * @return  (Date) the corrected date
  9814.      */
  9815.     _daylightSavingAdjust: function(date) {
  9816.         if (!date) {
  9817.             return null;
  9818.         }
  9819.         date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  9820.         return date;
  9821.     },
  9822.  
  9823.     /* Set the date(s) directly. */
  9824.     _setDate: function(inst, date, noChange) {
  9825.         var clear = !date,
  9826.             origMonth = inst.selectedMonth,
  9827.             origYear = inst.selectedYear,
  9828.             newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  9829.  
  9830.         inst.selectedDay = inst.currentDay = newDate.getDate();
  9831.         inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  9832.         inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  9833.         if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
  9834.             this._notifyChange(inst);
  9835.         }
  9836.         this._adjustInstDate(inst);
  9837.         if (inst.input) {
  9838.             inst.input.val(clear ? "" : this._formatDate(inst));
  9839.         }
  9840.     },
  9841.  
  9842.     /* Retrieve the date(s) directly. */
  9843.     _getDate: function(inst) {
  9844.         var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
  9845.             this._daylightSavingAdjust(new Date(
  9846.             inst.currentYear, inst.currentMonth, inst.currentDay)));
  9847.             return startDate;
  9848.     },
  9849.  
  9850.     /* Attach the onxxx handlers.  These are declared statically so
  9851.      * they work with static code transformers like Caja.
  9852.      */
  9853.     _attachHandlers: function(inst) {
  9854.         var stepMonths = this._get(inst, "stepMonths"),
  9855.             id = "#" + inst.id.replace( /\\\\/g, "\\" );
  9856.         inst.dpDiv.find("[data-handler]").map(function () {
  9857.             var handler = {
  9858.                 prev: function () {
  9859.                     $.datepicker._adjustDate(id, -stepMonths, "M");
  9860.                 },
  9861.                 next: function () {
  9862.                     $.datepicker._adjustDate(id, +stepMonths, "M");
  9863.                 },
  9864.                 hide: function () {
  9865.                     $.datepicker._hideDatepicker();
  9866.                 },
  9867.                 today: function () {
  9868.                     $.datepicker._gotoToday(id);
  9869.                 },
  9870.                 selectDay: function () {
  9871.                     $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
  9872.                     return false;
  9873.                 },
  9874.                 selectMonth: function () {
  9875.                     $.datepicker._selectMonthYear(id, this, "M");
  9876.                     return false;
  9877.                 },
  9878.                 selectYear: function () {
  9879.                     $.datepicker._selectMonthYear(id, this, "Y");
  9880.                     return false;
  9881.                 }
  9882.             };
  9883.             $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
  9884.         });
  9885.     },
  9886.  
  9887.     /* Generate the HTML for the current state of the date picker. */
  9888.     _generateHTML: function(inst) {
  9889.         var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  9890.             controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  9891.             monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  9892.             selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  9893.             cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  9894.             printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  9895.             tempDate = new Date(),
  9896.             today = this._daylightSavingAdjust(
  9897.                 new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
  9898.             isRTL = this._get(inst, "isRTL"),
  9899.             showButtonPanel = this._get(inst, "showButtonPanel"),
  9900.             hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
  9901.             navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
  9902.             numMonths = this._getNumberOfMonths(inst),
  9903.             showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
  9904.             stepMonths = this._get(inst, "stepMonths"),
  9905.             isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
  9906.             currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  9907.                 new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
  9908.             minDate = this._getMinMaxDate(inst, "min"),
  9909.             maxDate = this._getMinMaxDate(inst, "max"),
  9910.             drawMonth = inst.drawMonth - showCurrentAtPos,
  9911.             drawYear = inst.drawYear;
  9912.  
  9913.         if (drawMonth < 0) {
  9914.             drawMonth += 12;
  9915.             drawYear--;
  9916.         }
  9917.         if (maxDate) {
  9918.             maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  9919.                 maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  9920.             maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  9921.             while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  9922.                 drawMonth--;
  9923.                 if (drawMonth < 0) {
  9924.                     drawMonth = 11;
  9925.                     drawYear--;
  9926.                 }
  9927.             }
  9928.         }
  9929.         inst.drawMonth = drawMonth;
  9930.         inst.drawYear = drawYear;
  9931.  
  9932.         prevText = this._get(inst, "prevText");
  9933.         prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  9934.             this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  9935.             this._getFormatConfig(inst)));
  9936.  
  9937.         prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  9938.             "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
  9939.             " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
  9940.             (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>"));
  9941.  
  9942.         nextText = this._get(inst, "nextText");
  9943.         nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  9944.             this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  9945.             this._getFormatConfig(inst)));
  9946.  
  9947.         next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  9948.             "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
  9949.             " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
  9950.             (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>"));
  9951.  
  9952.         currentText = this._get(inst, "currentText");
  9953.         gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
  9954.         currentText = (!navigationAsDateFormat ? currentText :
  9955.             this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  9956.  
  9957.         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'>" +
  9958.             this._get(inst, "closeText") + "</button>" : "");
  9959.  
  9960.         buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
  9961.             (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'" +
  9962.             ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
  9963.  
  9964.         firstDay = parseInt(this._get(inst, "firstDay"),10);
  9965.         firstDay = (isNaN(firstDay) ? 0 : firstDay);
  9966.  
  9967.         showWeek = this._get(inst, "showWeek");
  9968.         dayNames = this._get(inst, "dayNames");
  9969.         dayNamesMin = this._get(inst, "dayNamesMin");
  9970.         monthNames = this._get(inst, "monthNames");
  9971.         monthNamesShort = this._get(inst, "monthNamesShort");
  9972.         beforeShowDay = this._get(inst, "beforeShowDay");
  9973.         showOtherMonths = this._get(inst, "showOtherMonths");
  9974.         selectOtherMonths = this._get(inst, "selectOtherMonths");
  9975.         defaultDate = this._getDefaultDate(inst);
  9976.         html = "";
  9977.         dow;
  9978.         for (row = 0; row < numMonths[0]; row++) {
  9979.             group = "";
  9980.             this.maxRows = 4;
  9981.             for (col = 0; col < numMonths[1]; col++) {
  9982.                 selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  9983.                 cornerClass = " ui-corner-all";
  9984.                 calender = "";
  9985.                 if (isMultiMonth) {
  9986.                     calender += "<div class='ui-datepicker-group";
  9987.                     if (numMonths[1] > 1) {
  9988.                         switch (col) {
  9989.                             case 0: calender += " ui-datepicker-group-first";
  9990.                                 cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
  9991.                             case numMonths[1]-1: calender += " ui-datepicker-group-last";
  9992.                                 cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
  9993.                             default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
  9994.                         }
  9995.                     }
  9996.                     calender += "'>";
  9997.                 }
  9998.                 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  9999.                     (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
  10000.                     (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
  10001.                     this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  10002.                     row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  10003.                     "</div><table class='ui-datepicker-calendar'><thead>" +
  10004.                     "<tr>";
  10005.                 thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  10006.                 for (dow = 0; dow < 7; dow++) { // days of the week
  10007.                     day = (dow + firstDay) % 7;
  10008.                     thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
  10009.                         "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  10010.                 }
  10011.                 calender += thead + "</tr></thead><tbody>";
  10012.                 daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  10013.                 if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  10014.                     inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  10015.                 }
  10016.                 leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  10017.                 curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
  10018.                 numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
  10019.                 this.maxRows = numRows;
  10020.                 printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  10021.                 for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  10022.                     calender += "<tr>";
  10023.                     tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  10024.                         this._get(inst, "calculateWeek")(printDate) + "</td>");
  10025.                     for (dow = 0; dow < 7; dow++) { // create date picker days
  10026.                         daySettings = (beforeShowDay ?
  10027.                             beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
  10028.                         otherMonth = (printDate.getMonth() !== drawMonth);
  10029.                         unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  10030.                             (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  10031.                         tbody += "<td class='" +
  10032.                             ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
  10033.                             (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
  10034.                             ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
  10035.                             (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
  10036.                             // or defaultDate is current printedDate and defaultDate is selectedDate
  10037.                             " " + this._dayOverClass : "") + // highlight selected day
  10038.                             (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
  10039.                             (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
  10040.                             (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
  10041.                             (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
  10042.                             ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
  10043.                             (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
  10044.                             (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  10045.                             (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  10046.                             (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
  10047.                             (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
  10048.                             (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
  10049.                             "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
  10050.                         printDate.setDate(printDate.getDate() + 1);
  10051.                         printDate = this._daylightSavingAdjust(printDate);
  10052.                     }
  10053.                     calender += tbody + "</tr>";
  10054.                 }
  10055.                 drawMonth++;
  10056.                 if (drawMonth > 11) {
  10057.                     drawMonth = 0;
  10058.                     drawYear++;
  10059.                 }
  10060.                 calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
  10061.                             ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
  10062.                 group += calender;
  10063.             }
  10064.             html += group;
  10065.         }
  10066.         html += buttonPanel;
  10067.         inst._keyEvent = false;
  10068.         return html;
  10069.     },
  10070.  
  10071.     /* Generate the month and year header. */
  10072.     _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  10073.             secondary, monthNames, monthNamesShort) {
  10074.  
  10075.         var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  10076.             changeMonth = this._get(inst, "changeMonth"),
  10077.             changeYear = this._get(inst, "changeYear"),
  10078.             showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
  10079.             html = "<div class='ui-datepicker-title'>",
  10080.             monthHtml = "";
  10081.  
  10082.         // month selection
  10083.         if (secondary || !changeMonth) {
  10084.             monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
  10085.         } else {
  10086.             inMinYear = (minDate && minDate.getFullYear() === drawYear);
  10087.             inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
  10088.             monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
  10089.             for ( month = 0; month < 12; month++) {
  10090.                 if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
  10091.                     monthHtml += "<option value='" + month + "'" +
  10092.                         (month === drawMonth ? " selected='selected'" : "") +
  10093.                         ">" + monthNamesShort[month] + "</option>";
  10094.                 }
  10095.             }
  10096.             monthHtml += "</select>";
  10097.         }
  10098.  
  10099.         if (!showMonthAfterYear) {
  10100.             html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
  10101.         }
  10102.  
  10103.         // year selection
  10104.         if ( !inst.yearshtml ) {
  10105.             inst.yearshtml = "";
  10106.             if (secondary || !changeYear) {
  10107.                 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  10108.             } else {
  10109.                 // determine range of years to display
  10110.                 years = this._get(inst, "yearRange").split(":");
  10111.                 thisYear = new Date().getFullYear();
  10112.                 determineYear = function(value) {
  10113.                     var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  10114.                         (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
  10115.                         parseInt(value, 10)));
  10116.                     return (isNaN(year) ? thisYear : year);
  10117.                 };
  10118.                 year = determineYear(years[0]);
  10119.                 endYear = Math.max(year, determineYear(years[1] || ""));
  10120.                 year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  10121.                 endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  10122.                 inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
  10123.                 for (; year <= endYear; year++) {
  10124.                     inst.yearshtml += "<option value='" + year + "'" +
  10125.                         (year === drawYear ? " selected='selected'" : "") +
  10126.                         ">" + year + "</option>";
  10127.                 }
  10128.                 inst.yearshtml += "</select>";
  10129.  
  10130.                 html += inst.yearshtml;
  10131.                 inst.yearshtml = null;
  10132.             }
  10133.         }
  10134.  
  10135.         html += this._get(inst, "yearSuffix");
  10136.         if (showMonthAfterYear) {
  10137.             html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
  10138.         }
  10139.         html += "</div>"; // Close datepicker_header
  10140.         return html;
  10141.     },
  10142.  
  10143.     /* Adjust one of the date sub-fields. */
  10144.     _adjustInstDate: function(inst, offset, period) {
  10145.         var year = inst.drawYear + (period === "Y" ? offset : 0),
  10146.             month = inst.drawMonth + (period === "M" ? offset : 0),
  10147.             day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
  10148.             date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
  10149.  
  10150.         inst.selectedDay = date.getDate();
  10151.         inst.drawMonth = inst.selectedMonth = date.getMonth();
  10152.         inst.drawYear = inst.selectedYear = date.getFullYear();
  10153.         if (period === "M" || period === "Y") {
  10154.             this._notifyChange(inst);
  10155.         }
  10156.     },
  10157.  
  10158.     /* Ensure a date is within any min/max bounds. */
  10159.     _restrictMinMax: function(inst, date) {
  10160.         var minDate = this._getMinMaxDate(inst, "min"),
  10161.             maxDate = this._getMinMaxDate(inst, "max"),
  10162.             newDate = (minDate && date < minDate ? minDate : date);
  10163.         return (maxDate && newDate > maxDate ? maxDate : newDate);
  10164.     },
  10165.  
  10166.     /* Notify change of month/year. */
  10167.     _notifyChange: function(inst) {
  10168.         var onChange = this._get(inst, "onChangeMonthYear");
  10169.         if (onChange) {
  10170.             onChange.apply((inst.input ? inst.input[0] : null),
  10171.                 [inst.selectedYear, inst.selectedMonth + 1, inst]);
  10172.         }
  10173.     },
  10174.  
  10175.     /* Determine the number of months to show. */
  10176.     _getNumberOfMonths: function(inst) {
  10177.         var numMonths = this._get(inst, "numberOfMonths");
  10178.         return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
  10179.     },
  10180.  
  10181.     /* Determine the current maximum date - ensure no time components are set. */
  10182.     _getMinMaxDate: function(inst, minMax) {
  10183.         return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
  10184.     },
  10185.  
  10186.     /* Find the number of days in a given month. */
  10187.     _getDaysInMonth: function(year, month) {
  10188.         return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
  10189.     },
  10190.  
  10191.     /* Find the day of the week of the first of a month. */
  10192.     _getFirstDayOfMonth: function(year, month) {
  10193.         return new Date(year, month, 1).getDay();
  10194.     },
  10195.  
  10196.     /* Determines if we should allow a "next/prev" month display change. */
  10197.     _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  10198.         var numMonths = this._getNumberOfMonths(inst),
  10199.             date = this._daylightSavingAdjust(new Date(curYear,
  10200.             curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  10201.  
  10202.         if (offset < 0) {
  10203.             date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  10204.         }
  10205.         return this._isInRange(inst, date);
  10206.     },
  10207.  
  10208.     /* Is the given date in the accepted range? */
  10209.     _isInRange: function(inst, date) {
  10210.         var yearSplit, currentYear,
  10211.             minDate = this._getMinMaxDate(inst, "min"),
  10212.             maxDate = this._getMinMaxDate(inst, "max"),
  10213.             minYear = null,
  10214.             maxYear = null,
  10215.             years = this._get(inst, "yearRange");
  10216.             if (years){
  10217.                 yearSplit = years.split(":");
  10218.                 currentYear = new Date().getFullYear();
  10219.                 minYear = parseInt(yearSplit[0], 10);
  10220.                 maxYear = parseInt(yearSplit[1], 10);
  10221.                 if ( yearSplit[0].match(/[+\-].*/) ) {
  10222.                     minYear += currentYear;
  10223.                 }
  10224.                 if ( yearSplit[1].match(/[+\-].*/) ) {
  10225.                     maxYear += currentYear;
  10226.                 }
  10227.             }
  10228.  
  10229.         return ((!minDate || date.getTime() >= minDate.getTime()) &&
  10230.             (!maxDate || date.getTime() <= maxDate.getTime()) &&
  10231.             (!minYear || date.getFullYear() >= minYear) &&
  10232.             (!maxYear || date.getFullYear() <= maxYear));
  10233.     },
  10234.  
  10235.     /* Provide the configuration settings for formatting/parsing. */
  10236.     _getFormatConfig: function(inst) {
  10237.         var shortYearCutoff = this._get(inst, "shortYearCutoff");
  10238.         shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
  10239.             new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  10240.         return {shortYearCutoff: shortYearCutoff,
  10241.             dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
  10242.             monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
  10243.     },
  10244.  
  10245.     /* Format the given date for display. */
  10246.     _formatDate: function(inst, day, month, year) {
  10247.         if (!day) {
  10248.             inst.currentDay = inst.selectedDay;
  10249.             inst.currentMonth = inst.selectedMonth;
  10250.             inst.currentYear = inst.selectedYear;
  10251.         }
  10252.         var date = (day ? (typeof day === "object" ? day :
  10253.             this._daylightSavingAdjust(new Date(year, month, day))) :
  10254.             this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  10255.         return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
  10256.     }
  10257. });
  10258.  
  10259. /*
  10260.  * Bind hover events for datepicker elements.
  10261.  * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  10262.  * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  10263.  */
  10264. function datepicker_bindHover(dpDiv) {
  10265.     var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  10266.     return dpDiv.delegate(selector, "mouseout", function() {
  10267.             $(this).removeClass("ui-state-hover");
  10268.             if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  10269.                 $(this).removeClass("ui-datepicker-prev-hover");
  10270.             }
  10271.             if (this.className.indexOf("ui-datepicker-next") !== -1) {
  10272.                 $(this).removeClass("ui-datepicker-next-hover");
  10273.             }
  10274.         })
  10275.         .delegate( selector, "mouseover", datepicker_handleMouseover );
  10276. }
  10277.  
  10278. function datepicker_handleMouseover() {
  10279.     if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
  10280.         $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
  10281.         $(this).addClass("ui-state-hover");
  10282.         if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  10283.             $(this).addClass("ui-datepicker-prev-hover");
  10284.         }
  10285.         if (this.className.indexOf("ui-datepicker-next") !== -1) {
  10286.             $(this).addClass("ui-datepicker-next-hover");
  10287.         }
  10288.     }
  10289. }
  10290.  
  10291. /* jQuery extend now ignores nulls! */
  10292. function datepicker_extendRemove(target, props) {
  10293.     $.extend(target, props);
  10294.     for (var name in props) {
  10295.         if (props[name] == null) {
  10296.             target[name] = props[name];
  10297.         }
  10298.     }
  10299.     return target;
  10300. }
  10301.  
  10302. /* Invoke the datepicker functionality.
  10303.    @param  options  string - a command, optionally followed by additional parameters or
  10304.                     Object - settings for attaching new datepicker functionality
  10305.    @return  jQuery object */
  10306. $.fn.datepicker = function(options){
  10307.  
  10308.     /* Verify an empty collection wasn't passed - Fixes #6976 */
  10309.     if ( !this.length ) {
  10310.         return this;
  10311.     }
  10312.  
  10313.     /* Initialise the date picker. */
  10314.     if (!$.datepicker.initialized) {
  10315.         $(document).mousedown($.datepicker._checkExternalClick);
  10316.         $.datepicker.initialized = true;
  10317.     }
  10318.  
  10319.     /* Append datepicker main container to body if not exist. */
  10320.     if ($("#"+$.datepicker._mainDivId).length === 0) {
  10321.         $("body").append($.datepicker.dpDiv);
  10322.     }
  10323.  
  10324.     var otherArgs = Array.prototype.slice.call(arguments, 1);
  10325.     if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
  10326.         return $.datepicker["_" + options + "Datepicker"].
  10327.             apply($.datepicker, [this[0]].concat(otherArgs));
  10328.     }
  10329.     if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
  10330.         return $.datepicker["_" + options + "Datepicker"].
  10331.             apply($.datepicker, [this[0]].concat(otherArgs));
  10332.     }
  10333.     return this.each(function() {
  10334.         typeof options === "string" ?
  10335.             $.datepicker["_" + options + "Datepicker"].
  10336.                 apply($.datepicker, [this].concat(otherArgs)) :
  10337.             $.datepicker._attachDatepicker(this, options);
  10338.     });
  10339. };
  10340.  
  10341. $.datepicker = new Datepicker(); // singleton instance
  10342. $.datepicker.initialized = false;
  10343. $.datepicker.uuid = new Date().getTime();
  10344. $.datepicker.version = "1.11.4";
  10345.  
  10346. var datepicker = $.datepicker;
  10347.  
  10348.  
  10349. /*!
  10350.  * jQuery UI Dialog 1.11.4
  10351.  * http://jqueryui.com
  10352.  *
  10353.  * Copyright jQuery Foundation and other contributors
  10354.  * Released under the MIT license.
  10355.  * http://jquery.org/license
  10356.  *
  10357.  * http://api.jqueryui.com/dialog/
  10358.  */
  10359.  
  10360.  
  10361. var dialog = $.widget( "ui.dialog", {
  10362.     version: "1.11.4",
  10363.     options: {
  10364.         appendTo: "body",
  10365.         autoOpen: true,
  10366.         buttons: [],
  10367.         closeOnEscape: true,
  10368.         closeText: "Close",
  10369.         dialogClass: "",
  10370.         draggable: true,
  10371.         hide: null,
  10372.         height: "auto",
  10373.         maxHeight: null,
  10374.         maxWidth: null,
  10375.         minHeight: 150,
  10376.         minWidth: 150,
  10377.         modal: false,
  10378.         position: {
  10379.             my: "center",
  10380.             at: "center",
  10381.             of: window,
  10382.             collision: "fit",
  10383.             // Ensure the titlebar is always visible
  10384.             using: function( pos ) {
  10385.                 var topOffset = $( this ).css( pos ).offset().top;
  10386.                 if ( topOffset < 0 ) {
  10387.                     $( this ).css( "top", pos.top - topOffset );
  10388.                 }
  10389.             }
  10390.         },
  10391.         resizable: true,
  10392.         show: null,
  10393.         title: null,
  10394.         width: 300,
  10395.  
  10396.         // callbacks
  10397.         beforeClose: null,
  10398.         close: null,
  10399.         drag: null,
  10400.         dragStart: null,
  10401.         dragStop: null,
  10402.         focus: null,
  10403.         open: null,
  10404.         resize: null,
  10405.         resizeStart: null,
  10406.         resizeStop: null
  10407.     },
  10408.  
  10409.     sizeRelatedOptions: {
  10410.         buttons: true,
  10411.         height: true,
  10412.         maxHeight: true,
  10413.         maxWidth: true,
  10414.         minHeight: true,
  10415.         minWidth: true,
  10416.         width: true
  10417.     },
  10418.  
  10419.     resizableRelatedOptions: {
  10420.         maxHeight: true,
  10421.         maxWidth: true,
  10422.         minHeight: true,
  10423.         minWidth: true
  10424.     },
  10425.  
  10426.     _create: function() {
  10427.         this.originalCss = {
  10428.             display: this.element[ 0 ].style.display,
  10429.             width: this.element[ 0 ].style.width,
  10430.             minHeight: this.element[ 0 ].style.minHeight,
  10431.             maxHeight: this.element[ 0 ].style.maxHeight,
  10432.             height: this.element[ 0 ].style.height
  10433.         };
  10434.         this.originalPosition = {
  10435.             parent: this.element.parent(),
  10436.             index: this.element.parent().children().index( this.element )
  10437.         };
  10438.         this.originalTitle = this.element.attr( "title" );
  10439.         this.options.title = this.options.title || this.originalTitle;
  10440.  
  10441.         this._createWrapper();
  10442.  
  10443.         this.element
  10444.             .show()
  10445.             .removeAttr( "title" )
  10446.             .addClass( "ui-dialog-content ui-widget-content" )
  10447.             .appendTo( this.uiDialog );
  10448.  
  10449.         this._createTitlebar();
  10450.         this._createButtonPane();
  10451.  
  10452.         if ( this.options.draggable && $.fn.draggable ) {
  10453.             this._makeDraggable();
  10454.         }
  10455.         if ( this.options.resizable && $.fn.resizable ) {
  10456.             this._makeResizable();
  10457.         }
  10458.  
  10459.         this._isOpen = false;
  10460.  
  10461.         this._trackFocus();
  10462.     },
  10463.  
  10464.     _init: function() {
  10465.         if ( this.options.autoOpen ) {
  10466.             this.open();
  10467.         }
  10468.     },
  10469.  
  10470.     _appendTo: function() {
  10471.         var element = this.options.appendTo;
  10472.         if ( element && (element.jquery || element.nodeType) ) {
  10473.             return $( element );
  10474.         }
  10475.         return this.document.find( element || "body" ).eq( 0 );
  10476.     },
  10477.  
  10478.     _destroy: function() {
  10479.         var next,
  10480.             originalPosition = this.originalPosition;
  10481.  
  10482.         this._untrackInstance();
  10483.         this._destroyOverlay();
  10484.  
  10485.         this.element
  10486.             .removeUniqueId()
  10487.             .removeClass( "ui-dialog-content ui-widget-content" )
  10488.             .css( this.originalCss )
  10489.             // Without detaching first, the following becomes really slow
  10490.             .detach();
  10491.  
  10492.         this.uiDialog.stop( true, true ).remove();
  10493.  
  10494.         if ( this.originalTitle ) {
  10495.             this.element.attr( "title", this.originalTitle );
  10496.         }
  10497.  
  10498.         next = originalPosition.parent.children().eq( originalPosition.index );
  10499.         // Don't try to place the dialog next to itself (#8613)
  10500.         if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  10501.             next.before( this.element );
  10502.         } else {
  10503.             originalPosition.parent.append( this.element );
  10504.         }
  10505.     },
  10506.  
  10507.     widget: function() {
  10508.         return this.uiDialog;
  10509.     },
  10510.  
  10511.     disable: $.noop,
  10512.     enable: $.noop,
  10513.  
  10514.     close: function( event ) {
  10515.         var activeElement,
  10516.             that = this;
  10517.  
  10518.         if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  10519.             return;
  10520.         }
  10521.  
  10522.         this._isOpen = false;
  10523.         this._focusedElement = null;
  10524.         this._destroyOverlay();
  10525.         this._untrackInstance();
  10526.  
  10527.         if ( !this.opener.filter( ":focusable" ).focus().length ) {
  10528.  
  10529.             // support: IE9
  10530.             // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  10531.             try {
  10532.                 activeElement = this.document[ 0 ].activeElement;
  10533.  
  10534.                 // Support: IE9, IE10
  10535.                 // If the <body> is blurred, IE will switch windows, see #4520
  10536.                 if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
  10537.  
  10538.                     // Hiding a focused element doesn't trigger blur in WebKit
  10539.                     // so in case we have nothing to focus on, explicitly blur the active element
  10540.                     // https://bugs.webkit.org/show_bug.cgi?id=47182
  10541.                     $( activeElement ).blur();
  10542.                 }
  10543.             } catch ( error ) {}
  10544.         }
  10545.  
  10546.         this._hide( this.uiDialog, this.options.hide, function() {
  10547.             that._trigger( "close", event );
  10548.         });
  10549.     },
  10550.  
  10551.     isOpen: function() {
  10552.         return this._isOpen;
  10553.     },
  10554.  
  10555.     moveToTop: function() {
  10556.         this._moveToTop();
  10557.     },
  10558.  
  10559.     _moveToTop: function( event, silent ) {
  10560.         var moved = false,
  10561.             zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
  10562.                 return +$( this ).css( "z-index" );
  10563.             }).get(),
  10564.             zIndexMax = Math.max.apply( null, zIndices );
  10565.  
  10566.         if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
  10567.             this.uiDialog.css( "z-index", zIndexMax + 1 );
  10568.             moved = true;
  10569.         }
  10570.  
  10571.         if ( moved && !silent ) {
  10572.             this._trigger( "focus", event );
  10573.         }
  10574.         return moved;
  10575.     },
  10576.  
  10577.     open: function() {
  10578.         var that = this;
  10579.         if ( this._isOpen ) {
  10580.             if ( this._moveToTop() ) {
  10581.                 this._focusTabbable();
  10582.             }
  10583.             return;
  10584.         }
  10585.  
  10586.         this._isOpen = true;
  10587.         this.opener = $( this.document[ 0 ].activeElement );
  10588.  
  10589.         this._size();
  10590.         this._position();
  10591.         this._createOverlay();
  10592.         this._moveToTop( null, true );
  10593.  
  10594.         // Ensure the overlay is moved to the top with the dialog, but only when
  10595.         // opening. The overlay shouldn't move after the dialog is open so that
  10596.         // modeless dialogs opened after the modal dialog stack properly.
  10597.         if ( this.overlay ) {
  10598.             this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
  10599.         }
  10600.  
  10601.         this._show( this.uiDialog, this.options.show, function() {
  10602.             that._focusTabbable();
  10603.             that._trigger( "focus" );
  10604.         });
  10605.  
  10606.         // Track the dialog immediately upon openening in case a focus event
  10607.         // somehow occurs outside of the dialog before an element inside the
  10608.         // dialog is focused (#10152)
  10609.         this._makeFocusTarget();
  10610.  
  10611.         this._trigger( "open" );
  10612.     },
  10613.  
  10614.     _focusTabbable: function() {
  10615.         // Set focus to the first match:
  10616.         // 1. An element that was focused previously
  10617.         // 2. First element inside the dialog matching [autofocus]
  10618.         // 3. Tabbable element inside the content element
  10619.         // 4. Tabbable element inside the buttonpane
  10620.         // 5. The close button
  10621.         // 6. The dialog itself
  10622.         var hasFocus = this._focusedElement;
  10623.         if ( !hasFocus ) {
  10624.             hasFocus = this.element.find( "[autofocus]" );
  10625.         }
  10626.         if ( !hasFocus.length ) {
  10627.             hasFocus = this.element.find( ":tabbable" );
  10628.         }
  10629.         if ( !hasFocus.length ) {
  10630.             hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  10631.         }
  10632.         if ( !hasFocus.length ) {
  10633.             hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  10634.         }
  10635.         if ( !hasFocus.length ) {
  10636.             hasFocus = this.uiDialog;
  10637.         }
  10638.         hasFocus.eq( 0 ).focus();
  10639.     },
  10640.  
  10641.     _keepFocus: function( event ) {
  10642.         function checkFocus() {
  10643.             var activeElement = this.document[0].activeElement,
  10644.                 isActive = this.uiDialog[0] === activeElement ||
  10645.                     $.contains( this.uiDialog[0], activeElement );
  10646.             if ( !isActive ) {
  10647.                 this._focusTabbable();
  10648.             }
  10649.         }
  10650.         event.preventDefault();
  10651.         checkFocus.call( this );
  10652.         // support: IE
  10653.         // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10654.         // so we check again later
  10655.         this._delay( checkFocus );
  10656.     },
  10657.  
  10658.     _createWrapper: function() {
  10659.         this.uiDialog = $("<div>")
  10660.             .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
  10661.                 this.options.dialogClass )
  10662.             .hide()
  10663.             .attr({
  10664.                 // Setting tabIndex makes the div focusable
  10665.                 tabIndex: -1,
  10666.                 role: "dialog"
  10667.             })
  10668.             .appendTo( this._appendTo() );
  10669.  
  10670.         this._on( this.uiDialog, {
  10671.             keydown: function( event ) {
  10672.                 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10673.                         event.keyCode === $.ui.keyCode.ESCAPE ) {
  10674.                     event.preventDefault();
  10675.                     this.close( event );
  10676.                     return;
  10677.                 }
  10678.  
  10679.                 // prevent tabbing out of dialogs
  10680.                 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  10681.                     return;
  10682.                 }
  10683.                 var tabbables = this.uiDialog.find( ":tabbable" ),
  10684.                     first = tabbables.filter( ":first" ),
  10685.                     last = tabbables.filter( ":last" );
  10686.  
  10687.                 if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
  10688.                     this._delay(function() {
  10689.                         first.focus();
  10690.                     });
  10691.                     event.preventDefault();
  10692.                 } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
  10693.                     this._delay(function() {
  10694.                         last.focus();
  10695.                     });
  10696.                     event.preventDefault();
  10697.                 }
  10698.             },
  10699.             mousedown: function( event ) {
  10700.                 if ( this._moveToTop( event ) ) {
  10701.                     this._focusTabbable();
  10702.                 }
  10703.             }
  10704.         });
  10705.  
  10706.         // We assume that any existing aria-describedby attribute means
  10707.         // that the dialog content is marked up properly
  10708.         // otherwise we brute force the content as the description
  10709.         if ( !this.element.find( "[aria-describedby]" ).length ) {
  10710.             this.uiDialog.attr({
  10711.                 "aria-describedby": this.element.uniqueId().attr( "id" )
  10712.             });
  10713.         }
  10714.     },
  10715.  
  10716.     _createTitlebar: function() {
  10717.         var uiDialogTitle;
  10718.  
  10719.         this.uiDialogTitlebar = $( "<div>" )
  10720.             .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
  10721.             .prependTo( this.uiDialog );
  10722.         this._on( this.uiDialogTitlebar, {
  10723.             mousedown: function( event ) {
  10724.                 // Don't prevent click on close button (#8838)
  10725.                 // Focusing a dialog that is partially scrolled out of view
  10726.                 // causes the browser to scroll it into view, preventing the click event
  10727.                 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  10728.                     // Dialog isn't getting focus when dragging (#8063)
  10729.                     this.uiDialog.focus();
  10730.                 }
  10731.             }
  10732.         });
  10733.  
  10734.         // support: IE
  10735.         // Use type="button" to prevent enter keypresses in textboxes from closing the
  10736.         // dialog in IE (#9312)
  10737.         this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  10738.             .button({
  10739.                 label: this.options.closeText,
  10740.                 icons: {
  10741.                     primary: "ui-icon-closethick"
  10742.                 },
  10743.                 text: false
  10744.             })
  10745.             .addClass( "ui-dialog-titlebar-close" )
  10746.             .appendTo( this.uiDialogTitlebar );
  10747.         this._on( this.uiDialogTitlebarClose, {
  10748.             click: function( event ) {
  10749.                 event.preventDefault();
  10750.                 this.close( event );
  10751.             }
  10752.         });
  10753.  
  10754.         uiDialogTitle = $( "<span>" )
  10755.             .uniqueId()
  10756.             .addClass( "ui-dialog-title" )
  10757.             .prependTo( this.uiDialogTitlebar );
  10758.         this._title( uiDialogTitle );
  10759.  
  10760.         this.uiDialog.attr({
  10761.             "aria-labelledby": uiDialogTitle.attr( "id" )
  10762.         });
  10763.     },
  10764.  
  10765.     _title: function( title ) {
  10766.         if ( !this.options.title ) {
  10767.             title.html( "&#160;" );
  10768.         }
  10769.         title.text( this.options.title );
  10770.     },
  10771.  
  10772.     _createButtonPane: function() {
  10773.         this.uiDialogButtonPane = $( "<div>" )
  10774.             .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
  10775.  
  10776.         this.uiButtonSet = $( "<div>" )
  10777.             .addClass( "ui-dialog-buttonset" )
  10778.             .appendTo( this.uiDialogButtonPane );
  10779.  
  10780.         this._createButtons();
  10781.     },
  10782.  
  10783.     _createButtons: function() {
  10784.         var that = this,
  10785.             buttons = this.options.buttons;
  10786.  
  10787.         // if we already have a button pane, remove it
  10788.         this.uiDialogButtonPane.remove();
  10789.         this.uiButtonSet.empty();
  10790.  
  10791.         if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
  10792.             this.uiDialog.removeClass( "ui-dialog-buttons" );
  10793.             return;
  10794.         }
  10795.  
  10796.         $.each( buttons, function( name, props ) {
  10797.             var click, buttonOptions;
  10798.             props = $.isFunction( props ) ?
  10799.                 { click: props, text: name } :
  10800.                 props;
  10801.             // Default to a non-submitting button
  10802.             props = $.extend( { type: "button" }, props );
  10803.             // Change the context for the click callback to be the main element
  10804.             click = props.click;
  10805.             props.click = function() {
  10806.                 click.apply( that.element[ 0 ], arguments );
  10807.             };
  10808.             buttonOptions = {
  10809.                 icons: props.icons,
  10810.                 text: props.showText
  10811.             };
  10812.             delete props.icons;
  10813.             delete props.showText;
  10814.             $( "<button></button>", props )
  10815.                 .button( buttonOptions )
  10816.                 .appendTo( that.uiButtonSet );
  10817.         });
  10818.         this.uiDialog.addClass( "ui-dialog-buttons" );
  10819.         this.uiDialogButtonPane.appendTo( this.uiDialog );
  10820.     },
  10821.  
  10822.     _makeDraggable: function() {
  10823.         var that = this,
  10824.             options = this.options;
  10825.  
  10826.         function filteredUi( ui ) {
  10827.             return {
  10828.                 position: ui.position,
  10829.                 offset: ui.offset
  10830.             };
  10831.         }
  10832.  
  10833.         this.uiDialog.draggable({
  10834.             cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10835.             handle: ".ui-dialog-titlebar",
  10836.             containment: "document",
  10837.             start: function( event, ui ) {
  10838.                 $( this ).addClass( "ui-dialog-dragging" );
  10839.                 that._blockFrames();
  10840.                 that._trigger( "dragStart", event, filteredUi( ui ) );
  10841.             },
  10842.             drag: function( event, ui ) {
  10843.                 that._trigger( "drag", event, filteredUi( ui ) );
  10844.             },
  10845.             stop: function( event, ui ) {
  10846.                 var left = ui.offset.left - that.document.scrollLeft(),
  10847.                     top = ui.offset.top - that.document.scrollTop();
  10848.  
  10849.                 options.position = {
  10850.                     my: "left top",
  10851.                     at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10852.                         "top" + (top >= 0 ? "+" : "") + top,
  10853.                     of: that.window
  10854.                 };
  10855.                 $( this ).removeClass( "ui-dialog-dragging" );
  10856.                 that._unblockFrames();
  10857.                 that._trigger( "dragStop", event, filteredUi( ui ) );
  10858.             }
  10859.         });
  10860.     },
  10861.  
  10862.     _makeResizable: function() {
  10863.         var that = this,
  10864.             options = this.options,
  10865.             handles = options.resizable,
  10866.             // .ui-resizable has position: relative defined in the stylesheet
  10867.             // but dialogs have to use absolute or fixed positioning
  10868.             position = this.uiDialog.css("position"),
  10869.             resizeHandles = typeof handles === "string" ?
  10870.                 handles :
  10871.                 "n,e,s,w,se,sw,ne,nw";
  10872.  
  10873.         function filteredUi( ui ) {
  10874.             return {
  10875.                 originalPosition: ui.originalPosition,
  10876.                 originalSize: ui.originalSize,
  10877.                 position: ui.position,
  10878.                 size: ui.size
  10879.             };
  10880.         }
  10881.  
  10882.         this.uiDialog.resizable({
  10883.             cancel: ".ui-dialog-content",
  10884.             containment: "document",
  10885.             alsoResize: this.element,
  10886.             maxWidth: options.maxWidth,
  10887.             maxHeight: options.maxHeight,
  10888.             minWidth: options.minWidth,
  10889.             minHeight: this._minHeight(),
  10890.             handles: resizeHandles,
  10891.             start: function( event, ui ) {
  10892.                 $( this ).addClass( "ui-dialog-resizing" );
  10893.                 that._blockFrames();
  10894.                 that._trigger( "resizeStart", event, filteredUi( ui ) );
  10895.             },
  10896.             resize: function( event, ui ) {
  10897.                 that._trigger( "resize", event, filteredUi( ui ) );
  10898.             },
  10899.             stop: function( event, ui ) {
  10900.                 var offset = that.uiDialog.offset(),
  10901.                     left = offset.left - that.document.scrollLeft(),
  10902.                     top = offset.top - that.document.scrollTop();
  10903.  
  10904.                 options.height = that.uiDialog.height();
  10905.                 options.width = that.uiDialog.width();
  10906.                 options.position = {
  10907.                     my: "left top",
  10908.                     at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10909.                         "top" + (top >= 0 ? "+" : "") + top,
  10910.                     of: that.window
  10911.                 };
  10912.                 $( this ).removeClass( "ui-dialog-resizing" );
  10913.                 that._unblockFrames();
  10914.                 that._trigger( "resizeStop", event, filteredUi( ui ) );
  10915.             }
  10916.         })
  10917.         .css( "position", position );
  10918.     },
  10919.  
  10920.     _trackFocus: function() {
  10921.         this._on( this.widget(), {
  10922.             focusin: function( event ) {
  10923.                 this._makeFocusTarget();
  10924.                 this._focusedElement = $( event.target );
  10925.             }
  10926.         });
  10927.     },
  10928.  
  10929.     _makeFocusTarget: function() {
  10930.         this._untrackInstance();
  10931.         this._trackingInstances().unshift( this );
  10932.     },
  10933.  
  10934.     _untrackInstance: function() {
  10935.         var instances = this._trackingInstances(),
  10936.             exists = $.inArray( this, instances );
  10937.         if ( exists !== -1 ) {
  10938.             instances.splice( exists, 1 );
  10939.         }
  10940.     },
  10941.  
  10942.     _trackingInstances: function() {
  10943.         var instances = this.document.data( "ui-dialog-instances" );
  10944.         if ( !instances ) {
  10945.             instances = [];
  10946.             this.document.data( "ui-dialog-instances", instances );
  10947.         }
  10948.         return instances;
  10949.     },
  10950.  
  10951.     _minHeight: function() {
  10952.         var options = this.options;
  10953.  
  10954.         return options.height === "auto" ?
  10955.             options.minHeight :
  10956.             Math.min( options.minHeight, options.height );
  10957.     },
  10958.  
  10959.     _position: function() {
  10960.         // Need to show the dialog to get the actual offset in the position plugin
  10961.         var isVisible = this.uiDialog.is( ":visible" );
  10962.         if ( !isVisible ) {
  10963.             this.uiDialog.show();
  10964.         }
  10965.         this.uiDialog.position( this.options.position );
  10966.         if ( !isVisible ) {
  10967.             this.uiDialog.hide();
  10968.         }
  10969.     },
  10970.  
  10971.     _setOptions: function( options ) {
  10972.         var that = this,
  10973.             resize = false,
  10974.             resizableOptions = {};
  10975.  
  10976.         $.each( options, function( key, value ) {
  10977.             that._setOption( key, value );
  10978.  
  10979.             if ( key in that.sizeRelatedOptions ) {
  10980.                 resize = true;
  10981.             }
  10982.             if ( key in that.resizableRelatedOptions ) {
  10983.                 resizableOptions[ key ] = value;
  10984.             }
  10985.         });
  10986.  
  10987.         if ( resize ) {
  10988.             this._size();
  10989.             this._position();
  10990.         }
  10991.         if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10992.             this.uiDialog.resizable( "option", resizableOptions );
  10993.         }
  10994.     },
  10995.  
  10996.     _setOption: function( key, value ) {
  10997.         var isDraggable, isResizable,
  10998.             uiDialog = this.uiDialog;
  10999.  
  11000.         if ( key === "dialogClass" ) {
  11001.             uiDialog
  11002.                 .removeClass( this.options.dialogClass )
  11003.                 .addClass( value );
  11004.         }
  11005.  
  11006.         if ( key === "disabled" ) {
  11007.             return;
  11008.         }
  11009.  
  11010.         this._super( key, value );
  11011.  
  11012.         if ( key === "appendTo" ) {
  11013.             this.uiDialog.appendTo( this._appendTo() );
  11014.         }
  11015.  
  11016.         if ( key === "buttons" ) {
  11017.             this._createButtons();
  11018.         }
  11019.  
  11020.         if ( key === "closeText" ) {
  11021.             this.uiDialogTitlebarClose.button({
  11022.                 // Ensure that we always pass a string
  11023.                 label: "" + value
  11024.             });
  11025.         }
  11026.  
  11027.         if ( key === "draggable" ) {
  11028.             isDraggable = uiDialog.is( ":data(ui-draggable)" );
  11029.             if ( isDraggable && !value ) {
  11030.                 uiDialog.draggable( "destroy" );
  11031.             }
  11032.  
  11033.             if ( !isDraggable && value ) {
  11034.                 this._makeDraggable();
  11035.             }
  11036.         }
  11037.  
  11038.         if ( key === "position" ) {
  11039.             this._position();
  11040.         }
  11041.  
  11042.         if ( key === "resizable" ) {
  11043.             // currently resizable, becoming non-resizable
  11044.             isResizable = uiDialog.is( ":data(ui-resizable)" );
  11045.             if ( isResizable && !value ) {
  11046.                 uiDialog.resizable( "destroy" );
  11047.             }
  11048.  
  11049.             // currently resizable, changing handles
  11050.             if ( isResizable && typeof value === "string" ) {
  11051.                 uiDialog.resizable( "option", "handles", value );
  11052.             }
  11053.  
  11054.             // currently non-resizable, becoming resizable
  11055.             if ( !isResizable && value !== false ) {
  11056.                 this._makeResizable();
  11057.             }
  11058.         }
  11059.  
  11060.         if ( key === "title" ) {
  11061.             this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
  11062.         }
  11063.     },
  11064.  
  11065.     _size: function() {
  11066.         // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  11067.         // divs will both have width and height set, so we need to reset them
  11068.         var nonContentHeight, minContentHeight, maxContentHeight,
  11069.             options = this.options;
  11070.  
  11071.         // Reset content sizing
  11072.         this.element.show().css({
  11073.             width: "auto",
  11074.             minHeight: 0,
  11075.             maxHeight: "none",
  11076.             height: 0
  11077.         });
  11078.  
  11079.         if ( options.minWidth > options.width ) {
  11080.             options.width = options.minWidth;
  11081.         }
  11082.  
  11083.         // reset wrapper sizing
  11084.         // determine the height of all the non-content elements
  11085.         nonContentHeight = this.uiDialog.css({
  11086.                 height: "auto",
  11087.                 width: options.width
  11088.             })
  11089.             .outerHeight();
  11090.         minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  11091.         maxContentHeight = typeof options.maxHeight === "number" ?
  11092.             Math.max( 0, options.maxHeight - nonContentHeight ) :
  11093.             "none";
  11094.  
  11095.         if ( options.height === "auto" ) {
  11096.             this.element.css({
  11097.                 minHeight: minContentHeight,
  11098.                 maxHeight: maxContentHeight,
  11099.                 height: "auto"
  11100.             });
  11101.         } else {
  11102.             this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  11103.         }
  11104.  
  11105.         if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  11106.             this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  11107.         }
  11108.     },
  11109.  
  11110.     _blockFrames: function() {
  11111.         this.iframeBlocks = this.document.find( "iframe" ).map(function() {
  11112.             var iframe = $( this );
  11113.  
  11114.             return $( "<div>" )
  11115.                 .css({
  11116.                     position: "absolute",
  11117.                     width: iframe.outerWidth(),
  11118.                     height: iframe.outerHeight()
  11119.                 })
  11120.                 .appendTo( iframe.parent() )
  11121.                 .offset( iframe.offset() )[0];
  11122.         });
  11123.     },
  11124.  
  11125.     _unblockFrames: function() {
  11126.         if ( this.iframeBlocks ) {
  11127.             this.iframeBlocks.remove();
  11128.             delete this.iframeBlocks;
  11129.         }
  11130.     },
  11131.  
  11132.     _allowInteraction: function( event ) {
  11133.         if ( $( event.target ).closest( ".ui-dialog" ).length ) {
  11134.             return true;
  11135.         }
  11136.  
  11137.         // TODO: Remove hack when datepicker implements
  11138.         // the .ui-front logic (#8989)
  11139.         return !!$( event.target ).closest( ".ui-datepicker" ).length;
  11140.     },
  11141.  
  11142.     _createOverlay: function() {
  11143.         if ( !this.options.modal ) {
  11144.             return;
  11145.         }
  11146.  
  11147.         // We use a delay in case the overlay is created from an
  11148.         // event that we're going to be cancelling (#2804)
  11149.         var isOpening = true;
  11150.         this._delay(function() {
  11151.             isOpening = false;
  11152.         });
  11153.  
  11154.         if ( !this.document.data( "ui-dialog-overlays" ) ) {
  11155.  
  11156.             // Prevent use of anchors and inputs
  11157.             // Using _on() for an event handler shared across many instances is
  11158.             // safe because the dialogs stack and must be closed in reverse order
  11159.             this._on( this.document, {
  11160.                 focusin: function( event ) {
  11161.                     if ( isOpening ) {
  11162.                         return;
  11163.                     }
  11164.  
  11165.                     if ( !this._allowInteraction( event ) ) {
  11166.                         event.preventDefault();
  11167.                         this._trackingInstances()[ 0 ]._focusTabbable();
  11168.                     }
  11169.                 }
  11170.             });
  11171.         }
  11172.  
  11173.         this.overlay = $( "<div>" )
  11174.             .addClass( "ui-widget-overlay ui-front" )
  11175.             .appendTo( this._appendTo() );
  11176.         this._on( this.overlay, {
  11177.             mousedown: "_keepFocus"
  11178.         });
  11179.         this.document.data( "ui-dialog-overlays",
  11180.             (this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
  11181.     },
  11182.  
  11183.     _destroyOverlay: function() {
  11184.         if ( !this.options.modal ) {
  11185.             return;
  11186.         }
  11187.  
  11188.         if ( this.overlay ) {
  11189.             var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
  11190.  
  11191.             if ( !overlays ) {
  11192.                 this.document
  11193.                     .unbind( "focusin" )
  11194.                     .removeData( "ui-dialog-overlays" );
  11195.             } else {
  11196.                 this.document.data( "ui-dialog-overlays", overlays );
  11197.             }
  11198.  
  11199.             this.overlay.remove();
  11200.             this.overlay = null;
  11201.         }
  11202.     }
  11203. });
  11204.  
  11205.  
  11206. /*!
  11207.  * jQuery UI Progressbar 1.11.4
  11208.  * http://jqueryui.com
  11209.  *
  11210.  * Copyright jQuery Foundation and other contributors
  11211.  * Released under the MIT license.
  11212.  * http://jquery.org/license
  11213.  *
  11214.  * http://api.jqueryui.com/progressbar/
  11215.  */
  11216.  
  11217.  
  11218. var progressbar = $.widget( "ui.progressbar", {
  11219.     version: "1.11.4",
  11220.     options: {
  11221.         max: 100,
  11222.         value: 0,
  11223.  
  11224.         change: null,
  11225.         complete: null
  11226.     },
  11227.  
  11228.     min: 0,
  11229.  
  11230.     _create: function() {
  11231.         // Constrain initial value
  11232.         this.oldValue = this.options.value = this._constrainedValue();
  11233.  
  11234.         this.element
  11235.             .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  11236.             .attr({
  11237.                 // Only set static values, aria-valuenow and aria-valuemax are
  11238.                 // set inside _refreshValue()
  11239.                 role: "progressbar",
  11240.                 "aria-valuemin": this.min
  11241.             });
  11242.  
  11243.         this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  11244.             .appendTo( this.element );
  11245.  
  11246.         this._refreshValue();
  11247.     },
  11248.  
  11249.     _destroy: function() {
  11250.         this.element
  11251.             .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  11252.             .removeAttr( "role" )
  11253.             .removeAttr( "aria-valuemin" )
  11254.             .removeAttr( "aria-valuemax" )
  11255.             .removeAttr( "aria-valuenow" );
  11256.  
  11257.         this.valueDiv.remove();
  11258.     },
  11259.  
  11260.     value: function( newValue ) {
  11261.         if ( newValue === undefined ) {
  11262.             return this.options.value;
  11263.         }
  11264.  
  11265.         this.options.value = this._constrainedValue( newValue );
  11266.         this._refreshValue();
  11267.     },
  11268.  
  11269.     _constrainedValue: function( newValue ) {
  11270.         if ( newValue === undefined ) {
  11271.             newValue = this.options.value;
  11272.         }
  11273.  
  11274.         this.indeterminate = newValue === false;
  11275.  
  11276.         // sanitize value
  11277.         if ( typeof newValue !== "number" ) {
  11278.             newValue = 0;
  11279.         }
  11280.  
  11281.         return this.indeterminate ? false :
  11282.             Math.min( this.options.max, Math.max( this.min, newValue ) );
  11283.     },
  11284.  
  11285.     _setOptions: function( options ) {
  11286.         // Ensure "value" option is set after other values (like max)
  11287.         var value = options.value;
  11288.         delete options.value;
  11289.  
  11290.         this._super( options );
  11291.  
  11292.         this.options.value = this._constrainedValue( value );
  11293.         this._refreshValue();
  11294.     },
  11295.  
  11296.     _setOption: function( key, value ) {
  11297.         if ( key === "max" ) {
  11298.             // Don't allow a max less than min
  11299.             value = Math.max( this.min, value );
  11300.         }
  11301.         if ( key === "disabled" ) {
  11302.             this.element
  11303.                 .toggleClass( "ui-state-disabled", !!value )
  11304.                 .attr( "aria-disabled", value );
  11305.         }
  11306.         this._super( key, value );
  11307.     },
  11308.  
  11309.     _percentage: function() {
  11310.         return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  11311.     },
  11312.  
  11313.     _refreshValue: function() {
  11314.         var value = this.options.value,
  11315.             percentage = this._percentage();
  11316.  
  11317.         this.valueDiv
  11318.             .toggle( this.indeterminate || value > this.min )
  11319.             .toggleClass( "ui-corner-right", value === this.options.max )
  11320.             .width( percentage.toFixed(0) + "%" );
  11321.  
  11322.         this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
  11323.  
  11324.         if ( this.indeterminate ) {
  11325.             this.element.removeAttr( "aria-valuenow" );
  11326.             if ( !this.overlayDiv ) {
  11327.                 this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
  11328.             }
  11329.         } else {
  11330.             this.element.attr({
  11331.                 "aria-valuemax": this.options.max,
  11332.                 "aria-valuenow": value
  11333.             });
  11334.             if ( this.overlayDiv ) {
  11335.                 this.overlayDiv.remove();
  11336.                 this.overlayDiv = null;
  11337.             }
  11338.         }
  11339.  
  11340.         if ( this.oldValue !== value ) {
  11341.             this.oldValue = value;
  11342.             this._trigger( "change" );
  11343.         }
  11344.         if ( value === this.options.max ) {
  11345.             this._trigger( "complete" );
  11346.         }
  11347.     }
  11348. });
  11349.  
  11350.  
  11351. /*!
  11352.  * jQuery UI Selectmenu 1.11.4
  11353.  * http://jqueryui.com
  11354.  *
  11355.  * Copyright jQuery Foundation and other contributors
  11356.  * Released under the MIT license.
  11357.  * http://jquery.org/license
  11358.  *
  11359.  * http://api.jqueryui.com/selectmenu
  11360.  */
  11361.  
  11362.  
  11363. var selectmenu = $.widget( "ui.selectmenu", {
  11364.     version: "1.11.4",
  11365.     defaultElement: "<select>",
  11366.     options: {
  11367.         appendTo: null,
  11368.         disabled: null,
  11369.         icons: {
  11370.             button: "ui-icon-triangle-1-s"
  11371.         },
  11372.         position: {
  11373.             my: "left top",
  11374.             at: "left bottom",
  11375.             collision: "none"
  11376.         },
  11377.         width: null,
  11378.  
  11379.         // callbacks
  11380.         change: null,
  11381.         close: null,
  11382.         focus: null,
  11383.         open: null,
  11384.         select: null
  11385.     },
  11386.  
  11387.     _create: function() {
  11388.         var selectmenuId = this.element.uniqueId().attr( "id" );
  11389.         this.ids = {
  11390.             element: selectmenuId,
  11391.             button: selectmenuId + "-button",
  11392.             menu: selectmenuId + "-menu"
  11393.         };
  11394.  
  11395.         this._drawButton();
  11396.         this._drawMenu();
  11397.  
  11398.         if ( this.options.disabled ) {
  11399.             this.disable();
  11400.         }
  11401.     },
  11402.  
  11403.     _drawButton: function() {
  11404.         var that = this;
  11405.  
  11406.         // Associate existing label with the new button
  11407.         this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
  11408.         this._on( this.label, {
  11409.             click: function( event ) {
  11410.                 this.button.focus();
  11411.                 event.preventDefault();
  11412.             }
  11413.         });
  11414.  
  11415.         // Hide original select element
  11416.         this.element.hide();
  11417.  
  11418.         // Create button
  11419.         this.button = $( "<span>", {
  11420.             "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
  11421.             tabindex: this.options.disabled ? -1 : 0,
  11422.             id: this.ids.button,
  11423.             role: "combobox",
  11424.             "aria-expanded": "false",
  11425.             "aria-autocomplete": "list",
  11426.             "aria-owns": this.ids.menu,
  11427.             "aria-haspopup": "true"
  11428.         })
  11429.             .insertAfter( this.element );
  11430.  
  11431.         $( "<span>", {
  11432.             "class": "ui-icon " + this.options.icons.button
  11433.         })
  11434.             .prependTo( this.button );
  11435.  
  11436.         this.buttonText = $( "<span>", {
  11437.             "class": "ui-selectmenu-text"
  11438.         })
  11439.             .appendTo( this.button );
  11440.  
  11441.         this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
  11442.         this._resizeButton();
  11443.  
  11444.         this._on( this.button, this._buttonEvents );
  11445.         this.button.one( "focusin", function() {
  11446.  
  11447.             // Delay rendering the menu items until the button receives focus.
  11448.             // The menu may have already been rendered via a programmatic open.
  11449.             if ( !that.menuItems ) {
  11450.                 that._refreshMenu();
  11451.             }
  11452.         });
  11453.         this._hoverable( this.button );
  11454.         this._focusable( this.button );
  11455.     },
  11456.  
  11457.     _drawMenu: function() {
  11458.         var that = this;
  11459.  
  11460.         // Create menu
  11461.         this.menu = $( "<ul>", {
  11462.             "aria-hidden": "true",
  11463.             "aria-labelledby": this.ids.button,
  11464.             id: this.ids.menu
  11465.         });
  11466.  
  11467.         // Wrap menu
  11468.         this.menuWrap = $( "<div>", {
  11469.             "class": "ui-selectmenu-menu ui-front"
  11470.         })
  11471.             .append( this.menu )
  11472.             .appendTo( this._appendTo() );
  11473.  
  11474.         // Initialize menu widget
  11475.         this.menuInstance = this.menu
  11476.             .menu({
  11477.                 role: "listbox",
  11478.                 select: function( event, ui ) {
  11479.                     event.preventDefault();
  11480.  
  11481.                     // support: IE8
  11482.                     // If the item was selected via a click, the text selection
  11483.                     // will be destroyed in IE
  11484.                     that._setSelection();
  11485.  
  11486.                     that._select( ui.item.data( "ui-selectmenu-item" ), event );
  11487.                 },
  11488.                 focus: function( event, ui ) {
  11489.                     var item = ui.item.data( "ui-selectmenu-item" );
  11490.  
  11491.                     // Prevent inital focus from firing and check if its a newly focused item
  11492.                     if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  11493.                         that._trigger( "focus", event, { item: item } );
  11494.                         if ( !that.isOpen ) {
  11495.                             that._select( item, event );
  11496.                         }
  11497.                     }
  11498.                     that.focusIndex = item.index;
  11499.  
  11500.                     that.button.attr( "aria-activedescendant",
  11501.                         that.menuItems.eq( item.index ).attr( "id" ) );
  11502.                 }
  11503.             })
  11504.             .menu( "instance" );
  11505.  
  11506.         // Adjust menu styles to dropdown
  11507.         this.menu
  11508.             .addClass( "ui-corner-bottom" )
  11509.             .removeClass( "ui-corner-all" );
  11510.  
  11511.         // Don't close the menu on mouseleave
  11512.         this.menuInstance._off( this.menu, "mouseleave" );
  11513.  
  11514.         // Cancel the menu's collapseAll on document click
  11515.         this.menuInstance._closeOnDocumentClick = function() {
  11516.             return false;
  11517.         };
  11518.  
  11519.         // Selects often contain empty items, but never contain dividers
  11520.         this.menuInstance._isDivider = function() {
  11521.             return false;
  11522.         };
  11523.     },
  11524.  
  11525.     refresh: function() {
  11526.         this._refreshMenu();
  11527.         this._setText( this.buttonText, this._getSelectedItem().text() );
  11528.         if ( !this.options.width ) {
  11529.             this._resizeButton();
  11530.         }
  11531.     },
  11532.  
  11533.     _refreshMenu: function() {
  11534.         this.menu.empty();
  11535.  
  11536.         var item,
  11537.             options = this.element.find( "option" );
  11538.  
  11539.         if ( !options.length ) {
  11540.             return;
  11541.         }
  11542.  
  11543.         this._parseOptions( options );
  11544.         this._renderMenu( this.menu, this.items );
  11545.  
  11546.         this.menuInstance.refresh();
  11547.         this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
  11548.  
  11549.         item = this._getSelectedItem();
  11550.  
  11551.         // Update the menu to have the correct item focused
  11552.         this.menuInstance.focus( null, item );
  11553.         this._setAria( item.data( "ui-selectmenu-item" ) );
  11554.  
  11555.         // Set disabled state
  11556.         this._setOption( "disabled", this.element.prop( "disabled" ) );
  11557.     },
  11558.  
  11559.     open: function( event ) {
  11560.         if ( this.options.disabled ) {
  11561.             return;
  11562.         }
  11563.  
  11564.         // If this is the first time the menu is being opened, render the items
  11565.         if ( !this.menuItems ) {
  11566.             this._refreshMenu();
  11567.         } else {
  11568.  
  11569.             // Menu clears focus on close, reset focus to selected item
  11570.             this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
  11571.             this.menuInstance.focus( null, this._getSelectedItem() );
  11572.         }
  11573.  
  11574.         this.isOpen = true;
  11575.         this._toggleAttr();
  11576.         this._resizeMenu();
  11577.         this._position();
  11578.  
  11579.         this._on( this.document, this._documentClick );
  11580.  
  11581.         this._trigger( "open", event );
  11582.     },
  11583.  
  11584.     _position: function() {
  11585.         this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  11586.     },
  11587.  
  11588.     close: function( event ) {
  11589.         if ( !this.isOpen ) {
  11590.             return;
  11591.         }
  11592.  
  11593.         this.isOpen = false;
  11594.         this._toggleAttr();
  11595.  
  11596.         this.range = null;
  11597.         this._off( this.document );
  11598.  
  11599.         this._trigger( "close", event );
  11600.     },
  11601.  
  11602.     widget: function() {
  11603.         return this.button;
  11604.     },
  11605.  
  11606.     menuWidget: function() {
  11607.         return this.menu;
  11608.     },
  11609.  
  11610.     _renderMenu: function( ul, items ) {
  11611.         var that = this,
  11612.             currentOptgroup = "";
  11613.  
  11614.         $.each( items, function( index, item ) {
  11615.             if ( item.optgroup !== currentOptgroup ) {
  11616.                 $( "<li>", {
  11617.                     "class": "ui-selectmenu-optgroup ui-menu-divider" +
  11618.                         ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  11619.                             " ui-state-disabled" :
  11620.                             "" ),
  11621.                     text: item.optgroup
  11622.                 })
  11623.                     .appendTo( ul );
  11624.  
  11625.                 currentOptgroup = item.optgroup;
  11626.             }
  11627.  
  11628.             that._renderItemData( ul, item );
  11629.         });
  11630.     },
  11631.  
  11632.     _renderItemData: function( ul, item ) {
  11633.         return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  11634.     },
  11635.  
  11636.     _renderItem: function( ul, item ) {
  11637.         var li = $( "<li>" );
  11638.  
  11639.         if ( item.disabled ) {
  11640.             li.addClass( "ui-state-disabled" );
  11641.         }
  11642.         this._setText( li, item.label );
  11643.  
  11644.         return li.appendTo( ul );
  11645.     },
  11646.  
  11647.     _setText: function( element, value ) {
  11648.         if ( value ) {
  11649.             element.text( value );
  11650.         } else {
  11651.             element.html( "&#160;" );
  11652.         }
  11653.     },
  11654.  
  11655.     _move: function( direction, event ) {
  11656.         var item, next,
  11657.             filter = ".ui-menu-item";
  11658.  
  11659.         if ( this.isOpen ) {
  11660.             item = this.menuItems.eq( this.focusIndex );
  11661.         } else {
  11662.             item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
  11663.             filter += ":not(.ui-state-disabled)";
  11664.         }
  11665.  
  11666.         if ( direction === "first" || direction === "last" ) {
  11667.             next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  11668.         } else {
  11669.             next = item[ direction + "All" ]( filter ).eq( 0 );
  11670.         }
  11671.  
  11672.         if ( next.length ) {
  11673.             this.menuInstance.focus( event, next );
  11674.         }
  11675.     },
  11676.  
  11677.     _getSelectedItem: function() {
  11678.         return this.menuItems.eq( this.element[ 0 ].selectedIndex );
  11679.     },
  11680.  
  11681.     _toggle: function( event ) {
  11682.         this[ this.isOpen ? "close" : "open" ]( event );
  11683.     },
  11684.  
  11685.     _setSelection: function() {
  11686.         var selection;
  11687.  
  11688.         if ( !this.range ) {
  11689.             return;
  11690.         }
  11691.  
  11692.         if ( window.getSelection ) {
  11693.             selection = window.getSelection();
  11694.             selection.removeAllRanges();
  11695.             selection.addRange( this.range );
  11696.  
  11697.         // support: IE8
  11698.         } else {
  11699.             this.range.select();
  11700.         }
  11701.  
  11702.         // support: IE
  11703.         // Setting the text selection kills the button focus in IE, but
  11704.         // restoring the focus doesn't kill the selection.
  11705.         this.button.focus();
  11706.     },
  11707.  
  11708.     _documentClick: {
  11709.         mousedown: function( event ) {
  11710.             if ( !this.isOpen ) {
  11711.                 return;
  11712.             }
  11713.  
  11714.             if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
  11715.                 this.close( event );
  11716.             }
  11717.         }
  11718.     },
  11719.  
  11720.     _buttonEvents: {
  11721.  
  11722.         // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11723.         mousedown: function() {
  11724.             var selection;
  11725.  
  11726.             if ( window.getSelection ) {
  11727.                 selection = window.getSelection();
  11728.                 if ( selection.rangeCount ) {
  11729.                     this.range = selection.getRangeAt( 0 );
  11730.                 }
  11731.  
  11732.             // support: IE8
  11733.             } else {
  11734.                 this.range = document.selection.createRange();
  11735.             }
  11736.         },
  11737.  
  11738.         click: function( event ) {
  11739.             this._setSelection();
  11740.             this._toggle( event );
  11741.         },
  11742.  
  11743.         keydown: function( event ) {
  11744.             var preventDefault = true;
  11745.             switch ( event.keyCode ) {
  11746.                 case $.ui.keyCode.TAB:
  11747.                 case $.ui.keyCode.ESCAPE:
  11748.                     this.close( event );
  11749.                     preventDefault = false;
  11750.                     break;
  11751.                 case $.ui.keyCode.ENTER:
  11752.                     if ( this.isOpen ) {
  11753.                         this._selectFocusedItem( event );
  11754.                     }
  11755.                     break;
  11756.                 case $.ui.keyCode.UP:
  11757.                     if ( event.altKey ) {
  11758.                         this._toggle( event );
  11759.                     } else {
  11760.                         this._move( "prev", event );
  11761.                     }
  11762.                     break;
  11763.                 case $.ui.keyCode.DOWN:
  11764.                     if ( event.altKey ) {
  11765.                         this._toggle( event );
  11766.                     } else {
  11767.                         this._move( "next", event );
  11768.                     }
  11769.                     break;
  11770.                 case $.ui.keyCode.SPACE:
  11771.                     if ( this.isOpen ) {
  11772.                         this._selectFocusedItem( event );
  11773.                     } else {
  11774.                         this._toggle( event );
  11775.                     }
  11776.                     break;
  11777.                 case $.ui.keyCode.LEFT:
  11778.                     this._move( "prev", event );
  11779.                     break;
  11780.                 case $.ui.keyCode.RIGHT:
  11781.                     this._move( "next", event );
  11782.                     break;
  11783.                 case $.ui.keyCode.HOME:
  11784.                 case $.ui.keyCode.PAGE_UP:
  11785.                     this._move( "first", event );
  11786.                     break;
  11787.                 case $.ui.keyCode.END:
  11788.                 case $.ui.keyCode.PAGE_DOWN:
  11789.                     this._move( "last", event );
  11790.                     break;
  11791.                 default:
  11792.                     this.menu.trigger( event );
  11793.                     preventDefault = false;
  11794.             }
  11795.  
  11796.             if ( preventDefault ) {
  11797.                 event.preventDefault();
  11798.             }
  11799.         }
  11800.     },
  11801.  
  11802.     _selectFocusedItem: function( event ) {
  11803.         var item = this.menuItems.eq( this.focusIndex );
  11804.         if ( !item.hasClass( "ui-state-disabled" ) ) {
  11805.             this._select( item.data( "ui-selectmenu-item" ), event );
  11806.         }
  11807.     },
  11808.  
  11809.     _select: function( item, event ) {
  11810.         var oldIndex = this.element[ 0 ].selectedIndex;
  11811.  
  11812.         // Change native select element
  11813.         this.element[ 0 ].selectedIndex = item.index;
  11814.         this._setText( this.buttonText, item.label );
  11815.         this._setAria( item );
  11816.         this._trigger( "select", event, { item: item } );
  11817.  
  11818.         if ( item.index !== oldIndex ) {
  11819.             this._trigger( "change", event, { item: item } );
  11820.         }
  11821.  
  11822.         this.close( event );
  11823.     },
  11824.  
  11825.     _setAria: function( item ) {
  11826.         var id = this.menuItems.eq( item.index ).attr( "id" );
  11827.  
  11828.         this.button.attr({
  11829.             "aria-labelledby": id,
  11830.             "aria-activedescendant": id
  11831.         });
  11832.         this.menu.attr( "aria-activedescendant", id );
  11833.     },
  11834.  
  11835.     _setOption: function( key, value ) {
  11836.         if ( key === "icons" ) {
  11837.             this.button.find( "span.ui-icon" )
  11838.                 .removeClass( this.options.icons.button )
  11839.                 .addClass( value.button );
  11840.         }
  11841.  
  11842.         this._super( key, value );
  11843.  
  11844.         if ( key === "appendTo" ) {
  11845.             this.menuWrap.appendTo( this._appendTo() );
  11846.         }
  11847.  
  11848.         if ( key === "disabled" ) {
  11849.             this.menuInstance.option( "disabled", value );
  11850.             this.button
  11851.                 .toggleClass( "ui-state-disabled", value )
  11852.                 .attr( "aria-disabled", value );
  11853.  
  11854.             this.element.prop( "disabled", value );
  11855.             if ( value ) {
  11856.                 this.button.attr( "tabindex", -1 );
  11857.                 this.close();
  11858.             } else {
  11859.                 this.button.attr( "tabindex", 0 );
  11860.             }
  11861.         }
  11862.  
  11863.         if ( key === "width" ) {
  11864.             this._resizeButton();
  11865.         }
  11866.     },
  11867.  
  11868.     _appendTo: function() {
  11869.         var element = this.options.appendTo;
  11870.  
  11871.         if ( element ) {
  11872.             element = element.jquery || element.nodeType ?
  11873.                 $( element ) :
  11874.                 this.document.find( element ).eq( 0 );
  11875.         }
  11876.  
  11877.         if ( !element || !element[ 0 ] ) {
  11878.             element = this.element.closest( ".ui-front" );
  11879.         }
  11880.  
  11881.         if ( !element.length ) {
  11882.             element = this.document[ 0 ].body;
  11883.         }
  11884.  
  11885.         return element;
  11886.     },
  11887.  
  11888.     _toggleAttr: function() {
  11889.         this.button
  11890.             .toggleClass( "ui-corner-top", this.isOpen )
  11891.             .toggleClass( "ui-corner-all", !this.isOpen )
  11892.             .attr( "aria-expanded", this.isOpen );
  11893.         this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
  11894.         this.menu.attr( "aria-hidden", !this.isOpen );
  11895.     },
  11896.  
  11897.     _resizeButton: function() {
  11898.         var width = this.options.width;
  11899.  
  11900.         if ( !width ) {
  11901.             width = this.element.show().outerWidth();
  11902.             this.element.hide();
  11903.         }
  11904.  
  11905.         this.button.outerWidth( width );
  11906.     },
  11907.  
  11908.     _resizeMenu: function() {
  11909.         this.menu.outerWidth( Math.max(
  11910.             this.button.outerWidth(),
  11911.  
  11912.             // support: IE10
  11913.             // IE10 wraps long text (possibly a rounding bug)
  11914.             // so we add 1px to avoid the wrapping
  11915.             this.menu.width( "" ).outerWidth() + 1
  11916.         ) );
  11917.     },
  11918.  
  11919.     _getCreateOptions: function() {
  11920.         return { disabled: this.element.prop( "disabled" ) };
  11921.     },
  11922.  
  11923.     _parseOptions: function( options ) {
  11924.         var data = [];
  11925.         options.each(function( index, item ) {
  11926.             var option = $( item ),
  11927.                 optgroup = option.parent( "optgroup" );
  11928.             data.push({
  11929.                 element: option,
  11930.                 index: index,
  11931.                 value: option.val(),
  11932.                 label: option.text(),
  11933.                 optgroup: optgroup.attr( "label" ) || "",
  11934.                 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  11935.             });
  11936.         });
  11937.         this.items = data;
  11938.     },
  11939.  
  11940.     _destroy: function() {
  11941.         this.menuWrap.remove();
  11942.         this.button.remove();
  11943.         this.element.show();
  11944.         this.element.removeUniqueId();
  11945.         this.label.attr( "for", this.ids.element );
  11946.     }
  11947. });
  11948.  
  11949.  
  11950. /*!
  11951.  * jQuery UI Slider 1.11.4
  11952.  * http://jqueryui.com
  11953.  *
  11954.  * Copyright jQuery Foundation and other contributors
  11955.  * Released under the MIT license.
  11956.  * http://jquery.org/license
  11957.  *
  11958.  * http://api.jqueryui.com/slider/
  11959.  */
  11960.  
  11961.  
  11962. var slider = $.widget( "ui.slider", $.ui.mouse, {
  11963.     version: "1.11.4",
  11964.     widgetEventPrefix: "slide",
  11965.  
  11966.     options: {
  11967.         animate: false,
  11968.         distance: 0,
  11969.         max: 100,
  11970.         min: 0,
  11971.         orientation: "horizontal",
  11972.         range: false,
  11973.         step: 1,
  11974.         value: 0,
  11975.         values: null,
  11976.  
  11977.         // callbacks
  11978.         change: null,
  11979.         slide: null,
  11980.         start: null,
  11981.         stop: null
  11982.     },
  11983.  
  11984.     // number of pages in a slider
  11985.     // (how many times can you page up/down to go through the whole range)
  11986.     numPages: 5,
  11987.  
  11988.     _create: function() {
  11989.         this._keySliding = false;
  11990.         this._mouseSliding = false;
  11991.         this._animateOff = true;
  11992.         this._handleIndex = null;
  11993.         this._detectOrientation();
  11994.         this._mouseInit();
  11995.         this._calculateNewMax();
  11996.  
  11997.         this.element
  11998.             .addClass( "ui-slider" +
  11999.                 " ui-slider-" + this.orientation +
  12000.                 " ui-widget" +
  12001.                 " ui-widget-content" +
  12002.                 " ui-corner-all");
  12003.  
  12004.         this._refresh();
  12005.         this._setOption( "disabled", this.options.disabled );
  12006.  
  12007.         this._animateOff = false;
  12008.     },
  12009.  
  12010.     _refresh: function() {
  12011.         this._createRange();
  12012.         this._createHandles();
  12013.         this._setupEvents();
  12014.         this._refreshValue();
  12015.     },
  12016.  
  12017.     _createHandles: function() {
  12018.         var i, handleCount,
  12019.             options = this.options,
  12020.             existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
  12021.             handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
  12022.             handles = [];
  12023.  
  12024.         handleCount = ( options.values && options.values.length ) || 1;
  12025.  
  12026.         if ( existingHandles.length > handleCount ) {
  12027.             existingHandles.slice( handleCount ).remove();
  12028.             existingHandles = existingHandles.slice( 0, handleCount );
  12029.         }
  12030.  
  12031.         for ( i = existingHandles.length; i < handleCount; i++ ) {
  12032.             handles.push( handle );
  12033.         }
  12034.  
  12035.         this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  12036.  
  12037.         this.handle = this.handles.eq( 0 );
  12038.  
  12039.         this.handles.each(function( i ) {
  12040.             $( this ).data( "ui-slider-handle-index", i );
  12041.         });
  12042.     },
  12043.  
  12044.     _createRange: function() {
  12045.         var options = this.options,
  12046.             classes = "";
  12047.  
  12048.         if ( options.range ) {
  12049.             if ( options.range === true ) {
  12050.                 if ( !options.values ) {
  12051.                     options.values = [ this._valueMin(), this._valueMin() ];
  12052.                 } else if ( options.values.length && options.values.length !== 2 ) {
  12053.                     options.values = [ options.values[0], options.values[0] ];
  12054.                 } else if ( $.isArray( options.values ) ) {
  12055.                     options.values = options.values.slice(0);
  12056.                 }
  12057.             }
  12058.  
  12059.             if ( !this.range || !this.range.length ) {
  12060.                 this.range = $( "<div></div>" )
  12061.                     .appendTo( this.element );
  12062.  
  12063.                 classes = "ui-slider-range" +
  12064.                 // note: this isn't the most fittingly semantic framework class for this element,
  12065.                 // but worked best visually with a variety of themes
  12066.                 " ui-widget-header ui-corner-all";
  12067.             } else {
  12068.                 this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
  12069.                     // Handle range switching from true to min/max
  12070.                     .css({
  12071.                         "left": "",
  12072.                         "bottom": ""
  12073.                     });
  12074.             }
  12075.  
  12076.             this.range.addClass( classes +
  12077.                 ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
  12078.         } else {
  12079.             if ( this.range ) {
  12080.                 this.range.remove();
  12081.             }
  12082.             this.range = null;
  12083.         }
  12084.     },
  12085.  
  12086.     _setupEvents: function() {
  12087.         this._off( this.handles );
  12088.         this._on( this.handles, this._handleEvents );
  12089.         this._hoverable( this.handles );
  12090.         this._focusable( this.handles );
  12091.     },
  12092.  
  12093.     _destroy: function() {
  12094.         this.handles.remove();
  12095.         if ( this.range ) {
  12096.             this.range.remove();
  12097.         }
  12098.  
  12099.         this.element
  12100.             .removeClass( "ui-slider" +
  12101.                 " ui-slider-horizontal" +
  12102.                 " ui-slider-vertical" +
  12103.                 " ui-widget" +
  12104.                 " ui-widget-content" +
  12105.                 " ui-corner-all" );
  12106.  
  12107.         this._mouseDestroy();
  12108.     },
  12109.  
  12110.     _mouseCapture: function( event ) {
  12111.         var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  12112.             that = this,
  12113.             o = this.options;
  12114.  
  12115.         if ( o.disabled ) {
  12116.             return false;
  12117.         }
  12118.  
  12119.         this.elementSize = {
  12120.             width: this.element.outerWidth(),
  12121.             height: this.element.outerHeight()
  12122.         };
  12123.         this.elementOffset = this.element.offset();
  12124.  
  12125.         position = { x: event.pageX, y: event.pageY };
  12126.         normValue = this._normValueFromMouse( position );
  12127.         distance = this._valueMax() - this._valueMin() + 1;
  12128.         this.handles.each(function( i ) {
  12129.             var thisDistance = Math.abs( normValue - that.values(i) );
  12130.             if (( distance > thisDistance ) ||
  12131.                 ( distance === thisDistance &&
  12132.                     (i === that._lastChangedValue || that.values(i) === o.min ))) {
  12133.                 distance = thisDistance;
  12134.                 closestHandle = $( this );
  12135.                 index = i;
  12136.             }
  12137.         });
  12138.  
  12139.         allowed = this._start( event, index );
  12140.         if ( allowed === false ) {
  12141.             return false;
  12142.         }
  12143.         this._mouseSliding = true;
  12144.  
  12145.         this._handleIndex = index;
  12146.  
  12147.         closestHandle
  12148.             .addClass( "ui-state-active" )
  12149.             .focus();
  12150.  
  12151.         offset = closestHandle.offset();
  12152.         mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  12153.         this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  12154.             left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  12155.             top: event.pageY - offset.top -
  12156.                 ( closestHandle.height() / 2 ) -
  12157.                 ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
  12158.                 ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
  12159.                 ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
  12160.         };
  12161.  
  12162.         if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  12163.             this._slide( event, index, normValue );
  12164.         }
  12165.         this._animateOff = true;
  12166.         return true;
  12167.     },
  12168.  
  12169.     _mouseStart: function() {
  12170.         return true;
  12171.     },
  12172.  
  12173.     _mouseDrag: function( event ) {
  12174.         var position = { x: event.pageX, y: event.pageY },
  12175.             normValue = this._normValueFromMouse( position );
  12176.  
  12177.         this._slide( event, this._handleIndex, normValue );
  12178.  
  12179.         return false;
  12180.     },
  12181.  
  12182.     _mouseStop: function( event ) {
  12183.         this.handles.removeClass( "ui-state-active" );
  12184.         this._mouseSliding = false;
  12185.  
  12186.         this._stop( event, this._handleIndex );
  12187.         this._change( event, this._handleIndex );
  12188.  
  12189.         this._handleIndex = null;
  12190.         this._clickOffset = null;
  12191.         this._animateOff = false;
  12192.  
  12193.         return false;
  12194.     },
  12195.  
  12196.     _detectOrientation: function() {
  12197.         this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  12198.     },
  12199.  
  12200.     _normValueFromMouse: function( position ) {
  12201.         var pixelTotal,
  12202.             pixelMouse,
  12203.             percentMouse,
  12204.             valueTotal,
  12205.             valueMouse;
  12206.  
  12207.         if ( this.orientation === "horizontal" ) {
  12208.             pixelTotal = this.elementSize.width;
  12209.             pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
  12210.         } else {
  12211.             pixelTotal = this.elementSize.height;
  12212.             pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
  12213.         }
  12214.  
  12215.         percentMouse = ( pixelMouse / pixelTotal );
  12216.         if ( percentMouse > 1 ) {
  12217.             percentMouse = 1;
  12218.         }
  12219.         if ( percentMouse < 0 ) {
  12220.             percentMouse = 0;
  12221.         }
  12222.         if ( this.orientation === "vertical" ) {
  12223.             percentMouse = 1 - percentMouse;
  12224.         }
  12225.  
  12226.         valueTotal = this._valueMax() - this._valueMin();
  12227.         valueMouse = this._valueMin() + percentMouse * valueTotal;
  12228.  
  12229.         return this._trimAlignValue( valueMouse );
  12230.     },
  12231.  
  12232.     _start: function( event, index ) {
  12233.         var uiHash = {
  12234.             handle: this.handles[ index ],
  12235.             value: this.value()
  12236.         };
  12237.         if ( this.options.values && this.options.values.length ) {
  12238.             uiHash.value = this.values( index );
  12239.             uiHash.values = this.values();
  12240.         }
  12241.         return this._trigger( "start", event, uiHash );
  12242.     },
  12243.  
  12244.     _slide: function( event, index, newVal ) {
  12245.         var otherVal,
  12246.             newValues,
  12247.             allowed;
  12248.  
  12249.         if ( this.options.values && this.options.values.length ) {
  12250.             otherVal = this.values( index ? 0 : 1 );
  12251.  
  12252.             if ( ( this.options.values.length === 2 && this.options.range === true ) &&
  12253.                     ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
  12254.                 ) {
  12255.                 newVal = otherVal;
  12256.             }
  12257.  
  12258.             if ( newVal !== this.values( index ) ) {
  12259.                 newValues = this.values();
  12260.                 newValues[ index ] = newVal;
  12261.                 // A slide can be canceled by returning false from the slide callback
  12262.                 allowed = this._trigger( "slide", event, {
  12263.                     handle: this.handles[ index ],
  12264.                     value: newVal,
  12265.                     values: newValues
  12266.                 } );
  12267.                 otherVal = this.values( index ? 0 : 1 );
  12268.                 if ( allowed !== false ) {
  12269.                     this.values( index, newVal );
  12270.                 }
  12271.             }
  12272.         } else {
  12273.             if ( newVal !== this.value() ) {
  12274.                 // A slide can be canceled by returning false from the slide callback
  12275.                 allowed = this._trigger( "slide", event, {
  12276.                     handle: this.handles[ index ],
  12277.                     value: newVal
  12278.                 } );
  12279.                 if ( allowed !== false ) {
  12280.                     this.value( newVal );
  12281.                 }
  12282.             }
  12283.         }
  12284.     },
  12285.  
  12286.     _stop: function( event, index ) {
  12287.         var uiHash = {
  12288.             handle: this.handles[ index ],
  12289.             value: this.value()
  12290.         };
  12291.         if ( this.options.values && this.options.values.length ) {
  12292.             uiHash.value = this.values( index );
  12293.             uiHash.values = this.values();
  12294.         }
  12295.  
  12296.         this._trigger( "stop", event, uiHash );
  12297.     },
  12298.  
  12299.     _change: function( event, index ) {
  12300.         if ( !this._keySliding && !this._mouseSliding ) {
  12301.             var uiHash = {
  12302.                 handle: this.handles[ index ],
  12303.                 value: this.value()
  12304.             };
  12305.             if ( this.options.values && this.options.values.length ) {
  12306.                 uiHash.value = this.values( index );
  12307.                 uiHash.values = this.values();
  12308.             }
  12309.  
  12310.             //store the last changed value index for reference when handles overlap
  12311.             this._lastChangedValue = index;
  12312.  
  12313.             this._trigger( "change", event, uiHash );
  12314.         }
  12315.     },
  12316.  
  12317.     value: function( newValue ) {
  12318.         if ( arguments.length ) {
  12319.             this.options.value = this._trimAlignValue( newValue );
  12320.             this._refreshValue();
  12321.             this._change( null, 0 );
  12322.             return;
  12323.         }
  12324.  
  12325.         return this._value();
  12326.     },
  12327.  
  12328.     values: function( index, newValue ) {
  12329.         var vals,
  12330.             newValues,
  12331.             i;
  12332.  
  12333.         if ( arguments.length > 1 ) {
  12334.             this.options.values[ index ] = this._trimAlignValue( newValue );
  12335.             this._refreshValue();
  12336.             this._change( null, index );
  12337.             return;
  12338.         }
  12339.  
  12340.         if ( arguments.length ) {
  12341.             if ( $.isArray( arguments[ 0 ] ) ) {
  12342.                 vals = this.options.values;
  12343.                 newValues = arguments[ 0 ];
  12344.                 for ( i = 0; i < vals.length; i += 1 ) {
  12345.                     vals[ i ] = this._trimAlignValue( newValues[ i ] );
  12346.                     this._change( null, i );
  12347.                 }
  12348.                 this._refreshValue();
  12349.             } else {
  12350.                 if ( this.options.values && this.options.values.length ) {
  12351.                     return this._values( index );
  12352.                 } else {
  12353.                     return this.value();
  12354.                 }
  12355.             }
  12356.         } else {
  12357.             return this._values();
  12358.         }
  12359.     },
  12360.  
  12361.     _setOption: function( key, value ) {
  12362.         var i,
  12363.             valsLength = 0;
  12364.  
  12365.         if ( key === "range" && this.options.range === true ) {
  12366.             if ( value === "min" ) {
  12367.                 this.options.value = this._values( 0 );
  12368.                 this.options.values = null;
  12369.             } else if ( value === "max" ) {
  12370.                 this.options.value = this._values( this.options.values.length - 1 );
  12371.                 this.options.values = null;
  12372.             }
  12373.         }
  12374.  
  12375.         if ( $.isArray( this.options.values ) ) {
  12376.             valsLength = this.options.values.length;
  12377.         }
  12378.  
  12379.         if ( key === "disabled" ) {
  12380.             this.element.toggleClass( "ui-state-disabled", !!value );
  12381.         }
  12382.  
  12383.         this._super( key, value );
  12384.  
  12385.         switch ( key ) {
  12386.             case "orientation":
  12387.                 this._detectOrientation();
  12388.                 this.element
  12389.                     .removeClass( "ui-slider-horizontal ui-slider-vertical" )
  12390.                     .addClass( "ui-slider-" + this.orientation );
  12391.                 this._refreshValue();
  12392.  
  12393.                 // Reset positioning from previous orientation
  12394.                 this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  12395.                 break;
  12396.             case "value":
  12397.                 this._animateOff = true;
  12398.                 this._refreshValue();
  12399.                 this._change( null, 0 );
  12400.                 this._animateOff = false;
  12401.                 break;
  12402.             case "values":
  12403.                 this._animateOff = true;
  12404.                 this._refreshValue();
  12405.                 for ( i = 0; i < valsLength; i += 1 ) {
  12406.                     this._change( null, i );
  12407.                 }
  12408.                 this._animateOff = false;
  12409.                 break;
  12410.             case "step":
  12411.             case "min":
  12412.             case "max":
  12413.                 this._animateOff = true;
  12414.                 this._calculateNewMax();
  12415.                 this._refreshValue();
  12416.                 this._animateOff = false;
  12417.                 break;
  12418.             case "range":
  12419.                 this._animateOff = true;
  12420.                 this._refresh();
  12421.                 this._animateOff = false;
  12422.                 break;
  12423.         }
  12424.     },
  12425.  
  12426.     //internal value getter
  12427.     // _value() returns value trimmed by min and max, aligned by step
  12428.     _value: function() {
  12429.         var val = this.options.value;
  12430.         val = this._trimAlignValue( val );
  12431.  
  12432.         return val;
  12433.     },
  12434.  
  12435.     //internal values getter
  12436.     // _values() returns array of values trimmed by min and max, aligned by step
  12437.     // _values( index ) returns single value trimmed by min and max, aligned by step
  12438.     _values: function( index ) {
  12439.         var val,
  12440.             vals,
  12441.             i;
  12442.  
  12443.         if ( arguments.length ) {
  12444.             val = this.options.values[ index ];
  12445.             val = this._trimAlignValue( val );
  12446.  
  12447.             return val;
  12448.         } else if ( this.options.values && this.options.values.length ) {
  12449.             // .slice() creates a copy of the array
  12450.             // this copy gets trimmed by min and max and then returned
  12451.             vals = this.options.values.slice();
  12452.             for ( i = 0; i < vals.length; i += 1) {
  12453.                 vals[ i ] = this._trimAlignValue( vals[ i ] );
  12454.             }
  12455.  
  12456.             return vals;
  12457.         } else {
  12458.             return [];
  12459.         }
  12460.     },
  12461.  
  12462.     // returns the step-aligned value that val is closest to, between (inclusive) min and max
  12463.     _trimAlignValue: function( val ) {
  12464.         if ( val <= this._valueMin() ) {
  12465.             return this._valueMin();
  12466.         }
  12467.         if ( val >= this._valueMax() ) {
  12468.             return this._valueMax();
  12469.         }
  12470.         var step = ( this.options.step > 0 ) ? this.options.step : 1,
  12471.             valModStep = (val - this._valueMin()) % step,
  12472.             alignValue = val - valModStep;
  12473.  
  12474.         if ( Math.abs(valModStep) * 2 >= step ) {
  12475.             alignValue += ( valModStep > 0 ) ? step : ( -step );
  12476.         }
  12477.  
  12478.         // Since JavaScript has problems with large floats, round
  12479.         // the final value to 5 digits after the decimal point (see #4124)
  12480.         return parseFloat( alignValue.toFixed(5) );
  12481.     },
  12482.  
  12483.     _calculateNewMax: function() {
  12484.         var max = this.options.max,
  12485.             min = this._valueMin(),
  12486.             step = this.options.step,
  12487.             aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
  12488.         max = aboveMin + min;
  12489.         this.max = parseFloat( max.toFixed( this._precision() ) );
  12490.     },
  12491.  
  12492.     _precision: function() {
  12493.         var precision = this._precisionOf( this.options.step );
  12494.         if ( this.options.min !== null ) {
  12495.             precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12496.         }
  12497.         return precision;
  12498.     },
  12499.  
  12500.     _precisionOf: function( num ) {
  12501.         var str = num.toString(),
  12502.             decimal = str.indexOf( "." );
  12503.         return decimal === -1 ? 0 : str.length - decimal - 1;
  12504.     },
  12505.  
  12506.     _valueMin: function() {
  12507.         return this.options.min;
  12508.     },
  12509.  
  12510.     _valueMax: function() {
  12511.         return this.max;
  12512.     },
  12513.  
  12514.     _refreshValue: function() {
  12515.         var lastValPercent, valPercent, value, valueMin, valueMax,
  12516.             oRange = this.options.range,
  12517.             o = this.options,
  12518.             that = this,
  12519.             animate = ( !this._animateOff ) ? o.animate : false,
  12520.             _set = {};
  12521.  
  12522.         if ( this.options.values && this.options.values.length ) {
  12523.             this.handles.each(function( i ) {
  12524.                 valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
  12525.                 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12526.                 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12527.                 if ( that.options.range === true ) {
  12528.                     if ( that.orientation === "horizontal" ) {
  12529.                         if ( i === 0 ) {
  12530.                             that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
  12531.                         }
  12532.                         if ( i === 1 ) {
  12533.                             that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  12534.                         }
  12535.                     } else {
  12536.                         if ( i === 0 ) {
  12537.                             that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
  12538.                         }
  12539.                         if ( i === 1 ) {
  12540.                             that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  12541.                         }
  12542.                     }
  12543.                 }
  12544.                 lastValPercent = valPercent;
  12545.             });
  12546.         } else {
  12547.             value = this.value();
  12548.             valueMin = this._valueMin();
  12549.             valueMax = this._valueMax();
  12550.             valPercent = ( valueMax !== valueMin ) ?
  12551.                     ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  12552.                     0;
  12553.             _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12554.             this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12555.  
  12556.             if ( oRange === "min" && this.orientation === "horizontal" ) {
  12557.                 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
  12558.             }
  12559.             if ( oRange === "max" && this.orientation === "horizontal" ) {
  12560.                 this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  12561.             }
  12562.             if ( oRange === "min" && this.orientation === "vertical" ) {
  12563.                 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
  12564.             }
  12565.             if ( oRange === "max" && this.orientation === "vertical" ) {
  12566.                 this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  12567.             }
  12568.         }
  12569.     },
  12570.  
  12571.     _handleEvents: {
  12572.         keydown: function( event ) {
  12573.             var allowed, curVal, newVal, step,
  12574.                 index = $( event.target ).data( "ui-slider-handle-index" );
  12575.  
  12576.             switch ( event.keyCode ) {
  12577.                 case $.ui.keyCode.HOME:
  12578.                 case $.ui.keyCode.END:
  12579.                 case $.ui.keyCode.PAGE_UP:
  12580.                 case $.ui.keyCode.PAGE_DOWN:
  12581.                 case $.ui.keyCode.UP:
  12582.                 case $.ui.keyCode.RIGHT:
  12583.                 case $.ui.keyCode.DOWN:
  12584.                 case $.ui.keyCode.LEFT:
  12585.                     event.preventDefault();
  12586.                     if ( !this._keySliding ) {
  12587.                         this._keySliding = true;
  12588.                         $( event.target ).addClass( "ui-state-active" );
  12589.                         allowed = this._start( event, index );
  12590.                         if ( allowed === false ) {
  12591.                             return;
  12592.                         }
  12593.                     }
  12594.                     break;
  12595.             }
  12596.  
  12597.             step = this.options.step;
  12598.             if ( this.options.values && this.options.values.length ) {
  12599.                 curVal = newVal = this.values( index );
  12600.             } else {
  12601.                 curVal = newVal = this.value();
  12602.             }
  12603.  
  12604.             switch ( event.keyCode ) {
  12605.                 case $.ui.keyCode.HOME:
  12606.                     newVal = this._valueMin();
  12607.                     break;
  12608.                 case $.ui.keyCode.END:
  12609.                     newVal = this._valueMax();
  12610.                     break;
  12611.                 case $.ui.keyCode.PAGE_UP:
  12612.                     newVal = this._trimAlignValue(
  12613.                         curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  12614.                     );
  12615.                     break;
  12616.                 case $.ui.keyCode.PAGE_DOWN:
  12617.                     newVal = this._trimAlignValue(
  12618.                         curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
  12619.                     break;
  12620.                 case $.ui.keyCode.UP:
  12621.                 case $.ui.keyCode.RIGHT:
  12622.                     if ( curVal === this._valueMax() ) {
  12623.                         return;
  12624.                     }
  12625.                     newVal = this._trimAlignValue( curVal + step );
  12626.                     break;
  12627.                 case $.ui.keyCode.DOWN:
  12628.                 case $.ui.keyCode.LEFT:
  12629.                     if ( curVal === this._valueMin() ) {
  12630.                         return;
  12631.                     }
  12632.                     newVal = this._trimAlignValue( curVal - step );
  12633.                     break;
  12634.             }
  12635.  
  12636.             this._slide( event, index, newVal );
  12637.         },
  12638.         keyup: function( event ) {
  12639.             var index = $( event.target ).data( "ui-slider-handle-index" );
  12640.  
  12641.             if ( this._keySliding ) {
  12642.                 this._keySliding = false;
  12643.                 this._stop( event, index );
  12644.                 this._change( event, index );
  12645.                 $( event.target ).removeClass( "ui-state-active" );
  12646.             }
  12647.         }
  12648.     }
  12649. });
  12650.  
  12651.  
  12652. /*!
  12653.  * jQuery UI Spinner 1.11.4
  12654.  * http://jqueryui.com
  12655.  *
  12656.  * Copyright jQuery Foundation and other contributors
  12657.  * Released under the MIT license.
  12658.  * http://jquery.org/license
  12659.  *
  12660.  * http://api.jqueryui.com/spinner/
  12661.  */
  12662.  
  12663.  
  12664. function spinner_modifier( fn ) {
  12665.     return function() {
  12666.         var previous = this.element.val();
  12667.         fn.apply( this, arguments );
  12668.         this._refresh();
  12669.         if ( previous !== this.element.val() ) {
  12670.             this._trigger( "change" );
  12671.         }
  12672.     };
  12673. }
  12674.  
  12675. var spinner = $.widget( "ui.spinner", {
  12676.     version: "1.11.4",
  12677.     defaultElement: "<input>",
  12678.     widgetEventPrefix: "spin",
  12679.     options: {
  12680.         culture: null,
  12681.         icons: {
  12682.             down: "ui-icon-triangle-1-s",
  12683.             up: "ui-icon-triangle-1-n"
  12684.         },
  12685.         incremental: true,
  12686.         max: null,
  12687.         min: null,
  12688.         numberFormat: null,
  12689.         page: 10,
  12690.         step: 1,
  12691.  
  12692.         change: null,
  12693.         spin: null,
  12694.         start: null,
  12695.         stop: null
  12696.     },
  12697.  
  12698.     _create: function() {
  12699.         // handle string values that need to be parsed
  12700.         this._setOption( "max", this.options.max );
  12701.         this._setOption( "min", this.options.min );
  12702.         this._setOption( "step", this.options.step );
  12703.  
  12704.         // Only format if there is a value, prevents the field from being marked
  12705.         // as invalid in Firefox, see #9573.
  12706.         if ( this.value() !== "" ) {
  12707.             // Format the value, but don't constrain.
  12708.             this._value( this.element.val(), true );
  12709.         }
  12710.  
  12711.         this._draw();
  12712.         this._on( this._events );
  12713.         this._refresh();
  12714.  
  12715.         // turning off autocomplete prevents the browser from remembering the
  12716.         // value when navigating through history, so we re-enable autocomplete
  12717.         // if the page is unloaded before the widget is destroyed. #7790
  12718.         this._on( this.window, {
  12719.             beforeunload: function() {
  12720.                 this.element.removeAttr( "autocomplete" );
  12721.             }
  12722.         });
  12723.     },
  12724.  
  12725.     _getCreateOptions: function() {
  12726.         var options = {},
  12727.             element = this.element;
  12728.  
  12729.         $.each( [ "min", "max", "step" ], function( i, option ) {
  12730.             var value = element.attr( option );
  12731.             if ( value !== undefined && value.length ) {
  12732.                 options[ option ] = value;
  12733.             }
  12734.         });
  12735.  
  12736.         return options;
  12737.     },
  12738.  
  12739.     _events: {
  12740.         keydown: function( event ) {
  12741.             if ( this._start( event ) && this._keydown( event ) ) {
  12742.                 event.preventDefault();
  12743.             }
  12744.         },
  12745.         keyup: "_stop",
  12746.         focus: function() {
  12747.             this.previous = this.element.val();
  12748.         },
  12749.         blur: function( event ) {
  12750.             if ( this.cancelBlur ) {
  12751.                 delete this.cancelBlur;
  12752.                 return;
  12753.             }
  12754.  
  12755.             this._stop();
  12756.             this._refresh();
  12757.             if ( this.previous !== this.element.val() ) {
  12758.                 this._trigger( "change", event );
  12759.             }
  12760.         },
  12761.         mousewheel: function( event, delta ) {
  12762.             if ( !delta ) {
  12763.                 return;
  12764.             }
  12765.             if ( !this.spinning && !this._start( event ) ) {
  12766.                 return false;
  12767.             }
  12768.  
  12769.             this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
  12770.             clearTimeout( this.mousewheelTimer );
  12771.             this.mousewheelTimer = this._delay(function() {
  12772.                 if ( this.spinning ) {
  12773.                     this._stop( event );
  12774.                 }
  12775.             }, 100 );
  12776.             event.preventDefault();
  12777.         },
  12778.         "mousedown .ui-spinner-button": function( event ) {
  12779.             var previous;
  12780.  
  12781.             // We never want the buttons to have focus; whenever the user is
  12782.             // interacting with the spinner, the focus should be on the input.
  12783.             // If the input is focused then this.previous is properly set from
  12784.             // when the input first received focus. If the input is not focused
  12785.             // then we need to set this.previous based on the value before spinning.
  12786.             previous = this.element[0] === this.document[0].activeElement ?
  12787.                 this.previous : this.element.val();
  12788.             function checkFocus() {
  12789.                 var isActive = this.element[0] === this.document[0].activeElement;
  12790.                 if ( !isActive ) {
  12791.                     this.element.focus();
  12792.                     this.previous = previous;
  12793.                     // support: IE
  12794.                     // IE sets focus asynchronously, so we need to check if focus
  12795.                     // moved off of the input because the user clicked on the button.
  12796.                     this._delay(function() {
  12797.                         this.previous = previous;
  12798.                     });
  12799.                 }
  12800.             }
  12801.  
  12802.             // ensure focus is on (or stays on) the text field
  12803.             event.preventDefault();
  12804.             checkFocus.call( this );
  12805.  
  12806.             // support: IE
  12807.             // IE doesn't prevent moving focus even with event.preventDefault()
  12808.             // so we set a flag to know when we should ignore the blur event
  12809.             // and check (again) if focus moved off of the input.
  12810.             this.cancelBlur = true;
  12811.             this._delay(function() {
  12812.                 delete this.cancelBlur;
  12813.                 checkFocus.call( this );
  12814.             });
  12815.  
  12816.             if ( this._start( event ) === false ) {
  12817.                 return;
  12818.             }
  12819.  
  12820.             this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12821.         },
  12822.         "mouseup .ui-spinner-button": "_stop",
  12823.         "mouseenter .ui-spinner-button": function( event ) {
  12824.             // button will add ui-state-active if mouse was down while mouseleave and kept down
  12825.             if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
  12826.                 return;
  12827.             }
  12828.  
  12829.             if ( this._start( event ) === false ) {
  12830.                 return false;
  12831.             }
  12832.             this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12833.         },
  12834.         // TODO: do we really want to consider this a stop?
  12835.         // shouldn't we just stop the repeater and wait until mouseup before
  12836.         // we trigger the stop event?
  12837.         "mouseleave .ui-spinner-button": "_stop"
  12838.     },
  12839.  
  12840.     _draw: function() {
  12841.         var uiSpinner = this.uiSpinner = this.element
  12842.             .addClass( "ui-spinner-input" )
  12843.             .attr( "autocomplete", "off" )
  12844.             .wrap( this._uiSpinnerHtml() )
  12845.             .parent()
  12846.                 // add buttons
  12847.                 .append( this._buttonHtml() );
  12848.  
  12849.         this.element.attr( "role", "spinbutton" );
  12850.  
  12851.         // button bindings
  12852.         this.buttons = uiSpinner.find( ".ui-spinner-button" )
  12853.             .attr( "tabIndex", -1 )
  12854.             .button()
  12855.             .removeClass( "ui-corner-all" );
  12856.  
  12857.         // IE 6 doesn't understand height: 50% for the buttons
  12858.         // unless the wrapper has an explicit height
  12859.         if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
  12860.                 uiSpinner.height() > 0 ) {
  12861.             uiSpinner.height( uiSpinner.height() );
  12862.         }
  12863.  
  12864.         // disable spinner if element was already disabled
  12865.         if ( this.options.disabled ) {
  12866.             this.disable();
  12867.         }
  12868.     },
  12869.  
  12870.     _keydown: function( event ) {
  12871.         var options = this.options,
  12872.             keyCode = $.ui.keyCode;
  12873.  
  12874.         switch ( event.keyCode ) {
  12875.         case keyCode.UP:
  12876.             this._repeat( null, 1, event );
  12877.             return true;
  12878.         case keyCode.DOWN:
  12879.             this._repeat( null, -1, event );
  12880.             return true;
  12881.         case keyCode.PAGE_UP:
  12882.             this._repeat( null, options.page, event );
  12883.             return true;
  12884.         case keyCode.PAGE_DOWN:
  12885.             this._repeat( null, -options.page, event );
  12886.             return true;
  12887.         }
  12888.  
  12889.         return false;
  12890.     },
  12891.  
  12892.     _uiSpinnerHtml: function() {
  12893.         return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
  12894.     },
  12895.  
  12896.     _buttonHtml: function() {
  12897.         return "" +
  12898.             "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
  12899.                 "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
  12900.             "</a>" +
  12901.             "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
  12902.                 "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
  12903.             "</a>";
  12904.     },
  12905.  
  12906.     _start: function( event ) {
  12907.         if ( !this.spinning && this._trigger( "start", event ) === false ) {
  12908.             return false;
  12909.         }
  12910.  
  12911.         if ( !this.counter ) {
  12912.             this.counter = 1;
  12913.         }
  12914.         this.spinning = true;
  12915.         return true;
  12916.     },
  12917.  
  12918.     _repeat: function( i, steps, event ) {
  12919.         i = i || 500;
  12920.  
  12921.         clearTimeout( this.timer );
  12922.         this.timer = this._delay(function() {
  12923.             this._repeat( 40, steps, event );
  12924.         }, i );
  12925.  
  12926.         this._spin( steps * this.options.step, event );
  12927.     },
  12928.  
  12929.     _spin: function( step, event ) {
  12930.         var value = this.value() || 0;
  12931.  
  12932.         if ( !this.counter ) {
  12933.             this.counter = 1;
  12934.         }
  12935.  
  12936.         value = this._adjustValue( value + step * this._increment( this.counter ) );
  12937.  
  12938.         if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
  12939.             this._value( value );
  12940.             this.counter++;
  12941.         }
  12942.     },
  12943.  
  12944.     _increment: function( i ) {
  12945.         var incremental = this.options.incremental;
  12946.  
  12947.         if ( incremental ) {
  12948.             return $.isFunction( incremental ) ?
  12949.                 incremental( i ) :
  12950.                 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
  12951.         }
  12952.  
  12953.         return 1;
  12954.     },
  12955.  
  12956.     _precision: function() {
  12957.         var precision = this._precisionOf( this.options.step );
  12958.         if ( this.options.min !== null ) {
  12959.             precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12960.         }
  12961.         return precision;
  12962.     },
  12963.  
  12964.     _precisionOf: function( num ) {
  12965.         var str = num.toString(),
  12966.             decimal = str.indexOf( "." );
  12967.         return decimal === -1 ? 0 : str.length - decimal - 1;
  12968.     },
  12969.  
  12970.     _adjustValue: function( value ) {
  12971.         var base, aboveMin,
  12972.             options = this.options;
  12973.  
  12974.         // make sure we're at a valid step
  12975.         // - find out where we are relative to the base (min or 0)
  12976.         base = options.min !== null ? options.min : 0;
  12977.         aboveMin = value - base;
  12978.         // - round to the nearest step
  12979.         aboveMin = Math.round(aboveMin / options.step) * options.step;
  12980.         // - rounding is based on 0, so adjust back to our base
  12981.         value = base + aboveMin;
  12982.  
  12983.         // fix precision from bad JS floating point math
  12984.         value = parseFloat( value.toFixed( this._precision() ) );
  12985.  
  12986.         // clamp the value
  12987.         if ( options.max !== null && value > options.max) {
  12988.             return options.max;
  12989.         }
  12990.         if ( options.min !== null && value < options.min ) {
  12991.             return options.min;
  12992.         }
  12993.  
  12994.         return value;
  12995.     },
  12996.  
  12997.     _stop: function( event ) {
  12998.         if ( !this.spinning ) {
  12999.             return;
  13000.         }
  13001.  
  13002.         clearTimeout( this.timer );
  13003.         clearTimeout( this.mousewheelTimer );
  13004.         this.counter = 0;
  13005.         this.spinning = false;
  13006.         this._trigger( "stop", event );
  13007.     },
  13008.  
  13009.     _setOption: function( key, value ) {
  13010.         if ( key === "culture" || key === "numberFormat" ) {
  13011.             var prevValue = this._parse( this.element.val() );
  13012.             this.options[ key ] = value;
  13013.             this.element.val( this._format( prevValue ) );
  13014.             return;
  13015.         }
  13016.  
  13017.         if ( key === "max" || key === "min" || key === "step" ) {
  13018.             if ( typeof value === "string" ) {
  13019.                 value = this._parse( value );
  13020.             }
  13021.         }
  13022.         if ( key === "icons" ) {
  13023.             this.buttons.first().find( ".ui-icon" )
  13024.                 .removeClass( this.options.icons.up )
  13025.                 .addClass( value.up );
  13026.             this.buttons.last().find( ".ui-icon" )
  13027.                 .removeClass( this.options.icons.down )
  13028.                 .addClass( value.down );
  13029.         }
  13030.  
  13031.         this._super( key, value );
  13032.  
  13033.         if ( key === "disabled" ) {
  13034.             this.widget().toggleClass( "ui-state-disabled", !!value );
  13035.             this.element.prop( "disabled", !!value );
  13036.             this.buttons.button( value ? "disable" : "enable" );
  13037.         }
  13038.     },
  13039.  
  13040.     _setOptions: spinner_modifier(function( options ) {
  13041.         this._super( options );
  13042.     }),
  13043.  
  13044.     _parse: function( val ) {
  13045.         if ( typeof val === "string" && val !== "" ) {
  13046.             val = window.Globalize && this.options.numberFormat ?
  13047.                 Globalize.parseFloat( val, 10, this.options.culture ) : +val;
  13048.         }
  13049.         return val === "" || isNaN( val ) ? null : val;
  13050.     },
  13051.  
  13052.     _format: function( value ) {
  13053.         if ( value === "" ) {
  13054.             return "";
  13055.         }
  13056.         return window.Globalize && this.options.numberFormat ?
  13057.             Globalize.format( value, this.options.numberFormat, this.options.culture ) :
  13058.             value;
  13059.     },
  13060.  
  13061.     _refresh: function() {
  13062.         this.element.attr({
  13063.             "aria-valuemin": this.options.min,
  13064.             "aria-valuemax": this.options.max,
  13065.             // TODO: what should we do with values that can't be parsed?
  13066.             "aria-valuenow": this._parse( this.element.val() )
  13067.         });
  13068.     },
  13069.  
  13070.     isValid: function() {
  13071.         var value = this.value();
  13072.  
  13073.         // null is invalid
  13074.         if ( value === null ) {
  13075.             return false;
  13076.         }
  13077.  
  13078.         // if value gets adjusted, it's invalid
  13079.         return value === this._adjustValue( value );
  13080.     },
  13081.  
  13082.     // update the value without triggering change
  13083.     _value: function( value, allowAny ) {
  13084.         var parsed;
  13085.         if ( value !== "" ) {
  13086.             parsed = this._parse( value );
  13087.             if ( parsed !== null ) {
  13088.                 if ( !allowAny ) {
  13089.                     parsed = this._adjustValue( parsed );
  13090.                 }
  13091.                 value = this._format( parsed );
  13092.             }
  13093.         }
  13094.         this.element.val( value );
  13095.         this._refresh();
  13096.     },
  13097.  
  13098.     _destroy: function() {
  13099.         this.element
  13100.             .removeClass( "ui-spinner-input" )
  13101.             .prop( "disabled", false )
  13102.             .removeAttr( "autocomplete" )
  13103.             .removeAttr( "role" )
  13104.             .removeAttr( "aria-valuemin" )
  13105.             .removeAttr( "aria-valuemax" )
  13106.             .removeAttr( "aria-valuenow" );
  13107.         this.uiSpinner.replaceWith( this.element );
  13108.     },
  13109.  
  13110.     stepUp: spinner_modifier(function( steps ) {
  13111.         this._stepUp( steps );
  13112.     }),
  13113.     _stepUp: function( steps ) {
  13114.         if ( this._start() ) {
  13115.             this._spin( (steps || 1) * this.options.step );
  13116.             this._stop();
  13117.         }
  13118.     },
  13119.  
  13120.     stepDown: spinner_modifier(function( steps ) {
  13121.         this._stepDown( steps );
  13122.     }),
  13123.     _stepDown: function( steps ) {
  13124.         if ( this._start() ) {
  13125.             this._spin( (steps || 1) * -this.options.step );
  13126.             this._stop();
  13127.         }
  13128.     },
  13129.  
  13130.     pageUp: spinner_modifier(function( pages ) {
  13131.         this._stepUp( (pages || 1) * this.options.page );
  13132.     }),
  13133.  
  13134.     pageDown: spinner_modifier(function( pages ) {
  13135.         this._stepDown( (pages || 1) * this.options.page );
  13136.     }),
  13137.  
  13138.     value: function( newVal ) {
  13139.         if ( !arguments.length ) {
  13140.             return this._parse( this.element.val() );
  13141.         }
  13142.         spinner_modifier( this._value ).call( this, newVal );
  13143.     },
  13144.  
  13145.     widget: function() {
  13146.         return this.uiSpinner;
  13147.     }
  13148. });
  13149.  
  13150.  
  13151. /*!
  13152.  * jQuery UI Tabs 1.11.4
  13153.  * http://jqueryui.com
  13154.  *
  13155.  * Copyright jQuery Foundation and other contributors
  13156.  * Released under the MIT license.
  13157.  * http://jquery.org/license
  13158.  *
  13159.  * http://api.jqueryui.com/tabs/
  13160.  */
  13161.  
  13162.  
  13163. var tabs = $.widget( "ui.tabs", {
  13164.     version: "1.11.4",
  13165.     delay: 300,
  13166.     options: {
  13167.         active: null,
  13168.         collapsible: false,
  13169.         event: "click",
  13170.         heightStyle: "content",
  13171.         hide: null,
  13172.         show: null,
  13173.  
  13174.         // callbacks
  13175.         activate: null,
  13176.         beforeActivate: null,
  13177.         beforeLoad: null,
  13178.         load: null
  13179.     },
  13180.  
  13181.     _isLocal: (function() {
  13182.         var rhash = /#.*$/;
  13183.  
  13184.         return function( anchor ) {
  13185.             var anchorUrl, locationUrl;
  13186.  
  13187.             // support: IE7
  13188.             // IE7 doesn't normalize the href property when set via script (#9317)
  13189.             anchor = anchor.cloneNode( false );
  13190.  
  13191.             anchorUrl = anchor.href.replace( rhash, "" );
  13192.             locationUrl = location.href.replace( rhash, "" );
  13193.  
  13194.             // decoding may throw an error if the URL isn't UTF-8 (#9518)
  13195.             try {
  13196.                 anchorUrl = decodeURIComponent( anchorUrl );
  13197.             } catch ( error ) {}
  13198.             try {
  13199.                 locationUrl = decodeURIComponent( locationUrl );
  13200.             } catch ( error ) {}
  13201.  
  13202.             return anchor.hash.length > 1 && anchorUrl === locationUrl;
  13203.         };
  13204.     })(),
  13205.  
  13206.     _create: function() {
  13207.         var that = this,
  13208.             options = this.options;
  13209.  
  13210.         this.running = false;
  13211.  
  13212.         this.element
  13213.             .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
  13214.             .toggleClass( "ui-tabs-collapsible", options.collapsible );
  13215.  
  13216.         this._processTabs();
  13217.         options.active = this._initialActive();
  13218.  
  13219.         // Take disabling tabs via class attribute from HTML
  13220.         // into account and update option properly.
  13221.         if ( $.isArray( options.disabled ) ) {
  13222.             options.disabled = $.unique( options.disabled.concat(
  13223.                 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
  13224.                     return that.tabs.index( li );
  13225.                 })
  13226.             ) ).sort();
  13227.         }
  13228.  
  13229.         // check for length avoids error when initializing empty list
  13230.         if ( this.options.active !== false && this.anchors.length ) {
  13231.             this.active = this._findActive( options.active );
  13232.         } else {
  13233.             this.active = $();
  13234.         }
  13235.  
  13236.         this._refresh();
  13237.  
  13238.         if ( this.active.length ) {
  13239.             this.load( options.active );
  13240.         }
  13241.     },
  13242.  
  13243.     _initialActive: function() {
  13244.         var active = this.options.active,
  13245.             collapsible = this.options.collapsible,
  13246.             locationHash = location.hash.substring( 1 );
  13247.  
  13248.         if ( active === null ) {
  13249.             // check the fragment identifier in the URL
  13250.             if ( locationHash ) {
  13251.                 this.tabs.each(function( i, tab ) {
  13252.                     if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
  13253.                         active = i;
  13254.                         return false;
  13255.                     }
  13256.                 });
  13257.             }
  13258.  
  13259.             // check for a tab marked active via a class
  13260.             if ( active === null ) {
  13261.                 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
  13262.             }
  13263.  
  13264.             // no active tab, set to false
  13265.             if ( active === null || active === -1 ) {
  13266.                 active = this.tabs.length ? 0 : false;
  13267.             }
  13268.         }
  13269.  
  13270.         // handle numbers: negative, out of range
  13271.         if ( active !== false ) {
  13272.             active = this.tabs.index( this.tabs.eq( active ) );
  13273.             if ( active === -1 ) {
  13274.                 active = collapsible ? false : 0;
  13275.             }
  13276.         }
  13277.  
  13278.         // don't allow collapsible: false and active: false
  13279.         if ( !collapsible && active === false && this.anchors.length ) {
  13280.             active = 0;
  13281.         }
  13282.  
  13283.         return active;
  13284.     },
  13285.  
  13286.     _getCreateEventData: function() {
  13287.         return {
  13288.             tab: this.active,
  13289.             panel: !this.active.length ? $() : this._getPanelForTab( this.active )
  13290.         };
  13291.     },
  13292.  
  13293.     _tabKeydown: function( event ) {
  13294.         var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
  13295.             selectedIndex = this.tabs.index( focusedTab ),
  13296.             goingForward = true;
  13297.  
  13298.         if ( this._handlePageNav( event ) ) {
  13299.             return;
  13300.         }
  13301.  
  13302.         switch ( event.keyCode ) {
  13303.             case $.ui.keyCode.RIGHT:
  13304.             case $.ui.keyCode.DOWN:
  13305.                 selectedIndex++;
  13306.                 break;
  13307.             case $.ui.keyCode.UP:
  13308.             case $.ui.keyCode.LEFT:
  13309.                 goingForward = false;
  13310.                 selectedIndex--;
  13311.                 break;
  13312.             case $.ui.keyCode.END:
  13313.                 selectedIndex = this.anchors.length - 1;
  13314.                 break;
  13315.             case $.ui.keyCode.HOME:
  13316.                 selectedIndex = 0;
  13317.                 break;
  13318.             case $.ui.keyCode.SPACE:
  13319.                 // Activate only, no collapsing
  13320.                 event.preventDefault();
  13321.                 clearTimeout( this.activating );
  13322.                 this._activate( selectedIndex );
  13323.                 return;
  13324.             case $.ui.keyCode.ENTER:
  13325.                 // Toggle (cancel delayed activation, allow collapsing)
  13326.                 event.preventDefault();
  13327.                 clearTimeout( this.activating );
  13328.                 // Determine if we should collapse or activate
  13329.                 this._activate( selectedIndex === this.options.active ? false : selectedIndex );
  13330.                 return;
  13331.             default:
  13332.                 return;
  13333.         }
  13334.  
  13335.         // Focus the appropriate tab, based on which key was pressed
  13336.         event.preventDefault();
  13337.         clearTimeout( this.activating );
  13338.         selectedIndex = this._focusNextTab( selectedIndex, goingForward );
  13339.  
  13340.         // Navigating with control/command key will prevent automatic activation
  13341.         if ( !event.ctrlKey && !event.metaKey ) {
  13342.  
  13343.             // Update aria-selected immediately so that AT think the tab is already selected.
  13344.             // Otherwise AT may confuse the user by stating that they need to activate the tab,
  13345.             // but the tab will already be activated by the time the announcement finishes.
  13346.             focusedTab.attr( "aria-selected", "false" );
  13347.             this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
  13348.  
  13349.             this.activating = this._delay(function() {
  13350.                 this.option( "active", selectedIndex );
  13351.             }, this.delay );
  13352.         }
  13353.     },
  13354.  
  13355.     _panelKeydown: function( event ) {
  13356.         if ( this._handlePageNav( event ) ) {
  13357.             return;
  13358.         }
  13359.  
  13360.         // Ctrl+up moves focus to the current tab
  13361.         if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
  13362.             event.preventDefault();
  13363.             this.active.focus();
  13364.         }
  13365.     },
  13366.  
  13367.     // Alt+page up/down moves focus to the previous/next tab (and activates)
  13368.     _handlePageNav: function( event ) {
  13369.         if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
  13370.             this._activate( this._focusNextTab( this.options.active - 1, false ) );
  13371.             return true;
  13372.         }
  13373.         if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
  13374.             this._activate( this._focusNextTab( this.options.active + 1, true ) );
  13375.             return true;
  13376.         }
  13377.     },
  13378.  
  13379.     _findNextTab: function( index, goingForward ) {
  13380.         var lastTabIndex = this.tabs.length - 1;
  13381.  
  13382.         function constrain() {
  13383.             if ( index > lastTabIndex ) {
  13384.                 index = 0;
  13385.             }
  13386.             if ( index < 0 ) {
  13387.                 index = lastTabIndex;
  13388.             }
  13389.             return index;
  13390.         }
  13391.  
  13392.         while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
  13393.             index = goingForward ? index + 1 : index - 1;
  13394.         }
  13395.  
  13396.         return index;
  13397.     },
  13398.  
  13399.     _focusNextTab: function( index, goingForward ) {
  13400.         index = this._findNextTab( index, goingForward );
  13401.         this.tabs.eq( index ).focus();
  13402.         return index;
  13403.     },
  13404.  
  13405.     _setOption: function( key, value ) {
  13406.         if ( key === "active" ) {
  13407.             // _activate() will handle invalid values and update this.options
  13408.             this._activate( value );
  13409.             return;
  13410.         }
  13411.  
  13412.         if ( key === "disabled" ) {
  13413.             // don't use the widget factory's disabled handling
  13414.             this._setupDisabled( value );
  13415.             return;
  13416.         }
  13417.  
  13418.         this._super( key, value);
  13419.  
  13420.         if ( key === "collapsible" ) {
  13421.             this.element.toggleClass( "ui-tabs-collapsible", value );
  13422.             // Setting collapsible: false while collapsed; open first panel
  13423.             if ( !value && this.options.active === false ) {
  13424.                 this._activate( 0 );
  13425.             }
  13426.         }
  13427.  
  13428.         if ( key === "event" ) {
  13429.             this._setupEvents( value );
  13430.         }
  13431.  
  13432.         if ( key === "heightStyle" ) {
  13433.             this._setupHeightStyle( value );
  13434.         }
  13435.     },
  13436.  
  13437.     _sanitizeSelector: function( hash ) {
  13438.         return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
  13439.     },
  13440.  
  13441.     refresh: function() {
  13442.         var options = this.options,
  13443.             lis = this.tablist.children( ":has(a[href])" );
  13444.  
  13445.         // get disabled tabs from class attribute from HTML
  13446.         // this will get converted to a boolean if needed in _refresh()
  13447.         options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
  13448.             return lis.index( tab );
  13449.         });
  13450.  
  13451.         this._processTabs();
  13452.  
  13453.         // was collapsed or no tabs
  13454.         if ( options.active === false || !this.anchors.length ) {
  13455.             options.active = false;
  13456.             this.active = $();
  13457.         // was active, but active tab is gone
  13458.         } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
  13459.             // all remaining tabs are disabled
  13460.             if ( this.tabs.length === options.disabled.length ) {
  13461.                 options.active = false;
  13462.                 this.active = $();
  13463.             // activate previous tab
  13464.             } else {
  13465.                 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
  13466.             }
  13467.         // was active, active tab still exists
  13468.         } else {
  13469.             // make sure active index is correct
  13470.             options.active = this.tabs.index( this.active );
  13471.         }
  13472.  
  13473.         this._refresh();
  13474.     },
  13475.  
  13476.     _refresh: function() {
  13477.         this._setupDisabled( this.options.disabled );
  13478.         this._setupEvents( this.options.event );
  13479.         this._setupHeightStyle( this.options.heightStyle );
  13480.  
  13481.         this.tabs.not( this.active ).attr({
  13482.             "aria-selected": "false",
  13483.             "aria-expanded": "false",
  13484.             tabIndex: -1
  13485.         });
  13486.         this.panels.not( this._getPanelForTab( this.active ) )
  13487.             .hide()
  13488.             .attr({
  13489.                 "aria-hidden": "true"
  13490.             });
  13491.  
  13492.         // Make sure one tab is in the tab order
  13493.         if ( !this.active.length ) {
  13494.             this.tabs.eq( 0 ).attr( "tabIndex", 0 );
  13495.         } else {
  13496.             this.active
  13497.                 .addClass( "ui-tabs-active ui-state-active" )
  13498.                 .attr({
  13499.                     "aria-selected": "true",
  13500.                     "aria-expanded": "true",
  13501.                     tabIndex: 0
  13502.                 });
  13503.             this._getPanelForTab( this.active )
  13504.                 .show()
  13505.                 .attr({
  13506.                     "aria-hidden": "false"
  13507.                 });
  13508.         }
  13509.     },
  13510.  
  13511.     _processTabs: function() {
  13512.         var that = this,
  13513.             prevTabs = this.tabs,
  13514.             prevAnchors = this.anchors,
  13515.             prevPanels = this.panels;
  13516.  
  13517.         this.tablist = this._getList()
  13518.             .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
  13519.             .attr( "role", "tablist" )
  13520.  
  13521.             // Prevent users from focusing disabled tabs via click
  13522.             .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
  13523.                 if ( $( this ).is( ".ui-state-disabled" ) ) {
  13524.                     event.preventDefault();
  13525.                 }
  13526.             })
  13527.  
  13528.             // support: IE <9
  13529.             // Preventing the default action in mousedown doesn't prevent IE
  13530.             // from focusing the element, so if the anchor gets focused, blur.
  13531.             // We don't have to worry about focusing the previously focused
  13532.             // element since clicking on a non-focusable element should focus
  13533.             // the body anyway.
  13534.             .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
  13535.                 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
  13536.                     this.blur();
  13537.                 }
  13538.             });
  13539.  
  13540.         this.tabs = this.tablist.find( "> li:has(a[href])" )
  13541.             .addClass( "ui-state-default ui-corner-top" )
  13542.             .attr({
  13543.                 role: "tab",
  13544.                 tabIndex: -1
  13545.             });
  13546.  
  13547.         this.anchors = this.tabs.map(function() {
  13548.                 return $( "a", this )[ 0 ];
  13549.             })
  13550.             .addClass( "ui-tabs-anchor" )
  13551.             .attr({
  13552.                 role: "presentation",
  13553.                 tabIndex: -1
  13554.             });
  13555.  
  13556.         this.panels = $();
  13557.  
  13558.         this.anchors.each(function( i, anchor ) {
  13559.             var selector, panel, panelId,
  13560.                 anchorId = $( anchor ).uniqueId().attr( "id" ),
  13561.                 tab = $( anchor ).closest( "li" ),
  13562.                 originalAriaControls = tab.attr( "aria-controls" );
  13563.  
  13564.             // inline tab
  13565.             if ( that._isLocal( anchor ) ) {
  13566.                 selector = anchor.hash;
  13567.                 panelId = selector.substring( 1 );
  13568.                 panel = that.element.find( that._sanitizeSelector( selector ) );
  13569.             // remote tab
  13570.             } else {
  13571.                 // If the tab doesn't already have aria-controls,
  13572.                 // generate an id by using a throw-away element
  13573.                 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
  13574.                 selector = "#" + panelId;
  13575.                 panel = that.element.find( selector );
  13576.                 if ( !panel.length ) {
  13577.                     panel = that._createPanel( panelId );
  13578.                     panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
  13579.                 }
  13580.                 panel.attr( "aria-live", "polite" );
  13581.             }
  13582.  
  13583.             if ( panel.length) {
  13584.                 that.panels = that.panels.add( panel );
  13585.             }
  13586.             if ( originalAriaControls ) {
  13587.                 tab.data( "ui-tabs-aria-controls", originalAriaControls );
  13588.             }
  13589.             tab.attr({
  13590.                 "aria-controls": panelId,
  13591.                 "aria-labelledby": anchorId
  13592.             });
  13593.             panel.attr( "aria-labelledby", anchorId );
  13594.         });
  13595.  
  13596.         this.panels
  13597.             .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  13598.             .attr( "role", "tabpanel" );
  13599.  
  13600.         // Avoid memory leaks (#10056)
  13601.         if ( prevTabs ) {
  13602.             this._off( prevTabs.not( this.tabs ) );
  13603.             this._off( prevAnchors.not( this.anchors ) );
  13604.             this._off( prevPanels.not( this.panels ) );
  13605.         }
  13606.     },
  13607.  
  13608.     // allow overriding how to find the list for rare usage scenarios (#7715)
  13609.     _getList: function() {
  13610.         return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
  13611.     },
  13612.  
  13613.     _createPanel: function( id ) {
  13614.         return $( "<div>" )
  13615.             .attr( "id", id )
  13616.             .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  13617.             .data( "ui-tabs-destroy", true );
  13618.     },
  13619.  
  13620.     _setupDisabled: function( disabled ) {
  13621.         if ( $.isArray( disabled ) ) {
  13622.             if ( !disabled.length ) {
  13623.                 disabled = false;
  13624.             } else if ( disabled.length === this.anchors.length ) {
  13625.                 disabled = true;
  13626.             }
  13627.         }
  13628.  
  13629.         // disable tabs
  13630.         for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
  13631.             if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
  13632.                 $( li )
  13633.                     .addClass( "ui-state-disabled" )
  13634.                     .attr( "aria-disabled", "true" );
  13635.             } else {
  13636.                 $( li )
  13637.                     .removeClass( "ui-state-disabled" )
  13638.                     .removeAttr( "aria-disabled" );
  13639.             }
  13640.         }
  13641.  
  13642.         this.options.disabled = disabled;
  13643.     },
  13644.  
  13645.     _setupEvents: function( event ) {
  13646.         var events = {};
  13647.         if ( event ) {
  13648.             $.each( event.split(" "), function( index, eventName ) {
  13649.                 events[ eventName ] = "_eventHandler";
  13650.             });
  13651.         }
  13652.  
  13653.         this._off( this.anchors.add( this.tabs ).add( this.panels ) );
  13654.         // Always prevent the default action, even when disabled
  13655.         this._on( true, this.anchors, {
  13656.             click: function( event ) {
  13657.                 event.preventDefault();
  13658.             }
  13659.         });
  13660.         this._on( this.anchors, events );
  13661.         this._on( this.tabs, { keydown: "_tabKeydown" } );
  13662.         this._on( this.panels, { keydown: "_panelKeydown" } );
  13663.  
  13664.         this._focusable( this.tabs );
  13665.         this._hoverable( this.tabs );
  13666.     },
  13667.  
  13668.     _setupHeightStyle: function( heightStyle ) {
  13669.         var maxHeight,
  13670.             parent = this.element.parent();
  13671.  
  13672.         if ( heightStyle === "fill" ) {
  13673.             maxHeight = parent.height();
  13674.             maxHeight -= this.element.outerHeight() - this.element.height();
  13675.  
  13676.             this.element.siblings( ":visible" ).each(function() {
  13677.                 var elem = $( this ),
  13678.                     position = elem.css( "position" );
  13679.  
  13680.                 if ( position === "absolute" || position === "fixed" ) {
  13681.                     return;
  13682.                 }
  13683.                 maxHeight -= elem.outerHeight( true );
  13684.             });
  13685.  
  13686.             this.element.children().not( this.panels ).each(function() {
  13687.                 maxHeight -= $( this ).outerHeight( true );
  13688.             });
  13689.  
  13690.             this.panels.each(function() {
  13691.                 $( this ).height( Math.max( 0, maxHeight -
  13692.                     $( this ).innerHeight() + $( this ).height() ) );
  13693.             })
  13694.             .css( "overflow", "auto" );
  13695.         } else if ( heightStyle === "auto" ) {
  13696.             maxHeight = 0;
  13697.             this.panels.each(function() {
  13698.                 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  13699.             }).height( maxHeight );
  13700.         }
  13701.     },
  13702.  
  13703.     _eventHandler: function( event ) {
  13704.         var options = this.options,
  13705.             active = this.active,
  13706.             anchor = $( event.currentTarget ),
  13707.             tab = anchor.closest( "li" ),
  13708.             clickedIsActive = tab[ 0 ] === active[ 0 ],
  13709.             collapsing = clickedIsActive && options.collapsible,
  13710.             toShow = collapsing ? $() : this._getPanelForTab( tab ),
  13711.             toHide = !active.length ? $() : this._getPanelForTab( active ),
  13712.             eventData = {
  13713.                 oldTab: active,
  13714.                 oldPanel: toHide,
  13715.                 newTab: collapsing ? $() : tab,
  13716.                 newPanel: toShow
  13717.             };
  13718.  
  13719.         event.preventDefault();
  13720.  
  13721.         if ( tab.hasClass( "ui-state-disabled" ) ||
  13722.                 // tab is already loading
  13723.                 tab.hasClass( "ui-tabs-loading" ) ||
  13724.                 // can't switch durning an animation
  13725.                 this.running ||
  13726.                 // click on active header, but not collapsible
  13727.                 ( clickedIsActive && !options.collapsible ) ||
  13728.                 // allow canceling activation
  13729.                 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  13730.             return;
  13731.         }
  13732.  
  13733.         options.active = collapsing ? false : this.tabs.index( tab );
  13734.  
  13735.         this.active = clickedIsActive ? $() : tab;
  13736.         if ( this.xhr ) {
  13737.             this.xhr.abort();
  13738.         }
  13739.  
  13740.         if ( !toHide.length && !toShow.length ) {
  13741.             $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
  13742.         }
  13743.  
  13744.         if ( toShow.length ) {
  13745.             this.load( this.tabs.index( tab ), event );
  13746.         }
  13747.         this._toggle( event, eventData );
  13748.     },
  13749.  
  13750.     // handles show/hide for selecting tabs
  13751.     _toggle: function( event, eventData ) {
  13752.         var that = this,
  13753.             toShow = eventData.newPanel,
  13754.             toHide = eventData.oldPanel;
  13755.  
  13756.         this.running = true;
  13757.  
  13758.         function complete() {
  13759.             that.running = false;
  13760.             that._trigger( "activate", event, eventData );
  13761.         }
  13762.  
  13763.         function show() {
  13764.             eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
  13765.  
  13766.             if ( toShow.length && that.options.show ) {
  13767.                 that._show( toShow, that.options.show, complete );
  13768.             } else {
  13769.                 toShow.show();
  13770.                 complete();
  13771.             }
  13772.         }
  13773.  
  13774.         // start out by hiding, then showing, then completing
  13775.         if ( toHide.length && this.options.hide ) {
  13776.             this._hide( toHide, this.options.hide, function() {
  13777.                 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
  13778.                 show();
  13779.             });
  13780.         } else {
  13781.             eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
  13782.             toHide.hide();
  13783.             show();
  13784.         }
  13785.  
  13786.         toHide.attr( "aria-hidden", "true" );
  13787.         eventData.oldTab.attr({
  13788.             "aria-selected": "false",
  13789.             "aria-expanded": "false"
  13790.         });
  13791.         // If we're switching tabs, remove the old tab from the tab order.
  13792.         // If we're opening from collapsed state, remove the previous tab from the tab order.
  13793.         // If we're collapsing, then keep the collapsing tab in the tab order.
  13794.         if ( toShow.length && toHide.length ) {
  13795.             eventData.oldTab.attr( "tabIndex", -1 );
  13796.         } else if ( toShow.length ) {
  13797.             this.tabs.filter(function() {
  13798.                 return $( this ).attr( "tabIndex" ) === 0;
  13799.             })
  13800.             .attr( "tabIndex", -1 );
  13801.         }
  13802.  
  13803.         toShow.attr( "aria-hidden", "false" );
  13804.         eventData.newTab.attr({
  13805.             "aria-selected": "true",
  13806.             "aria-expanded": "true",
  13807.             tabIndex: 0
  13808.         });
  13809.     },
  13810.  
  13811.     _activate: function( index ) {
  13812.         var anchor,
  13813.             active = this._findActive( index );
  13814.  
  13815.         // trying to activate the already active panel
  13816.         if ( active[ 0 ] === this.active[ 0 ] ) {
  13817.             return;
  13818.         }
  13819.  
  13820.         // trying to collapse, simulate a click on the current active header
  13821.         if ( !active.length ) {
  13822.             active = this.active;
  13823.         }
  13824.  
  13825.         anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
  13826.         this._eventHandler({
  13827.             target: anchor,
  13828.             currentTarget: anchor,
  13829.             preventDefault: $.noop
  13830.         });
  13831.     },
  13832.  
  13833.     _findActive: function( index ) {
  13834.         return index === false ? $() : this.tabs.eq( index );
  13835.     },
  13836.  
  13837.     _getIndex: function( index ) {
  13838.         // meta-function to give users option to provide a href string instead of a numerical index.
  13839.         if ( typeof index === "string" ) {
  13840.             index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
  13841.         }
  13842.  
  13843.         return index;
  13844.     },
  13845.  
  13846.     _destroy: function() {
  13847.         if ( this.xhr ) {
  13848.             this.xhr.abort();
  13849.         }
  13850.  
  13851.         this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
  13852.  
  13853.         this.tablist
  13854.             .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
  13855.             .removeAttr( "role" );
  13856.  
  13857.         this.anchors
  13858.             .removeClass( "ui-tabs-anchor" )
  13859.             .removeAttr( "role" )
  13860.             .removeAttr( "tabIndex" )
  13861.             .removeUniqueId();
  13862.  
  13863.         this.tablist.unbind( this.eventNamespace );
  13864.  
  13865.         this.tabs.add( this.panels ).each(function() {
  13866.             if ( $.data( this, "ui-tabs-destroy" ) ) {
  13867.                 $( this ).remove();
  13868.             } else {
  13869.                 $( this )
  13870.                     .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
  13871.                         "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
  13872.                     .removeAttr( "tabIndex" )
  13873.                     .removeAttr( "aria-live" )
  13874.                     .removeAttr( "aria-busy" )
  13875.                     .removeAttr( "aria-selected" )
  13876.                     .removeAttr( "aria-labelledby" )
  13877.                     .removeAttr( "aria-hidden" )
  13878.                     .removeAttr( "aria-expanded" )
  13879.                     .removeAttr( "role" );
  13880.             }
  13881.         });
  13882.  
  13883.         this.tabs.each(function() {
  13884.             var li = $( this ),
  13885.                 prev = li.data( "ui-tabs-aria-controls" );
  13886.             if ( prev ) {
  13887.                 li
  13888.                     .attr( "aria-controls", prev )
  13889.                     .removeData( "ui-tabs-aria-controls" );
  13890.             } else {
  13891.                 li.removeAttr( "aria-controls" );
  13892.             }
  13893.         });
  13894.  
  13895.         this.panels.show();
  13896.  
  13897.         if ( this.options.heightStyle !== "content" ) {
  13898.             this.panels.css( "height", "" );
  13899.         }
  13900.     },
  13901.  
  13902.     enable: function( index ) {
  13903.         var disabled = this.options.disabled;
  13904.         if ( disabled === false ) {
  13905.             return;
  13906.         }
  13907.  
  13908.         if ( index === undefined ) {
  13909.             disabled = false;
  13910.         } else {
  13911.             index = this._getIndex( index );
  13912.             if ( $.isArray( disabled ) ) {
  13913.                 disabled = $.map( disabled, function( num ) {
  13914.                     return num !== index ? num : null;
  13915.                 });
  13916.             } else {
  13917.                 disabled = $.map( this.tabs, function( li, num ) {
  13918.                     return num !== index ? num : null;
  13919.                 });
  13920.             }
  13921.         }
  13922.         this._setupDisabled( disabled );
  13923.     },
  13924.  
  13925.     disable: function( index ) {
  13926.         var disabled = this.options.disabled;
  13927.         if ( disabled === true ) {
  13928.             return;
  13929.         }
  13930.  
  13931.         if ( index === undefined ) {
  13932.             disabled = true;
  13933.         } else {
  13934.             index = this._getIndex( index );
  13935.             if ( $.inArray( index, disabled ) !== -1 ) {
  13936.                 return;
  13937.             }
  13938.             if ( $.isArray( disabled ) ) {
  13939.                 disabled = $.merge( [ index ], disabled ).sort();
  13940.             } else {
  13941.                 disabled = [ index ];
  13942.             }
  13943.         }
  13944.         this._setupDisabled( disabled );
  13945.     },
  13946.  
  13947.     load: function( index, event ) {
  13948.         index = this._getIndex( index );
  13949.         var that = this,
  13950.             tab = this.tabs.eq( index ),
  13951.             anchor = tab.find( ".ui-tabs-anchor" ),
  13952.             panel = this._getPanelForTab( tab ),
  13953.             eventData = {
  13954.                 tab: tab,
  13955.                 panel: panel
  13956.             },
  13957.             complete = function( jqXHR, status ) {
  13958.                 if ( status === "abort" ) {
  13959.                     that.panels.stop( false, true );
  13960.                 }
  13961.  
  13962.                 tab.removeClass( "ui-tabs-loading" );
  13963.                 panel.removeAttr( "aria-busy" );
  13964.  
  13965.                 if ( jqXHR === that.xhr ) {
  13966.                     delete that.xhr;
  13967.                 }
  13968.             };
  13969.  
  13970.         // not remote
  13971.         if ( this._isLocal( anchor[ 0 ] ) ) {
  13972.             return;
  13973.         }
  13974.  
  13975.         this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
  13976.  
  13977.         // support: jQuery <1.8
  13978.         // jQuery <1.8 returns false if the request is canceled in beforeSend,
  13979.         // but as of 1.8, $.ajax() always returns a jqXHR object.
  13980.         if ( this.xhr && this.xhr.statusText !== "canceled" ) {
  13981.             tab.addClass( "ui-tabs-loading" );
  13982.             panel.attr( "aria-busy", "true" );
  13983.  
  13984.             this.xhr
  13985.                 .done(function( response, status, jqXHR ) {
  13986.                     // support: jQuery <1.8
  13987.                     // http://bugs.jquery.com/ticket/11778
  13988.                     setTimeout(function() {
  13989.                         panel.html( response );
  13990.                         that._trigger( "load", event, eventData );
  13991.  
  13992.                         complete( jqXHR, status );
  13993.                     }, 1 );
  13994.                 })
  13995.                 .fail(function( jqXHR, status ) {
  13996.                     // support: jQuery <1.8
  13997.                     // http://bugs.jquery.com/ticket/11778
  13998.                     setTimeout(function() {
  13999.                         complete( jqXHR, status );
  14000.                     }, 1 );
  14001.                 });
  14002.         }
  14003.     },
  14004.  
  14005.     _ajaxSettings: function( anchor, event, eventData ) {
  14006.         var that = this;
  14007.         return {
  14008.             url: anchor.attr( "href" ),
  14009.             beforeSend: function( jqXHR, settings ) {
  14010.                 return that._trigger( "beforeLoad", event,
  14011.                     $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
  14012.             }
  14013.         };
  14014.     },
  14015.  
  14016.     _getPanelForTab: function( tab ) {
  14017.         var id = $( tab ).attr( "aria-controls" );
  14018.         return this.element.find( this._sanitizeSelector( "#" + id ) );
  14019.     }
  14020. });
  14021.  
  14022.  
  14023. /*!
  14024.  * jQuery UI Tooltip 1.11.4
  14025.  * http://jqueryui.com
  14026.  *
  14027.  * Copyright jQuery Foundation and other contributors
  14028.  * Released under the MIT license.
  14029.  * http://jquery.org/license
  14030.  *
  14031.  * http://api.jqueryui.com/tooltip/
  14032.  */
  14033.  
  14034.  
  14035. var tooltip = $.widget( "ui.tooltip", {
  14036.     version: "1.11.4",
  14037.     options: {
  14038.         content: function() {
  14039.             // support: IE<9, Opera in jQuery <1.7
  14040.             // .text() can't accept undefined, so coerce to a string
  14041.             var title = $( this ).attr( "title" ) || "";
  14042.             // Escape title, since we're going from an attribute to raw HTML
  14043.             return $( "<a>" ).text( title ).html();
  14044.         },
  14045.         hide: true,
  14046.         // Disabled elements have inconsistent behavior across browsers (#8661)
  14047.         items: "[title]:not([disabled])",
  14048.         position: {
  14049.             my: "left top+15",
  14050.             at: "left bottom",
  14051.             collision: "flipfit flip"
  14052.         },
  14053.         show: true,
  14054.         tooltipClass: null,
  14055.         track: false,
  14056.  
  14057.         // callbacks
  14058.         close: null,
  14059.         open: null
  14060.     },
  14061.  
  14062.     _addDescribedBy: function( elem, id ) {
  14063.         var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
  14064.         describedby.push( id );
  14065.         elem
  14066.             .data( "ui-tooltip-id", id )
  14067.             .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
  14068.     },
  14069.  
  14070.     _removeDescribedBy: function( elem ) {
  14071.         var id = elem.data( "ui-tooltip-id" ),
  14072.             describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
  14073.             index = $.inArray( id, describedby );
  14074.  
  14075.         if ( index !== -1 ) {
  14076.             describedby.splice( index, 1 );
  14077.         }
  14078.  
  14079.         elem.removeData( "ui-tooltip-id" );
  14080.         describedby = $.trim( describedby.join( " " ) );
  14081.         if ( describedby ) {
  14082.             elem.attr( "aria-describedby", describedby );
  14083.         } else {
  14084.             elem.removeAttr( "aria-describedby" );
  14085.         }
  14086.     },
  14087.  
  14088.     _create: function() {
  14089.         this._on({
  14090.             mouseover: "open",
  14091.             focusin: "open"
  14092.         });
  14093.  
  14094.         // IDs of generated tooltips, needed for destroy
  14095.         this.tooltips = {};
  14096.  
  14097.         // IDs of parent tooltips where we removed the title attribute
  14098.         this.parents = {};
  14099.  
  14100.         if ( this.options.disabled ) {
  14101.             this._disable();
  14102.         }
  14103.  
  14104.         // Append the aria-live region so tooltips announce correctly
  14105.         this.liveRegion = $( "<div>" )
  14106.             .attr({
  14107.                 role: "log",
  14108.                 "aria-live": "assertive",
  14109.                 "aria-relevant": "additions"
  14110.             })
  14111.             .addClass( "ui-helper-hidden-accessible" )
  14112.             .appendTo( this.document[ 0 ].body );
  14113.     },
  14114.  
  14115.     _setOption: function( key, value ) {
  14116.         var that = this;
  14117.  
  14118.         if ( key === "disabled" ) {
  14119.             this[ value ? "_disable" : "_enable" ]();
  14120.             this.options[ key ] = value;
  14121.             // disable element style changes
  14122.             return;
  14123.         }
  14124.  
  14125.         this._super( key, value );
  14126.  
  14127.         if ( key === "content" ) {
  14128.             $.each( this.tooltips, function( id, tooltipData ) {
  14129.                 that._updateContent( tooltipData.element );
  14130.             });
  14131.         }
  14132.     },
  14133.  
  14134.     _disable: function() {
  14135.         var that = this;
  14136.  
  14137.         // close open tooltips
  14138.         $.each( this.tooltips, function( id, tooltipData ) {
  14139.             var event = $.Event( "blur" );
  14140.             event.target = event.currentTarget = tooltipData.element[ 0 ];
  14141.             that.close( event, true );
  14142.         });
  14143.  
  14144.         // remove title attributes to prevent native tooltips
  14145.         this.element.find( this.options.items ).addBack().each(function() {
  14146.             var element = $( this );
  14147.             if ( element.is( "[title]" ) ) {
  14148.                 element
  14149.                     .data( "ui-tooltip-title", element.attr( "title" ) )
  14150.                     .removeAttr( "title" );
  14151.             }
  14152.         });
  14153.     },
  14154.  
  14155.     _enable: function() {
  14156.         // restore title attributes
  14157.         this.element.find( this.options.items ).addBack().each(function() {
  14158.             var element = $( this );
  14159.             if ( element.data( "ui-tooltip-title" ) ) {
  14160.                 element.attr( "title", element.data( "ui-tooltip-title" ) );
  14161.             }
  14162.         });
  14163.     },
  14164.  
  14165.     open: function( event ) {
  14166.         var that = this,
  14167.             target = $( event ? event.target : this.element )
  14168.                 // we need closest here due to mouseover bubbling,
  14169.                 // but always pointing at the same event target
  14170.                 .closest( this.options.items );
  14171.  
  14172.         // No element to show a tooltip for or the tooltip is already open
  14173.         if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  14174.             return;
  14175.         }
  14176.  
  14177.         if ( target.attr( "title" ) ) {
  14178.             target.data( "ui-tooltip-title", target.attr( "title" ) );
  14179.         }
  14180.  
  14181.         target.data( "ui-tooltip-open", true );
  14182.  
  14183.         // kill parent tooltips, custom or native, for hover
  14184.         if ( event && event.type === "mouseover" ) {
  14185.             target.parents().each(function() {
  14186.                 var parent = $( this ),
  14187.                     blurEvent;
  14188.                 if ( parent.data( "ui-tooltip-open" ) ) {
  14189.                     blurEvent = $.Event( "blur" );
  14190.                     blurEvent.target = blurEvent.currentTarget = this;
  14191.                     that.close( blurEvent, true );
  14192.                 }
  14193.                 if ( parent.attr( "title" ) ) {
  14194.                     parent.uniqueId();
  14195.                     that.parents[ this.id ] = {
  14196.                         element: this,
  14197.                         title: parent.attr( "title" )
  14198.                     };
  14199.                     parent.attr( "title", "" );
  14200.                 }
  14201.             });
  14202.         }
  14203.  
  14204.         this._registerCloseHandlers( event, target );
  14205.         this._updateContent( target, event );
  14206.     },
  14207.  
  14208.     _updateContent: function( target, event ) {
  14209.         var content,
  14210.             contentOption = this.options.content,
  14211.             that = this,
  14212.             eventType = event ? event.type : null;
  14213.  
  14214.         if ( typeof contentOption === "string" ) {
  14215.             return this._open( event, target, contentOption );
  14216.         }
  14217.  
  14218.         content = contentOption.call( target[0], function( response ) {
  14219.  
  14220.             // IE may instantly serve a cached response for ajax requests
  14221.             // delay this call to _open so the other call to _open runs first
  14222.             that._delay(function() {
  14223.  
  14224.                 // Ignore async response if tooltip was closed already
  14225.                 if ( !target.data( "ui-tooltip-open" ) ) {
  14226.                     return;
  14227.                 }
  14228.  
  14229.                 // jQuery creates a special event for focusin when it doesn't
  14230.                 // exist natively. To improve performance, the native event
  14231.                 // object is reused and the type is changed. Therefore, we can't
  14232.                 // rely on the type being correct after the event finished
  14233.                 // bubbling, so we set it back to the previous value. (#8740)
  14234.                 if ( event ) {
  14235.                     event.type = eventType;
  14236.                 }
  14237.                 this._open( event, target, response );
  14238.             });
  14239.         });
  14240.         if ( content ) {
  14241.             this._open( event, target, content );
  14242.         }
  14243.     },
  14244.  
  14245.     _open: function( event, target, content ) {
  14246.         var tooltipData, tooltip, delayedShow, a11yContent,
  14247.             positionOption = $.extend( {}, this.options.position );
  14248.  
  14249.         if ( !content ) {
  14250.             return;
  14251.         }
  14252.  
  14253.         // Content can be updated multiple times. If the tooltip already
  14254.         // exists, then just update the content and bail.
  14255.         tooltipData = this._find( target );
  14256.         if ( tooltipData ) {
  14257.             tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  14258.             return;
  14259.         }
  14260.  
  14261.         // if we have a title, clear it to prevent the native tooltip
  14262.         // we have to check first to avoid defining a title if none exists
  14263.         // (we don't want to cause an element to start matching [title])
  14264.         //
  14265.         // We use removeAttr only for key events, to allow IE to export the correct
  14266.         // accessible attributes. For mouse events, set to empty string to avoid
  14267.         // native tooltip showing up (happens only when removing inside mouseover).
  14268.         if ( target.is( "[title]" ) ) {
  14269.             if ( event && event.type === "mouseover" ) {
  14270.                 target.attr( "title", "" );
  14271.             } else {
  14272.                 target.removeAttr( "title" );
  14273.             }
  14274.         }
  14275.  
  14276.         tooltipData = this._tooltip( target );
  14277.         tooltip = tooltipData.tooltip;
  14278.         this._addDescribedBy( target, tooltip.attr( "id" ) );
  14279.         tooltip.find( ".ui-tooltip-content" ).html( content );
  14280.  
  14281.         // Support: Voiceover on OS X, JAWS on IE <= 9
  14282.         // JAWS announces deletions even when aria-relevant="additions"
  14283.         // Voiceover will sometimes re-read the entire log region's contents from the beginning
  14284.         this.liveRegion.children().hide();
  14285.         if ( content.clone ) {
  14286.             a11yContent = content.clone();
  14287.             a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  14288.         } else {
  14289.             a11yContent = content;
  14290.         }
  14291.         $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
  14292.  
  14293.         function position( event ) {
  14294.             positionOption.of = event;
  14295.             if ( tooltip.is( ":hidden" ) ) {
  14296.                 return;
  14297.             }
  14298.             tooltip.position( positionOption );
  14299.         }
  14300.         if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  14301.             this._on( this.document, {
  14302.                 mousemove: position
  14303.             });
  14304.             // trigger once to override element-relative positioning
  14305.             position( event );
  14306.         } else {
  14307.             tooltip.position( $.extend({
  14308.                 of: target
  14309.             }, this.options.position ) );
  14310.         }
  14311.  
  14312.         tooltip.hide();
  14313.  
  14314.         this._show( tooltip, this.options.show );
  14315.         // Handle tracking tooltips that are shown with a delay (#8644). As soon
  14316.         // as the tooltip is visible, position the tooltip using the most recent
  14317.         // event.
  14318.         if ( this.options.show && this.options.show.delay ) {
  14319.             delayedShow = this.delayedShow = setInterval(function() {
  14320.                 if ( tooltip.is( ":visible" ) ) {
  14321.                     position( positionOption.of );
  14322.                     clearInterval( delayedShow );
  14323.                 }
  14324.             }, $.fx.interval );
  14325.         }
  14326.  
  14327.         this._trigger( "open", event, { tooltip: tooltip } );
  14328.     },
  14329.  
  14330.     _registerCloseHandlers: function( event, target ) {
  14331.         var events = {
  14332.             keyup: function( event ) {
  14333.                 if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  14334.                     var fakeEvent = $.Event(event);
  14335.                     fakeEvent.currentTarget = target[0];
  14336.                     this.close( fakeEvent, true );
  14337.                 }
  14338.             }
  14339.         };
  14340.  
  14341.         // Only bind remove handler for delegated targets. Non-delegated
  14342.         // tooltips will handle this in destroy.
  14343.         if ( target[ 0 ] !== this.element[ 0 ] ) {
  14344.             events.remove = function() {
  14345.                 this._removeTooltip( this._find( target ).tooltip );
  14346.             };
  14347.         }
  14348.  
  14349.         if ( !event || event.type === "mouseover" ) {
  14350.             events.mouseleave = "close";
  14351.         }
  14352.         if ( !event || event.type === "focusin" ) {
  14353.             events.focusout = "close";
  14354.         }
  14355.         this._on( true, target, events );
  14356.     },
  14357.  
  14358.     close: function( event ) {
  14359.         var tooltip,
  14360.             that = this,
  14361.             target = $( event ? event.currentTarget : this.element ),
  14362.             tooltipData = this._find( target );
  14363.  
  14364.         // The tooltip may already be closed
  14365.         if ( !tooltipData ) {
  14366.  
  14367.             // We set ui-tooltip-open immediately upon open (in open()), but only set the
  14368.             // additional data once there's actually content to show (in _open()). So even if the
  14369.             // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  14370.             // the period between open() and _open().
  14371.             target.removeData( "ui-tooltip-open" );
  14372.             return;
  14373.         }
  14374.  
  14375.         tooltip = tooltipData.tooltip;
  14376.  
  14377.         // disabling closes the tooltip, so we need to track when we're closing
  14378.         // to avoid an infinite loop in case the tooltip becomes disabled on close
  14379.         if ( tooltipData.closing ) {
  14380.             return;
  14381.         }
  14382.  
  14383.         // Clear the interval for delayed tracking tooltips
  14384.         clearInterval( this.delayedShow );
  14385.  
  14386.         // only set title if we had one before (see comment in _open())
  14387.         // If the title attribute has changed since open(), don't restore
  14388.         if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  14389.             target.attr( "title", target.data( "ui-tooltip-title" ) );
  14390.         }
  14391.  
  14392.         this._removeDescribedBy( target );
  14393.  
  14394.         tooltipData.hiding = true;
  14395.         tooltip.stop( true );
  14396.         this._hide( tooltip, this.options.hide, function() {
  14397.             that._removeTooltip( $( this ) );
  14398.         });
  14399.  
  14400.         target.removeData( "ui-tooltip-open" );
  14401.         this._off( target, "mouseleave focusout keyup" );
  14402.  
  14403.         // Remove 'remove' binding only on delegated targets
  14404.         if ( target[ 0 ] !== this.element[ 0 ] ) {
  14405.             this._off( target, "remove" );
  14406.         }
  14407.         this._off( this.document, "mousemove" );
  14408.  
  14409.         if ( event && event.type === "mouseleave" ) {
  14410.             $.each( this.parents, function( id, parent ) {
  14411.                 $( parent.element ).attr( "title", parent.title );
  14412.                 delete that.parents[ id ];
  14413.             });
  14414.         }
  14415.  
  14416.         tooltipData.closing = true;
  14417.         this._trigger( "close", event, { tooltip: tooltip } );
  14418.         if ( !tooltipData.hiding ) {
  14419.             tooltipData.closing = false;
  14420.         }
  14421.     },
  14422.  
  14423.     _tooltip: function( element ) {
  14424.         var tooltip = $( "<div>" )
  14425.                 .attr( "role", "tooltip" )
  14426.                 .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
  14427.                     ( this.options.tooltipClass || "" ) ),
  14428.             id = tooltip.uniqueId().attr( "id" );
  14429.  
  14430.         $( "<div>" )
  14431.             .addClass( "ui-tooltip-content" )
  14432.             .appendTo( tooltip );
  14433.  
  14434.         tooltip.appendTo( this.document[0].body );
  14435.  
  14436.         return this.tooltips[ id ] = {
  14437.             element: element,
  14438.             tooltip: tooltip
  14439.         };
  14440.     },
  14441.  
  14442.     _find: function( target ) {
  14443.         var id = target.data( "ui-tooltip-id" );
  14444.         return id ? this.tooltips[ id ] : null;
  14445.     },
  14446.  
  14447.     _removeTooltip: function( tooltip ) {
  14448.         tooltip.remove();
  14449.         delete this.tooltips[ tooltip.attr( "id" ) ];
  14450.     },
  14451.  
  14452.     _destroy: function() {
  14453.         var that = this;
  14454.  
  14455.         // close open tooltips
  14456.         $.each( this.tooltips, function( id, tooltipData ) {
  14457.             // Delegate to close method to handle common cleanup
  14458.             var event = $.Event( "blur" ),
  14459.                 element = tooltipData.element;
  14460.             event.target = event.currentTarget = element[ 0 ];
  14461.             that.close( event, true );
  14462.  
  14463.             // Remove immediately; destroying an open tooltip doesn't use the
  14464.             // hide animation
  14465.             $( "#" + id ).remove();
  14466.  
  14467.             // Restore the title
  14468.             if ( element.data( "ui-tooltip-title" ) ) {
  14469.                 // If the title attribute has changed since open(), don't restore
  14470.                 if ( !element.attr( "title" ) ) {
  14471.                     element.attr( "title", element.data( "ui-tooltip-title" ) );
  14472.                 }
  14473.                 element.removeData( "ui-tooltip-title" );
  14474.             }
  14475.         });
  14476.         this.liveRegion.remove();
  14477.     }
  14478. });
  14479.  
  14480.  
  14481. /*!
  14482.  * jQuery UI Effects 1.11.4
  14483.  * http://jqueryui.com
  14484.  *
  14485.  * Copyright jQuery Foundation and other contributors
  14486.  * Released under the MIT license.
  14487.  * http://jquery.org/license
  14488.  *
  14489.  * http://api.jqueryui.com/category/effects-core/
  14490.  */
  14491.  
  14492.  
  14493. var dataSpace = "ui-effects-",
  14494.  
  14495.     // Create a local jQuery because jQuery Color relies on it and the
  14496.     // global may not exist with AMD and a custom build (#10199)
  14497.     jQuery = $;
  14498.  
  14499. $.effects = {
  14500.     effect: {}
  14501. };
  14502.  
  14503. /*!
  14504.  * jQuery Color Animations v2.1.2
  14505.  * https://github.com/jquery/jquery-color
  14506.  *
  14507.  * Copyright 2014 jQuery Foundation and other contributors
  14508.  * Released under the MIT license.
  14509.  * http://jquery.org/license
  14510.  *
  14511.  * Date: Wed Jan 16 08:47:09 2013 -0600
  14512.  */
  14513. (function( jQuery, undefined ) {
  14514.  
  14515.     var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  14516.  
  14517.     // plusequals test for += 100 -= 100
  14518.     rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  14519.     // a set of RE's that can match strings and generate color tuples.
  14520.     stringParsers = [ {
  14521.             re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14522.             parse: function( execResult ) {
  14523.                 return [
  14524.                     execResult[ 1 ],
  14525.                     execResult[ 2 ],
  14526.                     execResult[ 3 ],
  14527.                     execResult[ 4 ]
  14528.                 ];
  14529.             }
  14530.         }, {
  14531.             re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14532.             parse: function( execResult ) {
  14533.                 return [
  14534.                     execResult[ 1 ] * 2.55,
  14535.                     execResult[ 2 ] * 2.55,
  14536.                     execResult[ 3 ] * 2.55,
  14537.                     execResult[ 4 ]
  14538.                 ];
  14539.             }
  14540.         }, {
  14541.             // this regex ignores A-F because it's compared against an already lowercased string
  14542.             re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  14543.             parse: function( execResult ) {
  14544.                 return [
  14545.                     parseInt( execResult[ 1 ], 16 ),
  14546.                     parseInt( execResult[ 2 ], 16 ),
  14547.                     parseInt( execResult[ 3 ], 16 )
  14548.                 ];
  14549.             }
  14550.         }, {
  14551.             // this regex ignores A-F because it's compared against an already lowercased string
  14552.             re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  14553.             parse: function( execResult ) {
  14554.                 return [
  14555.                     parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  14556.                     parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  14557.                     parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  14558.                 ];
  14559.             }
  14560.         }, {
  14561.             re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  14562.             space: "hsla",
  14563.             parse: function( execResult ) {
  14564.                 return [
  14565.                     execResult[ 1 ],
  14566.                     execResult[ 2 ] / 100,
  14567.                     execResult[ 3 ] / 100,
  14568.                     execResult[ 4 ]
  14569.                 ];
  14570.             }
  14571.         } ],
  14572.  
  14573.     // jQuery.Color( )
  14574.     color = jQuery.Color = function( color, green, blue, alpha ) {
  14575.         return new jQuery.Color.fn.parse( color, green, blue, alpha );
  14576.     },
  14577.     spaces = {
  14578.         rgba: {
  14579.             props: {
  14580.                 red: {
  14581.                     idx: 0,
  14582.                     type: "byte"
  14583.                 },
  14584.                 green: {
  14585.                     idx: 1,
  14586.                     type: "byte"
  14587.                 },
  14588.                 blue: {
  14589.                     idx: 2,
  14590.                     type: "byte"
  14591.                 }
  14592.             }
  14593.         },
  14594.  
  14595.         hsla: {
  14596.             props: {
  14597.                 hue: {
  14598.                     idx: 0,
  14599.                     type: "degrees"
  14600.                 },
  14601.                 saturation: {
  14602.                     idx: 1,
  14603.                     type: "percent"
  14604.                 },
  14605.                 lightness: {
  14606.                     idx: 2,
  14607.                     type: "percent"
  14608.                 }
  14609.             }
  14610.         }
  14611.     },
  14612.     propTypes = {
  14613.         "byte": {
  14614.             floor: true,
  14615.             max: 255
  14616.         },
  14617.         "percent": {
  14618.             max: 1
  14619.         },
  14620.         "degrees": {
  14621.             mod: 360,
  14622.             floor: true
  14623.         }
  14624.     },
  14625.     support = color.support = {},
  14626.  
  14627.     // element for support tests
  14628.     supportElem = jQuery( "<p>" )[ 0 ],
  14629.  
  14630.     // colors = jQuery.Color.names
  14631.     colors,
  14632.  
  14633.     // local aliases of functions called often
  14634.     each = jQuery.each;
  14635.  
  14636. // determine rgba support immediately
  14637. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  14638. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  14639.  
  14640. // define cache name and alpha properties
  14641. // for rgba and hsla spaces
  14642. each( spaces, function( spaceName, space ) {
  14643.     space.cache = "_" + spaceName;
  14644.     space.props.alpha = {
  14645.         idx: 3,
  14646.         type: "percent",
  14647.         def: 1
  14648.     };
  14649. });
  14650.  
  14651. function clamp( value, prop, allowEmpty ) {
  14652.     var type = propTypes[ prop.type ] || {};
  14653.  
  14654.     if ( value == null ) {
  14655.         return (allowEmpty || !prop.def) ? null : prop.def;
  14656.     }
  14657.  
  14658.     // ~~ is an short way of doing floor for positive numbers
  14659.     value = type.floor ? ~~value : parseFloat( value );
  14660.  
  14661.     // IE will pass in empty strings as value for alpha,
  14662.     // which will hit this case
  14663.     if ( isNaN( value ) ) {
  14664.         return prop.def;
  14665.     }
  14666.  
  14667.     if ( type.mod ) {
  14668.         // we add mod before modding to make sure that negatives values
  14669.         // get converted properly: -10 -> 350
  14670.         return (value + type.mod) % type.mod;
  14671.     }
  14672.  
  14673.     // for now all property types without mod have min and max
  14674.     return 0 > value ? 0 : type.max < value ? type.max : value;
  14675. }
  14676.  
  14677. function stringParse( string ) {
  14678.     var inst = color(),
  14679.         rgba = inst._rgba = [];
  14680.  
  14681.     string = string.toLowerCase();
  14682.  
  14683.     each( stringParsers, function( i, parser ) {
  14684.         var parsed,
  14685.             match = parser.re.exec( string ),
  14686.             values = match && parser.parse( match ),
  14687.             spaceName = parser.space || "rgba";
  14688.  
  14689.         if ( values ) {
  14690.             parsed = inst[ spaceName ]( values );
  14691.  
  14692.             // if this was an rgba parse the assignment might happen twice
  14693.             // oh well....
  14694.             inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  14695.             rgba = inst._rgba = parsed._rgba;
  14696.  
  14697.             // exit each( stringParsers ) here because we matched
  14698.             return false;
  14699.         }
  14700.     });
  14701.  
  14702.     // Found a stringParser that handled it
  14703.     if ( rgba.length ) {
  14704.  
  14705.         // if this came from a parsed string, force "transparent" when alpha is 0
  14706.         // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  14707.         if ( rgba.join() === "0,0,0,0" ) {
  14708.             jQuery.extend( rgba, colors.transparent );
  14709.         }
  14710.         return inst;
  14711.     }
  14712.  
  14713.     // named colors
  14714.     return colors[ string ];
  14715. }
  14716.  
  14717. color.fn = jQuery.extend( color.prototype, {
  14718.     parse: function( red, green, blue, alpha ) {
  14719.         if ( red === undefined ) {
  14720.             this._rgba = [ null, null, null, null ];
  14721.             return this;
  14722.         }
  14723.         if ( red.jquery || red.nodeType ) {
  14724.             red = jQuery( red ).css( green );
  14725.             green = undefined;
  14726.         }
  14727.  
  14728.         var inst = this,
  14729.             type = jQuery.type( red ),
  14730.             rgba = this._rgba = [];
  14731.  
  14732.         // more than 1 argument specified - assume ( red, green, blue, alpha )
  14733.         if ( green !== undefined ) {
  14734.             red = [ red, green, blue, alpha ];
  14735.             type = "array";
  14736.         }
  14737.  
  14738.         if ( type === "string" ) {
  14739.             return this.parse( stringParse( red ) || colors._default );
  14740.         }
  14741.  
  14742.         if ( type === "array" ) {
  14743.             each( spaces.rgba.props, function( key, prop ) {
  14744.                 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  14745.             });
  14746.             return this;
  14747.         }
  14748.  
  14749.         if ( type === "object" ) {
  14750.             if ( red instanceof color ) {
  14751.                 each( spaces, function( spaceName, space ) {
  14752.                     if ( red[ space.cache ] ) {
  14753.                         inst[ space.cache ] = red[ space.cache ].slice();
  14754.                     }
  14755.                 });
  14756.             } else {
  14757.                 each( spaces, function( spaceName, space ) {
  14758.                     var cache = space.cache;
  14759.                     each( space.props, function( key, prop ) {
  14760.  
  14761.                         // if the cache doesn't exist, and we know how to convert
  14762.                         if ( !inst[ cache ] && space.to ) {
  14763.  
  14764.                             // if the value was null, we don't need to copy it
  14765.                             // if the key was alpha, we don't need to copy it either
  14766.                             if ( key === "alpha" || red[ key ] == null ) {
  14767.                                 return;
  14768.                             }
  14769.                             inst[ cache ] = space.to( inst._rgba );
  14770.                         }
  14771.  
  14772.                         // this is the only case where we allow nulls for ALL properties.
  14773.                         // call clamp with alwaysAllowEmpty
  14774.                         inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  14775.                     });
  14776.  
  14777.                     // everything defined but alpha?
  14778.                     if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  14779.                         // use the default of 1
  14780.                         inst[ cache ][ 3 ] = 1;
  14781.                         if ( space.from ) {
  14782.                             inst._rgba = space.from( inst[ cache ] );
  14783.                         }
  14784.                     }
  14785.                 });
  14786.             }
  14787.             return this;
  14788.         }
  14789.     },
  14790.     is: function( compare ) {
  14791.         var is = color( compare ),
  14792.             same = true,
  14793.             inst = this;
  14794.  
  14795.         each( spaces, function( _, space ) {
  14796.             var localCache,
  14797.                 isCache = is[ space.cache ];
  14798.             if (isCache) {
  14799.                 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  14800.                 each( space.props, function( _, prop ) {
  14801.                     if ( isCache[ prop.idx ] != null ) {
  14802.                         same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  14803.                         return same;
  14804.                     }
  14805.                 });
  14806.             }
  14807.             return same;
  14808.         });
  14809.         return same;
  14810.     },
  14811.     _space: function() {
  14812.         var used = [],
  14813.             inst = this;
  14814.         each( spaces, function( spaceName, space ) {
  14815.             if ( inst[ space.cache ] ) {
  14816.                 used.push( spaceName );
  14817.             }
  14818.         });
  14819.         return used.pop();
  14820.     },
  14821.     transition: function( other, distance ) {
  14822.         var end = color( other ),
  14823.             spaceName = end._space(),
  14824.             space = spaces[ spaceName ],
  14825.             startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  14826.             start = startColor[ space.cache ] || space.to( startColor._rgba ),
  14827.             result = start.slice();
  14828.  
  14829.         end = end[ space.cache ];
  14830.         each( space.props, function( key, prop ) {
  14831.             var index = prop.idx,
  14832.                 startValue = start[ index ],
  14833.                 endValue = end[ index ],
  14834.                 type = propTypes[ prop.type ] || {};
  14835.  
  14836.             // if null, don't override start value
  14837.             if ( endValue === null ) {
  14838.                 return;
  14839.             }
  14840.             // if null - use end
  14841.             if ( startValue === null ) {
  14842.                 result[ index ] = endValue;
  14843.             } else {
  14844.                 if ( type.mod ) {
  14845.                     if ( endValue - startValue > type.mod / 2 ) {
  14846.                         startValue += type.mod;
  14847.                     } else if ( startValue - endValue > type.mod / 2 ) {
  14848.                         startValue -= type.mod;
  14849.                     }
  14850.                 }
  14851.                 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  14852.             }
  14853.         });
  14854.         return this[ spaceName ]( result );
  14855.     },
  14856.     blend: function( opaque ) {
  14857.         // if we are already opaque - return ourself
  14858.         if ( this._rgba[ 3 ] === 1 ) {
  14859.             return this;
  14860.         }
  14861.  
  14862.         var rgb = this._rgba.slice(),
  14863.             a = rgb.pop(),
  14864.             blend = color( opaque )._rgba;
  14865.  
  14866.         return color( jQuery.map( rgb, function( v, i ) {
  14867.             return ( 1 - a ) * blend[ i ] + a * v;
  14868.         }));
  14869.     },
  14870.     toRgbaString: function() {
  14871.         var prefix = "rgba(",
  14872.             rgba = jQuery.map( this._rgba, function( v, i ) {
  14873.                 return v == null ? ( i > 2 ? 1 : 0 ) : v;
  14874.             });
  14875.  
  14876.         if ( rgba[ 3 ] === 1 ) {
  14877.             rgba.pop();
  14878.             prefix = "rgb(";
  14879.         }
  14880.  
  14881.         return prefix + rgba.join() + ")";
  14882.     },
  14883.     toHslaString: function() {
  14884.         var prefix = "hsla(",
  14885.             hsla = jQuery.map( this.hsla(), function( v, i ) {
  14886.                 if ( v == null ) {
  14887.                     v = i > 2 ? 1 : 0;
  14888.                 }
  14889.  
  14890.                 // catch 1 and 2
  14891.                 if ( i && i < 3 ) {
  14892.                     v = Math.round( v * 100 ) + "%";
  14893.                 }
  14894.                 return v;
  14895.             });
  14896.  
  14897.         if ( hsla[ 3 ] === 1 ) {
  14898.             hsla.pop();
  14899.             prefix = "hsl(";
  14900.         }
  14901.         return prefix + hsla.join() + ")";
  14902.     },
  14903.     toHexString: function( includeAlpha ) {
  14904.         var rgba = this._rgba.slice(),
  14905.             alpha = rgba.pop();
  14906.  
  14907.         if ( includeAlpha ) {
  14908.             rgba.push( ~~( alpha * 255 ) );
  14909.         }
  14910.  
  14911.         return "#" + jQuery.map( rgba, function( v ) {
  14912.  
  14913.             // default to 0 when nulls exist
  14914.             v = ( v || 0 ).toString( 16 );
  14915.             return v.length === 1 ? "0" + v : v;
  14916.         }).join("");
  14917.     },
  14918.     toString: function() {
  14919.         return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  14920.     }
  14921. });
  14922. color.fn.parse.prototype = color.fn;
  14923.  
  14924. // hsla conversions adapted from:
  14925. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  14926.  
  14927. function hue2rgb( p, q, h ) {
  14928.     h = ( h + 1 ) % 1;
  14929.     if ( h * 6 < 1 ) {
  14930.         return p + ( q - p ) * h * 6;
  14931.     }
  14932.     if ( h * 2 < 1) {
  14933.         return q;
  14934.     }
  14935.     if ( h * 3 < 2 ) {
  14936.         return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  14937.     }
  14938.     return p;
  14939. }
  14940.  
  14941. spaces.hsla.to = function( rgba ) {
  14942.     if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  14943.         return [ null, null, null, rgba[ 3 ] ];
  14944.     }
  14945.     var r = rgba[ 0 ] / 255,
  14946.         g = rgba[ 1 ] / 255,
  14947.         b = rgba[ 2 ] / 255,
  14948.         a = rgba[ 3 ],
  14949.         max = Math.max( r, g, b ),
  14950.         min = Math.min( r, g, b ),
  14951.         diff = max - min,
  14952.         add = max + min,
  14953.         l = add * 0.5,
  14954.         h, s;
  14955.  
  14956.     if ( min === max ) {
  14957.         h = 0;
  14958.     } else if ( r === max ) {
  14959.         h = ( 60 * ( g - b ) / diff ) + 360;
  14960.     } else if ( g === max ) {
  14961.         h = ( 60 * ( b - r ) / diff ) + 120;
  14962.     } else {
  14963.         h = ( 60 * ( r - g ) / diff ) + 240;
  14964.     }
  14965.  
  14966.     // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  14967.     // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  14968.     if ( diff === 0 ) {
  14969.         s = 0;
  14970.     } else if ( l <= 0.5 ) {
  14971.         s = diff / add;
  14972.     } else {
  14973.         s = diff / ( 2 - add );
  14974.     }
  14975.     return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  14976. };
  14977.  
  14978. spaces.hsla.from = function( hsla ) {
  14979.     if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  14980.         return [ null, null, null, hsla[ 3 ] ];
  14981.     }
  14982.     var h = hsla[ 0 ] / 360,
  14983.         s = hsla[ 1 ],
  14984.         l = hsla[ 2 ],
  14985.         a = hsla[ 3 ],
  14986.         q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  14987.         p = 2 * l - q;
  14988.  
  14989.     return [
  14990.         Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  14991.         Math.round( hue2rgb( p, q, h ) * 255 ),
  14992.         Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  14993.         a
  14994.     ];
  14995. };
  14996.  
  14997. each( spaces, function( spaceName, space ) {
  14998.     var props = space.props,
  14999.         cache = space.cache,
  15000.         to = space.to,
  15001.         from = space.from;
  15002.  
  15003.     // makes rgba() and hsla()
  15004.     color.fn[ spaceName ] = function( value ) {
  15005.  
  15006.         // generate a cache for this space if it doesn't exist
  15007.         if ( to && !this[ cache ] ) {
  15008.             this[ cache ] = to( this._rgba );
  15009.         }
  15010.         if ( value === undefined ) {
  15011.             return this[ cache ].slice();
  15012.         }
  15013.  
  15014.         var ret,
  15015.             type = jQuery.type( value ),
  15016.             arr = ( type === "array" || type === "object" ) ? value : arguments,
  15017.             local = this[ cache ].slice();
  15018.  
  15019.         each( props, function( key, prop ) {
  15020.             var val = arr[ type === "object" ? key : prop.idx ];
  15021.             if ( val == null ) {
  15022.                 val = local[ prop.idx ];
  15023.             }
  15024.             local[ prop.idx ] = clamp( val, prop );
  15025.         });
  15026.  
  15027.         if ( from ) {
  15028.             ret = color( from( local ) );
  15029.             ret[ cache ] = local;
  15030.             return ret;
  15031.         } else {
  15032.             return color( local );
  15033.         }
  15034.     };
  15035.  
  15036.     // makes red() green() blue() alpha() hue() saturation() lightness()
  15037.     each( props, function( key, prop ) {
  15038.         // alpha is included in more than one space
  15039.         if ( color.fn[ key ] ) {
  15040.             return;
  15041.         }
  15042.         color.fn[ key ] = function( value ) {
  15043.             var vtype = jQuery.type( value ),
  15044.                 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  15045.                 local = this[ fn ](),
  15046.                 cur = local[ prop.idx ],
  15047.                 match;
  15048.  
  15049.             if ( vtype === "undefined" ) {
  15050.                 return cur;
  15051.             }
  15052.  
  15053.             if ( vtype === "function" ) {
  15054.                 value = value.call( this, cur );
  15055.                 vtype = jQuery.type( value );
  15056.             }
  15057.             if ( value == null && prop.empty ) {
  15058.                 return this;
  15059.             }
  15060.             if ( vtype === "string" ) {
  15061.                 match = rplusequals.exec( value );
  15062.                 if ( match ) {
  15063.                     value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  15064.                 }
  15065.             }
  15066.             local[ prop.idx ] = value;
  15067.             return this[ fn ]( local );
  15068.         };
  15069.     });
  15070. });
  15071.  
  15072. // add cssHook and .fx.step function for each named hook.
  15073. // accept a space separated string of properties
  15074. color.hook = function( hook ) {
  15075.     var hooks = hook.split( " " );
  15076.     each( hooks, function( i, hook ) {
  15077.         jQuery.cssHooks[ hook ] = {
  15078.             set: function( elem, value ) {
  15079.                 var parsed, curElem,
  15080.                     backgroundColor = "";
  15081.  
  15082.                 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  15083.                     value = color( parsed || value );
  15084.                     if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  15085.                         curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  15086.                         while (
  15087.                             (backgroundColor === "" || backgroundColor === "transparent") &&
  15088.                             curElem && curElem.style
  15089.                         ) {
  15090.                             try {
  15091.                                 backgroundColor = jQuery.css( curElem, "backgroundColor" );
  15092.                                 curElem = curElem.parentNode;
  15093.                             } catch ( e ) {
  15094.                             }
  15095.                         }
  15096.  
  15097.                         value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  15098.                             backgroundColor :
  15099.                             "_default" );
  15100.                     }
  15101.  
  15102.                     value = value.toRgbaString();
  15103.                 }
  15104.                 try {
  15105.                     elem.style[ hook ] = value;
  15106.                 } catch ( e ) {
  15107.                     // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  15108.                 }
  15109.             }
  15110.         };
  15111.         jQuery.fx.step[ hook ] = function( fx ) {
  15112.             if ( !fx.colorInit ) {
  15113.                 fx.start = color( fx.elem, hook );
  15114.                 fx.end = color( fx.end );
  15115.                 fx.colorInit = true;
  15116.             }
  15117.             jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  15118.         };
  15119.     });
  15120.  
  15121. };
  15122.  
  15123. color.hook( stepHooks );
  15124.  
  15125. jQuery.cssHooks.borderColor = {
  15126.     expand: function( value ) {
  15127.         var expanded = {};
  15128.  
  15129.         each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  15130.             expanded[ "border" + part + "Color" ] = value;
  15131.         });
  15132.         return expanded;
  15133.     }
  15134. };
  15135.  
  15136. // Basic color names only.
  15137. // Usage of any of the other color names requires adding yourself or including
  15138. // jquery.color.svg-names.js.
  15139. colors = jQuery.Color.names = {
  15140.     // 4.1. Basic color keywords
  15141.     aqua: "#00ffff",
  15142.     black: "#000000",
  15143.     blue: "#0000ff",
  15144.     fuchsia: "#ff00ff",
  15145.     gray: "#808080",
  15146.     green: "#008000",
  15147.     lime: "#00ff00",
  15148.     maroon: "#800000",
  15149.     navy: "#000080",
  15150.     olive: "#808000",
  15151.     purple: "#800080",
  15152.     red: "#ff0000",
  15153.     silver: "#c0c0c0",
  15154.     teal: "#008080",
  15155.     white: "#ffffff",
  15156.     yellow: "#ffff00",
  15157.  
  15158.     // 4.2.3. "transparent" color keyword
  15159.     transparent: [ null, null, null, 0 ],
  15160.  
  15161.     _default: "#ffffff"
  15162. };
  15163.  
  15164. })( jQuery );
  15165.  
  15166. /******************************************************************************/
  15167. /****************************** CLASS ANIMATIONS ******************************/
  15168. /******************************************************************************/
  15169. (function() {
  15170.  
  15171. var classAnimationActions = [ "add", "remove", "toggle" ],
  15172.     shorthandStyles = {
  15173.         border: 1,
  15174.         borderBottom: 1,
  15175.         borderColor: 1,
  15176.         borderLeft: 1,
  15177.         borderRight: 1,
  15178.         borderTop: 1,
  15179.         borderWidth: 1,
  15180.         margin: 1,
  15181.         padding: 1
  15182.     };
  15183.  
  15184. $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
  15185.     $.fx.step[ prop ] = function( fx ) {
  15186.         if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  15187.             jQuery.style( fx.elem, prop, fx.end );
  15188.             fx.setAttr = true;
  15189.         }
  15190.     };
  15191. });
  15192.  
  15193. function getElementStyles( elem ) {
  15194.     var key, len,
  15195.         style = elem.ownerDocument.defaultView ?
  15196.             elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  15197.             elem.currentStyle,
  15198.         styles = {};
  15199.  
  15200.     if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  15201.         len = style.length;
  15202.         while ( len-- ) {
  15203.             key = style[ len ];
  15204.             if ( typeof style[ key ] === "string" ) {
  15205.                 styles[ $.camelCase( key ) ] = style[ key ];
  15206.             }
  15207.         }
  15208.     // support: Opera, IE <9
  15209.     } else {
  15210.         for ( key in style ) {
  15211.             if ( typeof style[ key ] === "string" ) {
  15212.                 styles[ key ] = style[ key ];
  15213.             }
  15214.         }
  15215.     }
  15216.  
  15217.     return styles;
  15218. }
  15219.  
  15220. function styleDifference( oldStyle, newStyle ) {
  15221.     var diff = {},
  15222.         name, value;
  15223.  
  15224.     for ( name in newStyle ) {
  15225.         value = newStyle[ name ];
  15226.         if ( oldStyle[ name ] !== value ) {
  15227.             if ( !shorthandStyles[ name ] ) {
  15228.                 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  15229.                     diff[ name ] = value;
  15230.                 }
  15231.             }
  15232.         }
  15233.     }
  15234.  
  15235.     return diff;
  15236. }
  15237.  
  15238. // support: jQuery <1.8
  15239. if ( !$.fn.addBack ) {
  15240.     $.fn.addBack = function( selector ) {
  15241.         return this.add( selector == null ?
  15242.             this.prevObject : this.prevObject.filter( selector )
  15243.         );
  15244.     };
  15245. }
  15246.  
  15247. $.effects.animateClass = function( value, duration, easing, callback ) {
  15248.     var o = $.speed( duration, easing, callback );
  15249.  
  15250.     return this.queue( function() {
  15251.         var animated = $( this ),
  15252.             baseClass = animated.attr( "class" ) || "",
  15253.             applyClassChange,
  15254.             allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  15255.  
  15256.         // map the animated objects to store the original styles.
  15257.         allAnimations = allAnimations.map(function() {
  15258.             var el = $( this );
  15259.             return {
  15260.                 el: el,
  15261.                 start: getElementStyles( this )
  15262.             };
  15263.         });
  15264.  
  15265.         // apply class change
  15266.         applyClassChange = function() {
  15267.             $.each( classAnimationActions, function(i, action) {
  15268.                 if ( value[ action ] ) {
  15269.                     animated[ action + "Class" ]( value[ action ] );
  15270.                 }
  15271.             });
  15272.         };
  15273.         applyClassChange();
  15274.  
  15275.         // map all animated objects again - calculate new styles and diff
  15276.         allAnimations = allAnimations.map(function() {
  15277.             this.end = getElementStyles( this.el[ 0 ] );
  15278.             this.diff = styleDifference( this.start, this.end );
  15279.             return this;
  15280.         });
  15281.  
  15282.         // apply original class
  15283.         animated.attr( "class", baseClass );
  15284.  
  15285.         // map all animated objects again - this time collecting a promise
  15286.         allAnimations = allAnimations.map(function() {
  15287.             var styleInfo = this,
  15288.                 dfd = $.Deferred(),
  15289.                 opts = $.extend({}, o, {
  15290.                     queue: false,
  15291.                     complete: function() {
  15292.                         dfd.resolve( styleInfo );
  15293.                     }
  15294.                 });
  15295.  
  15296.             this.el.animate( this.diff, opts );
  15297.             return dfd.promise();
  15298.         });
  15299.  
  15300.         // once all animations have completed:
  15301.         $.when.apply( $, allAnimations.get() ).done(function() {
  15302.  
  15303.             // set the final class
  15304.             applyClassChange();
  15305.  
  15306.             // for each animated element,
  15307.             // clear all css properties that were animated
  15308.             $.each( arguments, function() {
  15309.                 var el = this.el;
  15310.                 $.each( this.diff, function(key) {
  15311.                     el.css( key, "" );
  15312.                 });
  15313.             });
  15314.  
  15315.             // this is guarnteed to be there if you use jQuery.speed()
  15316.             // it also handles dequeuing the next anim...
  15317.             o.complete.call( animated[ 0 ] );
  15318.         });
  15319.     });
  15320. };
  15321.  
  15322. $.fn.extend({
  15323.     addClass: (function( orig ) {
  15324.         return function( classNames, speed, easing, callback ) {
  15325.             return speed ?
  15326.                 $.effects.animateClass.call( this,
  15327.                     { add: classNames }, speed, easing, callback ) :
  15328.                 orig.apply( this, arguments );
  15329.         };
  15330.     })( $.fn.addClass ),
  15331.  
  15332.     removeClass: (function( orig ) {
  15333.         return function( classNames, speed, easing, callback ) {
  15334.             return arguments.length > 1 ?
  15335.                 $.effects.animateClass.call( this,
  15336.                     { remove: classNames }, speed, easing, callback ) :
  15337.                 orig.apply( this, arguments );
  15338.         };
  15339.     })( $.fn.removeClass ),
  15340.  
  15341.     toggleClass: (function( orig ) {
  15342.         return function( classNames, force, speed, easing, callback ) {
  15343.             if ( typeof force === "boolean" || force === undefined ) {
  15344.                 if ( !speed ) {
  15345.                     // without speed parameter
  15346.                     return orig.apply( this, arguments );
  15347.                 } else {
  15348.                     return $.effects.animateClass.call( this,
  15349.                         (force ? { add: classNames } : { remove: classNames }),
  15350.                         speed, easing, callback );
  15351.                 }
  15352.             } else {
  15353.                 // without force parameter
  15354.                 return $.effects.animateClass.call( this,
  15355.                     { toggle: classNames }, force, speed, easing );
  15356.             }
  15357.         };
  15358.     })( $.fn.toggleClass ),
  15359.  
  15360.     switchClass: function( remove, add, speed, easing, callback) {
  15361.         return $.effects.animateClass.call( this, {
  15362.             add: add,
  15363.             remove: remove
  15364.         }, speed, easing, callback );
  15365.     }
  15366. });
  15367.  
  15368. })();
  15369.  
  15370. /******************************************************************************/
  15371. /*********************************** EFFECTS **********************************/
  15372. /******************************************************************************/
  15373.  
  15374. (function() {
  15375.  
  15376. $.extend( $.effects, {
  15377.     version: "1.11.4",
  15378.  
  15379.     // Saves a set of properties in a data storage
  15380.     save: function( element, set ) {
  15381.         for ( var i = 0; i < set.length; i++ ) {
  15382.             if ( set[ i ] !== null ) {
  15383.                 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  15384.             }
  15385.         }
  15386.     },
  15387.  
  15388.     // Restores a set of previously saved properties from a data storage
  15389.     restore: function( element, set ) {
  15390.         var val, i;
  15391.         for ( i = 0; i < set.length; i++ ) {
  15392.             if ( set[ i ] !== null ) {
  15393.                 val = element.data( dataSpace + set[ i ] );
  15394.                 // support: jQuery 1.6.2
  15395.                 // http://bugs.jquery.com/ticket/9917
  15396.                 // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
  15397.                 // We can't differentiate between "" and 0 here, so we just assume
  15398.                 // empty string since it's likely to be a more common value...
  15399.                 if ( val === undefined ) {
  15400.                     val = "";
  15401.                 }
  15402.                 element.css( set[ i ], val );
  15403.             }
  15404.         }
  15405.     },
  15406.  
  15407.     setMode: function( el, mode ) {
  15408.         if (mode === "toggle") {
  15409.             mode = el.is( ":hidden" ) ? "show" : "hide";
  15410.         }
  15411.         return mode;
  15412.     },
  15413.  
  15414.     // Translates a [top,left] array into a baseline value
  15415.     // this should be a little more flexible in the future to handle a string & hash
  15416.     getBaseline: function( origin, original ) {
  15417.         var y, x;
  15418.         switch ( origin[ 0 ] ) {
  15419.             case "top": y = 0; break;
  15420.             case "middle": y = 0.5; break;
  15421.             case "bottom": y = 1; break;
  15422.             default: y = origin[ 0 ] / original.height;
  15423.         }
  15424.         switch ( origin[ 1 ] ) {
  15425.             case "left": x = 0; break;
  15426.             case "center": x = 0.5; break;
  15427.             case "right": x = 1; break;
  15428.             default: x = origin[ 1 ] / original.width;
  15429.         }
  15430.         return {
  15431.             x: x,
  15432.             y: y
  15433.         };
  15434.     },
  15435.  
  15436.     // Wraps the element around a wrapper that copies position properties
  15437.     createWrapper: function( element ) {
  15438.  
  15439.         // if the element is already wrapped, return it
  15440.         if ( element.parent().is( ".ui-effects-wrapper" )) {
  15441.             return element.parent();
  15442.         }
  15443.  
  15444.         // wrap the element
  15445.         var props = {
  15446.                 width: element.outerWidth(true),
  15447.                 height: element.outerHeight(true),
  15448.                 "float": element.css( "float" )
  15449.             },
  15450.             wrapper = $( "<div></div>" )
  15451.                 .addClass( "ui-effects-wrapper" )
  15452.                 .css({
  15453.                     fontSize: "100%",
  15454.                     background: "transparent",
  15455.                     border: "none",
  15456.                     margin: 0,
  15457.                     padding: 0
  15458.                 }),
  15459.             // Store the size in case width/height are defined in % - Fixes #5245
  15460.             size = {
  15461.                 width: element.width(),
  15462.                 height: element.height()
  15463.             },
  15464.             active = document.activeElement;
  15465.  
  15466.         // support: Firefox
  15467.         // Firefox incorrectly exposes anonymous content
  15468.         // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  15469.         try {
  15470.             active.id;
  15471.         } catch ( e ) {
  15472.             active = document.body;
  15473.         }
  15474.  
  15475.         element.wrap( wrapper );
  15476.  
  15477.         // Fixes #7595 - Elements lose focus when wrapped.
  15478.         if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  15479.             $( active ).focus();
  15480.         }
  15481.  
  15482.         wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
  15483.  
  15484.         // transfer positioning properties to the wrapper
  15485.         if ( element.css( "position" ) === "static" ) {
  15486.             wrapper.css({ position: "relative" });
  15487.             element.css({ position: "relative" });
  15488.         } else {
  15489.             $.extend( props, {
  15490.                 position: element.css( "position" ),
  15491.                 zIndex: element.css( "z-index" )
  15492.             });
  15493.             $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
  15494.                 props[ pos ] = element.css( pos );
  15495.                 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  15496.                     props[ pos ] = "auto";
  15497.                 }
  15498.             });
  15499.             element.css({
  15500.                 position: "relative",
  15501.                 top: 0,
  15502.                 left: 0,
  15503.                 right: "auto",
  15504.                 bottom: "auto"
  15505.             });
  15506.         }
  15507.         element.css(size);
  15508.  
  15509.         return wrapper.css( props ).show();
  15510.     },
  15511.  
  15512.     removeWrapper: function( element ) {
  15513.         var active = document.activeElement;
  15514.  
  15515.         if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  15516.             element.parent().replaceWith( element );
  15517.  
  15518.             // Fixes #7595 - Elements lose focus when wrapped.
  15519.             if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  15520.                 $( active ).focus();
  15521.             }
  15522.         }
  15523.  
  15524.         return element;
  15525.     },
  15526.  
  15527.     setTransition: function( element, list, factor, value ) {
  15528.         value = value || {};
  15529.         $.each( list, function( i, x ) {
  15530.             var unit = element.cssUnit( x );
  15531.             if ( unit[ 0 ] > 0 ) {
  15532.                 value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  15533.             }
  15534.         });
  15535.         return value;
  15536.     }
  15537. });
  15538.  
  15539. // return an effect options object for the given parameters:
  15540. function _normalizeArguments( effect, options, speed, callback ) {
  15541.  
  15542.     // allow passing all options as the first parameter
  15543.     if ( $.isPlainObject( effect ) ) {
  15544.         options = effect;
  15545.         effect = effect.effect;
  15546.     }
  15547.  
  15548.     // convert to an object
  15549.     effect = { effect: effect };
  15550.  
  15551.     // catch (effect, null, ...)
  15552.     if ( options == null ) {
  15553.         options = {};
  15554.     }
  15555.  
  15556.     // catch (effect, callback)
  15557.     if ( $.isFunction( options ) ) {
  15558.         callback = options;
  15559.         speed = null;
  15560.         options = {};
  15561.     }
  15562.  
  15563.     // catch (effect, speed, ?)
  15564.     if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  15565.         callback = speed;
  15566.         speed = options;
  15567.         options = {};
  15568.     }
  15569.  
  15570.     // catch (effect, options, callback)
  15571.     if ( $.isFunction( speed ) ) {
  15572.         callback = speed;
  15573.         speed = null;
  15574.     }
  15575.  
  15576.     // add options to effect
  15577.     if ( options ) {
  15578.         $.extend( effect, options );
  15579.     }
  15580.  
  15581.     speed = speed || options.duration;
  15582.     effect.duration = $.fx.off ? 0 :
  15583.         typeof speed === "number" ? speed :
  15584.         speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  15585.         $.fx.speeds._default;
  15586.  
  15587.     effect.complete = callback || options.complete;
  15588.  
  15589.     return effect;
  15590. }
  15591.  
  15592. function standardAnimationOption( option ) {
  15593.     // Valid standard speeds (nothing, number, named speed)
  15594.     if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  15595.         return true;
  15596.     }
  15597.  
  15598.     // Invalid strings - treat as "normal" speed
  15599.     if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  15600.         return true;
  15601.     }
  15602.  
  15603.     // Complete callback
  15604.     if ( $.isFunction( option ) ) {
  15605.         return true;
  15606.     }
  15607.  
  15608.     // Options hash (but not naming an effect)
  15609.     if ( typeof option === "object" && !option.effect ) {
  15610.         return true;
  15611.     }
  15612.  
  15613.     // Didn't match any standard API
  15614.     return false;
  15615. }
  15616.  
  15617. $.fn.extend({
  15618.     effect: function( /* effect, options, speed, callback */ ) {
  15619.         var args = _normalizeArguments.apply( this, arguments ),
  15620.             mode = args.mode,
  15621.             queue = args.queue,
  15622.             effectMethod = $.effects.effect[ args.effect ];
  15623.  
  15624.         if ( $.fx.off || !effectMethod ) {
  15625.             // delegate to the original method (e.g., .show()) if possible
  15626.             if ( mode ) {
  15627.                 return this[ mode ]( args.duration, args.complete );
  15628.             } else {
  15629.                 return this.each( function() {
  15630.                     if ( args.complete ) {
  15631.                         args.complete.call( this );
  15632.                     }
  15633.                 });
  15634.             }
  15635.         }
  15636.  
  15637.         function run( next ) {
  15638.             var elem = $( this ),
  15639.                 complete = args.complete,
  15640.                 mode = args.mode;
  15641.  
  15642.             function done() {
  15643.                 if ( $.isFunction( complete ) ) {
  15644.                     complete.call( elem[0] );
  15645.                 }
  15646.                 if ( $.isFunction( next ) ) {
  15647.                     next();
  15648.                 }
  15649.             }
  15650.  
  15651.             // If the element already has the correct final state, delegate to
  15652.             // the core methods so the internal tracking of "olddisplay" works.
  15653.             if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  15654.                 elem[ mode ]();
  15655.                 done();
  15656.             } else {
  15657.                 effectMethod.call( elem[0], args, done );
  15658.             }
  15659.         }
  15660.  
  15661.         return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
  15662.     },
  15663.  
  15664.     show: (function( orig ) {
  15665.         return function( option ) {
  15666.             if ( standardAnimationOption( option ) ) {
  15667.                 return orig.apply( this, arguments );
  15668.             } else {
  15669.                 var args = _normalizeArguments.apply( this, arguments );
  15670.                 args.mode = "show";
  15671.                 return this.effect.call( this, args );
  15672.             }
  15673.         };
  15674.     })( $.fn.show ),
  15675.  
  15676.     hide: (function( orig ) {
  15677.         return function( option ) {
  15678.             if ( standardAnimationOption( option ) ) {
  15679.                 return orig.apply( this, arguments );
  15680.             } else {
  15681.                 var args = _normalizeArguments.apply( this, arguments );
  15682.                 args.mode = "hide";
  15683.                 return this.effect.call( this, args );
  15684.             }
  15685.         };
  15686.     })( $.fn.hide ),
  15687.  
  15688.     toggle: (function( orig ) {
  15689.         return function( option ) {
  15690.             if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  15691.                 return orig.apply( this, arguments );
  15692.             } else {
  15693.                 var args = _normalizeArguments.apply( this, arguments );
  15694.                 args.mode = "toggle";
  15695.                 return this.effect.call( this, args );
  15696.             }
  15697.         };
  15698.     })( $.fn.toggle ),
  15699.  
  15700.     // helper functions
  15701.     cssUnit: function(key) {
  15702.         var style = this.css( key ),
  15703.             val = [];
  15704.  
  15705.         $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  15706.             if ( style.indexOf( unit ) > 0 ) {
  15707.                 val = [ parseFloat( style ), unit ];
  15708.             }
  15709.         });
  15710.         return val;
  15711.     }
  15712. });
  15713.  
  15714. })();
  15715.  
  15716. /******************************************************************************/
  15717. /*********************************** EASING ***********************************/
  15718. /******************************************************************************/
  15719.  
  15720. (function() {
  15721.  
  15722. // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  15723.  
  15724. var baseEasings = {};
  15725.  
  15726. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  15727.     baseEasings[ name ] = function( p ) {
  15728.         return Math.pow( p, i + 2 );
  15729.     };
  15730. });
  15731.  
  15732. $.extend( baseEasings, {
  15733.     Sine: function( p ) {
  15734.         return 1 - Math.cos( p * Math.PI / 2 );
  15735.     },
  15736.     Circ: function( p ) {
  15737.         return 1 - Math.sqrt( 1 - p * p );
  15738.     },
  15739.     Elastic: function( p ) {
  15740.         return p === 0 || p === 1 ? p :
  15741.             -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
  15742.     },
  15743.     Back: function( p ) {
  15744.         return p * p * ( 3 * p - 2 );
  15745.     },
  15746.     Bounce: function( p ) {
  15747.         var pow2,
  15748.             bounce = 4;
  15749.  
  15750.         while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  15751.         return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  15752.     }
  15753. });
  15754.  
  15755. $.each( baseEasings, function( name, easeIn ) {
  15756.     $.easing[ "easeIn" + name ] = easeIn;
  15757.     $.easing[ "easeOut" + name ] = function( p ) {
  15758.         return 1 - easeIn( 1 - p );
  15759.     };
  15760.     $.easing[ "easeInOut" + name ] = function( p ) {
  15761.         return p < 0.5 ?
  15762.             easeIn( p * 2 ) / 2 :
  15763.             1 - easeIn( p * -2 + 2 ) / 2;
  15764.     };
  15765. });
  15766.  
  15767. })();
  15768.  
  15769. var effect = $.effects;
  15770.  
  15771.  
  15772. /*!
  15773.  * jQuery UI Effects Blind 1.11.4
  15774.  * http://jqueryui.com
  15775.  *
  15776.  * Copyright jQuery Foundation and other contributors
  15777.  * Released under the MIT license.
  15778.  * http://jquery.org/license
  15779.  *
  15780.  * http://api.jqueryui.com/blind-effect/
  15781.  */
  15782.  
  15783.  
  15784. var effectBlind = $.effects.effect.blind = function( o, done ) {
  15785.     // Create element
  15786.     var el = $( this ),
  15787.         rvertical = /up|down|vertical/,
  15788.         rpositivemotion = /up|left|vertical|horizontal/,
  15789.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15790.         mode = $.effects.setMode( el, o.mode || "hide" ),
  15791.         direction = o.direction || "up",
  15792.         vertical = rvertical.test( direction ),
  15793.         ref = vertical ? "height" : "width",
  15794.         ref2 = vertical ? "top" : "left",
  15795.         motion = rpositivemotion.test( direction ),
  15796.         animation = {},
  15797.         show = mode === "show",
  15798.         wrapper, distance, margin;
  15799.  
  15800.     // if already wrapped, the wrapper's properties are my property. #6245
  15801.     if ( el.parent().is( ".ui-effects-wrapper" ) ) {
  15802.         $.effects.save( el.parent(), props );
  15803.     } else {
  15804.         $.effects.save( el, props );
  15805.     }
  15806.     el.show();
  15807.     wrapper = $.effects.createWrapper( el ).css({
  15808.         overflow: "hidden"
  15809.     });
  15810.  
  15811.     distance = wrapper[ ref ]();
  15812.     margin = parseFloat( wrapper.css( ref2 ) ) || 0;
  15813.  
  15814.     animation[ ref ] = show ? distance : 0;
  15815.     if ( !motion ) {
  15816.         el
  15817.             .css( vertical ? "bottom" : "right", 0 )
  15818.             .css( vertical ? "top" : "left", "auto" )
  15819.             .css({ position: "absolute" });
  15820.  
  15821.         animation[ ref2 ] = show ? margin : distance + margin;
  15822.     }
  15823.  
  15824.     // start at 0 if we are showing
  15825.     if ( show ) {
  15826.         wrapper.css( ref, 0 );
  15827.         if ( !motion ) {
  15828.             wrapper.css( ref2, margin + distance );
  15829.         }
  15830.     }
  15831.  
  15832.     // Animate
  15833.     wrapper.animate( animation, {
  15834.         duration: o.duration,
  15835.         easing: o.easing,
  15836.         queue: false,
  15837.         complete: function() {
  15838.             if ( mode === "hide" ) {
  15839.                 el.hide();
  15840.             }
  15841.             $.effects.restore( el, props );
  15842.             $.effects.removeWrapper( el );
  15843.             done();
  15844.         }
  15845.     });
  15846. };
  15847.  
  15848.  
  15849. /*!
  15850.  * jQuery UI Effects Bounce 1.11.4
  15851.  * http://jqueryui.com
  15852.  *
  15853.  * Copyright jQuery Foundation and other contributors
  15854.  * Released under the MIT license.
  15855.  * http://jquery.org/license
  15856.  *
  15857.  * http://api.jqueryui.com/bounce-effect/
  15858.  */
  15859.  
  15860.  
  15861. var effectBounce = $.effects.effect.bounce = function( o, done ) {
  15862.     var el = $( this ),
  15863.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15864.  
  15865.         // defaults:
  15866.         mode = $.effects.setMode( el, o.mode || "effect" ),
  15867.         hide = mode === "hide",
  15868.         show = mode === "show",
  15869.         direction = o.direction || "up",
  15870.         distance = o.distance,
  15871.         times = o.times || 5,
  15872.  
  15873.         // number of internal animations
  15874.         anims = times * 2 + ( show || hide ? 1 : 0 ),
  15875.         speed = o.duration / anims,
  15876.         easing = o.easing,
  15877.  
  15878.         // utility:
  15879.         ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15880.         motion = ( direction === "up" || direction === "left" ),
  15881.         i,
  15882.         upAnim,
  15883.         downAnim,
  15884.  
  15885.         // we will need to re-assemble the queue to stack our animations in place
  15886.         queue = el.queue(),
  15887.         queuelen = queue.length;
  15888.  
  15889.     // Avoid touching opacity to prevent clearType and PNG issues in IE
  15890.     if ( show || hide ) {
  15891.         props.push( "opacity" );
  15892.     }
  15893.  
  15894.     $.effects.save( el, props );
  15895.     el.show();
  15896.     $.effects.createWrapper( el ); // Create Wrapper
  15897.  
  15898.     // default distance for the BIGGEST bounce is the outer Distance / 3
  15899.     if ( !distance ) {
  15900.         distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
  15901.     }
  15902.  
  15903.     if ( show ) {
  15904.         downAnim = { opacity: 1 };
  15905.         downAnim[ ref ] = 0;
  15906.  
  15907.         // if we are showing, force opacity 0 and set the initial position
  15908.         // then do the "first" animation
  15909.         el.css( "opacity", 0 )
  15910.             .css( ref, motion ? -distance * 2 : distance * 2 )
  15911.             .animate( downAnim, speed, easing );
  15912.     }
  15913.  
  15914.     // start at the smallest distance if we are hiding
  15915.     if ( hide ) {
  15916.         distance = distance / Math.pow( 2, times - 1 );
  15917.     }
  15918.  
  15919.     downAnim = {};
  15920.     downAnim[ ref ] = 0;
  15921.     // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  15922.     for ( i = 0; i < times; i++ ) {
  15923.         upAnim = {};
  15924.         upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15925.  
  15926.         el.animate( upAnim, speed, easing )
  15927.             .animate( downAnim, speed, easing );
  15928.  
  15929.         distance = hide ? distance * 2 : distance / 2;
  15930.     }
  15931.  
  15932.     // Last Bounce when Hiding
  15933.     if ( hide ) {
  15934.         upAnim = { opacity: 0 };
  15935.         upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15936.  
  15937.         el.animate( upAnim, speed, easing );
  15938.     }
  15939.  
  15940.     el.queue(function() {
  15941.         if ( hide ) {
  15942.             el.hide();
  15943.         }
  15944.         $.effects.restore( el, props );
  15945.         $.effects.removeWrapper( el );
  15946.         done();
  15947.     });
  15948.  
  15949.     // inject all the animations we just queued to be first in line (after "inprogress")
  15950.     if ( queuelen > 1) {
  15951.         queue.splice.apply( queue,
  15952.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  15953.     }
  15954.     el.dequeue();
  15955.  
  15956. };
  15957.  
  15958.  
  15959. /*!
  15960.  * jQuery UI Effects Clip 1.11.4
  15961.  * http://jqueryui.com
  15962.  *
  15963.  * Copyright jQuery Foundation and other contributors
  15964.  * Released under the MIT license.
  15965.  * http://jquery.org/license
  15966.  *
  15967.  * http://api.jqueryui.com/clip-effect/
  15968.  */
  15969.  
  15970.  
  15971. var effectClip = $.effects.effect.clip = function( o, done ) {
  15972.     // Create element
  15973.     var el = $( this ),
  15974.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  15975.         mode = $.effects.setMode( el, o.mode || "hide" ),
  15976.         show = mode === "show",
  15977.         direction = o.direction || "vertical",
  15978.         vert = direction === "vertical",
  15979.         size = vert ? "height" : "width",
  15980.         position = vert ? "top" : "left",
  15981.         animation = {},
  15982.         wrapper, animate, distance;
  15983.  
  15984.     // Save & Show
  15985.     $.effects.save( el, props );
  15986.     el.show();
  15987.  
  15988.     // Create Wrapper
  15989.     wrapper = $.effects.createWrapper( el ).css({
  15990.         overflow: "hidden"
  15991.     });
  15992.     animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
  15993.     distance = animate[ size ]();
  15994.  
  15995.     // Shift
  15996.     if ( show ) {
  15997.         animate.css( size, 0 );
  15998.         animate.css( position, distance / 2 );
  15999.     }
  16000.  
  16001.     // Create Animation Object:
  16002.     animation[ size ] = show ? distance : 0;
  16003.     animation[ position ] = show ? 0 : distance / 2;
  16004.  
  16005.     // Animate
  16006.     animate.animate( animation, {
  16007.         queue: false,
  16008.         duration: o.duration,
  16009.         easing: o.easing,
  16010.         complete: function() {
  16011.             if ( !show ) {
  16012.                 el.hide();
  16013.             }
  16014.             $.effects.restore( el, props );
  16015.             $.effects.removeWrapper( el );
  16016.             done();
  16017.         }
  16018.     });
  16019.  
  16020. };
  16021.  
  16022.  
  16023. /*!
  16024.  * jQuery UI Effects Drop 1.11.4
  16025.  * http://jqueryui.com
  16026.  *
  16027.  * Copyright jQuery Foundation and other contributors
  16028.  * Released under the MIT license.
  16029.  * http://jquery.org/license
  16030.  *
  16031.  * http://api.jqueryui.com/drop-effect/
  16032.  */
  16033.  
  16034.  
  16035. var effectDrop = $.effects.effect.drop = function( o, done ) {
  16036.  
  16037.     var el = $( this ),
  16038.         props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
  16039.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16040.         show = mode === "show",
  16041.         direction = o.direction || "left",
  16042.         ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  16043.         motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
  16044.         animation = {
  16045.             opacity: show ? 1 : 0
  16046.         },
  16047.         distance;
  16048.  
  16049.     // Adjust
  16050.     $.effects.save( el, props );
  16051.     el.show();
  16052.     $.effects.createWrapper( el );
  16053.  
  16054.     distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  16055.  
  16056.     if ( show ) {
  16057.         el
  16058.             .css( "opacity", 0 )
  16059.             .css( ref, motion === "pos" ? -distance : distance );
  16060.     }
  16061.  
  16062.     // Animation
  16063.     animation[ ref ] = ( show ?
  16064.         ( motion === "pos" ? "+=" : "-=" ) :
  16065.         ( motion === "pos" ? "-=" : "+=" ) ) +
  16066.         distance;
  16067.  
  16068.     // Animate
  16069.     el.animate( animation, {
  16070.         queue: false,
  16071.         duration: o.duration,
  16072.         easing: o.easing,
  16073.         complete: function() {
  16074.             if ( mode === "hide" ) {
  16075.                 el.hide();
  16076.             }
  16077.             $.effects.restore( el, props );
  16078.             $.effects.removeWrapper( el );
  16079.             done();
  16080.         }
  16081.     });
  16082. };
  16083.  
  16084.  
  16085. /*!
  16086.  * jQuery UI Effects Explode 1.11.4
  16087.  * http://jqueryui.com
  16088.  *
  16089.  * Copyright jQuery Foundation and other contributors
  16090.  * Released under the MIT license.
  16091.  * http://jquery.org/license
  16092.  *
  16093.  * http://api.jqueryui.com/explode-effect/
  16094.  */
  16095.  
  16096.  
  16097. var effectExplode = $.effects.effect.explode = function( o, done ) {
  16098.  
  16099.     var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
  16100.         cells = rows,
  16101.         el = $( this ),
  16102.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16103.         show = mode === "show",
  16104.  
  16105.         // show and then visibility:hidden the element before calculating offset
  16106.         offset = el.show().css( "visibility", "hidden" ).offset(),
  16107.  
  16108.         // width and height of a piece
  16109.         width = Math.ceil( el.outerWidth() / cells ),
  16110.         height = Math.ceil( el.outerHeight() / rows ),
  16111.         pieces = [],
  16112.  
  16113.         // loop
  16114.         i, j, left, top, mx, my;
  16115.  
  16116.     // children animate complete:
  16117.     function childComplete() {
  16118.         pieces.push( this );
  16119.         if ( pieces.length === rows * cells ) {
  16120.             animComplete();
  16121.         }
  16122.     }
  16123.  
  16124.     // clone the element for each row and cell.
  16125.     for ( i = 0; i < rows ; i++ ) { // ===>
  16126.         top = offset.top + i * height;
  16127.         my = i - ( rows - 1 ) / 2 ;
  16128.  
  16129.         for ( j = 0; j < cells ; j++ ) { // |||
  16130.             left = offset.left + j * width;
  16131.             mx = j - ( cells - 1 ) / 2 ;
  16132.  
  16133.             // Create a clone of the now hidden main element that will be absolute positioned
  16134.             // within a wrapper div off the -left and -top equal to size of our pieces
  16135.             el
  16136.                 .clone()
  16137.                 .appendTo( "body" )
  16138.                 .wrap( "<div></div>" )
  16139.                 .css({
  16140.                     position: "absolute",
  16141.                     visibility: "visible",
  16142.                     left: -j * width,
  16143.                     top: -i * height
  16144.                 })
  16145.  
  16146.             // select the wrapper - make it overflow: hidden and absolute positioned based on
  16147.             // where the original was located +left and +top equal to the size of pieces
  16148.                 .parent()
  16149.                 .addClass( "ui-effects-explode" )
  16150.                 .css({
  16151.                     position: "absolute",
  16152.                     overflow: "hidden",
  16153.                     width: width,
  16154.                     height: height,
  16155.                     left: left + ( show ? mx * width : 0 ),
  16156.                     top: top + ( show ? my * height : 0 ),
  16157.                     opacity: show ? 0 : 1
  16158.                 }).animate({
  16159.                     left: left + ( show ? 0 : mx * width ),
  16160.                     top: top + ( show ? 0 : my * height ),
  16161.                     opacity: show ? 1 : 0
  16162.                 }, o.duration || 500, o.easing, childComplete );
  16163.         }
  16164.     }
  16165.  
  16166.     function animComplete() {
  16167.         el.css({
  16168.             visibility: "visible"
  16169.         });
  16170.         $( pieces ).remove();
  16171.         if ( !show ) {
  16172.             el.hide();
  16173.         }
  16174.         done();
  16175.     }
  16176. };
  16177.  
  16178.  
  16179. /*!
  16180.  * jQuery UI Effects Fade 1.11.4
  16181.  * http://jqueryui.com
  16182.  *
  16183.  * Copyright jQuery Foundation and other contributors
  16184.  * Released under the MIT license.
  16185.  * http://jquery.org/license
  16186.  *
  16187.  * http://api.jqueryui.com/fade-effect/
  16188.  */
  16189.  
  16190.  
  16191. var effectFade = $.effects.effect.fade = function( o, done ) {
  16192.     var el = $( this ),
  16193.         mode = $.effects.setMode( el, o.mode || "toggle" );
  16194.  
  16195.     el.animate({
  16196.         opacity: mode
  16197.     }, {
  16198.         queue: false,
  16199.         duration: o.duration,
  16200.         easing: o.easing,
  16201.         complete: done
  16202.     });
  16203. };
  16204.  
  16205.  
  16206. /*!
  16207.  * jQuery UI Effects Fold 1.11.4
  16208.  * http://jqueryui.com
  16209.  *
  16210.  * Copyright jQuery Foundation and other contributors
  16211.  * Released under the MIT license.
  16212.  * http://jquery.org/license
  16213.  *
  16214.  * http://api.jqueryui.com/fold-effect/
  16215.  */
  16216.  
  16217.  
  16218. var effectFold = $.effects.effect.fold = function( o, done ) {
  16219.  
  16220.     // Create element
  16221.     var el = $( this ),
  16222.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  16223.         mode = $.effects.setMode( el, o.mode || "hide" ),
  16224.         show = mode === "show",
  16225.         hide = mode === "hide",
  16226.         size = o.size || 15,
  16227.         percent = /([0-9]+)%/.exec( size ),
  16228.         horizFirst = !!o.horizFirst,
  16229.         widthFirst = show !== horizFirst,
  16230.         ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
  16231.         duration = o.duration / 2,
  16232.         wrapper, distance,
  16233.         animation1 = {},
  16234.         animation2 = {};
  16235.  
  16236.     $.effects.save( el, props );
  16237.     el.show();
  16238.  
  16239.     // Create Wrapper
  16240.     wrapper = $.effects.createWrapper( el ).css({
  16241.         overflow: "hidden"
  16242.     });
  16243.     distance = widthFirst ?
  16244.         [ wrapper.width(), wrapper.height() ] :
  16245.         [ wrapper.height(), wrapper.width() ];
  16246.  
  16247.     if ( percent ) {
  16248.         size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  16249.     }
  16250.     if ( show ) {
  16251.         wrapper.css( horizFirst ? {
  16252.             height: 0,
  16253.             width: size
  16254.         } : {
  16255.             height: size,
  16256.             width: 0
  16257.         });
  16258.     }
  16259.  
  16260.     // Animation
  16261.     animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
  16262.     animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
  16263.  
  16264.     // Animate
  16265.     wrapper
  16266.         .animate( animation1, duration, o.easing )
  16267.         .animate( animation2, duration, o.easing, function() {
  16268.             if ( hide ) {
  16269.                 el.hide();
  16270.             }
  16271.             $.effects.restore( el, props );
  16272.             $.effects.removeWrapper( el );
  16273.             done();
  16274.         });
  16275.  
  16276. };
  16277.  
  16278.  
  16279. /*!
  16280.  * jQuery UI Effects Highlight 1.11.4
  16281.  * http://jqueryui.com
  16282.  *
  16283.  * Copyright jQuery Foundation and other contributors
  16284.  * Released under the MIT license.
  16285.  * http://jquery.org/license
  16286.  *
  16287.  * http://api.jqueryui.com/highlight-effect/
  16288.  */
  16289.  
  16290.  
  16291. var effectHighlight = $.effects.effect.highlight = function( o, done ) {
  16292.     var elem = $( this ),
  16293.         props = [ "backgroundImage", "backgroundColor", "opacity" ],
  16294.         mode = $.effects.setMode( elem, o.mode || "show" ),
  16295.         animation = {
  16296.             backgroundColor: elem.css( "backgroundColor" )
  16297.         };
  16298.  
  16299.     if (mode === "hide") {
  16300.         animation.opacity = 0;
  16301.     }
  16302.  
  16303.     $.effects.save( elem, props );
  16304.  
  16305.     elem
  16306.         .show()
  16307.         .css({
  16308.             backgroundImage: "none",
  16309.             backgroundColor: o.color || "#ffff99"
  16310.         })
  16311.         .animate( animation, {
  16312.             queue: false,
  16313.             duration: o.duration,
  16314.             easing: o.easing,
  16315.             complete: function() {
  16316.                 if ( mode === "hide" ) {
  16317.                     elem.hide();
  16318.                 }
  16319.                 $.effects.restore( elem, props );
  16320.                 done();
  16321.             }
  16322.         });
  16323. };
  16324.  
  16325.  
  16326. /*!
  16327.  * jQuery UI Effects Size 1.11.4
  16328.  * http://jqueryui.com
  16329.  *
  16330.  * Copyright jQuery Foundation and other contributors
  16331.  * Released under the MIT license.
  16332.  * http://jquery.org/license
  16333.  *
  16334.  * http://api.jqueryui.com/size-effect/
  16335.  */
  16336.  
  16337.  
  16338. var effectSize = $.effects.effect.size = function( o, done ) {
  16339.  
  16340.     // Create element
  16341.     var original, baseline, factor,
  16342.         el = $( this ),
  16343.         props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
  16344.  
  16345.         // Always restore
  16346.         props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
  16347.  
  16348.         // Copy for children
  16349.         props2 = [ "width", "height", "overflow" ],
  16350.         cProps = [ "fontSize" ],
  16351.         vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  16352.         hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  16353.  
  16354.         // Set options
  16355.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16356.         restore = o.restore || mode !== "effect",
  16357.         scale = o.scale || "both",
  16358.         origin = o.origin || [ "middle", "center" ],
  16359.         position = el.css( "position" ),
  16360.         props = restore ? props0 : props1,
  16361.         zero = {
  16362.             height: 0,
  16363.             width: 0,
  16364.             outerHeight: 0,
  16365.             outerWidth: 0
  16366.         };
  16367.  
  16368.     if ( mode === "show" ) {
  16369.         el.show();
  16370.     }
  16371.     original = {
  16372.         height: el.height(),
  16373.         width: el.width(),
  16374.         outerHeight: el.outerHeight(),
  16375.         outerWidth: el.outerWidth()
  16376.     };
  16377.  
  16378.     if ( o.mode === "toggle" && mode === "show" ) {
  16379.         el.from = o.to || zero;
  16380.         el.to = o.from || original;
  16381.     } else {
  16382.         el.from = o.from || ( mode === "show" ? zero : original );
  16383.         el.to = o.to || ( mode === "hide" ? zero : original );
  16384.     }
  16385.  
  16386.     // Set scaling factor
  16387.     factor = {
  16388.         from: {
  16389.             y: el.from.height / original.height,
  16390.             x: el.from.width / original.width
  16391.         },
  16392.         to: {
  16393.             y: el.to.height / original.height,
  16394.             x: el.to.width / original.width
  16395.         }
  16396.     };
  16397.  
  16398.     // Scale the css box
  16399.     if ( scale === "box" || scale === "both" ) {
  16400.  
  16401.         // Vertical props scaling
  16402.         if ( factor.from.y !== factor.to.y ) {
  16403.             props = props.concat( vProps );
  16404.             el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
  16405.             el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
  16406.         }
  16407.  
  16408.         // Horizontal props scaling
  16409.         if ( factor.from.x !== factor.to.x ) {
  16410.             props = props.concat( hProps );
  16411.             el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
  16412.             el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
  16413.         }
  16414.     }
  16415.  
  16416.     // Scale the content
  16417.     if ( scale === "content" || scale === "both" ) {
  16418.  
  16419.         // Vertical props scaling
  16420.         if ( factor.from.y !== factor.to.y ) {
  16421.             props = props.concat( cProps ).concat( props2 );
  16422.             el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
  16423.             el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
  16424.         }
  16425.     }
  16426.  
  16427.     $.effects.save( el, props );
  16428.     el.show();
  16429.     $.effects.createWrapper( el );
  16430.     el.css( "overflow", "hidden" ).css( el.from );
  16431.  
  16432.     // Adjust
  16433.     if (origin) { // Calculate baseline shifts
  16434.         baseline = $.effects.getBaseline( origin, original );
  16435.         el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
  16436.         el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
  16437.         el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
  16438.         el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
  16439.     }
  16440.     el.css( el.from ); // set top & left
  16441.  
  16442.     // Animate
  16443.     if ( scale === "content" || scale === "both" ) { // Scale the children
  16444.  
  16445.         // Add margins/font-size
  16446.         vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
  16447.         hProps = hProps.concat([ "marginLeft", "marginRight" ]);
  16448.         props2 = props0.concat(vProps).concat(hProps);
  16449.  
  16450.         el.find( "*[width]" ).each( function() {
  16451.             var child = $( this ),
  16452.                 c_original = {
  16453.                     height: child.height(),
  16454.                     width: child.width(),
  16455.                     outerHeight: child.outerHeight(),
  16456.                     outerWidth: child.outerWidth()
  16457.                 };
  16458.             if (restore) {
  16459.                 $.effects.save(child, props2);
  16460.             }
  16461.  
  16462.             child.from = {
  16463.                 height: c_original.height * factor.from.y,
  16464.                 width: c_original.width * factor.from.x,
  16465.                 outerHeight: c_original.outerHeight * factor.from.y,
  16466.                 outerWidth: c_original.outerWidth * factor.from.x
  16467.             };
  16468.             child.to = {
  16469.                 height: c_original.height * factor.to.y,
  16470.                 width: c_original.width * factor.to.x,
  16471.                 outerHeight: c_original.height * factor.to.y,
  16472.                 outerWidth: c_original.width * factor.to.x
  16473.             };
  16474.  
  16475.             // Vertical props scaling
  16476.             if ( factor.from.y !== factor.to.y ) {
  16477.                 child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
  16478.                 child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
  16479.             }
  16480.  
  16481.             // Horizontal props scaling
  16482.             if ( factor.from.x !== factor.to.x ) {
  16483.                 child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
  16484.                 child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
  16485.             }
  16486.  
  16487.             // Animate children
  16488.             child.css( child.from );
  16489.             child.animate( child.to, o.duration, o.easing, function() {
  16490.  
  16491.                 // Restore children
  16492.                 if ( restore ) {
  16493.                     $.effects.restore( child, props2 );
  16494.                 }
  16495.             });
  16496.         });
  16497.     }
  16498.  
  16499.     // Animate
  16500.     el.animate( el.to, {
  16501.         queue: false,
  16502.         duration: o.duration,
  16503.         easing: o.easing,
  16504.         complete: function() {
  16505.             if ( el.to.opacity === 0 ) {
  16506.                 el.css( "opacity", el.from.opacity );
  16507.             }
  16508.             if ( mode === "hide" ) {
  16509.                 el.hide();
  16510.             }
  16511.             $.effects.restore( el, props );
  16512.             if ( !restore ) {
  16513.  
  16514.                 // we need to calculate our new positioning based on the scaling
  16515.                 if ( position === "static" ) {
  16516.                     el.css({
  16517.                         position: "relative",
  16518.                         top: el.to.top,
  16519.                         left: el.to.left
  16520.                     });
  16521.                 } else {
  16522.                     $.each([ "top", "left" ], function( idx, pos ) {
  16523.                         el.css( pos, function( _, str ) {
  16524.                             var val = parseInt( str, 10 ),
  16525.                                 toRef = idx ? el.to.left : el.to.top;
  16526.  
  16527.                             // if original was "auto", recalculate the new value from wrapper
  16528.                             if ( str === "auto" ) {
  16529.                                 return toRef + "px";
  16530.                             }
  16531.  
  16532.                             return val + toRef + "px";
  16533.                         });
  16534.                     });
  16535.                 }
  16536.             }
  16537.  
  16538.             $.effects.removeWrapper( el );
  16539.             done();
  16540.         }
  16541.     });
  16542.  
  16543. };
  16544.  
  16545.  
  16546. /*!
  16547.  * jQuery UI Effects Scale 1.11.4
  16548.  * http://jqueryui.com
  16549.  *
  16550.  * Copyright jQuery Foundation and other contributors
  16551.  * Released under the MIT license.
  16552.  * http://jquery.org/license
  16553.  *
  16554.  * http://api.jqueryui.com/scale-effect/
  16555.  */
  16556.  
  16557.  
  16558. var effectScale = $.effects.effect.scale = function( o, done ) {
  16559.  
  16560.     // Create element
  16561.     var el = $( this ),
  16562.         options = $.extend( true, {}, o ),
  16563.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16564.         percent = parseInt( o.percent, 10 ) ||
  16565.             ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
  16566.         direction = o.direction || "both",
  16567.         origin = o.origin,
  16568.         original = {
  16569.             height: el.height(),
  16570.             width: el.width(),
  16571.             outerHeight: el.outerHeight(),
  16572.             outerWidth: el.outerWidth()
  16573.         },
  16574.         factor = {
  16575.             y: direction !== "horizontal" ? (percent / 100) : 1,
  16576.             x: direction !== "vertical" ? (percent / 100) : 1
  16577.         };
  16578.  
  16579.     // We are going to pass this effect to the size effect:
  16580.     options.effect = "size";
  16581.     options.queue = false;
  16582.     options.complete = done;
  16583.  
  16584.     // Set default origin and restore for show/hide
  16585.     if ( mode !== "effect" ) {
  16586.         options.origin = origin || [ "middle", "center" ];
  16587.         options.restore = true;
  16588.     }
  16589.  
  16590.     options.from = o.from || ( mode === "show" ? {
  16591.         height: 0,
  16592.         width: 0,
  16593.         outerHeight: 0,
  16594.         outerWidth: 0
  16595.     } : original );
  16596.     options.to = {
  16597.         height: original.height * factor.y,
  16598.         width: original.width * factor.x,
  16599.         outerHeight: original.outerHeight * factor.y,
  16600.         outerWidth: original.outerWidth * factor.x
  16601.     };
  16602.  
  16603.     // Fade option to support puff
  16604.     if ( options.fade ) {
  16605.         if ( mode === "show" ) {
  16606.             options.from.opacity = 0;
  16607.             options.to.opacity = 1;
  16608.         }
  16609.         if ( mode === "hide" ) {
  16610.             options.from.opacity = 1;
  16611.             options.to.opacity = 0;
  16612.         }
  16613.     }
  16614.  
  16615.     // Animate
  16616.     el.effect( options );
  16617.  
  16618. };
  16619.  
  16620.  
  16621. /*!
  16622.  * jQuery UI Effects Puff 1.11.4
  16623.  * http://jqueryui.com
  16624.  *
  16625.  * Copyright jQuery Foundation and other contributors
  16626.  * Released under the MIT license.
  16627.  * http://jquery.org/license
  16628.  *
  16629.  * http://api.jqueryui.com/puff-effect/
  16630.  */
  16631.  
  16632.  
  16633. var effectPuff = $.effects.effect.puff = function( o, done ) {
  16634.     var elem = $( this ),
  16635.         mode = $.effects.setMode( elem, o.mode || "hide" ),
  16636.         hide = mode === "hide",
  16637.         percent = parseInt( o.percent, 10 ) || 150,
  16638.         factor = percent / 100,
  16639.         original = {
  16640.             height: elem.height(),
  16641.             width: elem.width(),
  16642.             outerHeight: elem.outerHeight(),
  16643.             outerWidth: elem.outerWidth()
  16644.         };
  16645.  
  16646.     $.extend( o, {
  16647.         effect: "scale",
  16648.         queue: false,
  16649.         fade: true,
  16650.         mode: mode,
  16651.         complete: done,
  16652.         percent: hide ? percent : 100,
  16653.         from: hide ?
  16654.             original :
  16655.             {
  16656.                 height: original.height * factor,
  16657.                 width: original.width * factor,
  16658.                 outerHeight: original.outerHeight * factor,
  16659.                 outerWidth: original.outerWidth * factor
  16660.             }
  16661.     });
  16662.  
  16663.     elem.effect( o );
  16664. };
  16665.  
  16666.  
  16667. /*!
  16668.  * jQuery UI Effects Pulsate 1.11.4
  16669.  * http://jqueryui.com
  16670.  *
  16671.  * Copyright jQuery Foundation and other contributors
  16672.  * Released under the MIT license.
  16673.  * http://jquery.org/license
  16674.  *
  16675.  * http://api.jqueryui.com/pulsate-effect/
  16676.  */
  16677.  
  16678.  
  16679. var effectPulsate = $.effects.effect.pulsate = function( o, done ) {
  16680.     var elem = $( this ),
  16681.         mode = $.effects.setMode( elem, o.mode || "show" ),
  16682.         show = mode === "show",
  16683.         hide = mode === "hide",
  16684.         showhide = ( show || mode === "hide" ),
  16685.  
  16686.         // showing or hiding leaves of the "last" animation
  16687.         anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  16688.         duration = o.duration / anims,
  16689.         animateTo = 0,
  16690.         queue = elem.queue(),
  16691.         queuelen = queue.length,
  16692.         i;
  16693.  
  16694.     if ( show || !elem.is(":visible")) {
  16695.         elem.css( "opacity", 0 ).show();
  16696.         animateTo = 1;
  16697.     }
  16698.  
  16699.     // anims - 1 opacity "toggles"
  16700.     for ( i = 1; i < anims; i++ ) {
  16701.         elem.animate({
  16702.             opacity: animateTo
  16703.         }, duration, o.easing );
  16704.         animateTo = 1 - animateTo;
  16705.     }
  16706.  
  16707.     elem.animate({
  16708.         opacity: animateTo
  16709.     }, duration, o.easing);
  16710.  
  16711.     elem.queue(function() {
  16712.         if ( hide ) {
  16713.             elem.hide();
  16714.         }
  16715.         done();
  16716.     });
  16717.  
  16718.     // We just queued up "anims" animations, we need to put them next in the queue
  16719.     if ( queuelen > 1 ) {
  16720.         queue.splice.apply( queue,
  16721.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  16722.     }
  16723.     elem.dequeue();
  16724. };
  16725.  
  16726.  
  16727. /*!
  16728.  * jQuery UI Effects Shake 1.11.4
  16729.  * http://jqueryui.com
  16730.  *
  16731.  * Copyright jQuery Foundation and other contributors
  16732.  * Released under the MIT license.
  16733.  * http://jquery.org/license
  16734.  *
  16735.  * http://api.jqueryui.com/shake-effect/
  16736.  */
  16737.  
  16738.  
  16739. var effectShake = $.effects.effect.shake = function( o, done ) {
  16740.  
  16741.     var el = $( this ),
  16742.         props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
  16743.         mode = $.effects.setMode( el, o.mode || "effect" ),
  16744.         direction = o.direction || "left",
  16745.         distance = o.distance || 20,
  16746.         times = o.times || 3,
  16747.         anims = times * 2 + 1,
  16748.         speed = Math.round( o.duration / anims ),
  16749.         ref = (direction === "up" || direction === "down") ? "top" : "left",
  16750.         positiveMotion = (direction === "up" || direction === "left"),
  16751.         animation = {},
  16752.         animation1 = {},
  16753.         animation2 = {},
  16754.         i,
  16755.  
  16756.         // we will need to re-assemble the queue to stack our animations in place
  16757.         queue = el.queue(),
  16758.         queuelen = queue.length;
  16759.  
  16760.     $.effects.save( el, props );
  16761.     el.show();
  16762.     $.effects.createWrapper( el );
  16763.  
  16764.     // Animation
  16765.     animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
  16766.     animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
  16767.     animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
  16768.  
  16769.     // Animate
  16770.     el.animate( animation, speed, o.easing );
  16771.  
  16772.     // Shakes
  16773.     for ( i = 1; i < times; i++ ) {
  16774.         el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
  16775.     }
  16776.     el
  16777.         .animate( animation1, speed, o.easing )
  16778.         .animate( animation, speed / 2, o.easing )
  16779.         .queue(function() {
  16780.             if ( mode === "hide" ) {
  16781.                 el.hide();
  16782.             }
  16783.             $.effects.restore( el, props );
  16784.             $.effects.removeWrapper( el );
  16785.             done();
  16786.         });
  16787.  
  16788.     // inject all the animations we just queued to be first in line (after "inprogress")
  16789.     if ( queuelen > 1) {
  16790.         queue.splice.apply( queue,
  16791.             [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
  16792.     }
  16793.     el.dequeue();
  16794.  
  16795. };
  16796.  
  16797.  
  16798. /*!
  16799.  * jQuery UI Effects Slide 1.11.4
  16800.  * http://jqueryui.com
  16801.  *
  16802.  * Copyright jQuery Foundation and other contributors
  16803.  * Released under the MIT license.
  16804.  * http://jquery.org/license
  16805.  *
  16806.  * http://api.jqueryui.com/slide-effect/
  16807.  */
  16808.  
  16809.  
  16810. var effectSlide = $.effects.effect.slide = function( o, done ) {
  16811.  
  16812.     // Create element
  16813.     var el = $( this ),
  16814.         props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
  16815.         mode = $.effects.setMode( el, o.mode || "show" ),
  16816.         show = mode === "show",
  16817.         direction = o.direction || "left",
  16818.         ref = (direction === "up" || direction === "down") ? "top" : "left",
  16819.         positiveMotion = (direction === "up" || direction === "left"),
  16820.         distance,
  16821.         animation = {};
  16822.  
  16823.     // Adjust
  16824.     $.effects.save( el, props );
  16825.     el.show();
  16826.     distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
  16827.  
  16828.     $.effects.createWrapper( el ).css({
  16829.         overflow: "hidden"
  16830.     });
  16831.  
  16832.     if ( show ) {
  16833.         el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
  16834.     }
  16835.  
  16836.     // Animation
  16837.     animation[ ref ] = ( show ?
  16838.         ( positiveMotion ? "+=" : "-=") :
  16839.         ( positiveMotion ? "-=" : "+=")) +
  16840.         distance;
  16841.  
  16842.     // Animate
  16843.     el.animate( animation, {
  16844.         queue: false,
  16845.         duration: o.duration,
  16846.         easing: o.easing,
  16847.         complete: function() {
  16848.             if ( mode === "hide" ) {
  16849.                 el.hide();
  16850.             }
  16851.             $.effects.restore( el, props );
  16852.             $.effects.removeWrapper( el );
  16853.             done();
  16854.         }
  16855.     });
  16856. };
  16857.  
  16858.  
  16859. /*!
  16860.  * jQuery UI Effects Transfer 1.11.4
  16861.  * http://jqueryui.com
  16862.  *
  16863.  * Copyright jQuery Foundation and other contributors
  16864.  * Released under the MIT license.
  16865.  * http://jquery.org/license
  16866.  *
  16867.  * http://api.jqueryui.com/transfer-effect/
  16868.  */
  16869.  
  16870.  
  16871. var effectTransfer = $.effects.effect.transfer = function( o, done ) {
  16872.     var elem = $( this ),
  16873.         target = $( o.to ),
  16874.         targetFixed = target.css( "position" ) === "fixed",
  16875.         body = $("body"),
  16876.         fixTop = targetFixed ? body.scrollTop() : 0,
  16877.         fixLeft = targetFixed ? body.scrollLeft() : 0,
  16878.         endPosition = target.offset(),
  16879.         animation = {
  16880.             top: endPosition.top - fixTop,
  16881.             left: endPosition.left - fixLeft,
  16882.             height: target.innerHeight(),
  16883.             width: target.innerWidth()
  16884.         },
  16885.         startPosition = elem.offset(),
  16886.         transfer = $( "<div class='ui-effects-transfer'></div>" )
  16887.             .appendTo( document.body )
  16888.             .addClass( o.className )
  16889.             .css({
  16890.                 top: startPosition.top - fixTop,
  16891.                 left: startPosition.left - fixLeft,
  16892.                 height: elem.innerHeight(),
  16893.                 width: elem.innerWidth(),
  16894.                 position: targetFixed ? "fixed" : "absolute"
  16895.             })
  16896.             .animate( animation, o.duration, o.easing, function() {
  16897.                 transfer.remove();
  16898.                 done();
  16899.             });
  16900. };
  16901.  
  16902.  
  16903.  
  16904. }));;/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
  16905.  * Build: http://modernizr.com/download/#-flexbox-shiv-cssclasses-testprop-testallprops-domprefixes-load
  16906.  */
  16907. ;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
  16908. // By John Mueller: https://plus.google.com/u/0/+JohnMueller/posts
  16909.  
  16910. var next_data_url; // replaced when loading more
  16911. var prev_data_url; // replaced when loading more
  16912. var next_data_cache;
  16913. var prev_data_cache;
  16914. var last_scroll = 0;
  16915. var is_loading = 0; // simple lock to prevent loading when loading
  16916. var hide_on_load = false; // ID that can be hidden when content has been loaded
  16917.  
  16918. function loadFollowing() {
  16919.     if (next_data_url=="") {
  16920.         $('div.pagination').show();
  16921.     } else {
  16922.         is_loading = 1; // note: this will break when the server doesn't respond
  16923.         $('div.pagination').hide();
  16924.  
  16925.         function showFollowing(data) {
  16926.             $('div.listitempage:last').after(data.response);
  16927.             next_data_url = data.next_data_url;
  16928.             next_data_cache = false;
  16929.             $.getJSON(next_data_url, function(preview_data) {
  16930.                 next_data_cache = preview_data;
  16931.             });
  16932.         }
  16933.         if (next_data_cache) {
  16934.             showFollowing(next_data_cache);
  16935.             is_loading = 0;
  16936.         } else {
  16937.             $.getJSON(next_data_url, function(data) {
  16938.                 showFollowing(data);
  16939.                 is_loading = 0;
  16940.             });
  16941.         }
  16942.     }
  16943. };
  16944.  
  16945. function loadPrevious() {
  16946.     if (prev_data_url=="") {
  16947.         $('div.pagination').show();
  16948.     } else {
  16949.         is_loading = 1; // note: this will break when the server doesn't respond
  16950.         $('div.pagination').hide();
  16951.  
  16952.         function showPrevious(data) {
  16953.             $('div.listitempage:first').before(data.response);
  16954.             var item_height = $("div.listitempage:first").height();
  16955.             window.scrollTo(0, $(window).scrollTop()+item_height); // adjust scroll
  16956.             prev_data_url = data.prev_data_url;
  16957.             prev_data_cache = false;
  16958.             $.getJSON(prev_data_url, function(preview_data) {
  16959.                 prev_data_cache = preview_data;
  16960.             });
  16961.             if (hide_on_load) {
  16962.                 $(hide_on_load).hide();
  16963.                 hide_on_load = false;
  16964.             }
  16965.         }
  16966.         if (prev_data_cache) {
  16967.             showPrevious(prev_data_cache);
  16968.             is_loading = 0;
  16969.         } else {
  16970.             $.getJSON(prev_data_url, function(data) {
  16971.                 showPrevious(data);
  16972.                 is_loading = 0;
  16973.             });
  16974.         }
  16975.     }
  16976. };
  16977.  
  16978. function mostlyVisible(element) {
  16979.     // if ca 25% of element is visible
  16980.     var scroll_pos = $(window).scrollTop();
  16981.     var window_height = $(window).height();
  16982.     var el_top = $(element).offset().top;
  16983.     var el_height = $(element).height();
  16984.     var el_bottom = el_top + el_height;
  16985.     return ((el_bottom - el_height*0.25 > scroll_pos) &&
  16986.         (el_top < (scroll_pos+0.5*window_height)));
  16987. }
  16988.  
  16989. function initPaginator() {
  16990.     $(window).scroll(function() {
  16991.         // handle scroll events to update content
  16992.         var scroll_pos = $(window).scrollTop();
  16993.         if (scroll_pos >= 0.9*($(document).height() - $(window).height())) {
  16994.             if (is_loading==0) loadFollowing();
  16995.         }
  16996.         if (scroll_pos <= 0.9*$("#header").height()) {
  16997.             if (is_loading==0) loadPrevious();
  16998.         }
  16999.         // Adjust the URL based on the top item shown
  17000.         // for reasonable amounts of items
  17001.         if (Math.abs(scroll_pos - last_scroll)>$(window).height()*0.1) {
  17002.             last_scroll = scroll_pos;
  17003.             $(".listitempage").each(function(index) {
  17004.                 if (mostlyVisible(this)) {
  17005.                     history.replaceState(null, null, $(this).attr("data-url"));
  17006.                     $("#pagination").html($(this).attr("data-pagination"));
  17007.                     return(false);
  17008.                 }
  17009.             });
  17010.         }
  17011.     });
  17012.     $(document).ready(function () {
  17013.         // if we have enough room, load the next batch
  17014.         if ($(window).height()>$("#scrollingcontent").height()) {
  17015.             if (next_data_url!="") {
  17016.                 loadFollowing();
  17017.             } else {
  17018.                 var filler = document.createElement("div");
  17019.                 filler.id = "filler";
  17020.                 filler.style.height = ($(window).height() -
  17021.                     $("#scrollingcontent").height())+ "px";
  17022.                 $("#scrollingcontent").after(filler);
  17023.                 hide_on_load = "filler";
  17024.             }
  17025.         }
  17026.         // scroll down to hide empty room
  17027.         head_height = $("#header").height();
  17028.         window.scrollTo(0, head_height);
  17029.     });
  17030. }
  17031.  
  17032. function primeCache() {
  17033.     if(prev_data_url) {
  17034.         $.getJSON(prev_data_url, function(data) { prev_data_cache=data; } );
  17035.     }
  17036.     if(next_data_url) {
  17037.         $.getJSON(next_data_url, function(data) { next_data_cache=data; } );
  17038.     }
  17039. }
  17040.  
  17041. ;var Ajax = (function($) {
  17042.     var my = {}, onLoad = [], isLoaded = false;
  17043.  
  17044.     my.getContent = function(url, boxId, params) {
  17045.         // defer that after page load
  17046.         onLoad.push(function() {
  17047.             var $box = $('#' + boxId);
  17048.  
  17049.             $box.html('<i class="fa fa-spinner fa-spin fa-2x"></i>').addClass('ajax-loading');
  17050.  
  17051.             $.get(url, params, function(html) {
  17052.                 $box.html(html).removeClass('ajax-loading');
  17053.             });
  17054.         });
  17055.         if (isLoaded) {
  17056.             onLoad[onLoad.length - 1]();
  17057.         }
  17058.     };
  17059.  
  17060.     my.refreshPage = function(url, dialogBox) {
  17061.         // defer that after page load
  17062.         onLoad.push(function() {
  17063.             $('#' + dialogBox).modal('show');
  17064.             window.location.href = url;
  17065.         });
  17066.         if (isLoaded) {
  17067.             onLoad[onLoad.length - 1]();
  17068.         }
  17069.     };
  17070.  
  17071.     my.documentReady = function() {
  17072.         for (var i = 0; i < onLoad.length; i++) {
  17073.             onLoad[i]();
  17074.         }
  17075.         isLoaded = true;
  17076.     };
  17077.  
  17078.     return my;
  17079. }(jQuery));
  17080.  
  17081. jQuery(document).ready(Ajax.documentReady);;/*
  17082.  Google Maps
  17083.  https://developers.google.com/maps/documentation/javascript/examples/
  17084.  https://developers.google.com/maps/documentation/javascript/directions?hl=de#DisplayingResults
  17085.  */
  17086.  
  17087. function loadGoogleMap(mapId, geo, myGeoLocation, $getMyLocation, $ajaxLoad) {
  17088.     var map, directionsDisplay, directionsService, markers = [], bounds, myLocation;
  17089.  
  17090.     if (mapId == null) {
  17091.         mapId = 'map-canvas';
  17092.     }
  17093.  
  17094.     if (geo.length > 0) {
  17095.         directionsService = new google.maps.DirectionsService();
  17096.         bounds = new google.maps.LatLngBounds();
  17097.     }
  17098.  
  17099.     // Create an array of styles.
  17100.     var mapStyle = [
  17101.         {
  17102.             stylers: [
  17103.                 { saturation: -100 }
  17104.             ]
  17105.         }
  17106.     ];
  17107.  
  17108.     function initialize() {
  17109.         /* Add a marker to the map and push to the array. */
  17110.         function addMarker(location, title, image, index, openByDefault, tooltip) {
  17111.             var marker = new google.maps.Marker({
  17112.                 position: location,
  17113.                 map: map,
  17114.                 title: (tooltip ? tooltip : null),
  17115.                 icon: image,
  17116.                 animation: google.maps.Animation.DROP,
  17117.                 zIndex: google.maps.Marker.MAX_ZINDEX + index
  17118.             });
  17119.  
  17120.             attachMessage(marker, title, openByDefault);
  17121.             bounds.extend(location);
  17122.             google.maps.event.addListener(marker, 'click', function() {
  17123.                 Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
  17124.             });
  17125.             markers.push(marker);
  17126.         }
  17127.  
  17128.         /* Show Message Box */
  17129.         function attachMessage(marker, content, openByDefault) {
  17130.             var infowindow = new google.maps.InfoWindow({
  17131.                 content: content
  17132.             });
  17133.             google.maps.event.addListener(marker, 'click', function() {
  17134.                 infowindow.open(marker.get('map'), marker);
  17135.             });
  17136.             if (openByDefault == true) {
  17137.                 infowindow.open(marker.get('map'), marker);
  17138.             }
  17139.         }
  17140.  
  17141.         function getGeoSuccess(position) {
  17142.             var markerLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  17143.             addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">Mein Standort</div>', '/img/map_marker_green.png', 0, false);
  17144.             myLocation = position.coords.latitude + ', ' + position.coords.longitude;
  17145.             $("#routeStart").val('Mein Standort');
  17146.         }
  17147.  
  17148.         function getGeoError(errorCallback) {
  17149.  
  17150.         }
  17151.  
  17152.         /* remove a marker to the map and push to the array. */
  17153.         function removeLastMarker() {
  17154.             markers[markers.length - 1].setMap(null);
  17155.         }
  17156.  
  17157.         /* Sets the map on all markers in the array. */
  17158.         function setAllMap(map) {
  17159.             for (var i = 0; i < markers.length; i++) {
  17160.                 markers[i].setMap(map);
  17161.                 markers[i].showInfoWindow();
  17162.             }
  17163.         }
  17164.  
  17165.         /* Removes the markers from the map, but keeps them in the array. */
  17166.         function clearMarkers() {
  17167.             setAllMap(null);
  17168.         }
  17169.  
  17170.         var mapOptions = {}, centerLatitude, centerLongitude, markerLocation, i, index;
  17171.  
  17172.         if (geo.length == 0) {
  17173.             mapOptions = {
  17174.                 zoom: 6,
  17175.                 center: new google.maps.LatLng(51, 9),
  17176.                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  17177.                 styles: mapStyle
  17178.             };
  17179.             map = new google.maps.Map(document.getElementById(mapId), mapOptions);
  17180.         } else {
  17181.             directionsDisplay = new google.maps.DirectionsRenderer();
  17182.             if (myGeoLocation != null) {
  17183.                 centerLatitude = myGeoLocation['latitude'];
  17184.                 centerLongitude = myGeoLocation['longitude'];
  17185.             } else {
  17186.                 centerLatitude = geo[0]['latitude'];
  17187.                 centerLongitude = geo[0]['longitude'];
  17188.             }
  17189.             mapOptions = {
  17190.                 zoom: 12,
  17191.                 center: new google.maps.LatLng(centerLatitude, centerLongitude),
  17192.                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  17193.                 styles: mapStyle
  17194.             };
  17195.             map = new google.maps.Map(document.getElementById(mapId), mapOptions);
  17196.             directionsDisplay.setMap(map);
  17197.             directionsDisplay.setPanel(document.getElementById("directionsPanel-" + mapId));
  17198.             /* company marks */
  17199.             for (i = 0; i < geo.length; i++) {
  17200.                 if (geo[i]['latitude'] > 0 && geo[i]['longitude'] > 0 && geo[i]['address'] != '') {
  17201.                     markerLocation = new google.maps.LatLng(geo[i]['latitude'], geo[i]['longitude']);
  17202.                 }
  17203.                 index = 0;
  17204.                 if (geo[i]['icon'] == 'marker') {
  17205.                     index = 1;
  17206.                 }
  17207.  
  17208.                 if (!geo[i]['color']) {
  17209.                     geo[i]['color'] = 'red';
  17210.                 }
  17211.  
  17212.                 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);
  17213.             }
  17214.             /* own marker */
  17215.             if (myGeoLocation != null) {
  17216.                 if (myGeoLocation['latitude'] > 0 && myGeoLocation['longitude'] > 0 && myGeoLocation['address'] != '') {
  17217.                     markerLocation = new google.maps.LatLng(myGeoLocation['latitude'], myGeoLocation['longitude']);
  17218.                     addMarker(markerLocation, '<div class="whiteSpace-NoWrap text-base">' + myGeoLocation['address'] + '</div>', '/img/map_marker_green.png', 1, true);
  17219.                 }
  17220.             }
  17221.             /* routes */
  17222.             if (typeof geo[0]['address'] !== 'undefined') {
  17223.                 if ($getMyLocation == true) {
  17224.                     if (navigator.geolocation) {
  17225.                         navigator.geolocation.getCurrentPosition(getGeoSuccess, getGeoError);
  17226.                     }
  17227.                 }
  17228.             }
  17229.  
  17230.             google.maps.event.addListener(map, 'click', function() {
  17231.                 Tracking.trackYext(trackingOptions.yextId, 'detailspage', 'mappin');
  17232.             });
  17233.             if (geo.length > 1) {
  17234.                 map.fitBounds(bounds);
  17235.             }
  17236.  
  17237.             $("#calcRoute").click(function() {
  17238.                 calcRoute();
  17239.  
  17240.             });
  17241.  
  17242.             function calcRoute() {
  17243.                 // get the travelmode, startpoint and via point from the form
  17244.                 var travelMode = $('input[name="travelMode"]:checked').val();
  17245.                 var end = $("#routeEnd").val();
  17246.                 var start = $("#routeStart").val();
  17247.                 if (start == 'Mein Standort' && myLocation) {
  17248.                     start = myLocation;
  17249.                 }
  17250.                 var via = $("#routeVia").val();
  17251.  
  17252.                 if (travelMode == 'TRANSIT') {
  17253.                     via = ''; // if the travel mode is transit, don't use the via waypoint because that will not work
  17254.                 }
  17255.                 var waypoints = []; // init an empty waypoints array
  17256.                 if (via != '') {
  17257.                     // if waypoints (via) are set, add them to the waypoints array
  17258.                     waypoints.push({
  17259.                         location: via,
  17260.                         stopover: true
  17261.                     });
  17262.                 }
  17263.                 var request = {
  17264.                     origin: start,
  17265.                     destination: end,
  17266.                     waypoints: waypoints,
  17267.  
  17268.                     travelMode: google.maps.DirectionsTravelMode[travelMode]
  17269.                 };
  17270.                 directionsService.route(request, function(response, status) {
  17271.                     if (status == google.maps.DirectionsStatus.OK) {
  17272.                         $('#directionsPanel').empty(); // clear the directions panel before adding new directions
  17273.                         directionsDisplay.setDirections(response);
  17274.                         if ($("#routeStart").val() == 'Mein Standort') {
  17275.                             $("#routeStart").val(response.routes[0].legs[0].start_address);
  17276.                         }
  17277.                     } else {
  17278.                         // alert an error message when the route could nog be calculated.
  17279.                         if (status == 'ZERO_RESULTS') {
  17280.                             alert('No route could be found between the origin and destination.');
  17281.                         } else if (status == 'UNKNOWN_ERROR') {
  17282.                             alert('A directions request could not be processed due to a server error. The request may succeed if you try again.');
  17283.                         } else if (status == 'REQUEST_DENIED') {
  17284.                             alert('This webpage is not allowed to use the directions service.');
  17285.                         } else if (status == 'OVER_QUERY_LIMIT') {
  17286.                             alert('The webpage has gone over the requests limit in too short a period of time.');
  17287.                         } else if (status == 'NOT_FOUND') {
  17288.                             alert('At least one of the origin, destination, or waypoints could not be geocoded.');
  17289.                         } else if (status == 'INVALID_REQUEST') {
  17290.                             alert('The DirectionsRequest provided was invalid.');
  17291.                         } else {
  17292.                             alert("There was an unknown error in your request. Requeststatus: nn" + status);
  17293.                         }
  17294.                     }
  17295.                 });
  17296.             }
  17297.         }
  17298.     }
  17299.  
  17300.     if ($ajaxLoad) {
  17301.         $(document).ajaxStop(initialize);
  17302.     } else {
  17303.         google.maps.event.addDomListener(window, 'load', initialize);
  17304.     }
  17305. }
  17306.  
  17307. ;var CompanyAjaxLoad = (function($) {
  17308.     var my = {};
  17309.  
  17310.     my.getAdditionalCompanyInfo = function($select, $companyId, $hashTag, $scrollTo, $id, $boxId) {
  17311.         $('#termin-o-reservierung-vereinbaren').hide();
  17312.         $('#additionalCompanyInfo').empty();
  17313.  
  17314.         if (!$boxId) {
  17315.             $boxId = 'additionalCompanyInfo';
  17316.         }
  17317.         Ajax.getContent('/ajax.do/additionalCompanyInfo', $boxId, {
  17318.             'select': $select,
  17319.             'companyId': $companyId
  17320.         });
  17321.  
  17322.         if ($hashTag) {
  17323.             window.location.hash = $hashTag;
  17324.         }
  17325.  
  17326.         if ($scrollTo == true) {
  17327.             $("html, body").animate({ scrollTop: $('#pageHeader').offset().top }, 1000);
  17328.         }
  17329.  
  17330.         if ($id != false) {
  17331.             $('#navigationDetailList div').removeClass('gray');
  17332.             $('#navigation_' + $id).addClass('gray');
  17333.         }
  17334.  
  17335.         $('#navigationDetailList').removeClass('in');
  17336.  
  17337.         return false;
  17338.     };
  17339.  
  17340.     my.toggleFromNavigation = function(idNavigation, idBox, $scrollTo, companyInfo) {
  17341.         $('#navigationDetailList div').removeClass('gray');
  17342.         $('#' + idNavigation).addClass('gray');
  17343.  
  17344.         $('#navigationDetailList').removeClass('in');
  17345.  
  17346.         if (companyInfo == true) {
  17347.             $('#additionalCompanyInfo').empty();
  17348.         }
  17349.  
  17350.         $('#' + idBox).show();
  17351.         $('#' + idBox + ' .panel-collapse').addClass('in');
  17352.  
  17353.         if ($scrollTo == true) {
  17354.             $("html, body").animate({ scrollTop: ($('#' + idBox).offset().top) - 50 }, 1000);
  17355.         }
  17356.         return false;
  17357.     };
  17358.  
  17359.     my.claimDuplicate = function($companyId, $userId, $boxId) {
  17360.         Ajax.getContent('/ajax.do/claimDuplicate', $boxId, {
  17361.             'userId': $userId,
  17362.             'companyId': $companyId
  17363.         });
  17364.     };
  17365.  
  17366.     return my;
  17367. }(jQuery));
  17368.  
  17369. var Gallery = (function($) {
  17370.     var my = {}, imageList = '.image-list';
  17371.  
  17372.     my.showDialog = function(imageId) {
  17373.         var $active = $('#' + imageId);
  17374.  
  17375.         $(imageList).hide();
  17376.         $active.show();
  17377.     };
  17378.  
  17379.     my.slideImage = function(direction) {
  17380.         var $active = $(imageList).filter(":visible"), $first = $(imageList).first(), $last = $(imageList).last();
  17381.  
  17382.         $(imageList).hide();
  17383.  
  17384.         if (direction == 1) {
  17385.             if ($active.attr('id') == $last.attr('id')) {
  17386.                 $first.toggle("slide", { direction: "right" });
  17387.             } else {
  17388.                 $active.next().toggle("slide", { direction: "right" });
  17389.             }
  17390.         }
  17391.         if (direction == 0) {
  17392.             if ($active.attr('id') == $first.attr('id')) {
  17393.                 $last.toggle("slide", { direction: "left" });
  17394.             } else {
  17395.                 $active.prev().toggle("slide", { direction: "left" });
  17396.             }
  17397.         }
  17398.     };
  17399.  
  17400.     return my;
  17401. }(jQuery));
  17402. ;var lead = (function ($) {
  17403.     var my = {};
  17404.  
  17405.     my.send = function (formId, modalId, messageId) {
  17406.         var $form = $('#'+formId), $btn = $('button[type=submit]', $form), t = $btn.text();
  17407.         $btn.disableButton(t);
  17408.  
  17409.         $.post('/lead.do', $form.serialize(), function (d) {
  17410.             if (d.status == 'ok') {
  17411.                 $('#'+formId+' #message').val('');
  17412.                 $('#'+modalId).modal('hide');
  17413.  
  17414.                 $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msg + '</div></div>');
  17415.                 if (d.msgUser) {
  17416.                     $('header').append('<div class="row"><div class="alert alert-success noMargin" role="alert">' + d.msgUser + '</div></div>');
  17417.                 }
  17418.                 $("html, body").animate({scrollTop: 0}, "slow");
  17419.             } else {
  17420.                 $('#'+messageId).append('<div class="row"><div class="alert alert-danger noMargin" role="alert">' + d.msg + '</div></div>');
  17421.             }
  17422.  
  17423.             $btn.enableButton(t);
  17424.         });
  17425.     };
  17426.     return my;
  17427. }(jQuery, window));;$(document).ready(function() {
  17428.  
  17429.     $.doAjaxRequest = function(method, request, loader) {
  17430.         loader.addClass('loader');
  17431.         return $.ajax({
  17432.             url: 'ajax/get/' + method,
  17433.             cache: false,
  17434.             type: 'POST',
  17435.             dataType: 'json',
  17436.             data: request
  17437.         });
  17438.     };
  17439.  
  17440.     $.fn.disableButton = function(text) {
  17441.         if (text) {
  17442.             text += ' ';
  17443.         }
  17444.         this.attr('disabled', 'disabled').html((text || '') + '<i class="fa fa-spinner fa-spin"></i>');
  17445.         return this;
  17446.     };
  17447.  
  17448.     $.fn.enableButton = function(text, ok) {
  17449.         var $signal, that = this;
  17450.         if (text) {
  17451.             text += ' ';
  17452.         }
  17453.  
  17454.         this.attr('disabled', false);
  17455.  
  17456.         if (ok === true) {
  17457.             $signal = $('<i class="fa fa-check"></i>');
  17458.         } else {
  17459.             if (ok === false) {
  17460.                 $signal = $('<i class="fa fa-times"></i>');
  17461.             }
  17462.         }
  17463.  
  17464.         if (typeof ok !== 'undefined') {
  17465.             this.html(text || '').append($signal);
  17466.             window.setTimeout(function() {
  17467.                 $signal.fadeOut(300, function() {
  17468.                     that.html(text)
  17469.                 })
  17470.             }, 2000);
  17471.         } else {
  17472.             this.html(text);
  17473.         }
  17474.  
  17475.         return this;
  17476.     };
  17477.  
  17478.     $.fn.handleResponse = function(response, css_class) {
  17479.         response = response || {};
  17480.         response = response.hasOwnProperty('data') && Object.size(response.data) ? response.data[Object.keys(response.data)[0]] : false;
  17481.         var size = !!response ? Object.size(response) : 0;
  17482.         var $select = $(css_class);
  17483.         if (size) {
  17484.             $select.find('option:gt(0)').remove();
  17485.             $select.append('<option value=\"' + response + '\">' + response + '</option>');
  17486.             setTimeout(function() {
  17487.                 $select.prop('disabled', false);
  17488.                 $select.val(response);
  17489.                 $('#ort').focus();
  17490.             }, 0);
  17491.         } else {
  17492.             $select.find('option:gt(0)').remove();
  17493.         }
  17494.     };
  17495.  
  17496.     var $form = $('.simple-form form');
  17497.     if ($form.length) {
  17498.         var timeout, needReload = true;
  17499.         $('#plz').on('keyup', function(e) {
  17500.             var $this = $(this);
  17501.             $this.val($this.val().replace(/[^0-9]/g, ''));
  17502.             var zip = $this.val().length;
  17503.             if (zip < 5) {
  17504.                 needReload = true;
  17505.             }
  17506.             if (needReload) {
  17507.                 $('#ort').val('').prop('disabled', true);
  17508.                 if (zip == 5) {
  17509.                     clearTimeout(timeout);
  17510.                     timeout = setTimeout(function() {
  17511.                         var $loader = $('#ort').parent();
  17512.                         $.doAjaxRequest('residence', { plz: $this.val() }, $loader)
  17513.                             .success(function(response) {
  17514.                                 needReload = false;
  17515.                                 $this.handleResponse(response, '#ort');
  17516.                                 $loader.removeClass('loader');
  17517.                             });
  17518.                     }, 100);
  17519.                 }
  17520.             }
  17521.         }).trigger('keyup');
  17522.     }
  17523.  
  17524.     // find file uploads with size
  17525.     $('input[type=file]').each(function() {
  17526.         var my = $(this), maxsize = my.data('max-size');
  17527.         if (maxsize) {
  17528.             my.parents('form').submit(function() {
  17529.                 if (my.get(0).files.length) {
  17530.                     if (my.get(0).files[0].size > maxsize) {
  17531.                         alert('Die Datei ist leider zu groß, bitte senden Sie nur Bilder bis zu ' + (maxsize / 1000000) + ' MB Dateigröße.');
  17532.                         return false;
  17533.                     }
  17534.                 }
  17535.             });
  17536.         }
  17537.     });
  17538.  
  17539. });
  17540.  
  17541. // login module
  17542. var Login = (function(w, d, $, my) {
  17543.     var eventListener = [];
  17544.  
  17545.     my.registerListener = function(callback) {
  17546.         eventListener.push(callback);
  17547.     };
  17548.  
  17549.     my.popup = function(el) {
  17550.         var t = 300, l = 500, y = 530, x = 450;
  17551.  
  17552.         var $form = $(el).parents('form');
  17553.         /* $('.form-login-email', $form).val('[email protected]');*/
  17554.         $('.form-login-returnBlock').attr('checked', false);
  17555.         $('.form-login-terms').attr('checked', true);
  17556.  
  17557.         if (w.screen) {
  17558.             t = Math.round(w.screen.availHeight / 2 - y / 2 - 50);
  17559.             l = Math.round(w.screen.availWidth / 2 - x / 2 - 10);
  17560.  
  17561.             // chrome bug
  17562.             if (w.screenX > w.screen.availWidth) {
  17563.                 l += w.screen.availWidth;
  17564.             }
  17565.         }
  17566.         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');
  17567.     };
  17568.  
  17569.     my.popupSubmit = function(form) {
  17570.         var $form = $(form), f = new FormData(form), $btn = $('button[type=submit]', $form), t = $btn.html();
  17571.  
  17572.         $btn.attr('disabled', 'disabled').html(t + ' <i class="fa fa-spinner fa-spin"></i>');
  17573.  
  17574.         $.ajax({
  17575.             url: my.loginUrl,
  17576.             type: 'POST',
  17577.             data: f,
  17578.             cache: false,
  17579.             contentType: false,
  17580.             processData: false,
  17581.             success: function(d) {
  17582.                 $btn.attr('disabled', false).html(t);
  17583.                 if (d.status == 'ok') {
  17584.                     //CustomEvent workarond for IE
  17585.                     var evt = w.opener.document.createEvent("CustomEvent");
  17586.                     evt.initCustomEvent('message', false, false, {
  17587.                         a: 'dialo_login_popup_ok', d: d
  17588.                     });
  17589.  
  17590.                     w.opener.dispatchEvent(evt);
  17591.                     w.close();
  17592.                 }
  17593.                 if (d.status == 'error') {
  17594.                     var $msg = $('<div class="alert alert-danger">' + d.msg + '</div>').hide();
  17595.                     $('#errorMessage').append($msg);
  17596.                     $msg.slideDown(100);
  17597.                     window.setTimeout(function() {
  17598.                         $msg.slideUp(200);
  17599.                     }, 2000);
  17600.                 }
  17601.             }
  17602.         });
  17603.     };
  17604.  
  17605.     my.listener = function(e) {
  17606.         if (e.detail && e.detail.a === 'dialo_login_popup_ok') {
  17607.             var d = e.detail.d;
  17608.             $('.form-login-actions').hide();
  17609.             $('.form-login-actions').next().hide(); //hide required star
  17610.             $('.form-login-email').val('[email protected]');
  17611.             $('.csrf-token').attr('name', d.token.name).val(d.token.value);
  17612.             $('.form-login-returnBlock').remove();
  17613.             $('.form-login-terms').remove();
  17614.             $('.form-login-terms-checkbox').attr('checked', true);
  17615.             $('.form-login-terms-checkbox').parent().hide();
  17616.             $('.form-login-newsletter-checkbox').parent().hide();
  17617.             $('.recaptcha-holder').addClass('recaptcha-deactivate'); // remove captcha
  17618.             $('.form-login-submit').slideDown();
  17619.  
  17620.             if (d.canClaim) {
  17621.                 $('#claimBox').slideDown();
  17622.             }
  17623.  
  17624.             for (var i = 0; i < eventListener.length; i++) {
  17625.                 if (typeof eventListener[i] == 'function') {
  17626.                     eventListener[i](d);
  17627.                 }
  17628.             }
  17629.             if ($('#selectKeywordPayment').length || $('#companyPayment').length) {
  17630.                 Payment.adpackage.login(e.detail.d.userId);
  17631.             }
  17632.         }
  17633.     };
  17634.  
  17635.     my.facebook = function(data) {
  17636.         $.ajax({
  17637.             url: my.loginUrl,
  17638.             type: 'POST',
  17639.             data: {
  17640.                 fbUserId: data.profile.id,
  17641.                 fbEmail: data.profile.email,
  17642.                 fbAccessToken: data.auth.authResponse.accessToken
  17643.             },
  17644.             cache: false,
  17645.             success: function(d) {
  17646.                 if (d.status == 'ok') {
  17647.                     //CustomEvent workarond for IE
  17648.                     var evt = w.opener.document.createEvent("CustomEvent");
  17649.                     evt.initCustomEvent('message', false, false, {
  17650.                         a: 'dialo_login_popup_ok', d: d
  17651.                     });
  17652.  
  17653.                     w.opener.dispatchEvent(evt);
  17654.                     w.close();
  17655.                 }
  17656.             }
  17657.         });
  17658.     };
  17659.  
  17660.     my.facebookRegister = function(data) {
  17661.         var html = '';
  17662.  
  17663.         html += '<div class="col-md-12">Die Registrierung erfolgt über Facebook.</div>';
  17664.         html += '<input type="hidden" name="fbToken" value="' + data.auth.authResponse.accessToken + '" />';
  17665.         html += '<input type="hidden" name="fbUsername" value="' + data.profile.name + '" />';
  17666.  
  17667.         $('.form-login-options').html(html);
  17668.  
  17669.         $('.form-login-submit').slideDown();
  17670.         $('#claimBox').slideDown();
  17671.     };
  17672.  
  17673.     my.facebookConnect = function(data) {
  17674.         $('.facebook-login-button').disableButton();
  17675.  
  17676.         $.ajax({
  17677.             url: my.fbConnectUrl,
  17678.             type: 'POST',
  17679.             data: {
  17680.                 fbUserId: data.profile.id,
  17681.                 fbEmail: data.profile.email,
  17682.                 fbAccessToken: data.auth.authResponse.accessToken
  17683.             },
  17684.             cache: false,
  17685.             success: function(d) {
  17686.                 if (d.status == 'ok') {
  17687.                     $('.facebook-login-button').replaceWith('Vielen Dank für die Verknüpfung.');
  17688.                 }
  17689.             }
  17690.         });
  17691.     };
  17692.  
  17693.     my.showRegister = function(el) {
  17694.         var $form = $(el).parents('form');
  17695.         $('.form-login-email', $form).val('');
  17696.         $('.form-login-email', $form).val('');
  17697.         $('.form-login-returnBlock').attr('checked', true);
  17698.         $('.form-login-terms').attr('checked', false);
  17699.     };
  17700.  
  17701.     my.checkForSend = function($el) {
  17702.         var value = $el.val();
  17703.  
  17704.         if (value.length > 4) {
  17705.             $('.form-login-submit').slideDown();
  17706.             $('#claimBox').slideDown();
  17707.         } else {
  17708.             $('.form-login-submit').slideUp();
  17709.             $('#claimBox').slideUp();
  17710.         }
  17711.     };
  17712.  
  17713.     return my;
  17714. }(window, document, jQuery, Login || {}));
  17715.  
  17716. // Popup FbApp
  17717. function FbPopup(link) {
  17718.     var t = 300, l = 500, y = 450, x = 600;
  17719.  
  17720.     if (window.screen) {
  17721.         t = Math.round(window.screen.availHeight / 2 - y / 2 - 50);
  17722.         l = Math.round(window.screen.availWidth / 2 - x / 2 - 10);
  17723.  
  17724.         // chrome bug
  17725.         if (window.screenX > window.screen.availWidth) {
  17726.             l += window.screen.availWidth;
  17727.         }
  17728.     }
  17729.     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');
  17730. }
  17731.  
  17732. function activateInputSlider(value, sliderId, radiusId, showRadiusId) {
  17733.     $slider = $('#' + sliderId);
  17734.     $radius = $('#' + radiusId);
  17735.     $showRadius = $('#' + showRadiusId);
  17736.  
  17737.     $slider.slider({
  17738.         range: 'max',
  17739.         min: 1,
  17740.         max: 100,
  17741.         value: value,
  17742.         slide: function(event, ui) {
  17743.             $radius.val(ui.value);
  17744.             $showRadius.text(ui.value);
  17745.         }
  17746.     });
  17747. }
  17748.  
  17749. function showSearchClearIcon(element, searchWrapper, clearIcon, additionalClass) {
  17750.     if ($(window).width() <= 768) { //for iPad & smaller devices
  17751.         var t = $(element);
  17752.         $('.' + clearIcon).toggle(Boolean(t.val()));
  17753.         if (Boolean(t.val())) {
  17754.             $('.' + searchWrapper).addClass(additionalClass);
  17755.         } else {
  17756.             $('.' + searchWrapper).removeClass(additionalClass);
  17757.         }
  17758.     }
  17759. }
  17760.  
  17761. function clearSearch(element, searchBox, searchWrapper, additionalClass) {
  17762.     if ($(window).width() <= 768) { //for iPad & smaller devices
  17763.         $('.' + searchBox).val('').focus();
  17764.         $('.' + searchWrapper).removeClass(additionalClass);
  17765.         $(element).hide();
  17766.     }
  17767. }
  17768.  
  17769. function autoresizeTextarea(element) {
  17770.     if (element != null) {
  17771.         element.style.height = '0px';
  17772.         var textareaHeight = element.scrollHeight + 10;
  17773.         if (textareaHeight == 10) {
  17774.             textareaHeight = 50;
  17775.         }
  17776.         var maxHeight = 450;
  17777.         if (textareaHeight > maxHeight) {
  17778.             element.style.height = maxHeight + 'px';
  17779.             element.style.overflow = 'auto';
  17780.         } else {
  17781.             element.style.height = textareaHeight + 'px';
  17782.         }
  17783.     }
  17784. }
  17785.  
  17786. function autoResizePlaceholderImage() {
  17787.     $('.imagePlaceholder').each(function(index, value) {
  17788.         var height = $(value).height();
  17789.  
  17790.         $(value).css({
  17791.             'font-size': (height / 1.5) + 'px',
  17792.             'line-height': height + 'px'
  17793.         });
  17794.     });
  17795. }
  17796.  
  17797. function outputFlashSession(id) {
  17798.     id = typeof id !== 'undefined' ? id : 'flashSessionOutput';
  17799.     $.get('/flashmessage.do', {}, function(html) {
  17800.         $('#' + id).html(html);
  17801.     });
  17802. }
  17803.  
  17804. function changeArrow(e) {
  17805.     clicked = $(document).find("[href='#" + $(e.target).attr('id') + "']");
  17806.     icon = clicked.find('i');
  17807.  
  17808.     if (icon.hasClass('fa-angle-down')) {
  17809.         icon.removeClass('fa-angle-down');
  17810.         icon.addClass('fa-angle-up');
  17811.     } else {
  17812.         icon.removeClass('fa-angle-up');
  17813.         icon.addClass('fa-angle-down');
  17814.     }
  17815. };;(function() {
  17816. var method, noop = function() {};
  17817. var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
  17818. var length = methods.length;
  17819. var console = (window.console = window.console || {});
  17820. while (length--) {
  17821.     method = methods[length];
  17822.     if (!console[method]) console[method] = noop;
  17823. }
  17824. }());
  17825.  
  17826. ;(function($){
  17827.     $(".alert .close").click(function() {
  17828.         $(this).parent().fadeTo("slow", 0.00, function(){
  17829.             $(this).slideUp();
  17830.         }); return false;
  17831.     });
  17832. })(jQuery);
  17833.  
  17834. Object.size = function(obj) {
  17835.     var size = 0, key;
  17836.     for (key in obj) if (obj.hasOwnProperty(key)) size++;
  17837.     return size;
  17838. };
  17839. ;/*
  17840.   Bootstrap - File Input
  17841.   ======================
  17842.  
  17843.   This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
  17844.  
  17845.   Converts all
  17846.   <input type="file">
  17847.   into Bootstrap buttons
  17848.   <a class="btn">Browse</a>
  17849.  
  17850. */
  17851. $(function() {
  17852.  
  17853. $.fn.bootstrapFileInput = function() {
  17854.  
  17855.   this.each(function(i,elem){
  17856.  
  17857.     var $elem = $(elem);
  17858.  
  17859.     // Maybe some fields don't need to be standardized.
  17860.     if (typeof $elem.attr('data-bfi-disabled') != 'undefined') {
  17861.       return;
  17862.     }
  17863.  
  17864.     // Set the word to be displayed on the button
  17865.     var buttonWord = 'Browse';
  17866.  
  17867.     if (typeof $elem.attr('title') != 'undefined') {
  17868.       buttonWord = $elem.attr('title');
  17869.     }
  17870.  
  17871.     // Start by getting the HTML of the input element.
  17872.     // Thanks for the tip http://stackoverflow.com/a/1299069
  17873.     var input = $('<div>').append( $elem.eq(0).clone() ).html();
  17874.     var className = '';
  17875.  
  17876.     if (!!$elem.attr('class')) {
  17877.       className = ' ' + $elem.attr('class');
  17878.     }
  17879.  
  17880.     // Now we're going to replace that input field with a Bootstrap button.
  17881.     // The input will actually still be there, it will just be float above and transparent (done with the CSS).
  17882.     $elem.replaceWith('<a class="file-input-wrapper btn' + className + '">'+buttonWord+input+'</a>');
  17883.   })
  17884.  
  17885.   // After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
  17886.   // 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.
  17887.   .promise().done( function(){
  17888.  
  17889.     // 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.
  17890.     // This gives us the pointer cursor that FF denies us
  17891.     $('.file-input-wrapper').mousemove(function(cursor) {
  17892.  
  17893.       var input, wrapper,
  17894.         wrapperX, wrapperY,
  17895.         inputWidth, inputHeight,
  17896.         cursorX, cursorY;
  17897.  
  17898.       // This wrapper element (the button surround this file input)
  17899.       wrapper = $(this);
  17900.       // The invisible file input element
  17901.       input = wrapper.find("input");
  17902.       // The left-most position of the wrapper
  17903.       wrapperX = wrapper.offset().left;
  17904.       // The top-most position of the wrapper
  17905.       wrapperY = wrapper.offset().top;
  17906.       // The with of the browsers input field
  17907.       inputWidth= input.width();
  17908.       // The height of the browsers input field
  17909.       inputHeight= input.height();
  17910.       //The position of the cursor in the wrapper
  17911.       cursorX = cursor.pageX;
  17912.       cursorY = cursor.pageY;
  17913.  
  17914.       //The positions we are to move the invisible file input
  17915.       // 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
  17916.       moveInputX = cursorX - wrapperX - inputWidth + 20;
  17917.       // Slides the invisible input Browse button to be positioned middle under the cursor
  17918.       moveInputY = cursorY- wrapperY - (inputHeight/2);
  17919.  
  17920.       // Apply the positioning styles to actually move the invisible file input
  17921.       input.css({
  17922.         left:moveInputX,
  17923.         top:moveInputY
  17924.       });
  17925.     });
  17926.  
  17927.     $('.file-input-wrapper input[type=file]').change(function(){
  17928.  
  17929.       var fileName;
  17930.       fileName = $(this).val();
  17931.  
  17932.       // Remove any previous file names
  17933.       $(this).parent().next('.file-input-name').remove();
  17934.       if (!!$(this).prop('files') && $(this).prop('files').length > 1) {
  17935.         fileName = $(this)[0].files.length+' files';
  17936.         //$(this).parent().after('<span class="file-input-name">'+$(this)[0].files.length+' files</span>');
  17937.       }
  17938.       else {
  17939.         // var fakepath = 'C:\\fakepath\\';
  17940.         // fileName = $(this).val().replace('C:\\fakepath\\','');
  17941.         fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
  17942.       }
  17943.  
  17944.       $(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
  17945.     });
  17946.  
  17947.   });
  17948.  
  17949. };
  17950.  
  17951. // Add the styles before the first stylesheet
  17952. // This ensures they can be easily overridden with developer styles
  17953. var cssHtml = '<style>'+
  17954.   '.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
  17955.   '.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; }'+
  17956.   '.file-input-name { margin-left: 8px; }'+
  17957.   '</style>';
  17958. $('link[rel=stylesheet]').eq(0).before(cssHtml);
  17959.  
  17960. });;var AjaxForm = (function($, window) {
  17961.     var my = {}, dialogTemplate, windowsTemplate;
  17962.  
  17963.     dialogTemplate = '<div class="modal fade" id=":id:" tabindex="-1" role="dialog">'
  17964.         + '<div class="modal-dialog" style=":style:"><div class="modal-content">'
  17965.         + '<div class="modal-header">'
  17966.         + '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'
  17967.         + '<p class="modal-title lead"><strong>:title:</strong></p>'
  17968.         + '</div>'
  17969.         + '<div class="modal-body" id="modal-body-:id:">:text:</div>'
  17970.         + '</div>'
  17971.         + '</div></div>';
  17972.  
  17973.     windowsTemplate = '<div id=":id:">' +
  17974.         '<h3>:title:</h3>' +
  17975.         '<div>:text:</div>' +
  17976.         '</div>';
  17977.  
  17978.     function handleResponse(url, response, options, showInDialog) {
  17979.         if (typeof showInDialog === "undefined" || showInDialog === null) {
  17980.             showInDialog = true;
  17981.         }
  17982.  
  17983.         var html, $dialog, id = 'ajaxform_' + Math.ceil(Math.random() * 1000000);
  17984.         options = options || {};
  17985.         options.style = options.style || '';
  17986.  
  17987.         if (showInDialog) {
  17988.             html = dialogTemplate.replace(/:id:/g, id)
  17989.                 .replace(':style:', options.style)
  17990.                 .replace(':title:', response.title)
  17991.                 .replace(':text:', response.html);
  17992.  
  17993.             $('body').append(html);
  17994.             $dialog = $('#' + id);
  17995.  
  17996.             $dialog.on('hidden.bs.modal', function(e) {
  17997.                 // user somehow aborted -> kill the dialog
  17998.                 //$dialog.remove();
  17999.             });
  18000.  
  18001.             $dialog.modal('show');
  18002.  
  18003.             //bugfix scrolling in dialog - add class to body
  18004.             $('.modal').on("hidden.bs.modal", function(e) {
  18005.                 if ($('.modal:visible').length) {
  18006.                     $('body').addClass('modal-open');
  18007.                 }
  18008.             });
  18009.         } else {
  18010.             html = windowsTemplate.replace(/:id:/g, id)
  18011.                 .replace(':title:', response.title)
  18012.                 .replace(':text:', response.html);
  18013.  
  18014.             if (options.boxId) {
  18015.                 $('#' + options.boxId).append(html);
  18016.             }
  18017.  
  18018.             $dialog = $('#' + id);
  18019.         }
  18020.  
  18021.         // grab the submit
  18022.         $('form', $dialog).submit(function(e) {
  18023.             var $form = $(this), formData = new FormData($form[0]);
  18024.             e.preventDefault();
  18025.  
  18026.             $.ajax({
  18027.                 url: url,
  18028.                 type: 'POST',
  18029.                 data: formData,
  18030.                 async: false,
  18031.                 cache: false,
  18032.                 contentType: false,
  18033.                 processData: false,
  18034.                 success: function(response) {
  18035.                     if (response.status === 'reload') {
  18036.                         window.location.reload();
  18037.                     }
  18038.                     if (response.status === 'ajax') {
  18039.                         Ajax.getContent(response.url, response.id, {});
  18040.                     } else {
  18041.                         handleResponse(url, response, options);
  18042.                     }
  18043.                 }
  18044.             });
  18045.             if (showInDialog) {
  18046.                 $dialog.modal('hide');
  18047.             }
  18048.         });
  18049.     }
  18050.  
  18051.     my.show = function(url, options, showInDialog) {
  18052.         if (window.event) {
  18053.             window.event.stopPropagation();
  18054.         }
  18055.         $('#dialog-waiting').modal('show');
  18056.         $.get(url, function(response) {
  18057.             handleResponse(url, response, options, showInDialog);
  18058.             $('#dialog-waiting').modal('hide');
  18059.         });
  18060.     };
  18061.  
  18062.     return my;
  18063. }(jQuery, window));
  18064.  
  18065. var Helper = (function($) {
  18066.     var my = {};
  18067.  
  18068.     my.previewImage = function(inputElement) {
  18069.         if (inputElement.files && inputElement.files[0]) {
  18070.             var reader = new FileReader();
  18071.  
  18072.             reader.onload = function(e) {
  18073.                 var $el = $(inputElement), $container = $el.parent(), $preview = $('.image-preview');
  18074.  
  18075.                 if ($preview.size() === 0) {
  18076.                     $preview = $('<img/>').addClass('image-preview');
  18077.                     $preview.appendTo($container);
  18078.                 }
  18079.  
  18080.                 $preview.attr('src', e.target.result);
  18081.             };
  18082.  
  18083.             reader.readAsDataURL(inputElement.files[0]);
  18084.         }
  18085.     };
  18086.  
  18087.     my.changeImageStatus = function(status) {
  18088.         if (status == true) {
  18089.             $('.file-manager-file-delete').val('true');
  18090.             $('.image-preview').attr('src', '');
  18091.             $('.image-preview').attr('alt', '');
  18092.             $('#image-delete').hide();
  18093.             $('#image-placeholder').show();
  18094.         } else {
  18095.             $('.file-manager-file-delete').val('false');
  18096.             $('#image-delete').show();
  18097.             $('#image-placeholder').hide();
  18098.         }
  18099.     };
  18100.  
  18101.     return my;
  18102. }(jQuery));
  18103.  
  18104. function cityAutocomplete(element, id) {
  18105.     if (!id) {
  18106.         id = 'town';
  18107.     }
  18108.     autocompleteDropDown.start('/zipcity.do', { element: element, threshold: 2 }, id);
  18109. }
  18110.  
  18111. function keywordAutocomplete(element, event, limit) {
  18112.     var code = event.keyCode || event.which;
  18113.     if (code == 32 || code == 13 || code == 188) { //space, return, comma
  18114.         event.preventDefault();
  18115.         addKeyword(element, $(element).val(), limit);
  18116.     }
  18117. }
  18118.  
  18119. function addKeyword(element, keyword, limit) {
  18120.     if (!keyword) {
  18121.         keyword = $(element).val();
  18122.     }
  18123.  
  18124.     if (keyword.trim()) {
  18125.         var keywordArray = keyword.split(',');
  18126.  
  18127.         if (typeof limit !== "undefined") {
  18128.             var $keywords = $('#keywordData').val();
  18129.             if ($keywords) {
  18130.                 $keywords = JSON.parse($keywords);
  18131.                 if ($keywords.length >= limit) {
  18132.                     $('#keywordError').show();
  18133.                     return;
  18134.                 }
  18135.             }
  18136.  
  18137.         }
  18138.  
  18139.         $.each(keywordArray, function(index, value) {
  18140.             if (value.trim()) {
  18141.                 var result = {
  18142.                     keywordType: null,
  18143.                     keyword: value
  18144.                 };
  18145.  
  18146.                 var $keywords = $('#keywordData'),
  18147.                     $keywordContainer = $('#keywordContainer');
  18148.  
  18149.                 $keywordContainer.appendKeyword(result);
  18150.                 $.updateKeywords($keywordContainer, $keywords);
  18151.                 $(element).val('');
  18152.             }
  18153.         });
  18154.     }
  18155. }
  18156.  
  18157. $.fn.appendKeyword = function(data) {
  18158.     this.append('<span class="btn btn-default" data-type="' + data.keywordType + '" onclick="keywordRemove(this)">' + data.keyword + ' <i class="fa fa-times-circle"></i></span>');
  18159. };
  18160.  
  18161. $.updateKeywords = function($keywordContainer, $keywords) {
  18162.     var keywords = [];
  18163.     $keywordContainer.find('> span').each(function(i) {
  18164.         var $this = $(this);
  18165.         keywords.push({
  18166.             keywordType: $this.attr('data-type'),
  18167.             keyword: $this.text()
  18168.         });
  18169.     });
  18170.     $keywords.val(JSON.stringify(keywords));
  18171. };
  18172.  
  18173. function keywordRemove(element) {
  18174.     var $keywords = $('#keywordData');
  18175.  
  18176.     $(element).remove().data();
  18177.     $.updateKeywords($('#keywordContainer'), $keywords);
  18178. }
  18179.  
  18180. function parseKeywords() {
  18181.     var keywordRaw = $('#keywordData').val(), keyword, $keywordContainer = $('#keywordContainer');
  18182.  
  18183.     if (keywordRaw) {
  18184.         try {
  18185.             keyword = jQuery.parseJSON(keywordRaw);
  18186.         } catch (e) {
  18187.             // old broken keyword structure
  18188.             // be nice, it's not their fault
  18189.         }
  18190.  
  18191.         if ($.isArray(keyword)) {
  18192.             $.each(keyword, function(i, v) {
  18193.                 $keywordContainer.appendKeyword(v);
  18194.             });
  18195.         }
  18196.     }
  18197. }
  18198.  
  18199. function branchAutocomplete(element) {
  18200.     $('#clientCategoryText').attr('data-id', '');
  18201.     $('#clientCategoryId').val('');
  18202.  
  18203.     autocomplete.start('/category.do', {
  18204.         element: element,
  18205.         threshold: 3,
  18206.         pickClass: '',
  18207.         onPick: function(element) {
  18208.             var data = $(element).data();
  18209.  
  18210.             var branchIds = [], $branches = $('#clientCategoryId'),
  18211.                 $branchContainer = $('#clientCategoryText');
  18212.  
  18213.             $branchContainer.find('> span').each(function(i) {
  18214.                 branchIds.push(parseInt($(this).attr('data-id')));
  18215.             });
  18216.             if ($.inArray(parseInt(data.key), branchIds) < 0) {
  18217.                 var result = {
  18218.                     branch_id: data.key,
  18219.                     branch: data.value
  18220.                 };
  18221.                 $branchContainer.appendBranch(result);
  18222.                 $.updateBranch($branchContainer, $branches);
  18223.             }
  18224.         }
  18225.     });
  18226. }
  18227.  
  18228. $.fn.appendBranch = function(data) {
  18229.     var $el = $('#clientCategoryText');
  18230.     $el.val(data.branch);
  18231.     $el.attr('data-id', data.branch_id);
  18232. };
  18233.  
  18234. $.updateBranch = function($branchContainer, $branch) {
  18235.     $branch.val($branchContainer.attr('data-id'));
  18236. };
  18237.  
  18238. function formatOpeningHours(element) {
  18239.     var data = $(element).val();
  18240.     if (data.indexOf(".") >= 0) {
  18241.         data = data.replace('.', ':');
  18242.  
  18243.         $(element).val(data);
  18244.     }
  18245.  
  18246.     var dataArray = data.split(':');
  18247.  
  18248.     if (dataArray.length > 1) {
  18249.         if (dataArray[0].length < 2) {
  18250.             data = '0' + data;
  18251.         }
  18252.         data = data.substring(0, 5);
  18253.  
  18254.         $(element).val(data);
  18255.     }
  18256. }
  18257.  
  18258. jQuery(document).ready(function() {
  18259.     parseKeywords();
  18260.  
  18261.     var $clientCategoryId = $('#clientCategoryId');
  18262.  
  18263.     if ($clientCategoryId.size()) {
  18264.         try {
  18265.             var branch = jQuery.parseJSON($clientCategoryId.val()),
  18266.                 $branchContainer = $('#clientCategoryText');
  18267.  
  18268.             $.each(branch, function(i, v) {
  18269.                 $branchContainer.appendBranch(v);
  18270.             });
  18271.         } catch (err) {
  18272.         }
  18273.     }
  18274.  
  18275.     // help the user with homepage input
  18276.     $('input[type=url]').blur(function() {
  18277.         var $el = $(this), val = $el.val();
  18278.  
  18279.         if (val && val.search(/^http/) === -1) {
  18280.             $el.val('http://' + val);
  18281.         }
  18282.     });
  18283.  
  18284.     /*
  18285.      $('select').each(function () {
  18286.      if ($(this).length == 1) {
  18287.      $($(this + ' option').get(0)).prop('selected', true);
  18288.      }
  18289.      });*/
  18290. });
  18291.  
  18292. function fancyButtons($addFontClass) {
  18293.     var ua = 0;
  18294.     var msie = 0; //IE 10 and older
  18295.     var trident = 0; //IE 11+
  18296.     var edge = 0;
  18297.  
  18298.     if (typeof $addFontClass === undefined) {
  18299.         ua = window.navigator.userAgent;
  18300.         msie = ua.indexOf("MSIE "); //IE 10 and older
  18301.         trident = ua.indexOf('Trident/'); //IE 11+
  18302.         edge = ua.indexOf('Edge/');
  18303.     }
  18304.  
  18305.     if ($addFontClass === false || (typeof $addFontClass === undefined && (edge > 0 || trident > 0 || msie > 0))) {
  18306.         $("input[type=checkbox]").each(function() {
  18307.             if ($(this).hasClass('fa')) {
  18308.                 $(this).removeClass('fa');
  18309.             }
  18310.         });
  18311.  
  18312.         $("input[type=radio]").each(function() {
  18313.             if ($(this).hasClass('fa')) {
  18314.                 $(this).removeClass('fa');
  18315.             }
  18316.         });
  18317.     }
  18318.     else  // If another browser, return 0
  18319.     {
  18320.         $("input[type=checkbox]").each(function() {
  18321.             if (!$(this).hasClass('fa')) {
  18322.                 $(this).addClass('fa');
  18323.             }
  18324.         });
  18325.         $("input[type=radio]").each(function() {
  18326.             if (!$(this).hasClass('fa')) {
  18327.                 $(this).addClass('fa');
  18328.             }
  18329.         });
  18330.     }
  18331. }
  18332.  
  18333. function openSocialMediaLink(element) {
  18334.     var id = $(element).attr('data-id'), val = $('#' + id).val(), link = $('#' + id + '_addon_pre').text() + val;
  18335.  
  18336.     if (val.search(/^http:/) !== -1) {
  18337.         link = val;
  18338.     }
  18339.  
  18340.     window.open(link, 'Social Media Link');
  18341. }
  18342.  
  18343. function addOpeningHoursRow(containerId, hide) {
  18344.     var $container = $('#'+containerId),
  18345.         prototype = $container.data('prototype').replace(/__name__/g, 'oh' + (Math.ceil(Math.random() * 1000000)));
  18346.  
  18347.     $container.append(prototype);
  18348.     if (hide === true) {
  18349.         $container.children().first().attr('style', 'display:none');
  18350.     }
  18351. }
  18352.  
  18353. function removeOpeningHoursRow(button) {
  18354.     var row = $(button).closest('.row').closest('.form-group'), parent = row.parent();
  18355.     row.remove();
  18356.  
  18357.     if (parent.find('.form-group').length) {
  18358.  
  18359.     } else {
  18360.         addOpeningHoursRow(parent.attr('id'), true);
  18361.     }
  18362. }
  18363.  
  18364. $(document).ready(function() {
  18365.     $('.btn-checkbox .checkbox input').each(function() {
  18366.         if (this.checked) {
  18367.             toggleActiveClass($(this).parent());
  18368.         }
  18369.     });
  18370. });
  18371.  
  18372. $(document).on('click', '.btn-checkbox .checkbox label', function(e) {
  18373.     toggleActiveClass($(this).parent());
  18374. });
  18375.  
  18376. $(document).on('click', '.btn-checkbox .checkbox', function(e) {
  18377.     toggleActiveClass(this);
  18378. });
  18379.  
  18380. function toggleActiveClass(element) {
  18381.     $(element).toggleClass("active");
  18382.     var $input = $(element).find('input');
  18383.     if ($(element).hasClass("active")) {
  18384.         $input.attr('checked', 'checked');
  18385.     } else {
  18386.         $input.removeAttr('checked');
  18387.     }
  18388. }
  18389. ;Mem = (function ($, window) {
  18390.     var my = {}, autoTime, selected, prefix = '', frame = 'mainframe', source;
  18391.  
  18392.     my.init = function (listId, urlPrefix, project) {
  18393.         $('.sidebar-item .head').click(function () {
  18394.             $(this).siblings('.body').slideToggle();
  18395.         });
  18396.  
  18397.         if (listId) {
  18398.             my.selectList(listId);
  18399.         }
  18400.  
  18401.         if (urlPrefix) {
  18402.             prefix = urlPrefix;
  18403.         }
  18404.  
  18405.         if (project) {
  18406.             source = project;
  18407.         }
  18408.     };
  18409.  
  18410.     my.selectList = function (listId) {
  18411.         Ajax.getContent(prefix + 'merkliste/ajax/detail', frame, {'id': listId, 'source': source});
  18412.     };
  18413.  
  18414.     my.edit = function (listId) {
  18415.         Ajax.getContent(prefix + 'user/memoryEdit', frame, {'id': listId, 'source': source});
  18416.     };
  18417.  
  18418.     my.editCompany = function (listId) {
  18419.         Ajax.getContent(prefix + 'user/memoryEditCompany', frame, {'id': listId, 'source': source});
  18420.     };
  18421.  
  18422.     my.follow = function (btn, id) {
  18423.         var $btn = $(btn);
  18424.  
  18425.         var t = 'Nicht mehr folgen';
  18426.         $btn.attr("onclick", "Mem.unfollow(this, " + id + ")");
  18427.         $btn.disableButton(t);
  18428.  
  18429.         url = 'merkliste/ajax/follow';
  18430.  
  18431.         $.get(prefix + url, {'id': id, 'f': 1}, function (d) {
  18432.             $btn.enableButton(t, d.status == 'ok');
  18433.         });
  18434.     };
  18435.     my.unfollow = function (btn, id) {
  18436.         var $btn = $(btn);
  18437.  
  18438.         var t = 'Folgen';
  18439.         $btn.attr("onclick", "Mem.follow(this, " + id + ")");
  18440.         $btn.disableButton(t);
  18441.  
  18442.         url = 'merkliste/ajax/follow';
  18443.  
  18444.         $.get(prefix + url, {'id': id, 'f': 0}, function (d) {
  18445.             $btn.enableButton(t, d.status == 'ok');
  18446.         });
  18447.     };
  18448.  
  18449.     my.saveListSubmit = function () {
  18450.         var $form = $('#listform'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18451.         var formData = new FormData($form[0]);
  18452.  
  18453.         url = 'user/memorySave';
  18454.  
  18455.         $.ajax({
  18456.             url: prefix + url,
  18457.             type: 'POST',
  18458.             data: formData,
  18459.             async: false,
  18460.             cache: false,
  18461.             contentType: false,
  18462.             processData: false,
  18463.             success: function (d) {
  18464.                 $btn.enableButton(t, d.status == 'ok');
  18465.  
  18466.                 if (d.status == 'ok') {
  18467.                     my.editCompany(d.id);
  18468.                 } else {
  18469.                     $('#mainframe').html(d);
  18470.                 }
  18471.             }
  18472.         });
  18473.  
  18474.         return false;
  18475.     };
  18476.  
  18477.     my.searchListSubmit = function (page, searchWord, saveHistory) {
  18478.         var $form = $('#searchMemoryListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18479.         $btn.disableButton(t);
  18480.  
  18481.         if (searchWord != null) {
  18482.             $('#searchMemoryListName').val(searchWord);
  18483.         }
  18484.         $('#memorySearchPage').val(page);
  18485.  
  18486.         url = 'merkliste/ajax/searchMemory';
  18487.  
  18488.         $.post(prefix + url, $form.serialize(), function (d) {
  18489.             if (saveHistory == true) {
  18490.                 //console.log('Input Field: ' + $('#searchMemoryListName').attr('name'));
  18491.                 saveHistoryFunction("$.ajax(Ajax.getContent('" + prefix + url + "', '" + frame + "Form')).done(function() {Mem.searchListSubmit(" + $('#memorySearchPage').val() + ", '" + $('#searchMemoryListName').val() + "', false);}); setActiveSidebarEntry('searchFormLink');");
  18492.             }
  18493.  
  18494.             $btn.enableButton(t);
  18495.             $('#memoryResultFrame').html(d);
  18496.         });
  18497.     };
  18498.  
  18499.     my.deleteList = function (listId) {
  18500.         if (confirm('Möchtest du diese LieblingsListe wirklich löschen?')) {
  18501.  
  18502.             url = 'user/memoryDelete';
  18503.             urlSuccess = 'merkliste/ajax/myList';
  18504.  
  18505.             $.post(prefix + url, {'l': listId, 'source': source}, function (d) {
  18506.                 if (d.status == 'ok') {
  18507.                     message('success', 'Die LieblingsListe wurde erfolgreich gelöscht.');
  18508.  
  18509.                     Ajax.getContent(prefix + urlSuccess, frame);
  18510.                 }
  18511.             });
  18512.         }
  18513.     };
  18514.  
  18515.     function message(type, text) {
  18516.         var $msg = $('<div class="alert alert-' + type + '">' + text + '</div>');
  18517.         $msg.hide().appendTo($('.messages')).fadeIn();
  18518.         window.setTimeout(function () {
  18519.             $msg.fadeOut();
  18520.         }, 3000);
  18521.     }
  18522.  
  18523.     my.createCompanySubmit = function () {
  18524.         var $form = $('#addNewCompanyContainer #addCompany form'), $btn = $('button[type=submit]', $form), t = $btn.html();
  18525.         $btn.disableButton(t);
  18526.  
  18527.         url = 'user/createCompany';
  18528.  
  18529.         $.post(prefix + url, $form.serialize(), function (d) {
  18530.             $btn.enableButton(t, d.status == 'ok');
  18531.  
  18532.             if (d.status) {
  18533.                 $('#companyAddError').text(d.msg).show();
  18534.                 window.setTimeout(function () {
  18535.                     $('#companyAddError').fadeOut();
  18536.                 }, 2000);
  18537.  
  18538.                 $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
  18539.  
  18540.                 $('#newCompanyErrorMsg').removeClass("hidden", 100, "easeInQuad");
  18541.                 setTimeout(function () {
  18542.                     $('#newCompanyErrorMsg').addClass("hidden", 100, "easeInQuad");
  18543.                 }, 3000);
  18544.  
  18545.             } else {
  18546.                 selected = null;
  18547.                 $('#companyList').html(d);
  18548.                 $("html, body").animate({scrollTop: ($('#companyList').offset().top) - 50}, 1000);
  18549.  
  18550.                 $('#newCompanySuccessMsg').removeClass("hidden", 100, "easeInQuad");
  18551.                 setTimeout(function () {
  18552.                     $('#newCompanySuccessMsg').addClass("hidden", 100, "easeInQuad");
  18553.                 }, 3000);
  18554.             }
  18555.         });
  18556.     };
  18557.  
  18558.     my.addFacebookSubmit = function () {
  18559.         var $form = $('#addNewCompanyContainer #addFacebookPage form'), $btn = $('button[type=submit]', $form), t = $btn.html();
  18560.         $btn.disableButton(t);
  18561.  
  18562.         url = 'user/addFacebookPage';
  18563.  
  18564.         $.post(prefix + url, $form.serialize(), function (d) {
  18565.             $btn.enableButton(t, d.status == 'ok');
  18566.             if (d.status) {
  18567.                 $('#companyAddError').text(d.msg).show();
  18568.                 window.setTimeout(function () {
  18569.                     $('#companyAddError').fadeOut();
  18570.                 }, 2000);
  18571.             } else {
  18572.                 selected = null;
  18573.                 $('#companyList').html(d);
  18574.                 $('#facebookPageLink').val('');
  18575.             }
  18576.         });
  18577.     };
  18578.  
  18579.     my.add = function (btn, cid) {
  18580.         var $btn = $(btn), t = $btn.text();
  18581.         $btn.disableButton(t);
  18582.  
  18583.         $.get('/merkliste/ajax/lists', {'cid': cid}, function (d) {
  18584.             var html = '', i;
  18585.             $btn.enableButton(t);
  18586.  
  18587.             if (d.status == 'ok') {
  18588.                 html += '<li class="list-group-item"><div class="row"><div class="col-xs-8">' +
  18589.                     '<input type="text" id="memoryNew" class="form-control" placeholder="Neue Merkliste anlegen" /></div><div class="col-xs-4">' +
  18590.                     '<button type="button" class="btn btn-warning" onclick="Mem.selected(0, ' + cid + ')">Neue Merkliste anlegen <i class="fa fa-check"></i></button>' +
  18591.                     '</div></div></div></li>';
  18592.  
  18593.                 for (i = 0; i < d.lists.length; i++) {
  18594.                     var l = d.lists[i];
  18595.                     var clickAble = '"';
  18596.                     if (!l.isOnList) {
  18597.                         clickAble = ' clickable" onclick="Mem.selected(' + l.id + ', ' + cid + ');" ';
  18598.                     }
  18599.  
  18600.  
  18601.                     html += '<li class="list-group-item' + clickAble +
  18602.                         ' data-toggle="tooltip" data-placement="bottom" title="Zur Merkliste ' + l.title + ' hinzufügen"' +
  18603.                         '><span class="indicators">' +
  18604.                         (l.isOnList ? '<i class="fa fa-2x fa-check"></i> ' : '') +
  18605.                         '</span>' + l.title + '</li>';
  18606.                 }
  18607.  
  18608.                 $('#memoryAddContainer').html('<ul class="list-group">' + html + '</ul>').slideDown();
  18609.             } else {
  18610.                 $('#memoryAddContainer').html(d.msg).slideDown();
  18611.             }
  18612.         });
  18613.     };
  18614.  
  18615.     my.selected = function (id, cid) {
  18616.         var t = '';
  18617.  
  18618.         if (id == 0) {
  18619.             t = $('#memoryNew').val();
  18620.  
  18621.             if (!t) {
  18622.                 return;
  18623.             }
  18624.         }
  18625.  
  18626.         $('#memoryAddContainer').slideUp();
  18627.  
  18628.         $.post('/merkliste/ajax/add', {'id': id, 't': t, 'cid': cid}, function (d) {
  18629.             if (d.status == 'ok') {
  18630.                 var $btn = $('#buttonAddToMemoryList');
  18631.                 $btn.enableButton($btn.text(), true);
  18632.             }
  18633.         });
  18634.     };
  18635.  
  18636.  
  18637.     my.addCompanyNotice = function (companyEntryId) {
  18638.         var notice = $('#listCompanyNotice_' + companyEntryId).val(), $btn = $('#listCompanyNoticeButton_' + companyEntryId);
  18639.         $btn.disableButton();
  18640.  
  18641.         $.post('/merkliste/ajax/addCompanyNotice', {'notice': notice, 'cid': companyEntryId}, function (d) {
  18642.             if (d.status == 'ok') {
  18643.                 $btn.enableButton('<i class="fa fa-check"></i>');
  18644.             }
  18645.         });
  18646.     };
  18647.  
  18648.     my.addCompanyNoticeList = function () {
  18649.         var $form = $('#memoryListCompanies'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18650.         $btn.disableButton(t);
  18651.  
  18652.         $.post('/merkliste/ajax/addCompanyNoticeList', $form.serialize(), function (d) {
  18653.             if (d.status == 'ok') {
  18654.                 $btn.enableButton(t);
  18655.             }
  18656.         });
  18657.     };
  18658.  
  18659.     my.addCompany = function (listId, companyId) {
  18660.         url = 'user/addCompany';
  18661.         $.get(prefix + url, {'id': listId, 'cid': companyId}, function (d) {
  18662.             if (d.status) {
  18663.                 $('#companyAddError').text(d.msg).show();
  18664.                 window.setTimeout(function () {
  18665.                     $('#companyAddError').fadeOut();
  18666.                 }, 2000);
  18667.             } else {
  18668.                 selected = null;
  18669.                 $('#companyList').html(d);
  18670.             }
  18671.         });
  18672.     };
  18673.  
  18674.     my.removeCompany = function (listId, companyEntryId) {
  18675.         var $row = $('#memoryListCompany_' + companyEntryId), $rowNotice = $('#memoryListCompanyNotice_' + companyEntryId), $btn = $('button', $row), t = $btn.html();
  18676.         $btn.disableButton();
  18677.  
  18678.         $.post('/user/memoryremove', {'l': listId, 'c': companyEntryId}, function (d) {
  18679.             if (d.status == 'ok') {
  18680.                 $row.fadeOut(200);
  18681.                 $rowNotice.fadeOut(200);
  18682.             } else {
  18683.                 $btn.enableButton(t);
  18684.             }
  18685.         });
  18686.     };
  18687.  
  18688.     my.searchCompanyListSubmit = function (boxId, page) {
  18689.         url = 'user/memorySearchCompany';
  18690.  
  18691.         var $form = $('#searchCompanyListForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  18692.         $btn.disableButton(t);
  18693.         $('#companySearchPage').val(page);
  18694.  
  18695.         $.post(prefix + url, $form.serialize(), function (d) {
  18696.             $btn.enableButton(t);
  18697.             $('#' + boxId).html(d);
  18698.             $("html, body").animate({scrollTop: ($('#searchCompanyListForm').offset().top) - 50}, 1000);
  18699.         });
  18700.     };
  18701.  
  18702.     return my;
  18703. }(jQuery, window));
  18704.  
  18705.  
  18706. //memory history for app
  18707. var historyList = [];
  18708.  
  18709. function saveHistory(element) {
  18710.     var onclickFunction = $(element).attr("onclick");
  18711.     onclickFunction = onclickFunction.replace("saveHistory(this);", "");
  18712.  
  18713.     saveHistoryFunction(onclickFunction);
  18714. }
  18715.  
  18716. function saveHistoryFunction(functionString) {
  18717.     if (functionString != null) {
  18718.  
  18719.         if (functionString.indexOf("setActiveSidebarEntry") <= 0) {
  18720.             sidebarId = $('#sidebar .btn-danger').attr('id');
  18721.             functionString = functionString + 'setActiveSidebarEntry("' + sidebarId + '");';
  18722.         }
  18723.         historyList.push(functionString);
  18724.         if (historyList.length > 1) {
  18725.             $('#backButton').show();
  18726.         }
  18727.     }
  18728. }
  18729.  
  18730. function historyBack() {
  18731.     /*
  18732.      remove the current element from the list with pop
  18733.      trigger the now last entry
  18734.      make sure there are at least 2 entries in the list (> 1)
  18735.      otherwise the current entry will be removed by pop and can not be reached in the future
  18736.      */
  18737.     if (historyList.length > 1) {
  18738.         historyList.pop();
  18739.         var lastFunction = historyList[historyList.length - 1];
  18740.  
  18741.         if (lastFunction != 'undefined') {
  18742.             eval(lastFunction);
  18743.         }
  18744.     } else {
  18745.         $('#backButton').hide();
  18746.     }
  18747. };var Categories = (function () {
  18748.     var my = {},
  18749.         firstLevelPrefix = 'first-level-',
  18750.         secondLevelPrefix = 'second-level-list-',
  18751.         categoriesPrefix = 'categories-';
  18752.  
  18753.     /* --------------------------------------------------------------*/
  18754.     /*                        categoryList                           */
  18755.  
  18756.     my.showFirstLevelName = function (firstLevelId) {
  18757.         hideElement(firstLevelId);
  18758.         $('#first-level-' + firstLevelId).slideDown();
  18759.     };
  18760.  
  18761.     my.showSecondLevelName = function (firstLevelId) {
  18762.         hideElement(firstLevelId);
  18763.  
  18764.         if ($('#' + firstLevelPrefix + firstLevelId).is(":hidden")) {
  18765.             $('#' + firstLevelPrefix + firstLevelId).slideDown();
  18766.         }
  18767.         if ($('#' + secondLevelPrefix + firstLevelId).is(":hidden")) {
  18768.             $('#' + secondLevelPrefix + firstLevelId).slideDown();
  18769.         }
  18770.     };
  18771.  
  18772.     function hideElement(id) {
  18773.         $('.first-level-name').each(function () {
  18774.             if ($(this).attr('id') != firstLevelPrefix + id) {
  18775.                 $(this).slideUp();
  18776.             }
  18777.         });
  18778.         $('.second-level-list').each(function () {
  18779.             if ($(this).attr('id') != secondLevelPrefix + id) {
  18780.                 $(this).slideUp();
  18781.             }
  18782.         });
  18783.     }
  18784.  
  18785.  
  18786.     /* --------------------------------------------------------------*/
  18787.     /*                      biggestCityList                          */
  18788.  
  18789.     my.showCategoryInCityList = function (cityId) {
  18790.         if ($('#' + categoriesPrefix + cityId).is(":hidden")) {
  18791.             $('.categories-in-city').each(function () {
  18792.                 $(this).slideUp();
  18793.             });
  18794.  
  18795.             $('#' + categoriesPrefix + cityId).slideDown();
  18796.         }
  18797.     };
  18798.  
  18799.     return my;
  18800. }(jQuery, window));;var Navigation = (function () {
  18801.     var my = {};
  18802.  
  18803.     my.scrollTolElement = function (id) {
  18804.         $('html, body').animate({
  18805.             scrollTop: $('#' + id).offset().top
  18806.         }, 1000);
  18807.     };
  18808.  
  18809.     return my;
  18810. }(jQuery, window));;var Mobile = (function($) {
  18811.     var my = {}, isMobile = false;
  18812.  
  18813.     my.isMobile = function() {
  18814.         if ($(window).width() <= 768) { //for iPad & smaller devices
  18815.             isMobile = true;
  18816.         }
  18817.  
  18818.         return isMobile;
  18819.     };
  18820.  
  18821.     return my;
  18822. }(jQuery));;var TrackingCompany = (function () {
  18823.     var my = {}, method = 'trackcompany.do';
  18824.  
  18825.     my.send = function (action, companyId, userId) {
  18826.         return $.ajax({
  18827.             url: '/' + method,
  18828.             cache: false,
  18829.             type: 'POST',
  18830.             dataType: 'json',
  18831.             data: {
  18832.                 'action': action,
  18833.                 'companyId': companyId,
  18834.                 'userId': userId
  18835.             }
  18836.         });
  18837.     };
  18838.  
  18839.     return my;
  18840. }(jQuery, window));;var Cookie = (function($) {
  18841.     var my = {};
  18842.     my.set = function(key, value) {
  18843.         var expires = new Date();
  18844.         expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
  18845.         document.cookie = key + '=' + value + ';path=/' + ';expires=' + expires.toUTCString();
  18846.     };
  18847.  
  18848.     my.get = function(key) {
  18849.         var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
  18850.         return keyValue ? keyValue[2] : null;
  18851.     };
  18852.  
  18853.     return my;
  18854. }(jQuery));;/**
  18855.  * fontFaceCheck v0.2
  18856.  * Roel Nieskens, November 11, 2013
  18857.  *
  18858.  * Released under the MIT License. http://www.opensource.org/licenses/mit-license.php
  18859.  *
  18860.  * http://pixelambacht.nl/2013/font-face-render-check/
  18861.  *
  18862.  * Usage:
  18863.  * 1. If you call fontFaceCheck.support(), either a fontfacerender or a no-fontfacerender class
  18864.  *    will be added to the HTML tag.
  18865.  * 2. Or use a callback function to grab the test result:
  18866.  *    fontFaceCheck.support( function(isSupported) { alert(isSupported) } );
  18867.  *
  18868.  * For IE8 and below, also pass the path to the EOT font: fontFaceCheck.support('/my/font/');
  18869.  *
  18870.  * Should work on all JavaScript-enabled browsers, old or new
  18871.  *
  18872.  * Inspired by the work of Paul Irish: http://www.paulirish.com/2009/font-face-feature-detection/
  18873.  */
  18874. var fontFaceCheck = new function() {
  18875.  
  18876.     var doc = document,
  18877.         body = doc.body || doc.documentElement.appendChild(doc.createElement("fontface")),
  18878.         tempElm = doc.createElement("span"),
  18879.         tempStyle = doc.createElement("style"),
  18880.         delay = 5,
  18881.         runs = 20,
  18882.         supported,
  18883.  
  18884.         // Gratefully taken from https://gist.github.com/padolsey/527683
  18885.         ie = (function(){
  18886.             var undef,
  18887.                 v = 3,
  18888.                 div = doc.createElement("div"),
  18889.                 all = div.getElementsByTagName("i");
  18890.  
  18891.             while (
  18892.                 div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
  18893.                     all[0]
  18894.                 );
  18895.  
  18896.             return v > 4 ? v : undef;
  18897.         }()),
  18898.  
  18899.         checkSupport = function(fontPathEOT, callback) {
  18900.             // Use timeout because Gecko and Webkit load data-uri font asynchronously :(
  18901.             // setTimeout(function(){
  18902.             supported = (tempElm.offsetWidth / Math.max(1, tempElm.offsetHeight)) >= 5;
  18903.             if(!supported && runs-- > 0)
  18904.             {
  18905.                 setTimeout(function(){
  18906.                     checkSupport(fontPathEOT, callback);
  18907.                 }, delay);
  18908.                 return;
  18909.             }
  18910.             body.removeChild(tempElm);
  18911.             // When font doesn't load, ratio will be less than or equal to 1. When loaded, it will
  18912.             // be 10. Check if it"s more than 5 to account for offsetWidth/offsetHeight wonkyness.
  18913.             if(callback) {
  18914.                 callback(supported);
  18915.             } else  {
  18916.                 doc.getElementsByTagName("html")[0].className += supported ? " fontfacerender" : " no-fontfacerender";
  18917.             }
  18918.         };
  18919.  
  18920.     // Check @font-face support by trying to render our test icon
  18921.     this.support = function(fontPathEOT, callback) {
  18922.         fontPathEOT = fontPathEOT || "./";
  18923.  
  18924.         tempElm.setAttribute("style", "font-family:pixelambacht !important;position:fixed;visibility:hidden");
  18925.         tempElm.innerHTML = "-";
  18926.         body.appendChild(tempElm);
  18927.  
  18928.         tempStyle.type = "text/css";
  18929.         doc.getElementsByTagName("head")[0].appendChild(tempStyle);
  18930.  
  18931.         if(ie <= 8)
  18932.         {
  18933.             // IE<8 doesn't support fonts via data-uri, so get external .eot file. To assure it's
  18934.             // present when the test is executed, download it to cache via a synchronous XHR call
  18935.             var request = new XMLHttpRequest();
  18936.             request.open("GET", fontPathEOT+"pixelambacht.eot", false);
  18937.             request.send(null);
  18938.             tempStyle.styleSheet.cssText = "@font-face{font-family:pixelambacht;src:url('"+fontPathEOT+"pixelambacht.eot');}";
  18939.         }
  18940.         else
  18941.         {
  18942.             // Load TTF via data-uri
  18943.             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=)}";
  18944.         }
  18945.  
  18946.         checkSupport(fontPathEOT, callback);
  18947.     };
  18948. };;
  18949.  
  18950.    
  18951.     (function (w) {
  18952.         w['Login'] = w['Login'] || {};
  18953.         w['Login'].loginUrl = "https://www.bundes-telefonbuch.de/user/loginPopup"
  18954.     }(window));
  18955.  
  18956.  
  18957.         var onloadCallback = function () {
  18958.         $('.g-recaptcha').each(function (index, el) {
  18959.             grecaptcha.render(el, {
  18960.                 'sitekey': '6Ld0RAoTAAAAAFji0CujiR0oPoPiDYZQvh21l715',
  18961.                 'theme': 'light'
  18962.             });
  18963.         });
  18964.     };
  18965.    
  18966.  
  18967.     // getScript workaround for IE
  18968.     jQuery.extend({
  18969.         getScript: function (url, callback) {
  18970.             var head = document.getElementsByTagName("head")[0];
  18971.             var script = document.createElement("script");
  18972.             var done = false; // Handle Script loading
  18973.  
  18974.             script.src = url;
  18975.             script.onload = script.onreadystatechange = function () { // Attach handlers for all browsers
  18976.                 if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
  18977.                     done = true;
  18978.                     if (callback) {
  18979.                         callback();
  18980.                     }
  18981.                     script.onload = script.onreadystatechange = null; // Handle memory leak in IE
  18982.                 }
  18983.             };
  18984.  
  18985.             head.appendChild(script);
  18986.             return undefined; // We handle everything using the script element injection
  18987.         }
  18988.     });
  18989.  
  18990.  
  18991.     if (window.location.hash && window.location.hash == '#_=_') {
  18992.         if (window.history && history.pushState) window.history.pushState("", document.title, window.location.pathname);
  18993.         else window.location.hash = '';
  18994.     }
  18995.  
  18996.    
  18997.     $(document).ready(function () {
  18998.         if (window.location.hash == '#imageUploadForm') {
  18999.             CompanyAjaxLoad.toggleFromNavigation('navigation_images', 'imageUploadForm', true, false);
  19000.         }
  19001.  
  19002.         if ($('#companyAdvert').height() > 200) {
  19003.             $('#map-canvas').height($('#companyAdvert').height());
  19004.         }
  19005.  
  19006.         var windowWidth = $(window).width();
  19007.         if (windowWidth <= 768) { //for iPad & smaller devices
  19008.             $('.panel-collapse').removeClass('in');
  19009.         }
  19010.  
  19011.         $('.fb-page').attr('data-width', $('.fb-page').parent().width());
  19012.  
  19013.         $('textarea').each(function () {
  19014.             autoresizeTextarea(this);
  19015.         });
  19016.     });
  19017.  
  19018.     $(function () {
  19019.         $('[data-toggle="tooltip"]').tooltip({html: true});
  19020.         $('textarea').keyup(function () {
  19021.             autoresizeTextarea(this);
  19022.         });
  19023.     });
  19024.  
  19025.     function loadDatePicker($noStartDate, $id) {
  19026.         if ($id != null) {
  19027.             $field = $id;
  19028.         } else {
  19029.             $field = '.form-control.date';
  19030.         }
  19031.         if ($noStartDate == false) {
  19032.             $($field).datepicker({
  19033.                 format: "dd.mm.yyyy",
  19034.                 weekStart: 1,
  19035.                 startDate: "23.10.2019",
  19036.                 clearBtn: true,
  19037.                 language: "de",
  19038.                 calendarWeeks: true,
  19039.                 autoclose: true
  19040.             });
  19041.         } else {
  19042.             $($field).datepicker({
  19043.                 format: "dd.mm.yyyy",
  19044.                 weekStart: 1,
  19045.                 startDate: "22.04.2019",
  19046.                 clearBtn: true,
  19047.                 language: "de",
  19048.                 calendarWeeks: true,
  19049.                 autoclose: true
  19050.             });
  19051.         }
  19052.     }
  19053.  
  19054.  
  19055.  
  19056.     (function (G, o, O, g, L, e) {
  19057.         G[g] = G[g] || function () {
  19058.                     (G[g]['q'] = G[g]['q'] || []).push(arguments)
  19059.                 }, G[g]['t'] = 1 * new Date;
  19060.         L = o.createElement(O), e = o.getElementsByTagName(O)[0];
  19061.         L.async = 1;
  19062.         L.src = '//www.google.com/adsense/search/async-ads.js';
  19063.         e.parentNode.insertBefore(L, e)
  19064.     })(window, document, 'script', '_googCsa');
  19065.  
  19066.  
  19067.    
  19068.         var googletag = googletag || {};
  19069.     googletag.cmd = googletag.cmd || [];
  19070.     (function () {
  19071.         var gads = document.createElement('script');
  19072.         gads.async = true;
  19073.         gads.type = 'text/javascript';
  19074.         var useSSL = 'https:' == document.location.protocol;
  19075.         gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
  19076.         var node = document.getElementsByTagName('script')[0];
  19077.         node.parentNode.insertBefore(gads, node);
  19078.     })();
  19079.  
  19080.     googletag.cmd.push(function () {
  19081.        
  19082.                 googletag.defineSlot('/2492971/BTB.de_sonstiges_Leaderboard_Top', [728, 90], 'gpt-ad-leader-top').addService(googletag.pubads());
  19083.                         googletag.defineSlot('/2492971/BTb.de_sonstige_Leaderboard', [728, 90], 'gpt-ad-leader').addService(googletag.pubads());
  19084.                 googletag.defineSlot('/2492971/BTb.de_sonstige_Medium_Rectangle', [300, 250], 'gpt-ad-rectangle1').addService(googletag.pubads());
  19085.         googletag.defineSlot('/2492971/BTb.de_sonstige_Wide_Skyscraper', [160, 600], 'gpt-ad-skyscraper').addService(googletag.pubads());
  19086.                 googletag.defineSlot('/2492971/BTb.de_Startseite_Medium_Rectangle_Bilder', [300, 250], 'gpt-ad-rectangle2').addService(googletag.pubads());
  19087.                 googletag.defineSlot('/2492971/BTb.de_Large_Mobile_Banner', [325, 120], 'gpt-ad-mobile-top').addService(googletag.pubads());
  19088.  
  19089.         googletag.enableServices();
  19090.     });
  19091.    
  19092.  
  19093.     function getLocation() {
  19094.         $('#myLocation').toggleClass("active");
  19095.         var output = document.getElementById("geoMsg");
  19096.         var nav = window.navigator, $btn = $('#searchButton'), t = $btn.html();
  19097.  
  19098.         function successCallback(position) {
  19099.             $btn.enableButton(t);
  19100.             $('#geoMsg').html("");
  19101.             $('#whereLat').val(position.coords.latitude);
  19102.             $('#whereLng').val(position.coords.longitude);
  19103.  
  19104.             $('#where').val("Mein Standort");
  19105.             $('#where').attr('readonly', 'readonly');
  19106.         }
  19107.  
  19108.         function errorCallback(error) {
  19109.             $btn.enableButton(t);
  19110.             var message = "";
  19111.             switch (error.code) {
  19112.                 case error.PERMISSION_DENIED:
  19113.                     message = "<i class='fa fa-times-circle-o'></i> <strong class='bold text-white'>Keine Berechtigung zur Ermittlung des Standorts.</span>";
  19114.                     break;
  19115.                 case error.POSITION_UNAVAILABLE:
  19116.                     message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Keine Positionsermittlung möglich.</span>";
  19117.                     break;
  19118.                 case error.PERMISSION_DENIED_TIMEOUT:
  19119.                     message = "<i class='fa fa-times-circle-o'></i> <span class='bold text-white'>Fehler: Ermittlung des Standorts dauerte zu lange.</span>";
  19120.                     break;
  19121.             }
  19122.             output.innerHTML = message;
  19123.         }
  19124.  
  19125.         if (nav != null) {
  19126.             var geoloc = nav.geolocation;
  19127.             if (geoloc != null) {
  19128.                 output.innerHTML = "<i class='fa fa-question-circle-o'></i> <span class='bold text-white'>Koordinaten werden ermittelt.</span>";
  19129.                 if ($('#myLocation').hasClass('active')) {
  19130.                     $btn.disableButton(t);
  19131.                     geoloc.getCurrentPosition(successCallback, errorCallback);
  19132.                 } else {
  19133.                     $('#where').removeAttr('readonly');
  19134.                     $('#where').val('');
  19135.                     $('#whereLat').val('');
  19136.                     $('#whereLng').val('');
  19137.                     output.innerHTML = "";
  19138.                 }
  19139.             }
  19140.             else {
  19141.                 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>";
  19142.                 return;
  19143.             }
  19144.         }
  19145.         else {
  19146.             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>";
  19147.             return;
  19148.         }
  19149.     }
  19150.  
  19151.     function removeLocation() {
  19152.         $('#myLocation').toggleClass("active");
  19153.         var output = document.getElementById("geoMsg");
  19154.  
  19155.         $('#where').removeAttr('readonly');
  19156.         $('#where').val('');
  19157.         $('#whereLat').val('');
  19158.         $('#whereLng').val('');
  19159.         output.innerHTML = "";
  19160.     }
  19161.  
  19162.     function positionSlidercontroll(id) {
  19163.         var carouselFiftyPercent = (($('#' + id).height() - 20) - ($('#' + id + ' .btn').height() / 2)) / 2;
  19164.         $('#' + id + ' .btn').css('top', carouselFiftyPercent);
  19165.     }
  19166.  
  19167.  
  19168.                         googletag.cmd.push(function() {
  19169.                             googletag.display('gpt-ad-leader-top');
  19170.                         });
  19171.                    
  19172.  
  19173.                                     googletag.cmd.push(function () {
  19174.                                         googletag.display('gpt-ad-skyscraper');
  19175.                                     });
  19176.                                
  19177.  
  19178.             $(document).ready(function () {
  19179.                 var offset = $('.skyscraper').offset();
  19180.                 $('.skyscraper').affix({
  19181.                     offset: {
  19182.                         top: offset.top
  19183.                     }
  19184.                 });
  19185.             });
  19186.        
  19187.  
  19188.     jQuery(document).ready(function($) {
  19189.         $.get('/usermenu.do', {}, function(html) {
  19190.             $('#userMenuPlaceholder').replaceWith(html);
  19191.         });
  19192.     }(jQuery));
  19193.  
  19194.  
  19195.     if ($(window).width() <= 768) { //for iPad & smaller devices
  19196.         if ($('.search-box-what').val()) {
  19197.             $('.search-wrapper-what').addClass('input-group');
  19198.             $('.close-icon-what').show();
  19199.         }
  19200.  
  19201.         if ($('.search-box-where').val()) {
  19202.             $('.close-icon-where').show();
  19203.         }
  19204.     }
  19205.  
  19206.     /*  $('.search-box').keyup(function () {
  19207.      var t = $(this);
  19208.      $('.close-icon').toggle(Boolean(t.val()));
  19209.      if (Boolean(t.val())) {
  19210.      $('.search-wrapper').addClass('input-group');
  19211.      } else {
  19212.      $('.search-wrapper').removeClass('input-group');
  19213.      }
  19214.      });
  19215.  
  19216.      $('.close-icon').click(function () {
  19217.      $('.search-box').val('').focus();
  19218.      $('.search-wrapper').removeClass('input-group');
  19219.      $(this).hide();
  19220.      });
  19221.      */
  19222.  
  19223.  
  19224.                 googletag.cmd.push(function () {
  19225.                     googletag.display('gpt-ad-mobile-top');
  19226.                 });
  19227.            
  19228.  
  19229.         jQuery(document).ready(function () {
  19230.             $('#qwertzuiop').load('/office.do?u=&c=');
  19231.         });
  19232.    
  19233.  
  19234.                     jQuery(document).ready(function ($) {
  19235.                         outputFlashSession();
  19236.                     }(jQuery));
  19237.                
  19238.  
  19239.                 googletag.cmd.push(function () {
  19240.                     googletag.display('gpt-ad-rectangle1');
  19241.                 });
  19242.            
  19243.  
  19244.         $(document).ready(function () {
  19245.             var leaderWidth = $('.rectangleContainer1').parent().width();
  19246.             if (leaderWidth < 300) {
  19247.                 $('.rectangleContainer1').hide()
  19248.             } else {
  19249.                 $('.rectangleContainer1').show()
  19250.             }
  19251.         });
  19252.    
  19253.  
  19254.                     googletag.cmd.push(function () {
  19255.                         googletag.display('gpt-ad-leader');
  19256.                     });
  19257.                
  19258.  
  19259.             $(document).ready(function () {
  19260.                 var leaderWidth = $('.leaderContainer').parent().width();
  19261.                 if (leaderWidth < 728) {
  19262.                     $('.leaderContainer').hide()
  19263.                 } else {
  19264.                     $('.leaderContainer').show()
  19265.                 }
  19266.             });
  19267.        
  19268.  
  19269.         var gaProperty = 'UA-4947670-1';
  19270.         var disableStr = 'ga-disable-' + gaProperty;
  19271.  
  19272.         if (document.cookie.indexOf(disableStr + '=true') > -1) {
  19273.             window[disableStr] = true;
  19274.         }
  19275.  
  19276.         function gaOptout() {
  19277.             document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  19278.             window[disableStr] = true;
  19279.             alert('Google Analytics ausgeschaltet');
  19280.         }
  19281.  
  19282.         (function(i, s, o, g, r, a, m) {
  19283.             i['GoogleAnalyticsObject'] = r;
  19284.             i[r] = i[r] || function() {
  19285.                 (i[r].q = i[r].q || []).push(arguments)
  19286.             }, i[r].l = 1 * new Date();
  19287.             a = s.createElement(o),
  19288.                 m = s.getElementsByTagName(o)[0];
  19289.             a.async = 1;
  19290.             a.src = g;
  19291.             m.parentNode.insertBefore(a, m)
  19292.         })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  19293.  
  19294.         ga('create', gaProperty, 'auto');
  19295.         ga('set', 'anonymizeIp', true);
  19296.         ga('send', 'pageview');
  19297.  
  19298.        
  19299.         var gaTbUA = 'UA-61714288-4';
  19300.         var disableStrTbUA = 'ga-disable-' + gaTbUA;
  19301.  
  19302.         function gaTbOptout() {
  19303.             document.cookie = disableStrTbUA + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  19304.             window[disableStrTbUA] = true;
  19305.             alert('google analytics disabled - tb');
  19306.         }
  19307.  
  19308.        
  19309.         $(document).ready(function() {
  19310.             $('.gaOptoutLink').click(function() {
  19311.                 gaOptout();
  19312.             });
  19313.  
  19314.             $('.gaTbOptoutLink').click(function() {
  19315.                 gaTbOptout();
  19316.             });
  19317.         });
  19318.    
  19319. /*DO NOT HOST THIS SCRIPT ON YOUR OWN SERVER*/
  19320. var szmvars = "";
  19321. var iom = iom || (function () {
  19322.   var dummySite = "dummy",
  19323.       baseUrlDE = "de.ioam.de/tx.io",
  19324.       baseUrlLSO = "de.ioam.de/aid.io",
  19325.       optinUrl = "de.ioam.de/optin.php?re=",
  19326.       qdsUrl = "irqs.ioam.de",
  19327.       cntBaseUrl = ".iocnt.net/tx.io",
  19328.       cntBaseUrlLSO = ".iocnt.net/aid.io",
  19329.       cntOptinUrl = ".iocnt.net/optin.php?re=",
  19330.       cntQdsUrl = "irqs.iocnt.net",
  19331.       cntSubdomain = ["at", "imarex"],
  19332.       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"],
  19333.       LSOBlacklist = [],
  19334.       checkEvents = 1,
  19335.       tb = 0,
  19336.       sv = 1,
  19337.       lastEvent = "",
  19338.       emptyCode = "Leercode_nichtzuordnungsfaehig",
  19339.       autoEvents = {
  19340.         onfocus:"aforg",
  19341.         onblur:"abakg",
  19342.         onclose:"aclse"
  19343.       },
  19344.       nt = 2,
  19345.       cookiewhitelist = [],
  19346.       cookieName = "ioam2018",
  19347.       socioToken = "632015cbcfc384bd790454922497da97",
  19348.       frequency = 60000,
  19349.       hbiAdShort = 5000,
  19350.       hbiAdMedium = 10000,
  19351.       hbiAdLong = 30000,
  19352.       hbiShort = 10000,
  19353.       hbiMedium = 30000,
  19354.       hbiLong = 60000,
  19355.       hbiExtraLong = 300000,
  19356.       heart;
  19357.  
  19358.   var IAMPageElement = null,
  19359.       IAMQSElement = null,
  19360.       qdsParameter = {},
  19361.       qdsPopupBlockDuration = 86400000,
  19362.       result = {},
  19363.       mode,
  19364.       eventsEnabled = 0,
  19365.       surveyCalled = 0,
  19366.       inited = 0;
  19367.  
  19368.   var lsottl = 86400000,
  19369.       lsottlmin = 180000,
  19370.       ioplusurl = "me.ioam.de";
  19371.  
  19372.   function enableEvents() {
  19373.     if ((tb == 1 || result.tb == "on") && result.tb != "off" && !eventsEnabled) {
  19374.       eventsEnabled = 1;
  19375.       mode = 1;
  19376.       for(var e in autoEvents) {
  19377.         (function(e) {
  19378.           var oldEvent = window[e];
  19379.           window[e] = function() {
  19380.             if (lastEvent != autoEvents[e]) {
  19381.               lastEvent = autoEvents[e];
  19382.               event(autoEvents[e]);
  19383.             }
  19384.             if (typeof oldEvent == "function") oldEvent();
  19385.           };
  19386.         })(e);
  19387.       }
  19388.     }
  19389.   }
  19390.  
  19391.   function isDoNotTrack() {
  19392.     if ((nt & 2) ? ((typeof result.nt == "undefined") ? (nt & 1) : result.nt) : nt & 1) {
  19393.       if (window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") return true;
  19394.       if (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1")) return true;
  19395.     }
  19396.     return false;
  19397.   }
  19398.  
  19399.   var getInvitation = function (response) {
  19400.     if (response && response.hasOwnProperty("block-status")){
  19401.       var isEligibleForInvitation = ( "NONE" === response['block-status'].toUpperCase() );
  19402.       if (isEligibleForInvitation) {
  19403.         if (IAMQSElement) {
  19404.           IAMQSElement.parentNode.removeChild(IAMQSElement);
  19405.         }
  19406.         IAMQSElement = createScriptTag(response['invite-url']);
  19407.       }
  19408.     }
  19409.   };
  19410.  
  19411.   function loadSurvey() {
  19412.     szmvars = result.st + "//" + result.pt + "//" + result.cp + "//VIA_SZMNG";
  19413.     var sampleType = (result.sv == "i2") ? "in" : result.sv;
  19414.     var qdsHost = qdsUrl;
  19415.     if (result.cn) {
  19416.       sampleType += "_"+result.cn;
  19417.       if (result.cn == "at") {
  19418.         qdsHost = cntQdsUrl;
  19419.       }
  19420.     }
  19421.  
  19422.     qdsParameter = {
  19423.       siteIdentifier: result.cp,
  19424.       offerIdentifier: result.st,
  19425.       sampleType: sampleType,
  19426.       pixelType: result.pt,
  19427.       contentType: result.cp,
  19428.       host: qdsHost,
  19429.       port: "",
  19430.       isFadeoutFlash: true,
  19431.       isFadeoutFrame: true,
  19432.       isFadeoutForm: true,
  19433.       positionTop: 10,
  19434.       positionLeft: 100,
  19435.       zIndex: 1100000,
  19436.       popupBlockDuration: qdsPopupBlockDuration,
  19437.       keysForQueryParam : [
  19438.           "offerIdentifier",
  19439.           "siteIdentifier",
  19440.           "sampleType",
  19441.           "pixelType",
  19442.           "isFadeoutFlash",
  19443.           "isFadeoutFrame",
  19444.           "isFadeoutForm",
  19445.           "positionTop",
  19446.           "positionLeft",
  19447.           "zIndex"]
  19448.     };
  19449.  
  19450.     if(typeof window.iam_zindex !== 'undefined') {
  19451.       qdsParameter.zIndex = window.iam_zindex;
  19452.     }
  19453.  
  19454.     if(typeof window.iam_fadeout_flash !== 'undefined') {
  19455.       qdsParameter.isFadeoutFlash = window.iam_fadeout_flash;
  19456.     }
  19457.  
  19458.     if(typeof window.iam_fadeout_iframe !== 'undefined') {
  19459.       qdsParameter.isFadeoutFrame = window.iam_fadeout_iframe;
  19460.     }
  19461.  
  19462.     if(typeof window.iam_fadeout_form !== 'undefined') {
  19463.       qdsParameter.isFadeoutForm = window.iam_fadeout_form;
  19464.     }
  19465.  
  19466.     if(typeof window.iam_position_top !== 'undefined') {
  19467.       qdsParameter.positionTop = window.iam_position_top;
  19468.     }
  19469.  
  19470.     if(typeof window.iam_position_left !== 'undefined') {
  19471.       qdsParameter.positionLeft = window.iam_position_left;
  19472.     }
  19473.  
  19474.     var filterObjectByKeys = function (obj, keysToFilter) {
  19475.         var result = {}, key;
  19476.         var arrayLength = keysToFilter.length;
  19477.         for (var i = 0; i < arrayLength; i++) {
  19478.             key = keysToFilter[i];
  19479.             if (obj.hasOwnProperty(key)) {
  19480.                 result[key] = obj[key];
  19481.             }
  19482.         }
  19483.         return result;
  19484.     };
  19485.  
  19486.     var serializeToQueryString = function (obj) {
  19487.       var str = [];
  19488.       for (var key in obj)
  19489.         if (obj.hasOwnProperty(key)) {
  19490.         str.push(encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]));
  19491.       }
  19492.       return str.join("&");
  19493.     };
  19494.  
  19495.     var createPopupcheckCookie = function (blockDuration) {
  19496.       var blockedUntilDate = new Date();
  19497.       blockedUntilDate.setTime(blockedUntilDate.getTime() + blockDuration);
  19498.       var expires = "expires=" + blockedUntilDate.toUTCString();
  19499.       document.cookie = "POPUPCHECK=" + blockedUntilDate.getTime().toString() + ";" + expires + ";path=/";
  19500.     };
  19501.  
  19502.     var hasPopupcheckCookie = function () {
  19503.       var cookie = document.cookie.split(";");
  19504.       for (var i = 0; i < cookie.length; i++) {
  19505.         if (cookie[i].match("POPUPCHECK=.*")) {
  19506.           var currentDate = new Date();
  19507.           var now = currentDate.getTime();
  19508.           currentDate.setTime(cookie[i].split("=")[1]);
  19509.           var blockedUntilTime = currentDate.getTime();
  19510.           if (now <= blockedUntilTime) {
  19511.             return true;
  19512.           }
  19513.         }
  19514.       }
  19515.       return false;
  19516.     };
  19517.  
  19518.     if (hasPopupcheckCookie()) {
  19519.       return;
  19520.     }
  19521.  
  19522.     if (sv && !surveyCalled && result.sv !== "ke" && result.sv === "dz") {
  19523.       surveyCalled = 1;
  19524.       iam_ng_nxss();
  19525.     }
  19526.  
  19527.     if (sv && !surveyCalled && result.sv !== "ke" && (result.sv === "in" || result.sv === "mo" || result.sv === "i2" )) {
  19528.       surveyCalled = 1;
  19529.       createPopupcheckCookie(qdsParameter.popupBlockDuration);
  19530.       var protocol = window.location.protocol;
  19531.       var pathOfCheckInvitation = "identitystatus";
  19532.       var queryParameter = filterObjectByKeys(qdsParameter, qdsParameter.keysForQueryParam);
  19533.       var queryParameterString = "?" + serializeToQueryString(queryParameter);
  19534.       if (window.XDomainRequest && document.documentMode === 9) {
  19535.         var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + '/identity.js' + queryParameterString+'&callback=iom.gi&c='+Math.random();
  19536.         createScriptTag(checkForInvitationUrl);
  19537.       } else {
  19538.         var checkForInvitationUrl = protocol + '//' + qdsParameter.host + '/' + pathOfCheckInvitation + queryParameterString+'&c='+Math.random();
  19539.         var httpRequest = new XMLHttpRequest();
  19540.         httpRequest.onreadystatechange = function () {
  19541.           if (httpRequest.readyState === XMLHttpRequest.DONE && 200 === httpRequest.status) {
  19542.             var response = JSON.parse(httpRequest.responseText);
  19543.             getInvitation(response);
  19544.           }
  19545.         };
  19546.         httpRequest.open('GET', checkForInvitationUrl, true);
  19547.         httpRequest.withCredentials = true;
  19548.         httpRequest.send(null);
  19549.       }
  19550.  
  19551.     }
  19552.   }
  19553.  
  19554.   function hash(key) {
  19555.     var hash = 0;
  19556.     for (var i=0; i<key.length; ++i) {
  19557.       hash += key.charCodeAt(i);
  19558.       hash += (hash << 10);
  19559.       hash ^= (hash >> 6);
  19560.     }
  19561.     hash += (hash << 3);
  19562.     hash ^= (hash >> 11);
  19563.     hash += (hash << 15);
  19564.     hash = Math.abs(hash & hash);
  19565.     return hash.toString(36);
  19566.   }
  19567.  
  19568.   function activeXDetect() {
  19569.     var result = "",
  19570.         componentVersion,
  19571.         components =[
  19572.                      "7790769C-0471-11D2-AF11-00C04FA35D02", "89820200-ECBD-11CF-8B85-00AA005B4340",
  19573.                      "283807B5-2C60-11D0-A31D-00AA00B92C03", "4F216970-C90C-11D1-B5C7-0000F8051515",
  19574.                      "44BBA848-CC51-11CF-AAFA-00AA00B6015C", "9381D8F2-0288-11D0-9501-00AA00B911A5",
  19575.                      "4F216970-C90C-11D1-B5C7-0000F8051515", "5A8D6EE0-3E18-11D0-821E-444553540000",
  19576.                      "89820200-ECBD-11CF-8B85-00AA005B4383", "08B0E5C0-4FCB-11CF-AAA5-00401C608555",
  19577.                      "45EA75A0-A269-11D1-B5BF-0000F8051515", "DE5AED00-A4BF-11D1-9948-00C04F98BBC9",
  19578.                      "22D6F312-B0F6-11D0-94AB-0080C74C7E95", "44BBA842-CC51-11CF-AAFA-00AA00B6015B",
  19579.                      "3AF36230-A269-11D1-B5BF-0000F8051515", "44BBA840-CC51-11CF-AAFA-00AA00B6015C",
  19580.                      "CC2A9BA0-3BDD-11D0-821E-444553540000", "08B0E5C0-4FCB-11CF-AAA5-00401C608500",
  19581.                      "D27CDB6E-AE6D-11CF-96B8-444553540000", "2A202491-F00D-11CF-87CC-0020AFEECF20"
  19582.                     ];
  19583.     document.body.addBehavior( "#default#clientCaps" );
  19584.     for (var i = 0; i < components.length; i++) {
  19585.       componentVersion = document.body.getComponentVersion('{' + components[i] + '}', 'ComponentID');
  19586.       if ( componentVersion !== null ) {
  19587.         result += componentVersion;
  19588.       } else {
  19589.         result += "null";
  19590.       }
  19591.     }
  19592.     return result;
  19593.   }
  19594.  
  19595.   function fingerprint() {
  19596.     var nav = window.navigator, t = nav.userAgent;
  19597.     t += getScreen();
  19598.     if (nav.plugins.length > 0 ) {
  19599.       for (var i = 0; i < nav.plugins.length; i++ ) {
  19600.         t += nav.plugins[i].filename + nav.plugins[i].version + nav.plugins[i].description;
  19601.       }
  19602.     }
  19603.     if (nav.mimeTypes.length > 0 ) {
  19604.       for (var i = 0; i < nav.mimeTypes.length; i++ ) {
  19605.         t += nav.mimeTypes[i].type;
  19606.       }
  19607.     }
  19608.     if ( /MSIE (\d+\.\d+);/.test(nav.userAgent) ) {
  19609.       try {
  19610.         t += activeXDetect();
  19611.       }
  19612.       catch(e) {
  19613.         // ignore
  19614.       }
  19615.     }
  19616.     return hash(t);
  19617.   }
  19618.  
  19619.   function createScriptTag(url){
  19620.     var el = document.createElement("script");
  19621.     el.type = "text/javascript";
  19622.     el.src = url;
  19623.     var head = document.getElementsByTagName("head")[0];
  19624.     if(head) {
  19625.       head.appendChild(el);
  19626.       return el;
  19627.     }
  19628.     else return false;
  19629.   }
  19630.  
  19631.   function createScriptTagAsync(url, cb){
  19632.     var el = document.createElement("script");
  19633.     el.type = "text/javascript";
  19634.     el.src = url;
  19635.     el.onload = cb;
  19636.     el.async = true;
  19637.     var head = document.getElementsByTagName("head")[0];
  19638.     if(head) {
  19639.       head.appendChild(el);
  19640.       return el;
  19641.     }
  19642.     else return false;
  19643.   }
  19644.  
  19645.   function transmitData(url, mode) {
  19646.     if (url.split("/")[2].slice(url.split("/")[2].length-8) == ".ioam.de" || url.split("/")[2].slice(url.split("/")[2].length-10) == ".iocnt.net") {
  19647.       switch (mode) {
  19648.         case 1:
  19649.           if (IAMPageElement) {
  19650.             IAMPageElement.parentNode.removeChild(IAMPageElement);
  19651.           }
  19652.           IAMPageElement = createScriptTag(url+'&mo=1');
  19653.           if (!IAMPageElement) (new Image()).src = url+'&mo=0';
  19654.           break;
  19655.         case 2:
  19656.           (new Image()).src = url+'&mo=0';
  19657.           break;
  19658.         case 3:
  19659.           var IAMsendBox = document.getElementById('iamsendbox'), sendBoxStyle;
  19660.           if (IAMsendBox) {
  19661.             document.body.removeChild(IAMsendBox);
  19662.           }
  19663.           IAMsendBox = document.createElement("iframe");
  19664.           IAMsendBox.id = "iamsendbox";
  19665.           sendBoxStyle = IAMsendBox.style;
  19666.           sendBoxStyle.position = "absolute";
  19667.           sendBoxStyle.left = sendBoxStyle.top = "-999px";
  19668.           IAMsendBox.src = url + "&mo=1";
  19669.           document.body.appendChild(IAMsendBox);
  19670.           break;
  19671.         case 0:
  19672.         default:
  19673.           document.write('<script src="'+url+'&mo=1"></script>');
  19674.       }
  19675.     }
  19676.   }
  19677.  
  19678.   function getScreen() {
  19679.     return screen.width + "x" + screen.height + "x" + screen.colorDepth;
  19680.   }
  19681.  
  19682.   function arrayContains(arr, obj) {
  19683.     var i;
  19684.     for (i=0;i<arr.length;i++) {
  19685.       if (arr[i]==obj) return true;
  19686.     }
  19687.     return false;
  19688.   }
  19689.  
  19690.   function transformVar(value) {
  19691.     if (!value) value = "";
  19692.     value = value.replace(/[?#].*/g, "");
  19693.     value = value.replace(/[^a-zA-Z0-9,_\/-]+/g, ".");
  19694.     if (value.length > 255) value = value.substr(0,254) + '+';
  19695.     return value;
  19696.   }
  19697.  
  19698.   function getRefHost() {
  19699.     var url = document.referrer.split("/");
  19700.     return (url.length >= 3) ? url[2] : "";
  19701.   }
  19702.  
  19703.   function buildResult(params) {
  19704.     result = {};
  19705.     var i;
  19706.     for (i in params) {
  19707.       if (params.hasOwnProperty(i)) {
  19708.         if (i != "cn" || (i == "cn" && arrayContains(cntSubdomain, params[i]))) {
  19709.           result[i] = params[i];
  19710.         }
  19711.       }
  19712.     }
  19713.     if (result.hasOwnProperty("fp")) {
  19714.       result.fp = (result.fp != "" && typeof result.fp != "undefined") ? result.fp : emptyCode;
  19715.       result.fp = transformVar(result.fp);
  19716.       result.pt = "FP";
  19717.     }
  19718.     if (result.hasOwnProperty("np")) {
  19719.       result.np = (result.np != "" && typeof result.np != "undefined") ? result.np : emptyCode;
  19720.       result.np = transformVar(result.np);
  19721.       result.pt = "NP";
  19722.     }
  19723.     if (result.hasOwnProperty("xp")) {
  19724.       result.xp = (result.xp != "" && typeof result.xp != "undefined") ? result.xp : emptyCode;
  19725.       result.xp = transformVar(result.xp);
  19726.       result.pt = "XP";
  19727.     }
  19728.     if (result.hasOwnProperty("cp")) {
  19729.       result.cp = (result.cp != "" && typeof result.cp != "undefined") ? result.cp : emptyCode;
  19730.       result.cp = transformVar(result.cp);
  19731.       result.pt = "CP";
  19732.     }
  19733.     if (!result.pt) {
  19734.       result.cp = emptyCode;
  19735.       result.pt = "CP";
  19736.       result.er = "N13";
  19737.     }
  19738.     if (!result.hasOwnProperty("ps")) {
  19739.       result.ps = "lin";
  19740.       result.er = "N22";
  19741.     } else {
  19742.       if (!(arrayContains(['ack', 'lin', 'pio', 'out'], result.ps))) {
  19743.         result.ps = "lin";
  19744.         result.er = "N23";
  19745.       }
  19746.     }
  19747.     result.rf = getRefHost();
  19748.     if (!result.hasOwnProperty("sur") || (result.hasOwnProperty("sur") && result.sur != "yes")) {
  19749.       result.r2 = document.referrer;
  19750.     }
  19751.     result.ur = document.location.host;
  19752.     result.xy = getScreen();
  19753.     result.lo = "US/Oregon";
  19754.     result.cb = "000d";
  19755.     result.i2 = "000dc8b3f4e3020ae5cbcfc38";
  19756.     result.ep = 1579667364;
  19757.     result.vr = "412";
  19758.     result.id = fingerprint();
  19759.     result.st = result.st ? result.st : dummySite;
  19760.     if (!result.hasOwnProperty("sc") || (result.hasOwnProperty("sc") && result.sc != "no")) {
  19761.       var cookie = getFirstPartyCookie();
  19762.       result.i3 = cookie.cookie;
  19763.       result.n1 = cookie.length;
  19764.     }
  19765.     if (((arrayContains(cookiewhitelist, result.st)) || (result.hasOwnProperty("sc") && result.sc == "yes")) && result.i3 == "nocookie") {
  19766.       result.i3 = setFirstPartyCookie();
  19767.     }
  19768.  
  19769.     if (!result.hasOwnProperty("cn") && result.st.charAt(2) == "_") {
  19770.       var cn = result.st.substr(0,2);
  19771.       if (arrayContains(cntSubdomain, cn)) {
  19772.         result.cn = cn;
  19773.       } else {
  19774.         result.er = "E12";
  19775.       }
  19776.     }
  19777.  
  19778.     // DNT dissemination survey
  19779.     try {
  19780.       result.dntt = ((window.navigator.msDoNotTrack && window.navigator.msDoNotTrack == "1") || (window.navigator.doNotTrack && (window.navigator.doNotTrack == "yes" || window.navigator.doNotTrack == "1"))) ? "1" : "0";
  19781.     } catch(e) {
  19782.       // ignore
  19783.     }
  19784.   }
  19785.  
  19786.   function event(event) {
  19787.     var payLoad = "";
  19788.     var i;
  19789.     event = event || "";
  19790.     stopHeart();
  19791.     if (inited && !isDoNotTrack() && (!checkEvents || (checkEvents && arrayContains(eventList, event))) && result.ps !== "out") {
  19792.       result.lt = (new Date()).getTime();
  19793.       result.ev = event;
  19794.       var proto = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:";
  19795.       var baseUrl = baseUrlDE;
  19796.       if (result.cn) {
  19797.         baseUrl = result.cn + cntBaseUrl;
  19798.       }
  19799.       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))) ) {
  19800.         if (result.cn) {
  19801.           baseUrl = result.cn + cntBaseUrlLSO;
  19802.         } else {
  19803.           baseUrl = baseUrlLSO;
  19804.         }
  19805.         mode = 3;
  19806.         if (result.hasOwnProperty("sur") && result.sur == "yes") {
  19807.           result.u2 = window.location.origin;
  19808.         } else {
  19809.           result.u2 = document.URL;
  19810.         }
  19811.       }
  19812.       for (i in result) {
  19813.         if (result.hasOwnProperty(i) && i!="cs" && i!="url") {
  19814.           payLoad = payLoad + encodeURIComponent(i).slice(0,8) + "=" + encodeURIComponent(result[i]).slice(0,2048) + "&";
  19815.         }
  19816.       }
  19817.       payLoad = payLoad.slice(0,4096);
  19818.       result.cs = hash(payLoad);
  19819.       result.url = proto + "//" + baseUrl + "?" + payLoad + "cs=" + result.cs;
  19820.       transmitData(result.url, mode);
  19821.       if (arrayContains(['play', 'resm', 'alve', 'mute', 'sfqt', 'ssqt', 'stqt', 'sapl', 'snsp'], event) && mode === 1 && result.hasOwnProperty('hb')) {
  19822.         startHeart();
  19823.       }
  19824.       return result;
  19825.     }
  19826.     return {};
  19827.   }
  19828.  
  19829.   function forwardToOldSZM() {
  19830.     if (result.oer === "yes" && !window.IVW && !document.IVW) {
  19831.       var SZMProtocol = (window.location.protocol.slice(0,4) === 'http') ? window.location.protocol : "https:";
  19832.       var SZMComment = (result.co) ? result.co + "_SENT_VIA_MIGRATION_TAG" : "SENT_VIA_MIGRATION_TAG";
  19833.       var SZMCode = (result.oc) ? result.oc : ((result.cp) ? ((result.cp == emptyCode) ? "" : result.cp) : "");
  19834.       var SZMContType = (result.pt !== null) ? result.pt : "CP";
  19835.       (new Image()).src = SZMProtocol + "//" + result.st + ".ivwbox.de/cgi-bin/ivw/" + SZMContType.toUpperCase() + "/" + SZMCode + ";" + SZMComment + "?r=" + escape(document.referrer) + "&d=" + (Math.random()*100000);
  19836.     }
  19837.   }
  19838.  
  19839.   function count(params, m) {
  19840.     init(params,m);
  19841.     return event(result.ev);
  19842.   }
  19843.  
  19844.   function init(params,m) {
  19845.     mode = m;
  19846.     buildResult(params);
  19847.     if (result.sv) {
  19848.       result.sv = (result.sv == "in" && mode == 1) ? "i2" : result.sv;
  19849.     }
  19850.     enableEvents();
  19851.     loadSurvey();
  19852.     inited = 1;
  19853.     forwardToOldSZM();
  19854.     return {};
  19855.   }
  19856.  
  19857.   function hybrid(params,m) {
  19858.     init(params,m);
  19859.     var ioam_smi = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_smi") : null;
  19860.     var ioam_site = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_site") : null;
  19861.     var ioam_bo = (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') ? localStorage.getItem("ioam_bo") : null;
  19862.     if ( ioam_smi !== null && ioam_site !== null && ioam_bo !== null ) {
  19863.       result.mi = ioam_smi;
  19864.       result.fs = result.st;
  19865.       result.st = ioam_site;
  19866.       result.bo = ioam_bo;
  19867.       if (result.fs == result.st) {
  19868.         result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
  19869.       } else {
  19870.         result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
  19871.       }
  19872.       return event(result.ev);
  19873.     } else if ( ioam_smi !== null && ioam_bo !== null ) {
  19874.       return {};
  19875.     } else {
  19876.       if ( window.location.protocol.slice(0,4) !== 'http' || /IOAM\/\d+\.\d+/.test(window.navigator.userAgent) ) {
  19877.         return {};
  19878.       } else {
  19879.         return event(result.ev);
  19880.       }
  19881.     }
  19882.   }
  19883.  
  19884.   function setMultiIdentifier(midentifier) {
  19885.     if ( localStorage.getItem("ioam_smi") === null || localStorage.getItem("ioam_site") === null || localStorage.getItem("ioam_bo") === null || localStorage.getItem("ioam_smi") !== midentifier ) {
  19886.       result.fs = result.st;
  19887.       var JsonMIndetifier = null;
  19888.       var NewSite = null;
  19889.       if ( typeof midentifier === 'string' && typeof JSON === 'object' && typeof JSON.parse === 'function' ) {
  19890.         try {
  19891.           JsonMIndetifier = JSON.parse(midentifier);
  19892.           if (JsonMIndetifier.hasOwnProperty( 'library' )) {
  19893.             if (JsonMIndetifier.library.hasOwnProperty( 'offerIdentifier' )) {
  19894.               if ( JsonMIndetifier.library.offerIdentifier ) {
  19895.                 NewSite = JsonMIndetifier.library.offerIdentifier;
  19896.               } else {
  19897.                 result.er = "JSON(E10): offerIdentifier not valid";
  19898.               }
  19899.             } else {
  19900.               result.er = "JSON(E10): no key offerIdentifier";
  19901.             }
  19902.           } else {
  19903.             result.er = "JSON(E10): no key library";
  19904.           }
  19905.         } catch(err) {
  19906.           result.er = "JSON(E10): "+err;
  19907.         }
  19908.       }
  19909.       if ( NewSite !== null ) {
  19910.         localStorage.setItem("ioam_site", NewSite);
  19911.       }
  19912.       result.st = NewSite;
  19913.       result.mi = midentifier;
  19914.       result.bo = (new Date()).getTime();
  19915.       localStorage.setItem("ioam_smi", result.mi);
  19916.       localStorage.setItem("ioam_bo", result.bo);
  19917.       if (result.fs == result.st) {
  19918.         result.cp = (result.cp.slice(0,10) !== "___hyb2___") ? "___hyb2___"+result.fs+"___"+result.cp : result.cp;
  19919.       } else {
  19920.         result.cp = (result.cp.slice(0,9) !== "___hyb___") ? "___hyb___"+result.fs+"___"+result.cp : result.cp;
  19921.       }
  19922.       return event(result.ev);
  19923.     }
  19924.     return {};
  19925.   }
  19926.  
  19927.   if (window.postMessage || window.JSON && {}.toString.call(window.JSON.parse) !== '[object Function]' && {}.toString.call(window.JSON.stringify) !== '[object Function]') {
  19928.     var listener = function(msg) {
  19929.       try {
  19930.         var msgdata = JSON.parse(msg.data);
  19931.       } catch(e) {
  19932.         msgdata = { type:false };
  19933.       }
  19934.       if ({}.toString.call(msgdata) === '[object Object]' && msgdata.type == "iam_data") {
  19935.         var respObj = {
  19936.                        seq : msgdata.seq,
  19937.                        iam_data : {
  19938.                                    st: result.st,
  19939.                                    cp: result.cp
  19940.                                   }
  19941.                       };
  19942.         msg.source.postMessage(JSON.stringify(respObj),msg.origin);
  19943.       }
  19944.     };
  19945.     if (window.addEventListener) {
  19946.       window.addEventListener("message", listener);
  19947.     } else {
  19948.       window.attachEvent("onmessage", listener);
  19949.     }
  19950.   }
  19951.  
  19952.   function optin() {
  19953.     var oiurl = ( window.location.protocol.slice(0,4) === 'http' ) ? window.location.protocol : "https:" + "//" + optinUrl;
  19954.     var win = window.open(oiurl, '_blank');
  19955.     win.focus();
  19956.   }
  19957.  
  19958.   function startHeart() {
  19959.     // IE 9 Compatible
  19960.     function heartbeat() {
  19961.       return event("alve");
  19962.     }
  19963.     switch (result.hb) {
  19964.         case "adshort":
  19965.           frequency = hbiAdShort;
  19966.           break;
  19967.         case "admedium":
  19968.           frequency = hbiAdMedium;
  19969.           break;
  19970.        case "adlong":
  19971.           frequency = hbiAdLong;
  19972.           break;
  19973.         case "short":
  19974.           frequency = hbiShort;
  19975.           break;
  19976.         case "medium":
  19977.           frequency = hbiMedium;
  19978.           break;
  19979.         case "long":
  19980.           frequency = hbiLong;
  19981.           break;
  19982.         case "extralong":
  19983.           frequency = hbiExtraLong;
  19984.           break;
  19985.         default:
  19986.           frequency = 0;
  19987.     }
  19988.     if (frequency != 0) {
  19989.       try {
  19990.         heart = setInterval(heartbeat, frequency);
  19991.       } catch(e) {
  19992.         // pass
  19993.       }
  19994.     }
  19995.   }
  19996.  
  19997.   function stopHeart() {
  19998.     try {
  19999.       clearInterval(heart);
  20000.     } catch(e) {
  20001.       // pass
  20002.     }
  20003.   }
  20004.  
  20005.   function stringtohex(str) {
  20006.     var res = [];
  20007.     for (var n = 0, l = str.length; n < l; n ++) {
  20008.       var hex = Number(str.charCodeAt(n)).toString(16);
  20009.       res.push(hex);
  20010.     }
  20011.     return res.join('');
  20012.   }
  20013.  
  20014.   function getUniqueID() {
  20015.     var max = 999999999999;
  20016.     var min = 100000000000;
  20017.     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);
  20018.   }
  20019.  
  20020.   function expireDays() {
  20021.     var max = 365;
  20022.     var min = 300;
  20023.     return Math.floor(Math.random() * (max - min + 1)) + min;
  20024.   }
  20025.  
  20026.   function getFirstPartyCookie() {
  20027.     var cookie = document.cookie.split(";");
  20028.     for (var i = 0; i < cookie.length; i++) {
  20029.       if (cookie[i].match(cookieName + "=.*")) {
  20030.         var ourcookie = cookie[i].split("=")[1];
  20031.         if (hash(ourcookie.split("!")[0]) == ourcookie.split("!")[1]) {
  20032.           if (!result.hasOwnProperty("i3") || !result.i3) {
  20033.             updateFirstPartyCookie(ourcookie);
  20034.           }
  20035.           return {
  20036.             cookie: ourcookie,
  20037.             length: cookie.length
  20038.           };
  20039.         } else {
  20040.           // checksum failed, cookie not trusted, delete cookie
  20041.           result.er = "N19";
  20042.           try {
  20043.             setFirstPartyCookie(2000);
  20044.           } catch(e) {
  20045.             result.er = "N20";
  20046.           }
  20047.         }
  20048.       }
  20049.     }
  20050.     return {cookie: "nocookie", length: cookie.length};
  20051.   }
  20052.  
  20053.   function checkFirstPartyCookie() {
  20054.     var cookie = getFirstPartyCookie();
  20055.     if (cookie.cookie != "nocookie") {
  20056.       return true;
  20057.     } else {
  20058.       return false;
  20059.     }
  20060.   }
  20061.  
  20062.   function getFpcd(cd) {
  20063.     var ctld ='acadaeafagaialamaoaqarasatauawaxazbabbbdbebfbgbhbibjbmbnbobrbsbtbwbybzcacccdcfcgchcickclcmcncocrcucvcwcxcyczdjdkdmdodzeceeegereseteufifjfkfmfofrgagdgegfggghgiglgmgngpgqgrgsgtgugwgyhkhmhnhrhthuidieiliminioiqirisitjejmjojpkekgkhkikmknkpkrkwkykzlalblclilklrlsltlulvlymamcmdmemgmhmkmlmmmnmompmqmrmsmtmumvmwmxmymznancnenfngninlnonpnrnunzompapepfpgphpkplpmpnprpsptpwpyqarerorsrurwsasbscsdsesgshsiskslsmsnsosrssstsvsxsysztctdtftgthtjtktltmtntotrtttvtwtzuaugukusuyuzvavcvevgvivnvuwfwsyeytzazmzw'.match(/.{1,2}(?=(.{2})+(?!.))|.{1,2}$/g),
  20064.         blkPrefixes = ['www', 'm', 'mobile'],
  20065.         urlParts = cd.split('.'),
  20066.         fpcd,
  20067.         ctldParts = [],
  20068.         hostParts = [],
  20069.         ctldPart = '',
  20070.         hostPart = '',
  20071.         i = 0,
  20072.         iLen = 0;
  20073.     if (!cd) return '';
  20074.     if (arrayContains(ctld, urlParts[urlParts.length -1])) {
  20075.       for (i = urlParts.length -1; i >= 0; i -= 1) {
  20076.         if ( i >= urlParts.length - 3 && urlParts[i].length <= 4) {
  20077.           ctldParts.push(urlParts[i]);
  20078.         } else {
  20079.           hostParts.push(urlParts[i]);
  20080.           break;
  20081.         }
  20082.       }
  20083.       ctldParts = ctldParts.reverse();
  20084.       for (i = 0, iLen = ctldParts.length;i < iLen; i += 1) {
  20085.         if (!arrayContains(blkPrefixes, ctldParts[i])) {
  20086.           ctldPart += i < iLen ? '.' + ctldParts[i] :  ctldParts[i];
  20087.         }
  20088.       }
  20089.       hostParts = hostParts.reverse();
  20090.       hostPart = hostParts[hostParts.length - 1] || '';
  20091.       if (arrayContains(blkPrefixes, hostPart)) {
  20092.         hostPart = '';
  20093.       }
  20094.     } else {
  20095.       hostPart = urlParts
  20096.         .slice(urlParts.length - 2, urlParts.length)
  20097.         .join('.') || '';
  20098.     }
  20099.     fpcd = hostPart + ctldPart;
  20100.     if (fpcd && fpcd.length > 4 && fpcd.split('.').length > 1) {
  20101.       // RFC 2109
  20102.       return 'domain=' + (fpcd[0] === '.' ? fpcd : (fpcd ? '.' + fpcd : '')) + ';';
  20103.     }
  20104.     return '';
  20105.   }
  20106.  
  20107.   function updateFirstPartyCookie(cookievalue) {
  20108.     var domain = getFpcd(location.hostname);
  20109.     var expireValue = cookievalue.split(":")[1];
  20110.     var events = parseInt(cookievalue.split(":")[4]) + 1;
  20111.     var expireDate = new Date(new Date().setTime(expireValue));
  20112.     var now = new Date();
  20113.     var cookval = cookievalue.split(":").slice(0,4).join(":") + ":" + events + ":" + now.getTime().toString();
  20114.     cookval = cookval + "!" + hash(cookval);
  20115.     document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
  20116.   }
  20117.  
  20118.   function setFirstPartyCookie(expire) {
  20119.     if (!expire) {
  20120.       expire = expireDays()*24*60*60*1000;
  20121.     }
  20122.     var domain = getFpcd(location.hostname);
  20123.     var expireDate = new Date(new Date().setTime(new Date().getTime()+expire));
  20124.     var setDate = new Date();
  20125.     var identifier;
  20126.     if (result.hasOwnProperty("i2")) {
  20127.       identifier = result.i2;
  20128.     } else {
  20129.       identifier = getUniqueID();
  20130.     }
  20131.     var cookval = identifier + ":" + expireDate.getTime().toString() + ":" + setDate.getTime().toString() + ":" + domain.replace("domain=", "").replace(";", "") + ":1:" +  setDate.getTime().toString();
  20132.     cookval = cookval + "!" + hash(cookval);
  20133.     document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";" + domain + ";path=/;";
  20134.     if (!checkFirstPartyCookie()) {
  20135.       // cookie not found, try it without domain
  20136.       document.cookie = cookieName + "=" + cookval + ";expires=" + expireDate.toUTCString() + ";path=/;";
  20137.       result.er = "N25";
  20138.       if (!checkFirstPartyCookie()) {
  20139.         result.er = "N26";
  20140.         return "nocookie";
  20141.       }
  20142.     }
  20143.     return cookval;
  20144.   }
  20145.  
  20146.   function createCORSRequest(method, url) {
  20147.     var xdhreq = new XMLHttpRequest();
  20148.     if ("withCredentials" in xdhreq) {
  20149.       xdhreq.open(method, url, true);
  20150.       xdhreq.withCredentials = true;
  20151.     } else if (typeof XDomainRequest != "undefined") {
  20152.       xdhreq = new XDomainRequest();
  20153.       xdhreq.open(method, url);
  20154.     } else {
  20155.       xdhreq = null;
  20156.     }
  20157.     return xdhreq;
  20158.   }
  20159.  
  20160.   function getPlus() {
  20161.     if (typeof localStorage === 'object' && typeof localStorage.getItem === 'function') {
  20162.       if (localStorage.getItem("ioamplusdata") !== null && localStorage.getItem("ioamplusttl") !== null) {
  20163.         var currentDate = new Date();
  20164.         var now = currentDate.getTime();
  20165.         currentDate.setTime(localStorage.getItem("ioamplusttl"));
  20166.         if (now <= currentDate.getTime()) {
  20167.           return true;
  20168.         }
  20169.       }
  20170.       var checkForSocio = 'https:' + '//' + ioplusurl + '/soziodata2.php?sc=' + socioToken + '&st=' + result.st + '&id=' + result.id;
  20171.       var XHR = createCORSRequest('GET', checkForSocio);
  20172.       if (XHR) {
  20173.         XHR.onload = function() {
  20174.           var response = XHR.responseText;
  20175.           var blockedUntilDate = new Date();
  20176.           try {
  20177.             if ((response.split(":")[1].split(",")[0]) == "0") {
  20178.               blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottlmin);
  20179.               localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
  20180.               if (localStorage.getItem("ioamplusdata") == null) {
  20181.                 localStorage.setItem("ioamplusdata", response);
  20182.               }
  20183.             } else {
  20184.               blockedUntilDate.setTime(blockedUntilDate.getTime() + lsottl);
  20185.               localStorage.setItem("ioamplusdata", response);
  20186.               localStorage.setItem("ioamplusttl", blockedUntilDate.getTime().toString());
  20187.             }
  20188.           } catch(e) {
  20189.             // pass
  20190.           }
  20191.         };
  20192.         XHR.send();
  20193.         return true;
  20194.       }
  20195.     }
  20196.     return false;
  20197.   }
  20198.  
  20199.   return {
  20200.     count: count,
  20201.     c: count,
  20202.     i: init,
  20203.     init: init,
  20204.     e: event,
  20205.     event: event,
  20206.     h: hybrid,
  20207.     hybrid: hybrid,
  20208.     setMultiIdentifier: setMultiIdentifier,
  20209.     smi: setMultiIdentifier,
  20210.     oi: optin,
  20211.     optin: optin,
  20212.     getInvitation: getInvitation,
  20213.     gi: getInvitation,
  20214.     getPlus: getPlus,
  20215.     gp: getPlus
  20216.   };
  20217.  
  20218. })();
  20219.  
  20220.  
  20221.     var iam_data = {
  20222.         "st": "dastelef",
  20223.         "cp": "TBBUND_Start",
  20224.         "sv": "in"
  20225.     };
  20226.     iom.c(iam_data);
  20227.  
  20228. /* 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);})();
  20229.  
  20230.     var Confirmation = (function ($) {
  20231.         var my = {'facebookCallback': null};
  20232.  
  20233.         my.registerFacebookCallback = function (cb) {
  20234.             my.facebookCallback = cb;
  20235.         };
  20236.  
  20237.         my.isConfirmed = function (by, data) {
  20238.             var email, accountname, token;
  20239.  
  20240.             if (by === 'facebook') {
  20241.                 email = data.profile.email;
  20242.                 accountname = data.profile.name;
  20243.                 token = data.auth.authResponse.accessToken;
  20244.                 $('.facebook-authinfo').val(JSON.stringify(data.auth.authResponse));
  20245.  
  20246.                 if (typeof my.facebookCallback === 'function') {
  20247.                     my.facebookCallback(data.auth, data.profile);
  20248.                 }
  20249.             } else {
  20250.                 if (by === 'twitter') {
  20251.                     email = 'not_send';
  20252.                     accountname = 'not_send';
  20253.                     token = 'private';
  20254.                 } else {
  20255.                     return;
  20256.                 }
  20257.             }
  20258.  
  20259.             $('.confirm-option').hide();
  20260.             $('.confirm-info').show().children(':nth-child(2)').html('Bestätigung erfolgt über ' + by.charAt(0).toUpperCase() + by.slice(1));
  20261.             $('.privemail').val(email);
  20262.             $('.accountname').val(accountname);
  20263.             $('.accesstoken').val(token);
  20264.             $('.confirmMethod').val(by);
  20265.             $('.captchaAnswer').val('1234');
  20266.         };
  20267.  
  20268.         my.listener = function (event) {
  20269.             if (event.data === 'dialo_twitter_confirm_ok') {
  20270.                 my.isConfirmed('twitter');
  20271.             }
  20272.         };
  20273.  
  20274.         return my;
  20275.     }(jQuery));
  20276.  
  20277.     if (window.addEventListener) {
  20278.         addEventListener("message", function (e) {
  20279.             if (Confirmation) {
  20280.                 Confirmation.listener(e);
  20281.             }
  20282.             if (Login) {
  20283.                 Login.listener(e);
  20284.             }
  20285.         }, false)
  20286.     } else {
  20287.         attachEvent("onmessage", function (e) {
  20288.             if (Confirmation) {
  20289.                 Confirmation.listener(e);
  20290.             }
  20291.             if (Login) {
  20292.                 Login.listener(e);
  20293.             }
  20294.         })
  20295.     }
  20296.  
  20297.    
  20298.     jQuery(window).load(function () {
  20299.        
  20300.         $('.image-defer').each(function () {
  20301.             $(this).attr('src', $(this).data('src'));
  20302.         });
  20303.     })
  20304.  
  20305. /*!
  20306.  * Bootstrap v3.3.5 (http://getbootstrap.com)
  20307.  * Copyright 2011-2016 Twitter, Inc.
  20308.  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  20309.  */
  20310.  
  20311. /*!
  20312.  * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=1329f33fb164b183e04b121bd6602571)
  20313.  * Config saved to config.json and https://gist.github.com/1329f33fb164b183e04b121bd6602571
  20314.  */
  20315. 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]);
  20316. }}}},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);;/* ========================================================================
  20317.  * bootstrap-switch - v3.3.2
  20318.  * http://www.bootstrap-switch.org
  20319.  * ========================================================================
  20320.  * Copyright 2012-2013 Mattia Larentis
  20321.  *
  20322.  * ========================================================================
  20323.  * Licensed under the Apache License, Version 2.0 (the "License");
  20324.  * you may not use this file except in compliance with the License.
  20325.  * You may obtain a copy of the License at
  20326.  *
  20327.  *     http://www.apache.org/licenses/LICENSE-2.0
  20328.  *
  20329.  * Unless required by applicable law or agreed to in writing, software
  20330.  * distributed under the License is distributed on an "AS IS" BASIS,
  20331.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20332.  * See the License for the specific language governing permissions and
  20333.  * limitations under the License.
  20334.  * ========================================================================
  20335.  */
  20336.  
  20337. (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);;/* ========================================================================
  20338.  * Bootstrap: affix.js v3.3.5
  20339.  * http://getbootstrap.com/javascript/#affix
  20340.  * ========================================================================
  20341.  * Copyright 2011-2015 Twitter, Inc.
  20342.  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  20343.  * ======================================================================== */
  20344.  
  20345.  
  20346. +function ($) {
  20347.     'use strict';
  20348.  
  20349.     // AFFIX CLASS DEFINITION
  20350.     // ======================
  20351.  
  20352.     var Affix = function (element, options) {
  20353.         this.options = $.extend({}, Affix.DEFAULTS, options)
  20354.  
  20355.         this.$target = $(this.options.target)
  20356.             .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
  20357.             .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))
  20358.  
  20359.         this.$element     = $(element)
  20360.         this.affixed      = null
  20361.         this.unpin        = null
  20362.         this.pinnedOffset = null
  20363.  
  20364.         this.checkPosition()
  20365.     }
  20366.  
  20367.     Affix.VERSION  = '3.3.5'
  20368.  
  20369.     Affix.RESET    = 'affix affix-top affix-bottom'
  20370.  
  20371.     Affix.DEFAULTS = {
  20372.         offset: 0,
  20373.         target: window
  20374.     }
  20375.  
  20376.     Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
  20377.         var scrollTop    = this.$target.scrollTop()
  20378.         var position     = this.$element.offset()
  20379.         var targetHeight = this.$target.height()
  20380.  
  20381.         if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
  20382.  
  20383.         if (this.affixed == 'bottom') {
  20384.             if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
  20385.             return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
  20386.         }
  20387.  
  20388.         var initializing   = this.affixed == null
  20389.         var colliderTop    = initializing ? scrollTop : position.top
  20390.         var colliderHeight = initializing ? targetHeight : height
  20391.  
  20392.         if (offsetTop != null && scrollTop <= offsetTop) return 'top'
  20393.         if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
  20394.  
  20395.         return false
  20396.     }
  20397.  
  20398.     Affix.prototype.getPinnedOffset = function () {
  20399.         if (this.pinnedOffset) return this.pinnedOffset
  20400.         this.$element.removeClass(Affix.RESET).addClass('affix')
  20401.         var scrollTop = this.$target.scrollTop()
  20402.         var position  = this.$element.offset()
  20403.         return (this.pinnedOffset = position.top - scrollTop)
  20404.     }
  20405.  
  20406.     Affix.prototype.checkPositionWithEventLoop = function () {
  20407.         setTimeout($.proxy(this.checkPosition, this), 1)
  20408.     }
  20409.  
  20410.     Affix.prototype.checkPosition = function () {
  20411.         if (!this.$element.is(':visible')) return
  20412.  
  20413.         var height       = this.$element.height()
  20414.         var offset       = this.options.offset
  20415.         var offsetTop    = offset.top
  20416.         var offsetBottom = offset.bottom
  20417.         var scrollHeight = Math.max($(document).height(), $(document.body).height())
  20418.  
  20419.         if (typeof offset != 'object')         offsetBottom = offsetTop = offset
  20420.         if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
  20421.         if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
  20422.  
  20423.         var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
  20424.  
  20425.         if (this.affixed != affix) {
  20426.             if (this.unpin != null) this.$element.css('top', '')
  20427.  
  20428.             var affixType = 'affix' + (affix ? '-' + affix : '')
  20429.             var e         = $.Event(affixType + '.bs.affix')
  20430.  
  20431.             this.$element.trigger(e)
  20432.  
  20433.             if (e.isDefaultPrevented()) return
  20434.  
  20435.             this.affixed = affix
  20436.             this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
  20437.  
  20438.             this.$element
  20439.                 .removeClass(Affix.RESET)
  20440.                 .addClass(affixType)
  20441.                 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
  20442.         }
  20443.  
  20444.         if (affix == 'bottom') {
  20445.             this.$element.offset({
  20446.                 top: scrollHeight - height - offsetBottom
  20447.             })
  20448.         }
  20449.     }
  20450.  
  20451.  
  20452.     // AFFIX PLUGIN DEFINITION
  20453.     // =======================
  20454.  
  20455.     function Plugin(option) {
  20456.         return this.each(function () {
  20457.             var $this   = $(this)
  20458.             var data    = $this.data('bs.affix')
  20459.             var options = typeof option == 'object' && option
  20460.  
  20461.             if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
  20462.             if (typeof option == 'string') data[option]()
  20463.         })
  20464.     }
  20465.  
  20466.     var old = $.fn.affix
  20467.  
  20468.     $.fn.affix             = Plugin
  20469.     $.fn.affix.Constructor = Affix
  20470.  
  20471.  
  20472.     // AFFIX NO CONFLICT
  20473.     // =================
  20474.  
  20475.     $.fn.affix.noConflict = function () {
  20476.         $.fn.affix = old
  20477.         return this
  20478.     }
  20479.  
  20480.  
  20481.     // AFFIX DATA-API
  20482.     // ==============
  20483.  
  20484.     $(window).on('load', function () {
  20485.         $('[data-spy="affix"]').each(function () {
  20486.             var $spy = $(this)
  20487.             var data = $spy.data()
  20488.  
  20489.             data.offset = data.offset || {}
  20490.  
  20491.             if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
  20492.             if (data.offsetTop    != null) data.offset.top    = data.offsetTop
  20493.  
  20494.             Plugin.call($spy, data)
  20495.         })
  20496.     })
  20497.  
  20498. }(jQuery);;/*************************
  20499.  * Croppie
  20500.  * Copyright 2015
  20501.  * Foliotek
  20502.  * Version: 1.0.3
  20503.  *************************/
  20504. (function (root, factory) {
  20505.     if (typeof define === 'function' && define.amd) {
  20506.         // AMD. Register as an anonymous module.
  20507.         define(['exports', 'b'], factory);
  20508.     } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
  20509.         // CommonJS
  20510.         factory(exports, require('b'));
  20511.     } else {
  20512.         // Browser globals
  20513.         factory((root.commonJsStrict = {}), root.b);
  20514.     }
  20515. }(this, function (exports, b) {
  20516.  
  20517.     if (typeof Promise !== 'function') {
  20518.         /*!
  20519.          * @overview es6-promise - a tiny implementation of Promises/A+.
  20520.          * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  20521.          * @license   Licensed under MIT license
  20522.          *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  20523.          * @version   3.0.2
  20524.          */
  20525.         (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);
  20526.     }
  20527.  
  20528.     var cssPrefixes = ['Webkit', 'Moz', 'ms'],
  20529.         emptyStyles = document.createElement('div').style,
  20530.         CSS_TRANS_ORG,
  20531.         CSS_TRANSFORM,
  20532.         CSS_USERSELECT;
  20533.  
  20534.     function vendorPrefix(prop) {
  20535.         if (prop in emptyStyles) {
  20536.             return prop;
  20537.         }
  20538.  
  20539.         var capProp = prop[0].toUpperCase() + prop.slice(1),
  20540.             i = cssPrefixes.length;
  20541.  
  20542.         while (i--) {
  20543.             prop = cssPrefixes[i] + capProp;
  20544.             if (prop in emptyStyles) {
  20545.                 return prop;
  20546.             }
  20547.         }
  20548.     }
  20549.  
  20550.     CSS_TRANSFORM = vendorPrefix('transform');
  20551.     CSS_TRANS_ORG = vendorPrefix('transformOrigin');
  20552.     CSS_USERSELECT = vendorPrefix('userSelect');
  20553.  
  20554.  
  20555.     function deepExtend(out) {
  20556.         out = out || {};
  20557.  
  20558.         for (var i = 1; i < arguments.length; i++) {
  20559.             var obj = arguments[i];
  20560.  
  20561.             if (!obj)
  20562.                 continue;
  20563.  
  20564.             for (var key in obj) {
  20565.                 if (obj.hasOwnProperty(key)) {
  20566.                     if (typeof obj[key] === 'object')
  20567.                         out[key] = deepExtend({}, obj[key]);
  20568.                     else
  20569.                         out[key] = obj[key];
  20570.                 }
  20571.             }
  20572.         }
  20573.         return out;
  20574.     }
  20575.  
  20576.     function debounce(func, wait, immediate) {
  20577.         var timeout;
  20578.         return function () {
  20579.             var context = this, args = arguments;
  20580.             var later = function () {
  20581.                 timeout = null;
  20582.                 if (!immediate) func.apply(context, args);
  20583.             };
  20584.             var callNow = immediate && !timeout;
  20585.             clearTimeout(timeout);
  20586.             timeout = setTimeout(later, wait);
  20587.             if (callNow) func.apply(context, args);
  20588.         };
  20589.     }
  20590.  
  20591.     function dispatchChange(element) {
  20592.         if ("createEvent" in document) {
  20593.             var evt = document.createEvent("HTMLEvents");
  20594.             evt.initEvent("change", false, true);
  20595.             element.dispatchEvent(evt);
  20596.         }
  20597.         else {
  20598.             element.fireEvent("onchange");
  20599.         }
  20600.     }
  20601.  
  20602.     //http://jsperf.com/vanilla-css
  20603.     function css(el, styles, val) {
  20604.         if (typeof (styles) === 'string') {
  20605.             var tmp = styles;
  20606.             styles = {};
  20607.             styles[tmp] = val;
  20608.         }
  20609.  
  20610.         for (var prop in styles) {
  20611.             el.style[prop] = styles[prop];
  20612.         }
  20613.     }
  20614.  
  20615.     /* Image Drawing Functions */
  20616.     function getHtmlImage(data) {
  20617.         var points = data.points,
  20618.             div = document.createElement('div'),
  20619.             img = document.createElement('img'),
  20620.             width = points[2] - points[0],
  20621.             height = points[3] - points[1];
  20622.         // scale = data.zoom;
  20623.  
  20624.         div.classList.add('croppie-result');
  20625.         div.appendChild(img);
  20626.         css(img, {
  20627.             left: (-1 * points[0]) + 'px',
  20628.             top: (-1 * points[1]) + 'px'
  20629.             // transform: 'scale(' + scale + ')'
  20630.         })
  20631.         img.src = data.url;
  20632.         css(div, {
  20633.             width: width + 'px',
  20634.             height: height + 'px'
  20635.         });
  20636.  
  20637.         return div;
  20638.     }
  20639.  
  20640.     function getCanvasImage(img, data) {
  20641.         var points = data.points,
  20642.             left = points[0],
  20643.             top = points[1],
  20644.             width = (points[2] - points[0]),
  20645.             height = (points[3] - points[1]),
  20646.             circle = data.circle,
  20647.             canvas = document.createElement('canvas'),
  20648.             ctx = canvas.getContext('2d'),
  20649.             outWidth = width,
  20650.             outHeight = height;
  20651.  
  20652.         if (data.outputWidth && data.outputHeight) {
  20653.             outWidth = data.outputWidth;
  20654.             outHeight = data.outputHeight;
  20655.         }
  20656.  
  20657.         canvas.width = outWidth;
  20658.         canvas.height = outHeight;
  20659.  
  20660.         if (circle) {
  20661.             ctx.save();
  20662.             ctx.beginPath();
  20663.             ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true);
  20664.             ctx.closePath();
  20665.             ctx.clip();
  20666.         }
  20667.  
  20668.         ctx.drawImage(img, left, top, width, height, 0, 0, outWidth, outHeight);
  20669.  
  20670.         return canvas.toDataURL();
  20671.     }
  20672.  
  20673.     /* Utilities */
  20674.     function loadImage(src, imageEl) {
  20675.         var img = imageEl || new Image(),
  20676.             prom;
  20677.  
  20678.         prom = new Promise(function (resolve, reject) {
  20679.             if (src.substring(0,4).toLowerCase() === 'http') {
  20680.                 img.setAttribute('crossOrigin', 'anonymous');
  20681.             }
  20682.             img.onload = function () {
  20683.                 setTimeout(function () {
  20684.                     resolve(img);
  20685.                 }, 1);
  20686.             };
  20687.         });
  20688.  
  20689.         img.src = src;
  20690.         return prom;
  20691.     }
  20692.  
  20693.     /* CSS Transform Prototype */
  20694.     var _TRANSLATE = 'translate3d',
  20695.         _TRANSLATE_SUFFIX = ', 0px';
  20696.     var Transform = function (x, y, scale) {
  20697.         this.x = parseFloat(x);
  20698.         this.y = parseFloat(y);
  20699.         this.scale = parseFloat(scale);
  20700.     };
  20701.  
  20702.     Transform.parse = function (v) {
  20703.         if (v.style) {
  20704.             return Transform.parse(v.style[CSS_TRANSFORM]);
  20705.         }
  20706.         else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) {
  20707.             return Transform.fromMatrix(v);
  20708.         }
  20709.         else {
  20710.             return Transform.fromString(v);
  20711.         }
  20712.     };
  20713.  
  20714.     Transform.fromMatrix = function (v) {
  20715.         var vals = v.substring(7).split(',');
  20716.         if (!vals.length || v === 'none') {
  20717.             vals = [1, 0, 0, 1, 0, 0];
  20718.         }
  20719.  
  20720.         return new Transform(parseInt(vals[4], 10), parseInt(vals[5], 10), parseFloat(vals[0]));
  20721.     };
  20722.  
  20723.     Transform.fromString = function (v) {
  20724.         var values = v.split(') '),
  20725.             translate = values[0].substring(_TRANSLATE.length + 1).split(','),
  20726.             scale = values.length > 1 ? values[1].substring(6) : 1,
  20727.             x = translate.length > 1 ? translate[0] : 0,
  20728.             y = translate.length > 1 ? translate[1] : 0;
  20729.  
  20730.         return new Transform(x, y, scale);
  20731.     }
  20732.  
  20733.     Transform.prototype.toString = function () {
  20734.         return _TRANSLATE + '(' + this.x + 'px, ' + this.y + 'px' + _TRANSLATE_SUFFIX + ') scale(' + this.scale + ')';
  20735.     };
  20736.  
  20737.     var TransformOrigin = function (el) {
  20738.         if (!el || !el.style[CSS_TRANS_ORG]) {
  20739.             this.x = 0;
  20740.             this.y = 0;
  20741.             return;
  20742.         }
  20743.         var css = el.style[CSS_TRANS_ORG].split(' ');
  20744.         this.x = parseFloat(css[0]);
  20745.         this.y = parseFloat(css[1]);
  20746.     };
  20747.  
  20748.     TransformOrigin.prototype.toString = function () {
  20749.         return this.x + 'px ' + this.y + 'px';
  20750.     };
  20751.  
  20752.     /* Private Methods */
  20753.     function _create() {
  20754.         var self = this,
  20755.             contClass = ['croppie-container'],
  20756.             customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null,
  20757.             boundary, img, viewport, overlay;
  20758.  
  20759.         // Properties on class
  20760.         self.data = {};
  20761.         self.elements = {};
  20762.  
  20763.         // Generating Markup
  20764.         boundary = self.elements.boundary = document.createElement('div');
  20765.         viewport = self.elements.viewport = document.createElement('div');
  20766.         img = self.elements.img = document.createElement('img');
  20767.         overlay = self.elements.overlay = document.createElement('div');
  20768.  
  20769.         boundary.classList.add('cr-boundary');
  20770.         css(boundary, {
  20771.             width: self.options.boundary.width + 'px',
  20772.             height: self.options.boundary.height + 'px'
  20773.         });
  20774.  
  20775.         viewport.classList.add('cr-viewport');
  20776.         if (customViewportClass) {
  20777.             viewport.classList.add(customViewportClass);
  20778.         }
  20779.         css(viewport, {
  20780.             width: self.options.viewport.width + 'px',
  20781.             height: self.options.viewport.height + 'px'
  20782.         });
  20783.  
  20784.         img.classList.add('cr-image');
  20785.         overlay.classList.add('cr-overlay');
  20786.  
  20787.         self.element.appendChild(boundary);
  20788.         boundary.appendChild(img);
  20789.         boundary.appendChild(viewport);
  20790.         boundary.appendChild(overlay);
  20791.  
  20792.         self.element.classList.add(contClass);
  20793.         if (self.options.customClass) {
  20794.             self.element.classList.add(self.options.customClass);
  20795.         }
  20796.  
  20797.         // Initialize drag & zoom
  20798.         _initDraggable.call(this);
  20799.  
  20800.         if (self.options.showZoom) {
  20801.             _initializeZoom.call(self);
  20802.         }
  20803.     }
  20804.  
  20805.     function _setZoomerVal(v) {
  20806.         if (this.options.showZoom) {
  20807.             this.elements.zoomer.value = fix(v);
  20808.         }
  20809.     }
  20810.  
  20811.     function _initializeZoom() {
  20812.         var self = this,
  20813.             wrap = self.elements.zoomerWrap = document.createElement('div'),
  20814.             zoomer = self.elements.zoomer = document.createElement('input'),
  20815.             origin,
  20816.             viewportRect,
  20817.             transform;
  20818.  
  20819.         wrap.classList.add('cr-slider-wrap');
  20820.         zoomer.type = 'range';
  20821.         zoomer.classList.add('cr-slider');
  20822.         zoomer.step = '0.01';
  20823.         zoomer.value = 1;
  20824.  
  20825.         self.element.appendChild(wrap);
  20826.         wrap.appendChild(zoomer);
  20827.  
  20828.         self._currentZoom = 1;
  20829.         function start() {
  20830.             _updateCenterPoint.call(self);
  20831.             origin = new TransformOrigin(self.elements.img);
  20832.             viewportRect = self.elements.viewport.getBoundingClientRect();
  20833.             transform = Transform.parse(self.elements.img);
  20834.         }
  20835.  
  20836.         function change() {
  20837.             _onZoom.call(self, {
  20838.                 value: parseFloat(zoomer.value),
  20839.                 origin: origin || new TransformOrigin(self.elements.img),
  20840.                 viewportRect: viewportRect || self.elements.viewport.getBoundingClientRect(),
  20841.                 transform: transform || Transform.parse(self.elements.img)
  20842.             });
  20843.         }
  20844.  
  20845.         function scroll(ev) {
  20846.             var delta, targetZoom;
  20847.        
  20848.             if (ev.wheelDelta) {
  20849.                 delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2
  20850.             } else if (ev.deltaY) {
  20851.                 delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2
  20852.             } else if (ev.detail) {
  20853.                 delta = ev.detail / 60; //delta min: -3 max: 3 // max x 10 x 2
  20854.             } else {
  20855.                 delta = 0;
  20856.             }
  20857.        
  20858.             targetZoom = self._currentZoom + delta;
  20859.        
  20860.             ev.preventDefault();
  20861.             start();
  20862.             _setZoomerVal.call(self, targetZoom);
  20863.             change();
  20864.         }
  20865.  
  20866.         self.elements.zoomer.addEventListener('mousedown', start);
  20867.         self.elements.zoomer.addEventListener('touchstart', start);
  20868.  
  20869.         self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress
  20870.         self.elements.zoomer.addEventListener('change', change);
  20871.  
  20872.         if (self.options.mouseWheelZoom) {
  20873.             self.elements.boundary.addEventListener('mousewheel', scroll);
  20874.             self.elements.boundary.addEventListener('DOMMouseScroll', scroll);
  20875.         }
  20876.     }
  20877.  
  20878.     function _onZoom(ui) {
  20879.         var self = this,
  20880.             transform = ui.transform,
  20881.             vpRect = ui.viewportRect,
  20882.             origin = ui.origin;
  20883.  
  20884.         self._currentZoom = ui.value;
  20885.         transform.scale = self._currentZoom;
  20886.  
  20887.         var boundaries = _getVirtualBoundaries.call(self, vpRect),
  20888.             transBoundaries = boundaries.translate,
  20889.             oBoundaries = boundaries.origin;
  20890.  
  20891.         if (transform.x >= transBoundaries.maxX) {
  20892.             origin.x = oBoundaries.minX;
  20893.             transform.x = transBoundaries.maxX;
  20894.         }
  20895.  
  20896.         if (transform.x <= transBoundaries.minX) {
  20897.             origin.x = oBoundaries.maxX;
  20898.             transform.x = transBoundaries.minX;
  20899.         }
  20900.  
  20901.         if (transform.y >= transBoundaries.maxY) {
  20902.             origin.y = oBoundaries.minY;
  20903.             transform.y = transBoundaries.maxY;
  20904.         }
  20905.  
  20906.         if (transform.y <= transBoundaries.minY) {
  20907.             origin.y = oBoundaries.maxY;
  20908.             transform.y = transBoundaries.minY;
  20909.         }
  20910.  
  20911.         var transCss = {};
  20912.         transCss[CSS_TRANSFORM] = transform.toString();
  20913.         transCss[CSS_TRANS_ORG] = origin.toString();
  20914.         css(self.elements.img, transCss);
  20915.  
  20916.         _debouncedOverlay.call(self);
  20917.         _triggerUpdate.call(self);
  20918.     }
  20919.  
  20920.     function _getVirtualBoundaries(viewport) {
  20921.         var self = this,
  20922.             scale = self._currentZoom,
  20923.             vpWidth = viewport.width,
  20924.             vpHeight = viewport.height,
  20925.             centerFromBoundaryX = self.options.boundary.width / 2,
  20926.             centerFromBoundaryY = self.options.boundary.height / 2,
  20927.             originalImgWidth = self._originalImageWidth,
  20928.             originalImgHeight = self._originalImageHeight,
  20929.             curImgWidth = originalImgWidth * scale,
  20930.             curImgHeight = originalImgHeight * scale,
  20931.             halfWidth = vpWidth / 2,
  20932.             halfHeight = vpHeight / 2;
  20933.  
  20934.  
  20935.         var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1;
  20936.         var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale)));
  20937.  
  20938.         var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1;
  20939.         var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale)));
  20940.  
  20941.         var originMinX = (1 / scale) * halfWidth;
  20942.         var originMaxX = (curImgWidth * (1 / scale)) - originMinX;
  20943.  
  20944.         var originMinY = (1 / scale) * halfHeight;
  20945.         var originMaxY = (curImgHeight * (1 / scale)) - originMinY;
  20946.  
  20947.         return {
  20948.             translate: {
  20949.                 maxX: maxX,
  20950.                 minX: minX,
  20951.                 maxY: maxY,
  20952.                 minY: minY
  20953.             },
  20954.             origin: {
  20955.                 maxX: originMaxX,
  20956.                 minX: originMinX,
  20957.                 maxY: originMaxY,
  20958.                 minY: originMinY
  20959.             }
  20960.         };
  20961.     }
  20962.  
  20963.     function _updateCenterPoint() {
  20964.         var self = this,
  20965.             scale = self._currentZoom,
  20966.             data = self.elements.img.getBoundingClientRect(),
  20967.             vpData = self.elements.viewport.getBoundingClientRect(),
  20968.             transform = Transform.parse(self.elements.img.style[CSS_TRANSFORM]),
  20969.             pc = new TransformOrigin(self.elements.img),
  20970.             top = (vpData.top - data.top) + (vpData.height / 2),
  20971.             left = (vpData.left - data.left) + (vpData.width / 2),
  20972.             center = {},
  20973.             adj = {};
  20974.  
  20975.         center.y = top / scale;
  20976.         center.x = left / scale;
  20977.  
  20978.         adj.y = (center.y - pc.y) * (1 - scale);
  20979.         adj.x = (center.x - pc.x) * (1 - scale);
  20980.  
  20981.         transform.x -= adj.x;
  20982.         transform.y -= adj.y;
  20983.  
  20984.         var newCss = {};
  20985.         newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px';
  20986.         newCss[CSS_TRANSFORM] = transform.toString();
  20987.         css(self.elements.img, newCss);
  20988.     }
  20989.  
  20990.     function _initDraggable() {
  20991.         var self = this,
  20992.             isDragging = false,
  20993.             originalX,
  20994.             originalY,
  20995.             originalDistance,
  20996.             vpRect;
  20997.  
  20998.         function mouseDown(ev) {
  20999.             ev.preventDefault();
  21000.             if (isDragging) return;
  21001.             isDragging = true;
  21002.             originalX = ev.pageX;
  21003.             originalY = ev.pageY;
  21004.             transform = Transform.parse(self.elements.img);
  21005.             window.addEventListener('mousemove', mouseMove);
  21006.             window.addEventListener('touchmove', mouseMove);
  21007.             window.addEventListener('mouseup', mouseUp);
  21008.             window.addEventListener('touchend', mouseUp);
  21009.             document.body.style[CSS_USERSELECT] = 'none';
  21010.             vpRect = self.elements.viewport.getBoundingClientRect();
  21011.         }
  21012.  
  21013.         function mouseMove(ev) {
  21014.             ev.preventDefault();
  21015.             var pageX = ev.pageX || ev.touches[0].pageX,
  21016.                 pageY = ev.pageY || ev.touches[0].pageY,
  21017.                 deltaX = pageX - originalX,
  21018.                 deltaY = pageY - originalY,
  21019.                 imgRect = self.elements.img.getBoundingClientRect(),
  21020.                 top = transform.y + deltaY,
  21021.                 left = transform.x + deltaX,
  21022.                 newCss = {};
  21023.  
  21024.             if (ev.type == 'touchmove') {
  21025.                 if (ev.touches.length > 1) {
  21026.                     var touch1 = ev.touches[0];
  21027.                     var touch2 = ev.touches[1];
  21028.                     var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY));
  21029.  
  21030.                     if (!originalDistance) {
  21031.                         originalDistance = dist / self._currentZoom;
  21032.                     }
  21033.  
  21034.                     var scale = dist / originalDistance;
  21035.  
  21036.                     _setZoomerVal.call(self, scale);
  21037.                     dispatchChange(self.elements.zoomer);
  21038.                     return;
  21039.                 }
  21040.             }
  21041.  
  21042.             if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) {
  21043.                 transform.y = top;
  21044.             }
  21045.  
  21046.             if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) {
  21047.                 transform.x = left;
  21048.             }
  21049.  
  21050.             newCss[CSS_TRANSFORM] = transform.toString();
  21051.             css(self.elements.img, newCss);
  21052.             _updateOverlay.call(self);
  21053.             originalY = pageY;
  21054.             originalX = pageX;
  21055.         }
  21056.  
  21057.         function mouseUp() {
  21058.             isDragging = false;
  21059.             window.removeEventListener('mousemove', mouseMove);
  21060.             window.removeEventListener('touchmove', mouseMove);
  21061.             window.removeEventListener('mouseup', mouseUp);
  21062.             window.removeEventListener('touchend', mouseUp);
  21063.             document.body.style[CSS_USERSELECT] = '';
  21064.             _updateCenterPoint.call(self);
  21065.             _triggerUpdate.call(self);
  21066.             originalDistance = 0;
  21067.         }
  21068.  
  21069.         self.elements.overlay.addEventListener('mousedown', mouseDown);
  21070.         self.elements.overlay.addEventListener('touchstart', mouseDown);
  21071.     }
  21072.  
  21073.     function _updateOverlay() {
  21074.         var self = this,
  21075.             boundRect = self.elements.boundary.getBoundingClientRect(),
  21076.             imgData = self.elements.img.getBoundingClientRect();
  21077.  
  21078.         css(self.elements.overlay, {
  21079.             width: imgData.width + 'px',
  21080.             height: imgData.height + 'px',
  21081.             top: (imgData.top - boundRect.top) + 'px',
  21082.             left: (imgData.left - boundRect.left) + 'px'
  21083.         });
  21084.     }
  21085.     var _debouncedOverlay = debounce(_updateOverlay, 500);
  21086.  
  21087.     function _triggerUpdate() {
  21088.         var self = this;
  21089.         if (_isVisible.call(self)) {
  21090.             self.options.update.call(self, self.get());
  21091.         }
  21092.     }
  21093.  
  21094.     function _isVisible() {
  21095.         return this.elements.img.offsetHeight > 0 && this.elements.img.offsetWidth > 0;
  21096.     }
  21097.  
  21098.     function _updatePropertiesFromImage() {
  21099.         var self = this,
  21100.             minZoom = 0,
  21101.             maxZoom = 1.5,
  21102.             initialZoom = 1,
  21103.             cssReset = {},
  21104.             img = self.elements.img,
  21105.             zoomer = self.elements.zoomer,
  21106.             transformReset = new Transform(0, 0, initialZoom),
  21107.             originReset = new TransformOrigin(),
  21108.             isVisible = _isVisible.call(self),
  21109.             imgData,
  21110.             vpData,
  21111.             boundaryData,
  21112.             minW,
  21113.             minH;
  21114.  
  21115.         if (!isVisible || self.data.bound) {
  21116.             // if the croppie isn't visible or it doesn't need binding
  21117.             return;
  21118.         }
  21119.  
  21120.         self.data.bound = true;
  21121.         cssReset[CSS_TRANSFORM] = transformReset.toString();
  21122.         cssReset[CSS_TRANS_ORG] = originReset.toString();
  21123.         css(img, cssReset);
  21124.  
  21125.         imgData = img.getBoundingClientRect();
  21126.         vpData = self.elements.viewport.getBoundingClientRect();
  21127.         boundaryData = self.elements.boundary.getBoundingClientRect();
  21128.         self._originalImageWidth = imgData.width;
  21129.         self._originalImageHeight = imgData.height;
  21130.  
  21131.         if (self.options.showZoom) {
  21132.             minW = vpData.width / imgData.width;
  21133.             minH = vpData.height / imgData.height;
  21134.             minZoom = Math.max(minW, minH);
  21135.  
  21136.             if (minZoom >= maxZoom) {
  21137.                 maxZoom = minZoom + 1;
  21138.             }
  21139.  
  21140.             zoomer.min = fix(minZoom)
  21141.             zoomer.max = fix(maxZoom);
  21142.             initialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));
  21143.             _setZoomerVal.call(self, initialZoom);
  21144.             dispatchChange(zoomer);
  21145.         }
  21146.  
  21147.         self._currentZoom = transformReset.scale = initialZoom;
  21148.         cssReset[CSS_TRANSFORM] = transformReset.toString();
  21149.         css(img, cssReset);
  21150.  
  21151.         if (self.data.points.length) {
  21152.             _bindPoints.call(self, self.data.points);
  21153.         }
  21154.         else {
  21155.             _centerImage.call(self);
  21156.         }
  21157.  
  21158.        
  21159.         _updateOverlay.call(self);
  21160.     }
  21161.  
  21162.     function _bindPoints(points) {
  21163.         if (points.length != 4) {
  21164.             throw "Croppie - Invalid number of points supplied: " + points;
  21165.         }
  21166.         var self = this,
  21167.             pointsWidth = points[2] - points[0],
  21168.             // pointsHeight = points[3] - points[1],
  21169.             vpData = self.elements.viewport.getBoundingClientRect(),
  21170.             boundRect = self.elements.boundary.getBoundingClientRect(),
  21171.             vpOffset = {
  21172.                 left: vpData.left - boundRect.left,
  21173.                 top: vpData.top - boundRect.top
  21174.             },
  21175.             scale = vpData.width / pointsWidth,
  21176.             originTop = points[1],
  21177.             originLeft = points[0],
  21178.             transformTop = (-1 * points[1]) + vpOffset.top,
  21179.             transformLeft = (-1 * points[0]) + vpOffset.left,
  21180.             newCss = {};
  21181.  
  21182.         newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px';
  21183.         newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString();
  21184.         css(self.elements.img, newCss);
  21185.  
  21186.         _setZoomerVal.call(self, scale);
  21187.         self._currentZoom = scale;
  21188.     }
  21189.  
  21190.     function _centerImage() {
  21191.         var self = this,
  21192.             imgDim = self.elements.img.getBoundingClientRect(),
  21193.             vpDim = self.elements.viewport.getBoundingClientRect(),
  21194.             boundDim = self.elements.boundary.getBoundingClientRect(),
  21195.             vpLeft = vpDim.left - boundDim.left,
  21196.             vpTop = vpDim.top - boundDim.top,
  21197.             w = vpLeft - ((imgDim.width - vpDim.width) / 2),
  21198.             h = vpTop - ((imgDim.height - vpDim.height) / 2),
  21199.             transform = new Transform(w, h, self._currentZoom);
  21200.  
  21201.         css(self.elements.img, CSS_TRANSFORM, transform.toString());
  21202.     }
  21203.  
  21204.     function _bind(options, cb) {
  21205.         var self = this,
  21206.             url,
  21207.             points = [];
  21208.  
  21209.         if (typeof (options) === 'string') {
  21210.             url = options;
  21211.             options = {};
  21212.         }
  21213.         else if (Array.isArray(options)) {
  21214.             points = options.slice();
  21215.         }
  21216.         else if (typeof (options) == 'undefined' && self.data.url) { //refreshing
  21217.             _updatePropertiesFromImage.call(self);
  21218.             _triggerUpdate.call(self);
  21219.             return null;
  21220.         }
  21221.         else {
  21222.             url = options.url;
  21223.             points = options.points || [];
  21224.         }
  21225.  
  21226.         self.data.bound = false;
  21227.         self.data.url = url || self.data.url;
  21228.         self.data.points = (points || self.data.points).map(function (p) {
  21229.             return parseFloat(p);
  21230.         });
  21231.         var prom = loadImage(url, self.elements.img);
  21232.         prom.then(function () {
  21233.             _updatePropertiesFromImage.call(self);
  21234.             _triggerUpdate.call(self);
  21235.             if (cb) {
  21236.                 cb();
  21237.             }
  21238.         });
  21239.         return prom;
  21240.     }
  21241.  
  21242.     function fix(v) {
  21243.         return parseFloat(v).toFixed(2);
  21244.     }
  21245.  
  21246.     function _get() {
  21247.         var self = this,
  21248.             imgData = self.elements.img.getBoundingClientRect(),
  21249.             vpData = self.elements.viewport.getBoundingClientRect(),
  21250.             x1 = vpData.left - imgData.left,
  21251.             y1 = vpData.top - imgData.top,
  21252.             x2 = x1 + vpData.width,
  21253.             y2 = y1 + vpData.height,
  21254.             scale = self._currentZoom;
  21255.  
  21256.         if (scale === Infinity || isNaN(scale)) {
  21257.             scale = 1;
  21258.         }
  21259.  
  21260.         x1 = Math.max(0, x1 / scale);
  21261.         y1 = Math.max(0, y1 / scale);
  21262.         x2 = Math.max(0, x2 / scale);
  21263.         y2 = Math.max(0, y2 / scale);
  21264.        
  21265.         return {
  21266.             points: [fix(x1), fix(y1), fix(x2), fix(y2)],
  21267.             zoom: scale
  21268.         };
  21269.     }
  21270.  
  21271.     function _result(options) {
  21272.         var self = this,
  21273.             data = _get.call(self),
  21274.             opts = options || { type: 'canvas', size: 'viewport' },
  21275.             type = (typeof (opts) === 'string' ? opts : opts.type),
  21276.             size = opts.size || 'viewport',
  21277.             vpRect,
  21278.             prom;
  21279.  
  21280.         if (size === 'viewport') {
  21281.             vpRect = self.elements.viewport.getBoundingClientRect();
  21282.             data.outputWidth = vpRect.width;
  21283.             data.outputHeight = vpRect.height;
  21284.         }
  21285.  
  21286.         data.circle = self.options.viewport.type === 'circle';
  21287.         data.url = self.data.url;
  21288.  
  21289.         prom = new Promise(function (resolve, reject) {
  21290.             if (type === 'canvas') {
  21291.                 loadImage(data.url).then(function (img) {
  21292.                     resolve(getCanvasImage(img, data));
  21293.                 });
  21294.             }
  21295.             else {
  21296.                 resolve(getHtmlImage(data));
  21297.             }
  21298.         });
  21299.         return prom;
  21300.     }
  21301.  
  21302.     function _refresh() {
  21303.         console.warn("Croppie.refresh() is deprecated.  Please use Croppie.bind() without any arguments instead.  refresh() will be removed in a later release.");
  21304.         _updatePropertiesFromImage.call(this);
  21305.     }
  21306.  
  21307.     function _destroy() {
  21308.         var self = this;
  21309.         self.element.removeChild(self.elements.boundary);
  21310.         if (self.options.showZoom) {
  21311.             self.element.removeChild(self.elements.zoomerWrap);
  21312.         }
  21313.         delete self.elements;
  21314.     }
  21315.  
  21316.     if (this.jQuery) {
  21317.         var $ = this.jQuery;
  21318.         $.fn.croppie = function (opts) {
  21319.             var ot = typeof opts;
  21320.  
  21321.             if (ot === 'string') {
  21322.                 var args = Array.prototype.slice.call(arguments, 1);
  21323.                 var singleInst = $(this).data('croppie');
  21324.  
  21325.                 if (opts === 'get') {
  21326.                     return singleInst.get();
  21327.                 }
  21328.                 else if (opts === 'result') {
  21329.                     return singleInst.result.apply(singleInst, args);
  21330.                 }
  21331.  
  21332.                 return this.each(function () {
  21333.                     var i = $(this).data('croppie');
  21334.                     if (!i) return;
  21335.  
  21336.                     var method = i[opts];
  21337.                     if ($.isFunction(method)) {
  21338.                         method.apply(i, args);
  21339.                         if (opts === 'destroy') {
  21340.                             $(this).removeData('croppie');
  21341.                         }
  21342.                     }
  21343.                     else {
  21344.                         throw 'Croppie ' + opts + ' method not found';
  21345.                     }
  21346.                 });
  21347.             }
  21348.             else {
  21349.                 return this.each(function () {
  21350.                     var i = new Croppie(this, opts);
  21351.                     $(this).data('croppie', i);
  21352.                 });
  21353.             }
  21354.         };
  21355.     }
  21356.  
  21357.     function Croppie(element, opts) {
  21358.         this.element = element;
  21359.         this.options = deepExtend({}, Croppie.defaults, opts);
  21360.  
  21361.         _create.call(this);
  21362.     }
  21363.  
  21364.     Croppie.defaults = {
  21365.         viewport: {
  21366.             width: 100,
  21367.             height: 100,
  21368.             type: 'square'
  21369.         },
  21370.         boundary: {
  21371.             width: 300,
  21372.             height: 300
  21373.         },
  21374.         customClass: '',
  21375.         showZoom: true,
  21376.         mouseWheelZoom: true,
  21377.         update: function () { }
  21378.     };
  21379.  
  21380.     deepExtend(Croppie.prototype, {
  21381.         bind: function (options, cb) {
  21382.             return _bind.call(this, options, cb);
  21383.         },
  21384.         get: function () {
  21385.             return _get.call(this);
  21386.         },
  21387.         result: function (type) {
  21388.             return _result.call(this, type);
  21389.         },
  21390.         refresh: function () {
  21391.             return _refresh.call(this);
  21392.         },
  21393.         destroy: function () {
  21394.             return _destroy.call(this);
  21395.         }
  21396.     });
  21397.  
  21398.     exports.Croppie = window.Croppie = Croppie;
  21399. }));
  21400. ;/* =========================================================
  21401.  * bootstrap-datepicker.js
  21402.  * Repo: https://github.com/eternicode/bootstrap-datepicker/
  21403.  * Demo: http://eternicode.github.io/bootstrap-datepicker/
  21404.  * Docs: http://bootstrap-datepicker.readthedocs.org/
  21405.  * Forked from http://www.eyecon.ro/bootstrap-datepicker
  21406.  * =========================================================
  21407.  * Started by Stefan Petre; improvements by Andrew Rowls + contributors
  21408.  *
  21409.  * Licensed under the Apache License, Version 2.0 (the "License");
  21410.  * you may not use this file except in compliance with the License.
  21411.  * You may obtain a copy of the License at
  21412.  *
  21413.  * http://www.apache.org/licenses/LICENSE-2.0
  21414.  *
  21415.  * Unless required by applicable law or agreed to in writing, software
  21416.  * distributed under the License is distributed on an "AS IS" BASIS,
  21417.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21418.  * See the License for the specific language governing permissions and
  21419.  * limitations under the License.
  21420.  * ========================================================= */
  21421.  
  21422. (function($, undefined){
  21423.  
  21424.     var $window = $(window);
  21425.  
  21426.     function UTCDate(){
  21427.         return new Date(Date.UTC.apply(Date, arguments));
  21428.     }
  21429.     function UTCToday(){
  21430.         var today = new Date();
  21431.         return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
  21432.     }
  21433.     function alias(method){
  21434.         return function(){
  21435.             return this[method].apply(this, arguments);
  21436.         };
  21437.     }
  21438.  
  21439.     var DateArray = (function(){
  21440.         var extras = {
  21441.             get: function(i){
  21442.                 return this.slice(i)[0];
  21443.             },
  21444.             contains: function(d){
  21445.                 // Array.indexOf is not cross-browser;
  21446.                 // $.inArray doesn't work with Dates
  21447.                 var val = d && d.valueOf();
  21448.                 for (var i=0, l=this.length; i < l; i++)
  21449.                     if (this[i].valueOf() === val)
  21450.                         return i;
  21451.                 return -1;
  21452.             },
  21453.             remove: function(i){
  21454.                 this.splice(i,1);
  21455.             },
  21456.             replace: function(new_array){
  21457.                 if (!new_array)
  21458.                     return;
  21459.                 if (!$.isArray(new_array))
  21460.                     new_array = [new_array];
  21461.                 this.clear();
  21462.                 this.push.apply(this, new_array);
  21463.             },
  21464.             clear: function(){
  21465.                 this.length = 0;
  21466.             },
  21467.             copy: function(){
  21468.                 var a = new DateArray();
  21469.                 a.replace(this);
  21470.                 return a;
  21471.             }
  21472.         };
  21473.  
  21474.         return function(){
  21475.             var a = [];
  21476.             a.push.apply(a, arguments);
  21477.             $.extend(a, extras);
  21478.             return a;
  21479.         };
  21480.     })();
  21481.  
  21482.  
  21483.     // Picker object
  21484.  
  21485.     var Datepicker = function(element, options){
  21486.         this.dates = new DateArray();
  21487.         this.viewDate = UTCToday();
  21488.         this.focusDate = null;
  21489.  
  21490.         this._process_options(options);
  21491.  
  21492.         this.element = $(element);
  21493.         this.isInline = false;
  21494.         this.isInput = this.element.is('input');
  21495.         this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
  21496.         this.hasInput = this.component && this.element.find('input').length;
  21497.         if (this.component && this.component.length === 0)
  21498.             this.component = false;
  21499.  
  21500.         this.picker = $(DPGlobal.template);
  21501.         this._buildEvents();
  21502.         this._attachEvents();
  21503.  
  21504.         if (this.isInline){
  21505.             this.picker.addClass('datepicker-inline').appendTo(this.element);
  21506.         }
  21507.         else {
  21508.             this.picker.addClass('datepicker-dropdown dropdown-menu');
  21509.         }
  21510.  
  21511.         if (this.o.rtl){
  21512.             this.picker.addClass('datepicker-rtl');
  21513.         }
  21514.  
  21515.         this.viewMode = this.o.startView;
  21516.  
  21517.         if (this.o.calendarWeeks)
  21518.             this.picker.find('tfoot th.today')
  21519.                         .attr('colspan', function(i, val){
  21520.                             return parseInt(val) + 1;
  21521.                         });
  21522.  
  21523.         this._allow_update = false;
  21524.  
  21525.         this.setStartDate(this._o.startDate);
  21526.         this.setEndDate(this._o.endDate);
  21527.         this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
  21528.  
  21529.         this.fillDow();
  21530.         this.fillMonths();
  21531.  
  21532.         this._allow_update = true;
  21533.  
  21534.         this.update();
  21535.         this.showMode();
  21536.  
  21537.         if (this.isInline){
  21538.             this.show();
  21539.         }
  21540.     };
  21541.  
  21542.     Datepicker.prototype = {
  21543.         constructor: Datepicker,
  21544.  
  21545.         _process_options: function(opts){
  21546.             // Store raw options for reference
  21547.             this._o = $.extend({}, this._o, opts);
  21548.             // Processed options
  21549.             var o = this.o = $.extend({}, this._o);
  21550.  
  21551.             // Check if "de-DE" style date is available, if not language should
  21552.             // fallback to 2 letter code eg "de"
  21553.             var lang = o.language;
  21554.             if (!dates[lang]){
  21555.                 lang = lang.split('-')[0];
  21556.                 if (!dates[lang])
  21557.                     lang = defaults.language;
  21558.             }
  21559.             o.language = lang;
  21560.  
  21561.             switch (o.startView){
  21562.                 case 2:
  21563.                 case 'decade':
  21564.                     o.startView = 2;
  21565.                     break;
  21566.                 case 1:
  21567.                 case 'year':
  21568.                     o.startView = 1;
  21569.                     break;
  21570.                 default:
  21571.                     o.startView = 0;
  21572.             }
  21573.  
  21574.             switch (o.minViewMode){
  21575.                 case 1:
  21576.                 case 'months':
  21577.                     o.minViewMode = 1;
  21578.                     break;
  21579.                 case 2:
  21580.                 case 'years':
  21581.                     o.minViewMode = 2;
  21582.                     break;
  21583.                 default:
  21584.                     o.minViewMode = 0;
  21585.             }
  21586.  
  21587.             o.startView = Math.max(o.startView, o.minViewMode);
  21588.  
  21589.             // true, false, or Number > 0
  21590.             if (o.multidate !== true){
  21591.                 o.multidate = Number(o.multidate) || false;
  21592.                 if (o.multidate !== false)
  21593.                     o.multidate = Math.max(0, o.multidate);
  21594.                 else
  21595.                     o.multidate = 1;
  21596.             }
  21597.             o.multidateSeparator = String(o.multidateSeparator);
  21598.  
  21599.             o.weekStart %= 7;
  21600.             o.weekEnd = ((o.weekStart + 6) % 7);
  21601.  
  21602.             var format = DPGlobal.parseFormat(o.format);
  21603.             if (o.startDate !== -Infinity){
  21604.                 if (!!o.startDate){
  21605.                     if (o.startDate instanceof Date)
  21606.                         o.startDate = this._local_to_utc(this._zero_time(o.startDate));
  21607.                     else
  21608.                         o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
  21609.                 }
  21610.                 else {
  21611.                     o.startDate = -Infinity;
  21612.                 }
  21613.             }
  21614.             if (o.endDate !== Infinity){
  21615.                 if (!!o.endDate){
  21616.                     if (o.endDate instanceof Date)
  21617.                         o.endDate = this._local_to_utc(this._zero_time(o.endDate));
  21618.                     else
  21619.                         o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
  21620.                 }
  21621.                 else {
  21622.                     o.endDate = Infinity;
  21623.                 }
  21624.             }
  21625.  
  21626.             o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
  21627.             if (!$.isArray(o.daysOfWeekDisabled))
  21628.                 o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
  21629.             o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
  21630.                 return parseInt(d, 10);
  21631.             });
  21632.  
  21633.             var plc = String(o.orientation).toLowerCase().split(/\s+/g),
  21634.                 _plc = o.orientation.toLowerCase();
  21635.             plc = $.grep(plc, function(word){
  21636.                 return (/^auto|left|right|top|bottom$/).test(word);
  21637.             });
  21638.             o.orientation = {x: 'auto', y: 'auto'};
  21639.             if (!_plc || _plc === 'auto')
  21640.                 ; // no action
  21641.             else if (plc.length === 1){
  21642.                 switch (plc[0]){
  21643.                     case 'top':
  21644.                     case 'bottom':
  21645.                         o.orientation.y = plc[0];
  21646.                         break;
  21647.                     case 'left':
  21648.                     case 'right':
  21649.                         o.orientation.x = plc[0];
  21650.                         break;
  21651.                 }
  21652.             }
  21653.             else {
  21654.                 _plc = $.grep(plc, function(word){
  21655.                     return (/^left|right$/).test(word);
  21656.                 });
  21657.                 o.orientation.x = _plc[0] || 'auto';
  21658.  
  21659.                 _plc = $.grep(plc, function(word){
  21660.                     return (/^top|bottom$/).test(word);
  21661.                 });
  21662.                 o.orientation.y = _plc[0] || 'auto';
  21663.             }
  21664.         },
  21665.         _events: [],
  21666.         _secondaryEvents: [],
  21667.         _applyEvents: function(evs){
  21668.             for (var i=0, el, ch, ev; i < evs.length; i++){
  21669.                 el = evs[i][0];
  21670.                 if (evs[i].length === 2){
  21671.                     ch = undefined;
  21672.                     ev = evs[i][1];
  21673.                 }
  21674.                 else if (evs[i].length === 3){
  21675.                     ch = evs[i][1];
  21676.                     ev = evs[i][2];
  21677.                 }
  21678.                 el.on(ev, ch);
  21679.             }
  21680.         },
  21681.         _unapplyEvents: function(evs){
  21682.             for (var i=0, el, ev, ch; i < evs.length; i++){
  21683.                 el = evs[i][0];
  21684.                 if (evs[i].length === 2){
  21685.                     ch = undefined;
  21686.                     ev = evs[i][1];
  21687.                 }
  21688.                 else if (evs[i].length === 3){
  21689.                     ch = evs[i][1];
  21690.                     ev = evs[i][2];
  21691.                 }
  21692.                 el.off(ev, ch);
  21693.             }
  21694.         },
  21695.         _buildEvents: function(){
  21696.             if (this.isInput){ // single input
  21697.                 this._events = [
  21698.                     [this.element, {
  21699.                         focus: $.proxy(this.show, this),
  21700.                         keyup: $.proxy(function(e){
  21701.                             if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
  21702.                                 this.update();
  21703.                         }, this),
  21704.                         keydown: $.proxy(this.keydown, this)
  21705.                     }]
  21706.                 ];
  21707.             }
  21708.             else if (this.component && this.hasInput){ // component: input + button
  21709.                 this._events = [
  21710.                     // For components that are not readonly, allow keyboard nav
  21711.                     [this.element.find('input'), {
  21712.                         focus: $.proxy(this.show, this),
  21713.                         keyup: $.proxy(function(e){
  21714.                             if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
  21715.                                 this.update();
  21716.                         }, this),
  21717.                         keydown: $.proxy(this.keydown, this)
  21718.                     }],
  21719.                     [this.component, {
  21720.                         click: $.proxy(this.show, this)
  21721.                     }]
  21722.                 ];
  21723.             }
  21724.             else if (this.element.is('div')){  // inline datepicker
  21725.                 this.isInline = true;
  21726.             }
  21727.             else {
  21728.                 this._events = [
  21729.                     [this.element, {
  21730.                         click: $.proxy(this.show, this)
  21731.                     }]
  21732.                 ];
  21733.             }
  21734.             this._events.push(
  21735.                 // Component: listen for blur on element descendants
  21736.                 [this.element, '*', {
  21737.                     blur: $.proxy(function(e){
  21738.                         this._focused_from = e.target;
  21739.                     }, this)
  21740.                 }],
  21741.                 // Input: listen for blur on element
  21742.                 [this.element, {
  21743.                     blur: $.proxy(function(e){
  21744.                         this._focused_from = e.target;
  21745.                     }, this)
  21746.                 }]
  21747.             );
  21748.  
  21749.             this._secondaryEvents = [
  21750.                 [this.picker, {
  21751.                     click: $.proxy(this.click, this)
  21752.                 }],
  21753.                 [$(window), {
  21754.                     resize: $.proxy(this.place, this)
  21755.                 }],
  21756.                 [$(document), {
  21757.                     'mousedown touchstart': $.proxy(function(e){
  21758.                         // Clicked outside the datepicker, hide it
  21759.                         if (!(
  21760.                             this.element.is(e.target) ||
  21761.                             this.element.find(e.target).length ||
  21762.                             this.picker.is(e.target) ||
  21763.                             this.picker.find(e.target).length
  21764.                         )){
  21765.                             this.hide();
  21766.                         }
  21767.                     }, this)
  21768.                 }]
  21769.             ];
  21770.         },
  21771.         _attachEvents: function(){
  21772.             this._detachEvents();
  21773.             this._applyEvents(this._events);
  21774.         },
  21775.         _detachEvents: function(){
  21776.             this._unapplyEvents(this._events);
  21777.         },
  21778.         _attachSecondaryEvents: function(){
  21779.             this._detachSecondaryEvents();
  21780.             this._applyEvents(this._secondaryEvents);
  21781.         },
  21782.         _detachSecondaryEvents: function(){
  21783.             this._unapplyEvents(this._secondaryEvents);
  21784.         },
  21785.         _trigger: function(event, altdate){
  21786.             var date = altdate || this.dates.get(-1),
  21787.                 local_date = this._utc_to_local(date);
  21788.  
  21789.             this.element.trigger({
  21790.                 type: event,
  21791.                 date: local_date,
  21792.                 dates: $.map(this.dates, this._utc_to_local),
  21793.                 format: $.proxy(function(ix, format){
  21794.                     if (arguments.length === 0){
  21795.                         ix = this.dates.length - 1;
  21796.                         format = this.o.format;
  21797.                     }
  21798.                     else if (typeof ix === 'string'){
  21799.                         format = ix;
  21800.                         ix = this.dates.length - 1;
  21801.                     }
  21802.                     format = format || this.o.format;
  21803.                     var date = this.dates.get(ix);
  21804.                     return DPGlobal.formatDate(date, format, this.o.language);
  21805.                 }, this)
  21806.             });
  21807.         },
  21808.  
  21809.         show: function(){
  21810.             if (!this.isInline)
  21811.                 this.picker.appendTo('body');
  21812.             this.picker.show();
  21813.             this.place();
  21814.             this._attachSecondaryEvents();
  21815.             this._trigger('show');
  21816.         },
  21817.  
  21818.         hide: function(){
  21819.             if (this.isInline)
  21820.                 return;
  21821.             if (!this.picker.is(':visible'))
  21822.                 return;
  21823.             this.focusDate = null;
  21824.             this.picker.hide().detach();
  21825.             this._detachSecondaryEvents();
  21826.             this.viewMode = this.o.startView;
  21827.             this.showMode();
  21828.  
  21829.             if (
  21830.                 this.o.forceParse &&
  21831.                 (
  21832.                     this.isInput && this.element.val() ||
  21833.                     this.hasInput && this.element.find('input').val()
  21834.                 )
  21835.             )
  21836.                 this.setValue();
  21837.             this._trigger('hide');
  21838.         },
  21839.  
  21840.         remove: function(){
  21841.             this.hide();
  21842.             this._detachEvents();
  21843.             this._detachSecondaryEvents();
  21844.             this.picker.remove();
  21845.             delete this.element.data().datepicker;
  21846.             if (!this.isInput){
  21847.                 delete this.element.data().date;
  21848.             }
  21849.         },
  21850.  
  21851.         _utc_to_local: function(utc){
  21852.             return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
  21853.         },
  21854.         _local_to_utc: function(local){
  21855.             return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
  21856.         },
  21857.         _zero_time: function(local){
  21858.             return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
  21859.         },
  21860.         _zero_utc_time: function(utc){
  21861.             return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
  21862.         },
  21863.  
  21864.         getDates: function(){
  21865.             return $.map(this.dates, this._utc_to_local);
  21866.         },
  21867.  
  21868.         getUTCDates: function(){
  21869.             return $.map(this.dates, function(d){
  21870.                 return new Date(d);
  21871.             });
  21872.         },
  21873.  
  21874.         getDate: function(){
  21875.             return this._utc_to_local(this.getUTCDate());
  21876.         },
  21877.  
  21878.         getUTCDate: function(){
  21879.             return new Date(this.dates.get(-1));
  21880.         },
  21881.  
  21882.         setDates: function(){
  21883.             var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
  21884.             this.update.apply(this, args);
  21885.             this._trigger('changeDate');
  21886.             this.setValue();
  21887.         },
  21888.  
  21889.         setUTCDates: function(){
  21890.             var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
  21891.             this.update.apply(this, $.map(args, this._utc_to_local));
  21892.             this._trigger('changeDate');
  21893.             this.setValue();
  21894.         },
  21895.  
  21896.         setDate: alias('setDates'),
  21897.         setUTCDate: alias('setUTCDates'),
  21898.  
  21899.         setValue: function(){
  21900.             var formatted = this.getFormattedDate();
  21901.             if (!this.isInput){
  21902.                 if (this.component){
  21903.                     this.element.find('input').val(formatted).change();
  21904.                 }
  21905.             }
  21906.             else {
  21907.                 this.element.val(formatted).change();
  21908.             }
  21909.         },
  21910.  
  21911.         getFormattedDate: function(format){
  21912.             if (format === undefined)
  21913.                 format = this.o.format;
  21914.  
  21915.             var lang = this.o.language;
  21916.             return $.map(this.dates, function(d){
  21917.                 return DPGlobal.formatDate(d, format, lang);
  21918.             }).join(this.o.multidateSeparator);
  21919.         },
  21920.  
  21921.         setStartDate: function(startDate){
  21922.             this._process_options({startDate: startDate});
  21923.             this.update();
  21924.             this.updateNavArrows();
  21925.         },
  21926.  
  21927.         setEndDate: function(endDate){
  21928.             this._process_options({endDate: endDate});
  21929.             this.update();
  21930.             this.updateNavArrows();
  21931.         },
  21932.  
  21933.         setDaysOfWeekDisabled: function(daysOfWeekDisabled){
  21934.             this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
  21935.             this.update();
  21936.             this.updateNavArrows();
  21937.         },
  21938.  
  21939.         place: function(){
  21940.             if (this.isInline)
  21941.                 return;
  21942.             var calendarWidth = this.picker.outerWidth(),
  21943.                 calendarHeight = this.picker.outerHeight(),
  21944.                 visualPadding = 10,
  21945.                 windowWidth = $window.width(),
  21946.                 windowHeight = $window.height(),
  21947.                 scrollTop = $window.scrollTop();
  21948.  
  21949.             var zIndex = parseInt(this.element.parents().filter(function(){
  21950.                     return $(this).css('z-index') !== 'auto';
  21951.                 }).first().css('z-index'))+10;
  21952.             var offset = this.component ? this.component.parent().offset() : this.element.offset();
  21953.             var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
  21954.             var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
  21955.             var left = offset.left,
  21956.                 top = offset.top;
  21957.  
  21958.             this.picker.removeClass(
  21959.                 'datepicker-orient-top datepicker-orient-bottom '+
  21960.                 'datepicker-orient-right datepicker-orient-left'
  21961.             );
  21962.  
  21963.             if (this.o.orientation.x !== 'auto'){
  21964.                 this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
  21965.                 if (this.o.orientation.x === 'right')
  21966.                     left -= calendarWidth - width;
  21967.             }
  21968.             // auto x orientation is best-placement: if it crosses a window
  21969.             // edge, fudge it sideways
  21970.             else {
  21971.                 // Default to left
  21972.                 this.picker.addClass('datepicker-orient-left');
  21973.                 if (offset.left < 0)
  21974.                     left -= offset.left - visualPadding;
  21975.                 else if (offset.left + calendarWidth > windowWidth)
  21976.                     left = windowWidth - calendarWidth - visualPadding;
  21977.             }
  21978.  
  21979.             // auto y orientation is best-situation: top or bottom, no fudging,
  21980.             // decision based on which shows more of the calendar
  21981.             var yorient = this.o.orientation.y,
  21982.                 top_overflow, bottom_overflow;
  21983.             if (yorient === 'auto'){
  21984.                 top_overflow = -scrollTop + offset.top - calendarHeight;
  21985.                 bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
  21986.                 if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
  21987.                     yorient = 'top';
  21988.                 else
  21989.                     yorient = 'bottom';
  21990.             }
  21991.             this.picker.addClass('datepicker-orient-' + yorient);
  21992.             if (yorient === 'top')
  21993.                 top += height;
  21994.             else
  21995.                 top -= calendarHeight + parseInt(this.picker.css('padding-top'));
  21996.  
  21997.             this.picker.css({
  21998.                 top: top,
  21999.                 left: left,
  22000.                 zIndex: zIndex
  22001.             });
  22002.         },
  22003.  
  22004.         _allow_update: true,
  22005.         update: function(){
  22006.             if (!this._allow_update)
  22007.                 return;
  22008.  
  22009.             var oldDates = this.dates.copy(),
  22010.                 dates = [],
  22011.                 fromArgs = false;
  22012.             if (arguments.length){
  22013.                 $.each(arguments, $.proxy(function(i, date){
  22014.                     if (date instanceof Date)
  22015.                         date = this._local_to_utc(date);
  22016.                     dates.push(date);
  22017.                 }, this));
  22018.                 fromArgs = true;
  22019.             }
  22020.             else {
  22021.                 dates = this.isInput
  22022.                         ? this.element.val()
  22023.                         : this.element.data('date') || this.element.find('input').val();
  22024.                 if (dates && this.o.multidate)
  22025.                     dates = dates.split(this.o.multidateSeparator);
  22026.                 else
  22027.                     dates = [dates];
  22028.                 delete this.element.data().date;
  22029.             }
  22030.  
  22031.             dates = $.map(dates, $.proxy(function(date){
  22032.                 return DPGlobal.parseDate(date, this.o.format, this.o.language);
  22033.             }, this));
  22034.             dates = $.grep(dates, $.proxy(function(date){
  22035.                 return (
  22036.                     date < this.o.startDate ||
  22037.                     date > this.o.endDate ||
  22038.                     !date
  22039.                 );
  22040.             }, this), true);
  22041.             this.dates.replace(dates);
  22042.  
  22043.             if (this.dates.length)
  22044.                 this.viewDate = new Date(this.dates.get(-1));
  22045.             else if (this.viewDate < this.o.startDate)
  22046.                 this.viewDate = new Date(this.o.startDate);
  22047.             else if (this.viewDate > this.o.endDate)
  22048.                 this.viewDate = new Date(this.o.endDate);
  22049.  
  22050.             if (fromArgs){
  22051.                 // setting date by clicking
  22052.                 this.setValue();
  22053.             }
  22054.             else if (dates.length){
  22055.                 // setting date by typing
  22056.                 if (String(oldDates) !== String(this.dates))
  22057.                     this._trigger('changeDate');
  22058.             }
  22059.             if (!this.dates.length && oldDates.length)
  22060.                 this._trigger('clearDate');
  22061.  
  22062.             this.fill();
  22063.         },
  22064.  
  22065.         fillDow: function(){
  22066.             var dowCnt = this.o.weekStart,
  22067.                 html = '<tr>';
  22068.             if (this.o.calendarWeeks){
  22069.                 var cell = '<th class="cw">&nbsp;</th>';
  22070.                 html += cell;
  22071.                 this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
  22072.             }
  22073.             while (dowCnt < this.o.weekStart + 7){
  22074.                 html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
  22075.             }
  22076.             html += '</tr>';
  22077.             this.picker.find('.datepicker-days thead').append(html);
  22078.         },
  22079.  
  22080.         fillMonths: function(){
  22081.             var html = '',
  22082.             i = 0;
  22083.             while (i < 12){
  22084.                 html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
  22085.             }
  22086.             this.picker.find('.datepicker-months td').html(html);
  22087.         },
  22088.  
  22089.         setRange: function(range){
  22090.             if (!range || !range.length)
  22091.                 delete this.range;
  22092.             else
  22093.                 this.range = $.map(range, function(d){
  22094.                     return d.valueOf();
  22095.                 });
  22096.             this.fill();
  22097.         },
  22098.  
  22099.         getClassNames: function(date){
  22100.             var cls = [],
  22101.                 year = this.viewDate.getUTCFullYear(),
  22102.                 month = this.viewDate.getUTCMonth(),
  22103.                 today = new Date();
  22104.             if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
  22105.                 cls.push('old');
  22106.             }
  22107.             else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
  22108.                 cls.push('new');
  22109.             }
  22110.             if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
  22111.                 cls.push('focused');
  22112.             // Compare internal UTC date with local today, not UTC today
  22113.             if (this.o.todayHighlight &&
  22114.                 date.getUTCFullYear() === today.getFullYear() &&
  22115.                 date.getUTCMonth() === today.getMonth() &&
  22116.                 date.getUTCDate() === today.getDate()){
  22117.                 cls.push('today');
  22118.             }
  22119.             if (this.dates.contains(date) !== -1)
  22120.                 cls.push('active');
  22121.             if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
  22122.                 $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
  22123.                 cls.push('disabled');
  22124.             }
  22125.             if (this.range){
  22126.                 if (date > this.range[0] && date < this.range[this.range.length-1]){
  22127.                     cls.push('range');
  22128.                 }
  22129.                 if ($.inArray(date.valueOf(), this.range) !== -1){
  22130.                     cls.push('selected');
  22131.                 }
  22132.             }
  22133.             return cls;
  22134.         },
  22135.  
  22136.         fill: function(){
  22137.             var d = new Date(this.viewDate),
  22138.                 year = d.getUTCFullYear(),
  22139.                 month = d.getUTCMonth(),
  22140.                 startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
  22141.                 startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
  22142.                 endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
  22143.                 endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
  22144.                 todaytxt = dates[this.o.language].today || dates['en'].today || '',
  22145.                 cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
  22146.                 tooltip;
  22147.             this.picker.find('.datepicker-days thead th.datepicker-switch')
  22148.                         .text(dates[this.o.language].months[month]+' '+year);
  22149.             this.picker.find('tfoot th.today')
  22150.                         .text(todaytxt)
  22151.                         .toggle(this.o.todayBtn !== false);
  22152.             this.picker.find('tfoot th.clear')
  22153.                         .text(cleartxt)
  22154.                         .toggle(this.o.clearBtn !== false);
  22155.             this.updateNavArrows();
  22156.             this.fillMonths();
  22157.             var prevMonth = UTCDate(year, month-1, 28),
  22158.                 day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
  22159.             prevMonth.setUTCDate(day);
  22160.             prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
  22161.             var nextMonth = new Date(prevMonth);
  22162.             nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
  22163.             nextMonth = nextMonth.valueOf();
  22164.             var html = [];
  22165.             var clsName;
  22166.             while (prevMonth.valueOf() < nextMonth){
  22167.                 if (prevMonth.getUTCDay() === this.o.weekStart){
  22168.                     html.push('<tr>');
  22169.                     if (this.o.calendarWeeks){
  22170.                         // ISO 8601: First week contains first thursday.
  22171.                         // ISO also states week starts on Monday, but we can be more abstract here.
  22172.                         var
  22173.                             // Start of current week: based on weekstart/current date
  22174.                             ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
  22175.                             // Thursday of this week
  22176.                             th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
  22177.                             // First Thursday of year, year from thursday
  22178.                             yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
  22179.                             // Calendar week: ms between thursdays, div ms per day, div 7 days
  22180.                             calWeek =  (th - yth) / 864e5 / 7 + 1;
  22181.                         html.push('<td class="cw">'+ calWeek +'</td>');
  22182.  
  22183.                     }
  22184.                 }
  22185.                 clsName = this.getClassNames(prevMonth);
  22186.                 clsName.push('day');
  22187.  
  22188.                 if (this.o.beforeShowDay !== $.noop){
  22189.                     var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
  22190.                     if (before === undefined)
  22191.                         before = {};
  22192.                     else if (typeof(before) === 'boolean')
  22193.                         before = {enabled: before};
  22194.                     else if (typeof(before) === 'string')
  22195.                         before = {classes: before};
  22196.                     if (before.enabled === false)
  22197.                         clsName.push('disabled');
  22198.                     if (before.classes)
  22199.                         clsName = clsName.concat(before.classes.split(/\s+/));
  22200.                     if (before.tooltip)
  22201.                         tooltip = before.tooltip;
  22202.                 }
  22203.  
  22204.                 clsName = $.unique(clsName);
  22205.                 html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
  22206.                 if (prevMonth.getUTCDay() === this.o.weekEnd){
  22207.                     html.push('</tr>');
  22208.                 }
  22209.                 prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
  22210.             }
  22211.             this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
  22212.  
  22213.             var months = this.picker.find('.datepicker-months')
  22214.                         .find('th:eq(1)')
  22215.                             .text(year)
  22216.                             .end()
  22217.                         .find('span').removeClass('active');
  22218.  
  22219.             $.each(this.dates, function(i, d){
  22220.                 if (d.getUTCFullYear() === year)
  22221.                     months.eq(d.getUTCMonth()).addClass('active');
  22222.             });
  22223.  
  22224.             if (year < startYear || year > endYear){
  22225.                 months.addClass('disabled');
  22226.             }
  22227.             if (year === startYear){
  22228.                 months.slice(0, startMonth).addClass('disabled');
  22229.             }
  22230.             if (year === endYear){
  22231.                 months.slice(endMonth+1).addClass('disabled');
  22232.             }
  22233.  
  22234.             html = '';
  22235.             year = parseInt(year/10, 10) * 10;
  22236.             var yearCont = this.picker.find('.datepicker-years')
  22237.                                 .find('th:eq(1)')
  22238.                                     .text(year + '-' + (year + 9))
  22239.                                     .end()
  22240.                                 .find('td');
  22241.             year -= 1;
  22242.             var years = $.map(this.dates, function(d){
  22243.                     return d.getUTCFullYear();
  22244.                 }),
  22245.                 classes;
  22246.             for (var i = -1; i < 11; i++){
  22247.                 classes = ['year'];
  22248.                 if (i === -1)
  22249.                     classes.push('old');
  22250.                 else if (i === 10)
  22251.                     classes.push('new');
  22252.                 if ($.inArray(year, years) !== -1)
  22253.                     classes.push('active');
  22254.                 if (year < startYear || year > endYear)
  22255.                     classes.push('disabled');
  22256.                 html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
  22257.                 year += 1;
  22258.             }
  22259.             yearCont.html(html);
  22260.         },
  22261.  
  22262.         updateNavArrows: function(){
  22263.             if (!this._allow_update)
  22264.                 return;
  22265.  
  22266.             var d = new Date(this.viewDate),
  22267.                 year = d.getUTCFullYear(),
  22268.                 month = d.getUTCMonth();
  22269.             switch (this.viewMode){
  22270.                 case 0:
  22271.                     if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
  22272.                         this.picker.find('.prev').css({visibility: 'hidden'});
  22273.                     }
  22274.                     else {
  22275.                         this.picker.find('.prev').css({visibility: 'visible'});
  22276.                     }
  22277.                     if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
  22278.                         this.picker.find('.next').css({visibility: 'hidden'});
  22279.                     }
  22280.                     else {
  22281.                         this.picker.find('.next').css({visibility: 'visible'});
  22282.                     }
  22283.                     break;
  22284.                 case 1:
  22285.                 case 2:
  22286.                     if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
  22287.                         this.picker.find('.prev').css({visibility: 'hidden'});
  22288.                     }
  22289.                     else {
  22290.                         this.picker.find('.prev').css({visibility: 'visible'});
  22291.                     }
  22292.                     if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
  22293.                         this.picker.find('.next').css({visibility: 'hidden'});
  22294.                     }
  22295.                     else {
  22296.                         this.picker.find('.next').css({visibility: 'visible'});
  22297.                     }
  22298.                     break;
  22299.             }
  22300.         },
  22301.  
  22302.         click: function(e){
  22303.             e.preventDefault();
  22304.             var target = $(e.target).closest('span, td, th'),
  22305.                 year, month, day;
  22306.             if (target.length === 1){
  22307.                 switch (target[0].nodeName.toLowerCase()){
  22308.                     case 'th':
  22309.                         switch (target[0].className){
  22310.                             case 'datepicker-switch':
  22311.                                 this.showMode(1);
  22312.                                 break;
  22313.                             case 'prev':
  22314.                             case 'next':
  22315.                                 var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
  22316.                                 switch (this.viewMode){
  22317.                                     case 0:
  22318.                                         this.viewDate = this.moveMonth(this.viewDate, dir);
  22319.                                         this._trigger('changeMonth', this.viewDate);
  22320.                                         break;
  22321.                                     case 1:
  22322.                                     case 2:
  22323.                                         this.viewDate = this.moveYear(this.viewDate, dir);
  22324.                                         if (this.viewMode === 1)
  22325.                                             this._trigger('changeYear', this.viewDate);
  22326.                                         break;
  22327.                                 }
  22328.                                 this.fill();
  22329.                                 break;
  22330.                             case 'today':
  22331.                                 var date = new Date();
  22332.                                 date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  22333.  
  22334.                                 this.showMode(-2);
  22335.                                 var which = this.o.todayBtn === 'linked' ? null : 'view';
  22336.                                 this._setDate(date, which);
  22337.                                 break;
  22338.                             case 'clear':
  22339.                                 var element;
  22340.                                 if (this.isInput)
  22341.                                     element = this.element;
  22342.                                 else if (this.component)
  22343.                                     element = this.element.find('input');
  22344.                                 if (element)
  22345.                                     element.val("").change();
  22346.                                 this.update();
  22347.                                 this._trigger('changeDate');
  22348.                                 if (this.o.autoclose)
  22349.                                     this.hide();
  22350.                                 break;
  22351.                         }
  22352.                         break;
  22353.                     case 'span':
  22354.                         if (!target.is('.disabled')){
  22355.                             this.viewDate.setUTCDate(1);
  22356.                             if (target.is('.month')){
  22357.                                 day = 1;
  22358.                                 month = target.parent().find('span').index(target);
  22359.                                 year = this.viewDate.getUTCFullYear();
  22360.                                 this.viewDate.setUTCMonth(month);
  22361.                                 this._trigger('changeMonth', this.viewDate);
  22362.                                 if (this.o.minViewMode === 1){
  22363.                                     this._setDate(UTCDate(year, month, day));
  22364.                                 }
  22365.                             }
  22366.                             else {
  22367.                                 day = 1;
  22368.                                 month = 0;
  22369.                                 year = parseInt(target.text(), 10)||0;
  22370.                                 this.viewDate.setUTCFullYear(year);
  22371.                                 this._trigger('changeYear', this.viewDate);
  22372.                                 if (this.o.minViewMode === 2){
  22373.                                     this._setDate(UTCDate(year, month, day));
  22374.                                 }
  22375.                             }
  22376.                             this.showMode(-1);
  22377.                             this.fill();
  22378.                         }
  22379.                         break;
  22380.                     case 'td':
  22381.                         if (target.is('.day') && !target.is('.disabled')){
  22382.                             day = parseInt(target.text(), 10)||1;
  22383.                             year = this.viewDate.getUTCFullYear();
  22384.                             month = this.viewDate.getUTCMonth();
  22385.                             if (target.is('.old')){
  22386.                                 if (month === 0){
  22387.                                     month = 11;
  22388.                                     year -= 1;
  22389.                                 }
  22390.                                 else {
  22391.                                     month -= 1;
  22392.                                 }
  22393.                             }
  22394.                             else if (target.is('.new')){
  22395.                                 if (month === 11){
  22396.                                     month = 0;
  22397.                                     year += 1;
  22398.                                 }
  22399.                                 else {
  22400.                                     month += 1;
  22401.                                 }
  22402.                             }
  22403.                             this._setDate(UTCDate(year, month, day));
  22404.                         }
  22405.                         break;
  22406.                 }
  22407.             }
  22408.             if (this.picker.is(':visible') && this._focused_from){
  22409.                 $(this._focused_from).focus();
  22410.             }
  22411.             delete this._focused_from;
  22412.         },
  22413.  
  22414.         _toggle_multidate: function(date){
  22415.             var ix = this.dates.contains(date);
  22416.             if (!date){
  22417.                 this.dates.clear();
  22418.             }
  22419.             if (this.o.multidate === 1 && ix === 0){
  22420.                 // single datepicker, don't remove selected date
  22421.             }
  22422.             else if (ix !== -1){
  22423.                 this.dates.remove(ix);
  22424.             }
  22425.             else {
  22426.                 this.dates.push(date);
  22427.             }
  22428.             if (typeof this.o.multidate === 'number')
  22429.                 while (this.dates.length > this.o.multidate)
  22430.                     this.dates.remove(0);
  22431.         },
  22432.  
  22433.         _setDate: function(date, which){
  22434.             if (!which || which === 'date')
  22435.                 this._toggle_multidate(date && new Date(date));
  22436.             if (!which || which  === 'view')
  22437.                 this.viewDate = date && new Date(date);
  22438.  
  22439.             this.fill();
  22440.             this.setValue();
  22441.             this._trigger('changeDate');
  22442.             var element;
  22443.             if (this.isInput){
  22444.                 element = this.element;
  22445.             }
  22446.             else if (this.component){
  22447.                 element = this.element.find('input');
  22448.             }
  22449.             if (element){
  22450.                 element.change();
  22451.             }
  22452.             if (this.o.autoclose && (!which || which === 'date')){
  22453.                 this.hide();
  22454.             }
  22455.         },
  22456.  
  22457.         moveMonth: function(date, dir){
  22458.             if (!date)
  22459.                 return undefined;
  22460.             if (!dir)
  22461.                 return date;
  22462.             var new_date = new Date(date.valueOf()),
  22463.                 day = new_date.getUTCDate(),
  22464.                 month = new_date.getUTCMonth(),
  22465.                 mag = Math.abs(dir),
  22466.                 new_month, test;
  22467.             dir = dir > 0 ? 1 : -1;
  22468.             if (mag === 1){
  22469.                 test = dir === -1
  22470.                     // If going back one month, make sure month is not current month
  22471.                     // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
  22472.                     ? function(){
  22473.                         return new_date.getUTCMonth() === month;
  22474.                     }
  22475.                     // If going forward one month, make sure month is as expected
  22476.                     // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
  22477.                     : function(){
  22478.                         return new_date.getUTCMonth() !== new_month;
  22479.                     };
  22480.                 new_month = month + dir;
  22481.                 new_date.setUTCMonth(new_month);
  22482.                 // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
  22483.                 if (new_month < 0 || new_month > 11)
  22484.                     new_month = (new_month + 12) % 12;
  22485.             }
  22486.             else {
  22487.                 // For magnitudes >1, move one month at a time...
  22488.                 for (var i=0; i < mag; i++)
  22489.                     // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
  22490.                     new_date = this.moveMonth(new_date, dir);
  22491.                 // ...then reset the day, keeping it in the new month
  22492.                 new_month = new_date.getUTCMonth();
  22493.                 new_date.setUTCDate(day);
  22494.                 test = function(){
  22495.                     return new_month !== new_date.getUTCMonth();
  22496.                 };
  22497.             }
  22498.             // Common date-resetting loop -- if date is beyond end of month, make it
  22499.             // end of month
  22500.             while (test()){
  22501.                 new_date.setUTCDate(--day);
  22502.                 new_date.setUTCMonth(new_month);
  22503.             }
  22504.             return new_date;
  22505.         },
  22506.  
  22507.         moveYear: function(date, dir){
  22508.             return this.moveMonth(date, dir*12);
  22509.         },
  22510.  
  22511.         dateWithinRange: function(date){
  22512.             return date >= this.o.startDate && date <= this.o.endDate;
  22513.         },
  22514.  
  22515.         keydown: function(e){
  22516.             if (this.picker.is(':not(:visible)')){
  22517.                 if (e.keyCode === 27) // allow escape to hide and re-show picker
  22518.                     this.show();
  22519.                 return;
  22520.             }
  22521.             var dateChanged = false,
  22522.                 dir, newDate, newViewDate,
  22523.                 focusDate = this.focusDate || this.viewDate;
  22524.             switch (e.keyCode){
  22525.                 case 27: // escape
  22526.                     if (this.focusDate){
  22527.                         this.focusDate = null;
  22528.                         this.viewDate = this.dates.get(-1) || this.viewDate;
  22529.                         this.fill();
  22530.                     }
  22531.                     else
  22532.                         this.hide();
  22533.                     e.preventDefault();
  22534.                     break;
  22535.                 case 37: // left
  22536.                 case 39: // right
  22537.                     if (!this.o.keyboardNavigation)
  22538.                         break;
  22539.                     dir = e.keyCode === 37 ? -1 : 1;
  22540.                     if (e.ctrlKey){
  22541.                         newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
  22542.                         newViewDate = this.moveYear(focusDate, dir);
  22543.                         this._trigger('changeYear', this.viewDate);
  22544.                     }
  22545.                     else if (e.shiftKey){
  22546.                         newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
  22547.                         newViewDate = this.moveMonth(focusDate, dir);
  22548.                         this._trigger('changeMonth', this.viewDate);
  22549.                     }
  22550.                     else {
  22551.                         newDate = new Date(this.dates.get(-1) || UTCToday());
  22552.                         newDate.setUTCDate(newDate.getUTCDate() + dir);
  22553.                         newViewDate = new Date(focusDate);
  22554.                         newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
  22555.                     }
  22556.                     if (this.dateWithinRange(newDate)){
  22557.                         this.focusDate = this.viewDate = newViewDate;
  22558.                         this.setValue();
  22559.                         this.fill();
  22560.                         e.preventDefault();
  22561.                     }
  22562.                     break;
  22563.                 case 38: // up
  22564.                 case 40: // down
  22565.                     if (!this.o.keyboardNavigation)
  22566.                         break;
  22567.                     dir = e.keyCode === 38 ? -1 : 1;
  22568.                     if (e.ctrlKey){
  22569.                         newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
  22570.                         newViewDate = this.moveYear(focusDate, dir);
  22571.                         this._trigger('changeYear', this.viewDate);
  22572.                     }
  22573.                     else if (e.shiftKey){
  22574.                         newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
  22575.                         newViewDate = this.moveMonth(focusDate, dir);
  22576.                         this._trigger('changeMonth', this.viewDate);
  22577.                     }
  22578.                     else {
  22579.                         newDate = new Date(this.dates.get(-1) || UTCToday());
  22580.                         newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
  22581.                         newViewDate = new Date(focusDate);
  22582.                         newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
  22583.                     }
  22584.                     if (this.dateWithinRange(newDate)){
  22585.                         this.focusDate = this.viewDate = newViewDate;
  22586.                         this.setValue();
  22587.                         this.fill();
  22588.                         e.preventDefault();
  22589.                     }
  22590.                     break;
  22591.                 case 32: // spacebar
  22592.                     // Spacebar is used in manually typing dates in some formats.
  22593.                     // As such, its behavior should not be hijacked.
  22594.                     break;
  22595.                 case 13: // enter
  22596.                     focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
  22597.                     this._toggle_multidate(focusDate);
  22598.                     dateChanged = true;
  22599.                     this.focusDate = null;
  22600.                     this.viewDate = this.dates.get(-1) || this.viewDate;
  22601.                     this.setValue();
  22602.                     this.fill();
  22603.                     if (this.picker.is(':visible')){
  22604.                         e.preventDefault();
  22605.                         if (this.o.autoclose)
  22606.                             this.hide();
  22607.                     }
  22608.                     break;
  22609.                 case 9: // tab
  22610.                     this.focusDate = null;
  22611.                     this.viewDate = this.dates.get(-1) || this.viewDate;
  22612.                     this.fill();
  22613.                     this.hide();
  22614.                     break;
  22615.             }
  22616.             if (dateChanged){
  22617.                 if (this.dates.length)
  22618.                     this._trigger('changeDate');
  22619.                 else
  22620.                     this._trigger('clearDate');
  22621.                 var element;
  22622.                 if (this.isInput){
  22623.                     element = this.element;
  22624.                 }
  22625.                 else if (this.component){
  22626.                     element = this.element.find('input');
  22627.                 }
  22628.                 if (element){
  22629.                     element.change();
  22630.                 }
  22631.             }
  22632.         },
  22633.  
  22634.         showMode: function(dir){
  22635.             if (dir){
  22636.                 this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
  22637.             }
  22638.             this.picker
  22639.                 .find('>div')
  22640.                 .hide()
  22641.                 .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName)
  22642.                     .css('display', 'block');
  22643.             this.updateNavArrows();
  22644.         }
  22645.     };
  22646.  
  22647.     var DateRangePicker = function(element, options){
  22648.         this.element = $(element);
  22649.         this.inputs = $.map(options.inputs, function(i){
  22650.             return i.jquery ? i[0] : i;
  22651.         });
  22652.         delete options.inputs;
  22653.  
  22654.         $(this.inputs)
  22655.             .datepicker(options)
  22656.             .bind('changeDate', $.proxy(this.dateUpdated, this));
  22657.  
  22658.         this.pickers = $.map(this.inputs, function(i){
  22659.             return $(i).data('datepicker');
  22660.         });
  22661.         this.updateDates();
  22662.     };
  22663.     DateRangePicker.prototype = {
  22664.         updateDates: function(){
  22665.             this.dates = $.map(this.pickers, function(i){
  22666.                 return i.getUTCDate();
  22667.             });
  22668.             this.updateRanges();
  22669.         },
  22670.         updateRanges: function(){
  22671.             var range = $.map(this.dates, function(d){
  22672.                 return d.valueOf();
  22673.             });
  22674.             $.each(this.pickers, function(i, p){
  22675.                 p.setRange(range);
  22676.             });
  22677.         },
  22678.         dateUpdated: function(e){
  22679.             // `this.updating` is a workaround for preventing infinite recursion
  22680.             // between `changeDate` triggering and `setUTCDate` calling.  Until
  22681.             // there is a better mechanism.
  22682.             if (this.updating)
  22683.                 return;
  22684.             this.updating = true;
  22685.  
  22686.             var dp = $(e.target).data('datepicker'),
  22687.                 new_date = dp.getUTCDate(),
  22688.                 i = $.inArray(e.target, this.inputs),
  22689.                 l = this.inputs.length;
  22690.             if (i === -1)
  22691.                 return;
  22692.  
  22693.             $.each(this.pickers, function(i, p){
  22694.                 if (!p.getUTCDate())
  22695.                     p.setUTCDate(new_date);
  22696.             });
  22697.  
  22698.             if (new_date < this.dates[i]){
  22699.                 // Date being moved earlier/left
  22700.                 while (i >= 0 && new_date < this.dates[i]){
  22701.                     this.pickers[i--].setUTCDate(new_date);
  22702.                 }
  22703.             }
  22704.             else if (new_date > this.dates[i]){
  22705.                 // Date being moved later/right
  22706.                 while (i < l && new_date > this.dates[i]){
  22707.                     this.pickers[i++].setUTCDate(new_date);
  22708.                 }
  22709.             }
  22710.             this.updateDates();
  22711.  
  22712.             delete this.updating;
  22713.         },
  22714.         remove: function(){
  22715.             $.map(this.pickers, function(p){ p.remove(); });
  22716.             delete this.element.data().datepicker;
  22717.         }
  22718.     };
  22719.  
  22720.     function opts_from_el(el, prefix){
  22721.         // Derive options from element data-attrs
  22722.         var data = $(el).data(),
  22723.             out = {}, inkey,
  22724.             replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
  22725.         prefix = new RegExp('^' + prefix.toLowerCase());
  22726.         function re_lower(_,a){
  22727.             return a.toLowerCase();
  22728.         }
  22729.         for (var key in data)
  22730.             if (prefix.test(key)){
  22731.                 inkey = key.replace(replace, re_lower);
  22732.                 out[inkey] = data[key];
  22733.             }
  22734.         return out;
  22735.     }
  22736.  
  22737.     function opts_from_locale(lang){
  22738.         // Derive options from locale plugins
  22739.         var out = {};
  22740.         // Check if "de-DE" style date is available, if not language should
  22741.         // fallback to 2 letter code eg "de"
  22742.         if (!dates[lang]){
  22743.             lang = lang.split('-')[0];
  22744.             if (!dates[lang])
  22745.                 return;
  22746.         }
  22747.         var d = dates[lang];
  22748.         $.each(locale_opts, function(i,k){
  22749.             if (k in d)
  22750.                 out[k] = d[k];
  22751.         });
  22752.         return out;
  22753.     }
  22754.  
  22755.     var old = $.fn.datepicker;
  22756.     $.fn.datepicker = function(option){
  22757.         var args = Array.apply(null, arguments);
  22758.         args.shift();
  22759.         var internal_return;
  22760.         this.each(function(){
  22761.             var $this = $(this),
  22762.                 data = $this.data('datepicker'),
  22763.                 options = typeof option === 'object' && option;
  22764.             if (!data){
  22765.                 var elopts = opts_from_el(this, 'date'),
  22766.                     // Preliminary otions
  22767.                     xopts = $.extend({}, defaults, elopts, options),
  22768.                     locopts = opts_from_locale(xopts.language),
  22769.                     // Options priority: js args, data-attrs, locales, defaults
  22770.                     opts = $.extend({}, defaults, locopts, elopts, options);
  22771.                 if ($this.is('.input-daterange') || opts.inputs){
  22772.                     var ropts = {
  22773.                         inputs: opts.inputs || $this.find('input').toArray()
  22774.                     };
  22775.                     $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
  22776.                 }
  22777.                 else {
  22778.                     $this.data('datepicker', (data = new Datepicker(this, opts)));
  22779.                 }
  22780.             }
  22781.             if (typeof option === 'string' && typeof data[option] === 'function'){
  22782.                 internal_return = data[option].apply(data, args);
  22783.                 if (internal_return !== undefined)
  22784.                     return false;
  22785.             }
  22786.         });
  22787.         if (internal_return !== undefined)
  22788.             return internal_return;
  22789.         else
  22790.             return this;
  22791.     };
  22792.  
  22793.     var defaults = $.fn.datepicker.defaults = {
  22794.         autoclose: false,
  22795.         beforeShowDay: $.noop,
  22796.         calendarWeeks: false,
  22797.         clearBtn: false,
  22798.         daysOfWeekDisabled: [],
  22799.         endDate: Infinity,
  22800.         forceParse: true,
  22801.         format: 'mm/dd/yyyy',
  22802.         keyboardNavigation: true,
  22803.         language: 'en',
  22804.         minViewMode: 0,
  22805.         multidate: false,
  22806.         multidateSeparator: ',',
  22807.         orientation: "auto",
  22808.         rtl: false,
  22809.         startDate: -Infinity,
  22810.         startView: 0,
  22811.         todayBtn: false,
  22812.         todayHighlight: false,
  22813.         weekStart: 0
  22814.     };
  22815.     var locale_opts = $.fn.datepicker.locale_opts = [
  22816.         'format',
  22817.         'rtl',
  22818.         'weekStart'
  22819.     ];
  22820.     $.fn.datepicker.Constructor = Datepicker;
  22821.     var dates = $.fn.datepicker.dates = {
  22822.         en: {
  22823.             days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
  22824.             daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  22825.             daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
  22826.             months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  22827.             monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  22828.             today: "Today",
  22829.             clear: "Clear"
  22830.         }
  22831.     };
  22832.  
  22833.     var DPGlobal = {
  22834.         modes: [
  22835.             {
  22836.                 clsName: 'days',
  22837.                 navFnc: 'Month',
  22838.                 navStep: 1
  22839.             },
  22840.             {
  22841.                 clsName: 'months',
  22842.                 navFnc: 'FullYear',
  22843.                 navStep: 1
  22844.             },
  22845.             {
  22846.                 clsName: 'years',
  22847.                 navFnc: 'FullYear',
  22848.                 navStep: 10
  22849.         }],
  22850.         isLeapYear: function(year){
  22851.             return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
  22852.         },
  22853.         getDaysInMonth: function(year, month){
  22854.             return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
  22855.         },
  22856.         validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
  22857.         nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
  22858.         parseFormat: function(format){
  22859.             // IE treats \0 as a string end in inputs (truncating the value),
  22860.             // so it's a bad format delimiter, anyway
  22861.             var separators = format.replace(this.validParts, '\0').split('\0'),
  22862.                 parts = format.match(this.validParts);
  22863.             if (!separators || !separators.length || !parts || parts.length === 0){
  22864.                 throw new Error("Invalid date format.");
  22865.             }
  22866.             return {separators: separators, parts: parts};
  22867.         },
  22868.         parseDate: function(date, format, language){
  22869.             if (!date)
  22870.                 return undefined;
  22871.             if (date instanceof Date)
  22872.                 return date;
  22873.             if (typeof format === 'string')
  22874.                 format = DPGlobal.parseFormat(format);
  22875.             var part_re = /([\-+]\d+)([dmwy])/,
  22876.                 parts = date.match(/([\-+]\d+)([dmwy])/g),
  22877.                 part, dir, i;
  22878.             if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
  22879.                 date = new Date();
  22880.                 for (i=0; i < parts.length; i++){
  22881.                     part = part_re.exec(parts[i]);
  22882.                     dir = parseInt(part[1]);
  22883.                     switch (part[2]){
  22884.                         case 'd':
  22885.                             date.setUTCDate(date.getUTCDate() + dir);
  22886.                             break;
  22887.                         case 'm':
  22888.                             date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
  22889.                             break;
  22890.                         case 'w':
  22891.                             date.setUTCDate(date.getUTCDate() + dir * 7);
  22892.                             break;
  22893.                         case 'y':
  22894.                             date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
  22895.                             break;
  22896.                     }
  22897.                 }
  22898.                 return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
  22899.             }
  22900.             parts = date && date.match(this.nonpunctuation) || [];
  22901.             date = new Date();
  22902.             var parsed = {},
  22903.                 setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
  22904.                 setters_map = {
  22905.                     yyyy: function(d,v){
  22906.                         return d.setUTCFullYear(v);
  22907.                     },
  22908.                     yy: function(d,v){
  22909.                         return d.setUTCFullYear(2000+v);
  22910.                     },
  22911.                     m: function(d,v){
  22912.                         if (isNaN(d))
  22913.                             return d;
  22914.                         v -= 1;
  22915.                         while (v < 0) v += 12;
  22916.                         v %= 12;
  22917.                         d.setUTCMonth(v);
  22918.                         while (d.getUTCMonth() !== v)
  22919.                             d.setUTCDate(d.getUTCDate()-1);
  22920.                         return d;
  22921.                     },
  22922.                     d: function(d,v){
  22923.                         return d.setUTCDate(v);
  22924.                     }
  22925.                 },
  22926.                 val, filtered;
  22927.             setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
  22928.             setters_map['dd'] = setters_map['d'];
  22929.             date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  22930.             var fparts = format.parts.slice();
  22931.             // Remove noop parts
  22932.             if (parts.length !== fparts.length){
  22933.                 fparts = $(fparts).filter(function(i,p){
  22934.                     return $.inArray(p, setters_order) !== -1;
  22935.                 }).toArray();
  22936.             }
  22937.             // Process remainder
  22938.             function match_part(){
  22939.                 var m = this.slice(0, parts[i].length),
  22940.                     p = parts[i].slice(0, m.length);
  22941.                 return m === p;
  22942.             }
  22943.             if (parts.length === fparts.length){
  22944.                 var cnt;
  22945.                 for (i=0, cnt = fparts.length; i < cnt; i++){
  22946.                     val = parseInt(parts[i], 10);
  22947.                     part = fparts[i];
  22948.                     if (isNaN(val)){
  22949.                         switch (part){
  22950.                             case 'MM':
  22951.                                 filtered = $(dates[language].months).filter(match_part);
  22952.                                 val = $.inArray(filtered[0], dates[language].months) + 1;
  22953.                                 break;
  22954.                             case 'M':
  22955.                                 filtered = $(dates[language].monthsShort).filter(match_part);
  22956.                                 val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
  22957.                                 break;
  22958.                         }
  22959.                     }
  22960.                     parsed[part] = val;
  22961.                 }
  22962.                 var _date, s;
  22963.                 for (i=0; i < setters_order.length; i++){
  22964.                     s = setters_order[i];
  22965.                     if (s in parsed && !isNaN(parsed[s])){
  22966.                         _date = new Date(date);
  22967.                         setters_map[s](_date, parsed[s]);
  22968.                         if (!isNaN(_date))
  22969.                             date = _date;
  22970.                     }
  22971.                 }
  22972.             }
  22973.             return date;
  22974.         },
  22975.         formatDate: function(date, format, language){
  22976.             if (!date)
  22977.                 return '';
  22978.             if (typeof format === 'string')
  22979.                 format = DPGlobal.parseFormat(format);
  22980.             var val = {
  22981.                 d: date.getUTCDate(),
  22982.                 D: dates[language].daysShort[date.getUTCDay()],
  22983.                 DD: dates[language].days[date.getUTCDay()],
  22984.                 m: date.getUTCMonth() + 1,
  22985.                 M: dates[language].monthsShort[date.getUTCMonth()],
  22986.                 MM: dates[language].months[date.getUTCMonth()],
  22987.                 yy: date.getUTCFullYear().toString().substring(2),
  22988.                 yyyy: date.getUTCFullYear()
  22989.             };
  22990.             val.dd = (val.d < 10 ? '0' : '') + val.d;
  22991.             val.mm = (val.m < 10 ? '0' : '') + val.m;
  22992.             date = [];
  22993.             var seps = $.extend([], format.separators);
  22994.             for (var i=0, cnt = format.parts.length; i <= cnt; i++){
  22995.                 if (seps.length)
  22996.                     date.push(seps.shift());
  22997.                 date.push(val[format.parts[i]]);
  22998.             }
  22999.             return date.join('');
  23000.         },
  23001.         headTemplate: '<thead>'+
  23002.                             '<tr>'+
  23003.                                 '<th class="prev">&laquo;</th>'+
  23004.                                 '<th colspan="5" class="datepicker-switch"></th>'+
  23005.                                 '<th class="next">&raquo;</th>'+
  23006.                             '</tr>'+
  23007.                         '</thead>',
  23008.         contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
  23009.         footTemplate: '<tfoot>'+
  23010.                             '<tr>'+
  23011.                                 '<th colspan="7" class="today"></th>'+
  23012.                             '</tr>'+
  23013.                             '<tr>'+
  23014.                                 '<th colspan="7" class="clear"></th>'+
  23015.                             '</tr>'+
  23016.                         '</tfoot>'
  23017.     };
  23018.     DPGlobal.template = '<div class="datepicker">'+
  23019.                             '<div class="datepicker-days">'+
  23020.                                 '<table class=" table-condensed">'+
  23021.                                     DPGlobal.headTemplate+
  23022.                                     '<tbody></tbody>'+
  23023.                                     DPGlobal.footTemplate+
  23024.                                 '</table>'+
  23025.                             '</div>'+
  23026.                             '<div class="datepicker-months">'+
  23027.                                 '<table class="table-condensed">'+
  23028.                                     DPGlobal.headTemplate+
  23029.                                     DPGlobal.contTemplate+
  23030.                                     DPGlobal.footTemplate+
  23031.                                 '</table>'+
  23032.                             '</div>'+
  23033.                             '<div class="datepicker-years">'+
  23034.                                 '<table class="table-condensed">'+
  23035.                                     DPGlobal.headTemplate+
  23036.                                     DPGlobal.contTemplate+
  23037.                                     DPGlobal.footTemplate+
  23038.                                 '</table>'+
  23039.                             '</div>'+
  23040.                         '</div>';
  23041.  
  23042.     $.fn.datepicker.DPGlobal = DPGlobal;
  23043.  
  23044.  
  23045.     /* DATEPICKER NO CONFLICT
  23046.     * =================== */
  23047.  
  23048.     $.fn.datepicker.noConflict = function(){
  23049.         $.fn.datepicker = old;
  23050.         return this;
  23051.     };
  23052.  
  23053.  
  23054.     /* DATEPICKER DATA-API
  23055.     * ================== */
  23056.  
  23057.     $(document).on(
  23058.         'focus.datepicker.data-api click.datepicker.data-api',
  23059.         '[data-provide="datepicker"]',
  23060.         function(e){
  23061.             var $this = $(this);
  23062.             if ($this.data('datepicker'))
  23063.                 return;
  23064.             e.preventDefault();
  23065.             // component click requires us to explicitly show it
  23066.             $this.datepicker('show');
  23067.         }
  23068.     );
  23069.     $(function(){
  23070.         $('[data-provide="datepicker-inline"]').datepicker();
  23071.     });
  23072.  
  23073. }(window.jQuery));
  23074. ;/**
  23075.  * German translation for bootstrap-datepicker
  23076.  * Sam Zurcher <[email protected]>
  23077.  */
  23078. ;(function($){
  23079.     $.fn.datepicker.dates['de'] = {
  23080.         days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
  23081.         daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
  23082.         daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
  23083.         months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
  23084.         monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
  23085.         today: "Heute",
  23086.         clear: "Löschen",
  23087.         weekStart: 1,
  23088.         format: "dd.mm.yyyy"
  23089.     };
  23090. }(jQuery));
  23091. ;var openinghours = (function () {
  23092.     var my = {};
  23093.  
  23094.     var _days = {
  23095.         'mo': 'Montag',
  23096.         'di': 'Dienstag',
  23097.         'mi': 'Mittwoch',
  23098.         'do': 'Donnerstag',
  23099.         'fr': 'Freitag',
  23100.         'sa': 'Samstag',
  23101.         'so': 'Sonntag'
  23102.     };
  23103.  
  23104.     var _index = 1;
  23105.  
  23106.     my.parse = function (element, options) {
  23107.         var val = $(element).val(), found = [], i, line, d, d2, matches, time, hours, t, foundDay, foundTime, regEx;
  23108.  
  23109.         // each line is one statement
  23110.         val = val.toLowerCase().split("\n");
  23111.         for (i = 0; i < val.length; i++) {
  23112.             time = '';
  23113.             line = val[i];
  23114.             foundDay = false;
  23115.             foundTime = false;
  23116.  
  23117.             // find start day
  23118.             for (d in _days) {
  23119.                 regEx = new RegExp('^\\s*(' + d + '|' + _days[d] + ')\\s*([:-])', 'i');
  23120.                 if (matches = line.match(regEx)) {
  23121.                     time += _days[d];
  23122.                     foundDay = true;
  23123.  
  23124.                     // second day required
  23125.                     if (matches[2] == '-') {
  23126.                         for (d2 in _days) {
  23127.                             if (d2 == d) {
  23128.                                 // makes no sense
  23129.                                 continue;
  23130.                             }
  23131.                             regEx = new RegExp('-\\s*(' + d2 + '|' + _days[d2] + ')\\s*:', 'i');
  23132.                             if (matches = line.match(regEx)) {
  23133.                                 time += ' - ' + _days[d2];
  23134.                             }
  23135.                         }
  23136.                     }
  23137.                 }
  23138.             }
  23139.  
  23140.             hours = [];
  23141.             regEx = /[:,]\s*(\d\d?)(?::(\d\d?))?-(\d\d?)(?::(\d\d?))?/g;
  23142.             while (matches = regEx.exec(line)) {
  23143.                 t = (matches[1].length < 2 ? '0' : '') + matches[1] + ':';
  23144.                 if (matches[2]) {
  23145.                     t += (matches[2].length < 2 ? '0' : '') + matches[2];
  23146.                 } else {
  23147.                     t += '00';
  23148.                 }
  23149.                 t += ' - ' + (matches[3].length < 2 ? '0' : '') + matches[3] + ':';
  23150.                 if (matches[4]) {
  23151.                     t += (matches[4].length < 2 ? '0' : '') + matches[4];
  23152.                 } else {
  23153.                     t += '00';
  23154.                 }
  23155.                 hours.push(t);
  23156.                 foundTime = true;
  23157.             }
  23158.  
  23159.             // other
  23160.             if (line.match(/\D:\s*(Ruhe|geschl)/i)) {
  23161.                 hours.push('geschlossen');
  23162.                 foundTime = true;
  23163.             }
  23164.  
  23165.             if (foundDay && foundTime) {
  23166.                 time += ': ' + hours.join(', ');
  23167.                 found.push(time);
  23168.             }
  23169.         }
  23170.  
  23171.         if (found == '') {
  23172.             $(options.static).html("<br /><strong class='text-danger'>Ungültige Öffnungszeiten. Bitte tragen Sie ihre Öffnungszeiten im richtigen Format ein.</span>");
  23173.             return ""
  23174.         }
  23175.  
  23176.         $(options.static).html(found.join("<br>"));
  23177.         $(options.hidden).val(found.join("\n"));
  23178.     };
  23179.  
  23180.     my.addSameDay = function ($element) {
  23181.         var $row = $element.parent().parent().parent();
  23182.         var weekDayTo = $('[name="weekDayTo[]"]', $row);
  23183.  
  23184.         if (weekDayTo.val() > 0) {
  23185.             return;
  23186.         }
  23187.  
  23188.         var value = $element.val();
  23189.         weekDayTo.val(value);
  23190.     };
  23191.  
  23192.     my.addOpeningHours = function (id, index) {
  23193.         if (index > _index) {
  23194.             _index = index;
  23195.         } else {
  23196.             _index++;
  23197.         }
  23198.  
  23199.         var $newRow = $('#' + id + ' .rowFirst').clone();
  23200.  
  23201.         $newRow.attr("id", "openingHoursRow" + _index);
  23202.         $newRow.addClass('rowNext').removeClass('rowFirst').hide().appendTo($('#' + id)).slideDown(200);
  23203.         $('input, select', $newRow).val('');
  23204.     };
  23205.  
  23206.     my.removeOpeningHours = function ($btn) {
  23207.         var $row = $btn.parent().parent();
  23208.         if ($row.hasClass('rowFirst')) {
  23209.             $('input, select', $row).val('');
  23210.         } else {
  23211.             $row.slideUp(200, function () {
  23212.                 $row.remove();
  23213.             });
  23214.         }
  23215.     };
  23216.  
  23217.     return my;
  23218. }());;var autocomplete = (function() {
  23219.     var my = {};
  23220.  
  23221.     my.start = function(url, config) {
  23222.         var term = $(config.element).val();
  23223.         if (term.length >= (config.threshold || 2)) {
  23224.             $.ajax(url, {
  23225.                 data: { term: term },
  23226.                 success: function(data) {
  23227.                     my.onServerResponse(config, data);
  23228.                 }
  23229.             });
  23230.         } else {
  23231.             $(config.element).next('.autocomplete').hide();
  23232.         }
  23233.     };
  23234.  
  23235.     my.onServerResponse = function(config, data) {
  23236.         var html = [], z, key;
  23237.  
  23238.         if (data.length) {
  23239.             for (z = 0; z < data.length; z++) {
  23240.                 if (typeof data[z].key !== 'undefined') {
  23241.                     key = data[z].key;
  23242.                 } else {
  23243.                     key = z;
  23244.                 }
  23245.                 html.push('<div class="autocomplete-pick" data-key="' + key + '" data-value="' + data[z].value + '">' + data[z].display + '</div>');
  23246.             }
  23247.         } else {
  23248.             for (z in data) {
  23249.                 var extra_data = '', extra;
  23250.                 for (extra in data[z]) {
  23251.                     if (extra !== 'value' && extra !== 'display') {
  23252.                         extra_data += ' data-' + extra + '="' + data[z][extra] + '"';
  23253.                     }
  23254.                 }
  23255.                 html.push('<div class="autocomplete-pick ' + config.pickClass + '" data-key="' + z + '" data-value="' + data[z].value + '"' + extra_data + '>' + data[z].display + '</div>');
  23256.             }
  23257.         }
  23258.  
  23259.         // nothing found
  23260.         if (html.length == 0) {
  23261.             html.push('Keine Übereinstimmung gefunden');
  23262.         }
  23263.  
  23264.         var $thing = $(config.element).next('.autocomplete'), width = $thing.data('width'), $parent;
  23265.         if (!width) {
  23266.             $parent = $thing.parent();
  23267.             width = $parent.css('width').replace('px', '');
  23268.             width -= $parent.css('padding-left').replace('px', '');
  23269.             width -= $parent.css('padding-right').replace('px', '');
  23270.             $thing.data('width', width);
  23271.         }
  23272.         $thing.html(html.join('')).css('width', (width) + 'px').show();
  23273.  
  23274.         $('.autocomplete-pick', $thing).click(function() {
  23275.             $thing.hide();
  23276.             config.onPick(this);
  23277.         });
  23278.     };
  23279.  
  23280.     return my;
  23281. }());
  23282.  
  23283. var autocompleteDropDown = (function() {
  23284.     var my = {};
  23285.  
  23286.     my.start = function(url, config, id) {
  23287.         var term = $(config.element).val();
  23288.         if (term.length >= (config.threshold || 2)) {
  23289.             $.ajax(url, {
  23290.                 data: { term: term },
  23291.                 success: function(data) {
  23292.                     my.onServerResponse(data, id);
  23293.                 }
  23294.             });
  23295.         }
  23296.     };
  23297.  
  23298.     my.onServerResponse = function(data, id) {
  23299.         var html = [], z, lastCity = '', townVal = null;
  23300.  
  23301.         if (data.length) {
  23302.             for (z = 0; z < data.length; z++) {
  23303.                 if (lastCity != data[z].value) {
  23304.                     html.push('<option value="' + data[z].value + '">' + data[z].value + '</option>');
  23305.                 }
  23306.                 lastCity = data[z].value;
  23307.             }
  23308.         } else {
  23309.             for (z in data) {
  23310.                 if (lastCity != data[z].display) {
  23311.                     html.push('<option value="' + data[z].display + '">' + data[z].display + '</option>');
  23312.                 }
  23313.                 lastCity = data[z].display;
  23314.             }
  23315.         }
  23316.  
  23317.         var $thing = $('#' + id);
  23318.  
  23319.         // nothing found
  23320.         if (html.length == 0) {
  23321.             html.push('<option value="">Keine Übereinstimmung gefunden</option>');
  23322.             $thing.html(html.join(''));
  23323.         } else {
  23324.             // edit form -> preselect old town
  23325.             if ($thing.val()) {
  23326.                 townVal = $thing.val();
  23327.             }
  23328.  
  23329.             $thing.html(html.join(''));
  23330.             $thing.prepend('<option value="">Bitte wählen Sie eine Stadt aus.</option>');
  23331.  
  23332.             if (townVal) {
  23333.                 $preSelectedOption = $('#' + id + ' option[value="' + townVal + '"]');
  23334.             } else {
  23335.                 if (html.length == 1) {
  23336.                     $preSelectedOption = $($('#' + id + ' option').get(1));
  23337.                 } else {
  23338.                     $preSelectedOption = $($('#' + id + ' option').get(0));
  23339.                 }
  23340.             }
  23341.             $preSelectedOption.attr('selected', 'selected').change();
  23342.             $preSelectedOption.attr("rel");
  23343.         }
  23344.     };
  23345.  
  23346.     return my;
  23347. }());;var Products = (function ($, window) {
  23348.     var my = {}, delUrl = '/user/productDelete';
  23349.  
  23350.     my.create = function (cid, showDialog) {
  23351.         if (!showDialog) {
  23352.             $('#manageProducts').hide();
  23353.         }
  23354.  
  23355.         $.get('/user/createProductRequired', {'cid': cid, 'showDialog': +showDialog}, function (html) {
  23356.             $("html, body").animate({scrollTop: 0}, "slow");
  23357.             $('#productFormContainer').html(html).slideDown(300);
  23358.         });
  23359.     };
  23360.  
  23361.     my.edit = function (cid, pid, showDialog) {
  23362.         if (!showDialog) {
  23363.             $('#manageProducts').hide();
  23364.         }
  23365.         $.get('/user/editProductRequired', {'cid': cid, 'pid': pid, 'showDialog': +showDialog}, function (html) {
  23366.             $("html, body").animate({scrollTop: 0}, "slow");
  23367.             $('#productFormContainer').html(html).slideDown(300);
  23368.         });
  23369.     };
  23370.  
  23371.     my.editAdditional = function (cid, pid, showDialog) {
  23372.         var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  23373.         var formData = new FormData($form[0]);
  23374.  
  23375.         $.ajax({
  23376.             url: '/user/editProductRequired',
  23377.             type: 'POST',
  23378.             data: formData,
  23379.             async: false,
  23380.             cache: false,
  23381.             contentType: false,
  23382.             processData: false,
  23383.             success: function (d) {
  23384.                 $btn.enableButton(t, d.status == 'ok');
  23385.  
  23386.                 if (d.status == 'ok') {
  23387.                     pid = d.productId;
  23388.                     if (!showDialog) {
  23389.                         $('#manageProducts').hide();
  23390.                     }
  23391.  
  23392.                     $.get('/user/editProductAdditional', {
  23393.                         'cid': cid,
  23394.                         'pid': pid,
  23395.                         'showDialog': +showDialog
  23396.                     }, function (html) {
  23397.                         $("html, body").animate({scrollTop: 0}, "slow");
  23398.                         $('#productFormContainer').html(html).slideDown(300);
  23399.                     });
  23400.                 } else {
  23401.                 }
  23402.             }
  23403.         });
  23404.         outputFlashSession();
  23405.     };
  23406.  
  23407.     my.saveAdditional = function () {
  23408.         var $form = $('#companyProductForm'), $btn = $('button[type=submit]', $form), t = $btn.text();
  23409.         var formData = new FormData($form[0]);
  23410.  
  23411.         $.ajax({
  23412.             url: '/user/editProductAdditional',
  23413.             type: 'POST',
  23414.             data: formData,
  23415.             async: false,
  23416.             cache: false,
  23417.             contentType: false,
  23418.             processData: false,
  23419.             success: function (d) {
  23420.                 $btn.enableButton(t, d.status == 'ok');
  23421.                 if (d.status == 'ok') {
  23422.                     window.location.href = d.redirect;
  23423.                 }
  23424.             }
  23425.         });
  23426.         outputFlashSession();
  23427.     };
  23428.  
  23429.     my.del = function (pid, confirmText) {
  23430.         if (confirm(confirmText)) {
  23431.             $.post(delUrl, {'pid': pid}, function () {
  23432.                 window.location.reload();
  23433.             })
  23434.         }
  23435.     };
  23436.  
  23437.     return my;
  23438. }(jQuery, window));
  23439.  
  23440. var Profile = (function ($) {
  23441.     var my = {};
  23442.  
  23443.     my.updateOption = function (element) {
  23444.         var $el = $(element);
  23445.  
  23446.         $.get('/user/profileOption', {o: $el.attr('name'), v: +$el.is(':checked')}, function (d) {
  23447.             var $ok = $('<span class="text-success"><i class="fa fa-check" aria-hidden="true"></i>gespeichert</span>').hide();
  23448.             $el.parent().append($ok);
  23449.             $ok.fadeIn();
  23450.             window.setTimeout(function () {
  23451.                 $ok.fadeOut()
  23452.             }, 2000);
  23453.         });
  23454.     };
  23455.  
  23456.     my.removeProfileImage = function () {
  23457.         $.get('/user/deleteProfile', {}, function (d) {
  23458.                 if (d.status === 'ok') {
  23459.                     $('#profileImage').remove();
  23460.                     $('#profileImageRemoveButton').remove();
  23461.                     $('#profileImagePlaceholder').show();
  23462.  
  23463.                     autoResizePlaceholderImage();
  23464.                 }
  23465.             outputFlashSession();
  23466.             }
  23467.         );
  23468.  
  23469.     };
  23470.  
  23471.     return my;
  23472. }(jQuery));;/**
  23473.  * Global container for payment actions.
  23474.  */
  23475. var Payment = (function (window, document, $, my) {
  23476.     var step, progress = 0, callbacks = {
  23477.         nextStep: null,
  23478.         progress: null,
  23479.         confirm: null
  23480.     };
  23481.  
  23482.     my.data = {
  23483.         config: {'url': '', 'requests': {}},
  23484.         transaction: {'info': {}, 'order': ''}
  23485.     };
  23486.  
  23487.     my.registerCallback = function (key, callback) {
  23488.         callbacks[key] = callback;
  23489.     };
  23490.  
  23491.     my.init = function () {
  23492.         if (typeof PaymentConfig == 'undefined') {
  23493.             return;
  23494.         }
  23495.  
  23496.         my.data.config = PaymentConfig;
  23497.  
  23498.         if (PaymentData && PaymentData.order) {
  23499.             my.data.transaction.order = PaymentData.order;
  23500.             my.return.process(PaymentData);
  23501.         }
  23502.  
  23503.         window.setTimeout(function () {
  23504.             nextStep('init');
  23505.         }, 500);
  23506.     };
  23507.  
  23508.     my.fancyInOut = function ($out, $in) {
  23509.         $out.slideUp(300, function () {
  23510.             $in.slideDown(300);
  23511.         });
  23512.     };
  23513.  
  23514.     function nextStep(key) {
  23515.         var nextStep = my.moveToStep(key, true);
  23516.  
  23517.         $('.step-' + nextStep + '-progress div').addClass('btn-danger');
  23518.         $('.step-' + nextStep + '-progress div').removeClass('btn-default');
  23519.         $('.step-' + nextStep + '-progress div').removeClass('no-button');
  23520.         if (key == 'toConfirm') {
  23521.             $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToConfirm()");
  23522.         } else {
  23523.             $('.step-' + nextStep + '-progress div').attr("onclick", "Payment.moveToStep('" + key + "', false)");
  23524.         }
  23525.  
  23526.  
  23527.         if (typeof callbacks.progress == 'function') {
  23528.             progress = callbacks.progress(step, progress);
  23529.             $('#paymentProgress').css('width', progress + '%');
  23530.         }
  23531.     }
  23532.  
  23533.     my.moveToStep = function (key, returnNextStep) {
  23534.         var nextStep, previousStep = step;
  23535.  
  23536.         if (typeof callbacks.nextStep == 'function') {
  23537.             nextStep = callbacks.nextStep(key, step);
  23538.         }
  23539.  
  23540.         if (nextStep) {
  23541.             step = nextStep;
  23542.         }
  23543.  
  23544.         if (!previousStep || previousStep == nextStep) {
  23545.             $('.step-' + nextStep).show();
  23546.         } else {
  23547.             my.fancyInOut($('.step-' + previousStep), $('.step-' + step));
  23548.         }
  23549.  
  23550.         if (returnNextStep == true) {
  23551.             return nextStep;
  23552.         }
  23553.     };
  23554.  
  23555.     my.productSelect = function (form) {
  23556.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23557.         $btn.disableButton(t);
  23558.  
  23559.         $.post(my.data.config.url + '/productSelect', {'pid': $('#productId').val()}, function (d) {
  23560.             $btn.enableButton(t);
  23561.  
  23562.             if (d.status == 'ok') {
  23563.                 my.data.transaction = d;
  23564.                 nextStep('product');
  23565.             }
  23566.         });
  23567.     };
  23568.  
  23569.     my.register = function (form, id, showClaims) {
  23570.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23571.         $btn.disableButton(t);
  23572.  
  23573.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23574.         data.push({'name': 'showClaims', 'value': showClaims});
  23575.         $.post(my.data.config.url + '/register', data, function (d) {
  23576.             $btn.enableButton(t);
  23577.  
  23578.             if (d.status == 'ok') {
  23579.                 my.data.transaction = d;
  23580.                 $('.form-login-actions').hide();
  23581.                 $('#' + id).slideDown();
  23582.             }
  23583.         });
  23584.     };
  23585.  
  23586.     my.login = function (userId, id, showClaims) {
  23587.         $.post(my.data.config.url + '/login', {
  23588.             'uid': userId,
  23589.             'order': my.data.transaction.order,
  23590.             'showClaims': showClaims
  23591.         }, function (d) {
  23592.             if (d.status == 'ok') {
  23593.                 my.data.transaction = d;
  23594.                 $('#' + id).slideDown();
  23595.             }
  23596.         });
  23597.     };
  23598.  
  23599.     my.checkAvailability = function (data, $btn) {
  23600.         var t = $btn.html();
  23601.         $btn.disableButton(t);
  23602.         $.post(my.data.config.url + '/checkAvailability', data, function (d) {
  23603.             $btn.enableButton(t);
  23604.  
  23605.             if (d.status == 'ok') {
  23606.                 $('#packageConfigAvailable').show();
  23607.                 $('#packageConfigSubmitContainer').slideDown();
  23608.                 $btn.hide();
  23609.             } else {
  23610.                 $('#packageConfigNotAvailable').show();
  23611.             }
  23612.         });
  23613.  
  23614.     };
  23615.  
  23616.     my.productConfig = function (form) {
  23617.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23618.         $btn.disableButton(t);
  23619.  
  23620.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23621.  
  23622.         $.post(my.data.config.url + '/productConfig', data, function (d) {
  23623.             if (form != null) {
  23624.                 $btn.enableButton(t);
  23625.             }
  23626.  
  23627.             if (d.status == 'ok') {
  23628.                 my.data.transaction = d;
  23629.                 nextStep('productConfig');
  23630.             }
  23631.         });
  23632.     };
  23633.  
  23634.     my.companySelected = function (companyId, btn, form) {
  23635.         var $btn = $(btn), t = $btn.html(), data = [];
  23636.         $btn.disableButton(t);
  23637.  
  23638.         if (form) {
  23639.             var $form = $(form);
  23640.             data = $form.serializeArray();
  23641.         }
  23642.         data.push({'name': 'cid', 'value': companyId});
  23643.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23644.  
  23645.         $.post(my.data.config.url + '/addCompany', data, function (d) {
  23646.             $btn.enableButton(t);
  23647.  
  23648.             if (d.status == 'ok') {
  23649.                 my.data.transaction = d;
  23650.                 nextStep('company');
  23651.             }
  23652.             if (form) {
  23653.                 return false;
  23654.             }
  23655.         });
  23656.     };
  23657.  
  23658.     my.customerData = function (form) {
  23659.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23660.         $btn.disableButton(t);
  23661.  
  23662.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23663.  
  23664.         $.post(my.data.config.url + '/customerData', data, function (d) {
  23665.             $btn.enableButton(t);
  23666.  
  23667.             if (d.status == 'ok') {
  23668.                 my.data.transaction = d;
  23669.                 nextStep('customer');
  23670.             }
  23671.         });
  23672.     };
  23673.  
  23674.     my.moveToConfirm = function () {
  23675.         var html = '', val, pt = my.data.config.paymentText;
  23676.         for (var key in my.data.transaction.info.payment) {
  23677.             val = my.data.transaction.info.payment[key];
  23678.             html += '<div class="row"><div class="col-xs-6 bold">' + pt[key] + '</div>';
  23679.             html += '<div class="col-xs-6">' + (pt[val] ? pt[val] : val) + '</div></div>';
  23680.         }
  23681.         $('#confirmPayment').html(html);
  23682.  
  23683.         if (typeof callbacks.confirm == 'function') {
  23684.             callbacks.confirm(my.data.transaction.info);
  23685.         }
  23686.  
  23687.         $('#costs').hide();
  23688.         nextStep('toConfirm');
  23689.     };
  23690.  
  23691.     my.confirm = function (form) {
  23692.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html(), data = $form.serializeArray();
  23693.         $btn.disableButton(t);
  23694.  
  23695.         data.push({'name': 'order', 'value': my.data.transaction.order});
  23696.  
  23697.         $.post(my.data.config.url + '/confirm', data, function (d) {
  23698.             $btn.enableButton(t);
  23699.  
  23700.             if (d.status == 'ok') {
  23701.                 my.thanks(d);
  23702.             } else {
  23703.                 if (d.status == 'redirect') {
  23704.                     $('#externalPaymentBtn').click(function () {
  23705.                         $('#externalPaymentBtn').disableButton();
  23706.                         window.location.href = d.url;
  23707.                     });
  23708.                     my.fancyInOut($('.step-' + step), $('.step-external'));
  23709.                 }
  23710.             }
  23711.         });
  23712.     };
  23713.  
  23714.     my.thanks = function (response) {
  23715.         $('#thanksRefNo').text(response.info.referenceNumber);
  23716.         my.fancyInOut($('.step:visible'), $('.step-thanks'));
  23717.         $('#progressBar').hide();
  23718.         $('#invoiceLink').attr('href', $('#invoiceLink').attr('href') + '/' + response.info.referenceNumber);
  23719.     };
  23720.  
  23721.     my.error = function (response) {
  23722.         $('#paymentError').html('FEHLER: ' + response.customermessage);
  23723.     };
  23724.  
  23725.     return my;
  23726. }(window, document, jQuery, Payment || {}));
  23727.  
  23728. /**
  23729.  * Add module return to handle the different cases the user return to the payment process.
  23730.  */
  23731. var Payment = (function ($, parent) {
  23732.     var my = {};
  23733.  
  23734.     my.process = function (data) {
  23735.         if (data.returnType === 'external') {
  23736.             $('.step').hide();
  23737.  
  23738.             if (data.status === 'back') {
  23739.                 externalAbort(data.order);
  23740.             } else {
  23741.                 if (data.status === 'ok') {
  23742.                     externalOk(data.order);
  23743.                 } else {
  23744.                     if (data.status === 'error') {
  23745.                         externalError(data.order);
  23746.                     }
  23747.                 }
  23748.             }
  23749.         }
  23750.     };
  23751.  
  23752.     function externalAbort(order) {
  23753.         $('#restartExternalPaymentBtn').click(function () {
  23754.             var $btn = $(this);
  23755.             $btn.disableButton();
  23756.             $('.step-external-back .info').show();
  23757.  
  23758.             $.post(parent.data.config.url + '/restartExternal', {'order': order}, function (d) {
  23759.                 if (d.status == 'redirect') {
  23760.                     window.location.href = d.url;
  23761.                 } else {
  23762.                     $btn.enableButton(t);
  23763.                 }
  23764.             });
  23765.         });
  23766.         $('.step-external-back').show();
  23767.     }
  23768.  
  23769.     function externalOk(order) {
  23770.         $('.step-external-ok').show();
  23771.         my.checkOrder(order);
  23772.     }
  23773.  
  23774.     my.checkOrder = function (order) {
  23775.         $.post(parent.data.config.url + '/checkOrder', {'order': order}, function (d) {
  23776.             if (d.status == 'ok') {
  23777.                 if (d.isPaid === true) {
  23778.                     // we are done
  23779.                     parent.thanks(d);
  23780.                 } else {
  23781.                     // try again in a few
  23782.                     window.setTimeout(function () {
  23783.                         my.checkOrder(order);
  23784.                     }, 1500);
  23785.                 }
  23786.             }
  23787.         });
  23788.     };
  23789.  
  23790.     function externalError(order) {
  23791.         $('.step-external-error').show();
  23792.     }
  23793.  
  23794.     parent.return = my;
  23795.     return parent;
  23796. }(jQuery, Payment || {}));
  23797.  
  23798. /**
  23799.  * Add module methods to handle the different payment methods.
  23800.  */
  23801. var Payment = (function ($, parent) {
  23802.     var my = {};
  23803.  
  23804.     my.selected = function () {
  23805.         var type = $('#paymentSelect').val();
  23806.         $('.method').hide();
  23807.         $('.method-' + type).show();
  23808.     };
  23809.  
  23810.     function mergeParameters(request, params) {
  23811.         for (var key in parent.data.config.requests[request]) {
  23812.             params[key] = parent.data.config.requests[request][key];
  23813.         }
  23814.  
  23815.         return params;
  23816.     }
  23817.  
  23818.     function addPaymentMethod(type, data, $btn, btnText) {
  23819.         $.post(parent.data.config.url + '/addPaymentMethod', {
  23820.             'type': type,
  23821.             'order': parent.data.transaction.order,
  23822.             'data': data
  23823.         }, function (d) {
  23824.             $btn.enableButton(btnText);
  23825.  
  23826.             if (d.status == 'ok') {
  23827.                 parent.data.transaction = d;
  23828.                 parent.moveToConfirm();
  23829.             }
  23830.         });
  23831.     }
  23832.  
  23833.     my.creditCardCheck = function (form) {
  23834.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23835.         $btn.disableButton();
  23836.  
  23837.         var funcName = 'callbackCreditCardCheck' + Math.ceil(Math.random() * 100000000);
  23838.         window[funcName] = function (response) {
  23839.             $('#response').html(JSON.stringify(response, null, 2));
  23840.  
  23841.             if (response.status === 'ERROR') {
  23842.                 $btn.enableButton(t);
  23843.                 my.error(response);
  23844.             } else {
  23845.                 if (response.status === 'VALID') {
  23846.                     // inform server
  23847.                     addPaymentMethod('creditcard', {
  23848.                         'pseudoCardNumber': response.pseudocardpan,
  23849.                         'truncatedCardNumber': response.truncatedcardpan
  23850.                     }, $btn, t);
  23851.                 } else {
  23852.                 }
  23853.             }
  23854.         };
  23855.  
  23856.         var pr = new PayoneRequest(mergeParameters('creditCardCheck', {
  23857.             'cardpan': parseInt($('#ccNumber', $form).val(), 10), // credit card number
  23858.             'cardtype': $('#ccType', $form).val(),
  23859.             'cardexpiredate': parseInt($('#ccExpire', $form).val(), 10),
  23860.             'cardcvc2': parseInt($('#ccCvc', $form).val(), 10),
  23861.             'language': 'de'
  23862.         }), {'callback_function_name': funcName});
  23863.         pr.checkAndStore();
  23864.     };
  23865.  
  23866.     my.paypalCheck = function (form) {
  23867.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23868.         $btn.disableButton();
  23869.  
  23870.         addPaymentMethod('paypal', {}, $btn, t);
  23871.     };
  23872.  
  23873.     my.invoiceCheck = function (form) {
  23874.         var $form = $(form), $btn = $('[type=submit]', $form), t = $btn.html();
  23875.         $btn.disableButton();
  23876.  
  23877.         addPaymentMethod('invoice', {}, $btn, t);
  23878.     };
  23879.  
  23880.     parent.method = my;
  23881.     return parent;
  23882. }(jQuery, Payment || {}));
  23883.  
  23884. Payment.banner = (function ($) {
  23885.     var my = {};
  23886.  
  23887.     my.checkDetailRival = function (url, companyId, boxId, claimId, userId) {
  23888.         $('#' + boxId + 'Advertising').hide();
  23889.         $.get(url + '/checkDetailRival', {'cid': companyId}, function (d) {
  23890.             if (d.status == 'ok') {
  23891.                 $('#' + boxId).addClass('marginBottom17');
  23892.                 $('#' + boxId + 'Container').addClass('marginTop17');
  23893.                 my.getBanner(d.phrase, d.city, boxId, 'detail', 'df', 'leader');
  23894.  
  23895.                 if ((claimId && userId) && (claimId == userId)) {
  23896.                     $('#' + boxId + 'Info').removeClass('hidden');
  23897.                 }
  23898.             } else {
  23899.                 $('#' + boxId + 'Advertising').show();
  23900.             }
  23901.         });
  23902.     };
  23903.  
  23904.     my.getBanner = function (phrase, city, boxId, page, trackInfo, format) {
  23905.         $.getScript('/banner.do?page=' + page + '&sp=' + phrase + '&sl=' + city + '&f=' + format + '&t=' + trackInfo + '&id=' + boxId);
  23906.     };
  23907.  
  23908.     return my;
  23909. }(jQuery));
  23910.  
  23911. jQuery(document).ready(Payment.init);;jQuery(document).ready(function() {
  23912.     $('#searchForm input[name=what]').change(function() {
  23913.         // check the "what" input for validity
  23914.         var $what = $(this), value;
  23915.  
  23916.         // there must be at least one number or one letter
  23917.         value = $what.val().replace(/[^a-z0-9]/ig, '');
  23918.  
  23919.         if (value == '') {
  23920.             this.validity.valid = false;
  23921.             this.setCustomValidity('Sie müssen mindestens einen Buchstaben oder eine Zahl eingeben.');
  23922.         } else {
  23923.             this.validity.valid = true;
  23924.             this.setCustomValidity('');
  23925.         }
  23926.     });
  23927. });
  23928.  
  23929. var Search = (function($) {
  23930.     var my = {};
  23931.  
  23932.     my.searchFilter = function(filterContentId, filterBoxClass, filterHeaderClass) {
  23933.         if (Mobile.isMobile()) {
  23934.             $('#' + filterContentId).removeClass('in');
  23935.             $('.' + filterBoxClass).addClass('panel panel-primary');
  23936.             $('.' + filterBoxClass + ' .' + filterHeaderClass).addClass('panel-heading');
  23937.             $('.' + filterBoxClass + ' h2').addClass('panel-title');
  23938.             $('.' + filterBoxClass + ' h2').removeClass('text-danger');
  23939.             $('.' + filterBoxClass + ' h2 a').removeClass('text-danger');
  23940.             $('.' + filterBoxClass + ' h2 a').html($('.search-filter-box .panel-title a').text() + '  <i class="fa fa-angle-down pull-right" aria-hidden="true"></i>');
  23941.             $('#' + filterContentId + ' .row').removeClass('row');
  23942.         }
  23943.     };
  23944.  
  23945.     return my;
  23946. }(jQuery));;var Social = (function ($) {
  23947.     var my = {}, fbApiInit = false, twApiInit = false;
  23948.  
  23949.     my.loadFacebookSDK = function (facebookAppId) {
  23950.         window.fbAsyncInit = function () {
  23951.             FB.init({appId: facebookAppId, cookie: false, xfbml: true, version: 'v2.1'});
  23952.             fbApiInit = true;
  23953.         };
  23954.  
  23955.         (function (d, s, id) {
  23956.             var js, fjs = d.getElementsByTagName(s)[0];
  23957.             if (d.getElementById(id)) return;
  23958.             js = d.createElement(s);
  23959.             js.id = id;
  23960.             js.src = "//connect.facebook.net/de_DE/sdk.js";
  23961.             fjs.parentNode.insertBefore(js, fjs);
  23962.         }(document, 'script', 'facebook-jssdk'));
  23963.     };
  23964.  
  23965.     my.loadTwitterScript = function () {
  23966.         !function (d, s, id) {
  23967.             var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
  23968.             if (!d.getElementById(id)) {
  23969.                 js = d.createElement(s);
  23970.                 js.id = id;
  23971.                 js.src = p + "://platform.twitter.com/widgets.js";
  23972.                 fjs.parentNode.insertBefore(js, fjs);
  23973.  
  23974.                 twApiInit = true;
  23975.             }
  23976.         }(document, "script", "twitter-wjs");
  23977.  
  23978.     };
  23979.  
  23980.     my.clickToShowFacebook = function (element, facebookAppId) {
  23981.         var $btn = $(element), t = $btn.html();
  23982.         $btn.disableButton(t);
  23983.  
  23984.         my.loadFacebookSDK(facebookAppId);
  23985.  
  23986.         my.fbEnsureInit(function () {
  23987.             $btn.enableButton(t);
  23988.         });
  23989.     };
  23990.  
  23991.     my.fbEnsureInit = function (callback) {
  23992.         if (!fbApiInit) {
  23993.             setTimeout(function () {
  23994.                 my.fbEnsureInit(callback);
  23995.             }, 50);
  23996.         } else {
  23997.             if (callback) {
  23998.                 callback();
  23999.             }
  24000.         }
  24001.     };
  24002.  
  24003.     my.loginByFacebookStep1 = function (element, facebookAppId, fbScope, buttonText) {
  24004.         var $btn = $(element), t = $btn.html();
  24005.         $btn.disableButton(t);
  24006.         my.loadFacebookSDK(facebookAppId);
  24007.         my.fbEnsureInit(function () {
  24008.             $btn.enableButton('<i class="fa fa-facebook-square fa-2x"></i> ' + buttonText);
  24009.             $btn.removeClass('btn-default');
  24010.             $btn.addClass('btn-fb');
  24011.             $btn.attr("onclick", "Social.loginByFacebookStep2(this, '" + fbScope + "')");
  24012.         });
  24013.     };
  24014.  
  24015.     my.loginByFacebookStep2 = function (element, fbScope) {
  24016.         var $btn = $(element), t = $btn.html();
  24017.         $btn.disableButton(t);
  24018.         FB.login(facebookStatusCallback, {scope: fbScope});
  24019.         $btn.enableButton(t);
  24020.     };
  24021.  
  24022.     my.twEnsureInit = function (callback) {
  24023.         if (!twApiInit) {
  24024.             setTimeout(function () {
  24025.                 my.twEnsureInit(callback);
  24026.             }, 50);
  24027.         } else {
  24028.             if (callback) {
  24029.                 callback();
  24030.             }
  24031.         }
  24032.     };
  24033.  
  24034.     my.clickToShowTwitter = function (element) {
  24035.         var $btn = $(element), t = $btn.html();
  24036.         $btn.disableButton(t);
  24037.  
  24038.         my.loadTwitterScript();
  24039.  
  24040.         my.twEnsureInit(function () {
  24041.             $btn.enableButton(t);
  24042.         });
  24043.     };
  24044.  
  24045.     return my;
  24046. }(jQuery));;jQuery(document).ready(function($) {
  24047.     $('[data-track="1"]').each(function() {
  24048.         var el = $(this), url = el.data('track-url');
  24049.  
  24050.         el.click(function() {
  24051.             Tracking.trackYext(url);
  24052.         });
  24053.     })
  24054. }(jQuery));
  24055.  
  24056. var Tracking = (function($) {
  24057.     var my = {};
  24058.  
  24059.     my.trackYext = function(url) {
  24060.         $('body').append('<img src="' + url + '"/>');
  24061.     };
  24062.  
  24063.     return my;
  24064. }(jQuery));;
Add Comment
Please, Sign In to add comment