window.onload = function() {
	myInit()
};

function myInit() {
	// AddCss();
	h = document.createElement("span");
	h.id = "btc";
	h.style.zIndex = 20000;
	h.setAttribute("id", "btc");
	h.style.position = "absolute";
	document.getElementsByTagName("body")[0].appendChild(h);
}

var showTooltip = function(ob, title, content, e) {
	var tooltip = CreateEl("span", "tooltip");
	tooltip.style.zIndex = 20000;
	var s = CreateEl("span", "top");
	s.style.zIndex = 20000;
	s.appendChild(document.createTextNode(title));
	tooltip.appendChild(s);
	var b = CreateEl("b", "bottom");
	b.style.zIndex = 20000;
	b.appendChild(document.createTextNode(content));
	tooltip.appendChild(b);
	setOpacity(tooltip);
	ob.tooltip = tooltip;
	// el.onmouseover=showTooltip;
	// var e = window.event ? window.event : e;
	// alert(e);
	// showTooltip(e);
	ob.onmouseout = hideTooltip;
	document.getElementById("btc").appendChild(tooltip);
	e = window.event ? window.event : e;
	Locate(ob, e);
	ob.onmousemove = function() {
		Locate(ob, e)
	};
}

function AddCss() {

}

function hideTooltip(e) {
	var d = document.getElementById("btc");
	if (d.childNodes.length > 0)
		d.removeChild(d.firstChild);
}

function setOpacity(el) {
	el.style.filter = "alpha(opacity:95)";
	el.style.KHTMLOpacity = "0.95";
	el.style.MozOpacity = "0.95";
	el.style.opacity = "0.95";
}

function CreateEl(t, c) {
	var x = document.createElement(t);
	x.className = c;
	x.style.display = "block";
	return (x);
}

function Locate(obj, e) {
	// var p = _getPosition(obj);
	var p = getEventPoint(e);
	var posx = p.x, posy = p.y;

	document.getElementById("btc").style.top = (posy + 10) + "px";
	document.getElementById("btc").style.left = (posx - 20) + "px";
}

var _getPosition = function(obj) {

	var ary = new Array();
	// var obj = document.getElementById(id);
	ary[0] = obj.offsetLeft;
	ary[1] = obj.offsetTop;
	while (obj = obj.offsetParent) {
		ary[0] += obj.offsetLeft;
		ary[1] += obj.offsetTop;
	}
	return {
		x : ary[0],
		y : ary[1]
	};
};

var getEventPoint = function(e) {
	e = window.event ? window.event : e;
	var _x = e.clientX;
	var _y = e.clientY;
	return {
		x : _x,
		y : _y
	};
};