var ret;
if(!Array.prototype.push){Array.prototype.push=function(obj){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i];}
return this.length;}}
if(!Array.prototype.shift){Array.prototype.shift=function(){var result=this[0];for(var i=0;i<this.length-1;i++){this[i]=this[i+1];}
this.length--;return result;}}
if(!Array.prototype.unshift){Array.prototype.unshift=function(){this.reverse();for(var i=arguments.length-1;i>=0;i--){this[this.length]=arguments[i]}
this.reverse();return this.length;}}
if(!Array.prototype.pop){Array.prototype.pop=function(){lastElement=this[this.length-1];this.length=Math.max(this.length-1,0);return lastElement;}}
Object.extend=function(destination,source){for(property in source){destination[property]=source[property];}
return destination;}
function $(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')
element=document.getElementById(element);if(arguments.length==1)
return element;elements.push(element);}
return elements;}
function getElementsByClassName(strClass,strTag,objContElm)
{
	strTag=strTag||"*";
	objContElm=objContElm||document;
	var objColl=(strTag=='*'&&document.all)?document.all:objContElm.getElementsByTagName(strTag);
	var arr=new Array();
	var delim=strClass.indexOf('|')!=-1?'|':' ';
	var arrClass=strClass.split(delim);
	if(objColl.length)
	{
	for(i=0,j=objColl.length;i<j;i++)
	{
                if(objColl[i].className)
                {	
		var arrObjClass=objColl[i].className.split(' ');
		if(delim==' '&&arrClass.length>arrObjClass.length)continue;
		var c=0;
		comparisonLoop:for(k=0,l=arrObjClass.length;k<l;k++)
		{
			for(m=0,n=arrClass.length;m<n;m++)
			{
				if(arrClass[m]==arrObjClass[k])c++;
				if((delim=='|'&&c==1)||(delim==' '&&c==arrClass.length))
				{
					arr.push(objColl[i]);
					break comparisonLoop;
				}
			}
		}
		}
	}
	}
	return arr;
}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
function addEvent(elm,evType,fn,useCapture){if(elm.addEventListener){elm.addEventListener(evType,fn,useCapture);return true;}
else if(elm.attachEvent){var r=elm.attachEvent('on'+evType,fn);EventCache.add(elm,evType,fn);return r;}
else{elm['on'+evType]=fn;}}
var EventCache=function(){var listEvents=[];return{listEvents:listEvents,add:function(node,sEventName,fHandler,bCapture){listEvents.push(arguments);},flush:function(){var i,item;for(i=listEvents.length-1;i>=0;i=i-1){item=listEvents[i];if(item[0].removeEventListener){item[0].removeEventListener(item[1],item[2],item[3]);};if(item[1].substring(0,2)!="on"){item[1]="on"+item[1];};if(item[0].detachEvent){item[0].detachEvent(item[1],item[2]);};item[0][item[1]]=null;};}};}();addEvent(window,'unload',EventCache.flush,false);

var LoadEvents=new Array();
function pushLoadEvent(func)
{
    LoadEvents.push(func);
}
function LoadEventsStart()
{
   for(var i=0;i<LoadEvents.length;i++)
   {
           LoadEvents[i]();
   }
}
addEvent(window,'load',LoadEventsStart,false);

