function getEMMStatus()
{
	var xmlhttp = false;
	var response;
	var params = "type=32&cmd=1&language=" + document.getElementById("language").value;
	
	xmlhttp = getHTTPObject();
	xmlhttp.open("POST", "/goform/formIPQAM", true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);

	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{
			response = xmlhttp.responseText.slice(7, -8);
			var emmStatusRows = response.split("&");
			var len = emmStatusRows.length;
			for(var i = 0; i < (len - 1); i++)
			{
				var rowData = emmStatusRows[i].split(",");
				document.getElementById("emm_conn_" + (i + 1)).innerHTML = rowData[0];
				document.getElementById("emm_bit_" + (i + 1)).innerHTML = rowData[1];
				document.getElementById("emm_ts_bit_" + (i + 1)).innerHTML = rowData[2];
			}
			var otherInfo = emmStatusRows[len - 1].split(",");
			document.getElementById("emm_total_bitrate").innerHTML = otherInfo[0];
			document.getElementById("memory_usage").innerHTML = otherInfo[1];
		}
	}
	xmlhttp.send(params);
}


function PageLoadHandler()
{
	document.body.style.cursor = "wait";
	window.status = "Retrieving data, please wait...";
	
	getEMMStatus();
	
	document.body.style.cursor = "auto";
	window.status = "Done";
}

window.onload = function()
{
	PageLoadHandler();
}
