// JavaScript Document
//<![CDATA[
/********************************************************
 * This file includes source code which is taken
 * from, or derived from the Ahab Cross Browser Library,
 * Copyright (C) 2003, CodeHouse.com
 * http://www.codehouse.com/javascript/ahab
 * This notice may not be removed.
 ********************************************************/
function AhabBrowserSniffer()
{
   var ua = navigator.userAgent;

   this.isOpera = function()
   {
      return /Opera/.test(ua);
   }

   this.isSafari = function()
   {
      return /Safari/.test(ua);
   }

   this.isGecko = function()
   {
      return navigator.product == "Gecko" &&
	     ! ( this.isOpera() || this.isSafari() );
   }

   this.isIEWin = function()
   {
      return window.external && /Win/.test(ua);
   }

   this.isIEMac = function()
   {
      return window.external && /Mac/.test(ua);
   }

   this.getVersion = function()
   {
      if( this.isIEWin() || this.isIEMac() )
      {
         return Number(ua.match(/MSIE ([0-9.]+)/)[1]);
      }
      else if( this.isSafari() )
      {
         return Number(ua.match(/[0-9.]+$/));
      }
      else if( this.isGecko() )
      {
         var n = ua.match(/rv:([0-9.]+)/)[1];

         var ar = n.split(".");

         var s = ar[0] + ".";

         for(var i = 1; i < ar.length; ++i)
         {
            s += ("0" + ar[i]).match(/.{2}$/)[0];
         }

         return Number(s);
      }
      else if( this.isOpera() )
      {
         return Number(ua.match(/Opera ([0-9.]+)/)[1]);
      }
      else
      {
         return null;
      }
   }
}

   sniffer = new AhabBrowserSniffer();

   if( sniffer.isIEWin() )
   {
      browserType = "Internet Explorer for Windows";
   }
   else if( sniffer.isIEMac() )
   {
      browserType = "Internet Explorer for Macintosh";
   }
   else if( sniffer.isSafari() )
   {
      browserType = "Safari"
	  document.write('<link rel="stylesheet" type="text/css" href="css/mac_safari.css">');
   }
   else if( sniffer.isGecko() )
   {
      browserType = "Gecko family";
   }
   else if( sniffer.isOpera() )
   {
      browserType = "Opera";
   }
   else
   {
      browserType = "Unknown";
   }
//]]>