(function(b){function p(){if(b.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log)window.console.log(a);else window.opera&&window.opera.postError&&window.opera.postError(a)}}b.fn.ajaxSubmit=function(a){function g(){function t(){var n=k.attr("target"),m=k.attr("action");l.setAttribute("target",u);l.getAttribute("method")!="POST"&&l.setAttribute("method","POST");l.getAttribute("action")!=e.url&&l.setAttribute("action",e.url);e.skipEncodingOverride||
k.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});e.timeout&&setTimeout(function(){F=true;s()},e.timeout);var v=[];try{if(e.extraData)for(var w in e.extraData)v.push(b('').appendTo(l)[0]);q.appendTo("body");q.data("form-plugin-onload",s);l.submit()}finally{l.setAttribute("action",m);n?l.setAttribute("target",n):k.removeAttr("target");b(v).remove()}}function s(){if(!G){q.removeData("form-plugin-onload");var n=true;
try{if(F)throw"timeout";o=x.contentWindow?x.contentWindow.document:x.contentDocument?x.contentDocument:x.document;var m=e.dataType=="xml"||o.XMLDocument||b.isXMLDoc(o);p("isXml="+m);if(!m&&window.opera&&(o.body==null||o.body.innerHTML==""))if(--K){p("requeing onLoad callback, DOM not available");setTimeout(s,250);return}G=true;i.responseText=o.documentElement?o.documentElement.innerHTML:null;i.responseXML=o.XMLDocument?o.XMLDocument:o;i.getResponseHeader=function(L){var M={"content-type":e.dataType};
return M[L]};var v=/(json|script)/.test(e.dataType);if(v||e.textarea){var w=o.getElementsByTagName("textarea")[0];if(w)i.responseText=w.value;else if(v){var H=o.getElementsByTagName("pre")[0],I=o.getElementsByTagName("body")[0];if(H)i.responseText=H.textContent;else if(I)i.responseText=I.innerHTML}}else if(e.dataType=="xml"&&!i.responseXML&&i.responseText!=null)i.responseXML=C(i.responseText);J=b.httpData(i,e.dataType)}catch(D){p("error caught:",D);n=false;i.error=D;b.handleError(e,i,"error",D)}if(i.aborted){p("upload aborted");
n=false}if(n){e.success.call(e.context,J,"success",i);y&&b.event.trigger("ajaxSuccess",[i,e])}y&&b.event.trigger("ajaxComplete",[i,e]);y&&!--b.active&&b.event.trigger("ajaxStop");if(e.complete)e.complete.call(e.context,i,n?"success":"error");setTimeout(function(){q.removeData("form-plugin-onload");q.remove();i.responseXML=null},100)}}function C(n,m){if(window.ActiveXObject){m=new ActiveXObject("Microsoft.XMLDOM");m.async="false";m.loadXML(n)}else m=(new DOMParser).parseFromString(n,"text/xml");return m&&
m.documentElement&&m.documentElement.tagName!="parsererror"?m:null}var l=k[0];if(b(":input[name=submit],:input[id=submit]",l).length)alert('Error: Form elements must not have name or id of "submit".');else{var e=b.extend(true,{},b.ajaxSettings,a);e.context=e.context||e;var u="jqFormIO"+(new Date).getTime(),E="_"+u;window[E]=function(){var n=q.data("form-plugin-onload");if(n){n();window[E]=undefined;try{delete window[E]}catch(m){}}};var q=b(''),
x=q[0];q.css({position:"absolute",top:"-1000px",left:"-1000px"});var i={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;q.attr("src",e.iframeSrc)}},y=e.global;y&&!b.active++&&b.event.trigger("ajaxStart");y&&b.event.trigger("ajaxSend",[i,e]);if(e.beforeSend&&e.beforeSend.call(e.context,i,e)===false)e.global&&b.active--;else if(!i.aborted){var G=false,
F=0,z=l.clk;if(z){var A=z.name;if(A&&!z.disabled){e.extraData=e.extraData||{};e.extraData[A]=z.value;if(z.type=="image"){e.extraData[A+".x"]=l.clk_x;e.extraData[A+".y"]=l.clk_y}}}e.forceSync?t():setTimeout(t,10);var J,o,K=50}}}if(!this.length){p("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof a=="function")a={success:a};var d=this.attr("action");if(d=typeof d==="string"?b.trim(d):"")d=(d.match(/^([^#]+)/)||[])[1];d=d||window.location.href||"";a=b.extend(true,{url:d,
type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a);d={};this.trigger("form-pre-serialize",[this,a,d]);if(d.veto){p("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(a.beforeSerialize&&a.beforeSerialize(this,a)===false){p("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var c,f,h=this.formToArray(a.semantic);if(a.data){a.extraData=a.data;for(c in a.data)if(a.data[c]instanceof Array)for(var j in a.data[c])h.push({name:c,
value:a.data[c][j]});else{f=a.data[c];f=b.isFunction(f)?f():f;h.push({name:c,value:f})}}if(a.beforeSubmit&&a.beforeSubmit(h,this,a)===false){p("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[h,this,a,d]);if(d.veto){p("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}c=b.param(h);if(a.type.toUpperCase()=="GET"){a.url+=(a.url.indexOf("?")>=0?"&":"?")+c;a.data=null}else a.data=c;var k=this,r=[];a.resetForm&&r.push(function(){k.resetForm()});
a.clearForm&&r.push(function(){k.clearForm()});if(!a.dataType&&a.target){var B=a.success||function(){};r.push(function(t){var s=a.replaceTarget?"replaceWith":"html";b(a.target)[s](t).each(B,arguments)})}else a.success&&r.push(a.success);a.success=function(t,s,C){for(var l=a.context||a,e=0,u=r.length;e0;j="multipart/form-data";j=k.attr("enctype")==j||k.attr("encoding")==j;if(a.iframe!==false&&(c||a.iframe||j))a.closeKeepAlive?b.get(a.closeKeepAlive,
g):g();else b.ajax(a);this.trigger("form-submit-notify",[this,a]);return this};b.fn.ajaxForm=function(a){if(this.length===0){var g={s:this.selector,c:this.context};if(!b.isReady&&g.s){p("DOM not ready, queuing ajaxForm");b(function(){b(g.s,g.c).ajaxForm(a)});return this}p("terminating; zero elements found by selector"+(b.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(d){if(!d.isDefaultPrevented()){d.preventDefault();b(this).ajaxSubmit(a)}}).bind("click.form-plugin",
function(d){var c=d.target,f=b(c);if(!f.is(":submit,input:image")){c=f.closest(":submit");if(c.length==0)return;c=c[0]}var h=this;h.clk=c;if(c.type=="image")if(d.offsetX!=undefined){h.clk_x=d.offsetX;h.clk_y=d.offsetY}else if(typeof b.fn.offset=="function"){f=f.offset();h.clk_x=d.pageX-f.left;h.clk_y=d.pageY-f.top}else{h.clk_x=d.pageX-c.offsetLeft;h.clk_y=d.pageY-c.offsetTop}setTimeout(function(){h.clk=h.clk_x=h.clk_y=null},100)})};b.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};
b.fn.formToArray=function(a){var g=[];if(this.length===0)return g;var d=this[0],c=a?d.getElementsByTagName("*"):d.elements;if(!c)return g;var f,h,j,k,r,B;f=0;for(r=c.length;f