PageSourceSearch

https://safetyhanoi.com/js/common.js

js safetyhanoi.com collected 2026-10-08 15:13:46 UTC 11,664 bytes, 308 lines download raw bytes

1<!--
2function remove_all_item(obj){
3		while(obj.length != 1){
4			obj.remove(1);
5		}
6		return true;	
7	}
8	function extract_number_on_string(str){
9		for(var i=0; i<str.length; i++){
10			var ch = str.charAt(i);
11			if((ch>=0)&&(ch<=9))
12				return str.substr(i,(str.length-i));
13		}
14		return 0;
15	}
16function windowupload_ext(revalto, folder){
17	var pathlink = 'imageup.php?revalto='+revalto+'&folder='+folder;
18	window_open(pathlink,300,300,'no','normal');
19}	
20function windowupload(revalto, folder){
21	var pathlink = 'admin/includes/imageup.php?revalto='+revalto+'&folder='+folder;
22	window_open(pathlink,300,300,'no','normal');
23}
24function createCookie(name,value,days) {
25	if (days) {
26		var date = new Date();
27		date.setTime(date.getTime()+(days*24*60*60*1000));
28		var expires = "; expires="+date.toGMTString();
29	}
30	else var expires = "";
31	document.cookie = name+"="+value+expires+"; path=/";
32}
33
34function readCookie(name) {
35	var nameEQ = name + "=";
36	var ca = document.cookie.split(';');
37	for(var i=0;i < ca.length;i++) {
38		var c = ca[i];
39		while (c.charAt(0)==' ') c = c.substring(1,c.length);
40		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
41	}
42	return null;
43}
44
45function eraseCookie(name) {
46	createCookie(name,"",-1);
47}
48var priority_value=0;
49function all_selection(textid){
50	var obj_arr = document.getElementById("report").getElementsByTagName("input");
51	for (var i=0; i < obj_arr.length; i++){
52		if(obj_arr[i].name == textid){
53			obj_arr[i].checked = true;
54		}
55	}
56}
57function is_selected(textid){
58	var ok=false;
59	var obj_arr = document.getElementById("report").getElementsByTagName("input");
60	for (var i=0; i < obj_arr.length; i++){
61		if((obj_arr[i].name == textid)&&(obj_arr[i].checked == true))
62			return true;
63	}
64	return false;
65}
66function reset_priority_values(){
67	document.frm.reset();
68	priority_value = 0;
69	var obj_arr = document.getElementById("report").getElementsByTagName("input");
70	for (var i=0; i < obj_arr.length; i++){
71		if((obj_arr[i].name == "PRID[]")){
72			var id = obj_arr[i].value;
73			var obj = document.getElementById("PRVAL"+id);
74			if(obj.disabled == false)
75				obj.disabled = true;
76		}
77	}
78}
79function default_priority_values(){
80	priority_value = 0;
81	var obj_arr = document.getElementById("report").getElementsByTagName("input"); //DynamicDrive.com change
82	for (var i=0; i < obj_arr.length; i++){
83		if(obj_arr[i].name == "PRID[]"){
84			var id =obj_arr[i].value; 
85			document.getElementById("PRVAL"+id).value = document.frm.total.value;
86		}
87
88		if(obj_arr[i].name == "PRID[]")
89			obj_arr[i].checked= false;
90	}
91}
92function priority_selection(obj){
93	var id = obj.value;
94	if(obj.checked == true){
95		priority_value++;
96		priority_value_old = document.getElementById("PRVAL"+id).value;
97		document.getElementById("PRVAL"+id).value = priority_value;
98		document.getElementById("PRVAL"+id).disabled = false;
99	}
100	else{
101		if(priority_value > 0)
102			priority_value--;
103		document.getElementById("PRVAL"+id).value = document.frm.total.value;		
104		document.getElementById("PRVAL"+id).disabled = true;
105	}	
106}
107
108function value_priority_exits(obj){
109	var pos=0;
110	var msg = '';
111	var dup = false;
112	var obj_arr = document.getElementById("report").getElementsByTagName("input"); //DynamicDrive.com change
113	for (var i=0; i < obj_arr.length; i++){
114		if(obj_arr[i].name.substr(0,5) == "PRVAL"){
115			pos++;
116			if((obj.name != obj_arr[i].name)&&(parseInt(obj.value)== parseInt(obj_arr[i].value))){
117				msg += pos + ', ';
118				dup=true;
119			}
120		}		
121	}
122	if(dup==true)
123		alert(msg.substr(0,msg.length-2));
124	return msg;	
125}
126var last_click;             // zuletzt angeklickter Button
127var windows = new Array();  // Array mit Win-Objekten
128function button_mouse_overme(obj){
129	obj.className='mybutton_over';
130}
131function button_mouse_outme(obj){
132	obj.className='mybutton';
133}
134function set_over(obj) {
135   document.getElementById(obj).style.borderTopColor = "white";
136   document.getElementById(obj).style.borderLeftColor = "white";
137   document.getElementById(obj).style.borderBottomColor = "black";
138   document.getElementById(obj).style.borderRightColor = "black";
139}
140
141function set_out(obj) {
142   document.getElementById(obj).style.borderColor = "black";
143}
144function set_outh(obj) {
145   document.getElementById(obj).style.borderColor = "ButtonFace";
146}
147
148function set_click(obj)
149{
150   document.getElementById(obj).style.borderTopColor = "black";
151   document.getElementById(obj).style.borderLeftColor = "black";
152   document.getElementById(obj).style.borderBottomColor = "white";
153   document.getElementById(obj).style.borderRightColor = "white";
154   elem1 = document.getElementById(last_click);
155   if (elem1) elem1.style.fontWeight = "normal";
156   last_click = obj;
157   document.getElementById(obj).style.fontWeight = "bold";
158}
159
160function Win(ref, posx, posy) {
161   this.ref  = ref;
162   this.posx = posx;
163   this.posy = posy;
164}
165
166function check_windows() {
167   var windows_new = new Array();
168   var i;
169   for (i=0; i<windows.length; i++)
170   {
171    var found = false;
172    try{
173        if(!windows[i].ref.closed)
174            found = true;
175    }
176    catch(e){
177        found = false;
178    }
179    if (found && windows[i] && windows[i].ref && !windows[i].ref.closed) {
180         windows_new.push(windows[i]);
181         windows[i].ref.focus();
182      }
183   }
184   windows = windows_new;
185}
186
187function window_open(url, w_width, w_height, scroll, type) {
188   var proper;
189   var posx;
190   var posy;
191   check_windows();
192   var ind = windows.length - 1;
193   if (windows[ind]) {
194      posx = windows[ind].posx + 20;
195      posy = windows[ind].posy + 20;
196   }
197   else {
198      posx = (screen.width - w_width) / 2;
199      posy = (screen.height - w_height) / 2 - 30;
200   }
201   if (type == 'resizeable')  proper = 'titlebar=no,toolbar=yes,menubar=no,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=yes,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
202   if (type == 'normal')      proper = 'titlebar=no,toolbar=no,menubar=no,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
203   if (type == 'menu')        proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
204   if (type == 'mresizeable') proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=yes,left='+posx+',top='+posy+',screenX='+posx+',screenY='+posy;
205   if (type == 'minimized')   proper = 'titlebar=no,toolbar=no,menubar=yes,scrollbars='+scroll+',width='+w_width+',height='+w_height+',resizable=no,left='+screen.width+',top='+screen.height+',screenX='+screen.width+',screenY='+screen.height;
206   
207   var win_ref;
208   win_ref = window.open(url, '', proper);
209   if (win_ref) {
210      var tmp;
211	  tmp = new Win(win_ref, posx, posy);
212      windows.push(tmp);
213      win_ref.focus();
214   }
215   return win_ref;
216}
217
218function modal_open(url, w_width, w_height, scroll, type) {
219	var proper;	
220   if (type == 'normal')     proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:no;scroll:'+scroll+';status:no;';
221   if (type == 'resizeable') proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:yes;scroll:'+scroll+';status:no;';
222   window.showModalDialog(url, window, proper);
223}
224
225function modless_open(url, w_width, w_height, scroll, type) {
226	var proper;
227   if (type == 'normal')     proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:no;scroll:'+scroll+';status:no;';
228   if (type == 'resizeable') proper = 'dialogHeight:'+w_height+'px;dialogWidth:'+w_width+'px;center:yes;edge:raised;help:no;resizable:yes;scroll:'+scroll+';status:no;';
229   window.showModalDialog(url, window, proper);
230}
231
232
233function vntext(st)
234{
235var Rex = ["&#224;","&#7843;","&#227;","&#225;","&#7841;","&#259;","&#7857;","&#7859;","&#7861;","&#7855;","&#7863;","&#226;","&#7847;","&#7849;","&#7851;","&#7845;","&#7853;","&#273;","&#232;","&#7867;","&#7869;","&#233;","&#7865;","&#234;","&#7873;","&#7875;","&#7877;","&#7871;","&#7879;","&#236;","&#7881;","&#297;","&#237;","&#7883;","&#242;","&#7887;","&#245;","&#243;","&#7885;","&#244;","&#7891;","&#7893;","&#7895;","&#7889;","&#7897;","&#417;","&#7901;","&#7903;","&#7905;","&#7899;","&#7907;","&#249;","&#7911;","&#361;","&#250;","&#7909;","&#432;","&#7915;","&#7917;","&#7919;","&#7913;","&#7921;","&#7923;","&#7927;","&#7929;","&#253;","&#7925;","&#192;","&#7842;","&#195;","&#193;","&#7840;","&#258;","&#7856;","&#7858;","&#7860;","&#7854;","&#7862;","&#194;","&#7846;","&#7848;","&#7850;","&#7844;","&#7852;","&#272;","&#200;","&#7866;","&#7868;","&#201;","&#7864;","&#202;","&#7872;","&#7874;","&#7876;","&#7870;","&#7878;","&#204;","&#7880;","&#296;","&#205;","&#7882;","&#210;","&#7886;","&#213;","&#211;","&#7884;","&#212;","&#7890;","&#7892;","&#7894;","&#7888;","&#7896;","&#416;","&#7900;","&#7902;","&#7904;","&#7898;","&#7906;","&#217;","&#7910;","&#360;","&#218;","&#7908;","&#431;","&#7914;","&#7916;","&#431&#7918;","&#7920;","&#7922;","&#7926;","&#7928;","&#221;","&#7924;"]
236var Req = ["224","7843","227","225","7841","259","7857","7859","7861","7855","7863","226","7847","7849","7851","7845","7853","273","232","7867","7869","233","7865","234","7873","7875","7877","7871","7879","236","7881","297","237","7883","242","7887","245","243","7885","244","7891","7893","7895","7889","7897","417","7901","7903","7905","7899","7907","249","7911","361","250","7909","432","7915","7917","7919","7913","7921","7923","7927","7929","253","7925","192","7842","195","193","7840","258","7856","7858","7860","7854","7862","194","7846","7848","7850","7844","7852","272","200","7866","7868","201","7864","202","7872","7874","7876","7870","7878","204","7880","296","205","7882","210","7886","213","211","7884","212","7890","7892","7894","7888","7896","416","7900","7902","7904","7898","7906","217","7910","360","218","7908","431","7914","7916","4317918","7920","7922","7926","7928","221","7924"]
237
238     function replaceString(szString,szFind,szReplace){
239    var iMatched, fSubstring, sSubstring;
240    iMatched=0;
241        while(iMatched>=0){
242        iMatched=szString.indexOf(szFind);
243        if(iMatched<0)
244        return szString;
245        fSubstring=szString.substring(0,iMatched);
246        sSubstring=szString.substring(iMatched+szFind.length,szString.length);
247        szString=fSubstring + szReplace + sSubstring;
248    }
249    // Next line for Netscape compatibility 
250    //     only - no effects
251    return(0);
252}
253
254var s = st
255for (i=0;i<133;i++)
256{
257
258	s = replaceString(s,Rex[i],String.fromCharCode(Req[i]))
259}
260return s
261}	
262// Ham kiem tra chuoi nhap so dau cho cac Mang 
263
264function ValidString(sText,sodau,socuoi)
265{
266	var ValidChars = "0123456789,";
267	var IsNumber=true;
268	var Char;
269	// Kiem tra tinh hop le cua cac Ky tu trong chuoi
270	for (i = 0; i < sText.length && IsNumber == true; i++) 
271		{ 
272			Char = sText.charAt(i); 
273			if (i == 0 && Char=="," ) // Kiem tra dau o dau chuoi
274				{
275					return false;
276				}
277					//continue;
278			if (ValidChars.indexOf(Char) == -1) 
279				{
280					return false;
281				}
282       }		
283// kiem tra tinh hop le cua vi tri dau cham (,) trong chuoi so, khong the co <> 3-4  chu so giua 2 dau ,
284//var mang=new Array();
285    var luu=sText;
286	var mang=luu.split(",");
287	if (mang.length>0)	
288		for(i=0;i<mang.length;i++)
289			{
290			    if(mang[i].length>socuoi || mang[i].length <sodau)
291				    return false;				
292			}			
293
294	return true;
295
296}
297//--> 
298function isNumeric(str)
299{	var iLen;
300	iLen=str.length;
301	var c ;
302	for(var i=0; i<iLen; i++)
303	{	c = str.charAt(i);
304		if ((c<'0') || (c>'9'))
305			return false;
306	}
307	return true;
308}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.