function ShowNews(theURL,winName)
{ //v1.0
	var now = new Date();
	window.open(theURL,winName+now.getTime(),'scrollbars=1,width=800,height=600,');
}
function ShowImage(URL,width,height)
{ //v1.0
	var now = new Date();
	winName="Изображение";
	window.open(URL,winName+now.getTime(),'scrollbars=0,width='+(parseInt(width)+30).toString()+',height='+(parseInt(height)+30).toString()+',');
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,'scrollbars=0,width=920,height=700,');
}
function MM_openBrWindowEx(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function ActivateMenu()
{
    if (rubric_id)
    {
        var id='menu_item_'+rubric_id;
        var li=document.getElementById(id);
        ActiveMenuProcessLI(li);
        
        var id='menu1_item_'+rubric_id;
        var li=document.getElementById(id);
        ActiveMenuProcessLI(li);
    }
}
function ActiveMenuProcessLI(li)
{
       var ul;
        
        while(li)
        {
            li.className='active';
            if(li.parentNode)
                if(li.parentNode.parentNode)
                    if (li.parentNode.parentNode.tagName=='LI')
                        li=li.parentNode.parentNode;
                    else
                        li=null;
                else
                    li=null;
            else
                li=null;
        }
}
addEvent(window,'load',ActivateMenu,false);

function GetDate()
{
    var a=new Date();
   
    var D=a.getDate();
    var W=a.getDay();
    var Y=a.getFullYear();
    var M=a.getMonth()+1;
    var MM='';
    var WW='';
    switch (M)
      {
        case 1: { MM='Января'; break }
        case 2: { MM='Февраля'; break }
        case 3: { MM='Марта'; break }
        
        case 4: { MM='Апреля'; break }
        case 5: { MM='Майя'; break }
        case 6: { MM='Июня'; break }
        
        case 7: { MM='Июля'; break }
        case 8: { MM='Августа'; break }
        case 9: { MM='Сентября'; break }
        
        case 10: { MM='Октября'; break }
        case 11: { MM='Ноября'; break }
        case 12: { MM='Декабря'; break }
        
      }
      switch (W)
      {
        case 0: { WW='Воскресенье'; break }
        
        case 1: { WW='Понедельник'; break }
        case 2: { WW='Вторник'; break }
        case 3: { WW='Среда'; break }
        
        case 4: { WW='Четверг'; break }
        case 5: { WW='Пятница'; break }
        case 6: { WW='Суббота'; break }
        
        
        
      }
      return "<div class='right_date'><div class='d'>"+D.toString()+" "+MM+"</div><div class='y'>"+Y.toString()+" г.</div><div class='w'>"+WW.toString()+"</div></div>"
}
function DetectBrowser()
{
    var browserName=navigator.appName; 
    
    var Class='';
    if (browserName=="Netscape")
    { 
     Class+='NS ';
    }
    if (browserName=="Microsoft Internet Explorer")
    {
      Class+='IE ';
      if(navigator.appVersion.indexOf('MSIE 7')!=-1) Class+='IE7 ';
      if(navigator.appVersion.indexOf('MSIE 6')!=-1) Class+='IE6 ';
      if(navigator.appVersion.indexOf('MSIE 5')!=-1) Class+='IE5 ';
    }
    else
       Class+='NIE ';
    if (browserName=="Opera")
     {
      Class+='OP ';
     } 
     document.body.className=Class;
}
DetectBrowser();

function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "/images/blank.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
		
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}
function ShowNews(URL,w,h)
{
    var now = new Date();
	winName='Новость';
	URL=location.protocol+"//"+location.hostname+URL;
	window.open(URL,winName+now.getTime(),'scrollbars=1,width='+w+',height='+h);
    return true;
}
//Всплывающая подсказка для изображений
function ToolTipShowMove(e)
    {
        var tt=document.getElementById("tool_tip");
        
        var IsIE=0;
        if (navigator.appName=="Microsoft Internet Explorer") IsIE=1;
        
        var x,y;
        x=0;
        y=0;
        if (IsIE==0)
        {
            x=e.pageX+13;
            y=e.pageY+18;
        }
        else
        {
            x=window.event.x+document.documentElement.scrollLeft+13;
            y=window.event.y+document.documentElement.scrollTop+18;
        }
        if (tt.oldx!=x) tt.style.left=x+'px';
        if(tt.oldy!=y) tt.style.top=y+'px';
        tt.oldx=x;
        tt.oldy=y;
        if(tt.style.display!='block')tt.style.display='block';
        
    }
    function ToolTipShow(Img,Text)
    {
        
        var tt=document.getElementById("tool_tip");
        if (!tt) 
        {
            tt=document.createElement("DIV");
            tt.style.display='none';
            tt.style.position='absolute';
            tt.id="tool_tip";
            document.body.appendChild(tt);            
        }
        tt.innerHTML=Text;
        tt.oldx=0;
        tt.oldy=0;
        tt.style.display='block';
        
        Img.onmousemove=ToolTipShowMove;        
        
        Img.old_onmouseover=Img.onmouseover;
        Img.onmouseover=new Function();        
        
        Img.old_onmouseout=Img.onmouseout;
        
        Img.onmouseout=ToolTipHide;
        
    }
    function ToolTipHide()
    {
        document.getElementById("tool_tip").style.display='none';    
        this.onmouseout=this.old_onmouseout;
        try{this.onmouseout();} catch(e){}
        
        this.onmouseover=this.old_onmouseover;            
    }