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="/qis/qis_style.css">
7<link type="text/css" rel="stylesheet" href="/form_style.css">
8<style>
9.test_css{
10	padding-left:10px;
11	font-size:13px;
12	font-weight:bolder;
13	color: #003399;
14	background-color:#C0DAE4;
15}
16</style>
17
18<script type="text/JavaScript" src="/state.js"></script>
19<script type="text/javascript">
20var flag = '<% get_parameter("flag"); %>';
21
22var new_ifWANConnect = 0;
23var new_wan_link_str = "";
24var detectType = "";
25var new_wan_status_log = "";
26
27var wantype = '<% nvram_get_x("Layer3Forwarding", "wan_proto"); %>';
28
29var MAX_proceeding = 10;
30var proceeding_time = 0;
31
32function QKDetect_load_body(){
33	parent.document.title = "ASUS Wireless Router <#Web_Title#> - <#QKSet_detect_sanglass#>";
34	hideLinkTag();
35	flash_button();
36	
37	if(flag == "verify_detect")
38		$("DETECT_TITLE").innerHTML = "<#QKSet_detect_desc2#>";
39	else
40		$("DETECT_TITLE").innerHTML = "<#QKSet_detect_desc1#>";
41	$("DETECT_TITLE").style.visibility = "visible";
42	
43	setTimeout("getWANStatus();", 1);
44}
45
46function getWANStatus(){
47	document.detectForm.action = "/result_of_get_changed_status_QIS.asp";
48	document.detectForm.target = "detect_frame";
49	
50	document.detectForm.submit();
51}
52
53function check_changed_status(){
54	if(this.new_ifWANConnect == 0){
55		faultstatus();
56		return;
57	}
58	
59	if(this.new_wan_link_str == "Disconnected"){
60		//if(this.wantype == "pppoe" && new_wan_status_log.indexOf("Failed to authenticate ourselves to peer") >= 0){
61		if((this.wantype == "pppoe" && new_wan_status_log.indexOf("Failed to authenticate ourselves to peer") >= 0)
62				|| (this.wantype != "pppoe" && this.detectType == "pppoe")){
63			successstatus();
64			return;
65		}
66		
67		++proceeding_time;
68		
69		if(proceeding_time < MAX_proceeding){
70			setTimeout("getWANStatus();", 1000);
71			$('proceeding_times').innerHTML = proceeding_time;
72			return;
73		}
74	}
75	
76	successstatus();
77}
78
79function set_changed_status(manually_stop_wan,
80														ifWANConnect,
81														wan_link_str,
82														detect_dhcp_pppoe,
83														wan_status_log
84														){
85	this.new_ifWANConnect = ifWANConnect;
86	this.new_wan_link_str = wan_link_str;
87	this.detectType = detect_dhcp_pppoe;
88	this.new_wan_status_log = wan_status_log;
89}
90
91function redirect_page(){
92	parent.document.QKform.wan_proto.value = wantype;
93	
94	gotoPage(document.detectForm.next_page.value);
95}
96
97function successstatus(){
98	if(new_wan_link_str == "Connected"){
99		this.flag = "";
100		
101		//document.detectForm.next_page.value = "/qis/QIS_internet_success.htm";
102		submitForm("/QIS_wizard.htm", "unset_default");
103		return;
104	}
105	else if(this.flag == "verify_detect"){
106		if(new_wan_status_log.indexOf("Failed to authenticate ourselves to peer") >= 0)
107			this.flag = wantype+"_wrong_input";
108		else
109			this.flag = wantype+"_wrong_response";
110		
111		document.detectForm.next_page.value = "/qis/QIS_internet_success.htm";
112	}
113	else if(detectType == "dhcp"){
114		if(wantype != "dhcp" && wantype != "static"){
115			wantype = "dhcp";
116			
117			document.detectForm.x_DHCPClient.value = "1";
118			document.detectForm.wan_dnsenable_x.value = "1";
119			
120			submitForm("/QIS_wizard.htm", "detect");
121			return;
122		}
123		else{
124			document.detectForm.flag.value = "auto_way";
125			
126			document.detectForm.action = "/qis/QIS_internet_ip.htm";
127			document.detectForm.target = "";
128			
129			document.detectForm.submit();
130			return;
131		}
132	}
133	else if(detectType == "pppoe"){
134		/*wantype = detectType;
135		
136		document.detectForm.next_page.value = "/qis/QIS_internet_account.htm";//*/
137		document.detectForm.flag.value = "auto_way_pppoe";
138		
139		document.detectForm.action = "/qis/QIS_internet_account.htm";
140		document.detectForm.target = "";
141		
142		document.detectForm.submit();
143		return;
144	}
145	else{
146		document.detectForm.flag.value = "auto_way_static";
147		
148		document.detectForm.action = "/qis/QIS_internet_ip.htm";
149		document.detectForm.target = "";
150		
151		document.detectForm.submit();
152		return;
153	}
154	
155	redirect_page();
156}
157
158function faultstatus(){
159	blocking('wanfault', true);
160	blocking('waitarea', false);
161	blocking('fresharea', true);
162	blocking('skiparea', false);
163}
164
165function APstatus(){
166	blocking('wanfault', false);
167	blocking('waitarea', false);
168	blocking('fresharea', false);
169	blocking('skiparea', false);
170	blocking('AParea', true);
171	
172	gotoPage(document.detectForm.next_page.value);
173}
174
175function gotoPage(destURL){
176	with(document.redirectForm){
177		action = destURL;
178		if(this.flag.length > 0)
179			flag.value = this.flag;
180		
181		submit();
182	}
183}
184
185function submitForm(nextPage, flag){
186	parent.showLoading();
187	
188	document.detectForm.action = "/start_apply.htm";
189	document.detectForm.target = "";
190	
191	document.detectForm.current_page.value = "";
192	document.detectForm.next_page.value = nextPage;
193	document.detectForm.sid_list.value = "Layer3Forwarding;IPConnection;General;";
194	document.detectForm.flag.value = flag;
195	
196	document.detectForm.action_mode.value = " Apply ";
197	document.detectForm.wan_proto.value = wantype;
198	
199	if(flag == "unset_default"){
200		document.detectForm.x_Setting.value = '1';
201		
202		//document.detectForm.action_script.value = "restart_lan";
203	}
204	else
205		document.detectForm.x_Setting.value = '<% nvram_get_x("General", "x_Setting"); %>';
206	
207	$("x_DHCPClient").disabled = false;
208	$("wan_dnsenable_x").disabled = false;
209	$("x_Setting").disabled = false;
210	
211	document.detectForm.submit();
212}
213</script>
214</head>
215
216<body onLoad="QKDetect_load_body();" onunload="no_flash_button();">
217<iframe name="detect_frame" id="detect_frame" src="" width=0 height=0 frameborder=0></iframe>
218
219<form method="post" name="detectForm" action="/result_of_get_changed_status_QIS.asp" target="">
220<input type="hidden" name="prev_page" value="QIS_detect.htm">
221<input type="hidden" name="current_page" value="/qis/QIS_detect.htm">
222<input type="hidden" name="next_page" value="">
223<input type="hidden" name="flag" value="verify_detect">
224<input type="hidden" name="sid_list" value="">
225<input type="hidden" name="action_mode" value="">
226<input type="hidden" name="action_script" value="">
227<input type="hidden" name="preferred_lang" value="<% nvram_get_x("","preferred_lang"); %>">
228
229<input type="hidden" name="wan_proto" value="">
230
231<input type="hidden" name="x_DHCPClient" id="x_DHCPClient" value="<% nvram_get_x("","x_DHCPClient"); %>" disabled>
232<input type="hidden" name="wan_dnsenable_x" id="wan_dnsenable_x" value="<% nvram_get_x("","wan_dnsenable_x"); %>" disabled>
233<input type="hidden" name="x_Setting" id="x_Setting" value="" disabled>
234
235<div class="QISmain">
236  <div id='waitarea'>
237  <div class="description_down" id="DETECT_TITLE" style="visibility:hidden;"></div>
238  <br/><br/>
239    <table id="tblsetting_1" class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
240	  <tr>
241		<td align="right">
242			<img src="/images/InternetScan.gif"></span>
243		</td>	  
244		<td class="test_css">
245			<strong><span><#QKSet_detect_waitdesc#></span></strong><br>
246			<#QKSet_detect_timedesc1#> <span id="proceeding_times">1</span> <#QKSet_detect_timedesc2#>
247		</td>
248	  </tr>
249    </table>
250  </div>
251  
252  <div id='AParea' style='display:none'>
253    <table id="tblsetting_2" class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
254	  <tr Height="50"><td></td></tr>
255	  <tr><td class="description_down"><#QKSet_detect_APdesc#></td></tr>
256	</table>
257  </div>
258  
259  <div id='wanfault' style='display:none'>
260   <div class="description_down"><#QKSet_detect_wanconnfault#></div>
261    <table id="tblsetting_3" class="QISform" width="400" border=0 align="center" cellpadding="5" cellspacing="0">
262	  <tr>
263    	<td align="center">
264    	  <img src="/images/WANunplug.gif" width="320" height="220" style="border:3px double #666;" />
265		</td>
266	  </tr>
267	</table>
268  </div>
269</div>
270
271<div id="fresharea" class='QISfoot' style="display:none"> 
272  <input type="button" class="button" width="72"  onclick="gotoPage('QIS_detect.htm');" value="<#QKSet_detect_freshbtn#>">
273  <input type="button" class="button" width="72"  onclick="parent.location.href='/';" value="<#CTL_Setting#>">
274</div>
275
276<div id="skiparea"  class="QISfoot">
277  <input type="button" class="sbtn" onclick="gotoPage('/qis/QIS_internet_type.htm');" value="<#QKSet_detect_skipbtn#>">
278</div>
279
280</form>
281
282<form method="post" name="redirectForm" action="">
283<input type="hidden" name="flag" value="">
284</form>
285</body>
286