/*!
* jQuery Form Plugin
* version: 3.32.0-2013.04.03
* @requires jQuery v1.5 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Project repository: https://github.com/malsup/form
* Dual licensed under the MIT and GPL licenses:
* http://malsup.github.com/mit-license.txt
* http://malsup.github.com/gpl-license-v2.txt
*/
(function(f){var c={};c.fileapi=f("").get(0).files!==undefined;c.formdata=window.FormData!==undefined;var e=!!f.fn.prop;f.fn.attr2=function(){if(!e){return this.attr.apply(this,arguments)}var g=this.prop.apply(this,arguments);if((g&&g.jquery)||typeof g==="string"){return g}return this.attr.apply(this,arguments)};f.fn.ajaxSubmit=function(i){if(!this.length){d("ajaxSubmit: skipping submit process - no element selected");return this}var h,z,l,n=this;if(typeof i=="function"){i={success:i}}h=this.attr2("method");z=this.attr2("action");l=(typeof z==="string")?f.trim(z):"";l=l||window.location.href||"";if(l){l=(l.match(/^([^#]+)/)||[])[1]}i=f.extend(true,{url:l,success:f.ajaxSettings.success,type:h||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},i);var t={};this.trigger("form-pre-serialize",[this,i,t]);if(t.veto){d("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(i.beforeSerialize&&i.beforeSerialize(this,i)===false){d("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var m=i.traditional;if(m===undefined){m=f.ajaxSettings.traditional}var r=[];var C,D=this.formToArray(i.semantic,r);if(i.data){i.extraData=i.data;C=f.param(i.data,m)}if(i.beforeSubmit&&i.beforeSubmit(D,this,i)===false){d("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[D,this,i,t]);if(t.veto){d("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var x=f.param(D,m);if(C){x=(x?(x+"&"+C):C)}if(i.type.toUpperCase()=="GET"){i.url+=(i.url.indexOf("?")>=0?"&":"?")+x;i.data=null}else{i.data=x}var F=[];if(i.resetForm){F.push(function(){n.resetForm()})}if(i.clearForm){F.push(function(){n.clearForm(i.includeHidden)})}if(!i.dataType&&i.target){var j=i.success||function(){};F.push(function(q){var k=i.replaceTarget?"replaceWith":"html";f(i.target)[k](q).each(j,arguments)})}else{if(i.success){F.push(i.success)}}i.success=function(I,q,J){var H=i.context||this;for(var G=0,k=F.length;G0;var A="multipart/form-data";var w=(n.attr("enctype")==A||n.attr("encoding")==A);var v=c.fileapi&&c.formdata;d("fileAPI :"+v);var p=(o||w)&&!v;var u;if(i.iframe!==false&&(i.iframe||p)){if(i.closeKeepAlive){f.get(i.closeKeepAlive,function(){u=E(D)})}else{u=E(D)}}else{if((o||w)&&v){u=s(D)}else{u=f.ajax(i)}}n.removeData("jqxhr").data("jqxhr",u);for(var y=0;y');L.css({position:"absolute",top:"-1000px",left:"-1000px"})}O=L[0];M={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(ah){var ai=(ah==="timeout"?"timeout":"aborted");d("aborting upload... "+ai);this.aborted=1;try{if(O.contentWindow.document.execCommand){O.contentWindow.document.execCommand("Stop")}}catch(aj){}L.attr("src",T.iframeSrc);M.error=ai;if(T.error){T.error.call(T.context,M,ai,ah)}if(ab){f.event.trigger("ajaxError",[M,T,ai])}if(T.complete){T.complete.call(T.context,M,ai)}}};ab=T.global;if(ab&&0===f.active++){f.event.trigger("ajaxStart")}if(ab){f.event.trigger("ajaxSend",[M,T])}if(T.beforeSend&&T.beforeSend.call(T.context,M,T)===false){if(T.global){f.active--}ag.reject();return ag}if(M.aborted){ag.reject();return ag}N=J.clk;if(N){X=N.name;if(X&&!N.disabled){T.extraData=T.extraData||{};T.extraData[X]=N.value;if(N.type=="image"){T.extraData[X+".x"]=J.clk_x;T.extraData[X+".y"]=J.clk_y}}}var S=1;var P=2;function Q(aj){var ai=null;try{if(aj.contentWindow){ai=aj.contentWindow.document}}catch(ah){d("cannot get iframe.contentWindow document: "+ah)}if(ai){return ai}try{ai=aj.contentDocument?aj.contentDocument:aj.document}catch(ah){d("cannot get iframe.contentDocument: "+ah);ai=aj.document}return ai}var H=f("meta[name=csrf-token]").attr("content");var G=f("meta[name=csrf-param]").attr("content");if(G&&H){T.extraData=T.extraData||{};T.extraData[G]=H}function Y(){var aj=n.attr2("target"),ah=n.attr2("action");J.setAttribute("target",W);if(!h){J.setAttribute("method","POST")}if(ah!=T.url){J.setAttribute("action",T.url)}if(!T.skipEncodingOverride&&(!h||/post/i.test(h))){n.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(T.timeout){R=setTimeout(function(){aa=true;V(S)},T.timeout)}function ak(){try{var ao=Q(O).readyState;d("state = "+ao);if(ao&&ao.toLowerCase()=="uninitialized"){setTimeout(ak,50)}}catch(ap){d("Server abort: ",ap," (",ap.name,")");V(P);if(R){clearTimeout(R)}R=undefined}}var ai=[];try{if(T.extraData){for(var an in T.extraData){if(T.extraData.hasOwnProperty(an)){if(f.isPlainObject(T.extraData[an])&&T.extraData[an].hasOwnProperty("name")&&T.extraData[an].hasOwnProperty("value")){ai.push(f('').val(T.extraData[an].value).appendTo(J)[0])}else{ai.push(f('').val(T.extraData[an]).appendTo(J)[0])}}}}if(!T.iframeTarget){L.appendTo("body");if(O.attachEvent){O.attachEvent("onload",V)}else{O.addEventListener("load",V,false)}}setTimeout(ak,15);try{J.submit()}catch(al){var am=document.createElement("form").submit;am.apply(J)}}finally{J.setAttribute("action",ah);if(aj){J.setAttribute("target",aj)}else{n.removeAttr("target")}f(ai).remove()}}if(T.forceSync){Y()}else{setTimeout(Y,10)}var ae,af,ac=50,K;function V(an){if(M.aborted||K){return}af=Q(O);if(!af){d("cannot access response document");an=P}if(an===S&&M){M.abort("timeout");ag.reject(M,"timeout");return}else{if(an==P&&M){M.abort("server abort");ag.reject(M,"error","server abort");return}}if(!af||af.location.href==T.iframeSrc){if(!aa){return}}if(O.detachEvent){O.detachEvent("onload",V)}else{O.removeEventListener("load",V,false)}var al="success",ap;try{if(aa){throw"timeout"}var ak=T.dataType=="xml"||af.XMLDocument||f.isXMLDoc(af);d("isXml="+ak);if(!ak&&window.opera&&(af.body===null||!af.body.innerHTML)){if(--ac){d("requeing onLoad callback, DOM not available");setTimeout(V,250);return}}var aq=af.body?af.body:af.documentElement;M.responseText=aq?aq.innerHTML:null;M.responseXML=af.XMLDocument?af.XMLDocument:af;if(ak){T.dataType="xml"}M.getResponseHeader=function(au){var at={"content-type":T.dataType};return at[au]};if(aq){M.status=Number(aq.getAttribute("status"))||M.status;M.statusText=aq.getAttribute("statusText")||M.statusText}var ah=(T.dataType||"").toLowerCase();var ao=/(json|script|text)/.test(ah);if(ao||T.textarea){var am=af.getElementsByTagName("textarea")[0];if(am){M.responseText=am.value;M.status=Number(am.getAttribute("status"))||M.status;M.statusText=am.getAttribute("statusText")||M.statusText}else{if(ao){var ai=af.getElementsByTagName("pre")[0];var ar=af.getElementsByTagName("body")[0];if(ai){M.responseText=ai.textContent?ai.textContent:ai.innerText}else{if(ar){M.responseText=ar.textContent?ar.textContent:ar.innerText}}}}}else{if(ah=="xml"&&!M.responseXML&&M.responseText){M.responseXML=U(M.responseText)}}try{ae=k(M,ah,T)}catch(aj){al="parsererror";M.error=ap=(aj||al)}}catch(aj){d("error caught: ",aj);al="error";M.error=ap=(aj||al)}if(M.aborted){d("upload aborted");al=null}if(M.status){al=(M.status>=200&&M.status<300||M.status===304)?"success":"error"}if(al==="success"){if(T.success){T.success.call(T.context,ae,"success",M)}ag.resolve(M.responseText,"success",M);if(ab){f.event.trigger("ajaxSuccess",[M,T])}}else{if(al){if(ap===undefined){ap=M.statusText}if(T.error){T.error.call(T.context,M,al,ap)}ag.reject(M,"error",ap);if(ab){f.event.trigger("ajaxError",[M,T,ap])}}}if(ab){f.event.trigger("ajaxComplete",[M,T])}if(ab&&!--f.active){f.event.trigger("ajaxStop")}if(T.complete){T.complete.call(T.context,M,al)}K=true;if(T.timeout){clearTimeout(R)}setTimeout(function(){if(!T.iframeTarget){L.remove()}M.responseXML=null},100)}var U=f.parseXML||function(ah,ai){if(window.ActiveXObject){ai=new ActiveXObject("Microsoft.XMLDOM");ai.async="false";ai.loadXML(ah)}else{ai=(new DOMParser()).parseFromString(ah,"text/xml")}return(ai&&ai.documentElement&&ai.documentElement.nodeName!="parsererror")?ai:null};var q=f.parseJSON||function(ah){return window["eval"]("("+ah+")")};var k=function(am,ak,aj){var ai=am.getResponseHeader("content-type")||"",ah=ak==="xml"||!ak&&ai.indexOf("xml")>=0,al=ah?am.responseXML:am.responseText;if(ah&&al.documentElement.nodeName==="parsererror"){if(f.error){f.error("parsererror")}}if(aj&&aj.dataFilter){al=aj.dataFilter(al,ak)}if(typeof al==="string"){if(ak==="json"||!ak&&ai.indexOf("json")>=0){al=q(al)}else{if(ak==="script"||!ak&&ai.indexOf("javascript")>=0){f.globalEval(al)}}}return al};return ag}};f.fn.ajaxForm=function(g){g=g||{};g.delegation=g.delegation&&f.isFunction(f.fn.on);if(!g.delegation&&this.length===0){var h={s:this.selector,c:this.context};if(!f.isReady&&h.s){d("DOM not ready, queuing ajaxForm");f(function(){f(h.s,h.c).ajaxForm(g)});return this}d("terminating; zero elements found by selector"+(f.isReady?"":" (DOM not ready)"));return this}if(g.delegation){f(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,g,b).on("click.form-plugin",this.selector,g,a);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",g,b).bind("click.form-plugin",g,a)};function b(h){var g=h.data;if(!h.isDefaultPrevented()){h.preventDefault();f(this).ajaxSubmit(g)}}function a(k){var j=k.target;var h=f(j);if(!(h.is("[type=submit],[type=image]"))){var g=h.closest("[type=submit]");if(g.length===0){return}j=g[0]}var i=this;i.clk=j;if(j.type=="image"){if(k.offsetX!==undefined){i.clk_x=k.offsetX;i.clk_y=k.offsetY}else{if(typeof f.fn.offset=="function"){var l=h.offset();i.clk_x=k.pageX-l.left;i.clk_y=k.pageY-l.top}else{i.clk_x=k.pageX-j.offsetLeft;i.clk_y=k.pageY-j.offsetTop}}}setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}f.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};f.fn.formToArray=function(x,g){var w=[];if(this.length===0){return w}var l=this[0];var p=x?l.getElementsByTagName("*"):l.elements;if(!p){return w}var r,q,o,y,m,t,k;for(r=0,t=p.length;r