var LinkLayer = null;

function Init() {

ope	= window.opera?true:false;
ns4 = document.layers?true:false;
ie4 = document.all?true:false;
dmc = document.getElementById?true:false;

if (ns4) {
	g_StyleObj=function(o){return o;}
	pObj.prototype.show=function(){this.o.visibility='show';}
	pObj.prototype.hide=function(){this.o.visibility='hide';}
}
else {
	g_StyleObj=function(o){return o.style;}
	pObj.prototype.show=function(){this.s.visibility='visible';}
	pObj.prototype.hide=function(){this.s.visibility='hidden';}
}

if (ns4) g_Obj=function(id){return document.layers[id];}
else if (dmc) g_Obj=function(id){return document.getElementById(id);}
else if (ie4) g_Obj=function(id){return document.all[id];}

if (ns4) {
	pObj.prototype.getWidth=function(){return this.o.document.width;}
	pObj.prototype.getHeight=function(){return this.o.document.height;}
}
else if (ope) {
	pObj.prototype.getWidth=function(){return this.s.pixelWidth;}
	pObj.prototype.getHeight=function(){return this.s.pixelHeight;}
}
else {
	pObj.prototype.getWidth=function(){return this.o.offsetWidth;}
	pObj.prototype.getHeight=function(){return this.o.offsetHeight;}
}

if (ope) pObj.prototype.setPos=function(x,y){this.s.pixelLeft=x;this.s.pixelTop=y;}
else if (dmc) pObj.prototype.setPos=function(x,y){this.s.left=x+'px';this.s.top=y+'px';}
else if (ie4) pObj.prototype.setPos=function(x,y){this.s.pixelLeft=x;this.s.pixelTop=y;}
else if (ns4) pObj.prototype.setPos=function(x,y){this.o.moveTo(x,y);}

ie_pos = (document.body && typeof document.body.scrollTop!="undefined");
ns_pos = (typeof window.pageYOffset!='undefined');

document.onmousemove = msHandler;
if (ns4) {
	window.onmousemove = msHandler;
	window.captureEvents(Event.MOUSEMOVE);
	origWidth = innerWidth; origHeight = innerHeight;
	onresize = function(){if (innerWidth!=origWidth||innerHeight!=origHeight) location.reload();}}
}

function pObj(o) {this.o=o;this.s=g_StyleObj(o)}
function g_pObj(id) {return new pObj(g_Obj(id))}


function msHandler(e) {
	if (window.event) {
		docMsPosX = window.event.clientX;
		docMsPosY = window.event.clientY;
		if (ie_pos && !ope) {
			docMsPosX += document.body.scrollLeft;
			docMsPosY += document.body.scrollTop;
		}
	}
	else { docMsPosX = e.pageX; docMsPosY = e.pageY; }
	if (LinkLayer!=null) PositionBox();
}


function hideLinks() {
	if (LinkLayer!=null) LinkLayer.hide();
	LinkLayer = null;
}

function PositionBox() {
	var x = docMsPosX + 30;
	var y = docMsPosY - 20;
	var w = LinkLayer.getWidth();
	var h = LinkLayer.getHeight();
	if (ns_pos && typeof window.innerHeight!='undefined') {
		var xStart = window.pageXOffset;
		var xEnd = xStart+window.innerWidth;
		var yStart = window.pageYOffset;
		var yEnd = yStart+window.innerHeight;
	}
	else if (ie_pos) {
		var xStart = document.body.scrollLeft;
		var xEnd = xStart+document.body.clientWidth;
		var yStart = document.body.scrollTop;
		var yEnd = yStart+document.body.clientHeight;
	}
	if ((x+w)>=xEnd) x=docMsPosX-w-30; if (x<xStart) x=xStart+2;
	if ((y+h)>=yEnd) y=yEnd-h-20; if (y<yStart) y=yStart+2;
	LinkLayer.setPos(x,y);
}

function putLinks(id) {
	hideLinks(); LinkLayer = g_pObj(id);
	PositionBox();
	LinkLayer.show();
}