
//
// listenwindow.js
//
// Open a new window/tab for the "listen" page with music player
// For www.treestudios.net - by Brian Reed (Sep 2007)
//

// Hows it work in different browsers?
// - Seems OK in IE6 and IE7?
// - Is not focusing to an already-open tab in FF
// - Opera seems to re-focus to tabs nicely!


var listenWindowRef=null;


// This is called by /index.html & /music/index.html (make/focus listen window)
function listenWindow(url)
{
  // If the window is not open, open it
  if (listenWindowRef==null || listenWindowRef.closed==true) {
    listenWindowRef = window.open(url,'listen');
    if (listenWindowRef.opener == null)       // make sure .opener is populated
      listenWindowRef.opener = window.self;   //
  }

  if (window.focus)           // See if window.focus is supported
    listenWindowRef.focus();  // Focus (bring to front) player window

  return false;
}


// This is called by /music/listen.html (return to Home window)
function listenWindowReturn()
{
  if (window.focus)           // See if window.focus is supported
    window.opener.focus();    // Focus (bring to front) main window

  return false;
}


// This is called by /music/listen.html (make a new Home window)
function listenWindowOpenHome(url)
{
  window.open(url,'home');
  return false;
}


