// JavaScript Document
onerror=handleErr

var popUpWin=0;
var txt=""

function handleErr(msg,url,l)
{
  txt="There was an error on this page.\n\n"
  txt+="Error: " + msg + "\n"
  txt+="URL: " + url + "\n"
  txt+="Line: " + l + "\n\n"
  txt+="Click OK to continue.\n\n"
  alert(txt)
  return true
}

function openPicture(filename, width, height) {
  var top=(screen.availHeight - height)/2 - 30;
  var left=(screen.availWidth - width)/2;

  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open('', 'popUpWin', 'dialog=yes, minimizable=no, scrollbars=no, titlebar=no, toolbar=no, location=no, directories=no, status=no, statusbar=no, menubar=no, resizable=no, copyhistory=yes, width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

  var newDoc=popUpWin.document.open("text/html");
  var txt='<html>'
         +'<script language="JavaScript" src="PictureShower.js"></script>'
         +'<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0">'
         +'<a href="javascript:window.close()"><img src="'+filename+'" border="0" width="100%" height="100%" ></a>'
		 +'</body></html>';
  newDoc.write(txt);
  newDoc.close();
}

function picture(filename, popupWidth, popupHeight, displayWidth) { 
  return '<a href="javascript:openPicture(\''+filename+'\', '+popupWidth+', '+popupHeight+')" ><img src="'+filename+'" width="'+displayWidth+'" ></a>';
}

function horzPicture(filename) { 
  return picture(filename, 700, 467, 200);
}

function vertPicture(filename) { 
  return picture(filename, 467, 700, 120);
}

function open2Frames(frame1Name, url1, frame2Name, url2) {
  top.document.getElementsByName(frame1Name)[0].src=url1;;
  top.document.getElementsByName(frame2Name)[0].src=url2;
}

function openInFrame(frameName, url) {
  top.document.getElementsByName(frameName)[0].src=url;;
}

