$(document).ready(function(){
	fillRoster();
}); //close $.ajax(


function fillRoster(){
	 $.getJSON("./xml/news/roster.js", function(json) {
		$.each(json.players,function(i,players) {
			// Adding players to the table
			var row = $('<tr><td>' + 
						players[0] + '</td><td>' + 
						players[1] + '</td><td><a href="roster.html?player=' + players[2] + '" class="roster-link">' + 
						players[2] + '</a></td><td>' + 
						players[3] + '</td><td>' + 
						players[4] + '</td><td>' + 
						players[5] + '</td><td>' + 
						players[6] + '</td></tr>');
			if (players[2]==jQuery.url.param("player")){
				$('#player-photo').attr("src", 'images/players-big/' + players[7]);
				$('#info0').html(players[2]);
				$('#info1').html(players[1]);	
				$('#info2').html(players[5]);
				$('#info3').html(players[3] + 'cm / ' + players[4] + 'kg');
				$('#info4').html(players[8]);
				$('#info5').html(players[9]);
				$('#info6').html(players[10]);
				$('#info7').html(players[11]);
			}

			row.appendTo('#roster');
		});
     });
}

