var detect = navigator.userAgent.toLowerCase();
var browser, browserName, version, OS, place;
browserName = getBrowser();
version = getVersion();
OS = getOS();

function calcHeight()
{
	if (browserName == 'msie' || browserName == 'opera')
	{
		var the_height=document.htmlframe.document.body.scrollHeight;
	}
	else
	{
		var the_height=document.getElementById('htmlframe').contentWindow.document.body.scrollHeight;
	}
	document.getElementById('htmlframe').style.height=the_height;
}

function getBrowser()
{
	if (checkIt('opera'))		return 'opera';
	if (checkIt('msie'))		return 'msie';
	if (!checkIt('compatible'))	return 'ns';
	if (checkIt('konqueror'))	return 'konqueror';
	if (checkIt('safari'))		return 'safari';
	if (checkIt('omniweb'))		return 'omniweb';
	if (checkIt('webtv'))		return 'webtv';
	if (checkIt('icab'))		return 'icab';
	return 'unknown';
}

function getVersion()
{
	if (browser == 'ns')
		return detect.charAt(8);
	return detect.charAt(place + browser.length);
}

function getOS()
{
	if (checkIt('konqueror'))	return 'Linux';

	if (checkIt('linux'))		return "Linux";
	else if (checkIt('x11')) 	return "Unix";
	else if (checkIt('mac')) 	return "Mac"
	else if (checkIt('win')) 	return "Windows"
	return "unknown OS";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	browser = string;
	return place;
}
