// Javascript admin functions...
// these are basic ajax function that are used for admin purposes.

function addToEdPicks(gameid) {
	var xmlhttp =  new XMLHttpRequest();
	xmlhttp.open('POST', 'subs/admin_addtoedpicks.php', true);
	xmlhttp.onreadystatechange = function() {
    	if (xmlhttp.readyState == 4) {
    		// Your callback code goes here
			//alert(xmlhttp.status);
			//alert(xmlhttp.responseText);
			//document.getElementById("game_rating").innerHTML = xmlhttp.responseText;
			alert("Game added to Editor's Picks!");
   		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send('game=' + gameid);				
}

function addToFeatures(gameid) {
	var xmlhttp =  new XMLHttpRequest();
	xmlhttp.open('POST', 'subs/admin_addtofeatures.php', true);
	xmlhttp.onreadystatechange = function() {
    	if (xmlhttp.readyState == 4) {
    		// Your callback code goes here
			//alert(xmlhttp.status);
			//alert(xmlhttp.responseText);
			//document.getElementById("game_rating").innerHTML = xmlhttp.responseText;
			alert("Game added to Features!");
   		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send('game=' + gameid);				
}

function approveGame(gameslug) {
	var xmlhttp =  new XMLHttpRequest();
	xmlhttp.open('POST', 'subs/admin_approvegame.php', true);
	xmlhttp.onreadystatechange = function() {
    	if (xmlhttp.readyState == 4) {
    		// Your callback code goes here
			//alert(xmlhttp.status);
			//alert(xmlhttp.responseText);
			//document.getElementById("game_rating").innerHTML = xmlhttp.responseText;
			alert("Game Approved!");
   		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send('game=' + gameslug);				
}

function denyGame(gameslug) {
	var xmlhttp =  new XMLHttpRequest();
	xmlhttp.open('POST', 'subs/admin_denygame.php', true);
	xmlhttp.onreadystatechange = function() {
    	if (xmlhttp.readyState == 4) {
    		// Your callback code goes here
			//alert(xmlhttp.status);
			//alert(xmlhttp.responseText);
			//document.getElementById("game_rating").innerHTML = xmlhttp.responseText;
			alert("Game Denied!");
   		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send('game=' + gameslug);				
}