<!--
// JavaScript functions
// ====================

var rhs = 800;  // default screen width
var bos = 600;  //            and height
if (window.screen)
{ rhs = window.screen.width;  // actual screen size
  bos = window.screen.height;
}
var wpicture;

function winpict(path,ppw,pph) // extra info (currently just a picture) on model as popup
{ var wpw = 322;  // I use to to use 318 and 238 because I thought 320x240 left a
  var wph = 242;  // very thin background right & bottom but border=1 so now 322x242
  if (typeof ppw != "undefined") wpw = ppw;
  if (typeof pph != "undefined") wph = pph;
//  var top2 = (bos/2)-(wph/2);
  var top2 = 1                 // this is an attempt (reasonably successful)
  var lft2 = (rhs/2)-(wpw/2);  // to position a picture top middle of the screen
  var winpars = "width=" + wpw + ",height=" + wph + ",left=" + lft2 + ",top=" + top2;
  winpars = winpars +   ",status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=yes,dependent=yes";
  if (!(typeof wpicture == "undefined"))
  { if (!wpicture.closed) wpicture.close(); }  // in case different size
  wpicture = window.open(path,"picture",winpars);
  wpicture.focus();
}

function format_date(dt,lang)
{ dye = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  moe = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
  dy = new String("");
  var tdtx = "";
  if (dt == "") tdt = new Date();
  else tdt = new Date(dt);
  if (typeof lang == "undefined") tdtx = dye[tdt.getDay()];
  dy = dy + tdt.getDate();
  if (dy.length == 1) dy = "0" + dy;
  tdtx = tdtx + " " + dy;
  dy = "0" + (tdt.getMonth()+1);
  if (typeof lang == "undefined")
  { tdtx = tdtx + " " + moe[tdt.getMonth()] + " " + tdt.getFullYear(); }
  else tdtx = tdtx + "." + dy.substr(dy.length-2,2) + "." + tdt.getFullYear();
  return tdtx;
}

function WinPopUp(ppath,pname,pwidth,pheight,pextra)  // popup window
{ var vwidth = pwidth;
  var vheight = pheight;
  var vextra = "scrollbars=yes,toolbar=yes,menubar=no,location=no";
  if (pextra.length > 0) { vextra = pextra; }
  var rhs2 = rhs;
  var bos2 = bos;
  if (typeof rhs2 == "undefined") rhs2 = 800;  // default screen width
  if (typeof bos2 == "undefined") bos2 = 600;  //            and height
  if (vwidth == 0) vwidth = rhs2 - 20;
  if (vheight == 0) vheight = bos2 - 20;
  var lft2 = (rhs2-vwidth)/2;
  var top2 = 1;
//  var top2 = (bos2-vheight)/2;
//  if (bos2 < 700) top2 = 1;  // stops new window bottom hidden behind taskbar
//  if (top2 > bos2/6) top2 = bos2/6; // simple attempt to allow for top toolbar
  var winpars = "width=" + vwidth + ",height=" + vheight + ",left=" + lft2 + ",top=" + top2;
  winpars = winpars + "," + vextra + ",resizable=yes,dependent=yes";
  wpopup = window.open(ppath,pname,winpars);
  wpopup.focus();
}

function myfocus(fld) {
if (document.all)
{ document.all(fld).focus(); }
else if (document.getElementsByName)
{ document.getElementsByName(fld)[0].focus(); } }

function showmenu(p1,p2) { document.getElementById(p1).style.display=p2; }

function swfver()  // find if Flash installed and version
{ var swfv = 0;
  if ( typeof(navigator.plugins) != "undefined" && navigator.plugins.length > 0 )
  { for ( var i=0; i < navigator.plugins.length; i++ )
    { pind = new String(navigator.plugins[i].description);
      if ( pind.substr(0,15) == "Shockwave Flash" )
        swfv = pind.substring(16,pind.indexOf(".")) * -1;
    }
  }
  else
  { try
    { var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      try
      { var axov = axo.GetVariable("$version");
        swfv = axov.substring(axov.indexOf(" ")+1,axov.indexOf(","));
      }
      catch(e)
      { for ( var i=6; i>1; i-- )
        { try
          { axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
            swfv = i;
            break;
          }
          catch(e){}
        }
      }
    }
    catch(e){}
  }
  return swfv;
}

//-->
