PageSourceSearch

https://spravzdrav.ru/js/guest.js?1285067821&

js spravzdrav.ru collected 2026-10-02 21:39:39 UTC 10,070 bytes, 519 lines download raw bytes

1var is_ie = !(navigator.appName.indexOf("Netscape") != -1);
2
3function includeJS(src) {
4	if(document.getElementsByTagName && document.createElement) {
5		var head = document.getElementsByTagName('head')[0];
6
7		var script = document.createElement('script');
8		script.type = 'text/javascript';
9		script.src = src;
10		script.charset = "utf-8";
11
12		head.appendChild(script);
13
14		return true;
15	} else {
16		return false;
17	}
18}
19
20function getCurrSelection() {
21	if(document.selection)
22		return document.selection;
23	else
24		return window.getSelection();
25}
26
27function getRange(sel) {
28	if(!sel)
29		sel = getSelection();
30
31	if(typeof sel != "undefined") {
32		return sel.getRangeAt(0);
33	} else {
34		return window.document.createRange();
35	}
36}
37
38function hasParent(obj, par_id) {
39	if(!obj) {
40		return false;
41	}
42
43	if(obj.id == par_id) {
44//		alert(obj.id);
45		return true;
46	} else {
47		if(obj.parentNode) {
48			return hasParent(obj.parentNode, par_id);
49		} else {
50			return false;
51		}
52	}
53}
54
55function trim(str) {
56	var res = str.replace(/^\s+/, '');
57	return res.replace(/\s+$/, '');
58
59}
60
61function lLib () {
62	return this;
63}
64
65lLib.instance = null;
66
67lLib.getInstance = function () {
68	if(! lLib.instance) {
69		lLib.instance = new lLib();
70	}
71
72	return lLib.instance;
73};
74
75
76lLib.includeJS = includeJS;
77
78lLib.prototype.is_loaded = false;
79lLib.prototype.onLoadEvents = new Array();
80lLib.prototype.requestStack = new Array();
81
82
83
84
85
86lLib.prototype.makeRequest = function (url, handler) {
87	var requestId = this.requestStack.length;
88	this.requestStack[requestId] = handler;
89	
90	var s_delim = "?";
91	if (url.indexOf('?') !== -1) s_delim = '&';
92
93	url += s_delim + "requestId=" + requestId + "&rnd=" + Math.random();
94	lLib.includeJS(url);
95
96	return requestId;
97};
98
99
100lLib.prototype.makeResponse = function (response) {
101	if(typeof response != "object") {
102		return false;
103	}
104
105	var requestHandler;
106	var requestId = response.id;
107
108	if(typeof this.requestStack[requestId] == "undefined") {
109		return false;
110	} else {
111		requestHandler = this.requestStack[requestId];
112		requestHandler(response);
113		this.requestStack[requestId] = undefined;
114		return true;
115	}
116};
117
118
119
120function lLibResponse(requestId) {
121	this.id = requestId;
122}
123
124lLibResponse.prototype.id = null;
125
126function is_safari() {
127	return (navigator.userAgent.indexOf("Safari") != -1);
128}
129
130
131var Mozilla = (navigator.appName.indexOf("Netscape") != -1);
132
133function forum_check_reg_form() {
134	forum_login = document.getElementById('forum_login');
135	forum_password = document.getElementById('forum_password');
136	forum_password_check = document.getElementById('forum_password_check');
137	forum_email = document.getElementById('forum_email');
138
139	if(!forum_login || !forum_password || !forum_password_check || !forum_email) {
140		alert("Неправильно сформирована форма.");
141		return false;
142	}
143
144	if(forum_login.value == "") {
145		alert("Необходимо заполнить поле \"Логин\"");
146		return false;
147	}
148
149	if(forum_password.value == "") {
150		alert("Необходимо заполнить поле \"Пароль\"");
151		return false;
152	}
153
154	if(forum_password.value != forum_password_check.value) {
155		alert("Пароли не совпадают.");
156		return false;
157	}
158
159	if(forum_email.value == "") {
160		alert("Необходимо заполнить поле \"E-mail\"");
161		return false;
162	}
163
164	return true;
165}
166
167
168function forum_check_form(obj) {
169	if(!obj)
170		return false;
171
172
173	if(obj.captcha) {
174		if(md5(obj.captcha.value) != getCookie("captcha1")) {
175			alert("Неправильный код.");
176			return false;
177		}
178	}
179
180
181	if(obj.nickname)
182		vlogin = obj.nickname.value;
183	else
184		vlogin = "";
185
186	if(obj.title)
187		vtitle = obj.title.value;
188	else
189		vtitle = "";
190
191	if(obj.body)
192		vbody = obj.body.value;
193	else
194		vbody = "";
195
196	if(vlogin.length == 0) {
197		alert("Введите имя.");
198		return false;
199	}
200
201
202
203	if(vtitle.length == 0) {
204		alert("Введите заголовок.");
205		return false;
206	}
207
208	bd = vbody.replace(/[ \t\r\n]*/g, "");
209
210	if(bd.length == 0) { 
211		alert("Введите текст сообщения");
212		return false;
213	}
214	return true;
215}
216
217function forum_quote(mess_id) {
218    var author = "";
219	mess_obj = document.getElementById('mess_' + mess_id);
220	if(!mess_obj)
221		return false;
222
223	body_obj = document.getElementById('message');
224
225	if(!body_obj)
226		return false;
227
228
229	if(is_ie) {
230		sel = getCurrSelection();
231		range = sel.createRange();
232		sel_str = range.text;
233	} else {
234		sel = getCurrSelection();
235		if (sel.rangeCount) {
236			range = getRange(sel);
237			sel_str = range;
238		} else {
239			sel_str = "";
240		}
241	}
242
243	if(!is_ie)
244		qmess = mess_obj.textContent;
245	else
246		qmess = mess_obj.outerText;
247
248	if(sel_str && typeof sel_str != "undefined" && qmess) {
249		parentObj = range.commonAncestorContainer;
250
251		if(is_ie) {
252			if(qmess.replace(sel_str, "") != qmess) {
253				qmess = sel_str;
254			}
255		} else {
256			parentObj = range.commonAncestorContainer;
257
258			if(hasParent(parentObj, 'mess_' + mess_id)) {
259				qmess = range;
260			}
261		}
262	}
263
264	res = "";
265
266	real_id = mess_obj.id.substr(5, mess_obj.id.length - 5);
267	author_obj = document.getElementById('author_' + real_id);
268	if(author_obj) {
269		author = (!Mozilla) ? author_obj.innerText : author_obj.textContent;
270		author = "[b]" + trim(author) + "[/b]\r\n";
271	} else {
272		author = "";
273	}
274
275	if(qmess) {
276		if(body_obj.value.length == 0)
277			body_obj.value += "[QUOTE]" + author + qmess + "[/QUOTE]\r\n";
278		else
279			body_obj.value += "\r\n[QUOTE]" + author + qmess + "[/QUOTE]\r\n";
280	}
281	document.getElementById('message').focus();
282	return false;
283}
284
285
286function forum_toAuthor(obj) {
287	if(is_ie)
288		res = obj.innerText;
289	else
290		res = obj.textContent;
291
292	res = trim(res);
293
294	res = "[b]" + res + "[/b]\r\n";
295
296	document.getElementById('message').value += res;
297	window.location = "#add";
298
299	document.getElementById('message').focus();
300
301	return false;
302}
303
304
305
306function forum_insert_smile(obj, element_name) {
307	if(!obj) return;
308	var obj = obj.firstChild;
309	if(!obj) return;
310
311	var alt = obj.alt;
312	if(!alt) return false;
313
314	var obj = document.getElementById('message');
315	if(!obj) obj = document.getElementById('forum_body');
316	if(!obj) obj = document.getElementById(element_name);
317	if(!obj) return false;
318
319	obj.value += "[smile:" + alt + "] ";
320	obj.focus();
321
322	return true;
323}
324
325var last_src = "";
326
327
328function cms_vote_postDo(formName, inputName, nstext) {
329	var fObjColl = document.getElementsByName(formName);
330
331	var fObj = '';
332	if (fObjColl) {
333		fObj = fObjColl[fObjColl.length-1];
334	}
335
336	if(typeof(fObj) !== "object") return false;
337	
338	iObj = fObj.elements[inputName];
339	
340	if(typeof(iObj) === "undefined") return false;
341
342	res = false;
343	for(i = 0; i < iObj.length; i++)
344		if(iObj[i].checked)
345			res = iObj[i].value;
346
347
348	if(res) {
349		sc = document.createElement("script");
350		sc.src = "/vote/post/" + res + "/?m=" + new Date().getTime();
351		oTemplate = fObj.elements['system_template'];
352		if((oTemplate instanceof Object) && (oTemplate.value.length)) {		
353			sc.src = sc.src + "&template="+oTemplate.value;			
354		}
355
356		fObj.appendChild(sc);
357	} else {
358		if(nstext) {
359			alert(nstext);
360		}
361	}
362}
363
364function saveFormData(form) {
365	if(!form) {
366		return false;
367	}
368	
369	if(!form.id) {
370		alert("You should set id attribute in form tag to save or restore it.");
371		return false;
372	}
373
374	var cookieData = new Array;	
375	for(var i = 0; i < form.elements.length; i++) {
376		var input = form.elements[i];
377		if (input.name) {
378			var inputName = input.name.replace(/([)\\])/g, "\\$1");
379
380			switch(input.type) {
381				case "file": {
382					if (input.value == '') input.parentNode.removeChild(input);
383					break;
384				}
385				case "password":
386				
387				case "text":
388				case "textarea": {
389					cookieData.push({type: 'T', name: inputName, value: input.value});
390					break;
391				}
392				
393				case "checkbox":
394				case "radio": {
395					cookieData.push({type: 'C', name: inputName, value: (input.checked ? 1 : 0)});
396					break;
397				}
398				
399				case "select-multiple":
400				case "select-one": {
401					cookieData.push({type: 'S', name: inputName, value: input.selectedIndex});
402					break;
403				}
404			}
405		}
406
407	}
408	
409	var str = "";
410	for(var i = 0; i < cookieData.length; i++) {
411		var elementData = cookieData[i];
412		var value = new String(elementData.value);
413		var inputName = new String(elementData.name);
414		
415		if(!inputName || !value) {
416			continue;
417		}
418		
419		str += elementData.type + "," + inputName.length + "," + inputName + "," + value.length + "," + value;
420	}
421	document.cookie="frm" + form.id + "=" + escape(str.replace(/([|\\])/g, "\\$1"));
422	return true;
423}
424
425function restoreFormData(form) {
426	if(!form) {
427		return false;
428	}
429	
430	if(!form.id) {
431		alert("You should set id attribute in form tag to save or restore it.");
432		return false;
433	}
434	var cookieName = "frm" + form.id + "=";
435	
436	var cookie = new String(unescape(document.cookie));
437	var posStart, posEnd;
438	if((posStart = cookie.indexOf(cookieName)) == -1) {
439		return false;
440	}
441	
442	if((posEnd = cookie.indexOf(";", posStart)) == -1) {
443		posEnd = cookie.length;
444	}
445	
446	var data = cookie.substring(posStart + cookieName.length, posEnd);
447	var pos = 0, cookieData = new Array;
448
449	while(pos < data.length) {
450		var inputName;
451		var type = data.substring(pos, pos + 1);
452		pos += 2;
453		
454		var length = parseInt(data.substring(pos, data.indexOf(",", pos)));
455		pos = data.indexOf(",", pos) + 1;
456		var inputName = data.substring(pos, pos + length);
457		pos += length + 1;
458
459		var length = parseInt(data.substring(pos, data.indexOf(",", pos)));
460		if(length == 0) {
461			pos += 2;
462			continue;
463		} else {
464			pos = data.indexOf(",", pos) + 1;
465		}
466		
467		var value = data.substring(pos, pos + length);
468		pos += length;
469		
470		cookieData.push({type: type, name: inputName, value: value});
471	}
472	
473	for(var i = 0; i < cookieData.length; i++) {
474		var elementData = cookieData[i];
475		if (elementData.type && elementData.name) {
476			switch(elementData.type) {
477				case "T": {
478					form.elements[elementData.name].value = elementData.value;
479					break;
480				}
481				
482				case "C": {
483					form.elements[elementData.name].checked = elementData.value ? true : false;
484					break;
485				}
486				
487				case "S": {
488					form.elements[elementData.name].selectedIndex = elementData.value;
489					break;
490				}
491			}
492		}
493	}
494}
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519

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.