
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);
	
	function element(id)
	{
		if(ie4)	// Explorer 4
			return document.all[id];
		else	// Explorer 5+ Netscape 6+ and Mozilla and Firefox
			return document.getElementById(id);
	}
	
	function doDetect() {
		// Browser detect script from www.quirksmode.org
		var detect = navigator.userAgent.toLowerCase();
		var OS,browser,version,total,thestring;
		
		if (checkIt('konqueror'))
		{
			browser = "Konqueror";
			OS = "Linux";
		}
		else if (checkIt('safari')) browser = "Safari"
		else if (checkIt('omniweb')) browser = "OmniWeb"
		else if (checkIt('opera')) browser = "Opera"
		else if (checkIt('webtv')) browser = "WebTV";
		else if (checkIt('icab')) browser = "iCab";
		else if (checkIt('netscape')) browser = "netscape";
		else if (checkIt('firefox')) browser = "firefox";			
		else if (checkIt('msie')) browser = "Internet Explorer";
		else if (!checkIt('compatible'))
		{
			browser = "Netscape Navigator"
			version = detect.charAt(8);
		}
		else browser = "An unknown browser";
		
		if (!version) version = detect.charAt(place + thestring.length);
		
		if (!OS)
		{
			if (checkIt('linux')) OS = "Linux";
			else if (checkIt('x11')) OS = "Unix";
			else if (checkIt('mac')) OS = "Mac"
			else if (checkIt('win')) OS = "Windows"
			else OS = "an unknown operating system";
		}
		
		function checkIt(string)
		{
			place = detect.indexOf(string) + 1;
			thestring = string;
			return place;
		}

		// check for windows and internet explorer 6
		if (OS == "Windows" && (browser == "Internet Explorer" && version >= 5) || (browser == "netscape") || (browser == "firefox"))
		{	if( isTurnToolInstalled() )
			{	document.location.href = 'animation.htm';
			}
			else
			{
				element('browserInfo').innerHTML = "<p>Your operating system and Internet Browser are correct, please follow the instructions below to install the plugin.</p>";
			}
		}
		else {
			document.location.href = 'unsupported.htm';
		}
	
	}
	function isTurnToolInstalled()
	{
		var tntInstalled = false;
		if (ie4||ie5)
		{
			try
			{
				var xObj = new ActiveXObject("TNT.TNTCtrl");
				if (xObj)
				{
					tntInstalled = true;
				}
			}
			catch (e)
			{
			}
		}
		else
		{
			if(navigator.plugins.namedItem("TurnTool XPCOM Plugin"))
			{
				tntInstalled = true;
			}
		}
		return tntInstalled;
	}
