/**
 * Begin news.js
 */

jQuery(document).ready(function($) {

	// Some common properties for both the artist and knerd news accordion widgets
	var homeTabAccordionConfig = {
			autoHeight: false,
			collapsible: true
		};

	// Set up the news accordian effects
	$("#hometab-knerd-news").accordion(homeTabAccordionConfig); // Knerd News
	$("#hometab-artist-news").accordion($.extend({ active: false }, homeTabAccordionConfig)); // Artist news, ALL collapsed by default (by adding {active: false})


	// More and Prev links for showing more news
	$(".load-more-news a,.load-prev-news a").live("click", function(event) {
		var newsType = $(this).attr("rel");
		var nextPageNum = $(this).attr("href");
		var newsContainer = $(this).closest(".news-container");

		showAjaxLoad($(this).closest('.news-container').find("div:first"));

		newsContainer.load("scripts/news/"+newsType+"-news.inc.php", {
				'page':nextPageNum
			},
			function() // callback for when new news has loaded
			{
				hideAjaxLoad();
				newsContainer.find(".hometab-news-accordion").accordion(homeTabAccordionConfig);
			}
		);

		event.preventDefault();
		return false; // prevent link from firing
	});


/**
 * END - news.js
 */

});