/* Frontpage top teaser functions */
var timerID;
var numberOfElements = 5;

function teasertimer(position)
{
    if((position % (numberOfElements + 1)) == 0) 
    {
        position = 1;
    }
    
    var previousposition = 0;
    if(position == 1) 
    {
        previousposition = numberOfElements;
    }
    else 
    {
        previousposition = position - 1;    
    }
    
    /* hide all elements */
    hideelements();
    
    /*showelement(position);*/
    showelement(position);
    
    /* keep the timer going */        
    timerID = setTimeout("teasertimer(" + ((position) + 1) + ")",7000);
}

function restarttimer(position) 
{
    clearTimeout (timerID); /* added to counter possible bugs */
    teasertimer(position);
}

function stoptimer(position) 
{
    clearTimeout (timerID);
    hideelements();
    showelement(position);
}

function hideelements() 
{
    var i = 1;
    while(i <= numberOfElements) 
    {
        document.getElementById('ArticleTeaserID' + (i)).style.display = 'none';
        i++;
    }
}

function showelement(position) 
{
    document.getElementById('ArticleTeaserID' + (position)).style.display = 'block';
}

/*
function fadein(position) 
{
    element = document.getElementById('ArticleTeaserID' + (position));
    element.style.display = 'block';
    element.style.opacity = .01;
    var i = 0;
    
    
    while(i <= 100) 
    {
        i++;
        var t = setTimeout("changeopacity(" + position + ")", 300);
    }
}

function changeopacity(position) 
{
    document.getElementById('ArticleTeaserID' + (position)).style.opacity = document.getElementById('ArticleTeaserID' + (position)).style.opacity * 1.05;    
}*/


/* ****************************************************************************** */

/*  */


/* ****************************************************************************** */
