/*
 *  (c) 2000-2018 deviantART, Inc. All rights reserved.
 */
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){(function(n){n.fn.countdown=function(e){return e=n.extend({},n.fn.countdown.defaults,e),this.each(function(){var t,a=n(this),l=0;if(null!=e.outputElement)t=n(e.outputElement);else{var s=document.createElement("span");t=n(s).addClass(e.className).insertAfter(a)}var i=e.length||a.attr("maxlength"),r=e.minLength,u=e.countWords,o=e.suffix||"";a.on("keyup.countdown change.countdown",function(){var s=0;if(u){var d=a.val();d=d.replace(/\s+__CCW1000\s+/,""),d=d.replace(/<da:(thumb|bigthumb|deviation|embed)[^>]+>/g,"__CCW1000"),d=d.replace(/\s/g," "),d=d.split(" ");for(var g=0;d.length>g;g++){var c=d[g];c&&c.length&&(c=c.replace(/:[a-zA-Z0-9_+#!]+:/g,""),c=c.replace(/[^a-zA-Z0-9_]/g,""),c.match(/__CCW1000/)?s+=1e3:c.length&&s++)}}else s=a.val().length;r&&r>s?(null!=e.hideElement&&n(e.hideElement).show(),s=e.positive?r-s:-(r-s),t.addClass(e.warningClass)):i>0?(s=i-s,e.warningLength>=s?t.addClass(e.warningClass):t.removeClass(e.warningClass),e.textWarningClass&&(1>s?a.addClass(e.textWarningClass):a.removeClass(e.textWarningClass))):(null!=e.hideElement&&n(e.hideElement).hide(),t.removeClass(e.warningClass),e.textWarningClass&&a.removeClass(e.textWarningClass)),s!=l&&(""!=o&&s>1?t.html(s+o+"s"):t.html(s+o),l=s)}).keyup()})},n.fn.countdown.defaults={countWords:!1,length:!1,positive:!1,pluralize:!1,className:"countdown",warningLength:10,minLength:0,warningClass:"countdown-warning",hideElement:null,outputElement:null,textWarningClass:""}})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.countdown.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){(function(a){a.fn.databs=function(t){if("string"==typeof arguments[0]){if(this.length>1){var e=arguments;return this.each(function(){a.fn.databs.apply(a(this),e)})}return a.fn.databs[arguments[0]].apply(this,a.makeArray(arguments).slice(1)||[]),this}var s=a.extend({},a.fn.databs.options,t||{});return this.each(function(){var t=a("."+s.activeClass,this);if(s.enable_location_hash_change&&document.location.hash){var e=a('a.tab[href="'+document.location.hash+'"]');e.length&&(a(s.tabQuery).removeClass(s.activeClass),e.addClass(s.activeClass),t=e)}var i=a(s.tabQuery,this);s.tabsExtraHTML&&i.append(s.tabsExtraHTML);var n={orig:t,activeTabID:t[0].hash,active:a(t[0].hash,s.baseElement)};i.data("tabData",n),i.click(function(a){a.preventDefault(),a.stopPropagation()}),i.mousedown(function(t){t.preventDefault(),t.stopPropagation(),a(this).blur();var e=this.hash;e!=n.activeTabID&&(i.removeClass(s.activeClass),a(this).addClass(s.activeClass),n.active.hide(s.animateSpeed),n.activeTabID=e,n.active=a(e,s.baseElement).show(s.animateSpeed))}),s.hideOnStart&&i.each(function(){this==t[0]?a(this.hash,s.baseElement).show():a(this.hash,s.baseElement).hide()})})},a.fn.databs.options={tabQuery:".tab",activeClass:"activetab",tabsExtraHTML:"<b></b>",animateSpeed:0,hideOnStart:!1,baseElement:!1,enable_location_hash_change:!1}})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.databs.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){jQuery.extend({keys:function(u){var e=[];return jQuery.each(u,function(u){e.push(u)}),e}}),jQuery.extend({values:function(u){var e=[];return jQuery.each(u,function(u,n){e.push(n)}),e}}),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.hashmap.js")});
DWait.ready(["cssms/lib/jquery/jquery.select.pager.css","jms/lib/pager.js","jms/lib/jquery/jquery.current.js","jms/lib/browser.js","jms/lib/popup2.js"],function(){(function(e){function t(t,s,i,d,n){t.text()||"Browse";var o=e('<div class="pager-holder pager-select"><div class="jsid-pager pager2"><div class="page2"></div></div></div>'),r=o.find(".page2");return s.find("option").each(function(){var a=e(this),s=e("<div>"+i.filter(a.html())+"</div>").data("option",a).data("base",t).addClass("option");a.prop("disabled")&&s.addClass("disabled"),a.prop("selected")&&s.addClass("selected"),a.attr("class")&&s.addClass(a.attr("class")),r.append(s)}),r.find("div.option").bind("mouseover",function(){e(this).addClass("hover")}).bind("mouseleave",function(){e(this).removeClass("hover")}).click(a),popup=new Popup2("selectPager"+n,"body",{classes:i.className,content:o.get(0),created:function(){Browser.isIE8||this.$node.css("border-bottom-left-radius","5px").css("border-bottom-right-radius","5px"),d&&this.$node.css("position","fixed");var t=this.$node.find("div.option"),a=Math.min(t.length*(t.height()+2*(i.optionPadding||7)),Math.max(200,e(window).height()-150));d&&(a=Math.min(a,e(window).height()-(this.$node.offset().top-e(window).scrollTop()))),this.$node.height(Math.min(a,i.maxHeight))},hidden:function(){t.removeClass("active")},shown:function(){t.removeClass("active")}})}function a(t){t.preventDefault(),t.stopPropagation();var a=e(this),i=a.data("option"),d=a.data("base");i.attr("disabled")||(a.siblings(".selected").removeClass("selected"),a.addClass("selected"),i.parent().val(i.val()).change(),s(i,d.find(".text"),d.data("options")),Popup2.hideAll())}function s(e,t,a){t.attr("class","text").addClass(e.attr("class")).html(a.filter(e.html()))}var t,a,i=0;e.fn.selectpager=function(a){return a=e.extend({},e.fn.selectpager.defaults,a),this.each(function(){if(i++,"SELECT"!=!this.tagName&&!this.getAttribute("no_custom_select")){var d=e(this),n=d.data("select_pager");if(n&&n.remove(),!(d.children().length>a.maxLength)){d.hide();var o=e("<div>").addClass(a.className);if(a.setID){var r;(r=d.attr("id")||d.attr("name"))&&o.attr("id",r+"-pager")}d.attr("disabled")&&o.addClass("select_pager_disabled"),d.data("select_pager",o);var l;o.data("options",a).append('<span class="text">Nothing selected...</span>').append('<div class="button">').insertAfter(d).bind("mouseover",function(){o.addClass("hover")}).bind("mouseleave",function(){o.removeClass("hover")});var p=e(document.body).hasClass("modal-active");l||(l=t(o,d,a,p,i),o.data("menu",l)),o.click(function(t){t.preventDefault(),t.stopPropagation(),d.attr("disabled")||(l.render(),l.show(l.position(e(this),{bump:{left:a.bumpLeft,top:a.bumpTop},fixedElem:p})))});var c=d.find("option").eq(d.prop("selectedIndex"));s(c,o.find(".text"),a)}}})},e.fn.selectpager.defaults={className:"select_pager",filter:function(e){return e&&e.replace(/ \*$/,"")||""},maxLength:60,maxHeight:800,setID:!1,bumpLeft:-1,bumpTop:-1}})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.select.pager.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)})(function(e){function t(t){var l,i=t||window.event,s=[].slice.call(arguments,1),u=0,h=0,a=0,r=0,d=0;return t=e.event.fix(i),t.type="mousewheel",i.wheelDelta&&(u=i.wheelDelta),i.detail&&(u=-1*i.detail),i.deltaY&&(a=-1*i.deltaY,u=a),i.deltaX&&(h=i.deltaX,u=-1*h),void 0!==i.wheelDeltaY&&(a=i.wheelDeltaY),void 0!==i.wheelDeltaX&&(h=-1*i.wheelDeltaX),r=Math.abs(u),(!n||n>r)&&(n=r),d=Math.max(Math.abs(a),Math.abs(h)),(!o||o>d)&&(o=d),l=u>0?"floor":"ceil",u=Math[l](u/n),h=Math[l](h/o),a=Math[l](a/o),s.unshift(t,u,h,a),(e.event.dispatch||e.event.handle).apply(this,s)}var n,o,l=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(e.event.fixHooks)for(var s=l.length;s;)e.event.fixHooks[l[--s]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=i.length;e;)this.addEventListener(i[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=i.length;e;)this.removeEventListener(i[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.mousewheel.js")});
DWait.ready(["jms/lib/jquery/plugins/jquery.mousewheel.js","jms/lib/jquery/jquery.current.js"],function(){(function(e){e.fn.extend({noleakyscroll:function(n){var t={leak_when_noscrollbar:!1};return n=e.extend(t,n),this.each(function(){var t=e(this);t.bind("mousewheel",function(t,i){n.leak_when_noscrollbar&&e(this).get(0).clientHeight>=e(this).get(0).scrollHeight||(i>0&&0==e(this).scrollTop()||0>i&&e(this).scrollTop()==e(this).get(0).scrollHeight-e(this).innerHeight())&&t.preventDefault()})})}})})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.noleakyscroll.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js","jms/lib/difi.js"],function(){(function(i){var e={textarea:void 0,classname:"previewcontainer",active_text:"Edit",difi_call:["Comments","preview"],difi_args:[0],render:function(i,e){i.html(e).prepend("<strong>Preview:</strong><br>")}};i.fn.previewer=function(r){return r=i.extend(e,r),this.each(function(){var e=i(this);if(e.is("a.smbutton"))var t=function(i){e.find("span").text(i)},n=e.find("span").text();else var t=function(i){e.val(i)},n=e.val();var s=r.textarea;i.isFunction(s)&&(s=s.call(this)),"string"==typeof s&&(s=i(s));var a;a=s.siblings("."+r.classname).length?s.siblings("."+r.classname):i("<div></div>").addClass(r.classname).hide().insertBefore(s),e.on({"show.preview":function(){a.html("...").css({cursor:"wait",width:s.outerWidth()-10}).show(),a.siblings(".ccwriter-wrapper").length?a.siblings(".ccwriter-wrapper").hide():s.hide(),t(r.active_text);var e=[s.val()];r.difi_args&&i.merge(e,r.difi_args),DiFi.pushPost(r.difi_call[0],r.difi_call[1],e,function(i,e){return i?(a.css("cursor","default"),r.render(a,e.response.content),void 0):alert("A problem occurred")}),DiFi.send()},"hide.preview":function(){a.hide().empty(),a.siblings(".ccwriter-wrapper").length?a.siblings(".ccwriter-wrapper").show():s.show(),t(n)},"click.preview":function(){e.trigger(a.is(":visible")?"hide":"show")}})})}})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.previewer.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){(function(t){function e(t){if(t in p.style)return t;var e=["Moz","Webkit","O","ms"],n=t.charAt(0).toUpperCase()+t.substr(1);if(t in p.style)return t;for(var i=0;e.length>i;++i){var r=e[i]+n;if(r in p.style)return r}}function n(){return p.style[l.transform]="",p.style[l.transform]="rotateY(90deg)",""!==p.style[l.transform]}function i(t){return"string"==typeof t&&this.parse(t),this}function r(t,e,n){e===!0?t.queue(n):e?t.queue(e,n):n()}function s(e){var n=[];return t.each(e,function(e){e=t.camelCase(e),e=t.transit.propertyMap[e]||t.cssProps[e]||e,e=u(e),-1===t.inArray(e,n)&&n.push(e)}),n}function a(e,n,i,r){var a=s(e);t.cssEase[i]&&(i=t.cssEase[i]);var o=""+f(n)+" "+i;parseInt(r,10)>0&&(o+=" "+f(r));var u=[];return t.each(a,function(t,e){u.push(e+" "+o)}),u.join(", ")}function o(e,n){n||(t.cssNumber[e]=!0),t.transit.propertyMap[e]=l.transform,t.cssHooks[e]={get:function(n){var i=t(n).css("transit:transform");return i.get(e)},set:function(n,i){var r=t(n).css("transit:transform");r.setFromString(e,i),t(n).css({"transit:transform":r})}}}function u(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function c(t,e){return"string"!=typeof t||t.match(/^[\-0-9\.]+$/)?""+t+e:t}function f(e){var n=e;return t.fx.speeds[n]&&(n=t.fx.speeds[n]),c(n,"ms")}t.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var p=document.createElement("div"),l={},d=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;l.transition=e("transition"),l.transitionDelay=e("transitionDelay"),l.transform=e("transform"),l.transformOrigin=e("transformOrigin"),l.transform3d=n();var h={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"},b=l.transitionEnd=h[l.transition]||null;for(var g in l)l.hasOwnProperty(g)&&t.support[g]===void 0&&(t.support[g]=l[g]);p=null,t.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"},t.cssHooks["transit:transform"]={get:function(e){return t(e).data("transform")||new i},set:function(e,n){var r=n;r instanceof i||(r=new i(r)),e.style[l.transform]="WebkitTransform"!==l.transform||d?""+r:r.toString(!0),t(e).data("transform",r)}},t.cssHooks.transform={set:t.cssHooks["transit:transform"].set},"1.8">t.fn.jquery&&(t.cssHooks.transformOrigin={get:function(t){return t.style[l.transformOrigin]},set:function(t,e){t.style[l.transformOrigin]=e}},t.cssHooks.transition={get:function(t){return t.style[l.transition]},set:function(t,e){t.style[l.transition]=e}}),o("scale"),o("translate"),o("rotate"),o("rotateX"),o("rotateY"),o("rotate3d"),o("perspective"),o("skewX"),o("skewY"),o("x",!0),o("y",!0),i.prototype={setFromString:function(t,e){var n="string"==typeof e?e.split(","):e.constructor===Array?e:[e];n.unshift(t),i.prototype.set.apply(this,n)},set:function(t){var e=Array.prototype.slice.apply(arguments,[1]);this.setter[t]?this.setter[t].apply(this,e):this[t]=e.join(",")},get:function(t){return this.getter[t]?this.getter[t].apply(this):this[t]||0},setter:{rotate:function(t){this.rotate=c(t,"deg")},rotateX:function(t){this.rotateX=c(t,"deg")},rotateY:function(t){this.rotateY=c(t,"deg")},scale:function(t,e){void 0===e&&(e=t),this.scale=t+","+e},skewX:function(t){this.skewX=c(t,"deg")},skewY:function(t){this.skewY=c(t,"deg")},perspective:function(t){this.perspective=c(t,"px")},x:function(t){this.set("translate",t,null)},y:function(t){this.set("translate",null,t)},translate:function(t,e){void 0===this._translateX&&(this._translateX=0),void 0===this._translateY&&(this._translateY=0),null!==t&&void 0!==t&&(this._translateX=c(t,"px")),null!==e&&void 0!==e&&(this._translateY=c(e,"px")),this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var t=(this.scale||"1,1").split(",");return t[0]&&(t[0]=parseFloat(t[0])),t[1]&&(t[1]=parseFloat(t[1])),t[0]===t[1]?t[0]:t},rotate3d:function(){for(var t=(this.rotate3d||"0,0,0,0deg").split(","),e=0;3>=e;++e)t[e]&&(t[e]=parseFloat(t[e]));return t[3]&&(t[3]=c(t[3],"deg")),t}},parse:function(t){var e=this;t.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,n,i){e.setFromString(n,i)})},toString:function(t){var e=[];for(var n in this)if(this.hasOwnProperty(n)){if(!l.transform3d&&("rotateX"===n||"rotateY"===n||"perspective"===n||"transformOrigin"===n))continue;"_"!==n[0]&&(t&&"scale"===n?e.push(n+"3d("+this[n]+",1)"):t&&"translate"===n?e.push(n+"3d("+this[n]+",0)"):e.push(n+"("+this[n]+")"))}return e.join(" ")}},t.fn.transition=t.fn.transit=function(e,n,i,s){var o=this,u=0,c=!0;"function"==typeof n&&(s=n,n=void 0),"function"==typeof i&&(s=i,i=void 0),e.easing!==void 0&&(i=e.easing,delete e.easing),e.duration!==void 0&&(n=e.duration,delete e.duration),e.complete!==void 0&&(s=e.complete,delete e.complete),e.queue!==void 0&&(c=e.queue,delete e.queue),e.delay!==void 0&&(u=e.delay,delete e.delay),n===void 0&&(n=t.fx.speeds._default),i===void 0&&(i=t.cssEase._default),n=f(n);var p=a(e,n,i,u),d=t.transit.enabled&&l.transition,h=d?parseInt(n,10)+parseInt(u,10):0;if(0===h){var g=function(t){o.css(e),s&&s.apply(o),t&&t()};return r(o,c,g),o}var m={},y=function(n){var i=!1,r=function(){i&&o.unbind(b,r),h>0&&o.each(function(){this.style[l.transition]=m[this]||null}),"function"==typeof s&&s.apply(o),"function"==typeof n&&n()};h>0&&b&&t.transit.useTransitionEnd?(i=!0,o.bind(b,r)):window.setTimeout(r,h),o.each(function(){h>0&&(this.style[l.transition]=p),t(this).css(e)})},v=function(t){this.offsetWidth,y(t)};return r(o,c,v),this},t.transit.getTransitionValue=a})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.transit.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js"],function(){/**
 * @license
 * jQuery Form Example Plugin 1.6.0
 * Populate form inputs with example text that disappears on focus.
 *
 * e.g.
 *    $('input#name').example('Bob Smith');
 *    $('input[@title]').example(function () {
 *        return $(this).attr('title');
 *    });
 *    $('textarea#message').example('Type your message here', {
 *        className: 'example_text'
 *    });
 *
 * Copyright (c) Paul Mucur (http://mudge.name), 2007-2012.
 * Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
 * licenses.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
 * GNU General Public License for more details.
 */
(function(e){"use strict";var a;a=e.fn.on?function(a,s,l){e("body").on(s,a,l)}:e.fn.delegate?function(a,s,l){e("body").delegate(a,s,l)}:e.fn.live?function(a,s,l){e(a).live(s,l)}:function(a,s,l){e(a).bind(s,l)},e.fn.example=function(s,l){var n=e.isFunction(s),t=e.extend({},l,{example:s});return this.each(function(){var s,l=e(this);s=e.metadata?e.extend({},e.fn.example.defaults,l.metadata(),t):e.extend({},e.fn.example.defaults,t),e.fn.example.boundClassNames[s.className]||(e(window).bind("unload.example",function(){e("."+s.className).val("").removeClass(s.className)}),a("form","submit.example example:resetForm",function(){e(this).find("."+s.className).val("").removeClass(s.className)}),e.fn.example.boundClassNames[s.className]=!0),l.val()===this.defaultValue||!n&&l.val()!==s.example||l.val(this.defaultValue),""!==l.val()||l.is(":focus")||l.addClass(s.className).val(n?s.example.call(this):s.example),l.bind("focus.example",function(){e(this).is("."+s.className)&&e(this).val("").removeClass(s.className)}).bind("change.example",function(){e(this).is("."+s.className)&&e(this).removeClass(s.className)}).bind("blur.example",function(){""===e(this).val()&&e(this).addClass(s.className).val(n?s.example.call(this):s.example)})})},e.fn.example.defaults={className:"example"},e.fn.example.boundClassNames=[]})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.example.js")});
DWait.ready(["jms/lib/jquery/jquery.current.js","jms/lib/pubsub.js","jms/lib/Base.js"],function(){(function(t){t.fn.dautocomplete=function(s){var i=t.extend({},t.fn.dautocomplete.default_options,s||{});if(!this.data("dautocomplete")){var r=new e(this,i);this.data("dautocomplete",r)}return this};var e=Base.extend({items:[],last_searched:[],current:0,blur_timeout:null,handlers:{search:function(t){var e=this.$.val(),s=[];switch(t.keyCode){case 27:this.$.val(""),e="";break;case 13:return PubSub.publish("Autocomplete.selected"),!1;case 38:return this.decrement_current(),!1;case 40:return this.increment_current(),!1}if(e.length){this.$clear.show();for(var i=0;this.items.length>i;i++){var r=this.items[i],n=r.string.indexOf(e);-1!==n&&(r.pos=n,s.push(r))}}s.sort(this._sort),this.last_searched=s.slice(0,this.options.max_found),PubSub.publish("Autocomplete.search_done",this.last_searched),this.reset_current()},blur:function(){var t=this;this.blur_timeout=setTimeout(function(){t.$.val(""),t.$clear.hide(),PubSub.publish("Autocomplete.blur")},100)},results_click:function(){return clearTimeout(this.blur_timeout),this.$.focus(),!0}},constructor:function(t,e){this.$=t,this.options=e,this.bind_elements(),this.bind_events(),this.set_items()},bind_elements:function(){this.$clear=t(this.options.clear_selector),this.$results=t(this.options.results_selector)},bind_events:function(){this.$.on("keyup.autocomplete",t.proxy(this.handlers.search,this)).on("blur.autocomplete",t.proxy(this.handlers.blur,this)),this.$clear.on("click.autocomplete",t.proxy(this.handlers.blur,this)),this.$results.on("click.autocomplete",t.proxy(this.handlers.results_click,this))},set_items:function(){if("string"==typeof this.options.items){var e=this;t(this.options.items).each(function(){var s=t(this);e.items.push({string:""+s.data(e.options.data_name),text:s.text(),url:s.attr("href")})})}else this.items=this.options.items},increment_current:function(){this.update_current(1)},decrement_current:function(){this.update_current(-1)},reset_current:function(){this.update_current(0)},update_current:function(t){this.current=0===t?0:Math.min(Math.max(this.current+t,0),this.last_searched.length-1),PubSub.publish("Autocomplete.currently_selected",this.current)},_sort:function(t,e){if(t.pos!==e.pos){if(t.pos>e.pos)return 1;if(e.pos>t.pos)return-1}return t.text>e.text?1:e.text>t.text?-1:0}});t.fn.dautocomplete.default_options={clear_selector:".autocomplete-clear",results_selector:".autocomplete-results",data_name:"search_string",max_found:10}})(jQuery),window.DWait&&DWait.run("jms/lib/jquery/plugins/jquery.dautocomplete.js")});if(window.DWait){DWait.count()}