// JavaScript Document
/*
 *  File:  browser.js
 *
 *  Browser checking routines (for popular browsers v3.0 and above)
 *
 *  Usage:
 *
 *    <script type="text/javascript"
 *            src="http://www.bgsu.edu/scripts/browser.js">
 *    </script>
 *
 *  Insert the <script> element into the <head> or <body> of your document.
 *
 *  This script adds the following properties to the navigator object:
 *
 *  String properties:   navigator.appVer
 *
 *  Boolean properties:  navigator.isNN,  navigator.isIE
 *                       navigator.isNN3, navigator.isIE3
 *                       navigator.isNN4, navigator.isIE4
 *                       navigator.isNN5, navigator.isIE5
 *                       navigator.isNN6, navigator.isIE6
 *                       navigator.isNN7, navigator.isIE7
 *
 *                       navigator.isWin, navigator.isMac
 *
 *  The script also fixes a screen redraw bug in Netscape Navigator v4.
 *
 *  Example:  browserTest.html
 *
 */

// Adds some properties to the navigator object:
function addNavigatorProps() {

  // Get and save the navigator object:
  var nav = navigator;

  // Determine the name of the browser:
  var browserName = nav.appName;
  var isNN = ( browserName == "Netscape" );
  var isIE = ( browserName == "Microsoft Internet Explorer" );

  // Determine the version of the browser:
  var browserVersion = nav.appVersion;
  var appVer = parseFloat( browserVersion );
  
  // Bug fix for IE 4 and above:
  if ( isIE && appVer >= 4 ) {
    var regexp = /MSIE ([0-9.]+)/;
    if ( regexp.exec( browserVersion ) ) {
      var ver = parseFloat( RegExp.$1 );
      if ( ver > appVer ) {
        appVer = ver;
      }
    }
  }
  
  // Bug fix for NN 6 and above:
  if ( isNN && appVer >= 5 ) {
    var regexp = /Netscape\d?\/([0-9.]+)/;
    if ( regexp.exec( nav.userAgent ) ) {
      var ver = parseFloat( RegExp.$1 );
      if ( ver > appVer ) {
        appVer = ver;
      }
    }
  }
  
  // Determine the platform:
  var ua = nav.userAgent.toLowerCase();
  var isWin = ( ua.indexOf( "win" ) != -1 || ua.indexOf( "16bit" ) != -1 );
  var isMac = ( ua.indexOf( "mac" ) != -1 );
  
  
  // Add properties to the navigator object:
  nav.appVer = appVer;
  nav.isNN = isNN;
  nav.isNN3 = ( isNN && appVer >= 3 );
  nav.isNN4 = ( isNN && appVer >= 4 );
  nav.isNN5 = ( isNN && appVer >= 5 );
  nav.isNN6 = ( isNN && appVer >= 6 );
  nav.isNN7 = ( isNN && appVer >= 7 );
  nav.isIE = isIE;
  nav.isIE3 = ( isIE && appVer >= 3 );
  nav.isIE4 = ( isIE && appVer >= 4 );
  nav.isIE5 = ( isIE && appVer >= 5 );
  nav.isIE6 = ( isIE && appVer >= 6 );
  nav.isIE6orless = ( isIE && appVer <= 6 );
  nav.isIE7 = ( isIE && appVer >= 7 );
  nav.isWin = isWin;
  nav.isMac = isMac;

}
addNavigatorProps();

function isIE6orless()
{
  // Get and save the navigator object:
  var nav = navigator;

  // Determine the name of the browser:
  var browserName = nav.appName;
  var isNN = ( browserName == "Netscape" );
  var isIE = ( browserName == "Microsoft Internet Explorer" );
  
    // Determine the version of the browser:
  var browserVersion = nav.appVersion;
  var appVer = parseFloat( browserVersion );
  
  return ( isIE && appVer <= 6 );
}

function writeEmail(name1, name2, email1, email2)
{
	document.write('<a href=\"mailto:' + email1 + '@' + email2 + '\">' + name1 + name2 + '</a>');
				
}
