//
// Initialisation funcs

function Initialise()
{
  SubstitutePopups();
}


function SubstitutePopups()
{
  var el, href;

  if (document.getElementById)
  {
    if ( document.getElementById('magazinelink') )
    {
      el = document.getElementById('magazinelink');

      // get the existing static magazine URL
      href = el.href;

      // rewrite it with the JS function to explode window size
      el.href = "javascript:popUpMagazine('"+href+"');";
      el.target = '';
    }
  }
}

//
// Functions for opening a pop-up window

// each new pop-up window to re-use the existing one
// rather than having the user have multiple pop-up windows open
var remote;

function popUpMagazine(magazine)
{
  if (remote) remote.close();

  remote = open
  (
    magazine, 'OnlineMagazine', 'width='+screen.availWidth+',height='+screen.availHeight+',scrollbars=yes,location=0,status=1,toolbar=0,menubar=0,top=0, left=0'
  );

  remote.focus();
}


//
// Functions for opening a pop-up window from flash, without closing the parent

function flashpopUpMagazine(magazine)
{

  window.open
  (
    magazine, 'newmag', 'width='+screen.availWidth+',height='+screen.availHeight+',scrollbars=yes,location=0,status=1,toolbar=1,menubar=0,top=0, left=0'
  );

}

