var url = window.location.href;
var intPos = url.indexOf("="); 
var slotno= url.substr(intPos + 1);
function getHTTPObject()
{
	var xmlhttp = false;
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e2)
		{
			xmlhttp = false;
		}
	}
	if ((!xmlhttp) && (typeof XMLHttpRequest != "undefined"))
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch(e)
		{
			xmlhttp = false;
		}
	}
	return xmlhttp;
}
$(document).ready(function(){GetEpgSysParam()});
/*Between the pages of the jump*/
function jump(id)
{
	if(id==1)
	{
		window.location.href="epgSys.asp?slotno="+slotno;
	}
	else
	{
		window.location.href="epgPro.asp?slotno="+slotno;
	}
}
/* Get EPG system configration parameters*/
function GetEpgSysParam()
{
	var CurrentRow = parent.CurrentRow;
	var xmlhttp = getHTTPObject();
	var PostParams = "CurSlot="+slotno;
	xmlhttp.open("POST", "/goform/EpgSysParamGet", true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", PostParams.length);
	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{
			if((xmlhttp.status>=200&&xmlhttp.status<300)||xmlhttp.status==304)
			{
				var response = xmlhttp.responseText.slice(7, -8);
				var response_array = response.split("&");
				AssignmentSys(response_array);
			}
		}
	}
	xmlhttp.send(PostParams);
	return true;
}
/* */
function AssignmentSys(response_array)
{
	$("#CurSlot").val(slotno);
	$("#IPAddr").val(response_array[0]);
	$("#Netmask").val(response_array[1]);
	$("#Gateway").val(response_array[2]);
	$("#Mac").html(response_array[3]);
}
function submitcheck(Language)
{
    var returnnum;
	if(Language == "English")
	{
		returnnum = ValidateNum($("#IPAddr"),"LOCAL_IP_ADDR","<IP Address>");
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateNum($("#Gateway"),"GATEWAY","<Gateway>");
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateNum($("#Netmask"),"SUBMASK","<Net Mask>");
		if(returnnum == false)
		{
			return;
		}
		$("#paramform").submit();
		setTimeout("self.location.reload(true)",1000);
	}
	else
	{
		returnnum = ValidateNum($("#IPAddr"),"LOCAL_IP_ADDR","<IP地址>");
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateNum($("#Gateway"),"GATEWAY","<网关地址>");
		if(returnnum == false)
		{
			return;
		}
		returnnum = ValidateNum($("#Netmask"),"SUBMASK","<子网掩码>");
		if(returnnum == false)
		{
			return;
		}
		$("#paramform").submit();
		setTimeout("self.location.reload(true)",1000);
	}	
}