// JavaScript Document

var xmlHttp;

function loadallgames(str,limitstart)
{
	document.getElementById('fullgame_loader').innerHTML='<div style="clear:both; padding-top:280px; height:280px;" align="center"><img src="./images/loading.gif"></div>';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://www.gamerflex.com/ajaxfunctions.php";
	url=url+"?page=allgames&limitstart="+limitstart;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
	
function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("fullgame_list").innerHTML=xmlHttp.responseText;
	} 
}
	
function GetXmlHttpObject()
{
	var xmlHttp=null;
	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 loadgames_byletter(str,limitstart)
{
	document.getElementById('fullgame_loader').innerHTML='<div style="clear:both; padding-top:280px; height:280px;" align="center"><img src="./images/loading.gif"></div>';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://www.gamerflex.com/ajaxfunctions.php";
	url=url+"?page=allgames_byletter&str="+str+"&limitstart="+limitstart;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function loadcomments(str,limitstart)
{
	document.getElementById('user_comments').innerHTML='<div style="clear:both; padding-top:160px; height:160px;" align="center"><img src="./images/loading.gif"></div>';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="http://www.gamerflex.com/ajaxfunctions.php";
	url=url+"?page=loadcomments&str="+str+"&limitstart="+limitstart;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged1() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("user_comments").innerHTML=xmlHttp.responseText;
	} 
}

function loadfavorites(str,limitstart)

{

	document.getElementById('user_favorites').innerHTML='<div style="clear:both; padding-top:90px; height:90px;" align="center"><img src="./images/loading.gif"></div>';

	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)

	{

		alert ("Browser does not support HTTP Request");

		return;

	}

	var url="http://www.gamerflex.com/ajaxfunctions.php";

	url=url+"?page=loadfavorites&str="+str+"&limitstart="+limitstart;

	url=url+"&sid="+Math.random();

	xmlHttp.onreadystatechange=stateChanged2;

	xmlHttp.open("GET",url,true);

	xmlHttp.send(null);

}



function stateChanged2() 

{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

	{ 

		document.getElementById("user_favorites").innerHTML=xmlHttp.responseText;

	} 

}
