// Returns true if browser is MSIE (< 4) or Mozilla (< 4).
function oldBrowser()
{
  ua = navigator.userAgent;
  return (ua.indexOf("Mozilla/3") >= 0) || (ua.indexOf("Mozilla/2") >= 0) || (ua.indexOf("MSIE 3") >= 0);
}

// Generate e-mail link for toWhom@domain, plus URI-compatible subject string.
function linkEmail(domain,toWhom,subject,body)
{
  var addr = toWhom + "@" + domain;
  var mailto = "mailto:" + addr;
  document.write("<a title='" + mailto + "' href='" + mailto + "?subject=" + escape(subject) + "'>" + addr + "<\/a>");
}

// Link to external URL in a dependent window.
function extLink(exturl)
{
  var rtn = true;
  if (!oldBrowser())
  {
    var from = unescape(document.URL);
    var home = "index.htm";
    var extwin = window.open("index.htm", "extwin", "resizable,toolbar,scrollbars,menubar,status,dependent");
    self.focus();
    if (from.indexOf(home) < 0)
    {
      extwin.location = from;
    }
    extwin.location = exturl;
    extwin.focus();
    rtn = false;
  }
  return rtn;
}

// Returns left position of an element.
function getElementLeft(eElement)
{
  var nLeftPos = eElement.offsetLeft;
  var eParElement = eElement.offsetParent;
  while (eParElement != null)
  {
    nLeftPos += eParElement.offsetLeft;
    eParElement = eParElement.offsetParent;
  }
  return nLeftPos;
}

// Returns top position of an element.
function getElementTop(eElement)
{
  var nTopPos = eElement.offsetTop;
  var eParElement = eElement.offsetParent;
  while (eParElement != null)
  {
    nTopPos += eParElement.offsetTop;
    eParElement = eParElement.offsetParent;
  }
  return nTopPos;
}

// Show copyright information at bottom of page.
function showCopyright()
{
  var docm = document.lastModified;
  var year = docm.substr(6, 4);
  var date = docm.substr(0, 10);
  var time = docm.substr(11, 8);

  if (oldBrowser())
  {
    document.write("<p class='credits'>Copyright " + year + " Synapsa Productions<\/p>");
  }
  else
  {
    // Put copyright notice at bottom of text, or bottom of page, whichever is lower.
    document.write("<img src='images/pixel.gif' alt='x' ID='textBottom' style='width:1px; visibility:hidden'></img><img src='images/pixel.gif' alt='x' ID='pageBottom' style='position:absolute; bottom:30px; visibility:hidden'></img>");
    var textY = getElementTop(window.textBottom);
    var pageY = getElementTop(window.pageBottom);
    var y = 3 + (pageY > textY ? pageY - textY : 0);

    document.write("<div style='clear:both; margin:0em; padding-top:" + y + "px; width:100%'>");

    document.write("<div style='clear:both; text-align:right; float:right; margin-right:5px;'><a href='https://www.sitelock.com/verify.php?site=visitrax.net' target='_blank'><img id='sl_shield_image' alt='SiteLock' title='SiteLock' border='0' src='http://shield.sitelock.com/shield/visitrax.net' oncontextmenu='alert('Copyright 2009 SITELOCK.COM. All rights reserved.');return false;'/></a></div>");

    document.write("<div style='float:left; margin-left:5px; padding-top:20px;'><img src='images/icra.gif' alt='This site is suitable for all ages - Internet Content Rating Association' onClick='return extLink(icra);' border='1' width='70' height='25' /></div>");

    document.write("<div style='font-size:7pt; font-weight:normal; text-align:center; color:#999999; padding-top:20px;'>Copyright " + year + " Synapsa Productions (updated " + time + " on " + date + ")<br/><strong>VisiTrax<\/strong> and <strong>Synapsa</strong> are trademarks of Synapsa Productions</div></div>");

  }
}

var icra = "http://www.icra.org";


