var MENU_GAMES_EXTRA_TIMEOUT = 100;
var MENU_GAMES_EXTRA_SCROLLSTEP = 20;
var MENU_GAMES_EXTRA_SCROLLINTERVAL = 10;

function showMenuGamesExtra() {
	// Clear previous timeout
	clearMenuGamesExtraTimeout();

	var oMenu = document.getElementById('menuGamesExtra');
	var oMenuList = oMenu.getElementsByTagName('ul')[0];
	oMenu.oMenuList = oMenuList;

	// Show menu
	if (oMenu.className != 'Visible') {
		// Save the top offset
		oMenuList.currentScrollTop = -oMenuList.clientHeight;
		// Set the top offset
		oMenuList.style.top = oMenuList.currentScrollTop + 'px';
		// Unhide the menu
		oMenu.className = 'Visible';
	}
	
	// Start scrolling down
	scrollDownMenuGameExtra();
}

function hideMenuGamesExtra() {
	// Clear previous timeout
	clearMenuGamesExtraTimeout();
	// Wait for the timeout and csroll up the menu
	var oMenu = document.getElementById('menuGamesExtra');
	oMenu.showTimout = window.setTimeout('scrollUpMenuGameExtra();', MENU_GAMES_EXTRA_TIMEOUT);
}

function clearMenuGamesExtraTimeout() {
	var oMenu = document.getElementById('menuGamesExtra');
	if (oMenu.showTimout) {
		window.clearTimeout(oMenu.showTimout);
	}
}

function scrollDownMenuGameExtra() {
	var oMenuList = document.getElementById('menuGamesExtra').oMenuList;
	if (!oMenuList.scrollDownInterval && oMenuList.currentScrollTop != 0) {
		// Clear interval for scrolling up
		if (oMenuList.scrollUpInterval) {
			window.clearInterval(oMenuList.scrollUpInterval);
			oMenuList.scrollUpInterval = 0;
		}
		// Set the top offset
		oMenuList.style.top = oMenuList.currentScrollTop + 'px';
		// Start scrolling down
		oMenuList.scrollDownInterval = window.setInterval('stepDownMenuGameExtra()', MENU_GAMES_EXTRA_SCROLLINTERVAL);
	}
}

function stepDownMenuGameExtra() {
	var oMenuList = document.getElementById('menuGamesExtra').oMenuList;
	if (oMenuList.currentScrollTop < -MENU_GAMES_EXTRA_SCROLLSTEP) {
		oMenuList.currentScrollTop += MENU_GAMES_EXTRA_SCROLLSTEP;
		oMenuList.style.top = oMenuList.currentScrollTop + 'px';
	} else {
		window.clearInterval(oMenuList.scrollDownInterval);
		oMenuList.scrollDownInterval = 0;
		oMenuList.style.top = 0;
		oMenuList.currentScrollTop = 0;
	}
}

function scrollUpMenuGameExtra() {
	var oMenuList = document.getElementById('menuGamesExtra').oMenuList;
	if (!oMenuList.scrollUpInterval && oMenuList.currentScrollTop > -oMenuList.clientHeight) {
		// Clear interval for scrolling down
		if (oMenuList.scrollDownInterval) {
			window.clearInterval(oMenuList.scrollDownInterval);
			oMenuList.scrollDownInterval = 0;
		}
		// Start scrolling up
		oMenuList.scrollUpInterval = window.setInterval('stepUpMenuGameExtra()', MENU_GAMES_EXTRA_SCROLLINTERVAL);
	}
}

function stepUpMenuGameExtra() {
	var oMenuList = document.getElementById('menuGamesExtra').oMenuList;
	if (oMenuList.currentScrollTop > -oMenuList.clientHeight+MENU_GAMES_EXTRA_SCROLLSTEP) {
		oMenuList.currentScrollTop -= MENU_GAMES_EXTRA_SCROLLSTEP;
		oMenuList.style.top = oMenuList.currentScrollTop + 'px';
	} else { +
		window.clearInterval(oMenuList.scrollUpInterval);
		oMenuList.scrollUpInterval = 0;
		oMenuList.style.top = -oMenuList.clientHeight + 'px';
		oMenuList.currentScrollTop = -oMenuList.clientHeight;
		document.getElementById('menuGamesExtra').className = 'Hidden';
	}
}