function clickGameTab(el,num) {
	var belowTab;
	// reset all tabs
	var tabs = $('#gameSelect li');
	for(i=0;i<tabs.length;i++) {
		tabs[i].className = '';
	}
	// reset all detail panes
	var panes = $('#relatedGamesData div');
	for(i=0;i<panes.length;i++) {
		if(panes[i].className == 'gameDetail clearfix') {
			if(panes[i].id != 'pane' + num) {
				panes[i].style.display = 'none';
			} else {
				panes[i].style.display = '';
			}
		}
	}
	// current tab
	document.getElementById('select' + num).className = 'selected';
	// tab above
	if (num > 0) {
		document.getElementById('select' + (num-1)).className = 'aboveSelect';
	}
	// tab below
	if ( belowTab = $('#select' + (num+1)) )	{
		belowTab.className = 'belowSelect';
	}
	return false;
}

var t;
var lastId = '-2';
// get new live reports
function getReport() {
	// send request
	$.ajax({
		type: 'GET',
		url: urlReport + '&lastId=' + lastId ,
		error: function(a,b,c) { alert(b); },
		success: function(data) {
			if (data != '') {
				$('#reportContainer').prepend(data);
				$('#reportContainer .new').fadeIn('def', function () {
					$('#reportContainer .new').colorBlend( [{param:'background-color',colorList:['#fcffcb','#ffffff'],isFade:false,fps:300,cycles:1}] )
						.removeClass('new');
				});
			}
		},
		complete: function() {startRetrieve();}
		 });
}
function startRetrieve() {
	preLastId = lastId;

	tempId = $('#reportContainer > *:first').attr('id');
	lastId = tempId == undefined ? lastId : tempId;

	if (lastId != '0') {
		t = setTimeout('getReport()', 25000);

		if (lastId == '-1' && preLastId != '-1') {
			toggleStatus(false);
			$('#now').show();
		}
	} else {
		toggleStatus(true);
		$('#reportEnded').html('<strong>This article has been closed, no further updates to be expected.</strong>');
	}

}
function toggleStatus(hide) {
	$('#now').toggle(hide);
}