
// (c) Agents.se - Revision v1.7

var detect = navigator.userAgent.toLowerCase();
var place,total,thestring;
var style = "";

function client_check() {
	// Browser/Version/OS check
	if (checkIt('konqueror')) {
		this.b = "dom";
		this.app = "konqueror";
	} else if (checkIt('safari')) {
		this.b = "dom";
		this.app = "safari";
	} else if (checkIt('opera')) {
		this.b = "dom";	// Support for opera<7 scrapped
		this.app = "opera";
	} else if (checkIt('msie')) {
		this.b = "ie"
		this.app = "ie"
	} else if (!checkIt('compatible')) { // All mozilla derivatives = moz
		this.b = "dom"	// Support for ns<=4 scrapped
		this.app = "moz"
	} else {
		this.b = "dom";
		this.app = "?"
	}	
	if (checkIt('linux')) this.os = "linux";
	else if (checkIt('x11')) this.os = "unix";
	else if (checkIt('mac')) this.os = "mac"
	else if (checkIt('win')) this.os = "win"
	else this.os = "other";

	// Set stylesheet, opera and safari gets own style
	if (this.app == "opera") {
		style = "css/opera.css";
//	} else if (this.app == "safari") {
//		style = "css/safari.css";
	} else {
		style = "css/"+this.b+".css";
	}

	// Check for flash
	this.flash = 0;
	var fx = getCookie("flash_exist"); // Bypass corrupt flash installs with cookie
	if (fx) {
		this.flash = 9;
	} else {
		if (this.b == "ie" && this.os == "win") {
			document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
			document.write('on error resume next \n');
			document.write('flash6 = false \n');
			document.write('flash7 = false \n');
			document.write('flash8 = false \n');
			document.write('flash9 = false \n');
			document.write('flash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
			document.write('flash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
			document.write('flash8 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
			document.write('flash9 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
			document.write('</SCR' + 'IPT\> \n');
			if (flash6) this.flash = 6;
			if (flash7) this.flash = 7;
			if (flash8) this.flash = 8;
			if (flash9) this.flash = 9;
		}
		else {
			if (navigator.plugins["Shockwave Flash"]) {
				var flashDescription = navigator.plugins["Shockwave Flash"].description;
				var flashver = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
				this.flash = flashver;
			}
		}
	}
}
function checkIt(string) {
	place = detect.indexOf(string) + 1;
	return place;
}

// Get Cookie
function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) 
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

// Run
check = new client_check();
print_css();


