
// (c) Agents.se - v2.0

var ua = navigator.userAgent.toLowerCase();
var place,total,thestring;

function client_check() {
	// Browser/Version/OS check
	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";

	// Check for flash
	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 = ua.indexOf(string) + 1;
	return place;
}

// CSS Browser Selector   v0.2.3
// Documentation:         http://rafael.adm.br/css_browser_selector
var css_browser_selector = function() {
	var 
		is = function(t){ return ua.indexOf(t) != -1; },
		h = document.getElementsByTagName('html')[0],
		b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1)
			: is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '',
		os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : '';
	var c = b+os+' js';
	h.className += h.className?' '+c:c;
}();

// Run
check = new client_check();


