var objIdArray = ["totalBitrate", "effectiveBitrate"];
var ROW_NUM = 2;

window.onresize = function()
{
	GetMainContentHeight(BUTTON_TOP_MENU, NO_BUTTON_CHANGE);
}

$(document).ready(function()
{
	var args = GetArgs();
	slotNo = parseInt(args["slotNo"], 10);
	portNo = parseInt(args["portNo"], 10);
	GetMainContentHeight(BUTTON_TOP_MENU, NO_BUTTON_CHANGE);
	$("#pcrMenu").css("display", "none");
	funcUpdateDisplay();
	setInterval("displayParam();", 10000);
});

function funcUpdateDisplay() 
{
	DisableButton("refreshBtn");
	PageLoadStatus(true);
	
	displayParam();
	
	EnableButton("refreshBtn");
	PageLoadStatus(false);
}

function displayParam()
{
	var data;
	var sectionData;
	var response;
	var length;
	var xmlHttp = GetHTTPObject();
	
	xmlHttp.open("GET", "/goform/formEMR30?type=" + PORT_OUT_MONITOR + "&cmd=" + GET + "&language=" + language + "&slotNo=" + slotNo + "&portNo=" + portNo + "&ran=" + Math.random(), true);
	xmlHttp.onreadystatechange = function()
	{
		if((xmlHttp.readyState == 4) && (xmlHttp.status == 200))
		{
			response = AjaxStrDeal(xmlHttp.responseText);
			if(response != "")
			{
				data = response.split(FIRST_DELIMITER);				
				for(var i = 0; i < ROW_NUM; i++)
				{
					$("#" + objIdArray[i]).html(data[i]);
				}
				identifyData = data[2];
				displayMenu();
				refreshFlag = true;
			}
		}
	}
	xmlHttp.send(null);
}

function displayMenu()
{
	if(identifyData == OFF)
	{
		$("#pcrMenu").css("display", "none");
	}
	else
	{
		$("#pcrMenu").css("display", "");
	}
}
