var user_mode = 0; var check = false;
var currentPage = null;
var ns4 = false;
var ie4 = false;
var dom = false;
var hideStr = "";
var showStr = "";
var styleStr = "";
var blank_page = "about:blank";
var rec_sep_ptn = "$*$";
var fld_sep_ptn = "!$!";
var smt_sep_ptn = "@$@!";
var host_url = fn_get_url();
var arr_menu = new Array(obj_menu.voice, obj_menu.wifi, obj_menu.bt, obj_menu.pab, obj_menu.ch, obj_menu.sd, obj_menu.fu);
var arr_menu_lnk = new Array(host_url, obj_page.wifi, obj_page.bt, obj_page.pab, obj_page.ch, obj_page.sd, obj_page.ug);
var arr_menu_id = new Array("Voice", "WiFi", "Bluetooth", "PersonalAddressBook", "CallHistory", "SpeedDial", "FirmwareUpgrade");
var arr_endis_pg = new Array("div_disable_page", "div_enable_page");
var arr_width = new Array("50", "50", "170", "170", "90", "95", "140");
var arr_percent = new Array("10", "10", "12", "22", "13", "13", "19");
var menu_lenth = 765;
var str_menu = "Voice!$!/basic!$!1!$!0!$!10!$!$*$Wi-Fi!$!/Wireless.htm!$!1!$!0!$!10!$!$*$Bluetooth!$!/Bluetooth.htm!$!1!$!0!$!12!$!$*$Personal Address Book!$!/Personal_Directory.htm!$!1!$!0!$!22!$!$*$Call History!$!/Call_History.htm!$!1!$!0!$!13!$!$*$Speed Dials!$!/Quick_Dial.htm!$!1!$!0!$!13!$!$*$Firmware Upgrade!$!/Upgrade.htm!$!1!$!0!$!19!$!$*$NULL!$!NULL!$!0!$!0!$!0!$!$*$NULL!$!NULL!$!0!$!0!$!0!$!$*$NULL!$!NULL!$!0!$!0!$!0!$!$*$";
var arr_menu_list = new Array();
var wan_ifname = "eth0";
var isHebrew = "0";
function cstr_ntv_menu(AG_tab_name, AG_href, AG_needed, AG_read_only, AG_percent)
{
this.TAB_NAME = AG_tab_name;
this.HREF = AG_href;
this.NEEDED = AG_needed;
this.READ_ONLY = AG_read_only;
this.PERCENT = AG_percent;
}
function fn_onload()
{
document.title = obj_menu.tl;
fn_init();
fn_hide_others();
}
function fn_init()
{
styleStr = ".style.display";
hideStr = "='none'";
showStr = "='block'";
check = true;
if(document.getElementById){
dom = true;
}else if(document.all){
ie4 = true;
}else if(document.layers){
ns4 = true;
styleStr = ".visibility";
hideStr = "='hide'";
showStr = "='show'";
}else{
check = false;
}
}
function fn_hide_others()
{
var all_div;
var i = 0;
var first = 1;
all_div = fn_get_tag("div");
if(all_div == null){return;}
for(; i < all_div.length; i++)
{
if(all_div[i].className == "tab-page")
{
if(first == 1)
{
first=0;
fn_sw_page(all_div[i].id);
}else{
eval("all_div[i]" + styleStr + hideStr);
}
}
}
}
function fn_get_tag(AG_tags)
{
if(check)
{
if(document.getElementsByTagName){return document.getElementsByTagName(AG_tags);}
if(document.document.all){return document.all.tags(AG_tags);}
if(document.layers){return document.lalyers;}
if(document.divs){return document.divs;}
}
return null;
}
function fn_sw_page(AG_page)
{
if(currentPage!=null){fn_sh_hide_tab(currentPage, 0);}
currentPage = AG_page;
fn_sh_hide_tab(AG_page, 1);
}
function fn_sh_hide_tab(AG_tname, ARG_on)
{
var el;
el = fn_get_elmt(AG_tname);
if(el == null){return;}
(parseInt(ARG_on) == 1) ? eval("el" + styleStr + showStr) : eval("el"+styleStr+hideStr);
el = fn_get_elmt("nav" + AG_tname);
if(el == null){return;}
el.className = (parseInt(ARG_on) == 1) ? el.className.replace(/tab/g, "tab selected") : el.className.replace(/ selected/g, "");
}
function fn_get_elmt(AG_tname)
{
if(check)
{
if(dom){return document.getElementById(AG_tname);}
if(ie4){return document.all[AG_tname];}
if(ns4){return document.layers[AG_tname];}
}
return null;
}
function fn_on_mouse(AG_tname, AG_hover)
{
var el;
el = fn_get_elmt("nav" + AG_tname);
if(el==null){return;}
el.className = (parseInt(AG_hover) == 1) ? (el.className + " hover") : el.className.replace(/ hover/g, "");
}
function fn_sw_banner()
{
var url_cisco = "http://www.cisco.com/";
var img_src = "image/UI_Cisco.gif";
var img_alt = "Cisco Systems, Inc.";
document.write("
");
document.write("");
document.write("");
document.write(" ");
document.write(" | ");
document.write("");
document.write("" + obj_cr.model + " ");
if(isHebrew == "1") {
document.write("Cisco Systems");
}
else
{
document.write("" + obj_cr.cisco + "");
}
document.write(" | |
");
}
function fn_sw_menu(AG_pname)
{
var prefix = "nav";
var i;
var sel;
var total_percent = 0;
fn_prs_ntv_menu_data();
document.write("");
document.write("");
document.write(" ");
for(i = 0; i < arr_menu_list.length; i++)
{
sel = (AG_pname == arr_menu_list[i].HREF) ? "tab selected" : "tab";
document.write("");
if(AG_pname == arr_menu_list[i].HREF)
{
document.write("");
}else{
document.write("");
}
document.write(" | ");
total_percent = total_percent + parseInt(arr_menu_list[i].PERCENT);
}
if(parseInt(total_percent) < 95)
{
document.write("");
}
document.write(" |
");
document.write(" |
");
}
function fn_prs_ntv_menu_data()
{
var arr_mu;
var arr_mu_tmpfld;
var mu_amt;
var i;
var j = 0;
var arr_menu_fld = new Array();
if(str_menu.length == 0){return;}
arr_mu = str_menu.split(rec_sep_ptn);
mu_amt = arr_mu.length;
for(i = 0; i < mu_amt; i++)
{
arr_mu_tmpfld = arr_mu[i].split(fld_sep_ptn);
arr_menu_fld[i] = new cstr_ntv_menu(arr_mu_tmpfld[0], arr_mu_tmpfld[1], arr_mu_tmpfld[2], arr_mu_tmpfld[3], arr_mu_tmpfld[4]);
if(((arr_menu_fld[i].TAB_NAME != "NULL") && (!parseInt(user_mode)) && (parseInt(arr_menu_fld[i].NEEDED))) || ((arr_menu_fld[i].TAB_NAME != "NULL") && parseInt(user_mode) && (arr_menu_fld[i].HREF != obj_page.ug) && (parseInt(arr_menu_fld[i].NEEDED))))
{
if(arr_menu_fld[i].TAB_NAME == "Voice")
arr_menu_fld[i].HREF = host_url + arr_menu_fld[i].HREF;
else
arr_menu_fld[i].HREF = fn_get_tabname_url(arr_menu_fld[i].TAB_NAME);
arr_menu_fld[i].PERCENT = fn_get_tabname_percent(arr_menu_fld[i].TAB_NAME);
arr_menu_list[j++] = arr_menu_fld[i];
}
}
}
function fn_get_menu_id(AG_plnk)
{
var i;
for(i = 0; i < arr_menu_lnk.length; i++)
{
if(AG_plnk == arr_menu_lnk[i]){return arr_menu_id[i]}
}
return arr_menu_id[0];
}
function fn_get_tabname_url(AG_pname)
{
if(AG_pname == obj_tag.voice)
{
return arr_menu_lnk[0];
}else if(AG_pname == obj_tag.wifi){
return arr_menu_lnk[1];
}else if(AG_pname == obj_tag.bt){
return arr_menu_lnk[2];
}else if(AG_pname == obj_tag.pab){
return arr_menu_lnk[3];
}else if(AG_pname == obj_tag.ch){
return arr_menu_lnk[4];
}else if(AG_pname == obj_tag.sd){
return arr_menu_lnk[5];
}else if(AG_pname == obj_tag.fu){
return arr_menu_lnk[6];
}
}
function fn_get_tabname_percent(AG_pname)
{
if(AG_pname == obj_tag.voice)
{
return arr_percent[0];
}else if(AG_pname == obj_tag.wifi){
return arr_percent[1];
}else if(AG_pname == obj_tag.bt){
return arr_percent[2];
}else if(AG_pname == obj_tag.pab){
return arr_percent[3];
}else if(AG_pname == obj_tag.ch){
return arr_percent[4];
}else if(AG_pname == obj_tag.sd){
return arr_percent[5];
}else if(AG_pname == obj_tag.fu){
return arr_percent[6];
}
}
function fn_sw_tabname(AG_pname)
{
if(AG_pname == obj_tag.voice)
{
return arr_menu[0];
}else if(AG_pname == obj_tag.wifi){
return arr_menu[1];
}else if(AG_pname == obj_tag.bt){
return arr_menu[2];
}else if(AG_pname == obj_tag.pab){
return arr_menu[3];
}else if(AG_pname == obj_tag.ch){
return arr_menu[4];
}else if(AG_pname == obj_tag.sd){
return arr_menu[5];
}else if(AG_pname == obj_tag.fu){
return arr_menu[6];
}
}
function fn_is_readonly(AG_pname)
{
var i;
for(i = 0; i < arr_menu_list.length; i++)
{
if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.wifi))
{
fn_freeze_wifi();
return true;
}else if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.bt)){
fn_freeze_bt();
return true;
}else if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.pab)){
fn_freeze_pab();
return true;
}else if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.ch)){
fn_freeze_ch();
return true;
}else if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.sd)){
fn_freeze_sd();
return true;
}else if((AG_pname == arr_menu_list[i].HREF) && parseInt(arr_menu_list[i].READ_ONLY) && (AG_pname == obj_page.ug)){
fn_freeze_fu();
return true;
}
}
return false;
}
function fn_sw_copyright()
{
document.write(" |
");
document.write(" |
");
document.write("");
document.write("
" + obj_cr.cr + " © " + obj_cr.year + " " + obj_cr.cisco + " " + obj_cr.alr + " ");
document.write(" |
");
}
function fn_sw_col_grp()
{
document.write("");
}
function fn_sw_subtitle(AG_subtitle)
{
document.write(" |
");
if(isHebrew=="1")
{
document.write("" + AG_subtitle + " |
");
}
else
{
document.write("" + AG_subtitle + " |
");
}
}
function fn_sw_option(AG_opt, AG_pos)
{
if(AG_pos == "left" || AG_pos == "right")
{ document.write("" + AG_opt + ": | ");
}
else
{
document.write(" | | ");
}
}
function fn_sw_radio_opt(AG_raname, AG_arr_optname, AG_arr_optval, AG_fn)
{
var i;
for(i = 0; i < AG_arr_optname.length; i++)
{
if(AG_fn == "")
{
document.write("" + AG_arr_optname[i]);
}else{
document.write("" + AG_arr_optname[i]);
}
}
}
function fn_sw_blk_option(AG_td_id, AG_item)
{
if(AG_item == "wifi_update")
{
document.write(" | ");
document.write(" | ");
}else if(AG_item == "bt_update"){
document.write(" | ");
document.write(" | ");
}else if(AG_item == "bt_mode_update"){
document.write(" | ");
document.write(" | ");
}else{
document.write(" | ");
document.write(" | ");
}
document.write(" | ");
}
function fn_ud_status(AG_frid, AG_page)
{
var obj_div;
obj_div = document.getElementById(AG_frid);
if(obj_div == null)
{
alert("error: fn_ud_status");
return;
}
obj_div.contentWindow.location.href = AG_page;
}
function fn_padding(AG_clr)
{
document.write(" | | |
");
}
function fn_sw_iframe(AG_ifr_id, AG_width, AG_height, AG_scrl, AG_src, AG_flag)
{
if(parseInt(AG_flag))
{
document.write("");
}else{
document.write(" | ");
document.write("");
document.write("");
document.write(" | | ");
}
}
function fn_sw_btn(AG_bname, AG_bval, AG_fn)
{
document.write("");
}
function fn_sw_smtbtn(AG_fn)
{
document.write("");
}
function fn_sw_canbtn(AG_fn)
{
document.write("");
}
function fn_sw_pro_opt_name(AG_optname)
{
document.write(" " + AG_optname + ":");
}
function fn_check_space(AG_obj, AG_flt)
{
var flt_pre_space;
var flt_post_space;
var i;
var ch;
if(AG_flt == "SPACE_DENY")
{
for(i = 0; i < AG_obj.value.length; i++)
{
if((ch = AG_obj.value.charAt(i)) == " ")
{
alert(errmsg.err02);
AG_obj.value = AG_obj.defaultValue;
return;
}
}
}
flt_pre_space = AG_obj.value.replace(/^\s*/,"");
flt_post_space = flt_pre_space.replace(/\s*$/,"");
AG_obj.value = flt_post_space;
}
function fn_vfy_name(AG_obj, AG_fldname, AG_flt)
{
var ret;
var flt_pre_space;
var flt_post_space;
ret = fn_is_ascii(AG_obj, AG_flt);
if(ret == false)
{
eval("document.forms[0]." + AG_fldname + ".focus()");
return;
}
if(AG_flt == "SPACE_ALLOW")
{
flt_pre_space = AG_obj.value.replace(/^\s*/,"");
flt_post_space = flt_pre_space.replace(/\s*$/,"");
AG_obj.value = flt_post_space;
}
}
function fn_is_ascii(AG_obj, AG_flt)
{
var i;
var ch;
for(i = 0; i < AG_obj.value.length; i++)
{
ch = AG_obj.value.charAt(i);
if(ch < ' ' || ch > '~')
{
alert(errmsg.err01);
AG_obj.value = AG_obj.defaultValue;
return false;
}
if((AG_flt == "SPACE_DENY") && (ch == " ")){
alert(errmsg.err02);
AG_obj.value = AG_obj.defaultValue;
return false;
}
}
return true;
}
function fn_sw_select_opt(AG_arr_optname, AG_arr_optval)
{
var i;
for(i = 0; i < AG_arr_optname.length; i++)
{
document.write("");
}
}
function fn_isxdigit(AG_obj)
{
var reg_xdigit = /^[!\da-fA-F]+$/;
if(!AG_obj.value.length){return true;}
if(!reg_xdigit.test(AG_obj.value))
{
alert(errmsg.err06);
AG_obj.value = AG_obj.defaultValue;
return false;
}
return true;
}
function fn_is_phone_num(AG_obj, AG_flt, AG_flt1)
{
var arr_regular_phone_num = new Array(/^\d+$/,/^[0-9#]+$/,/^\d+\*?[0-9]{1,6}$/,/^[0-9#*]+$/);
var sip_phone_ip = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(:\d{1,5})?(\*\d{1,10})?)$/;
var sip_phone_domain = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}(:\d{1,5})?(\*\d{1,10})?)$/;
var regular_phone_num;
if(!AG_obj.value.length)
{
return true;
}
if(AG_flt == "DIGIT_ONLY"){
regular_phone_num = arr_regular_phone_num[0];
}else if(AG_flt == "#_ALLOW"){
regular_phone_num = arr_regular_phone_num[1];
}else if(AG_flt == "*_ALLOW"){
regular_phone_num = arr_regular_phone_num[2];
}else if(AG_flt == "*#_ALLOW"){ regular_phone_num = arr_regular_phone_num[3];
}
if(AG_flt1 == "SIP_PHONE")
{
if((!regular_phone_num.test(AG_obj.value)) && (!sip_phone_domain.test(AG_obj.value)) && (!sip_phone_ip.test(AG_obj.value)))
{
alert(errmsg.err68);
AG_obj.value = AG_obj.defaultValue;
return false;
}
}
else if(AG_flt1 == "SIP_PHONE_SPEED") {
}
else{
if(!regular_phone_num.test(AG_obj.value))
{
alert(errmsg.err68);
AG_obj.value = AG_obj.defaultValue;
return false;
}
}
return true;
}
function fn_isdigit(AG_obj)
{
var regular_digit = /^\d+$/;
if(!AG_obj.value.length)
{
return true;
}
if(!regular_digit.test(AG_obj.value))
{
alert(errmsg.err03);
AG_obj.value = AG_obj.defaultValue;
return false;
}
return true;
}
function is_alpha_num(AG_obj)
{
var alpha_num = /^[0-9a-zA-Z]+$/;
if(!alpha_num.test(AG_obj.value))
{
alert(errmsg.err92);
AG_obj.value = AG_obj.defaultValue;
return false;
}
return true;
}
function fn_cancel_setting(AG_form)
{
parent.fn_sw_pop_pg();
}
function fn_sw_pop_pg()
{
var obj_div;
var i;
obj_div = top.document.getElementById("load_webpage");
if(obj_div == null)
{
alert("error: fn_show_pop_page");
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_show_pop_page");
return;
}
if(obj_div.style.display == "none"){obj_div.style.display = "block";}else{obj_div.style.display = "none";}
}
}
function fn_sw_txt(AG_text)
{
document.write(AG_text);
}
function fn_chk_sgl_item(AG_form, AG_obj, AG_chk_name)
{
var i;
var type_chk = "checkbox";
if(AG_obj.checked)
{
for(i = 0; i < AG_form.length; i++){if((AG_form.elements[i].type == type_chk) && (AG_form.elements[i].name == AG_obj.name) && ((!AG_form.elements[i].checked) && !AG_form.elements[i].disabled)){return;}}
eval("AG_form." + AG_chk_name +".checked = true");
}else{
eval("AG_form." + AG_chk_name +".checked = false");
}
}
function fn_chk_all_item(AG_form, AG_obj, AG_chk_name)
{
var i;
var type_chk = "checkbox";
for(i = 0; i < AG_form.length; i++)
{
if((AG_form.elements[i].type == type_chk) && (AG_form.elements[i].name == AG_chk_name))
{
AG_form.elements[i].checked = AG_obj.checked ? ((AG_form.elements[i].disabled == true) ? false : true) : false;
}
}
}
function fn_wh_max_accnt(ARGV_src_page)
{
var obj_div;
var i;
var j;
var obj_select;
var arr_enable_disable_page2 = new Array("div_disable_page", "div_enable_page2");
obj_div = top.document.getElementById("load_webpage2");
if(obj_div == null)
{
alert("error: fn_wh_max_accnt");
return;
}
for(i = 0; i < arr_enable_disable_page2.length; i++)
{
obj_div = top.document.getElementById(arr_enable_disable_page2[i]);
if(obj_div == null)
{
alert("error: fn_wh_max_accnt");
return;
}
if(obj_div.style.display == "none")
{
top.document.getElementById("load_webpage2").contentWindow.document.frm_warning.hdn_src_page.value = ARGV_src_page;
obj_div.style.display = "block";
}else{
top.document.getElementById("load_webpage2").contentWindow.document.frm_warning.hdn_src_page.value = "";
obj_div.style.display = "none";
}
}
}
function fn_get_url()
{
var url_rule = /(\w+):\/\/([\w.]+)/;
var full_url = window.location.href;
var result = full_url.match(url_rule);
var url;
if(result != null)
{
url = result[0];
}
return url;
}