(function(n){function i(n,t){for(var i=window,r=(n||"").split(".");i&&length;)i=i[shift()];return typeof i=="function"?i:(push(n),apply(null,t))}function u(n){return n==="GET"||n==="POST"}function o(n,t){u(t)||setrequestheader("X-HTTP-Method-Override",t)}function s(t,i,r){var u;indexof("application/x-javascript")===-1&&(u=(getattribute("data-ajax-mode")||"").toUpperCase(),n(getattribute("data-ajax-update")).each(function(t,r){var f;switch(u){case"BEFORE":f=firstchild;n("
").html(i).contents().each(function(){insertbefore(this,f)});break;case"AFTER":n("").html(i).contents().each(function(){appendchild(this)});break;case"REPLACE-WITH":n(r).replaceWith(i);break;default:n(r).html(i)}}))}function f(t,r){var e,h,f,c;(e=getattribute("data-ajax-confirm"),!e||confirm(e))&&(h=n(getattribute("data-ajax-loading")),c=parseInt(getattribute("data-ajax-loading-duration"),10)||0,extend(r,{type:getattribute("data-ajax-method")||undefined,url:getattribute("data-ajax-url")||undefined,cache:!!getattribute("data-ajax-cache"),beforeSend:function(n){var r;return o(n,f),r=i(getattribute("data-ajax-begin"),["xhr"]).apply(t,arguments),r!==!1&&show(c),r},complete:function(){hide(c);i(getattribute("data-ajax-complete"),["xhr","status"]).apply(t,arguments)},success:function(n,r,u){s(t,n,getresponseheader("Content-Type")||"text/html");i(getattribute("data-ajax-success"),["data","status","xhr"]).apply(t,arguments)},error:function(){i(getattribute("data-ajax-failure"),["xhr","status","error"]).apply(t,arguments)}}),push({name:"X-Requested-With",value:"XMLHttpRequest"}),f=touppercase(),u(f)||(type="POST",push({name:"X-HTTP-Method-Override",value:f})),ajax(r))}function h(t){var i=n(t).data(e);return!i||!validate||validate()}var t="unobtrusiveAjaxClick",r="unobtrusiveAjaxClickTarget",e="unobtrusiveValidation";n(document).on("click","a[data-ajax=true]",function(n){preventdefault();f(this,{url:href,type:"GET",data:[]})});n(document).on("click","form[data-ajax=true] input[type=image]",function(i){var r=name,u=n(target),f=n(parents("form")[0]),e=offset();data(t,[{name:r+".x",value:round(left)},{name:r+".y",value:round(top)}]);setTimeout(function(){removedata(t)},0)});n(document).on("click","form[data-ajax=true] :submit",function(i){var f=name,e=n(target),u=n(parents("form")[0]);data(t,f?[{name:f,value:value}]:[]);data(r,e);setTimeout(function(){removedata(t);removedata(r)},0)});n(document).on("submit","form[data-ajax=true]",function(i){var e=n(this).data(t)||[],u=n(this).data(r),o=u&&hasclass("cancel");(preventdefault(),o||h(this))&&f(this,{url:action,type:method||"GET",data:concat(n(this).serializeArray())})})})(jQuery)