var ostat_http = null;
 
function init_ostat_ajax()
{
	if (window.XMLHttpRequest){
		ostat_http = new XMLHttpRequest();	
	}
	
	else if (window.ActiveXObject){
		ostat_http = new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function refresh_ostat()
{
	if (ostat_http != null)
	{
        ostat_http.open("POST", "update_online_status.php", true);
		ostat_http.onreadystatechange = ostat_refreshed;
		ostat_http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ostat_http.send(null);
		
		window.setTimeout("refresh_ostat()", 30000);
	}
}

function ostat_refreshed()
{
	if (ostat_http.readyState == 4)
	{
		// ...
	} 
}

function start_ostat()
{
    init_ostat_ajax();
    refresh_ostat();
}