function img_onRollOver(e){var t=e.element();t.src=t.src.replace("-off.","-on.")}function img_onRollOut(e){var t=e.element();t.src=t.src.replace("-on.","-off.")}function flashBg(e,t,n){var e=$(e);var r=e.style.backgroundColor;e.style.backgroundColor=t;if(!n)flashBg.delay(1,e,r,true)}function attachGlobalEvents(baseNode){if(!baseNode)baseNode=$(document.body);baseNode.select("img[src*='-off.']").each(function(e){e.observe("mouseover",img_onRollOver.bindAsEventListener());e.observe("mouseout",img_onRollOut.bindAsEventListener());new Element("img",{src:e.src.replace("-off","-on")})});var reg=new RegExp("^([A-Za-z0-9]+)://([A-Za-z0-9-.]+)(/.*)?$");baseNode.select("div.mockup.v2 a").each(function(e){var t=reg.exec(e.href);if(!t||e.up("pre")||e.up(".source-code"))return;var n=e.getInnerText();var r;if(t[2]!="wiki.allegro.cc"&&t[2]!=location.host&&e.href.substr(0,n.length)!=n){if(userSettings.external_links=="NEW"){if(t[2]!=location.host){e.target="_blank"}}if(userSettings.show_url_flag){var i=e;while(i.lastChild)i=i.lastChild;if(i&&i.nodeType==3){var s=(new Element("span",{className:"url"})).update(" ["+t[2]+"]");e.parentNode.insertBefore(s,e.nextSibling)}}}else if(r=/\/forums\/thread\/(\d+)\/(\d+)/.exec(e.href)){var o=$("post-"+r[2]);if(o){var u=o.down("a");if(!u.name)u.name="post-"+r[2];e.href="#"+u.name}}});baseNode.select("div.mockup.v2").each(function(e){var t=0;var n=e;while(n&&!n.id)n=n.parentNode;var r=n?n.id:"mockup";var i=e.select("div.ref-block ol")[0];if(!i)return;e.select("span.ref a").each(function(e){e.observe("click",function(t){var n=e.innerHTML-1;var r=i.select("li")[n];if(r.style.backgroundColor=="")flashBg(r,"#ffa");i.up().scrollTo();t.stop()});t++})});baseNode.select("span.remote-thumbnail").each(function(s){s.observe("click",function(event){var me=event.element();if(!me.hasClassName("remote-thumbnail"))me=me.up("span.remote-thumbnail");if(event.ctrlKey){var link=me.up("a");if(link){window.open(link.href,"_blank");event.stop();return false}}var info=me.select("span")[0];var img=me.select("img")[0];var imgLarge=me.select("img")[1];if(!info.hasClassName("json")){info=info.innerHTML.split(";");var matches=/^(.*?)(.thumb)?.(jpg|png|gif)$/.exec(img.src);if(event.shiftKey){window.open(matches[1]+"."+info[0],"thumbnail","width="+(Number(info[1])+32)+",height="+(Number(info[2])+32))}else{if(matches[2]){img.src=matches[1]+"."+info[0];img.width=info[1];img.height=info[2];img.title="Click to go back to thumbnail."}else{img.src=matches[1]+".thumb.jpg";img.width=info[3];img.height=info[4];img.title="Click to enlarge. ("+info[1]+"x"+info[2]+"). Shift-Click for new window."}}}else{var info=eval("("+info.getInnerText()+")");if(event.shiftKey){window.open(info.src,"thumbnail","scrollbars=yes,resizable=yes,width="+(Number(info.w)+40)+",height="+(Number(info.h)+40))}else if(!imgLarge||imgLarge.style.display=="none"){if(!imgLarge){imgLarge=new Element("img");imgLarge.title=img.title;if(info.w<=1024){imgLarge.src=info.src;imgLarge.width=info.w;imgLarge.height=info.h}else{imgLarge.src=info.tn+"-1024.jpg";imgLarge.width="1024";imgLarge.height=parseInt(info.h/(info.w/1024))}img.parentNode.appendChild(imgLarge)}imgLarge.style.display="inline";img.style.display="none"}else{img.style.display="inline";imgLarge.style.display="none"}}event.stop();return false})});baseNode.select("div.spoiler").each(function(e){var t=new Element("div");var n=new Element("input",{type:"button",value:"Reveal Spoiler...",className:"spoiler"});t.appendChild(n);e.parentNode.insertBefore(t,e);n.observe("click",function(t){if(e.style.display!="block"){n.value="Hide Spoiler";e.style.display="block"}else{n.value="Reveal Spoiler...";e.style.display="none"}t.stop();return false})});baseNode.select("div.mockup.v2 div.source-code").each(function(e){if(e.down("div.toolbar")){var t=new CodeBox(e);_codeBoxes.push(t)}});baseNode.select(".media-player").invoke("observe","click",MediaPlayer.onActivate.bindAsEventListener(MediaPlayer));baseNode.select("span.math").each(function(e){var t=e.down();var n=t.innerHTML;e.title=n;e.setStyle({cursor:"pointer"});e.observe("click",function(){prompt("The following code can be used to recreate the formula:","")});t.update("")});var reManual=new RegExp("/manual/([a-zA-Z0-9_]+)$");var funcManualURL=function(e){return"/dhtml/manual-tooltip.rpc/"+reManual.exec(e.href)[1]};var reMember=new RegExp("/members/((id/([0-9]+))|([^/]+)$)");var funcMemberURL=function(e){var t=reMember.exec(e.href);return"/dhtml/member-tooltip.rpc/"+(t[4]?t[4]:t[3])};$$("a").each(function(e){if(reManual.test(e.href))toolTip.add(e,funcManualURL,toolTip.FETCH_RPC);else if(reMember.test(e.href))toolTip.add(e,funcMemberURL,toolTip.FETCH_RPC)})}function foosize(){for(var e=0;e";this.div=new Element("div",{style:"position: absolute; top: 0; left: 0; visibility: hidden;",className:"drop-shadow"});var t=new Element("div",{className:"wrap"});var n=new Element("div",{className:"tool-tip"});n.innerHTML=e;t.appendChild(n);this.div.appendChild(t);document.body.appendChild(this.div);this.X=Number(this.X)+this.xOffset;this.Y=Number(this.Y)+this.yOffset;var r=window.innerWidth;this.div.style.left=r'+''+''+''+''+''+''+"";t.innerHTML=r}else if(t.hasClassName("vimeo")){var i=/vimeo.com\/(\d+)/.exec(n)[1];var s="//www.vimeo.com/"+i+"&hl=en&fs=1&autoplay=1";var o=new Element("object",{width:"480",height:"300"});o.appendChild(new Element("param",{name:"movie",value:"//vimeo.com/moogaloop.swf?clip_id="+i+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=&fullscreen=1&autoplay=0&loop=0"}));o.appendChild(new Element("param",{name:"allowFullScreen",value:"true"}));o.appendChild(new Element("param",{name:"allowscriptaccess",value:"always"}));o.appendChild(new Element("param",{name:"wmode",value:"opaque"}));o.appendChild(new Element("embed",{src:"//vimeo.com/moogaloop.swf?clip_id="+i+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=&fullscreen=1&autoplay=0&loop=0",type:"application/x-shockwave-flash",allowfullscreen:"true",allowscriptaccess:"always",width:"480",height:"300",wmode:"opaque"}));t.innerHTML="";t.appendChild(o)}else if(t.hasClassName("youtube")){var i=/\?v=(.+)/.exec(n)[1];var s="//www.youtube.com/v/"+i+"&hl=en&fs=1&autoplay=1";var o=new Element("object",{width:"480",height:"300"});o.appendChild(new Element("param",{name:"movie",value:s}));o.appendChild(new Element("param",{name:"allowFullScreen",value:"true"}));o.appendChild(new Element("param",{name:"allowscriptaccess",value:"always"}));o.appendChild(new Element("param",{name:"wmode",value:"opaque"}));o.appendChild(new Element("embed",{src:s,type:"application/x-shockwave-flash",allowscriptaccess:"always",allowfullscreen:"true",width:"480",height:"300",wmode:"opaque"}));t.innerHTML="";t.appendChild(o)}e.stop()}};var resizeWait=false;Event.observe(document.onresize?document:window,"resize",function(){if(resizeWait)return;var e;if((e=/MSIE (\d+)/i.exec(navigator.userAgent))&&e[1]<7)return;for(var t=0;t=this.files.length||this.uploading){return false}var e=this.nextUploadIndex;var t=this.files[e];var n=new XMLHttpRequest;if(n.upload)n.upload.onprogress=function(t){var n={id:e,bytesLoaded:t.loaded,bytesTotal:t.total};this.onuploadProgress(n)}.bind(this);n.onload=function(t){this.onuploadCompleteData({id:e,data:n.responseText})}.bind(this);alert(t.file);n.open("POST","/upload.php?UPLOAD_IDENTIFIER="+t.uploadId,true);n.setRequestHeader("X-File-Name",t.file.name||t.file.fileName);n.setRequestHeader("X-File-Size",t.file.size||t.file.fileSize);n.setRequestHeader("X-File-Type",t.file.type);n.send(t.file);alert(this);this.nextUploadIndex++;this.uploading=true;return true},observe:function(e,t){if(!this.observers[e])this.observers[e]=[];this.observers[e].push(t)},notify:function(e,t){if(!this.observers[e])return;this.observers[e].each(function(e){e(t)})},position:function(){},setAllowMultipleFiles:function(){}});Uploader.uploaders=[];Uploader.pending=[];Uploader.eventHandler=function(e,t){var n=Uploader.get(e);if(!n)return;if(n["on"+t.type]){n["on"+t.type](t)}};var m=/Firefox\/(\d+)\.(\d+)/.exec(navigator.userAgent);Uploader.HTML5=m&&parseInt(m[1])*100+parseInt(m[2])>=306;m=null;Uploader.insertHTML=function(e){Uploader.pending.push(e)};Uploader.get=function(e){var t=null;Uploader.uploaders.each(function(n){if(n.id==e){t=n}});return t};document.observe("dom:loaded",function(){if(!document.body)document.body=$$("body")[0];Element.extend(document.body);toolTip.init();attachGlobalEvents();Uploader.pending.each(function(e){var t=$(e.replace("uploader","upload-button"));if(t){Uploader.uploaders.push(new Uploader(e))}})})