// JavaScript Document

function OpenPlayer() {
  // projde ve zvolenem elementu linky a otevre v novem okne radio prehravac.
  
  var self = this;
  var parent;
  var radioSRC;
  // initialize
  this.init = function(id) {
     if(id) {
       parent = document.getElementById(id); 
       this.radiolist();
       return true;
     }
     return false;
  }
  // prehravac
  this.player = function() {
     return window.open(radioSRC,'player','width=800,height=510,menubar=no,resizable=no,status=no,scrollbars=no');
  }
  
  // link crawler
  this.radiolist = function() {
     this.list = parent.getElementsByTagName('a');
     for (i in this.list)  {
        this.list[i].onclick = function () {
             radioSRC = this.href;
             self.player();
             return false;	   
        }
     }
  }
  
}
window.onload = function() {
  var player = new OpenPlayer();
  player.init('radiolist');
}
