function showImg(page)
{
mn3=mn.substring(0,3)
mn1=mn.substring(0,1)
var imgt=""
if(mn=="714P+")imgt="bp"
if(mn=="714P+")mn="714pp"
if(mn1=="8")imgt="hv"
var img=mn.toLowerCase()+".gif";
if(page=="main")
{
document.write("<TABLE WIDTH=765 BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD WIDTH=765 HEIGHT=95 BACKGROUND=/tbk"+imgt+".gif VALIGN=TOP ALIGN=RIGHT>")
document.write("<IMG SRC=/sp.gif WIDTH=472 HEIGHT=68 BORDER=0 USEMAP=#m_l1><MAP NAME=m_l1><AREA SHAPE=rect COORDS='18,8,152,58' HREF=http://www.dlink.com TARGET=_blank></MAP><IMG SRC=/t"+img+"><IMG SRC=/sp.gif WIDTH=153 HEIGHT=68></TD></TR></TABLE>")
}
else
document.write("<TR><TD VALIGN=TOP BACKGROUND=/wbk.gif HEIGHT=34><IMG SRC=/sp.gif WIDTH=200 HEIGHT=31><IMG SRC=/b"+img+"></TD></TR>")
}
function showpct()
{
var timg="a";
mn3=mn.substring(0,3)
if(mn3=="704") timg="pct"
else if(mn3=="804") timg="wired"
else if(mn3=="808") timg="808"
else if(mn3=="714") timg="plus"
document.write("<BR><IMG SRC=/"+timg+".gif><BR>")
}
var SelRow
function GURL(x){var t=new Date();location=x+'&ZT='+t.getTime();}
function makesure(p,l){if(confirm(p))GURL(l);}
function sa(s){alert(s)}
function prn_err(c){
if(c=="A")sa("Can not connect to Time Server!")
if(c=="B")sa("Fail when communicate with Time server!")
if(c=="X")sa("Invalidate value!")
if(c=="C")sa("Time Server does not response.")
if(c=="Y")sa("Set Device Time Failed!")
}
var week=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var lt=new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U")
function pr_1_schd(id,schd){
j1=id*7
if(schd[j1]==0)document.write("always")
else document.write(schd[j1+3]+":"+schd[j1+5]+" - "+schd[j1+4]+":"+schd[j1+6]+", "+week[parseInt(schd[j1+1])]+" - "+week[parseInt(schd[j1+2])])
document.write("</TD><TD><A HREF='javascript:doedit("+id+")'><IMG BORDER=0 SRC=/e.gif></A>&nbsp;<A HREF='javascript:delchk("+id+")'><IMG BORDER=0 SRC=/d.gif></A></TD>")
document.write("</TR>")
}
function pr_2_schd(id,schd){
j1=id*7
var sch="";
if(schd[j1]==0) sch="always";
else sch=schd[j1+3]+":"+schd[j1+5]+" - "+schd[j1+4]+":"+schd[j1+6]+", "+week[parseInt(schd[j1+1])]+" - "+week[parseInt(schd[j1+2])];
return sch;
}
function pre_1_schd(id,schd){
val=new String;
j1=id*7
if(schd[j1]=="0") val="99";
else val=String(schd[j1+1])+String(schd[j1+3])+String(schd[j1+5])+"-"+String(schd[j1+2])+String(schd[j1+4])+String(schd[j1+6]);
document.write("<INPUT TYPE=HIDDEN NAME=SVC"+lt[id]+" VALUE='"+val+"'>\n")
}
function pre_schd_input(){
s1=op(0,12)
s2=op(0,23)
s3=op(0,55,5)+"</SELECT>";
var w="";
for(i=0;i<7;i++) w=w+"<OPTION VALUE="+i+">"+week[i];
document.write(
"<TABLE WIDTH=99% >"+
"<TR><TD WIDTH=20%>Schedule</TD>"+
"<TD WIDTH=15%><INPUT TYPE=RADIO NAME=zsvt VALUE='1'> Always</TD>"+
"<TD WIDTH=65%>&nbsp;</TD>"+
"</TR>"+
"<TR><TD>&nbsp;</TD>"+
"<TD><INPUT TYPE=RADIO NAME=zsvt VALUE='0'> From</TD>"+
"<TD>Time <SELECT NAME=zsvh>"+s2+"</SELECT>:"+
"<SELECT NAME=zsvm>"+s3+"To <SELECT NAME=zsvhh>"+s2+"</SELECT>:"+
"<SELECT NAME=zsvmm>"+s3+"</TD>"+
"</TR>"+
"<TR><TD>&nbsp;</TD><TD>&nbsp;</TD>"+
"<TD>day <SELECT NAME=zsvd>"+w+"</SELECT>"+
" to <SELECT NAME=zsvdd>"+w+"</SELECT>"+
"</TD>"+
"</TR></TABLE>")
}
function validate_schd(f,ix){
var fd,td,fh,fm,th,tm,xx
if(f.zsvt[1].checked!=true){
f.elements[ix].value="99";
}
else {
var val=new String;
fd=f.zsvd.selectedIndex
fh=f.zsvh.selectedIndex
fm=f.zsvm.selectedIndex*5
if(fm<10) ffm="0"+fm
else ffm=fm
td=f.zsvdd.selectedIndex
th=f.zsvhh.selectedIndex
tm=f.zsvmm.selectedIndex*5
if(tm<10) ttm="0"+tm
else ttm=tm
val =String(fd)+f.zsvh.options[fh].text+ffm
val+="-"+String(td)+f.zsvhh.options[th].text+ttm
f.elements[ix].value=val;
}
return true
}
function disp_schd(f,schd,ix){
if(schd[ix]=="1") {
f.zsvt[1].checked=true;
f.zsvd.selectedIndex =schd[ix+1]
f.zsvdd.selectedIndex=schd[ix+2]
f.zsvh.selectedIndex =schd[ix+3]
f.zsvhh.selectedIndex=schd[ix+4]
f.zsvm.selectedIndex =schd[ix+5]/5
f.zsvmm.selectedIndex=schd[ix+6]/5
}
else f.zsvt[0].checked=true;
}
function SelectRow(row){
if(SelRow!=row){
var bar=document.getElementById('tab1')
if(SelRow>=0)bar.rows[SelRow].style.backgroundColor=SelRowBC
if(row>=0){
SelRowBC=bar.rows[row].style.backgroundColor
bar.rows[row].style.backgroundColor="#FFFF00"
}
SelRow=row
}
}
function ag(str){
sa(str)
history.go(-1)
}
function smenu(bg,link,img){
if((link.indexOf('.')==-1)&&(link.indexOf('=')==-1))link="/"+link+".htm"
document.write("<TR><TH WIDTH=91 HEIGHT=37 BACKGROUND=/"+bg+".gif><A HREF="+link+"><IMG SRC=/"+img+".gif BORDER=0></A></TH></TR>")
}
function IWcheck(IW01){
if(document.f._IW0.value==document.f._IW1.value)
{
var PIW=(document.f._IW0.value=="**********")?"":document.f._IW0.value
eval("document.f."+IW01+".value='"+PIW+"'")
t=0;
}
else
{
sa("New passwords are not identical!");
t++
}
}
function PPTPType(c)
{
if(c)
{
document.forms[0].WI.value="0.0.0.0"
document.forms[0].WN.value="0.0.0.0"
document.forms[0].WG.value="0.0.0.0"
}
document.forms[0].WI.disabled=c
document.forms[0].WN.disabled=c
document.forms[0].WG.disabled=c
}
function PPPoEType(c)
{
document.forms[0].II0.disabled=c
document.forms[0].ID00.disabled=c
document.forms[0].ID01.disabled=c
}
function L2TPType(c)
{
if(c)
{
document.forms[0].WI.value="0.0.0.0"
document.forms[0].WN.value="0.0.0.0"
document.forms[0].WG.value="0.0.0.0"
}
document.forms[0].WI.disabled=c
document.forms[0].WN.disabled=c
document.forms[0].WG.disabled=c
}
function sMAC(j)
{
var MAC=""
for(s=0;s<6;s++){
var mac_str=document.f.elements[s+j+1].value;
mac_str=mac_str.toUpperCase();
if(mac_str.length==1) mac_str="0"+mac_str;
if(check_hex(mac_str))
{
MAC+=mac_str;
if(s!=5) MAC+="-"
}
}
return (MAC.length==17)?MAC:""
}
function check_hex(str)
{
var c=0;
if(str.length>1)
{
for(k=0;k<str.length;k++)
{
if(str.charAt(k)!=0)
{
if(isNaN(parseInt('0x'+str.charAt(k))))c++
}
}
return (c==0)?true:false;
}
else
return !isNaN(parseInt('0x'+str))
}
function lMAC(j,mac)
{
a=mac.split("-")
for(i=0;i<6;i++) document.f.elements[i+j+1].value=a[i]
}
var act=new Array(2);
function newID(){
SelectRow(-1);
act[0]=EmpID;
document.forms[0].reset()
document.forms[0]._ID.value=EmpID+1
}
function locate(dest)
{
for(var j=0;j<document.f.elements.length;j++)
{
if(document.f.elements[j].name==dest) break;
}
return j;
}
function FindEmpty(ary,no,cp,ci)
{
if(arguments.length>=3)i=cp
else i=0
if(arguments.length==4)c=ci
else c=""
for(EmpID=0;EmpID<eval(ary+".length/no");EmpID++)
{
if(eval(ary+"["+(EmpID*no+i)+"]==c")) break;
}
return EmpID;
}
function cffn(page){
var idx=document.UPG.FN.value.lastIndexOf(".");
var ext=document.UPG.FN.value.substring(idx+1);
if((idx!=-1)&&(ext.toUpperCase()=="BIN"))
{
if(page=="system")
document.forms[1].submit()
else document.forms[0].submit()
return true;
}
else {sa("Incorrect Filename!");
}
}
function chkfake()
{

}
function turn_ASC(str)
{
var ASC_no = new Array("%2B","%2D","%2A","%2F","%40","%5F","%2E","%22","%2C")
var ASC_str= new Array("+",  "-",  "*",  "/",  "@",  "_",  ".", "\"",",")
var ss="";
for(i=0;i<str.length;i++)
{
for(j=0;j<ASC_str.length;j++)
{
if(str.substring(i,i+1)==ASC_str[j])
{
ss+=ASC_no[j]
break;
}
}
if(j==ASC_str.length) ss+=escape(str.substring(i,i+1))
}
return ss
}
function klvv(cskm,zsq,zs0,zs1,zs2,zs3)
{
var WEPv=new Array(zs0,zs1,zs2,zs3)
var klv=VV1="";
var ktype=0;
var klen=new Array("0","10","26","58")
if(cskm=="1")
{
for(i=0;i<WEPv.length;i++)
{
if(WEPv[i]=="CHECKED") break;
}
if(i==3)WEP=4;
else WEP=i
klv=klen[i];
if(zsq>128){ ktype=1;klv/=2;}
VV1="10"+ktype+WEP;
if(klv==0)klv="";
}
if(cskm=="1CHECKED")VV1="2000"
if(cskm=="1CHECKED")VV1="2000"
if(cskm=="2CHECKED")VV1="8000"
if(cskm=="3CHECKED")VV1="8000"
if(cskm=="2")VV1="4000"
if(cskm=="3")VV1="4000"
return  "rc="+klv+"&rf="+VV1
}
