window._MUSICPLAYER_FRAME = 1;

var lastUrl = '';

/*
Change the target of all external links in the main frame to _parent, so that they will break this frameset when clicked.
*/

function updateLinks() {

/* 
We need to make sure that links to other member sites also break the frameset, so we use a fancy regex which strips a URL down to being only its hostname and directory path (not including its filename). If the regex returns the same string for the current location and the link, then we assume that the link is local. 
*/

  var result = window.location.href.match('[^:]+://([^/]+.*)/[^/]*');
  var thisURLMatch = result[1];
  for (var i=0; i < window.mainFrame.document.links.length; i++) {
    result = window.mainFrame.document.links[i].href.match('[^:]+://([^/]+.*)/[^/]*');
    if (result != null) {
      if (result[1] != thisURLMatch) {
        if (window.mainFrame.document.links[i].target == "") {
          window.mainFrame.document.links[i].target = "_parent";
        }
      }
    }
  }
}

/*
Poll the main frame to detect when it has changed URL.  When it does, call updateLinks()
*/

function monitor() {
  // Make sure the other frame is loaded
  if (window.frames[0] == null) return;
  if (!window.mainFrame.document) return;
  if (!window.mainFrame.document.links) return;
  if (lastUrl != window.mainFrame.location.href) {
    lastUrl = window.mainFrame.location.href;
    document.title=window.mainFrame.document.title;
    updateLinks();
  }
  // Poll every 1 second (1000 ms)
  setTimeout('monitor()',1000);
}