function playRadio() {
//de: http://radiostream.de/stream/26430.m3u
//tr: http://radiostream.de/stream/28555.m3u
//ru: http://radiostream.de/stream/28545.m3u

  var code="<embed\n"
  + "src=\"http://radiostream.de/stream/28555.m3u?n="+Math.random()+"\"\n"
  + "width=\"0\"\n"
  + "height=\"0\"\n"
  + "autostart=\"true\" align=\"middle\" type=\"application/x-mplayer2\"\n"
  + "pluginspage=\"http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&\"\n"
  + "transparentatstart=\"false\"\n"
  + "showcontrols=\"-1\"\n"
  + "showstatusbar=\"-1\"\n"
  + "name=\"MediaPlayer\"\n"
  + "autosize=\"-1\"\n"
  + "displaysize=\"0\"\n"
  + "enablejavascript=\"true\"\n"
  + "filename=\"http://radiostream.de/stream/28555.m3u?n="+Math.random()+"\"> </embed>\n";

  parent.radio.document.getElementById("playerdiv").innerHTML=code;

  return false;
}


function stopRadio() {
  parent.radio.document.getElementById("playerdiv").innerHTML="";
  return false;
}


function nowPlaying() {
  if (document.getElementById("nowplaying").innerHTML.length==0) {
    document.getElementById("nowplaying").innerHTML="warten...";
  }

  var xmlhttp=null;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.
   try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
    try {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
     xmlhttp = false;
    }
   }
  @end @*/
  if (typeof XMLHttpRequest!='undefined') {
    xmlhttp=new XMLHttpRequest();
  }

  xmlhttp.open("GET", "/cgi-bin/nowplaying.pl", true);
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
      showNowPlaying(xmlhttp.responseText)
    }
  }
  xmlhttp.send(null);
}

var timeout=null;

function showNowPlaying(html) {
  document.getElementById("scrolldiv").innerHTML=html + '<br>';

  if (timeout!=null) {
    window.clearTimeout(timeout);
  }
  timeout=window.setTimeout("nowPlaying()", 30000);
}


/* Scroller */

var scrollxpos=0;
var scrolldirection=-1;
function scroll() {
  var div=document.getElementById("scrolldiv");
  var container=document.getElementById("scrollcontainter");

  if ((scrolldirection<0 && scrollxpos<-div.offsetWidth+container.offsetWidth-3) ||
      (scrolldirection>0 && scrollxpos>0) ) {
    scrolldirection*=-1;

    window.setTimeout("scroll()", 2000);
  } else {

    div.style.left=scrollxpos+"px";
    scrollxpos+=scrolldirection;

    window.setTimeout("scroll()", 50);
  }

}

function init() {
  window.setTimeout("scroll()", 2000);
}