$(document).ready(function() {
	 $("ul.filterList li input").click(updateList);
	 $(".colorbox").colorbox({opacity:0.80});
	 $(".colorboxIframe").colorbox({iframe:true,width:400,height:460,opacity:0.80});
	 updateList();
});

function updateList() {
	$("ul.artistList li").removeClass("hidden");
	$("div.errorMessage").hide();

	if (!$("ul.filterList li input:checked").length) {
		// No filters checked - show all of the artists.
		$("ul.artistList li").fadeIn("slow");
	}
	else {
		// Filters checked -
		// Hide artists who don't have ALL of the checked filters.
		jQuery.each($("ul.filterList li input:checked"), function() {
			$("ul.artistList li").not("."+this.id).addClass("hidden").fadeOut("slow");
		});
		
		// Show artists who don't have the "hidden" class.
		$("ul.artistList li").not(".hidden").fadeIn("slow");
	}
	
	checkNone();
}

function checkNone() {
	if (!$("ul.artistList li").not(".hidden").length) {
		$("div.errorMessage").fadeIn("fast");
	}
}

function openColorboxLink(e) {
    $(e).colorbox({open:true});
    return false;
}

