			<!-- Original:  Gregor (legreg@legreg.de) -->

			<!-- This script and many more are available free online at -->
			<!-- The JavaScript Source!! http://javascript.internet.com -->

// Includes
var browser_js = 1;

var bUserAgentActual = navigator.userAgent;
var bUserAgent = bUserAgentActual.toLowerCase();
var bName = navigator.appName;
var bVer = 0.0;
var bVerText = "";
var bOS = "";

bMatch_AOL = "AOL";							// always match against bUserAgentActual
bMatch_IE = "msie";							// always match against bUserAgent
bMatch_Netscape = "Netscape";		// always match against navigator.appName
bMatch_Safari = "safari";				// always match against bUserAgent
bMatch_Firefox = "firefox";			// always match against bUserAgent

var bIE = (bUserAgent.indexOf(bMatch_IE) != -1);
var bMSN = (bUserAgent.search(/msn\s(\d+(\.?\d)*)/) != -1);
var bNetscape = (navigator.appName == bMatch_Netscape);
var bSafari = (bUserAgent.indexOf(bMatch_Safari) != -1);
var bAOL = (bUserAgentActual.indexOf(bMatch_AOL) != -1);
var bFirefox = (bUserAgent.indexOf(bMatch_Firefox) != -1);

var bOSWindows = ((bUserAgent.indexOf("win") != -1) || (bUserAgent.indexOf("32bit") != -1));
var bOSMacintosh = (bUserAgent.indexOf("mac") != -1);
var bOSMacintoshX = (bUserAgent.indexOf("mac os x") != -1);
if (bOSWindows)
{
	bOS = "Windows";
}
else if (bOSMacintoshX)
{
	bOS = "Mac OS X";
}
else if (bOSMacintosh)
{
	bOS = "Mac OS 9";
}
else
{
	bOS = "Other";
}

var bIsW3C = (document.getElementById) ? true : false;
var bIsAll = (document.all) ? true : false;

if (true)
{
	var pos;
	if ((bIE) || (bMSN))
	{
		pos = bUserAgent.indexOf(bMatch_IE);
		bVerText = bUserAgent.substring(pos + bMatch_IE.length + 1);
		pos = bVerText.indexOf(';');
		bVerText = bVerText.substring(0,pos);
		bVer = parseFloat(bVerText);
		bOSMacintoshX = ((bOSMacintosh) && (bVer >= 5.2));
	}
	if (bAOL)
	{
		bName = 'AOL';
		pos = bUserAgentActual.indexOf(bMatch_AOL);
		bVerText = bUserAgent.substring(pos + kAOL.length);
		pos = bVerText.indexOf(';');
		bVerText = bVerText.substring(0,pos);
		bVer = parseFloat(bVerText);
	}
	if (bNetscape)
	{
		bVerText = bUserAgent.substring(8);
		pos = bVerText.indexOf(' ');
		bVerText = bVerText.substring(0, pos);
		bVer = parseFloat(bVerText);
		if (parseInt(navigator.appVersion) >= 5)
		{
			pos = bUserAgent.lastIndexOf('/');
			bVerText = bUserAgent.substring(pos + 1);
			bVer = parseFloat(bVerText);
		}
	}
	if (bFirefox)
	{
		bName = "Firefox";
		pos = bUserAgent.indexOf(bMatch_Firefox+"/");
		if (pos != -1)
		{
			bVerText = bUserAgent.substring(pos + bMatch_Firefox.length + 1);
			bVer = parseFloat(bVerText);
		}
	}
	if (bSafari)
	{
		bName = "Safari";
		pos = bUserAgent.indexOf(bMatch_Safari+"/");
		if (pos != -1)
		{
			bVerText = bUserAgent.substring(pos + bMatch_Safari.length + 1);
			bVer = parseFloat(bVerText);
		}
	}
}

var bMenuBarHeight = ((bOSMacintosh) ? 20 : 30)

var bScreenWidth = 640;
try { bScreenWidth = ((bIE) ? screen.width : screen.width); } catch(ignore) {}
bScreenWidth -= 10;

var bScreenHeight = 480;
try { bScreenHeight = ((bIE) ? screen.height : screen.height); } catch(ignore) {}
bScreenHeight -= (40 + bMenuBarHeight);

var bBorderOffset = ((bIE) ? 0 : -1);
				

/**
 * Return the specified tag by id.
 *
 * @param id = id of tag to get.
 * @return - tag represented by the specified id
 */
function idToTag(id)
{
	return (bIsAll ? eval("document.all." + id) : document.getElementById(id));
}

/**
 * Return the specified tag by id (in specified frame).
 *
 * @param id = id of tag to get.
 * @param frame = frame tag is in.
 * @return - tag represented by the specified id
 */
function idToTagInFrame(id,frame)
{
	if ((typeof frame == 'undefined')
			|| (frame == null))
	{
		return (bIsAll ? eval("document.all." + id) : document.getElementById(id));
	}
	else
	{
		return (bIsAll ? eval(frame.name+".document.all." + id) : frame.document.getElementById(id));
	}
}


/**
 * Open the window, forcing it to live in the available space
 *
 * @param url - URL to apply (undefined = none)
 * @param windowname - name of window (undefined = "#window#")
 * @param width - width of window (undefined = screen.width)
 * @param height - height of window (undefined = screen.height)
 * @param options - options for window (undefined = none)
 * @return - window object
 */
function browser_windowOpen(url, windowname, width, height, options)
{
	url = ((typeof url == 'undefined') ? '' : url);
	windowname = ((typeof windowname == 'undefined') ? '#window#' : windowname);
	width = ((typeof width == 'undefined') ? bScreenWidth : Math.min(bScreenWidth,width));
	height = ((typeof height == 'undefined') ? bScreenHeight : Math.min(bScreenHeight,height));

	var openOptions;
	if ((typeof options == 'undefined')
			|| (options == null)
			|| (options == ''))
	{
		openOptions = "";
	}
	else
	{
		openOptions = "," + options;
	}

	newWindow = window.open(url,windowname,'width='+width+',height='+height+openOptions);
	newWindow.focus();

	if (!bIE) // ie does not allow
	{
		newWindow.resizeTo(width, height);
	}
	return newWindow;
}


/**
 * Dump brower info.
 *
 * @return - browser info.
 */
function dumpBrowserInfo()
{
	var info = "" +
			"bUserAgentActual=" + bUserAgentActual + "\n" +
			"bUserAgent=" + bUserAgent + "\n" +
			"bName=" + bName + "\n" +
			"bVer=" + bVer + "\n" +
			"bVerText=" + bVerText + "\n" +
			"bIE=" + bIE + "\n" +
			"bMSN=" + bMSN + "\n" +
			"bNetscape=" + bNetscape + "\n" +
			"bFirefox=" + bFirefox + "\n" +
			"bSafari=" + bSafari + "\n" +
			"bOSWindows=" + bOSWindows + "\n" +
			"bOSMacintosh=" + bOSMacintosh + "\n" +
			"bOSMacintoshX=" + bOSMacintoshX + "\n";
	return info;
}
