
   if(!dbugScripts("cbsnews",["cbsnews.a2.frontdoor.js"])) {
   /*	cbsnews.a2.frontdoor.js - packed	*/
       var CBSCarousel=new Class({Implements:[Options,Events],options:{slide$$:"li.carouselSlide",slideInterval:6000,transitionDuration:"short",startIndex:0,indicatorActiveClass:"selected",indicatorInactiveClass:"off",indicatorDisplayStart:0,rotateAction:"mouseenter",rotateActionDuration:100,autoplay:true,useIndicators:true,indicatorContainerClass:"indicators",indicator$$:null,nextButtonClass:"carouselNext",prevButtonClass:"carouselPrev",pauseOnHover:true,pauseOnBlur:true},initialize:function(A,B){A=$(A);if(A.retrieve("carousel")){return false;}this.container=A;this.container.store("carousel",this);this.setOptions(B);this.slides=this.setSlides();if(this.options.useIndicators&&this.slides.length>1){this.setIndicators();}this.showSlide(this.options.startIndex);this.setButtons();if(this.options.pauseOnHover&&this.options.autoplay){this.setHoverPausing();}if(this.options.pauseOnBlur&&this.options.autoplay){this.setWindowPausing();}if(this.options.autoplay){this.autoplay();}this.fireEvent("onInitialize");return this;},setHoverPausing:function(){this.setBindings();this.container.addEvents({mouseenter:this.bound.stop,mouseleave:this.bound.autoplay});this.addEvent("onActiveSelect",this.bound.clearPausing);},setWindowPausing:function(){if(!this.bound){this.setBindings();}window.addEvents({blur:this.bound.stop,focus:this.bound.autoplay});},clearPausing:function(){this.container.removeEvent("mouseenter",this.bound.stop);this.container.removeEvent("mouseleave",this.bound.autoplay);window.removeEvent("blur",this.bound.stop);window.removeEvent("focus",this.bound.autoplay);this.removeEvent("onActiveSelect",this.bound.clearPausing);},setBindings:function(){this.bound={autoplay:this.autoplay.bind(this),stop:this.stop.bind(this),clearPausing:this.clearPausing.bind(this)};},setSlides:function(){slides=this.container.getElements(this.options.slide$$);slides.each(function(A,B){A.set("tween",{duration:this.options.transitionDuration,onStart:function(){if(A.getStyle("opacity")<0.1){A.setStyle("display","block");}},onComplete:function(){if(A.getStyle("opacity")<1){A.setStyle("display","none");}}});A.setStyles({display:(B==this.options.startIndex)?"block":"none",opacity:(B==this.options.startIndex)?1:0});}.bind(this));return slides;},setIndicators:function(){this.indicators=(this.options.indicator$$)?this.container.getElements(this.options.indicator$$):this.createIndicators();this.indicators.each(function(A,B){A.addEvent(this.options.rotateAction,this.activeSelect.bind(this,B));},this);},createIndicators:function(){var C=this.options,A=new Element("ul",{"class":C.indicatorContainerClass}).inject(this.container);var D=[];for(var B=0;B<this.slides.length;B++){D.push(new Element("li",{text:B+(C.indicatorDisplayStart||0)}).inject(A));}return D;},setButtons:function(){this.container.getElements("."+this.options.nextButtonClass).removeProperties("onclick","href").addEvent("click",this.activeSelect.bind(this,"next"));this.container.getElements("."+this.options.prevButtonClass).removeProperties("onclick","href").addEvent("click",this.activeSelect.bind(this,"prev"));},activeSelect:function(A){if($type(A)!="number"){A=this.getToIndex(A);}if(this.slideshowInt){this.stop();}this.showSlide(A);this.fireEvent("onActiveSelect");},getToIndex:function(A){if(A=="next"){return(this.currentIndex==this.slides.length-1)?0:this.currentIndex+1;}return((this.currentIndex==0)?this.slides.length:this.currentIndex)-1;},showSlide:function(A){if(A==this.currentIndex){return this;}$each(this.slides,function(B,C){if(C==A){if(this.options.useIndicators&&this.slides.length>1){this.indicators[C].swapClass(this.options.indicatorInactiveClass,this.options.indicatorActiveClass);}B.fade("in");}else{if(this.options.useIndicators&&this.slides.length>1){this.indicators[C].swapClass(this.options.indicatorActiveClass,this.options.indicatorInactiveClass);}B.fade("out");}}.bind(this));this.fireEvent("onShowSlide",[A,this.currentIndex]);this.currentIndex=A;return this;},autoplay:function(){if(this.slideshowInt){return this;}this.slideshowInt=this.rotate.periodical(this.options.slideInterval,this);this.fireEvent("onAutoPlay");return this;},stop:function(){this.slideshowInt=$clear(this.slideshowInt);this.fireEvent("onStop");return this;},rotate:function(){var B=this.currentIndex;var A=(B+1>=this.slides.length)?0:B+1;this.showSlide(A);this.fireEvent("onRotate",[A,B]);return this;},toElement:function(){return this.container;}});var ThumbScroller=new Class({Extends:Fx.Scroll,scrollOptions:{thumbs:".box",axis:"x",thumbContainer:null,nav:{},startIndex:0,tolerance:0},initialize:function(A,B){if(typeof (A)=="string"){if($(A).retrieve("thumbscroller")){return false;}}else{if(A.retrieve("thumbscroller")){return false;}}this.parent(A,$merge(this.scrollOptions,B));this.element.store("thumbscroller",this);this.element.setStyle("overflow","hidden");this.computeDimensions();this.initNav();this.toIndex(this.options.startIndex);this.lastScroll=null;this.fireEvent("onInitialize");return this;},computeDimensions:function(){this.thumbs=this.element.getElements(this.options.thumbs);this.setParentSize();this.positions=this.getLocations();return this;},isAtEnd:function(A){A=A||this.getRange();var B=A[A.length-1];return(B.index==this.thumbs.length-1&&(B.type!="partial"||B.tolerated));},isAtStart:function(A){A=A||this.getRange();var B=A[0];return(B.index==0&&(B.type!="partial"||B.tolerated));},getLocations:function(){return this.thumbs.map(function(B){var C=B.getComputedSize()[this.getDir("total")];var A=B.getPosition(B.getParent())[this.getDir("xy")];return{size:C,start:A,end:C+A};},this);},initNav:function(){try{if(typeof (this.options.nav.next)=="string"){$$(this.options.nav.next).addEvent("click",this.toNextScreen.bind(this));}else{if(this.options.nav.next instanceof Array){this.options.nav.next[0].addEvent("click",this.toNextScreen.bind(this));}else{this.options.nav.next.addEvent("click",this.toNextScreen.bind(this));}}if(typeof (this.options.nav.previous)=="string"){$$(this.options.nav.previous).addEvent("click",this.toPreviousScreen.bind(this));}else{if(this.options.nav.previous instanceof Array){this.options.nav.previous[0].addEvent("click",this.toPreviousScreen.bind(this));}else{this.options.nav.previous.addEvent("click",this.toPreviousScreen.bind(this));}}if(typeof (this.options.nav.start)=="string"){$$(this.options.nav.start).addEvent("click",this.toStart.bind(this));}else{if(this.options.nav.start instanceof Array){this.options.nav.start[0].addEvent("click",this.toStart.bind(this));}else{this.options.nav.start.addEvent("click",this.toStart.bind(this));}}if(typeof (this.options.nav.end)=="string"){$$(this.options.nav.end).addEvent("click",this.toEnd.bind(this));}else{if(this.options.nav.end instanceof Array){this.options.nav.end[0].addEvent("click",this.toEnd.bind(this));}else{this.options.nav.end.addEvent("click",this.toEnd.bind(this));}}}catch(A){}},getDir:function(A){switch(A){case"total":if(this.options.axis=="y"){return"totalHeight";}return"totalWidth";case"dir":if(this.options.axis=="y"){return"height";}return"width";case"xy":default:if(this.options.axis=="y"){return"y";}return"x";}},getStart:function(A){if(this.options.axis=="y"){return[0,A];}return[A,0];},getStartPx:function(A){if(!A){return 0;}return this.positions[A].start-(this.positions[A].start-this.positions[A-1].end);},setParentSize:function(){var A=(this.options.thumbContainer)?this.element.getElement(this.options.thumbContainer):this.element.getElement(this.options.thumbs).getParent();var B=0;$each(this.thumbs,function(C){B+=C.getComputedSize({styles:["padding","border","margin"]})[this.getDir("total")];},this);A.setStyle(this.getDir("dir"),B);},getRange:function(E){if(isNaN(E)){E=this.element.getScroll()[this.getDir("xy")];}var D=this.element.getComputedSize({styles:["padding"]})[this.getDir("total")];var C=[];for(var A=0;A<this.positions.length;A++){var B=this.withinRange(this.positions[A],E,E+D);if(B){C.push($merge(B,{index:A}));if(B.where=="end"){break;}}}return C;},withinRange:function(C,B,A){if(C.end>B&&C.end<=A){if(C.start>=B){return{type:"full"};}else{return{type:"partial",where:"start",tolerated:((B-C.start)<=this.options.tolerance)};}}else{if(C.start>=B&&C.start<A){return{type:"partial",where:"end",tolerated:((C.start-A)<this.options.tolerance)};}else{if(C.start<B&&C.end>A){return{type:"full"};}}}return false;},toNextScreen:function(){var A=this.getRange();if(A.getLast().type=="partial"&&!A.getLast().tolerated&&A.length>1){this.start.run(this.getStart(this.getStartPx(A.getLast().index)),this);}else{if($(this.thumbs[A.getLast().index+1])){this.start.run(this.getStart(this.getStartPx(A.getLast().index+1)),this);}else{this.toEnd();}}this.lastScroll="next";},toPreviousScreen:function(){var A=this.getRange();var C=(A[0].type=="partial"&&!A[0].tolerated&&A.length>1)?A[0].index:A[0].index-1;if(!this.positions[C]){this.toStart();return ;}var B=this.positions[C].end-this.element.getComputedSize({styles:["padding"]})[this.getDir("total")];var E=this.getRange(B);var D=(E[0].type=="partial"&&E.length>1)?E[0].index+1:E[0].index;this.start.run(this.getStart(this.getStartPx(D)),this);this.lastScroll="previous";},toIndex:function(A){this.start.run(this.getStart(this.getStartPx(parseInt(A))),this);},toStart:function(){if(this.options.axis=="y"){this.toTop();}else{this.toLeft();}},toEnd:function(){if(this.options.axis=="y"){this.toBottom();}else{this.toRight();}}});var CBSThumbScroller=new Class({Extends:ThumbScroller,cbsOptions:{thumbs:"li.promoBox",nav:{next:".arrowRight",previous:".arrowLeft"},setArrowClasses:false,onInitialize:function(){this.addEvent("onStart",this.startEvent);},onComplete:function(){var B=this.getRange(),A;this.setArrows.run([B],this);if(!this.imagesLoaded){A=B.map(function(C){return this.thumbs[C.index];},this);this.loadImages.run(A);}}},initialize:function(C,A){this.outerShell=$(C);var B=$merge(this.cbsOptions,A);if(B.nav){$each(B.nav,function(F,E,D){D[E]=this.outerShell.getElements(F);}.bind(this));}this.parent(this.outerShell.getElement(".scrollShell"),B);},loadImages:function(){$A(arguments).each(function(A){var C=A.getElement(".assetThumb img");var B=(C)?C.getProperty("loadsrc"):null;if(C&&B){if(C.getProperty("src")!=B){C.setProperty("src",B);}}});},setArrows:function(A){if(this.options.setArrowClasses){if(this.isAtStart(A)){$$(this.options.nav.previous).removeClass("arrowsOn").addClass("arrowsOff");}else{$$(this.options.nav.previous).removeClass("arrowsOff").addClass("arrowsOn");}if(this.isAtEnd(A)){$$(this.options.nav.next).removeClass("arrowsOn").addClass("arrowsOff");}else{$$(this.options.nav.next).removeClass("arrowsOff").addClass("arrowsOn");}}else{$$(this.options.nav.previous).morph({opacity:(this.isAtStart(A))?0.3:1});$$(this.options.nav.next).morph({opacity:(this.isAtEnd(A))?0.3:1});}},startEvent:function(){this.loadImages.run(this.thumbs);this.imagesLoaded=true;this.removeEvent("onStart",this.startEvent);},initNav:function(){this.parent();$$(this.options.nav.next,this.options.nav.previous).set("morph",{duration:"short"});}});Element.implement("cbsNodeIndex",function(){var A=0;elem=this;while(elem.previousSibling){if(elem.previousSibling.nodeName=="#text"){elem=elem.previousSibling;}else{A++;elem=elem.previousSibling;}}return A;});var SixtyMinsCarousel=new Class({initialize:function(){dbug.log("SixtyMinsCarousel");return new CBSCarousel("cbsCarousel",{indicator$$:"li.carouselListItem"});}});var CrimeSiderCarousel=new Class({initialize:function(){return new CBSCarousel("cbsCarousel",{indicator$$:"li.carouselListItem"});}});var CBSDoorCarousel=new Class({initialize:function(){var A=new CBSCarousel("cbsCarousel",{indicatorActiveClass:"active",rotateAction:"click",slideInterval:8000});new Jlogger({tag:"carousel",ctype:"button",cval:"prev",element:$$("#cbsCarousel .carouselPrev")[0],event:"click"});new Jlogger({tag:"carousel",ctype:"button",cval:"next",element:$$("#cbsCarousel .carouselNext")[0],event:"click"});$$("#cbsCarousel .carouselLink, #cbsCarousel .carouselCaption a").addEvent("click",function(){new Jlogger({tag:"carousel",ctype:"action;pane",cval:"click;"+($("cbsCarousel").retrieve("carousel").currentIndex+1)}).ping();});return A;}});var cbsCarouselGallery=new Class({initialize:function(){var A=new CBSCarousel("cbsCarouselGallery",{indicatorActiveClass:"active",rotateAction:"click",indicatorDisplayStart:1,slideInterval:6000,onInitialize:function(){this.myindicate=this.indicators[0].getParent("ul");this.myindicate.inject(this.slides[0].getElement(".num_display"));},onRotate:function(B){this.myindicate.inject(this.slides[B].getElement(".num_display"));},onActiveSelect:function(){this.myindicate.inject(this.slides[this.currentIndex].getElement(".num_display"));}});new Jlogger({tag:"carousel",ctype:"button",cval:"prev",element:$$("#cbsCarouselGallery .carouselPrev")[0],event:"click"});new Jlogger({tag:"carousel",ctype:"button",cval:"next",element:$$("#cbsCarouselGallery .carouselNext")[0],event:"click"});$$("#cbsCarouselGallery .carouselLink, #cbsCarouselGallery .carouselCaption a").addEvent("click",function(){new Jlogger({tag:"carousel",ctype:"action;pane",cval:"click;"+($("cbsCarouselGallery").retrieve("carousel").currentIndex+1)}).ping();});return A;}});var CBSDoorCarouselMoreNews=new Class({initialize:function(){var A=new CBSCarousel("cbsCarouselMoreNews",{indicatorActiveClass:"active",rotateAction:"click",autoplay:false});$$("#cbsCarouselMoreNews .carouselLink, #cbsCarouselMoreNews .carouselCaption a").addEvent("click",function(){new Jlogger({tag:"carousel",ctype:"action;pane",cval:"click;"+($("cbsCarouselMoreNews").retrieve("carousel").currentIndex+1)}).ping();});return A;}});var CBSDoorCarouselVideoFD=new Class({initialize:function(){var A=new CBSCarousel("cbsCarouselVideoFD",{indicatorActiveClass:"active",rotateAction:"click",autoplay:false});$$("#cbsCarouselVideoFD .carouselLink, #cbsCarouselVideoFD .carouselCaption a").addEvent("click",function(){new Jlogger({tag:"carousel",ctype:"action;pane",cval:"click;"+($("cbsCarouselVideoFD").retrieve("carousel").currentIndex+1)}).ping();});return A;}});var CBSDoorCarouselPhotoFD=new Class({initialize:function(){var A=new CBSCarousel("cbsCarouselPhotoFD",{indicatorActiveClass:"active",rotateAction:"click",autoplay:false});$$("#cbsCarouselPhotoFD .carouselLink, #cbsCarouselPhotoFD .carouselCaption a").addEvent("click",function(){new Jlogger({tag:"carousel",ctype:"action;pane",cval:"click;"+($("cbsCarouselPhotoFD").retrieve("carousel").currentIndex+1)}).ping();});return A;}});var fdInnerGalleryCarousel=new Class({initialize:function(){$("cbsCarouselPhotoFD").getElements(".cbsCarouselPhotoInner").each(function(A){return new CBSCarousel(A,{indicator$$:"li.carouselListItem",slide$$:"li.carouselSlideInner",autoplay:false});});}});var fdInnerPhotoGallery=new Class({initialize:function(){$("cbsPhotoGalleryFD").getElements(".cbsPhotoGalleryInner").each(function(A){return new CBSCarousel(A,{indicator$$:"li.carouselListItem",slide$$:"li.carouselSlideInner",autoplay:false});});}});window.addEvent("domready",function(){if($("webmdDoorModule")){new Jlogger({tag:"webmd",ctype:"module_impression",cval:"module_a",element:$("webmdDoorModule").getElement(".doorsWebMDPromo")}).ping();$$("#webmdDoorModule .doorsWebMDPromo .webmdDoor .webmdFeed1 a").addEvent("click",function(){new Jlogger({tag:"webmd",ctype:"module_a",cval:"module_click:quiz"}).ping();});$$("#webmdDoorModule .doorsWebMDPromo .webmdDoor .webmdFeed2 a").addEvent("click",function(){new Jlogger({tag:"webmd",ctype:"module_a",cval:"module_click;drugdatabase"}).ping();});$$("#webmdDoorModule .doorsWebMDPromo .webmdDoorRight a").addEvent("click",function(){new Jlogger({tag:"webmd",ctype:"module_a",cval:"module_click;drugdatabaseImage"}).ping();});}$$(".sideScroller").each(function(A){if(!A.retrieve("thumbscroller")&&!A.retrieve("carousel")){new CBSThumbScroller(A);var B=A.get("id");if(!B){if(A.get("class").indexOf("storyScroller")!=-1){B="storyScroller";}else{if(A.getElements(".sideScrollerTitle span").get("text")=="Latest Video"){B="videoScroller";}else{return ;}}}new Jlogger({tag:B,ctype:"button",cval:"prev",element:$ES(".arrowLeft",A)[0],event:"click"});new Jlogger({tag:B,ctype:"button",cval:"next",element:$ES(".arrowRight",A)[0],event:"click"});$ES("a",A).each(function(D){if(D.getParent(".promoBox")){var C=D.getParent(".promoBox").cbsNodeIndex()+1;if(B=="videoScroller"){C=Math.ceil(C/3);}new Jlogger({tag:B,ctype:"action;pane",cval:"click;"+C,element:D,event:"click"});}});}});if(PageVars.get("channelId")=="505263"){$("twitterModuleCBSThisMorning").addEvent("click",function(B){var A=$(B.target);if(A.get("tag")!="a"){A=A.getParent("a");}if(A&&A.getProperty("href")){A.set("target","new");}});}if($("healthCenterLeadID")){if($("videoLargeID")){$$(".playStoryVid").addEvent("click",function(C){var A=new Element("div",{id:"flashvideocontent"});var B=$("videoLargeID").get("videoid");A.injectAfter($("videoLargeID"));$$(".playStoryVid").dispose();$("topMPU").empty();CBSVideo.setNewData({playerWidth:"408",vidWidth:"408",vidHeight:"291",playerHeight:"291",controlsDisplay:"over"});CBSVideo.setPlayerResize(291,408);CBSVideo.setVideoId(B);});}}if($("videoShellId")){$$(".playStoryVid").addEvent("click",function(C){var A=new Element("div",{id:"flashvideocontent"});var B=$("videoLargeID").get("videoid");A.injectAfter($("videoLargeID"));$$(".playStoryVid").dispose();$("topMPU").empty();CBSVideo.setNewData({playerWidth:"630",vidWidth:"630",vidHeight:"378",playerHeight:"390",controlsDisplay:"below"});CBSVideo.setPlayerResize(413,630);CBSVideo.setVideoId(B);});}$$(".playVid").addEvent("click",function(A){A.stop();$("thumb").dispose();$("flashvideocontent").getChildren("a").setStyle("display","none");CBSVideo.setNewData({playerWidth:"390",playerHeight:"235",vidWidth:"390",vidHeight:"222",controlsDisplay:"over",shareUrl:linkUrl,adPreroll:"false"});CBSVideo.setPlayerResize(235,390);CBSVideo.setVideoId(lumID);});$$(".mnPhotoBg").each(function(A){new ImgDoorRollOver(A);});});window.addEvent("domready",function(){if(PageVars.get("nodeId")==505263){var A=Cookie.read("test_group")||"NOCOOKIE";if($("bottomMPU")){new JlScroller({tag:A,ctype:"cbs_scroller",cval:"bottomMPU",fireOnce:true,event:"scrollTo",scrollTo:{top:"bottomMPU"}});}if($("cbsFooterWrap")){new JlScroller({tag:A,ctype:"cbs_scroller",cval:"footer",fireOnce:true,event:"scrollTo",scrollTo:{top:"cbsFooterWrap"}});}new Jlogger({tag:A,ctype:"cbs_scroller",cval:"scroll",fireOnce:true,element:window,event:"scroll"});}});var TwitPanel=new Class({Implements:[Options,Events],options:{apiUrl:"http://api.cnet.com/rest/v1.0/tweets/",method:"user_timeline",fetchCount:20,callBackKey:"callback",template$:"tweetTemplate",tweetShell$$:"ul",moreTweetsClass:"twitterMore",updatePeriod:30000,panelName:null,fetchData:true,listName:null,listOwner:null,action:null,favoritesOwner:null,getOlderTweets:false,mineData:function(A){return{text:this.addTwitterLinks(A.text),created:this.getTimeDifference(A.created_at),id:A.id,profilePic:A.user.profile_image_url,screenName:A.user.screen_name,profileUrl:A.user.url,name:A.user.name};},getTweetElem:function(){return(this.template||(this.template=$(this.options.template$))).clone();},getTweetHtml:function(){return(this.template||(this.template=$(this.options.template$))).get("html");},updateTweetElem:function(A,C){var B=new Element(this.template.get("tag"));$each(C,function(E,D){A=A.replace(new RegExp("%"+D+"%","g"),E);});B.set("html",A);return B;}},initialize:function(C,D,B){C=$(C);if(C.retrieve("twitpanel")){return false;}this.element=C;this.element.store("twitpanel",this);this.userId=D;this.container=this.element.getElement(this.options.tweetShell$$);this.setOptions(B);this.addPanel();if(this.options.fetchData){this.fetchData();}this.lastTwitterId=0;this.oldestTweet=0;if($(C).getElements(this.options.moreTweetsClass).length>0){var A=this;if($(C).getElements(this.options.moreTweetsClass)){$(C).getElements(this.options.moreTweetsClass)[0].addEvent("click",function(){A.loadOlderPosts();return false;});}}},addPanel:function(){var A=TwitPanel.panels.push(this)-1;this.panelName=this.options.panelName||"panel_"+A;TwitPanel.panels[this.panelName]=this;},fetchData:function(B){var C={method:this.options.method,viewType:"json",per_page:this.options.fetchCount,callback:"TwitPanel.panels."+this.panelName+".loadResponse",username:this.userId};if(this.options.method=="statuses"&&this.options.listName){C.action="lists";C.listName=this.options.listName;if(this.options.listOwner){C.listOwner=this.options.listOwner;}else{C.listOwner=this.userId;}}else{if(this.options.action=="favorites"){C.action=this.options.action;C.favoritesOwner=this.options.favoritesOwner;}}if(this.oldestTweet&&this.getOlderTweets){dbug.log("fetch older");C.max_id=this.oldestTweet;dbug.log("max_id: %s",C.max_id);}var A=new Hash($merge(C,B||{})).toQueryString();A=(this.options.apiUrl.contains("?")?"&":"?")+A;this.script=new Element("script",{type:"text/javascript",src:this.options.apiUrl+A}).inject(document.head);},loadResponse:function(A){dbug.log("%s data: %o",this.panelName,A);var C=$unlink(A);if(!this.fired){this.updatePanel(A,true);this.fireEvent("onInitialLoad",[C,this]);this.fired=true;}else{this.updatePanel(A,false);this.fireEvent("onUpdateLoad",[C,this]);}try{if(this.script){this.script.dispose();}}catch(B){dbug.log("Script disposal issue: %o",B);}if(this.options.updatePeriod){this.poll=this.fetchData.delay(this.options.updatePeriod,this);}},updatePanel:function(C,A){var B;if(A!==true){A=false;}if(C.length){if(C[0].id>this.oldestTweet){dbug.log("new tweets");while(B=C.pop()){if(B.id>this.lastTwitterId){this.displayTweet(B,"top",A);this.lastTwitterId=B.id;if(B.id<this.oldestTweet||this.oldestTweet==0){this.oldestTweet=B.id-1;}}}}else{if(C[0].id<this.oldestTweet){dbug.log("older tweets");while(B=C.shift()){if(B.id!=this.oldestTweet){this.displayTweet(B,"bottom",A);this.oldestTweet=B.id-1;this.getOlderTweets=false;}}}}}},addTwitterLinks:function(A){A=A.replace(/(http\:\/\/[a-z0-9]+\.[a-z0-9]+[^\s]*)/gi,'<a href="$1">$1</a>');A=A.replace(/([\s^])+\@([a-z0-9_]+)/gi,'$1@<a href="http://twitter.com/$2">$2</a>');A=A.replace(/\#([a-z0-9_]+)/gi,'<a href="http://search.twitter.com/search?q=%23$1" target="_new">#$1</a>');return A;},getTimeDifference:function(B){try{B=B.replace(/\+0000/,"GMT");var A="About ";var D=Math.round(($time()-new Date(B).getTime())/1000);if(D<60){A+=D+" second";}else{if(D<60*60){D=Math.round(D/60);A+=D+" minute";}else{if(D<60*60*24){D=Math.round(D/(60*60));A+=D+" hour";}else{D=Math.round(D/(60*60*24));A+=D+" day";}}}if(!D){return"Posted "+B;}if(D!=1){A+="s";}A+=" ago";return A;}catch(C){dbug.log("Failed to determine time difference: %o",C);return"Posted "+B;}},displayTweet:function(E,A,B){var C=this.options.getTweetHtml.apply(this);var D=this.options.mineData.run(E,this);elem=this.options.updateTweetElem.run([C,D],this);elem.inject(this.container,A);this.fireEvent("onTweetDisplay",[elem,D,E,B]);},loadOlderPosts:function(){this.getOlderTweets=true;this.fetchData();}});TwitPanel.panels=[];var WeatherChannelCore=new Class({Implements:[Options,Events],options:{},hasData:false,response:null,responseXML:null,location:null,initialize:function(B,A){this.uri=B;this.setOptions(A);},fetch:function(){if(this.uri==null){return false;}new Request({url:this.uri,method:"get",onSuccess:this.weatherDataSuccess.bind(this),async:false,timeout:30000,onTimeout:function(){dbug.log("Weather request timeout");}}).send();},weatherDataSuccess:function(A,C){var B;this.response=A;this.responseXML=C;this.hasData=true;if(B=this.feedError()){this.fireEvent("onWeatherDataError",B);this.response=null;this.responseXML=null;this.hasData=false;return false;}this.fireEvent("onNewWeatherData",[A,C]);},feedError:function(){if(typeof this.responseXML=="undefined"){return"Error retrieving data";}else{if(this.responseXML.getElementsByTagName("err")[0]){return this.responseXML.getElementsByTagName("err")[0].firstChild.nodeValue;}}return false;},getNodeValue:function(D){if(!D){return ;}if(D.childNodes&&D.childNodes.length<2){if(D.nodeType==1){return D.firstChild.nodeValue;}}else{var B={};var E=D.childNodes;var A=D.nodeName;for(var C=0;C<E.length;C++){if(E[C].nodeType==1){B[E[C].nodeName]=this.getNodeValue(E[C]);}}}return B;},getValues:function(E,D){var A={};var C;for(var B=0;B<E.length;B++){C=D.getElementsByTagName(E[B])[0];if(C){A[E[B]]=this.getNodeValue(C);}}return A;}});var WeatherChannelLocal=new Class({Extends:WeatherChannelCore,options:{days:5,iconBasePath:"http://wwwimage.cbsnews.com/weather/images/icons/"},localApiUri:"/cbsweather/weather/local/%%%ZIP%%%?cc=*&dayf=%%%DAYS%%%&prod=bd_select&par=cbsxml",initialize:function(A,B){this.setOptions(B);this.location=A;if(A!=null){this.apiUri=this.localApiUri;this.apiUri=this.apiUri.replace(/%%%ZIP%%%/ig,A);this.apiUri=this.apiUri.replace(/%%%DAYS%%%/ig,this.options.days);dbug.log("Weather zip set to: "+A);}else{dbug.log("Weather doesn't have a  zip code set.  It can't be used until it does");}this.parent(this.apiUri,B);},setZip:function(A){this.initialize(A);},getLocationName:function(){var A=this.responseXML.getElementsByTagName("loc")[0];return A.getElementsByTagName("dnam")[0].firstChild.nodeValue;},getCurrent:function(){var A=Array("tmp","flik","t","icon");var B=this.responseXML.getElementsByTagName("cc")[0];return this.getValues(A,B);},getHighLowTemp:function(){var A=Array("hi","low");var B=this.responseXML.getElementsByTagName("day")[0];return this.getValues(A,B);},getWeatherDetails:function(){var A=Array("uv","wind","barom","hmid");var B=this.responseXML.getElementsByTagName("cc")[0];return this.getValues(A,B);},getExtended:function(D){if(D>this.options.days){D=this.options.days;}var A=Array("tmp","hi","low","icon","t");var B=Array();for(i=0;i<D;i++){var C=this.responseXML.getElementsByTagName("day")[i];B[i]=this.getValues(A,C);B[i].day=C.getAttribute("t");}return B;},populateWeather:function(){if(this.hasData==false){return ;}var D=this.getLocationName();var H=this.getCurrent();var E=this.getExtended(5);$$(".locCity").set("text",D.replace(/ \(.*\)/ig,""));if(D&&$("Wcurrent")){dbug.log("Weather For: "+D);$$("#Wcurrent .Wcity").set("text",D);$$(".WCurrentConIn").set("text","Current Conditions in "+D);}if(H&&$("Wcurrent")){$("Wcurrent").morph({display:"block",opacity:0});var C=this.getHighLowTemp();var F=this.getWeatherDetails();H=$merge(H,C,F);for(var A in H){if(typeof H[A]=="object"){for(var B in H[A]){$$("#Wcurrent .W"+A+" .W"+B).set("text",H[A][B]);}}else{if(A=="icon"){$$("#Wcurrent .W"+A).set({src:this.options.iconBasePath+H[A]+".gif",width:52,height:52});}else{$$("#Wcurrent .W"+A).set("text",H[A]);}}}$("Wcurrent").morph({display:"block",opacity:1});}if(E&&$("Wextended")){if($("extendedForecast")){$("extendedForecast").set("href","http://www.weather.com/weather/tenday/"+this.location+"?par=cbsnews&site=www.cbsnews.com&promo=0&cm_ven=CBS&cm_cat=www.cbsnews.com&cm_pla=WxPage&cm_ite=CityPage");}$("Wextended").morph({display:"block",opacity:0});$("Wextended").empty();for(var I=0;I<E.length;I++){clone=$("WextendedTmpl").clone().inject("Wextended");for(var A in E[I]){if(A=="icon"){var G=clone.getElement(".W"+A);G.set({src:this.options.iconBasePath+E[I][A]+".gif",width:52,height:52,styles:{relative:"relative"}});}else{clone.getElement(".W"+A).set("text",E[I][A]);}}clone.setStyle("display","block");}$("Wextended").morph({display:"block",opacity:1});}}});function loadFromTextBox(){var A=document.getElementById("txtZip").value+"";loadZipWidget(A);}function loadZipWidget(B){if(window.ng_showDataForZip){ng_showDataForZip(B);}else{var C=187594;var A="18E45DF08C414168B99ADDF208CBBAFE";var D="ngZipCodeContainer";ng.buzz.LoadWidget(C,A,D,{zip:B});}}var LocalizedContent=new Class({Implements:Options,options:{},zip:null,overrideZip:null,hideLocal:false,initialize:function(){this.hideLocal=false;var C;if(C=this.getLocalZipOverride()){var B=(C&&C.toString().match(/\d\d\d\d\d/));if(B){this.zip=C;this.initWeather();return ;}}else{if(UserVars.isLoggedIn()){var A=(UserVars.get("postalCode")&&UserVars.get("postalCode","string").match(/\d\d\d\d\d/));dbug.log("UserVars[Logged In]: "+UserVars.isLoggedIn());dbug.log("UserVars[zip]: "+UserVars.isLoggedIn());if(!A){}else{dbug.log("postal check:"+UserVars.get("postalCode"));this.zip=UserVars.get("postalCode");this.initWeather();return ;}}}var D=new CbsLocalization();D.addEvent("hasLocale",function(E){if(E.country&&E.country=="usa"){if(E.zip&&E.zip!=0){dbug.log("Geo Localization in use");this.zip=E.zip;this.initWeather();return ;}else{dbug.log("No zip code... closing local news");this.hideLocal=true;}}else{this.zip=10019;this.initWeather();return ;}}.bind(this));D.init();return ;},initWeather:function(){window.cbsLocalizedWeather.setZip(this.zip);window.cbsLocalizedWeather.addEvent("onWeatherDataError",function(){dbug.log("Hiding weather box");this.hideElement("#Wcurrent");}.bind(this));window.cbsLocalizedWeather.fetch();},loadContent:function(){if(this.hideLocal){this.hideElement(".catLocal");return false;}if(!this.zip){return false;}this.showElement(".catLocal");if(typeof loadZipWidget!=null){loadZipWidget(this.zip);}if(typeof cbsLocalizedWeather!="undefined"&&cbsLocalizedWeather.hasData){dbug.log("Rendering weather data");this.loadWeatherWidget();}else{dbug.log("Waiting for onNewWeatherData  to render weather data");cbsLocalizedWeather.addEvent("onNewWeatherData",function(){this.loadWeatherWidget();});}},loadWeatherWidget:function(){this.showElement("#Wcurrent");$$(".fiveDayForecast a").set("href","/2332-100_162-0.html?zip="+this.zip);cbsLocalizedWeather.populateWeather();},getLocalZipOverride:function(){if(cookie=Cookie.read("cbsLocalZip")){return cookie;}return false;},setLocalZipOverride:function(B){var A=(B&&B.toString().match(/\d\d\d\d\d/));if(!A){dbug.log("Zip check error");return false;}this.zip=B;Cookie.write("cbsLocalZip",B,{duration:1095});this.initWeather();this.loadContent();this.toggleZipBox();return false;},hideElement:function(A){A=$$(A);if(A.getStyle("display")!="none"){$$(A).setStyle("display","none");}},showElement:function(A){A=$$(A);if(A.getStyle("display")!="block"){$$(A).setStyle("display","block");}},toggleZipBox:function(){var A=$("localZipBox");if(A.getStyle("display")!="block"){A.setStyle("display","block");}else{A.setStyle("display","none");}}});var cbsLocalizedWeather=new WeatherChannelLocal(null,{iconBasePath:"http://wwwimage.cbsnews.com/weather/images/icons/"});var cbsLocalized=new LocalizedContent();if(!UserVars.isLoggedIn()){CURS.Manager.addEvent("onLogin",function(){cbsLocalized.initialize();cbsLocalized.loadContent();});}var InputTextDefault=new Class({Implements:[Options],options:{emptyString:""},initialize:function(B,A){B=$(B);this.element=B;this.options.emptyString=B.value;this.setOptions(A);this.addEvents();},addEvents:function(){var A=this;this.element.addEvent("click",function(){if(this.get("value")==A.options.emptyString){this.set("value","");}});this.element.addEvent("blur",function(){if(this.get("value")==""){this.set("value",A.options.emptyString);}});}});var CBSMobileFormSubmit=new Class({Implements:[Options],options:{numberField:"number"},initialize:function(B,A){B=$(B);this.form=B;this.setOptions(A);var C=this;this.form.addEvent("submit",function(){return C.submit(this);});},submit:function(C){var B=$(C).getElement("#number").get("value");B=B.match(/[\s1\.\-/\(]*(\d{3})[\s\.\-\)\/]*(\d{3})[\s\.\-\/]*(\d*)/);if(!B){alert("Please enter your phone number as: xxx-xxx-xxxx");return false;}var A=B[1].toString()+B[2].toString()+B[3].toString();if(A.length==9){A="1"+A;}if(A.length!=10){alert("Please enter your phone number as: xxx-xxx-xxxx");return false;}this.sendNumber(A);return false;},sendNumber:function(A){var B=this;new Request.JSON({url:"/2253-100_162-0.html?num="+A,onSuccess:function(C){B.processResponse(C);}}).send();},processResponse:function(A){A=A.Response;var B="";dbug.log(A);if(typeof A.Success!="undefined"&&A.Success["$"]==1){var B="<p><strong>Successfully signed up</strong></p>";B+='<p><a href="#">Back</a></p>';}else{if(typeof A.Success=="undefined"&&typeof A.resultMessage!="undefined"){var B="<p><strong>Error:</strong>"+A.resultMessage["$"]+"</p>";B+='<p><a href="#">Back</a></p>';}else{var B="<p><strong>Error:</strong>Sorry, we couldn't subscribe you at this time.  Please try again later.</p>";B+='<p><a href="#">Back</a></p>';}}this.message(B);return ;},message:function(A){this.form.hide();this.messageBox=new Element("div",{"class":"resultMessage"}).injectAfter(this.form);this.messageBox.set("html",A);var B=this;this.messageBox.getElements("a")[0].addEvent("click",function(){B.messageBox.dispose();B.form.show();return false;});}});window.addEvent("domready",function(){if($("twitterModule")){new TwitPanel("twitterModule","cbs_tweet_feed",{method:"friends_timeline",updatePeriod:30000,onInitialLoad:function(){if(!Browser.Engine.trident){this.element.reveal();}else{this.element.setStyles({display:"block",position:"relative"});}new Jlogger({tag:"twitter",ctype:"action",cval:"scroll",element:$$("#twitterModule ul")[0],event:"scroll",fireOnce:true});},onTweetDisplay:function(B,C,D,A){$ES("a",B).each(function(E){new Jlogger({tag:"twitter",ctype:"click",cval:"click",element:E,event:"click"});});if(A){return ;}B.set("tween",{duration:2000});B.highlight("#FFFFEF","#EAEEF1");}});}});
   }
       
