var nXPos;
var nYPos;
var cGlobal;
var iDocID;
var ScreenWidth=1024;
//document.captureEvents(Event.CLICK);
document.onclick=clickfunction;
if (!document.all) {
	document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove=TrackMouse;
}

if (top.data.innerWidth) {
	ScreenWidth = top.data.innerWidth;
} else if (top.data.documentElement && top.data.documentElement.clientWidth) {
	ScreenWidth = top.data.documentElement.clientWidth;
} else if (top.data.body) {
	ScreenWidth = top.data.body.clientWidth;
} else if (screen) {
	ScreenWidth = screen.width-300;
} else {
	ScreenWidth = 300;
}
//ScreenWidth-=300;

function ToolOn(cID) {
	GlobOff();
	var oSpan=GetSpan(cID);
	var nSpanWidth=parseInt(GetSpanWidth(cID));
	if (oSpan) {
		if (document.all) {
			nXPos=event.x+document.body.scrollLeft;
			nYPos=event.y+document.body.scrollTop;
		}
		oSpan.top=(nYPos+23)+"px";
		if (nXPos+nSpanWidth>ScreenWidth) {
			oSpan.left="auto";
			oSpan.right="0%";
		} else {
			oSpan.right="auto";
			if (nXPos>20) {
				oSpan.left=(nXPos-50)+"px";
			} else {
				oSpan.left="0px";
			}
		}
		oSpan.visibility='visible';
	}
	cGlobal=cID;
	if (iDocID) clearTimeout(iDocID);
	iDocID=setTimeout("GlobOff()",8000);
}

function ToolOff(cID) {
	if (iDocID) clearTimeout(iDocID);
	iDocID=setTimeout("GlobOff()",0);
}

function GlobOff() {
	if (iDocID) clearTimeout(iDocID);
	if (cGlobal!="") {
		var oSpan=GetSpan(cGlobal);
		if (oSpan) {
			oSpan.visibility='hidden';
		}
		cGlobal="";
	}
}

function GetSpan(cID) {
	var oResult;
	if (document.all) {
		oResult=document.all[cID];
	} else if (document.getElementById) {
		oResult=document.getElementById(cID);
	}
	if (oResult) {
		return oResult.style;
	}
	return null;
}

function TrackMouse(oEvent) {
	nXPos=oEvent.pageX;//-10;
	nYPos=oEvent.pageY;//+5;
}

function clickfunction(oEvent) {
	GlobOff();
}

function GetSpanWidth(cID) {
	var s=false;
	quotesElements = document.getElementById(cID);
	if (quotesElements.length > 0) {
		q=quotesElements[0];
	} else {
		q=quotesElements;
	}
	if (q.currentStyle) {
		s = q.currentStyle;
	} else if (document.defaultView && document.defaultView.getComputedStyle) {
		s = document.defaultView.getComputedStyle(q,'');
	}
	if (s) {
		var width=100;
		width=s['width'];
		return width;
	} else {
		return 100;
	}
}

top.cdaybody=self.location.pathname;
if (parent.location.href == self.location.href)
   window.location.href = '../index.htm?daybody='+top.cdaybody+self.location.search;