$(document).ready(function(){
	//insert a break after the online count and before the names
	$(".onlineList a:first").prepend("<br />");
	//fix the forum member list colors
	$(".onlineList").find("a").each(function(){
		if ($(this).css("color") != "#ffffff" && $(this).css("color") != "rgb(255, 255, 255)")
		{
			if ($(this).css("color") == "#ff0000" || $(this).css("color") == "rgb(255, 0, 0)")
			{
				$(this).css("font-weight", "bold");
			}
				$(this).css("color", "black");
		}
		else
		{
			$(this).css("color", "#333");
		}
	});
	//load the site data xml file
	$.ajax({
		type: "GET",
		url: "sitedata.xml",
		dataType: "xml",
		success: function(xml){
			//set the server info
			var chapterList = $(xml).find("chapters");		
			if (chapterList != undefined && chapterList != null)
			{
				chapterList.find("chapter").each(function(){
					$(".chapterInfo").append("<div class='header'>" + $(this).attr("name") + "</div>")
						.append("<div class='title'>Leader: <span>" + $(this).attr("leader") + "</span>")
						.append("<div class='title'>Game: <span><a href='" + $(this).attr("gameUrl") + "'>" + $(this).attr("game") + "</a></div>");
					$(this).find("node").each(function(){
						$(".chapterInfo").append("<div class='title'>" + $(this).attr("key") + ": " + $(this).attr("value") + "</div>");   
					});
				});
			}
			else
			{				
				$(".chapterInfo").append("No data available");
			}
		},
		error: function(){
			$(".chapterInfo").append("No data available");
		}
	});
});
