$(document).ready(function() {
	slideShow.stop();
	updateSectionInfo();
	$("div#controls > a").attr("href","javascript:;");
	$("div#utilityband > a").attr("href","javascript:;");
	
	$("div#controls > a[@rel=prev]").click(function() {
		slideShow.prev();
		updateSectionInfo();
	});
	$("div#controls > a[@rel=next]").click(function() {
		slideShow.next();
		updateSectionInfo();
	});
	$("div#utilityband > a").click(function() {
		slideShow.goTo(parseInt($("img[@name=" + $(this).attr("rel") + " 1]").attr("id"))-1);
		updateSectionInfo();
	});
});
		
function updateSectionInfo() {
	var image = slideShow.getCurrentImage();
	if (image.attr("title") == undefined) {
		$("span#sectionname").html("");
	} else {
		$("span#sectionname").html(image.attr("title"));
	}
	var rel = image.attr("rel");
	if (rel != undefined) {
		if (rel.indexOf('last') != -1 || rel.indexOf('first') != -1)
		{
			resetUtilityBand()
			$("div#utilityband > a[@rel=" + image.attr("alt") + "]").addClass("selected");
		}
	}
}

function resetUtilityBand() {
	$("div#utilityband > a").removeClass("selected");
}