//*******************************************
//  Copyright Dealer.com Websystems
//  browserinfo.js
//  earthcars Browser Information
//  author: ///o-o\\\
//  date: 6.28.99
//********************************************

function BrowserInfo()
{
    this.type = navigator.appName;
    this.agent = navigator.userAgent.toLowerCase();
    var version = navigator.appVersion;
    this.versionInfo = version.split(" ");

    if( this.type == "Netscape"
        && this.versionInfo[0].indexOf("G") != -1 )
        this.version = this.versionInfo[0].substring(0,this.versionInfo[0].indexOf("G"));
    else if( this.type == "Netscape" ){
        this.version = this.versionInfo[0];
    }else{
        // MS5.0 appVersion wasn't updated in both places
        index = this.versionInfo[3].indexOf(";");
        this.version = this.versionInfo[3].substring( 0, index );
    }

    this.platform = navigator.platform;

    if( this.type == "Netscape" && this.version.substring(0,1) < 4 ){
        this.os = "UNKNOWN";
    }else{
        this.os = this.platform.substring( 0, 3 );
    }

    // Methods
    this.getType = getType;
    this.getVersion = getVersion;
    this.aboveFour = aboveFour;
    this.isNetscape = isNetscape;
    this.isExplorer = isExplorer;
		this.isMozilla = isMozilla;
    this.isOther = isOther;
    this.getPlatform = getPlatform;
    this.getOS = getOS;
    this.isAol = isAol;
		this.isWindows = isWindows;
		this.isNetscape6 = isNetscape6
}

function getType()
{
     return this.type;
}

function getVersion()
{
     return this.version;
}

function isNetscape()
{
    if((this.type == "Netscape") && (!this.isMozilla))
        return true;
    else
        return false;
}

function isMozilla() {
	if ((this.agent.indexOf('mozilla') > -1) && (this.agent.indexOf('compatible') == -1))
		return true;
	else
		return false;
}

function isExplorer()
{
    if( this.type == "Microsoft Internet Explorer" )
        return true;
    else
        return false;
}

function isOther()
{
     if( this.type != "Netscape" && this.type != "Microsoft Internet Explorer" )
        return true;
     else
        return false;
}

function aboveFour()
{
    if( this.version.substring(0,1) >= 4 )
        return true;
    else
        return false;
}

function getPlatform()
{
    return this.platform;
}

function getOS()
{
    return this.os;
}

function isAol()
{
	return ((this.agent.indexOf("aol")>0)?true:false);
}

function isWindows()
{
    if( this.os == "Win" )
        return true;
    else
        return false;
}

function isNetscape6() {
	if( this.type == "Netscape" && this.version > 4.9 ) return true;
	else return false;
}

//Not a method of BrowserInfo()
function browserCheck( redirectPage ) {
	browserInfoObj = new BrowserInfo()
	if( (browserInfoObj.version < 4.0) || (browserInfoObj.type=="Netscape" && browserInfoObj.version < 4.08) ) {
		top.location = (redirectPage)?redirectPage:"download.esl";
		return false;
	}
	return true;
}

