/*Javascript for Bubble Tooltips by Alessandro Fulciniti http://pro.html.it - http://web-graphics.com */





function enableTooltips(id){
var links,i,h;
if(!document.getElementById || !document.getElementsByTagName) return;
AddCss();
h=document.createElement("span");
h.id="btc";
h.setAttribute("id","btc");
h.style.position="absolute";
document.getElementsByTagName("body")[0].appendChild(h);
if(id==null) links=document.getElementsByTagName("a");
else links=getElementsByClassName(id,"a");/*Modify by laurentc*/
for(i=0;i<links.length;i++){
    Prepare(links[i]);
    }
}


/* Added by laurentc from http://www.bigbold.com/snippets/posts/show/830 */
function getElementsByClassName(clsName,htmltag){ 
	var arr = new Array(); 
	var elems = document.getElementsByTagName(htmltag);
	for ( var cls, i = 0; ( elem = elems[i] ); i++ ){
		if ( elem.className == clsName ){
			arr[arr.length] = elem;
		}
	}
	return arr;
}



function Prepare(el){
var tooltip,t,b,s,ff,hty,htyt;
t=el.getAttribute("title");
if(t==null || t.length==0) t="...";
el.removeAttribute("title");
el.removeAttribute("href");
tooltip=CreateEl("div","tooltip");
s=CreateEl("div","top");
tooltip.appendChild(s);
b=CreateEl("div","bottom");

hty=CreateEl("a","close");
hty.appendChild(document.createTextNode(". . ."));



htyt=CreateEl("div","texttt");
htyt.appendChild(document.createTextNode(t));

tooltip.appendChild(hty);
tooltip.appendChild(htyt);
tooltip.appendChild(b);
setOpacity(tooltip);
el.tooltip=tooltip;
el.style.borderBottom="1px dashed #CC6635"
el.style.color="#CC6635"
el.style.cursor="pointer"
el.style.textDecoration="none"
el.onmouseover=hov;
el.onmouseout=nhov;
el.onclick=showTooltip;
hty.onclick=hideTooltip;

}

function hov(){
this.style.color="#000000"
this.style.borderBottom="1px dashed #CC6635"
}
function nhov(){
this.style.borderBottom="1px dashed #CC6635"
this.style.color="#CC6635"
this.style.cursor="pointer"
this.style.textDecoration="none"
}

function showTooltip(e){
hideTooltip(e)
document.getElementById("btc").appendChild(this.tooltip);
Locate(e);
}

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 AddCss(){
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","assets/plugins/tooltipx/bt.css");/*Modify by laurentc*/
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}





function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
    posx=e.pageX; posy=e.pageY;
    }
else if(e.clientX || e.clientY){
    if(document.documentElement.scrollTop){
        posx=e.clientX+document.documentElement.scrollLeft;
        posy=e.clientY+document.documentElement.scrollTop;
        }
    else{
        posx=e.clientX+document.body.scrollLeft;
        posy=e.clientY+document.body.scrollTop;
        }
    }
document.getElementById("btc").style.top=(posy-50)+"px";
document.getElementById("btc").style.right=10+"px";
}