var saveid;
saveid = 0;

var newsid;
var rotateid;
rotateid = 0;
newsid = 1;

var newsrotate=true;

function rotatenews () {
if(newsrotate) {
rotateid = rotateid + 1;
if(rotateid < 6) {
switchnews(rotateid, true);
} else {
rotateid = 1;
switchnews(rotateid, true);
}


setTimeout('rotatenews();', 6000);

}
}

function switchnews(id)
{
document.getElementById("cont" + id).style.display= 'block';
if(newsid != id) {
document.getElementById("cont" + newsid).style.display= 'none';
}
newsid = id;
}


function colorset(id) {
if(id != saveid) {
document.getElementById(id).style.backgroundColor = "#ffdf00";
}
}

function colorunset(id) {
if(id != saveid) {
document.getElementById(id).style.backgroundColor = "#ffffff";
}
}

function initplayer() {
  var zahl;
  var playeranzahl;
  playeranzahl = document.getElementById('players').getElementsByTagName('div').length;
  zahl = 1 + Math.floor(Math.random() * playeranzahl);
  document.getElementById("player" + zahl).style.display= 'block';
  document.getElementById("pr" + zahl).style.backgroundColor = "#ffcc00";
  saveid = 'pr' + zahl;
}


function switchplayer(id)
{
idint = id.match("[0-9]+");
document.getElementById(id).style.backgroundColor = "#ffcc00";
document.getElementById("player" + idint).style.display= 'block';
if(saveid) {
document.getElementById(saveid).style.backgroundColor = "#FFFFFF";
saveidint = saveid.match("[0-9]+");
document.getElementById("player" + saveidint).style.display= 'none';
}
if(saveid == id) {
saveid = 0;
} else {
saveid = id;
}
}

