﻿
function FadeInAnnouncement()
{  
    opacity = opacity + adder;

    if(opacity > 100)
    {
        ShowAnnouncement();
       return;
    }
    
    thediv.style.display = "block";
    setOpacity(opacity);

    setTimeout("FadeInAnnouncement()", FadeDelay);
}

function ShowAnnouncement()
{
    thediv.setAttribute("style","display:block;filter:alpha(opacity=100);-moz-opacity:1;opacity:1");
    setTimeout("FadeOutAnnouncement()", ShowLength);
}

function FadeOutAnnouncement()
{
    opacity = opacity - adder;

    if(opacity < 0)
    {
       currentdiv = currentdiv + 1;
       
       if(currentdiv >= divs.length)
        {            
            currentdiv = 0;
        }
       
        thediv.style.display = "none";
       
       thediv = document.getElementById(divs[currentdiv]);

       FadeInAnnouncement();
       return;
    }
    
    setOpacity(opacity);

    setTimeout("FadeOutAnnouncement()", FadeDelay);
}

function setOpacity(value)
{
    try
    {
        thediv.style.opacity = value/100;
    }
    catch(ex)
    {
    }   
    
    try
    {
        thediv.style.filter = ("alpha(opacity=" + value);
    }
    catch(ex)
    {
    }   

}
