var playerName = 'nbeCdPlayer';
var playerUrl = '/player/';
/*
var minFeatures = 'directories=no, location=no, menubar=no, resizable=no,'
                + 'scrollbars=no, status=no, toolbar=no, width=260, height=130';
*/
var minFeatures = 'directories=no, location=no, menubar=no, resizable=no,'
                + 'scrollbars=no, status=no, toolbar=no, width=250, height=123';


var PLAYER;
var playing = false;

function openPlayer(mediaid, color){
  var left = window.screenLeft + 2;
  var top = window.screenTop - 20;

try {
  var fromMain = (window.parent.document.location.href==document.location.href);
  if (fromMain) {
    // call player from inside the iframe if possible
    window.frames.playerwrapper.openPlayer(mediaid, color);
    return;
  }
} catch (e) {}

  if (!mediaid) mediaid = '';
  var url = playerUrl + '?id=' + mediaid + '&c2=' + color;
  try {
    var features = minFeatures + ", left=" + left + ", top=" + top;
    PLAYER = open('', playerName, features);
    if (!PLAYER.loaded) PLAYER.document.location.href = url;
    PLAYER.focus();
    PLAYER.moveTo(left, top);
  } catch(e) {}
}