var firstrun=true;var teller=0;$(function(){loadPage();});function loadPage()
{loadNews();$("#livebox").bind({click:function(){window.open('http://www.clubbrugge.be/fcb2010/matchcenter/','matchcenter','width=850,height=600,scrollbars=no,toolbar=no,location=yes');}});loadLatestNews();}
function loadNews()
{$("ul.news li").bind({mouseover:function(){$(this).addClass('over');},mouseout:function(){$(this).removeClass('over');},click:function(){location=$("a",this).attr('href');}});$("#medialong ul li").bind({mouseover:function(){$(this).addClass('over');},mouseout:function(){$(this).removeClass('over');},click:function(){location=$("a",this).attr('href');}});$("#clubtv .content ul li").bind({mouseover:function(){$(this).addClass('over');},mouseout:function(){$(this).removeClass('over');},click:function(){location=$("a",this).attr('href');}});}
function getImageUrl(img,state)
{var url=img.attr('src');if(state=='over')
{if(url!=null){if(url.indexOf('&c=')>-1)
url=url.substr(0,url.indexOf('&c='));}}
else
{if(url!=null){if(url.indexOf('&c=')==-1)
url=url+'&c=1';}}
return url;}
function loadLatestNews()
{$("ul.news li").bind({mouseover:function(){$('ul.news li').removeClass('over');$(this).addClass('over');teller=parseInt(this.id.replace("title",""));SetActiveHeadline(teller);},mouseout:function(){$(this).removeClass('over');if(teller==8)
teller=0;start();periodical=$(document).everyTime(10000,"stopnews",start);}});start();var periodical=$(document).everyTime(10000,"stopnews",start);}
function start()
{SetActiveHeadline(teller);$("ul.news li[id^='title']").removeClass('over');$('#title'+teller).addClass('over');var src=getImageUrl($('#title'+teller+' img'),'over');if(src!=null)
$('#title'+teller+' img').attr('src',src);teller=teller+1;if(teller==8)
teller=0;}
function SetActiveHeadline(nr)
{if(!firstrun){setProps(nr);$('#newslatest #photo').fadeIn(300,function(){});}
else{setProps(nr);firstrun=false;}}
function setProps(nr)
{var morelink='../nieuws/bericht/'+data.nieuws[nr].id+'/'+data.nieuws[nr].seotitle;if(data.nieuws[nr].speeldagID!=0)
{morelink='../season/team/verslag/'+data.nieuws[nr].speeldagID+'?o='+data.nieuws[nr].nieuwstype;}
if(data.nieuws[nr].foto!=''){$('#newsLatest .title').html(data.nieuws[nr].title.replace('\u0096','-'));$('#newsLatest a').attr('href',morelink);$('#newsLatest .text').html(data.nieuws[nr].intro);$('#newsLatest').mouseenter(function(){$(this).css('cursor','pointer');});$('#newsLatest').click(function(){navigateTo($('#newsLatest a').attr('href'));});$('#newsLatest #photo img').attr('src','/img/'+data.nieuws[nr].foto);$('#newslatest #photo').fadeIn(300,function(){});}}
function navigateTo(url)
{location=url;}
