//<![CDATA[
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/dhtml/tooltip [v1.1]

//========================================================
// REQUIRES http://www.jsfromhell.com/geral/event-listener
//========================================================

//+ Carlos R. L. Rodrigues
//@ http://jsfromhell.com/geral/event-listener [v1.4]

addEvent = function(o, e, f, s){
    var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
    r[r.length] = [f, s || o], o[e] = function(e){
        try{
            (e = e || (window.event ? (arguments = [].slice.call(arguments)).unshift(e = event) || 1 && e : {})).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
            e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
            e.target || (e.target = e.srcElement || null);
            e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
        }catch(f){}
        for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.apply ? c = a.apply(o, arguments) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
        return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
    for(var i = (e = o["_on" + e] || []).length; i;)
        if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
            return delete e[i];
    return false;
};

//========================================================
// REQUIRES http://www.jsfromhell.com/geral/event-listener
//========================================================

ToolTip = function(o, t, c, f){
	var i, $ = this;
	$.s = ($.o = document.createElement("div")).style;
	$.s.display = "none", $.s.position = "absolute", $.o.className = c, $.t = t, $.f = f;
	for(i in {mouseout: 0, mouseover: 0, mousemove: 0})
		addEvent(o, i, function(e){$[e.type](e);});
};
with({p: ToolTip.prototype}){
	p.update = function(e){
		var w = window, b = document.body;
		this.s.top = e.clientY + (w.scrollY || b.scrollTop || b.parentNode.scrollTop || 0) + "px",
		this.s.left = e.clientX + (w.scrollX || b.scrollLeft || b.parentNode.scrollLeft || 0) + "px";
	}
	p.mouseout = function(){
		this.s.display = "none";
	};
	p.mouseover = function(e){
		document.body.appendChild(this.o).innerHTML = this.t,
		e.stopPropagation(), this.update(e), this.s.display = "block";
	};
	p.mousemove = function(e){
		this.f && this.update(e);
	};
	p.setContent = function(s){
		this.o.innerHTML = this.t = s;
	};
}

function get_tool_tip(meEle, varImg)
{
	var t = new ToolTip(document.getElementById(meEle), "<img src='" + varImg + "'>", "toolTip", true);
}

//]]>
