//File name: popup.js
//Author: Mike Boyce
//© Mibo Designs 
//Date: 2006/08/29
//Description: Popup window control for content & shop pages
wPop = null;  //popup window handles
wShop = null;
wZoom = null;

//2006/09/14: Modified to allow sending of target parameter in function call
//this allows different popups for different content
//also added in the facility for extra window properties for windows that are not
//just info popups
function openPopup( target )
{
  var extras = "";

  if( target == undefined ) target = "popup";

  if( target != "popup" ) extras = ",toolbar,status";

  wPop = window.open( "about:blank", target, "top=100,left=300,width=360,height=360,resizable,scrollbars" + extras );
  wPop.focus();
}

//close window
function closePopup()
{
  if (wPop != null && !wPop.closed) wPop.close();
}


//shop pages popup
function openShop()
{
  //to avoid seeing previous content, if window already opened: close it
  if( wShop != null && !wShop.closed ) wShop.close();

  wShop = window.open( "about:blank", "va_shop", "top=200,left=100,width=750,height=400,resizable,scrollbars,status" );
  wShop.focus();
}

//2006/09/25: image zoom window handler
//displays enlarged version of picture
function openZoom()
{
  //to avoid seeing previous content, if window already opened: close it
  if( wZoom != null && !wZoom.closed ) wZoom.close();

  wZoom = window.open( "about:blank", "zoom", "top=50,left=200,width=300,height=200,resizable,scrollbars" );
  wZoom.focus();
}

function openForm()
{
  wForm = window.open( "about:blank", "query", "top=100,left=100,width=580,height=480,resizable,scrollbars,status,toolbars");
  wForm.focus();
}


//2006/09/24: Schools window handler
function openSchool()
{
  wSchool = window.open( "about:blank", "sfs", "top=50,left=50,width=720,height=400,resizable,toolbar,menubar,scrollbars,status");
  wSchool.focus();
}

//2006/09/14: disabled onunload event
//since we may be opening several popups, we can't close them all on exit,
//unless we maintain separate handles for them
//onunload = closePopup;

