/*javascript for Bubble Tooltips by Alessandro Fulciniti
- http://pro.html.it - http://web-graphics.com */

function enableTooltipsRight(id){
var links,i,h;
if(!document.getElementById || !document.getElementsByTagName) return;
AddCssRight();
h=document.createElement("span");
h.id="btcright";
h.setAttribute("id","btcright");
h.style.position="absolute";
document.getElementsByTagName("body")[0].appendChild(h);
if(id==null) links=document.getElementsByTagName("a");
else links=document.getElementById(id).getElementsByTagName("a");
for(i=0;i<links.length;i++){
    PrepareRight(links[i]);
    }
}

function PrepareRight(el){
var tooltip,t,b,c,s,l,r;
l=el.getAttribute("name");
t=el.getAttribute("title");
if(t==null || t.length==0) return;
el.removeAttribute("title");
tooltip=CreateElRight("span","tooltip");
c=CreateElRight("b","maintop");
tooltip.appendChild(c);
r=CreateElRight("span","something");
r.appendChild(document.createTextNode(l));
tooltip.appendChild(r);
s=CreateElRight("span","top");
s.appendChild(document.createTextNode(t));
tooltip.appendChild(s);
b=CreateElRight("b","bottom");
tooltip.appendChild(b);
//l=el.getAttribute("href");
//if(l.length>30) l=l.substr(0,27)+"...";
//b.appendChild(document.createTextNode(l));
setOpacityRight(tooltip);
el.tooltip=tooltip;
el.onmouseover=showTooltipRight;
el.onmouseout=hideTooltipRight;
el.onmousemove=LocateRight;
}

function showTooltipRight(e){
document.getElementById("btcright").appendChild(this.tooltip);
LocateRight(e);
}

function hideTooltipRight(e){
var d=document.getElementById("btcright");
if(d.childNodes.length>0) d.removeChild(d.firstChild);
}

function setOpacityRight(el){
el.style.filter="alpha(opacity:70)";
el.style.KHTMLOpacity="0.70";
el.style.MozOpacity="0.70";
el.style.opacity="0.70";
}

function CreateElRight(t,c){
var x=document.createElement(t);
x.className=c;
x.id=c;
x.style.display="block";
return(x);
}

function AddCssRight(){
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","../includes/btright.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}

function LocateRight(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("btcright").style.top=(posy+10)+"px";
document.getElementById("btcright").style.left=(posx-375)+"px";
}
