var SelRowBC
function GetSchedule(f, r, i){
    if (r[i]=="0")
        f.schd[0].checked = true
    else
        f.schd[1].checked = true
    f.hour1.selectedIndex = r[i+1]
    f.min1.selectedIndex = r[i+2]
    f.am1.selectedIndex = r[i+3]
    f.hour2.selectedIndex = r[i+4]
    f.min2.selectedIndex = r[i+5]
    f.am2.selectedIndex = r[i+6]
    f.day1.selectedIndex = r[i+7]
    f.day2.selectedIndex = r[i+8]
}
function GetProto(f, p, n){
    var i
    if (p=="6")
        i=0
    else if (p=="17")
        i=1
    else
        i=2
	eval("f."+n+".selectedIndex="+i)
}
function SelectRow(tn,row){
    if (SelRow != row){
        var bar = document.getElementById(tn)
        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 NewRow(f,tn){
	f.editRow.value = "-1"
	SelectRow(tn,-1)
	f.enable[2].disabled = true
}
function LastRow(fn,tn){
	var f = document.getElementById(fn)
	var i = parseInt(f.editRow.value)
	if (i>=1){
	    SelectRow(tn,i)
	}
}
function EnableRow(f, e){
	if (e == "1")
		f.enable[0].checked = true
	else
		f.enable[1].checked = true
	f.enable[2].disabled = false
}
function ShowWizard(name){
	window.open(name,"Wizard","width=450,height=320")
}
function ExitWizard(){
    if (confirm("Quit setup wizard and discard settings ?"))
        window.close()
}
function ChgPage(i){
    var p
	if (i==0) p="h_wan_dhcp.html"
	if (i==1) p="h_wan_fix.html"
	if (i==2) p="h_wan_poe.html"
	window.location.href=p
}
function ChgFilter(i){
    var p
	if (i==0) p="adv_filters.html"
	if (i==1) p="adv_filters_mac.html"
	if (i==2) p="adv_filters_url.html"
	if (i==3) p="adv_filters_domain.html"
	window.location.href=p
}
function selWL(F){
	F.submit();
}
function DelRow(f,r)
{
    EditRow(r)
    if (confirm("Are your sure to delete this entry?")){
        f.delrow.value="1"
        popupwin();
    }
}

function popupwin () {
window.open("restart.html","url","scrolling=no,width=780,height=300,navigation=no")

}