(function(B,a,x){B=B||(function(Q){return{ajax:Q.ajax,$:function(U){return Q(U)[0]},replaceWith:function(U,Y){var X=Q(U)[0];var W=X.nextSibling,V=X.parentNode;Q(X).remove();if(W){Q(W).before(Y)}else{Q(V).append(Y)}}}})(a.jQuery);function L(W,V){for(var U=0,Q=W.length;U<Q;U++){if(V(W[U])===false){return}}}function s(Q){return Object.prototype.toString.call(Q)==="[object Function]"}function n(Q){return Object.prototype.toString.call(Q)==="[object String]"}function r(V,U,Q){return Array.prototype.slice.call(V,U||0,Q||V&&V.length)}function A(W,V){var Q=false;L(W,U);function U(X){return !(Q=V(X))}return Q}function H(Q){this._queue=[];this._children=[];this._parent=Q;if(Q){Q._addChild(this)}}H.prototype={_addChild:function(Q){this._children.push(Q)},push:function(Q){this._queue.push(Q);this._bubble("_doRun")},pause:function(){this._bubble("_doPause")},resume:function(){this._bubble("_doResume")},_bubble:function(U){var Q=this;while(!Q[U]){Q=Q._parent}return Q[U]()},_next:function(){if(A(this._children,Q)){return true}function Q(V){return V._next()}var U=this._queue.shift();if(U){U()}return !!U}};function h(Q){if(Q){return new H(Q)}H.call(this);this.paused=0}h.prototype=(function(){function Q(){}Q.prototype=H.prototype;return new Q()})();h.prototype._doRun=function(){if(!this.running){this.running=true;try{while(this.paused<1&&this._next()){}}finally{this.running=false}}};h.prototype._doPause=function(){this.paused++};h.prototype._doResume=function(){this.paused--;this._doRun()};function I(){}I.prototype={_html:"",open:function(){this._opened=true;if(this._delegate){this._delegate.open()}},write:function(Q){if(this._closed){return}this._written=true;if(this._delegate){this._delegate.write(Q)}else{this._html+=Q}},writeln:function(Q){this.write(Q+"\n")},close:function(){this._closed=true;if(this._delegate){this._delegate.close()}},copyTo:function(Q){this._delegate=Q;Q.foobar=true;if(this._opened){Q.open()}if(this._written){Q.write(this._html)}if(this._closed){Q.close()}}};var e=(function(){var Q={f:a.document.getElementById};try{Q.f.call(a.document,"abc");return true}catch(U){return false}})();function u(){var Y=[];var W={write:a.document.write,writeln:a.document.writeln,getEl:a.document.getElementById,finish:function(){L(Y,function(Z){var aa=a.document.getElementById(Z.id);if(!aa){throw"No element with id: "+Z.id}L(Z.el.childNodes,function(ab){aa.appendChild(ab)});if(aa.contentWindow){a.setTimeout(function(){Z.el.contentWindow.document.copyTo(aa.contentWindow.document)},1)}})},out:""};a.document.write=V;a.document.writeln=U;if(m.proxyGetElementById){a.document.getElementById=Q}function V(Z){W.out+=Z}function U(Z){W.out+=Z+"\n"}function X(aa){var Z=a.document.createElement("div");Y.push({id:aa,el:Z});Z.contentWindow={document:new I()};return Z}function Q(aa){var Z=e?W.getEl.call(a.document,aa):W.getEl(aa);return Z||X(aa)}return W}function P(Q){a.document.write=Q.write;a.document.writeln=Q.writeln;if(m.proxyGetElementById){a.document.getElementById=Q.getEl}return Q.out}function J(Q){return Q&&Q.replace(/^\s*<!(\[CDATA\[|--)/,"").replace(/(\]\]|--)>\s*$/,"")}function b(){}function d(U,Q){console.error("Error",Q,"executing code:",U)}var j=s(a.console&&console.error)?d:b;function N(Q){var U=u();try{x(J(Q))}catch(V){j(Q,V)}finally{P(U)}return U}function K(U){var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(U);return Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)}function O(Q){return new RegExp(Q+"=(?:([\"'])([\\s\\S]*?)\\1|([^\\s>]+))","i")}function i(Q){var U=O(Q);return function(V){var W=U.exec(V)||[];return W[2]||W[3]}}var p=/(<script[\s\S]*?>)([\s\S]*?)<\/script>/ig,l=O("src"),S=i("src"),o=i("type"),T=i("language"),z="__document_write_ajax_callbacks__",y="__document_write_ajax_div-",g="window['"+z+"']['%d']();",k=a[z]={},t='<script type="text/javascript">'+g+"<\/script>",E=0;function c(){return(++E).toString()}function D(U,V){var Q;if(s(U)){Q=U;U=null}U=U||{};Q=Q||U&&U.done;U.done=V?function(){V(Q)}:Q;return U}var w=new h();var v=[];var f=window._debugWriteCapture?function(){}:function(Q,V,U){v.push({type:Q,src:V,data:U})};var G=window._debugWriteCapture?function(){}:function(){v.push(arguments)};function R(Q){var U=c();k[U]=function(){Q();delete k[U]};return U}function F(Q){return t.replace(/%d/,R(Q))}function M(X,V,W){var Q=W&&new h(W)||w;V=D(V);var U=V.done;var Y="";if(s(U)){Y=F(function(){Q.push(U)})}return X.replace(p,Z)+Y;function Z(ac,am,ab){var af=S(am),ae=o(am)||"",at=T(am)||"",aq=(!ae&&!at)||ae.toLowerCase().indexOf("javascript")!==-1||at.toLowerCase().indexOf("javascript")!==-1;f("replace",af,ac);if(!aq){return ac}if(af&&s(m.fixUrls)){af=m.fixUrls(af)}var an=R(ah),ag=y+an;var al;function ah(){Q.push(al)}if(af){am=am.replace(l,"");if(K(af)){al=ar}else{if(V.asyncAll){al=ap()}else{al=ak}}}else{al=ao}function ao(){aa(ab)}function ak(){B.ajax({url:af,type:"GET",async:false,success:function(au){aa(au)}})}function ad(aw,au,av){j("<XHR for "+af+">",av);Q.resume()}function ai(){return F(function(){Q.resume()})}function ap(){var aw,av;function au(ay,ax){if(!aw){av=ay;return}try{aa(ay,ai())}catch(az){j(ay,az)}}B.ajax({url:af,type:"GET",async:true,success:au,error:ad});return function(){aw=true;if(av){aa(av)}else{Q.pause()}}}function ar(au){var aw=u();Q.pause();f("pause",af);B.ajax({url:af,type:"GET",dataType:"script",success:av,error:ad});function av(az,ay,ax){f("out",af,aw.out);aj(P(aw),F(aw.finish)+ai());f("resume",af)}}function aa(av,au){var aw=N(av);au=F(aw.finish)+(au||"");aj(aw.out,au)}function aj(av,au){B.replaceWith("#"+ag,M(av,null,Q)+(au||""))}return am+g.replace(/%d/,an)+'<\/script><div style="display: none" id="'+ag+'"></div>'}}function C(U,V){var Q=w;L(U,function(W){Q.push(X);function X(){W.action(M(W.html,W.options,Q),W)}});if(V){Q.push(V)}}var q="writeCapture";var m=a[q]={_original:a[q],fixUrls:function(Q){return Q.replace(/&amp;/g,"&")},noConflict:function(){a[q]=this._original;return this},debug:v,proxyGetElementById:false,_forTest:{Q:h,GLOBAL_Q:w,$:B,matchAttr:i,slice:r,capture:u,uncapture:P,captureWrite:N},replaceWith:function(Q,V,U){B.replaceWith(Q,M(V,U))},html:function(Q,W,U){var V=B.$(Q);V.innerHTML="<span/>";B.replaceWith(V.firstChild,M(W,U))},load:function(Q,V,U){B.ajax({url:V,type:"GET",success:function(W){m.html(Q,W,U)}})},sanitize:M,sanitizeSerial:C}})(this.writeCaptureSupport,this,eval);(function(g,d,n){var c={html:h};g.each(["append","prepend","after","before","wrap","wrapAll","replaceWith","wrapInner"],function(){c[this]=i(this)});function a(q){return Object.prototype.toString.call(q)=="[object String]"}function p(u,t,s,r){if(arguments.length==0){return o.call(this)}var q=c[u];if(u=="load"){return l.call(this,t,s,r)}if(!q){j(u)}return b.call(this,t,s,q)}g.fn.writeCapture=p;var k="__writeCaptureJsProxied-fghebd__";function o(){if(this[k]){return this}var r=this;function q(){var t=this,s=false;this[k]=true;g.each(c,function(v){var u=r[v];if(!u){return}t[v]=function(y,x,w){if(!s&&a(y)){try{s=true;return p.call(t,v,y,x,w)}finally{s=false}}return u.apply(t,arguments)}});this.pushStack=function(){return o.call(r.pushStack.apply(t,arguments))};this.endCapture=function(){return r}}q.prototype=r;return new q()}function b(t,s,u){var q,r=this;if(s&&s.done){q=s.done;delete s.done}else{if(g.isFunction(s)){q=s;s=null}}d.sanitizeSerial(g.map(this,function(v){return{html:t,options:s,action:function(w){u.call(v,w)}}}),q&&function(){q.call(r)}||q);return this}function h(q){g(this).html(q)}function i(q){return function(r){g(this)[q](r)}}function l(t,s,v){var r=this,q,u=t.indexOf(" ");if(u>=0){q=t.slice(u,t.length);t=t.slice(0,u)}if(g.isFunction(v)){s=s||{};s.done=v}return g.ajax({url:t,type:s&&s.type||"GET",dataType:"html",data:s&&s.params,complete:f(r,s,q)})}function f(r,s,q){return function(u,t){if(t=="success"||t=="notmodified"){var v=m(u.responseText,q);b.call(r,v,s,h)}}}var e=/jquery-writeCapture-script-placeholder-(\d+)-wc/g;function m(s,r){if(!r||!s){return s}var t=0,q={};return g("<div/>").append(s.replace(/<script(.|\s)*?\/script>/g,function(u){q[t]=u;return"jquery-writeCapture-script-placeholder-"+(t++)+"-wc"})).find(r).html().replace(e,function(u,v){return q[v]})}function j(q){throw"invalid method parameter "+q}g.writeCapture=d})(jQuery,writeCapture.noConflict());
