	/**
	 * Browser Info 0.3
	 */

	function browserInfo() {

		this.engineName = '';
		this.engineVersion = '';
		this.browserName = '';
		this.browserVersion = '';
		this.systemName = '';
		this.systemVersion = '';
		
		var htmlElement = document.getElementsByTagName('html')[0];
		
		this.getEngine = function() {
		
			if (typeof(opera) == 'object') {
			
				this.engineName = 'Presto';
				var version = navigator.userAgent.match(/Presto\/([0-9.]+)/);
				if (version && version[1]) this.engineVersion = version[1];
				
				this.browserName = 'Opera';
				this.browserVersion = opera.version();
				
			}
			else if(typeof(htmlElement.style.MozBackgroundClip) == 'string') {
			
				this.engineName = 'Gecko';
				var version = navigator.userAgent.match(/rv:([0-9.]+)/);
				if (version && version[1]) this.engineVersion = version[1];
				
				var browsers = [
				
					['Flock', /Flock\/([0-9.]+)/],
					['Firefox', /Firefox\/([0-9.]+)/]
				];
				
				this.getBrowser(browsers);
				
// 				if (navigator.userAgent.indexOf('Flock') != -1) {
// 				
// 					this.browserName = 'Flock';
// 					var version = navigator.userAgent.match(/Flock\/([0-9.]+)/);
// 					if (version && version[1]) this.browserVersion = version[1];
// 				}
// 				else {
// 				
// 					this.browserName = 'Firefox';
// 					var version = navigator.userAgent.match(/Firefox ([0-9.]+)/);
// 					if (version && version[1]) this.browserVersion = version[1];
// 				}
			}
			else if(typeof(htmlElement.style.WebkitBackgroundClip) == 'string') {
			
				this.engineName = 'Webkit';
				var version = navigator.userAgent.match(/WebKit\/([0-9.]+)/);
				if (version && version[1]) this.engineVersion = version[1];
				
				var browsers = [
								
					['Arora', /Arora\/([0-9.]+)/],
					['Iron', /Iron\/([0-9.]+)/],
					['Chrome', /Chrome\/([0-9.]+)/],
					['Safari', /Safari\/([0-9.]+)/]
				];
				
				this.getBrowser(browsers);
			}
			else if(typeof(htmlElement.style.KHTMLBorderRadius) == 'string') {
			
				this.engineName = 'KHTML';
				var version = navigator.userAgent.match(/KHTML\/([0-9.]+)/);
				if (version && version[1]) this.engineVersion = version[1];
			}
			else if(typeof(htmlElement.style.filter) == 'string') {
			
				this.engineName = 'Trident';
				var version = navigator.userAgent.match(/Trident\/([0-9.]+)/);
				if (version && version[1]) {
					
					this.engineVersion = version[1];
				}
				else if (typeof htmlElement.style.msInterpolationMode == 'string') {
				
					this.engineVersion = 'IE7.0';
				}
				else {
					
					var version = navigator.userAgent.match(/MSIE ([0-9.]+)/);
					if (version && version[1]) {
					
						this.engineVersion = 'IE' + version[1];
					}
				}
				
				var browsers = [
								
					['MSIE', /MSIE ([0-9.]+)/]
				];
				
				this.getBrowser(browsers);
			}
			else {
			
				this.engineName = 'Other';
			}
		}
		
		this.getBrowser = function(pattern) {
		
			if (pattern) {
			
				for (var i = 0; i < pattern.length; i++) {
				
					if (navigator.userAgent.indexOf(pattern[i][0]) != -1) {
					
						this.browserName = pattern[i][0];
						var version = navigator.userAgent.match(pattern[i][1]);
						if (version && version[1]) this.browserVersion = version[1];
						break;
					}
				}
			}
		}
		
		this.getObjectTree = function(obj) {
		
			var returnVar = [];
			
			if (typeof obj == 'object') {
			
				for(var o in obj) {
				
					returnVar.push(o + ': ' + typeof obj[o] + ' ' + obj[o]);
				}
			}
			
			returnVar.sort();
			return returnVar.join('<br />');
		}
		
		this.dump = typeof document.getElementsByTagName('html')[0].style.filter;
	}
	
//	var defaultErrorHandler = window.onerror;
//	window.onerror = function(errorMsg, url, lineNumber) {
//	
//		window.onload = function() {
//			
//			document.getElementById('biError').innerHTML = '<b>Error:</p><br />' + ('Error: ' + errorMsg + ' in Line ' + lineNumber + ' in file ' + url);
//		}
//		return false;
//	}
	
