//   ::sector27 GmbH, Dorsten - cb^2
//   http://www.sector27.de - eMail: info@sector27.de
//   CGI-/ Perl-Programmierungen, Webapplikationen, 
//   HTML, XHTML, DHTML, CSS, JavaScript, Webdesign 
//   Alle Rechte vorbehalten  - (c)2005 by sector27

//   Version: 20050716

//  Einzubindende JavaScript-Libraries
//  - keine

/* Funktionsbeschreibungen -------------------------------------------------
	nach Einbindung dieser JS-Datei steht automatisch das Objekt app_env.browser.x zur Verfuegung, welches
	unterschiedliche Eigenschaften beschreibt
	app_env.browser.name     		Name des Browser (op, ge, ns, ie, browser_name);
						.version	Versionsnummer des Browsers;
						.ns4/ge5/ie4/ie5/ie5_5/ie6/op5/op6/op7/op8	Spezifikation eines definierten Browsers bzw. Engine
						.ns			Spezifikation der Browsergruppe: Netscape 4.x
						.op			Spezifikation der Browsergruppe: Opera, wird an die Gruppen: .ie und .dom weitergereicht
						.ie				"        "        "      : IExplorer 4.x,5.x, Opera 5
						.dom			"        "        "      : IExplorer >= 6, Netscape6, Mozilla > 0.x, Firefox > 1  Opera > 6
						.dhtml		Browsergruppe die nicht oben genannt wurde aber das DOM-Model erfuellen
*/

top.app_env=new check_browser();
function check_browser(){this.browser=new init_browser();}

function init_browser(){
	// bestimme Browsername
	if(!navigator.userAgent.search(/Opera.*/))this.name="op";
	else if(!navigator.userAgent.search(/.*Gecko/))this.name="ge";    
	else if(!navigator.appName.search(/Netscape.*/))this.name="ns";
	else if(!navigator.appName.search(/Microsoft Internet Explorer.*/))this.name="ie";
	else this.name=navigator.appName;

	// bestimme Browserversion
	this.version = parseInt(navigator.appVersion);
	this.ns4=(this.name=="ns"&&this.version==4)?true:false;
	this.ge5=(this.name=="ge"&&this.version==5)?true:false;

	this.ie4=this.ie5=this.ie5_5=this.ie6=this.ie7=this.op5=this.op6=this.op7=this.op8=false;
	if(navigator.userAgent.search(/Opera/)>=0){
		if(navigator.userAgent.search(/Opera.5/)>=0){ 	this.op5=true; 		this.version=5; 	}
		if(navigator.userAgent.search(/Opera.6/)>=0){ 	this.op6=true; 		this.version=6; 	}
		if(navigator.userAgent.search(/Opera.7/)>=0){ 	this.op7=true; 		this.version=7; 	}
		if(navigator.userAgent.search(/Opera.8/)>=0){ 	this.op8=true; 		this.version=8; 	}	
	}else if(navigator.userAgent.search(/MSIE/)>=0){
		if(navigator.userAgent.search(/MSIE 4/)>=0){ 	this.ie4=true; 		this.version=4; 	}
		if(navigator.userAgent.search(/MSIE 5/)>=0){ 	this.ie5=true; 		this.version=5; 	}
		if(navigator.userAgent.search(/MSIE 5.5/)>=0){ 	this.ie5_5=true; 	this.version=5.5; 	}
		if(navigator.userAgent.search(/MSIE 6/)>=0){ 	this.ie6=true; 		this.version=6; 	}	
		if(navigator.userAgent.search(/MSIE 7/)>=0){ 	this.ie7=true; 		this.version=7; 	}	
	}
	
	// ordne ermittelten Browser bestimmten Gruppen zu
	this.ns=(this.name=="ns"&&this.version==4)?true:false;
	this.op=(this.op5 || this.op6 || this.op7 || this.op8)?true:false;
	this.ie=( (this.name=="ie"&&this.version>=4 && this.version<6) || (this.op && this.version<=6) )?true:false;
	this.dom=(this.ge5 || (this.name=="ie"&&this.version>=6) || (this.op && this.version>=7) )?true:false;
	this.dhtml=(!this.dom&&!this.ie&&!this.ns&&!this.op&&document.getElementById)?true:false;
	
	// erfuellt ermittelter Browser die Mindestvoraussetzungen
	this.status=(this.ns||this.ie||this.dom||this.dhtml)?true:false;
}
