(function($){
var jCarlLitov = null;
$.fn.jCarouselLite = function(o) {
    o = $.extend({
        btnPrev: null,
        btnNext: null,
        btnGo: null,
        btnGo_reply: null,
        mouseWheel: false,
        auto: null,
        width: null,
        speed: 200,
        easing: null,
        vertical: false,
        circular: true,
        visible: 3,
        start: 0,
        starts: null,
        scroll: 1,
        beforeStart: null,
        afterEnd: null,
        description: null,
        description_html: null,
        sliderlist:null
    }, o || {});
    return this.each(function() {
        var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
        var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
        if(o.circular) {
            ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());
            o.start += v;
        }
        var li = $("li", ul), itemLength = li.size(), curr = o.start;
        div.css("visibility", "visible");
        li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
        li.mouseover(function(){jCarlLitov = true;}).mouseout(function(){jCarlLitov = null;});
        ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
        div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
        var liSize = o.vertical ? height(li) : (o.width?o.width:width(li));
        var ulSize = liSize * itemLength;
        var divSize = liSize * v;
        li.css({width: (o.width?o.width:li.width()), height: li.height()});
        ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
        div.css(sizeCss, divSize+"px");
        if(o.btnPrev)   $(o.btnPrev).click(function(){return go(curr-o.scroll);}).mouseover(function(){jCarlLitov = true;}).mouseout(function(){jCarlLitov = null;}).blur();
        if(o.btnNext)   $(o.btnNext).click(function(){return go(curr+o.scroll);}).mouseover(function(){jCarlLitov = true;}).mouseout(function(){jCarlLitov = null;}).blur();
        if(o.btnGo)
            $.each(o.btnGo, function(i, val) {
                $(val).click(function() {
                    return go(o.circular ? o.visible+i : i);
                });
            });
        if(o.mouseWheel && div.mousewheel)
            div.mousewheel(function(e, d) {
                return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
            });
        if(o.starts){
            go(o.starts);
        }
        if(o.auto)
            setInterval(function() {
                if(!jCarlLitov) go(curr+o.scroll);
            }, o.auto+o.speed);
        function vis() {
            return li.slice(curr).slice(0,v);
        };
        function go(to) {
            if(!running){
                if(o.beforeStart){
                    o.beforeStart.call(this, vis());
                }
                if(o.circular){
                    if(to<=o.start-v-1){
                        ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                        curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
                    } else if(to>=itemLength-v+1){
                        ul.css(animCss, -( (v) * liSize ) + "px" );
                        curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
                    } else curr = to;
                }else{
                    if(to < 0 || to > ((itemLength%v == 0)?itemLength-v:itemLength-(v-1)) ) return;
                    else curr = to;
                }
                running = true;
                ul.animate(
                    animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
                    function() {
                        if(o.afterEnd) o.afterEnd.call(this, vis());
                        running = false;
                    }
                );
                if(o.description_html){
                    $(o.description_html).slideUp("slow");
                    if(o.description && o.description[curr-o.scroll+1] && o.description[curr-o.scroll+1] != ''){
                        $(o.description_html).html(o.description[curr-o.scroll+1]);
                    }else{
                        $(o.description_html).html('');
                    }
                    $(o.description_html).slideDown("slow");
                }
                if(o.sliderlist){
                    for(i=0;i <= itemLength;i++){
                        if($(o.sliderlist+i)){
                            if(curr-o.scroll+1 == i){
                                $(o.sliderlist+i).addClass("active").blur();
                            }else{
                                $(o.sliderlist+i).removeClass("active");
                            }
                        }
                    }
                }
            }
            return false;
        };
    });
};
function css(el, prop) {
    return parseInt($.css(el[0], prop)) || 0;
};
function width(el) {
    return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};

})(jQuery);
$(document).ready(function(){
   $.fn.alignCenter = function() {
      var marginLeft = Math.max(20, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
      var marginTop = Math.max(20, parseInt(($(window).height()/2 - $(this).height()/2)-60)) + 'px';
      return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
   };
   $(".leftgreen").bind("mouseenter", function() {
	 var pobj= $(this).find("h5 a")
	 if (pobj.hasClass("selected"))
	 	{
			 pobj.addClass("now")
	 	return
		}
	 pobj.addClass("selected")
	   })
      $(".leftgreen").bind("mouseleave", function() {
	 var pobj= $(this).find("h5 a")
	 if (pobj.hasClass("now"))
	 	return
	 pobj.removeClass("selected")	
	   })
});
jQuery.easing = {
	easein: function(x, t, b, c, d) {
		return c*(t/=d)*t + b; // in
	},
	easeinout: function(x, t, b, c, d) {
		if (t < d/2) return 2*c*t*t/(d*d) + b;
		var ts = t - d/2;
		return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;
	},
	easeout: function(x, t, b, c, d) {
		return -c*t*t/(d*d) + 2*c*t/d + b;
	},
	expoin: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (Math.exp(Math.log(c)/d * t)) + b;
	},
	expoout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
	},
	expoinout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
		return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
	},
	bouncein: function(x, t, b, c, d) {
		return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
	},
	bounceout: function(x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	bounceinout: function(x, t, b, c, d) {
		if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
	},
	elasin: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	elasout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	elasinout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	backin: function(x, t, b, c, d) {
		var s=1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	backout: function(x, t, b, c, d) {
		var s=1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	backinout: function(x, t, b, c, d) {
		var s=1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	linear: function(x, t, b, c, d) {
		return c*t/d + b; //linear
	}
};

jQuery.fn.crawlLine = function(_options){
	var _options = jQuery.extend({
		speed:2,
		crawElement:'div',
		textElement:'p'
	},_options);
	return this.each(function(){
		var _THIS = jQuery(this);
		var _el = $(_options.crawElement, _THIS).css('position','relative');
		var _text = $(_options.textElement, _THIS);
		var _clone = _text.css('whiteSpace','nowrap').clone();
		var _elWidth = 0;
		var _k = 1;
		var _textWidth = 0;
		_text.each(function(){
			_textWidth += $(this).outerWidth(true);
		});
		var _duration = _textWidth*50 / _options.speed;
		_el.append(_clone);
		_el.css('width',_textWidth*2);
	    var animate = function() {
			_el.animate({left:-_textWidth}, {queue:false, duration:_duration*_k, easing:'linear', complete:function(){
				_el.css('left','0');
				_k=1;
				animate();
			}})
	    }
	    animate();
	    _THIS.hover(function() {
			_el.stop();
	    }, function(){
			_k = (_textWidth + parseInt(_el.css('left')))/_textWidth;
			animate();
	    })
	});
}



/*-----------------------------------------------*/
function Q(id){return document.getElementById(id);}
function $$(id){return document.createElement(id);}
function $$$(id){document.write(id);}
function che(id){
    if(!Q(id)) return;
    $('#'+id).slideToggle();
}
function opnpopup(w,h,title,srcs){
    if(!windowload) return;
	myWin= open("","displayWindow","width="+w+",height="+h+",status=no,toolbar=no,menubar=no,resizable=no");
	myWin.document.open();
	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>");
	myWin.document.close();
}
function getjsvar(asmode, url){
    newurl = 'http://'+document.domain+'/onliner.js?';
    if(asmode) newurl += 'mode='+asmode;
    else       newurl += 'first='+firstgeturl+'&langid='+langid+'&sectid='+sectid+'&artid='+artid+((url)?('&'+url):'');
    newurl += '&time='+(new Date()).getTime();
    firstgeturl = 0;
    $.ajax({
        async:false,
        url:newurl,
        cache:false,
        dataType:'script',
        success: function(){

        }
    });
}
function vidm(n,t){
	c = new Array (2,0,1,1,1,2);
	return t[(n%100>4 && n%100<20)? 2:c[Math.min(n%10,5)]];
}
function leadingZero(x){return (x>9)?x:'0'+x;}
function dog(user,server,subj){
	var eil = user+unescape('%40')+server;
	$$$('<a href="mailto:'+eil+((subj) ? '?subject='+subj : '')+'">'+eil+'</a>');
}
function mkhttp(url,data,handler){
	var x = (window.ActiveXObject) ? (new ActiveXObject("Microsoft.XMLHTTP")):(new XMLHttpRequest());
	x.open(data?'POST':'GET',url,(typeof(handler) != 'undefined' && handler)?true:false);
    if(data) x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    x.send(data?data:null);
	if(handler) if(typeof(x.onload) != 'undefined')	x.onload = function(){handler(x);}
    else x.onreadystatechange = function(){if(x.readyState == 4) handler(x);}
	return x;
}
function avote_handler(x){
	if(x.responseXML && (d = x.responseXML.documentElement) && d.tagName == 'ok' && x.responseXML.getElementsByTagName("ok")[0].firstChild){
        var val = x.responseXML.getElementsByTagName("ok")[0].firstChild.nodeValue;
        $('#ratingstar span').text(val);
        $('#ratingstar span').removeClass('red green').addClass((val>0?'green':(val<0?'red':'')));
	}else{
        alert('Ви вже голосували. Дякуємо!');
    }
}
function multiVoteIt(absn, ball){
    mkhttp(basehref+'/xml/avote?mode=0&artid='+absn+'&sectid='+sectid+'&ball='+ball, null, avote_handler);
}
function makeObj(obj){
	this.elem = Q(obj);
	this.css = this.elem ? this.elem.style : null;
	return this;
}
function em(f,lib,tm,w,h){
	if(w!=''&&h!='')	var wh = 'width="'+w+'" height="'+h+'"';
	else var wh = '';
	$$$('<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>');
}
function B_Load(){
	this.wib = screen.width;
	this.heb = screen.height;
	this.documes = ($ || document.createElement || document.getElementsByTagName) ? true : false;
	this.objects = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
	this.types = 'load';
    this.addsevent = function(func){
    	if(this.objects.addEventListener){
    	this.objects.addEventListener(this.types,func,false);
    	return true;
    	}else if (this.objects.attachEvent)
    	this.objects.attachEvent("on" + this.types,func);
    	else return false;
    }
    this.findobj = function(obj){
    	this.parent = window.document;
    	if(this.parent[obj]){ return this.parent[obj]; }
    	if(this.parent.all && this.parent.all[obj]){ return this.parent.all[obj]; }
    	if(this.parent.layers && this.parent.layers[obj]){ return this.parent.layers[obj]; }
    	if(this.parent.getElementById && this.parent.getElementById(obj)){ return this.parent.getElementById(obj); }
    	return null;
    }
}
function B_Hint(){
    this.show = function(obj,str){
    	var hint = B.findobj('hint');
    	if(!obj)return;
    	if(!B.documes)return;
    	if(!hint)return;
        if(!hint.style)return;
    	hint.className = 'hint';
    	hint.style.left = 15+'px';
    	hint.style.top = 19+'px';
      obj.onmouseout = function(advance){
      	hint.style.width = '';
      	hint.style.visibility = 'hidden';
      	if(hint.firstChild) hint.removeChild(hint.firstChild);
      	hint.appendChild(document.createTextNode(str));
    	};
      obj.onmousemove = function(advance){
      	hint.style.width = '';
      	hint.innerHTML = str;
      	vc = document.getElementsByTagName((document.compatMode && document.compatMode=="CSS1Compat") ? "HTML":"BODY")[0];
      	if(!vc) return;
      	x = window.event ? event.clientX + vc.scrollLeft : advance.pageX;
      	y = window.event ? event.clientY + vc.scrollTop : advance.pageY;
      	vcwidth = vc.clientWidth ? vc.clientWidth + vc.scrollLeft : window.innerWidth + window.pageXOffset;
      	vcheight = vc.innerHeight ? window.innerHeight + window.pageYOffset : vc.clientHeight + vc.scrollTop;
      	if((x + hint.offsetWidth + 15) > vcwidth)
            hint.style.left = (x - hint.offsetWidth - 4)+'px';
      	else
            hint.style.left = (x + 15)+'px';
      	if((y + hint.offsetHeight + 19) > vcheight)
            hint.style.top = (y - hint.offsetHeight)+'px';
      	else
            hint.style.top = (y + 19)+'px';
      	hint.style.opacity = '.87';
      	hint.style.filter = "alpha(opacity:87)";
      	hint.style.visibility = 'visible';
    	}
    }
    this.initialize = function(){
    	var hint = document.createElement("DIV");
    	hint.setAttribute('id','hint');
    	document.getElementsByTagName('body')[0].appendChild(hint);
    	hint.style.visibility = 'hidden';
    	var hintmarker = ['img','a','tr','td','area'];
    	var textmarker = ['alt','title','title','title','title'];
    	var lenmarker = hintmarker.length;
    	for(var i=0; i<lenmarker; i++) {
    	atr = document.getElementsByTagName(hintmarker[i]);
    	for(var j=0; j<atr.length; j++)
    	if(viewhint=atr[j].getAttribute(textmarker[i])){
    	atr[j].removeAttribute(textmarker[i]);
    	HINT.show(atr[j],viewhint);
    	}
    	}
    }
}
function chlogin(obj){
	var err = '';
	if(!obj.elements['f[login]'].value) 	err += 'Не вказано логін\r\n';
	if(!obj.elements['f[passwd]'].value)	err += 'Не вказано пароль\r\n';
	if(err){
		alert(err);
		return false;
	}
	return true;
}
function insteg(id,aTag,eTag){
    Q(id).focus();
    if(typeof document.selection != 'undefined'){
        var range = document.selection.createRange();
        var insText = range.text;
        range.text = aTag + insText + ((eTag) ? eTag : '');
        range = document.selection.createRange();
        if(insText.length == 0 && eTag) range.move('character', -eTag.length);
        else range.moveStart('character',aTag.length+insText.length+((eTag) ? eTag.length : 0));
        range.select();
    }else if(typeof Q(id).selectionStart != 'undefined'){
        var start = Q(id).selectionStart;
        var end = Q(id).selectionEnd;
        var insText = Q(id).value.substring(start, end);
        Q(id).value = Q(id).value.substr(0, start) + aTag + insText + ((eTag) ? eTag : '') + Q(id).value.substr(end);
        var pos;
        if(insText.length == 0) pos = start + aTag.length;
        else pos = start + aTag.length + insText.length + ((eTag) ? eTag.length : 0);
        Q(id).selectionStart = pos;
        Q(id).selectionEnd = pos;
    }
}
function addsendmess(touser){
    sendmess(window.prompt('Написати повідомлення:',''),touser);
}
function sendmess(mess,touser){
    if(!mess || mess == ' ' || !touser){
        return;
    }
    if(!userid){
        alert('Помилка! Ви не авторизовані або час сесії вичерпано.');
        return;
    }
  	var url =  encodeURI(basehref+'/xml/sendsmessage/?mess='+mess+'&touser='+touser);
  	var h = mkhttp(url);
    if(!h) return false;
  	if(!h.responseXML.getElementsByTagName("status")[0].firstChild) return;
  	if(h.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue == 1){
        alert('Дякуємо, Ваше повідомлення успішно надіслане');
    }else{
        alert('Помилка! Ви не авторизовані або час сесії вичерпано.');
    }
}
function addrate(obj, absn, art, sect, rate, type){
    if(!windowload) return;
    if(type == 2){
  	    var url =  basehref+'/xml/avote?mode='+type+'&rate='+rate+'&commid='+absn+'&sectid='+sect+'&artid='+art;
  	    var h = mkhttp(url);
  	    if(!h) return false;
        obj.onclick = null;
        obj.src = '/upload/tmp/plus2.gif';
        obj.blur();
  	    var res = h.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue;
        if(res < 1){alert('Ви вже голосували');return;}
        if(Q('mark_'+absn)) Q('mark_'+absn).innerHTML = res;
        alert('Дякуємо, Ваш голос враховано');
    }
}
function SetCookie(name,value){
    var argv    = SetCookie.arguments;
    var argc    = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path    = (argc > 3) ? argv[3] : null;
    var domain  = (argc > 4) ? argv[4] : null;
    var secure  = (argc > 5) ? argv[5] : false;
    document.cookie = name + "="+escape(value)+";"+((expires==null)?"":("expires="+expires.toGMTString()))+((path==null)?"; path=/":("; path=" +path))+((domain==null)?"; domain=.bershad.ua":("; domain="+domain))+((secure==true)?"; secure":"");
}
function GetCookie(name){
    var arg  = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i    = 0;
    while (i < clen){
        var j = i + alen;
        if(document.cookie.substring(i, j) == arg) return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if(i==0) break;
    }
    return null;
}
function getCookieVal(offset){
    var endstr = document.cookie.indexOf (";",offset);
    if (endstr == -1)endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset,endstr));
}
function DeleteCookie(name){
    var exp  = new Date();
    var cval = GetCookie (name);
    exp.setTime (exp.getTime() - 1);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function sendTxtError(evt){
	evt = (evt)?evt :((window.event)?window.event : null);
	if (evt) {
		if (evt.keyCode == 10 || (evt.keyCode == 13 && evt.ctrlKey)) {
			var oInit = {
				maxlen: 256,
				wText:  {
					Big: "Виділено занадто багато тексту",
					NoSupport: "Ваш оглядач не підтримує таку функцію",
					Error: "Помилка в тексті",
					Send: "Надіслати повідомлення редактору?\nВи залишитесь на цій же сторінці",
					Mark: "<помилка>",
                    Sencs: "Дякуємо за допомогу!"
				}
			}
			var sel = null;
			sel = (parent.getSelection) ? parent.getSelection() : ((parent.document.getSelection) ? parent.document.getSelection() : ((document.selection.createRange) ? document.selection.createRange().text : null));
			if(sel == null) {
				alert(oInit.wText.NoSupport);
				return;
			}
            sel += '';
			if(sel.length > oInit.maxlen){
				alert(oInit.wText.Big);
				return;
			}
			if(sel == "") return;
			if(confirm(oInit.wText.Error + "\n" + oInit.wText.Mark + sel + oInit.wText.Mark + "\n\n" + oInit.wText.Send)){
		        re = /\r/g;
				sel = sel.toString().replace(re, " ");
		        re = /\n/gi;
				sel = sel.toString().replace(re, " ");
                var url =  basehref+'/xml/senderror?txterr='+sel+'&useragent='+navigator.userAgent+'&docloc='+document.location.href;
        	    var h = mkhttp(url);
                alert(oInit.wText.Sencs);
			}
		}
    }
}
function cntrentererror(){
    if (!((navigator.appName.indexOf("Netscape")!=-1 && eval(navigator.appVersion.substring(0,1)) < 5) || (isOpera && verOpera < 7))) {
    	document.onkeypress = sendTxtError;
        if(Q('cntrlEnter')){
            Q('cntrlEnter').innerHTML = 'Якщо Ви виявили помилку, виділіть текст з помилкою та натисніть Ctrl+Enter щоб повідомити про це редакцію';
            Q('cntrlEnter').style.display = 'block';
        }
    }
}
function changetab(div,id){
    for(i=0;i<25;i++){
        if(!$('#'+div+'_'+i+'_td')) break;
        if(id == i){
            $('#'+div+'_'+i+'_td').addClass('current');
            $('#'+div+'_'+i+'_content').css({display: 'block'});
        }else{
            $('#'+div+'_'+i+'_td').removeClass('current');
            $('#'+div+'_'+i+'_content').css({display: 'none'});
        }

    }
}
popup_typesall = null;
function closePopup(){
    $('#opaco').toggleClass('hidden').removeAttr('style');
    $('#popup_'+popup_typesall).toggleClass('hidden')
    popup_typesall = null;
    return false;
}
function showPopup(popup_type){
    if(!windowload) return;
    $(".reference_form").show();
    $(".reference_status").hide();
    if($.browser.msie){
        $('#opaco').height($(document).height()).toggleClass('hidden');
    }else{
        $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.2);
    }
    $('#popup_'+popup_type).alignCenter().toggleClass('hidden');
    popup_typesall = popup_type;
    return false;
}
function preimg(src){
    var x = new Image();
    x.src = src;
    globimgprev[globimgprev_num++] = x;
}
function newmessage(){
    if(countmessage > 0){
        $("#newmessage").html('є нові повідомлення <a href="/passport/mycontacts.html"><b>('+countmessage+')</b></a>&nbsp;').removeClass('green').addClass('red');
    }else{
        $("#newmessage").html('нових повідомлень немає&nbsp;').removeClass('red').addClass('green');
    }
}
function xvotess(){
    this.start = function(){
        var this_ = this;
        $('ul.votesrender li').each(function(){
            var x = $(this).attr('absn');var y = $(this).attr('nums');
            $(this).find('a').click(function(){this_.vot(x, y);});
        });
        this.render();
    }
    this.render = function(){
        $('ul.votesrender li').each(function(){
            var x = $(this).attr('absn');
            var y = $(this).attr('nums');
            var s = xvotes_sum[x];
            var z = parseInt(100/(!s?1:s)*xvotes_opt[x+'_'+y]);
            $(this).find('i').text(z+'% / '+xvotes_opt[x+'_'+y]);
            $(this).find('i').animate({width:(z>1?z*2+30:30)+'px'}, 500);
        });
    }
    this.vot = function(x,y){
        var this_ = this;
        $.ajax({url:'/xml/avote?mode=3&artid='+x+'&commid='+y, type:'GET', dataType:'xml', cache:false, success:function(data){
            if(parseInt($(data).find('status').text())){
                xvotes_opt[x+'_'+y] += 1;
                xvotes_sum[x] += 1;
                this_.render();
            }else{
                alert('Вибачте, ви вже голосували');
            }
        }});
    }
}
var userid  = 0;
var artid   = 0;
var sectid  = 0;
var langid  = 1;
firstgeturl = 1;
var member = new Array();
var commentisvoted = new Array();
var xvotes_opt = new Array();
var xvotes_sum = new Array();
var nocomment = null;
var globimgprev = [];
var globimgprev_num = 0;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
if(isOpera) var verOpera = parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("Opera")+6));
brshd = new Array();
star_o      = new Image();
star_o.src  = "/upload/tmp/star_o_small.gif";
tmp         = new Array(star_o.src);
var issallrate= new Array();
var tickermsg= new Array();
var ticdelay  = 30;
var ticnextm  = 0;
var B = new B_Load();
var HINT = new B_Hint();
if(B.objects) B.addsevent(HINT.initialize);
