var videoIdArray = ["input", "inputStatus", "inResolution", "frameRate", "videoBitrate", "clcLine", "vidContCount"];
var audio1IdArray = ["status1", "standard1", "bitrate1", "lrSel1", "aud1ContCount"];
var audio2IdArray = ["status2", "standard2", "bitrate2", "lrSel2", "aud2ContCount"];
var audio3IdArray = ["status3", "standard3", "bitrate3", "lrSel3", "aud3ContCount"];
var audio4IdArray = ["status4", "standard4", "bitrate4", "lrSel4", "aud4ContCount"];
var objIdArray = [videoIdArray, audio1IdArray, audio2IdArray, audio3IdArray, audio4IdArray];
var SEC_NUM = 5;

window.onresize = function()
{
	GetMainContentHeight(BUTTON_BOTTOM_MENU, BUTTON_CHANGE);
}

$(document).ready(function()
{
	var args = GetArgs();
	slotNo = parseInt(args["slotNo"], 10);
	portNo = parseInt(args["portNo"], 10);
	GetMainContentHeight(BUTTON_BOTTOM_MENU, BUTTON_CHANGE);
	funcUpdateDisplay();
	setInterval("displayParam();", 5000);
});

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_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 < SEC_NUM; i++)
				{
					sectionData = data[i].split(SECOND_DELIMITER);
					length = sectionData.length;
					for(var j = 0; j < length; j++)
					{
						$("#" + objIdArray[i][j]).val(sectionData[j]);
					}
				}
				refreshFlag = true;
			}
		}
	}
	xmlHttp.send(null);
}