function SetNavTagsWidth(){var r=$(".subnav").width(),n,t,i,u;r!=subNavWidth&&(subNavWidth=r,n=0,$(".subnav h4").length>0&&(n=$(".subnav h4").width()),t=0,$(".subnav .sponsor").length>0&&(t=$(".subnav .sponsor").width()),i=0,$(".subnav .popTagArrow").length>0&&(i=$(".subnav .popTagArrow").width()),u=subNavWidth-n-t-i-100,$(".subnav .navTags").removeAttr("style").attr("style","width:"+u+"px"))}function SetContentWellItemsWidth(){var n,i,r,f,e,o,s,h,c,l,u;if($(".contentWell").length>0&&(n=$(".contentWell").width(),n!=contentWellWidth)){if(contentWellWidth=n,$(".contentWell .article .segment .heroTop img, .contentWell .article .segment .heroBottom img").each(function(){var t=n,i,r;$(this).hasClass("hasPaddingTrue")&&(t=t-16),$(this).removeAttr("style").attr("style","max-width:"+t+"px;height:auto;"),$(this).parent().attr("rev")=="colorbox"&&(i=$(this).parent().attr("id").split("_"),i.length==2&&(r=i[1],t=$(this).width(),r<=t&&$(this).unwrap()))}),$(".article .segment .articleGallery .galleryItem .mainPhoto").length>0&&(i=parseInt(contentWellWidth)-150,$(".article .segment .articleGallery .galleryItem .mainPhoto").removeAttr("style").attr("style","height:"+i+"px"),$(".article .segment .articleGallery .galleryItem .mainPhoto img").each(function(){if($(this).attr("name")!=null){var n=$(this).attr("name").split("_"),t=parseInt(n[0]),r=parseInt(n[1]);t>=r?$(this).removeAttr("style").attr("style","max-width:"+contentWellWidth+"px;height:auto;"):$(this).removeAttr("style").attr("style","max-height:"+i+"px;width:auto;")}})),$(".sideNavigation").length>0&&(r=$(".sideNavigation").width(),$(".article.withSideNav").length>0&&(f=parseInt(contentWellWidth)-parseInt(r)-52,$(".article.withSideNav").attr("style","width:"+f+"px;")),$(".section .withSideNav").length>0&&(e=parseInt(contentWellWidth)-parseInt(r)-52,$(".section .withSideNav").removeAttr("style").attr("style","width:"+e+"px;"))),$(".gallery .display .right").length>0&&(o=$(".gallery .display .left").width(),s=$(".gridRow .gallery").width()-o-20,$(".gallery .display .right").attr("style","width:"+s+"px")),$(".section .withSponsor").length>0&&(h=$(".section .sectionSponsor").width(),c=parseInt(contentWellWidth)-parseInt(h)-50,$(".section .withSponsor").removeAttr("style").attr("style","width:"+c+"px;")),$("body").width()<=450){if($(".header .logo").length>0){l=$(".gridRow").width()-80,$(".header .logo img").removeAttr("style").attr("style","width:"+l+"px;height:auto;");var y=$(".header").height(),p=$(".header .logo").height(),w=(y-p)/2;$(".header .logo").removeAttr("style").attr("style","margin-top:"+w+"px;")}}else $(".header .logo img").removeAttr("style"),$(".header .logo").removeAttr("style");if($(".homepage .sortContainer").length>0){u=3,$("body").width()<=500&&(u=2);var b=$(".homepage .sortContainer .center").width(),a=b/u,k=a-12;$(".homepage .sortContainer .center .sliderContainer .thumbContainer .thumb").removeAttr("style").attr("style","width:"+a+"px;"),$(".homepage .sortContainer .center .sliderContainer .thumbContainer .thumb .thumbBg").removeAttr("style").attr("style","width:"+k+"px;")}if($(".homepageSlider .mainContainer .sliderContainer").length>0&&$("body").width()>650){var d=$(".homepageSlider .mainContainer").width(),t=(d-5)/2,g=t+5,v=(t-5)/2;$(".homepageSlider .mainContainer .sliderContainer .thumbContainer .thumb").removeAttr("style").attr("style","width:"+g+"px;"),$(".homepageSlider .mainContainer .sliderContainer .thumbContainer .thumbBg").removeAttr("style").attr("style","width:"+t+"px;"),$(".homepageSlider .mainContainer .sliderContainer .thumbContainer .thumbBg.double .item").removeAttr("style").attr("style","width:"+v+"px;"),$(".homepageSlider .mainContainer .sliderContainer .thumbContainer .thumbBg.single img").removeAttr("style").attr("style","width:"+t+"px;height:auto;"),$(".homepageSlider .mainContainer .sliderContainer .thumbContainer .thumbBg.double img").removeAttr("style").attr("style","width:"+v+"px;height:auto;")}}}function SetContentWellItemsHeight(){var i,t,n,r,u;$(".contentWell").length>0&&(i=$(".contentWell").height(),i!=contentWellHeight&&(contentWellHeight=i,$(".homepage").length>0&&$(".gallerySlider").length>0&&(t=$(".rightColumn").height(),n=0,$(".ladder").length>0&&(n=$(".ladder").height()),parseInt(contentWellHeight)>parseInt(t)&&parseInt(contentWellHeight)>parseInt(n)?$(".gallerySlider").removeAttr("style").attr("style","margin-top:35px;"):(r=t,parseInt(n)>parseInt(t)&&(r=n),u=parseInt(r)-parseInt(contentWellHeight),$(".gallerySlider").removeAttr("style").attr("style","margin-top:-"+u+"px;")))))}function SetNewOnDiscover(){var t="/sitefiles/resources/search.ashx",r='(publish_date:[* TO NOW] AND unpublish_date:[* TO NOW]) AND ((sitecore_item:true AND rss_included:true AND flag_names:"Feature") OR (wordpress_item:true AND (topic_names:"select" OR topic_names:"top posts")))',u={fq:r,pageSize:5,sortBy:"publish_date"},f=jQuery.param(u),n;$.ajax({type:"POST",dataType:"json",data:f,url:t,error:function(){},success:function(t){t!=null&&(n=t.response.docs)},complete:function(){var t,u,r;if(n!=null&&n.length>0){for(t="",i=0;i<n.length;i++)u="",i==n.length-1&&(u="border-bottom:none;"),r="",r=n[i].wordpress_item?"http://"+n[i].url:n[i].url,t+='<div class="dataItem" style="'+u+'">',t+='<a href="'+r+'">'+n[i].title+"<\/a>",t+="<\/div>";$(".ladder .newDiscover .content").html(t)}}})}function onHeaderSearchBoxKeyPress(n){var t=n.which?n.which:event.keyCode;if(t==13)return $(".header .searchBox .searchButton a").length>0&&$(".header .searchBox .searchButton a").click(),!1}function onBasementNewsletterKeyPress(n){var t=n.which?n.which:event.keyCode;if(t==13)return $(".basement .newsletter .button.normal a").length>0&&$(".basement .newsletter .button.normal a").click(),!1}function onPopupSearchBoxKeyPress(n){var t=n.which?n.which:event.keyCode;if(t==13)return $(".navbar .searchPopup td a").length>0&&$(".navbar .searchPopup td a").click(),!1}function showPopTags(n){$("#"+n).length>0&&$("#"+n).slideDown("fast")}function hidePopTags(n){$("#"+n).length>0&&$("#"+n).slideUp("fast")}function SetupMobileLoginLogic(){var n=$("#hfIsLoggedIn").val().toLowerCase(),t=$("#hfLoggedOutUrl").val(),i=$(".gearMenu ul li  a.login"),r=$(".gearMenu ul li a.logout");n=="false"?$(i).show():$(r).attr("href",t).show()}function SetNavHover(n,t,i,r){$(n).hasClass(i)||($(n).addClass(i),$(t).show(),r!=""&&$(r).addClass("hideEdge"))}function ClearNavHover(n,t,i,r){topicSwatch!=i&&($(n).removeClass(i),$(t).hide(),r!=""&&$(r).removeClass("hideEdge"))}function SetNavTopicArticles(n,t){var f=".navbar .navhover."+n+" .columnOne",e=".navbar .navhover."+n+" .columnTwo ul",r=$(".hfNavCDN").val(),o='sitecore_item:true AND topic_ids:"'+t+'" AND template_name:"article" AND publish_date:[* TO NOW] AND unpublish_date:[* TO NOW] AND NOT flag_names:"Advertisement"',s=jQuery.param({fq:o,pageSize:1,sortBy:"publish_date"}),u;$.ajax({type:"GET",dataType:"json",data:s,url:"/sitefiles/resources/search.ashx",error:function(){},success:function(n){var i,t,o,e;n!=null&&n.response!=null&&n.response.docs.length>0&&(i=n.response.docs[0],t="",u=i.id,i.media_items_raw!=null&&i.media_items_raw.length>0&&(o=i.media_items_raw[0].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),t+='<div class="previewImage">',t+='<a href="'+i.url+'">',t+=r==""?'<img src="/~/media/'+o+'.jpg?mw=395" alt="" />':'<img src="'+r+"/~/media/"+o+'.jpg?mw=395" alt="" />',t+="<\/a>",t+="<\/div>"),t+='<h1><a href="'+i.url+'">'+i.title+"<\/a><\/h1>",t+='<div class="snippet">',e=i.snippet,e!=null&&e.length>250&&(e=e.substring(0,250)+"..."),e!=null&&(t+=e),t+="<\/div>",$(f).html(t))},complete:function(){var h=$(".navbar .navhover."+n+" .columnTwo .wpCategories").val(),o=h.split("|"),f="(",s,r;for(f+='(sitecore_item:true AND topic_ids:"'+t+'") OR ',f+="((wordpress_item:true) AND (",i=0;i<o.length;i++)f+='topic_names:"'+o[i]+'"',i!=o.length-1&&(f+=" OR ");f+='))) AND (publish_date:[* TO NOW]) AND (unpublish_date:[* TO NOW]) AND NOT flag_names:"Advertisement"',s=jQuery.param({fq:f,pageSize:10,sortBy:"publish_date"}),$.ajax({type:"GET",dataType:"json",data:s,url:"/sitefiles/resources/search.ashx",error:function(){},success:function(n){n!=null&&n.response!=null&&n.response.docs.length>0&&(r=n.response.docs)},complete:function(){var n,t,f;if(r!=null&&r.length>0){for(n="",t=0,i=0;i<r.length;i++)r[i].id!=u&&t<5&&(f=r[i].url,r[i].wordpress_item&&(f="http://"+r[i].url),n+="<li>",n+='<a href="'+f+'">'+r[i].title+"<\/a>",n+="<\/li>",t++);$(e).append(n)}}})}})}function SetNavGalleries(){var r=".navbar .navhover.photosSwatch .columnOne",u=".navbar .navhover.photosSwatch .columnTwo .navPhotoContent",f="sitecore_item:true AND template_name:gallery AND publish_date:[* TO NOW] AND unpublish_date:[* TO NOW]",e=jQuery.param({fq:f,pageSize:10,sortBy:"publish_date"}),n,t=$(".hfNavCDN").val();$.ajax({type:"GET",dataType:"json",data:e,url:"/sitefiles/resources/search.ashx",error:function(){},success:function(t){t!=null&&t.response!=null&&(n=t.response.docs)},complete:function(){var f,s,o,e,h;if(n!=null&&n.length>0){for(f="",f+='<div class="previewImage">',n[0].media_items_raw!=null&&n[0].media_items_raw.length>0&&(s="",s=n[0].media_items_raw[0].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),s!=""&&(f+='<a href="'+n[0].url+'">',f+=t==""?'<img src="/~/media/'+s+'.jpg?mw=395" alt="" />':'<img src="'+t+"/~/media/"+s+'.jpg?mw=395" alt="" />',f+="<\/a>")),f+="<\/div>",f+='<h1><a href="'+n[0].url+'">'+n[0].title+"<\/a><\/h1>",o=n[0].snippet,o!=null&&o.length>250&&(o=o.substring(0,250)+"..."),f+='<div class="snippet">',o!=null&&(f+=o),f+="<\/div>",$(r).html(f),e="",i=0;i<n.length;i++)i>0&&(e+='<div class="galleryThumbContainer">',e+='<div class="galleryThumbBg">',e+='<a href="'+n[i].url+'">',e+='<table width="100%" cellspacing="0" cellpadding="0" style="height:100%;"><tr><td align="center" valign="middle">',n[i].media_items_raw!=null&&n[i].media_items_raw.length>0&&(h="",h=n[i].media_items_raw[0].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),e+=t==""?'<img src="/~/media/'+h+'.jpg?mw=135" alt="" />':'<img src="'+t+"/~/media/"+h+'.jpg?mw=135" alt="" />'),e+="<\/td><\/tr><\/table>",e+="<\/a>",e+="<\/div><\/div>");$(u).html(e)}}})}function SetNavBlogs(){var t=".navbar .navhover.blogsSwatch .columnOne",r=".navbar .navhover.blogsSwatch .columnTwo ul",u="wordpress_item:true",f=jQuery.param({fq:u,pageSize:6,sortBy:"publish_date"}),n;$.ajax({type:"GET",dataType:"json",data:f,url:"/sitefiles/resources/search.ashx",error:function(){},success:function(t){t!=null&&t.response!=null&&(n=t.response.docs)},complete:function(){var u,e,s,h,c,f,o;if(n!=null&&n.length>0){for(u="",e=null,n[0].media_override!=null?e=n[0].media_override:n[0].media_items!=null&&n[0].media_items.length>0&&(e=n[0].media_items[0]),e!=null&&(s="/-/rp/"+e.substring(7)+(e.indexOf("?")!=-1?"&":"?")+"mw=400",u+='<div class="previewImage">',u+='<a href="http://'+n[0].url+'">',u+='<img src="'+s+'" alt="" />',u+="<\/a><\/div>"),n[0].parent_item_name!=null&&(h=n[0].parent_item_name.split("|")[0],c=n[0].parent_item_name.split("|")[1],u+='<h6><a href="'+c+'">'+h+"<\/a><\/h6>"),u+='<h1><a href="http://'+n[0].url+'">'+n[0].title+"<\/a><\/h1>",f=n[0].snippet,f!=null&&f.length>100&&(f=f.substring(0,100)+"..."),u+='<div class="snippet">',f!=null&&(u+=f),u+="<\/div>",$(t).html(u),o="",i=0;i<n.length;i++)i>0&&(o+="<li>",o+='<a href="http://'+n[i].url+'">'+n[i].title+"<\/a>",o+="<\/li>");$(r).html(o)}}})}function SetTwitterFeed(){var t="",r,n;for(i=0;i<twitterFeedData.length;i++)if(i<5){for(r="",(i==twitterFeedData.length-1||i==4)&&(r="border-bottom:none;"),t+='<div class="feedItem" style="'+r+'">',n=twitterFeedData[i].text.split(" "),s=0;s<n.length;s++)t+=n[s].indexOf("http://")>-1||n[s].indexOf("https://")>-1?'<a href="'+n[s]+'" target="_blank">'+n[s]+"<\/a>":n[s],s!=n.length-1&&(t+=" ");t+="<\/div>"}$(".ladder .twitterFeed .content").html(t)}function articlePage(n){var r=$("#hfArticlePage").val(),u=$("#pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$("#articlePage"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".article h1").offset().top},{duration:"fast",easing:"swing"}),$("#articlePage"+t).fadeIn(),$(".pagePrevContainer").show(),$("#pagerCurrent").text(t),$("#hfArticlePage").val(t),t==u&&$(".pageNextContainer").hide(),googletag.pubads().refresh([dfpSlotLeader,dfpSlotMedium1,dfpSlotMedium2,dfpSlotSkyscraper,dfpSlotSponsor])})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$("#articlePage"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".article h1").offset().top},{duration:"fast",easing:"swing"}),$("#articlePage"+i).fadeIn(),$(".pageNextContainer").show(),$("#pagerCurrent").text(i),$("#hfArticlePage").val(i),i==1&&$(".pagePrevContainer").hide(),googletag.pubads().refresh([dfpSlotLeader,dfpSlotMedium1,dfpSlotMedium2,dfpSlotSkyscraper,dfpSlotSponsor])}))}function issuePage(n){var r=$("#hfIssuePage").val(),u=$("#pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$("#issueDataPage"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".issue .bottomRow h3").offset().top},{duration:"fast",easing:"swing"}),$("#issueDataPage"+t).fadeIn(),$(".pagePrevContainer").show(),$("#pagerCurrent").text(t),$("#hfIssuePage").val(t),t==u&&$(".pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$("#issueDataPage"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".issue .bottomRow h3").offset().top},{duration:"fast",easing:"swing"}),$("#issueDataPage"+i).fadeIn(),$(".pageNextContainer").show(),$("#pagerCurrent").text(i),$("#hfIssuePage").val(i),i==1&&$(".pagePrevContainer").hide()}))}function topicMagazinePage(n){var r=$("#hfTopicMagazinePage").val(),u=$(".pager.magHighlights .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".topic .magazineHighlights #magFeature"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".topic .magazineHighlights").offset().top-50},{duration:"fast",easing:"swing"}),$(".topic .magazineHighlights #magFeature"+t).fadeIn(),$(".pager.magHighlights .pagePrevContainer").show(),$(".pager.magHighlights .pagerCurrent").text(t),$("#hfTopicMagazinePage").val(t),t==u&&$(".pager.magHighlights .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$(".topic .magazineHighlights #magFeature"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".topic .magazineHighlights").offset().top-50},{duration:"fast",easing:"swing"}),$(".topic .magazineHighlights #magFeature"+i).fadeIn(),$(".pager.magHighlights .pageNextContainer").show(),$(".pager.magHighlights .pagerCurrent").text(i),$("#hfTopicMagazinePage").val(i),i==1&&$(".pager.magHighlights .pagePrevContainer").hide()}))}function topicFeaturePage(n){var r=$("#hfTopicFeaturePage").val(),u=$(".pager.features .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".topic .featured #topicFeature"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".topic .featured").offset().top-50},{duration:"fast",easing:"swing"}),$(".topic .featured #topicFeature"+t).fadeIn(),$(".pager.features .pagePrevContainer").show(),$(".pager.features .pagerCurrent").text(t),$("#hfTopicFeaturePage").val(t),t==u&&$(".pager.features .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$(".topic .featured #topicFeature"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".topic .featured").offset().top-50},{duration:"fast",easing:"swing"}),$(".topic .featured #topicFeature"+i).fadeIn(),$(".pager.features .pageNextContainer").show(),$(".pager.features .pagerCurrent").text(i),$("#hfTopicFeaturePage").val(i),i==1&&$(".pager.features .pagePrevContainer").hide()}))}function gallerySliderPage(n){var t=$("#hfGallerySliderPosition").val(),o=$(".gallerySlider .slider .center").width(),s=$(".gallerySlider .slider .center .thumb").length,u=$(".gallerySlider .slider .center .thumb").width(),a=$(".gallerySlider .slider .center .thumbContainer").width(),i=Math.round(parseInt(o)/parseInt(u)),h,c,f,l,r,e;n=="next"?parseInt(a)>parseInt(o)&&(h=parseInt(i)*parseInt(t),s>h&&(c=parseInt(u)*parseInt(i)*t,$(".gallerySlider .slider .center .sliderContainer .thumbContainer").animate({left:"-"+c}),f=parseInt(t)+1,$("#hfGallerySliderPosition").val(f),l=parseInt(i)*parseInt(f),s<=l&&$(".gallerySlider .slider .right").fadeTo(0,.3),$(".gallerySlider .slider .left").fadeTo(0,1))):n=="prev"&&parseInt(t)>1&&(r=parseInt(t)-1,$("#hfGallerySliderPosition").val(r),e=parseInt(u)*parseInt(i)*(parseInt(r)-1),parseInt(e)>0?$(".gallerySlider .slider .center .sliderContainer .thumbContainer").animate({left:"-"+e}):$(".gallerySlider .slider .center .sliderContainer .thumbContainer").animate({left:"0"}),r==1&&$(".gallerySlider .slider .left").fadeTo(0,.3),$(".gallerySlider .slider .right").fadeTo(0,1))}function issueSliderPage(n){var t=$("#hfIssueSliderPosition").val(),o=$(".issueSlider .slider .center").width(),s=$(".issueSlider .slider .center .thumb").length,u=$(".issueSlider .slider .center .thumb").width(),a=$(".issueSlider .slider .center .thumbContainer").width(),i=Math.round(parseInt(o)/parseInt(u)),h,c,f,l,r,e;n=="next"?parseInt(a)>parseInt(o)&&(h=parseInt(i)*parseInt(t),s>h&&(c=parseInt(u)*parseInt(i)*t,$(".issueSlider .slider .center .sliderContainer .thumbContainer").animate({left:"-"+c}),f=parseInt(t)+1,$("#hfIssueSliderPosition").val(f),l=parseInt(i)*parseInt(f),s<=l&&$(".issueSlider .slider .right").fadeTo(0,.3),$(".issueSlider .slider .left").fadeTo(0,1))):n=="prev"&&parseInt(t)>1&&(r=parseInt(t)-1,$("#hfIssueSliderPosition").val(r),e=parseInt(u)*parseInt(i)*(parseInt(r)-1),parseInt(e)>0?$(".issueSlider .slider .center .sliderContainer .thumbContainer").animate({left:"-"+e}):$(".issueSlider .slider .center .sliderContainer .thumbContainer").animate({left:"0"}),r==1&&$(".issueSlider .slider .left").fadeTo(0,.3),$(".issueSlider .slider .right").fadeTo(0,1))}function relatedGallerySliderPage(n){var t=$("#hfRelatedGalleriesSliderPosition").val(),o=$(".relatedGalleries .slider .center").width(),s=$(".relatedGalleries .slider .center .thumb").length,u=$(".relatedGalleries .slider .center .thumb").width(),a=$(".relatedGalleries .slider .center .thumbContainer").width(),i=Math.round(parseInt(o)/parseInt(u)),h,c,f,l,r,e;n=="next"?parseInt(a)>parseInt(o)&&(h=parseInt(i)*parseInt(t),s>h&&(c=parseInt(u)*parseInt(i)*t,$(".relatedGalleries .slider .center .sliderContainer .thumbContainer").animate({left:"-"+c}),f=parseInt(t)+1,$("#hfRelatedGalleriesSliderPosition").val(f),l=parseInt(i)*parseInt(f),s<=l&&$(".relatedGalleries .slider .right").fadeTo(0,.3),$(".relatedGalleries .slider .left").fadeTo(0,1))):n=="prev"&&parseInt(t)>1&&(r=parseInt(t)-1,$("#hfRelatedGalleriesSliderPosition").val(r),e=parseInt(u)*parseInt(i)*(parseInt(r)-1),parseInt(e)>0?$(".relatedGalleries .slider .center .sliderContainer .thumbContainer").animate({left:"-"+e}):$(".relatedGalleries .slider .center .sliderContainer .thumbContainer").animate({left:"0"}),r==1&&$(".relatedGalleries .slider .left").fadeTo(0,.3),$(".relatedGalleries .slider .right").fadeTo(0,1))}function relatedArticlesSliderPage(n){var t=$("#hfRelatedArticlesSliderPosition").val(),o=$(".relatedArticles .slider .center").width(),s=$(".relatedArticles .slider .center .thumb").length,u=$(".relatedArticles .slider .center .thumb").width(),a=$(".relatedArticles .slider .center .thumbContainer").width(),i=Math.round(parseInt(o)/parseInt(u)),h,c,f,l,r,e;n=="next"?parseInt(a)>parseInt(o)&&(h=parseInt(i)*parseInt(t),s>h&&(c=parseInt(u)*parseInt(i)*t,$(".relatedArticles .slider .center .sliderContainer .thumbContainer").animate({left:"-"+c}),f=parseInt(t)+1,$("#hfRelatedArticlesSliderPosition").val(f),l=parseInt(i)*parseInt(f),s<=l&&$(".relatedArticles .slider .right").fadeTo(0,.3),$(".relatedArticles .slider .left").fadeTo(0,1))):n=="prev"&&parseInt(t)>1&&(r=parseInt(t)-1,$("#hfRelatedArticlesSliderPosition").val(r),e=parseInt(u)*parseInt(i)*(parseInt(r)-1),parseInt(e)>0?$(".relatedArticles .slider .center .sliderContainer .thumbContainer").animate({left:"-"+e}):$(".relatedArticles .slider .center .sliderContainer .thumbContainer").animate({left:"0"}),r==1&&$(".relatedArticles .slider .left").fadeTo(0,.3),$(".relatedArticles .slider .right").fadeTo(0,1))}function homepageMagazinePage(n){var r=$("#hfHomepageMagPage").val(),u=$(".homepage .magHighlights .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".homepage .magHighlights .data .page"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".homepage .magHighlights").offset().top-50},{duration:"fast",easing:"swing"}),$(".homepage .magHighlights .data .page"+t).fadeIn(),$(".homepage .magHighlights .pagePrevContainer").show(),$(".homepage .magHighlights .pagerCurrent").text(t),$("#hfHomepageMagPage").val(t),t==u&&$(".homepage .magHighlights .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$(".homepage .magHighlights .data .page"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".homepage .magHighlights").offset().top-50},{duration:"fast",easing:"swing"}),$(".homepage .magHighlights .data .page"+i).fadeIn(),$(".homepage .magHighlights .pageNextContainer").show(),$(".homepage .magHighlights .pagerCurrent").text(i),$("#hfHomepageMagPage").val(i),i==1&&$(".homepage .magHighlights .pagePrevContainer").hide()}))}function homepageFeaturePage(n){var r=$("#hfHomepageFeaturePage").val(),u=$(".homepage .featured .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".homepage .featured .data .page"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".homepage .featured").offset().top-50},{duration:"fast",easing:"swing"}),$(".homepage .featured .data .page"+t).fadeIn(),$(".homepage .featured .pagePrevContainer").show(),$(".homepage .featured .pagerCurrent").text(t),$("#hfHomepageFeaturePage").val(t),t==u&&$(".homepage .featured .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>0&&$(".homepage .featured .data .page"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".homepage .featured").offset().top-50},{duration:"fast",easing:"swing"}),$(".homepage .featured .data .page"+i).fadeIn(),$(".homepage .featured .pageNextContainer").show(),$(".homepage .featured .pagerCurrent").text(i),$("#hfHomepageFeaturePage").val(i),i==1&&$(".homepage .featured .pagePrevContainer").hide()}))}function eventListingPage(n){var r=$("#hfEventListingPage").val(),u=$(".pager.eventListings .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".event .eventListings #eventListing"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".event .eventListings").offset().top-50},{duration:"fast",easing:"swing"}),$(".event .eventListings #eventListing"+t).fadeIn(),$(".pager.eventListings .pagePrevContainer").show(),$(".pager.eventListings .pagerCurrent").text(t),$("#hfEventListingPage").val(t),t==u&&$(".pager.eventListings .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$(".event .eventListings #eventListing"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".event .eventListings").offset().top-50},{duration:"fast",easing:"swing"}),$(".event .eventListings #eventListing"+i).fadeIn(),$(".pager.eventListings .pageNextContainer").show(),$(".pager.eventListings .pagerCurrent").text(i),$("#hfEventListingPage").val(i),i==1&&$(".pager.eventListings .pagePrevContainer").hide()}))}function eventListingRelatedItems(n){var r=$("#hfELPageRelatedItems").val(),u=$(".pager.relatedItems .pagerTotal").text(),t,i;n=="next"?(t=parseInt(r)+1,t<=parseInt(u)&&$(".event .relatedItems #eventListing"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".event .relatedItems").offset().top-50},{duration:"fast",easing:"swing"}),$(".event .relatedItems #eventListing"+t).fadeIn(),$(".pager.relatedItems .pagePrevContainer").show(),$(".pager.relatedItems .pagerCurrent").text(t),$("#hfELPageRelatedItems").val(t),t==u&&$(".pager.relatedItems .pageNextContainer").hide()})):n=="prev"&&(i=parseInt(r)-1,i>=0&&$(".event .relatedItems #eventListing"+r).fadeOut("slow",function(){$("html, body").animate({scrollTop:$(".event .relatedItems").offset().top-50},{duration:"fast",easing:"swing"}),$(".event .relatedItems #eventListing"+i).fadeIn(),$(".pager.relatedItems .pageNextContainer").show(),$(".pager.relatedItems .pagerCurrent").text(i),$("#hfELPageRelatedItems").val(i),i==1&&$(".pager.relatedItems .pagePrevContainer").hide()}))}function InsertEmailAddress(){var n=$(".payWall .emailRegistration .textField input").val(),t;$(".messages").html("").hide(),IsValid(n)?($(".payWall .emailRegistration .textField input").attr("disabled","disabled"),$(".payWall .emailRegistration .buttons.red").hide(),$(".payWall .emailRegistration .buttons.black").show(),t={email:n,optins:["DS"],source:"Rapid"},kservAddOptins(t).success(function(){SetEmailRegistrationCookie(),location.href=location.href}).error(function(){$(".messages").html("<div class='message error' style='font-weight:bold'>There was an error trying to process your request.  Please try again.<\/div>").slideDown("fast"),$(".payWall .emailRegistration .textField input").removeAttr("disabled"),$(".payWall .emailRegistration .buttons.red").show(),$(".payWall .emailRegistration .buttons.black").hide()})):$(".messages").html("<div class='message error' style='font-weight:bold;'>A valid email address is required to access this content.  Please enter a valid email address and try again.<\/div>").slideDown("fast")}function SetEmailRegistrationCookie(){var t=$(".hfItemID").val(),i="rapid_"+t.replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),r=escape("1"),n=new Date;n.setDate(n.getDate()+30),document.cookie=i+"="+r}function IsValid(n){if(n==null||n==undefined||n=="")return!1;var t=/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;return t.test(n)}function onEmailRegistrationKeyPress(n){var t=n.which?n.which:event.keyCode;if(t==13)return $(".payWall .emailRegistration .buttons.red a").length>0&&$(".payWall .emailRegistration .buttons.red a").click(),!1}function ShowLikeAmount(n){$("#fbLike").text(n)}var navTagsInterval,subNavWidth=0,contentWellWidthInterval,contentWellWidth=0,contentWellHeightInterval,contentWellHeight=0,$ytVideos,$fluidEl,topicSwatch,twitterFeedData;$(document).ready(function(){function u(n,t,i){var u=new Date,r=new Date;(i==null||i==0)&&(i=1),r.setTime(u.getTime()+864e5*i),document.cookie=n+"="+escape(t)+";expires="+r.toGMTString()+";domain=.discovermagazine.com;path=/"}function f(n){var t=" "+document.cookie,i=t.indexOf(" "+n+"="),r;return(i==-1&&(i=t.indexOf(";"+n+"=")),i==-1||n=="")?"":(r=t.indexOf(";",i+1),r==-1&&(r=t.length),unescape(t.substring(i+n.length+2,r)))}var t,i,n,r;$("body").width()>800&&$("a[rev='colorbox']").colorbox({transition:"none",scrolling:!1}),$("input[type='text']").attr("autocomplete","off"),t=".header .searchBox input[type='text']",$(t).focus(function(){$(t).val()=="Search DiscoverMagazine.com"&&($(t).val(""),$(t).addClass("active"))}),$(t).blur(function(){$(t).val()==""&&($(t).val("Search DiscoverMagazine.com"),$(t).removeClass("active"))}),$(".header .searchBox .searchButton a").length>0&&$(".header .searchBox .searchButton a").click(function(){var n=$(".header .searchBox input[type='text']").val(),t,i;n=$.trim(n),n=n.replace(/<\/?[^>]+>/gi,""),t={q:n},i="/search?"+jQuery.param(t),location.href=i}),$(".navbar .searchDisplay a").length>0&&$(".navbar .searchDisplay a").click(function(){$(".navbar .gearMenu").hide(),$(".navbar .mobileMenu").hide(),$(".navbar .searchPopup").toggle()}),$(".navbar #menuButton").length>0&&($(".navbar #menuButton").click(function(){$(".navbar .searchPopup").hide(),$(".navbar .gearMenu").hide(),$(".navbar .mobileMenu").toggle()}),$(".navbar #blogMenuButton").click(function(){$(".navbar .mobileMenu .blogmenu ul").toggle()})),$(".navbar .searchPopup td a").length>0&&$(".navbar .searchPopup td a").click(function(){var n="/search?"+jQuery.param({q:$(".navbar .searchPopup input[type='text']").val()});location.href=n}),$(".navbar .gearIcon a").length>0&&$(".navbar .gearIcon a").click(function(){$(".navbar .searchPopup").hide(),$(".navbar .mobileMenu").hide(),$(".navbar .gearMenu").toggle()}),i=".newsletterBox input[type='text']",$(i).focus(function(){$(i).val()=="email address"&&($(i).val(""),$(i).addClass("active"))}),$(i).blur(function(){$(i).val()==""&&($(i).val("email address"),$(i).removeClass("active"))}),n=".newsletter .form .textField input[type='text']",$(n).focus(function(){$(n).val()=="email address"&&($(n).val(""),$(n).addClass("active"))}),$(n).blur(function(){$(n).val()==""&&($(n).val("email address"),$(n).removeClass("active"))}),$(n).length>0&&$(n).val()!="email address"&&$(n).addClass("active"),r=".basement .newsletter input[type='text']",$(r).focus(function(){$(r).val()=="email address"&&($(r).val(""),$(r).addClass("active"))}),$(r).blur(function(){$(r).val()==""&&($(r).val("email address"),$(r).removeClass("active"))}),$(".basement .newsletter .button a.normal").length>0&&$(".basement .newsletter .button a.normal").click(function(){var n="/magazine/newsletter?"+jQuery.param({e:$(".basement .newsletter input[type='text']").val()});location.href=n}),$(".basement .newsletter .button a.noInput").length>0&&$(".basement .newsletter .button a.noInput").click(function(){location.href="/magazine/newsletter"}),$(".captchaDefine").click(function(){$.colorbox({transition:"eleastic",width:"470",height:"450",close:"Close Window X",href:"/sitefiles/resources/captcha/index.html"})}),$(".basement .close a").length>0&&$(".basement .close a").click(function(){$(".basement").slideUp("fast",function(){$(".basementExpand").slideDown("fast"),typeof Storage!="undefined"&&u("basementToggleCookie",1,30)})}),$(".basementExpand a").length>0&&$(".basementExpand a").click(function(){$(".basementExpand").slideUp("fast",function(){$(".basement").slideDown("fast"),typeof Storage!="undefined"&&u("basementToggleCookie",0,30)})}),typeof Storage!="undefined"&&f("basementToggleCookie")==1&&($(".basement").hide(),$(".basementExpand").show()),$(".mainContentGrid .ladder").length==0&&($(".mainContentGrid .contentWell").addClass("noLadder"),$(".mainContentGrid").addClass("noLadder")),$(".ladder .newDiscover").length>0&&SetNewOnDiscover(),$(".subnav").length>0&&(navTagsInterval=setInterval("SetNavTagsWidth()",200)),$(".gallerySlider .slider .left").length>0&&$(".gallerySlider .slider .left").fadeTo(0,.3),$(".issueSlider .slider .left").length>0&&$(".issueSlider .slider .left").fadeTo(0,.3),$(".article .relatedArticles .slider .left").length>0&&$(".article .relatedArticles .slider .left").fadeTo(0,.3),$(".relatedGalleries .slider .left").length>0&&$(".relatedGalleries .slider .left").fadeTo(0,.3),$(".contentWell").length>0&&(contentWellWidthInterval=setInterval("SetContentWellItemsWidth()",200),contentWellHeightInterval=setInterval("SetContentWellItemsHeight()",200))});try{$ytVideos=$("iframe[src^='//www.youtube.com']"),$fluidEl=$(".contentWell"),$ytVideos.each(function(){$(this).data("aspectRatio",this.height/this.width),$(this).removeAttr("height"),$(this).removeAttr("width")}),$(window).resize(function(){var n=$fluidEl.width();$ytVideos.each(function(){$(this).width(n),$(this).height(n*$(this).data("aspectRatio"))})}).resize()}catch(e){}$(document).ready(function(){topicSwatch=$("#hfTopicSwatch").val(),topicSwatch=="magazineSwatch"&&$("#navMagazine").addClass("magazineSwatch"),topicSwatch=="healthMedicineSwatch"&&($("#navHealthMedicine").addClass("healthMedicineSwatch"),$("#navBlogs a").addClass("hideEdge")),topicSwatch=="mindBrainSwatch"&&($("#navMindBrain").addClass("mindBrainSwatch"),$("#navHealthMedicine a").addClass("hideEdge")),topicSwatch=="technologySwatch"&&($("#navTechnology").addClass("technologySwatch"),$("#navMindBrain a").addClass("hideEdge")),topicSwatch=="spacePhysicsSwatch"&&($("#navSpacePhysics").addClass("spacePhysicsSwatch"),$("#navTechnology a").addClass("hideEdge")),topicSwatch=="livingWorldSwatch"&&($("#navLivingWorld").addClass("livingWorldSwatch"),$("#navSpacePhysics a").addClass("hideEdge")),topicSwatch=="environmentSwatch"&&($("#navEnvironment").addClass("environmentSwatch"),$("#navLivingWorld a").addClass("hideEdge")),topicSwatch=="photosSwatch"&&($("#navPhotos").addClass("photosSwatch"),$("#navEnvironment a").addClass("hideEdge")),topicSwatch=="rssSwatch"&&($("#navRSS").addClass("rssSwatch"),$("#navPhotos a").addClass("hideEdge")),$("#navMagazine").mouseover(function(){SetNavHover(this,"#hoverMagazine","magazineSwatch","")}),$("#navBlogs").mouseover(function(){SetNavHover(this,"#hoverBlogs","blogsSwatch","#navMagazine a")}),$("#navHealthMedicine").mouseover(function(){SetNavHover(this,"#hoverHealthMedicine","healthMedicineSwatch","#navBlogs a")}),$("#navMindBrain").mouseover(function(){SetNavHover(this,"#hoverMindBrain","mindBrainSwatch","#navHealthMedicine a")}),$("#navTechnology").mouseover(function(){SetNavHover(this,"#hoverTechnology","technologySwatch","#navMindBrain a")}),$("#navSpacePhysics").mouseover(function(){SetNavHover(this,"#hoverSpacePhysics","spacePhysicsSwatch","#navTechnology a")}),$("#navLivingWorld").mouseover(function(){SetNavHover(this,"#hoverLivingWorld","livingWorldSwatch","#navSpacePhysics a")}),$("#navEnvironment").mouseover(function(){SetNavHover(this,"#hoverEnvironment","environmentSwatch","#navLivingWorld a")}),$("#navPhotos").mouseover(function(){SetNavHover(this,"#hoverPhotos","photosSwatch","#navEnvironment a")}),$("#navRSS").mouseover(function(){SetNavHover(this,"","rssSwatch","#navShop a")}),$("#navShop").mouseover(function(){SetNavHover(this,"","shopSwatch","#navPhotos a")}),$("#navMagazine").mouseout(function(){ClearNavHover(this,"#hoverMagazine","magazineSwatch","")}),$("#navBlogs").mouseout(function(){ClearNavHover(this,"#hoverBlogs","blogsSwatch","#navMagazine a")}),$("#navHealthMedicine").mouseout(function(){ClearNavHover(this,"#hoverHealthMedicine","healthMedicineSwatch","#navBlogs a")}),$("#navMindBrain").mouseout(function(){ClearNavHover(this,"#hoverMindBrain","mindBrainSwatch","#navHealthMedicine a")}),$("#navTechnology").mouseout(function(){ClearNavHover(this,"#hoverTechnology","technologySwatch","#navMindBrain a")}),$("#navSpacePhysics").mouseout(function(){ClearNavHover(this,"#hoverSpacePhysics","spacePhysicsSwatch","#navTechnology a")}),$("#navLivingWorld").mouseout(function(){ClearNavHover(this,"#hoverLivingWorld","livingWorldSwatch","#navSpacePhysics a")}),$("#navEnvironment").mouseout(function(){ClearNavHover(this,"#hoverEnvironment","environmentSwatch","#navLivingWorld a")}),$("#navPhotos").mouseout(function(){ClearNavHover(this,"#hoverPhotos","photosSwatch","#navEnvironment a")}),$("#navRSS").mouseout(function(){ClearNavHover(this,"","rssSwatch","#navShop a")}),$("#navShop").mouseout(function(){ClearNavHover(this,"","shopSwatch","#navPhotos a")}),$("#hoverMagazine").hover(function(){SetNavHover("#navMagazine",this,"magazineSwatch","")},function(){ClearNavHover("#navMagazine",this,"magazineSwatch","")}),$("#hoverBlogs").hover(function(){SetNavHover("#navBlogs",this,"blogsSwatch","#navMagazine a")},function(){ClearNavHover("#navBlogs",this,"blogsSwatch","#navMagazine a")}),$("#hoverHealthMedicine").hover(function(){SetNavHover("#navHealthMedicine",this,"healthMedicineSwatch","#navBlogs a")},function(){ClearNavHover("#navHealthMedicine",this,"healthMedicineSwatch","#navBlogs a")}),$("#hoverMindBrain").hover(function(){SetNavHover("#navMindBrain",this,"mindBrainSwatch","#navHealthMedicine a")},function(){ClearNavHover("#navMindBrain",this,"mindBrainSwatch","#navHealthMedicine a")}),$("#hoverTechnology").hover(function(){SetNavHover("#navTechnology",this,"technologySwatch","#navMindBrain a")},function(){ClearNavHover("#navTechnology",this,"technologySwatch","#navMindBrain a")}),$("#hoverSpacePhysics").hover(function(){SetNavHover("#navSpacePhysics",this,"spacePhysicsSwatch","#navTechnology a")},function(){ClearNavHover("#navSpacePhysics",this,"spacePhysicsSwatch","#navTechnology a")}),$("#hoverLivingWorld").hover(function(){SetNavHover("#navLivingWorld",this,"livingWorldSwatch","#navSpacePhysics a")},function(){ClearNavHover("#navLivingWorld",this,"livingWorldSwatch","#navSpacePhysics a")}),$("#hoverEnvironment").hover(function(){SetNavHover("#navEnvironment",this,"environmentSwatch","#navLivingWorld a")},function(){ClearNavHover("#navEnvironment",this,"environmentSwatch","#navLivingWorld a")}),$("#hoverPhotos").hover(function(){SetNavHover("#navPhotos",this,"photosSwatch","#navEnvironment a")},function(){ClearNavHover("#navPhotos",this,"photosSwatch","#navEnvironment a")}),SetNavBlogs(),SetNavGalleries(),SetNavTopicArticles("healthMedicineSwatch","{BCEF9F39-DE04-49E7-9FF4-FB4F72E0E9CC}"),SetNavTopicArticles("mindBrainSwatch","{0E20407D-3F39-439A-9799-26A650A2C98B}"),SetNavTopicArticles("technologySwatch","{79150636-091E-4087-8533-07943BC1FEC3}"),SetNavTopicArticles("spacePhysicsSwatch","{4B9266D7-FDFE-41A7-9D27-693B6558CC6C}"),SetNavTopicArticles("livingWorldSwatch","{5CB2FD9A-75A2-4AC0-8F8C-E951F3E84617}"),SetNavTopicArticles("environmentSwatch","{AF36EEEE-63AE-4F6F-A7E3-9CACA773D505}"),SetupMobileLoginLogic()}),twitterFeedData=null,$(document).ready(function(){$(".ladder .twitterFeed .content").length>0&&$.ajax({type:"POST",dataType:"json",url:"/sitefiles/resources/twitterfeed.ashx",error:function(){},success:function(n){n!=null&&(twitterFeedData=n)},complete:function(){twitterFeedData!=null&&SetTwitterFeed()}})}),$(document).ready(function(){$(".payWall .emailRegistration .buttons.red a").click(function(){InsertEmailAddress()}),$(".payWall .emailRegistration .textField input").focus(function(){$(this).val()=="Email address"&&$(this).val("")}),$(".payWall .emailRegistration .textField input").blur(function(){$(this).val()==""&&$(this).val("Email address")})}),$(document).ready(function(){var n=$("#fbLike").length,t="https://graph.facebook.com/9045517075";n>0&&$.ajax({type:"GET",url:t,dataType:"jsonp",cache:!1,async:!0,error:function(){},success:function(n){var f,i,r,u,o;if(n!=null){f=n.likes,i=f.toString().length,i<=3&&(u="",r=0),i>=4&&i<7&&(u=" k",r=1e3),i>=7&&i<10&&(u=" million",r=1e6),i>=10&&(u=" billion",r=1e9);var e=0,t=0,o=t.toString().split(".")[1];r!=0?(e=parseFloat(f)/r,t=e.toFixed(1),o=t.toString().split(".")[1],o==0&&(t=t.replace(/(\.[0-9]*?)0+$/,"$1"),t=t.replace(/\.$/,""))):t=f,t=t+u,setTimeout(function(){ShowLikeAmount(t)},3e3)}},complete:function(){}})})