// JavaScript Document
hexinput=102  // Initial color value.
var inc=-1 //increment variable
var prev_el=false

function fadingtext(div_id)
{	         	
	if(hexinput>0) 
	{		
		hexinput-=11; // increase color value
        if (document.getElementById(div_id)) {
		    document.getElementById(div_id).style.display = "block";
        }
		//document.getElementById(div_id).style.color="rgb("+hexinput+","+hexinput+","+hexinput+")"; 
		func = "fadingtext(\""+div_id+"\")";
		setTimeout(func,20);	
	}
	else
	{
		hexinput=102  //reset hex value
		//document.getElementById(div_id).style.display = "none";
	}
}

function changetext()
{
    var max = 0;
    
    if (document.getElementById("max_news")) {
	    max = document.getElementById("max_news").value;
    }
	if (!document.getElementById) return
	inc++
	if (inc > (max-1)) inc = 0
	fade_el = "fun_fader"+inc;
	if (document.getElementById(prev_el))
		document.getElementById(prev_el).style.display = "none";
	fadingtext(fade_el)
	prev_el = fade_el;
	setTimeout("changetext()",5000)
}

window.onload=changetext


