function OpenNewWindow(URL, wName, sizeOfWin) {
  var xtraWindow;
  var wSettings = 'status=yes,scrollbars=yes,resizable=yes';
  var maxW = screen.width;
  var maxH = screen.height;
  var scaleH, scaleV;
  var wTop = 15;
  var wLeft = 20;
  var wW, wH;

  if (wName == null | wName == '') { wName = 'newwin'; }
  if (maxW == 0 | maxW == '') {maxW = 640;}
  if (maxH == 0 | maxH == '') {maxH = 480;}

  if (sizeOfWin == 'tiny') {
     wSettings += ',toolbar=no,menubar=no,location=no';
     scaleW = 0.90; scaleH = 0.20;}
  else if (sizeOfWin == 'small') {
     wSettings += ',toolbar=no,menubar=no,location=no';
     scaleW = 0.90; scaleH = 0.40;}
  else if (sizeOfWin == 'medium') {
     wSettings += ',toolbar=no,menubar=yes,location=no';
     scaleW = 0.90; scaleH = 0.60;}
  else if (sizeOfWin == 'video') {
     wSettings += ',toolbar=no,menubar=no,location=no';
     scaleW = 0.60; scaleH = 0.60;}
  else {
     wSettings += ',toolbar=yes,menubar=yes,location=yes';
     scaleW = 0.90; scaleH = 0.75;}

  wH = maxH * scaleH;
  wW = maxW * scaleW;

  wSettings += ',top=' + wTop + ',left=' + wLeft;
  wSettings += ',width=' + wW + ',height=' + wH;

  xtraWindow=window.open(URL, wName, wSettings);
  try { xtraWindow.focus(); } catch(err) {}
}

function LogOff()
 {
  if (confirm("Are you sure you want to log off now?"))
   {
    var expiresWhen = new Date();
    expiresWhen.setTime(expiresWhen.getTime() + 30*24*60*60*1000);

    var pathSeparator = unescape("%2F");
    var LastLocation = parent.location.href;
    var pathPieces = LastLocation.split (pathSeparator);
    LastLocation = pathPieces[pathPieces.length - 1];

    SetCookie('LastPage', LastLocation, expiresWhen);
    top.window.close();
    return true;
   }
  else
   {
    return false;
   }
 }
