function showSmallFlashGames() {	var smallFlashGames = document.getElementById('smallFlashGames');	var multiplayerFlashGames = document.getElementById('multiplayerFlashGames');		smallFlashGames.style.display = 'block';	multiplayerFlashGames.style.display = 'none';}function showMultiplayerFlashGames() {	var smallFlashGames = document.getElementById('smallFlashGames');	var multiplayerFlashGames = document.getElementById('multiplayerFlashGames');		smallFlashGames.style.display = 'none';	multiplayerFlashGames.style.display = 'block';}function sortSmallFlashGamesByName() {	sortGames(true, false, 'name');}function sortSmallFlashGamesByPopularity() {	sortGames(true, false, 'popularity');}function sortSmallFlashGamesByDate() {	sortGames(true, false, 'date');}function sortMultiplayerFlashGamesByName() {	sortGames(false, true, 'name');}function sortMultiplayerFlashGamesByPopularity() {	sortGames(false, true, 'popularity');}function sortMultiplayerFlashGamesByDate() {	sortGames(false, true, 'date');}function sortGames(isSmallFlashGames, isMultiplayerFlashGames, sort) {	var xmlHttpRequest;	try {		xmlHttpRequest = new XMLHttpRequest();	} catch(e) {		xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");	}		xmlHttpRequest.onreadystatechange = function() {		if(xmlHttpRequest.readyState != 4) return;				sortGamesResultsGot(isSmallFlashGames, isMultiplayerFlashGames, xmlHttpRequest);	};		xmlHttpRequest.open("GET", "/ajax/getSortedIDs.php?type=" + (isSmallFlashGames ? 'smallFlashGames' : 'multiplayerFlashGames') + "&sort=" + sort, true);	xmlHttpRequest.send(null);}function sortGamesResultsGot(isSmallFlashGames, isMultiplayerFlashGames, xmlHttpRequest) {	var ids = xmlHttpRequest.responseText.split(',');	var games = document.getElementById(isSmallFlashGames ? 'smallFlashGames' : 'multiplayerFlashGames');	var linkBoxGames;	var idPrefix = 'game_' + (isSmallFlashGames ? '' : 'm');	var gameBoxes;	var otherBoxes;	var gameBoxesSorted;	var id;	var i;		for(i=0;i<games.childNodes.length;i++) {		if(games.childNodes[i].nodeType != 1) continue;				if(games.childNodes[i].className == 'linkBoxGames') {			linkBoxGames = games.childNodes[i];			break;		}	}		gameBoxes = new Array();	otherBoxes = new Array();		for(i=0;i<linkBoxGames.childNodes.length;i++) {		if(linkBoxGames.childNodes[i].nodeType != 1) continue;				id = linkBoxGames.childNodes[i].getAttribute('id');				if(id != null && id.substr(0, 5) == 'game_') {			id = parseInt(id.substr(idPrefix.length));			gameBoxes[id] = linkBoxGames.childNodes[i];					} else {			otherBoxes.push(linkBoxGames.childNodes[i]);		}	}		for(i=0;i<gameBoxes.length;i++) {		if(!gameBoxes[i]) continue;				linkBoxGames.removeChild(gameBoxes[i]);	}		gameBoxesSorted = new Array();		for(i=0;i<ids.length;i++) {		gameBoxesSorted[i] = gameBoxes[parseInt(ids[i])];	}		for(i=0;i<gameBoxesSorted.length;i++) {		linkBoxGames.appendChild(gameBoxesSorted[i]);	}		for(i=0;i<otherBoxes.length;i++) {		linkBoxGames.appendChild(otherBoxes[i]);	}}function showHelp(index) {	var element = document.getElementById('help' + index);		hidePopups();		element.style.visibility = 'visible';}function hidePopups() {	var element;	var i;		for(i=0;i<3;i++) {		element = document.getElementById('help' + i);		element.style.visibility = 'hidden';	}}