function switchTabs(parentDiv, elemGroup, elemNumber, elemTotal) {
  //browse through the other links to switch any active_tab classes back to tab
  var tabArray = new Array();
  var elem;

  tabArray = parentDiv.parentNode.childNodes;

  for(i = 0; i < tabArray.length; i++) {
    if(tabArray[i].className == 'active_tab') {
      tabArray[i].className = 'tab';
    }
  }
  //Change the className of the link clicked
  if(parentDiv.className == 'tab') {
    parentDiv.className = 'active_tab';
  } else {
    parentDiv.className = 'tab';
  }
  //get all the html object belonging to the elemGroup and change the display
  for(i = 1; i <= elemTotal; i++) {
    if(elem = document.getElementById(elemGroup + i)) {
      if((elemGroup + i) == elemGroup + elemNumber) {
        elem.style.display = 'block';
      } else {
        elem.style.display = 'none';
      }
    }
  }
}

function openListenLiveWindow() {
  var llPopupWindow = new SnPopupWindow("http://radio.sportingnews.com/listenlive/listenlive_popup.html", null, null, 335, 575);
  llPopupWindow.setState(false, false, false, false, false, true);
  llPopupWindow.show();
}

function SnHashtable() {
  this._associativeDataArray = new Array();
  this.containsKey = function(key) {
    if(this._associativeDataArray["k_" + key]) {
      return true;
    }
    return false;
  }

  this.put = function(key, value) {
    this._associativeDataArray['k_' + key] = value;
  }

  this.putSeveral = function(keyString, valueString, delimiter) {
    if( !(delimiter) ) { delimiter = "|"; }
    var keyArray   = keyString.split(delimiter);
    var valueArray = valueString.split(delimiter);
    for(var index = 0; index < keyArray.length; index++) {
      this.put(keyArray[index], valueArray[index]);
    }
  }

  this.get = function(key) {
    return this._associativeDataArray['k_' + key];
  }
}

function SnPopupWindow(url, left, top, width, height, name) {

  this._name   = (name   ? name   :  "default");
  this._url    = (url    ? url    :  "");
  this._left   = (left   ? left   :  -1);
  this._top    = (top    ? top    :  -1);
  this._width  = (width  ? width  : 800);
  this._height = (height ? height : 600);
  this._menuBar     = true;
  this._toolBar     = true;
  this._locationBar = true;
  this._scrollBars  = true;
  this._resizing    = true;
  this._centering   = true;
  this.setName   = function(name)   { this._name   =   name; }
  this.setUrl    = function(url)    { this._url    =    url; }
  this.setLeft   = function(left)   { this._left   =   left; }
  this.setTop    = function(top)    { this._top    =    top; }
  this.setWidth  = function(width)  { this._width  =  width; }
  this.setHeight = function(height) { this._height = height; }
  this.getName   = function() { return this._name;   }
  this.getUrl    = function() { return this._url;    }
  this.getLeft   = function() { return this._left;   }
  this.getTop    = function() { return this._top;    }
  this.getWidth  = function() { return this._width;  }
  this.getHeight = function() { return this._height; }
  this.enableMenuBar     = function() { this._menuBar     = true; }
  this.enableToolBar     = function() { this._toolBar     = true; }
  this.enableLocationBar = function() { this._locationBar = true; }
  this.enableScrollBars  = function() { this._scrollBars  = true; }
  this.enableResizing    = function() { this._resizing    = true; }
  this.enableCentering   = function() { this._centering   = true; }
  this.disableMenuBar     = function() { this._menuBar     = false; }
  this.disableToolBar     = function() { this._toolBar     = false; }
  this.disableLocationBar = function() { this._locationBar = false; }
  this.disableScrollBars  = function() { this._scrollBars  = false; }
  this.disableResizing    = function() { this._resizing    = false; }
  this.disableCentering   = function() { this._centering   = false; }

  this.setState = function(menuBar, toolBar, locationBar, scrollBars, resizing, centering) {
    this._menuBar     =     menuBar;
    this._toolBar     =     toolBar;
    this._locationBar = locationBar;
    this._scrollBars  =  scrollBars;
    this._resizing    =    resizing;
    this._centering   =   centering;
  }

  this.show = function() {
    var specArray = new Array();
    if(this._centering) {
      this._left = (screen.width  ? (screen.width  - this._width )/2 : -1);
      this._top  = (screen.height ? (screen.height - this._height)/2 : -1);
    }
    if(this._left > 0) { specArray.push("left=" + this._left); };
    if(this._top  > 0) { specArray.push("top="  + this._top ); };
    specArray.push("width="  + this._width );
    specArray.push("height=" + this._height);
    specArray.push("menubar="    + (this._menuBar     ? "1" : "0"));
    specArray.push("toolbar="    + (this._toolBar     ? "1" : "0"));
    specArray.push("location="   + (this._locationBar ? "1" : "0"));
    specArray.push("scrollbars=" + (this._scrollBars  ? "1" : "0"));
    specArray.push("resizable="  + (this._resizing    ? "1" : "0"));
    var specifications = "";
    for(var counter = 0; counter < specArray.length; counter++)
    {
    specifications += ( (counter > 0 ? "," : "") + specArray[counter]);
    }
    window.open(this._url, this._name, specifications);
  }
}
