var NewsAnimation=(function(){var state={isRunning:true};var scroll=function(){if(!state.isRunning){return;}$(".news-container").animate({top:"-=50px"},2000,"linear",function(){if($(".news-container:animated").length===1){var topMostEl=undefined;var bottomMostEl=undefined;$(".news-container").each(function(){if(topMostEl===undefined){topMostEl=$(this);}else{if(pxAsInt(topMostEl.css("top"))>=pxAsInt($(this).css("top"))){topMostEl=$(this);}}if(bottomMostEl===undefined){bottomMostEl=$(this);}else{if(pxAsInt(bottomMostEl.css("top"))<=pxAsInt($(this).css("top"))){bottomMostEl=$(this);}}});var offset=topMostEl.css("top");offset=parseInt(offset.substring(0,offset.length-2));if(offset<=topMostEl.outerHeight()*-1){topMostEl.css("top",pxAsInt(bottomMostEl.css("top"))+bottomMostEl.outerHeight(true));}scroll();}});};var pxAsInt=function(pixels){return parseInt(pixels.substring(0,pixels.length-2));};var init=function(){var visibleArea=$(".isbitscontainer");var newsWrapper=$("#news-wrapper");var newsContainer=newsWrapper.find(".news-container");var copyTimes=Math.ceil(visibleArea.outerHeight(true)/newsContainer.outerHeight(true));var counter=0;while(copyTimes--){newsContainer.clone().css("top",newsContainer.outerHeight(true)*++counter).appendTo(newsWrapper);}};var pause=function(){state.isRunning=false;$(".news-container").stop();};var resume=function(){state.isRunning=true;scroll();};return{init:init,pause:pause,resume:resume,scroll:scroll};})();$(document).ready(function(){if($("html").is("#plain")){jQuery("#newscarousel").jcarousel({visible:1,scroll:1});}else{$(".news-container .news").each(function(index){$(this).css({top:100*index});});$(".isbitscontainer").bind("mouseenter",function(){NewsAnimation.pause();});$(".isbitscontainer").bind("mousemove",function(e){var foundNewsElement=false;$(".news-container .news").each(function(){var offset=$(this).offset();var width=$(this).width();var height=$(this).height();if((offset.left<e.pageX&&offset.left+width>e.pageX)&&(offset.top<e.pageY&&offset.top+height>e.pageY)){$("#fake-news-link").attr("href",$(this).find("a").attr("href")).css("z-index",12);foundNewsElement=true;}});if(!foundNewsElement){$("#fake-news-link").attr("href","#").css("z-index",5);}});$(".isbitscontainer").bind("mouseleave",function(){NewsAnimation.resume();$("#fake-news-link").attr("href","#").css("z-index",5);});if($.browser.msie){$(".isbitscontainer").css("cursor","pointer").bind("click",function(e){$(".news-container .news").each(function(){var offset=$(this).offset();var width=$(this).width();var height=$(this).height();if((offset.left<e.pageX&&offset.left+width>e.pageX)&&(offset.top<e.pageY&&offset.top+height>e.pageY)){window.location=$(this).find("a").attr("href");}});});}NewsAnimation.init();setTimeout(function(){NewsAnimation.scroll();},1500);}});
