
 //dbugScripts - will include non-compressed versions of this code if "jsdebug=true" is in the url of this page,
 //otherwise it will execute this code.

 if(!dbugScripts("http://publish.cnet.com:8100/html/rb/js/tron/cbsnews/",["cbsnews.a2.newsletters.js"])) {
 /*	cbsnews.a2.newsletters.js - packed	*/
       var StyleWriter=new Class({createStyle:function(A,B){window.addEvent("domready",function(){try{if($(B)&&B){return ;}var C=new Element("style",{id:B||""}).inject($$("head")[0]);if(Browser.Engine.trident){C.styleSheet.cssText=A;}else{C.set("text",A);}}catch(D){dbug.log("error: %s",D);}}.bind(this));}});var Newsletter=new Hash({Manage:new Class({options:{submitUrl:"/8674-4_"+PageVars.get("siteId")+"-0.html",nlIdKey:"newsletter",subscribedClass:"statusUpdated",subscribeHTML:'<a class="flexButton subscribe"><b>Subscribe</b></a>',unsubscribeHTML:'<div class="subscribed"><b>You are subscribed</b><span><a class="unsubscribe">Unsubscribe</a></span></div>'},initialize:function(B,A){B=$(B);if(B.get("tag")!="a"){B=B.getParent("a");}this.shell=(B.getProperty(this.options.nlIdKey))?B:B.getParent("["+this.options.nlIdKey+"]");this.id=this.shell.getProperty(this.options.nlIdKey);if(B.hasClass("subscribe")){this.action="subscribe";}else{if(B.hasClass("unsubscribe")){this.action="unsubscribe";}else{this.action=null;}}this.waiter=new Waiter(this.shell);this.pingServer();},updateState:function(){$$("li[newsletter="+this.id+"]").each(function(A){var B=A.getElement(".nlAction");if(this.action=="unsubscribe"){A.removeClass(this.options.subscribedClass);B.set("html",this.options.subscribeHTML);}else{if(this.action=="subscribe"){A.addClass(this.options.subscribedClass);B.set("html",this.options.unsubscribeHTML);}}A.getElements(".subscribe, .unsubscribe").addEvent("click",function(C){C.stop();new Newsletter.Manage(C.target);});}.bind(this));},pingServer:function(){var A="";A+="action="+(this.action);A+="&"+(this.action)+"Ids="+this.shell.getProperty("newsletter");new Request({url:this.options.submitUrl,method:"get",data:A,onRequest:function(){this.waiter.start();}.bind(this),onComplete:function(B){this.waiter.stop();B=JSON.decode(B);if(B&&B.status&&B.status=="success"){this.updateState();}}.bind(this)}).send();}}),updateOnRefresh:function(){var B=new Cookie("addNL");if(B.read()){var C=$E("li[newsletter="+B.read()+"]");if(C){new Fx.Scroll(window).toElement(C);var A=C.getElement(".subscribe");if(A){new Newsletter.Manage(A);}}B.dispose();}},Prefs:new Class({Implements:Options,options:{triggerSel:".nlPrefsLink"},initialize:function(B,A){this.setOptions(A);this.shell=$(B).inject(document.body);this.triggers=$$(this.options.triggerSel);this.triggers.addEvent("click",this.toggle.bind(this));this.shell.getElements(".closeModal").addEvent("click",this.hide.bind(this));this.initPrefs();this.ping=new Request({url:"/8674-4-0.html",method:"get"});},initPrefs:function(){this.shell.getElements("input[type=radio]").each(function(A){A.addEvent("click",this.updateRadio.pass(A,this));}.bind(this));},updateRadio:function(A){if(A.hasClass("ping")){this.pingPref({action:"updateMailPref",mailPref:A.get("value")});}this.notifyUpdate(A);},notifyUpdate:function(C){var B=new Element("span",{text:"preference saved",styles:{opacity:0,color:"#C00","font-weight":"bold"}}).inject(C.getParent("label"));var A=function(){if(B.getStyle("opacity")>0.1){(function(){B.morph({opacity:0});}).delay(1500);}else{B.dispose();}};B.set("morph",{duration:250,onComplete:A}).morph({opacity:1});},pingPref:function(A){A=A||{};this.ping.send(new Hash(A).toQueryString());},show:function(){this.shell.setPosition({});this.shell.setStyle("top",window.getScrollTop()+50);this.shell.setStyle("display","block");},hide:function(){this.shell.setStyle("display","none");},toggle:function(){if(this.shell.getStyle("display")=="none"){this.show();}else{this.hide();}}}),checkPassedIn:function(){if(!Browser.qs.subscribe&&!Browser.qs.unsubscribe){return ;}var E=(Browser.qs.unsubscribe)?"unsubscribe":"subscribe";var A=Browser.qs[E];var D=$E("ul.myList li[newsletter="+A+"]");var C="<strong>";C+=(E=="unsubscribe")?"You have been unsubscribed":"You are now subscribed";if(D){C+=(E=="unsubscribe")?" from ":" to ";C+=D.getElement("a.title").get("text").trim();}C+=".</strong>";var B=new Element("li",{html:C,"class":"mainMessage",styles:{color:"#900",display:"none"}}).inject($E("ul.status"),"top");B.reveal();},resetReloc:function(){Newsletter.reloc=false;CURS.Manager.removeEvent("onClose",Newsletter.resetReloc);}});if(!UserVars.isLoggedIn()){CURS.Manager.addEvent("onLogin",function(){(function(){try{if(!Newsletter.reloc){window.location=PageVars.getRefreshPath({subscribe:false,unsubscribe:false});}}catch(A){dbug.log("Newsletter onlogin event failure: %o",A);}}).delay(20);});}window.addEvent("domready",function(){var B=new fbEmailPerms();Newsletter.checkPassedIn();if(!UserVars.isLoggedIn()){$$("a.subscribe, a.unsubscribe").addEvent("click",function(C){C.stop();var D=$(C.target).getParent("[newsletter]");if(D){Cookie.write("addNL",D.getProperty("newsletter"));}CURS.Manager.checkLogin({loginHed:"Log in to CBSNews.com to subscribe",registerHed:"Join CBSNews.com to subscribe",appId:189});});$$(".catNav dd a").each(function(C){if(!C.hasClass("noreg")){C.addEvent("click",function(D){D.stop();Newsletter.reloc=true;CURS.Manager.addEvent("onClose",Newsletter.resetReloc);CURS.Manager.checkLogin({appId:189,nextAction:function(){window.location=C.get("href");}});});}});}else{$$(".subscribe, .unsubscribe").addEvent("click",function(C){C.stop();if(CURS.Social&&CURS.Social.fb.isUser()){B.checkForFbLink(C);}else{new Newsletter.Manage(C.target);}});Newsletter.updateOnRefresh();new Newsletter.Prefs("newsletterPrefsModal",{triggerSel:".updatePrefs"});}try{$E("ul.loggedIn a.logOut").href=new Link({href:$E("ul.loggedIn a.logOut").href}).setQueryString({path:encodeURIComponent(PageVars.getRefreshPath({subscribe:false,unsubscribe:false}))}).get("href");}catch(A){}});var fbEmailPerms=new Class({Implements:Options,initialize:function(A){this.setOptions(A);this.setPermsPrompt();},setPermsPrompt:function(){var B=new Element("div",{"class":"globalModal"}).set("html",'<h2>E-mail permissions have not been granted<a class="closeModal"></a></h2>You have not set permissions for CBSNews.com to send e-mail through your Facebook account. You will need to do so before you can subscribe to a newsletter. To set permissions:<ol><li>Click the button below to open a permissions prompt from Facebook.</li><li>On the Facebook prompt, click "Allow E-mails."</li></ol>');var A=new Element("a",{id:"launchFbPerms","class":"flexButton"}).set("html","<b>Continue</b>");B.adopt(A);this.permsPrompt=new GlobalModal({id:"permsPrompt",content:B});A.addEvent("click",function(){this.getFBpermsPopup();}.bind(this));},getFBpermsPopup:function(){this.permsPrompt.hide();FB.Connect.showPermissionDialog("email",function(){var A=this.emailPermsRequest();if(A.json&&A.json.HasPermission){if(A.json.HasPermission["$"]=="true"){new Newsletter.Manage(this.event.target);}}}.bind(this));},checkPerms:function(){var A=this.emailPermsRequest();if(A.json&&A.json.HasPermission){if(A.json.HasPermission["$"]=="true"){new Newsletter.Manage(this.event.target);}else{this.permsPrompt.show();}}},emailPermsRequest:function(){var A=FB.Facebook.apiClient.get_session();return new CURS.RPS.Request({resource:"social-hasAppPermission",data:{socialId:A.uid,socialSite:"fb",appId:210,permission:"email",socialSessionKey:A.session_key},async:false}).send().response;},checkForFbLink:function(A){this.event=A;new CURS.RPS.Request({resource:"rps-regIdToEmail",data:{regId:UserVars.get("ursRegId"),appId:"189"},onSuccess:function(C){var B=C.User.Email["$"];if(B.match("@proxymail.facebook.com")){this.checkPerms(A);}else{new Newsletter.Manage(this.event.target);}}.bind(this)}).send();}});
 /* end packed code */
 }
       