// Universelle Browserabfrage
// (Plattform, Browser, Flash, Java)
//
// Copyright (c) 2002 Eurotel NewMedia GmbH
// Konzept und Realisation R. Botzenhart
//
// All rights reserved. The duplication of this Script in any
// form is strictly prohibited for private and commercial use.

function browserCheck() {
	var userAgent = navigator.userAgent.toLowerCase();
	var appName = navigator.appName.toLowerCase();
	
	var docAll = (document.all) ? true : false;
	var docLayers = (document.layers) ? true : false;
	var docGetElemId = (document.getElementById) ? true : false;
	
	this.win = (userAgent.indexOf('win') != -1) ? true : false;
	this.mac = (userAgent.indexOf('mac') != -1) ? true : false;
	this.linux = (userAgent.indexOf('linux') != -1 || userAgent.indexOf('x11') != -1) ? true : false;
	
	this.ie = (appName.indexOf('internet explorer') != -1) ? true : false;
	this.ie4 = (this.ie && !docGetElemId);
	this.ie4win = (this.ie4 && this.win);
	this.ie4mac = (this.ie4 && this.mac && !docGetElemId);
	this.ie5 = (this.ie4 && docGetElemId);
	this.ie5mac = (this.ie5 && this.mac);
	this.ie6 = (this.ie && userAgent.indexOf('msie 6') != -1);
	
	this.ns = (appName.indexOf('netscape') != -1) ? true : false;
	this.ns4 = (this.ns && docLayers);
	this.ns6 = (this.ns && docGetElemId);
	
	if (this.ie4in) {
		with (document) {
			write('<script language="VBScript" type="text/vbscript">\n');
			write('Function flashActX(flashVer)\n');
			write('\tOn Error Resume Next\n');
			write('\t\n');
			write('\tDim FlashObj\n');
			write('\tFlashObj = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVer))\n');
			write('\tflashActX = FlashObj\n');
			write('End Function\n');
			write('</script>\n');
		}
		this.flash4Enabled = (typeof(flashActX(4)) != 'undefined') ? true : false;
		this.flash5Enabled = (typeof(flashActX(5)) != 'undefined') ? true : false;
	} else {
		if (navigator.plugins && navigator.plugins['Shockwave Flash']) {
			var flashPlugIn = 0;
			var str = navigator.plugins['Shockwave Flash'].description.split(' ');
			for (var i = 0; i < str.length; i++) {
				if (!isNaN(parseInt(str[i]))) {
					flashPlugIn = parseInt(str[i]);
					break;
				}
			}
			this.flash4Enabled = (flashPlugIn >= 4) ? true : false;
			this.flash5Enabled = (flashPlugIn >= 5) ? true : false;
		} else {
			this.flash4Enabled = false;
			this.flash5Enabled = false;
		}
	}
	
	this.javaEnabled = navigator.javaEnabled();
}

var is = new browserCheck();
