(function(){CNB.initNavOverlay=function(){try{var container=$('header-sec');var tabs=container.getElements('.nav-sec li');var overlay=container.getElements('.overlay-pop');var tab_special=tabs.pop();var overlay_special=overlay.pop();var popSpecial=new CNB.Pop(tab_special,overlay_special,{offset:{x:-510},position:{x:'right'}}).load();var pop=new CNB.Pop(tabs,overlay).load();var popGlobal=new CNB.Pop(container.getElements('.geo-loc'),container.getElements('.overlay-global'),{offset:{x:-20}}).load()}catch(err){}};CNB.getRelatedContent=function(cont){try{var assets=relassets();var impressions=relimpressions();if(assets.length==0&&impressions.length==0)return;var container=$(cont);if(assets.length>0){var hold=new Element('div',{'class':'space-3'});var hed=new Element('div',{'class':'hed hed-1','html':'<h6 class="h s-6 c-1"><span class="int">People who read this, also read...</span></h6>'}).inject(hold);var list=new Element('ul',{'class':'list-1'}).inject(hold,'bottom');assets.each(function(asset){var listItem=new Element('li',{'html':'<a href="'+asset.url+'">'+asset.title+'</a></li>'}).inject(list,'bottom')});container.adopt(hold)}if(impressions.length>0){var imageString='';impressions.each(function(img){imageString+=img});var hold2=new Element('div',{'html':imageString,'styles':{'position':'absolute','left':'-9999px'}}).inject(container)}}catch(e){}};CNB.clickableSkin={load:function(clickables,content,container){this.elements=$$(clickables);this.container=$(container);this.content=$(content);if(!$chk(this.elements)||!$chk(this.container)||!$chk(this.content))return false;this.container.setStyle('position','relative');this.setClickableArea();window.addEvent('resize',this.setClickableArea.bind(this))},setClickableArea:function(){var containerSize=this.container.getScrollSize();var contentSize=this.content.getSize();var gutterSize=containerSize.x-contentSize.x;var width=(gutterSize>0)?Math.floor(gutterSize/2):0;var height=containerSize.y;if(width>0&&height>0){this.elements.each(function(el,i){el.setStyles({'position':'absolute','z-index':'1','top':'0','left':0,'width':width,'height':height});if(i==1){el.setStyles({'left':'auto','right':'0'})}})}}};CNB.Overlay.loadEmail=function(options){var handleFormSubmit=function(e,form){e.stop();overlay.loader.add();var request=new Request.JSON({url:form.getProperty('action'),data:form.toJSON(),onSuccess:function(data){if(data.status=='success'){overlay.notify('Your message has been sent.')}else{overlay.notify('Sorry we can\'t send your message at this time.')}},onComplete:overlay.loader.remove.bind(overlay.loader),onFailure:function(xhr){overlay.notify('Sorry we can\'t send your message at this time.')}}).post()};var overlay=new CNB.Overlay.Async(options);overlay.addOneEvent('contentReady',function(content){var validate=new CNB.Validator(content.getElement('form'),{onValidateSuccess:handleFormSubmit})});overlay.open()};CNB.SubscribePromo=new Class({initialize:function(loggedInForm,loggedOutForm){this.loggedOutForm=$(loggedOutForm);this.loggedInForm=$(loggedInForm);this.loader=new CNB.Loading(this.loggedInForm);this.loggedOutForm.addEvent('submit',this.loggedOutSubmit.bind(this));this.validate=new CNB.Validator(this.loggedInForm,{onValidateSuccess:CNB.Reg.checkLoggedIn.bindWithEvent(CNB.Reg,this.loggedInSubmit.bind(this))})},loggedOutSubmit:function(e){e.stop();CNB.Reg.join({'data':this.loggedOutForm.toJSON()})},loggedInSubmit:function(){this.loader.add();var request=new Request.JSON({url:this.loggedInForm.getProperty('action'),data:$merge(this.loggedInForm.toJSON(),{'appId':'187','updateUser':true}),onSuccess:this.subscribeResponse.bind(this),onComplete:this.loader.remove.bind(this.loader),onFailure:function(xhr){this.subscribeResponse({'status':'failure'})}}).post()},subscribeResponse:function(response){switch(response.status){case'success':msg='Thank you for subscribing.';break;default:msg='Sorry, we encountered a problem, and can\'t process your request at this time.'}this.loggedInForm.empty().set('html','<p class="fancy s-8">'+msg+'</p>')}});CNB.RegOverlay=new Class({initialize:function(){this.isUser=(Cookie.read('purs_3')!=null)?true:false;this.hasViewed=(Cookie.read('reg-overlay')!=null)?true:false},load:function(){if(this.isUser||this.hasViewed){return false}var path=location.pathname;if(path!='/'&&path!='/news'&&path!='/reviews'){return false}if(CNB.Page&&CNB.Page.isIntroScheduled===true){return false}if(!CNB.hasCookiesEnabled()){return false}this.overlay=new CNB.Overlay({id:'reg-pop-overlay',containerClass:'contain-overlay-10',content:this.buildContent(),onClose:function(){DW.redir({'ctype':'reg-ol;act','cval':'close'})},onOpen:function(){DW.redir({ctype:'reg-ol;act',cval:'load'});Cookie.write('reg-overlay','1',{duration:30,domain:CNB.getCookieHost(),path:'/'})}}).open()},buildContent:function(){var html='<h2 class="h s-4 fancy space-1">Join the largest community of IT Professionals on the web.</h2>'+'<div class="hed hed-1"><h4 class="h s-6 c-1"><span class="int">ZDNet members receive FREE access to:</span></h4></div>'+'<div class=" view-6 space-1">'+'<ul class="list-2"><li class="space-1">All-star team of technology experts delivering dozens of reports daily</li>'+'<li class="space-1">50,000+ white papers, case studies and webcasts</li>'+'<li class="space-1">400,000+ downloads featuring scripts, executables, and other time-saving tools</li>'+'<li class="space-1">100,000+ products reviewed from around the web</li>'+'<li class="space-1">Informative newsletters covering a wide variety of topics</li>'+'<li>Breaking IT alerts as the news happens</li></ul></div>';var contents=new Element('div',{'class':'content','html':html});var submitLevel=new Element('div',{'class':'lvl-btn clear space-1'}).inject(contents,'bottom');var join=new Element('a',{'class':'btn-1','text':'Join ZDNet','events':{'click':function(){DW.redir({ctype:'reg-ol;act',cval:'signmeup'});this.overlay.remove();CNB.Reg.join({regSrc:'reg-over'})}.bind(this)}}).inject(submitLevel,'bottom');var span=new Element('span',{'class':'other-options right fancy c-2','text':' | '}).inject(submitLevel,'bottom');var login=new Element('a',{'html':'I&#8217;m already a member','events':{'click':function(){DW.redir({ctype:'reg-ol;act',cval:'currentmember'});this.overlay.remove();if(typeof CNB.Reg.logIn!='undefined'){CNB.Reg.logIn({regSource:'reg-over'})}else{CNB.Reg.login({regSrc:'reg-over'})}}.bind(this)}}).inject(span,'top');var noThanks=new Element('a',{'text':'No thanks','class':'close','events':{'click':function(){this.overlay.removeEvents('close');DW.redir({ctype:'reg-ol;act',cval:'nothanks'})}.bind(this)}}).inject(span,'bottom');return contents}});CNB.SearchSection=new Class({Implements:Options,options:{defaultSection:''},initialize:function(container,options){this.setOptions(options);this.container=$(container);this.form=this.container.getElement('form');this.overlay=this.container.getElement('.overlay-search');this.sectionOptions=this.overlay.getElements('a')},load:function(){this.sectionOptions.each(function(el){el.addEvent('click',this.handleClick.bindWithEvent(this,el))}.bind(this));var pop=new CNB.Pop(this.form,this.overlay,{offset:{x:-5,y:5}}).load();if($chk(this.options.defaultSection)){this.setOnState(this.overlay.getElement('a[section='+this.options.defaultSection+']'));this.setSection(this.options.defaultSection)}this.form.addEvent('submit',this.handleSubmitEvent.bind(this))},handleClick:function(e,el){e.stop();var section=el.getProperty('section');this.setSection(section);this.setOnState(el)},setOnState:function(selected){this.sectionOptions.each(function(el){el.removeClass('on')});selected.addClass('on')},setSection:function(section){switch(section){case'reviews':action='http://reviews-search.zdnet.com/search';title='Search Reviews';break;case'downloads':action='http://downloads.zdnet.com/search.aspx';title='Search Downloads';break;case'whitepapers':action='http://whitepapers.zdnet.com/search.aspx';title='Search Whitepapers';break;default:action='http://www.zdnet.com/search';title='Search All'}this.form.setProperty('action',action);var input=this.form.getElement('input');if(input.hasClass('placeholder')){input.set('value',title)}input.setProperty('placeholder',title)},handleSubmitEvent:function(e){e.stop();var input=this.form.getElement('input');input.set('value',input.get('value').toLowerCase());this.form.submit()}});window.addEvent('domready',function(){var clickableAreas=$$('.skinClick');if($chk(clickableAreas)){CNB.clickableSkin.load(clickableAreas,'content','mantle_skin')}}.bind(this))})();
