/***********************
 * image preview popup *
 ***********************/

PWin = null;
//width should exceed widest image in gallery, and height should exceed tallest
PWinHeight = 500;
PWinWidth = 500;
//make sure this one is kept synchronised with the page margins in gallery_item.asp
PWinMargin = 5;

function pictureOpen(pcat,pname)
{
  pictureClose();

  PWin = window.open('gallery_item.asp?c='+pcat+'&n='+pname+'&resize=true','PWin','width='+PWinWidth+',height='+PWinHeight+',scrollbars=0,toolbars=0,resizable=1');
  PWin.focus();
  return false;
}

function pictureClose()
{
  if (PWin)
    PWin.close();
}

function FitPic() {
//iWidth and iHeight are window height and width specified in gallery.js, minus page margins
  iWidth = PWinWidth - (2 * PWinMargin);
  iHeight = PWinHeight - (2 * PWinMargin);
  iWidth = document.images[0].width - iWidth;
  iHeight = document.images[0].height - iHeight;
  window.resizeBy(iWidth, iHeight);
  self.focus();
};


/********************
 * image protection *
 ********************/

function right(e) {
  if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
  {
    alert("Copyright subsists in all photographs used on this site.\nContact gateway@kalgoorlie.com for permission to use images.");
    return false;
  }
  else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
  {
    alert("Copyright subsists in all photographs used on this site.\nContact gateway@kalgoorlie.com for permission to use images.");
    return false;
  }
  return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

