(function(){/*
 Copyright 2011, Peter Rowntree. All Rights Reserved.
*/
var d=null;window.rc=g;window.htStart=j;window.pay=k;window.moveDrifter=l;window.toggleDrift=m;window.setDrift=n;window.inform=o;window.otdStart=p;window.otdContinue=q;window.otdToggle=r;function s(a){return typeof a.layerX!="undefined"?a.layerX:typeof a.offsetX!="undefined"?a.offsetX:0}function t(a){return typeof a.layerY!="undefined"?a.layerY:typeof a.offsetY!="undefined"?a.offsetY:0}function u(a){return typeof a.target!="undefined"?a.target:a.srcElement}function v(a){if(typeof a.stopPropagation!="undefined")a.stopPropagation();else if(typeof a.cancelBubble!="undefined")a.cancelBubble=!0};var x=new w,y=d,z=d;window.onblur=function(a){v(a);y=d;A()};
function g(a){if(!a)a=window.event;a=u(a);switch(a.className.substr(0,4)){case "ceil":y=a;var b=a.nextSibling;if(b.className.substr(0,4)=="bloc"){var c=a.parentNode,e=a,f=0;do f+=e.offsetTop,e=e.offsetParent;while(e!=d&&e!=c);var e=a,h=0;do h+=e.offsetLeft,e=e.offsetParent;while(e!=d&&e!=c);b.style.left=h+a.offsetWidth-1+"px";b.style.top=f+2+"px"}b.style.display="block";if(typeof g_activeBGColor!="undefined")a.style.backgroundColor=g_activeBGColor;B();break;case "bloc":y=a.previousSibling;break;default:if(a=
a.parentNode,a.className.substr(0,4)=="bloc")y=a.previousSibling}}function C(a){var b=a.nextSibling;if(b)b.style.display="none";a.style.backgroundColor=""}function A(){if(z==d){z=[];var a=document.getElementById("nav");if(a)for(var a=a.getElementsByTagName("div"),b=0;b<a.length;b++)a[b].className.substr(0,4)=="bloc"&&z.push(a[b].previousSibling)}for(a=z.length-1;a>=0;a--){if(y!=d&&y==z[a]){a-=1;for(b=y.parentNode;a>=0;a--)z[a].parentNode==b&&C(z[a]);break}C(z[a])}}
function u(a){return typeof a.target!="undefined"?a.target:a.srcElement}function B(){x.clear();A()}window.doHideTimer=B;function j(){y=d;x.B()};function k(){try{var a=document.getElementById("f2");a.action="https://www.paypal.com/cgi-bin/webscr";a.method="post";a.submit()}catch(b){alert(typeof b.message=="undefined"?b:b.message)}};var D=d;function E(){D.t(d);D.u(d);D.j()}function F(a){D.s(0,0);D.stop();a.className=a.className.replace(/drifting/,"stopped")}window.doDrift=function(){D.z();D.A()};function m(a,b){if(a&&a.ctrlKey)return!1;o(b,!1);D.C()?F(b):(D.stop(),b.className=b.className.replace(/stopped/,"drifting"),D.start("doDrift()"));v(a);return!1}
function o(a,b){a==d&&(a=document.getElementById("drifter"));if(b&&a.className.indexOf("drifting")<0)a.innerHTML="Click in this box to start or stop drifting. Move cursor to control drift. Ctrl-click anywhere to move the box there.",a.className.indexOf("informing")<0&&(a.className+=" informing");else if(!b)a.innerHTML="&nbsp;",a.className=a.className.replace(/ informing/,"");return!1}
window.onload=function(){var a=document.getElementById("tileHolder");if(!a)return d;D=new G(a);window.onresize=E;D.j();return D};
function G(a){H=40;this.o=this.n=0;this.loaded=[];this.c=d;this.start=function(a){this.c=setInterval(a,H)};this.stop=function(){clearInterval(this.c);this.c=d};this.C=function(){return this.c!=d};this.j=function(){var b=a.parentNode,c=Math.floor((b.offsetWidth-a.offsetLeft)/256)+1,b=Math.floor((b.offsetHeight-a.offsetTop)/256)+1;b>=10&&(b=9);c>=10&&(c=9);var e;e=a.hasChildNodes()?a.lastChild:this.l(0,0);var f=e.offsetTop/256+1;e=e.offsetLeft/256+1;for(var h=0;h<f;h++)for(var i=e;i<=c;i++)this.l(h,
i);for(h=f;h<=b;h++)for(i=0;i<=c;i++)this.l(h,i)};this.l=function(b,c){var e=b+"_"+c;if(typeof this.loaded[e]!="undefined")return d;this.loaded[e]=1;var f=document.createElement("img");f.src="tiles/tile_"+e+".jpg";e=f.style;e.left=c*256+"px";e.top=b*256+"px";a.appendChild(f);return f};this.z=function(){this.t(a.offsetLeft+this.n)};this.t=function(b){if(b==d)b=a.offsetLeft;var c=-2560+a.parentNode.offsetWidth;b>0?b=0:b<c&&(b=c);if(b!=a.offsetLeft)a.style.left=b+"px",this.j()};this.A=function(){this.u(a.offsetTop+
this.o)};this.u=function(b){if(b==d)b=a.offsetTop;var c=-2560+a.parentNode.offsetHeight;b>0?b=0:b<c&&(b=c);if(b!=a.offsetTop)a.style.top=b+"px",this.j()};this.s=function(a,c){this.n=a;this.o=c}}var H;function n(a){if(!a)a=window.event;var b=u(a);D.s(b.offsetWidth/2-s(a),b.offsetHeight/2-t(a));return!1}
function l(a){if(!a)a=window.event;var b=document.getElementById("drifter");F(b);if(!a.ctrlKey)return!1;for(var c=s(a),e=t(a),f=document.getElementById("tileHolderHolder"),a=u(a);a!=f;)if(c+=a.offsetLeft,e+=a.offsetTop,a=a.offsetParent,a==d)break;f=b.style;f.left=c-52+"px";f.top=e-52+"px";o(b,!0);return!1};function w(){this.i=d;this.B=function(){this.clear();this.i=setTimeout("doHideTimer()",180)};this.clear=function(){if(this.i!=d)clearTimeout(this.i),this.i=d}};var I=d;
function J(){K=1E6;L=100;this.b=0;this.c=setInterval("otdStart()",500);this.f=this.d=this.h=d;this.k=!1;this.g=1;this.J=function(){return this.k};this.start=function(a){clearInterval(this.c);if(a)this.h=a;if(!(this.b>=K))this.k=!0,this.c=setInterval("otdContinue()",L)};this.label=function(a){var b=document.createElement("a");b.className="block";b.title="pause/resume";b.href="javascript:otdToggle();";b.appendChild(document.createTextNode(a));this.h.appendChild(b)};this.G=function(){if(this.b<K){if(this.b%
1E3==0)if(this.label("$"+this.b/1E3+(this.b==0?"":" BILLION")),this.d==d)this.d=document.createElement("div"),this.h.appendChild(this.d);else{this.f=this.d.cloneNode(!0);for(var a=Math.floor(Math.random()*16777215),b=[],c=0;c<3;++c)b[c]=a>>8*c&127|128;this.f.style.backgroundColor="rgb("+b.join(",")+")"}if(this.f==d){this.b>=this.g*10&&(this.g*=10);a=this.d.innerHTML.length>0?[this.d.innerHTML]:[];for(c=0;c<this.g;++c)a.push("$1,000,000");this.d.innerHTML=a.join(", ");this.b+=this.g}else this.h.appendChild(this.f),
this.b+=1E3}else this.stop(),this.label("$1 TRILLION")};this.stop=function(){this.k=!1;clearInterval(this.c)}}var K,L;function p(){I==d&&(I=new J);var a=document.getElementById("otdHolder");if(a)a.innerHTML="",I.start(a)}function q(){I.G()}function r(){I.k?I.stop():I.start()};var M=d;function Editor(a,b,c,e){this.a=document.getElementById(a);this.m=b;this.q=c;this.e=this.editor=d;this.r=e}
Editor.prototype={H:function(){this.editor?this.w(!0):this.D()},D:function(){if(!this.editor&&this.a){this.e=this.a.cloneNode(!1);this.a.parentNode.insertBefore(this.e,this.a);this.e.id="";this.e.style.cssText="padding-top:20px;";var a={saveFunction:N,bodyClass:this.a.className,extraPlugins:"stylesheetparser"};if(this.m)a.contentsCss=this.m;this.editor=CKEDITOR.appendTo(this.e,a,this.a.innerHTML)}},p:function(){return this.editor.checkDirty()},w:function(a){if(!this.editor)return!0;if(a&&this.p()&&
!confirm("unsaved changes will be lost; exit anyway?"))return!1;this.e.parentNode.removeChild(this.e);this.editor.destroy();this.editor=d;return!0},saveFunction:function(a){if(this.a){this.a.innerHTML=a;var a="https://secure.hdyn.com:8812/auth?action=authorize&get_otk&rid="+this.r+"&wrapper=processMumonData",b=document.getElementById("scriptHolder"),c=b.firstChild;c!=d&&b.removeChild(c);c=document.createElement("script");c.type="text/javascript";b.appendChild(c);a+="&dt="+(new Date).getTime();c.src=
a}},F:function(a){if(a==="")alert("you are not signed in (or are cookies disabled?)");else if(this.a&&(this.editor.resetDirty(),this.q)){var b="POST";try{b||(b="POST"),O(encodeURIComponent(this.a.innerHTML),"store.php?p="+this.q+"&rid="+this.r+"&mumonData="+a,P,b)}catch(c){Q(typeof c.message=="undefined"?c:c.message)}}}};window.toggleEditor=function(a,b,c,e){M||(M=new Editor(a,b,c,e));M.H()};window.processMumonData=function(a){M.F(a)};function N(a){M.saveFunction(a)}
window.onbeforeunload=function(a){if(M&&M.p()){if(a=a||window.event)a.returnValue="unsaved changes will be lost.";return"unsaved changes will be lost."}};
function P(a){try{if(a==d)throw"no response XML!";var b="";if(a.status!=200)throw b+=a.status+" "+a.statusText+"<br/>",b;if(a.responseText===d)throw"expected xml responseText, got null<br/>";if(a.responseText=="you are not signed in.")throw a.responseText;if(a.responseText.indexOf("ERROR:")==0)throw a.responseText;a.responseText.indexOf("//js")===0?eval(a.responseText):a.responseText!="OK"&&Q(a.responseText)}catch(c){Q(typeof c.message=="undefined"?c:c.message)}};var R=d,S=d;function T(a,b){this.v=function(){switch(a.readyState){case 4:if(b==d)break;typeof b=="function"?b(a):b.I(a)}}}
function U(a){var b=a!=d,c=d,e=d;if(typeof XMLHttpRequest!="undefined"){e=new XMLHttpRequest;if(b)c=new T(e,a),e.onreadystatechange=c.v;return e}if(typeof window.ActiveXObject=="undefined")return d;if(c=R==d){if(R!=d)c=!0;else{b:{c=["Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(e=0;e<c.length;e++)try{new ActiveXObject(c[e]);R=c[e];break b}catch(f){}"Unable to create an XMLHTTP request object"!=d&&(S==d?alert("Unable to create an XMLHTTP request object"):S("Unable to create an XMLHTTP request object"));
R=d}c=R!=d}c=!c}if(c)return d;e=new ActiveXObject(R);if(b)c=new T(e,a),e.onreadystatechange=c.v;return e}function O(a,b,c){var e=arguments.length<4?"POST":arguments[3],f=arguments.length<5?d:arguments[4],h=arguments.length<6?d:arguments[5],i=U(c);if(i==d)throw"Sorry, your browser lacks the ability to run this AJAX application.";i.open(e,b,c!=d,f,h);i.setRequestHeader("Content-Type","text/xml; charset=utf-8");i.send(a)};function Q(a){var b=document.getElementById("report");if(b!=d){if(b.innerHTML=a,b.parentNode)b.parentNode.style.display=a==""?"none":"block"}else a!=""&&alert(a)}window.reportEncoded=function(a){Q(decodeURIComponent(a))};})();

