$(document).ready(function()
{			
	$("#tabs").tabs();
	$.ajax({
    	type: "GET",
    	url: "giglist.xml",
    	dataType: "xml",
    	success: function(xml) { parseXml(xml); }
    });
    $('#gallery a').lightBox({fixedNavigation:false});
    
    var $tabs = $('#tabs').tabs(); // first tab selected

	$('#my-text-link').click(function() { 
    	$tabs.tabs('select', 1); // switch to third tab
    	return false;
	});
});

function parseXml(xml)
{
	$("#gigList").append("<ul>");
	$(xml).find("entry").each(function()
	{
		var mapRef = $(this).find("MapLink").text();
		if(mapRef != "undefined" && mapRef != "")
		{
			var $link = "<a href='" + unescape(mapRef) + "'>map</a>";
		}
		else
		{
			var $link = "";
		}
		$("#gigList").append("<li>" + $(this).find("Title").text() + ": " + $(this).find("Date").text() + " " + $link + "</li>");
	});
	$("#gigList").append("</ul>");
}
