/*************************************************************************** 
File: modified by Nathan Richards to bring it into line with XHTML standards
****************************************************************************/  

if(!window.JSFX)
	JSFX=new Object();

if(!JSFX.Browser)
	JSFX.Browser = new Object();

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,thestring;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function netscapeParameters(horizontalOffSet)
{
	JSFX.Browser.getCanvasWidth	= function() {return (innerWidth - horizontalOffSet);}
	JSFX.Browser.getCanvasHeight	= function() {return innerHeight;}
	JSFX.Browser.getWindowWidth 	= function() {return outerWidth;}
	JSFX.Browser.getWindowHeight	= function() {return outerHeight;}
	JSFX.Browser.getScreenWidth 	= function() {return screen.width;}
	JSFX.Browser.getScreenHeight	= function() {return screen.height;}
	JSFX.Browser.getMinX		= function() {return(pageXOffset);}
	JSFX.Browser.getMinY		= function() {return(pageYOffset);}
	JSFX.Browser.getMaxX		= function() {return(pageXOffset+innerWidth);}
	JSFX.Browser.getMaxY		= function() {return(pageYOffset+innerHeight);}
}
function iexplorerParameters()
{
	JSFX.Browser.getCanvasWidth	= function() {return document.body.clientWidth;}
	JSFX.Browser.getCanvasHeight	= function() {return document.body.clientHeight;}
	JSFX.Browser.getWindowWidth 	= function() {return document.body.clientWidth;}
	JSFX.Browser.getWindowHeight	= function() {return document.body.clientHeight;}
	JSFX.Browser.getScreenWidth	= function() {return screen.width;}
	JSFX.Browser.getScreenHeight	= function() {return screen.height;}
	JSFX.Browser.getMinX		= function() {return(document.body.scrollLeft);}
	JSFX.Browser.getMinY		= function() {return(document.body.scrollTop);}
	JSFX.Browser.getMaxX		= function() {
		return(document.body.scrollLeft
			+document.body.clientWidth);
	}
	JSFX.Browser.getMaxY		= function() {
			return(document.body.scrollTop
				+document.body.clientHeight);
	}
}
function iexplorerNewParameters()
{
	JSFX.Browser.getCanvasWidth	= function() {return document.documentElement.clientWidth;}
	JSFX.Browser.getCanvasHeight	= function() {return document.documentElement.clientHeight;}
	JSFX.Browser.getWindowWidth 	= function() {return document.documentElement.clientWidth;}
	JSFX.Browser.getWindowHeight	= function() {return document.documentElement.clientHeight;}
	JSFX.Browser.getScreenWidth	= function() {return screen.width;}
	JSFX.Browser.getScreenHeight	= function() {return screen.height;}
	JSFX.Browser.getMinX		= function() {return(document.documentElement.scrollLeft);}
	JSFX.Browser.getMinY		= function() {return(document.documentElement.scrollTop);}
	JSFX.Browser.getMaxX		= function() {
		return(document.documentElement.scrollLeft
			+document.documentElement.clientWidth);
	}
	JSFX.Browser.getMaxY		= function() {
			return(document.documentElement.scrollTop
				+document.documentElement.clientHeight);
	}
}


if (checkIt('konqueror'))
{
	JSFX.Browser.brand = "Konqueror";
	JSFX.Browser.OS = "Linux";
}
else if (checkIt('safari')) JSFX.Browser.brand = "Safari"
else if (checkIt('omniweb')) JSFX.Browser.brand = "OmniWeb"
else if (checkIt('opera')) JSFX.Browser.brand = "Opera"
else if (checkIt('webtv')) JSFX.Browser.brand = "WebTV";
else if (checkIt('icab')) JSFX.Browser.brand = "iCab"
else if (checkIt('msie')) JSFX.Browser.brand = "Internet Explorer"
else if (checkIt('firefox')) JSFX.Browser.brand = "Firefox"
else if (checkIt('camino')) JSFX.Browser.brand = "Camino"
else if (checkIt('netscape')) JSFX.Browser.brand = "Netscape"
else if (!checkIt('compatible'))
{
	JSFX.Browser.brand = "Netscape Navigator"
	JSFX.Browser.version = detect.charAt(8);
}
else JSFX.Browser.brand = "An unknown browser";

if (!JSFX.Browser.version) JSFX.Browser.version = detect.charAt(place + thestring.length);

if (!JSFX.Browser.OS)
{
	if (checkIt('linux')) JSFX.Browser.OS = "Linux";
	else if (checkIt('x11')) JSFX.Browser.OS = "Unix";
	else if (checkIt('mac')) JSFX.Browser.OS = "Mac"
	else if (checkIt('win')) JSFX.Browser.OS = "Windows"
	else JSFX.Browser.OS = "an unknown operating system";
}
if (JSFX.Browser.brand == "Safari"){
	netscapeParameters(0)
}
else if(JSFX.Browser.brand == "Firefox" && JSFX.Browser.OS == "Mac")
{
	netscapeParameters(16)
}
else if(JSFX.Browser.brand == "Camino" && JSFX.Browser.OS == "Mac")
{
	netscapeParameters(16)
}
else if(navigator.appName.indexOf("Netscape") != -1)
{
	netscapeParameters(20)
}
else if(JSFX.Browser.brand == "Internet Explorer" && JSFX.Browser.version >= 6) 	{
	iexplorerNewParameters()
} 
else if(document.all) 	{
	iexplorerParameters()
} 

function getOS() {
	return JSFX.Browser.OS;
}

/*** End  ***/ 