1<html xmlns="http://www.w3.org/1999/xhtml">
2<head>     
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
5<meta HTTP-EQUIV="Expires" CONTENT="-1">
6<link type="text/css" rel="stylesheet" href="/form_style.css">
7<link type="text/css" rel="stylesheet" href="qis_style.css">
8
9<script type="text/javascript" src="/state.js"></script>
10<script type="text/javascript" src="/general.js"></script>
11<script type="text/javascript" src="/js/ex_overlib.js"></script>
12<script type="text/javascript">
13var wl_wpa_psk_org = '<% nvram_char_to_ascii("WLANConfig11b", "wl_wpa_psk"); %>';
14var wl_key1_org = '<% nvram_char_to_ascii("WLANConfig11b", "wl_key1"); %>';
15var wl_key2_org = '<% nvram_char_to_ascii("WLANConfig11b", "wl_key2"); %>';
16var wl_key3_org = '<% nvram_char_to_ascii("WLANConfig11b", "wl_key3"); %>';
17var wl_key4_org = '<% nvram_char_to_ascii("WLANConfig11b", "wl_key4"); %>';
18
19function QKWireless_load_body(){
20	parent.document.title = "ASUS Wireless Router <#Web_Title#> - <#QKSet_wireless_webtitle#>";
21	hideLinkTag();
22	flash_button();
23	
24	document.form.wl_ssid.value = decodeURIComponent(document.form.wl_ssid2.value);
25	document.form.wl_wpa_psk.value = decodeURIComponent(wl_wpa_psk_org);
26	document.form.wl_key1.value = decodeURIComponent(wl_key1_org);
27	document.form.wl_key2.value = decodeURIComponent(wl_key2_org);
28	document.form.wl_key3.value = decodeURIComponent(wl_key3_org);
29	document.form.wl_key4.value = decodeURIComponent(wl_key4_org);
30	
31	if(document.form.wl_wpa_psk.value.length <= 0)
32		document.form.wl_wpa_psk.value = "Please type Password";
33	
34	if(isModel() == "SnapAP" || isCard() == 'ralink')
35		wl_auth_mode_reconf();
36	
37	wl_auth_mode_change(1);
38	
39	show_prev_button();
40}
41
42function wl_auth_mode_change(isload){
43	var mode = document.form.wl_auth_mode.value;
44	var opts = document.form.wl_auth_mode.options;
45	var new_array;
46	var cur_crypto;
47	var cur_key_index, cur_key_obj;
48	
49	if(mode == "open" || mode == "shared"){
50		blocking("all_related_wep", 1);
51		
52		change_wep_type(mode);
53	}
54	else{
55		if(mode == "radius")
56			change_wep_type(mode);
57		
58		blocking("all_related_wep", 0);
59	}
60	
61	/* enable/disable crypto algorithm */
62	if(mode == "wpa" || mode == "wpa2" || mode == "psk")
63		$("wl_crypto").style.display = "";
64	else
65		blocking("wl_crypto", 0);
66	
67	/* enable/disable psk passphrase */
68	if(mode == "psk")
69		blocking("wl_wpa_psk", 1);
70	else
71		blocking("wl_wpa_psk", 0);
72	
73	/* update wl_crypto */
74	for(var i = 0; i < document.form.wl_crypto.length; ++i)
75		if(document.form.wl_crypto[i].selected){
76			cur_crypto = document.form.wl_crypto[i].value;
77			break;
78		}
79	
80	/* Reconstruct algorithm array from new crypto algorithms */
81	if(mode == "psk"){
82		/* Save current crypto algorithm */
83		if(isModel() == "SnapAP" || isBand() == 'b')
84			new_array = new Array("TKIP");
85		else{
86			if(opts[opts.selectedIndex].text == "WPA-Personal")
87				new_array = new Array("TKIP");
88			else if(opts[opts.selectedIndex].text == "WPA2-Personal")
89				new_array = new Array("AES");
90			else
91				new_array = new Array("TKIP", "AES", "TKIP+AES");
92		}
93		
94		free_options(document.form.wl_crypto);
95		for(var i in new_array){
96			document.form.wl_crypto[i] = new Option(new_array[i], new_array[i].toLowerCase());
97			document.form.wl_crypto[i].value = new_array[i].toLowerCase();
98			if(new_array[i].toLowerCase() == cur_crypto)
99				document.form.wl_crypto[i].selected = true;
100		}
101	}
102	else if(mode == "wpa"){
103		if(opts[opts.selectedIndex].text == "WPA-Enterprise")
104			new_array = new Array("TKIP");
105		else
106			new_array = new Array("TKIP", "AES", "TKIP+AES");
107		
108		free_options(document.form.wl_crypto);
109		for(var i in new_array){
110			document.form.wl_crypto[i] = new Option(new_array[i], new_array[i].toLowerCase());
111			document.form.wl_crypto[i].value = new_array[i].toLowerCase();
112			if(new_array[i].toLowerCase() == cur_crypto)
113				document.form.wl_crypto[i].selected = true;
114		}
115	}
116	else if(mode == "wpa2"){
117		new_array = new Array("AES");
118		
119		free_options(document.form.wl_crypto);
120		for(var i in new_array){
121			document.form.wl_crypto[i] = new Option(new_array[i], new_array[i].toLowerCase());
122			document.form.wl_crypto[i].value = new_array[i].toLowerCase();
123			if(new_array[i].toLowerCase() == cur_crypto)
124				document.form.wl_crypto[i].selected = true;
125		}
126	}
127	
128	/* Save current network key index */
129	for(var i = 0; i < document.form.wl_key.length; ++i)
130		if(document.form.wl_key[i].selected){
131			cur_key_index = document.form.wl_key[i].value;
132			break;
133		}
134	
135	/* Define new network key indices */
136	if(mode == "psk" || mode == "wpa" || mode == "wpa2")
137		new_array = new Array("2", "3");
138	else{
139		new_array = new Array("1", "2", "3", "4");
140		
141		if(!isload)
142			cur_key_index = "1";
143	}
144	
145	/* Reconstruct network key indices array from new network key indices */
146	free_options(document.form.wl_key);
147	for(var i in new_array){
148		document.form.wl_key[i] = new Option(new_array[i], new_array[i]);
149		document.form.wl_key[i].value = new_array[i];
150		if(new_array[i] == cur_key_index)
151			document.form.wl_key[i].selected = true;
152	}
153	
154	wl_wep_change();
155}
156
157function change_wep_type(mode){
158	var cur_wep = document.form.wl_wep_x.value;
159	var wep_type_array;
160	var value_array;
161	
162	free_options(document.form.wl_wep_x);
163	
164	if(mode == "shared" || mode == "radius"){
165		wep_type_array = new Array("WEP-64bits", "WEP-128bits");
166		value_array = new Array("1", "2");
167	}
168	else{
169		wep_type_array = new Array("None", "WEP-64bits", "WEP-128bits");
170		value_array = new Array("0", "1", "2");
171	}
172	
173	add_options_x2(document.form.wl_wep_x, wep_type_array, value_array, cur_wep);
174	
175	if(mode == "psk" || mode == "wpa" || mode == "wpa2")
176		document.form.wl_wep_x.value = "0";
177	
178	change_wlweptype(document.form.wl_wep_x);
179}
180
181function change_wlweptype(wep_type_obj){
182	if(wep_type_obj.value == "0")
183		blocking("all_wep_key", 0);
184	else
185		blocking("all_wep_key", 1);
186	
187	wl_wep_change();
188}
189
190function wl_wep_change(){
191	var mode = document.form.wl_auth_mode.value;
192	var wep = document.form.wl_wep_x.value;
193	
194	blocking("wl_crypto", 0);
195	blocking("wl_wpa_psk", 0);
196		
197	if(mode == "psk" || mode == "wpa" || mode == "wpa2" || mode == "radius"){
198		if(mode != "radius")
199			blocking("wl_crypto", 1);
200		
201		if(mode == "psk")
202			blocking("wl_wpa_psk", 1);
203		
204		blocking("all_related_wep", 0);
205	}
206	else{
207		blocking("all_related_wep", 1);
208		
209		if(wep == "0")
210			blocking("all_wep_key", 0);
211		else{
212			blocking("all_wep_key", 1);
213			
214			show_key();
215		}
216	}
217	
218	change_key_des();
219}
220
221function change_key_des(){
222	var objs = getElementsByName_iefix("span", "key_des");
223	var wep_type = document.form.wl_wep_x.value;
224	var str = "";
225	
226	if(wep_type == "1")
227		str = " (<#WLANConfig11b_WEPKey_itemtype1#>)";
228	else if(wep_type == "2")
229		str = " (<#WLANConfig11b_WEPKey_itemtype2#>)";
230	
231	for(var i = 0; i < objs.length; ++i)
232		showtext(objs[i], str);
233}
234
235function change_auth_mode(auth_mode_obj){
236	wl_auth_mode_change(0);
237	
238	if(auth_mode_obj.value == "psk" || auth_mode_obj.value == "wpa"){
239		var opts = document.form.wl_auth_mode.options;
240		
241		if(opts[opts.selectedIndex].text == "WPA-Personal")
242			document.form.wl_wpa_mode.value = "1";
243		else if(opts[opts.selectedIndex].text == "WPA2-Personal")
244			document.form.wl_wpa_mode.value="2";
245		else if(opts[opts.selectedIndex].text == "WPA-Auto-Personal")
246			document.form.wl_wpa_mode.value="0";
247		else if(opts[opts.selectedIndex].text == "WPA-Enterprise")
248			document.form.wl_wpa_mode.value="3";
249		else if(opts[opts.selectedIndex].text == "WPA-Auto-Enterprise")
250			document.form.wl_wpa_mode.value = "4";
251		
252		if(auth_mode_obj.value == "psk"){
253			document.form.wl_wpa_psk.focus();
254			document.form.wl_wpa_psk.select();
255		}
256	}
257	else if(auth_mode_obj.value == "shared")
258		show_key();
259}
260
261function show_key(){
262	var wep_type = document.form.wl_wep_x.value;
263	var keyindex = document.form.wl_key.value;
264	var cur_key_obj = eval("document.form.wl_key"+keyindex);
265	var cur_key_length = cur_key_obj.value.length;
266	
267	if(wep_type == 1){
268		if(cur_key_length == 5 || cur_key_length == 10)
269			document.form.wl_asuskey1.value = cur_key_obj.value;
270		else
271			document.form.wl_asuskey1.value = "0000000000";
272	}
273	else if(wep_type == 2){
274		if(cur_key_length == 13 || cur_key_length == 26)
275			document.form.wl_asuskey1.value = cur_key_obj.value;
276		else
277			document.form.wl_asuskey1.value = "00000000000000000000000000";
278	}
279	else
280		document.form.wl_asuskey1.value = "";
281	
282	document.form.wl_asuskey1.focus();
283	document.form.wl_asuskey1.select();
284}
285
286function submitForm(){
287	var auth_mode = document.form.wl_auth_mode.value;
288	
289	if(!validate_string_ssid(document.form.wl_ssid))
290		return false;
291	document.form.wl_ssid2.value = encodeURIComponent(document.form.wl_ssid.value);
292	
293	if(auth_mode == "psk" || auth_mode == "wpa" || auth_mode == "wpa2"){
294		if(!validate_psk(document.form.wl_wpa_psk))
295			return false;
296	}
297	else{
298		if(auth_mode != "radius" && !validate_wlkey(document.form.wl_asuskey1))
299			return false;
300	}
301	
302	var wep11 = eval('document.form.wl_key'+document.form.wl_key.value);
303	wep11.value = document.form.wl_asuskey1.value;
304	
305	if((auth_mode == "shared" || auth_mode == "wpa" || auth_mode == "wpa2" || auth_mode == "radius")
306			&& document.form.wsc_mode.value == "enabled")
307		document.form.wsc_mode.value = "disabled";
308	
309	document.form.wan_nat_x.value = parent.document.QKform.wan_nat_x.value;
310	document.form.wan_route_x.value = parent.document.QKform.wan_route_x.value;
311	
312	parent.showLoading();
313	
314	document.form.target = "";
315	document.form.action_mode.value = " Apply ";
316	document.form.sid_list.value = "WLANConfig11b;LANHostConfig;IPConnection;PPPConnection;Layer3Forwarding;General;";
317	
318	document.form.next_page.value = "/QIS_wizard.htm";
319	document.form.flag.value = "finish";
320	
321	document.form.x_Setting.value = '1';
322	document.form.wsc_config_state.value = "1";
323	
324	if(document.form.wl_auth_mode.value == "wpa"
325			|| document.form.wl_auth_mode.value == "wpa2"
326			|| document.form.wl_auth_mode.value == "radius"){
327		document.form.next_page.value = "/Advanced_WSecurity_Content.asp";
328		parent.document.QKform.current_page.value = "";
329	}
330	
331	document.form.submit();	
332}
333
334function show_prev_button(){
335	if(parent.$("flag").value == "wireless"){
336		$("prevButton").value = '<#CTL_AdvSetting#>';
337		
338		document.form.prev_page.value = "/Advanced_Wireless_Content.asp";
339	}
340	else if(parent.$("flag").value == "bridge_mode")
341		document.form.prev_page.value = "/Advanced_OperationMode_Content.asp";
342}
343
344function show_hint(field_order){
345	if(field_order == 1)
346		return overlib("<#WLANConfig11b_SSID_itemdesc#>", LEFT);
347	else if(field_order == 2)
348		return overlib("<#WLANConfig11b_WEPDefaultKey_itemdesc#>", LEFT);
349	else if(field_order == 3)
350		return overlib("<#WLANConfig11b_x_PSKKey_itemdesc#>", LEFT);
351}
352</script>
353</head>
354
355<body onLoad="QKWireless_load_body();" onunload="no_flash_button();">
356<iframe name="hidden_frame" id="hidden_frame" width="0" height="0" frameborder="0"></iframe>
357<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
358
359<form method="post" name="form" action="/start_apply2.htm" target="">
360<input type="hidden" name="current_page" value="">
361<input type="hidden" name="next_page" value="">
362<input type="hidden" name="prev_page" value="QIS_internet_success.htm">
363<input type="hidden" name="flag" value="">
364
365<!--1008 Lock add-->
366<input type="hidden" name="x_Setting" value="">
367<input type="hidden" name="wsc_config_state" value="">
368<input type="hidden" name="wan_nat_x" value="">
369<input type="hidden" name="wan_route_x" value="">
370
371<input type="hidden" name="sid_list" value="WLANConfig11b;">
372<input type="hidden" name="group_id" value="">
373<input type="hidden" name="action_mode" value="">
374<input type="hidden" name="productid" value="<% nvram_get_x("",  "productid"); %>">
375
376<input type="hidden" name="wsc_mode" value="<% nvram_get_x("WLANConfig11b", "wsc_mode"); %>">
377<input type="hidden" name="wl_wpa_mode" value="<% nvram_get_x("WLANConfig11b",  "wl_wpa_mode"); %>">
378<input type="hidden" name="wl_key1" value="">
379<input type="hidden" name="wl_key2" value="">
380<input type="hidden" name="wl_key3" value="">
381<input type="hidden" name="wl_key4" value="">
382
383<input type="hidden" name="wl_ssid2" value="<% nvram_get_x("WLANConfig11b", "wl_ssid2"); %>">
384
385<div class="QISmain">
386<div class="description_down"><#QKSet_wireless_webtitle#></div>
387<br/><br/>
388<table class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
389   <tr>
390	<th width="180" onmouseout="return nd();" onmouseover="return show_hint(1);"><#WLANConfig11b_SSID_itemname#></th>
391	<td class="QISformtd">
392	  <input type="text" name="wl_ssid" onkeypress="return is_string(this);" class="input" maxlength="32" size="34" value="default"/>
393	</td>
394  </tr>
395  
396	<tr>
397		<th width="180"><#WLANConfig11b_AuthenticationMethod_itemname#></th>
398		<td class="QISformtd">
399			<select name="wl_auth_mode" onchange="change_auth_mode(this);" class="input">
400				<option value="open" <% nvram_match_x("WLANConfig11b","wl_auth_mode", "open","selected"); %>>Open System</option>
401				<option value="shared" <% nvram_match_x("WLANConfig11b","wl_auth_mode", "shared","selected"); %>>Shared Key</option>
402				<option value="psk" <% nvram_double_match_x("WLANConfig11b", "wl_auth_mode", "psk", "WLANConfig11b", "wl_wpa_mode", "1", "selected"); %>>WPA-Personal</option>
403				<option value="psk" <% nvram_double_match_x("WLANConfig11b", "wl_auth_mode", "psk", "WLANConfig11b", "wl_wpa_mode", "2", "selected"); %>>WPA2-Personal</option>
404				<option value="psk" <% nvram_double_match_x("WLANConfig11b", "wl_auth_mode", "psk", "WLANConfig11b", "wl_wpa_mode", "0", "selected"); %>>WPA-Auto-Personal</option>
405				<option value="wpa" <% nvram_double_match_x("WLANConfig11b", "wl_auth_mode", "wpa", "WLANConfig11b", "wl_wpa_mode", "3", "selected"); %>>WPA-Enterprise</option>
406				<option value="wpa2" <% nvram_match_x("WLANConfig11b", "wl_auth_mode", "wpa2", "selected"); %>>WPA2-Enterprise</option>
407				<option value="wpa" <% nvram_double_match_x("WLANConfig11b", "wl_auth_mode", "wpa", "WLANConfig11b", "wl_wpa_mode", "4", "selected"); %>>WPA-Auto-Enterprise</option>
408				<option value="radius" <% nvram_match_x("WLANConfig11b","wl_auth_mode", "radius","selected"); %>>Radius with 802.1x</option>
409			</select>
410		</td>
411	</tr>
412</table>
413
414<div id='all_related_wep' style='display:none'>
415<table class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
416  <tr>
417	<th width="180"><#WLANConfig11b_WEPType_itemname#></th>
418	<td class="QISformtd">
419	  <select name="wl_wep_x" onchange="change_wlweptype(this);" class="input">
420			<option value="0" <% nvram_match_x("WLANConfig11b", "wl_wep_x", "0", "selected"); %>>None</option>
421			<option value="1" <% nvram_match_x("WLANConfig11b", "wl_wep_x", "1", "selected"); %>>WEP-64bits</option>
422			<option value="2" <% nvram_match_x("WLANConfig11b", "wl_wep_x", "2", "selected"); %>>WEP-128bits</option>
423	  </select>
424	</td>
425  </tr>
426</table>
427
428<div id='all_wep_key' style='display:none;'>
429<table class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
430  <tr>
431	<th width="180" onmouseout="return nd();" onmouseover="return show_hint(2);"><#WLANConfig11b_WEPDefaultKey_itemname#></th>
432	<td class="QISformtd">
433	  <select name="wl_key" onchange="show_key();" class="input">
434			<option value="1" <% nvram_match_x("WLANConfig11b", "wl_key", "1", "selected"); %>>Key1</option>
435			<option value="2" <% nvram_match_x("WLANConfig11b", "wl_key", "2", "selected"); %>>Key2</option>
436			<option value="3" <% nvram_match_x("WLANConfig11b", "wl_key", "3", "selected"); %>>Key3</option>
437			<option value="4" <% nvram_match_x("WLANConfig11b", "wl_key", "4", "selected"); %>>Key4</option>
438	  </select>
439	</td>
440  </tr>
441  <tr>
442	<th width="180"><#WLANConfig11b_WEPKey_itemname#></th>
443	<td class="QISformtd">
444	  <input type="text" name="wl_asuskey1" value="" onKeyUp="return change_wlkey(this, 'WLANConfig11b');" maxlength="" size="34" class="input">
445	  <br/><span name="key_des" style="color:#FF3300; font-size:9px;"></span>
446	</td>
447  </tr>
448</table>
449</div>
450</div>
451
452<div id='wl_crypto' style='display:none;'>
453<table class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
454  <tr>
455	<th width="180"><#WLANConfig11b_WPAType_itemname#></th>
456	<td>
457	  <select name="wl_crypto" onchange="wl_auth_mode_change(0);" class="input">
458			<option value="tkip" <% nvram_match_x("WLANConfig11b", "wl_crypto", "tkip", "selected"); %>>TKIP</option>
459			<option value="aes" <% nvram_match_x("WLANConfig11b", "wl_crypto", "aes", "selected"); %>>AES</option>
460			<option value="tkip+aes" <% nvram_match_x("WLANConfig11b", "wl_crypto", "tkip+aes", "selected"); %>>TKIP+AES</option>
461	  </select>
462	</td>
463  </tr>
464</table>
465</div>
466
467<div id='wl_wpa_psk' style='display:none'>
468<table class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
469  <tr>
470	<th width="180" onmouseout="return nd();" onmouseover="return show_hint(3);"><#WLANConfig11b_x_PSKKey_itemname#></th>
471	<td class="QISformtd">
472	  <input type="text" name="wl_wpa_psk" value="" class="input" maxlength="64" size="34">
473	</td>
474  </tr>
475</table>
476</div>  
477
478</div>
479
480<div class='QISfoot'>
481  <input type='button' id="prevButton" value="<#CTL_prev#>" onclick="gotoprev(document.form);" class="sbtn">
482<td>&nbsp;</td>
483  <input type='button' value="<#QKSet_finishpre_rebootnow#>" onclick="submitForm();" class="sbtn">
484</div>
485
486</form>
487</body>
488