/*!
 * jQuery Form Plugin
 * version: 3.33.0-2013.05.02
 * @requires jQuery v1.5 or later
 * Copyright (c) 2013 M. Alsup
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Project repository: https://github.com/malsup/form
 * Dual licensed under the MIT and GPL licenses.
 * https://github.com/malsup/form#copyright-and-license
 */
(function(a){"use strict";var c={};c.fileapi=a("<input type='file'/>").get(0).files!==undefined;c.formdata=window.FormData!==undefined;var f=!!a.fn.prop;a.fn.attr2=function(){if(!f)return this.attr.apply(this,arguments);var a=this.prop.apply(this,arguments);return a&&a.jquery||typeof a==="string"?a:this.attr.apply(this,arguments)};a.fn.ajaxSubmit=function(d){if(!this.length){b("ajaxSubmit: skipping submit process - no element selected");return this}var i,r,g,e=this;if(typeof d=="function")d={success:d};i=this.attr2("method");r=this.attr2("action");g=typeof r==="string"?a.trim(r):"";g=g||window.location.href||"";if(g)g=(g.match(/^([^#]+)/)||[])[1];d=a.extend(true,{url:g,success:a.ajaxSettings.success,type:i||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},d);var o={};this.trigger("form-pre-serialize",[this,d,o]);if(o.veto){b("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(d.beforeSerialize&&d.beforeSerialize(this,d)===false){b("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var n=d.traditional;if(n===undefined)n=a.ajaxSettings.traditional;var k=[],p,j=this.formToArray(d.semantic,k);if(d.data){d.extraData=d.data;p=a.param(d.data,n)}if(d.beforeSubmit&&d.beforeSubmit(j,this,d)===false){b("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[j,this,d,o]);if(o.veto){b("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var m=a.param(j,n);if(p)m=m?m+"&"+p:p;if(d.type.toUpperCase()=="GET"){d.url+=(d.url.indexOf("?")>=0?"&":"?")+m;d.data=null}else d.data=m;var h=[];d.resetForm&&h.push(function(){e.resetForm()});d.clearForm&&h.push(function(){e.clearForm(d.includeHidden)});if(!d.dataType&&d.target){var C=d.success||function(){};h.push(function(b){var c=d.replaceTarget?"replaceWith":"html";a(d.target)[c](b).each(C,arguments)})}else d.success&&h.push(d.success);d.success=function(f,c,i){for(var b=d.context||this,a=0,g=h.length;a<g;a++)h[a].apply(b,[f,c,i||e,e])};if(d.error){var D=d.error;d.error=function(f,b,c){var a=d.context||this;D.apply(a,[f,b,c,e])}}if(d.complete){var A=d.complete;d.complete=function(c,b){var a=d.context||this;A.apply(a,[c,b,e])}}var B=a('input[type=file]:enabled[value!=""]',this),u=B.length>0,w="multipart/form-data",v=e.attr("enctype")==w||e.attr("encoding")==w,q=c.fileapi&&c.formdata;b("fileAPI :"+q);var x=(u||v)&&!q,l;if(d.iframe!==false&&(d.iframe||x))if(d.closeKeepAlive)a.get(d.closeKeepAlive,function(){l=t(j)});else l=t(j);else if((u||v)&&q)l=z(j);else l=a.ajax(d);e.removeData("jqxhr").data("jqxhr",l);for(var s=0;s<k.length;s++)k[s]=null;this.trigger("form-submit-notify",[this,d]);return this;function y(f){for(var c=a.param(f).split("&"),g=c.length,e=[],d,b=0;b<g;b++){c[b]=c[b].replace(/\+/g," ");d=c[b].split("=");e.push([decodeURIComponent(d[0]),decodeURIComponent(d[1])])}return e}function z(g){for(var f=new FormData,b=0;b<g.length;b++)f.append(g[b].name,g[b].value);if(d.extraData){var e=y(d.extraData);for(b=0;b<e.length;b++)e[b]&&f.append(e[b][0],e[b][1])}d.data=null;var c=a.extend(true,{},a.ajaxSettings,d,{contentType:false,processData:false,cache:false,type:i||"POST"});if(d.uploadProgress)c.xhr=function(){var a=jQuery.ajaxSettings.xhr();a.upload&&a.upload.addEventListener("progress",function(a){var c=0,b=a.loaded||a.position,e=a.total;if(a.lengthComputable)c=Math.ceil(b/e*100);d.uploadProgress(a,b,e,c)},false);return a};c.data=null;var h=c.beforeSend;c.beforeSend=function(b,a){a.data=f;h&&h.call(this,b,a)};return a.ajax(c)}function t(J){var j=e[0],x,u,c,o,t,n,l,g,r,p,w,s,m=a.Deferred();if(J)for(u=0;u<k.length;u++){x=a(k[u]);if(f)x.prop("disabled",false);else x.removeAttr("disabled")}c=a.extend(true,{},a.ajaxSettings,d);c.context=c.context||c;t="jqFormIO"+ +new Date;if(c.iframeTarget){n=a(c.iframeTarget);p=n.attr2("name");if(!p)n.attr2("name",t);else t=p}else{n=a('<iframe name="'+t+'" src="'+c.iframeSrc+'" />');n.css({position:"absolute",top:"-1000px",left:"-1000px"})}l=n[0];g={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var d=e==="timeout"?"timeout":"aborted";b("aborting upload... "+d);this.aborted=1;try{l.contentWindow.document.execCommand&&l.contentWindow.document.execCommand("Stop")}catch(f){}n.attr("src",c.iframeSrc);g.error=d;c.error&&c.error.call(c.context,g,d,e);o&&a.event.trigger("ajaxError",[g,c,d]);c.complete&&c.complete.call(c.context,g,d)}};o=c.global;o&&0===a.active++&&a.event.trigger("ajaxStart");o&&a.event.trigger("ajaxSend",[g,c]);if(c.beforeSend&&c.beforeSend.call(c.context,g,c)===false){if(c.global)a.active--;m.reject();return m}if(g.aborted){m.reject();return m}r=j.clk;if(r){p=r.name;if(p&&!r.disabled){c.extraData=c.extraData||{};c.extraData[p]=r.value;if(r.type=="image"){c.extraData[p+".x"]=j.clk_x;c.extraData[p+".y"]=j.clk_y}}}var y=1,v=2;function D(a){var c=null;try{if(a.contentWindow)c=a.contentWindow.document}catch(d){b("cannot get iframe.contentWindow document: "+d)}if(c)return c;try{c=a.contentDocument?a.contentDocument:a.document}catch(d){b("cannot get iframe.contentDocument: "+d);c=a.document}return c}var B=a("meta[name=csrf-token]").attr("content"),A=a("meta[name=csrf-param]").attr("content");if(A&&B){c.extraData=c.extraData||{};c.extraData[A]=B}function C(){var k=e.attr2("target"),h=e.attr2("action");j.setAttribute("target",t);!i&&j.setAttribute("method","POST");h!=c.url&&j.setAttribute("action",c.url);!c.skipEncodingOverride&&(!i||/post/i.test(i))&&e.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});if(c.timeout)s=setTimeout(function(){w=true;q(y)},c.timeout);function g(){try{var a=D(l).readyState;b("state = "+a);a&&a.toLowerCase()=="uninitialized"&&setTimeout(g,50)}catch(c){b("Server abort: ",c," (",c.name,")");q(v);s&&clearTimeout(s);s=undefined}}var f=[];try{if(c.extraData)for(var d in c.extraData)if(c.extraData.hasOwnProperty(d))if(a.isPlainObject(c.extraData[d])&&c.extraData[d].hasOwnProperty("name")&&c.extraData[d].hasOwnProperty("value"))f.push(a('<input type="hidden" name="'+c.extraData[d].name+'">').val(c.extraData[d].value).appendTo(j)[0]);else f.push(a('<input type="hidden" name="'+d+'">').val(c.extraData[d]).appendTo(j)[0]);if(!c.iframeTarget){n.appendTo("body");if(l.attachEvent)l.attachEvent("onload",q);else l.addEventListener("load",q,false)}setTimeout(g,15);try{j.submit()}catch(o){var m=document.createElement("form").submit;m.apply(j)}}finally{j.setAttribute("action",h);if(k)j.setAttribute("target",k);else e.removeAttr("target");a(f).remove()}}if(c.forceSync)C();else setTimeout(C,10);var E,h,F=50,z;function q(t){if(g.aborted||z)return;h=D(l);if(!h){b("cannot access response document");t=v}if(t===y&&g){g.abort("timeout");m.reject(g,"timeout");return}else if(t==v&&g){g.abort("server abort");m.reject(g,"error","server abort");return}if(!h||h.location.href==c.iframeSrc)if(!w)return;if(l.detachEvent)l.detachEvent("onload",q);else l.removeEventListener("load",q,false);var d="success",e;try{if(w)throw"timeout";var p=c.dataType=="xml"||h.XMLDocument||a.isXMLDoc(h);b("isXml="+p);if(!p&&window.opera&&(h.body===null||!h.body.innerHTML))if(--F){b("requeing onLoad callback, DOM not available");setTimeout(q,250);return}var f=h.body?h.body:h.documentElement;g.responseText=f?f.innerHTML:null;g.responseXML=h.XMLDocument?h.XMLDocument:h;if(p)c.dataType="xml";g.getResponseHeader=function(b){var a={"content-type":c.dataType};return a[b]};if(f){g.status=Number(f.getAttribute("status"))||g.status;g.statusText=f.getAttribute("statusText")||g.statusText}var r=(c.dataType||"").toLowerCase(),u=/(json|script|text)/.test(r);if(u||c.textarea){var j=h.getElementsByTagName("textarea")[0];if(j){g.responseText=j.value;g.status=Number(j.getAttribute("status"))||g.status;g.statusText=j.getAttribute("statusText")||g.statusText}else if(u){var i=h.getElementsByTagName("pre")[0],k=h.getElementsByTagName("body")[0];if(i)g.responseText=i.textContent?i.textContent:i.innerText;else if(k)g.responseText=k.textContent?k.textContent:k.innerText}}else if(r=="xml"&&!g.responseXML&&g.responseText)g.responseXML=I(g.responseText);try{E=H(g,r,c)}catch(x){d="parsererror";g.error=e=x||d}}catch(x){b("error caught: ",x);d="error";g.error=e=x||d}if(g.aborted){b("upload aborted");d=null}if(g.status)d=g.status>=200&&g.status<300||g.status===304?"success":"error";if(d==="success"){c.success&&c.success.call(c.context,E,"success",g);m.resolve(g.responseText,"success",g);o&&a.event.trigger("ajaxSuccess",[g,c])}else if(d){if(e===undefined)e=g.statusText;c.error&&c.error.call(c.context,g,d,e);m.reject(g,"error",e);o&&a.event.trigger("ajaxError",[g,c,e])}o&&a.event.trigger("ajaxComplete",[g,c]);o&&!--a.active&&a.event.trigger("ajaxStop");c.complete&&c.complete.call(c.context,g,d);z=true;c.timeout&&clearTimeout(s);setTimeout(function(){!c.iframeTarget&&n.remove();g.responseXML=null},100)}var I=a.parseXML||function(b,a){if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLDOM");a.async="false";a.loadXML(b)}else a=(new DOMParser).parseFromString(b,"text/xml");return a&&a.documentElement&&a.documentElement.nodeName!="parsererror"?a:null},G=a.parseJSON||function(a){return window.eval("("+a+")")},H=function(d,c,f){var e=d.getResponseHeader("content-type")||"",g=c==="xml"||!c&&e.indexOf("xml")>=0,b=g?d.responseXML:d.responseText;if(g&&b.documentElement.nodeName==="parsererror")a.error&&a.error("parsererror");if(f&&f.dataFilter)b=f.dataFilter(b,c);if(typeof b==="string")if(c==="json"||!c&&e.indexOf("json")>=0)b=G(b);else(c==="script"||!c&&e.indexOf("javascript")>=0)&&a.globalEval(b);return b};return m}};a.fn.ajaxForm=function(c){c=c||{};c.delegation=c.delegation&&a.isFunction(a.fn.on);if(!c.delegation&&this.length===0){var f={s:this.selector,c:this.context};if(!a.isReady&&f.s){b("DOM not ready, queuing ajaxForm");a(function(){a(f.s,f.c).ajaxForm(c)});return this}b("terminating; zero elements found by selector"+(a.isReady?"":" (DOM not ready)"));return this}if(c.delegation){a(document).off("submit.form-plugin",this.selector,e).off("click.form-plugin",this.selector,d).on("submit.form-plugin",this.selector,c,e).on("click.form-plugin",this.selector,c,d);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",c,e).bind("click.form-plugin",c,d)};function e(b){var c=b.data;if(!b.isDefaultPrevented()){b.preventDefault();a(this).ajaxSubmit(c)}}function d(c){var d=c.target,e=a(d);if(!e.is("[type=submit],[type=image]")){var g=e.closest("[type=submit]");if(g.length===0)return;d=g[0]}var b=this;b.clk=d;if(d.type=="image")if(c.offsetX!==undefined){b.clk_x=c.offsetX;b.clk_y=c.offsetY}else if(typeof a.fn.offset=="function"){var f=e.offset();b.clk_x=c.pageX-f.left;b.clk_y=c.pageY-f.top}else{b.clk_x=c.pageX-d.offsetLeft;b.clk_y=c.pageY-d.offsetTop}setTimeout(function(){b.clk=b.clk_x=b.clk_y=null},100)}a.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};a.fn.formToArray=function(k,i){var e=[];if(this.length===0)return e;var f=this[0],n=k?f.getElementsByTagName("*"):f.elements;if(!n)return e;var j,g,d,h,b,q,p;for(j=0,q=n.length;j<q;j++){b=n[j];d=b.name;if(!d||b.disabled)continue;if(k&&f.clk&&b.type=="image"){if(f.clk==b){e.push({name:d,value:a(b).val(),type:b.type});e.push({name:d+".x",value:f.clk_x},{name:d+".y",value:f.clk_y})}continue}h=a.fieldValue(b,true);if(h&&h.constructor==Array){i&&i.push(b);for(g=0,p=h.length;g<p;g++)e.push({name:d,value:h[g]})}else if(c.fileapi&&b.type=="file"){i&&i.push(b);var l=b.files;if(l.length)for(g=0;g<l.length;g++)e.push({name:d,value:l[g],type:b.type});else e.push({name:d,value:"",type:b.type})}else if(h!==null&&typeof h!="undefined"){i&&i.push(b);e.push({name:d,value:h,type:b.type,required:b.required})}}if(!k&&f.clk){var o=a(f.clk),m=o[0];d=m.name;if(d&&!m.disabled&&m.type=="image"){e.push({name:d,value:o.val()});e.push({name:d+".x",value:f.clk_x},{name:d+".y",value:f.clk_y})}}return e};a.fn.formSerialize=function(b){return a.param(this.formToArray(b))};a.fn.fieldSerialize=function(c){var b=[];this.each(function(){var f=this.name;if(!f)return;var d=a.fieldValue(this,c);if(d&&d.constructor==Array)for(var e=0,g=d.length;e<g;e++)b.push({name:f,value:d[e]});else d!==null&&typeof d!="undefined"&&b.push({name:this.name,value:d})});return a.param(b)};a.fn.fieldValue=function(e){for(var c=[],d=0,f=this.length;d<f;d++){var g=this[d],b=a.fieldValue(g,e);if(b===null||typeof b=="undefined"||b.constructor==Array&&!b.length)continue;if(b.constructor==Array)a.merge(c,b);else c.push(b)}return c};a.fieldValue=function(b,f){var n=b.name,d=b.type,k=b.tagName.toLowerCase();if(f===undefined)f=true;if(f&&(!n||b.disabled||d=="reset"||d=="button"||(d=="checkbox"||d=="radio")&&!b.checked||(d=="submit"||d=="image")&&b.form&&b.form.clk!=b||k=="select"&&b.selectedIndex==-1))return null;if(k=="select"){var g=b.selectedIndex;if(g<0)return null;for(var l=[],j=b.options,h=d=="select-one",m=h?g+1:j.length,i=h?g:0;i<m;i++){var c=j[i];if(c.selected){var e=c.value;if(!e)e=c.attributes&&c.attributes.value&&!c.attributes.value.specified?c.text:c.value;if(h)return e;l.push(e)}}return l}return a(b).val()};a.fn.clearForm=function(b){return this.each(function(){a("input,select,textarea",this).clearFields(b)})};a.fn.clearFields=a.fn.clearInputs=function(b){var c=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var d=this.type,e=this.tagName.toLowerCase();if(c.test(d)||e=="textarea")this.value="";else if(d=="checkbox"||d=="radio")this.checked=false;else if(e=="select")this.selectedIndex=-1;else if(d=="file")if(/MSIE/.test(navigator.userAgent))a(this).replaceWith(a(this).clone(true));else a(this).val("");else if(b)if(b===true&&/hidden/.test(d)||typeof b=="string"&&a(this).is(b))this.value=""})};a.fn.resetForm=function(){return this.each(function(){(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)&&this.reset()})};a.fn.enable=function(a){if(a===undefined)a=true;return this.each(function(){this.disabled=!a})};a.fn.selected=function(b){if(b===undefined)b=true;return this.each(function(){var d=this.type;if(d=="checkbox"||d=="radio")this.checked=b;else if(this.tagName.toLowerCase()=="option"){var c=a(this).parent("select");b&&c[0]&&c[0].type=="select-one"&&c.find("option").selected(false);this.selected=b}})};a.fn.ajaxSubmit.debug=false;function b(){if(!a.fn.ajaxSubmit.debug)return;var b="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log)window.console.log(b);else window.opera&&window.opera.postError&&window.opera.postError(b)}})(jQuery);jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a.expires=-1}var h="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){var b;if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1e3)}else b=a.expires;h="; expires="+b.toUTCString()}var l=a.path?"; path="+a.path:"",j=a.domain?"; domain="+a.domain:"",k=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),h,l,j,k].join("")}else{var f=null;if(document.cookie&&document.cookie!="")for(var g=document.cookie.split(";"),e=0;e<g.length;e++){var i=jQuery.trim(g[e]);if(i.substring(0,d.length+1)==d+"="){f=decodeURIComponent(i.substring(d.length+1));break}}return f}};jQuery.fn.DefaultValue=function(a){return this.each(function(){if(this.type!="text"&&this.type!="password"&&this.type!="textarea")return;var b=this;if(this.value==""){this.value=a;$(this).css("color","grey")}else return;$(this).focus(function(){if(this.value==a||this.value==""){this.value="";$(this).css("color","black")}});$(this).blur(function(){if(this.value==a||this.value==""){this.value=a;$(this).css("color","grey")}});$(this).parents("form").each(function(){$(this).submit(function(){if(b.value==a)b.value=""})})})};(function(a){typeof a.fn.each2=="undefined"&&a.fn.extend({each2:function(d){var b=a([0]),c=-1,e=this.length;while(++c<e&&(b.context=b[0]=this[c])&&d.call(b[0],c,b)!==false);return this}})})(jQuery);(function(a,b){"use strict";if(window.Select2!==b)return;var j,n,o,k,h,t,v,l,c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){a=a.which?a.which:a;switch(a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return true}return false},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return true}return a.metaKey?true:false},isFunctionKey:function(a){a=a.which?a.which:a;return a>=112&&a<=123}},C="<div style='position:absolute; top:-10000px; left:-10000px; width:100px; height:100px; overflow:scroll;'></div>";v=a(document);k=function(){var a=1;return function(){return a++}}();function g(c,b){for(var a=0,d=b.length;a<d;a=a+1)if(e(c,b[a]))return a;return-1}function H(){var b=a(C);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};b.remove();return c}function e(a,c){return a===c?true:a===b||c===b?false:a===null||c===null?false:a.constructor===String?a+""===c+"":c.constructor===String?c+""===a+"":false}function p(d,f){var c,b,e;if(d===null||d.length<1)return[];c=d.split(f);for(b=0,e=c.length;b<e;b=b+1)c[b]=a.trim(c[b]);return c}function s(a){return a.outerWidth(false)-a.width()}function r(c){var d="keyup-change-value";c.bind("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())});c.bind("keyup",function(){var e=a.data(c,d);if(e!==b&&c.val()!==e){a.removeData(c,d);c.trigger("keyup-change")}})}v.bind("mousemove",function(a){t={x:a.pageX,y:a.pageY}});function D(c){c.bind("mousemove",function(c){var d=t;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function x(d,e,a){a=a||b;var c;return function(){var b=arguments;window.clearTimeout(c);c=window.setTimeout(function(){e.apply(a,b)},d)}}function J(c){var a=false,b;return function(){if(a===false){b=c();a=true}return b}}function E(b,a){var c=x(b,function(b){a.trigger("scroll-debounced",b)});a.bind("scroll",function(b){g(b.target,a.get())>=0&&c(b)})}function y(a){if(a[0]===document.activeElement)return;window.setTimeout(function(){var b=a[0],d=a.val().length,c;a.focus();if(a.is(":visible")&&b===document.activeElement)if(b.setSelectionRange)b.setSelectionRange(d,d);else if(b.createTextRange){c=b.createTextRange();c.collapse(false);c.select()}},0)}function d(a){a.preventDefault();a.stopPropagation()}function F(a){a.preventDefault();a.stopImmediatePropagation()}function I(c){if(!h){var b=c[0].currentStyle||window.getComputedStyle(c[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:b.fontSize,fontFamily:b.fontFamily,fontStyle:b.fontStyle,fontWeight:b.fontWeight,letterSpacing:b.letterSpacing,textTransform:b.textTransform,whiteSpace:"nowrap"});h.attr("class","select2-sizer");a("body").append(h)}h.text(c.val());return h.width()}function m(e,g,f){var b,c=[],d;b=e.attr("class");if(b){b=""+b;a(b.split(" ")).each2(function(){this.indexOf("select2-")===0&&c.push(this)})}b=g.attr("class");if(b){b=""+b;a(b.split(" ")).each2(function(){if(this.indexOf("select2-")!==0){d=f(this);d&&c.push(this)}})}e.attr("class",c.join(" "))}function w(b,e,a,d){var c=b.toUpperCase().indexOf(e.toUpperCase()),f=e.length;if(c<0){a.push(d(b));return}a.push(d(b.substring(0,c)));a.push("<span class='select2-match'>");a.push(d(b.substring(c,c+f)));a.push("</span>");a.push(d(b.substring(c+f,b.length)))}function A(b){var f,d=0,e=null,g=b.quietMillis||100,h=b.url,c=this;return function(i){window.clearTimeout(f);f=window.setTimeout(function(){d+=1;var k=d,j=b.data,f=h,l=b.transport||a.ajax,m=b.type||"GET",g={};j=j?j.call(c,i.term,i.page,i.context):null;f=typeof f==="function"?f.call(c,i.term,i.page,i.context):f;null!==e&&e.abort();if(b.params)if(a.isFunction(b.params))a.extend(g,b.params.call(c));else a.extend(g,b.params);a.extend(g,{url:f,dataType:b.dataType,data:j,type:m,cache:false,success:function(c){if(k<d)return;var a=b.results(c,i.page);i.callback(a)}});e=l.call(c,g)},g)}}function z(g){var b=g,f,d,c=function(a){return""+a.text};if(a.isArray(b)){d=b;b={results:d}}if(a.isFunction(b)===false){d=b;b=function(){return d}}var e=b();if(e.text){c=e.text;if(!a.isFunction(c)){f=b.text;c=function(a){return a[f]}}}return function(d){var f=d.term,g={results:[]},e;if(f===""){d.callback(b());return}e=function(b,i){var g,h;b=b[0];if(b.children){g={};for(h in b)if(b.hasOwnProperty(h))g[h]=b[h];g.children=[];a(b.children).each2(function(b,a){e(a,g.children)});(g.children.length||d.matcher(f,c(g),b))&&i.push(g)}else d.matcher(f,c(b),b)&&i.push(b)};a(b().results).each2(function(b,a){e(a,g.results)});d.callback(g)}}function B(c){var d=a.isFunction(c);return function(e){var g=e.term,f={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(g===""||e.matcher(g,c))&&f.results.push(a?this:{id:this,text:this})});e.callback(f)}}function i(b){if(a.isFunction(b))return true;if(!b)return false;throw new Error("formatterName must be a function or a falsy value");}function f(b){return a.isFunction(b)?b():b}function u(c){var b=0;a.each(c,function(c,a){if(a.children)b+=u(a.children);else b++});return b}function G(f,i,l,c){var m=f,k=false,a,g,d,h,j;if(!c.createSearchChoice||!c.tokenSeparators||c.tokenSeparators.length<1)return b;while(true){g=-1;for(d=0,h=c.tokenSeparators.length;d<h;d++){j=c.tokenSeparators[d];g=f.indexOf(j);if(g>=0)break}if(g<0)break;a=f.substring(0,g);f=f.substring(g+j.length);if(a.length>0){a=c.createSearchChoice(a,i);if(a!==b&&a!==null&&c.id(a)!==b&&c.id(a)!==null){k=false;for(d=0,h=i.length;d<h;d++)if(e(c.id(a),c.id(i[d]))){k=true;break}!k&&l(a)}}}if(m!==f)return f}function q(c,d){var b=function(){};b.prototype=new c;b.prototype.constructor=b;b.prototype.parent=c.prototype;b.prototype=a.extend(b.prototype,d);return b}j=q(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var e,g,h=".select2-results",i;this.opts=c=this.prepareOpts(c);this.id=c.id;c.element.data("select2")!==b&&c.element.data("select2")!==null&&this.destroy();this.enabled=true;this.container=this.createContainer();this.containerId="s2id_"+(c.element.attr("id")||"autogen"+k());this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1");this.container.attr("id",this.containerId);this.body=J(function(){return c.element.closest("body")});m(this.container,this.opts.element,this.opts.adaptContainerCssClass);this.container.css(f(c.containerCss));this.container.addClass(f(c.containerCssClass));this.elementTabIndex=this.opts.element.attr("tabIndex");this.opts.element.data("select2",this).bind("focus.select2",function(){a(this).select2("focus")}).attr("tabIndex","-1").before(this.container);this.container.data("select2",this);this.dropdown=this.container.find(".select2-drop");this.dropdown.addClass(f(c.dropdownCssClass));this.dropdown.data("select2",this);this.results=e=this.container.find(h);this.search=g=this.container.find("input.select2-input");g.attr("tabIndex",this.elementTabIndex);this.resultsPage=0;this.context=null;this.initContainer();D(this.results);this.dropdown.delegate(h,"mousemove-filtered touchstart touchmove touchend",this.bind(this.highlightUnderEvent));E(80,this.results);this.dropdown.delegate(h,"scroll-debounced",this.bind(this.loadMoreIfNeeded));a.fn.mousewheel&&e.mousewheel(function(b,h,f,a){var c=e.scrollTop(),g;if(a>0&&c-a<=0){e.scrollTop(0);d(b)}else if(a<0&&e.get(0).scrollHeight-e.scrollTop()+a<=e.height()){e.scrollTop(e.get(0).scrollHeight-e.height());d(b)}});r(g);g.bind("keyup-change input paste",this.bind(this.updateResults));g.bind("focus",function(){g.addClass("select2-focused")});g.bind("blur",function(){g.removeClass("select2-focused")});this.dropdown.delegate(h,"mouseup",this.bind(function(b){if(a(b.target).closest(".select2-result-selectable").length>0){this.highlightUnderEvent(b);this.selectHighlighted(b)}}));this.dropdown.bind("click mouseup mousedown",function(a){a.stopPropagation()});if(a.isFunction(this.opts.initSelection)){this.initSelection();this.monitorSource()}(c.element.is(":disabled")||c.element.is("[readonly='readonly']"))&&this.disable();l=l||H()},destroy:function(){var a=this.opts.element.data("select2");if(this.propertyObserver){delete this.propertyObserver;this.propertyObserver=null}if(a!==b){a.container.remove();a.dropdown.remove();a.opts.element.removeClass("select2-offscreen").removeData("select2").unbind(".select2").attr({tabIndex:this.elementTabIndex}).show()}},prepareOpts:function(c){var f,g,h,d;f=c.element;if(f.get(0).tagName.toLowerCase()==="select")this.select=g=c.element;g&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.");});c=a.extend({},{populateResults:function(g,h,e){var d,l,k,j,i=this.opts.id,f=this;d=function(m,r,s){var k,t,h,q,p,o,g,j,l,n;m=c.sortResults(m,r,e);for(k=0,t=m.length;k<t;k=k+1){h=m[k];p=h.disabled===true;q=!p&&i(h)!==b;o=h.children&&h.children.length>0;g=a("<li></li>");g.addClass("select2-results-dept-"+s);g.addClass("select2-result");g.addClass(q?"select2-result-selectable":"select2-result-unselectable");p&&g.addClass("select2-disabled");o&&g.addClass("select2-result-with-children");g.addClass(f.opts.formatResultCssClass(h));j=a(document.createElement("div"));j.addClass("select2-result-label");n=c.formatResult(h,j,e,f.opts.escapeMarkup);n!==b&&j.html(n);g.append(j);if(o){l=a("<ul></ul>");l.addClass("select2-result-sub");d(h.children,l,s+1);g.append(l)}g.data("select2-data",h);r.append(g)}};d(h,g,0)}},a.fn.select2.defaults,c);if(typeof c.id!=="function"){h=c.id;c.id=function(a){return a[h]}}if(a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(g){c.query=this.bind(function(h){var i={results:[],more:false},j=h.term,c,d,g;g=function(a,c){var b;if(a.is("option"))h.matcher(j,a.text(),a)&&c.push({id:a.attr("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:e(a.attr("disabled"),"disabled")});else if(a.is("optgroup")){b={text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")};a.children().each2(function(c,a){g(a,b.children)});b.children.length>0&&c.push(b)}};c=f.children();if(this.getPlaceholder()!==b&&c.length>0){d=c[0];if(a(d).text()==="")c=c.not(d)}c.each2(function(b,a){g(a,i.results)});h.callback(i)});c.id=function(a){return a.id};c.formatResultCssClass=function(a){return a.css}}else if(!("query"in c))if("ajax"in c){d=c.element.data("ajax-url");if(d&&d.length>0)c.ajax.url=d;c.query=A.call(c.element,c.ajax)}else if("data"in c)c.query=z(c.data);else if("tags"in c){c.query=B(c.tags);if(c.createSearchChoice===b)c.createSearchChoice=function(a){return{id:a,text:a}};if(c.initSelection===b)c.initSelection=function(f,d){var b=[];a(p(f.val(),c.separator)).each(function(){var g=this,f=this,d=c.tags;if(a.isFunction(d))d=d();a(d).each(function(){if(e(this.id,g)){f=this.text;return false}});b.push({id:g,text:f})});d(b)}}if(typeof c.query!=="function")throw"query function not defined for Select2 "+c.element.attr("id");return c},monitorSource:function(){var b=this.opts.element,a;b.bind("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==true&&this.initSelection()}));a=this.bind(function(){var a,b,c=this;a=this.opts.element.attr("disabled")!=="disabled";b=this.opts.element.attr("readonly")==="readonly";a=a&&!b;if(this.enabled!==a)if(a)this.enable();else this.disable();m(this.container,this.opts.element,this.opts.adaptContainerCssClass);this.container.addClass(f(this.opts.containerCssClass));m(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass);this.dropdown.addClass(f(this.opts.dropdownCssClass))});b.bind("propertychange.select2 DOMAttrModified.select2",a);if(typeof WebKitMutationObserver!=="undefined"){if(this.propertyObserver){delete this.propertyObserver;this.propertyObserver=null}this.propertyObserver=new WebKitMutationObserver(function(b){b.forEach(a)});this.propertyObserver.observe(b.get(0),{attributes:true,subtree:false})}},triggerChange:function(b){b=b||{};b=a.extend({},b,{type:"change",val:this.val()});this.opts.element.data("select2-change-triggered",true);this.opts.element.trigger(b);this.opts.element.data("select2-change-triggered",false);this.opts.element.click();this.opts.blurOnChange&&this.opts.element.blur()},enable:function(){if(this.enabled)return;this.enabled=true;this.container.removeClass("select2-container-disabled");this.opts.element.removeAttr("disabled")},disable:function(){if(!this.enabled)return;this.close();this.enabled=false;this.container.addClass("select2-container-disabled");this.opts.element.attr("disabled","disabled")},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var b=this.dropdown,e=this.container.offset(),u=this.container.outerHeight(false),h=this.container.outerWidth(false),m=b.outerHeight(false),q=a(window).scrollLeft()+a(window).width(),s=a(window).scrollTop()+a(window).height(),i=e.top+u,d=e.left,p=i+m<=s,o=e.top-m>=this.body().scrollTop(),c=b.outerWidth(false),n=d+c<=q,t=b.hasClass("select2-drop-above"),k,g,r,j;if(this.opts.dropdownAutoWidth){j=a(".select2-results",b)[0];b.addClass("select2-drop-auto-width");b.css("width","");c=b.outerWidth(false)+(j.scrollHeight===j.clientHeight?0:l.width);c>h?h=c:c=h;n=d+c<=q}else this.container.removeClass("select2-drop-auto-width");if(this.body().css("position")!=="static"){k=this.body().offset();i-=k.top;d-=k.left}if(t){g=true;if(!o&&p)g=false}else{g=false;if(!p&&o)g=true}if(!n)d=e.left+h-c;if(g){i=e.top-m;this.container.addClass("select2-drop-above");b.addClass("select2-drop-above")}else{this.container.removeClass("select2-drop-above");b.removeClass("select2-drop-above")}r=a.extend({top:i,left:d,width:h},f(this.opts.dropdownCss));b.css(r)},shouldOpen:function(){var b;if(this.opened())return false;b=a.Event("opening");this.opts.element.trigger(b);return!b.isDefaultPrevented()},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above");this.dropdown.removeClass("select2-drop-above")},open:function(){if(!this.shouldOpen())return false;window.setTimeout(this.bind(this.opening),1);return true},opening:function(){var c=this.containerId,g="scroll."+c,f="resize."+c,e="orientationchange."+c,b;this.clearDropdownAlignmentPreference();this.container.addClass("select2-dropdown-open").addClass("select2-container-active");this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body());this.updateResults(true);b=a("#select2-drop-mask");if(b.length==0){b=a(document.createElement("div"));b.attr("id","select2-drop-mask").attr("class","select2-drop-mask");b.hide();b.appendTo(this.body());b.bind("mousedown touchstart",function(){var c=a("#select2-drop"),b;if(c.length>0){b=c.data("select2");b.opts.selectOnBlur&&b.selectHighlighted({noFocus:true});b.close()}})}this.dropdown.prev()[0]!==b[0]&&this.dropdown.before(b);a("#select2-drop").removeAttr("id");this.dropdown.attr("id","select2-drop");b.css(d());b.show();this.dropdown.show();this.positionDropdown();this.dropdown.addClass("select2-drop-active");this.ensureHighlightVisible();var h=this;this.container.parents().add(window).each(function(){a(this).bind(f+" "+g+" "+e,function(){a("#select2-drop-mask").css(d());h.positionDropdown()})});this.focusSearch();function d(){return{width:Math.max(document.documentElement.scrollWidth,a(window).width()),height:Math.max(document.documentElement.scrollHeight,a(window).height())}}},close:function(){if(!this.opened())return;var b=this.containerId,e="scroll."+b,d="resize."+b,c="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).unbind(e).unbind(d).unbind(c)});this.clearDropdownAlignmentPreference();a("#select2-drop-mask").hide();this.dropdown.removeAttr("id");this.dropdown.hide();this.container.removeClass("select2-dropdown-open");this.results.empty();this.clearSearch();this.search.removeClass("select2-active");this.opts.element.trigger(a.Event("close"))},clearSearch:function(){},getMaximumSelectionSize:function(){return f(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var b=this.results,g,d,c,f,h,i,e;d=this.highlight();if(d<0)return;if(d==0){b.scrollTop(0);return}g=this.findHighlightableChoices().find(".select2-result-label");c=a(g[d]);f=c.offset().top+c.outerHeight(true);if(d===g.length-1){e=b.find("li.select2-more-results");if(e.length>0)f=e.offset().top+e.outerHeight(true)}h=b.offset().top+b.outerHeight(true);f>h&&b.scrollTop(b.scrollTop()+(f-h));i=c.offset().top-b.offset().top;i<0&&c.css("display")!="none"&&b.scrollTop(b.scrollTop()+i)},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-selected):not(.select2-disabled)")},moveHighlight:function(e){var d=this.findHighlightableChoices(),b=this.highlight();while(b>-1&&b<d.length){b+=e;var c=a(d[b]);if(c.hasClass("select2-result-selectable")&&!c.hasClass("select2-disabled")&&!c.hasClass("select2-selected")){this.highlight(b);break}}},highlight:function(c){var b=this.findHighlightableChoices(),e,d;if(arguments.length===0)return g(b.filter(".select2-highlighted")[0],b.get());if(c>=b.length)c=b.length-1;if(c<0)c=0;this.results.find(".select2-highlighted").removeClass("select2-highlighted");e=a(b[c]);e.addClass("select2-highlighted");this.ensureHighlightVisible();d=e.data("select2-data");d&&this.opts.element.trigger({type:"highlight",val:this.id(d),choice:d})},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(d){var b=a(d.target).closest(".select2-result-selectable");if(b.length>0&&!b.is(".select2-highlighted")){var c=this.findHighlightableChoices();this.highlight(c.index(b))}else b.length==0&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var b=this.results,c=b.find("li.select2-more-results"),f,h=-1,d=this.resultsPage+1,a=this,g=this.search.val(),e=this.context;if(c.length===0)return;f=c.offset().top-b.offset().top-b.height();if(f<=this.opts.loadMorePadding){c.addClass("select2-active");this.opts.query({element:this.opts.element,term:g,page:d,context:e,matcher:this.opts.matcher,callback:this.bind(function(f){if(!a.opened())return;a.opts.populateResults.call(this,b,f.results,{term:g,page:d,context:e});a.postprocessResults(f,false,false);if(f.more===true){c.detach().appendTo(b).text(a.opts.formatLoadMore(d+1));window.setTimeout(function(){a.loadMoreIfNeeded()},10)}else c.remove();a.positionDropdown();a.resultsPage=d;a.context=f.context})})}},tokenize:function(){},updateResults:function(l){var d=this.search,h=this.results,c=this.opts,m,f=this,j,p=d.val(),o=a.data(this.container,"select2-last-term");if(l!==true&&o&&e(p,o))return;a.data(this.container,"select2-last-term",p);if(l!==true&&(this.showSearchInput===false||!this.opened()))return;function n(){h.scrollTop(0);d.removeClass("select2-active");f.positionDropdown()}function g(a){h.html(a);n()}var k=this.getMaximumSelectionSize();if(k>=1){m=this.data();if(a.isArray(m)&&m.length>=k&&i(c.formatSelectionTooBig,"formatSelectionTooBig")){g("<li class='select2-selection-limit'>"+c.formatSelectionTooBig(k)+"</li>");return}}if(d.val().length<c.minimumInputLength){if(i(c.formatInputTooShort,"formatInputTooShort"))g("<li class='select2-no-results'>"+c.formatInputTooShort(d.val(),c.minimumInputLength)+"</li>");else g("");return}if(c.maximumInputLength&&d.val().length>c.maximumInputLength){if(i(c.formatInputTooLong,"formatInputTooLong"))g("<li class='select2-no-results'>"+c.formatInputTooLong(d.val(),c.maximumInputLength)+"</li>");else g("");return}c.formatSearching&&this.findHighlightableChoices().length===0&&g("<li class='select2-searching'>"+c.formatSearching()+"</li>");d.addClass("select2-active");j=this.tokenize();j!=b&&j!=null&&d.val(j);this.resultsPage=1;c.query({element:c.element,term:d.val(),page:this.resultsPage,context:null,matcher:c.matcher,callback:this.bind(function(j){var k;if(!this.opened()){this.search.removeClass("select2-active");return}this.context=j.context===b?null:j.context;if(this.opts.createSearchChoice&&d.val()!==""){k=this.opts.createSearchChoice.call(null,d.val(),j.results);if(k!==b&&k!==null&&f.id(k)!==b&&f.id(k)!==null)a(j.results).filter(function(){return e(f.id(this),f.id(k))}).length===0&&j.results.unshift(k)}if(j.results.length===0&&i(c.formatNoMatches,"formatNoMatches")){g("<li class='select2-no-results'>"+c.formatNoMatches(d.val())+"</li>");return}h.empty();f.opts.populateResults.call(this,h,j.results,{term:d.val(),page:this.resultsPage,context:null});if(j.more===true&&i(c.formatLoadMore,"formatLoadMore")){h.append("<li class='select2-more-results'>"+f.opts.escapeMarkup(c.formatLoadMore(this.resultsPage))+"</li>");window.setTimeout(function(){f.loadMoreIfNeeded()},10)}this.postprocessResults(j,l);n();this.opts.element.trigger({type:"loaded",data:j})})})},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:true});this.close();this.container.removeClass("select2-container-active");this.search[0]===document.activeElement&&this.search.blur();this.clearSearch();this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(c){var d=this.highlight(),b=this.results.find(".select2-highlighted"),a=b.closest(".select2-result").data("select2-data");if(a){this.highlight(d);this.onSelect(a,c)}},getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder},initContainerWidth:function(){function d(){var c,f,e,d,g;if(this.opts.width==="off")return null;else if(this.opts.width==="element")return this.opts.element.outerWidth(false)===0?"auto":this.opts.element.outerWidth(false)+"px";else if(this.opts.width==="copy"||this.opts.width==="resolve"){c=this.opts.element.attr("style");if(c!==b){f=c.split(";");for(d=0,g=f.length;d<g;d=d+1){e=f[d].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);if(e!==null&&e.length>=1)return e[1]}}c=this.opts.element.css("width");return c&&c.length>0?c:this.opts.width==="resolve"?this.opts.element.outerWidth(false)===0?"auto":this.opts.element.outerWidth(false)+"px":null}else return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var c=d.call(this);c!==null&&this.container.css("width",c)}});n=q(j,{createContainer:function(){return a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>","   <span></span><abbr class='select2-search-choice-close' style='display:none;'></abbr>","   <div><b></b></div>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop' style='display:none'>","   <div class='select2-search'>","       <input type='text' autocomplete='off' class='select2-input'/>","   </div>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},disable:function(){if(!this.enabled)return;this.parent.disable.apply(this,arguments);this.focusser.attr("disabled","disabled")},enable:function(){if(this.enabled)return;this.parent.enable.apply(this,arguments);this.focusser.removeAttr("disabled")},opening:function(){this.parent.opening.apply(this,arguments);this.focusser.attr("disabled","disabled");this.opts.element.trigger(a.Event("open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments);this.focusser.removeAttr("disabled");y(this.focusser)},focus:function(){if(this.opened())this.close();else{this.focusser.removeAttr("disabled");this.focusser.focus()}},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments);this.focusser.removeAttr("disabled");this.focusser.focus()},initContainer:function(){var b,f=this.container,g=this.dropdown,e=false;this.showSearch(this.opts.minimumResultsForSearch>=0);this.selection=b=f.find(".select2-choice");this.focusser=f.find(".select2-focusser");this.focusser.attr("id","s2id_autogen"+k());a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id"));this.search.bind("keydown",this.bind(function(a){if(!this.enabled)return;if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN){d(a);return}switch(a.which){case c.UP:case c.DOWN:this.moveHighlight(a.which===c.UP?-1:1);d(a);return;case c.TAB:case c.ENTER:this.selectHighlighted();d(a);return;case c.ESC:this.cancel(a);d(a);return}}));this.search.bind("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)}));this.focusser.bind("keydown",this.bind(function(a){if(!this.enabled)return;if(a.which===c.TAB||c.isControl(a)||c.isFunctionKey(a)||a.which===c.ESC)return;if(this.opts.openOnEnter===false&&a.which===c.ENTER){d(a);return}if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){this.open();d(a);return}if(a.which==c.DELETE||a.which==c.BACKSPACE){this.opts.allowClear&&this.clear();d(a);return}}));r(this.focusser);this.focusser.bind("keyup-change input",this.bind(function(a){if(this.opened())return;this.open();this.showSearchInput!==false&&this.search.val(this.focusser.val());this.focusser.val("");d(a)}));b.delegate("abbr","mousedown",this.bind(function(a){if(!this.enabled)return;this.clear();F(a);this.close();this.selection.focus()}));b.bind("mousedown",this.bind(function(a){e=true;if(this.opened())this.close();else this.enabled&&this.open();d(a);e=false}));g.bind("mousedown",this.bind(function(){this.search.focus()}));b.bind("focus",this.bind(function(a){d(a)}));this.focusser.bind("focus",this.bind(function(){this.container.addClass("select2-container-active")})).bind("blur",this.bind(function(){!this.opened()&&this.container.removeClass("select2-container-active")}));this.search.bind("focus",this.bind(function(){this.container.addClass("select2-container-active")}));this.initContainerWidth();this.opts.element.addClass("select2-offscreen");this.setPlaceholder()},clear:function(b){var a=this.selection.data("select2-data");if(a){this.opts.element.val("");this.selection.find("span").empty();this.selection.removeData("select2-data");this.setPlaceholder();if(b!==false){this.opts.element.trigger({type:"removed",val:this.id(a),choice:a});this.triggerChange({removed:a})}}},initSelection:function(){var c;if(this.opts.element.val()===""&&this.opts.element.text()===""){this.close();this.setPlaceholder()}else{var a=this;this.opts.initSelection.call(null,this.opts.element,function(c){if(c!==b&&c!==null){a.updateSelection(c);a.close();a.setPlaceholder()}})}},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments);if(b.element.get(0).tagName.toLowerCase()==="select")b.initSelection=function(d,c){var b=d.find(":selected");a.isFunction(c)&&c({id:b.attr("value"),text:b.text(),element:b})};else if("data"in b)b.initSelection=b.initSelection||function(f,c){var g=f.val(),d=null;b.query({matcher:function(f,h,c){var a=e(g,b.id(c));if(a)d=c;return a},callback:!a.isFunction(c)?a.noop:function(){c(d)}})};return b},getPlaceholder:function(){if(this.select)if(this.select.find("option").first().text()!=="")return b;return this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.opts.element.val()===""&&a!==b){if(this.select&&this.select.find("option:first").text()!=="")return;this.selection.find("span").html(this.opts.escapeMarkup(a));this.selection.addClass("select2-default");this.selection.find("abbr").hide()}},postprocessResults:function(h,g,f){var b=0,c=this,a=true;this.findHighlightableChoices().each2(function(d,a){if(e(c.id(a.data("select2-data")),c.opts.element.val())){b=d;return false}});f!==false&&this.highlight(b);if(g===true){var d=this.opts.minimumResultsForSearch;a=d<0?false:u(h.results)>=d;this.showSearch(a)}},showSearch:function(b){this.showSearchInput=b;this.dropdown.find(".select2-search")[b?"removeClass":"addClass"]("select2-search-hidden");a(this.dropdown,this.container)[b?"addClass":"removeClass"]("select2-with-searchbox")},onSelect:function(a,b){var d=this.opts.element.val(),c=this.data();this.opts.element.val(this.id(a));this.updateSelection(a);this.opts.element.trigger({type:"selected",val:this.id(a),choice:a});this.close();(!b||!b.noFocus)&&this.selection.focus();!e(d,this.id(a))&&this.triggerChange({added:a,removed:c})},updateSelection:function(d){var a=this.selection.find("span"),c;this.selection.data("select2-data",d);a.empty();c=this.opts.formatSelection(d,a);c!==b&&a.append(this.opts.escapeMarkup(c));this.selection.removeClass("select2-default");this.opts.allowClear&&this.getPlaceholder()!==b&&this.selection.find("abbr").show()},val:function(){var c,d=false,e=null,a=this,f=this.data();if(arguments.length===0)return this.opts.element.val();c=arguments[0];if(arguments.length>1)d=arguments[1];if(this.select){this.select.val(c).find(":selected").each2(function(b,a){e={id:a.attr("value"),text:a.text(),element:a.get(0)};return false});this.updateSelection(e);this.setPlaceholder();d&&this.triggerChange({added:e,removed:f})}else{if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");if(!c&&c!==0){this.clear(d);return}this.opts.element.val(c);this.opts.initSelection(this.opts.element,function(b){a.opts.element.val(!b?"":a.id(b));a.updateSelection(b);a.setPlaceholder();d&&a.triggerChange({added:b,removed:f})})}},clearSearch:function(){this.search.val("");this.focusser.val("")},data:function(a,d){var c;if(arguments.length===0){c=this.selection.data("select2-data");if(c==b)c=null;return c}else if(!a||a==="")this.clear(d);else{c=this.data();this.opts.element.val(!a?"":this.id(a));this.updateSelection(a);d&&this.triggerChange({added:a,removed:c})}}});o=q(j,{createContainer:function(){return a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["    <ul class='select2-choices'>","  <li class='select2-search-field'>","    <input type='text' autocomplete='off' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi' style='display:none;'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments);if(b.element.get(0).tagName.toLowerCase()==="select")b.initSelection=function(c,b){var a=[];c.find(":selected").each2(function(c,b){a.push({id:b.attr("value"),text:b.text(),element:b[0]})});b(a)};else if("data"in b)b.initSelection=b.initSelection||function(f,c){var g=p(f.val(),b.separator),d=[];b.query({matcher:function(h,i,f){var c=a.grep(g,function(a){return e(a,b.id(f))}).length;c&&d.push(f);return c},callback:!a.isFunction(c)?a.noop:function(){c(d)}})};return b},initContainer:function(){var e=".select2-choices",b;this.searchContainer=this.container.find(".select2-search-field");this.selection=b=this.container.find(e);this.search.attr("id","s2id_autogen"+k());a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id"));this.search.bind("input paste",this.bind(function(){if(!this.enabled)return;!this.opened()&&this.open()}));this.search.bind("keydown",this.bind(function(a){if(!this.enabled)return;if(a.which===c.BACKSPACE&&this.search.val()===""){this.close();var e,f=b.find(".select2-search-choice-focus");if(f.length>0){this.unselect(f.first());this.search.width(10);d(a);return}e=b.find(".select2-search-choice:not(.select2-locked)");e.length>0&&e.last().addClass("select2-search-choice-focus")}else b.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");if(this.opened())switch(a.which){case c.UP:case c.DOWN:this.moveHighlight(a.which===c.UP?-1:1);d(a);return;case c.ENTER:case c.TAB:this.selectHighlighted();d(a);return;case c.ESC:this.cancel(a);d(a);return}if(a.which===c.TAB||c.isControl(a)||c.isFunctionKey(a)||a.which===c.BACKSPACE||a.which===c.ESC)return;if(a.which===c.ENTER)if(this.opts.openOnEnter===false)return;else if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;this.open();(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&d(a);a.which===c.ENTER&&d(a)}));this.search.bind("keyup",this.bind(this.resizeSearch));this.search.bind("blur",this.bind(function(a){this.container.removeClass("select2-container-active");this.search.removeClass("select2-focused");this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");!this.opened()&&this.clearSearch();a.stopImmediatePropagation()}));this.container.delegate(e,"mousedown",this.bind(function(b){if(!this.enabled)return;if(a(b.target).closest(".select2-search-choice").length>0)return;this.clearPlaceholder();this.open();this.focusSearch();b.preventDefault()}));this.container.delegate(e,"focus",this.bind(function(){if(!this.enabled)return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active");this.clearPlaceholder()}));this.initContainerWidth();this.opts.element.addClass("select2-offscreen");this.clearSearch()},enable:function(){if(this.enabled)return;this.parent.enable.apply(this,arguments);this.search.removeAttr("disabled")},disable:function(){if(!this.enabled)return;this.parent.disable.apply(this,arguments);this.search.attr("disabled",true)},initSelection:function(){var c;if(this.opts.element.val()===""&&this.opts.element.text()===""){this.updateSelection([]);this.close();this.clearSearch()}if(this.select||this.opts.element.val()!==""){var a=this;this.opts.initSelection.call(null,this.opts.element,function(c){if(c!==b&&c!==null){a.updateSelection(c);a.close();a.clearSearch()}})}},clearSearch:function(){var a=this.getPlaceholder();if(a!==b&&this.getVal().length===0&&this.search.hasClass("select2-focused")===false){this.search.val(a).addClass("select2-default");this.search.width(this.getMaxSearchWidth())}else this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder();this.resizeSearch();this.parent.opening.apply(this,arguments);this.focusSearch();this.opts.element.trigger(a.Event("open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments)},focus:function(){this.close();this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(c){var e=[],d=[],b=this;a(c).each(function(){if(g(b.id(this),e)<0){e.push(b.id(this));d.push(this)}});c=d;this.selection.find(".select2-search-choice").remove();a(c).each(function(){b.addSelectedChoice(this)});b.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer(a,this.data(),this.bind(this.onSelect),this.opts);if(a!=null&&a!=b){this.search.val(a);a.length>0&&this.open()}},onSelect:function(a,b){this.addSelectedChoice(a);this.opts.element.trigger({type:"selected",val:this.id(a),choice:a});(this.select||!this.opts.closeOnSelect)&&this.postprocessResults();if(this.opts.closeOnSelect){this.close();this.search.width(10)}else if(this.countSelectableResults()>0){this.search.width(10);this.resizeSearch();this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(true);this.positionDropdown()}else{this.close();this.search.width(10)}this.triggerChange({added:a});(!b||!b.noFocus)&&this.focusSearch()},cancel:function(){this.close();this.focusSearch()},addSelectedChoice:function(e){var g=!e.locked,j=a("<li class='select2-search-choice'>    <div></div>    <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),i=a("<li class='select2-search-choice select2-locked'><div></div></li>"),c=g?j:i,k=this.id(e),h=this.getVal(),f;f=this.opts.formatSelection(e,c.find("div"));f!=b&&c.find("div").replaceWith("<div>"+this.opts.escapeMarkup(f)+"</div>");g&&c.find(".select2-search-choice-close").bind("mousedown",d).bind("click dblclick",this.bind(function(b){if(!this.enabled)return;a(b.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");this.close();this.focusSearch()})).dequeue();d(b)})).bind("focus",this.bind(function(){if(!this.enabled)return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active")}));c.data("select2-data",e);c.insertBefore(this.searchContainer);h.push(k);this.setVal(h)},unselect:function(a){var d=this.getVal(),b,c;a=a.closest(".select2-search-choice");if(a.length===0)throw"Invalid argument: "+a+". Must be .select2-search-choice";b=a.data("select2-data");if(!b)return;c=g(this.id(b),d);if(c>=0){d.splice(c,1);this.setVal(d);this.select&&this.postprocessResults()}a.remove();this.opts.element.trigger({type:"removed",val:this.id(b),choice:b});this.triggerChange({removed:b})},postprocessResults:function(){var d=this.getVal(),c=this.results.find(".select2-result"),b=this.results.find(".select2-result-with-children"),a=this;c.each2(function(e,b){var c=a.id(b.data("select2-data"));if(g(c,d)>=0){b.addClass("select2-selected");b.find(".select2-result-selectable").addClass("select2-selected")}});b.each2(function(b,a){!a.is(".select2-result-selectable")&&a.find(".select2-result-selectable:not(.select2-selected)").length===0&&a.addClass("select2-selected")});this.highlight()==-1&&a.highlight(0)},getMaxSearchWidth:function(){return this.selection.width()-s(this.search)},resizeSearch:function(){var d,f,b,e,a,c=s(this.search);d=I(this.search)+10;f=this.search.offset().left;b=this.selection.width();e=this.selection.offset().left;a=b-(f-e)-c;if(a<d)a=b-c;if(a<40)a=b-c;if(a<=0)a=d;this.search.width(a)},getVal:function(){var a;if(this.select){a=this.select.val();return a===null?[]:a}else{a=this.opts.element.val();return p(a,this.opts.separator)}},setVal:function(c){var b;if(this.select)this.select.val(c);else{b=[];a(c).each(function(){g(this,b)<0&&b.push(this)});this.opts.element.val(b.length===0?"":b.join(this.opts.separator))}},buildChangeDetails:function(b,a){console.log("current",a,"old",b);for(var a=a.slice(0),b=b.slice(0),c=0;c<a.length;c++)for(var d=0;d<b.length;d++)if(e(this.opts.id(a[c]),this.opts.id(b[d]))){a.splice(c,1);c--;b.splice(d,1);d--}return{added:a,removed:b}},val:function(f,e){var c,d=this,g;if(arguments.length===0)return this.getVal();c=this.data();if(!c.length)c=[];if(!f&&f!==0){this.opts.element.val("");this.updateSelection([]);this.clearSearch();e&&this.triggerChange({added:this.data(),removed:c});return}this.setVal(f);if(this.select){this.opts.initSelection(this.select,this.bind(this.updateSelection));e&&this.triggerChange(this.buildChangeDetails(c,this.data()))}else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var f=a(b).map(d.id);d.setVal(f);d.updateSelection(b);d.clearSearch();e&&d.triggerChange(this.buildChangeDetails(c,this.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0);this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))});this.setVal(b);this.triggerChange()},data:function(b,e){var f=this,c,d;if(arguments.length===0)return this.selection.find(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get();else{d=this.data();if(!b)b=[];c=a.map(b,function(a){return f.opts.id(a)});this.setVal(c);this.updateSelection(b);this.clearSearch();e&&this.triggerChange(this.buildChangeDetails(d,this.data()))}}});a.fn.select2=function(){var c=Array.prototype.slice.call(arguments,0),d,e,f,h,i=["val","destroy","opened","open","close","focus","isFocused","container","onSortStart","onSortEnd","enable","disable","positionDropdown","data"];this.each(function(){if(c.length===0||typeof c[0]==="object"){d=c.length===0?{}:a.extend({},c[0]);d.element=a(this);if(d.element.get(0).tagName.toLowerCase()==="select")h=d.element.attr("multiple");else{h=d.multiple||false;if("tags"in d)d.multiple=h=true}e=h?new o:new n;e.init(d)}else if(typeof c[0]==="string"){if(g(c[0],i)<0)throw"Unknown method: "+c[0];f=b;e=a(this).data("select2");if(e===b)return;if(c[0]==="container")f=e.container;else f=e[c[0]].apply(e,c.slice(1));if(f!==b)return false}else throw"Invalid arguments to select2 plugin: "+c;});return f===b?this:f};a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:true,openOnEnter:true,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(c,e,d,b){var a=[];w(c.text,d.term,a,b);return a.join("")},formatSelection:function(a){return a?a.text:b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(b,c){var a=c-b.length;return"Please enter "+a+" more character"+(a==1?"":"s")},formatInputTooLong:function(b,c){var a=b.length-c;return"Please delete "+a+" character"+(a==1?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(a==1?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return(""+b).toUpperCase().indexOf((""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:G,escapeMarkup:function(b){var a={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;","/":"&#47;"};return String(b).replace(/[&<>"'\/\\]/g,function(b){return a[b[0]]})},blurOnChange:false,selectOnBlur:false,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null}};window.Select2={query:{ajax:A,local:z,tags:B},util:{debounce:x,markMatch:w},"class":{"abstract":j,single:n,multi:o}}})(jQuery);(function(a){var b;a.fn.printThis=function(h){b=a.extend({},a.fn.printThis.defaults,h);var f=this instanceof jQuery?this:a(this),e="printThis-"+ +new Date;if(window.location.hostname!==document.domain&&navigator.userAgent.match(/msie/i)){var g='javascript:document.write("<head><script>document.domain=\\"'+document.domain+'\\";<\/script></head><body></body>")',d=document.createElement("iframe");d.name="printIframe";d.id=e;d.className="MSIE";document.body.appendChild(d);d.src=g}else{var i=a("<iframe id='"+e+"' name='printIframe' />");i.appendTo("body")}var c=a("#"+e);!b.debug&&c.css({position:"absolute",width:"0px",height:"0px",left:"-600px",top:"-600px"});setTimeout(function(){var d=c.contents();b.importCSS&&a("link[rel=stylesheet]").each(function(){var b=a(this).attr("href");if(b){var c=a(this).attr("media")||"all";d.find("head").append("<link type='text/css' rel='stylesheet' href='"+b+"' media='"+c+"'>")}});b.pageTitle&&d.find("head").append("<title>"+b.pageTitle+"</title>");b.loadCSS&&d.find("head").append("<link type='text/css' rel='stylesheet' href='"+b.loadCSS+"'>");b.header&&d.find("body").append(b.header);if(b.printContainer)d.find("body").append(f.outer());else f.each(function(){d.find("body").append(a(this).html())});if(b.removeInline)if(a.isFunction(a.removeAttr))d.find("body *").removeAttr("style");else d.find("body *").attr("style","");setTimeout(function(){if(c.hasClass("MSIE")){window.frames.printIframe.focus();d.find("head").append("<script>  window.print(); <\/script>")}else{c[0].contentWindow.focus();c[0].contentWindow.print()}f.trigger("done");!b.debug&&setTimeout(function(){c.remove()},1e3)},b.printDelay)},333)};a.fn.printThis.defaults={debug:false,importCSS:true,printContainer:true,loadCSS:"",pageTitle:"",removeInline:false,printDelay:333,header:null};jQuery.fn.outer=function(){return a(a("<div></div>").html(this.clone())).html()}})(jQuery);!function(a){"use strict";a(function(){a.support.transition=function(){var a=function(){var c=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},a;for(a in b)if(c.style[a]!==undefined)return b[a]}();return a&&{end:a}}()})}(window.jQuery);!function(a){"use strict";var d="[data-toggle=dropdown]",b=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};b.prototype={constructor:b,toggle:function(){var d=a(this),b,f;if(d.is(".disabled, :disabled"))return;b=c(d);f=b.hasClass("open");e();!f&&b.toggleClass("open");d.focus();return false},keydown:function(e){var f,d,i,h,g,b;if(!/(38|40|27)/.test(e.keyCode))return;f=a(this);e.preventDefault();e.stopPropagation();if(f.is(".disabled, :disabled"))return;h=c(f);g=h.hasClass("open");if(!g||g&&e.keyCode==27)return f.click();d=a("[role=menu] li:not(.divider):visible a",h);if(!d.length)return;b=d.index(d.filter(":focus"));if(e.keyCode==38&&b>0)b--;if(e.keyCode==40&&b<d.length-1)b++;if(!~b)b=0;d.eq(b).focus()}};function e(){a(d).each(function(){c(a(this)).removeClass("open")})}function c(d){var b=d.attr("data-target"),c;if(!b){b=d.attr("href");b=b&&/#/.test(b)&&b.replace(/.*(?=#[^\s]*$)/,"")}c=a(b);c.length||(c=d.parent());return c}var f=a.fn.dropdown;a.fn.dropdown=function(c){return this.each(function(){var d=a(this),e=d.data("dropdown");!e&&d.data("dropdown",e=new b(this));typeof c=="string"&&e[c].call(d)})};a.fn.dropdown.Constructor=b;a.fn.dropdown.noConflict=function(){a.fn.dropdown=f;return this};a(document).on("click.dropdown.data-api touchstart.dropdown.data-api",e).on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("touchstart.dropdown.data-api",".dropdown-menu",function(a){a.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",d,b.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",d+", [role=menu]",b.prototype.keydown)}(window.jQuery);!function(a){"use strict";function b(b,e){var f=a.proxy(this.process,this),d=a(b).is("body")?a(window):a(b),c;this.options=a.extend({},a.fn.scrollspy.defaults,e);this.$scrollElement=d.on("scroll.scroll-spy.data-api",f);this.selector=(this.options.target||(c=a(b).attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a";this.$body=a("body");this.refresh();this.process()}b.prototype={constructor:b,refresh:function(){var b=this,c;this.offsets=a([]);this.targets=a([]);c=this.$body.find(this.selector).map(function(){var e=a(this),d=e.data("target")||e.attr("href"),c=/^#\w/.test(d)&&a(d);return c&&c.length&&[[c.position().top+b.$scrollElement.scrollTop(),d]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]);b.targets.push(this[1])})},process:function(){var c=this.$scrollElement.scrollTop()+this.options.offset,f=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,g=f-this.$scrollElement.height(),b=this.offsets,d=this.targets,e=this.activeTarget,a;if(c>=g)return e!=(a=d.last()[0])&&this.activate(a);for(a=b.length;a--;)e!=d[a]&&c>=b[a]&&(!b[a+1]||c<=b[a+1])&&this.activate(d[a])},activate:function(c){var b,d;this.activeTarget=c;a(this.selector).parent(".active").removeClass("active");d=this.selector+'[data-target="'+c+'"],'+this.selector+'[href="'+c+'"]';b=a(d).parent("li").addClass("active");if(b.parent(".dropdown-menu").length)b=b.closest("li.dropdown").addClass("active");b.trigger("activate")}};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var e=a(this),d=e.data("scrollspy"),f=typeof c=="object"&&c;!d&&e.data("scrollspy",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.scrollspy.Constructor=b;a.fn.scrollspy.defaults={offset:10};a.fn.scrollspy.noConflict=function(){a.fn.scrollspy=c;return this};a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery);!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,g=b.closest("ul:not(.dropdown-menu)"),c=b.attr("data-target"),d,e,f;if(!c){c=b.attr("href");c=c&&c.replace(/.*(?=#[^\s]*$)/,"")}if(b.parent("li").hasClass("active"))return;d=g.find(".active:last a")[0];f=a.Event("show",{relatedTarget:d});b.trigger(f);if(f.isDefaultPrevented())return;e=a(c);this.activate(b.parent("li"),g);this.activate(e,e.parent(),function(){b.trigger({type:"shown",relatedTarget:d})})},activate:function(b,g,d){var c=g.find("> .active"),e=d&&a.support.transition&&c.hasClass("fade");function f(){c.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");b.addClass("active");if(e){b[0].offsetWidth;b.addClass("in")}else b.removeClass("fade");b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active");d&&d()}e?c.one(a.support.transition.end,f):f();c.removeClass("in")}};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var e=a(this),d=e.data("tab");!d&&e.data("tab",d=new b(this));typeof c=="string"&&d[c]()})};a.fn.tab.Constructor=b;a.fn.tab.noConflict=function(){a.fn.tab=c;return this};a(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault();a(this).tab("show")})}(window.jQuery);!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(f,d,e){var c,b;this.type=f;this.$element=a(d);this.options=this.getOptions(e);this.enabled=true;if(this.options.trigger=="click")this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if(this.options.trigger!="manual"){c=this.options.trigger=="hover"?"mouseenter":"focus";b=this.options.trigger=="hover"?"mouseleave":"blur";this.$element.on(c+"."+this.type,this.options.selector,a.proxy(this.enter,this));this.$element.on(b+"."+this.type,this.options.selector,a.proxy(this.leave,this))}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){b=a.extend({},a.fn[this.type].defaults,b,this.$element.data());if(b.delay&&typeof b.delay=="number")b.delay={show:b.delay,hide:b.delay};return b},enter:function(c){var b=a(c.currentTarget)[this.type](this._options).data(this.type);if(!b.options.delay||!b.options.delay.show)return b.show();clearTimeout(this.timeout);b.hoverState="in";this.timeout=setTimeout(function(){b.hoverState=="in"&&b.show()},b.options.delay.show)},leave:function(c){var b=a(c.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!b.options.delay||!b.options.delay.hide)return b.hide();b.hoverState="out";this.timeout=setTimeout(function(){b.hoverState=="out"&&b.hide()},b.options.delay.hide)},show:function(){var b,g,a,f,e,c,d;if(this.hasContent()&&this.enabled){b=this.tip();this.setContent();this.options.animation&&b.addClass("fade");c=typeof this.options.placement=="function"?this.options.placement.call(this,b[0],this.$element[0]):this.options.placement;g=/in/.test(c);b.detach().css({top:0,left:0,display:"block"}).insertAfter(this.$element);a=this.getPosition(g);f=b[0].offsetWidth;e=b[0].offsetHeight;switch(g?c.split(" ")[1]:c){case"bottom":d={top:a.top+a.height,left:a.left+a.width/2-f/2};break;case"top":d={top:a.top-e,left:a.left+a.width/2-f/2};break;case"left":d={top:a.top+a.height/2-e/2,left:a.left-f};break;case"right":d={top:a.top+a.height/2-e/2,left:a.left+a.width}}b.offset(d).addClass(c).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b);a.removeClass("fade in top bottom left right")},hide:function(){var d=this,b=this.tip();b.removeClass("in");function c(){var c=setTimeout(function(){b.off(a.support.transition.end).detach()},500);b.one(a.support.transition.end,function(){clearTimeout(c);b.detach()})}a.support.transition&&this.$tip.hasClass("fade")?c():b.detach();return this},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var b,c=this.$element,a=this.options;b=c.attr("data-original-title")||(typeof a.title=="function"?a.title.call(c[0]):a.title);return b},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(c){var b=a(c.currentTarget)[this.type](this._options).data(this.type);b[b.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var e=a(this),d=e.data("tooltip"),f=typeof c=="object"&&c;!d&&e.data("tooltip",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.tooltip.Constructor=b;a.fn.tooltip.defaults={animation:true,placement:"top",selector:false,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:false};a.fn.tooltip.noConflict=function(){a.fn.tooltip=c;return this}}(window.jQuery);!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),c=this.getTitle(),b=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](c);a.find(".popover-content")[this.options.html?"html":"text"](b);a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var b,c=this.$element,a=this.options;b=c.attr("data-content")||(typeof a.content=="function"?a.content.call(c[0]):a.content);return b},tip:function(){if(!this.$tip)this.$tip=a(this.options.template);return this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var e=a(this),d=e.data("popover"),f=typeof c=="object"&&c;!d&&e.data("popover",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.popover.Constructor=b;a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'});a.fn.popover.noConflict=function(){a.fn.popover=c;return this}}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.options=a.extend({},a.fn.affix.defaults,c);this.$window=a(window).on("scroll.affix.data-api",a.proxy(this.checkPosition,this)).on("click.affix.data-api",a.proxy(function(){setTimeout(a.proxy(this.checkPosition,this),1)},this));this.$element=a(b);this.checkPosition()};b.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var h=a(document).height(),f=this.$window.scrollTop(),g=this.$element.offset(),b=this.options.offset,d=b.bottom,e=b.top,i="affix affix-top affix-bottom",c;if(typeof b!="object")d=e=b;if(typeof e=="function")e=b.top();if(typeof d=="function")d=b.bottom();c=this.unpin!=null&&f+this.unpin<=g.top?false:d!=null&&g.top+this.$element.height()>=h-d?"bottom":e!=null&&f<=e?"top":false;if(this.affixed===c)return;this.affixed=c;this.unpin=c=="bottom"?g.top-f:null;this.$element.removeClass(i).addClass("affix"+(c?"-"+c:""))};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var e=a(this),d=e.data("affix"),f=typeof c=="object"&&c;!d&&e.data("affix",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.affix.Constructor=b;a.fn.affix.defaults={offset:0};a.fn.affix.noConflict=function(){a.fn.affix=c;return this};a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),b=c.data();b.offset=b.offset||{};b.offsetBottom&&(b.offset.bottom=b.offsetBottom);b.offsetTop&&(b.offset.top=b.offsetTop);c.affix(b)})})}(window.jQuery);!function(a){"use strict";var c='[data-dismiss="alert"]',b=function(b){a(b).on("click",c,this.close)};b.prototype.close=function(e){var d=a(this),c=d.attr("data-target"),b;if(!c){c=d.attr("href");c=c&&c.replace(/.*(?=#[^\s]*$)/,"")}b=a(c);e&&e.preventDefault();b.length||(b=d.hasClass("alert")?d:d.parent());b.trigger(e=a.Event("close"));if(e.isDefaultPrevented())return;b.removeClass("in");function f(){b.trigger("closed").remove()}a.support.transition&&b.hasClass("fade")?b.on(a.support.transition.end,f):f()};var d=a.fn.alert;a.fn.alert=function(c){return this.each(function(){var d=a(this),e=d.data("alert");!e&&d.data("alert",e=new b(this));typeof c=="string"&&e[c].call(d)})};a.fn.alert.Constructor=b;a.fn.alert.noConflict=function(){a.fn.alert=d;return this};a(document).on("click.alert.data-api",c,b.prototype.close)}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.$element=a(b);this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(b){var c="disabled",a=this.$element,d=a.data(),e=a.is("input")?"val":"html";b=b+"Text";d.resetText||a.data("resetText",a[e]());a[e](d[b]||this.options[b]);setTimeout(function(){b=="loadingText"?a.addClass(c).attr(c,c):a.removeClass(c).removeAttr(c)},0)};b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active");this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var e=a(this),d=e.data("button"),f=typeof c=="object"&&c;!d&&e.data("button",d=new b(this,f));if(c=="toggle")d.toggle();else c&&d.setState(c)})};a.fn.button.defaults={loadingText:"loading..."};a.fn.button.Constructor=b;a.fn.button.noConflict=function(){a.fn.button=c;return this};a(document).on("click.button.data-api","[data-toggle^=button]",function(c){var b=a(c.target);if(!b.hasClass("btn"))b=b.closest(".btn");b.button("toggle")})}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.$element=a(b);this.options=a.extend({},a.fn.collapse.defaults,c);if(this.options.parent)this.$parent=a(this.options.parent);this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var c,e,b,d;if(this.transitioning)return;c=this.dimension();e=a.camelCase(["scroll",c].join("-"));b=this.$parent&&this.$parent.find("> .accordion-group > .in");if(b&&b.length){d=b.data("collapse");if(d&&d.transitioning)return;b.collapse("hide");d||b.data("collapse",null)}this.$element[c](0);this.transition("addClass",a.Event("show"),"shown");a.support.transition&&this.$element[c](this.$element[0][e])},hide:function(){var b;if(this.transitioning)return;b=this.dimension();this.reset(this.$element[b]());this.transition("removeClass",a.Event("hide"),"hidden");this.$element[b](0)},reset:function(a){var b=this.dimension();this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth;this.$element[a!==null?"addClass":"removeClass"]("collapse");return this},transition:function(f,b,e){var c=this,d=function(){b.type=="show"&&c.reset();c.transitioning=0;c.$element.trigger(e)};this.$element.trigger(b);if(b.isDefaultPrevented())return;this.transitioning=1;this.$element[f]("in");a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,d):d()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var e=a(this),d=e.data("collapse"),f=typeof c=="object"&&c;!d&&e.data("collapse",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.collapse.defaults={toggle:true};a.fn.collapse.Constructor=b;a.fn.collapse.noConflict=function(){a.fn.collapse=c;return this};a(document).on("click.collapse.data-api","[data-toggle=collapse]",function(f){var b=a(this),d,c=b.attr("data-target")||f.preventDefault()||(d=b.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),e=a(c).data("collapse")?"toggle":b.data();b[a(c).hasClass("in")?"addClass":"removeClass"]("collapsed");a(c).collapse(e)})}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.$element=a(b);this.options=c;this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){if(!b)this.paused=false;this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval));return this},to:function(b){var e=this.$element.find(".item.active"),c=e.parent().children(),d=c.index(e),f=this;return b>c.length-1||b<0?void 0:this.sliding?this.$element.one("slid",function(){f.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(c[b]))},pause:function(b){if(!b)this.paused=true;if(this.$element.find(".next, .prev").length&&a.support.transition.end){this.$element.trigger(a.support.transition.end);this.cycle()}clearInterval(this.interval);this.interval=null;return this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(c,j){var f=this.$element.find(".item.active"),b=j||f[c](),g=this.interval,e=c=="next"?"left":"right",i=c=="next"?"first":"last",h=this,d;this.sliding=true;g&&this.pause();b=b.length?b:this.$element.find(".item")[i]();d=a.Event("slide",{relatedTarget:b[0]});if(b.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(d);if(d.isDefaultPrevented())return;b.addClass(c);b[0].offsetWidth;f.addClass(e);b.addClass(e);this.$element.one(a.support.transition.end,function(){b.removeClass([c,e].join(" ")).addClass("active");f.removeClass(["active",e].join(" "));h.sliding=false;setTimeout(function(){h.$element.trigger("slid")},0)})}else{this.$element.trigger(d);if(d.isDefaultPrevented())return;f.removeClass("active");b.addClass("active");this.sliding=false;this.$element.trigger("slid")}g&&this.cycle();return this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var g=a(this),d=g.data("carousel"),e=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c),f=typeof c=="string"?c:e.slide;!d&&g.data("carousel",d=new b(this,e));if(typeof c=="number")d.to(c);else if(f)d[f]();else e.interval&&d.cycle()})};a.fn.carousel.defaults={interval:5e3,pause:"hover"};a.fn.carousel.Constructor=b;a.fn.carousel.noConflict=function(){a.fn.carousel=c;return this};a(document).on("click.carousel.data-api","[data-slide]",function(f){var b=a(this),d,c=a(b.attr("data-target")||(d=b.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),e=a.extend({},c.data(),b.data());c.carousel(e);f.preventDefault()})}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.$element=a(b);this.options=a.extend({},a.fn.typeahead.defaults,c);this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.highlighter=this.options.highlighter||this.highlighter;this.updater=this.options.updater||this.updater;this.source=this.options.source;this.$menu=a(this.options.menu);this.shown=false;this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");this.$element.val(this.updater(a)).change();return this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});this.$menu.insertAfter(this.$element).css({top:b.top+b.height,left:b.left}).show();this.shown=true;return this},hide:function(){this.$menu.hide();this.shown=false;return this},lookup:function(){var b;this.query=this.$element.val();if(!this.query||this.query.length<this.options.minLength)return this.shown?this.hide():this;b=a.isFunction(this.source)?this.source(this.query,a.proxy(this.process,this)):this.source;return b?this.process(b):this},process:function(b){var c=this;b=a.grep(b,function(a){return c.matcher(a)});b=this.sorter(b);return!b.length?this.shown?this.hide():this:this.render(b.slice(0,this.options.items)).show()},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var d=[],c=[],b=[],a;while(a=e.shift())if(!a.toLowerCase().indexOf(this.query.toLowerCase()))d.push(a);else if(~a.indexOf(this.query))c.push(a);else b.push(a);return d.concat(c,b)},highlighter:function(b){var a=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return b.replace(new RegExp("("+a+")","ig"),function(b,a){return"<strong>"+a+"</strong>"})},render:function(b){var c=this;b=a(b).map(function(b,d){b=a(c.options.item).attr("data-value",d);b.find("a").html(c.highlighter(d));return b[0]});b.first().addClass("active");this.$menu.html(b);return this},next:function(){var c=this.$menu.find(".active").removeClass("active"),b=c.next();if(!b.length)b=a(this.$menu.find("li")[0]);b.addClass("active")},prev:function(){var b=this.$menu.find(".active").removeClass("active"),a=b.prev();if(!a.length)a=this.$menu.find("li").last();a.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this));if(this.eventSupported("keydown"))this.$element.on("keydown",a.proxy(this.keydown,this));this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},eventSupported:function(b){var a=b in this.$element;if(!a){this.$element.setAttribute(b,"return;");a=typeof this.$element[b]==="function"}return a},move:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault();this.prev();break;case 40:a.preventDefault();this.next()}a.stopPropagation()},keydown:function(b){this.suppressKeyPressRepeat=~a.inArray(b.keyCode,[40,38,9,13,27]);this.move(b)},keypress:function(a){if(this.suppressKeyPressRepeat)return;this.move(a)},keyup:function(a){switch(a.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation();a.preventDefault()},blur:function(){var a=this;setTimeout(function(){a.hide()},150)},click:function(a){a.stopPropagation();a.preventDefault();this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active");a(b.currentTarget).addClass("active")}};var c=a.fn.typeahead;a.fn.typeahead=function(c){return this.each(function(){var e=a(this),d=e.data("typeahead"),f=typeof c=="object"&&c;!d&&e.data("typeahead",d=new b(this,f));typeof c=="string"&&d[c]()})};a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1};a.fn.typeahead.Constructor=b;a.fn.typeahead.noConflict=function(){a.fn.typeahead=c;return this};a(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(c){var b=a(this);if(b.data("typeahead"))return;c.preventDefault();b.typeahead(b.data())})}(window.jQuery);!function(a){"use strict";var b=function(b,c){this.options=c;this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this));this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[!this.isShown?"show":"hide"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=true;this.escape();this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body);b.$element.show();if(c)b.$element[0].offsetWidth;b.$element.addClass("in").attr("aria-hidden",false);b.enforceFocus();c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide");this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=false;this.escape();a(document).off("focusin.modal");this.$element.removeClass("in").attr("aria-hidden",true);a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;if(this.isShown&&this.options.keyboard)this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()});else!this.isShown&&this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end);b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c);b.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden");this.backdrop()},removeBackdrop:function(){this.$backdrop.remove();this.$backdrop=null},backdrop:function(b){var f=this,d=this.$element.hasClass("fade")?"fade":"",e=a("div.modal-backdrop").length;if(this.isShown&&this.options.backdrop&&!e){var c=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body);this.$backdrop.click(this.options.backdrop=="static"?a.proxy(this.$element[0].focus,this.$element[0]):a.proxy(this.hide,this));if(c)this.$backdrop[0].offsetWidth;this.$backdrop.addClass("in");c?this.$backdrop.one(a.support.transition.end,b):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(this.removeBackdrop,this)):this.removeBackdrop()}else b&&b()}};var c=a.fn.modal;a.fn.modal=function(c){return this.each(function(){var e=a(this),d=e.data("modal"),f=a.extend({},a.fn.modal.defaults,e.data(),typeof c=="object"&&c);!d&&e.data("modal",d=new b(this,f));if(typeof c=="string")d[c]();else f.show&&d.show()})};a.fn.modal.defaults={backdrop:true,keyboard:true,show:true};a.fn.modal.Constructor=b;a.fn.modal.noConflict=function(){a.fn.modal=c;return this};a(document).on("click.modal.data-api",'[data-toggle="modal"]',function(f){var b=a(this),c=b.attr("href"),d=a(b.attr("data-target")||c&&c.replace(/.*(?=#[^\s]+$)/,"")),e=d.data("modal")?"toggle":a.extend({remote:!/#/.test(c)&&c},d.data(),b.data());f.preventDefault();d.modal(e).one("hide",function(){b.focus()})})}(window.jQuery);!function(a){function d(){return new Date(Date.UTC.apply(Date,arguments))}var e=function(e,d){var f=this;this.element=a(e);this.language=d.language||this.element.data("date-language")||"en";this.language=this.language in c?this.language:this.language.split("-")[0];this.language=this.language in c?this.language:"en";this.isRTL=c[this.language].rtl||false;this.format=b.parseFormat(d.format||this.element.data("date-format")||c[this.language].format||"mm/dd/yyyy");this.isInline=false;this.isInput=this.element.is("input");this.component=this.element.is(".date")?this.element.find(".add-on, .btn"):false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0)this.component=false;this.forceParse=true;if("forceParse"in d)this.forceParse=d.forceParse;else if("dateForceParse"in this.element.data())this.forceParse=this.element.data("date-force-parse");this.picker=a(b.template);this._buildEvents();this._attachEvents();if(this.isInline)this.picker.addClass("datepicker-inline").appendTo(this.element);else this.picker.addClass("datepicker-dropdown dropdown-menu");if(this.isRTL){this.picker.addClass("datepicker-rtl");this.picker.find(".prev i, .next i").toggleClass("icon-arrow-left icon-arrow-right")}this.autoclose=false;if("autoclose"in d)this.autoclose=d.autoclose;else if("dateAutoclose"in this.element.data())this.autoclose=this.element.data("date-autoclose");this.keyboardNavigation=true;if("keyboardNavigation"in d)this.keyboardNavigation=d.keyboardNavigation;else if("dateKeyboardNavigation"in this.element.data())this.keyboardNavigation=this.element.data("date-keyboard-navigation");this.viewMode=this.startViewMode=0;switch(d.startView||this.element.data("date-start-view")){case 2:case"decade":this.viewMode=this.startViewMode=2;break;case 1:case"year":this.viewMode=this.startViewMode=1}this.minViewMode=d.minViewMode||this.element.data("date-min-view-mode")||0;if(typeof this.minViewMode==="string")switch(this.minViewMode){case"months":this.minViewMode=1;break;case"years":this.minViewMode=2;break;default:this.minViewMode=0}this.viewMode=this.startViewMode=Math.max(this.startViewMode,this.minViewMode);this.todayBtn=d.todayBtn||this.element.data("date-today-btn")||false;this.todayHighlight=d.todayHighlight||this.element.data("date-today-highlight")||false;this.calendarWeeks=false;if("calendarWeeks"in d)this.calendarWeeks=d.calendarWeeks;else if("dateCalendarWeeks"in this.element.data())this.calendarWeeks=this.element.data("date-calendar-weeks");this.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(b,a){return parseInt(a)+1});this._allow_update=false;this.weekStart=(d.weekStart||this.element.data("date-weekstart")||c[this.language].weekStart||0)%7;this.weekEnd=(this.weekStart+6)%7;this.startDate=-Infinity;this.endDate=Infinity;this.daysOfWeekDisabled=[];this.beforeShowDay=d.beforeShowDay||a.noop;this.setStartDate(d.startDate||this.element.data("date-startdate"));this.setEndDate(d.endDate||this.element.data("date-enddate"));this.setDaysOfWeekDisabled(d.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.fillDow();this.fillMonths();this.setRange(d.range);this._allow_update=true;this.update();this.showMode();this.isInline&&this.show()};e.prototype={constructor:e,_events:[],_secondaryEvents:[],_applyEvents:function(b){for(var a=0,c,d;a<b.length;a++){c=b[a][0];d=b[a][1];c.on(d)}},_unapplyEvents:function(b){for(var a=0,c,d;a<b.length;a++){c=b[a][0];d=b[a][1];c.off(d)}},_buildEvents:function(){if(this.isInput)this._events=[[this.element,{keyup:a.proxy(this.update,this),keydown:a.proxy(this.keydown,this)}]];else if(this.component&&this.hasInput)this._events=[[this.element.find("input"),{keyup:a.proxy(this.update,this),keydown:a.proxy(this.keydown,this)}],[this.component,{click:a.proxy(this.show,this)}]];else if(this.element.is("div"))this.isInline=true;else this._events=[[this.element,{click:a.proxy(this.show,this)}]];this._secondaryEvents=[[this.picker,{click:a.proxy(this.click,this)}],[a(window),{resize:a.proxy(this.place,this)}],[a(document),{mousedown:a.proxy(function(b){a(b.target).closest(".datepicker.datepicker-inline, .datepicker.datepicker-dropdown").length===0&&this.hide()},this)}]]},_attachEvents:function(){this._detachEvents();this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents();this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(e,d){var c=d||this.date;c=new Date(c.getTime()+c.getTimezoneOffset()*6e4);this.element.trigger({type:e,date:c,format:a.proxy(function(a){var d=this.format;if(a)d=b.parseFormat(a);return b.formatDate(c,d,this.language)},this)})},show:function(a){!this.isInline&&this.picker.appendTo("body");this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();this.place();this._attachSecondaryEvents();a&&a.preventDefault();this._trigger("show")},hide:function(){if(this.isInline)return;if(!this.picker.is(":visible"))return;this.picker.hide().detach();this._detachSecondaryEvents();this.viewMode=this.startViewMode;this.showMode();this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue();this._trigger("hide")},remove:function(){this.hide();this._detachEvents();this._detachSecondaryEvents();this.picker.remove();delete this.element.data().datepicker;if(!this.isInput)delete this.element.data().date},getDate:function(){var a=this.getUTCDate();return new Date(a.getTime()+a.getTimezoneOffset()*6e4)},getUTCDate:function(){return this.date},setDate:function(a){this.setUTCDate(new Date(a.getTime()-a.getTimezoneOffset()*6e4))},setUTCDate:function(a){this.date=a;this.setValue()},setValue:function(){var a=this.getFormattedDate();if(!this.isInput)this.component&&this.element.find("input").val(a);else this.element.val(a)},getFormattedDate:function(a){if(a===undefined)a=this.format;return b.formatDate(this.date,a,this.language)},setStartDate:function(a){this.startDate=a||-Infinity;if(this.startDate!==-Infinity)this.startDate=b.parseDate(this.startDate,this.format,this.language);this.update();this.updateNavArrows()},setEndDate:function(a){this.endDate=a||Infinity;if(this.endDate!==Infinity)this.endDate=b.parseDate(this.endDate,this.format,this.language);this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(b){this.daysOfWeekDisabled=b||[];if(!a.isArray(this.daysOfWeekDisabled))this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/);this.daysOfWeekDisabled=a.map(this.daysOfWeekDisabled,function(a){return parseInt(a,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline)return;var d=parseInt(this.element.parents().filter(function(){return a(this).css("z-index")!="auto"}).first().css("z-index"))+10,b=this.component?this.component.parent().offset():this.element.offset(),c=this.component?this.component.outerHeight(true):this.element.outerHeight(true);this.picker.css({top:b.top+c,left:b.left,zIndex:d})},_allow_update:true,update:function(){if(!this._allow_update)return;var a,c=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0]instanceof Date)){a=arguments[0];c=true}else{a=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val();delete this.element.data().date}this.date=b.parseDate(a,this.format,this.language);c&&this.setValue();if(this.date<this.startDate)this.viewDate=new Date(this.startDate);else if(this.date>this.endDate)this.viewDate=new Date(this.endDate);else this.viewDate=new Date(this.date);this.fill()},fillDow:function(){var b=this.weekStart,a="<tr>";if(this.calendarWeeks){var d='<th class="cw">&nbsp;</th>';a+=d;this.picker.find(".datepicker-days thead tr:first-child").prepend(d)}while(b<this.weekStart+7)a+='<th class="dow">'+c[this.language].daysMin[b++%7]+"</th>";a+="</tr>";this.picker.find(".datepicker-days thead").append(a)},fillMonths:function(){var a="",b=0;while(b<12)a+='<span class="month">'+c[this.language].monthsShort[b++]+"</span>";this.picker.find(".datepicker-months td").html(a)},setRange:function(b){if(!b||!b.length)delete this.range;else this.range=a.map(b,function(a){return a.valueOf()});this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),g=this.viewDate.getUTCMonth(),f=this.date.valueOf(),e=new Date;if(b.getUTCFullYear()<d||b.getUTCFullYear()==d&&b.getUTCMonth()<g)c.push("old");else(b.getUTCFullYear()>d||b.getUTCFullYear()==d&&b.getUTCMonth()>g)&&c.push("new");this.todayHighlight&&b.getUTCFullYear()==e.getFullYear()&&b.getUTCMonth()==e.getMonth()&&b.getUTCDate()==e.getDate()&&c.push("today");f&&b.valueOf()==f&&c.push("active");(b.valueOf()<this.startDate||b.valueOf()>this.endDate||a.inArray(b.getUTCDay(),this.daysOfWeekDisabled)!==-1)&&c.push("disabled");if(this.range){b>this.range[0]&&b<this.range[this.range.length-1]&&c.push("range");a.inArray(b.valueOf(),this.range)!=-1&&c.push("selected")}return c},fill:function(){var v=new Date(this.viewDate),e=v.getUTCFullYear(),r=v.getUTCMonth(),n=this.startDate!==-Infinity?this.startDate.getUTCFullYear():-Infinity,w=this.startDate!==-Infinity?this.startDate.getUTCMonth():-Infinity,o=this.endDate!==Infinity?this.endDate.getUTCFullYear():Infinity,x=this.endDate!==Infinity?this.endDate.getUTCMonth():Infinity,A=this.date&&this.date.valueOf(),p;this.picker.find(".datepicker-days thead th.datepicker-switch").text(c[this.language].months[r]+" "+e);this.picker.find("tfoot th.today").text(c[this.language].today).toggle(this.todayBtn!==false);this.updateNavArrows();this.fillMonths();var f=d(e,r-1,28,0,0,0,0),s=b.getDaysInMonth(f.getUTCFullYear(),f.getUTCMonth());f.setUTCDate(s);f.setUTCDate(s-(f.getUTCDay()-this.weekStart+7)%7);var j=new Date(f);j.setUTCDate(j.getUTCDate()+42);j=j.valueOf();var i=[],h;while(f.valueOf()<j){if(f.getUTCDay()==this.weekStart){i.push("<tr>");if(this.calendarWeeks){var u=new Date(+f+(this.weekStart-f.getUTCDay()-7)%7*864e5),t=new Date(+u+(7+4-u.getUTCDay())%7*864e5),q=new Date(+(q=d(t.getUTCFullYear(),0,1))+(7+4-q.getUTCDay())%7*864e5),z=(t-q)/864e5/7+1;i.push('<td class="cw">'+z+"</td>")}}h=this.getClassNames(f);h.push("day");var g=this.beforeShowDay(f);if(g===undefined)g={};else if(typeof g==="boolean")g={enabled:g};else if(typeof g==="string")g={classes:g};g.enabled===false&&h.push("disabled");if(g.classes)h=h.concat(g.classes.split(/\s+/));if(g.tooltip)p=g.tooltip;h=a.unique(h);i.push('<td class="'+h.join(" ")+'"'+(p?' title="'+p+'"':"")+">"+f.getUTCDate()+"</td>");f.getUTCDay()==this.weekEnd&&i.push("</tr>");f.setUTCDate(f.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(i.join(""));var m=this.date&&this.date.getUTCFullYear(),k=this.picker.find(".datepicker-months").find("th:eq(1)").text(e).end().find("span").removeClass("active");m&&m==e&&k.eq(this.date.getUTCMonth()).addClass("active");(e<n||e>o)&&k.addClass("disabled");e==n&&k.slice(0,w).addClass("disabled");e==o&&k.slice(x+1).addClass("disabled");i="";e=parseInt(e/10,10)*10;var y=this.picker.find(".datepicker-years").find("th:eq(1)").text(e+"-"+(e+9)).end().find("td");e-=1;for(var l=-1;l<11;l++){i+='<span class="year'+(l==-1||l==10?" old":"")+(m==e?" active":"")+(e<n||e>o?" disabled":"")+'">'+e+"</span>";e+=1}y.html(i)},updateNavArrows:function(){if(!this._allow_update)return;var c=new Date(this.viewDate),a=c.getUTCFullYear(),b=c.getUTCMonth();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&a<=this.startDate.getUTCFullYear()&&b<=this.startDate.getUTCMonth())this.picker.find(".prev").css({visibility:"hidden"});else this.picker.find(".prev").css({visibility:"visible"});if(this.endDate!==Infinity&&a>=this.endDate.getUTCFullYear()&&b>=this.endDate.getUTCMonth())this.picker.find(".next").css({visibility:"hidden"});else this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:if(this.startDate!==-Infinity&&a<=this.startDate.getUTCFullYear())this.picker.find(".prev").css({visibility:"hidden"});else this.picker.find(".prev").css({visibility:"visible"});if(this.endDate!==Infinity&&a>=this.endDate.getUTCFullYear())this.picker.find(".next").css({visibility:"hidden"});else this.picker.find(".next").css({visibility:"visible"})}},click:function(j){j.preventDefault();var c=a(j.target).closest("span, td, th");if(c.length==1)switch(c[0].nodeName.toLowerCase()){case"th":switch(c[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var i=b.modes[this.viewMode].navStep*(c[0].className=="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,i);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,i)}this.fill();break;case"today":var g=new Date;g=d(g.getFullYear(),g.getMonth(),g.getDate(),0,0,0);this.showMode(-2);var k=this.todayBtn=="linked"?null:"view";this._setDate(g,k)}break;case"span":if(!c.is(".disabled")){this.viewDate.setUTCDate(1);if(c.is(".month")){var h=1,e=c.parent().find("span").index(c),f=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(e);this._trigger("changeMonth",this.viewDate);this.minViewMode==1&&this._setDate(d(f,e,h,0,0,0,0))}else{var f=parseInt(c.text(),10)||0,h=1,e=0;this.viewDate.setUTCFullYear(f);this._trigger("changeYear",this.viewDate);this.minViewMode==2&&this._setDate(d(f,e,h,0,0,0,0))}this.showMode(-1);this.fill()}break;case"td":if(c.is(".day")&&!c.is(".disabled")){var h=parseInt(c.text(),10)||1,f=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth();if(c.is(".old"))if(e===0){e=11;f-=1}else e-=1;else if(c.is(".new"))if(e==11){e=0;f+=1}else e+=1;this._setDate(d(f,e,h,0,0,0,0))}}},_setDate:function(c,a){if(!a||a=="date")this.date=c;if(!a||a=="view")this.viewDate=c;this.fill();this.setValue();this._trigger("changeDate");var b;if(this.isInput)b=this.element;else if(this.component)b=this.element.find("input");if(b){b.change();this.autoclose&&(!a||a=="date")&&this.hide()}},moveMonth:function(f,c){if(!c)return f;var a=new Date(f.valueOf()),g=a.getUTCDate(),e=a.getUTCMonth(),h=Math.abs(c),b,d;c=c>0?1:-1;if(h==1){d=c==-1?function(){return a.getUTCMonth()==e}:function(){return a.getUTCMonth()!=b};b=e+c;a.setUTCMonth(b);if(b<0||b>11)b=(b+12)%12}else{for(var i=0;i<h;i++)a=this.moveMonth(a,c);b=a.getUTCMonth();a.setUTCDate(g);d=function(){return b!=a.getUTCMonth()}}while(d()){a.setUTCDate(--g);a.setUTCMonth(b)}return a},moveYear:function(a,b){return this.moveMonth(a,b*12)},dateWithinRange:function(a){return a>=this.startDate&&a<=this.endDate},keydown:function(c){if(this.picker.is(":not(:visible)")){c.keyCode==27&&this.show();return}var f=false,a,h,g,b,d;switch(c.keyCode){case 27:this.hide();c.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation)break;a=c.keyCode==37?-1:1;if(c.ctrlKey){b=this.moveYear(this.date,a);d=this.moveYear(this.viewDate,a)}else if(c.shiftKey){b=this.moveMonth(this.date,a);d=this.moveMonth(this.viewDate,a)}else{b=new Date(this.date);b.setUTCDate(this.date.getUTCDate()+a);d=new Date(this.viewDate);d.setUTCDate(this.viewDate.getUTCDate()+a)}if(this.dateWithinRange(b)){this.date=b;this.viewDate=d;this.setValue();this.update();c.preventDefault();f=true}break;case 38:case 40:if(!this.keyboardNavigation)break;a=c.keyCode==38?-1:1;if(c.ctrlKey){b=this.moveYear(this.date,a);d=this.moveYear(this.viewDate,a)}else if(c.shiftKey){b=this.moveMonth(this.date,a);d=this.moveMonth(this.viewDate,a)}else{b=new Date(this.date);b.setUTCDate(this.date.getUTCDate()+a*7);d=new Date(this.viewDate);d.setUTCDate(this.viewDate.getUTCDate()+a*7)}if(this.dateWithinRange(b)){this.date=b;this.viewDate=d;this.setValue();this.update();c.preventDefault();f=true}break;case 13:this.hide();c.preventDefault();break;case 9:this.hide()}if(f){this._trigger("changeDate");var e;if(this.isInput)e=this.element;else if(this.component)e=this.element.find("input");e&&e.change()}},showMode:function(a){if(a)this.viewMode=Math.max(this.minViewMode,Math.min(2,this.viewMode+a));this.picker.find(">div").hide().filter(".datepicker-"+b.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()}};var f=function(c,b){this.element=a(c);this.inputs=a.map(b.inputs,function(a){return a.jquery?a[0]:a});delete b.inputs;a(this.inputs).datepicker(b).bind("changeDate",a.proxy(this.dateUpdated,this));this.pickers=a.map(this.inputs,function(b){return a(b).data("datepicker")});this.updateDates()};f.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.date});this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(c,a){a.setRange(b)})},dateUpdated:function(d){var f=a(d.target).data("datepicker"),c=d.date,b=a.inArray(d.target,this.inputs),e=this.inputs.length;if(b==-1)return;if(c<this.dates[b])while(b>=0&&c<this.dates[b])this.pickers[b--].setUTCDate(c);else if(c>this.dates[b])while(b<e&&c>this.dates[b])this.pickers[b++].setUTCDate(c);this.updateDates()},remove:function(){a.map(this.pickers,function(a){a.remove()});delete this.element.data().datepicker}};var g=a.fn.datepicker;a.fn.datepicker=function(b){var c=Array.apply(null,arguments);c.shift();return this.each(function(){var g=a(this),d=g.data("datepicker"),h=typeof b=="object"&&b;if(!d)if(g.is(".input-daterange")||h.inputs){var i={inputs:h.inputs||g.find("input").toArray()};g.data("datepicker",d=new f(this,a.extend(i,a.fn.datepicker.defaults,h)))}else g.data("datepicker",d=new e(this,a.extend({},a.fn.datepicker.defaults,h)));typeof b=="string"&&typeof d[b]=="function"&&d[b].apply(d,c)})};a.fn.datepicker.defaults={};a.fn.datepicker.Constructor=e;var c=a.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today"}},b={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return a%4===0&&a%100!==0||a%400===0},getDaysInMonth:function(c,a){return([31,b.isLeapYear(c)?29:28,31,30,31,30,31,31,30,31,30,31])[a]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(c){var a=c.replace(this.validParts,"\0").split("\0"),b=c.match(this.validParts);if(!a||!a.length||!b||b.length===0)throw new Error("Invalid date format.");return{separators:a,parts:b}},parseDate:function(b,s,o){if(b instanceof Date)return b;if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(b)){var r=/([\-+]\d+)([dmwy])/,g=b.match(/([\-+]\d+)([dmwy])/g),j,k;b=new Date;for(var f=0;f<g.length;f++){j=r.exec(g[f]);k=parseInt(j[1]);switch(j[2]){case"d":b.setUTCDate(b.getUTCDate()+k);break;case"m":b=e.prototype.moveMonth.call(e.prototype,b,k);break;case"w":b.setUTCDate(b.getUTCDate()+k*7);break;case"y":b=e.prototype.moveYear.call(e.prototype,b,k)}}return d(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),0,0,0)}var g=b&&b.match(this.nonpunctuation)||[],b=new Date,p={},q=["yyyy","yy","M","MM","m","mm","d","dd"],h={yyyy:function(a,b){return a.setUTCFullYear(b)},yy:function(a,b){return a.setUTCFullYear(2e3+b)},m:function(b,a){a-=1;while(a<0)a+=12;a%=12;b.setUTCMonth(a);while(b.getUTCMonth()!=a)b.setUTCDate(b.getUTCDate()-1);return b},d:function(a,b){return a.setUTCDate(b)}},l,n,j;h.M=h.MM=h.mm=h.m;h.dd=h.d;b=d(b.getFullYear(),b.getMonth(),b.getDate(),0,0,0);var i=s.parts.slice();if(g.length!=i.length)i=a(i).filter(function(c,b){return a.inArray(b,q)!==-1}).toArray();if(g.length==i.length){for(var f=0,t=i.length;f<t;f++){l=parseInt(g[f],10);j=i[f];if(isNaN(l))switch(j){case"MM":n=a(c[o].months).filter(function(){var a=this.slice(0,g[f].length),b=g[f].slice(0,a.length);return a==b});l=a.inArray(n[0],c[o].months)+1;break;case"M":n=a(c[o].monthsShort).filter(function(){var a=this.slice(0,g[f].length),b=g[f].slice(0,a.length);return a==b});l=a.inArray(n[0],c[o].monthsShort)+1}p[j]=l}for(var f=0,m;f<q.length;f++){m=q[f];m in p&&!isNaN(p[m])&&h[m](b,p[m])}}return b},formatDate:function(b,f,e){var d={d:b.getUTCDate(),D:c[e].daysShort[b.getUTCDay()],DD:c[e].days[b.getUTCDay()],m:b.getUTCMonth()+1,M:c[e].monthsShort[b.getUTCMonth()],MM:c[e].months[b.getUTCMonth()],yy:b.getUTCFullYear().toString().substring(2),yyyy:b.getUTCFullYear()};d.dd=(d.d<10?"0":"")+d.d;d.mm=(d.m<10?"0":"")+d.m;for(var b=[],h=a.extend([],f.separators),g=0,i=f.parts.length;g<i;g++){h.length&&b.push(h.shift());b.push(d[f.parts[g]])}return b.join("")},headTemplate:'<thead><tr><th class="prev"><i class="icon-arrow-left"/></th><th colspan="5" class="datepicker-switch"></th><th class="next"><i class="icon-arrow-right"/></th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'};b.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+b.headTemplate+"<tbody></tbody>"+b.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+b.headTemplate+b.contTemplate+b.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+b.headTemplate+b.contTemplate+b.footTemplate+"</table></div></div>";a.fn.datepicker.DPGlobal=b;a.fn.datepicker.noConflict=function(){a.fn.datepicker=g;return this};a(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(c){var b=a(this);if(b.data("datepicker"))return;c.preventDefault();b.datepicker("show")});a(function(){a('[data-provide="datepicker-inline"]').datepicker()})}(window.jQuery);
/*!
 * jQuery capslockstate plugin v1.2.1
 * https://github.com/nosilleg/capslockstate-jquery-plugin/
 *
 * Copyright 2012 Jason Ellison
 * Released under the MIT license
 * https://github.com/nosilleg/capslockstate-jquery-plugin/blob/master/MIT-LICENSE.txt
 *
 * Date: Sun Feb 3 2013 21:34:00 GMT
 */
(function(b){var a="unknown",c={init:function(e){var f=b.extend({},e),d=/MacPPC|MacIntel/.test(window.navigator.platform)===true,c={isCapslockOn:function(e){var c=false;if(e.shiftKey)c=e.shiftKey;else if(e.modifiers)c=!!(e.modifiers&4);var b=String.fromCharCode(e.which);if(b.toUpperCase()!==b.toLowerCase())if(b.toUpperCase()===b){if(!(d===true&&c))a=!c}else if(b.toLowerCase()===b)a=c;return a},isCapslockKey:function(c){var b=c.which;if(b===20)if(a!=="unknown")a=!a;return a},hasStateChange:function(c,a){if(c!==a){b("body").trigger("capsChanged");if(a===true)b("body").trigger("capsOn");else if(a===false)b("body").trigger("capsOff");else a==="unknown"&&b("body").trigger("capsUnknown")}}};b("body").bind("keypress.capslockstate",function(d){var b=a;a=c.isCapslockOn(d);c.hasStateChange(b,a)});b("body").bind("keydown.capslockstate",function(d){var b=a;a=c.isCapslockKey(d);c.hasStateChange(b,a)});b(window).bind("focus.capslockstate",function(){var b=a;a="unknown";c.hasStateChange(b,a)});c.hasStateChange(null,"unknown");return this.each(function(){})},state:function(){return a},destroy:function(){return this.each(function(){b("body").unbind(".capslockstate");b(window).unbind(".capslockstate")})}};jQuery.fn.capslockstate=function(a){if(c[a])return c[a].apply(this,Array.prototype.slice.call(arguments,1));else if(typeof a==="object"||!a)return c.init.apply(this,arguments);else b.error("Method "+a+" does not exist on jQuery.capslockstate")}})(jQuery)