/* 
  Business Day Custom extension 
      VERSION: 1.1 for MooTools v1.2dev 
    CHANGELOG: 
      20080111 - Born and added list fader 
      20080313 - Added Advertisement Metadata 
      20080506 - Removed Ad Translation functionality 
      20080506 - Removed Ad Translation functionality for use with new FD.addAd and inline 
                 SITE and AREA properties of baseAd. 
	  20090810 - Added function _initTabs() to enable Common Templates tab boxes 
*/ 
var siteAdvertDesc={redir:"/adredirect.html?ad="};if(window.FD){FD.BusinessDay=new Class({options:{aSHeight:366,duration:250,classCurrent:"current"},initialize:function(){this._initAllSections();this._initFader();this._initTabs();this._initExternalParams()},_initAllSections:function(){var A=$("allSections");var C=$("allSectionsWrap");var B=$("allSectionsContent");if(A&&C&&B){this.options.aSOpenText=A.innerHTML;A.addEvent("click",this.toggleAllSections.create({bind:this,event:true}));C.empty().innerHTML=B.innerHTML
}},getASW:function(){return $("allSectionsWrap")},toggleAllSections:function(B){new Event(B).stop();var A=this.getASW();if(A&&!this.asChanging){if(A.getStyle("height").toInt()==0){this.openAllSections(A)}else{this.closeAllSections(A)}}},openAllSections:function(B){this.asChanging=true;B.setStyle("border-width","1px 1px 1px 1px");var A=new Fx.Style(B,"height",$extend(this.options,{onComplete:this.allSectionsComplete.bind(this)}));A.start(0,this.options.aSHeight)},closeAllSections:function(B){this.asChanging=true;
var A=new Fx.Style(B,"height",$extend(this.options,{onComplete:this.allSectionsComplete.bind(this,B)}));A.start(this.options.aSHeight,0)},allSectionsComplete:function(A){if(A){this.asChanging=false;var B=A.innerHTML;if(A.getStyle("height").toInt()!=this.options.aSHeight){A.empty().innerHTML=B.replace(/Hide/ig,"Show");A.setStyle("border-width","1px 0 0 0")}else{A.empty().innerHTML=B.replace(/Show/ig,"Hide")}}},_initFader:function(){this.sliderPos=0;var A=$("woffRotator_parent");if(A){this.slCount=A.getElements("li").length;
this.addSliderTimeout();A.addEvent("mouseover",function(){$clear(this.sliderTimeout)}.bind(this));A.addEvent("mouseleave",this.addSliderTimeout.bind(this));A.getElements("a.fdScrollPrevItem").addEvent("click",this._moveSlider.bind(this,-1));A.getElements("a.fdScrollNextItem").addEvent("click",this._moveSlider.bind(this,1))}},_moveSlider:function(A){if(!this.sliding&A){this.sliding=true;var B=new Fx.Style($("woffRotator_holder"),"opacity",$merge(this.options,{duration:550,onComplete:this._moveSliderComplete.bind(this,A)})).start(0)
}},_moveSliderComplete:function(B){var C=this.sliderPos+B;var F=0;var E=$("woffRotator");var A=E.getElements("li");A[this.sliderPos].removeClass(this.options.classCurrent);if(C==this.slCount){C=0}else{if(C<0){C=this.slCount-1}}this.sliderPos=C;A[this.sliderPos].addClass(this.options.classCurrent);var D=new Fx.Style($("woffRotator_holder"),"opacity",$merge(this.options,{duration:450,onComplete:this._setFadeComplete.bind(this)})).start(1)},_setFadeComplete:function(){this.sliding=false},addSliderTimeout:function(){this.sliderTimeout=this._moveSlider.periodical(7000,this,1)
},_initTabs:function(){var C=$$("a.cN-externalTarget");for(var B=0;B<C.length;++B){C[B].addEvent("click",this._sendTracking.create({bind:this,event:true}))}var A=$$("ul.cN-tabBox");this.tabIDs=[];if(A){for(var B=0,D=A.length;B<D;B++){A[B].addEvent("click",this._swapTab.create({bind:this,event:true,arguments:A[B].id}));this.tabIDs.push(A[B].id);A[B].removeClass("accessibleTab")}}},_swapTab:function(C,D){if(C&&C.target&&$(D)){var A=$(C.target);if(A.href&&A.href.test("#$")){new Event(C).stop()}if(!A.href){A=A.getFirst()
}if(!A||A.getParent().tagName!="H4"){return }var B=$(D).getChildren().removeClass("selected");A.getParent().getParent().addClass("selected")}},_sendTracking:function(D){if(D&&D.target){var A=$(D.target);var C=new Element("img");var B=A.href;B=B.replace("#","");C.src=this._paramsForExterntracking(B)}},_paramsForExterntracking:function(B,D,C){if(FD.specificCTyle){if(D&&D==true){B+="?pageType="+FD.specificCTyle}else{B+="&pageType="+FD.specificCTyle}}if(FD.specificArea){B+="&section="+FD.specificArea
}if(C&&C==true){}else{var A=Math.floor(Math.random()*10000);B+="&rand="+A}return B},_initExternalParams:function(){var C=$$("a.applyParamsForExternal");if(C){for(var B=0;B<C.length;++B){if(C[B].href.contains("#")){var A=new Array();A=C[B].href.split("#");C[B].href=A[1]}C[B].href=this._paramsForExterntracking(C[B].href);C[B].href=C[B].href.clean()}}var C=$$("a.applyFirstParamsForExternalNoRand");if(C){for(var B=0;B<C.length;++B){C[B].href=this._paramsForExterntracking(C[B].href,true,true);C[B].href=C[B].href.clean()
}}}});var businessday;function initBusinessDay(){businessday=new FD.BusinessDay()}window.addEvent("initBusinessDay",initBusinessDay);FD.register("BusinessDay",1)};