
function updateOneNeighbour(neighbourID){
    var neighbourTag = $(neighbourID);
    var username = neighbourTag.readAttribute('username');
    var url = 'lastfm/getCurrentTrack.php?username='+encodeURIComponent(username);
    var successo = function(transport){
			var retObj = transport.responseText.evalJSON();
	    		if(retObj != null){
			    if(retObj.artist != "")
				neighbourTag.update(retObj.artist + ' - ' + retObj.track);
			    else
				neighbourTag.update('non in ascolto');
			}
		    };
    doQuery(url, successo);
}

function updateNeighbours(){
    var i = 0;
    var neighbourTag = null;
    while(true){
	neighbourTag = $("neighbour" +i);
	if(neighbourTag == null)
	    break;
	// setTimeout("
	window.setTimeout('updateOneNeighbour("neighbour' + i + '")',5000*i);
	// ",5000);
	++i;
    }

}
