/**
 * Browserversion ermitteln
 * @package JavaScript
 * @subpackage Browser
 * @author Alexander Zimmermann <zimmermann@twt.de>
 * @version $Id: twt_browser.js,v 1.1 2006/04/25 09:49:11 kevin Exp $
 * @filesource
 * @desc Funktionen rund um die Browserversion, Einstellungen, etc.
 * Hinweise: IE 5.0 unterstützt einiges von von DOM 1.0, IE 5.5 schon mehr, IE 6
 * NS 6.x
 */

/**
 * Version des Browsers ermitteln und Global bereit stellen.
 */
Browser = new TWT_GetBrowser();


/**
 * Gibt den Browser und versucht die Haupt- und Nebenversion zu ermitteln
 * @return    integer   Hersteller oder Detailierte Version
 * @access    public
 */
function TWT_GetBrowser()
{
  // Init
  this.browser = '';
  this.majorver = 0;
  this.minorver = 0;
  Browser = null;

  // Opera
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/.*opera[\/ ](\d{1,2})\.(\d{1,2}).*/i);
    if (Browser) {
      this.browser = 'opera';
      this.majorver = Browser[1];
      this.minorver = Browser[2];
    } // if (Browser)
  } // if (this.browswer == '') {

  // Konqueror (Linux)
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/.*konqueror\/(\d{1,2})\.(\d{1,2}).*/i);
    if (Browser) {
      this.browser = 'konqueror';
      this.majorver = Browser[1];
      this.minorver = Browser[2];
    } // if (Browser)
  } // if (this.browswer == '') {

  // Microsoft IE
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/.*msie (\d{1,2})\.(\d{1,2}).*/i);
    if (Browser) {
      this.browser = 'ie';
      this.majorver = Browser[1];
      this.minorver = Browser[2];
    } // if (Browser)
  } // if (this.browswer == '') {

  // NETSCAPE 6+
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/mozilla\/\d\.\d.*netscape6?\/(\d)\.(\d).*/i);
    if (Browser) {
      this.browser = 'netscape';
      this.majorver = Browser[1];
      this.minorver = Browser[2];
    } // if (Browser)
  } // if (this.browswer == '') {

  // MOZILLA
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/mozilla\/\d\.\d.*rv:(\d)\.(\d(\.\d)?).*gecko/i);
    if (Browser) {
      this.browser = 'mozilla';
      this.majorver = Browser[1];
      this.minorver = Browser[2];
    } // if (Browser)
  } // if (this.browswer == '') {

  // NETSCAPE <4
  if (this.browser == '') {
    Browser = navigator.userAgent.match(/mozilla\/(\d).(\d{1,2})/i);
    if (Browser) {
      this.browser = 'netscape';
      this.majorver = Browser[1];
      this.minorver = Browser[2];

      if ((this.majorver == 5) && (navigator.userAgent.indexOf('ecko') > 0))
        this.majorver = 6;
    } // if (Browser)
  } // if (this.browswer == '') {

  // Version Mac (MacOS) feststellen
} // Ende Funktion TWT_GetBrowser
