(function(a){"function"===typeof define&&define.amd?define(["jquery"],a):a("undefined"!=typeof jQuery?jQuery:window.Zepto)})(function(a){function b(b){var c=b.data;b.isDefaultPrevented()||(b.preventDefault(),a(b.target).ajaxSubmit(c))}function c(b){var c=b.target,d=a(c);if(!d.is("[type=submit],[type=image]")){c=d.closest("[type=submit]");if(0===c.length)return;c=c[0]}var e=this;e.clk=c;"image"==c.type&&(void 0!==b.offsetX?(e.clk_x=b.offsetX,e.clk_y=b.offsetY):"function"==typeof a.fn.offset?(d=d.offset(), e.clk_x=b.pageX-d.left,e.clk_y=b.pageY-d.top):(e.clk_x=b.pageX-c.offsetLeft,e.clk_y=b.pageY-c.offsetTop));setTimeout(function(){e.clk=e.clk_x=e.clk_y=null},100)}function d(){if(a.fn.ajaxSubmit.debug){var b="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(b):window.opera&&window.opera.postError&&window.opera.postError(b)}}var e,f;e=void 0!==a("").get(0).files;f=void 0!==window.FormData;var h=!!a.fn.prop;a.fn.attr2=function(){if(!h)return this.attr.apply(this, arguments);var a=this.prop.apply(this,arguments);return a&&a.jquery||"string"===typeof a?a:this.attr.apply(this,arguments)};a.fn.ajaxSubmit=function(b){function c(e){function f(a){var b=null;try{a.contentWindow&&(b=a.contentWindow.document)}catch(c){d("cannot get iframe.contentWindow document: "+c)}if(b)return b;try{b=a.contentDocument?a.contentDocument:a.document}catch(e){d("cannot get iframe.contentDocument: "+e),b=a.document}return b}function g(){function b(){try{var a=f(m).readyState;d("state = "+ a);a&&"uninitialized"==a.toLowerCase()&&setTimeout(b,50)}catch(c){d("Server abort: ",c," (",c.name,")"),v(I),G&&clearTimeout(G),G=void 0}}var c=q.attr2("target"),e=q.attr2("action"),B=q.attr("enctype")||q.attr("encoding")||"multipart/form-data";i.setAttribute("target",w);(!n||/post/i.test(n))&&i.setAttribute("method","POST");e!=l.url&&i.setAttribute("action",l.url);!l.skipEncodingOverride&&(!n||/post/i.test(n))&&q.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});l.timeout&&(G= setTimeout(function(){t=!0;v(O)},l.timeout));var h=[];try{if(l.extraData)for(var C in l.extraData)l.extraData.hasOwnProperty(C)&&(a.isPlainObject(l.extraData[C])&&l.extraData[C].hasOwnProperty("name")&&l.extraData[C].hasOwnProperty("value")?h.push(a('').val(l.extraData[C].value).appendTo(i)[0]):h.push(a('').val(l.extraData[C]).appendTo(i)[0]));l.iframeTarget||p.appendTo("body");m.attachEvent?m.attachEvent("onload", v):m.addEventListener("load",v,!1);setTimeout(b,15);try{i.submit()}catch(x){document.createElement("form").submit.apply(i)}}finally{i.setAttribute("action",e),i.setAttribute("enctype",B),c?i.setAttribute("target",c):q.removeAttr("target"),a(h).remove()}}function v(b){if(!r.aborted&&!P)if(x=f(m),x||(d("cannot access response document"),b=I),b===O&&r)r.abort("timeout"),B.reject(r,"timeout");else if(b==I&&r)r.abort("server abort"),B.reject(r,"error","server abort");else if(x&&x.location.href!=l.iframeSrc|| t){m.detachEvent?m.detachEvent("onload",v):m.removeEventListener("load",v,!1);var b="success",c;try{if(t)throw"timeout";var e="xml"==l.dataType||x.XMLDocument||a.isXMLDoc(x);d("isXml="+e);if(!e&&(window.opera&&(null===x.body||!x.body.innerHTML))&&--T){d("requeing onLoad callback, DOM not available");setTimeout(v,250);return}var g=x.body?x.body:x.documentElement;r.responseText=g?g.innerHTML:null;r.responseXML=x.XMLDocument?x.XMLDocument:x;e&&(l.dataType="xml");r.getResponseHeader=function(a){return{"content-type":l.dataType}[a.toLowerCase()]}; g&&(r.status=Number(g.getAttribute("status"))||r.status,r.statusText=g.getAttribute("statusText")||r.statusText);var h=(l.dataType||"").toLowerCase(),j=/(json|script|text)/.test(h);if(j||l.textarea){var i=x.getElementsByTagName("textarea")[0];if(i)r.responseText=i.value,r.status=Number(i.getAttribute("status"))||r.status,r.statusText=i.getAttribute("statusText")||r.statusText;else if(j){var k=x.getElementsByTagName("pre")[0],n=x.getElementsByTagName("body")[0];k?r.responseText=k.textContent?k.textContent: k.innerText:n&&(r.responseText=n.textContent?n.textContent:n.innerText)}}else"xml"==h&&(!r.responseXML&&r.responseText)&&(r.responseXML=u(r.responseText));try{var e=r,g=l,q=e.getResponseHeader("content-type")||"",w="xml"===h||!h&&0<=q.indexOf("xml"),s=w?e.responseXML:e.responseText;w&&"parsererror"===s.documentElement.nodeName&&a.error&&a.error("parsererror");g&&g.dataFilter&&(s=g.dataFilter(s,h));"string"===typeof s&&("json"===h||!h&&0<=q.indexOf("json")?s=E(s):("script"===h||!h&&0<=q.indexOf("javascript"))&& a.globalEval(s));C=s}catch(y){b="parsererror",r.error=c=y||b}}catch(z){d("error caught: ",z),b="error",r.error=c=z||b}r.aborted&&(d("upload aborted"),b=null);r.status&&(b=200<=r.status&&300>r.status||304===r.status?"success":"error");"success"===b?(l.success&&l.success.call(l.context,C,"success",r),B.resolve(r.responseText,"success",r),A&&a.event.trigger("ajaxSuccess",[r,l])):b&&(void 0===c&&(c=r.statusText),l.error&&l.error.call(l.context,r,b,c),B.reject(r,"error",c),A&&a.event.trigger("ajaxError", [r,l,c]));A&&a.event.trigger("ajaxComplete",[r,l]);A&&!--a.active&&a.event.trigger("ajaxStop");l.complete&&l.complete.call(l.context,r,b);P=!0;l.timeout&&clearTimeout(G);setTimeout(function(){l.iframeTarget?p.attr("src",l.iframeSrc):p.remove();r.responseXML=null},100)}}var i=q[0],k,l,A,w,p,m,r,t,G,B=a.Deferred();B.abort=function(a){r.abort(a)};if(e)for(k=0;k'),p.css({position:"absolute",top:"-1000px",left:"-1000px"}));m=p[0];r={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(b){var c="timeout"===b?"timeout":"aborted";d("aborting upload... "+c);this.aborted=1;try{m.contentWindow.document.execCommand&& m.contentWindow.document.execCommand("Stop")}catch(e){}p.attr("src",l.iframeSrc);r.error=c;l.error&&l.error.call(l.context,r,c,b);A&&a.event.trigger("ajaxError",[r,l,c]);l.complete&&l.complete.call(l.context,r,c)}};(A=l.global)&&0===a.active++&&a.event.trigger("ajaxStart");A&&a.event.trigger("ajaxSend",[r,l]);if(l.beforeSend&&!1===l.beforeSend.call(l.context,r,l))return l.global&&a.active--,B.reject(),B;if(r.aborted)return B.reject(),B;if(e=i.clk)if((k=e.name)&&!e.disabled)l.extraData=l.extraData|| {},l.extraData[k]=e.value,"image"==e.type&&(l.extraData[k+".x"]=i.clk_x,l.extraData[k+".y"]=i.clk_y);var O=1,I=2,e=a("meta[name=csrf-token]").attr("content");if((k=a("meta[name=csrf-param]").attr("content"))&&e)l.extraData=l.extraData||{},l.extraData[k]=e;l.forceSync?g():setTimeout(g,10);var C,x,T=50,P,u=a.parseXML||function(a,b){window.ActiveXObject?(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)):b=(new DOMParser).parseFromString(a,"text/xml");return b&&b.documentElement&& "parsererror"!=b.documentElement.nodeName?b:null},E=a.parseJSON||function(a){return window.eval("("+a+")")};return B}if(!this.length)return d("ajaxSubmit: skipping submit process - no element selected"),this;var n,k,q=this;"function"==typeof b?b={success:b}:void 0===b&&(b={});n=b.type||this.attr2("method");k=b.url||this.attr2("action");(k=(k="string"===typeof k?a.trim(k):"")||window.location.href||"")&&(k=(k.match(/^([^#]+)/)||[])[1]);b=a.extend(!0,{url:k,success:a.ajaxSettings.success,type:n||a.ajaxSettings.type, iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},b);k={};this.trigger("form-pre-serialize",[this,b,k]);if(k.veto)return d("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(b.beforeSerialize&&!1===b.beforeSerialize(this,b))return d("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=b.traditional;void 0===p&&(p=a.ajaxSettings.traditional);var s=[],m,u=this.formToArray(b.semantic,s);b.data&&(b.extraData=b.data,m=a.param(b.data, p));if(b.beforeSubmit&&!1===b.beforeSubmit(u,this,b))return d("ajaxSubmit: submit aborted via beforeSubmit callback"),this;this.trigger("form-submit-validate",[u,this,b,k]);if(k.veto)return d("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;k=a.param(u,p);m&&(k=k?k+"&"+m:m);"GET"==b.type.toUpperCase()?(b.url+=(0<=b.url.indexOf("?")?"&":"?")+k,b.data=null):b.data=k;var t=[];b.resetForm&&t.push(function(){q.resetForm()});b.clearForm&&t.push(function(){q.clearForm(b.includeHidden)}); if(!b.dataType&&b.target){var g=b.success||function(){};t.push(function(c){var d=b.replaceTarget?"replaceWith":"html";a(b.target)[d](c).each(g,arguments)})}else b.success&&t.push(b.success);b.success=function(a,c,d){for(var e=b.context||this,f=0,g=t.length;fh)return null;for(var d=[],f=b.options,s=(e="select-one"== e)?h+1:f.length,h=e?h:0;h").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last();this.tagInput=a('').addClass("ui-widget-content");this.options.readOnly&&this.tagInput.attr("disabled","disabled");this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex);this.options.placeholderText&&this.tagInput.attr("placeholder", this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(b,c){var d=b.term.toLowerCase(),e=a.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(e=this._subtractArray(e,this.assignedTags()));c(e)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(){b._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0)); a.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=a.proxy(this.options.autocomplete.source,this));a.isFunction(this.options.tagSource)&&(this.options.tagSource=a.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(a('
  • ').append(this.tagInput)).click(function(c){var d=a(c.target);d.hasClass("tagit-label")?(d=d.closest(".tagit-choice"),d.hasClass("removed")||b._trigger("onTagClicked", c,{tag:d,tagLabel:b.tagLabel(d)})):b.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=a(this.options.singleFieldNode),e=d.val().split(this.options.singleFieldDelimiter);d.val("");a.each(e,function(a,d){b.createTag(d,null,!0);c=!0})}else this.options.singleFieldNode=a(''),this.tagList.after(this.options.singleFieldNode);c||this.tagList.children("li").each(function(){a(this).hasClass("tagit-new")|| (b.createTag(a(this).text(),a(this).attr("class"),!0),a(this).remove())});this.tagInput.keydown(function(c){if(c.which==a.ui.keyCode.BACKSPACE&&""===b.tagInput.val()){var d=b._lastTag();!b.options.removeConfirmation||d.hasClass("remove")?b.removeTag(d):b.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else b.options.removeConfirmation&&b._lastTag().removeClass("remove ui-state-highlight");if(c.which===a.ui.keyCode.COMMA&&!1===c.shiftKey||c.which===a.ui.keyCode.ENTER||c.which== a.ui.keyCode.TAB&&""!==b.tagInput.val()||c.which==a.ui.keyCode.SPACE&&!0!==b.options.allowSpaces&&('"'!=a.trim(b.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==a.trim(b.tagInput.val()).charAt(0)&&'"'==a.trim(b.tagInput.val()).charAt(a.trim(b.tagInput.val()).length-1)&&0!==a.trim(b.tagInput.val()).length-1))if(c.which===a.ui.keyCode.ENTER&&""===b.tagInput.val()||c.preventDefault(),!b.options.autocomplete.autoFocus||!b.tagInput.data("autocomplete-open"))b.tagInput.autocomplete("close"),b.createTag(b._cleanedInput())}).blur(function(){b.tagInput.data("autocomplete-open")|| b.createTag(b._cleanedInput())});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)d={select:function(a,c){b.createTag(c.item.value);return!1}},a.extend(d,this.options.autocomplete),d.source=this.options.tagSource||d.source,this.tagInput.autocomplete(d).bind("autocompleteopen.tagit",function(){b.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(){b.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")}, destroy:function(){a.Widget.prototype.destroy.call(this);this.element.unbind(".tagit");this.tagList.unbind(".tagit");this.tagInput.removeData("autocomplete-open");this.tagList.removeClass("tagit ui-widget ui-widget-content ui-corner-all tagit-hidden-field");this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){a(this).hasClass("tagit-new")?a(this).remove():(a(this).removeClass("tagit-choice ui-widget-content ui-state-default ui-state-highlight ui-corner-all remove tagit-choice-editable tagit-choice-read-only"), a(this).text(a(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove());return this},_cleanedInput:function(){return a.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var b=this,c=[];this.options.singleField?(c=a(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter), ""===c[0]&&(c=[])):this._tags().each(function(){c.push(b.tagLabel(this))});return c},_updateSingleTagsField:function(b){a(this.options.singleFieldNode).val(b.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(b,c){for(var d=[],e=0;e=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:d}),!1;var f=a(this.options.onTagClicked?'':'').text(b),h=a("
  • ").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(c).append(f); this.options.readOnly?h.addClass("tagit-choice-read-only"):(h.addClass("tagit-choice-editable"),c=a("").addClass("ui-icon ui-icon-close"),c=a('\u00d7').addClass("tagit-close").append(c).click(function(){e.removeTag(h)}),h.append(c));this.options.singleField||(f=f.html(),h.append(''));!1!==this._trigger("beforeTagAdded",null,{tag:h,tagLabel:this.tagLabel(h), duringInitialization:d})&&(this.options.singleField&&(f=this.assignedTags(),f.push(b),this._updateSingleTagsField(f)),this._trigger("onTagAdded",null,h),this.tagInput.val(""),this.tagInput.parent().before(h),this._trigger("afterTagAdded",null,{tag:h,tagLabel:this.tagLabel(h),duringInitialization:d}),this.options.showAutocompleteOnFocus&&!d&&setTimeout(function(){e._showAutocomplete()},0))},removeTag:function(b,c){c="undefined"===typeof c?this.options.animate:c;b=a(b);this._trigger("onTagRemoved", null,b);if(!1!==this._trigger("beforeTagRemoved",null,{tag:b,tagLabel:this.tagLabel(b)})){if(this.options.singleField){var d=this.assignedTags(),e=this.tagLabel(b),d=a.grep(d,function(a){return a!=e});this._updateSingleTagsField(d)}if(c){b.addClass("removed");var d=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],f=this;d.push(function(){b.remove();f._trigger("afterTagRemoved",null,{tag:b,tagLabel:f.tagLabel(b)})});b.fadeOut("fast").hide.apply(b,d).dequeue()}else b.remove(), this._trigger("afterTagRemoved",null,{tag:b,tagLabel:this.tagLabel(b)})}},removeTagByLabel:function(a,c){var d=this._findTagByLabel(a);if(!d)throw"No such tag exists with the name '"+a+"'";this.removeTag(d,c)},removeAll:function(){var a=this;this._tags().each(function(c,d){a.removeTag(d,!1)})}})})(jQuery);jQuery.fn.sortElements=function(){var a=[].sort;return function(b,c){var c=c||function(){return this},d=this.map(function(){var a=c.call(this),b=a.parentNode,d=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,d);b.removeChild(d)}});return a.call(this,b).each(function(a){d[a].call(c.call(this))})}}();(function(a){"function"===typeof define&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){function b(a){return e.raw?a:encodeURIComponent(a)}function c(b,c){var j;if(e.raw)j=b;else a:{var i=b;0===i.indexOf('"')&&(i=i.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{i=decodeURIComponent(i.replace(d," "))}catch(n){j=void 0;break a}try{j=e.json?JSON.parse(i):i;break a}catch(k){}j=void 0}return a.isFunction(c)?c(j):j}var d=/\+/g,e=a.cookie=function(d,h,j){if(void 0!==h&&!a.isFunction(h)){j= a.extend({},e.defaults,j);if("number"===typeof j.expires){var i=j.expires,n=j.expires=new Date;n.setDate(n.getDate()+i)}return document.cookie=[b(d),"=",b(e.json?JSON.stringify(h):String(h)),j.expires?"; expires="+j.expires.toUTCString():"",j.path?"; path="+j.path:"",j.domain?"; domain="+j.domain:"",j.secure?"; secure":""].join("")}for(var j=d?void 0:{},i=document.cookie?document.cookie.split("; "):[],n=0,k=i.length;n").attr("for",b.attr("id")).text(b.attr("title")));b.before(c);c.css({"font-family":b.css("font-family"),"font-size":b.css("font-size"),"font-style":b.css("font-style"),"font-variant":b.css("font-variant"),"font-weight":b.css("font-weight"),"letter-spacing":b.css("letter-spacing"),"line-height":b.css("line-height"), "text-decoration":b.css("text-decoration"),"text-transform":b.css("text-transform"),color:b.css("color"),cursor:b.css("cursor"),width:b.css("width"),display:"inline-block",overflow:"hidden"});c.mousedown(function(){return!1}).css({position:"relative","z-index":"100","margin-right":-c.width(),left:h.xShift+parseInt(b.css("padding-left"))+"px",top:h.yShift+"px"});this.label=c;""!=this.input.val()&&this.label.hide()}function d(b){var c;a.each(f,function(){if(this.equals(b))return c=this,!1});return c} function e(a){var b=d(a).label;""==a.val()?b.stop().fadeTo(h.speed,h.opacity):b.is(":visible")&&b.stop().fadeTo(h.speed,0,function(){b.hide()})}var f=[],h=a.extend({},a.fn.jLabel.defaults,b);return this.each(function(){var b=a(this);f.push(new c(b));b.focus(function(){var b=a(this);""==b.val()&&d(b).label.stop().fadeTo(h.speed,h.opacity)}).blur(function(){var b=a(this);""==b.val()&&d(b).label.stop().fadeTo(h.speed,1)}).keyup(function(){e(a(this))}).change(function(){e(a(this))})})};a.fn.jLabel.defaults= {speed:200,opacity:0.4,xShift:2,yShift:0}})(jQuery);jQuery&&function(a){a.extend(a.fn,{selectBox:function(b,c){var d,e="",f=navigator.platform.match(/mac/i),h=function(b,c){var d,e=function(b,c){b.children("OPTION, OPTGROUP").each(function(){if(a(this).is("OPTION"))if(0"),g=a("");f.addClass(b.attr("class"));f.data(b.data());g.attr("rel",b.val()).text(b.text());f.append(g);b.attr("disabled")&&f.addClass("selectBox-disabled");b.attr("selected")&&f.addClass("selectBox-selected");d.append(f)}else c.append("
  • \u00a0
  • "); else b=a('
  • '),b.text(a(this).attr("label")),c.append(b),c=e(a(this),c)});return c};switch(c){case "inline":return d=a('