$(document).ready(function(){$(".menu_home").after($("#menu_home_body"));$(".menu_explore").after($("#menu_explore_body"));$(".menu_articles").after($("#menu_articles_body"));$(".menu_forums").after($("#menu_forums_body"));$("#menu_home_body, #menu_explore_body").each(function(){var t=$(this).find(".tabmenucontent .tabmenuleft ul a"),n=$(this).find(".productoverview");$.each(t,function(t,i){$(n).css("display","none");$(n[0]).css("display","block");$(i).mouseenter(function(){$(n).css("display","none");$(n[t]).css("display","block")})})});$(".menu_home, .menu_explore, .menu_articles, .menu_forums").parent().hover(function(){$(this).find(".tabmenu").show()},function(){$(this).find(".tabmenu").hide()});$("#customizeteaser").hide();$(".tabbed a.tab").click(function(){$(this).addClass("selected");$(this).siblings().removeClass("selected");var n=$(this).index();return $(this).parent().find(".tabcontent").hide(),$(this).parent().find(".tabcontent:eq("+n+")").show(),!1});$("#searchbutton").click(function(){var n=$("img.search_bar_icon").attr("title");return window.location="http://www.wincustomize.com/explore/"+n+"/search/"+$("input[title=query]").val().replace(/[^a-zA-Z 0-9]+/g,"").replace(/ /g,"+"),!1});$(".search_menu_button").click(function(){$(".dropdownsearch").toggle(200)});$("div.searchmenuitem a").hover(function(){$(this).next("em").stop(!0,!0).animate({opacity:"show",top:-20},"normal")},function(){$(this).next("em").hide()});$("div.searchmenuitemr2 a").hover(function(){$(this).next("em").stop(!0,!0).animate({opacity:"show",top:22},"normal")},function(){$(this).next("em").hide()});$("div.searchmenuitemr3 a").hover(function(){$(this).next("em").stop(!0,!0).animate({opacity:"show",top:65},"normal")},function(){$(this).next("em").hide()});$("img.menu_icon").click(function(){var n,t;$(".dropdownsearch").hide();n=jQuery(this).attr("src");$("img.search_bar_icon").attr("src",n);t=jQuery(this).attr("title");$("img.search_bar_icon").attr("title",t)});$(".loginlink").click(function(){return $("input#_TextUser").focus(),!1})});$.connection.hub.url="/sockets";$(function(){StardockHub.InitWebsockets();setTimeout(function(){StardockHub.updateNotificationMenu},4e3)});var StardockHub={notificationMessageCount:0,notificationSubscriptionCount:0,notificationCartCount:0,isFastSpringInitialized:!1,isRunning:!1,isOn:!0,isLoggedOn:!1,hubConnection:{},ddHubProxy:{},GetDailyDealCount:0,DailyDealChangedHandler:function(n){var t=Math.round((n.Total-n.Remaining)/n.Total*100);$("#percent-claimed").html(t);$("#progress-remaining").css("width",""+t+"%");$("p.price").html(n.Price);$("p.description").html(n.Description);n.Remaining<=0?$("#ddclaim").hide():n.Status==3&&setTimeout(function(){StardockHub.GetDailyDealCount>3||(StardockHub.GetDailyDealCount++,$.ajax({type:"GET",cache:!1,url:"/games/DailyDeal/GetDailyDeal",success:function(n){$("#deallayout").html(n);connection.stop()},error:function(n){$("#dailydeal").hide();console.log("Error getting daily deal: "+n.responseText)}}))},10)},InitWebsockets:function(){StardockHub.isFastSpringInitialized=typeof fastspring!="undefined";setTimeout(function(){StardockHub.hubConnection=$.connection("https://hubs.stardock.com/sockets");sdHubProxy=$.connection.stardockWebsiteSharedHub;sdHubProxy.client.cart_Changed=function(n){StardockHub.onCart_Changed(n,!0)};sdHubProxy.client.stopClient=function(){StardockHub.hubConnection.stop()};StardockHub.isLoggedOn=StardockHub.IsSignedIn();StardockHub.isLoggedOn==!0&&(StardockHub.isLoggedOn=!0,sdHubProxy.client.subscriptionUnreadCount_Changed=function(n){StardockHub.onSubscriptionUnreadCount_Changed(n,!0)},sdHubProxy.client.privateMessageUnreadCount_Changed=function(n){StardockHub.onPrivateMessageUnreadCount_Changed(n,!0)},$("#DDSocket").val()=="true"&&(StardockHub.ddHubProxy=$.connection.dailyDealHub,StardockHub.ddHubProxy.client.dailyDeal_OnChange=function(n){StardockHub.DailyDealChangedHandler(n)},StardockHub.ddHubProxy.client.stopClient=function(){StardockHub.hubConnection.stop()}));StardockHub.StartHubConnection(!0);$.connection.hub.disconnected(function(){StardockHub.isRunning=!1;StardockHub.isOn&&setTimeout(function(){StardockHub.StartHubConnection(!1)},6e4)})},1)},IsSignedIn:function(){return $("#account-trigger").hasClass("loggedin")||$(".account-trigger").hasClass("loggedin")||$("#listatus").hasClass("loggedin")?!0:!1},StartHubConnection:function(n,t){var i;i=arguments[2];$.connection.hub.start().done(function(){StardockHub.isOn=!0;StardockHub.CompleteInitialization(n);typeof t=="function"&&t(i);i})},StopHubConnection:function(){(StardockHub.isOn=!1,StardockHub.isRunning)&&$.connection.hub.stop()},ReduceConnections:function(){StardockHub.isLoggedOn||setTimeout(function(){StardockHub.StopHubConnection()},4e3)},CompleteInitialization:function(n){StardockHub.isRunning=!0;n&&(StardockHub.isLoggedOn&&(StardockHub.UpdateSubscriptionCount(),StardockHub.UpdateMessageCount()),StardockHub.isFastSpringInitialized&&fsInitializeCarts())},AddToCart:function(n){if(!StardockHub.isRunning){StardockHub.StartHubConnection(!1,StardockHub.AddToCart,n);return}sdHubProxy.server.addToCart(n).done(function(){})},GetCart:function(n){if(!StardockHub.isRunning){StardockHub.StartHubConnection(!1,StardockHub.GetCart,n);return}sdHubProxy.server.getCart().done(function(t){n(t)})},UpdateCart:function(n){if(!StardockHub.isRunning){StardockHub.StartHubConnection(!1,StardockHub.UpdateCart,n);return}sdHubProxy.server.updateCart(n).done(function(){})},UpdateSubscriptionCount:function(){if(!StardockHub.isRunning){StardockHub.StartHubConnection(!1,StardockHub.UpdateSubscriptionCount);return}sdHubProxy.server.getSubscriptionCount().done(function(n){StardockHub.onSubscriptionUnreadCount_Changed(n,!1)})},UpdateMessageCount:function(){if(!StardockHub.isRunning){StardockHub.StartHubConnection(!1,StardockHub.UpdateMessageCount);return}sdHubProxy.server.getPrivateMessageCount().done(function(n){StardockHub.onPrivateMessageUnreadCount_Changed(n,!1)})},onCart_Changed:function(n){StardockHub.isFastSpringInitialized&&fsMergeCarts(global_fastSpringData,n)},onSubscriptionUnreadCount_Changed:function(n,t){var i=$("#subscription_count");n>0?(i.text(n),i.addClass("show"),t&&(i.addClass("new"),setTimeout(function(){i.removeClass("new")},1500))):(i.text(""),i.removeClass("show"));n>0?$(".subscriptioncount").html("(<b>"+n+"<\/b>)"):$(".subscriptioncount").html("");StardockHub.notificationSubscriptionCount=n;StardockHub.updateNotificationMenu()},onPrivateMessageUnreadCount_Changed:function(n,t){var i=$("#message_count");n>0?(i.text(n),i.addClass("show"),t&&(i.addClass("new"),setTimeout(function(){i.removeClass("new")},1500))):(i.text(""),i.removeClass("show"));n>0?(StardockHub.hasNotifications=!0,$(".messagecount").html("(<b>"+n+"<\/b>)")):$(".messagecount").html("");StardockHub.notificationMessageCount=n;StardockHub.updateNotificationMenu()},updateNotificationMenu:function(){StardockHub.notificationCartCount=$("#cart-trigger").children("span").hasClass("show")?1:0;StardockHub.hasNotifications()?$("#notification-form").hasClass("show")||$("#notification-form").addClass("show"):$("#notification-form").hasClass("show")||$("#notification-form").removeClass("show")},hasNotifications:function(){return StardockHub.notificationMessageCount>0||StardockHub.notificationSubscriptionCount>0||StardockHub.notificationCartCount>0?!0:!1}}