//	window.onerror = defaultErrorHandler;

	
//	window.onload = function() {
//
//		document.getElementById('biOut').innerHTML = '<b>Browser Info:</b>';
//		document.getElementById('biOut').innerHTML += '<br />Engine: ' + browserInfo.engineName + ' ' + browserInfo.engineVersion;
//		document.getElementById('biOut').innerHTML += '<br />Browser: ' + browserInfo.browserName + ' ' + browserInfo.browserVersion;
//		document.getElementById('biOut').innerHTML += '<br />User Agent: ' + navigator.userAgent;
//// 		document.getElementById('biOut').innerHTML += browserInfo.getObjectTree(opera);
//	
//	}



	try {
		
		var STATISTIC_BASE_URL = '%server_url%';
		var STATISTIC_DEVMODE = %dev_mode%;
		var STATISTIC_SERVER_ID = location.hostname.replace(/^www\./, '');
		
		/**
		 * ID Noscript Request Image
		 */
		NNS_REQIMG_ID = 'nnsRequest';
		
		/**
		 * Erzeuge Image
		 */
		var browserVersion, engineName, engineVersion, browserName;
		var svgEnabled = -1, canvasEnabled = -1, javaEnabled = -1;
		var screenSize = -1, screenColorDepth = -1, contentSize = -1;
		var cookiesEnabled = -1;
		var operatingSystem, browserLanguage, flashVersion, silverlightVersion;
		var jsReferrer, jsUserAgent;
		
		/**
		 * Get Browser by Object
		 */
		function getBrowserByObject() {
		
			if (window.opera) {
			
				//Opera
				browserVersion = opera.version();
				engineName = 'Presto';
				engineVersion = '';
				browserName = 'Opera';
				operatingSystem = getPlatform();
				browserLanguage = getLanguage();
				flashVersion = getPlugin('Flash');
				silverlightVersion = getPlugin('Sliverlight');
			}
			else if (window.clientInformation) {
			
				//Konqueror, Safari or IE
				if (window.clientInformation.vendor && window.clientInformation.vendor.indexOf('Apple') != -1) {
				
					if (navigator.userAgent.indexOf('Arora') == '-1') {
						
						browserVersion = getVersionByUA();
						engineName = 'Webkit';
						engineVersion = getVersionByUA(/(WebKit)\/([0-9.]+)/);
						browserName = 'Safari';
						operatingSystem = getPlatform();
						browserLanguage = getLanguage();
					}
					else {
						
						browserVersion = getVersionByUA();
						engineName = 'Webkit';
						engineVersion = getVersionByUA(/(Arora)\/([0-9.]+)/);
						browserName = 'Arora';
						operatingSystem = getPlatform();
						browserLanguage = getLanguage();
					}
				}
				else if (window.clientInformation.vendor && window.clientInformation.vendor.indexOf('KDE') != -1) {
				
					browserVersion = getVersionByUA();
					engineName = 'KHTML';
					engineVersion = browserVersion;
					browserName = 'Konqueror';
					operatingSystem = getPlatform();
					browserLanguage = getLanguage();
				}
				else {
				
					//MSIE
					
					browserVersion = getVersionByUA(/(MSIE) ([0-9.]+)/);
					engineName = 'Trident';
					engineVersion = 0;
					browserName = 'MSIE';
					operatingSystem = getPlatform();
					browserLanguage = getLanguage();
				}
			}
			else if (navigator.product && navigator.product == 'Gecko') {
			
				//Firefox Derivat
				browserVersion = getVersionByUA();
				engineName = 'Gecko';
				engineVersion = navigator.productSub;
				browserName = 'Firefox';
				operatingSystem = getPlatform();
				browserLanguage = getLanguage();
			}
			else {
			
				browserVersion = 0;
				engineName = 'other';
				browserName = 'Other';
			}
			
		}
		
		function getBrowserInfo() {
		
			if (screen.width) {
			
				screenSize = screen.width + 'x' + screen.height;
			}
			else {
			
				screenSize = '-1x-1';
			}
			
			if (window.innerWidth) {
			
				contentSize = window.innerWidth + 'x' + window.innerHeight;
			}
			else if(document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth > 0) {
			
				contentSize = document.documentElement.clientWidth + 'x' + document.documentElement.clientHeight;
			}
			else if(document.body && document.body.clientWidth && document.body.clientWidth > 0) {
			
				contentSize = document.body.clientWidth + 'x' + document.body.clientHeight;
			}
			else {
			
				contentSize = '-1x-1';
			}
			
			if (screen.colorDepth) {
			
				screenColorDepth = screen.colorDepth;
			}
			else if(screen.pixelDepth) {
			
				screenColorDepth = screen.pixelDepth;
			}
			else {
			
				screenColorDepth = -1;
			}
			
			//Java
			if (typeof navigator.javaEnabled != 'undefined') {
			
				javaEnabled = (navigator.javaEnabled()) ? 1 : 0;
			}
			
			//Cookies
			if (typeof navigator.cookieEnabled != 'undefined') {
			
				cookiesEnabled = (navigator.cookieEnabled) ? 1 : 0;
			}
			
			//Referrer
			if (typeof document.referrer == 'string') {
				
				jsReferrer = encodeURIComponent(document.referrer);
			}
			
			//UserAgent
			if (typeof navigator.userAgent == 'string') {
				
				jsUserAgent = encodeURIComponent(navigator.userAgent);
			}
			
		}
		
		function getVersionByUA(pattern) {
		
			if (!pattern) {
			
				var pattern = /(Firefox|KHTML|Version)\/([0-9.]+)/;
			}
			
			var browserVersion = navigator.userAgent.match(pattern);
			if (browserVersion && browserVersion.length > 1) {
			
				return browserVersion[2];
			}
			else {
			
				return 'x';
			}
		}
		
		function getPlatformByUA(pattern) {
		
			if (!pattern) {
			
				var pattern = /((Linux|NT [0-9.]+))/;
			}
			
			var os = navigator.userAgent.match(pattern);
			if (os && os.length > 1) {
			
				return os[2];
			}
			else {
			
				return 0;
			}
		}
		
		function getPlatform() {
		
			var os = null;
			
			if (navigator.platform) {
			
				os = navigator.platform;
				var osFrom = (navigator.oscpu) ? navigator.oscpu : '';
				
				if (os.indexOf('Linux') > -1) {
					
					os = 'Linux';
				}
				else if (os.indexOf('Win32') > -1 || os.indexOf('Win64') > -1) {
					
					os = 'Windows';
					
					if (osFrom.indexOf("Windows NT 6.0") > -1) {
						
						os = "Windows Vista";
					}
					else if (osFrom.indexOf("Windows NT 5.2") > -1) {
					
						os = "Windows 2003";
					}
					else if (osFrom.indexOf("Windows NT 5.1") > -1) {
					
						os = "Windows XP";
					}
					else if (osFrom.indexOf("Windows NT 5.0") > -1) {
					
						os = "Windows 2000";
					}
					else if (osFrom.indexOf("Windows NT 4") > -1) {
					
						os = "Windows NT";
					}
					else if (osFrom.indexOf("Windows ME") > -1) {
					
						os = "Windows ME";
					}
					else if (osFrom.indexOf("Windows 98") > -1) {
					
						os = "Windows 98";
					}
					else if (osFrom.indexOf("Windows 95") > -1) {
					
						os = "Windows 95";
					}
					else if (osFrom.indexOf("Windows CE") > -1) {
					
						os = "Windows CE";
					}
				}
				else if (os.indexOf('Mac') > -1) {
					
					os = 'Mac';
				}
			}
			
			return os;
		}
		
		function getLanguage() {
		
			var lang = null;
			
			if (navigator.language) {
			
				lang = navigator.language;
			}
			
			return lang;
		}
		
		function getPlugin(pluginName) {
		
			var pluginVersion = -1;
			
			if (pluginName && navigator.plugins) {
			
				for (var el in navigator.plugins) {
				
					if (navigator.plugins[el].description.indexOf(pluginName) != -1) {
					
						//Plugin gefunden
	// 					var pluginName = pluginName;
						var pluginVersion = navigator.plugins[el].description.match(/([0-9.]+)/);
						
						if (pluginVersion) {
						
							pluginVersion = pluginVersion[1];
						}
						
						break;
					}
				}
			}
	
			return pluginVersion;
		}
		
		function getPage() {
			
			//TODO Page settings
			var page = (true) ? location.pathname : location.pathname + location.search;
			
			return page;
		}
		
		getBrowserByObject();
		getBrowserInfo();
		
		//Browsr
		browser = 'Opera';
		
		//OS
		operating_system = 'Linux';
		
		function deleteImage() {
			
			if (typeof(document.getElementById(NNS_REQIMG_ID)) == 'undefined') {
				
				window.setTimeout(deleteImage, 5);
			}
			else {
				
				document.getElementById(NNS_REQIMG_ID).src = '';
			}
		}
		
		//Deaktiviere Noscript Request
		
		
		//Create output image
		var statistic = new browserInfo();
		statistic.getEngine();
		
		//Image Erzeugen
		document.write('<img src="' + STATISTIC_BASE_URL + '/in.php?');
		document.write('bname=' + statistic.browserName);
		document.write('&bvers=' + statistic.browserVersion);
		document.write('&osys=' + operatingSystem);
		document.write('&ename=' + statistic.engineName);
		document.write('&evers=' + statistic.engineVersion);
		document.write('&ssize=' + screenSize);
		document.write('&asize=' + contentSize);
		document.write('&sdep=' + screenColorDepth);
		document.write('&blang=' + browserLanguage);
		document.write('&svgen=' + svgEnabled);
		document.write('&canen=' + canvasEnabled);
		document.write('&javen=' + javaEnabled);
		document.write('&jsen=1');
		document.write('&fvers=' + flashVersion);
		document.write('&svers=' + silverlightVersion);
		document.write('&cooen=' + cookiesEnabled);
		document.write('&jsref=' + jsReferrer);
		document.write('&jsua=' + jsUserAgent);
		document.write('&sid=' + STATISTIC_SERVER_ID);
		document.write('&page=' + encodeURIComponent(getPage()));
		document.write('&p1=' + ((navigator.platform) ? encodeURIComponent(navigator.platform) : ''));
		document.write('&p2=' + ((navigator.vendor) ? encodeURIComponent(navigator.vendor) : ''));
		document.write('&p3=' + ((navigator.oscpu) ? encodeURIComponent(navigator.oscpu) : ''));
		document.write('&p4=' + ((navigator.vendorSub) ? encodeURIComponent(navigator.vendorSub) : ''));
		document.write('&p5=' + ((navigator.product) ? encodeURIComponent(navigator.product) : ''));
		document.write('&p6=' + ((navigator.productSub) ? encodeURIComponent(navigator.productSub) : ''));
		document.write('&p7=' + ((navigator.cpuClass) ? encodeURIComponent(navigator.cpuClass) : ''));
		//document.write('&p8=' + );
		//document.write('&p9=' + );
		document.write('" id="' + NNS_REQIMG_ID + '" />');
		
		if (STATISTIC_DEVMODE == 1) {
			
			document.write('<br /><br /><code>URL: ' + document.getElementById(NNS_REQIMG_ID).src);
			
			document.write('</code><div style="font-size: 11px;">');
			
			document.write('<br /><b>Devmode Output:</b>');
			document.write('<br />Browser: ' + statistic.browserName + ' ' + statistic.browserVersion);
			document.write('<br />System: ' + operatingSystem);
			document.write('<br />Engine: ' + statistic.engineName + ' ' + statistic.engineVersion);
			document.write('<br />Screen: ' + screenSize + ' ' + screenColorDepth);
			document.write('<br />Avail Screen: ' + contentSize);
			document.write('<br />Language: ' + browserLanguage);
			document.write('<br />SVG Support: ' + svgEnabled);
			document.write('<br />Canvas Support: ' + canvasEnabled);
			document.write('<br />Java Enabled: ' + javaEnabled);
			document.write('<br />Flash Version: ' + flashVersion);
			document.write('<br />Sliverlight Version: ' + silverlightVersion);
			
	
			document.write('<br /><br /><b>DOM Output:</b>');
			document.write('<br />navigator.userAgent :' + navigator.userAgent);
			document.write('<br />navigator.platform :' + navigator.platform);
			document.write('<br />navigator.vendor :' + ((navigator.vendor) ? navigator.vendor : ''));
			document.write('<br />navigator.oscpu :' + ((navigator.oscpu) ? navigator.oscpu : ''));
			document.write('<br />navigator.vendorSub :' + ((navigator.vendorSub) ? navigator.vendorSub : ''));
			document.write('<br />navigator.product :' + ((navigator.product) ? navigator.product : ''));
			document.write('<br />navigator.productSub :' + ((navigator.productSub) ? navigator.productSub : ''));
			document.write('<br />navigator.cpuClass :' + ((navigator.cpuClass) ? navigator.cpuClass : ''));
			document.write('<br />screen.width :' + ((screen.width) ? screen.width : ''));
			
			document.write('<br /><br /><b>Variablen:</b>');
			document.write('<br />STATISTIC_BASE_URL: ' + STATISTIC_BASE_URL);
			document.write('<br />STATISTIC_SERVER_ID: ' + STATISTIC_SERVER_ID);
			document.write('<br /><br /><div><b>Request Image URL:</b><br />' + (document.getElementById(NNS_REQIMG_ID).src.replace(/(&|\?)([a-z0-9]+)=/g, '<br /> &nbsp; $2 = ')) + '</div>');
			document.write('</div>');
			
			//Print Styleobject
//			window.onload = function() {
//			for (var e in document.body) {
//				
//				document.body.innerHTML += ('<br /><span style="display: inline-block; width: 100px;">' + e + '</span>' + typeof document.getElementsByTagName('div')[0].style[e] + ' ' + document.getElementsByTagName('div')[0].style[e]);
//			}
//			}
			
		}
	
	}
	catch(e) {
		
		document.write('<img src="' + STATISTIC_BASE_URL + '/jserror.php?e=' + e + '" />');
	}
	

