/* jQuery Form Plugin version: 3.44.0-2013.09.15 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(b){function u(a){var k=a.data;a.isDefaultPrevented()||(a.preventDefault(),b(a.target).ajaxSubmit(k))}function z(a){var k=a.target,f=b(k);if(!f.is("[type=submit],[type=image]")){k=f.closest("[type=submit]");if(0===k.length)return;k=k[0]}var c=this;c.clk=k;"image"==k.type&&(void 0!==a.offsetX?(c.clk_x=a.offsetX,c.clk_y=a.offsetY):"function"==typeof b.fn.offset?(f=f.offset(),c.clk_x=a.pageX-f.left,c.clk_y=a.pageY-f.top):(c.clk_x=a.pageX-k.offsetLeft,c.clk_y=a.pageY-k.offsetTop));setTimeout(function(){c.clk= c.clk_x=c.clk_y=null},100)}function q(){if(b.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(a):window.opera&&window.opera.postError&&window.opera.postError(a)}}var A,D;A=void 0!==b("").get(0).files;D=void 0!==window.FormData;var I=!!b.fn.prop;b.fn.attr2=function(){if(!I)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)};b.fn.ajaxSubmit=function(a){function k(c){c=b.param(c,a.traditional).split("&");var k=c.length,d=[],f,m;for(f=0;f').val(e.extraData[g].value).appendTo(l)[0]):h.push(b('').val(e.extraData[g]).appendTo(l)[0]));e.iframeTarget||w.appendTo("body");v.attachEvent?v.attachEvent("onload",k):v.addEventListener("load",k,!1);setTimeout(a,15);try{l.submit()}catch(L){document.createElement("form").submit.apply(l)}}finally{l.setAttribute("action",f),c?l.setAttribute("target",c):n.removeAttr("target"),b(h).remove()}}function k(a){if(!h.aborted&&!A)if(r=d(v),r||(q("cannot access response document"),a=2),1===a&&h)h.abort("timeout"),x.reject(h,"timeout");else if(2==a&&h)h.abort("server abort"), x.reject(h,"error","server abort");else if(r&&r.location.href!=e.iframeSrc||y){v.detachEvent?v.detachEvent("onload",k):v.removeEventListener("load",k,!1);a="success";var c;try{if(y)throw"timeout";var f="xml"==e.dataType||r.XMLDocument||b.isXMLDoc(r);q("isXml="+f);if(!f&&window.opera&&(null===r.body||!r.body.innerHTML)&&--B){q("requeing onLoad callback, DOM not available");setTimeout(k,250);return}var g=r.body?r.body:r.documentElement;h.responseText=g?g.innerHTML:null;h.responseXML=r.XMLDocument?r.XMLDocument: r;f&&(e.dataType="xml");h.getResponseHeader=function(a){return{"content-type":e.dataType}[a.toLowerCase()]};g&&(h.status=Number(g.getAttribute("status"))||h.status,h.statusText=g.getAttribute("statusText")||h.statusText);var l=(e.dataType||"").toLowerCase(),m=/(json|script|text)/.test(l);if(m||e.textarea){var n=r.getElementsByTagName("textarea")[0];if(n)h.responseText=n.value,h.status=Number(n.getAttribute("status"))||h.status,h.statusText=n.getAttribute("statusText")||h.statusText;else if(m){var E= r.getElementsByTagName("pre")[0],p=r.getElementsByTagName("body")[0];E?h.responseText=E.textContent?E.textContent:E.innerText:p&&(h.responseText=p.textContent?p.textContent:p.innerText)}}else"xml"==l&&!h.responseXML&&h.responseText&&(h.responseXML=D(h.responseText));try{z=K(h,l,e)}catch(G){a="parsererror",h.error=c=G||a}}catch(G){q("error caught: ",G),a="error",h.error=c=G||a}h.aborted&&(q("upload aborted"),a=null);h.status&&(a=200<=h.status&&300>h.status||304===h.status?"success":"error");"success"=== a?(e.success&&e.success.call(e.context,z,"success",h),x.resolve(h.responseText,"success",h),t&&b.event.trigger("ajaxSuccess",[h,e])):a&&(void 0===c&&(c=h.statusText),e.error&&e.error.call(e.context,h,a,c),x.reject(h,"error",c),t&&b.event.trigger("ajaxError",[h,e,c]));t&&b.event.trigger("ajaxComplete",[h,e]);t&&!--b.active&&b.event.trigger("ajaxStop");e.complete&&e.complete.call(e.context,h,a);A=!0;e.timeout&&clearTimeout(u);setTimeout(function(){e.iframeTarget?w.attr("src",e.iframeSrc):w.remove(); h.responseXML=null},100)}}var l=n[0],g,e,t,C,w,v,h,y,u,x=b.Deferred();x.abort=function(a){h.abort(a)};if(c)for(g=0;g'),w.css({position:"absolute",top:"-1000px",left:"-1000px"}));v=w[0];h={aborted:0,responseText:null, responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(a){var c="timeout"===a?"timeout":"aborted";q("aborting upload... "+c);this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(F){}w.attr("src",e.iframeSrc);h.error=c;e.error&&e.error.call(e.context,h,c,a);t&&b.event.trigger("ajaxError",[h,e,c]);e.complete&&e.complete.call(e.context,h,c)}};(t=e.global)&& 0===b.active++&&b.event.trigger("ajaxStart");t&&b.event.trigger("ajaxSend",[h,e]);if(e.beforeSend&&!1===e.beforeSend.call(e.context,h,e))return e.global&&b.active--,x.reject(),x;if(h.aborted)return x.reject(),x;(c=l.clk)&&(g=c.name)&&!c.disabled&&(e.extraData=e.extraData||{},e.extraData[g]=c.value,"image"==c.type&&(e.extraData[g+".x"]=l.clk_x,e.extraData[g+".y"]=l.clk_y));c=b("meta[name=csrf-token]").attr("content");(g=b("meta[name=csrf-param]").attr("content"))&&c&&(e.extraData=e.extraData||{},e.extraData[g]= c);e.forceSync?f():setTimeout(f,10);var z,r,B=50,A,D=b.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},H=b.parseJSON||function(a){return window.eval("("+a+")")},K=function(a,c,e){var d=a.getResponseHeader("content-type")||"",f="xml"===c||!c&&0<=d.indexOf("xml");a=f?a.responseXML:a.responseText;f&&"parsererror"=== a.documentElement.nodeName&&b.error&&b.error("parsererror");e&&e.dataFilter&&(a=e.dataFilter(a,c));"string"===typeof a&&("json"===c||!c&&0<=d.indexOf("json")?a=H(a):("script"===c||!c&&0<=d.indexOf("javascript"))&&b.globalEval(a));return a};return x}if(!this.length)return q("ajaxSubmit: skipping submit process - no element selected"),this;var m,d,n=this;"function"==typeof a?a={success:a}:void 0===a&&(a={});m=a.type||this.attr2("method");d=a.url||this.attr2("action");(d=(d="string"===typeof d?b.trim(d): "")||window.location.href||"")&&(d=(d.match(/^([^#]+)/)||[])[1]);a=b.extend(!0,{url:d,success:b.ajaxSettings.success,type:m||b.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a);d={};this.trigger("form-pre-serialize",[this,a,d]);if(d.veto)return q("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(a.beforeSerialize&&!1===a.beforeSerialize(this,a))return q("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var g=a.traditional; void 0===g&&(g=b.ajaxSettings.traditional);var p=[],l,t=this.formToArray(a.semantic,p);a.data&&(a.extraData=a.data,l=b.param(a.data,g));if(a.beforeSubmit&&!1===a.beforeSubmit(t,this,a))return q("ajaxSubmit: submit aborted via beforeSubmit callback"),this;this.trigger("form-submit-validate",[t,this,a,d]);if(d.veto)return q("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;d=b.param(t,g);l&&(d=d?d+"&"+l:l);"GET"==a.type.toUpperCase()?(a.url+=(0<=a.url.indexOf("?")?"&":"?")+d,a.data= null):a.data=d;var y=[];a.resetForm&&y.push(function(){n.resetForm()});a.clearForm&&y.push(function(){n.clearForm(a.includeHidden)});if(!a.dataType&&a.target){var u=a.success||function(){};y.push(function(c){var d=a.replaceTarget?"replaceWith":"html";b(a.target)[d](c).each(u,arguments)})}else a.success&&y.push(a.success);a.success=function(b,c,d){for(var f=a.context||this,g=0,k=y.length;gd)return null;for(var f=[],m=a.options,n=(c="select-one"==c)?d+1:m.length,d=c?d:0;d