  var homepage_highlight_first_instance_timer = 7000;
  var homepage_highlight_timer = 7000;
  var step = 1;
  var homepage_highlight_caller;
  var current;

  
  function switch_homepage_highlight (next_layer_id ) 
  {

	var speed = Math.round(200 / 10);
	var timer = 0;
	
	current = currently_shown_layer;
	currently_shown_layer = next_layer_id;

  	for ( var i=1; i <= count_highlights ; i++) 
	{	        
		
		if(i != current) {
			changeOpac(i,0);
			document.getElementById("n"+i).style.display = 'none';
			document.getElementById("n"+i).style.zIndex = '100';
		}
		
	  	document.getElementById("b"+i).style.backgroundColor = "#cccccc";
		document.getElementById("b"+i).style.color = "white";
	}
	  

	changeOpac(current,100);
	document.getElementById("n"+current).style.display="block";
	document.getElementById("n"+current).style.zIndex = '100';
	document.getElementById("n"+next_layer_id).style.zIndex = '200';
	document.getElementById("n"+next_layer_id).style.display="block";
	document.getElementById("b"+next_layer_id).style.backgroundColor = "f6f6f6";
	document.getElementById("b"+next_layer_id).style.color = "#454346";
	  
	  
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" +current+ "," + (100-i) + ")",(timer * speed));
		setTimeout("changeOpac(" + next_layer_id + "," + i + ")",(timer * speed));
		timer++;
	}

	      
	window.clearTimeout(homepage_highlight_caller);
	homepage_highlight_caller = window.setTimeout( 'next_homepage_highlight()', homepage_highlight_timer);
	
	return false;
  }
  
  // der erste aufruf
function highlights()
{
 	changeOpac(currently_shown_layer,100);
	document.getElementById('n'+currently_shown_layer).style.display= 'block';
	document.getElementById('b'+currently_shown_layer).style.backgroundColor = 'f6f6f6';
	 document.getElementById("b"+currently_shown_layer).style.color = "black";
	homepage_highlight_caller = window.setTimeout( 'next_homepage_highlight()', homepage_highlight_first_instance_timer);
 }


function next_homepage_highlight () 
{
	if ( currently_shown_layer < count_highlights ) { next_layer = currently_shown_layer+1; } 
	else { next_layer =  1; }
	switch_homepage_highlight(next_layer);
}


	
function changeOpac(id,opac)
{
	document.getElementById("n"+id).style.opacity = opac/100;
	document.getElementById("n"+id).style.filter = "alpha(opacity=" + opac + ")";
}

