(function(a){var b=a.ajax,c=[];a.extend({ajax:function(d){var e=jQuery.extend(!0,{},jQuery.ajaxSettings,d),f=!1;a.each(c,function(g,h){if(!c[g])return;var i=null;if(a.isFunction(c[g]))i=c[g](e);else{i=c[g];if(a.isFunction(i.url.test))i.url.test(e.url)||(i=null);else{var j=i.url.indexOf("*");if(i.url!="*"&&i.url!=e.url&&j==-1||j>-1&&i.url.substr(0,j)!=e.url.substr(0,j))i=null}if(i){if(i.data&&e.data){var k=!1;(function u(b,c){if(typeof c=="string")return k=a.isFunction(b.test)?b.test(c):b==c,k;a.each(b,function(d,e){return c[d]===undefined?(k=!1,!1):(k=!0,typeof c[d]=="object"?u(b[d],c[d]):(a.isFunction(b[d].test)?k=b[d].test(c[d]):k=b[d]==c[d],k))})})(i.data,e.data),k==0&&(i=null)}i&&i.type&&i.type!=e.type&&(i=null)}}if(i){typeof console!="undefined"&&console.log&&console.log("MOCK GET: "+e.url),f=!0;if(e.dataType==="jsonp"){if(e.type.toUpperCase()==="GET")l.test(e.url)||(e.url+=(rquery.test(e.url)?"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!l.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}var l=/=\?(&|$)/;e.dataType==="json"&&(e.data&&l.test(e.data)||l.test(e.url))&&(jsonp=e.jsonpCallback||"jsonp"+jsc++,e.data&&(e.data=(e.data+"").replace(l,"="+jsonp+"$1")),e.url=e.url.replace(l,"="+jsonp+"$1"),e.dataType="script",window[jsonp]=window[jsonp]||function(a){data=a,q(),r(),window[jsonp]=undefined;try{delete window[jsonp]}catch(b){}head&&head.removeChild(script)});var m=/^(\w+:)?\/\/([^\/?#]+)/,n=m.exec(e.url),o=n&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(e.dataType==="script"&&e.type.toUpperCase()==="GET"&&o){var p=d&&d.context||e;function q(){e.success&&e.success.call(p,i.response?i.response.toString():i.responseText||"",status,{}),e.global&&t("ajaxSuccess",[{},e])}function r(){e.complete&&e.complete.call(p,{},status),e.global&&t("ajaxComplete",[{},e]),e.global&&!--jQuery.active&&jQuery.event.trigger("ajaxStop")}function t(a,b){(e.context?jQuery(e.context):jQuery.event).trigger(a,b)}return a.globalEval(i.responseText),q(),r(),!1}return b.call(a,a.extend(!0,{},d,{xhr:function(){return i=a.extend({},a.mockjaxSettings,i),{status:i.status,readyState:1,open:function(){},send:function(){var c=a.proxy(function(){this.status=i.status,this.readyState=4,a.isFunction(i.response)&&i.response(),e.dataType=="json"&&typeof i.responseText=="object"?this.responseText=JSON.stringify(i.responseText):e.dataType=="xml"?a.xmlDOM&&typeof i.responseXML=="string"?this.responseXML=a.xmlDOM(i.responseXML)[0]:this.responseXML=i.responseXML:this.responseText=i.responseText,this.onreadystatechange(i.isTimeout?"timeout":undefined)},this);i.proxy?b({global:!1,url:i.proxy,type:i.type,data:i.data,dataType:e.dataType,complete:function(a,b){i.responseXML=a.responseXML,i.responseText=a.responseText,this.responseTimer=setTimeout(c,i.responseTime||0)}}):e.async===!1?c():this.responseTimer=setTimeout(c,i.responseTime||50)},abort:function(){clearTimeout(this.responseTimer)},setRequestHeader:function(){},getResponseHeader:function(a){if(i.headers&&i.headers[a])return i.headers[a];if(a=="Last-modified")return i.lastModified||(new Date).toString();if(a=="Etag")return i.etag||"";if(a=="content-type")return i.contentType||"text/plain"}}}})),!1}});if(!f)return b.apply(a,arguments)}}),a.mockjaxSettings={status:200,responseTime:500,isTimeout:!1,contentType:"text/plain",response:"",responseText:"",responseXML:"",proxy:"",lastModified:null,etag:"",headers:{etag:"IJF@H#@923uf8023hFO@I#H#","content-type":"text/plain"}},a.mockjax=function(a){var b=c.length;return c[b]=a,b},a.mockjaxClear=function(a){arguments.length==1?c[a]=null:c=[]}})(jQuery)