function LoadData(n){var r={q:n,fq:baseFilterQuery,pageSize:defaultPagesize,pageIndex:0,sort:"sticky_date desc, publish_date desc"},u=jQuery.param(r);$(".section .results .spinner").show(),$(".section .results .loadMore").hide(),$.ajax({type:"GET",dataType:"json",data:u,url:"/sitefiles/resources/search.ashx",error:function(){$(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  Please try again later.<\/div>")},success:function(n){var nt,v,r,w,h,b,rt,k,d,g;if(n!=null)if(nt=n.response.numFound,nt>0){for(v=n.response.docs,r="",hpFilterLoaded=="skyEvents"&&(r+="<div class='dataItem industry'>",r+="<div class='content'>",r+="<h2 style='text-align:center'><a href='/observing/tonights-sky'>Click here to view Tonight's Sky<\/a><\/h2>",r+="<\/div>",r+="<div style='clear:both;'><\/div><\/div>"),i=0;i<v.length;i++){var u=v[i],tt=u.title,c=u.url;c==null&&(c="#");var o=u.publish_date,f=u.author_names,s=u.tag_names,e=u.snippet;e!=null&&e.length>250&&(e=e.substring(0,250)+"...");var it=u.media_override,l=u.media_items,y=u.media_items_raw,p="dataItem";if(i>=3&&i<=8&&(p="dataItem page2"),i>8&&(p="dataItem page3"),r+="<div class='"+p+"'>",w=!1,h="",it!=null)h=it;else if(l!=null&&y!=null&&l.length==y.length)for(b=!1,m=0;m<l.length;m++)b||l[m].indexOf("{E9B1327A-4BEA-44CC-8398-7A03DEF15C9D}")!=-1&&(rt=y[m].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),h="/-/media/"+rt+".jpg",b=!0);if(h!=""&&(w=!0,r+="<div class='thumbnail'>",r+="<a href='"+c+"'><img src='"+h+"?mw=160' alt='' /><\/a>",r+="<\/div>"),k="content",w&&(k="content withImage"),r+="<div class='"+k+"'>",tt!=null&&(r+="<h2><a href='"+c+"'>",r+=tt,r+="<\/a><\/h2>"),f!=null||o!=null){if(d=!1,r+="<div class='byline'>",o!=null&&(g=o.substring(0,4),parseInt(g)>1920)){var ut=o.substring(5,7),ft=o.substring(8,10),et=ut+"/"+ft+"/"+g,ot=new Date(et);d=!0,r+=dateFormat(ot,"fullDate")}if(f!=null)for(d&&(r+=" &#160;|&#160;"),r+="by ",a=0;a<f.length;a++)r+="<a href='/authors?"+$.param({name:f[a]})+"'>"+f[a]+"<\/a>",a!=f.length-1&&(r+=", ");r+="<\/div>"}if(e!=null&&(r+="<div class='snippet'>"+e+"<\/div>"),s!=null){for(r+="<div class='tags'>MORE ABOUT: ",t=0;t<s.length;t++)r+="<a href='/tags?"+jQuery.param({tag:s[t]})+"'>"+s[t]+"<\/a>",t!=s.length-1&&(r+=", ");r+="<\/div>"}r+="<\/div>",r+="<div style='clear:both;'><\/div><\/div>"}feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().append(r):$(".section .results .resultSet").append(r)}else $(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  No data found.  Please try again later.<\/div>");else $(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  No data found.  Please try again later.<\/div>")},complete:function(){if($(".section .results .spinner").hide(),feedBodyWidth>disableScrollWidth)SetResultsHeight(),scrollApi.reinitialise(),scrollApi.scrollToY(0);else{var n=$(".section .results .dataItem").length;n>4?($(".section .results .loadMore a").html("Load More Stories"),$(".section .results .loadMore").show()):$(".section .results .loadMore").hide()}}})}function LoadFeatured(){$(".section .results .spinner").show(),$(".section .results .loadMore").hide(),$.ajax({type:"GET",dataType:"json",data:jQuery.param({q:'parent_item_name:"From the Industry"',fq:baseFilterQuery,pageSize:9,pageIndex:0,sort:"sticky_date desc, publish_date desc"}),url:"/sitefiles/resources/search.ashx",success:function(n){n!=null&&(industryBlogs=n.response.docs)},error:function(){console.log("Unable to locate Industry Blog")}}),$(".section .results .spinner").show(),$(".section .results .loadMore").hide();var n={q:featuredQuery,fq:baseFilterQuery,pageSize:defaultPagesize,pageIndex:0,sort:"sticky_date desc, publish_date desc"},r=jQuery.param(n);$.ajax({type:"GET",dataType:"json",data:r,url:"/sitefiles/resources/search.ashx",error:function(){$(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  Please try again later.<\/div>")},success:function(n){var nt,v,r,w,h,b,rt,k,d,g;if(n!=null)if(nt=n.response.numFound,nt>0){for(v=n.response.docs,r="",i=0;i<v.length;i++){var u=v[i],tt=u.title,c=u.url;c==null&&(c="#");var o=u.publish_date,f=u.author_names,s=u.tag_names,e=u.snippet;e!=null&&e.length>250&&(e=e.substring(0,250)+"...");var it=u.media_override,l=u.media_items,y=u.media_items_raw,p="dataItem";if(i>=3&&i<=8&&(p="dataItem page2"),i>8&&(p="dataItem page3"),i==3&&showIndustryPostInFeatured&&(r+=LoadIndustryBlog(industryBlogs[0])),r+="<div class='"+p+"'>",w=!1,h="",it!=null)h=it;else if(l!=null&&y!=null&&l.length==y.length)for(b=!1,m=0;m<l.length;m++)b||l[m].indexOf("{E9B1327A-4BEA-44CC-8398-7A03DEF15C9D}")!=-1&&(rt=y[m].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),h="/-/media/"+rt+".jpg",b=!0);if(h!=""&&(w=!0,r+="<div class='thumbnail'>",r+="<a href='"+c+"'><img src='"+h+"?mw=160' alt='' /><\/a>",r+="<\/div>"),k="content",w&&(k="content withImage"),r+="<div class='"+k+"'>",tt!=null&&(r+="<h2><a href='"+c+"'>",r+=tt,r+="<\/a><\/h2>"),f!=null||o!=null){if(d=!1,r+="<div class='byline'>",o!=null&&(g=o.substring(0,4),parseInt(g)>1920)){var ut=o.substring(5,7),ft=o.substring(8,10),et=ut+"/"+ft+"/"+g,ot=new Date(et);d=!0,r+=dateFormat(ot,"fullDate")}if(f!=null)for(d&&(r+=" &#160;|&#160;"),r+="by ",a=0;a<f.length;a++)r+="<a href='/authors?"+$.param({name:f[a]})+"'>"+f[a]+"<\/a>",a!=f.length-1&&(r+=", ");r+="<\/div>"}if(e!=null&&(r+="<div class='snippet'>"+e+"<\/div>"),s!=null){for(r+="<div class='tags'>MORE ABOUT: ",t=0;t<s.length;t++)r+="<a href='/tags?"+jQuery.param({tag:s[t]})+"'>"+s[t]+"<\/a>",t!=s.length-1&&(r+=", ");r+="<\/div>"}r+="<\/div>",r+="<div style='clear:both;'><\/div><\/div>"}feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().append(r):$(".section .results .resultSet").append(r)}else $(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  No data found.  Please try again later.<\/div>");else $(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  No data found.  Please try again later.<\/div>")},complete:function(){if($(".section .results .spinner").hide(),feedBodyWidth>disableScrollWidth)SetResultsHeight(),scrollApi.reinitialise(),scrollApi.scrollToY(0);else{var n=$(".section .results .dataItem").length;n>4?($(".section .results .loadMore a").html("Load More Stories"),$(".section .results .loadMore").show()):$(".section .results .loadMore").hide()}}})}function LoadFilterBlogs(){$(".section .results .spinner").show(),$(".section .results .loadMore").hide();var n;$.ajax({type:"GET",dataType:"json",data:jQuery.param({q:'parent_item_name:"From the Industry"',fq:baseFilterQuery,pageSize:9,pageIndex:0,sort:"sticky_date desc, publish_date desc"}),url:"/sitefiles/resources/search.ashx",success:function(t){t!=null&&(n=t.response.docs)},complete:function(){$.ajax({type:"GET",dataType:"json",data:jQuery.param({PageSize:defaultPagesize,PageIndex:"0"}),url:"/sitefiles/resources/blogposts.ashx",error:function(){$(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  Please try again later.<\/div>")},success:function(r){var u,y,a,w,b,v;if(r!=null){for(u="",y=r.Posts,i=0;i<y.length;i++){var f=y[i],k=f.title,h=f.url;h==null&&(h="#");var d=f.media,c=f.author_names,l=f.publish_date,e=f.snippet;e!=null&&e.length>250&&(e=e.substring(0,250)+"...");var o=f.tags,p=f.parent_url,s=f.parent_item_id;if(s!="year of pluto"&&(p+="/default.aspx"),a="dataItem",i>=3&&i<=8&&(a="dataItem page2"),i>8&&(a="dataItem page3"),i==3&&showIndustryPostInBlog&&(u+=LoadIndustryBlog(n[0])),u+="<div class='"+a+"'>",w=!1,d!=null&&(w=!0,u+="<div class='thumbnail'>",u+="<a href='"+h+"'>",u+="<img src='"+d+"' alt='' />",u+="<\/a><\/div>"),b="content",w&&(b="content withImage"),u+="<div class='"+b+"'>",s!=null&&p!=null&&(s=="72"?v="DAVE'S UNIVERSE":s=="51"?v="LOCAL GROUP":s=="year of pluto"&&(v="YEAR OF PLUTO"),u+="<div class='microTextBold'>",u+="<a href='"+p+"'>"+v+"<\/a>",u+="<\/div>"),k!=null&&(u+="<h2><a href='"+h+"'>"+k+"<\/a><\/h2>"),(l!=null||c!=null)&&(u+="<div class='byline'>",l!=null&&(u+=dateFormat(l,"fullDate")),c!=null&&(l!=null&&(u+=" | "),u+="by <a href='/authors?"+jQuery.param({name:c})+"'>"+c+"<\/a>"),u+="<\/div>"),e!=null&&(u+="<div class='snippet'>"+e+"<\/div>"),o!=null){for(u+="<div class='tags'>MORE ABOUT: ",t=0;t<o.length;t++)u+="<a href='/tags?"+jQuery.param({tag:o[t]})+"'>"+o[t]+"<\/a>",t!=o.length-1&&(u+=", ");u+="<\/div>"}u+="<\/div>",u+="<div style='clear:both;'><\/div><\/div>"}feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().append(u):$(".section .results .resultSet").append(u)}else $(".section .results .resultSet").html("<div class='message error'>Unable to load article feed at this time.  No data found.  Please try again later.<\/div>")},complete:function(){if($(".section .results .spinner").hide(),feedBodyWidth>disableScrollWidth)SetResultsHeight(),scrollApi.reinitialise(),scrollApi.scrollToY(0);else{var n=$(".section .results .dataItem").length;n>4?($(".section .results .loadMore a").html("Load More Stories"),$(".section .results .loadMore").show()):$(".section .results .loadMore").hide()}}})}})}function LoadIndustryBlog(n){var i="",c,f,v,s,d,k,y,p,w;if(n!=null){c=n.title,f=n.url,f==null&&(f="#");var e=n.publish_date,r=n.author_names,o=n.tag_names,u=n.snippet;u!=null&&u.length>250&&(u=u.substring(0,250)+"...");var b=n.media_override,h=n.media_items,l=n.media_items_raw;if(i+="<div class='dataItem industry'>",v=!1,s="",b!=null)s=b;else if(h!=null&&l!=null&&h.length==l.length)for(d=!1,m=0;m<h.length;m++)h[m].indexOf("{E9B1327A-4BEA-44CC-8398-7A03DEF15C9D}")!=-1&&(k=l[m].replace("{","").replace("}","").replace("-","").replace("-","").replace("-","").replace("-",""),s="/-/media/"+k+".jpg");if(s!=""&&(v=!0,i+="<div class='thumbnail'>",i+="<a href='"+f+"'><img src='"+s+"?mw=160' alt='' /><\/a>",i+="<\/div>"),y="content",v&&(y="content withImage"),i+="<div class='"+y+"'>",i+="<div class='microTextBold'>",i+="<a href='/community/from-the-industry'>FROM THE INDUSTRY<\/a>",i+="<\/div>",c!=null&&(i+="<h2><a href='"+f+"'>",i+=c,i+="<\/a><\/h2>"),r!=null||e!=null){if(p=!1,i+="<div class='byline'>",e!=null&&(w=e.substring(0,4),parseInt(w)>1920)){var g=e.substring(5,7),nt=e.substring(8,10),tt=g+"/"+nt+"/"+w,it=new Date(tt);p=!0,i+=dateFormat(it,"fullDate")}if(r!=null)for(p&&(i+=" &#160;|&#160;"),i+="by ",a=0;a<r.length;a++)i+="<a href='/authors?"+$.param({name:r[a]})+"'>"+r[a]+"<\/a>",a!=r.length-1&&(i+=", ");i+="<\/div>"}if(u!=null&&(i+="<div class='snippet'>"+u+"<\/div>"),o!=null){for(i+="<div class='tags'>MORE ABOUT: ",t=0;t<o.length;t++)i+="<a href='/tags?"+jQuery.param({tag:o[t]})+"'>"+o[t]+"<\/a>",t!=o.length-1&&(i+=", ");i+="<\/div>"}i+="<\/div>",i+="<div style='clear:both'><\/div><\/div>"}return i}function SetResultsHeight(){var t=$(".section .results .dataItem"),n=0;for(i=0;i<t.length;i++)i<=3&&(n=n+$(t[i]).height()+41);n=n-1,$(".section .results .resultSet").css({height:n})}function FeedScrollOver(){var n=$(".section .results .dataItem").length;n>4&&$(".jspVerticalBar").removeAttr("style").attr("style","visibility:visible")}function FeedScrollOut(){$(".jspVerticalBar").removeAttr("style").attr("style","visibility:hidden")}function hpSliderPage(n){var h=$(".homepageSlider").width(),f=$(".homepageSlider .thumb").length,i=$(".homepageSlider .thumb").width(),l=$(".homepageSlider .thumbContainer").width(),c=Math.round(parseInt(h)/parseInt(i)),t=2,e,o,s,r,u;$("body").width()<=600&&(c=1,t=1),hpSliderPosition>1&&(t=t+(parseInt(hpSliderPosition)-1)),n=="next"?parseInt(f)>parseInt(t)&&(e=parseInt(i)*hpSliderPosition,$(".homepageSlider .thumbContainer").animate({left:"-"+e}),o=parseInt(hpSliderPosition)+1,hpSliderPosition=o,$(".homepageSlider .sliderPrev").show(),s=parseInt(t)+1,s>=parseInt(f)&&$(".homepageSlider .sliderNext").hide(),clearInterval(hpSliderInterval)):n=="prev"&&parseInt(hpSliderPosition)>1&&(r=parseInt(i)*(parseInt(hpSliderPosition)-2),r>0?$(".homepageSlider .thumbContainer").animate({left:"-"+r}):$(".homepageSlider .thumbContainer").animate({left:"0"}),u=parseInt(hpSliderPosition)-1,hpSliderPosition=u,$(".homepageSlider .sliderNext").show(),u<=1&&$(".homepageSlider .sliderPrev").hide(),clearInterval(hpSliderInterval)),ga("send","pageview",location.pathname)}function hpSliderIntervalStart(){var u=$(".homepageSlider").width(),f=$(".homepageSlider .thumb").length,t=$(".homepageSlider .thumb").width(),o=$(".homepageSlider .thumbContainer").width(),e=Math.round(parseInt(u)/parseInt(t)),n=2,i,r;$("body").width()<=600&&(e=1,n=1),hpSliderPosition>1&&(n=n+(parseInt(hpSliderPosition)-1)),parseInt(f)>parseInt(n)?(i=parseInt(t)*hpSliderPosition,$(".homepageSlider .thumbContainer").animate({left:"-"+i}),r=parseInt(hpSliderPosition)+1,hpSliderPosition=r):clearInterval(hpSliderInterval)}function hpSliderIntervalMobileStart(){var t,n;$(".homepageSlider.mobile .photo").length>0&&(t=$(".homepageSlider.mobile .photo").length,t>1&&(n=parseInt(hpSliderPositionMobile)+1,parseInt(n)>t&&(n=1),$(".homepageSlider.mobile .photo."+hpSliderPositionMobile).fadeOut("fast",function(){hpSliderPositionMobile=n,$(".homepageSlider.mobile .photo."+n).fadeIn()})))}var hpFilterLoaded="featured",defaultPagesize="15",baseFilterQuery="(publish_date:[NOW-200YEAR TO NOW]) AND (unpublish_date:[* TO NOW-200YEAR] OR unpublish_date:[NOW TO *])",featuredQuery='flag_names:"feature"',skyEventsQuery='topic_names:"sky events" OR parent_item_name:"Events"',askAstroQuery='topic_names:"ask astro"',scrollApi,resetScrollPane=function(){api.reinitialise()},disableScrollWidth=650,feedBodyWidth,showIndustryPostInBlog=!1,showIndustryPostInFeatured=!1,industryBlogs,hpSliderPosition,hpSliderPositionMobile,hpSliderInterval,hpSliderIntervalMobile;$(document).ready(function(){feedBodyWidth=$(document).width(),feedBodyWidth>disableScrollWidth&&(scrollApi=$(".section .results .resultSet").jScrollPane({mouseWheelSpeed:50}).data("jsp")),LoadFeatured(),$(".homepage.feed .filterBar ul li.blogs a").click(function(){hpFilterLoaded!="blogs"&&($(this).addClass("current"),$(this).parent().find(".arrowDown").show(),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" a").removeClass("current"),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" .arrowDown").hide(),hpFilterLoaded="blogs",feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().text(""):$(".section .results .resultSet").html(""),LoadFilterBlogs())}),$(".homepage.feed .filterBar ul li.featured a").click(function(){hpFilterLoaded!="featured"&&($(this).addClass("current"),$(this).parent().find(".arrowDown").show(),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" a").removeClass("current"),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" .arrowDown").hide(),hpFilterLoaded="featured",feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().text(""):$(".section .results .resultSet").html(""),LoadFeatured())}),$(".homepage.feed .filterBar ul li.skyEvents a").click(function(){hpFilterLoaded!="skyEvents"&&($(this).addClass("current"),$(this).parent().find(".arrowDown").show(),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" a").removeClass("current"),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" .arrowDown").hide(),hpFilterLoaded="skyEvents",feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().text(""):$(".section .results .resultSet").html(""),LoadData(skyEventsQuery))}),$(".homepage.feed .filterBar ul li.askAstro a").click(function(){hpFilterLoaded!="askAstro"&&($(this).addClass("current"),$(this).parent().find(".arrowDown").show(),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" a").removeClass("current"),$(".homepage.feed .filterBar ul li."+hpFilterLoaded+" .arrowDown").hide(),hpFilterLoaded="askAstro",feedBodyWidth>disableScrollWidth?scrollApi.getContentPane().text(""):$(".section .results .resultSet").html(""),LoadData(askAstroQuery))}),$(".section .results .loadMore a").click(function(){$(".homepage.feed .resultSet .dataItem.page2").show(),$(".homepage.feed .resultSet .dataItem.page3").show(),$(".section .results .loadMore").hide()})}),hpSliderPosition=1,hpSliderPositionMobile=1,$(document).ready(function(){$(".homepageSlider .dataBg").length>0&&$(".homepageSlider .dataBg").fadeTo(0,.7),$(".homepageSlider").mouseover(function(){var t=$(".homepageSlider").width(),i=$(".homepageSlider .thumb").length,r=$(".homepageSlider .thumb").width(),u=$(".homepageSlider .thumbContainer").width(),f=Math.round(parseInt(t)/parseInt(r)),n=2;hpSliderPosition>1&&(n=n+(parseInt(hpSliderPosition)-1)),parseInt(i)>n?$(".homepageSlider .sliderNext").show():$(".homepageSlider .sliderNext").hide(),hpSliderPosition>1?$(".homepageSlider .sliderPrev").show():$(".homepageSlider .sliderPrev").hide()}),$(".homepageSlider").mouseout(function(){$(".homepageSlider .sliderPrev").hide(),$(".homepageSlider .sliderNext").hide()}),$("body").width()>650?hpSliderInterval=setInterval("hpSliderIntervalStart()",1e4):hpSliderIntervalMobile=setInterval("hpSliderIntervalMobileStart()",1e4)})