1// JavaScript Document
2var winH,winW; //瀏覽器內容的長與寬,判斷遮罩大小使用
3var timeout = 0;
4var progress = 0;
5
6function winW_H(){
7	if(parseInt(navigator.appVersion) > 3){
8		winW = document.documentElement.scrollWidth;
9		if(document.documentElement.clientHeight > document.documentElement.scrollHeight)
10			winH = document.documentElement.clientHeight;
11		else
12			winH = document.documentElement.scrollHeight;
13	}
14}
15
16function LoadingTime(seconds, flag){
17	showtext($("proceeding_main_txt"), "<#Main_alert_proceeding_desc1#>...");
18	$("Loading").style.visibility = "visible";
19
20	y = y+progress;
21	if(typeof(seconds) == "number" && seconds >= 0){
22		if(seconds != 0){
23			showtext($("proceeding_main_txt"), "<#Main_alert_proceeding_desc4#>");
24			showtext($("proceeding_txt"), Math.round(y)+"% <#Main_alert_proceeding_desc1#>");
25			--seconds;
26			timeout = setTimeout("LoadingTime("+seconds+", '"+flag+"');", 1000);
27		}
28		else{
29			showtext($("proceeding_main_txt"), translate("<#Main_alert_proceeding_desc3#>"));
30			showtext($("proceeding_txt"), "");
31			y = 0;
32
33			if(flag != "waiting")
34				timeout = setTimeout("hideLoading();",1000);
35		}
36	}
37}
38function LoadingProgress(seconds){
39	$("LoadingBar").style.visibility = "visible";
40
41	y = y+progress;
42	if(typeof(seconds) == "number" && seconds >= 0){
43		if(seconds != 0){
44			$("proceeding_img").style.width = Math.round(y) + "%";
45			$("proceeding_img_text").innerHTML = Math.round(y) + "%";
46			--seconds;
47			timeout = setTimeout("LoadingProgress("+seconds+");", 1000);
48		}
49		else{
50			$("proceeding_img_text").innerHTML = "<#Main_alert_proceeding_desc3#>";
51			y = 0;
52			timeout = setTimeout("hideLoadingBar();",1000);
53			location.href = "/";
54		}
55	}
56}
57
58function showLoading(seconds, flag){
59	if(location.pathname.indexOf("QIS_wizard.htm") < 0){
60		disableCheckChangedStatus();
61		hideHint();
62		clearHintTimeout();
63	}
64
65	clearTimeout(timeout);
66
67	htmlbodyforIE = document.getElementsByTagName("html");  //this both for IE&FF, use "html" but not "body" because <!DOCTYPE html PUBLIC.......>
68	htmlbodyforIE[0].style.overflow = "hidden";	  //hidden the Y-scrollbar for preventing from user scroll it.
69
70	winW_H();
71	var blockmarginTop;
72	blockmarginTop = document.documentElement.scrollTop + 200;
73	$("loadingBlock").style.marginTop = blockmarginTop+"px"
74	$("Loading").style.width = winW+"px";
75	$("Loading").style.height = winH+"px";
76
77	loadingSeconds = seconds;
78	if(seconds > 0)
79		progress = 100/loadingSeconds;
80	else
81		progress = 100;
82	y = 0;
83
84	LoadingTime(seconds, flag);
85}
86
87function dr_advise(){
88	disableCheckChangedStatus();
89
90	clearHintTimeout();
91
92	htmlbodyforIE = document.getElementsByTagName("html");  //this both for IE&FF, use "html" but not "body" because <!DOCTYPE html PUBLIC.......>
93	htmlbodyforIE[0].style.overflow = "hidden";	  //hidden the Y-scrollbar for preventing from user scroll it.
94
95	winW_H();
96	var blockmarginTop;
97	blockmarginTop = document.documentElement.scrollTop + 200;
98	$("dr_sweet_advise").style.marginTop = blockmarginTop+"px"
99	$("hiddenMask").style.width = winW+"px";
100	$("hiddenMask").style.height = winH+"px";
101	$("hiddenMask").style.visibility = "visible";
102}
103
104function showLoadingBar(seconds){
105	if(location.pathname.indexOf("QIS_wizard.htm") < 0){
106		disableCheckChangedStatus();
107		hideHint();
108		clearHintTimeout();
109	}
110
111	clearTimeout(timeout);
112
113	htmlbodyforIE = document.getElementsByTagName("html");  //this both for IE&FF, use "html" but not "body" because <!DOCTYPE html PUBLIC.......>
114	htmlbodyforIE[0].style.overflow = "hidden";	  //hidden the Y-scrollbar for preventing from user scroll it.
115
116	winW_H();
117	var blockmarginTop;
118	blockmarginTop = document.documentElement.scrollTop + 200;
119	$("loadingBarBlock").style.marginTop = blockmarginTop+"px";
120	$("LoadingBar").style.width = winW+"px";
121	$("LoadingBar").style.height = winH+"px";
122
123	loadingSeconds = seconds;
124	if(seconds > 0)
125		progress = 100/loadingSeconds;
126	else
127		progress = 100;
128	y = 0;
129
130	LoadingProgress(seconds);
131}
132
133function hideLoadingBar(flag){
134	if(flag != "noDrSurf")
135		enableCheckChangedStatus();
136
137	$("LoadingBar").style.visibility = "hidden";
138}
139
140function hideLoading(flag){
141	if(flag != "noDrSurf")
142		enableCheckChangedStatus();
143
144	$("Loading").style.visibility = "hidden";
145}
146
147function simpleSSID(obj){
148	var SSID = document.loginform.wl_ssid.value;
149
150	if(SSID.length < 16)
151		showtext(obj, SSID);
152	else{
153		obj.title = SSID;
154		showtext(obj, SSID.substring(0, 16)+"...");
155	}
156}
157