
//*****************************************************
// Copyright:  © 2001 M H Payet
//
// File:       libMain.js
// Language:	JavaScript
// Developer:  MHP
// Date:       Apr 2001
//
// Description:
//    Personal Website - Main library of functions.
//    To be included in all web pages.
//*****************************************************

//=====================================================
// Browser detection.
//=====================================================

var browserType = navigator.userAgent.toLowerCase();
var browserVer = parseFloat(navigator.appVersion);
var browserID = "";
var browserVer4plus = false;

// Check for non-MSIE and non-NN browsers first for JavaScript functions to
// ignore emulation of these two browsers.  Code will operate according to
// real browser ID otherwise outcome is unpredictable without
// thorough testing on these other browsers.

if (browserType.indexOf('opera') != -1) browserID = "OPERA"
else if (browserType.indexOf('webtv') != -1) browserID = "WEBTV"
else if (browserType.indexOf('msie') != -1) browserID = "MSIE"
else if (browserType.indexOf('mozilla') != -1) browserID = "NN"

// Get actual version number of MSIE browser (NN extracts this) to determine
// if > V4.0.

if ((browserID == "MSIE") && (browserVer == 4.0)) {
   var ver4 = browserType.substring(browserType.indexOf('msie'), browserType.length);

   browserVer = ver4.substring(ver4.indexOf(' '), ver4.indexOf(';'));

   // In case value returned is not a number, return 4.0 browser version again.

   if (isNaN(browserVer)) browserVer = 4.0;
}

// Check that current browser will support JavaScript code version 1.2+.
// If not, then any JavaScript 1.1- code may be executed.

if (((browserID == "MSIE") || (browserID == "NN")) && (browserVer >= 4.0)) {
   browserVer4plus = true;
}


//=====================================================
// Browser-specific CSS element definitions.
//=====================================================

if ((browserID == "NN") && (browserVer >= 5.0)) {
   // In particular NN 7.1.

   document.writeln('<style type="text/css">');
   document.writeln('<!--');
   document.writeln('   #glider           {visibility: visible}');
   document.writeln('-->');
   document.writeln('</style>');
}

//=====================================================
// Show date modified - used in page footers.
//=====================================================

function showDateModified() {
   if (lastDateModified() != "") document.writeln("<span>Last modified: " + lastDateModified() + ", EST Australia.</span>");
   else  document.writeln("<span>Last modified: " + document.lastModified +  ".</span>");
}

//=====================================================
// Last date modified.
//=====================================================

function lastDateModified() {
   var someDate = new Date(document.lastModified);
   return someDate.toLocaleString();
}

//=====================================================
// Status messages.
//=====================================================

function statusMsg(msg) {
   window.status = msg;
   return true;
}

function defaultStatusMsg() {
   window.status = window.defaultStatus;
   return true;
}

//=====================================================
// Disclaimer for quotes shown in website.
//=====================================================

function showQuoteDisclaimer() {
   if (browserVer4plus) {
      document.writeln('   <h4>Quotations</h4>');

      document.writeln('   <p>Where copyright exists, quotations displayed on this website');
      document.writeln('      are copyright of their respective owners.  No infringement on');
      document.writeln('      copyright is intended.');
      document.writeln('   </p>');
   }
}

//=====================================================
//
//=====================================================
