function setUpFocusliste(focusItemsListId, nyhedslisteId, landsdele, idraetter, maalgrupper, antal, focusAreaId, url)
{
    var table = document.getElementById( nyhedslisteId );
    table.Landsdele = landsdele;
    table.Idraetter = idraetter;
    table.Antal = antal;
    table.FocusAreaId = focusAreaId;
    table.Maalgrupper = maalgrupper;
    table.Url = url;
    renderFocusListe( nyhedslisteId );    

    //Make selected element bold
    boldifyElement()
}

$(document).ready(function(){
    boldifyElement();
});

//Create bold effect on selected focusitem
function boldifyElement()
{  
    var li = $(".knowledge li a").click(function(){
        li.each(function(){
          $(this).removeClass("active");  
        });

        $(this).addClass("active");  
    });   
}

function renderFocusListe( nyhedslisteId, e )
{
   var table = document.getElementById( nyhedslisteId );
   DGI.Web.API.WSAPI_sublayouts.newsservice.GetFocusNewsItems(nyhedslisteId , table.Url, table.Landsdele, table.Idraetter, table.Maalgrupper, table.Antal, table.FocusAreaId, callbackFocusListe);   
} 

function callbackFocusListe(o,e)
{
    var table = document.getElementById( o.NewsListId );
    while(table.hasChildNodes())
    {
        table.removeChild(table.childNodes[0]);        
    }
    table.className = "newsList";
   
    var head = document.createElement("THEAD");
    table.appendChild(head);
    
    var col = document.createElement("COL");
    col.className = "newsDate";
    head.appendChild(col);
    col= document.createElement("COL");
    col.className = "newsTitle";
    head.appendChild(col);
    
    var body = document.createElement("TBODY");
    
    for(i = 0; i < o.News.length; i++){
        var tr = document.createElement("TR");
        var td = document.createElement("TD");
        
        td= document.createElement("TD");
        var link = document.createElement("A");
       link.appendChild ( document.createTextNode( o.News[i].Headline ) );  
       link.setAttribute("href", o.News[i].Link);
        
        td.appendChild(link);
        tr.appendChild(td);
        body.appendChild(tr); 
    }
    
    table.appendChild(body);    
}
