var KickNews={};KickNews.userIsLoggedIn=false;$(document).ready(function(){$("a.storysource").click(function(event){$(".highlight-source-box").remove();var sourceId=$(this).attr('kn_source');var safeSource=$(this).attr('kn_safesource');var sourceUrl=$(this).attr('href');var storyId=$(this).attr('kn_storyid');var clickedWrapper=$("li.storywrapper[kn_storyid="+ storyId+"]");$("body").append("<div id='highlight-source-box' class='highlight-source-box'></div>")
var sourceWrappers=$("li.storywrapper[kn_source="+ sourceId+"]");var pos=$(clickedWrapper).offset();$("#highlight-source-box").css({"position":"absolute","left":pos.left+(68)+"px","top":(pos.top+ $(clickedWrapper).height())+-12+"px"});if($(clickedWrapper).hasClass("highlight")){$(".highlight-source-box").append($("<a id='highlight-story' href='#'>Remove source highlight</a>")).attr('kn_source',sourceId);$("#highlight-story").click(function(event){$(sourceWrappers).removeClass("highlight").animate({backgroundColor:"#fff"},1000);$(this).remove();var sources=$.cookie("highlight-sources").toString().split(",");for(var i=0;i<sources.length;i++){if(sources[i]===sourceId){sources.splice(i,1);}}
$.cookie("highlight-sources",sources,{path:'/',expires:999});});}else{$(".highlight-source-box").append($("<div><a id='highlight-story' href='#'>Highlight stories from this source</a></div>")).attr('kn_source',sourceId);$("#highlight-story").click(function(event){$(sourceWrappers).animate({backgroundColor:"#eee"},1000).addClass("highlight");$(this).remove();var sources=$.cookie("highlight-sources");if(sources===null){sources=sourceId;}else{sources+=","+ sourceId;}
$.cookie("highlight-sources",sources,{path:'/',expires:999});});}
var blockSourceLinkText=KickNews.userIsLoggedIn?"Block this source from your feed":"Login to block this source from your feed";$(".highlight-source-box").append($("<div><a id='block-source' href='#'>"+ blockSourceLinkText+"</a></div>"));$("#block-source").click(function(){$.post("/Account/BlockedSourcesAdd",{id:sourceId},function(data){if(data=="Error"){location.href="/account/login";}
else{location.reload();}});});$(".highlight-source-box").append($("<div><a id='highlight-story' href='"+ sourceUrl+"'>View all stories from this source</a></div>"));$(document).click(function(event){$(".highlight-source-box").remove();});return false;});if(!!$.cookie("highlight-sources")){var sources=$.cookie("highlight-sources").toString().split(",");for(var i=0;i<sources.length;i++){if(sources[i]===null)continue;$("li.storywrapper[kn_source="+ sources[i]+"]").animate({backgroundColor:"#eee"},1000).addClass("highlight");}}
$("#mainnav .leftlist li#show-league-panel").click=KickNews.Menu.menuHoverOver;KickNews.Menu.initMenu("#mainnav .leftlist li#show-league-panel")
$('#menu-slider-1').menuSlider();$("#mainnav .leftlist li#show-source-groups-panel").click=KickNews.Menu.menuHoverOver;KickNews.Menu.initMenu("#mainnav .leftlist li#show-source-groups-panel")});KickNews.Menu=(function(){var sliderCreated=false;var initMenu=function(id){$(id).hoverIntent(config);$(id).click(function(){menuHoverOver();});$(id+" a:first").click(function(){return false;});};var menuHoverOver=function(msg){if(msg=='click'){alert(msg)}
$(this).find(".sub-menu").stop().fadeTo('fast',1).show();};var menuHoverOut=function(){$(this).find(".sub-menu").stop().fadeTo('fast',0,function(){$(this).hide();});};var config={sensitivity:2,interval:100,over:menuHoverOver,timeout:500,out:menuHoverOut}
return{initMenu:initMenu,menuHoverOver:menuHoverOver,menuHoverOver:menuHoverOver};})();
