var objIdArray = ["hardVersion", "softVersion", "kernelVersion", "bootVersion", "webVersion", "fpgaVersion1", "fpgaVersion2", "fpgaVersion3", "lcdCpld", "backbordSn"];
var SEC_NUM = 7;

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

$(document).ready(function()
{
	GetMainContentHeight(BUTTON_BOTTOM_NO_MENU, NO_BUTTON_CHANGE);
	funcUpdateDisplay();	
});

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

function displayParam() 
{
	var curLiNum;
	var initLiNum;
	var data;
	var length;
	var sectionData;
	var sectionLength;
	var response;
	var xmlHttp = GetHTTPObject();

	xmlHttp.open("GET", "/goform/formEMR30?type=" + VERSION_MONITOR + "&cmd=" + GET + "&language=" + language 
		+ "&slotNo=" + slotNo + "&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);
				length = data.length;
				for(var i = 0; i < length; i++)
				{
					sectionData = data[i].split(SECOND_DELIMITER);
					sectionLength = sectionData.length;
					$("#versionUlLeft" + i).empty();
					$("#versionUlRight" + i).empty();	
					initLiNum = 1;
					while(initLiNum < Math.ceil((sectionLength - 1)/2)*2)
					{
						$("#versionUlLeft" + i).append("<li id='cardVersion" + i + initLiNum +"'></li>");
						$("#versionUlRight" + i).append("<li id='cardVersion" + i + (initLiNum + 1) +"'></li>");
						initLiNum += 2;
					}
					curLiNum = Math.ceil((sectionLength - 1)/2);
					$("#versionInfo" + i).css("height", (45 + (curLiNum - 1)*25) + "px");
					for(var j = 0; j < sectionLength; j++)
					{
						$("#cardVersion" + i + j).html(sectionData[j]);	
					}
					if(i != 0)
					{						
						$("#bar" + i).css("display", "");
						$("#versionInfo" + i).css("display", "");
					}					
				}
				for(var i = length; i < SEC_NUM; i++)
				{
					$("#bar" + i).css("display", "none");
					$("#versionInfo" + i).css("display", "none");
				}
				refreshFlag = true;
				ChangeButtonLocation();
			}			
		}
	}
	xmlHttp.send(null);
}