/*!
** Unobtrusive Ajax support library for jQuery
** Copyright (C) Microsoft Corporation. All rights reserved.
*/
(function(c){var h="unobtrusiveAjaxClick",b="unobtrusiveValidation";function i(l,j){var k=window,m=(l||"").split(".");while(k&&m.length){k=k[m.shift()]}if(typeof(k)==="function"){return k}j.push(l);return Function.constructor.apply(null,j)}function d(j){return j==="GET"||j==="POST"}function f(j,k){if(!d(k)){j.setRequestHeader("X-HTTP-Method-Override",k)}}function g(j,k,m){var l;if(m.indexOf("application/x-javascript")!==-1){return}l=(j.getAttribute("data-ajax-mode")||"").toUpperCase();c(j.getAttribute("data-ajax-update")).each(function(n,p){var o;switch(l){case"BEFORE":o=p.firstChild;c("<div />").html(k).contents().each(function(){p.insertBefore(this,o)});break;case"AFTER":c("<div />").html(k).contents().each(function(){p.appendChild(this)});break;default:c(p).html(k);break}})}function a(l,k){var j,o,n,m;j=l.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j)){return}o=c(l.getAttribute("data-ajax-loading"));m=l.getAttribute("data-ajax-loading-duration")||0;c.extend(k,{type:l.getAttribute("data-ajax-method")||undefined,url:l.getAttribute("data-ajax-url")||undefined,beforeSend:function(q){var p;f(q,n);p=i(l.getAttribute("data-ajax-begin"),["xhr"]).apply(this,arguments);if(p!==false){o.show(m)}return p},complete:function(){o.hide(m);i(l.getAttribute("data-ajax-complete"),["xhr","status"]).apply(this,arguments)},success:function(q,p,r){g(l,q,r.getResponseHeader("Content-Type")||"text/html");i(l.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(this,arguments)},error:i(l.getAttribute("data-ajax-failure"),["xhr","status","error"])});k.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});n=k.type.toUpperCase();if(!d(n)){k.type="POST";k.data.push({name:"X-HTTP-Method-Override",value:n})}c.ajax(k)}function e(k){var j=c(k).data(b);return !j||!j.validate||j.validate()}c("a[data-ajax=true]").live("click",function(j){j.preventDefault();a(this,{url:this.href,type:"GET",data:[]})});c("form[data-ajax=true] input[type=image]").live("click",function(k){var l=k.target.name,j=c(k.target),m=j.parents("form")[0],n=j.offset();c(m).data(h,[{name:l+".x",value:Math.round(k.pageX-n.left)},{name:l+".y",value:Math.round(k.pageY-n.top)}]);setTimeout(function(){c(m).removeData(h)},0)});c("form[data-ajax=true] :submit").live("click",function(j){var k=j.target.name,l=c(j.target).parents("form")[0];c(l).data(h,k?[{name:k,value:j.target.value}]:[]);setTimeout(function(){c(l).removeData(h)},0)});c("form[data-ajax=true]").live("submit",function(j){var k=c(this).data(h)||[];j.preventDefault();if(!e(this)){return}a(this,{url:this.action,type:this.method||"GET",data:k.concat(c(this).serializeArray())})})}(jQuery));
