function clkaction(para)
{
if(timer1!=null)clearTimeout(timer1);
var t=new Date();
refreshlist2(para)
}
function createxmllist(xmlurl,mtag)
{
xmlDoc=loadXMLDocs(xmlurl);
z=xmlDoc.getElementsByTagName(mtag)
xmlarys=new Array()
for (j=0;j<z.length;j++)
{
xmlarys[j]=new Array()
ruleid=z[j].getAttribute("id")
x=z[j].childNodes;
y=z[j].firstChild;
xmlarys[j][0]=ruleid;
for (i=0;i<x.length;i++)
{
xmlarys[j][i+1]=""
if (y.nodeType==1)
{  //Process only element nodes (type 1)
nodevalues=y.childNodes[0].nodeValue
}
y=y.nextSibling;
xmlarys[j][i+1]=nodevalues
}
}
return xmlarys
}
function refreshlist(paras)
{
frm=document.forms[0]
alt=document.getElementById('_sr_')
xx=document.getElementById('tab0')
lists=createxmllist(xmlurl+((arguments.length>0)?("?"+paras):""),"tunnel")
startrow=1;
if(xx!=null)
{
xrowl=xx.rows.length
for (k=0;k<xrowl-startrow;k++)xx.deleteRow(startrow)
for (i=0;i<lists.length;i++)
{
z=xx.insertRow(i+startrow)
for (j=0;j<lists[i].length;j++)z.insertCell(j).innerHTML=lists[i][j]
z.align="center";
z.style.lineHeight="22px";
}
chgLang()
setTabStyle('tab0')
setTimeout("swid('csta',true)",800)
timer1=setTimeout("refreshlist()",2000)
}
}
function refreshlist2(paras)
{
frm=document.forms[0]
lists=createxmllist(xmlurl+((arguments.length>0)?("?"+paras):""),"tunnel")
idary=new Array('tlna','vip','rip','tlsta','tlact')
for (i=0;i<lists.length;i++)
{
for (j=0;j<idary.length;j++)
{
var obj = document.getElementById(idary[j]+i);
if( obj != null)
{
document.getElementById(idary[j]+i).innerHTML=lists[i][j+1]
}
}
}
chgLang()
timer1=setTimeout("refreshlist2()",2000)
}
function clkedit()
{
for(k=1;k<arguments.length;k++)
{
xid=arguments[k]
swids('tabss'+xid,true);
xDiv('edit'+xid,false);
swids('tlname'+xid,false,'tltext'+xid,true);
ddiv=document.getElementById('Nruleedit'+xid)
if(ddiv!=null)ddiv.value=1;
}
}
function setreject(xobj,ix) //MSCHAP or MSCHAPv2
{
if(xobj.checked)
{
setck(arguments[1],true,arguments[2],true,arguments[3],true)
}
}
function clkdefgw(dgwck,ix)
{
ix="";
if(dgwck.value == 0){
document.getElementById('routes'+ix).value="0.0.0.0/0"
document.getElementById('route'+ix).value="0.0.0.0/0"
}
else {
chkS(document.getElementById('routes'+ix),'v')
document.getElementById('route'+ix).value = document.getElementById('routes'+ix).value
}
}
function wrroute(routes,ix)
{
ix="";
document.getElementById('route'+ix).value=routes.value
}
encrytext=new Array(
"_31","_32","_33"
,"_u31_1","_u32_1","_u33_1"
,"_u31_2","_u32_2","_u33_2"
,"_u31_3","_u32_3","_u33_3"
,"_aprim_63_","_aprim_64_","_al2tps_5_","_al2tps_6_"
)
encryra=new Array(
"rpap0","rpap1","rpap2"
,"rchap0","rchap1","rchap2"
,"rmschap0","rmschap1","rmschap2"
,"rmschapv20","rmschapv21","rmschapv22"
)
function dixencry(tf)
{
for(t1=0;t1<encryra.length;t1++)
{
ww=document.getElementById(encryra[t1])
if(ww!=null)  ww.disabled = !tf
}
for(t1=0;t1<encrytext.length;t1++)
{
ww=document.getElementById(encrytext[t1])
if(ww!=null)  ww.style.color = tf?"#333333":"#919191"
}// style="color:#A8A8A8"
if(tf) clkmppe(document.getElementById('mppeck'))
}
function setcli_port(obj){
g_hcli_port = document.getElementById("h_l2tp_cli_port")
g_scli_port = document.getElementById("s_l2tp_cli_port")
g_tcli_port = document.getElementById("t_l2tp_cli_port")
if(typeof(obj) != 'object'){
ops = "U_df" ;
for(i=0;i<g_scli_port.length;i++){
if(obj == g_scli_port.options[i].value){ ops = i ; break };
}
if(ops == "U_df"){g_scli_port.value = ops}
else { g_scli_port.options[ops].selected = true ;}
g_tcli_port.disabled = (!(ops == "U_df"));
g_tcli_port.value = obj ;
g_hcli_port.value = g_tcli_port.value
}
else{
g_tcli_port.disabled = (obj.value != "U_df")
g_tcli_port.value = (obj.value != "U_df")?obj.value:0
g_hcli_port.value = g_tcli_port.value
if(obj.value != "U_df") {clear_valchk(g_tcli_port)}
}
}
function setV(obj){
g_hcli_port = document.getElementById("h_l2tp_cli_port")
g_hcli_port.value = obj.value
}
function sev_cli_port(obj){
g_hcli_lns_port = document.getElementById("h_l2tp_cli_lns_port")
g_tcli_lns_port = document.getElementById("t_l2tp_cli_lns_port")
if(typeof(obj) != 'object'){
p_value = (obj == 0)?"1701":obj;
g_hcli_lns_port.value = obj;
g_tcli_lns_port.value = p_value;
clear_valchk(g_tcli_lns_port)
}
else{
g_hcli_lns_port.value = obj.value;
}
}