////////////////////////////////////////////////////////////////////////////////
// browser.js	Current version:1.01		Last modified: 19/04/2007
//
// Remarks:   Javascript browser sniffer code.
//
// Developers:
// Mike Foster - Original source (http://www.webmasterworld.com/forum91/567-2-15.htm)
// Rob Foulsham (RobF)
// Nick Taylor (NickT)
//
// Version History:
//
// 1.0	12/04/2007	(RobF)	First version based on Croner-i original (note: this may be overkill as the browser version number is not required at present).
// 1.01 19/04/2007  (NickT) Updated for IE7.
//
// Copyright Wolters Kluwer (UK) Limited 2004-2007. All rights reserved.
////////////////////////////////////////////////////////////////////////////////


function getBrowser()
{
  this.ua = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  // DOM Support
  if (document.addEventListener && document.removeEventListener) this.dom2events = true;
  if (document.getElementById) this.dom1getbyid = true;
  // opera
  this.opera = this.ua.indexOf('opera') != -1;
  if (this.opera)
  {
    this.opera5 = (this.ua.indexOf("opera 5") != -1 || this.ua.indexOf("opera/5") != -1);
    return;
  }
  // MSIE
  this.ie = this.ua.indexOf('msie') != -1;
  if (this.ie)
  {
    this.ie3 = this.major < 4;
    this.ie4 = (this.major == 4 && this.ua.indexOf('msie 5') == -1 && this.ua.indexOf('msie 6') == -1);
    this.ie4up = this.major >= 4;
    this.ie5 = (this.major == 4 && this.ua.indexOf('msie 5.0') != -1);
    this.ie5up = !this.ie3 && !this.ie4;
    this.ie6 = (this.major == 4 && this.ua.indexOf('msie 6.0') != -1);
    this.ie6up = (!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5") == -1);
    this.ie7 = (this.major == 7 && this.ua.indexOf('msie 7.0') != -1);
    this.ie7up = (!this.ie3 && !this.ie4 && !this.ie5 && this.ua.indexOf("msie 5.5") == -1 && !this.ie6);
    return;
  }
  // Misc.
  this.hotjava = this.ua.indexOf('hotjava') != -1;
  this.webtv = this.ua.indexOf('webtv') != -1;
  this.aol = this.ua.indexOf('aol') != -1;
  if (this.hotjava || this.webtv || this.aol) return;
  // Gecko, NN4+, and NS6
  this.gecko = this.ua.indexOf('gecko') != -1;
  this.nav = (this.ua.indexOf('mozilla') != -1 && this.ua.indexOf('spoofer') == -1 && this.ua.indexOf('compatible') == -1);
  if (this.nav)
  {
    this.nav4 = this.major == 4;
    this.nav4up= this.major >= 4;
    this.nav5up= this.major >= 5;
    this.nav6 = this.major == 5;
    this.nav6up= this.nav5up;
  }
}
