
/** Top 10 LB AJAX update call **/
var LBCycle = 150;
var http = new getHTTPObject();

/* Retrieves a new version of the leaderboard given the url */
function get_LBUpdate(argObj) {
    http.open('get',argObj.url + '?r=' + Math.floor(Math.random()*10000),false);
    http.send(null);
    return http.responseText;
}

/* Loads the leaderboard and inserts it into the top10LBCntr element. */   
function LBInit() {
	//var url = '/.element/ssi/sect/1.0/scoring/leaderboard/' + tourCode + tournId + '/current/body/top10Leaderboard.html';
	var url = '/.element/ssi/sect/1.0/tournament-central/' + tourCode + tournId + '/body/top10Leaderboard.html';
    //var url = '/.element/ssi/sect/1.0/tournament-central/' + tourCode + tournId + '/body/top10Leaderboard.html'; 
    var top10Lb = get_LBUpdate({url:url});
    //top10Lb = get_LBUpdate({url:'/tc/top10-lb?current_year=2006&tid=r475&course_id=665'});
    document.getElementById("top10LBCntr").innerHTML = '';   
    document.getElementById("top10LBCntr").innerHTML = top10Lb;   
}

function initLeaderboard()
{
   	LBInit();
	setInterval("LBInit()",LBCycle*1000);
}
   	
// Register initLeaderboard function so it get's called when the page finished loading   	
addLoadListener(initLeaderboard);
