// Start function when DOM has completely loaded 
$(document).ready(function() { 
	// Open the xml file
	$.get("/data/promotions/passport/results.xml",{},function(xml) {
		$(xml).find('player').each(function() {						  
			name = $(this).attr("name");
			HTMLOutput = '';
	
			$(this).find('result').each(function() {				  		  
				tournament = $(this).find("tournament").text();
				field = $(this).find("field").text();
				position = $(this).find("position").text();
				money = $(this).find("money").text();
				
				// Build row HTML data and store in string
				mydata = buildHTML(tournament,field,position,money);
				HTMLOutput = HTMLOutput + mydata;
			});
		// Update the DIV called Content Area with the HTML string
		$("#" + name + "2").append(HTMLOutput);
		});
	});	
});
 
function buildHTML(tournament,field,position,money){	
	// Build HTML string and return
	output = '';
	output += '<tr>';
	output += '<td>'+ tournament + '</td>';
	output += '<td>'+ field +'</td>';
	output += '<td>'+ position +'</td>';
	output += '<td>'+ money +'</td>';
	output += '</tr>';
	return output;
}
	 