document.write('<div id="tt" class="tt" onmouseover="clearTimeout(tohid);" onmouseout="clearTimeout(tosho); hid();"></div>');
document.write('<div id="shad" class="shad"></div>');

var rzid=new Array('',
'Химическая энциклопедия',
'БСЭ',
'Справочник по веществам',
'Лекарственные препараты',
'Биохимический справ.',
'Неорганическая химия',
'Органическая химия',
'Токсикологическая химия',
'Теплотехника',
'Коллоидная химия',
'Биологическая химия',
'Фармацевтический справ.',
'Углеводы',
'Наглядная биохимия',
'Экологическая химия');

var ww=0;
if (self.innerHeight) {	
    ww = self.innerWidth;		
} else if (document.documentElement && document.documentElement.clientHeight) {	
    ww = document.documentElement.clientWidth;	
} else if (document.body) {	
    ww = document.body.clientWidth;	
}

function mXY(e)
{
  var x = 0, y = 0;
  if (!e) e = window.event;
  if (e.pageX || e.pageY)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
  hh = (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  return {"x":x, "y":y};
}

var vel = true;
var rg;

document.onmousemove = function(e) {
	var mC = mXY(e);
	x = mC.x;
	y = mC.y;
	}

var rw=0;
var wiw=0;
var detect = navigator.userAgent.toLowerCase();

function gebi(arh){
	return(document.getElementById(arh));
	}

function sho(zima,zssy){
	var inside="";
	var hi=0;
	inside="<span>Дополнительно:</span>";
	for(j=0, len=zima.length; j<len; j++) {
		inside+="<li><a href='"+bubu+zssy[j]+"'>"+zima[j]+"</a></li>";
	}
	gebi('tt').innerHTML=inside;
	wiw=gebi('tt').offsetWidth;

	if((detect.indexOf('msie'))==-1) {wiw-=4;}
	gebi('shad').style.width=wiw;
	wiw+=24;
	hi=18*len+22;
	gebi('tt').style.height=hi+'px';
	gebi('shad').style.height=hi+'px';
	gebi('shad').style.visibility='visible';
	gebi('tt').style.visibility='visible';
	
	if ((x+wiw)>ww) {x=ww-wiw;}
	if ((y-hh)<hi) {y+=hi+20;}

	gebi('shad').style.top=y-hi-10;
	gebi('shad').style.left=x+3;
	
	gebi('tt').style.top=y-hi-13;
	gebi('tt').style.left=x;
	}
	
var tohid;
var tosho;
var ima=new Array();
var ssy=new Array();

function hid(){
	tohid = setTimeout("gebi('tt').style.visibility='hidden';gebi('shad').style.visibility='hidden'",delay);
	}
  
var anz = document.getElementsByTagName("a");
	for (var i=0, len=anz.length; i<len; i++) {
		anz[i].onmouseover=function() {
			clearTimeout(tohid);
			var j=1;
			ima=[];
			ssy=[];
			while(this.getAttribute("tit"+j)) {
				ima.push(rzid[this.getAttribute("tit"+j)]);
				ssy.push(this.getAttribute("lin"+j));
				j++;
			}
			if(j>1) {tosho = setTimeout("sho(ima,ssy)",delay);} else {clearTimeout(tosho); hid();}
		}
		anz[i].onmouseout=function() {clearTimeout(tosho); hid();}
	}
	
var delay=200;
var delik=400;
var speed=30;
var shag=1;
var bubu="http://www.xumuk.ru/";
