$(document).ready(_getBoxContent);

$('#infobox-head ul li a').click(function()
{
	var strLink = $(this).attr('href');
	var arrLink = strLink.split('#');

	_getBoxContent(arrLink[1], this);
});

function _getBoxContent(strLink, el)
{
	$('#infobox-head ul li a').removeClass('active');
	$('#infobox-head ul li a').css('background-color', 'transparent');

	$(el).css('background-color', '#bd0100');
	$(el).addClass('active');

	if (typeof(strLink) == 'undefined' || typeof(strLink) == 'function') {
		strLink = '';
	}

	if (typeof(el) != 'undefined') {
//		el = $('#infobox-head ul li a');
//		for (i = 0, j = el.length; i < j; i++)
//		{
//			if ($(el[i]).hasClass('active'))
//			{
//				break;
//			}
//			$(el[i]).css('background-color', '#bd0100');
//		}
	}
	else
	{
		$('#infobox-head ul li a:first').css('background-color', '#bd0100');
		$('#infobox-head ul li a:first').addClass('active');
	}

	$.get(
			url + 'ajax/special/' + strLink,
			function(data)
			{
				$('#infobox-content').html(data);
			}
		  );
}


function toggleTicker(gameId)
{
	waitBox('#matchticker', 'show');
	
	if (gameId == undefined)
	{
		gameId = '';
	}
	$.get(
			url + 'ajax/match/' + gameId,
			function(data)
			{
				$('#matchticker').html(data);
				waitBox('#matchticker', 'hide');
			}
		  );
}