var xmlHttp
var setAtt = new Object();
var where
var myInput
function GetXmlHttpObject() {
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function userGames(id, type, str) {
	xmlHttp=GetXmlHttpObject()
	setAtt.id = id;
	setAtt.type = type;
	setAtt.myInput = str;
	document.getElementById(setAtt.myInput).value = 'Adding...';
	document.getElementById(setAtt.myInput).disabled = true;
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="/global/usergames.php"
	url=url+"?id="+id + "&type="+ type +"&ms=" + new Date().getTime();
	xmlHttp.onreadystatechange = stateChangedAdd 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
} 

function stateChangedAdd() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById(setAtt.myInput).value = 'Game Added';
		alert('Awesome! You have added this game to your profile');
	}
} 