var arr_wifi_devid = new Array("wifi_sta", "wifi_pro", "wifi_btn", "wifi_wps", "wifi_save"); var arr_wifi_dev_val = new Array("1", "0"); var arr_sw_wifi_opt = new Array("wifi_pro", "wifi_btn", "wifi_wps"); var arr_wifi_opt = new Array(obj_sb_tle.manual, obj_sb_tle.wps); var arr_wifi_opt_val = new Array("0", "1"); var max_profile = 3; var wl_enable = 0; var wps_pin = "69457135"; var frz_wifi = false; if(isHebrew == "1") { var arr_wifi_dev = new Array(obj_sb_tle.off,obj_sb_tle.on); } else { var arr_wifi_dev = new Array(obj_sb_tle.on,obj_sb_tle.off); } function fn_wifi_init() { var wifi_form = document.frm_wifi; fn_onload(); if(parseInt(wl_enable)) { wifi_form.ra_wireless_device[0].checked = true; wifi_form.bt_site_survey.disabled = false; }else{ wifi_form.ra_wireless_device[1].checked = true; } fn_sw_wifi_item(wifi_form); top.frames[3].fn_prs_ntv_wifi_data(); if(top.frames[3].arr_pro_fld.length >= max_profile){wifi_form.bt_add_profile.disabled = true;} frz_wifi = fn_is_readonly(obj_page.wifi); } function fn_sw_wifi_item(AG_form) { var obj_div_id; var i; var wifi_dev = parseInt(AG_form.sl_wl_option.selectedIndex); for(i = 0; i < arr_wifi_devid.length; i++) { obj_div_id = document.getElementById(arr_wifi_devid[i]); if(obj_div_id == null) { alert("error on fn_show_wl_items"); return; } switch(wifi_dev) { case 0: arr_wifi_devid[i] != "wifi_wps" ? obj_div_id.style.display = "block" : obj_div_id.style.display = "none"; break; case 1: arr_wifi_devid[i] == "wifi_wps" ? obj_div_id.style.display = "block" : obj_div_id.style.display = "none"; break; } } } function fn_sw_new_wifi_pg(AG_page, AG_flag, AG_security) { var dest_form = top.document.getElementById("load_webpage").contentWindow.document.frm_wifi_pro; var wifi_proname = ""; var wifi_ssid = ""; var sec_ind = AG_security; dest_form.hdn_flag_add_new.value = parseInt(AG_flag); if(parseInt(dest_form.hdn_rec_index.value) != -1){dest_form.hdn_rec_index.value = -1;} fn_sw_wifi_pop_pg(AG_page); fn_set_wifi_pro_bsc(dest_form, wifi_proname, wifi_ssid, sec_ind); dest_form.hdn_valid.value = 4; } function fn_sw_site_srvy_pg(AG_flag) { var i; var arr_enable_disable_page_1 = new Array("div_disable_page", "div_enable_page_1"); var obj_div = top.document.getElementById("load_webpage_1"); if(obj_div == null) { alert("error: fn_sw_site_srvy_pg"); return; } for(i = 0; i < arr_enable_disable_page_1.length; i++) { obj_div = top.document.getElementById(arr_enable_disable_page_1[i]); if(obj_div == null) { alert("error: fn_sw_site_srvy_pg"); return; } if(obj_div.style.display == "none") { obj_div.style.display = "block"; if( (i == 0) && (AG_flag != "Cancel_add_entry") ) { top.document.getElementById("load_webpage_1").contentWindow.fn_count_down(); } }else if(AG_flag == "Add_list"){ obj_div.style.display = "none"; } else{ parent.window.location.href = obj_page.site_scan; obj_div.style.display = "none"; } } } function fn_rm_wifi_pro(AG_form, AG_smtform) { var profile_length = top.frames[3].arr_old_wifi_pro.length; var i; var obj_chkbox; var counter = 0; AG_smtform.hdn_submit_page.value = obj_page.wifi; AG_smtform.hdn_reply_page.value = obj_page.wifi; AG_smtform.hdn_wl_device.value = (AG_form.ra_wireless_device[0].checked) ? AG_form.ra_wireless_device[0].value : AG_form.ra_wireless_device[1].value; AG_smtform.hdn_wl_profiles.value = ""; AG_smtform.hdn_rm_wl_profiles.value = ""; if(top.frames[3].document.frm_wifi_pro_list.chk_sel_wifi_pro_all.checked && fn_chk_locked_pro()) { if(!confirm(errmsg.err84)) { return; } for(i = 0; i < profile_length; i++) { if(i == (profile_length - 1)) { AG_smtform.hdn_rm_wl_profiles.value = AG_smtform.hdn_rm_wl_profiles.value + top.frames[3].arr_old_wifi_pro[i].KEY; }else{ AG_smtform.hdn_rm_wl_profiles.value = AG_smtform.hdn_rm_wl_profiles.value + top.frames[3].arr_old_wifi_pro[i].KEY + smt_sep_ptn; } } }else{ for(i = 0; i < profile_length; i++) { eval("obj_chkbox = top.frames[3].document.getElementById(\"chk_sel_wifi_pro" + i + "\")"); if(obj_chkbox.checked) { counter++; AG_smtform.hdn_rm_wl_profiles.value = AG_smtform.hdn_rm_wl_profiles.value + top.frames[3].arr_old_wifi_pro[i].KEY + smt_sep_ptn;; } } if(counter) { if(!confirm(errmsg.err91)){return;} AG_smtform.hdn_rm_wl_profiles.value = AG_smtform.hdn_rm_wl_profiles.value.slice(0, AG_smtform.hdn_rm_wl_profiles.value.lastIndexOf(smt_sep_ptn)); }else{ alert(errmsg.err57); return; } } AG_smtform.submit(); } function fn_smt_wifi(AG_form, AG_smtform) { var profile_length = top.frames[3].arr_old_wifi_pro.length; var i; AG_smtform.hdn_submit_page.value = obj_page.wifi; AG_smtform.hdn_reply_page.value = obj_page.wifi; AG_smtform.hdn_wl_device.value = (AG_form.ra_wireless_device[0].checked) ? AG_form.ra_wireless_device[0].value : AG_form.ra_wireless_device[1].value; switch(parseInt(profile_length)) { case 0: AG_smtform.hdn_wl_profiles.value = ""; break; case 1: AG_smtform.hdn_wl_profiles.value = top.frames[3].arr_old_wifi_pro[0].KEY; break; default: AG_smtform.hdn_wl_profiles.value = ""; for(i = 0; i < profile_length; i++) { if(i == (profile_length - 1)) { AG_smtform.hdn_wl_profiles.value = AG_smtform.hdn_wl_profiles.value + top.frames[3].arr_old_wifi_pro[i].KEY; }else{ AG_smtform.hdn_wl_profiles.value = AG_smtform.hdn_wl_profiles.value + top.frames[3].arr_old_wifi_pro[i].KEY + smt_sep_ptn; } } } AG_smtform.submit(); } function fn_cancel_wifi(ARGV_page) { window.location.href = ARGV_page; } function fn_sw_wifi_pop_pg(AG_pgname) { var obj_div = top.document.getElementById("load_webpage"); if(obj_div == null) { alert("error: fn_sw_wifi_pop_pg"); return; } for(i = 0; i < arr_endis_pg.length; i++) { obj_div = top.document.getElementById(arr_endis_pg[i]); if(obj_div == null) { alert("error: fn_sw_wifi_pop_pg"); return; } if(obj_div.style.display == "none"){obj_div.style.display = "block";}else{obj_div.style.display = "none";} } } function fn_set_wifi_pro_bsc(AG_form, AG_wifi_proname, AG_wifi_ssid, AG_sec_ind) { AG_form.txt_wl_profile_name.value = AG_wifi_proname; AG_form.txt_wl_ssid.value = AG_wifi_ssid; fn_cln_all_sec_fld(AG_form); AG_form.sl_wl_security.selectedIndex = parseInt(AG_sec_ind); fn_sw_sec_opt(AG_form); } function fn_cln_all_sec_fld(AG_form) { var i; for(i = 0; i < AG_form.length; i++) { AG_form.elements[i].disabled = false; } AG_form.ra_wep_tx_key[0].checked = true; AG_form.sl_wep_encrypt.selectedIndex = 0; fn_chg_maxchar(AG_form, "txt_wep_key", 4); AG_form.sl_wpa_psk.selectedIndex = 0; AG_form.txt_wpa_psk.value = ""; AG_form.sl_eap_type.selectedIndex = 0; fn_sw_eap_opt(AG_form); AG_form.txt_wpa_user_id.value = ""; AG_form.txt_wpa_user_pwd.value = ""; AG_form.ra_wap_chk_server_certify[0].checked = true; AG_form.txt_wpa_anonymous_id.value = ""; AG_form.sl_wpa_ttls_inner.selectedIndex = 0; AG_form.txt_wpa_priv_pwd.value = ""; } function fn_sw_wifi_opt(AG_form) { var obj_div; var j; for(i = 0; i < arr_sw_wifi_opt.length; i++) { obj_div = document.getElementById(arr_sw_wifi_opt[i]); if(obj_div == null) { alert("error: fn_sw_wifi_opt"); return; } obj_div.style.display = "none"; } switch(parseInt(AG_form.sl_wl_option.selectedIndex)) { case 0: for(j = 0; j <= 1; j++) { document.getElementById(arr_sw_wifi_opt[j]).style.display = "block"; } document.getElementById("td_submit").innerHTML = fn_sw_smt_btn1("fn_smt_wifi(document.frm_wifi, document.frm_hidden_wireless)"); document.getElementById("td_cancel").innerHTML = fn_sw_cnl_btn1("fn_cancel_wifi(obj_page.wifi)"); if(frz_wifi) { AG_form.bt_submit.disabled = true; AG_form.bt_cancel.disabled = true; } break; case 1: document.getElementById(arr_sw_wifi_opt[2]).style.display = "block"; document.getElementById("td_submit").innerHTML = ""; document.getElementById("td_cancel").innerHTML = ""; document.getElementById("td_submit").height = "30"; break; } } function fn_sw_wps_txt(AG_txt, AG_flg) { document.write(""); switch(parseInt(AG_flg)) { case 1: document.write("" + AG_txt + " TM"); break; case 2: document.write("" + AG_txt + ""); break; case 3: document.write("" + AG_txt + ""); document.write(""); break; case 4: document.write("" + AG_txt + ""); break; case 5: document.write(""); break; case 6: document.write("" + AG_txt + ""); document.write(""); break; case 7: document.write("" + AG_txt + "" + top.window.wps_pin + "" + ""); break; } document.write(""); } function fn_wps_connection(AG_form, AG_type) { var submit_form = top.document.frm_hidden_frm_wps; if(document.frm_wifi.ra_wireless_device[1].checked) { alert(errmsg.err93); }else if((wan_ifname == "eth0") && document.frm_wifi.ra_wireless_device[0].checked){ alert(errmsg.err94); }else{ submit_form.hdn_submit_page.value = obj_page.wifi; submit_form.hdn_reply_page.value = obj_page.warning_wireless; submit_form.hdn_wps_type.value = parseInt(AG_type); submit_form.submit(); } } function fn_sw_smt_btn1(ARGV_fn_onclick) { return " "; } function fn_sw_cnl_btn1(ARGV_fn_onclick) { return " "; } function fn_freeze_wifi() { var wifi_frm = document.frm_wifi; var arr_del_itm = new Array("ra_wireless_device[0]", "ra_wireless_device[1]", "sl_wl_option", "bt_wl_status_update", "bt_add_profile", "bt_site_survey", "bt_remove_wl_profile", "bt_submit", "bt_cancel", "bt_wps_connection", "bt_submit", "bt_cancel"); var wifi_pro_lst_frm; var cnt_wifi_pro = top.document.getElementById("ifr_wifi_pro").contentWindow.arr_old_wifi_pro.length; var i; var j; var obj_odr; var obj_edt; var obj_push_btn; for(i = 0; i < arr_del_itm.length; i++) { eval("wifi_frm." + arr_del_itm[i] + ".disabled = true;"); } wifi_pro_lst_frm = top.document.getElementById("ifr_wifi_pro").contentWindow.document.frm_wifi_pro_list; wifi_pro_lst_frm.chk_sel_wifi_pro_all.disabled = true; obj_push_btn = document.getElementById("img_wps"); obj_push_btn.onclick = function(){return;}; if(!cnt_wifi_pro){return;} for(j = 0; j < cnt_wifi_pro; j++) { eval("wifi_pro_lst_frm.chk_sel_wifi_pro" + j + ".disabled = true;"); obj_odr = eval("top.frames[3].document.getElementById(\"img_odr_pro" + j +"\")"); obj_odr.onclick = function(){return;}; obj_edt = eval("top.frames[3].document.getElementById(\"img_edt_wifi_pro" + j +"\")"); obj_edt.onclick = function(){return;}; } } function fn_chk_locked_pro() { var profile_length = top.frames[3].arr_old_wifi_pro.length; for(i = 0; i < profile_length; i++) { if(parseInt(top.frames[3].arr_pro_fld[i].VALID) & 0x1) { return false; } } return true; }