/**
 * Ultimate client-side JavaScript client sniff. Version 3.03
 * (C) Netscape Communications 1999.  Permission granted to reuse and distribute.
 * Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
 * Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
 *                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
 * Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4,
 *                      correct Opera 5 detection
 *                      add support for winME and win2k
 *                      synch with browser-type-oo.js
 * Revised 26 Mar 01 to correct Opera detection
 * Revised 02 Oct 01 to add IE6 detection
 *
 * Everything you always wanted to know about your JavaScript client
 * but were afraid to ask. Creates "is_" variables indicating:
 * (1) browser vendor:
 *     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
 * (2) browser version number:
 *     is_major (integer indicating major version number: 2, 3, 4 ...)
 *     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
 * (3) browser vendor AND major version number
 *     is_nav2, is_nav3, is_nav4, is_nav6, is_nav7, is_nav7up, is_gecko, is_ie3,
 *     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie55, is_ie55up, is_ie6, is_ie6up,
 *     is_hotjava3, is_hotjava3up, is_opera2, is_opera3, is_opera4, is_opera5,
 *     is_opera6, is_opera7, is_opera7up, is_aol3, is_aol4, is_aol5, is_aol6
 *
 * ============================================================================
 *
 * Note: you don't want your Nav4 or IE4 code to "turn off" or stop working when
 * new versions of browsers are released, so in conditional code forks, use is_ie5up
 * ("IE 5.0 or greater") is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or
 * is_opera5 to check version in code which you want to work on future versions.
 *
 * ============================================================================
 *
 */

function jsDetectBrowser()
{
    // Convert all characters to lowercase to simplify testing
    var agt         = navigator.userAgent.toLowerCase();
    /*
     * *** BROWSER VERSION ***
     * Note: On IE5, these return 4, so use this.ie5up to detect IE5.
     */
    this.major      = parseInt( navigator.appVersion );
    this.minor      = parseFloat( navigator.appVersion );
    /*
     * Note: Opera and WebTV spoof Navigator.  We do strict client detection.
     * If you want to allow spoofing, take out the tests for opera and webtv.
     */
    this.nav        = ( ( agt.indexOf( "mozilla" ) != -1 ) && ( agt.indexOf( "spoofer" ) == -1 ) &&
                        ( agt.indexOf( "compatible" ) == -1 ) && ( agt.indexOf( "opera" ) == -1 ) &&
                        ( agt.indexOf( "webtv" ) == -1 ) && ( agt.indexOf( "hotjava" ) == -1 ) );
    this.nav2       = ( this.nav && ( this.major == 2 ) );
    this.nav3       = ( this.nav && ( this.major == 3 ) );
    this.nav4       = ( this.nav && ( this.major == 4 ) );
    this.navonly    = ( this.nav && ( ( agt.indexOf( ";nav" ) != -1 ) || ( agt.indexOf( "; nav" ) != -1 ) ) );
    this.nav6       = ( this.nav && ( this.major == 6 ) );
    this.nav7       = ( this.nav && ( agt.indexOf( "netscape/7" ) != -1 ) );
    this.nav7up     = ( this.nav && ( agt.indexOf( "netscape/7.") != -1 ) );
    this.gecko      = ( agt.indexOf( "gecko" ) != -1 );

    this.ie         = ( (agt.indexOf( "msie" ) != -1 ) && ( agt.indexOf( "opera" ) == -1 ) );
    this.ie3        = ( this.ie && ( this.major < 4 ) );
    this.ie4        = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 4" ) != -1 ) );
    this.ie5        = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 5.0" ) != -1 ) );
    this.ie55       = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 5.5" ) != -1 ) );
    this.ie55up     = ( this.ie && !this.ie3 && !this.ie4 && !this.ie5 );
    this.ie6        = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 6." ) != -1 ) );
    this.ie7        = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 7." ) != -1 ) );
    this.ie8        = ( this.ie && ( this.major == 4 ) && ( agt.indexOf( "msie 8." ) != -1 ) );
    this.ie6up      = ( this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie55 );
    /*
     * KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
     * or if this is the first browser window opened.  Thus the
     * variables this.aol, this.aol3, and this.aol4 aren't 100% reliable.
     */
    this.aol        = ( agt.indexOf( "aol" ) != -1 );
    this.aol3       = ( this.aol && this.ie3 );
    this.aol4       = ( this.aol && this.ie4 );
    this.aol5       = ( agt.indexOf( "aol 5" ) != -1 );
    this.aol6       = ( agt.indexOf( "aol 6" ) != -1 );
    this.aol6up     = ( this.aol && !this.aol3 && !this.aol4 && !this.aol5 && !this.aol6 );

    this.opera      = ( agt.indexOf( "opera" ) != -1 );
    this.opera2     = ( agt.indexOf( "opera 2" ) != -1 || agt.indexOf( "opera/2" ) != -1 );
    this.opera3     = ( agt.indexOf( "opera 3" ) != -1 || agt.indexOf( "opera/3" ) != -1 );
    this.opera4     = ( agt.indexOf( "opera 4" ) != -1 || agt.indexOf( "opera/4" ) != -1 );
    this.opera5     = ( agt.indexOf( "opera 5" ) != -1 || agt.indexOf( "opera/5" ) != -1 );
    this.opera6     = ( agt.indexOf( "opera 6" ) != -1 || agt.indexOf( "opera/6" ) != -1 );
    this.opera7     = ( agt.indexOf( "opera 7" ) != -1 || agt.indexOf( "opera/7" ) != -1 );
    this.opera7up   = ( this.opera && !this.opera2 && !this.opera3 && !this.opera4 && !this.opera5 && !this.opera6 );

    this.webtv      = ( agt.indexOf( "webtv" ) != -1 );
    this.mac        = ( agt.indexOf( "mac" ) > -1 );
    this.dom        = document.getElementById ? 1 : 0;

    this.TVNavigator= ( ( agt.indexOf( "navio" ) != -1 ) || ( agt.indexOf( "navio_aoltv" ) != -1 ) );
    this.AOLTV		= this.TVNavigator;

    this.hotjava    = ( agt.indexOf( "hotjava" ) != -1 );
    this.hotjava3   = ( this.hotjava && ( this.major == 3 ) );
    this.hotjava3up = ( this.hotjava && ( this.major >= 3 ) );
}

// Determining browser OBJECT
var browser = new jsDetectBrowser();

