PageSourceSearch

http://www.promwood.com/upload/js/index.js

js promwood.com collected 2026-10-03 21:49:38 UTC 18,481 bytes, 462 lines download raw bytes

1function Q(id){return document.getElementById(id);}
2function $$(id){return document.createElement(id);}
3function $$$(id){document.write(id);}
4function che(id){
5    if(!Q(id)) return;
6    $('#'+id).slideToggle();
7}
8
9(function($) {
10	$.fn.ParaSlider = function(options) {
11		return this.each(function(){
12			var opts = $.extend(true, {}, $.fn.ParaSlider.defaults, options || {});
13			opts.filter = opts.filter || $.fn.ParaSlider.filter;
14			var $cont = $(this);
15			var cont = $cont[0];
16			$cont.hover(function(){cont.Pause = true;},function(){cont.Pause = false;});
17			function ParaGo() {
18				if (cont.Pause) {
19					setTimeout(ParaGo, 500);
20					return;
21				}
22				var $el = $cont.children(':first'), el = $el[0];
23				$el.animate({opacity: 0}, opts.animOutSpeed, function(){
24					var h = $el.outerHeight();
25					$el.animate({ marginTop: -h }, opts.animInSpeed, function() {
26						$el.css({ marginTop: 0,	opacity: 1 });
27						/*@cc_on
28						try { el.style.removeAttribute('filter'); } // ie cleartype fix
29						catch(smother) {}
30						@*/
31						$el.show().appendTo($cont);
32					});
33					setTimeout(ParaGo, opts.timeout);
34				});
35			}
36            setTimeout(ParaGo, opts.timeout);
37		});
38	};
39	$.fn.ParaSlider.filter = function() {
40		return true;
41	};
42	$.fn.ParaSlider.defaults = {
43		animOutSpeed: 1000,
44		animInSpeed: 500,
45		filter: null,
46		timeout: 5000
47	};
48})(jQuery);
49
50function opnpopup(w,h,title,srcs){
51	myWin= open("","displayWindow","width="+w+",height="+h+",status=no,toolbar=no,menubar=no,resizable=no");
52	myWin.document.open();
53	myWin.document.write("<html><head><title>"+title+"</title></head><body style='margin:0;padding:0;'><center><a href='javascript:window.close();void(0);'><img src='"+srcs+"' width='"+w+"' height='"+h+"' border='0' /></a></center></body></html>");
54	myWin.document.close();
55}
56function getjsvar(asmode,url){
57    newurl = '/onliner.js?';
58    if(asmode) newurl += 'mode='+asmode;
59    else       newurl += 'first='+firstgeturl+'&langid='+langid+'&sectid='+sectid+'&artid='+artid+((url)?('&'+url):'');
60    newurl += '&time='+time().getTime();
61    firstgeturl = 0;
62    var span = null;
63	var span = document.createElement('SPAN');
64    Q('jsdiv').appendChild(span);
65    span.style.display = 'none';
66    span.innerHTML = 't <s'+'cript></' + 'script>';
67    var s = span.getElementsByTagName("script")[0];
68    s.language = "JavaScript";
69    s.type = "text/javascript";
70    if(s.setAttribute) s.setAttribute('src',newurl); else s.src = newurl;
71}
72function vidm(n,t){
73	c = new Array (2,0,1,1,1,2);
74	return t[(n%100>4 && n%100<20)? 2:c[Math.min(n%10,5)]];
75}
76function timeBershad(){
77   x = new Date(time().getUTCFullYear(),time().getUTCMonth(),time().getUTCDate(),time().getUTCHours()+3,time().getUTCMinutes(),time().getUTCSeconds());
78   x.setTime(x.getTime());
79   return x;
80}
81function time(){return new Date()}
82function leadingZero(x){return (x>9)?x:'0'+x;}
83function dog(user,server,subj){
84	var eil = user+unescape('%40')+server;
85	$$$('<a href="mailto:'+eil+((subj) ? '?subject='+subj : '')+'">'+eil+'</a>');
86}
87function mkhttp(url,data,handler){
88	var x = (window.ActiveXObject) ? (new ActiveXObject("Microsoft.XMLHTTP")):(new XMLHttpRequest());
89	x.open(data?'POST':'GET',url,(typeof(handler) != 'undefined' && handler)?true:false);
90    if(data) x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
91    x.send(data?data:null);
92	if(handler) if(typeof(x.onload) != 'undefined')	x.onload = function(){handler(x);}
93    else x.onreadystatechange = function(){if(x.readyState == 4) handler(x);}
94	return x;
95}
96function avote_handler(x){
97	if(x.responseXML && (d = x.responseXML.documentElement) && d.tagName == 'ok'){
98		var tmp = x.responseXML.getElementsByTagName('ok');
99		return true;
100	}else return false;
101}
102function multiVoteIt(absn,act,elem,t){
103	var oRate = new makeObj("rate" + absn);
104	var eList = oRate.elem.childNodes.length;
105	var eImg = oRate.elem.childNodes;
106	if(!act) for(i=0;i<=elem;i++) eImg[i].src = tmp[i].src;
107	if(act==1){
108		for(i=0;i<eList;i++) tmp[i] = new Image();
109		for(i=0;i<=elem;i++) tmp[i].src = eImg[i].src;
110		if(!isRate[absn]){
111			for(i=0;i<=elem;i++) eImg[i].src = star_o.src;
112			oRate.elem.style.cursor = "pointer";
113		}
114	}
115	if(act == 2 && !isRate[absn]){
116		vCount[absn]++;
117		ball = elem + 1;
118		vSum[absn] += ball;
119		rating = Math.round(vSum[absn] * 10 / vCount[absn]) / 10;
120		oRate.elem.className = "def";
121		isRate[absn] = 1;
122		var x = mkhttp(basehref+'/xml/avote?mode='+t+'&artid='+absn+'&sectid='+sectid+'&ball='+ball,null,avote_handler);
123		for(i=0;i<eList;i++){
124			eImg[i].src = '/upload/tmp/star_' + ((i <= rating - 1) ? 'f' : (i + 0.5 <= rating ? 'h' : 'e')) + '.gif';
125			tmp[i].src = eImg[i].src;
126		}
127		alert('Ваш голос учтен. Спасибо!');
128	}else if(act == 2){
129        alert('Вы уже голосовали. Спасибо!');
130    }
131}
132function makeObj(obj){
133	this.elem = Q(obj);
134	this.css = this.elem ? this.elem.style : null;
135	return this;
136}
137function repltime(dat,def,c){
138		var m = new Date(dat*1000);
139		var md = m.getDate();
140		var u =new Date(dat*1000);
141		u.setDate(u.getDate()+1);
142		if((timeBershad().getTime()-m.getTime()) < (3600*24*30*1000))
143			if(md == timeBershad().getDate())
144				$$$('<span class="green">Сегодня</span>'+(c?',':'')+' ');
145			else if(u.getDate() == timeBershad().getDate())
146				$$$('<span class="blue">Вчера</span>'+(c?',':'&nbsp;&nbsp;&nbsp;')+' ');
147        else $$$(def+(c?',':'')+' ');
148}
149function em(f,lib,tm,w,h){
150	if(w!=''&&h!='')	var wh = 'width="'+w+'" height="'+h+'"';
151	else var wh = '';
152	$$$('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '+wh+' id="picture" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'+f+'?'+tm+'" /><param name="quality" value="high" /><PARAM NAME=FlashVars VALUE="'+lib+'"><PARAM NAME=wmode VALUE="transparent"><param name="bgcolor" value="#eaeff4" /><embed src="'+f+'?'+tm+'" quality="high" wmode="transparent" FlashVars="'+lib+'" bgcolor="#eaeff4" '+wh+' name="picture" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
153}
154function B_Load(){
155	this.wib = screen.width;
156	this.heb = screen.height;
157	this.documes = ($ || document.createElement || document.getElementsByTagName) ? true : false;
158	this.objects = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
159	this.types = 'load';
160    this.addsevent = function(func){
161    	if(this.objects.addEventListener){
162    	this.objects.addEventListener(this.types,func,false);
163    	return true;
164    	}else if (this.objects.attachEvent)
165    	this.objects.attachEvent("on" + this.types,func);
166    	else return false;
167    }
168    this.findobj = function(obj){
169    	this.parent = window.document;
170    	if(this.parent[obj]){ return this.parent[obj]; }
171    	if(this.parent.all && this.parent.all[obj]){ return this.parent.all[obj]; }
172    	if(this.parent.layers && this.parent.layers[obj]){ return this.parent.layers[obj]; }
173    	if(this.parent.getElementById && this.parent.getElementById(obj)){ return this.parent.getElementById(obj); }
174    	return null;
175    }
176}
177function B_Hint(){
178    this.show = function(obj,str){
179    	var hint = B.findobj('hint');
180    	if(!obj)return;
181    	if(!B.documes)return;
182    	if(!hint)return;
183        if(!hint.style)return;
184    	hint.className = 'hint';
185    	hint.style.left = 15+'px';
186    	hint.style.top = 19+'px';
187      obj.onmouseout = function(advance){
188      	hint.style.width = '';
189      	hint.style.visibility = 'hidden';
190      	if(hint.firstChild) hint.removeChild(hint.firstChild);
191      	hint.appendChild(document.createTextNode(str));
192    	};
193      obj.onmousemove = function(advance){
194      	hint.style.width = '';
195      	hint.innerHTML = str;
196      	vc = document.getElementsByTagName((document.compatMode && document.compatMode=="CSS1Compat") ? "HTML":"BODY")[0];
197      	if(!vc) return;
198      	x = window.event ? event.clientX + vc.scrollLeft : advance.pageX;
199      	y = window.event ? event.clientY + vc.scrollTop : advance.pageY;
200      	vcwidth = vc.clientWidth ? vc.clientWidth + vc.scrollLeft : window.innerWidth + window.pageXOffset;
201      	vcheight = vc.innerHeight ? window.innerHeight + window.pageYOffset : vc.clientHeight + vc.scrollTop;
202      	if((x + hint.offsetWidth + 15) > vcwidth)
203            hint.style.left = (x - hint.offsetWidth - 4)+'px';
204      	else
205            hint.style.left = (x + 15)+'px';
206      	if((y + hint.offsetHeight + 19) > vcheight)
207            hint.style.top = (y - hint.offsetHeight)+'px';
208      	else
209            hint.style.top = (y + 19)+'px';
210      	hint.style.opacity = '.87';
211      	hint.style.filter = "alpha(opacity:87)";
212      	hint.style.visibility = 'visible';
213    	}
214    }
215    this.initialize = function(){
216    	var hint = document.createElement("DIV");
217    	hint.setAttribute('id','hint');
218    	document.getElementsByTagName('body')[0].appendChild(hint);
219    	hint.style.visibility = 'hidden';
220    	var hintmarker = ['img','a','tr','td','area'];
221    	var textmarker = ['alt','title','title','title','title'];
222    	var lenmarker = hintmarker.length;
223    	for(var i=0; i<lenmarker; i++) {
224    	atr = document.getElementsByTagName(hintmarker[i]);
225    	for(var j=0; j<atr.length; j++)
226    	if(viewhint=atr[j].getAttribute(textmarker[i])){
227    	atr[j].removeAttribute(textmarker[i]);
228    	HINT.show(atr[j],viewhint);
229    	}
230    	}
231    }
232}
233function chlogin(obj){
234	var err = '';
235	if(!obj.elements['f[login]'].value) 	err += 'Не указан логин\r\n';
236	if(!obj.elements['f[passwd]'].value)	err += 'Не указан пароль\r\n';
237	if(err){
238		alert(err);
239		return false;
240	}
241	return true;
242}
243function insteg(id,aTag,eTag){
244    Q(id).focus();
245    if(typeof document.selection != 'undefined'){
246        var range = document.selection.createRange();
247        var insText = range.text;
248        range.text = aTag + insText + ((eTag) ? eTag : '');
249        range = document.selection.createRange();
250        if(insText.length == 0 && eTag) range.move('character', -eTag.length);
251        else range.moveStart('character',aTag.length+insText.length+((eTag) ? eTag.length : 0));
252        range.select();
253    }else if(typeof Q(id).selectionStart != 'undefined'){
254        var start = Q(id).selectionStart;
255        var end = Q(id).selectionEnd;
256        var insText = Q(id).value.substring(start, end);
257        Q(id).value = Q(id).value.substr(0, start) + aTag + insText + ((eTag) ? eTag : '') + Q(id).value.substr(end);
258        var pos;
259        if(insText.length == 0) pos = start + aTag.length;
260        else pos = start + aTag.length + insText.length + ((eTag) ? eTag.length : 0);
261        Q(id).selectionStart = pos;
262        Q(id).selectionEnd = pos;
263    }
264}
265function addsendmess(touser){
266    sendmess(window.prompt('Написать сообщение:',''),touser);
267}
268function sendmess(mess,touser){
269    if(!mess || mess == ' ' || !touser){
270        return;
271    }
272    if(!userid){
273        alert('Ошибка! Вы не авторизированы или время Вашей сессии истекло.');
274        return;
275    }
276  	var url =  encodeURI(basehref+'/xml/sendsmessage/?mess='+mess+'&touser='+touser);
277  	var h = mkhttp(url);
278    if(!h) return false;
279  	if(!h.responseXML.getElementsByTagName("status")[0].firstChild) return;
280  	if(h.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue == 1){
281        alert('Спасибо, Ваше сообщение успешно отправлено.');
282    }else{
283        alert('Ошибка! Вы не авторизированы или время Вашей сессии истекло.');
284    }
285}
286function addrate(obj,absn,art,sect,rate,type){
287    if(type == 2){
288  	    var url =  basehref+'/xml/avote?mode='+type+'&rate='+rate+'&commid='+absn+'&sectid='+sect+'&artid='+art;
289  	    var h = mkhttp(url);
290  	    if(!h) return false;
291        obj.onclick = null;
292        obj.src = '/upload/tmp/plus2.gif';
293        obj.blur();
294  	    var res = h.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue;
295        if(res < 1){alert('Вы уже голосовали');return;}
296        if(Q('mark_'+absn)) Q('mark_'+absn).innerHTML = res;
297        alert('Спасибо, Ваш голос учитан.');
298    }
299}
300function SetCookie(name,value){
301    var argv    = SetCookie.arguments;
302    var argc    = SetCookie.arguments.length;
303    var expires = (argc > 2) ? argv[2] : null;
304    var path    = (argc > 3) ? argv[3] : null;
305    var domain  = (argc > 4) ? argv[4] : null;
306    var secure  = (argc > 5) ? argv[5] : false;
307    document.cookie = name + "="+escape(value)+";"+((expires==null)?"":("expires="+expires.toGMTString()))+((path==null)?"/":("; path=" +path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
308}
309function GetCookie(name){
310    var arg  = name + "=";
311    var alen = arg.length;
312    var clen = document.cookie.length;
313    var i    = 0;
314    while (i < clen){
315        var j = i + alen;
316        if(document.cookie.substring(i, j) == arg) return getCookieVal (j);
317        i = document.cookie.indexOf(" ", i) + 1;
318        if(i==0) break;
319    }
320    return null;
321}
322function getCookieVal(offset){
323    var endstr = document.cookie.indexOf (";",offset);
324    if (endstr == -1)endstr = document.cookie.length;
325    return unescape(document.cookie.substring(offset,endstr));
326}
327function DeleteCookie(name){
328    var exp  = new Date();
329    var cval = GetCookie (name);
330    exp.setTime (exp.getTime() - 1);
331    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
332}
333
334function sendTxtError(evt){
335	evt = (evt)?evt :((window.event)?window.event : null);
336	if (evt) {
337		if (evt.keyCode == 10 || (evt.keyCode == 13 && evt.ctrlKey)) {
338			var oInit = {
339				maxlen: 256,
340				wText:  {
341					Big: "Выделенно слишком много текста",
342					NoSupport: "Ваш браузер не поддерживает такую функцию",
343					Error: "Ошибка в тексте",
344					Send: "Отправить сообщение редактору?\nВы останитесь на этой же странице",
345					Mark: "<ошибка>",
346                    Sencs: "Спасибо за помощь!"
347				}
348			}
349			var sel = null;
350			sel = (parent.getSelection) ? parent.getSelection() : ((parent.document.getSelection) ? parent.document.getSelection() : ((document.selection.createRange) ? document.selection.createRange().text : null));
351			if(sel == null) {
352				alert(oInit.wText.NoSupport);
353				return;
354			}
355            sel += '';
356			if(sel.length > oInit.maxlen){
357				alert(oInit.wText.Big);
358				return;
359			}
360			if(sel == "") return;
361			if(confirm(oInit.wText.Error + "\n" + oInit.wText.Mark + sel + oInit.wText.Mark + "\n\n" + oInit.wText.Send)){
362		        re = /\r/g;
363				sel = sel.toString().replace(re, " ");
364		        re = /\n/gi;
365				sel = sel.toString().replace(re, " ");
366                var url =  basehref+'/xml/senderror?txterr='+sel+'&useragent='+navigator.userAgent+'&docloc='+document.location.href;
367        	    var h = mkhttp(url);
368                alert(oInit.wText.Sencs);
369			}
370		}
371    }
372}
373function cntrentererror(){
374    if (!((navigator.appName.indexOf("Netscape")!=-1 && eval(navigator.appVersion.substring(0,1)) < 5) || (isOpera && verOpera < 7))) {
375    	document.onkeypress = sendTxtError;
376        if(Q('cntrlEnter')){
377            Q('cntrlEnter').innerHTML = 'Если Вы обнаружили ошибку, выделите текст с ошибкой и нажмите Ctrl+Enter что бы сообщить об этом в редакцию';
378            Q('cntrlEnter').style.display = 'block';
379        }
380    }
381}
382jQuery.fn.accordion = function() {
383    function update(dl) {
384        $("h2:not(.active)", dl).css("cursor", "pointer");
385        $("h2.active", dl).css("cursor", "");
386        $("dd div", dl).hide(300);
387        $("dd span.remark", dl).show();
388        $("h2.active", dl).next().children("div").show(300);
389        $("h2.active", dl).next().addClass("active");
390        $("h2.active", dl).next().children("span.remark").hide();
391    }
392    return this.each(function(){
393        var dl = $(this), active = $("h2.active", dl);
394        update(dl);
395        $("h2", dl).click(function() {
396            if (!$(this).hasClass("active")) {
397                active && active.removeClass("active") && active.next().removeClass("active");
398                active = $(this).addClass("active");
399                update(dl);
400                //SetCookie('birgaselect',$(this).attr('id'));
401            }
402        });
403    });
404};
405function changetab(div,id){
406    for(i=0;i<25;i++){
407        if(!$('#'+div+'_'+i+'_td')) break;
408        if(id == i){
409            $('#'+div+'_'+i+'_td').addClass('current');
410            $('#'+div+'_'+i+'_content').css({display: 'block'});
411        }else{
412            $('#'+div+'_'+i+'_td').removeClass('current');
413            $('#'+div+'_'+i+'_content').css({display: 'none'});
414        }
415
416    }
417}
418popup_typesall = null;
419function closePopup(){
420    $('#opaco').toggleClass('hidden').removeAttr('style');
421    $('#popup_'+popup_typesall).toggleClass('hidden')
422    popup_typesall = null;
423    return false;
424}
425function showPopup(popup_type){
426    $(".reference_form").show();
427    $(".reference_status").hide();
428    if($.browser.msie){
429        $('#opaco').height($(document).height()).toggleClass('hidden');
430    }else{
431        $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.3);
432    }
433    $('#popup_'+popup_type).alignCenter().toggleClass('hidden');
434    popup_typesall = popup_type;
435    return false;
436}
437var userid  = 0;
438var artid   = 0;
439var sectid  = 0;
440var langid  = 1;
441firstgeturl = 1;
442var member = new Array();
443var commentisvoted = new Array();
444var nocomment = null;
445var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
446if(isOpera) var verOpera = parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("Opera")+6));
447brshd = new Array();
448star_o      = new Image();
449star_o.src  = "/upload/tmp/star_o_small.gif";
450tmp         = new Array(star_o.src);
451isRate      = new Array();
452vCount      = new Array();
453vSum        = new Array();
454var issallrate= new Array();
455var tickermsg= new Array();
456var ticdelay  = 30;
457var ticnextm  = 0;
458var yandex_direct_place = 'yandex_direct';
459var yandex_market_place = 'yandex_market';
460var B = new B_Load();
461var HINT = new B_Hint();
462if(B.objects)B.addsevent(HINT.initialize);

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.