var stfWrapper=false;var stfDiv=false;var linkDiv=false;if(top.location!=location){top.location.href=document.location.href;}var speechBubble=new Element("img",{src:"/images/speech-bubble.png",width:15,height:19});speechBubble.setStyle("position","relative");var boxPath="/boxes";Element.implement({roundCorners:function(){if(!Browser.Engine.trident){return ;}fn=this.hasClass("stroked")?"stroke-4e4e4e":"round";bg=this.hasClass("bg-black")?"000000":"161616";fg=this.hasClass("fg-grey")?"333333":"000000";x=this.getSize().x;y=this.getSize().y;this.setStyle("background-color",fg);borders=0;if(this.hasClass("top-left")){borders+=2;}if(this.hasClass("top-right")){borders+=4;}if(this.hasClass("bottom-left")){borders+=8;}if(this.hasClass("bottom-right")){borders+=16;}if(this.hasClass("top")){borders=6;}if(this.hasClass("bottom")){borders=24;}if(this.hasClass("right")){borders=20;}if(this.hasClass("left")){borders=10;}if(this.hasClass("all")||borders===0){borders=30;}path=boxPath+"/bg"+bg+"/"+fg+"/"+x+"x"+y+"/"+borders+"/"+fn+".png";this.setStyle("background-image","url("+path+")");var A=this;(function(){A.setStyle("background-color","transparent");}).delay(500);}});Element.implement({addSpeechBubble:function(){myBubble=speechBubble.clone();myBubble.setStyle("left",this.getSize().x*0.8);myBubble.setStyle("top",0-this.getStyle("margin-bottom").toInt());myBubble.inject(this,"after");}});Element.implement({attachJumpEvent:function(){this.addEvent("click",function(A){A.preventDefault();target=this.get("href");scroller=new Fx.Scroll(window);scroller.toElement(document.getElement(target));});}});var shareLinks=function(){uri=encodeURIComponent(location.href);title=encodeURIComponent(document.title);$$("#delicious, li.delicious a").addEvent("click",function(A){A.preventDefault();window.open(this.get("href"),"delicious","toolbar=no,width=550,height=550");});$$("#facebook, li.facebook a").addEvent("click",function(A){A.preventDefault();window.open(this.get("href"),"facebook","toolbar=0,width=626,height=436");});$$("#digg, li.digg a").addEvent("click",function(A){A.preventDefault();window.open(this.get("href"),"digg","toolbar=0,width=626,height=436");});$$("#stumbleupon, li.stumbleupon a").addEvent("click",function(A){A.preventDefault();window.open(this.get("href"),"stumbleupon","toolbar=0,scrollbars=1,width=626,height=436");});};var makeSpeechBubbles=function(){$$(".bubble").each(function(A){A.addSpeechBubble();});};var createPlayer=function(D,B,C,A){if(!C){C=480;}if(!A){A=270;}chunks=D.split("||");if(chunks[1]){im=chunks[1];im=im.replace("/wp-content/","/"+C+"x"+A+"/wp-content/");}else{im="/images/player-splash.png";}div=new Element("div","player-container");div.setStyle("clear","both");div.setStyle("width",C);div.setStyle("height",A);div.addClass("video-player-container");div.replaces(B);player=new Swiff("/videoplayer.swf",{width:C,height:A,vars:{clip:chunks[0],image:im?im:null},params:{wmode:"transparent",allowFullScreen:true}});div.adopt(player);};var buildGallery=function(){$$(".gallery-icon a").each(function(A){A.addEvent("click",function(B){B.preventDefault();image=this.getParent("div.gallery").getElement(".attachment-medium");if(!image){image=this.getParent("div.gallery").getElement(".attachment-large");}if(!image){return false;}image.src=this.get("rel");});});};Element.implement({submitButton:function(){this.addClass("submit-button");if(Browser.Engine.trident){this.addClass("rounded");this.addClass("fg-grey");this.addClass("bg-black");this.roundCorners();}return ;}});String.implement({getHostname:function(){var A=new RegExp("^(?:f|ht)tp(?:s)?://([^/]+)","im");return this.match(A)?this.match(A)[1]:false;}});var requiredField=function(){$$("span.required, dt.required span").each(function(A){A.set("html","*");});};var drawOverlay=function(){if(stfWrapper){stfWrapper.fade("hide");}if($("container").getSize().y>document.getElement("body").getSize().y){height=$("container").getSize().y;}else{height=document.getElement("body").getSize().y;}stfWrapper.setStyle("height",height);stfWrapper.set("id","stf-wrapper-active");stfWrapper.set("opacity",0.5);};var killOverlay=function(){stfWrapper.set("id","stf-wrapper");stfWrapper.setStyle("height",0);};var killLinkLightbox=function(){killOverlay();linkDiv.set("id","external-link");linkDiv.set("html","");};var triggerLinkLightbox=function(A){drawOverlay();linkDiv.fade("hide");linkDiv.grab(new Element("p",{html:"You're about to leave the Red Bull Reporter website and launch:"}));linkDiv.grab(new Element("p",{html:"<strong>"+A.get("href")+"</strong>",styles:{"text-align":"center"}}));linkDiv.grab(new Element("p",{html:"Please choose whether you'd like to launch the new website in this window or a new one:"}));p=new Element("p",{styles:{"text-align":"center"}});sameWindow=new Element("a",{html:"Use this window",href:A.get("href"),"class":"button"});sameWindow.addEvent("click",function(){Cookie.write("links","same",{domain:document.domain,path:"/"});killLinkLightbox();});newWindow=new Element("a",{html:"Open a new window",href:A.get("href"),target:"_blank","class":"button"});newWindow.addEvent("click",function(){Cookie.write("links","new",{domain:document.domain,path:"/"});killLinkLightbox();});p.grab(sameWindow);p.appendText(" / ");p.grab(newWindow);linkDiv.grab(p);linkDiv.set("id","external-link-active");linkDiv.fade("show");linkDiv.setStyle("top",window.getScroll().y+(window.getSize().y/2)-100);stfWrapper.addEvent("click",function(){killLinkLightbox();});};var initExternalLinks=function(){oBody=window.document.body;linkDiv=new Element("div",{id:"external-link"});oBody.grab(linkDiv,"bottom");$$("a").each(function(A){if($defined(A.get("href"))&&A.get("href").getHostname()&&A.get("href").getHostname()!==document.domain&&!A.getParent("div#share")&&!A.getParent(".share")){A.addEvent("click",function(B){if(Cookie.read("links")=="new"){A.set("target","_blank");}else{if(Cookie.read("links")=="same"){return true;}else{B.preventDefault();triggerLinkLightbox(A);}}});}});};window.addEvents({domready:function(){stfWrapper=new Element("div",{id:"stf-wrapper"});oBody=document.getElement("body");oBody.grab(stfWrapper,"bottom");stfDiv=new Element("div",{id:"stf"});oBody.grab(stfDiv,"bottom");shareLinks();initExternalLinks();$$("a#to-top, a.jumper").each(function(A){A.attachJumpEvent();});},finished:function(){$$(".rounded, .stroked").each(function(A){A.roundCorners();});makeSpeechBubbles();}});var k=0;var l=0;document.addEvent("keyup",function(A){if((A.key=="up"&&k==0)||(A.key=="up"&&k==1&&l=="up")||(A.key=="down"&&k==2&&l=="up")||(A.key=="down"&&k==3&&l=="down")||(A.key=="left"&&k==4&&l=="down")||(A.key=="right"&&k==5&&l=="left")||(A.key=="left"&&k==6&&l=="right")||(A.key=="right"&&k==7&&l=="left")||(A.key=="b"&&k==8&&l=="right")||(A.key=="a"&&k==9&&l=="b")||(A.key=="enter"&&k==10&&l=="a")){k++;l=A.key;}else{l=0;k=0;}if(k==10){document.getElement("body").setStyles({"background-image":"url(/images/hamster.gif)","background-color":"#FFF","background-repeat":"repeat"});$("container").setStyle("background-image","none");}});