/**
* Inferno Top X Stats
* Developer: Zero Tolerance
* Distributer: Inferno Technologies
* Copyright Inferno Technologies, All rights reserved
* * * * * * * * * * * * * * * * * * *
*/

_inferno_topxstats = function()
{
	this.loading = false;
	this.topxstats = my_getbyid('inferno_topxstats');

	this.fetch_top_x_stats = function()
	{
		if (this.loading)
		{
			return false;
		}

		this.loading = true;

		this.ajax_xstats = new ajax_request();
		this.ajax_xstats.onreadystatechange(InfernoTopXStats.got_top_x_stats);
		this.ajax_xstats.process(ipb_var_base_url + 'act=idx&topxstatsonly=1');
	}

	this.got_top_x_stats = function()
	{
		if (InfernoTopXStats.ajax_xstats.readystate_ready_and_ok())
		{
			if (my_getbyid('fc_inferno_topxstats'))
			{
				if (InfernoTopXStats.ajax_xstats.xmlhandler.responseText == '')
				{
					my_getbyid('fc_inferno_topxstats').parentNode.removeChild(my_getbyid('fc_inferno_topxstats'));	
				}
				else
				{
					my_getbyid('fc_inferno_topxstats').innerHTML = InfernoTopXStats.ajax_xstats.xmlhandler.responseText;
				}
			}

			InfernoTopXStats.loading = false;
		}
	}
}

InfernoTopXStats = new _inferno_topxstats();