<!--
 //--------------------------------------------------
 // 27.05.2002
 //--------------------------------------------------
 var IE,IE4;
 if (window.navigator.userAgent){
   var ua = window.navigator.userAgent
   var msie = ua.indexOf ( "MSIE " )
   if ( msie > 0 ){      
     IE=true;
     if ( parseInt(ua.substring(msie+5,ua.indexOf(".",msie)))>=4 )
       IE4=true;
   }
 }

 function td_In(N,color) {
   if (IE4) N.style.backgroundColor=color; 
 }
 function td_Out(N,color) {
   if (IE4) N.style.backgroundColor=color; 
 }
 

  saveBgColor="white";
  function cIn(newColor){
    if ( IE4 ){
      el=window.event.srcElement;
      while ( el!=null ){
        if (el.nodeName=="TABLE") break;
        if ((el.nodeName=="TD" || el.nodeName=="TH") && el.cIt) {
          saveBgColor=el.style.backgroundColor;
          if (el.cIt.charAt(0)=="#") el.style.backgroundColor  = el.cIt;
          else if (newColor) el.style.backgroundColor  = newColor;
          else  el.style.backgroundColor  = "#E0E0D0";
          break;
        }
        el=el.parentNode;
      }
    }
  }

  function cOut(){
    if ( IE4 ){
      el=window.event.srcElement;
      while ( el!=null ){
        if (el.nodeName=="TABLE") break;
        if ((el.nodeName=="TD" || el.nodeName=="TH") && el.cIt) {
          el.style.backgroundColor  = saveBgColor;
          break;
        }
        el=el.parentNode;
      }
    }
  }

  function mIn(newColor){
    if ( IE4 ){
      el=window.event.srcElement;
      while ( el!=null ){
        if (el.nodeName=="TD") break;
        if (el.nodeName=="DIV" && el.cIt) {
          saveBgColor=el.style.backgroundColor;
          if (el.cIt.charAt(0)=="#") el.style.backgroundColor  = el.cIt;
          else if (newColor) el.style.backgroundColor  = newColor;
          else  {
            el.style.backgroundColor  = "#D0883F";
            if (el.children.item(0))
              if (el.children.item(0).children.item(0))
                el.children.item(0).children.item(0).color="black";
          }
          break;
        }
        el=el.parentNode;
      }
    }
  }

  function mOut(){
    if ( IE4 ){
      el=window.event.srcElement;
      while ( el!=null ){
        if (el.nodeName=="TD") break;
        if (el.nodeName=="DIV" && el.cIt) {
          el.style.backgroundColor  = saveBgColor;
          if (el.children.item(0))
            if (el.children.item(0).children.item(0))
              el.children.item(0).children.item(0).color="white";
          break;
        }
        el=el.parentNode;
      }
    }
  }

  function cClick(){
    if ( IE4 ){
      el=window.event.srcElement;
      if (el.nodeName!="A"){
        i=0;
        while (i<el.all.length) {
          chel=el.all(i);
          if (chel.nodeName=="A" && chel.href) 
            break;
          i++;
        }
        if (i<el.all.length) {
          window.navigate(el.all(i).href);
        }
      }
    }
  }

  function getCookie(cName){
    if ( !document.cookie ) return null;
    var cook = "";
    cook=document.cookie.replace("+","%20");

    var pr = cName + "=";
    var si = cook.indexOf(pr);
    if ( si==-1) return null;
    var ei = cook.indexOf(";", si + pr.length);
    if ( ei==-1)
      ei = cook.length;
    return unescape(cook.substring(si + pr.length, ei))
  }

//2005 RBS2. 2010.02.03 ver
var timeout;
var	showtimeout;
var shownKl=null;

function inKl(klID){
    clearTimeout(showtimeout);
    showtimeout = setTimeout( "showKlDiv(\'"+klID+"\')", 200 );
}
function showKlDiv(klID){
	if (shownKl!=null) hideKlDiv(shownKl.id);
	shownKl=document.getElementById(klID);
	if (klID=='bestpopupmenu'){
		ofsLeft = document.body.offsetWidth/2 - shownKl.offsetWidth/2;
		shownKl.style.left = ofsLeft+'px';
	}
	else{
		tdklm =  document.getElementById('td'+klID);
		if (tdklm!=null){
			ofsLeft = offsetPositionLeft(tdklm);
			shownKl.style.left = ofsLeft+'px';
		}
		topban = document.getElementById('topbanner');
		if (topban!=null) topban.style.visibility='hidden';
	}
	shownKl.style.visibility='visible';
}
function enterKlDiv(klID){
    clearTimeout(timeout);
    clearTimeout(showtimeout);
	shownKl=document.getElementById(klID);
	shownKl.style.visibility='visible';
}
function outKl(klID){
    clearTimeout(showtimeout);
    timeout = setTimeout( "hideKlDiv(\'"+klID+"\')", 100 );
}
function hideKlDiv(klID){
	document.getElementById(klID).style.visibility='hidden';
	shownKl=null;
	if (klID!='bestpopupmenu'){
		topban = document.getElementById('topbanner');
		if (topban!=null) topban.style.visibility='visible';
	}
}

function offsetPosition ( element ) {
    var offsetLeft = 0, offsetTop = 0;
    do { 
        offsetLeft += element.offsetLeft
        offsetTop  += element.offsetTop;
    }
    while ( element = element.offsetParent );
    return [ offsetLeft, offsetTop];
}
function offsetPositionLeft ( element ) {
    var offsetLeft = 0, offsetTop = 0;
    do { 
        offsetLeft += element.offsetLeft
        offsetTop  += element.offsetTop;
    }
    while ( element = element.offsetParent );
    return offsetLeft;
}

function add_favorite(a) {
	title=document.title;
	url=document.location.href;
	try {
		// Internet Explorer
		window.external.AddFavorite(url, title);
	}
	catch (e) {
		try {
			// Mozilla
			window.sidebar.addPanel(title, url, "");
		}
		catch (e) {
			// Opera
			if (typeof(opera)=="object") {
				a.rel="sidebar";
				a.title=title;
				a.url=url;
				return true;
			}
			else {
				// Unknown
				alert('Нажмите Ctrl-D чтобы добавить страницу в закладки');
			}
		}
	}
	return false;
}


//-->
