function isOpera(version)
	{
	var opera_v = 0;
	if ([document.frames].toString() != '[object WindowCollection]') { return false; }
	if (!version) { return true; }
	if (document.all.toString() == '[object HTMLCollection]') { opera_v = 7.1; }
	if (this.XMLHttpRequest) { opera_v = 8; }
	if (document.designMode) { opera_v = 9; }

	if (typeof version == 'number') { return (version == opera_v); }
	
	return eval (opera_v + version + ';');
	}

function isIEMac()
	{
	if ([document.frames].toString() != '[object Frames]') { return false; }
	return true;
	}
function isIEWin(version)
	{
	var ie_v = 0;
	if (![document.frames].toString().match(/\[(object|object Window)\]/)) { return false; }
	if (!version) { return true; }
	if (document.body.contentEditable) { ie_v = 5.5; }
	if (document.documentElement.clientHeight) { ie_v = 6; }
	// NB. the next line will fail in quirks mode
	// possibly better to check for standards mode and if not parse agent string
	if (this.XMLHttpRequest) { ie_v = 7; }
	if (ie_v == 7)
		{
		try
			{
			if (this.XMLHttpRequest.toString())
				{
				ie_v = 8;
				}
			}
		catch(e) {}
		}
	if (typeof version == 'number') { return (version == ie_v); }
	return eval (ie_v + version + ';');
	}

function isIE(args)
	{
	if (isIEWin(args)) { return true; }
	return isIEMac(args);
	}

function isGecko(version)
	{
	try
		{
		if (document.all.toString()) { return false; }
		}
	catch(e) {};
	if ([document.body].toString() != '[object HTMLBodyElement]') { return false; }
	if (!version) { return true; }
	// Array.forEach separates 1.5x from 1.0x
	var gecko_v = navigator.productSub;
	if (typeof version == 'number') { return (version == gecko_v); }
	return eval (gecko_v + version + ';');
	}

function isSafari(version)
	{
	if ([document.frames].toString()) { return false; }
	var safari_3 = '';
	try { safari_3 = [document.all].toString(); }
	catch(e) {}
	var safari_v = 1;
	if ((document.body && [document.body].toString() == '[object BODY]') || (safari_3 == '[object Collection]') || (safari_3 == '[object HTMLCollection]'))
		{
		// it's safari
		}
	else { return false; }
	if (!version) { return true; }
	if (this.XMLHttpRequest) { safari_v = 2; }
	if (safari_3) { safari_v = 3; }
	if (typeof version == 'number') { return (version == safari_v); }
	return eval (safari_v + version + ';');
	}
