/*!
 * DropKick 1.3.3
 *
 * Highly customizable <select> lists
 * https://github.com/robdel12/DropKick
 *
 * Created by: Jamie Lottering <http://github.com/JamieLottering> <http://twitter.com/JamieLottering>
 *
 *
*/
!function(a,b,c){"use strict";var d=navigator.userAgent.match(/MSIE ([0-9]{1,}[\.0-9]{0,})/),e=!!d,f=e&&parseFloat(d[1])<7,g=navigator.userAgent.match(/iPad|iPhone|Android|IEMobile|BlackBerry/i),h={},i=[],j={left:37,up:38,right:39,down:40,enter:13,tab:9,zero:48,z:90,last:221},k=['<div class="dk_container" id="dk_container_{{ id }}" tabindex="{{ tabindex }}">','<a class="dk_toggle">','<span class="dk_label">{{ label }}</span>',"</a>",'<div class="dk_options">','<ul class="dk_options_inner">',"</ul>","</div>","</div>"].join(""),l='<li class="{{ current }} {{ disabled }}"><a data-dk-dropdown-value="{{ value }}">{{ text }}</a></li>',m={startSpeed:400,theme:!1,changes:!1,syncReverse:!0,nativeMobile:!0},n=null,o=null,p=function(a,b,c){var d,e,f,g;d=a.attr("data-dk-dropdown-value"),e=a.text(),f=b.data("dropkick"),g=f.$select,g.val(d).trigger("change"),b.find(".dk_label").text(e),c=c||!1,!f.settings.change||c||f.settings.syncReverse||f.settings.change.call(g,d,e)},q=function(a){a.removeClass("dk_open"),n=null},r=function(c){var d=c.find(".dk_toggle"),e=c.find(".dk_options").outerHeight(),f=a(b).height()-d.outerHeight()-d.offset().top+a(b).scrollTop(),g=d.offset().top-a(b).scrollTop();return g>e?f>e:!0},s=function(a,b,c){var d=a.find(".dk_options_inner"),e=b.prevAll("li").outerHeight()*b.prevAll("li").length,f=d.scrollTop(),g=d.height()+d.scrollTop()-b.outerHeight();(c&&"keydown"===c.type||f>e||e>g)&&d.scrollTop(e)},t=function(a,b){var c=r(a);a.find(".dk_options").css({top:c?a.find(".dk_toggle").outerHeight()-1:"",bottom:c?"":a.find(".dk_toggle").outerHeight()-1}),n=a.toggleClass("dk_open"),s(a,a.find(".dk_option_current"),b)},u=function(a,b,c){b.find(".dk_option_current").removeClass("dk_option_current"),a.addClass("dk_option_current"),s(b,a,c)},v=function(b,c){var d,e,f,g,h,i,k,l=b.keyCode,m=c.data("dropkick"),n=String.fromCharCode(l),o=c.find(".dk_options"),r=c.hasClass("dk_open"),s=o.find("li"),v=c.find(".dk_option_current"),w=s.first(),x=s.last();switch(l){case j.enter:r?v.hasClass("disabled")||(p(v.find("a"),c),q(c)):t(c,b),b.preventDefault();break;case j.tab:r&&(p(v.find("a"),c),q(c));break;case j.up:e=v.prev("li"),r?e.length?u(e,c,b):u(x,c,b):t(c,b),b.preventDefault();break;case j.down:r?(d=v.next("li").first(),d.length?u(d,c,b):u(w,c,b)):t(c,b),b.preventDefault()}if(l>=j.zero&&l<=j.z){for(f=(new Date).getTime(),null===m.finder?(m.finder=n.toUpperCase(),m.timer=f):f>parseInt(m.timer,10)+1e3?(m.finder=n.toUpperCase(),m.timer=f):(m.finder=m.finder+n.toUpperCase(),m.timer=f),g=s.find("a"),h=0,i=g.length;i>h;h++)if(k=a(g[h]),0===k.html().toUpperCase().indexOf(m.finder)){p(k,c),u(k.parent(),c,b);break}c.data("dropkick",m)}},w=function(b){return a.trim(b).length>0?b:!1},x=function(b,c){var d,e,f,g,h,i=b.replace("{{ id }}",c.id).replace("{{ label }}",c.label).replace("{{ tabindex }}",c.tabindex),j=[];if(c.options&&c.options.length)for(e=0,f=c.options.length;f>e;e++)g=a(c.options[e]),h=0===e&&void 0!==g.attr("selected")&&void 0!==g.attr("disabled")?null:l.replace("{{ value }}",g.val()).replace("{{ current }}",w(g.val())===c.value?"dk_option_current":"").replace("{{ disabled }}",void 0!==g.attr("disabled")?"disabled":"").replace("{{ text }}",a.trim(g.html())),j[j.length]=h;return d=a(i),d.find(".dk_options_inner").html(j.join("")),d};f||(c.documentElement.className=c.documentElement.className+" dk_fouc"),h.init=function(b){return b=a.extend({},m,b),this.each(function(){var c,d,e=a(this),f=e.find(":selected").first(),h=e.find("option"),j=e.data("dropkick")||{},l=e.attr("id")||e.attr("name"),m=b.width||e.outerWidth(),n=e.attr("tabindex")||"0",p=!1;return j.id?e:(j.settings=b,j.tabindex=n,j.id=l,j.$original=f,j.$select=e,j.value=w(e.val())||w(f.attr("value")),j.label=f.text(),j.options=h,p=x(k,j),p.find(".dk_toggle").css({width:m+"px"}),e.before(p).appendTo(p),p=a('div[id="dk_container_'+l+'"]').fadeIn(b.startSpeed),c=b.theme||"default",p.addClass("dk_theme_"+c),j.theme=c,j.$dk=p,e.data("dropkick",j),p.addClass(e.attr("class")),p.data("dropkick",j),i[i.length]=e,p.bind("focus.dropkick",function(){o=p.addClass("dk_focus")}).bind("blur.dropkick",function(){p.removeClass("dk_focus"),o=null}),g&&j.settings.nativeMobile&&p.addClass("dk_mobile"),j.settings.syncReverse&&e.on("change",function(b){var c=e.val(),d=a('a[data-dk-dropdown-value="'+c+'"]',p),f=d.text();p.find(".dk_label").text(f),j.settings.change&&j.settings.change.call(e,c,f),u(d.parent(),p,b)}),(e.attr("form")||e.closest("form").length)&&(d=e.attr("form")?a("#"+e.attr("form").replace(" ",", #")):e.closest("form"),d.on("reset",function(){e.dropkick("reset")})),void 0)})},h.theme=function(b){var c=a(this).data("dropkick"),d=c.$dk,e="dk_theme_"+c.theme;d.removeClass(e).addClass("dk_theme_"+b),c.theme=b},h.reset=function(){return this.each(function(){var b=a(this).data("dropkick"),c=b.$dk,d=a('a[data-dk-dropdown-value="'+b.value+'"]',c);!b.$original.eq(0).prop("selected")&&b.$original.eq(0).prop("selected",!0),c.find(".dk_label").text(b.label),u(d.parent(),c)})},h.setValue=function(b){var c=a(this).data("dropkick").$dk,d=a('.dk_options a[data-dk-dropdown-value="'+b+'"]',c);d.length?(p(d,c),u(d.parent(),c)):console.warn("There is no option with this value in the <select>")},h.refresh=function(){return this.each(function(){var b=a(this).data("dropkick"),c=b.$select,d=b.$dk;b.settings.startSpeed=0,c.removeData("dropkick").insertAfter(d),d.remove(),c.dropkick(b.settings)})},a.fn.dropkick=function(a){if(!f){if(h[a])return h[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"==typeof a||!a)return h.init.apply(this,arguments)}},a(function(){a(c).on(e?"mousedown":"click",".dk_options a",function(){var b=a(this),c=b.parents(".dk_container").first();return b.parent().hasClass("disabled")||(p(b,c),u(b.parent(),c),q(c)),!1}),a(c).bind("keydown.dk_nav",function(a){var b=null;n?b=n:o&&!n&&(b=o),b&&v(a,b)}),a(c).on("click",null,function(b){if(n&&0===a(b.target).closest(".dk_container").length)q(n);else if(a(b.target).is(".dk_toggle, .dk_label")){var c=a(b.target).parents(".dk_container").first();return c.hasClass("dk_open")?q(c):(n&&q(n),t(c,b)),!1}});var d="onwheel"in b?"wheel":"onmousewheel"in c?"mousewheel":"MouseScrollEvent"in b?"DOMMouseScroll MozMousePixelScroll":!1;d&&a(c).on(d,".dk_options_inner",function(a){var b=a.originalEvent.wheelDelta||-a.originalEvent.deltaY||-a.originalEvent.detail;return e?(this.scrollTop-=Math.round(b/10),!1):b>0&&this.scrollTop<=0||0>b&&this.scrollTop>=this.scrollHeight-this.offsetHeight?!1:!0})})}(opjq,window,document);