var card_index;
var language;
function getCardStatus()
{
	var xmlhttp = false;
	var response;
	var cardStatus;
	var params = "type=9&cmd=1&card=" + card_index + "&language=" + language;
	
	xmlhttp = getHTTPObject();
	xmlhttp.open("POST", "/goform/formIPQAM", true);
	if((bd.browser != "IE") && (language == 1))
	{
		xmlhttp.overrideMimeType("text/html;charset=gb2312");
	}
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);

	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{
			if((bd.browser == "IE") && (language == 1))
			{
				response = gb2utf8(xmlhttp.responseBody);
				var index = response.indexOf("</html>");
				var bias = response.length - index;
				response = response.slice(7, - bias);
			}
			else
			{
				response = xmlhttp.responseText.slice(7, -8);
			}

			cardStatus = response.split(",");
			document.getElementById("serial_num").innerHTML = cardStatus[0];
			document.getElementById("version_num").innerHTML = cardStatus[1];
			document.getElementById("gbe_port").innerHTML = cardStatus[2];
			document.getElementById("clock").innerHTML = cardStatus[3];
		}
	}
	xmlhttp.send(params);
}


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

window.onload = function()
{
	var args = getArgs();
	var nodeId = args["nodeId"];
	if(nodeId == null)
	{
		nodeId = parent.curTree.getSelectedNodes()[0].id;
	}
	card_index = nodeId;
	
	//chenjin,20130613,the tree added a node of monitor 10GbE measure
	card_index = card_index - 1;    
	
	document.getElementById("card_num").innerHTML = card_index;
	language = document.getElementById("language").value;
	PageLoadHandler();
}
