var count = 0;

/*********************************************
* Funktion fuer Fade-Effekte                 *
* inkl. Unterstuetzung verschiedener Browser *
*********************************************/

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd)
    {
        for(i=opacStart; i>=opacEnd; i--)
        { 
            setTimeout("changeOpac("+i+", '"+id+"')", (timer * speed)); 
            timer++; 
        } 
    } 
    else if(opacStart < opacEnd)
    { 
        for(i=opacStart; i<=opacEnd; i++) 
        { 
            setTimeout("changeOpac("+i+", '"+id+"')", (timer * speed)); 
            timer++; 
        } 
    } 
    
} // function opacity()




//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style;
    
    object.opacity      = (opacity / 100); 
    object.MozOpacity   = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter       = "alpha(opacity="+opacity+")"; 
}


/*******************************************
* Funktion zur automatischen Darstellung   *
* einer Diashow                            *
*******************************************/
function diashow(count, high){ //alert(count);
    if(count < high)
    { 
        id = "newsflash";
        news = "<h3 style='text-align:center;'>"+newsflash[count][0]+"</h3><p style='text-align:center;'>"+newsflash[count][1]+"</p><br style='clear:both; />";
        changeOpac(0, id);
        document.getElementById(id).innerHTML=news;
        opacity(id, 0, 100, 2000);
        setTimeout("fixHeight('"+id+"')",1000);
        setTimeout("opacity('"+id+"', 100, 0, 2000)",15000);

        count++;
        setTimeout("diashow("+count+","+high+")",17500);
    }
    else
    {
        setTimeout("diashow(0,"+high+")",500);        
    }
}

function fixHeight(id){

    if(typeof(document.getElementById(id).offsetHeight) == 'number'){
    	document.getElementById(id).parentNode.style.height = document.getElementById(id).offsetHeight + 70 + 'px';
//    	document.getElementById('main').style.height = parseInt(document.getElementById('newsflash_border').offsetHeight) - 10 + "px";
    }
    else if(typeof(document.getElementById(id).clientHeight) == 'number'){
    	document.getElementById(id).parentNode.style.height = document.getElementById(id).clientHeight + 70 + 'px';
//    	document.getElementById('main').style.height = parseInt(document.getElementById('newsflash_border').clientHeight) - 10 + "px";
    }
    
}