window.onload=enableTooltips;


function enableTooltips(){
var links=document.getElementsByTagName("a");
//alert(top.location.host);
for(i=0;i<links.length;i++){
	var t,h,i,tooltip;
    t=links[i].getAttribute("title");
    h=links[i].getAttribute("href");
   // alert ("<"+t+">")
    if(h!= null && (h.indexOf("http://")==0 || h.indexOf("https://")==0) && h.indexOf(tooltipLocalhost)!=0){
        links[i].removeAttribute("title");
        links[i].style.position="relative";
        tooltip=document.createElement("span");
		tooltip.id="donTip";
		tooltip.setAttribute("id","donTip");
		if (t=="" || t==null){
        	tooltip.className="tooltip";
		}
		else{
		    tooltip.className="tooltipText";
		}
        tooltip.style.display="none";
        tooltip.style.backgroundRepeat="no-repeat";
        tooltipImg=document.createElement("img");
		tooltipImg.src="http://api.thumbalizr.com/?url="+h+"&width=200"
		tooltip.appendChild(document.createElement("br"));
        tooltip.appendChild(tooltipImg);
		tooltip.appendChild(document.createElement("br"));
        tooltip.appendChild(document.createTextNode(t));
		//setOpacity(tooltip);
        links[i].appendChild(tooltip);
        links[i].onmouseover=showTooltip;
        links[i].onmouseout=hideTooltip;
	//	links[i].onmousemove=Locate();
        }
    }
}

function showTooltip(event){
    this.style.zIndex="25";
    this.getElementsByTagName("span")[0].style.display="block";
    }

function hideTooltip(event){
    this.style.zIndex="24";
    this.getElementsByTagName("span")[0].style.display="none";
    } 

function setOpacity(el){
var o=90
el.style.filter="alpha(opacity:"+o+")";
el.style.KHTMLOpacity="0."+o+"";
el.style.MozOpacity="0."+o+"";
el.style.opacity="0."+o+"";
}



