/*
*	Archive Browser
*	Generates an interface for browsing show archives by year and month
*	
*	Requires jQuery library (http://www.jquery.com)
*	
*	Taylan Pince (taylan@trapeze.com) - August 2, 2007
*/

if (typeof trapeze == 'undefined') trapeze = new Object();

trapeze.ArchiveBrowser = {
	
	mark_inits : function() {
		$("#ShowArchiveBrowser").find("a.active").addClass("init-value");
	},
	
	generate : function() {
		$("#ShowArchiveBrowser").find("li.year > a").click(function() {
		    $ul = $(this).parents("ul")
			$ul.find("li.year > a.active").parent().find("ul").slideUp();
			$ul.find("a.active").removeClass("active");
			$(this).parent().find("a.init-value").addClass("active");
			$(this).addClass("active").parent().find("ul").slideDown();
		}).attr("href", "javascript:void(0);");
	},
	
	init : function() {
		if ($("#ShowArchiveBrowser").size() > 0) {
			this.generate();
			this.mark_inits();
		}
	}
	
};

$(function() {
	trapeze.ArchiveBrowser.init();
});