';
+$('#' + idOfTextbox).after(errorLabel);
+}
+function showErrorUnderTr(idOfTr, errormsg, label_id) {
+var errorLabel = '';
+$("tr.error_message").remove();
+if (label_id != null && label_id != '' && label_id != ' ') {
+errorLabel = "
| |
';
+} else {
+errorLabel = "
| |
';
+}
+$('#' + idOfTr).after(errorLabel);
+setErrorMessageColor('error_message');
+}
+function showErrorUnderTrEx(idOfTr, errormsg, label_id) {
+var errorLabel = '';
+$("tr.error_message").remove();
+if (label_id != null && label_id != '' && label_id != ' ') {
+errorLabel = "
| |
';
+} else {
+errorLabel = "
| |
';
+}
+$('#' + idOfTr).parent().parent().after(errorLabel);
+setErrorMessageColor('error_message');
+}
+function showPassword(id,check_id,maxlength) {
+var cbValue = $('#' + check_id).prop('checked');
+var strType = cbValue ? 'text' : 'password';
+var tempStr = $('#' + id).val();
+if(maxlength != null && (maxlength != "")) {
+$("
").replaceAll($('#' + id));
+} else {
+$("
").replaceAll($('#' + id));
+}
+$('#' + id).val(tempStr);
+}
+var COMMON_PASSWORD_VALUE = '********';
+var mousedownIndexList = [];
+function checkPostIndex(index) {
+if (!(typeof(g_moduleswitch.encrypt_enabled) != 'undefined' && g_moduleswitch.encrypt_enabled == 1)) {
+return false;
+}
+var checkIndexFlag = false;
+$.each(mousedownIndexList, function(n, arrvalue) {
+if(arrvalue == index) {
+checkIndexFlag = true;
+}
+});
+if (checkIndexFlag) {
+return false;
+} else {
+return true;
+}
+}
+function clickPasswordEvent(id,index) {
+if (!(typeof(g_moduleswitch.encrypt_enabled) != 'undefined' && g_moduleswitch.encrypt_enabled == 1)) {
+return false;
+}
+$('#' + id).live("mousedown focusin click", function(event) {
+var checkmousedown = false;
+$.each(mousedownIndexList, function(n, arrvalue) {
+if(arrvalue == index) {
+checkmousedown = true;
+}
+});
+if (checkmousedown) {
+return;
+} else {
+mousedownIndexList.push(index);
+}
+if($('#' + id).val().length > 0) {
+$('#' + id).prop('value','');
+}
+});
+}
+function clearAllErrorLabel() {
+$('.error_message').remove();
+var pwdMsgh = 4;
+if ((g_supportPwdSame && g_wifiSameWithWeb) && ($('#pwd_message').height() > 16)) {
+pwdMsgh = $('#pwd_message').height() - 16;
+}
+$(".forget_password_tab").css({"margin-top":pwdMsgh + "px"});
+}
+function showWaitingDialog(tipTitle, tipContent, callback_func, prompt_timeout_flag) {
+tipContent = display_SIMtoUIM(tipContent);
+$('#div_wrapper').remove();
+if (prompt_timeout_flag) {
+var tab = "
';
+} else {
+var tab = "
';
+}
+var wait_div = "
" + tab;
+$('body').append(wait_div);
+if(/msie/.test(navigator.userAgent.toLowerCase()) && (parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) < 9)) {
+$(".wait_table_header").css({
+"width":"377px",
+"height":"26px"
+});
+var ahtml="

";
+$(".wait_table_header span").append(ahtml);
+} else {
+var canvas = document.getElementById("showWaitingCanvas");
+draw(canvas);
+}
+reputPosition($('#wait_table'), $('#div_wrapper'));
+$('#wait_dialog_btn').bind('click', function() {
+closeWaitingDialog();
+});
+if (typeof (callback_func) == 'function') {
+callback_func();
+}
+disableTabKey();
+}
+function closeWaitingDialog(callback_func) {
+if ($('.info_dialog').size() == 0) {
+$('#div_wrapper').remove();
+}
+$('#wait_table').remove();
+enableTabKey();
+if (typeof (callback_func) == 'function') {
+callback_func();
+}
+}
+function getGMonitoringStatus() {
+if(G_MonitoringStatus != null) {
+return;
+} else {
+getAjaxData("api/monitoring/status", function($xml) {
+var gstatus_ret = xml2object($xml);
+if(gstatus_ret.type == "response") {
+G_MonitoringStatus = gstatus_ret;
+}
+}, {
+sync: true
+});
+}
+}
+function clearDeviceStatusInterval() {
+clearInterval(g_decive_timer);
+g_decive_timer = null;
+}
+function getDeviceStatus() {
+if (g_decive_timer) {
+return;
+}
+getDeviceStatusInterval();
+g_decive_timer = setInterval(getDeviceStatusInterval, g_feature.update_interval);
+}
+function getDeviceStatusInterval() {
+if (g_is_login_opened || g_is_clear_timeout) {
+clearDeviceStatusInterval();
+return;
+}
+if(firstTimeMontitoringStatusQuery == '0') {
+firstTimeMontitoringStatusQuery = '1';
+if(/opera/.test(navigator.userAgent.toLowerCase()) && (navigator.userAgent.toLowerCase().match(/opera\/([\d.]+)/)[1] == '11.00')) {
+getAjaxData('api/monitoring/status', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+G_MonitoringStatus = ret;
+DATA_READY.statusReady = true;
+execEachFunList();
+getPlmn();
+if(MACRO_NET_DUAL_MODE == g_net_mode_type) {
+getMainNetMode();
+}
+getAjaxData('api/monitoring/check-notifications', function($xml) {
+G_NotificationsStatus = null;
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (g_module.online_update_enabled && ret.response.OnlineUpdateStatus == 30 && g_needToLogin == '0') {
+if (window.location.href.toLowerCase().indexOf('update.html') < 0) {
+window.location.href = 'update.html';
+}
+}
+G_NotificationsStatus = ret.response;
+showNotification();
+DATA_READY.notificationsReady = true;
+execEachFunList();
+}
+});
+}
+});
+} else {
+getAjaxData('api/monitoring/status', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+G_MonitoringStatus = ret;
+DATA_READY.statusReady = true;
+execEachFunList();
+getPlmn();
+if(MACRO_NET_DUAL_MODE == g_net_mode_type) {
+getMainNetMode();
+}
+getAjaxData('api/monitoring/check-notifications', function($xml) {
+G_NotificationsStatus = null;
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (g_module.online_update_enabled && ret.response.OnlineUpdateStatus == 30 && g_needToLogin == '0') {
+if (window.location.href.toLowerCase().indexOf('update.html') < 0) {
+window.location.href = 'update.html';
+}
+}
+G_NotificationsStatus = ret.response;
+showNotification();
+DATA_READY.notificationsReady = true;
+execEachFunList();
+}
+});
+}
+}, {
+sync: true
+});
+}
+} else {
+getAjaxData('api/monitoring/status', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+G_MonitoringStatus = ret;
+DATA_READY.statusReady = true;
+execEachFunList();
+getPlmn();
+if(MACRO_NET_DUAL_MODE == g_net_mode_type) {
+getMainNetMode();
+}
+getAjaxData('api/monitoring/check-notifications', function($xml) {
+G_NotificationsStatus = null;
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (g_module.online_update_enabled && ret.response.OnlineUpdateStatus == 30 && g_needToLogin == '0') {
+if (window.location.href.toLowerCase().indexOf('update.html') < 0) {
+window.location.href = 'update.html';
+}
+}
+G_NotificationsStatus = ret.response;
+showNotification();
+DATA_READY.notificationsReady = true;
+execEachFunList();
+}
+});
+}
+});
+}
+if (g_module.wifioffload_enable) {
+getAjaxData('api/wlan/station-information', function($xml) {
+var ret = xml2object($xml);
+G_StationStatus = ret;
+if (G_StationStatus.type == 'response') {
+if (g_stationInfo != '' && G_StationStatus.response.NetworkName == g_stationInfo.response.NetworkName && G_StationStatus.response.CurrentSecMode == g_stationInfo.response.CurrentSecMode) {
+if (G_MonitoringStatus != null && G_MonitoringStatus.type == 'response') {
+if (g_wifiStatusInfo == G_MonitoringStatus.response.WifiConnectionStatus) {
+g_stationInfoFlag = true;
+} else {
+g_wifiStatusInfo = G_MonitoringStatus.response.WifiConnectionStatus;
+}
+}
+}
+g_stationInfo = ret;
+}
+DATA_READY.apStationReady = true;
+execEachFunList();
+});
+}
+if (g_module.cradle_enabled) {
+getAjaxData('api/cradle/status-info', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+G_cradleStationStatus = ret.response;
+}
+DATA_READY.cradleReady = true;
+execEachFunList();
+});
+} else {
+$('#ethernet_connection').remove();
+$('#only_ethernet_connection').remove();
+}
+if (g_module.celllock_enabled) {
+getAjaxData("api/ntwk/celllock", function($xml) {
+var celllock_ret = xml2object($xml);
+if(celllock_ret.type == "response") {
+G_CelllockEnable = celllock_ret.response.celllockEnable;
+G_CelllockStatus = celllock_ret.response.celllockStatus;
+}
+}, {
+sync: false
+});
+}
+if(g_module.wifi_enabled && typeof(g_wifiFeatureSwitch) != 'undefined' && WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled && g_loginFlag) {
+getAjaxData('api/wlan/multi-security-settings', function($xml) {
+var ret = xml2object($xml);
+if (ret.type != 'response') {
+return;
+}
+g_wlanInfo = ret.response;
+});
+}
+function execEachFunList() {
+if ((g_module.cradle_enabled && false == DATA_READY.cradleReady)||(g_module.wifioffload_enable && false == DATA_READY.apStationReady) || false == DATA_READY.statusReady || false == DATA_READY.notificationsReady) {
+return;
+}
+execFunList();
+DATA_READY.statusReady = false;
+DATA_READY.notificationsReady = false;
+DATA_READY.apStationReady = false;
+DATA_READY.cradleReady = false;
+}
+function execFunList() {
+alreadyStatusListnerExecuted = '1';
+$.each(STATUS_LISTENER_FUN_LIST, function(n, value) {
+eval(value);
+});
+}
+}
+function getPlmn() {
+function isValidType(inputType,defaultType) {
+if(typeof(inputType) == 'undefined' || inputType == '' || inputType == ' ') {
+return defaultType;
+} else {
+return inputType;
+}
+}
+g_plmn_rat = "";
+if(G_MonitoringStatus.response.ServiceStatus == SERVICE_STATUS_AVAIABLE) {
+if (typeof(G_MonitoringStatus.response.CurrentNetworkTypeEx) != 'undefined' &&
+G_MonitoringStatus.response.CurrentNetworkTypeEx != '') {
+switch(G_MonitoringStatus.response.CurrentNetworkTypeEx) {
+case MACRO_NET_WORK_TYPE_EX_GSM:
+case MACRO_NET_WORK_TYPE_EX_GPRS:
+case MACRO_NET_WORK_TYPE_EX_EDGE:
+case MACRO_NET_WORK_TYPE_EX_IS95A:
+case MACRO_NET_WORK_TYPE_EX_IS95B:
+case MACRO_NET_WORK_TYPE_EX_CDMA_1x:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_CDMA_1x:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkTypeEx,10)],plmn_label_2g);
+break;
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_0:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_A:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_B:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_0:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_A:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_B:
+case MACRO_NET_WORK_TYPE_EX_WCDMA:
+case MACRO_NET_WORK_TYPE_EX_HSDPA:
+case MACRO_NET_WORK_TYPE_EX_HSUPA:
+case MACRO_NET_WORK_TYPE_EX_HSPA:
+case MACRO_NET_WORK_TYPE_EX_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_EX_DC_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_EX_TD_SCDMA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSDPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSUPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSPA_PLUS:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkTypeEx,10)],plmn_label_3g);
+break;
+case MACRO_NET_WORK_TYPE_EX_LTE:
+case MACRO_NET_WORK_TYPE_EX_LTE_PLUS:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkTypeEx,10)],plmn_label_4g);
+break;
+default:
+break;
+}
+} else {
+switch(G_MonitoringStatus.response.CurrentNetworkType) {
+case MACRO_NET_WORK_TYPE_GSM:
+case MACRO_NET_WORK_TYPE_GPRS:
+case MACRO_NET_WORK_TYPE_EDGE:
+case MACRO_NET_WORK_TYPE_1xRTT:
+case MACRO_NET_WORK_TYPE_1xEVDV:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkType,10)],plmn_label_2g);
+break;
+case MACRO_NET_WORK_TYPE_WCDMA:
+case MACRO_NET_WORK_TYPE_TDSCDMA:
+case MACRO_NET_WORK_TYPE_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_HSDPA:
+case MACRO_NET_WORK_TYPE_HSUPA:
+case MACRO_NET_WORK_TYPE_HSPA:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS_64QAM:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS_MIMO:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkType,10)],plmn_label_3g);
+break;
+case MACRO_NET_WORK_TYPE_LTE:
+g_plmn_rat = isValidType(g_networktype[parseInt(G_MonitoringStatus.response.CurrentNetworkType,10)],plmn_label_4g);
+break;
+default:
+break;
+}
+}
+}
+if(g_plmn_rat == "" || typeof(g_plmn_rat) == 'undefined') {
+g_net_mode = dialup_label_no_service;
+} else {
+g_net_mode = g_plmn_rat;
+}
+return g_plmn_rat;
+}
+function getMainNetMode() {
+var newNetMode = null;
+if (typeof(G_MonitoringStatus.response.CurrentNetworkTypeEx) != 'undefined' &&
+G_MonitoringStatus.response.CurrentNetworkTypeEx != '') {
+switch(G_MonitoringStatus.response.CurrentNetworkTypeEx) {
+case MACRO_NET_WORK_TYPE_EX_IS95A:
+case MACRO_NET_WORK_TYPE_EX_IS95B:
+case MACRO_NET_WORK_TYPE_EX_CDMA_1x:
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EX_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_CDMA_1x:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_0:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_A:
+case MACRO_NET_WORK_TYPE_EX_EHRPD_REL_B:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_0:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_A:
+case MACRO_NET_WORK_TYPE_EX_HYBRID_EHRPD_REL_B:
+newNetMode = MACRO_NET_MODE_C;
+break;
+case MACRO_NET_WORK_TYPE_EX_GSM:
+case MACRO_NET_WORK_TYPE_EX_GPRS:
+case MACRO_NET_WORK_TYPE_EX_EDGE:
+case MACRO_NET_WORK_TYPE_EX_WCDMA:
+case MACRO_NET_WORK_TYPE_EX_HSDPA:
+case MACRO_NET_WORK_TYPE_EX_HSUPA:
+case MACRO_NET_WORK_TYPE_EX_HSPA:
+case MACRO_NET_WORK_TYPE_EX_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_EX_DC_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_EX_TD_SCDMA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSDPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSUPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSPA:
+case MACRO_NET_WORK_TYPE_EX_TD_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_EX_LTE:
+case MACRO_NET_WORK_TYPE_EX_LTE_PLUS:
+newNetMode = MACRO_NET_MODE_W;
+break;
+default:
+break;
+}
+} else {
+switch(G_MonitoringStatus.response.CurrentNetworkType) {
+case MACRO_NET_WORK_TYPE_EVDO_REV_0:
+case MACRO_NET_WORK_TYPE_EVDO_REV_A:
+case MACRO_NET_WORK_TYPE_EVDO_REV_B:
+case MACRO_NET_WORK_TYPE_1xRTT:
+case MACRO_NET_WORK_TYPE_UMB:
+case MACRO_NET_WORK_TYPE_1xEVDV:
+case MACRO_NET_WORK_TYPE_3xRTT:
+newNetMode = MACRO_NET_MODE_C;
+break;
+case MACRO_NET_WORK_TYPE_GSM:
+case MACRO_NET_WORK_TYPE_GPRS:
+case MACRO_NET_WORK_TYPE_EDGE:
+case MACRO_NET_WORK_TYPE_WCDMA:
+case MACRO_NET_WORK_TYPE_HSDPA:
+case MACRO_NET_WORK_TYPE_HSUPA:
+case MACRO_NET_WORK_TYPE_HSPA:
+case MACRO_NET_WORK_TYPE_TDSCDMA:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS_64QAM:
+case MACRO_NET_WORK_TYPE_HSPA_PLUS_MIMO:
+case MACRO_NET_WORK_TYPE_LTE:
+newNetMode = MACRO_NET_MODE_W;
+break;
+default:
+break;
+}
+}
+if(newNetMode != null) {
+if(g_net_mode_status != newNetMode) {
+if(g_net_mode_status == MACRO_NET_MODE_W || g_net_mode_status == MACRO_NET_MODE_C) {
+if(!g_judgeApplyFlag) {
+showInfoDialog(IDS_common_netmode_change);
+} else {
+g_judgeApplyFlag = false;
+}
+}
+g_net_mode_status = newNetMode;
+g_net_mode_change = MACRO_NET_MODE_CHANGE;
+}
+}
+}
+function resetNetModeChange() {
+g_net_mode_change = MACRO_NET_MODE_RESET;
+}
+function checkOffloadEnabled() {
+if(!checkValueIsNull(G_cradleStationStatus)) {
+setTimeout(checkOffloadEnabled, 50);
+return;
+}
+if(g_module.cradle_enabled && CRADLE_NETLINE_EXIST == G_cradleStationStatus.cradlestatus && ETHERNET_LAN_MODE != G_cradleStationStatus.connectionmode) {
+var offload_disabled_start = IDS_function_disabled.replace('%s1','cradle');
+var offload_disabled = offload_disabled_start.replace('%s2','offload');
+showInfoDialog(offload_disabled, false, disableEntirePage);
+}
+}
+function checkValueIsNull(value) {
+if(value == null || typeof(value) == 'undefined') {
+return false;
+} else {
+return true;
+}
+}
+function initialStatusIcon() {
+var corner = '';
+if (LANGUAGE_DATA.current_language == 'ar_sa' || LANGUAGE_DATA.current_language == 'he_il' || LANGUAGE_DATA.current_language == 'fa_fa') {
+corner = {
+my: 'topLeft',
+at: 'bottomCenter'
+};
+} else {
+corner = {
+my: 'topRight',
+at: 'bottomCenter'
+};
+}
+addStatusListener('getIconStatus()');
+if(alreadyStatusListnerExecuted == '1') {
+getIconStatus();
+}
+if (g_module.sms_enabled) {
+$('#tooltip_sms').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.unread_sms_tooltip_state + '',
+position: {
+corner:corner
+},
+style: {
+classes: 'qtip-sms'
+}
+});
+}
+if (g_module.online_update_enabled) {
+$('#tooltip_update').qtip({
+content: '
' + common_new_version + '',
+position: {
+corner:corner
+},
+style: {
+classes: 'qtip-upd'
+}
+});
+}
+$('#sim_signal_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state + '',
+position: {
+corner: corner
+},
+style: {
+width: 130 ,
+classes: 'qtip-sim'
+}
+});
+$('#wan_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.wan_tooltip_state + '',
+position: {
+corner: corner
+},
+style: {
+classes: 'qtip-wan'
+}
+});
+$('#wifi_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.wifi_tooltip_state + '',
+position: {
+corner: corner
+},
+style: {
+classes: 'qtip-wifi'
+}
+});
+$('#battery_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.battery_tooltip_state + '',
+position: {
+corner: corner
+},
+style: {
+classes: 'qtip-battery'
+}
+});
+$('#tooltip_sms_full').qtip({
+content: '
' + sms_message_full + '',
+position: {
+corner: corner
+},
+style: {
+classes: 'qtip-sms_full'
+}
+});
+$('#station_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.station_tooltip_state + '',
+position: {
+corner:corner
+},
+style: {
+classes: 'qtip-station'
+}
+});
+$('#indoor_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.wifi_indoor_tooltip_state + '',
+position: {
+corner:corner
+},
+style: {
+classes: 'qtip-indoor'
+}
+});
+$('#bluetooth_gif').qtip({
+content: '
' + STATUS_BAR_ICON_STATUS.bluetooth_tooltip_state + '',
+position: {
+corner:corner
+},
+style: {
+classes: 'qtip_bluetooth'
+}
+});
+}
+function refreshSimcardStatus() {
+getAjaxData('api/monitoring/converged-status', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+g_main_convergedStatus = ret.response;
+}
+});
+g_simcard_timer = setTimeout(refreshSimcardStatus, SIMCARD_STATUS_REFRESH);
+}
+function getIconStatus() {
+alreadyStatusListnerExecuted = '0';
+var g_connection_status = "0";
+var header_ret = G_MonitoringStatus;
+var station_ret = G_StationStatus;
+var g_cradle_change_status = '0';
+if (header_ret != null && header_ret.type == 'response') {
+header_icon_status.ConnectionStatus = header_ret.response.ConnectionStatus;
+if (g_module.cradle_enabled && checkValueIsNull(G_cradleStationStatus) && CRADLE_NETLINE_EXIST == G_cradleStationStatus.cradlestatus
+&& ETHERNET_LAN_MODE != G_cradleStationStatus.connectionmode && (CRADLEAUTOMODE != G_cradleStationStatus.connectionmode)) {
+var cradle_ret = G_cradleStationStatus;
+header_icon_status.ConnectionStatus = G_cradleStationStatus.connectstatus;
+}
+if (typeof(header_ret.response.SignalIcon) != 'undefined' ||
+header_ret.response.SignalIcon != null) {
+header_icon_status.SignalStrength = header_ret.response.SignalIcon;
+} else {
+header_icon_status.SignalStrength = parseInt(header_ret.response.SignalStrength / 20, 10).toString();
+}
+header_icon_status.BatteryStatus = header_ret.response.BatteryStatus;
+header_icon_status.BatteryLevel = header_ret.response.BatteryLevel;
+header_icon_status.BatteryPercent = header_ret.response.BatteryPercent;
+header_icon_status.SimStatus = header_ret.response.SimStatus;
+header_icon_status.WifiStatus = header_ret.response.WifiStatus;
+header_icon_status.BatteryColumnDisplay = header_ret.response.BatteryColumnDisplay;
+header_icon_status.BluetoothStatus = header_ret.response.bluetooth_edr_switch;
+header_icon_status.BluetoothConnectNumber = header_ret.response.bluetooth_edr_currert_user;
+g_usbBattery_status = header_ret.response.usbup;
+if (g_needPinlock && g_main_convergedStatus.SimState == 255) {
+header_icon_status.SimStatus = 255;
+}
+if (typeof(header_ret.response.CurrentNetworkTypeEx) != 'undefined' &&
+header_ret.response.CurrentNetworkTypeEx != '') {
+header_icon_status.CurrentNetworkType = header_ret.response.CurrentNetworkTypeEx;
+} else {
+header_icon_status.CurrentNetworkType = header_ret.response.CurrentNetworkType;
+}
+if((g_usbup != g_usbBattery_status) || ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || (g_BatteryStatus != header_icon_status.BatteryStatus)||(g_BatteryLevel != header_icon_status.BatteryLevel)||((g_coulometer_status == '1')&&(g_BatteryPercent != header_icon_status.BatteryPercent)) || header_icon_status.BatteryColumnDisplay) {
+if(g_BatteryStatus != header_icon_status.BatteryStatus ) {
+if(g_coulometer_status == '1') {
+g_coulometer_BatteryStatus = null;
+g_BatteryLevel = header_icon_status.BatteryLevel;
+} else {
+g_BatteryLevel = null;
+}
+g_BatteryStatus = header_icon_status.BatteryStatus;
+}
+switch (header_icon_status.BatteryStatus) {
+case MACRO_BATTERY_STATUS_NORMAL:
+if (header_icon_status.BatteryColumnDisplay === '1') {
+getBatteryLevel_529(header_icon_status.BatteryLevel);
+if (g_BatteryPercent != header_icon_status.BatteryPercent || g_coulometer_BatteryStatus != header_icon_status.BatteryStatus) {
+g_BatteryPercent = header_icon_status.BatteryPercent;
+g_coulometer_BatteryStatus = header_icon_status.BatteryStatus;
+}
+$('#battery_gif').show();
+break;
+}
+if (g_coulometer_status == '1' && (g_BatteryPercent != header_icon_status.BatteryPercent || g_coulometer_BatteryStatus != header_icon_status.BatteryStatus || g_usbup != g_usbBattery_status)) {
+if (g_usbup != g_usbBattery_status) {
+g_usbup = g_usbBattery_status;
+}
+g_BatteryPercent = header_icon_status.BatteryPercent;
+g_coulometer_BatteryStatus = header_icon_status.BatteryStatus;
+getBatteryLevel(header_icon_status.BatteryPercent);
+} else if(( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || g_BatteryLevel!=header_icon_status.BatteryLevel || g_usbup != g_usbBattery_status) {
+if (g_usbup != g_usbBattery_status) {
+g_usbup = g_usbBattery_status;
+}
+g_BatteryLevel = header_icon_status.BatteryLevel;
+getBatteryLevel(header_icon_status.BatteryLevel);
+}
+$('#battery_gif').show();
+break;
+case MACRO_BATTERY_STATUS_LOW:
+if(g_coulometer_status == '1') {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = header_icon_status.BatteryPercent + '%';
+} else {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = battery_prower_low;
+}
+if (null != g_lastBatteryStatus && MACRO_BATTERY_STATUS_LOW == g_lastBatteryStatus) {
+break;
+}
+if(g_usbBattery_status == '1' && header_icon_status.BatteryColumnDisplay !== '1') {
+$('#battery_gif').html('

');
+} else {
+$('#battery_gif').html('

');
+}
+$('#battery_gif').show();
+break;
+case MACRO_BATTERY_STATUS_ELECT:
+if(g_coulometer_status == '1') {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = header_icon_status.BatteryPercent + '%';
+} else {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = battery_recharging;
+}
+if (null != g_lastBatteryStatus && MACRO_BATTERY_STATUS_ELECT == g_lastBatteryStatus) {
+break;
+}
+if(g_usbBattery_status == '1' || header_icon_status.BatteryColumnDisplay === '1') {
+$('#battery_gif').html('

');
+} else {
+$('#battery_gif').html('

');
+}
+$('#battery_gif').show();
+break;
+case MACRO_BATTERY_STATUS_NOBATTERY:
+$('#battery_gif').hide();
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = "";
+break;
+default:
+$('#battery_gif').show();
+if(g_coulometer_status == '1') {
+getBatteryLevel(header_icon_status.BatteryPercent);
+} else {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = common_battery;
+if(g_usbBattery_status == '1' && header_icon_status.BatteryColumnDisplay !== '1') {
+$('#battery_gif').html('

');
+} else {
+$('#battery_gif').html('

');
+}
+}
+break;
+}
+g_lastBatteryStatus = header_icon_status.BatteryStatus;
+}
+if( ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || g_WifiStatus!=header_icon_status.WifiStatus) {
+g_WifiStatus = header_icon_status.WifiStatus;
+switch (header_icon_status.WifiStatus) {
+case MACRO_WIFI_OFF:
+$('#wifi_gif').html('
');
+STATUS_BAR_ICON_STATUS.wifi_tooltip_state = wlan_label_wlan_off;
+break;
+case MACRO_WIFI_ON:
+if(typeof(G_MonitoringStatus.response.wififrequence)!=undefined) {
+if((typeof(g_wifiFeatureSwitch) != 'undefined' )&&(WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled) &&(G_MonitoringStatus.response.wififrequence==WIFI5G_ON)) {
+$('#wifi_gif').html('
');
+} else if((typeof(g_wifiFeatureSwitch) != 'undefined' )&&(1 == g_wifiFeatureSwitch.wifi_dbdc_enable) &&(G_MonitoringStatus.response.wififrequence==WIFIDBDC_ON)) {
+$('#wifi_gif').html('
');
+} else {
+$('#wifi_gif').html('
');
+}
+} else {
+if((typeof(g_wifiFeatureSwitch) != 'undefined')&&(WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled) &&(g_wlanInfo.WifiMode=="a/n")) {
+$('#wifi_gif').html('
');
+} else {
+$('#wifi_gif').html('
');
+}
+}
+STATUS_BAR_ICON_STATUS.wifi_tooltip_state = wlan_label_wlan_on;
+break;
+default:
+$('#wifi_gif').html('
');
+STATUS_BAR_ICON_STATUS.wifi_tooltip_state = wlan_label_wlan_off;
+break;
+}
+}
+if (g_WifiStatus == header_icon_status.WifiStatus && MACRO_WIFI_ON == header_icon_status.WifiStatus) {
+if(typeof(G_MonitoringStatus.response.wififrequence) != 'undefined') {
+if((wifi5g_icon_flag == '-1') && (typeof(g_wifiFeatureSwitch) != 'undefined')&&(WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled) && (G_MonitoringStatus.response.wififrequence==WIFI5G_ON)) {
+$('#wifi_gif').html('
');
+wifi5g_icon_flag = 0;
+wifion_icon_flag = -1;
+} else if((typeof(g_wifiFeatureSwitch) != 'undefined' )&&(1 == g_wifiFeatureSwitch.wifi_dbdc_enable) &&(G_MonitoringStatus.response.wififrequence==WIFIDBDC_ON)) {
+$('#wifi_gif').html('
');
+wifi5g_icon_flag = -1;
+wifion_icon_flag = -1;
+} else if ((wifion_icon_flag == '-1') && !((typeof(g_wifiFeatureSwitch) != 'undefined')&&(WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled)&&(G_MonitoringStatus.response.wififrequence==WIFI5G_ON))) {
+$('#wifi_gif').html('
');
+wifion_icon_flag = 0;
+wifi5g_icon_flag = -1;
+}
+} else {
+if( (wifi5g_icon_flag == '-1') && (typeof(g_wifiFeatureSwitch) != 'undefined')&& (WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled)&&(g_wlanInfo.WifiMode=="a/n")) {
+$('#wifi_gif').html('
');
+wifi5g_icon_flag = 0;
+wifion_icon_flag = -1;
+} else if (wifion_icon_flag == '-1' && !((typeof(g_wifiFeatureSwitch) != 'undefined')&&(WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled)&&(g_wlanInfo.WifiMode=="a/n"))) {
+$('#wifi_gif').html('
');
+wifion_icon_flag = 0;
+wifi5g_icon_flag = -1;
+}
+}
+STATUS_BAR_ICON_STATUS.wifi_tooltip_state = wlan_label_wlan_on;
+}
+if( WIFI5G_ON == g_wifiFeatureSwitch.wifi5g_enabled && typeof(header_ret.response.wifiindooronly) != 'undefined') {
+if(g_WifiIndoorStatus != header_ret.response.wifiindooronly || ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0')) {
+g_WifiIndoorStatus = header_ret.response.wifiindooronly;
+if(1 == header_ret.response.wifiindooronly) {
+$('#indoor_gif').html('
');
+STATUS_BAR_ICON_STATUS.wifi_indoor_tooltip_state = wlan_label_5gWifi_indoor;
+$('#indoor_gif').show();
+} else {
+$('#indoor_gif').hide();
+}
+}
+} else {
+$('#indoor_gif').hide();
+}
+if((g_SimStatus != g_main_convergedStatus.SimState)||(g_hSimStatus != header_icon_status.SimStatus)) {
+g_SimStatus = g_main_convergedStatus.SimState;
+g_hSimStatus = header_icon_status.SimStatus;
+sign_enable = 0;
+var simdisable = '
';
+if (MACRO_PIN_REQUIRED == g_main_convergedStatus.SimState) {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_label_pin_code_required;
+} else if (MACRO_PUK_REQUIRED == g_main_convergedStatus.SimState) {
+if (PUK_TIMES_ZERO == g_pin_status_SimPukTimes) {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_help_puk_locked;
+} else {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_label_puk_code_required;
+}
+} else if ( (dialup_label_no_service == g_net_mode) && ( (MACRO_SIM_STATUS_USIM_N == header_icon_status.SimStatus) || (MACRO_SIM_STATUS_USIM_NE == header_icon_status.SimStatus) ) ) {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_label_sim_invalid;
+} else if ('undefined' == header_icon_status.SimStatus) {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_label_sim_invalid;
+} else if (header_icon_status.SimlockStatus) {
+$('#sim_signal_gif').html(simdisable);
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = dialup_label_sim_invalid;
+} else {
+sign_enable = 1;
+}
+}
+if(sign_enable) {
+STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state = g_net_mode;
+if((/msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || g_SignalStrength!=header_icon_status.SignalStrength && (SIMCARD_OK == sign_enable) ) {
+g_SignalStrength = header_icon_status.SignalStrength;
+switch (header_icon_status.SignalStrength) {
+case MACRO_EVDO_LEVEL_ONE:
+$('#sim_signal_gif').html('
');
+break;
+case MACRO_EVDO_LEVEL_TWO:
+$('#sim_signal_gif').html('
');
+break;
+case MACRO_EVDO_LEVEL_THREE:
+$('#sim_signal_gif').html('
');
+break;
+case MACRO_EVDO_LEVEL_FOUR:
+$('#sim_signal_gif').html('
');
+break;
+case MACRO_EVDO_LEVEL_FIVE:
+$('#sim_signal_gif').html('
');
+break;
+default:
+$('#sim_signal_gif').html('
');
+break;
+}
+}
+if(g_module.local_update_enabled) {
+$('#menu_update a').prop("href","update.html");
+if (g_module.cradle_enabled && checkValueIsNull(G_cradleStationStatus) && CRADLE_NETLINE_EXIST == G_cradleStationStatus.cradlestatus
+&& G_cradleStationStatus.connectionmode != ETHERNET_LAN_MODE
+&& (G_cradleStationStatus.connectstatus == CRADLE_CONNECTSTATUSNULL || G_cradleStationStatus.connectstatus == CRANDLE_CONNECTSTATUSERRO)) {
+$('#menu_update a').prop("href","update_local.html");
+}
+}
+} else {
+if(g_module.local_update_enabled &&
+!((G_MonitoringStatus.response.WifiConnectionStatus == WIFI_CONNECTED)||
+(g_module.cradle_enabled && checkValueIsNull(G_cradleStationStatus) && CRADLE_NETLINE_EXIST == G_cradleStationStatus.cradlestatus &&
+G_cradleStationStatus.connectionmode != ETHERNET_LAN_MODE &&
+(G_cradleStationStatus.connectstatus != CRADLE_CONNECTSTATUSNULL &&
+G_cradleStationStatus.connectstatus != CRANDLE_CONNECTSTATUSERRO)))) {
+$('#menu_update a').prop("href","update_local.html");
+if(g_not_need_login_update) {
+$('#menu_update').live('click', function() {
+if (!g_needToLogin) {
+return;
+}
+g_nav = $(this);
+if(g_nav.parent().prop("id") == "menu_connection_settings" || g_nav.parent().prop("id") == "profile_settings") {
+g_nav = g_nav.parent();
+}
+getAjaxData('api/user/state-login', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (ret.response.State != '0') {
+g_default_password_status = parseInt(ret.response.firstlogin,10);
+if(g_default_password_status == 0) {
+g_destnation = null;
+} else {
+g_destnation = g_nav.children().first().prop('href');
+}
+g_nav.children().first().prop('href', 'javascript:void(0);');
+showloginDialog();
+}
+}
+}, {
+sync: true
+});
+});
+}
+}
+}
+}
+if (g_module.online_update_enabled) {
+if(g_NotificationsOnlineUpdateStatus!=G_NotificationsStatus.OnlineUpdateStatus) {
+g_NotificationsOnlineUpdateStatus = G_NotificationsStatus.OnlineUpdateStatus;
+if (G_NotificationsStatus.OnlineUpdateStatus == MACRO_NEWVERSIONFOUND || G_NotificationsStatus.OnlineUpdateStatus == MACRO_READYTOUPDATE) {
+$('#update_gif').css({
+'display' : 'block'
+});
+$('#tooltip_update').html("

");
+} else {
+$('#update_gif').css({
+'display' : 'none'
+});
+$('#tooltip_update').html("

");
+}
+}
+}
+if (g_module.bt_enabled && (BLUETOOTH_ON == header_icon_status.BluetoothStatus)) {
+STATUS_BAR_ICON_STATUS.bluetooth_tooltip_state = IDS_bluetooth_icon_name;
+if (BLUETOOTH_CONNECT_NUMBER_1 == header_icon_status.BluetoothConnectNumber) {
+$('#bluetooth_gif').html("

");
+} else if (BLUETOOTH_CONNECT_NUMBER_2 == header_icon_status.BluetoothConnectNumber) {
+$('#bluetooth_gif').html("

");
+} else if(BLUETOOTH_CONNECT_NUMBER_3 == header_icon_status.BluetoothConnectNumber) {
+$('#bluetooth_gif').html("

");
+} else {
+$('#bluetooth_gif').html("

");
+}
+$("#bluetooth_gif").show();
+} else {
+$("#bluetooth_gif").hide();
+}
+function ap_station_disabled() {
+switch (header_icon_status.ConnectionStatus) {
+case MACRO_CONNECTION_CONNECTED:
+g_connection_status = "1";
+var CurrentUpload = '';
+var CurrentDownload = '';
+if(( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || $("#wan_gif").html().indexOf("wan_disable")<0) {
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+}
+$('#wan_gif').show();
+getAjaxData('api/monitoring/traffic-statistics', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+CurrentUpload = ret.response.CurrentUpload;
+CurrentDownload = ret.response.CurrentDownload;
+if((wanUpload != '')&&(wanUpload != null) && (wanDownload != '')&&(wanDownload != null)) {
+if((wanUpload != CurrentUpload) && (CurrentDownload == wanDownload)) {
+if(g_up_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "0";
+g_up_down_connection_status = "0";
+g_up_connection_status = "1";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wanUpload == CurrentUpload) && (CurrentDownload != wanDownload)) {
+if(g_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "0";
+g_up_down_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "1";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wanUpload != CurrentUpload) && (CurrentDownload != wanDownload)) {
+if(g_up_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "0";
+g_up_down_connection_status = "1";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wanUpload == CurrentUpload) && (CurrentDownload == wanDownload)) {
+if(g_disable_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "1";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+g_up_down_connection_status = "0";
+}
+}
+wanUpload = CurrentUpload;
+wanDownload = CurrentDownload;
+} else {
+if(g_disable_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "1";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+g_up_down_connection_status = "0";
+}
+wanUpload = CurrentUpload;
+wanDownload = CurrentDownload;
+}
+}
+});
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+break;
+default:
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_disconnect;
+break;
+}
+}
+if (WIFI_CONNECTED == G_MonitoringStatus.response.WifiConnectionStatus && g_module.wifioffload_enable) {
+if(station_ret != null
+&& station_ret.type == "response" ) {
+g_connection_status = "1";
+var wifiCurrentUpload = '';
+var wifiCurrentDownload = '';
+if( ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || $("#wan_gif").html().indexOf("wan_disable")<0) {
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+}
+$('#wan_gif').show();
+getAjaxData('api/wlan/station-information', function($xml) {
+var ret = xml2object($xml);
+G_StationStatus = ret;
+if (ret.type == 'response') {
+wifiCurrentUpload = ret.response.TxFlux;
+wifiCurrentDownload = ret.response.RxFlux;
+if((wifiUpload != '') && (wifiDownload != '')) {
+if((wifiUpload != wifiCurrentUpload) && (wifiCurrentDownload == wifiDownload)) {
+if(g_up_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "0";
+g_up_down_connection_status = "0";
+g_up_connection_status = "1";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wifiUpload == wifiCurrentUpload) && (wifiCurrentDownload != wifiDownload)) {
+if(g_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "0";
+g_up_down_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "1";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wifiUpload != wifiCurrentUpload) && (wifiCurrentDownload != wifiDownload)) {
+if(g_up_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_up_down_connection_status = "1";
+g_disable_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else if((wifiUpload == wifiCurrentUpload) && (wifiCurrentDownload == wifiDownload)) {
+if(g_disable_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "1";
+g_up_down_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+}
+wifiUpload = wifiCurrentUpload;
+wifiDownload = wifiCurrentDownload;
+} else {
+if(g_disable_connection_status == "0") {
+$('#wan_gif').html('
');
+g_disable_connection_status = "1";
+g_up_down_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+wifiUpload = wifiCurrentUpload;
+wifiDownload = wifiCurrentDownload;
+}
+}
+});
+var apSignal = setWifiSignal(station_ret.response.SignalStrength);
+var classname = "station_" + apSignal ;
+if( ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || typeof ($("#station_gif").html())=="undefined"|| $("#station_gif").html().indexOf(classname) < 0) {
+if(apSignal == "0.1") {
+$('#station_gif').html('
');
+} else if(apSignal == "0") {
+$('#station_gif').html('
');
+} else if(apSignal == "1") {
+$('#station_gif').html('
');
+} else if(apSignal == "2") {
+$('#station_gif').html('
');
+} else if(apSignal == "3") {
+$('#station_gif').html('
');
+} else if(apSignal == "4") {
+$('#station_gif').html('
');
+}
+}
+$("#station_gif").show();
+} else {
+$("#station_gif").hide();
+ap_station_disabled();
+}
+g_Monitoring_CradleConnectionStatus = -1111;
+} else if(g_module.cradle_enabled && checkValueIsNull(G_cradleStationStatus) && CRADLE_NETLINE_EXIST == G_cradleStationStatus.cradlestatus && ETHERNET_LAN_MODE != G_cradleStationStatus.connectionmode) {
+if( ( /msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') || g_Monitoring_CradleConnectionStatus != G_cradleStationStatus.cradlestatus) {
+g_Monitoring_CradleConnectionStatus = G_cradleStationStatus.cradlestatus;
+$('#station_gif').html('
');
+$("#station_gif").show();
+STATUS_BAR_ICON_STATUS.station_tooltip_state = IDS_plmn_label_wx;
+g_cradle_change_status = '1';
+if(G_cradleStationStatus.connectstatus == CRADLE_CONNECTED) {
+g_connection_status = "1";
+$('#wan_gif').show();
+if(g_up_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_up_down_connection_status = "1";
+g_disable_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+} else {
+ap_station_disabled();
+}
+} else {
+if(checkValueIsNull(G_cradleStationStatus) && G_cradleStationStatus.connectstatus == CRADLE_CONNECTED) {
+g_connection_status = "1";
+$('#wan_gif').show();
+if(g_up_down_connection_status == "0") {
+$('#wan_gif').html('
');
+g_up_down_connection_status = "1";
+g_disable_connection_status = "0";
+g_up_connection_status = "0";
+g_down_connection_status = "0";
+}
+STATUS_BAR_ICON_STATUS.wan_tooltip_state = dialup_label_wan_connect;
+}
+g_Monitoring_CradleConnectionStatus = G_cradleStationStatus.cradlestatus;
+}
+} else {
+g_Monitoring_CradleConnectionStatus = -1111;
+$("#station_gif").hide();
+ap_station_disabled();
+}
+if(G_cradleStationStatus != null) {
+if(g_module.cradle_enabled && (G_cradleStationStatus.cradlestatus == 1) &&(G_cradleStationStatus.connectionmode == 0 || G_cradleStationStatus.connectionmode == 1) && (g_cradle_change_status == '0')) {
+if(G_cradleStationStatus.connectstatus == CRADLE_CONNECTFAILED) {
+$('#station_gif').html('
');
+} else {
+$('#station_gif').html("

");
+g_Monitoring_CradleConnectionStatus = -1111;
+}
+$("#station_gif").show();
+STATUS_BAR_ICON_STATUS.station_tooltip_state = IDS_plmn_label_wx;
+}
+}
+if(g_connection_status == "0") {
+$('#wan_gif').hide();
+}
+var unreadSmsSize = G_NotificationsStatus.UnreadMessage;
+STATUS_BAR_ICON_STATUS.unread_sms_tooltip_state = common_new_message + unreadSmsSize;
+changeTooltipContent();
+}
+function getBatteryLevel(str) {
+if(g_usbBattery_status == '1') {
+if(g_coulometer_status == '1') {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = str + '%';
+var strTemp = parseInt(str, 10);
+if(0 < strTemp && strTemp <= 10) {
+$('#battery_gif').html("

");
+} else if(10 < strTemp && strTemp <= 23) {
+$('#battery_gif').html("

");
+} else if(23 < strTemp && strTemp <= 34) {
+$('#battery_gif').html("

");
+} else if(34 < strTemp && strTemp <= 45) {
+$('#battery_gif').html("

");
+} else if(45 < strTemp && strTemp <= 56) {
+$('#battery_gif').html("

");
+} else if(56 < strTemp && strTemp <= 67) {
+$('#battery_gif').html("

");
+} else if(67 < strTemp && strTemp <= 78) {
+$('#battery_gif').html("

");
+} else if(78 < strTemp && strTemp <= 89) {
+$('#battery_gif').html("

");
+} else if(89 < strTemp && strTemp <= 100) {
+$('#battery_gif').html("

");
+} else {
+$('#battery_gif').html("

");
+}
+} else {
+switch (str) {
+case MACRO_BATTERY_LEVEL_ONE:
+case MACRO_BATTERY_LEVEL_TWO:
+case MACRO_BATTERY_LEVEL_THREE:
+var temp =(parseInt(str,10)*2).toString();
+$('#battery_gif').html("

");
+break;
+case MACRO_BATTERY_LEVEL_FOUR:
+$('#battery_gif').html("

");
+break;
+default:
+$('#battery_gif').html("

");
+break;
+}
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = common_battery;
+}
+} else {
+if(g_coulometer_status == '1') {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = str + '%';
+var strTemp = parseInt(str, 10);
+if(0 < strTemp && strTemp <= 10) {
+$('#battery_gif').html('
');
+} else if(10 < strTemp && strTemp <= 23) {
+$('#battery_gif').html('
');
+} else if(23 < strTemp && strTemp <= 34) {
+$('#battery_gif').html('
');
+} else if(34 < strTemp && strTemp <= 45) {
+$('#battery_gif').html('
');
+} else if(45 < strTemp && strTemp <= 56) {
+$('#battery_gif').html('
');
+} else if(56 < strTemp && strTemp <= 67) {
+$('#battery_gif').html('
');
+} else if(67 < strTemp && strTemp <= 78) {
+$('#battery_gif').html('
');
+} else if(78 < strTemp && strTemp <= 89) {
+$('#battery_gif').html('
');
+} else if(89 < strTemp && strTemp <= 100) {
+$('#battery_gif').html('
');
+} else {
+$('#battery_gif').html('
');
+}
+} else {
+switch (str) {
+case MACRO_BATTERY_LEVEL_ONE:
+case MACRO_BATTERY_LEVEL_TWO:
+case MACRO_BATTERY_LEVEL_THREE:
+var temp =(parseInt(str,10)*2).toString();
+if(temp == "2") {
+$('#battery_gif').html('
');
+} else if(temp == "4") {
+$('#battery_gif').html('
');
+} else if(temp == "6") {
+$('#battery_gif').html('
');
+}
+break;
+case MACRO_BATTERY_LEVEL_FOUR:
+$('#battery_gif').html('
');
+break;
+default:
+if(str == "5") {
+$('#battery_gif').html('
');
+} else if(str == "6") {
+$('#battery_gif').html('
');
+} else if(str == "7") {
+$('#battery_gif').html('
');
+} else if(str == "8") {
+$('#battery_gif').html('
');
+} else if(str == "9") {
+$('#battery_gif').html('
');
+} else {
+$('#battery_gif').html('
');
+}
+break;
+}
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = common_battery;
+}
+}
+}
+function getBatteryLevel_529(str) {
+if (g_coulometer_status == '1') {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = str + '%';
+} else {
+STATUS_BAR_ICON_STATUS.battery_tooltip_state = common_battery;
+}
+if(!str) {
+return;
+}
+switch (str) {
+case MACRO_BATTERY_LEVEL_ONE:
+$('#battery_gif').html("

");
+break;
+case MACRO_BATTERY_LEVEL_TWO:
+$('#battery_gif').html("

");
+break;
+case MACRO_BATTERY_LEVEL_THREE:
+$('#battery_gif').html("

");
+break;
+case MACRO_BATTERY_LEVEL_FOUR:
+$('#battery_gif').html("

");
+break;
+default:
+$('#battery_gif').html("

");
+break;
+}
+}
+function changeTooltipContent() {
+$('.qtip-sim').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.sim_signal_tooltip_state + '');
+$('.qtip-station').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.station_tooltip_state + '');
+$('.qtip-wan').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.wan_tooltip_state + '');
+$('.qtip-wifi').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.wifi_tooltip_state + '');
+$('.qtip-battery').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.battery_tooltip_state + '');
+$('.qtip-indoor').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.wifi_indoor_tooltip_state + '');
+$('.qtip-sms').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.unread_sms_tooltip_state + '');
+$('.qtip-bluetooth').find('.qtip-content').html('
' + STATUS_BAR_ICON_STATUS.bluetooth_tooltip_state + '');
+}
+function addStatusListener(funName) {
+STATUS_LISTENER_FUN_LIST.push(funName);
+var n=navigator.userAgent;
+if(/Firefox/.test(n)&&funName == 'index_updatePageStatusListener()') {
+eval(funName);
+} else {
+if (DATA_READY.statusReady && DATA_READY.notificationsReady) {
+eval(funName);
+}
+}
+}
+function base64encode(str) {
+var out, i, len;
+var c1, c2, c3;
+len = str.length;
+i = 0;
+out = '';
+while (i < len) {
+c1 = str.charCodeAt(i++) & 0xff;
+if (i == len) {
+out += g_base64EncodeChars.charAt(c1 >> 2);
+out += g_base64EncodeChars.charAt((c1 & 0x3) << 4);
+out += '==';
+break;
+}
+c2 = str.charCodeAt(i++);
+if (i == len) {
+out += g_base64EncodeChars.charAt(c1 >> 2);
+out += g_base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
+out += g_base64EncodeChars.charAt((c2 & 0xF) << 2);
+out += '=';
+break;
+}
+c3 = str.charCodeAt(i++);
+out += g_base64EncodeChars.charAt(c1 >> 2);
+out += g_base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
+out += g_base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
+out += g_base64EncodeChars.charAt(c3 & 0x3F);
+}
+return out;
+}
+function _utf8_encode(string) {
+string = string.replace(/\r\n/g,"\n");
+var utftext = "";
+for (var n = 0; n < string.length; n++) {
+var c = string.charCodeAt(n);
+if (c < 128) {
+utftext += String.fromCharCode(c);
+} else if((c > 127) && (c < 2048)) {
+utftext += String.fromCharCode((c >> 6) | 192);
+utftext += String.fromCharCode((c & 63) | 128);
+} else {
+utftext += String.fromCharCode((c >> 12) | 224);
+utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+utftext += String.fromCharCode((c & 63) | 128);
+}
+}
+return utftext;
+}
+function base64_encode (input) {
+_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+var output = "";
+var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+var i = 0;
+input = _utf8_encode(input);
+while (i < input.length) {
+chr1 = input.charCodeAt(i++);
+chr2 = input.charCodeAt(i++);
+chr3 = input.charCodeAt(i++);
+enc1 = chr1 >> 2;
+enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+enc4 = chr3 & 63;
+if (isNaN(chr2)) {
+enc3 = enc4 = 64;
+} else if (isNaN(chr3)) {
+enc4 = 64;
+}
+output = output +
+this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
+this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
+}
+return output;
+}
+function validateInput(username, password) {
+clearAllErrorLabel();
+var validate = true;
+if (username == '') {
+showErrorUnderTextbox('username', settings_hint_user_name_empty);
+$("#username").focus();
+$("#username").val("");
+return false;
+}
+if (password == '' && username != '') {
+showErrorUnderTextbox('password', dialup_hint_password_empty);
+$("#password").focus();
+$("#password").val("");
+return false;
+}
+if (!checkInputChar(username)) {
+showErrorUnderTextbox("password", IDS_login_username_password_wrong);
+$("#username").focus();
+$("#username").val("");
+$("#password").val("");
+return false;
+}
+return validate;
+}
+function login(destnation, callback, redirectDes) {
+var name = $.trim($('#username').val());
+var psd = $('#password').val();
+var valid = validateInput(name, psd);
+if(!valid) {
+return;
+}
+g_currentPassword = psd;
+refreshToken();
+if (g_scarm_login) {
+if($.isArray(g_requestVerificationToken)) {
+if(g_requestVerificationToken.length <= 0) {
+setTimeout( function () {
+if(g_requestVerificationToken.length > 0) {
+login(destnation, callback, redirectDes);
+}
+}, 50)
+return;
+}
+}
+var scram = CryptoJS.SCRAM();
+var firstNonce = scram.nonce().toString();
+var firstPostData = {
+username: name,
+firstnonce: firstNonce,
+mode: RSA_LOGIN_MODE
+};
+var firstXml = object2xml('request', firstPostData);
+saveAjaxData('api/user/challenge_login', firstXml, function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+var salt = CryptoJS.enc.Hex.parse(ret.response.salt);
+var iter = ret.response.iterations;
+var finalNonce = ret.response.servernonce;
+var authMsg = firstNonce + "," + finalNonce + "," + finalNonce;
+var saltPassword = scram.saltedPassword(psd,salt,iter).toString();
+var clientProof = scram.clientProof(psd, salt, iter, authMsg);
+var serverKey = scram.serverKey(CryptoJS.enc.Hex.parse(saltPassword)).toString();
+var finalPostData = {
+clientproof: clientProof,
+finalnonce: finalNonce
+};
+if (ret.response.newType && ret.response.newType == '1') {
+var newSalt = CryptoJS.enc.Hex.parse(ret.response.newSalt);
+var newIter = ret.response.newIterations;
+var newSaltPassword = scram.saltedPassword(psd,newSalt,newIter).toString();
+var newStoredKey = scram.storedKey(scram.clientKey(CryptoJS.enc.Hex.parse(newSaltPassword))).toString();
+var newServerKey = scram.serverKey(CryptoJS.enc.Hex.parse(newSaltPassword)).toString();
+var hashOldNewPwd = SHA256(newStoredKey + newServerKey + clientProof);
+finalPostData = {
+clientproof: clientProof,
+finalnonce: finalNonce,
+hashOldNewPwd: hashOldNewPwd,
+newStoredKey: newStoredKey,
+newServerKey: newServerKey
+}
+}
+var finalXml = object2xml('request', finalPostData);
+saveAjaxData('api/user/authentication_login', finalXml, function($xml) {
+ret = xml2object($xml);
+if (ret.type == 'response') {
+var serverProof = scram.serverProof(psd, salt, iter, authMsg);
+if (ret.response.serversignature == serverProof) {
+var publicKeySignature = scram.signature(CryptoJS.enc.Hex.parse(ret.response.rsan), CryptoJS.enc.Hex.parse(serverKey)).toString();
+if (ret.response.rsapubkeysignature == publicKeySignature) {
+g_encPublickey.e = ret.response.rsae;
+g_encPublickey.n = ret.response.rsan;
+storagePubkey(g_encPublickey.n,g_encPublickey.e);
+getAjaxData('api/user/state-login', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (current_href === "quicksetup") {
+if (g_privacypolicy_update === '1') {
+if ($("#privacy_notice").is(':checked')) {
+button_enable('step1_next', '1');
+}
+} else {
+button_enable('step1_next', '1');
+}
+}
+if(g_feature.china_region_enable == '1') {
+if(!(current_href == 'quicksetup')) {
+var update_switch = $('#autoupdate').is(':checked') ? 1 : 0;
+var request_autoUpdate = {
+auto_update: update_switch,
+ui_download: g_auto_update_ret.ui_download
+};
+var xmlstr_autoUpdate = object2xml('request', request_autoUpdate);
+saveAjaxData('api/online-update/autoupdate-config', xmlstr_autoUpdate, function($xml) {
+var ret = xml2object($xml);
+if (!isAjaxReturnOK(ret)) {
+showInfoDialog(common_failed);
+}
+}, {
+sync: true
+});
+}
+}
+g_default_password_status = parseInt(ret.response.firstlogin, 10);
+g_login_state = ret.response.State;
+g_username_default = ret.response.Username;
+$('#username_span').text(name);
+$('#username_span').show();
+$('#logout_span').text(common_logout);
+var passwordStr = $('#password').val();
+clearDialog();
+g_main_displayingPromptStack.pop();
+startLogoutTimer(redirectDes);
+if (g_module.gdpr_enabled && g_privacypolicy_update == '1') {
+if (current_href == 'pincoderequired' || current_href == 'pukrequired' || current_href == 'simlockrequired' || current_href == 'nocard' || current_href == 'cradleDisconnected') {
+login(g_destnation, showGDPRdialog(),redirectDes);
+}
+}
+if (g_restore_default_status != '1' && g_default_password_status == 0) {
+if (current_href != 'pincoderequired' && current_href != 'pukrequired' && current_href != 'simlockrequired' && current_href != 'nocard' && current_href != 'cradleDisconnected' && current_href != 'commend') {
+gotoPageWithoutHistory("modifypassword.html");
+}
+} else {
+if(checkPWRemind(passwordStr,null,null)) {
+if(g_show_password_remind != 1) {
+showPWRemindDialog(destnation, callback);
+} else {
+loginSwitchDoing(destnation, callback);
+}
+} else {
+loginSwitchDoing(destnation, callback);
+}
+}
+if (typeof(ret.response.userlevel) != 'undefined' && ret.response.userlevel == '1') {
+$("#menu_sms").hide();
+$("#show_psk_password").hide();
+$("#show_wep_password").hide();
+$('#showPswForW2,#showPswForText').hide();
+} else {
+$("#menu_sms").show();
+$("#show_psk_password").show();
+$("#show_wep_password").show();
+$('#showPswForW2,#showPswForText').show();
+if(g_restore_default_status == '1') {
+$("#menu_sms").hide();
+}
+}
+}
+});
+} else {
+showErrorUnderTextbox('username', IDS_login_fialed_prompt);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+}
+} else {
+showErrorUnderTextbox('username', IDS_login_fialed_prompt);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+}
+} else {
+if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_ORERRUN) {
+showErrorUnderTextbox('password', IDS_login_username_password_input_overrun);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_WRONG) {
+showErrorUnderTextbox('password', IDS_login_username_password_wrong);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+}
+}
+});
+} else {
+if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_ORERRUN) {
+showErrorUnderTextbox('password', IDS_login_username_password_input_overrun);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_WRONG) {
+showErrorUnderTextbox('password', IDS_login_username_password_wrong);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_ALREADY_LOGIN) {
+showErrorUnderTextbox('password', IDS_touch_user_login_repeat);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_FREQUENTLY_LOGIN) {
+showErrorUnderTextbox('password', IDS_login_frequently_warning);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+}
+}
+});
+} else {
+if($.isArray(g_requestVerificationToken)) {
+if(g_requestVerificationToken.length > 0) {
+if(g_password_type == '4') {
+psd = base64encode(SHA256(name + base64encode(SHA256($('#password').val())) + g_requestVerificationToken[0]));
+} else {
+psd = base64encode($('#password').val());
+}
+} else {
+setTimeout( function () {
+if(g_requestVerificationToken.length > 0) {
+login(destnation, callback, redirectDes);
+}
+}, 50)
+return;
+}
+} else {
+psd = base64encode($('#password').val());
+}
+if (g_old_to_scram) {
+var scram = CryptoJS.SCRAM();
+var newSaltPassword = scram.saltedPassword($('#password').val(),CryptoJS.enc.Hex.parse(g_old_to_newSalt),g_old_to_newIter).toString();
+var newStoredKey = scram.storedKey(scram.clientKey(CryptoJS.enc.Hex.parse(newSaltPassword))).toString();
+var newServerKey = scram.serverKey(CryptoJS.enc.Hex.parse(newSaltPassword)).toString();
+var hashOldNewPwd = SHA256(psd + newStoredKey + newServerKey);
+var request = {
+Username: name,
+Password: psd,
+password_type: g_password_type,
+newStoredKey: newStoredKey,
+newServerKey: newServerKey,
+hashOldNewPwd: hashOldNewPwd
+};
+} else {
+var request = {
+Username: name,
+Password: psd,
+password_type: g_password_type
+};
+}
+var xmlstr = object2xml('request', request);
+saveAjaxData('api/user/login', xmlstr, function($xml) {
+var ret = xml2object($xml);
+if (isAjaxReturnOK(ret)) {
+getAjaxData('api/user/state-login', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (current_href === "quicksetup") {
+if (g_privacypolicy_update === '1') {
+if ($("#privacy_notice").is(':checked')) {
+button_enable('step1_next', '1');
+}
+} else {
+button_enable('step1_next', '1');
+}
+}
+g_default_password_status = parseInt(ret.response.firstlogin,10);
+$('#username_span').text(name);
+$('#username_span').show();
+$('#logout_span').text(common_logout);
+var passwordStr = $('#password').val();
+clearDialog();
+g_main_displayingPromptStack.pop();
+startLogoutTimer(redirectDes);
+if (g_restore_default_status != '1' && g_default_password_status == 0) {
+if (current_href != 'pincoderequired' && current_href != 'pukrequired' && current_href != 'simlockrequired' && current_href != 'nocard' && current_href != 'cradleDisconnected' && current_href != 'commend') {
+gotoPageWithoutHistory("modifypassword.html");
+}
+} else {
+if(checkPWRemind(passwordStr,null,null)) {
+if(g_show_password_remind != 1) {
+showPWRemindDialog(destnation, callback);
+} else {
+loginSwitchDoing(destnation, callback);
+}
+} else {
+loginSwitchDoing(destnation, callback);
+}
+}
+if (typeof(ret.response.userlevel) != 'undefined' && ret.response.userlevel == '1') {
+$("#menu_sms").hide();
+$("#show_psk_password").hide();
+$("#show_wep_password").hide();
+$('#showPswForW2,#showPswForText').hide();
+} else {
+$("#menu_sms").show();
+$("#show_psk_password").show();
+$("#show_wep_password").show();
+$('#showPswForW2,#showPswForText').show();
+if(g_restore_default_status == '1') {
+$("#menu_sms").hide();
+}
+}
+if(sessionStorage.refreshLastLoginSwitch=='true') {
+sessionStorage.refreshLastLoginSwitch='false';
+getAjaxData('api/user/history-login', function($xml) {
+var m = xml2object($xml);
+if (m.type == 'response') {
+sessionStorage.last_login_time=m.response.last_login_time;
+sessionStorage.last_login_ipaddr=m.response.last_login_ipaddr;
+sessionStorage.last_login_state=m.response.last_login_state;
+}
+});
+}
+}
+});
+} else {
+if (ret.type == 'error') {
+clearAllErrorLabel();
+if (ret.error.code == ERROR_LOGIN_PASSWORD_WRONG) {
+showErrorUnderTextbox('password', system_hint_wrong_password);
+$('#password').val('');
+$('#password').focus();
+} else if (ret.error.code == ERROR_LOGIN_ALREADY_LOGIN) {
+showErrorUnderTextbox('password', IDS_touch_user_login_repeat);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_USERNAME_WRONG) {
+showErrorUnderTextbox('username', settings_hint_user_name_not_exist);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_WRONG) {
+showErrorUnderTextbox('password', IDS_login_username_password_wrong);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+} else if (ret.error.code == ERROR_LOGIN_USERNAME_PWD_ORERRUN) {
+showErrorUnderTextbox('password', IDS_login_username_password_input_overrun);
+$('#username').focus();
+$('#username').val('');
+$('#password').val('');
+}
+}
+}
+});
+}
+}
+function trafficExceedContinueDailup(callback) {
+getAjaxData('api/monitoring/start_date', function($xml) {
+var start_date_ret = xml2object($xml);
+if (start_date_ret.type == 'response') {
+var response = start_date_ret.response;
+var startDate = response.StartDay;
+var dataLimit = response.DataLimit;
+var monthThreshold = response.MonthThreshold;
+var setMonthData = response.SetMonthData;
+var postdata = {
+StartDay:startDate,
+DataLimit:dataLimit,
+MonthThreshold:monthThreshold,
+SetMonthData:setMonthData,
+turnoffdataswitch:2
+}
+postdata = object2xml('request', postdata);
+saveAjaxData('api/monitoring/start_date', postdata, function($xml) {
+var ret = xml2object($xml);
+if (isAjaxReturnOK(ret)) {
+if(typeof(callback)=='function') {
+callback();
+}
+}
+});
+}
+});
+}
+function loginSwitchDoing(destnation, callback) {
+if (typeof(destnation) != 'undefined' &&
+destnation != null) {
+window.location.href = destnation;
+}
+if (typeof (callback) == 'function') {
+callback();
+callback = null;
+}
+if(g_is_network_connect) {
+g_is_network_connect = false;
+index_sendNetWorkAction();
+} else if(g_is_wlan_connect) {
+g_is_wlan_connect = false;
+setHandoverSetting();
+} else if(g_is_power_off) {
+g_is_power_off = false;
+setPowerOff();
+} else if(g_quicksetup_login) {
+g_quicksetup_login = false;
+hideQuicksetupButtons();
+quicksetup_initPageData();
+}
+if (g_is_disconnect_clicked) {
+index_clickDisconnectBtn();
+} else if (g_is_connect_clicked) {
+index_clickConnectBtn();
+}
+if(g_isTrunOffWlanChecked) {
+if($('.trun_on_off_waln :checked').size() > 0) {
+g_handover_setting.Handover = '2';
+} else {
+g_handover_setting.Handover = '0';
+}
+g_isTrunOffWlanChecked = false;
+setHandoverSetting();
+}
+if (current_href == 'quicksetup') {
+g_getWifiPwd = true;
+quicksetup_initPage_wifiMultiSSID();
+}
+}
+function checkPWRemind(passValue,userName,currentPwd) {
+var ret = false;
+if(checkPWStrength(passValue,userName,currentPwd) == MACRO_PASSWORD_LOW) {
+getAjaxData('api/user/remind', function($xml) {
+var res = xml2object($xml);
+g_show_password_remind = parseInt(res.response.checkpassword, 10);
+if ('response' == res.type && "0" == res.response.remindstate) {
+ret = true;
+}
+}, {
+sync: true
+});
+}
+return ret;
+}
+function setPWRemindStatus(setStatus) {
+var submitData = {
+remindstate:setStatus
+};
+var res = object2xml('request', submitData);
+saveAjaxData('api/user/remind', res, function($xml) {
+}, {
+sync: true
+});
+}
+function checkPWStrength(passValue,userName,currentPwd) {
+var nameSame = false;
+var pwdSame = false;
+if(userName != "" && (userName != null)) {
+if(userName == passValue || userName.split("").reverse().join("") == passValue) {
+nameSame = true;
+}
+}
+if(currentPwd != "" && (currentPwd != null)) {
+if(currentPwd == passValue) {
+pwdSame = true;
+}
+}
+var repeat_pass = 0;
+var tempArray = passValue.split("");
+var n = 0
+for (var i = 0; i < tempArray.length; i++) {
+var sliceArray = [];
+if (tempArray[i] != tempArray[i + 1]) {
+sliceArray = tempArray.slice(n, i + 1);
+if(sliceArray.length > 1) {
+repeat_pass += sliceArray.length;
+}
+n = i + 1;
+}
+}
+function charMode(iN) {
+if (iN>=48 && iN <=57) {
+return 1;
+} else if (iN>=65 && iN <=90) {
+return 2;
+} else if (iN>=97 && iN <=122) {
+return 4;
+} else {
+return 8;
+}
+}
+function bitTotal(num) {
+var modes=0;
+var i = 0;
+for (i=0;i<4;i++) {
+if (num & 1) {
+modes++;
+}
+num>>>=1;
+}
+return modes;
+}
+var ret = 0;
+var sPWLength = passValue.length;
+var sPWModes = 0;
+var i= 0;
+for (i= 0; i < sPWLength; i++) {
+sPWModes|=charMode(passValue.charCodeAt(i));
+}
+sPWModes = bitTotal(sPWModes);
+if(sPWLength < 6 || sPWModes == 1 || nameSame == true || pwdSame == true) {
+ret = MACRO_PASSWORD_LOW;
+} else if((sPWModes == 2 && (sPWLength >= 6) && (sPWLength <= 10))) {
+if(parseFloat((repeat_pass/parseInt(sPWLength,10)).toString()) > 0.667) {
+ret = MACRO_PASSWORD_LOW;
+} else {
+ret = MACRO_PASSWORD_MID;
+}
+} else if((sPWModes >= 3 && (sPWLength >= 6)) || (sPWModes == 2 && (sPWLength > 10))) {
+if(parseFloat((repeat_pass/parseInt(sPWLength,10)).toString()) > 0.334 && (parseFloat((repeat_pass/parseInt(sPWLength,10)).toString()) <= 0.667)) {
+ret = MACRO_PASSWORD_MID;
+} else if(parseFloat((repeat_pass/parseInt(sPWLength,10)).toString()) > 0.667) {
+ret = MACRO_PASSWORD_LOW;
+} else {
+ret = MACRO_PASSWORD_HIG;
+}
+} else {
+ret = MACRO_PASSWORD_LOW;
+}
+return ret;
+}
+function showPWRemindDialog(destnation,callback) {
+var dialogHtml = '';
+if ($('#div_wrapper').size() < 1) {
+dialogHtml += "
";
+}
+dialogHtml += "
";
+dialogHtml += "
";
+dialogHtml += " ";
+dialogHtml += "
" + IDS_psw_login_remind + "
";
+dialogHtml += "
" + IDS_psw_modify_remind + "
";
+dialogHtml += "
";
+dialogHtml += "
";
+dialogHtml += "
";
+$(".body_bg").before(dialogHtml);
+if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) == 9) {
+$(".button_wrapper").css('border-radius', '3px');
+var canvas = document.getElementById("remindDialogCanvas");
+draw(canvas);
+} else if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) < 9) {
+$(".dialog_header_left").css("margin-top","5");
+$(".dialog_header").css({
+"width":"494px",
+"height":"29px"
+});
+var ahtml="

";
+$(".dialog_header a").append(ahtml);
+} else {
+var canvas = document.getElementById("remindDialogCanvas");
+draw(canvas);
+}
+$('#psw_confirm, #psw_Cancel, #psw_close_btn').die('click');
+$('#psw_confirm').live('click', function() {
+if($('#check_pass_remind').get(0).checked) {
+setPWRemindStatus(MACRO_PASSWORD_REMIND_OFF);
+}
+clearDialog();
+loginSwitchDoing(destnation, callback);
+g_main_displayingPromptStack.pop();
+hiddenSelect(false);
+window.location.href = 'modifypassword.html';
+return false;
+});
+$('#psw_Cancel,#psw_close_btn').live('click', function() {
+if($('#check_pass_remind').length != 0 && $('#check_pass_remind').get(0).checked) {
+setPWRemindStatus(MACRO_PASSWORD_REMIND_OFF);
+}
+clearDialog();
+loginSwitchDoing(destnation, callback);
+g_main_displayingPromptStack.pop();
+hiddenSelect(false);
+return false;
+});
+hiddenSelect(true);
+reputPosition($('.dialog'), $('#div_wrapper'));
+g_main_displayingPromptStack.push('psw_confirm');
+disableTabKey();
+}
+function userOut(destnation) {
+sessionStorage.clear();
+var logOut = {
+Logout: 1
+};
+var submitData = object2xml('request', logOut);
+saveAjaxData('api/user/logout', submitData, function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (isAjaxReturnOK(ret)) {
+$("#username_span").hide();
+$("#logout_span").text(common_login);
+if (current_href == 'pincoderequired' || current_href == 'pukrequired' || current_href == 'simlockrequired' || (current_href == 'update' && g_not_need_login_update)) {
+refresh();
+} else {
+if (checkInputValue(destnation)) {
+if(destnation.indexOf(".html") > -1 ) {
+gotoPageWithoutHistory(destnation);
+} else {
+gotoPageWithoutHistory(destnation + ".html");
+}
+} else {
+if(g_restore_default_status == '1') {
+if(!redirectOnCondition(null,null)) {
+gotoPageWithoutHistory("quicksetup.html");
+}
+} else {
+gotoPageWithoutHistory(HOME_PAGE_URL);
+}
+}
+}
+}
+}
+});
+}
+function getDefaultPass() {
+getAjaxData('api/user/state-login', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+g_default_password_status = parseInt(ret.response.firstlogin,10);
+g_login_state = ret.response.State;
+if (ret.response.wifipwdsamewithwebpwd && ret.response.wifipwdsamewithwebpwd == '1') {
+g_wifiSameWithWeb = true;
+} else {
+g_wifiSameWithWeb = false;
+}
+if (ret.response.rsapadingtype && ret.response.rsapadingtype == '1') {
+g_supportOaepEnc = true;
+} else {
+g_supportOaepEnc = false;
+}
+}
+}, {
+sync: true
+});
+}
+function loginout() {
+getAjaxData('api/user/state-login', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+if (ret.response.State != 0) {
+g_default_password_status = parseInt(ret.response.firstlogin,10);
+showloginDialog();
+} else
+{
+showConfirmDialog(common_warning_logout, function() {
+userOut();
+cancelLogoutTimer();
+return false;
+}, function() {
+});
+}
+}
+}, {
+sync: true
+});
+}
+function showNotification() {
+if (G_NotificationsStatus != null) {
+var unreadSmsSize = G_NotificationsStatus.UnreadMessage;
+var smsStorageFull = G_NotificationsStatus.SmsStorageFull;
+if (g_module.sms_enabled) {
+if (smsStorageFull == '1') {
+$('#sms_full').css({
+'display' : 'block'
+});
+if($('#tooltip_sms_full').html()!=null) {
+if($('#tooltip_sms_full').html().indexOf("message.gif")<0) {
+$('#tooltip_sms_full').html("

");
+}
+}
+$('#sms_gif').css({
+'display' : 'none'
+});
+$('#tooltip_sms').html('');
+} else {
+$('#sms_full').css({
+'display' : 'none'
+});
+$('#tooltip_sms_full').html('');
+if (unreadSmsSize > 0) {
+var login_status = '';
+getAjaxData('api/user/state-login', function($xml) {
+var rets = xml2object($xml);
+if (rets.type == 'response') {
+g_login_userlevel_Info = rets.response.userlevel;
+login_status = rets.response.State;
+}
+}, {
+sync: true
+});
+if (typeof g_login_userlevel_Info != 'undefined' && g_login_userlevel_Info > 1) {
+$('#sms_gif').css({
+'display': 'block'
+});
+} else if (typeof login_status != 'undefined' && login_status != '0') {
+$('#sms_gif').css({
+'display': 'block'
+});
+} else {
+$('#sms_gif').css({
+'display': 'none'
+});
+}
+if($('#tooltip_sms').html()!=null) {
+if($('#tooltip_sms').html().indexOf("unread_message.gif")<0) {
+$('#tooltip_sms').html("

");
+}
+}
+} else {
+$('#sms_gif').css({
+'display': 'none'
+});
+$('#tooltip_sms').html('');
+}
+}
+}
+}
+}
+function getUserManualUrl() {
+if (g_needHelp) {
+var helpUrl = document.getElementById("help_url");
+var current_language = LANGUAGE_DATA.current_language;
+var usermanual_language_list = LANGUAGE_DATA.usermanual_language_list;
+var support_language = [];
+support_language = CreateArray(usermanual_language_list.support_language.language);
+var supportFlag = false;
+if(typeof(support_language)!= 'undefined' && support_language != '') {
+var i = 0;
+for(i=0 ;i < support_language.length;i++) {
+if(current_language == support_language[i].replace(/-/, '_')) {
+supportFlag = true;
+}
+}
+}
+if(supportFlag == false) {
+current_language = usermanual_language_list.default_language.replace(/-/, '_');
+}
+current_language = current_language.replace('_', '-');
+g_user_manual_url = "../" + USER_MANUAL_PATH + "/" + current_language + "/"
++ USER_MANUAL_PATH + "/" + USER_MANUAL_FILE_NAME;
+if( typeof helpUrl != "undefined" && typeof helpUrl != null) {
+helpUrl.href = g_user_manual_url;
+}
+}
+}
+function mainIsHandheldBrowser() {
+var bRet = false;
+var hardwarePlatform = navigator.platform.toLowerCase();
+var agent = navigator.userAgent.toLowerCase();
+var isIpod = hardwarePlatform.indexOf("ipod") != -1;
+var isIphone = hardwarePlatform.indexOf("iphone") != -1;
+var isIpad = hardwarePlatform.indexOf("ipad") != -1;
+g_isPad_status = isIpad;
+var isAndroid = agent.indexOf("android") !=-1;
+var isPsp = (agent.indexOf("playstation") != -1);
+if (isIphone || isIpod) {
+bRet = true;
+} else if (isPsp) {
+bRet = true;
+} else if (isIpad) {
+bRet = true;
+} else if (isAndroid) {
+bRet = true;
+} else {
+if (screen.height <= 320 || screen.width <= 320) {
+bRet = true;
+}
+}
+return bRet;
+}
+function reputPosition($dialogElement, $dialogDiv) {
+var newTop = 0, newLeft = 0, scTop = 0, scLeft = 0;
+if ($dialogElement) {
+if(g_smallPage) {
+newLeft = (getWindowWidth() - $dialogElement.width()) / 2;
+if(g_isPad_status) {
+newTop = ((getWindowHeight() - $dialogElement.height()) / 2);
+} else {
+newTop = 0;
+$(document).scrollTop(0);
+$(document).scrollLeft((getWindowWidth() - $dialogElement.width()) / 2);
+}
+} else {
+newTop = (getWindowHeight() - $dialogElement.height()) / 2;
+newLeft = (getWindowWidth() - $dialogElement.width()) / 2;
+scTop = $(document).scrollTop();
+scLeft = $(document).scrollLeft();
+newTop = scTop + newTop > 0 ? scTop + newTop : 0;
+newLeft = scLeft + newLeft;
+}
+$dialogElement.css({
+left: newLeft,
+top: newTop
+}).show();
+}
+window.onscroll = function() {
+scTop = $(document).scrollTop();
+scLeft = $(document).scrollLeft();
+};
+window.onresize = function() {
+if (!$dialogElement.is(':visible')) {
+return;
+} else {
+$dialogElement.css({
+left: newLeft,
+top: newTop
+});
+if ($dialogDiv) {
+$dialogDiv.css({
+'width' : 0,
+'height' : 0
+});
+}
+if(g_smallPage) {
+if(g_isPad_status) {
+$(document).scrollTop((getWindowHeight() - $dialogElement.height()) / 2);
+} else {
+$(document).scrollTop(0);
+}
+$(document).scrollLeft((getWindowWidth() - $dialogElement.width()) / 2);
+} else {
+$(document).scrollTop(scTop);
+$(document).scrollLeft(scLeft);
+}
+reputPosition($dialogElement.last(), $dialogDiv);
+}
+};
+if ($dialogDiv) {
+var div_width = Math.max(getWindowWidth(), getDocumentWidth());
+var div_height = Math.max(getWindowHeight(), getDocumentHeight());
+$dialogDiv.css({
+'width' : div_width,
+'height' : div_height
+});
+$dialogDiv.show();
+}
+function getWindowHeight() {
+return document.documentElement.clientHeight;
+}
+function getWindowWidth() {
+return document.documentElement.clientWidth;
+}
+function getDocumentHeight() {
+if (!$dialogElement) {
+return document.body.scrollHeight;
+} else {
+return Math.max($dialogElement.position().top + $dialogElement.height(), document.documentElement.scrollHeight);
+}
+}
+function getDocumentWidth() {
+if (!$dialogElement) {
+return document.documentElement.scrollWidth;
+} else {
+return Math.max($dialogElement.position().left + $dialogElement.width(), document.documentElement.scrollWidth);
+}
+}
+}
+function onKeyup(evt) {
+if (evt.ctrlKey || evt.altKey)
+{
+return;
+}
+if (MACRO_KEYCODE == evt.keyCode && true == flag_focus)
+{
+var targetID = '';
+var stackLen = g_main_displayingPromptStack.length;
+if (stackLen > 0) {
+targetID = g_main_displayingPromptStack[stackLen - 1];
+} else {
+if ('autoconnection' == current_href) {
+if(isButtonEnable('autocennect_apply')) {
+targetID = 'autocennect_apply';
+}
+}
+$('input').blur();
+$('select').blur();
+if ('mobilenetworksettings' == current_href) {
+if(isButtonEnable('mobilensetting_apply')) {
+targetID = 'mobilensetting_apply';
+}
+}
+if ('pincodemanagement' == current_href) {
+targetID = $('.button_wrapper').prop('id');
+}
+if ('pincoderequired' == current_href) {
+targetID = 'pinrequired_button_apply';
+}
+if ('pukrequired' == current_href) {
+targetID = 'pukrequired_apply';
+}
+if ('simlockrequired' == current_href) {
+targetID = 'simlock_button_apply';
+}
+if ('mobileconnection' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('pincodeautovalidate' == current_href) {
+if(isButtonEnable('validate_apply')) {
+targetID = 'validate_apply';
+}
+}
+if ('modifypassword' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('wps' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('dhcp' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('voicebasicsettings' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('volte' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('sipalgsettings' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('profilesmgr' == current_href) {
+if(isButtonEnable('select_apply')) {
+targetID = 'select_apply';
+}
+}
+if ('wlanbasicsettings' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('wlanadvanced' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('wlanmacfilter' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('firewallswitch' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('dmzsettings' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('upnp' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('update' == current_href) {
+if (!$('#success_ok').is(':hidden')) {
+targetID = 'success_ok';
+}
+if (!$('#pop_Cancel').is(':hidden')) {
+targetID = 'pop_Cancel';
+}
+}
+if ('sdcardsharing' == current_href) {
+if(isButtonEnable(g_sd_mode_id)) {
+targetID = g_sd_mode_id;
+}
+}
+if ('ethernetsettings' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('macclone' == current_href) {
+if(isButtonEnable('apply_button')) {
+targetID = 'apply_button';
+}
+}
+if ('ddns' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('cradleDisconnected' == current_href) {
+if(isButtonEnable('link_connetcioncradle')) {
+targetID = 'link_connetcioncradle';
+}
+}
+if ('stationwps' == current_href) {
+if(isButtonEnable('button_connection')) {
+targetID = 'button_connection';
+}
+}
+if ('ftpserver' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('serverbasic' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('sipbasic' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('staticroute' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('speeddial' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('tr069settings' == current_href) {
+if (isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('voiceprofile' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('advancecodec' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('voiceadvanced' == current_href) {
+if(isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+if ('tr069profile' == current_href) {
+if (isButtonEnable('apply')) {
+targetID = 'apply';
+}
+}
+}
+if ('' != targetID) {
+$('#' + targetID).trigger('click');
+}
+}
+}
+function enableTabKey() {
+$('a').prop('tabindex', '');
+$('input').prop('tabindex', '');
+$('select').prop('tabindex', '');
+}
+function disableTabKey() {
+$('a').prop('tabindex', '-1');
+$('input').prop('tabindex', '-1');
+$('select').prop('tabindex', '-1');
+$("#username").prop('tabindex','1');
+$("#password").prop('tabindex','2');
+if(!tabKeyflag) {
+$("#username").focusout( function() {
+disableTabKey();
+});
+$("#username").focusin( function() {
+enableTabKey();
+});
+tabKeyflag = true;
+}
+}
+function startLogoutTimer(destnation) {
+if (g_needToLogin) {
+clearTimeout(g_logoutTimer);
+gettimeout();
+g_logoutTimer = setTimeout( function () {
+userOut(destnation);
+}, loginTime);
+}
+}
+function cancelLogoutTimer() {
+if (g_needToLogin) {
+clearTimeout(g_logoutTimer);
+}
+}
+function regURL ( str ) {
+var reg = "(((https|http|ftp|rtsp|mms)://)|(www\\.)){1}[\41-\176]*";
+var matchURL=new RegExp(reg,"ig");
+str = XSSResolveCannotParseChar(str);
+return str.replace(matchURL, function($1) {
+$1_href = $1.indexOf("//")==-1?"http://"+$1:$1;
+if($1_href.charAt($1_href.length-1)=="="&&$1_href.charAt($1_href.length-2)!="=") {
+$1_href=$1_href.substring(0,$1_href.length-1);
+}
+return "
"+$1+"";
+});
+}
+function stopBubble( e ) {
+if ( e && e.stopPropagation ) {
+e.stopPropagation();
+} else {
+window.event.cancelBubble=true;
+}
+}
+function setWifiSignal(WifiSignal) {
+var signalIntension = null;
+switch (WifiSignal) {
+case MACRO_EVDO_LEVEL_ONE:
+signalIntension = MACRO_EVDO_LEVEL_ONE;
+break;
+case MACRO_EVDO_LEVEL_TWO:
+signalIntension = MACRO_EVDO_LEVEL_TWO;
+break;
+case MACRO_EVDO_LEVEL_THREE:
+signalIntension = MACRO_EVDO_LEVEL_THREE;
+break;
+case MACRO_EVDO_LEVEL_FOUR:
+case MACRO_EVDO_LEVEL_FIVE:
+signalIntension = MACRO_EVDO_LEVEL_FOUR;
+break;
+default:
+signalIntension = MACRO_EVDO_LEVEL_ZERO;
+break;
+}
+STATUS_BAR_ICON_STATUS.station_tooltip_state = wlan_lable_wifi;
+return signalIntension;
+}
+function replaceSpace(str) {
+var ss="";
+var i = 0;
+for (i=0; i < str.length; i++) {
+if(' '==str.charAt(i)) {
+str = str.replace(' ',' ');
+}
+}
+return str;
+}
+function replaceSpaceOther(str) {
+var ss="";
+var i = 0;
+for (i=0; i < str.length; i++) {
+if(' '==str.charAt(i)) {
+str = str.replace(' ',' ');
+}
+}
+while (str.indexOf('<') >= 0) {
+str = str.replace('<', '<');
+}
+while (str.indexOf('>') >= 0) {
+str = str.replace('>', '>');
+}
+return str;
+}
+function getSimPukTimes() {
+getAjaxData('api/pin/status', function($xml) {
+var pinstatus_ret = xml2object($xml);
+if (pinstatus_ret.type == 'response') {
+g_pin_status_SimPukTimes = pinstatus_ret.response.SimPukTimes;
+}
+});
+}
+function display_SIMtoUIM(str) {
+if (MACRO_NET_DUAL_MODE == g_net_mode_type) {
+if (str.indexOf('SIMLOCK')>-1) {
+return str;
+} else {
+str = str.replace(/SIM/g, "UIM");
+return str;
+}
+} else {
+return str;
+}
+}
+function hiddenSelect(flag) {
+if (/msie/.test(navigator.userAgent.toLowerCase()) && navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1] == '6.0') {
+if (flag) {
+$("select").css("display","none");
+} else {
+$("select").css("display","inline");
+$("#select_WifiCountry_for_Idevice").css("display","none");
+}
+}
+}
+function check_ethernet_display() {
+if(g_module.cradle_enabled) {
+$('#label_ethernet').text(IDS_ethernet_label_Internet_ethernet);
+if(checkLeftMenu(g_PageUrlTree.settings.ethernet.ethernetsettings)) {
+$('#label_wan_setting').text(IDS_ethernet_label_setting);
+} else {
+$('#ethernetsettings').remove();
+}
+if(checkLeftMenu(g_PageUrlTree.settings.ethernet.ethernetstatus)) {
+$('#label_wan_status').text(IDS_ethernet_label_ethernet_status);
+} else {
+$('#ethernetstatus').remove();
+}
+if(checkLeftMenu(g_PageUrlTree.settings.ethernet.macclone)) {
+$('#label_mac_clone').text(IDS_ethernet_label_mac_clone);
+} else {
+$('#macclone').remove();
+}
+} else {
+$('#ethernet').remove();
+}
+}
+function getMonitoringStatus() {
+if(g_net_mode_status == null) {
+getAjaxData('api/monitoring/status', function($xml) {
+var ret = xml2object($xml);
+if (ret.type == 'response') {
+G_MonitoringStatus = ret;
+getMainNetMode();
+}
+}, {
+sync: true
+});
+}
+}
+function CreateArray(obj) {
+var tempArray = [];
+if($.isArray(obj)) {
+return obj;
+} else {
+if(typeof(obj) != 'undefined') {
+tempArray.push(obj);
+}
+return tempArray;
+}
+}
+function checkInputChar(str) {
+var i;
+var char_i;
+var num_char_i;
+if (str == "") {
+return true;
+}
+for (i = 0; i < str.length; i++) {
+char_i = str.charAt(i);
+num_char_i = char_i.charCodeAt();
+if ((num_char_i > MACRO_SUPPORT_CHAR_MAX) || (num_char_i < MACRO_SUPPORT_CHAR_MIN)) {
+return false;
+} else if ((MACRO_NOT_SUPPORT_CHAR_COMMA == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_QUOTATION_MARK == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_COLON == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_SEMICOLON == num_char_i) ||
+(MACRO_NOT_SUPPORT_BACKSLASH_MARK == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_38 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_37 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_43 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_39 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_60 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_62 == num_char_i) ||
+(MACRO_NOT_SUPPORT_CHAR_63 == num_char_i)) {
+return false;
+} else {
+continue;
+}
+}
+return true;
+}
+function showDialog(common_title,content,button1_text,button1_Id,button2_text,button2_Id) {
+$('#div_wrapper').remove();
+$('.login_dialog').remove();
+var dialogHtml = '';
+if($('#div_wrapper').size() < 1) {
+dialogHtml += "
";
+}
+dialogHtml += "
";
+dialogHtml += "
';
+dialogHtml += '
';
+$('.body_bg').before(dialogHtml);
+if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) == 9 ) {
+$(".button_wrapper").css('border-radius', '3px');
+var canvas = document.getElementById("showCanvas");
+draw(canvas);
+} else if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) < 9) {
+$(".dialog_header_left").css("margin-top","5");
+$(".login_dialog_content").css({
+"width":"420px",
+"height":"29px"
+});
+var ahtml="

";
+$(".login_dialog_header a").append(ahtml);
+} else {
+var canvas = document.getElementById("showCanvas");
+draw(canvas);
+}
+reputPosition($('#dialog'), $('#div_wrapper'));
+g_main_displayingPromptStack.push(button1_Id);
+disableTabKey();
+}
+function showGDPRdialog(callback, destnation) {
+$('#div_wrapper').remove();
+$('.dialog').remove();
+var dialogHtml = '';
+if ($('#div_wrapper').size() < 1) {
+dialogHtml += "
";
+}
+dialogHtml += "
";
+dialogHtml += "
";
+dialogHtml += " ';
+var link = '
' + IDS_common_privacy_policy + '';
+dialogHtml += '
';
+dialogHtml += "
";
+dialogHtml += "
";
+dialogHtml += " ";
+dialogHtml += " ";
+dialogHtml += '
';
+dialogHtml += '
';
+dialogHtml += '
';
+dialogHtml += '
';
+$('#privacy_notice').live('click', function() {
+if ($(this).is(':checked')) {
+button_enable('pop_confirm_cust','1');
+} else {
+button_enable('pop_confirm_cust','0');
+}
+});
+$('#pop_confirm_cust').live('click', function() {
+if (!isButtonEnable('pop_confirm_cust')) {
+return;
+}
+var request_privacy = {
+approve: 2
+}
+var xmlstr_privacy = object2xml('request', request_privacy);
+saveAjaxData('api/app/privacynotice', xmlstr_privacy, function($xml) {
+var ret = xml2object($xml);
+if (isAjaxReturnOK(ret)) {
+clearDialog();
+if(typeof(callback) === "function") {
+callback();
+}
+if(destnation) {
+gotoPageWithoutHistory(destnation);
+}
+} else {
+refresh();
+}
+}, {
+sync: true
+});
+g_main_displayingPromptStack.pop();
+hiddenSelect(false);
+if(location.href.indexOf('reboot')>-1) {
+sessionStorage.clear();
+}
+return false;
+});
+$('.body_bg').before(dialogHtml);
+if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) == 9 ) {
+$(".button_wrapper").css('border-radius', '3px');
+} else if(/msie/.test(navigator.userAgent.toLowerCase()) && parseInt(navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/)[1]) < 9) {
+$(".dialog_header_left").css("margin-top","5");
+$(".dialog_header").css({
+"width":"494px",
+"height":"29px"
+});
+} else {
+}
+hiddenSelect(true);
+reputPosition($('.dialog'), $('#div_wrapper'));
+g_main_displayingPromptStack.push('pop_confirm_cust');
+disableTabKey();
+}
+function openPortToCss(tableID) {
+if((/firefox/.test(navigator.userAgent.toLowerCase())) || (/opera/.test(navigator.userAgent.toLowerCase()))) {
+$('#'+tableID).css
+({
+'table-layout':'fixed',
+'word-break':'break-all',
+'word-wrap':'break-word'
+});
+}
+}
+function spaceToNbsp(str) {
+var i = 0;
+for (i=0; i < str.length; i++) {
+if(' '==str.charAt(i)) {
+str = str.replace(' ',' ');
+}
+}
+return str;
+}
+function nbspToSpace(str) {
+return str.replace(/(\ )/g, function($0, $1) {
+return {
+' ' : ' '
+}[$1];
+}
+);
+}
+function profileNameValid(str) {
+var temp_status = true;
+var i = 0;
+for(i=0;i< str.length;i++) {
+if('"' == str.charAt(i) || '&' == str.charAt(i) || "'" == str.charAt(i) || '<' == str.charAt(i) || '>' == str.charAt(i)) {
+temp_status = false;
+}
+}
+return temp_status;
+}
+function coulometerCheck(str) {
+var temp ;
+if(g_coulometer_status == '1') {
+temp = str.replace(/50/g, "20");
+} else {
+temp = str;
+}
+return temp;
+}
+function copyrightReplace(str) {
+var temp = str.replace(/%s/g, g_copyright_year);
+return temp;
+}
+function SHA256(s) {
+var chrsz = 8;
+var hexcase = 0;
+function safe_add (x, y) {
+var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+return (msw << 16) | (lsw & 0xFFFF);
+}
+function S (X, n) {
+return ( X >>> n ) | (X << (32 - n));
+}
+function R (X, n) {
+return ( X >>> n );
+}
+function Ch(x, y, z) {
+return ((x & y) ^ ((~x) & z));
+}
+function Maj(x, y, z) {
+return ((x & y) ^ (x & z) ^ (y & z));
+}
+function Sigma0256(x) {
+return (S(x, 2) ^ S(x, 13) ^ S(x, 22));
+}
+function Sigma1256(x) {
+return (S(x, 6) ^ S(x, 11) ^ S(x, 25));
+}
+function Gamma0256(x) {
+return (S(x, 7) ^ S(x, 18) ^ R(x, 3));
+}
+function Gamma1256(x) {
+return (S(x, 17) ^ S(x, 19) ^ R(x, 10));
+}
+function core_sha256 (m, l) {
+var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2);
+var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
+var W = new Array(64);
+var a, b, c, d, e, f, g, h, i, j;
+var T1, T2;
+m[l >> 5] |= 0x80 << (24 - l % 32);
+m[((l + 64 >> 9) << 4) + 15] = l;
+for ( var i = 0; i
>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
+}
+return bin;
+}
+function Utf8Encode(string) {
+string = string.replace(/\r\n/g,"\n");
+var utftext = "";
+for (var n = 0; n < string.length; n++) {
+var c = string.charCodeAt(n);
+if (c < 128) {
+utftext += String.fromCharCode(c);
+} else if((c > 127) && (c < 2048)) {
+utftext += String.fromCharCode((c >> 6) | 192);
+utftext += String.fromCharCode((c & 63) | 128);
+} else {
+utftext += String.fromCharCode((c >> 12) | 224);
+utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+utftext += String.fromCharCode((c & 63) | 128);
+}
+}
+return utftext;
+}
+function binb2hex (binarray) {
+var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+var str = "";
+for(var i = 0; i < binarray.length * 4; i++) {
+str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
+hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
+}
+return str;
+}
+s = Utf8Encode(s);
+return binb2hex(core_sha256(str2binb(s), s.length * chrsz));
+}
+$.fn.die = function(event) {
+$(document).off(event,this.selector);
+}
+$.fn.live = function(event,func) {
+$(document).on(event,this.selector,func);
+}
+$.fn.val = function (data) {
+if (typeof(data) != 'undefined' || data === '') {
+var objArr = $.makeArray(this);
+if (objArr) {
+$.each(objArr, function(i) {
+if(objArr[i]) {
+objArr[i].value = data;
+}
+});
+}
+return this;
+} else {
+if (this.prop('value')) {
+return this.prop('value');
+}
+if (this.get(0)) {
+return this.get(0).value;
+}
+}
+};
diff --git a/refereapi.md b/router/refereapi.md
similarity index 100%
rename from refereapi.md
rename to router/refereapi.md