(function(C){"use strict";var y={};y.fileapi=C("").get(0).files!==undefined;y.formdata=window.FormData!==undefined;C.fn.ajaxSubmit=function(M){if(!this.length){_("ajaxSubmit: skipping submit process - no element selected");return this}var F,e,t,O=this;if(typeof M=="function"){M={success:M}}F=this.attr("method");e=this.attr("action");t=typeof e==="string"?C.trim(e):"";t=t||window.location.href||"";if(t){t=(t.match(/^([^#]+)/)||[])[1]}M=C.extend(true,{url:t,success:C.ajaxSettings.success,type:F||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},M);var r={};this.trigger("form-pre-serialize",[this,M,r]);if(r.veto){_("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(M.beforeSerialize&&M.beforeSerialize(this,M)===false){_("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var a=M.traditional;if(a===undefined){a=C.ajaxSettings.traditional}var X=[];var i,n=this.formToArray(M.semantic,X);if(M.data){M.extraData=M.data;i=C.param(M.data,a)}if(M.beforeSubmit&&M.beforeSubmit(n,this,M)===false){_("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[n,this,M,r]);if(r.veto){_("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var o=C.param(n,a);if(i){o=o?o+"&"+i:i}if(M.type.toUpperCase()=="GET"){M.url+=(M.url.indexOf("?")>=0?"&":"?")+o;M.data=null}else{M.data=o}var s=[];if(M.resetForm){s.push(function(){O.resetForm()})}if(M.clearForm){s.push(function(){O.clearForm(M.includeHidden)})}if(!M.dataType&&M.target){var u=M.success||function(){};s.push(function(e){var t=M.replaceTarget?"replaceWith":"html";C(M.target)[t](e).each(u,arguments)})}else if(M.success){s.push(M.success)}M.success=function(e,t,r){var a=M.context||this;for(var i=0,n=s.length;i0;var c="multipart/form-data";var d=O.attr("enctype")==c||O.attr("encoding")==c;var m=y.fileapi&&y.formdata;_("fileAPI :"+m);var p=(l||d)&&!m;var v;if(M.iframe!==false&&(M.iframe||p)){if(M.closeKeepAlive){C.get(M.closeKeepAlive,function(){v=b(n)})}else{v=b(n)}}else if((l||d)&&m){v=x(n)}else{v=C.ajax(M)}O.removeData("jqxhr").data("jqxhr",v);for(var h=0;h');d.css({position:"absolute",top:"-1000px",left:"-1000px"})}m=d[0];p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t=e==="timeout"?"timeout":"aborted";_("aborting upload... "+t);this.aborted=1;if(m.contentWindow.document.execCommand){try{m.contentWindow.document.execCommand("Stop")}catch(e){}}d.attr("src",l.iframeSrc);p.error=t;if(l.error)l.error.call(l.context,p,t,e);if(c)C.event.trigger("ajaxError",[p,l,t]);if(l.complete)l.complete.call(l.context,p,t)}};c=l.global;if(c&&0===C.active++){C.event.trigger("ajaxStart")}if(c){C.event.trigger("ajaxSend",[p,l])}if(l.beforeSend&&l.beforeSend.call(l.context,p,l)===false){if(l.global){C.active--}g.reject();return g}if(p.aborted){g.reject();return g}a=n.clk;if(a){i=a.name;if(i&&!a.disabled){l.extraData=l.extraData||{};l.extraData[i]=a.value;if(a.type=="image"){l.extraData[i+".x"]=n.clk_x;l.extraData[i+".y"]=n.clk_y}}}var x=1;var b=2;function y(e){var t=e.contentWindow?e.contentWindow.document:e.contentDocument?e.contentDocument:e.document;return t}var u=C("meta[name=csrf-token]").attr("content");var f=C("meta[name=csrf-param]").attr("content");if(f&&u){l.extraData=l.extraData||{};l.extraData[f]=u}function T(){var e=O.attr("target"),t=O.attr("action");n.setAttribute("target",o);if(!F){n.setAttribute("method","POST")}if(t!=l.url){n.setAttribute("action",l.url)}if(!l.skipEncodingOverride&&(!F||/post/i.test(F))){O.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(l.timeout){h=setTimeout(function(){v=true;D(x)},l.timeout)}function r(){try{var e=y(m).readyState;_("state = "+e);if(e&&e.toLowerCase()=="uninitialized")setTimeout(r,50)}catch(e){_("Server abort: ",e," (",e.name,")");D(b);if(h)clearTimeout(h);h=undefined}}var a=[];try{if(l.extraData){for(var i in l.extraData){if(l.extraData.hasOwnProperty(i)){if(C.isPlainObject(l.extraData[i])&&l.extraData[i].hasOwnProperty("name")&&l.extraData[i].hasOwnProperty("value")){a.push(C('').attr("value",l.extraData[i].value).appendTo(n)[0])}else{a.push(C('').attr("value",l.extraData[i]).appendTo(n)[0])}}}}if(!l.iframeTarget){d.appendTo("body");if(m.attachEvent)m.attachEvent("onload",D);else m.addEventListener("load",D,false)}setTimeout(r,15);n.submit()}finally{n.setAttribute("action",t);if(e){n.setAttribute("target",e)}else{O.removeAttr("target")}C(a).remove()}}if(l.forceSync){T()}else{setTimeout(T,10)}var j,w,S=50,k;function D(t){if(p.aborted||k){return}try{w=y(m)}catch(e){_("cannot access response document: ",e);t=b}if(t===x&&p){p.abort("timeout");g.reject(p,"timeout");return}else if(t==b&&p){p.abort("server abort");g.reject(p,"error","server abort");return}if(!w||w.location.href==l.iframeSrc){if(!v)return}if(m.detachEvent)m.detachEvent("onload",D);else m.removeEventListener("load",D,false);var e="success",r;try{if(v){throw"timeout"}var a=l.dataType=="xml"||w.XMLDocument||C.isXMLDoc(w);_("isXml="+a);if(!a&&window.opera&&(w.body===null||!w.body.innerHTML)){if(--S){_("requeing onLoad callback, DOM not available");setTimeout(D,250);return}}var i=w.body?w.body:w.documentElement;p.responseText=i?i.innerHTML:null;p.responseXML=w.XMLDocument?w.XMLDocument:w;if(a)l.dataType="xml";p.getResponseHeader=function(e){var t={"content-type":l.dataType};return t[e]};if(i){p.status=Number(i.getAttribute("status"))||p.status;p.statusText=i.getAttribute("statusText")||p.statusText}var n=(l.dataType||"").toLowerCase();var o=/(json|script|text)/.test(n);if(o||l.textarea){var s=w.getElementsByTagName("textarea")[0];if(s){p.responseText=s.value;p.status=Number(s.getAttribute("status"))||p.status;p.statusText=s.getAttribute("statusText")||p.statusText}else if(o){var u=w.getElementsByTagName("pre")[0];var f=w.getElementsByTagName("body")[0];if(u){p.responseText=u.textContent?u.textContent:u.innerText}else if(f){p.responseText=f.textContent?f.textContent:f.innerText}}}else if(n=="xml"&&!p.responseXML&&p.responseText){p.responseXML=A(p.responseText)}try{j=E(p,n,l)}catch(t){e="parsererror";p.error=r=t||e}}catch(t){_("error caught: ",t);e="error";p.error=r=t||e}if(p.aborted){_("upload aborted");e=null}if(p.status){e=p.status>=200&&p.status<300||p.status===304?"success":"error"}if(e==="success"){if(l.success)l.success.call(l.context,j,"success",p);g.resolve(p.responseText,"success",p);if(c)C.event.trigger("ajaxSuccess",[p,l])}else if(e){if(r===undefined)r=p.statusText;if(l.error)l.error.call(l.context,p,e,r);g.reject(p,"error",r);if(c)C.event.trigger("ajaxError",[p,l,r])}if(c)C.event.trigger("ajaxComplete",[p,l]);if(c&&!--C.active){C.event.trigger("ajaxStop")}if(l.complete)l.complete.call(l.context,p,e);k=true;if(l.timeout)clearTimeout(h);setTimeout(function(){if(!l.iframeTarget)d.remove();p.responseXML=null},100)}var A=C.parseXML||function(e,t){if(window.ActiveXObject){t=new ActiveXObject("Microsoft.XMLDOM");t.async="false";t.loadXML(e)}else{t=(new DOMParser).parseFromString(e,"text/xml")}return t&&t.documentElement&&t.documentElement.nodeName!="parsererror"?t:null};var L=C.parseJSON||function(e){return window["eval"]("("+e+")")};var E=function(e,t,r){var a=e.getResponseHeader("content-type")||"",i=t==="xml"||!t&&a.indexOf("xml")>=0,n=i?e.responseXML:e.responseText;if(i&&n.documentElement.nodeName==="parsererror"){if(C.error)C.error("parsererror")}if(r&&r.dataFilter){n=r.dataFilter(n,t)}if(typeof n==="string"){if(t==="json"||!t&&a.indexOf("json")>=0){n=L(n)}else if(t==="script"||!t&&a.indexOf("javascript")>=0){C.globalEval(n)}}return n};return g}};C.fn.ajaxForm=function(e){e=e||{};e.delegation=e.delegation&&C.isFunction(C.fn.on);if(!e.delegation&&this.length===0){var t={s:this.selector,c:this.context};if(!C.isReady&&t.s){_("DOM not ready, queuing ajaxForm");C(function(){C(t.s,t.c).ajaxForm(e)});return this}_("terminating; zero elements found by selector"+(C.isReady?"":" (DOM not ready)"));return this}if(e.delegation){C(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a)};function r(e){var t=e.data;if(!e.isDefaultPrevented()){e.preventDefault();C(this).ajaxSubmit(t)}}function a(e){var t=e.target;var r=C(t);if(!r.is(":submit,input:image")){var a=r.closest(":submit");if(a.length===0){return}t=a[0]}var i=this;i.clk=t;if(t.type=="image"){if(e.offsetX!==undefined){i.clk_x=e.offsetX;i.clk_y=e.offsetY}else if(typeof C.fn.offset=="function"){var n=r.offset();i.clk_x=e.pageX-n.left;i.clk_y=e.pageY-n.top}else{i.clk_x=e.pageX-t.offsetLeft;i.clk_y=e.pageY-t.offsetTop}}setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}C.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};C.fn.formToArray=function(e,t){var r=[];if(this.length===0){return r}var a=this[0];var i=e?a.getElementsByTagName("*"):a.elements;if(!i){return r}var n,o,s,u,f,l,c;for(n=0,l=i.length;n