//Browser Support Code
function RefreshCredits()
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Something went wrong
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if (ajaxRequest.readyState == 4)
		{
			if (ajaxRequest.responseText != "error")
			{
//				document.myForm.time.value = ajaxRequest.responseText;
				document.getElementById("credits_div").innerHTML = ajaxRequest.responseText;
			}
			else
			{
			}
		}
	}
	ajaxRequest.open("GET", "/current-credits.php", true);
	ajaxRequest.send(null); 
}

//Browser Support Code
function PostComments()
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Something went wrong
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if (ajaxRequest.readyState == 4)
		{
			if (ajaxRequest.responseText != "error")
			{
				document.getElementById("CommentArea").innerHTML = ajaxRequest.responseText;
			}
		}
	}
	var l_comment = encodeURIComponent( document.getElementById("comment").value)
	var l_gameID = encodeURIComponent( document.getElementById("id_game").value)
	var l_parameters = "comment=" + l_comment + "&id_game=" + l_gameID
	ajaxRequest.open( "POST", "post_comment.php", true);
	ajaxRequest.setRequestHeader( "Content-type", "application/x-www-form-urlencoded")
	ajaxRequest.send( l_parameters); 
}


//Browser Support Code
function VoteStars( p_num)
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				// Something went wrong
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if (ajaxRequest.readyState == 4)
		{
			if (ajaxRequest.responseText != "error")
			{
				document.getElementById("DivStars").innerHTML = ajaxRequest.responseText;
			}
		}
	}
	var l_gameID = encodeURIComponent( document.getElementById("id_game").value)
	var l_parameters = "note=" + p_num + "&id_game=" + l_gameID
	ajaxRequest.open( "POST", "post_rating.php", true);
	ajaxRequest.setRequestHeader( "Content-type", "application/x-www-form-urlencoded")
	ajaxRequest.send( l_parameters); 
}
