//----------------------------------------------------------------------------
//-- Constants : Global
//-- Browser   : Microsoft oder Netscape
//-- Copyright : (c) 2001 by Media Solutions GmbH
//-- Created by: Clemens Kolbenschlag 25.01.2001
//-- Changed by: 
//----------------------------------------------------------------------------
var BrowserName = navigator.appName;
var BrowserVer = parseInt(navigator.appVersion);
var NS3 = (BrowserName == "Netscape" && BrowserVer == 3);
var NS4 = (BrowserName == "Netscape" && BrowserVer >= 4);
var IE3 = (BrowserName == "Microsoft Internet Explorer" && BrowserVer < 4);
var IE4 = (BrowserName == "Microsoft Internet Explorer" && BrowserVer >= 4);
var IE5 = (IE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;

var IE = (document.all) ? 1 : 0;
var NS = (document.layers) ? 1 : 0;

//----------------------------------------------------------------------------
//-- Function  : BrowserCheck
//-- Copyright : (c) 2001 by mediaXp GbR, Essen
//-- Created by: Unknown          
//-- Changed by: Clemens Kolbenschlag 20.09.2001
//----------------------------------------------------------------------------
function BrowserCheck() 
{
	var b = navigator.userAgent.toLowerCase();
	this.major = this.v = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	
	// check for Netscape detect masked browsers workaround for NN6 returning navigator.appVersion = 5
	this.ns = (this.major >= 4 && ((b.indexOf("mozilla") != -1) && (b.indexOf("spoofer") == -1) && (b.indexOf("compatible") == -1) && (b.indexOf("opera") == -1) && (b.indexOf("webtv") == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns4up = (this.ns && (this.major >= 4));
	this.ns5 = (this.ns && (this.major == 5));
	this.ns5up = (this.ns && (this.major >= 5));
	this.ns6 = (this.ns && ((this.major == 6) || (b.indexOf("netscape6") != -1)));
	this.ns6up = (this.ns && ((this.major >= 6) || this.ns6));
	
	// check for Microsoft Internet Explorer detect masked browsers workaround for IE5 returning navigator.appVersion = 4
	this.ie = (this.major >= 4 && ((b.indexOf("msie") != -1) && (b.indexOf("spoofer") == -1) && (b.indexOf("opera") == -1) && (b.indexOf("webtv") == -1)));
	this.ie4 = (b.indexOf("msie 4") != -1);
	this.ie4up = (this.ie && (this.major >= 4));
	this.ie5 = (b.indexOf("msie 5") != -1);
	this.ie5up = (this.ie && (this.major >= 5 || this.ie5));
	this.ie6 = (this.ie && (this.major == 6));
	this.ie6up = (this.ie && (this.major >= 6));
	
	// detect Opera behind masking // changed 09 Jan 2001 by mak
	this.opera = (b.indexOf("opera") != -1);
	this.opera3 = (b.indexOf("opera 3") != -1);
	this.opera3up = (this.opera3 || (b.indexOf("opera 4") != -1) || (this.opera && this.major == 4) || (b.indexOf("opera 5") != -1) || (this.opera && this.major == 5));
	this.opera4 = (b.indexOf("opera 4") != -1 || (this.opera && this.major == 4));
	this.opera4up = (this.opera4 || (this.opera && this.major >= 5));
	this.opera5 = (b.indexOf("opera 5") != -1 || (this.opera && this.major == 5));
	this.opera5up = (this.opera5);
	// added 26 Jul 2000 by mak: set NS and IE detection to false if masked Opera
	if (this.opera) 
	{
		this.ns = this.ns4 = this.ns4up = this.ns5 = this.ns5up = this.ns6 = this.ns6up = this.ie = this.ie4 = this.ie4up = this.ie5 = this.ie5up = this.ie6 = this.ie6up = false;
	}

	// check for Mozilla
	this.mozilla5 = ((this.major == 5) && (b.indexOf("mozilla") != -1));
	
	// is.min stands for minimum requirements, i.e. browsers 4+ (remove comments around Opera 4 if the browser meets standards)
	this.min = (this.ns || this.ie  || this.opera4up );
	
	// platform detection without the use of document.platform
	this.win = this.pc = (b.indexOf("win") != -1 || b.indexOf("16bit") != -1);
	this.mac = (b.indexOf("mac") != -1);
	this.linux = (b.indexOf("linux") != -1);
	
	// object detection
	this.all = (document.all) ? true : false;
	this.layers = (document.layers) ? true : false;
	this.dom = (document.getElementById) ? true : false;
	
	this.java = (navigator.javaEnabled());
	this.print = (window.print) ? true : false;
	
	this.images = (document.images) ? true : false;
	this.frames = (window.frames) ? true : false;
	this.screen = (window.screen) ? true : false;
	
	// JavaScript version detection (workaround for NS3 returning 1.2 instead of 1.1)
	if (this.opera3) this.js = 1.1;
	else if ((this.ns4 && this.minor <= 4.05) || this.ie4) this.js = 1.2;
	else if ((this.ns4 && this.minor > 4.05) || this.ie5up || this.opera4) this.js = 1.3;
	else if (this.ns5 && !this.ns6up) this.js = 1.4;
	else if (this.ns6up) this.js = 1.5;
}

// automatically create the "is" object
var is = new BrowserCheck();

//----------------------------------------------------------------------------
//-- Function  : WindowAttributs
//-- Copyright : (c) 2001 by mediaXp GbR, Essen
//-- Created by: Unknown          
//-- Changed by: 
//----------------------------------------------------------------------------
function WindowAttributes() 
{
	if (is.ie) 
	{
		this.width = document.body.clientWidth
		this.height	= document.body.clientHeight
	}			
	if (is.ns) 
	{
		this.width = window.innerWidth
		this.height = window.innerHeight
	}
}

