function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
            }
        }
    }
 }


 var links = null;

 function setColorLinks() {
     try {
         var dummy;
         for (i = 0; i < links.length; i++) {
             dummy = links[i].parentNode.getAttribute("className");
             if (dummy == "riganew" || dummy == "riganew1") {
                 links[i].parentNode.setAttribute("className",dummy == "riganew" ? "riganew1" : "riganew");
             }
         }
     }
     catch (e) { }
}
 
/*script per i bubble tooltips*/

function enableTooltips(id)
{   var h,i,title,subtitle,ix,tip,t,b;
    if(!document.getElementById || !document.getElementsByTagName) return;    
    
    h=document.createElement("span");
    h.id="btc";
    h.setAttribute("id","btc");
    h.style.position="absolute";
    document.getElementsByTagName("body")[0].appendChild(h);
    
    links = id==null ? document.getElementsByTagName("a") : document.getElementById(id).getElementsByTagName("a");    
    for(i=0;i<links.length;i++)
    {   title = links[i].getAttribute("title");
        if(title==null || title=="") continue;

        ix = title.lastIndexOf("|");  
        if(ix>-1)
		{   subtitle = title.substring(ix+1);
		    title = title.substring(0,ix);
	    }
	    else
	    {  subtitle = "Clicca per aprire";
	    }
	    
        tip=CreateEl("span","tooltip");
        
        t=CreateEl("span","top");

        t.appendChild(document.createTextNode(title));
        tip.appendChild(t);
        
        b=CreateEl("b","bottom");
        b.appendChild(document.createTextNode(subtitle));        
        tip.appendChild(b);       
        
        tip.style.filter="alpha(opacity:95)";
        tip.style.KHTMLOpacity="0.95";
        tip.style.MozOpacity="0.95";
        tip.style.opacity="0.95";
        
        links[i].removeAttribute("title");
        links[i].tooltip=tip;
        links[i].onmouseover=ShowTooltip;
        links[i].onmouseout=HideTooltip;
        links[i].onmousemove=MoveTooltip;
    }

    window.setInterval("setColorLinks()", 750);
}

function ShowTooltip(e)
{   document.getElementById("btc").appendChild(this.tooltip);
    MoveTooltip(e);
}

function HideTooltip(e)
{   var d=document.getElementById("btc");
    if(d.childNodes.length>0) d.removeChild(d.firstChild);
}

function CreateEl(id,className)
{   var el=document.createElement(id);
    el.className=className;
    el.style.display="block";
    return(el);
}

function MoveTooltip(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+10)+"px";
    document.getElementById("btc").style.left=(posx-20)+"px";
}
