/*
	loads the initial homepage news
*/
window.addEvent('domready', function(){getHomeNews(1);});

/*
	gets the home page news based on the passed section
*/
function getHomeNews(subjectID)
{
	var request = new Request.HTML(
	{
		url: subPath + '_ajax/get_home_news.aspx',
		data: 'SubjectID=' + subjectID,
		update: $('homeNews'),
		onRequest: function()
		{			
			$('homeNews').set('html', '<p class=\"ajaxLoaderCircleIcon\">Loading news...</p>');	
		},
		onFailure: function()
		{
			$('homeNews').set('html', '<p class=\"errorIcon errorMsg\">The AJAX request failed...</p>');
		}
	}).send();
	
	return false;
}

/*
	set up the cookie to play the sounds
*/
var playSound = Cookie.read("playSound");
if ((playSound != 'true') && (playSound != 'false')) {
	playSound = 'true';
	Cookie.write('playSound', 'true', {duration: 30});
}
/*
	toggles the sound cookie on/off
*/
function toggleSound() {
	playSound = Cookie.read("playSound");
	if (playSound == 'true') {
		playSound = 'false';
	} else {
		playSound = 'true';
	}
	Cookie.write('playSound', playSound, {duration: 30});
}