/* ================================================================================

   RADIO DRS - WEBPLAYER
   zeigt in einem Popupfenster den Player fuer Streams und MP3 an.
   
   ----------------------------------------------------------------------
   2007-09-xx  hahnax  init
   2007-10-12  hahnax  Code fuer Content Seiten minimiert
   2008-02-22  hahnax  Anpassung fuer Pirando
   2008-07-18  hahnax  Defaulthoehe korrigiert
   hahnax: Axel Hahn (webmaster@srdrs.ch)
   ================================================================================
*/

var bIsKinderradio;
var iWindowHeight=620;

Radio = function() {
  if (bIsKinderradio) iWindowHeight=340;
  return false;
}
// ----------------------------------------------------------------------
// Radio object - open
// examples: 
// <a href="[target-url]" onclick='return Radio.open(this)'>linktext</a>
// <a href="[target-url]" onclick='return Radio.open(this, {'sg': [int], 'sh': [int]});'>linktext</a>


Radio.open = function() {
  var sUrl;
  if (Radio.open.arguments) {
    sUrl = "http://www.drs.ch/lib/player/radio.php?audiourl=" + Radio.open.arguments[0];
    if (window.location.hostname.indexOf("test.drs") >0) 
      sUrl = "/lib/player/radio.php?audiourl=" + Radio.open.arguments[0];
    if (bIsKinderradio) sUrl = "http://www.drs.ch/lib/player/kinderradio.php?audiourl=" + Radio.open.arguments[0];
    if (Radio.open.arguments[1]) {
      if (Radio.open.arguments[1]['sg'])     sUrl += "&sg=" + Radio.open.arguments[1]['sg'];
      if (Radio.open.arguments[1]['sh'])     sUrl += "&sh=" + Radio.open.arguments[1]['sh'];
      if (Radio.open.arguments[1]['stream']) sUrl += "&stream=" + Radio.open.arguments[1]['stream'];

      if (Radio.open.arguments[1]['title'])  sUrl += "&title=" + Radio.open.arguments[1]['title'];
      if (Radio.open.arguments[1]['click'])  sUrl += "&click=" + Radio.open.arguments[1]['click'];
    }
  }
  if (sUrl) {
    var sWindowsOptions='width=420,height='+iWindowHeight+',toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars=1,copyhistory=0';
    oWin = window.open(sUrl, "player", sWindowsOptions);
    oWin.focus();
  }
  return false;
}
// ----------------------------------------------------------------------
