var str_dyvpan0 ="<tr align=center id=dyvpan0 Xstyle='display:none'>"
str_dyvpan0 +="<td width=5%><span id=dyn_id0>1</span></td>"
str_dyvpan0 +="<td width=20%><span id=_0>Dynamic IPSec1</span></td>" //Tunnel Name
str_dyvpan0 +="<td width=20%>" // Interface
var gwan = parseInt("0")
if(gwan == 30){
str_dyvpan0 +="<span id=_wiz_0>LAN</span>"
}
else if(gwan > 30){
str_dyvpan0 +="<span>VLAN</span>&nbsp;"+(gwan-30)
}
else{
str_dyvpan0 +="<span id=_wiz_0>WAN</span>&nbsp;"+(gwan+1)
}
str_dyvpan0 +="</td>"
str_dyvpan0 +="<td width=20%>" //Status
str_dyvpan0 +="<span id='tunnel_state00'>"
var ipsec_ike = true ;
var ipsec_pkey = false ;
var ipsec_tunstate = false ;
var ipsec_en = false ;
if(ipsec_ike && ipsec_pkey){
str_dyvpan0 +="<span id='ts2_0'><span id='_0'>Not configured</span></span>"
}
else if(ipsec_en){
str_dyvpan0 +="<span id='ts0_0'><span id=_wary_0>Off</span></span>"
}
else {
if(ipsec_tunstate) {
str_dyvpan0 +="<span id='ts1_0'><span id=dyntunnels></span> <span id=_0>Connection(s)</span></span>"
}
else{ str_dyvpan0 +="<span id='ts3_0'><span id='_wary_0'>On</span></span>" }
}
str_dyvpan0 +="</span>&nbsp;</td>"
str_dyvpan0 +="<td width=15%>"  // Enable
str_dyvpan0 +="<img id=c_ipsec_tun_en src=cboxed.gif>"
str_dyvpan0 +="</td>"
str_dyvpan0 +="<td width=15% align=center>" // Actions
str_dyvpan0 +="<input type=button id=_wary_0 value=Edit name=Edit onclick=\"clkmore(this,0,1,'vpndynip')\">"
str_dyvpan0 +="<input type=checkbox name=dyntunnel_del value=0 id=_c_tunnel_del0><span id=_wary_0>Select</span>"
str_dyvpan0 +="</td></tr>"
function count_inx_dyvpan(){
var nb0 = 'x';
var nb1 = 'x';
var str0 = 'x';
nb1 = '128';
if((nb0 =='x')&&(nb1 =='x')){ return str0 }
else {
return (nb0 =='0')?'0':nb1
}
}
function setrecord(ty){
var str1 = "0";
var sw_ov0 = false ;
var sw_ov1 = false ;
var ary_record = [];
var re_reco ="";
if(str1.indexOf('-')!=-1){
var _a0 = str1.split('-');
for(var q=0;q<_a0.length;q++){
if(sw_ov0 || sw_ov1){ //remove 0
if(_a0[q] != "0") { ary_record.push(_a0[q]) }
}
else { ary_record.push(_a0[q]) }
}
}
else if((sw_ov0 || sw_ov1)&&(str1 != "")){
if(str1 != "0") { ary_record.push(str1) } //remove 0
}
else if(str1 != ""){ ary_record.push(str1) }
for(var q=0;q<ary_record.length;q++){//remove 0
re_reco += (q == 0)?ary_record[q]:"-"+ary_record[q]
}
if(ty == 0) { return ary_record ;}
else if(ty == 1) { return re_reco ;}
else { return (sw_ov0 || sw_ov1) }
}
function show_dynserver_list(){
var div = document.getElementById("d_dynserver_list");
var _str1 = "0" ;
var ary_record = setrecord(0);
var re_reco = setrecord(1);
if(setrecord(3)){
sGURL("/hide.htm?S002012C1="+re_reco);
}
var table_str = "<table width=100% border=0 align=center cellpadding=0 cellspacing=0 class='staball'>"
for(var x=0;x<ary_record.length;x++){
table_str += eval("str_dyvpan"+ary_record[x])
}
div.innerHTML = table_str+"</table>";
for(var x=0;x<ary_record.length;x++){
var obj1 = document.getElementById("dyn_id"+ary_record[x]);
obj1.innerHTML = (parseInt(x)+1)
}
}
function del_dynserver_tunnel(){
var tmp_del = document.getElementsByName("dyntunnel_del");
var del_arr = new Array();
var dyntunnel_rule_index = new Array();
var dyn_name_v = [];
var dyn_name_csid = [];
var dyn_en_csid = [];
var index = 0;
var new_index = 1;
var str1 = setrecord(1);
var sent_str ="vpn0.htm?S002012C1=";
if(str1.indexOf('-')!=-1){
var _a0 = str1.split('-');
for(var q=0;q<_a0.length;q++){ dyntunnel_rule_index.push(_a0[q]) }
}
else{ dyntunnel_rule_index.push(str1) }
dyn_name_v.push("0")
dyn_name_csid.push("S00700100")
dyn_en_csid.push("N00700200")
dyn_name_v.push("128")
dyn_name_csid.push("S00700180")
dyn_en_csid.push("N00700280")
for(var t=0;t<tmp_del.length;t++)
{
if(tmp_del[t].checked)
{
del_arr[index] = tmp_del[t].value;
index++;
}
}
if(del_arr.length == 0)
{
alert(GetElmCont("lb_0","Please choose one or more rule."));
return false;
}
for(var r=0;r<dyntunnel_rule_index.length;r++)
{
for(var n=0;n<del_arr.length;n++)
{
if(dyntunnel_rule_index[r] == del_arr[n])
{
dyntunnel_rule_index[r] = "";
}
}
}
var ss =""
for(var a=0;a<dyntunnel_rule_index.length;a++)
{
if(dyntunnel_rule_index[a] != "")
{
ss += (ss == "")?dyntunnel_rule_index[a]:"-"+dyntunnel_rule_index[a]
}
}
sent_str += ss ;
for(var r=0;r<del_arr.length;r++)
{
d = del_arr[r];
for(var w=0;w<dyn_name_v.length;w++)
{ if( d == dyn_name_v[w]){ d = w ; break } }
sent_str += "&"+dyn_name_csid[d]+"=";
}
for(var r=0;r<del_arr.length;r++)
{
d = del_arr[r];
for(var w=0;w<dyn_name_v.length;w++)
{ if( d == dyn_name_v[w]){ d = w ; break } }
sent_str += "&"+dyn_en_csid[d]+"=0";
}
sent_str += "&_cce=0x80700002";
GURL(sent_str);
}