1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<html xmlns:v>
4<head>
5<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
6<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
8<meta HTTP-EQUIV="Expires" CONTENT="-1">
9<link rel="shortcut icon" href="images/favicon.png">
10<link rel="icon" href="images/favicon.png">
11<link href="/images/map-iconRouter_iphone.png" rel="apple-touch-icon" />
12<title><#Web_Title#> - <#menu1#></title>
13<link rel="stylesheet" type="text/css" href="index_style.css">
14<link rel="stylesheet" type="text/css" href="form_style.css">
15<link rel="stylesheet" type="text/css" href="NM_style.css">
16<link rel="stylesheet" type="text/css" href="other.css">
17<link rel="stylesheet" type="text/css" href="/device-map/device-map.css">
18<style type="text/css">
19.contentM_qis{
20	position:absolute;
21	-webkit-border-radius: 5px;
22	-moz-border-radius: 5px;
23	border-radius: 5px;
24	z-index:200;
25	background-color:#2B373B;
26	display:block;
27	margin-left: 23%;
28	top: 15%;
29	width:495px;
30	height:auto;
31	box-shadow: 3px 3px 10px #000;
32	display: none;
33	padding: 10px;
34}
35.contentM_usericon{
36	position:absolute;
37	-webkit-border-radius: 5px;
38	-moz-border-radius: 5px;
39	border-radius: 5px;
40	z-index:20000;
41	background-color:#2B373B;
42	display:block;
43	margin-left: 23%;
44	margin-top: 20px;
45	width:650px;
46	height:250px;
47	box-shadow: 3px 3px 10px #000;
48	display: none;
49}
50.contentM_qis_manual{
51	position:absolute;
52	-webkit-border-radius: 5px;
53	-moz-border-radius: 5px;
54	border-radius: 5px;
55	z-index:200;
56	background-color:#2B373B;
57	margin-left: -30px;
58	margin-left: -100px \9; 
59	margin-top:-400px;
60	width:740px;
61	box-shadow: 3px 3px 10px #000;
62}
63#custom_image table{
64	border: 1px solid #1A1C1D;
65	border-collapse: collapse;
66}
67#custom_image div{
68	background-image:url('/images/New_ui/networkmap/client-list.svg');
69	background-repeat:no-repeat;
70	height:60px;
71	width:60px;
72	cursor:pointer;
73	background-position:0% 0.5%;
74	background-size: 900%;
75	background-color: #788D94;
76	border-radius: 10px;
77}
78#custom_image div:hover{
79	background-color: #FFFFFF;
80}
81.imgClientIcon{
82	position: relative; 
83	width: 52px;
84	height: 52px;
85	-webkit-border-radius: 10px;
86	-moz-border-radius: 10px;
87	border-radius: 10px;
88}
89</style>
90<script type="text/javascript" src="/md5.js"></script>
91<script type="text/javascript" src="/state.js"></script>
92<script type="text/javascript" src="/general.js"></script>
93<script type="text/javascript" src="/popup.js"></script>
94<script type="text/javascript" src="/disk_functions.js"></script>
95<script type="text/javascript" src="/help.js"></script>
96<script type="text/javascript" src="/validator.js"></script>
97<script language="JavaScript" type="text/javascript" src="/client_function.js"></script>
98<script language="JavaScript" type="text/javascript" src="/js/jquery.js"></script>
99<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
100<script language="JavaScript" type="text/javascript" src="/form.js"></script>
101<script>
102	
103var userIconBase64 = "NoIcon";
104var verderIcon = "";
105var userIconHideFlag = false;
106var custom_usericon_del = "";
107var firstTimeOpenBlock = false;
108var ipBindingFlag = false;
109var timeSchedulingFlag = false;
110
111if(location.pathname == "/"){
112	if('<% nvram_get("x_Setting"); %>' == '0'){
113		if(tmo_support){
114			location.href = '/MobileQIS_Login.asp';
115		}
116		else{
117			location.href = '/QIS_wizard.htm?flag=welcome';
118		}
119	}	
120	else if('<% nvram_get("w_Setting"); %>' == '0' && sw_mode != 2)
121		location.href = '/QIS_wizard.htm?flag=wireless';
122}
123
124// Live Update
125var webs_state_update= '<% nvram_get("webs_state_update"); %>';
126var webs_state_error= '<% nvram_get("webs_state_error"); %>';
127var webs_state_info= '<% nvram_get("webs_state_info"); %>';
128
129
130// WAN
131<% wanlink(); %>
132<% first_wanlink(); %>
133<% secondary_wanlink(); %>
134var wanstate = -1;
135var wansbstate = -1;
136var wanauxstate = -1;
137var Dev3G = '<% nvram_get("d3g"); %>';
138var flag = '<% get_parameter("flag"); %>';
139var wan0_primary = '<% nvram_get("wan0_primary"); %>';
140var wan1_primary = '<% nvram_get("wan1_primary"); %>';
141var wans_dualwan_orig = '<% nvram_get("wans_dualwan"); %>';
142var wans_mode = '<%nvram_get("wans_mode");%>';
143var dhcp_staticlist_orig = decodeURIComponent('<% nvram_char_to_ascii("", "dhcp_staticlist"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
144var dhcp_staticlist_num = dhcp_staticlist_orig.split("<").length - 1;
145var MULTIFILTER_ENABLE_orig = decodeURIComponent('<% nvram_char_to_ascii("", "MULTIFILTER_ENABLE"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
146var MULTIFILTER_MAC_orig = decodeURIComponent('<% nvram_char_to_ascii("", "MULTIFILTER_MAC"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
147var MULTIFILTER_DEVICENAME_orig = decodeURIComponent('<% nvram_char_to_ascii("", "MULTIFILTER_DEVICENAME"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
148var MULTIFILTER_MACFILTER_DAYTIME_orig = decodeURIComponent('<% nvram_char_to_ascii("", "MULTIFILTER_MACFILTER_DAYTIME"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
149var MULTIFILTER_num = (MULTIFILTER_MAC_orig == "") ? 0 : MULTIFILTER_ENABLE_orig.split(">").length;
150var wanlink_status = wanlink_statusstr();
151var wanlink_ipaddr = wanlink_ipaddr();
152var first_wanlink_status = first_wanlink_statusstr();
153var first_wanlink_ipaddr = first_wanlink_ipaddr();
154var secondary_wanlink_status = secondary_wanlink_statusstr();
155var secondary_wanlink_ipaddr = secondary_wanlink_ipaddr();
156
157if(gobi_support) {
158	var dualwan_first_if = wans_dualwan_array[0];
159	var dualwan_second_if = wans_dualwan_array[1];
160}
161if(wans_dualwan_orig.search(" ") == -1)
162	var wans_flag = 0;
163else
164	var wans_flag = (wans_dualwan_orig.search("none") == -1) ? 1:0;
165
166// USB function
167var currentUsbPort = new Number();
168var usbPorts = new Array();
169
170// Wireless
171window.onresize = function() {
172	if(document.getElementById("edit_client_block").style.display == "block") {
173		cal_panel_block("edit_client_block", 0.23);
174	}
175	if(document.getElementById("edit_usericon_block").style.display == "block") {
176		cal_panel_block("edit_usericon_block", 0.15);
177	}
178} 
179
180function initial(){   
181	show_menu();
182	var isIE6 = navigator.userAgent.search("MSIE 6") > -1;
183	if(isIE6)
184		alert("<#ALERT_TO_CHANGE_BROWSER#>");
185	
186	if(dualWAN_support && sw_mode == 1){
187		check_dualwan(wans_flag);
188	}
189	
190	if(sw_mode == 4){
191		var wlc_auth_mode = '<% nvram_get("wlc_auth_mode"); %>';
192		if(wlc_auth_mode == "") wlc_auth_mode = '<% nvram_get("wlc0_auth_mode"); %>';
193		if(wlc_auth_mode == "") wlc_auth_mode = '<% nvram_get("wlc1_auth_mode"); %>';
194		if(wlc_auth_mode == "") wlc_auth_mode = 'unknown';
195
196		show_middle_status(wlc_auth_mode, 0);
197	}
198	else
199		show_middle_status(document.form.wl_auth_mode_x.value, parseInt(document.form.wl_wep_x.value));
200
201	set_default_choice();
202
203	var get_client_detail_info = '<% get_client_detail_info(); %>'.replace(/&#62/g, ">").replace(/&#60/g, "<");
204	show_client_status(get_client_detail_info.split('<').length - 1);
205	document.networkmapdRefresh.client_info_tmp.value = get_client_detail_info.replace(/\s/g, "");
206
207	if(!parent.usb_support || usbPortMax == 0){
208		document.getElementById("line3_td").height = '40px';
209		document.getElementById("line3_img").src = '/images/New_ui/networkmap/line_dualwan.png';
210		document.getElementById("clients_td").colSpan = "3";
211		document.getElementById("clients_td").width = '350';
212		document.getElementById("clientspace_td").style.display = "none";
213		document.getElementById("usb_td").style.display = "none";
214	}
215
216	for(var i=0; i<usbPortMax; i++){
217		var tmpDisk = new newDisk();
218		tmpDisk.usbPath = i+1;
219		show_USBDevice(tmpDisk);
220		document.getElementById("usbPathContainer_"+parseInt(i+1)).style.display = "";
221	}
222	
223	if(document.getElementById('usbPathContainer_2').style.display == "none")
224		document.getElementById('space_block').style.display = "";
225	
226	check_usb3();
227
228 	require(['/require/modules/diskList.js'], function(diskList){
229 		var usbDevicesList = diskList.list();
230		for(var i=0; i<usbDevicesList.length; i++){
231		  var new_option = new Option(usbDevicesList[i].deviceName, usbDevicesList[i].deviceIndex);
232			document.getElementById('deviceOption_'+usbDevicesList[i].usbPath).options.add(new_option);
233			document.getElementById('deviceOption_'+usbDevicesList[i].usbPath).style.display = "";
234
235			if(typeof usbPorts[usbDevicesList[i].usbPath-1].deviceType == "undefined" || usbPorts[usbDevicesList[i].usbPath-1].deviceType == "")
236				show_USBDevice(usbDevicesList[i]);
237		}
238
239		for(var usbIndex = 1; usbIndex <= usbPortMax; usbIndex += 1) {
240			var usb_mount_count = document.getElementById("deviceOption_" + usbIndex).length;
241			if( usb_mount_count >= 2) {
242				var divUsbMountCount = document.createElement("div");
243				divUsbMountCount.className = "usb_count_circle";
244				divUsbMountCount.innerHTML = usb_mount_count;
245				document.getElementById("deviceText_" + usbIndex).appendChild(divUsbMountCount);
246
247				$(".usb_count_circle").mouseover(function(){
248					return overlib(this.innerHTML + " usb devices are plugged in <% nvram_get("productid"); %> through this port.");
249				});
250
251				$(".usb_count_circle").mouseout(function(){
252					nd();
253				});
254			}
255		}
256	});
257
258	showMapWANStatus(sw_mode);
259
260	if(sw_mode != "1"){
261		document.getElementById("wanIP_div").style.display = "none";
262		document.getElementById("ddnsHostName_div").style.display = "none";
263		document.getElementById("NM_connect_title").style.fontSize = "14px";
264		document.getElementById("NM_connect_status").style.fontSize = "20px";
265		if(sw_mode == 2 || sw_mode == 4){
266			document.getElementById('wlc_band_div').style.display = "";
267			document.getElementById('dataRate_div').style.display = "";
268			if(wlc_band == 0)
269				document.getElementById('wlc_band_status').innerHTML = "2.4GHz"; 
270			else	
271				document.getElementById('wlc_band_status').innerHTML = "5GHz";
272		}
273		document.getElementById('NM_connect_title').innerHTML = "<#parent_AP_status#> :";
274	}
275	else{
276		document.getElementById("index_status").innerHTML = '<span style="word-break:break-all;">' + wanlink_ipaddr + '</span>'
277		setTimeout("show_ddns_status();", 1);
278		
279		if(wanlink_ipaddr == '0.0.0.0' || wanlink_ipaddr == '')
280			document.getElementById("wanIP_div").style.display = "none";
281	}
282
283	var NM_table_img = cookie.get("NM_table_img");
284	if(NM_table_img != "" && NM_table_img != null){
285		customize_NM_table(NM_table_img);
286		document.getElementById("bgimg").options[NM_table_img[4]].selected = 1;
287	}
288	update_wan_status();
289
290	if(smart_connect_support){
291		if(localAP_support && sw_mode != 2){
292			if((based_modelid == "RT-AC5300" || based_modelid == "RT-AC5300R") && '<% nvram_get("smart_connect_x"); %>' !=0)
293			show_smart_connect_status();
294		}
295	}
296
297
298	document.list_form.dhcp_staticlist.value = dhcp_staticlist_orig;
299	document.list_form.MULTIFILTER_ENABLE.value = MULTIFILTER_ENABLE_orig;
300	document.list_form.MULTIFILTER_MAC.value = MULTIFILTER_MAC_orig;
301	document.list_form.MULTIFILTER_DEVICENAME.value = MULTIFILTER_DEVICENAME_orig;
302	document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value = MULTIFILTER_MACFILTER_DAYTIME_orig;
303	updateClientsCount();
304
305	if(isSwMode("mb")){
306		document.getElementById("wlSecurityContext").style.display = "none";
307		document.getElementById("mbModeContext").style.display = "";
308	}
309	if(wans_flag && gobi_support){
310		var eLAN_str = "<#Ethernet_wan#>:".replace(/WAN/, "LAN");
311		if(dualwan_first_if == 'wan')
312			document.getElementById("first_wan_title").innerHTML = "<#Ethernet_wan#>:";
313		else if(dualwan_first_if == 'lan')
314			document.getElementById("first_wan_title").innerHTML = eLAN_str;
315		else if(dualwan_first_if == 'usb'){
316			document.getElementById("iconInternet_primary").style.background = "url('images/New_ui/networkmap/Mobile-Broadband.png') no-repeat 0% 0%";
317			if(gobi_support)
318				document.getElementById("first_wan_title").innerHTML = "<#Mobile_title#>:";
319			else
320				document.getElementById("first_wan_title").innerHTML = "<#menu5_4_4#>:";
321		}
322
323		if(dualwan_second_if == 'wan')
324			document.getElementById("second_wan_title").innerHTML = "<#Ethernet_wan#>:";
325		else if(dualwan_second_if == 'lan')
326			document.getElementById("second_wan_title").innerHTML = eLAN_str;		
327		else if(dualwan_second_if == 'usb'){
328			document.getElementById("iconInternet_secondary").style.background = "url('images/New_ui/networkmap/Mobile-Broadband.png') no-repeat 0% 0%";
329			if(gobi_support)
330				document.getElementById("second_wan_title").innerHTML = "<#Mobile_title#>:";
331			else
332				document.getElementById("second_wan_title").innerHTML = "<#menu5_4_4#>:";
333		}
334	}
335}
336
337function show_smart_connect_status(){
338	document.getElementById("SmartConnectName").style.display = "";
339	document.getElementById("SmartConnectStatus").style.display = "";
340	var smart_connect_x = '<% nvram_get("smart_connect_x"); %>';
341
342        if(smart_connect_x == '0')
343                document.getElementById("SmartConnectStatus").innerHTML = '<a style="color:#FFF;text-decoration:underline;" href="/Advanced_Wireless_Content.asp">Off</a>';
344        else if(smart_connect_x == '1')
345                document.getElementById("SmartConnectStatus").innerHTML = '<a style="color:#FFF;text-decoration:underline;" href="/Advanced_Wireless_Content.asp">On</a>';
346
347	setTimeout("show_smart_connect_status();", 2000);
348}
349
350function show_ddns_status(){
351	var ddns_enable = '<% nvram_get("ddns_enable_x"); %>';
352	var ddns_server_x = '<% nvram_get("ddns_server_x");%>';
353	var ddnsName = decodeURIComponent('<% nvram_char_to_ascii("", "ddns_hostname_x"); %>');
354
355	document.getElementById("ddns_fail_hint").className = "notificationoff";
356	if( ddns_enable == '0')
357        document.getElementById("ddnsHostName").innerHTML = '<a style="color:#FFF;text-decoration:underline;" href="/Advanced_ASUSDDNS_Content.asp?af=ddns_enable_x"><#btn_go#></a>';
358    else if(ddnsName == '')
359        document.getElementById("ddnsHostName").innerHTML = '<a style="color:#FFF;text-decoration:underline;" href="/Advanced_ASUSDDNS_Content.asp?af=DDNSName">Sign up</a>';
360    else if(ddnsName == isMD5DDNSName())
361        document.getElementById("ddnsHostName").innerHTML = '<a style="color:#FFF;text-decoration:underline;" href="/Advanced_ASUSDDNS_Content.asp?af=DDNSName">Sign up</a>';
362    else{
363        document.getElementById("ddnsHostName").innerHTML = '<span>'+ ddnsName +'</span>';
364        if(ddns_enable == '1'){
365			if((link_status != undefined || link_auxstatus != undefined) && !((link_status == "2" && link_auxstatus == "0") || (link_status == "2" && link_auxstatus == "2")) ) //link down
366				document.getElementById("ddns_fail_hint").className = "notificationon";
367					
368			if( ddns_server_x == 'WWW.ASUS.COM' ) { //ASUS DDNS
369				if( (ddns_return_code.indexOf('200')==-1) && (ddns_return_code.indexOf('220')==-1) && (ddns_return_code.indexOf('230')==-1))
370					document.getElementById("ddns_fail_hint").className = "notificationon";
371			}
372			else{ //Other ddns service
373				if(ddns_updated != '1' || ddns_return_code=='unknown_error' || ddns_return_code=="auth_fail")
374					document.getElementById("ddns_fail_hint").className = "notificationon";
375			}
376        }
377	}
378	
379	setTimeout("show_ddns_status();", 2000);
380}
381
382var isMD5DDNSName = function(){
383	var macAddr = '<% nvram_get("lan_hwaddr"); %>'.toUpperCase().replace(/:/g, "");
384	return "A"+hexMD5(macAddr).toUpperCase()+".asuscomm.com";
385}
386
387function customize_NM_table(img){
388	$("#NM_table").css({
389		"background": "url('/images/" + img +"')",
390		"background-repeat": "no-repeat",
391		"background-size": "cover"
392	});
393
394	cookie.set("NM_table_img", img, 365);
395}
396
397function set_default_choice(){
398	var icon_name;
399	if(flag && flag.length > 0){
400		if(flag == "Internet"){
401			document.getElementById("iconRouter").style.backgroundPosition = '0% 0%';
402			clickEvent(document.getElementById("iconInternet"));
403		}
404		else if(flag == "Client"){
405			document.getElementById("iconRouter").style.backgroundPosition = '0% 0%';
406			clickEvent(document.getElementById("iconClient"));
407		}
408		else if(flag == "USBdisk"){
409			document.getElementById("iconRouter").style.backgroundPosition = '0% 0%';
410			clickEvent(document.getElementById("iconUSBdisk"));
411		}
412		else{
413			clickEvent(document.getElementById("iconRouter"));
414			return;
415		}
416
417		if(flag == "Router2g")
418			icon_name = "iconRouter";
419		else
420			icon_name = "icon"+flag;
421
422		clickEvent(document.getElementById(icon_name));
423	}
424	else
425		clickEvent(document.getElementById("iconRouter"));
426}
427
428function showMapWANStatus(flag){
429	if(sw_mode == "3"){
430		showtext(document.getElementById("NM_connect_status"), "<div style='margin-top:10px;'><#WLANConfig11b_x_APMode_itemname#></div>");
431	}
432	else if(sw_mode == "2"){
433		showtext(document.getElementById("NM_connect_title"), "<div style='margin-top:10px;'><#statusTitle_AP#>:</div><br>");
434	}
435	else
436		return 0;
437}
438
439function show_middle_status(auth_mode, wl_wep_x){
440	var security_mode;
441	switch (auth_mode){
442		case "open":
443				security_mode = "Open System";
444				break;
445		case "shared":
446				security_mode = "Shared Key";
447				break;
448		case "psk":
449				security_mode = "WPA-Personal";
450				break;
451		case "psk2":
452				security_mode = "WPA2-Personal";
453				break;
454		case "pskpsk2":
455				security_mode = "WPA-Auto-Personal";
456				document.getElementById("wl_securitylevel_span").style.fontSize = "16px";
457				break;
458		case "wpa":
459				security_mode = "WPA-Enterprise";
460				break;
461		case "wpa2":
462				security_mode = "WPA2-Enterprise";
463				break;
464		case "wpawpa2":
465				security_mode = "WPA-Auto-Enterprise";
466				document.getElementById("wl_securitylevel_span").style.fontSize = "16px";
467				break;
468		case "radius":
469				security_mode = "Radius with 802.1x";
470				document.getElementById("wl_securitylevel_span").style.fontSize = "16px";
471				break;
472		case "unknown":
473				security_mode = "<#CTL_Disconnect#>";
474				break;
475				
476		default:
477				security_mode = "Unknown Auth";	
478	}
479	
480	document.getElementById("wl_securitylevel_span").innerHTML = security_mode;
481
482	if(auth_mode == "open" && wl_wep_x == 0)
483		document.getElementById("iflock").src = "images/New_ui/networkmap/unlock.png";
484	else
485		document.getElementById("iflock").src = "images/New_ui/networkmap/lock.png"
486}
487
488function show_client_status(num){
489	document.getElementById("clientNumber").innerHTML = "<#Full_Clients#>: <span id='_clientNumber'>" + num + "</span>";
490}
491
492function show_USBDevice(device){
493	if(!usb_support || typeof device != "object")
494		return false;
495
496	switch(device.deviceType){
497		case "storage":
498			disk_html(device);
499			break;
500
501		case "printer":
502			printer_html(device);
503			break;
504
505		case "audio":
506
507		case "webcam":
508
509		case "modem":
510			modem_html(device);
511			break;
512
513		default:
514			no_device_html(device.usbPath);
515	}
516
517	currentUsbPort = device.usbPath-1;
518	usbPorts[currentUsbPort] = device;
519}
520
521function disk_html(device){
522	var icon_html_code = '';
523	icon_html_code += '<a target="statusframe">\n';
524	icon_html_code += '<div id="iconUSBdisk_'+device.usbPath+'" class="iconUSBdisk" onclick="setSelectedDiskOrder(this.id);clickEvent(this);"></div>\n';
525	icon_html_code += '<div id="ring_USBdisk_'+device.usbPath+'" class="iconUSBdisk" style="display:none;z-index:1;"></div>\n';
526	icon_html_code += '</a>\n';
527	document.getElementById("deviceIcon_" + device.usbPath).innerHTML = icon_html_code;
528
529	showDiskInfo(device);
530
531	// show ring
532	check_status(device);
533	// check_status2(usb_path1_pool_error, device.usbPath);
534}
535
536function showDiskInfo(device){
537	var dec_html_code = '';
538	var percentbar = 0;
539
540	if(device.mountNumber > 0){
541		percentbar = simpleNum2((device.totalSize - device.totalUsed)/device.totalSize*100);
542		percentbar = Math.round(100 - percentbar);		
543
544		//dec_html_code += '<p id="diskDesc'+ device.usbPath +'" style="margin-top:5px;"><#Availablespace#>:</p><div id="diskquota" align="left" style="margin-top:5px;margin-bottom:10px;">\n';
545		dec_html_code += '<div id="diskquota" align="left" style="margin-top:5px;margin-bottom:10px;">\n';
546		dec_html_code += '<img src="images/quotabar.gif" width="' + percentbar + '" height="13">';
547		dec_html_code += '</div>\n';
548	}
549	else{
550		dec_html_code += '<div class="style1"><strong id="diskUnmount'+ device.usbPath +'"><#DISK_UNMOUNTED#></strong></div>\n';
551	}
552
553	document.getElementById("deviceDec_"+device.usbPath).innerHTML = dec_html_code;
554}
555
556function printer_html(device){
557	var icon_html_code = '';
558	icon_html_code += '<a href="device-map/printer.asp" target="statusframe">\n';
559	icon_html_code += '<div id="iconPrinter_' + device.usbPath + '" class="iconPrinter" onclick="clickEvent(this);"></div>\n';
560	icon_html_code += '</a>\n';
561	document.getElementById("deviceIcon_" + device.usbPath).innerHTML = icon_html_code;
562
563	if(device.serialNum == '<% nvram_get("u2ec_serial"); %>')
564		document.getElementById("deviceDec_" + device.usbPath).innerHTML = '<div style="margin:10px;"><#CTL_Enabled#></div>';
565	else
566		document.getElementById("deviceDec_" + device.usbPath).innerHTML = '<div style="margin:10px;"><#CTL_Disabled#></div>';
567}
568
569function modem_html(device){
570	var icon_html_code = '';	
571	icon_html_code += '<a href="device-map/modem.asp" target="statusframe">\n';
572	icon_html_code += '<div id="iconModem_' + device.usbPath + '" class="iconmodem" onclick="clickEvent(this);"></div>\n';
573	icon_html_code += '</a>\n';
574	document.getElementById("deviceIcon_" + device.usbPath).innerHTML = icon_html_code;
575
576	document.getElementById("deviceDec_" + device.usbPath).innerHTML = '<div style="margin:10px;">' + device.deviceName + '</div>';
577}
578
579function no_device_html(device_seat){
580	var device_icon = document.getElementById("deviceIcon_"+device_seat);
581	var device_dec = document.getElementById("deviceDec_"+device_seat);
582	var icon_html_code = '';
583	var dec_html_code = '';
584	
585	icon_html_code += '<div class="iconNo"></div>';
586	dec_html_code += '<div style="margin:10px" id="noUSB'+ device_seat +'">';
587
588	if(rc_support.search("usbX") > -1)
589		dec_html_code += '<#NoDevice#>';
590	else
591		dec_html_code += '<#CTL_nonsupported#>';
592
593	dec_html_code += '</div>\n';
594	device_icon.innerHTML = icon_html_code;
595	device_dec.innerHTML = dec_html_code;
596}
597
598var avoidkey;
599var lastClicked;
600var lastName;
601var clicked_device_order;
602
603function get_clicked_device_order(){
604	return clicked_device_order;
605}
606
607function clickEvent(obj){
608	var icon;
609	var stitle;
610	var seat;
611	clicked_device_order = -1;
612
613	if(obj.id.indexOf("Internet") > 0){
614		if(!dualWAN_support){
615			check_wan_unit();
616		}
617
618		icon = "iconInternet";
619		stitle = "<#statusTitle_Internet#>";
620		document.getElementById("statusframe").src = "/device-map/internet.asp";
621
622		if(parent.wans_flag){
623			if(gobi_support) {
624				var eLAN_str = "<#Ethernet_wan#>".replace(/WAN/, "LAN");
625				if(obj.id.indexOf("primary") != -1){
626					if(dualwan_first_if == "wan")
627						stitle = "<#Ethernet_wan#> Status";
628					else if(dualwan_first_if == "lan")
629						stitle = eLAN_str+" Status";
630					else if(dualwan_first_if == "usb"){
631						if(gobi_support)
632							stitle = "<#Mobile_title#> Status";
633						else
634							stitle = "<#menu5_4_4#> Status";
635					}
636					else	
637						stitle = "Primary WAN status";
638				}
639				else{
640					if(dualwan_second_if == "wan")
641						stitle = "<#Ethernet_wan#> Status";
642					else if(dualwan_second_if == "lan")
643						stitle = eLAN_str+" Status";
644					else if(dualwan_second_if == "usb"){
645						if(gobi_support)
646							stitle = "<#Mobile_title#> Status";
647						else
648							stitle = "<#menu5_4_4#> Status";
649					}
650					else
651						stitle = "Secondary WAN status";
652				}
653			}
654			else {
655				if(obj.id.indexOf("primary") != -1)
656					stitle = "Primary WAN status";
657				else
658					stitle = "Secondary WAN status";
659			}
660		}
661	}
662	else if(obj.id.indexOf("Router") > 0){
663		icon = "iconRouter";
664		stitle = "<#menu5_7_1#>";
665	}
666	else if(obj.id.indexOf("Client") > 0){
667		icon = "iconClient";
668		stitle = "<#statusTitle_Client#>";
669	}
670	else if(obj.id.indexOf("USBdisk") > 0){
671		icon = "iconUSBdisk";
672		stitle = "<#statusTitle_USB_Disk#>";
673		currentUsbPort = obj.id.slice(-1) - 1;
674	}
675	else if(obj.id.indexOf("Modem") > 0){
676		seat = obj.id.indexOf("Modem")+5;
677		clicked_device_order = obj.id.slice(-1);
678		currentUsbPort = obj.id.slice(-1) - 1;
679		icon = "iconmodem";
680		stitle = "<#menu5_4_4#>";
681		document.getElementById("statusframe").src = "/device-map/modem.asp";
682	}
683	else if(obj.id.indexOf("Printer") > 0){
684		seat = obj.id.indexOf("Printer") + 7;
685		clicked_device_order = parseInt(obj.id.substring(seat, seat+1));
686		currentUsbPort = obj.id.slice(-1) - 1;
687		icon = "iconPrinter";
688		stitle = "<#statusTitle_Printer#>";
689		document.getElementById("statusframe").src = "/device-map/printer.asp";
690	}
691	else if(obj.id.indexOf("No") > 0){
692		icon = "iconNo";
693	}
694	else
695		alert("mouse over on wrong place!");
696
697	if(lastClicked){
698		if(lastClicked.id.indexOf("USBdisk") > 0)
699			lastClicked.style.backgroundPosition = '0% -4px';
700		else
701			lastClicked.style.backgroundPosition = '0% 0%';
702	}
703
704	if(obj.id.indexOf("USBdisk") > 0){	// To control USB icon outter ring's color
705		if(diskUtility_support){
706			if(!usbPorts[obj.id.slice(-1)-1].hasErrPart){
707				document.getElementById("statusframe").src = "/device-map/disk.asp";	
708				obj.style.backgroundPosition = '0% -103px';
709			}
710			else{
711				document.getElementById("statusframe").src = "/device-map/disk_utility.asp";
712				obj.style.backgroundPosition = '0% -202px';
713			}
714		}
715		else{
716			document.getElementById("statusframe").src = "/device-map/disk.asp";	
717			obj.style.backgroundPosition = '0% -103px';
718		}
719	}
720	else if(((obj.id.indexOf("secondary") > 0 && dualwan_second_if == 'usb') || (obj.id.indexOf("primary") > 0 && dualwan_first_if == 'usb')) && gobi_support) {
721		obj.style.backgroundPosition = '0% 100%';
722	}
723	else{
724		obj.style.backgroundPosition = '0% 101%';
725	}
726
727	document.getElementById('helpname').innerHTML = stitle;	
728	avoidkey = icon;
729	lastClicked = obj;
730	lastName = icon;
731}
732
733function mouseEvent(obj, key){
734	var icon;
735	
736	if(obj.id.indexOf("Internet") > 0)
737		icon = "iconInternet";
738	else if(obj.id.indexOf("Router") > 0)
739		icon = "iconRouter";
740	else if(obj.id.indexOf("Client") > 0)
741		icon = "iconClient";
742	else if(obj.id.indexOf("USBdisk") > 0)
743		icon = "iconUSBdisk";
744	else if(obj.id.indexOf("Printer") > 0)
745		icon = "iconPrinter";
746	else if(obj.id.indexOf("No") > 0)
747		icon = "iconNo";
748	else
749		alert("mouse over on wrong place!");
750	
751	if(avoidkey != icon){
752		if(key){ //when mouseover
753			obj.style.background = 'url("/images/map-'+icon+'_r.gif") no-repeat';
754		}
755		else {  //when mouseout
756			obj.style.background = 'url("/images/map-'+icon+'.gif") no-repeat';
757		}
758	}
759}//end of mouseEvent
760
761function MapUnderAPmode(){// if under AP mode, disable the Internet icon and show hint when mouseover.
762		document.getElementById("iconInternet").style.background = "url(/images/New_ui/networkmap/map-iconInternet-d.png) no-repeat";
763		document.getElementById("iconInternet").style.cursor = "default";
764		
765		document.getElementById("iconInternet").onmouseover = function(){
766			writetxt("<#underAPmode#>");
767		}
768		document.getElementById("iconInternet").onmouseout = function(){
769			writetxt(0);
770		}
771		document.getElementById("iconInternet").onclick = function(){
772			return false;
773		}
774		document.getElementById("clientStatusLink").href = "javascript:void(0)";
775		document.getElementById("clientStatusLink").style.cursor = "default";	
776		document.getElementById("iconClient").style.background = "url(/images/New_ui/networkmap/map-iconClient-d.png) no-repeat";
777		document.getElementById("iconClient").style.cursor = "default";
778}
779
780function showstausframe(page){
781	clickEvent(document.getElementById("icon"+page));
782	if(page == "Client")
783		page = "clients";
784	else if(page.indexOf('Internet') == 0){
785		if(page == "Internet_secondary")
786			document.form.dual_wan_flag.value = 1;
787		else	
788			document.form.dual_wan_flag.value = 0;
789			
790		page = "Internet";
791	}
792	
793	window.open("/device-map/"+page.toLowerCase()+".asp","statusframe");
794}
795
796function check_status(_device){
797	var diskOrder = _device.usbPath;
798	document.getElementById('iconUSBdisk_'+diskOrder).style.backgroundImage = "url(/images/New_ui/networkmap/USB_2.png)";	
799	document.getElementById('iconUSBdisk_'+diskOrder).style.backgroundPosition = '0px -4px';
800	document.getElementById('iconUSBdisk_'+diskOrder).style.position = "absolute";
801	document.getElementById('iconUSBdisk_'+diskOrder).style.marginTop = "0px";
802
803	/*if(navigator.appName.indexOf("Microsoft") >= 0)
804		document.getElementById('iconUSBdisk_'+diskOrder).style.marginLeft = "0px";
805	else*/
806		document.getElementById('iconUSBdisk_'+diskOrder).style.marginLeft = "34px";
807
808	document.getElementById('ring_USBdisk_'+diskOrder).style.backgroundImage = "url(/images/New_ui/networkmap/white_04.gif)";	
809	document.getElementById('ring_USBdisk_'+diskOrder).style.display = "";
810
811	if(!diskUtility_support)
812		return true;
813
814	var i, j;
815	var got_code_0, got_code_1, got_code_2, got_code_3;
816	for(i = 0; i < _device.partition.length; ++i){
817		switch(parseInt(_device.partition[i].fsck)){
818			case 0: // no error.
819				got_code_0 = 1;
820				break;
821			case 1: // find errors.
822				got_code_1 = 1;
823				break;
824			case 2: // proceeding...
825				got_code_2 = 1;
826				break;
827			default: // don't or can't support.
828				got_code_3 = 1;
829				break;
830		}
831	}
832	
833	if(got_code_1){
834		// red
835		document.getElementById('iconUSBdisk_'+diskOrder).style.backgroundPosition = '0px -6px';
836		document.getElementById('ring_USBdisk_'+diskOrder).style.backgroundPosition = '0px -186px';
837	}
838	else if(got_code_2 || got_code_3){
839		// white
840	}
841	else{
842		// blue
843		document.getElementById('iconUSBdisk_'+diskOrder).style.backgroundPosition = '0px -5px';
844		document.getElementById('ring_USBdisk_'+diskOrder).style.backgroundPosition = '0% 50%';
845	}
846}
847
848function check_wan_unit(){   //To check wan_unit, if USB Modem plug in change wan_unit to 1
849	if(wan0_primary == 1 && document.form.wan_unit.value == 1)
850		change_wan_unit(0);
851	else if(wan1_primary == 1 && document.form.wan_unit.value == 0)
852		change_wan_unit(1);
853}
854function change_wan_unit(wan_unit_flag){
855	document.form.wan_unit.value = wan_unit_flag;	
856	document.form.wl_auth_mode_x.disabled = true;	
857	document.form.wl_wep_x.disabled = true;		
858	FormActions("/apply.cgi", "change_wan_unit", "", "");
859	document.form.submit();
860}
861
862function show_ddns_fail_hint() {
863	var str="";
864	if( !((link_status == "2" && link_auxstatus == "0") || (link_status == "2" && link_auxstatus == "2")) )
865		str = "<#Disconnected#>";
866	else if(ddns_server = 'WWW.ASUS.COM') {
867		var ddnsHint = getDDNSState(ddns_return_code, "<%nvram_get("ddns_hostname_x");%>", "<%nvram_get("ddns_old_name");%>");
868		if(ddnsHint != "")
869			str = ddnsHint;
870	}
871	else 
872		str = "<#LANHostConfig_x_DDNS_alarm_2#>";
873
874	overlib(str);
875}
876
877function check_dualwan(flag){
878	if(flag == 0){		//single wan
879		document.getElementById('single_wan_icon').style.display = "";
880		document.getElementById('single_wan_status').style.display = "";
881		document.getElementById('single_wan_line').style.display = "";
882		document.getElementById('primary_wan_icon').style.display = "none";
883		document.getElementById('secondary_wan_icon').style.display = "none";
884		document.getElementById('primary_wan_line').style.display = "none";
885		document.getElementById('secondary_wan_line').style.display = "none";
886		document.getElementById('dual_wan_gap').style.display = "none";
887	}
888	else{
889		document.getElementById('single_wan_icon').style.display = "none";
890		document.getElementById('single_wan_status').style.display = "none";
891		document.getElementById('single_wan_line').style.display = "none";
892		document.getElementById('primary_wan_icon').style.display = "";
893		document.getElementById('secondary_wan_icon').style.display = "";
894		document.getElementById('primary_wan_line').style.display = "";
895		document.getElementById('secondary_wan_line').style.display = "";
896		document.getElementById('dual_wan_gap').style.display = "";
897	}
898}
899
900function update_wan_status(e) {
901	if(stopFlag == 1) return false;
902
903	$.ajax({
904		url: '/status.asp',
905		dataType: 'script', 
906
907		error: function(xhr) {
908			setTimeout("update_wan_status();", 3000);
909		},
910		success: function(response) {
911			wanlink_status = wanlink_statusstr();
912			wanlink_ipaddr = wanlink_ipaddr();
913			first_wanlink_status = first_wanlink_statusstr();
914			first_wanlink_ipaddr = first_wanlink_ipaddr();
915			secondary_wanlink_status = secondary_wanlink_statusstr();
916			secondary_wanlink_ipaddr = secondary_wanlink_ipaddr();
917			change_wan_state(first_wanlink_status,secondary_wanlink_status);
918			setTimeout("update_wan_status();", 3000);
919		}
920	});
921}
922
923function change_wan_state(primary_status, secondary_status){
924	if (!dualWAN_support)
925		return true;
926
927	if(wans_mode == "fo" || wans_mode == "fb"){
928		if(wan_unit == 0){
929			if(primary_status == "Disconnected"){
930				document.getElementById('primary_status').innerHTML = "<#Disconnected#>";
931				document.getElementById('primary_line').className = "primary_wan_disconnected";
932			}
933			else{
934				document.getElementById('primary_status').innerHTML = "<#Connected#>";
935				document.getElementById('primary_line').className = "primary_wan_connected";
936			}
937			
938			if(secondary_wanlink_ipaddr != '0.0.0.0' && secondary_status != 'Disconnected')
939				secondary_status = "Standby";
940					
941			if(secondary_status == 'Disconnected'){
942				document.getElementById('seconday_status').innerHTML = "<#Disconnected#>";
943				document.getElementById('secondary_line').className = "secondary_wan_disconnected";
944			}
945			else if(secondary_status == 'Standby'){
946				document.getElementById('seconday_status').innerHTML = "<#Status_Standby#>";
947				document.getElementById('secondary_line').className = "secondary_wan_standby";
948			}
949			else{
950				document.getElementById('seconday_status').innerHTML = "<#Connected#>";
951				document.getElementById('secondary_line').className = "secondary_wan_connected";
952			}
953		}
954		else{	//wan_unit : 1
955			if(first_wanlink_ipaddr != '0.0.0.0' && primary_status != 'Disconnected')
956				primary_status = "Standby";
957
958			if(primary_status == 'Disconnected'){
959				document.getElementById('primary_status').innerHTML = "<#Disconnected#>";
960				document.getElementById('primary_line').className = "primary_wan_disconnected";
961			}
962			else if(primary_status == 'Standby'){
963				document.getElementById('primary_status').innerHTML = "<#Status_Standby#>";
964				document.getElementById('primary_line').className = "primary_wan_standby";
965			}
966			else{
967				document.getElementById('primary_status').innerHTML = "<#Connected#>";
968				document.getElementById('primary_line').className = "primary_wan_connected";
969			}
970			
971			if(secondary_status == "Disconnected"){
972				document.getElementById('seconday_status').innerHTML = "<#Disconnected#>";
973				document.getElementById('secondary_line').className = "secondary_wan_disconnected";
974			}
975			else{
976				document.getElementById('seconday_status').innerHTML = "<#Connected#>";
977				document.getElementById('secondary_line').className = "secondary_wan_connected";
978			}
979		}
980	}
981	else{	//lb
982		if(primary_status == "Disconnected"){
983			document.getElementById('primary_status').innerHTML = "<#Disconnected#>";
984			document.getElementById('primary_line').className = "primary_wan_disconnected";
985		}
986		else{
987			document.getElementById('primary_status').innerHTML = "<#Connected#>";
988			document.getElementById('primary_line').className = "primary_wan_connected";
989		}
990		
991		if(secondary_status == "Disconnected"){
992			document.getElementById('seconday_status').innerHTML = "<#Disconnected#>";
993			document.getElementById('secondary_line').className = "secondary_wan_disconnected";
994		}
995		else{
996			document.getElementById('seconday_status').innerHTML = "<#Connected#>";
997			document.getElementById('secondary_line').className = "secondary_wan_connected";
998		}
999	}
1000}
1001
1002function validForm(){
1003	var validateIpRange = function(ip_obj){
1004		var retFlag = 1
1005		var ip_num = inet_network(ip_obj.value);
1006		
1007		if(ip_num <= 0){
1008			alert(ip_obj.value+" <#JS_validip#>");
1009			ip_obj.value = document.getElementById("ipaddr_field_orig").value;
1010			ip_obj.focus();
1011			retFlag = 0;
1012		}
1013		else if(ip_num <= getSubnet('<% nvram_get("lan_ipaddr"); %>', '<% nvram_get("lan_netmask"); %>', "head") ||
1014			 ip_num >= getSubnet('<% nvram_get("lan_ipaddr"); %>', '<% nvram_get("lan_netmask"); %>', "end")){
1015			alert(ip_obj.value+" <#JS_validip#>");
1016			ip_obj.value = document.getElementById("ipaddr_field_orig").value;
1017			ip_obj.focus();
1018			retFlag = 0;
1019		}
1020		else if(!validator.validIPForm(document.getElementById("ipaddr_field"), 0)){
1021			ip_obj.value = document.getElementById("ipaddr_field_orig").value;
1022			ip_obj.focus();
1023			retFlag = 0;
1024		}
1025
1026		document.list_form.dhcp_staticlist.value.split("<").forEach(function(element, index){
1027			var existMac = element.split(">")[0];
1028			var existIP = element.split(">")[1];
1029			if(existIP == document.getElementById("ipaddr_field").value) {
1030				if(existMac != document.getElementById("macaddr_field").value) {
1031					alert("<#JS_duplicate#>");
1032					ip_obj.value = document.getElementById("ipaddr_field_orig").value;
1033					ip_obj.focus();
1034					retFlag = 0;
1035				}
1036			}
1037		});
1038		
1039		return retFlag;
1040	}
1041
1042	if(validateIpRange(document.getElementById("ipaddr_field")) == true ){		
1043		if(ipBindingFlag) {	// only ipLockIcon is lock then update dhcp_staticlist						
1044			document.list_form.dhcp_staticlist.value.split("<").forEach(function(element, index){
1045				if(element.indexOf(document.getElementById("macaddr_field").value) != -1){
1046					var tmpArray = document.list_form.dhcp_staticlist.value.split("<")
1047					tmpArray[index] = document.getElementById("macaddr_field").value;
1048					tmpArray[index] += ">";
1049					tmpArray[index] += document.getElementById("ipaddr_field").value;
1050					document.list_form.dhcp_staticlist.value = tmpArray.join("<");
1051				}
1052			});
1053		}
1054		//if time sheduling enable, retain the existing settings
1055		if(timeSchedulingFlag) {
1056			delFromBlockMacList(document.getElementById("macaddr_field").value);
1057			if(document.list_form.MULTIFILTER_MAC.value.indexOf(document.getElementById("macaddr_field").value) == -1){
1058				if(document.list_form.MULTIFILTER_MAC.value == "") {
1059					document.list_form.MULTIFILTER_ENABLE.value += "1";
1060					document.list_form.MULTIFILTER_MAC.value += document.getElementById("macaddr_field").value;
1061					document.list_form.MULTIFILTER_DEVICENAME.value += document.getElementById("client_name").value.trim();
1062					if(time_scheduling_array[document.getElementById("macaddr_field").value] != undefined) {
1063						document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += time_scheduling_array[document.getElementById("macaddr_field").value][1];
1064					}
1065					else {
1066						document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += "<";
1067					}
1068				}
1069				else {
1070					document.list_form.MULTIFILTER_ENABLE.value += ">";
1071					document.list_form.MULTIFILTER_ENABLE.value += "1";
1072					document.list_form.MULTIFILTER_MAC.value += ">";
1073					document.list_form.MULTIFILTER_MAC.value += document.getElementById("macaddr_field").value;
1074					document.list_form.MULTIFILTER_DEVICENAME.value += ">";
1075					document.list_form.MULTIFILTER_DEVICENAME.value += document.getElementById("client_name").value.trim();
1076					if(time_scheduling_array[document.getElementById("macaddr_field").value] != undefined) {
1077						document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += ">" + time_scheduling_array[document.getElementById("macaddr_field").value][1];
1078					}
1079					else {
1080						document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += "><";
1081					}
1082				}
1083			}
1084		}
1085	}
1086	else		
1087		return false;
1088
1089	showtext(document.getElementById("alert_msg1"), "");
1090
1091	document.getElementById('client_name').value = document.getElementById('client_name').value.trim();
1092	if(document.getElementById('client_name').value.length == 0){
1093		alert("<#File_Pop_content_alert_desc1#>");
1094		document.getElementById("client_name").style.display = "";
1095		document.getElementById('client_name').focus();
1096		document.getElementById('client_name').select();
1097		return false;
1098	}
1099	else if(document.getElementById('client_name').value.indexOf(">") != -1 || document.getElementById('client_name').value.indexOf("<") != -1){
1100		alert("<#JS_validstr2#> '<', '>'");
1101		document.getElementById('client_name').focus();
1102		document.getElementById('client_name').select();
1103		document.getElementById('client_name').value = "";		
1104		return false;
1105	}
1106	else if(!validator.haveFullWidthChar(document.getElementById('client_name'))) {
1107		return false;
1108	}
1109
1110	return true;
1111}	
1112
1113var custom_name = decodeURIComponent('<% nvram_char_to_ascii("", "custom_clientlist"); %>').replace(/&#62/g, ">").replace(/&#60/g, "<");
1114function edit_confirm(){
1115	if(validForm()){
1116		document.list_form.custom_clientlist.disabled = false;
1117		// customize device name
1118		var originalCustomListArray = new Array();
1119		var onEditClient = new Array();
1120		var clientTypeNum = "";
1121		if(document.getElementById('client_image').className.search("venderIcon_no_hover") != -1) {
1122			clientTypeNum = "0";
1123		}
1124		else {
1125			clientTypeNum = document.getElementById('client_image').className.replace("clientIcon_no_hover type", "");
1126			if(clientTypeNum == "0_viewMode") {
1127				clientTypeNum = "0";
1128			}
1129		}
1130		originalCustomListArray = custom_name.split('<');
1131		onEditClient[0] = document.getElementById('client_name').value.trim();
1132		onEditClient[1] = document.getElementById('macaddr_field').value;
1133		onEditClient[2] = 0;
1134		onEditClient[3] = clientTypeNum;
1135		onEditClient[4] = "";
1136		onEditClient[5] = "";
1137
1138		for(var i=0; i<originalCustomListArray.length; i++){
1139			if(originalCustomListArray[i].split('>')[1] == onEditClient[1]){
1140				onEditClient[4] = originalCustomListArray[i].split('>')[4]; // set back callback for ROG device
1141				onEditClient[5] = originalCustomListArray[i].split('>')[5]; // set back keeparp for ROG device
1142				originalCustomListArray.splice(i, 1); // remove the selected client from original list
1143			}
1144		}
1145
1146		originalCustomListArray.push(onEditClient.join('>'));
1147		custom_name = originalCustomListArray.join('<');
1148		document.list_form.custom_clientlist.value = custom_name;
1149
1150		// static IP list
1151		if(document.list_form.dhcp_staticlist.value == dhcp_staticlist_orig || sw_mode != "1"){
1152			document.list_form.action_script.value = "saveNvram";
1153			document.list_form.action_wait.value = "1";
1154			document.list_form.flag.value = "background";
1155			document.list_form.dhcp_staticlist.disabled = true;
1156			document.list_form.dhcp_static_x.disabled = true;
1157			dhcp_staticlist_orig = document.list_form.dhcp_staticlist.value;
1158		}
1159		else {
1160			document.list_form.action_script.value = "restart_net_and_phy";
1161			document.list_form.action_wait.value = "35";
1162			document.list_form.flag.value = "";
1163			document.list_form.dhcp_staticlist.disabled = false;
1164			document.list_form.dhcp_static_x.value = 1;
1165			document.list_form.dhcp_static_x.disabled = false;
1166		}
1167
1168		//  block Mac list
1169		if((document.list_form.MULTIFILTER_MAC.value == MULTIFILTER_MAC_orig && document.list_form.MULTIFILTER_ENABLE.value == MULTIFILTER_ENABLE_orig && 
1170			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value == MULTIFILTER_MACFILTER_DAYTIME_orig) || sw_mode != "1"){
1171			document.list_form.MULTIFILTER_ALL.disabled = true;
1172			document.list_form.MULTIFILTER_ENABLE.disabled = true;
1173			document.list_form.MULTIFILTER_MAC.disabled = true;
1174			document.list_form.MULTIFILTER_DEVICENAME.disabled = true;
1175			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.disabled = true;
1176			MULTIFILTER_ENABLE_orig = document.list_form.MULTIFILTER_ENABLE.value;
1177			MULTIFILTER_MAC_orig = document.list_form.MULTIFILTER_MAC.value;
1178			MULTIFILTER_DEVICENAME_orig = document.list_form.MULTIFILTER_DEVICENAME.value;
1179			MULTIFILTER_MACFILTER_DAYTIME_orig = document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value;
1180		}
1181		else {
1182			document.list_form.flag.value = "";
1183			if(document.list_form.action_script.value == "restart_net_and_phy") {
1184				document.list_form.action_script.value += ";restart_firewall";
1185				document.list_form.action_wait.value = "35";
1186			}
1187			else {
1188				document.list_form.action_script.value = "restart_firewall";
1189				if(timeSchedulingFlag) {
1190					document.list_form.action_wait.value = "1";
1191					document.list_form.flag.value = "background";
1192				}
1193				else {
1194					document.list_form.action_wait.value = "5";
1195				}
1196			}
1197			
1198			document.list_form.MULTIFILTER_ALL.disabled = false;
1199			document.list_form.MULTIFILTER_ALL.value = "1";
1200			document.list_form.MULTIFILTER_ENABLE.disabled = false;
1201			document.list_form.MULTIFILTER_MAC.disabled = false;
1202			document.list_form.MULTIFILTER_DEVICENAME.disabled = false;
1203			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.disabled = false;
1204		}
1205
1206		// handle user image
1207		document.list_form.custom_usericon.disabled = true;
1208		if(usericon_support) {
1209			document.list_form.custom_usericon.disabled = false;
1210			var clientMac = document.getElementById("macaddr_field").value.replace(/\:/g, "");
1211			if(userIconBase64 != "NoIcon") {
1212				document.list_form.custom_usericon.value = clientMac + ">" + userIconBase64;
1213			}
1214			else {
1215				document.list_form.custom_usericon.value = clientMac + ">noupload";
1216			}
1217		}
1218
1219		// submit list_form
1220		document.list_form.submit();
1221
1222		// display waiting effect
1223		if(document.list_form.flag.value == "background"){
1224			document.getElementById("loadingIcon").style.display = "";
1225			setTimeout(function(){
1226				if(timeSchedulingFlag && document.getElementById("internetTimeScheduling").style.display == "none") { //if the latest internetMode is not time mode, then redirect to ParentalControl
1227					redirectTimeScheduling();
1228				}
1229				else {
1230					document.getElementById("statusframe").contentWindow.refreshpage();
1231				}
1232			}, document.list_form.action_wait.value * 1000);
1233		}
1234		else{
1235			hideEditBlock(); 
1236			setTimeout(function(){
1237				if(timeSchedulingFlag && document.getElementById("internetTimeScheduling").style.display == "none") { //if the latest internetMode is not time mode, then redirect to ParentalControl
1238					redirectTimeScheduling();
1239				}
1240				else {
1241					refreshpage();
1242				}
1243			}, document.list_form.action_wait.value * 1000);
1244		}
1245	}		
1246}
1247
1248function edit_cancel(){
1249	document.getElementById('edit_client_block').style.display = "none";
1250	document.getElementById("hiddenMask").style.visibility = "hidden";
1251	document.getElementById("dr_sweet_advise").style.display = "";
1252
1253	// disable event listener
1254	$(document).mouseup(function(e){});
1255	$("#statusframe").contents().mouseup(function(e){});
1256}
1257
1258function edit_delete(){
1259	var target_mac = document.getElementById('macaddr_field').value;
1260	var custom_name_row = custom_name.split('<');
1261	var custom_name_row_temp = custom_name.split('<');
1262	var custom_name_temp = "";
1263	var match_delete_flag = 0;
1264	
1265	for(i=0;i<custom_name_row.length;i++){
1266		var custom_name_col = custom_name_row[i].split('>');
1267
1268		if(target_mac == custom_name_col[1]){
1269			match_delete_flag = 1;
1270		}
1271		else{
1272			if(custom_name_temp != ""){
1273				custom_name_temp += "<";
1274			}
1275		
1276			for(j=0;j< custom_name_col.length;j++){
1277				if(j == custom_name_col.length-1)
1278					custom_name_temp += custom_name_col[j];
1279				else	
1280					custom_name_temp += custom_name_col[j] + ">";				
1281			}
1282		}
1283	}
1284	
1285	if(match_delete_flag == 1){
1286		document.list_form.custom_clientlist.value = custom_name_temp;
1287		custom_name = custom_name_temp;
1288		document.getElementById("loadingIcon").style.display = "";
1289		document.list_form.submit();
1290		document.getElementById("statusframe").contentWindow.refreshpage();
1291
1292		setTimeout("document.getElementById('loadingIcon').style.display='none'", 3500);
1293		setTimeout("document.getElementById('deleteBtn').style.display='none'", 3500);
1294	}
1295}
1296
1297function show_custom_image() {
1298	var display_state = document.getElementById("custom_image").style.display;
1299	if(display_state == "none") {
1300		$("#custom_image").slideDown("slow");
1301		document.getElementById("changeIconTitle").innerHTML = "<#CTL_close#>";
1302	}
1303	else {
1304		$("#custom_image").slideUp("slow");
1305		document.getElementById("changeIconTitle").innerHTML = "Change";/*untranslated*/
1306	}
1307}
1308
1309function select_image(type){
1310	var sequence = type.substring(4,type.length);
1311	document.getElementById("client_image").style.display = "none";
1312	document.getElementById("canvasUserIcon").style.display = "none";
1313	var icon_type = type;
1314	if(type == "type0") {
1315		icon_type = "type0_viewMode";
1316	}
1317
1318	document.getElementById('client_image').style.backgroundSize = "";
1319	document.getElementById('client_image').className = "clientIcon_no_hover " + icon_type;
1320	if(verderIcon != "" && type == "type0") {
1321		var venderIconClassName = getVenderIconClassName(verderIcon.toLowerCase());
1322		if(venderIconClassName != "" && !downsize_4m_support) {
1323			document.getElementById('client_image').className = "venderIcon_no_hover " + venderIconClassName;
1324			document.getElementById('client_image').style.backgroundSize = "180%";
1325		}
1326	}
1327
1328	var userImageFlag = false;
1329	if(!firstTimeOpenBlock) {
1330		if(usericon_support) {
1331			var clientMac = document.getElementById('macaddr_field').value.replace(/\:/g, "");
1332			userIconBase64 = getUploadIcon(clientMac);
1333			if(userIconBase64 != "NoIcon") {
1334				var img = document.createElement("img");
1335				img.src = userIconBase64;
1336				var canvas = document.getElementById("canvasUserIcon");
1337				var ctx = canvas.getContext("2d");
1338				ctx.clearRect(0,0,85,85);
1339				document.getElementById("client_image").style.display = "none";
1340				document.getElementById("canvasUserIcon").style.display = "";
1341				ctx.drawImage(img, 0, 0, 85, 85);
1342				userImageFlag = true;
1343			}
1344		}
1345	}
1346
1347	if(!userImageFlag) {
1348		userIconBase64 = "NoIcon";
1349		document.getElementById("client_image").style.display = "";
1350	}
1351}
1352
1353function hideEditBlock(){
1354	document.getElementById('edit_client_block').style.display = "none";
1355	document.getElementById('edit_usericon_block').style.display = "none";
1356	document.getElementById('loadingIcon').style.display = 'none';
1357	document.getElementById('loadingUserIcon').style.display = 'none';
1358	document.getElementById('deleteBtn').style.display ='none';
1359}
1360
1361function oui_query(mac){
1362	var queryStr = mac.replace(/\:/g, "").splice(6,6,"");
1363	$.ajax({
1364	    url: 'https://services11.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MA-L&format=html&text='+ queryStr,
1365		type: 'GET',
1366		success: function(response) {
1367			if(document.getElementById("edit_client_block").style.display == "none") return true;
1368			if(response.search("Sorry!") == -1) {
1369				if(response.search(queryStr) != -1) {
1370					var retData = response.split("pre")[1].split("(hex)")[1].split(queryStr)[0].split("<b>");
1371					document.getElementById('manufacturer_field').value = retData[0].trim();
1372					document.getElementById('manufacturer_field').title = "";
1373					if(retData[0].trim().length > 38) {
1374						document.getElementById('manufacturer_field').value = retData[0].trim().substring(0, 36) + "..";
1375						document.getElementById('manufacturer_field').title = retData[0].trim();
1376					}
1377				}
1378			}
1379		}
1380	});
1381}
1382
1383function popupEditBlock(clientObj){
1384	if(downsize_4m_support) {
1385		document.getElementById("changeClientIconControl").style.display = "none";
1386		document.getElementById("divDropClientImage").onclick = null;
1387	}
1388
1389	if(bwdpi_support) {
1390		document.getElementById("time_scheduling_title").innerHTML = "<#Time_Scheduling#>";
1391	}
1392
1393	firstTimeOpenBlock = false;
1394	
1395	var clientName = (clientObj.nickName == "") ? clientObj.name : clientObj.nickName;
1396	if(document.getElementById("edit_client_block").style.display != "none" && document.getElementById('client_name').value == clientName){
1397		$("#edit_client_block").fadeOut(300);
1398	}
1399	else{
1400		document.getElementById("uploadIcon").value = "";
1401		document.list_form.dhcp_staticlist.value = dhcp_staticlist_orig;
1402		document.list_form.MULTIFILTER_ENABLE.value = MULTIFILTER_ENABLE_orig;
1403		document.list_form.MULTIFILTER_MAC.value = MULTIFILTER_MAC_orig;
1404		document.list_form.MULTIFILTER_DEVICENAME.value = MULTIFILTER_DEVICENAME_orig;
1405		document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value = MULTIFILTER_MACFILTER_DAYTIME_orig;
1406		document.getElementById("divDropClientImage").ondrop = null;
1407		document.getElementById("internetTimeScheduling").style.display = "none";
1408		if(sw_mode == "1") {
1409			document.getElementById('tr_adv_setting').style.display = "";
1410		}
1411		else {
1412			document.getElementById('tr_adv_setting').style.display = "none";
1413		}
1414		document.getElementById("custom_image").style.display = "none";
1415		document.getElementById("changeIconTitle").innerHTML = "Change";/*untranslated*/
1416		
1417		var convRSSI = function(val) {
1418			if(val == "") return "wired";
1419
1420			val = parseInt(val);
1421			if(val >= -50) return 4;
1422			else if(val >= -80)	return Math.ceil((24 + ((val + 80) * 26)/10)/25);
1423			else if(val >= -90)	return Math.ceil((((val + 90) * 26)/10)/25);
1424			else return 1;
1425		};
1426
1427		var rssi_t = 0;
1428		var connectModeTip = "";
1429		var clientIconHtml = "";
1430		rssi_t = convRSSI(clientObj.rssi);
1431		if(isNaN(rssi_t)) {
1432			connectModeTip = "<#tm_wired#>";
1433		}
1434		else {
1435			switch (rssi_t) {
1436				case 1:
1437					connectModeTip = "<#Radio#>: <#PASS_score1#>\n";
1438					break;
1439				case 2:
1440					connectModeTip = "<#Radio#>: <#PASS_score2#>\n";
1441					break;
1442				case 3:
1443					connectModeTip = "<#Radio#>: <#PASS_score3#>\n";
1444					break;
1445				case 4:
1446					connectModeTip = "<#Radio#>: <#PASS_score4#>\n";
1447					break;
1448			}
1449			if(stainfo_support) {
1450				if(clientObj.curTx != "")
1451					connectModeTip += "Tx Rate: " + clientObj.curTx + "\n";
1452				if(clientObj.curRx != "")
1453					connectModeTip += "Rx Rate: " + clientObj.curRx + "\n";
1454				connectModeTip += "<#Access_Time#>: " + clientObj.wlConnectTime + "";
1455			}
1456		}
1457
1458		if(sw_mode != 4){
1459			clientIconHtml += '<div class="radioIcon radio_' + rssi_t +'" title="' + connectModeTip + '"></div>';
1460			if(clientObj.isWL != 0) {
1461				var bandClass = "band_txt";
1462				if(navigator.userAgent.toUpperCase().match(/CHROME\/([\d.]+)/)){
1463					bandClass = "band_txt_chrome";
1464				}
1465				clientIconHtml += '<div class="band_block"><span class="' + bandClass + '">' + wl_nband_title[clientObj.isWL-1].replace("Hz", "") + '</span></div>';
1466			}
1467			document.getElementById('client_interface').innerHTML = clientIconHtml;
1468			document.getElementById('client_interface').title = connectModeTip;
1469		}
1470
1471		document.getElementById('client_ipMethod').style.display = "none";
1472		document.getElementById('client_login').style.display = "none";
1473		document.getElementById('client_printer').style.display = "none";
1474		document.getElementById('client_iTunes').style.display = "none";
1475		document.getElementById('client_opMode').style.display = "none";
1476		if(sw_mode == "1") {
1477			document.getElementById('client_ipMethod').style.display = "";
1478			document.getElementById('client_ipMethod').innerHTML = clientObj.ipMethod;
1479			document.getElementById('client_ipMethod').onmouseover = function() {return overlib(ipState[clientObj.ipMethod]);};
1480			document.getElementById('client_ipMethod').onmouseout = function() {nd();};
1481		}
1482		if(clientObj.isLogin) {
1483			document.getElementById('client_login').style.display = "";
1484			document.getElementById('client_login').innerHTML = "logged-in-user";
1485		}
1486		if(clientObj.isPrinter) {
1487			document.getElementById('client_printer').style.display = "";
1488			document.getElementById('client_printer').innerHTML = "Printer";
1489		}
1490		if(clientObj.isITunes) {
1491			document.getElementById('client_iTunes').style.display = "";
1492			document.getElementById('client_iTunes').innerHTML = "iTunes";
1493		}
1494
1495		if(clientObj.opMode != 0) {
1496			var opModeDes = ["none", "<#wireless_router#>", "<#OP_RE_item#>", "<#OP_AP_item#>", "<#OP_MB_item#>"];
1497			document.getElementById('client_opMode').style.display = "";
1498			document.getElementById('client_opMode').innerHTML = opModeDes[clientObj.opMode];
1499		}
1500		
1501		document.getElementById('client_name').value = clientName;
1502		document.getElementById('ipaddr_field_orig').value = clientObj.ip;
1503		document.getElementById('ipaddr_field').value = clientObj.ip;
1504
1505		document.getElementById('ipaddr_field').disabled = true;
1506		$("#ipaddr_field").addClass("client_input_text_disabled");
1507		if(sw_mode == "1") {
1508			$("#ipaddr_field").removeClass("client_input_text_disabled");
1509			document.getElementById('ipaddr_field').disabled = false;
1510			document.getElementById("ipaddr_field").onkeypress = function() {
1511				if(!ipBindingFlag) {
1512					$('#radio_IPBinding_enable').click();
1513					ipBindingFlag = true;
1514				}	
1515			}
1516			document.getElementById("ipaddr_field").onblur = function() {
1517				if(!ipBindingFlag) {
1518					$('#radio_IPBinding_enable').click();
1519					ipBindingFlag = true;
1520				}				
1521				delFromList(document.getElementById("macaddr_field").value);
1522				addToList(document.getElementById("macaddr_field").value);	
1523			}
1524		}
1525		document.getElementById('macaddr_field').value = clientObj.mac;
1526		var deviceTitle = (clientObj.dpiDevice == "") ? clientObj.vendor : clientObj.dpiDevice;
1527		if(deviceTitle == undefined || deviceTitle == "") {
1528			document.getElementById('manufacturer_field').value = "Loading manufacturer..";
1529			setTimeout(function(){
1530				if('<% nvram_get("x_Setting"); %>' == '1' && wanConnectStatus && clientObj.internetState) {
1531					oui_query(clientObj.mac);
1532				}
1533			}, 1000);
1534		}
1535		else {
1536			document.getElementById('manufacturer_field').value = deviceTitle;
1537			document.getElementById('manufacturer_field').title = "";
1538			if(deviceTitle.length > 38) {
1539				document.getElementById('manufacturer_field').value = deviceTitle.substring(0, 36) + "..";
1540				document.getElementById('manufacturer_field').title = deviceTitle;
1541			}
1542		}
1543	
1544		var setRadioIPBinding = function (state, mode, mac) {
1545			switch (mode) {
1546				case "ipBinding" :
1547					$('#radio_IPBinding_enable').iphoneSwitch(state,
1548						function(){
1549							if(dhcp_staticlist_orig.search(mac) == -1) {
1550								if(dhcp_staticlist_num == 64) {
1551									if(confirm("The max limit is 64 rule. Please check your client list on DHCP server.")) { /*untranslated*/
1552										location.href = "Advanced_DHCP_Content.asp" ;
1553									}
1554									else {
1555										document.getElementById("ipaddr_field").value = document.getElementById("ipaddr_field_orig").value;
1556										setRadioIPBinding(0, "ipBinding", mac);
1557										ipBindingFlag = false;
1558										return false;
1559									}
1560								}
1561							}
1562							delFromList(document.getElementById("macaddr_field").value);
1563							addToList(document.getElementById("macaddr_field").value);
1564							ipBindingFlag = true;
1565						},
1566						function(){
1567							delFromList(document.getElementById("macaddr_field").value);
1568							document.getElementById("ipaddr_field").value = document.getElementById("ipaddr_field_orig").value;
1569							ipBindingFlag = false;
1570						}
1571					);
1572					break;
1573				case "blockInternet" :
1574					$('#radio_BlockInternet_enable').iphoneSwitch(state,
1575						function(){
1576							if(MULTIFILTER_MAC_orig.search(mac) == -1) {
1577								if(MULTIFILTER_num == 16) {
1578									if(confirm("The max limit is 16 clients. Please check your client list on time scheduling.")) { /*untranslated*/
1579										location.href = "ParentalControl.asp" ;
1580									}
1581									else {
1582										setRadioIPBinding(0, "blockInternet", mac);
1583										return false;
1584									}
1585								}
1586							}
1587							delFromBlockMacList(document.getElementById("macaddr_field").value);
1588							addToBlockMacList(document.getElementById("macaddr_field").value);
1589							setRadioIPBinding(0, "timeScheduling", mac);
1590							timeSchedulingFlag = false;
1591						},
1592						function(){
1593							delFromBlockMacList(document.getElementById("macaddr_field").value);
1594						}
1595					);
1596					break;
1597				case "timeScheduling" :
1598					$('#radio_TimeScheduling_enable').iphoneSwitch(state,
1599						function(){
1600							if(MULTIFILTER_MAC_orig.search(mac) == -1) {
1601								if(MULTIFILTER_num == 16) {
1602									if(confirm("The max limit is 16 clients. Please check your client list on time scheduling.")) { /*untranslated*/
1603										location.href = "ParentalControl.asp" ;
1604									}
1605									else {
1606										setRadioIPBinding(0, "timeScheduling", mac);
1607										return false;
1608									}
1609								}
1610							}
1611							delFromBlockMacList(document.getElementById("macaddr_field").value);
1612							addToBlockMacList(document.getElementById("macaddr_field").value);
1613							setRadioIPBinding(0, "blockInternet", mac);
1614							timeSchedulingFlag = true;
1615						},
1616						function(){
1617							delFromBlockMacList(document.getElementById("macaddr_field").value);
1618							timeSchedulingFlag = false;
1619						}
1620					);
1621					break;
1622			}
1623		};
1624
1625		if(dhcp_staticlist_orig.search(clientObj.mac + ">" + clientObj.ip) != -1) { //check mac>ip is combination the the radio_IPBinding_enable is manual
1626			setRadioIPBinding(1, "ipBinding", clientObj.mac);
1627			ipBindingFlag = true;
1628		}
1629		else {
1630			setRadioIPBinding(0, "ipBinding", clientObj.mac);
1631			ipBindingFlag = false;
1632		}
1633
1634		switch(clientObj.internetMode) {
1635			case "allow" :
1636				setRadioIPBinding(0, "blockInternet", clientObj.mac);
1637				setRadioIPBinding(0, "timeScheduling", clientObj.mac);
1638				timeSchedulingFlag = false;
1639				break;
1640			case "block" :
1641				setRadioIPBinding(1, "blockInternet", clientObj.mac);
1642				setRadioIPBinding(0, "timeScheduling", clientObj.mac);
1643				timeSchedulingFlag = false;
1644				break;
1645			case "time" :
1646				setRadioIPBinding(0, "blockInternet", clientObj.mac);
1647				setRadioIPBinding(1, "timeScheduling", clientObj.mac);
1648				document.getElementById("internetTimeScheduling").style.display = "";
1649				timeSchedulingFlag = true;
1650				break;
1651		}
1652
1653		verderIcon = clientObj.vendor;
1654
1655		select_image("type" + parseInt(clientObj.type));
1656
1657		//setting user upload icon attribute start.
1658		//1.check rc_support
1659		if(usericon_support && !downsize_4m_support) {
1660			//2.check browswer support File Reader and Canvas or not.
1661			if(isSupportFileReader() && isSupportCanvas()) {
1662				document.getElementById("divUserIcon").style.display = "";
1663				//Setting drop event
1664				var holder = document.getElementById("divDropClientImage");
1665				holder.ondragover = function () { return false; };
1666				holder.ondragend = function () { return false; };
1667				holder.ondrop = function (e) {
1668					e.preventDefault();
1669					var userIconLimitFlag = userIconNumLimit(document.getElementById("macaddr_field").value);
1670					if(userIconLimitFlag) {	//not over 100	
1671						var file = e.dataTransfer.files[0];
1672						//check image
1673						if(file.type.search("image") != -1) {
1674							var reader = new FileReader();
1675							reader.onload = function (event) {
1676								var img = document.createElement("img");
1677								img.src = event.target.result;
1678								var mimeType = img.src.split(",")[0].split(":")[1].split(";")[0];
1679								var canvas = document.getElementById("canvasUserIcon");
1680								var ctx = canvas.getContext("2d");
1681								ctx.clearRect(0,0,85,85);
1682								document.getElementById("client_image").style.display = "none";
1683								document.getElementById("canvasUserIcon").style.display = "";
1684								setTimeout(function() {
1685									ctx.drawImage(img, 0, 0, 85, 85);
1686									var dataURL = canvas.toDataURL(mimeType);
1687									userIconBase64 = dataURL;
1688								}, 100); //for firefox FPS(Frames per Second) issue need delay
1689							};
1690							reader.readAsDataURL(file);
1691							return false;
1692						}
1693						else {
1694							alert("<#Setting_upload_hint#>");
1695							return false;
1696						}
1697					}
1698					else {	//over 100 then let usee select delete icon or nothing
1699						showClientIconList();
1700					}
1701				};
1702			} 
1703		}
1704		//setting user upload icon attribute end.
1705		
1706		// hide block btn
1707		// document.getElementById("blockBtn").style.display = (clientObj.isWL && document.maclist_form.wl0_macmode.value != "allow") ? "" : "none";
1708		cal_panel_block("edit_client_block", 0.23);
1709		$("#edit_client_block").fadeIn(300);
1710	}
1711
1712	firstTimeOpenBlock = true;
1713
1714	// hide client panel 
1715	$(document).mouseup(function(e){
1716		if(!$("#edit_client_block").is(e.target) && $("#edit_client_block").has(e.target).length === 0 && !userIconHideFlag) {
1717			setTimeout( function() {userIconHideFlag = false;}, 1000);
1718			edit_cancel();
1719		}
1720		else {
1721			setTimeout( function() {userIconHideFlag = false;}, 1000);
1722		}
1723	});
1724	$("#statusframe").contents().mouseup(function(e){
1725		if(!$("#edit_client_block").is(e.target) && $("#edit_client_block").has(e.target).length === 0 && !userIconHideFlag) {
1726			setTimeout( function() {userIconHideFlag = false;}, 1000);
1727			edit_cancel();
1728		}
1729		else {
1730			setTimeout( function() {userIconHideFlag = false;}, 1000);
1731		}
1732	});
1733}
1734
1735function check_usb3(){
1736	if(based_modelid == "DSL-AC68U" || based_modelid == "RT-AC3200" || based_modelid == "RT-AC87U" || based_modelid == "RT-AC69U" || based_modelid == "RT-AC68U" || based_modelid == "RT-AC68U_V2" || based_modelid == "RT-AC56S" || based_modelid == "RT-AC56U" || based_modelid == "RT-AC55U" || based_modelid == "RT-AC55UHP" || based_modelid == "RT-N18U" || based_modelid == "RT-AC88U" || based_modelid == "RT-AC3100" || based_modelid == "RT-AC5300" || based_modelid == "RT-AC5300R"){
1737		document.getElementById('usb1_image').src = "images/New_ui/networkmap/USB3.png";
1738	}
1739	else if(based_modelid == "RT-N65U"){
1740		document.getElementById('usb1_image').src = "images/New_ui/networkmap/USB3.png";
1741		document.getElementById('usb2_image').src = "images/New_ui/networkmap/USB3.png";
1742	}
1743}
1744
1745function addToBlockMacList(macAddr){
1746	if(document.list_form.MULTIFILTER_MAC.value.indexOf(macAddr) == -1){
1747		if(document.list_form.MULTIFILTER_MAC.value == "") {
1748			document.list_form.MULTIFILTER_ENABLE.value += "1";
1749			document.list_form.MULTIFILTER_MAC.value += macAddr;
1750			document.list_form.MULTIFILTER_DEVICENAME.value += document.getElementById("client_name").value.trim();
1751			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += "<";
1752		}
1753		else {
1754			document.list_form.MULTIFILTER_ENABLE.value += ">";
1755			document.list_form.MULTIFILTER_ENABLE.value += "1";
1756			document.list_form.MULTIFILTER_MAC.value += ">";
1757			document.list_form.MULTIFILTER_MAC.value += macAddr;
1758			document.list_form.MULTIFILTER_DEVICENAME.value += ">";
1759			document.list_form.MULTIFILTER_DEVICENAME.value += document.getElementById("client_name").value.trim();
1760			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value += "><";
1761		}
1762	}
1763}
1764
1765function delFromBlockMacList(macAddr){
1766	document.list_form.MULTIFILTER_MAC.value.split(">").forEach(function(element, index){
1767		if(element.indexOf(macAddr) != -1){
1768			var tmpArray = document.list_form.MULTIFILTER_ENABLE.value.split(">");
1769			tmpArray.splice(index, 1);
1770			document.list_form.MULTIFILTER_ENABLE.value = tmpArray.join(">");
1771
1772			tmpArray = document.list_form.MULTIFILTER_MAC.value.split(">");
1773			tmpArray.splice(index, 1);
1774			document.list_form.MULTIFILTER_MAC.value = tmpArray.join(">");
1775
1776			tmpArray = document.list_form.MULTIFILTER_DEVICENAME.value.split(">");
1777			tmpArray.splice(index, 1);
1778			document.list_form.MULTIFILTER_DEVICENAME.value = tmpArray.join(">");
1779
1780			tmpArray = document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value.split(">");
1781			tmpArray.splice(index, 1);
1782			document.list_form.MULTIFILTER_MACFILTER_DAYTIME.value = tmpArray.join(">");
1783		}
1784	})
1785}
1786
1787function addToList(macAddr){
1788	if(document.list_form.dhcp_staticlist.value.indexOf(macAddr) == -1){
1789		document.list_form.dhcp_staticlist.value += "<";
1790		document.list_form.dhcp_staticlist.value += macAddr;
1791		document.list_form.dhcp_staticlist.value += ">";
1792		document.list_form.dhcp_staticlist.value += document.getElementById("ipaddr_field").value;
1793	}
1794}
1795
1796function delFromList(macAddr){
1797	document.list_form.dhcp_staticlist.value.split("<").forEach(function(element, index){
1798		if(element.indexOf(macAddr) != -1){
1799			var tmpArray = document.list_form.dhcp_staticlist.value.split("<")
1800			tmpArray.splice(index, 1);
1801			document.list_form.dhcp_staticlist.value = tmpArray.join("<");
1802		}
1803	})
1804}
1805
1806function showClientIconList() {
1807	var confirmFlag = true;
1808	confirmFlag = confirm("The client icon over upload limting, please remove at least one client icon then try to upload again.");
1809	if(confirmFlag) {
1810		edit_cancel();
1811		$("#edit_usericon_block").fadeIn(10);
1812		cal_panel_block("edit_usericon_block", 0.15);
1813		showClientIcon();
1814		document.getElementById("uploadIcon").value = "";
1815		return false;
1816	}
1817	else {
1818		document.getElementById("uploadIcon").value = "";
1819		return false;
1820	}
1821}
1822
1823function showClientIcon() {
1824	genClientList();
1825	var uploadIconMacList = getUploadIconList().replace(/\.log/g, "");
1826	var custom_usericon_row = uploadIconMacList.split('>');
1827	var code = "";
1828	var clientIcon = "";
1829	var custom_usericon_length = custom_usericon_row.length;
1830	code +='<table width="95%" cellspacing="0" cellpadding="4" align="center" class="list_table" id="usericon_table">';
1831	if(custom_usericon_length == 1) {
1832		code +='<tr><td style="color:#FFCC00;" colspan="4"><#IPConnection_VSList_Norule#></td></tr>';
1833		document.getElementById('edit_usericon_block').style.height = "145px";
1834	}
1835	else {
1836		for(var i = 0; i < custom_usericon_length; i += 1) {
1837			if(custom_usericon_row[i] != "") {
1838				var formatMac = custom_usericon_row[i].slice(0,2) + ":" + custom_usericon_row[i].slice(2,4) + ":" + custom_usericon_row[i].slice(4,6) + ":" + 
1839								custom_usericon_row[i].slice(6,8) + ":" + custom_usericon_row[i].slice(8,10)+ ":" + custom_usericon_row[i].slice(10,12);
1840				code +='<tr id="row' + i + '">';
1841				var clientObj = clientList[formatMac];
1842				var clientName = "";
1843				if(clientObj != undefined) {
1844					clientName = (clientObj.nickName == "") ? clientObj.name : clientObj.nickName;
1845				}
1846				code +='<td width="45%">'+ clientName +'</td>';
1847				code +='<td width="30%">'+ formatMac +'</td>';
1848				clientIcon = getUploadIcon(custom_usericon_row[i]);
1849				code +='<td width="15%"><img id="imgClientIcon_'+ i +'" class="imgClientIcon" src="' + clientIcon + '"</td>';
1850				code +='<td width="10%"><input class="remove_btn" onclick="delClientIcon(this);" value=""/></td></tr>';
1851			}
1852		}
1853		document.getElementById('edit_usericon_block').style.height = (61 * custom_usericon_length + 50) + "px";
1854	}
1855	code +='</table>';
1856	document.getElementById("usericon_block").innerHTML = code;
1857};
1858
1859function delClientIcon(rowdata) {
1860	var delIdx = rowdata.parentNode.parentNode.rowIndex;
1861	var delMac = rowdata.parentNode.parentNode.childNodes[1].innerHTML;
1862	document.getElementById("usericon_table").deleteRow(delIdx);
1863	custom_usericon_del += delMac + ">";
1864	var trCount = $( "#usericon_table tr" ).length;
1865	document.getElementById('edit_usericon_block').style.height = (61 * (trCount + 1) + 50) + "px";
1866	if(trCount == 0) {
1867		var code = "";
1868		code +='<table width="95%" cellspacing="0" cellpadding="4" align="center" class="list_table" id="usericon_table">';
1869		code +='<tr><td style="color:#FFCC00;" colspan="4"><#IPConnection_VSList_Norule#></td></tr>';
1870		code +='</table>';
1871		document.getElementById('edit_usericon_block').style.height = "145px";
1872		document.getElementById("usericon_block").innerHTML = code;
1873	}
1874}
1875
1876function btUserIconEdit() {
1877	document.list_form.custom_clientlist.disabled = true;
1878	document.list_form.dhcp_staticlist.disabled = true;
1879	document.list_form.custom_usericon.disabled = true;
1880	document.list_form.custom_usericon_del.disabled = false;
1881	document.list_form.custom_usericon_del.value = custom_usericon_del.replace(/\:/g, "");
1882
1883	// submit list_form
1884	document.list_form.submit();
1885	document.getElementById("loadingUserIcon").style.display = "";
1886	setTimeout(function(){
1887		document.getElementById("statusframe").contentWindow.refreshpage();
1888		custom_usericon_del = "";
1889		document.list_form.custom_usericon_del.disabled = true;
1890	}, document.list_form.action_wait.value * 1000);
1891}
1892function btUserIconCancel() {
1893	custom_usericon_del = "";
1894	$("#edit_usericon_block").fadeOut(100);
1895}
1896
1897function previewImage(imageObj) {
1898	var userIconLimitFlag = userIconNumLimit(document.getElementById("macaddr_field").value);
1899	
1900	if(userIconLimitFlag) {	//not over 100
1901		var checkImageExtension = function (imageFileObject) {
1902		var  picExtension= /\.(jpg|jpeg|gif|png|bmp|ico)$/i;  //analy extension
1903			if (picExtension.test(imageFileObject)) 
1904				return true;
1905			else
1906				return false;
1907		};
1908
1909		//1.check image extension
1910		if (!checkImageExtension(imageObj.value)) {
1911			alert("<#Setting_upload_hint#>");
1912			imageObj.focus();
1913		}
1914		else {
1915			//2.Re-drow image
1916			var fileReader = new FileReader(); 
1917			fileReader.onload = function (fileReader) {
1918				var img = document.createElement("img");
1919				img.src = fileReader.target.result;
1920				var mimeType = img.src.split(",")[0].split(":")[1].split(";")[0];
1921				var canvas = document.getElementById("canvasUserIcon");
1922				var ctx = canvas.getContext("2d");
1923				ctx.clearRect(0,0,85,85);
1924				document.getElementById("client_image").style.display = "none";
1925				document.getElementById("canvasUserIcon").style.display = "";
1926				setTimeout(function() {
1927					ctx.drawImage(img, 0, 0, 85, 85);
1928					var dataURL = canvas.toDataURL(mimeType);
1929					userIconBase64 = dataURL;
1930				}, 100); //for firefox FPS(Frames per Second) issue need delay
1931			}
1932			fileReader.readAsDataURL(imageObj.files[0]);
1933			userIconHideFlag = true;
1934		}
1935	}
1936	else {	//over 100 then let usee select delete icon or nothing
1937		showClientIconList();
1938	}
1939}
1940
1941function redirectTimeScheduling() {
1942	cookie.set("time_scheduling_mac", document.getElementById('macaddr_field').value, 1);
1943	location.href = "ParentalControl.asp" ;
1944}
1945function updateClientsCount() {
1946	$.ajax({
1947		url: '/update_networkmapd.asp',
1948		dataType: 'script', 
1949		error: function(xhr) {
1950			setTimeout("updateClientsCount();", 1000);
1951		},
1952		success: function(response){
1953			//When not click iconClient and not click View Client List need update client count.
1954			if(lastName != "iconClient") {
1955				if(document.getElementById("clientlist_viewlist_content")) {
1956					if(document.getElementById("clientlist_viewlist_content").style.display == "none") {
1957						show_client_status(fromNetworkmapd.length - 1);
1958					}
1959				}
1960				else {
1961					show_client_status(fromNetworkmapd.length - 1);
1962				}
1963			}
1964			setTimeout("updateClientsCount();", 3000);
1965		}
1966	});
1967}
1968function setDefaultIcon() {
1969	var mac = document.getElementById("macaddr_field").value;
1970	select_image("type" + parseInt(clientList[mac].defaultType));
1971}
1972function closeClientDetailView() {
1973	edit_cancel();
1974}
1975</script>
1976</head>
1977
1978<body onunload="return unload_body();">
1979<noscript>
1980	<div class="popup_bg" style="visibility:visible; z-index:999;">
1981		<div style="margin:200px auto; width:300px; background-color:#006699; color:#FFFFFF; line-height:150%; border:3px solid #FFF; padding:5px;"><#not_support_script#></p></div>
1982	</div>
1983</noscript>
1984
1985<div id="TopBanner"></div>
1986<div id="Loading" class="popup_bg"></div>
1987<div id="hiddenMask" class="popup_bg">
1988	<table cellpadding="5" cellspacing="0" id="dr_sweet_advise" class="dr_sweet_advise" align="center">
1989		<tr>
1990		<td>
1991			<div class="drword" id="drword"><#Main_alert_proceeding_desc4#> <#Main_alert_proceeding_desc1#>...
1992				<br>
1993				<div id="disconnect_hint" style="display:none;"><#Main_alert_proceeding_desc2#></div>
1994				<br>
1995		    </div>
1996			<div id="wireless_client_detect" style="margin-left:10px;position:absolute;display:none;width:400px">
1997				<img src="images/loading.gif">
1998				<div style="margin:-55px 0 0 75px;"><#QKSet_Internet_Setup_fail_method1#></div>
1999			</div> 
2000			<div class="drImg"><img src="images/alertImg.png"></div>
2001			<div style="height:100px; "></div>
2002		</td>
2003		</tr>
2004	</table>
2005<!--[if lte IE 6.5]><iframe class="hackiframe"></iframe><![endif]-->
2006</div>
2007
2008<iframe name="hidden_frame" id="hidden_frame" width="0" height="0" frameborder="0" scrolling="no"></iframe>
2009
2010<form method="post" name="form" id="ruleForm" action="/start_apply.htm" target="hidden_frame">
2011<input type="hidden" name="current_page" value="index.asp">
2012<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>">
2013<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>">
2014<input type="hidden" name="wl_auth_mode_x" value="<% nvram_get("wl0_auth_mode_x"); %>">
2015<input type="hidden" name="wl_wep_x" value="<% nvram_get("wl0_wep_x"); %>">
2016<input type="hidden" name="action_mode" value="">
2017<input type="hidden" name="action_script" value="">
2018<input type="hidden" name="action_wait" value="">
2019<input type="hidden" name="apps_action" value="">
2020<input type="hidden" name="apps_path" value="">
2021<input type="hidden" name="apps_name" value="">
2022<input type="hidden" name="apps_flag" value="">
2023<input type="hidden" name="wan_unit" value="<% nvram_get("wan_unit"); %>">
2024<input type="hidden" name="dual_wan_flag" value="">
2025</form>
2026<!-- Start for Editing client list-->
2027<form method="post" name="list_form" id="list_form" action="/start_apply2.htm" target="hidden_frame">
2028	<input type="hidden" name="current_page" value="index.asp">
2029	<input type="hidden" name="next_page" value="index.asp">
2030	<input type="hidden" name="modified" value="0">
2031	<input type="hidden" name="flag" value="background">
2032	<input type="hidden" name="action_mode" value="apply">
2033	<input type="hidden" name="action_script" value="saveNvram">
2034	<input type="hidden" name="action_wait" value="1">
2035	<input type="hidden" name="custom_clientlist" value="">
2036	<input type="hidden" name="dhcp_staticlist" value="" disabled>
2037	<input type="hidden" name="dhcp_static_x" value='<% nvram_get("dhcp_static_x"); %>' disabled>
2038	<input type="hidden" name="custom_usericon" value="">
2039	<input type="hidden" name="custom_usericon_del" value="" disabled>
2040	<input type="hidden" name="MULTIFILTER_ALL" value="" disabled>
2041	<input type="hidden" name="MULTIFILTER_ENABLE" value="" disabled>
2042	<input type="hidden" name="MULTIFILTER_MAC" value="" disabled>
2043	<input type="hidden" name="MULTIFILTER_DEVICENAME" value="" disabled>
2044	<input type="hidden" name="MULTIFILTER_MACFILTER_DAYTIME" value="" disabled>
2045</form>
2046
2047<form method="post" name="maclist_form" id="maclist_form" action="/start_apply2.htm" target="hidden_frame">
2048	<input type="hidden" name="current_page" value="index.asp">
2049	<input type="hidden" name="next_page" value="index.asp">
2050	<input type="hidden" name="modified" value="0">
2051	<input type="hidden" name="flag" value="">
2052	<input type="hidden" name="action_mode" value="apply_new">
2053	<input type="hidden" name="action_script" value="restart_wireless">
2054	<input type="hidden" name="action_wait" value="5">
2055	<input type="hidden" name="wl0_maclist_x" value="<% nvram_get("wl0_maclist_x"); %>">
2056	<input type="hidden" name="wl1_maclist_x" value="<% nvram_get("wl1_maclist_x"); %>">
2057	<input type="hidden" name="wl2_maclist_x" value="<% nvram_get("wl2_maclist_x"); %>">
2058	<input type="hidden" name="wl0_macmode" value="deny">
2059	<input type="hidden" name="wl1_macmode" value="deny">
2060	<input type="hidden" name="wl2_macmode" value="deny">
2061</form>
2062<!-- update Client List -->
2063<form method="post" name="networkmapdRefresh" action="/apply.cgi" target="hidden_frame">
2064	<input type="hidden" name="action_mode" value="update_client_list">
2065	<input type="hidden" name="action_script" value="">
2066	<input type="hidden" name="action_wait" value="1">
2067	<input type="hidden" name="current_page" value="httpd_check.xml">
2068	<input type="hidden" name="next_page" value="httpd_check.xml">
2069	<input type="hidden" name="client_info_tmp" value="">	
2070</form>
2071
2072<div id="edit_usericon_block" class="contentM_usericon">
2073	<table width="95%" border="1" align="center" cellpadding="4" cellspacing="0" class="FormTable_table" style="margin-top:8px;">
2074		<thead>
2075			<tr>
2076				<td colspan="4">Client upload icon&nbsp;(<#List_limit#>&nbsp;100)</td>
2077			</tr>
2078		</thead>
2079		<tr>
2080			<th width="45%">Client Name</th>
2081			<th width="30%">MAC</th>
2082			<th width="15%">Upload icon</th>
2083			<th width="10%"><#CTL_del#></th>
2084		</tr>
2085	</table>
2086	<div id="usericon_block"></div>
2087	<div style="margin-top:5px;padding-bottom:10px;width:100%;text-align:center;">
2088		<input class="button_gen" type="button" onclick="btUserIconCancel();" value="<#CTL_Cancel#>">
2089		<input class="button_gen" type="button" onclick="btUserIconEdit();" value="<#CTL_ok#>">
2090		<img id="loadingUserIcon" style="margin-left:5px;display:none;" src="/images/InternetScan.gif">
2091	</div>	
2092</div>
2093<div id="edit_client_block" class="contentM_qis">
2094	<table class="QISform_wireless" border=0 align="center" cellpadding="5" cellspacing="0" style="width:100%;">
2095		<tr>
2096			<td colspan="3">
2097				<div id="divClientState" class="clientState">
2098					<span id="client_ipMethod" class="ipMethodTag " ></span>
2099					<span id="client_login" class="ipMethodTag " ></span>
2100					<span id="client_printer" class="ipMethodTag " ></span>
2101					<span id="client_iTunes" class="ipMethodTag " ></span>
2102					<span id="client_opMode" class="ipMethodTag "></span>
2103				</div>
2104				<div id="client_interface" style="height:28px;width:28px;float:right;"></div>
2105			</td>
2106		</tr>
2107		<tr>
2108			<td colspan="3">
2109				<div class="clientList_line"></div>
2110			</td>
2111		</tr>
2112		<tr>
2113			<td style="text-align:center;vertical-align:top;width:85px;">
2114				<div id="divDropClientImage" class="client_preview_icon" title="Change client icon" onclick="show_custom_image();">
2115					<div id="client_image" style="width:85px;height:85px;margin:0 auto;"></div>
2116					<canvas id="canvasUserIcon" class="client_canvasUserIcon" width="85px" height="85px"></canvas>
2117				</div>
2118				<div id="changeClientIconControl" class="changeClientIcon">
2119					<span title="Change to default client icon" onclick="setDefaultIcon();">Default</span><!--untranslated-->
2120					<span id="changeIconTitle" title="Change client icon" style="margin-left:10px;" onclick="show_custom_image();">Change</span><!--untranslated-->
2121				</div>
2122			</td>
2123			<td style="vertical-align:top;text-align:center;">
2124				<div class="clientTitle">
2125					Name
2126				</div>
2127				<div  class="clientTitle" style="margin-top:10px;">
2128					IP
2129				</div>
2130				<div  class="clientTitle" style="margin-top:10px;">
2131					MAC
2132				</div>
2133				<div  class="clientTitle" style="margin-top:10px;">
2134					Device
2135				</div>
2136			</td>
2137			<td style="vertical-align:top;width:280px;">
2138				<div>	
2139					<input id="client_name" name="client_name" type="text" value="" class="input_32_table" maxlength="32" style="width:275px;" autocorrect="off" autocapitalize="off">
2140				</div>
2141				<div style="margin-top:10px;">				
2142					<input id="ipaddr_field_orig" type="hidden" value="" disabled="">
2143					<input id="ipaddr_field" type="text" value="" class="input_32_table" style="width:275px;" onkeypress="return validator.isIPAddr(this,event)" autocorrect="off" autocapitalize="off">
2144				</div>
2145					
2146				<div style="margin-top:10px;">
2147					<input id="macaddr_field" type="text" value="" class="input_32_table client_input_text_disabled" disabled autocorrect="off" autocapitalize="off">
2148				</div>
2149				<div style="margin-top:10px;">
2150					<input id="manufacturer_field" type="text" value="" class="input_32_table client_input_text_disabled" disabled>
2151				</div>
2152			</td>
2153		</tr>
2154
2155		<tr>
2156			<td colspan="3">
2157				<div id="custom_image" style="display:none;">
2158					<table border="1" align="center" cellpadding="4" cellspacing="0" style="width:100%">
2159						<tr>
2160							<td>
2161								<div class="type1" onclick="select_image(this.className);" title="Windows device"></div><!--untranslated-->
2162							</td>
2163							<td>
2164								<div class="type2" onclick="select_image(this.className);" title="Router"></div><!--untranslated-->
2165							</td>
2166							<td>
2167								<div class="type4" onclick="select_image(this.className);" title="NAS/Server"></div><!--untranslated-->
2168							</td>
2169							<td>
2170								<div class="type5" onclick="select_image(this.className);" title="IP Cam"></div><!--untranslated-->
2171							</td>
2172							<td>
2173								<div class="type6" onclick="select_image(this.className);" title="Macbook"></div><!--untranslated-->
2174							</td>
2175							<td>
2176								<div class="type7" onclick="select_image(this.className);" title="Game Console"></div><!--untranslated-->
2177							</td>
2178							<td>
2179								<div class="type9" onclick="select_image(this.className);" title="Android Phone"></div><!--untranslated-->
2180							</td>
2181						</tr>
2182						<tr>
2183							<td>
2184								<div class="type10" onclick="select_image(this.className);" title="iPhone"></div><!--untranslated-->
2185							</td>
2186							<td>
2187								<div class="type11" onclick="select_image(this.className);" title="Apple TV"></div><!--untranslated-->
2188							</td>
2189							<td>
2190								<div class="type12" onclick="select_image(this.className);" title="Set-top Box"></div><!--untranslated-->
2191							</td>
2192							<td>
2193								<div class="type14" onclick="select_image(this.className);" title="iMac"></div><!--untranslated-->
2194							</td>
2195							<td>
2196								<div class="type15" onclick="select_image(this.className);" title="ROG"></div><!--untranslated-->
2197							</td>
2198							<td>
2199								<div class="type18" onclick="select_image(this.className);" title="Printer"></div><!--untranslated-->
2200							</td>
2201							<td>
2202								<div class="type19" onclick="select_image(this.className);" title="Windows Phone"></div><!--untranslated-->
2203							</td>
2204						</tr>
2205						<tr>
2206							<td>
2207								<div class="type20" onclick="select_image(this.className);" title="Android Tablet"></div><!--untranslated-->
2208							</td>
2209							<td>
2210								<div class="type21" onclick="select_image(this.className);" title="iPad"></div><!--untranslated-->
2211							</td>
2212							<td>
2213								<div class="type22" onclick="select_image(this.className);" title="Linux Device"></div><!--untranslated-->
2214							</td>
2215							<td>
2216								<div class="type23" onclick="select_image(this.className);" title="Smart TV"></div><!--untranslated-->
2217							</td>
2218							<td>
2219								<div class="type24" onclick="select_image(this.className);" title="Repeater"></div><!--untranslated-->
2220							</td>
2221							<td>
2222								<div class="type25" onclick="select_image(this.className);" title="Kindle"></div><!--untranslated-->
2223							</td>
2224							<td>
2225								<div class="type26" onclick="select_image(this.className);" title="Scanner"></div><!--untranslated-->
2226							</td>
2227						</tr>
2228						<tr>
2229							<td>
2230								<div class="type27" onclick="select_image(this.className);" title="Chromecast"></div><!--untranslated-->
2231							</td>
2232							<td>
2233								<div class="type28" onclick="select_image(this.className);" title="ASUS smartphone"></div><!--untranslated-->
2234							</td>
2235							<td>
2236								<div class="type29" onclick="select_image(this.className);" title="ASUS Pad"></div><!--untranslated-->
2237							</td>
2238							<td>
2239								<div class="type30" onclick="select_image(this.className);" title="Windows"></div><!--untranslated-->
2240							</td>
2241							<td>
2242								<div class="type31" onclick="select_image(this.className);" title="Android"></div><!--untranslated-->
2243							</td>
2244							<td>
2245								<div class="type32" onclick="select_image(this.className);" title="Mac OS"></div><!--untranslated-->
2246							</td>
2247							<td>
2248								<div id="divUserIcon" class="client_upload_div" style="display:none;">+
2249									<input type="file" name="uploadIcon" id="uploadIcon" class="client_upload_file" onchange="previewImage(this);" title="Upload client icon" /><!--untranslated-->
2250								</div>
2251							</td>
2252						</tr>
2253					</table>
2254		 		</div>	
2255			</td>
2256		</tr>
2257		<tr id="tr_adv_setting">
2258			<td colspan="3">
2259				<div class="clientList_line"></div>
2260				<div style="height:32px;width:100%;margin:5px 0;">
2261					<div style="width:65%;float:left;line-height:32px;">
2262						<span onmouseover="return overlib('Enable this button to block this device to access internet.');" onmouseout="return nd();">Block Internet Access<!--untranslated--></span>
2263					</div>
2264					<div class="left" style="cursor:pointer;float:right;" id="radio_BlockInternet_enable"></div>
2265				</div>
2266				<div class="clientList_line"></div>
2267				<div style="height:32px;width:100%;margin:5px 0;">
2268					<div style="width:65%;float:left;line-height:32px;">
2269						<span id="time_scheduling_title" onmouseover="return overlib('Time Scheduling allows you to set the time limit for a client\'s network usage.');" onmouseout="return nd();"><#Parental_Control#></span><!--untranslated-->
2270					</div>
2271					<div align="center" class="left" style="cursor:pointer;float:right;" id="radio_TimeScheduling_enable"></div>
2272					<div id="internetTimeScheduling" class="internetTimeEdit" style="float:right;margin-right:10px;" title="<#Time_Scheduling#>" onclick="redirectTimeScheduling();" ></div>
2273				</div>
2274				<div class="clientList_line"></div>
2275				<div style="height:32px;width:100%;margin:5px 0;">
2276					<div style="width:65%;float:left;line-height:32px;">
2277						<span onmouseover="return overlib('Enable this button to bind specific IP with MAC Address of this device.');" onmouseout="return nd();">MAC and IP address Binding<!--untranslated--></span>
2278					</div>
2279					<div align="center" class="left" style="cursor:pointer;float:right;" id="radio_IPBinding_enable" ></div>
2280				</div>
2281				<div class="clientList_line"></div>
2282			</td>
2283		</tr>
2284		<tr>
2285			<td colspan="3" style="text-align: center;">
2286				<input class="button_gen" type="button" onclick="edit_delete();" id="deleteBtn" value="<#CTL_del#>" style="display:none;">
2287				<input class="button_gen" type="button" id="blockBtn" value="<#Block#>" title="<#block_client#>" style="display:none;">
2288				<script>
2289					document.maclist_form.wl0_maclist_x.value = (function(){
2290						var wl0_maclist_x_array = '<% nvram_get("wl0_maclist_x"); %>'.split("&#60");
2291
2292						if(wl_info.band5g_support){
2293							'<% nvram_get("wl1_maclist_x"); %>'.split("&#60").forEach(function(element, index){
2294								if(wl0_maclist_x_array.indexOf(element) == -1) wl0_maclist_x_array.push(element);
2295							});
2296						}
2297
2298						if(wl_info.band5g_2_support){
2299							'<% nvram_get("wl2_maclist_x"); %>'.split("&#60").forEach(function(element, index){
2300								if(wl0_maclist_x_array.indexOf(element) == -1) wl0_maclist_x_array.push(element);
2301							});
2302						}
2303
2304						return wl0_maclist_x_array.join("<");
2305					})();
2306
2307					document.getElementById("blockBtn").onclick = function(){
2308						document.maclist_form.wl0_maclist_x.value = document.maclist_form.wl0_maclist_x.value + "<" + document.getElementById("macaddr_field").value;
2309						document.maclist_form.wl1_maclist_x.value = document.maclist_form.wl0_maclist_x.value;
2310						document.maclist_form.wl2_maclist_x.value = document.maclist_form.wl0_maclist_x.value;
2311						document.maclist_form.submit();
2312						hideEditBlock();
2313					}
2314				</script>
2315				<input class="button_gen" type="button" onclick="closeClientDetailView();" value="<#CTL_Cancel#>">
2316				<input id="edit_confirm" class="button_gen" type="button" onclick="edit_confirm();" value="<#CTL_apply#>">
2317				<img id="loadingIcon" style="margin-left:5px;display:none;" src="/images/InternetScan.gif">
2318			</td>
2319		</tr>
2320	</table>
2321</div>
2322<!-- End for Editing client list-->	
2323<table class="content" align="center" cellpadding="0" cellspacing="0">
2324  <tr>
2325	<td valign="top" width="17">&nbsp;</td>
2326		
2327		<!--=====Beginning of Main Menu=====-->
2328		<td valign="top" width="204">
2329			<div id="mainMenu"></div>
2330			<div id="subMenu"></div>
2331		</td>
2332		
2333		<td align="left" valign="top" class="bgarrow">
2334		
2335		<!--=====Beginning of Network Map=====-->
2336		<div id="tabMenu"></div><br>
2337		<div id="NM_shift" style="margin-top:-155px;"></div>
2338		<div id="NM_table" class="NM_table" >
2339		<div id="NM_table_div">
2340			<table id="_NM_table" border="0" cellpadding="0" cellspacing="0" height="720" style="opacity:.95;" >
2341				<tr>
2342					<td width="40px" rowspan="11" valign="center"></td>
2343					<!--== Dual WAN ==-->
2344					<td id="primary_wan_icon" width="160px;" height="155" align="center" class="NM_radius" valign="middle" bgcolor="#444f53" onclick="showstausframe('Internet_primary');" style="display:none">
2345						<a href="/device-map/internet.asp" target="statusframe"><div id="iconInternet_primary" onclick="clickEvent(this);"></div></a>
2346						<div id="first_wan_title"><#dualwan_primary#>:</div>
2347						<div><strong id="primary_status"></strong></div>
2348					</td>
2349					<td id="dual_wan_gap" width="40px" style="display:none">
2350					</td>
2351					<td id="secondary_wan_icon" width="160px;" height="155" align="center" class="NM_radius" valign="middle" bgcolor="#444f53" onclick="showstausframe('Internet_secondary');" style="display:none">
2352						<a href="/device-map/internet.asp" target="statusframe"><div id="iconInternet_secondary" onclick="clickEvent(this);"></div></a>
2353						<div id="second_wan_title"><#dualwan_secondary#>:</div>
2354						<div><strong id="seconday_status"></strong></div>
2355					</td>
2356					<!--== single WAN ==-->
2357					<td id="single_wan_icon" height="115" align="right" class="NM_radius_left" valign="middle" bgcolor="#444f53" onclick="showstausframe('Internet');" >
2358						<a href="/device-map/internet.asp" target="statusframe"><div id="iconInternet" onclick="clickEvent(this);"></div></a>
2359					</td>
2360					<td id="single_wan_status" colspan="2" valign="middle" bgcolor="#444f53" class="NM_radius_right" onclick="" style="padding:5px;cursor:auto;width:180px;">
2361						<div>
2362							<span id="NM_connect_title" style="font-size:12px;font-family: Verdana, Arial, Helvetica, sans-serif;"><#statusTitle_Internet#>:</span>
2363							<br>
2364							<strong id="NM_connect_status" class="index_status" style="font-size:14px;"><#QIS_step2#>...</strong>
2365						</div>
2366						<div id="wanIP_div" style="margin-top:5px;">
2367							<span style="font-size:12px;font-family: Verdana, Arial, Helvetica, sans-serif;">WAN IP:</span>
2368							<strong id="index_status" class="index_status" style="font-size:14px;"></strong>
2369						</div>
2370						<div id="ddnsHostName_div" style="margin-top:5px;word-break:break-all;word-wrap:break-word;width:180px;">
2371							<span style="font-size:12px;font-family: Verdana, Arial, Helvetica, sans-serif;">DDNS:</span>
2372							<strong id="ddnsHostName" class="index_status" style="font-size:14px;"><#QIS_detectWAN_desc2#></strong>
2373							<span id="ddns_fail_hint" class="notificationoff" onClick="show_ddns_fail_hint();" onMouseOut="nd();"></span>
2374						</div>
2375						<div id="wlc_band_div" style="margin-top:5px;display:none">
2376							<span style="font-size:14px;font-family: Verdana, Arial, Helvetica, sans-serif;"><#Interface#>:</span>
2377							<strong id="wlc_band_status" class="index_status" style="font-size:14px;"></strong>
2378						</div>
2379						<div id="dataRate_div" style="margin-top:5px;display:none">
2380							<span style="font-size:14px;font-family: Verdana, Arial, Helvetica, sans-serif;">Link rate:</span>
2381							<strong id="speed_status" class="index_status" style="font-size:14px;"></strong>
2382						</div>
2383						
2384					</td>
2385					<td width="40px" rowspan="11" valign="top">
2386						<div class="statusTitle" id="statusTitle_NM">
2387							<div id="helpname" style="padding-top:10px;font-size:16px;"></div>
2388						</div>							
2389						<div>
2390							<iframe id="statusframe" class="NM_radius_bottom" style="margin-left:45px;margin-top:-2px;" name="statusframe" width="320" height="735" frameborder="0" allowtransparency="true" style="background-color:transparent; margin-left:10px;" src="device-map/router.asp"></iframe>
2391						</div>
2392					</td>	
2393				</tr>			
2394				<tr>
2395					<!--==line of dual wan==-->
2396					<td id="primary_wan_line"  height="40px" style="display:none;">
2397						<div id="primary_line" class="primary_wan_connected"></div>
2398					</td>
2399					<td id="secondary_wan_line" colspan="2" height="40px"  style="display:none;">
2400						<div id="secondary_line" class="secondary_wan_connected"></div>
2401					</td>
2402					<!--==line of single wan==-->
2403					<td id="single_wan_line" colspan="3" align="center" height="19px">
2404						<div id="single_wan" class="single_wan_connected"></div>
2405					</td>
2406				</tr>			
2407				<tr>
2408					<td height="115" align="right" bgcolor="#444f53" class="NM_radius_left" onclick="showstausframe('Router');">
2409						<a href="device-map/router.asp" target="statusframe"><div id="iconRouter" onclick="clickEvent(this);"></div></a>
2410					</td>
2411					<td colspan="2" valign="middle" bgcolor="#444f53" class="NM_radius_right" onclick="showstausframe('Router');">
2412						<div>
2413						<span id="SmartConnectName" style="font-size:14px;font-family: Verdana, Arial, Helvetica, sans-serif; display:none">Smart Connect Status: </span>
2414						</div>
2415						<div>
2416						<strong id="SmartConnectStatus" class="index_status" style="font-size:14px; display:none"><a style="color:#FFF;text-decoration:underline;" href="/
2417						Advanced_Wireless_Content.asp">On</a></strong>
2418						</div>
2419
2420						<div id="wlSecurityContext">
2421							<span style="font-size:14px;font-family: Verdana, Arial, Helvetica, sans-serif;"><#Security_Level#>: </span>
2422							<br/>  
2423							<strong id="wl_securitylevel_span" class="index_status"></strong>
2424							<img id="iflock">
2425						</div>
2426
2427						<div id="mbModeContext" style="display:none">
2428							<span style="font-size:14px;font-family: Verdana, Arial, Helvetica, sans-serif;"><#menu5_6_1#>: </span>
2429							<br/>
2430							<br/>
2431							<strong class="index_status"><#OP_MB_item#></strong>
2432						</div>
2433					</td>
2434
2435				</tr>			
2436				<tr>
2437					<td id="line3_td" colspan="3" align="center" height="52px">
2438					<img id="line3_img" src="/images/New_ui/networkmap/line_two.png">
2439					</td>
2440				</tr>
2441				<tr>
2442					<td id="clients_td" height="170" width="150" bgcolor="#444f53" align="center" valign="top" class="NM_radius" style="padding-bottom:15px;">
2443						<div id="clientsContainer" onclick="showstausframe('Client');">
2444							<a id="clientStatusLink" href="device-map/clients.asp" target="statusframe">
2445							<div id="iconClient" style="margin-top:20px;" onclick="clickEvent(this);"></div>
2446							</a>
2447							<div class="clients" id="clientNumber" style="cursor:pointer;"></div>
2448						</div>
2449						<input type="button" class="button_gen" value="View List" style="margin-top:15px;" onClick="pop_clientlist_listview(true)">
2450						<!--div id="" onclick="">
2451							<img style="margin-top:15px;width:150px;height:2px" src="/images/New_ui/networkmap/linetwo2.png">
2452							<a id="" href="device-map/clients.asp" target="statusframe">
2453							<div id="iconClient" style="margin-top:20px;" onclick=""></div>
2454							</a>
2455							<div class="clients" id="" style="cursor:pointer;">Wireless Clients:</div>
2456						</div-->
2457					</td>
2458
2459					<td width="36" rowspan="6" id="clientspace_td"></td>
2460
2461					<td id="usb_td" width="160" bgcolor="#444f53" align="center" valign="top" class="NM_radius" style="padding-bottom:5px;">
2462						<div id="usbPathContainer_1" style="display:none">
2463							<div style="margin-top:20px;margin-bottom:10px;" id="deviceIcon_1"></div>
2464							<div><img id="usb1_image" src="images/New_ui/networkmap/USB2.png"></div>
2465							<div style="margin:10px 0px;">
2466								<span id="deviceText_1"></span>
2467								<select id="deviceOption_1" class="input_option" style="display:none;height:20px;width:130px;font-size:12px;"></select>	
2468							</div>
2469							<div id="deviceDec_1"></div>
2470						</div>
2471						<div id="usbPathContainer_2" style="display:none">
2472							<img style="margin-top:5px;width:150px;height:2px" src="/images/New_ui/networkmap/linetwo2.png">
2473							<div style="margin-top:15px;margin-bottom:10px;" id="deviceIcon_2"></div>
2474							<div><img id="usb2_image" src="images/New_ui/networkmap/USB2.png"></div>
2475							<div style="margin:10px 0px;">
2476								<span id="deviceText_2"></span>
2477								<select id="deviceOption_2" class="input_option" style="display:none;height:20px;width:130px;font-size:12px;"></select>	
2478							</div>						
2479							<div id="deviceDec_2"></div>
2480						</div>
2481					</td>
2482				</tr>
2483				<tr>
2484					<td id="space_block" colspan="3" align="center" height="150px" style="display:none;"></td>
2485				</tr>
2486			</table>
2487		</div>
2488	</div>
2489<!--==============Ending of hint content=============-->
2490  </tr>
2491</table>
2492<div id="navtxt" class="navtext" style="position:absolute; top:50px; left:-100px; visibility:hidden; font-family:Arial, Verdana"></div>
2493<div id="footer"></div>
2494<select id="bgimg" onChange="customize_NM_table(this.value);" class="input_option_left" style="display:none;">
2495	<option value="wall0.gif">dark</option>
2496	<option value="wall1.gif">light</option>
2497</select>		
2498
2499<script>
2500	if(flag == "Internet" || flag == "Client")
2501		document.getElementById("statusframe").src = "";
2502
2503	initial();
2504
2505	document.getElementById('deviceOption_1').onchange = function(){
2506	 	require(['/require/modules/diskList.js'], function(diskList){
2507	 		diskList.update(function(){
2508		 		var usbDevicesList = diskList.list();
2509				show_USBDevice(usbDevicesList[document.getElementById('deviceOption_1').value]);
2510				setSelectedDiskOrder('iconUSBdisk_1');
2511
2512				if(usbDevicesList[document.getElementById('deviceOption_1').value].deviceType == "modem")
2513					clickEvent(document.getElementById('iconModem_1'));
2514				else if(usbDevicesList[document.getElementById('deviceOption_1').value].deviceType == "printer")
2515					clickEvent(document.getElementById('iconPrinter_1'));
2516				else
2517					clickEvent(document.getElementById('iconUSBdisk_1'));
2518			});
2519		});
2520	}
2521
2522	document.getElementById('deviceOption_2').onchange = function(){
2523	 	require(['/require/modules/diskList.js'], function(diskList){
2524	 		diskList.update(function(){
2525		 		var usbDevicesList = diskList.list();
2526				show_USBDevice(usbDevicesList[document.getElementById('deviceOption_2').value]);
2527				setSelectedDiskOrder('iconUSBdisk_2');
2528
2529				if(usbDevicesList[document.getElementById('deviceOption_2').value].deviceType == "modem")
2530					clickEvent(document.getElementById('iconModem_2'));
2531				else if(usbDevicesList[document.getElementById('deviceOption_2').value].deviceType == "printer")
2532					clickEvent(document.getElementById('iconPrinter_2'));
2533				else
2534					clickEvent(document.getElementById('iconUSBdisk_2'));
2535			});
2536		});
2537	}
2538
2539	var manualUpdate = false;
2540	if(parseInt((JS_timeObj.getTime()-cookie.get("nwmapRefreshTime"))/60000) > 1){
2541		setTimeout(function(){
2542			var local_mac = '<% nvram_get("lan_hwaddr"); %>';
2543			cookie.set("wireless_list_" + local_mac + "_temp", cookie.get("wireless_list_" + local_mac));
2544			cookie.unset("wireless_list_" + local_mac);
2545			document.networkmapdRefresh.submit();
2546		}, 3500);
2547	}
2548	cookie.set("nwmapRefreshTime", JS_timeObj.getTime(), 1);
2549</script>
2550</body>
2551</html>
2552