var ATBCore={init:function(){PreloadImages.init();HoverSwitch.init();DropdownNav.init();CommentAlert.init();LinkAroundSummaryImage.init()}};Event.observe(window,"load",ATBCore.init);var PreloadImages={init:function(){if(document.images){var G=new Array();var F=new Array();var C=["2.0/images/BlueButtonBlockON166x52.png"];var E=$$("img.hoverSwitch");if(E.length!=0){for(var D=0;D<E.length;D++){F[F.length]=E[D].src;C[C.length]=F[D].replace("Off","ON")}}var B=new Array();for(var A=0;A<C.length;A++){B[A]=document.createElement("img");B[A].setAttribute("src",C[A])}}}};var NavBackgroundSwitch={init:function(){if($$("li.button")){var B=$$("li.button");for(var A=0;A<B.length;A++){Event.observe(B[A],"mouseover",function(C){this.addClassName("hover")});Event.observe(B[A],"mouseout",function(C){this.removeClassName("hover")})}}}};var HoverSwitch={init:function(){if($$("img.hoverSwitch")[0]){var B=$$("img.hoverSwitch");for(var A=0;A<B.length;A++){Event.observe(B[A],"mouseover",HoverSwitch.swapImageOn.bindAsEventListener(B[A]));Event.observe(B[A],"mouseout",HoverSwitch.swapImageOff.bindAsEventListener(B[A]))}}},swapImageOn:function(){var B=this.src;var A=B.replace("Off","ON");this.src=A},swapImageOff:function(){var B=this.src;var A=B.replace("ON","Off");this.src=A}};var DropdownNav={init:function(){if($$("li.button")){var A=$$("li.button");for(var B=0;B<A.length;B++){Event.observe(A[B],"mouseover",DropdownNav.showBox);Event.observe(A[B],"mouseout",DropdownNav.hideBox)}}},showBox:function(){if(this.select("div")[0]){clearTimeout(this._timer);this.addClassName("hover");var A=this.select("div")[0];A.removeClassName("hiddenList")}},hideBox:function(){if(this.select("div")[0]){var A=this;A._timer=setTimeout(function(){A.removeClassName("hover");var B=A.select("div")[0];B.addClassName("hiddenList")},10)}}};var submitRolls=new Object();function submitroll(C,B,A){this.src=C;this.oversrc=B;this.name=A;this.alt="Search";this.write=submitroll_write}function submitroll_write(){var A="document.forms["+(document.forms.length-1)+"]";submitRolls[this.name]=new Object();submitRolls[this.name].over=new Image();submitRolls[this.name].over.src=this.oversrc;submitRolls[this.name].out=new Image();submitRolls[this.name].out.src=this.src;document.write("<A onMouseOver=\"if (document.images)document.images['"+this.name+"'].src=submitRolls['"+this.name+"'].over.src\" onMouseOut=\"if (document.images)document.images['"+this.name+"'].src=submitRolls['"+this.name+'\'].out.src" HREF="javascript:');if(this.sendfield){if(!this.sendvalue){this.sendvalue=1}document.write(A,".elements['",this.sendfield,"'].value='",this.sendvalue,"';")}document.write(A+'.submit();void(0);"');if(this.msg){document.write(" onClick=\"return confirm('",this.msg,"')\"")}document.write(">");document.write('<IMG SRC="'+this.src+'" ALT="'+this.alt+'" BORDER=0 NAME="'+this.name+'"');if(this.height){document.write(" HEIGHT="+this.height)}if(this.width){document.write(" WIDTH="+this.width)}if(this.otheratts){document.write(" "+this.otheratts)}document.write("></A>");if(this.sendfield){document.write('<INPUT TYPE=HIDDEN NAME="'+this.sendfield+'">');document.forms[document.forms.length-1].elements[this.sendfield].value=""}}var CommentAlert={init:function(){LightBox.init()}};var LinkAroundSummaryImage={init:function(){if($("catArticleList")){var A="catArticleList";LinkAroundSummaryImage.makeLink(A)}else{if($("homeFeatures")){var A="homeFeatures";LinkAroundSummaryImage.makeLink(A)}}},makeLink:function(H){var G=$(H).select("li");var C="";var B="";var A="";var F="";var E="";for(var D=0;D<G.length;D++){if(G[D].select("img.summaryImage")[0]){C=G[D].select("a.titleLink")[0].getAttribute("href");B=G[D].select("img.summaryImage")[0].remove();F=G[D].select("p")[0];A=document.createElement("a");A.setAttribute("href",C);A.appendChild(B);F.insert({before:A})}}}};var LightBox={counter:0,init:function(){if(document.getElementsByClassName("lightBox")){var B=document.getElementsByClassName("lightBox");for(var A=0;A<B.length;A++){Event.observe(B[A],"click",LightBox.animate.bindAsEventListener(B[A]))}}},animate:function(H){LightBox.counter++;var B=Cookies.readCookie("commentAlert");if(B!="off"&&LightBox.counter<=1){var J=$w(this.className)[0];var K=J+1;var C=$(K);var I=C.innerHTML;var D=$("box");D.innerHTML=I;var G=$("nameInput").cumulativeOffset();var F=G[1]+20;D.setStyle({top:F+"px"});new Effect.Appear("screen",{duration:0.5,from:0,to:0.7});new Effect.Appear("box",{duration:0.5,from:0,to:1});var A=$("dontShow");var E=$("box").select("div.clickClose")[0];Event.observe(E,"click",function(L){if(A.checked){Cookies.createCookie("commentAlert","off",300)}new Effect.Fade("box",{duration:0.5,from:1,to:0});new Effect.Fade("screen",{duration:0.5,from:0.7,to:0});Event.stop(L)},false)}}};var Cookies={createCookie:function(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"},readCookie:function(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null},eraseCookie:function(A){Cookies.createCookie(A,"",-1)}};var RotateNewsletter={init:function(){if($("newsletterFrame")){var B=["http://www.askthebuilder.com/newsletterForms/NewsletterHardCode1.html","http://www.askthebuilder.com/newsletterForms/NewsletterHardCode2.html","http://www.askthebuilder.com/newsletterForms/NewsletterHardCode3.html","http://www.askthebuilder.com/newsletterForms/NewsletterHardCode4.html","http://www.askthebuilder.com/newsletterForms/NewsletterHardCode5.html"];var A=Math.floor(Math.random()*4);$("newsletterFrame").setAttribute("src",B[A])}}};