<html>
   <head>
      <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
      <link rel="stylesheet" href='stylemain.css' type='text/css'>
         <link rel="stylesheet" href='colors.css' type='text/css'>
            <script language="javascript" src="util.js"></script>
            <script language="javascript">
<!-- hide

var Levels = '<%ejGetOther(GetFirewallofTR181Info,level)%>';	// format: level1|level2|
var Chains = '<%ejGetOther(GetFirewallofTR181Info, chain)%>';	// format: chain1|chain2| 

function btnApply()
{
	var loc = 'firewallOfTr181_view.html?action=AddLevel';

	var levelname = document.getElementById("Level_name").value;
	var levelchain = document.getElementById("Select_chain").value;
	var levelpolicy = document.getElementById("Level_policy").value;
	var levelenable = document.getElementById("Level_enable").checked?'1':'0';
	
	if(levelname == ''){
		alert("Please input the level name.");
		return;
	}
	var levelNames = Levels.split("|");
	for (var index = 0; index < levelNames.length -1; index++) {
		if(levelNames[index] == levelname){alert("The level name already exists.");return;}
	}

	loc += '&level='+levelname;
	loc += '&chain='+levelchain;
	loc += '&policy='+levelpolicy;
	loc += '&enable='+levelenable;
	// alert(loc);
	loc += '&sessionKey=<%ejGetOther(sessionKey)%>';
	var code = 'location="' + loc + '"';
	eval(code);
}

function frmLoad()
{
	var sc = document.getElementById("Select_chain");
	var chainNames = Chains.split('|');
	for(var i =0;i< chainNames.length -1;i++){
		sc.appendChild(new Option(chainNames[i],chainNames[i]));
	}
	if(sc.options.length == ''){
		alert("There are no chains,now jump to add chain page.");
		window.location = "addFirewallOfTr181Obj.html";
	}
}
// done hiding -->
 </script>
</head>
<body onLoad='frmLoad()'>
	<blockquote>
		<form name="TRFirewall">
			<b>Firewall Level -- Add</b><br><br>
			<!-- Note: Ipv4 address will prohibit edit if the NAT function of IPV4 is turned off.<br><br>
			Note: Ipv6 address will prohibit edit if the Ipv6 function of interface is turned off.<br><br> -->
			<center>
			<table>
				<tr>
					<td>Enable:</td>
					<td><input type="checkbox" id='Level_enable' checked></td>
				</tr>			
				<tr>
					<td>Level name:</td>
					<td><input type="text" id='Level_name' maxlength="16"></td>
				</tr>
				<tr>
					<td>Select Chain:</td>
					<td><Select id="Select_chain"></Select></td>
				</tr>
				<tr>
					<td>DefaultPolicy:</td>
					<td>
						<select id="Level_policy">
							<option value="Drop" selected>Drop</option>
							<option value="Accept">Accept</option>
						</select>
					</td>
				</tr>
			</table>
			</center>
			<br><br>
			<center><input type='button' onClick='btnApply()' value='Apply/Save'></center>
		</form>
	</blockquote>
</body>
</html>
