
var balloonX = -30; //This is balloon's X offset//
var balloonY = 25; //This is balloon's Y offset//



//There's No need to edit anything below this line//
toolballoon = {
  name : "balloon",
  offsetX : balloonX,
  offsetY : balloonY,
  balloon : null
}

toolballoon.init = function () {
	var balloonNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!balloonContainerID){ var balloonContainerID = "balloon";}
	var balloonContainer = document.getElementById(balloonContainerID);

	if(!balloonContainer) {
	  balloonContainer = document.createElementNS ? document.createElementNS(balloonNameSpaceURI, "div") : document.createElement("div");
		balloonContainer.setAttribute("id", balloonContainerID);
	  document.getElementsByTagName("body").item(0).appendChild(balloonContainer);
	}

	if (!document.getElementById) return;
	this.balloon = document.getElementById (this.name);
	if (this.balloon) document.onmousemove = function (evt) {toolballoon.move (evt)};

	var a, sTitle;
	var anchors = getElementsByClass('balloon');

	for (var i = 0; i < anchors.length; i ++) {
		a = anchors[i];
		sTitle = a.getAttribute("title");
		if(sTitle) {
			a.setAttribute("balloontitle", sTitle);
			a.removeAttribute("title");
			a.onmouseover = function() {toolballoon.show(this.getAttribute('balloontitle'))};
			a.onmouseout = function() {toolballoon.hide()};
		}
	}
}

toolballoon.move = function (evt) {
	var x=0, y=0;
	if (document.all) {//IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//FF etc.
		x = evt.pageX;
		y = evt.pageY;
	}
	this.balloon.style.left = (x + this.offsetX) + "px";
	this.balloon.style.top = (y + this.offsetY) + "px";
}

toolballoon.show = function (text) {
	if (!this.balloon) return;
	this.balloon.innerHTML = text;
	this.balloon.style.display = "block";
}

toolballoon.hide = function () {
	if (!this.balloon) return;
	this.balloon.innerHTML = "";
	this.balloon.style.display = "none";
}