var off_x=10;
var off_y=20;

var cid=document.getElementById('infoblock');
var isvis=false;

function mouseX(evt) {
	if(!evt) 
		evt=window.event; 
	if(evt.pageX) 
		return evt.pageX; 
	else if(evt.clientX)
		return evt.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft); 
	else
		return 0;
}

function mouseY(evt) {
	if(!evt) 
		evt=window.event; 
	if(evt.pageY) 
		return evt.pageY; 
	else if(evt.clientY)
		return evt.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop); 
	else
		return 0;

}




function follow(evt) {
	if (document.getElementById&&isvis==true) {
		var sx, sy, x, y;

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

		var dx=cid.clientWidth;
		var dy=cid.clientHeight;

		var mx=parseInt(mouseX(evt));
		var my=parseInt(mouseY(evt));

		x=mx+off_x;
		if(x+dx>sx)
			x=mx-off_x-dx;

		y=my+off_y;
		if(y+dy>(sy+document.documentElement.scrollTop))
			y=my-off_y-dy;

		cid.style.left=(x)+'px';
		cid.style.top=(y)+'px';

		if(sx&&mx&&dx) {
			if(cid.style.visibility!='visible')
				cid.style.visibility='visible';
		}
	}
}

document.onmousemove=follow;


function show_tag(txt) {
	if(arguments.length>1) {
		cid.style.opacity=1;
		cid.style.filter='alpha(opacity=100)';
	} else {
		cid.style.opacity=1;
		cid.style.filter='alpha(opacity=100)';
	}
	cid.innerHTML=txt;
	isvis=true;
}

function hide_tag() {
	cid.style.visibility='hidden';
	isvis=false;
}


