
function refreshWindow()
{
  window.location.reload();
}

function lnavOver(navCell, aName)
{
  navCell.className='td_lnav_on';
  navCell.style.cursor='hand';
  document.getElementById(aName).className='lnav_hover';
}

function lnavOut(navCell, aName)
{
  navCell.className='td_lnav';
  document.getElementById(aName).className='lnav';
}

function showMap(sStreet, sCity, sState, sZip)
{
  var mapUrl;

  mapUrl = 'http://maps.yahoo.com/maps_result?addr=' + sStreet;
  mapUrl += '&csz=' + sCity + ', ' + sState + ' ' + sZip;
  mapUrl += '&country=us';

  window.open(encodeURI(mapUrl));
}

function zoomPic(sImgSrc)
{
  var eImg;

  eImg = document.zoomPicImg;
  if (eImg)
    eImg.src = sImgSrc;
}

//
// UserAgent Class - for browser detection
//
function UserAgent()
{
  this.versionString = navigator.appVersion;
  this.major         = parseInt(navigator.appVersion);
  this.minor         = parseFloat(navigator.appVersion);

  this.appName = navigator.appName;
  this.agent   = navigator.userAgent;
  this.agt     = this.agent.toLowerCase();

  this.isWindows = this.agt.indexOf('windows') != -1;
  this.isMac     = this.agt.indexOf('mac') != -1;

  this.isOpera    = this.agt.indexOf('opera') != -1;
  this.isIE       = (this.agt.indexOf('msie') != -1) && (!this.isOpera);
  this.isMozilla  = this.agt.indexOf('gecko') != -1;
  this.isWebTV    = this.agt.indexOf('webtv') != -1;
  this.isAOL      = this.agt.indexOf('aol') != -1;
  this.isNetscape = (this.agt.indexOf('mozilla') != -1) && (!this.isIE) && (!this.isWebTV);

  this.version = 6;

  if (this.isIE)
  {
    var tmp = this.agt.indexOf('msie') + 5;
    this.version = parseFloat(this.agt.substring(tmp));
  }
  else if (this.isOpera)
  {
    var tmp = this.agt.indexOf('opera') + 6;
    this.version = parseFloat(this.agt.substring(tmp));
  }
  else if (this.isMozilla)
  {
    var tmp = this.agt.indexOf('netscape6/') + 10;
    this.version = parseFloat(this.agt.substring(tmp));
  }
  else if (this.isNetscape)
  {
    var tmp = this.agt.indexOf('mozilla/') + 8;
    this.version = parseFloat(this.agt.substring(tmp));
  }

  this.isIE3 = (this.isIE) && (this.version < 4);

  return this;
}

UserAgent.prototype.toString = function()
{
  return this.agent;
}

// create an instance that we can use globally
var userAgent = new UserAgent();

//
// Dialog Class - for popup windows
//
var dialogWinHandle = null;

function Dialog(width, height, url, name)
{
  this.width      = width;
  this.height     = height;
  this.url        = url;
  this.windowName = name;

  this.top        = 0;
  this.left       = 0;
  this.scrollbars = false;
  this.resizable  = false;
  this.toolbar    = false;
  this.status     = false;
  this.location   = false;

  this.handle     = null;
}

Dialog.prototype.show = function()
{
  if ((dialogWinHandle == null) || (dialogWinHandle.closed) )
  {
    this.calculateLocation();
    dialogWinHandle = window.open(this.url, this.windowName, this.features());
    this.handle = dialogWinHandle;
  }
  else
  {
    dialogWinHandle.focus();
    dialogWinHandle.location = this.url;
  }
}

Dialog.prototype.features = function()
{
  var sFeatures;

  if (this.scrollbars)
    sFeatures = "scrollbars=yes";
  else
    sFeatures = "scrollbars=no";

  if (this.resizable)
    sFeatures += ",resizable=yes";
  else
    sFeatures += ",resizable=no";

  if (this.toolbar)
    sFeatures += ",toolbar=yes";
  else
    sFeatures += ",toolbar=no";

  if (this.status)
    sFeatures += ",status=yes";
  else
    sFeatures += ",status=no";

  if (this.location)
    sFeatures += ",location=yes";
  else
    sFeatures += ",location=no";

  sFeatures += ",width=" + this.width;
  sFeatures += ",height=" + this.height;

  sFeatures += ",top=" + this.top;
  sFeatures += ",left=" + this.left;

  return sFeatures;
}

Dialog.prototype.calculateLocation = function()
{
  if ((!userAgent.isIE3) && (!userAgent.isAOL))
  {
    this.width  = (this.width > screen.width ? (screen.availWidth-30): this.width);
    this.height = (this.height > screen.height ? (screen.availHeight-30): this.height);
    this.top    = ((screen.availHeight - 25) - this.height) / 2;
    this.left    = ((screen.availWidth - 25) - this.width) / 2;
  }
}

//
// Open zoom picture popup
//
var zoomPicDlg = null;
function showZoomPic(sImgSrc)
{
  if (zoomPicDlg == null)
  {
    dialogWinHandle = null;
    zoomPicDlg = new Dialog(450, 350, sImgSrc, 'ZoomPic');
    zoomPicDlg.resizable = false;
  }
  else
  {
    dialogWinHandle = zoomPicDlg.handle;
    zoomPicDlg.url = sImgSrc;
  }

  zoomPicDlg.show();
}

