var is_touch_device='ontouchstart'in document.documentElement;var ads_updating=false;function updateAds(){if(typeof googletag!='undefined'){googletag.cmd.push(function(){googletag.pubads().refresh()});}} function updateStats(curIndex){$document_title=document.title.split('|');if(typeof Webtrends!=undefined){Webtrends.multiTrack({args:{"DCS.dcsuri":window.location.href+"?slide="+curIndex,"WT.ti":$document_title[0]+' - Slide - '+curIndex}});} if(typeof _gaq!='undefined'){_gaq.push(['_trackPageview',window.location.href+"?slide="+curIndex]);} if(typeof clicky!='undefined'){clicky.log(window.location.href+"?slide="+curIndex,$document_title[0]+' - Slide - '+curIndex);}} function carouselInit(carousel,start_num){carousel.addClass('init');if(!start_num)start_num=1;if(is_touch_device){carousel.addClass('touch-device');} if(carousel.hasClass('single-image')){return false;} var carousel_thumbs=jQuery('.carousel-thumbs');var swipe=new Swipe(carousel.get(0),{startSlide:start_num-1,speed:400,auto:0,stopPropagation:true,callback:function(index,elem){var classes=jQuery(elem).attr('class').split(" ");for(i=0;i-1){var slide_num=parseInt(class_each.replace('item-',''));}} carousel.find('.index .position').text(slide_num);carouselAdjustHeight(carousel,slide_num);carousel.find('.carousel-index .position').text(slide_num);var hash_url='#slide/'+slide_num;window.location.hash=hash_url;index=slide_num-1;if(carousel.find('.carousel-pager').length>0){carousel.find('.pager-btn').removeClass('pager-btn-active');carousel.find('.pager-btn-'+(index+1)).addClass('pager-btn-active');} if(carousel.hasClass('update-ads')){updateAds();} if(carousel_thumbs.find('.thumb-btn').length>0){carousel_thumbs.find('.thumb-btn').removeClass('thumb-active');carousel_thumbs.find('#thumb-btn-'+(index+1)).addClass('thumb-active');var thumb_page=Math.ceil((index+1)/5)-1;carouselThumbsGoto(thumb_page);} updateStats(index+1);}});carousel.data('swipe',swipe);carousel.find('.carousel-next').click(function(){carousel.data('swipe').next();});carousel.find('.carousel-prev').click(function(){carousel.data('swipe').prev();});if(carousel.find('.pager-btn').length>0){carousel.find('.pager-btn').click(function(){carousel.find('.pager-btn').removeClass('pager-btn-active');jQuery(this).addClass('pager-btn-active');carousel.data('swipe').slide(jQuery(this).index());});}} function carouselAdjustHeight(carousel,index){if(carousel.hasClass('adjust-height')){var control_height=0;var control=carousel.find('.control');if(carousel.hasClass('add-control-height')&&control.length>0){control_height=control.height();} var div_height=carousel.find('.carousel-items .item-'+index).height()+control_height;carousel.animate({'height':div_height},200);} if(carousel.hasClass('adjust-control-height')){carousel.find('.control').height(carousel.find('.carousel-items .item-'+index+' .image').height());}} function carouselThumbsInit(){jQuery('.carousel-thumbs-wrap').each(function(){var carousel_thumbs=jQuery(this);var carousel=jQuery('.carousel');var swipe=new Swipe(carousel_thumbs.get(0),{startSlide:0,speed:400,auto:0,stopPropagation:true,});carousel_thumbs.data('swipe',swipe);carousel_thumbs.find('.carousel-thumbs-next').click(function(){carousel_thumbs.data('swipe').next();carouselThumbsRefresh(carousel,carousel_thumbs);});carousel_thumbs.find('.carousel-thumbs-prev').click(function(){carousel_thumbs.data('swipe').prev();carouselThumbsRefresh(carousel,carousel_thumbs);});carouselThumbsRefresh(carousel,carousel_thumbs);});} function carouselThumbsGoto(num){jQuery('.carousel-thumbs-wrap').each(function(){var carousel_thumbs=jQuery(this);var swipe=new Swipe(carousel_thumbs.get(0),{startSlide:0,speed:400,auto:0,stopPropagation:true,});carousel_thumbs.data('swipe',swipe);carousel_thumbs.data('swipe').slide(num);});} function carouselThumbsRefresh(carousel,carousel_thumbs){carousel_thumbs.find('.thumb-btn').click(function(){var div_id=jQuery(this).attr('id');$div_num=div_id.split('thumb-btn-');carousel_thumbs.find('.thumb-btn').removeClass('thumb-btn-active');jQuery(this).addClass('thumb-btn-active');carousel.data('swipe').slide($div_num[1]-1);});} jQuery(document).ready(function(){carouselReady();if(jQuery('.carousel-thumbs-wrap').length>0){jQuery('.carousel-thumbs-wrap').each(function(){carouselThumbsInit();});}});jQuery(document).on('lazyload',function(){carouselReady();});function carouselReady(){if(jQuery('.carousel:not(.init)').length>0){jQuery('.carousel').each(function(){var carousel=jQuery(this);carousel.find('.image:first img').one('load',function(){if(window.location.hash.indexOf('#slide/')>-1){var urlParts=window.location.hash.split('/');var start=urlParts[1];} carouselInit(carousel,start);carousel.find('.carousel-index .position').text(start);}).each(function(){if(this.complete)jQuery(this).load();});});}}; (function($){$(document).ready(function(){var $bigshot;var $bigshotOverlay;var bigshotViewCount=0;var ads_updating=false;var swipe='';var imageNode='';var imageNodeFixed='';var bigshotsContent;$('.big-shots').on('click','.cover',function(){$bigshot=$(this).closest('.big-shots');var data_slide_num=0;if($bigshot.attr('data-slide-num')>0)data_slide_num=$bigshot.attr('data-slide-num');if($bigshot.attr('data-id')=='front_page'||(document.URL.indexOf('/node/')>-1&&parseInt($bigshot.attr('data-id'))=='NaN')){var cur_url=document.URL.split('/node/');imageNode=cur_url[1];imageNodeFixed=imageNode;} loadBigShots($bigshot.attr('data-id'),data_slide_num);return false;});function loadBigShots(nid,slideNumber){var window_height=$(window).height();$('body').css('height',window_height);$('body').addClass('noscroll');bigshotViewCount=0;$bigshot=$('.big-shots[data-id*="'+nid+'"]');var useAjaxLoad=$bigshot.attr('data-path');if(useAjaxLoad){var ajaxBigShotsURL=useAjaxLoad+nid+'/'+$bigshot.attr('revision');if(imageNodeFixed)ajaxBigShotsURL='/ajax/bigshots/image_node/'+imageNodeFixed;var html=$bigshot.find('.content').html();if(html==''){$.ajax({"type":"GET","dataType":"jsonp","jsonpCallback":"jsonCallback","url":ajaxBigShotsURL,"success":function(data){bigshotsContent=data.html;loadBigShotsAppend(nid,slideNumber);}});}else{loadBigShotsAppend(nid,slideNumber);}}} function loadBigShotsAppend(nid,slideNumber){$('body').append('
');$('body').append('
');$bigshotContent=$('#big-shots-content');$bigshotOverlay=$('#big-shots-overlay');$bigshotOverlay.fadeIn(200,function(){$bigshotContent.empty().html(bigshotsContent).fadeIn(200,function(){loadBigShotsSlide(slideNumber);});});} function loadBigShotsSlide(slideNumber){slideNumber=parseInt(slideNumber);var total=$bigshotContent.find('.sets .set').length;var slide=$bigshotContent.find('.sets .set').eq(slideNumber);if(slide.hasClass('current')){return;} var prevSlide=slide.prev();var nextSlide=slide.next();if(nextSlide.length==0){nextSlide=$bigshotContent.find('.sets .set').eq(0)} if(prevSlide.length==0){prevSlide=$bigshotContent.find('.sets .set').eq(total-1)} $bigshotContent.find('.sets .set').removeClass('current');slide.addClass('current');$bigshotContent.find('.nav .current, .counter .current').html(slideNumber+1);$bigshotContent.find('.slide .image-container').html('
');$bigshotContent.find('.slide .caption').html(slide.find('.description').html());$bigshotContent.find('.slide .credit').html(slide.find('.credit').html());$bigshotContent.find('.slide .article_text').html(slide.find('.title_text').html());$bigshotContent.find('.slide .slide_title').html(slide.find('.title_text').html());var type_bigshot=$bigshotContent.find('.slide h1 strong').html();if(type_bigshot){$bigshotContent.find('.slide h1 .article_title').html(slide.find('.title_text').html());$bigshotContent.find('.slide .row .article_title').html(slide.find('.title_text').html());$bigshotContent.find('.bigshots-subtitle').html(slide.find('.title_text').html());}else{$bigshotContent.find('.slide .row .article_title').html('');$bigshotContent.find('.slide .row .article_title').css('margin-bottom','0');$bigshotContent.find('.bigshots-subtitle').html(slide.find('.title_text').html());} var hash_url='#big-shots/'+$bigshot.attr('data-id')+'/'+slideNumber;if(slide.find('.node_slide').html()&&$bigshot.attr('data-id')=='front_page')imageNode=slide.find('.node_slide').html();if(imageNode)hash_url+='/'+imageNode;window.location.hash=hash_url;swipe=new Swipe($bigshotContent.find('.swipe').get(0),{startSlide:1,speed:400,auto:0,continuous:false,stopPropagation:true,transitionEnd:function(index,elem){var next=slideNumber;if(index==0){next=slideNumber-1;} else if(index==2){next=slideNumber+1;} if(next<0){next=total-1;} else if(next>=total){next=0;} loadBigShotsSlide(next);}});var nid=$bigshot.attr('data-id');var title=$bigshot.find('.cover .title').html();var node_url=slide.find('.node_url').html();var article_title=slide.find('.title_text').html();var article_description=slide.find('.description').html();var host='http://'+window.location.host;var share_url=host+node_url+'#big-shots/'+nid+'/'+slideNumber;if(nid=='front_page')share_url=host+node_url;if($('.social-share').length>0){$('.social-share').html($('.addthis_toolbox_'+nid)[0].outerHTML);$('.addthis_toolbox_'+nid+' .addthis_button_twitter').html('').attr('tw:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_facebook').html('').attr('fb:like:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_google_plusone_share').html('').attr('g:plusone:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_tweet').html('').attr('tw:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_facebook_like').html('').attr('fb:like:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_google_plusone').html('').attr('g:plusone:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_linkedin_counter').html('').attr('addthis:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_email').html('').attr('addthis:url',share_url);$('.addthis_toolbox_'+nid).attr('addthis:url',share_url);$('.addthis_toolbox_'+nid).attr('addthis:title',article_title);$('.addthis_toolbox_'+nid).attr('addthis:description',article_description);addthis.toolbox('.addthis_toolbox_'+nid);setTimeout(function(){$('.addthis_toolbox_'+nid+' .flyout>iframe').remove();},1000);} if($('.bigshots-share').length>0){var medias=['facebook','twitter','tumblr'];$.each(medias,function(key,value){element=$('.bigshots-share .'+value);if(element.length){url=element.attr('data-href');url=url.replace('URL',encodeURIComponent(share_url));element.attr('href',url);}});} bigshotViewCount++;if(bigshotViewCount>=700000){bigshotViewCount=0;showAd();}else if(bigshotViewCount<0){}else{updateBigShotsAds('Right1',$bigshotContent.find('.slide .ad'));updateBigShotsAdsTracking(bigshotViewCount);$.event.trigger({type:'dynamicdfp',positions:['right']});}} $('body').on('click','#big-shots-content .next',function(){var next=parseInt($bigshotContent.find('.sets .set.current').index())+1;var total=$bigshotContent.find('.sets .set').length;if(next>=total){next=0;} if(swipe!=''){swipe.next();} else{loadBigShotsSlide(next);}});$('body').on('click','#big-shots-content .previous',function(){var next=parseInt($bigshotContent.find('.sets .set.current').index())-1;var total=$bigshotContent.find('.sets .set').length;if(next<0){next=total-1;} if(swipe!=''){swipe.prev();} else{loadBigShotsSlide(next);}});$('body').on('click','#big-shots-content .all',function(){$bigshotContent.find('.nav-slides').hide();$bigshotContent.find('.thumbs').show().find('.image').each(function(){var $image=$(this);if($image.find('img').length==0){var thumbUrl=$image.html();$image.html('');}});if($('.bigshots-toggle').hasClass('active')){$('.bigshots-toggle').removeClass('active').text('Thumbnails');$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.counter').removeClass('toggle');} else{$('.bigshots-toggle').addClass('active').text('Slideshow');$bigshotContent.find('.counter').addClass('toggle');}});$('body').on('click','#big-shots-content .bigshots-close',function(){closeBigShots();});$('#big-shots-content .share-toggle').click(function(){if($(this).hasClass('active')){$(this).removeClass('active').parent().removeClass('expand');} else{$(this).addClass('active').parent().addClass('expand');}});$('body').on('click','#big-shots-content .nav-slides > .close',function(){closeBigShots();});$('body').on('click','#big-shots-content .thumbs .image',function(){$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.counter').removeClass('toggle');$bigshotContent.find('.all').removeClass('active');if($(this).parent('figure')){loadBigShotsSlide($(this).parent('figure').index());}else{loadBigShotsSlide($(this).index());}});$('body').on('click','#big-shots-content .thumbs .close',function(){$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();});$('body').on('click','#big-shots-content .continue',function(){closeAd();bigshotViewCount=1;});function closeBigShots(){$('body').css('height','');if(imageNodeFixed){imageNodeFixed='';$('.big-shots .content').html('');} $('body').removeClass('noscroll');window.location.hash='';$bigshotContent.remove();$bigshotOverlay.remove();history.pushState("",document.title,window.location.pathname);window.scrollTo(0,$('.big-shots').offset().top);} function showAd(){$bigshotContent.find('.nav-slides').hide();$bigshotContent.find('.box-message').show();updateBigShotsAds('Right1',$bigshotContent.find('.oas-ad-container'));updateBigShotsAdsTracking(bigshotViewCount);} function closeAd(){$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.box-message').hide();} $('body').on('click','#big-shots-content .share',function(){$bigshotContent.find('.social-share').toggleClass('hidden-xs');$bigshotContent.find('.share').toggleClass('active');});function updateBigShotsAds(listpos,pos){if(typeof OAS_sitepage=='undefined'){return false;} if(!ads_updating){ads_updating=true;var positions=listpos.split(',');var rnds=new String(Math.random());rnds=rnds.substring(2,11);var url='http://oascentral.ibtimes.com/RealMedia/ads/adstream_mjx.ads/'+OAS_sitepage+'/'+rnds+'@'+listpos+'?';jQuery.ajax({url:url,dataType:"script",cache:true,success:function(){jQuery.each(positions,function(key,position){pos=position.toLowerCase();var oas_data1='OAS_AD(\''+position+'\');<\/SCRIPT>';var el=jQuery('#big-shots-content .oas-'+pos);el.writeCapture().html(oas_data1);});}});ads_updating=false;}} function updateBigShotsAdsTracking(index){var document_title=document.title.split('|');if(typeof Webtrends!='undefined'){Webtrends.multiTrack({args:{"DCS.dcsuri":window.location.href+"?slide="+index,"WT.ti":document_title[0]+' - '+index}});} if(typeof _gaq!='undefined'){_gaq.push(['_trackPageview',window.location.href+"?slide="+index]);} if(typeof clicky!='undefined'){clicky.log(window.location.href+"?slide="+index,document_title[0]+' - '+index);}} function calculateSlideNumber(current,direction){var total=$bigshotContent.find('.sets .set').length;if(direction=='next'){var next=parseInt($bigshotContent.find('.sets .set.current').index())+1;if(next>=total){next=0;}}else if(direction=='prev'){var next=parseInt($bigshotContent.find('.sets .set.current').index())-1;if(next<0){next=total-1;}} return next;} $('body').on('click','#big-shots-content .image-container',function(e){var width=$(this).width();var current=parseInt($bigshotContent.find('.sets .set.current').index());if((width/2)-1&&$bigshotContent.find('.box-message').is(':hidden')){if(swipe!=''){if(e.keyCode==37){swipe.prev();} else if(e.keyCode==39){swipe.next();}} else{loadBigShotsSlide(next);}}}});if(window.location.hash.indexOf('#big-shots/')>-1){var urlParts=window.location.hash.split('/');var nid=urlParts[1];var slideNumber=urlParts[2];if(nid=='front_page'){slideNumber=0;imageNode=urlParts[3];imageNodeFixed=imageNode;} loadBigShots(nid,slideNumber);} if(typeof Drupal.settings.ibtg_slideshow!='undefined'){if(Drupal.settings.ibtg_slideshow.type=='rc-bigshots'){var slideNumber=0;$bigshot=$('.big-shots').closest('.big-shots');var nid=$bigshot.attr('data-id');var hash_url='#big-shots/'+nid+'/'+slideNumber;window.location.hash=hash_url;$('body').append('
');$('body').append('
');$bigshotContent=$('#big-shots-content');$bigshotOverlay=$('#big-shots-overlay');loadBigShotsSlide(slideNumber);}}});})(jQuery); /** * Cookie plugin 1.0 * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h0)?options.footer.height():0;var headerHeight=(options.header!=undefined&&options.header.length>0)?options.header.height():0;var footerTop=(options.footer!=undefined&&options.footer.length>0)?options.footer.offset().top:scrollTop+winHeight;var elementHeight=element.height();var elementTop=scrollTop+headerHeight;var footerMeetPoint=footerTop-elementTop-elementHeight-footerMeetPointOffset;if(footerMeetPoint<=0){if(!element.hasClass('position')){element.parents('.contextual-links-region').css('position','static');element.css('top',footerTop-elementHeight-positionTopOffset);element.addClass('position');}} else{if(element.hasClass('position')){element.parents('.contextual-links-region').css('position','relative');element.css('top','');element.removeClass('position');} if(scrollTop>stickyPosition-headerHeight){element.addClass('sticky').css('top',headerHeight+stickyTopOffset);} else if(element.hasClass('sticky')){element.removeClass('sticky');element.css('top','');}}};})(jQuery);(function($){$(document).ready(function(){$('.ibtmedia-form-placeholder').each(function(){var placeholder=$(this).find('div:first');var form_id=placeholder.attr('class');$.get('/ibtmedia_form/'+form_id,function(data){placeholder.prepend(data);var event=form_id+'_loaded';$.event.trigger({type:event});});});$(document).bind('search_block_form_loaded',function(){if(typeof Drupal.behaviors.apachesolr_autocomplete!='undefined'){Drupal.behaviors.apachesolr_autocomplete.attach();}});});})(jQuery);; (function($){Drupal.behaviors.lemon={attach:function(context,settings){this.scrollTop();this.detectFontFace();this.socialShareToggle();},scrollTop:function(){var hashTagActive='';var scrollElement=$('.scroll');if(scrollElement.length>0){scrollElement.on('click',function(event){if(hashTagActive!=this.hash){event.preventDefault();var dest=0;if($(this.hash).offset().top>$(document).height()-$(window).height()){dest=$(document).height()-$(window).height();} else{dest=$(this.hash).offset().top;} $('html, body').animate({scrollTop:dest-80},1000,'swing');hashTagActive=this.hash;}});}},detectFontFace:function(){var observer=new FontFaceObserver('Source Sans Pro','Playfair Display');observer.check().then(function(){document.documentElement.className+=" fonts-loaded";},function(){});},socialShareToggle:function(){$(document).on('click','.share-toggle',function(){$(this).toggleClass('active').parent().toggleClass('expand');});}};})(jQuery);; (function($){$.fn.shuffle=function(){return this.each(function(){var items=$(this).children().clone(true);return(items.length)?$(this).html($.shuffle(items)):this;});} $.shuffle=function(arr){for(var j,x,i=arr.length;i;j=parseInt(Math.random()*i),x=arr[--i],arr[i]=arr[j],arr[j]=x);return arr;} Drupal.behaviors.newsweek={attach:function(context,settings){var IEversion=this.detectIE();if(IEversion!==false){$('body').addClass('ie').addClass('ie-'+IEversion);} this.detectFFX();this.menuExpand();this.piano();if($('.shuffle').length){$('.shuffle').shuffle();} this.carousel();this.premierButtons();this.setSponsorHeight();this.toggleExpandableHeight();this.toggleLiveStream();},detectIE:function(){var ua=window.navigator.userAgent;var msie=ua.indexOf('MSIE ');if(msie>0){return parseInt(ua.substring(msie+5,ua.indexOf('.',msie)),10);} var trident=ua.indexOf('Trident/');if(trident>0){var rv=ua.indexOf('rv:');return parseInt(ua.substring(rv+3,ua.indexOf('.',rv)),10);} var edge=ua.indexOf('Edge/');if(edge>0){return parseInt(ua.substring(edge+5,ua.indexOf('.',edge)),10);} return false;},detectFFX:function(){if(navigator.userAgent.toLowerCase().indexOf('firefox')>-1){$('body').addClass('ffx');}},piano:function(){$(document).on('pianoLogin',function(e){$('.view1').removeClass('show').addClass('hide');$('.view2').removeClass('hide').addClass('show');$('.piano-account-email').text(e.userData.email);$('.piano-account-remaining-days').text(e.userData.remainingDays);$('.piano-account-info').show();});$(document).on('pianoLogout',function(){$('.view1').removeClass('hide').addClass('show');$('.view2').removeClass('show').addClass('hide');});$('.piano-logout').on('click',function(){if(typeof PianoMedia!='undefined'){PianoMedia.auth.logOut();}});$('.piano-login').on('click',function(){if(typeof PianoMedia!='undefined'){$('.m-expand').removeClass('active').parent().removeClass('expand');PianoMedia.box.login.toggle();Drupal.behaviors.newsweek.togglePianoLoginButton($(this));}});$('.piano-renew').on('click',function(){if(typeof PianoMedia!='undefined'){PianoMedia.box.payment.toggle();} Drupal.behaviors.newsweek.closeAll();});},togglePianoLoginButton:function(){if(typeof PianoMedia!='undefined'){var button=$('.piano-login') var loginBox=$('#'+PianoMedia.box.login.element_id);if(loginBox.length&&loginBox.is(':visible')){button.addClass('active');$('body').removeClass('menu-expand');} else{button.removeClass('active');}}},menuExpand:function(){var pageHeader=$('.page-header');var btnGlobal=$('.m-expand');var btnMenu=$('.m-expand.menu');var targetBody=$('body');if(pageHeader.length>0){pageHeader.on('click','.menu-search .m-expand',function(event){var toggle=$(this);if(toggle.hasClass('active')){toggle.removeClass('active');toggle.parent().removeClass('expand');targetBody.removeClass('menu-expand');if(targetBody.hasClass('social-display')){targetBody.removeClass('social-display');}} else{toggle.addClass('active').parent().addClass('expand');btnGlobal.not(this).removeClass('active').parent().removeClass('expand');targetBody.addClass('menu-expand');if(!targetBody.hasClass('social-display')){targetBody.addClass('social-display');}}});pageHeader.on('click','.header-meta.desktop .m-expand',function(event){var toggle=$(this);if(toggle.hasClass('piano-login')){return;} if(toggle.hasClass('active')){toggle.removeClass('active').parent().removeClass('expand');targetBody.removeClass('menu-expand');} else{toggle.addClass('active').parent().addClass('expand');btnGlobal.not(this).removeClass('active').parent().removeClass('expand');targetBody.addClass('menu-expand');}});pageHeader.on('click','.header-meta.mobile .m-expand',function(event){var toggle=$(this);if(toggle.hasClass('subscribe')){return;} targetBody.addClass('menu-expand');btnMenu.addClass('active');if(toggle.hasClass('subscribe')){$('.header-meta.desktop .header-subscribe > div').addClass('expand');} if(toggle.hasClass('edition')){$('.header-meta.desktop .header-editions').addClass('expand');} if(toggle.hasClass('user')){$('.header-meta.desktop .header-user > div').addClass('expand');}});pageHeader.on('click','.m-expand.back',function(event){var toggle=$(this);toggle.closest('.expand').removeClass('expand');btnMenu.addClass('active').parent().addClass('expand');});} $(document).click(function(event){if(typeof PianoMedia!='undefined'&&!$(event.target).closest('#'+PianoMedia.box.login.element_id).length&&!$(event.target).closest('.piano-login').length){if(typeof PianoMedia!='undefined'&&($('#'+PianoMedia.box.login.element_id).is(':visible')||$('#pnmdMobileBarContent').hasClass('pnmdMobileBarContentOpened'))){Drupal.behaviors.newsweek.closePianoLogin();}} if(!$(event.target).closest('.dropdown').length&&!$(event.target).closest('.expand').length){Drupal.behaviors.newsweek.menuCollapse();}});},closePianoLogin:function(){if(typeof PianoMedia!='undefined'&&($('#'+PianoMedia.box.login.element_id).is(':visible')||$('#pnmdMobileBarContent').hasClass('pnmdMobileBarContentOpened'))){PianoMedia.box.login.close();Drupal.behaviors.newsweek.togglePianoLoginButton();$('body').removeClass('menu-expand');}},menuCollapse:function(){$('.m-expand').not('.piano-login').removeClass('active').parent().removeClass('expand');},closeAll:function(){this.closePianoLogin();this.menuCollapse();},carousel:function(){if($.fn.owlCarousel&&$('#in_the_mag_carousel').length){var in_the_mag=$("#in_the_mag_carousel");var limit=4;var count=in_the_mag.children().length;var width=$('body').width();Drupal.behaviors.carousel_bk=in_the_mag.clone().children();if(width>=768)limit=8;if(width>=992)limit=16;if(count>limit){while(count>limit){count--;in_the_mag.children().last().remove();}} in_the_mag.owlCarousel({loop:false,autoplay:false,autoplayHoverPause:false,responsive:{0:{items:1,nav:false,dots:true,autoHeight:true,},768:{items:2,slideBy:2,nav:false,dots:true,},992:{items:4,slideBy:4,nav:true,dots:true,onInitialized:function(e){setTimeout(function(){Drupal.behaviors.newsweek.resizeCarouselNav();},100);},onResized:function(e){Drupal.behaviors.newsweek.resizeCarouselNav();},}},onResize:function(e){Drupal.behaviors.newsweek.setCarouselItems(e);},onRefresh:function(e){var visible=e.page.size;if(visible){$(e.target).find('.owl-item').each(function(key,value){if(key=768)limit=8;if(width>=992)limit=16;while(count>0){count--;$(e.target).trigger('remove.owl.carousel',1);} items=Drupal.behaviors.carousel_bk;while(count'+html+'');}},resizeCarouselNav:function(){var owlNav=$('.feature.magazine .owl-nav');var owlItemImage=$('.feature.small li:first-child .image').height();if(owlNav.length){var topPosition=owlItemImage-30;owlNav.css('top',topPosition);}},premierButtons:function(){$('.print-1mo a.premier-btn').click(function(){var pianoToggleOptions={package_id:'257',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.digital-1mo a.premier-btn').click(function(){var pianoToggleOptions={package_id:'255',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.printdigital a.premier-btn').click(function(){var pianoToggleOptions={package_id:'96',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.digital a.premier-btn').click(function(){var pianoToggleOptions={package_id:'18',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.printdigitalfull a.premier-btn').click(function(){var pianoToggleOptions={package_id:'21',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.digitalfull a.premier-btn').click(function(){var pianoToggleOptions={package_id:'19',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});$('.bluevalley a.premier-btn').click(function(){var pianoToggleOptions={package_id:'234',package_promo:'100',geo_tag:'US'};PianoMedia.box.package.toggle(pianoToggleOptions);Drupal.behaviors.newsweek.closeAll();return false;});},setSponsorHeight:function(){var sponsor=$('#block-nw-home-featured-story li.sponsor .info');if(!sponsor.length){return;} Drupal.behaviors.newsweek.calculateHeight(sponsor);$(window).on('resize',function(){Drupal.behaviors.newsweek.calculateHeight(sponsor);});},calculateHeight:function(sponsor){var windowWidth=$(window).width();if(windowWidth<768){sponsor.css('min-height','');return;} var sibling=$('#block-nw-home-featured-story li.first .info');var height=sibling.outerHeight();sponsor.css('min-height',height);},toggleExpandableHeight:function(){$('body').on('click','.expandable-toggle .toggle',function(event){var toggle=$(this).parent('.expandable-toggle');if(toggle.hasClass('active')){toggle.removeClass('active');$('.expandable').css('height','115px');} else{toggle.addClass('active');$('.expandable').css('height','auto');}});},toggleLiveStream:function(){$('.livestream-article .image').on('click',function(){$(this).parent().find('.livestream-embed').html(Drupal.settings.livestreamEmbed.code);$(this).remove();$('.feature li.large .info-wrapper').css('margin-top',0);return false;});}};})(jQuery);; (function($){Drupal.behaviors.nwSticky={elements:{},attach:function(context,settings){if($('body').hasClass('logged-in')){return;} this.init();this.stickyHeader();this.stickyAds();this.stickyVideo();this.stickySocial();},init:function(){if(!this.elements.length){var thisObj=this;this.elements.window={el:$(window)};this.elements.body={el:$('body')} this.elements.stickyhead={el:$('.stickyhead')} this.elements.header={el:$('.page-header')} this.elements.pagetop={el:$('.page-top')} this.elements.dropdown={el:$('.page-header .dropdown')} this.elements.sidebar={el:$('.page-sidebar')} this.elements.right1={el:$('#dfp-ad-right1')} this.elements.right2={el:$('#dfp-ad-right2')} this.elements.right3={el:$('#dfp-ad-right3')} this.elements.right4={el:$('#dfp-ad-right4')} this.elements.content={el:$('.article-content')} this.elements.footer={el:$('.page-footer')} this.elements.videocontent={el:$('.node-article .videocontent')} this.elements.ibt_player={el:$('.ibt_player')} this.elements.social={el:$('.sticky_social .article-social')} $(document).on('recalculate',function(){thisObj.recalculateElements();});if(typeof googletag!='undefined'){googletag.cmd.push(function(){googletag.pubads().addEventListener('slotRenderEnded',function(event){$.event.trigger({type:'recalculate'});$.event.trigger({type:'reposition'});});});} $(window).on('scroll',function(){$.event.trigger({type:'reposition'});});$(window).on('resize',function(){$.event.trigger({type:'recalculate'});$.event.trigger({type:'reposition'});});$(document).on('breaking_news_open breaking_news_close',function(){$.event.trigger({type:'recalculate'});$.event.trigger({type:'reposition'});});$.event.trigger({type:'recalculate'});$.event.trigger({type:'reposition'});}},recalculateElements:function(){var el;var fixed=false;this.elements.window.height=this.elements.window.el.height();this.elements.window.width=this.elements.window.el.width();this.elements.stickyhead=this.setItemAttributes(this.elements.stickyhead);this.elements.header=this.setItemAttributes(this.elements.header);this.elements.pagetop=this.setItemAttributes(this.elements.pagetop);this.elements.dropdown=this.setItemAttributes(this.elements.dropdown);this.elements.sidebar=this.setItemAttributes(this.elements.sidebar);this.elements.right1=this.setItemAttributes(this.elements.right1);this.elements.right2=this.setItemAttributes(this.elements.right2);this.elements.right3=this.setItemAttributes(this.elements.right3);this.elements.right4=this.setItemAttributes(this.elements.right4);this.elements.content=this.setItemAttributes(this.elements.content);this.elements.footer=this.setItemAttributes(this.elements.footer);this.elements.videocontent=this.setItemAttributes(this.elements.videocontent);this.elements.ibt_player=this.setItemAttributes(this.elements.ibt_player);this.elements.social=this.setItemAttributes(this.elements.social);},setItemAttributes:function(item){var el;var fixed=false;var absolute=false;el=item.el;if(!el.length){return item;} if(el.hasClass('fixed')){fixed=true;el.removeClass('fixed');} if(el.hasClass('absolute')){absolute=true;el.removeClass('absolute');} item.height=el.length?el.outerHeight(true):0;item.width=el.length?el.width():0;item.left=el.length?el.offset().left:0;item.top=el.length?el.offset().top:0;if(fixed){el.addClass('fixed');} if(absolute){el.addClass('absolute');} return item;},isMobile:function(){return(/android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent.toLowerCase()));},stickyAds:function(){var thisObj=this;var body=thisObj.elements.body.el;if(body.hasClass('locked-content')||thisObj.isMobile()==true){return;} if(body.hasClass('standard-article')){$(document).on('reposition',function(){thisObj.standardStickyAds();});} if(body.hasClass('magazine-article')){$(document).on('reposition',function(){thisObj.featuredStickyAds();});}},unstickObj:function(obj){obj.parent().css('min-height','');obj.removeClass('fixed absolute').css({'top':'','left':'','width':''});},standardStickyAds:function(){var thisObj=this;var sticky1=thisObj.elements.right1;var right1=sticky1.el;var sticky2=thisObj.elements.right2;var right2=sticky2.el;var sticky3=thisObj.elements.right3;var right3=sticky3.el;var sticky4=thisObj.elements.right4;var right4=sticky4.el;if(thisObj.elements.window.width<992){thisObj.unstickObj(right1);thisObj.unstickObj(right2);thisObj.unstickObj(right3);thisObj.unstickObj(right4);return;} var body=thisObj.elements.body.el;var right1_t=sticky1.top;var right1_l=sticky1.left;var right1_w=sticky1.width;var right1_h=sticky1.height;var right2_t=sticky2.top;var right2_l=sticky2.left;var right2_w=sticky2.width;var right2_h=sticky2.height;var right3_t=sticky3.top;var right3_l=sticky3.left;var right3_w=sticky3.width;var right3_h=sticky3.height;var right4_t=sticky4.top;var right4_l=sticky4.left;var right4_w=sticky4.width;var right4_h=sticky4.height;if(!body.hasClass('ds0')){var offset=thisObj.elements.stickyhead.height;var position=offset-14;} else{var offset=thisObj.elements.header.height;var position=offset;} var st=thisObj.elements.window.el.scrollTop()+offset;var start1=right1_t+18;var start2=right2_t+18;var start3=right3_t+18;var start4=right4_t+18;var stop1=right2_t-right1_h;var stop2=right3_t-right2_h;var stop3=right4_t-right4_h;var stop4=thisObj.elements.footer.top-right4_h;if(st>start1){if(!body.hasClass('ds1')){right1.parent().css('min-height',right1_h);right1.addClass('fixed').css({'top':position,'left':right1_l,'width':right1_w});} if(st>stop1){thisObj.unstickObj(right1);if(!right1.hasClass('sticky')){body.addClass('ds1');}}} else{thisObj.unstickObj(right1);} if(st>start2){if(!body.hasClass('ds2')){right2.parent().css('min-height',right2_h);right2.addClass('fixed').css({'top':position,'left':right2_l,'width':right2_w});} if(st>stop2){thisObj.unstickObj(right2);if(!right2.hasClass('sticky')){body.addClass('ds2');}}} else{thisObj.unstickObj(right2);} if(st>start3){if(!body.hasClass('ds3')){right3.parent().css('min-height',right3_h);right3.addClass('fixed').css({'top':position,'left':right3_l,'width':right3_w});} if(st>stop3){thisObj.unstickObj(right3);if(!right3.hasClass('sticky')){body.addClass('ds3');}}} else{thisObj.unstickObj(right3);} if(st>start4){if(!body.hasClass('ds4')){right4.parent().css('min-height',right4_h);right4.addClass('fixed').css({'top':position,'left':right4_l,'width':right4_w});} if(st>stop4){thisObj.unstickObj(right4);if(!right4.hasClass('sticky')){body.addClass('ds4');}}} else{thisObj.unstickObj(right4);}},featuredStickyAds:function(){var thisObj=this;var sticky1=thisObj.elements.right1;var right1=sticky1.el;var sticky2=thisObj.elements.right2;var right2=sticky2.el;var sticky3=thisObj.elements.right3;var right3=sticky3.el;var sticky4=thisObj.elements.right4;var right4=sticky4.el;if(thisObj.elements.window.width<992){thisObj.unstickObj(right1);thisObj.unstickObj(right2);thisObj.unstickObj(right3);thisObj.unstickObj(right4);return;} var body=thisObj.elements.body.el;var right1_t=sticky1.top;var right1_l=sticky1.left;var right1_w=sticky1.width;var right1_h=sticky1.height;var right2_t=sticky2.top;var right2_l=sticky2.left;var right2_w=sticky2.width;var right2_h=sticky2.height;var right3_t=sticky3.top;var right3_l=sticky3.left;var right3_w=sticky3.width;var right3_h=sticky3.height;var right4_t=sticky4.top;var right4_l=sticky4.left;var right4_w=sticky4.width;var right4_h=sticky4.height;if(!body.hasClass('ds0')){var offset=thisObj.elements.stickyhead.height;var position=offset-14;} else{var offset=thisObj.elements.header.height;var position=offset;} var st=thisObj.elements.window.el.scrollTop()+offset;var start1=right1_t+18;var start2=right2_t+18;var start3=right3_t+18;var start4=right4_t+18;var stop1=right2_t-right1_h;var stop2=right3_t-right2_h;var stop3=right4_t-right3_h;var stop4=thisObj.elements.content.top+thisObj.elements.content.height-right4_h;var parallax2=right2.closest('aside').nextAll('p.parallax:first');var parallax3=right3.closest('aside').nextAll('p.parallax:first');var parallax4=right4.closest('aside').nextAll('p.parallax:first');var parallax2_t=0;var parallax3_t=0;var parallax4_t=0;if(parallax2.length>0){parallax2_t=parallax2.offset().top;} if(parallax3.length>0){parallax3_t=parallax3.offset().top;} if(parallax4.length>0){parallax4_t=parallax4.offset().top;} if(parallax2_t>0&¶llax2_t0&¶llax3_t0&¶llax4_tstart1){right1.parent().css('min-height',right1_h);if(ststart2){right2.parent().css('min-height',right2_h);if(ststart3){right3.parent().css('min-height',right3_h);if(ststart4){right4.parent().css('min-height',right4_h);if(st0){$(document).on('reposition',function(e){if(body.hasClass('standard-article')||body.hasClass('featured-article')){thisObj.triggerStickTopAd();} else{thisObj.fixedHeader();} thisObj.triggerDropdown();});}},fixedHeader:function(){var thisObj=this;var body=thisObj.elements.body.el;var header=thisObj.elements.header.el;var header_h=thisObj.elements.header.height;header.addClass('fixed');body.css('padding-top',header_h);},triggerStickTopAd:function(){var thisObj=this;var body=thisObj.elements.body.el;var stickyhead=thisObj.elements.stickyhead.el;var stickhead_h=thisObj.elements.stickyhead.height;if(!body.hasClass('ds0')){if(thisObj.elements.pagetop.el.length){stickyhead.addClass('fixed');body.css('padding-top',stickhead_h);setTimeout(function(){stickyhead.removeClass('fixed');thisObj.fixedHeader();body.addClass('ds0');},15000);}} else{stickyhead.removeClass('fixed');thisObj.fixedHeader();}},triggerDropdown:function(){var thisObj=this;var dropdown=thisObj.elements.dropdown.el;var dropdown_h=thisObj.elements.window.height-61;if(thisObj.elements.window.width<768){dropdown.css({'height':dropdown_h,'overflow-y':'scroll'});} else{dropdown.css({'height':'','overflow-y':''});}},stickyVideo:function(){var thisObj=this;var body=thisObj.elements.body.el;var obj=thisObj.elements.videocontent.el;if(thisObj.elements.videocontent.el.length){$(document).on('reposition',function(){var closePlayer=$('.close-fusion-jwplayer');if(thisObj.elements.window.width<992||thisObj.isMobile()==true){closePlayer.addClass('hide').hide();thisObj.unstickObj(obj);return;} var obj_t=thisObj.elements.videocontent.top;var obj_h=thisObj.elements.videocontent.height;var start=obj_t+obj_h/2;if(!body.hasClass('ds0')){var offset=thisObj.elements.stickyhead.height;} else{var offset=thisObj.elements.header.height;} var st=thisObj.elements.window.el.scrollTop()+offset;if(st>start){if(!body.hasClass('ds5')){obj.parent().css('min-height',obj_h);obj.addClass('fixed');closePlayer.removeClass('hide');if(body.hasClass('standard-article')){if(jwplayer("fusion_jwplayer").getPosition()>=10){closePlayer.show();} else{if(!body.hasClass('ds6')){closePlayer.hide();jwplayer("fusion_jwplayer").on('firstFrame',function(){closePlayer.delay(1000).fadeIn(100);body.addClass('ds6');});}}} else{if(!body.hasClass('ds6')){closePlayer.hide();setTimeout(function(){closePlayer.show();body.addClass('ds6');},30000);} else{closePlayer.show();}} closePlayer.click(function(){if(body.hasClass('standard-article')){jwplayer("fusion_jwplayer").pause(true);} body.addClass('ds5');closePlayer.addClass('hide').hide();thisObj.unstickObj(obj);if(typeof ga!='undefined'){ga('send','event','JW Player Video','close button');}});} if(thisObj.elements.ibt_player.el.children().length>0){thisObj.elements.ibt_player.el.addClass('stuck');}} else{closePlayer.addClass('hide').hide();thisObj.unstickObj(obj);if(thisObj.elements.ibt_player.el.children().length>0){thisObj.elements.ibt_player.el.removeClass('stuck');}}});}},stickySocial:function(){var thisObj=this;var body=thisObj.elements.body.el;var obj=thisObj.elements.social.el;if(obj.length>0){$(document).on('reposition',function(){if(thisObj.elements.window.width<768||body.hasClass('node-type-ranking-table')){thisObj.unstickObj(obj);return;} var obj_t=thisObj.elements.social.top;var obj_l=thisObj.elements.social.left;var obj_w=thisObj.elements.social.width;var obj_h=thisObj.elements.social.height;var start=obj_t;var content_t=thisObj.elements.content.top;var content_h=thisObj.elements.content.height;var stop=content_t+content_h-obj_h-35;if(!body.hasClass('ds0')){var offset=thisObj.elements.stickyhead.height+35;} else{var offset=thisObj.elements.header.height+35;} var st=thisObj.elements.window.el.scrollTop()+offset;if(st>start){if(st