// variables
	// user-agent identity
	var version = parseInt(navigator.appVersion);
	var isNS  = (navigator.appName.indexOf("Netscape") >= 0);
	var isNS4 = (isNS && version == 4);
	var isNS5 = (isNS && version > 4);
	var isIE  = !(isNS);
	var isIE4 = (isIE && version == 4);
	var isIE5 = (isIE && version > 4);
	var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0);
	var isWin = !(isMac);
	var isAOL = (navigator.userAgent.indexOf("AOL") >= 0);

	// Flash detection; minimum: version 4.0
	var flashVersion = 0;
	for (var i = 4; i <= 7; i++)
	{
		if (isIE)
		{
			document.write('<script language="VBScript" type="text/vbscript">\n');
			document.write('On Error Resume Next\n');
			document.write('CreateObject("ShockwaveFlash.ShockwaveFlash." & i)\n');
			document.write('If Err = 0 Then\n');
			document.write('flashVersion = i\n');
			document.write('End If\n');
			document.write('</script>\n');
		}
		else
		{
			var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
			if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".") - 1)) >= i)
			{
				flashVersion = i;
			}
		}
	}

	// events
	var clickURL;
	var mouseX = 0;
	var mouseY = 0;
	var pageWidth = 0;
	var pageHeight = 0;
	var allowFrame = false;
	
	//utilities
	var windows = new Array();
	var pageURL = (window != top) ? document.referrer : location.href;
	
// event capturing
	if (isNS4)
	{
		window.captureEvents(Event.ONLOAD);
		window.onLoad = pageLoad;
		window.captureEvents(Event.ONUNLOAD);
		window.onUnload = pageUnload;
		document.captureEvents(Event.CLICK);
		document.onClick = mouseClick;
		document.captureEvents(Event.MOUSEMOVE);
		document.onMouseMove = mouseMove;
	}
	if (isNS5)
	{
		window.addEventListener("load", pageLoad, false);
		window.addEventListener("unload", pageUnload, false);
		document.addEventListener("click", mouseClick, false);
		document.addEventListener("mousemove", mouseMove, false);
	}
	if (isIE)
	{
		window.attachEvent("onload", pageLoad);
		window.attachEvent("onunload", pageUnload);
		document.attachEvent("onclick", mouseClick);
		document.attachEvent("onmousemove", mouseMove);
	}

// event handlers
	function pageLoad(evt)
	{
		// frame break
		if (window != top && allowFrame != true) top.location.replace(location.href);
	}

	function pageUnload(evt)
	{
		// close child windows
		for (var i = 0; i < windows.length; i++)
		{
			if (typeof windows[i] == "object" && !windows[i].closed) windows[i].close();
		}
	}

	function mouseClick(evt)
	{
		if (isNS4)
		{
			clickURL = evt.target.href;
		}
		else if (isNS5)
		{
			node = evt.target;
			while (node.tagName != "A" && node.tagName != "HTML")
			{
				node = node.parentNode;
			}
			clickURL = node.href;
		}
		else if (isIE)
		{
			element = evt.srcElement;
			while (element.tagName != "A" && element.tagName != "HTML")
			{
				element = element.parentElement;
			}
			clickURL = element.href;
		}

		if (clickURL == null) clickURL = "";
	}

	function mouseMove(evt)
	{
		if (isNS)
		{
			mouseX = evt.pageX;
			mouseY = evt.pageY;
			pageWidth = window.innerWidth;
			pageHeight = window.innerHeight;
		}
		else
		{
			mouseX = evt.offsetX;
			mouseY = evt.offsetY;
			if (document.compatMode && document.compatMode == "CSS1Compat")
			{
				pageWidth = document.body.parentNode.clientWidth;
				pageHeight = document.body.parentNode.clientHeight;
			}
			else
			{
				pageWidth = document.body.clientWidth;
				pageHeight = document.body.clientHeight;
			}
		}
	}

// mouseovers; incompatible with NS4
	//
	// Usage:
	// <a href="LINK"><img src="IMAGE.EXT" onload="mouseLoad(this);" width="WIDTH" height="HEIGHT" border="0" alt="ALT" /></a>
	// 
	// Note: Mouseover image must be named IMAGE_over.EXT
	//
	function mouseLoad(obj)
	{
		if (isNS4 || obj.out) return;
		
		obj.out = new Image();
		obj.out.src = obj.src;
		obj.over = new Image();
		obj.over.src = obj.src.replace(/.gif$/, "_over.gif").replace(/.jpg$/, "_over.jpg");
		if (isNS5)
		{
			obj.addEventListener("mouseover", mouseOver, false);
			obj.addEventListener("mouseout", mouseOut, false);
		}
		if (isIE)
		{
			obj.attachEvent("onmouseover", mouseOver);
			obj.attachEvent("onmouseout", mouseOut);
		}
	}
	function mouseOver(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		if (obj.over) obj.src = obj.over.src;
	}
	function mouseOut(evt)
	{
		obj = (evt.target) ? evt.target : evt.srcElement;
		if (obj.out) obj.src = obj.out.src;
	}

// page utilities
	//
	// Usage: <a href="javascript:emailPage();">LINK</a>
	//
	function emailPage()
	{
		// empty
	}

	//
	// Usage: <a href="javascript:printPage();">LINK</a>
	//
	function printPage()
	{
		// empty
	}
	
	//
	//Usage: <a href="javascript:bookmarkPage();">LINK</a>
	//
	function bookmarkPage()
	{
		if (isMac || isAOL)
		{
			alert("Sorry, this feature is not supported by your browser.");
			return;
		}

		if (!isNS)
		{
			window.external.AddFavorite(this.location.href, document.title);
		}
		else
		{
			alert("Click \"OK\", then type CTRL-D to add this page to your list of bookmarks.");
		}
	}
	
	//
	// Usage: <a href="javascript:homePage();">LINK</a>
	//
	function homePage()
	{
		if (!isIE || isAOL)
		{
			alert("Sorry, this feature is not supported by your browser.");
			return;
		}
	
		document.body.style.behavior = "url(#default#homePage)";
		document.body.setHomePage(pageURL);
	}

// help tips
	//
	// Mouseover-style:
	// <a href="javascript:void(0);" onmouseover="showTip('NAME');" onmouseout="hideTip('NAME');">LINK</a>
	// <div id="tip_NAME" class="tip">TIP</div>
	//
	// Click-style:
	// <a href="javascript:showTip('NAME');">LINK</a>
	// <div id="tip_NAME" class="tip">TIP<a href="javascript:hideTip('NAME');">CLOSELINK</a></div>
	//
	function showTip(id)
	{
		id = "tip_" + id;
		var prefix;
		var divWidth = 0;
		if (isIE)
		{
			divWidth = parseInt(document.getElementById(id).currentStyle.width);
		}
		if (isNS5)
		{
			divWidth = parseInt(getComputedStyle(document.getElementById(id), "").getPropertyValue("width"));
		}
		var tipX = ((mouseX + divWidth) > pageWidth) ? (pageWidth - divWidth) : mouseX;
		var tipY = mouseY + 25;
		var tipShow;
		if (isNS4)
		{
			var prefix = "document." + id + ".";
			tipShow = "show";
		}
		else
		{
			var prefix = "document.getElementById('" + id + "').style.";
			tipShow = "visible";
		}
		eval(prefix + "left = " + tipX);
		eval(prefix + "top = " + tipY);
		eval(prefix + "visibility = '" + tipShow + "'");
	}
	function hideTip(id)
	{
		id = "tip_" + id;
		if (isNS4)
		{
			eval("document." + id + ".visibility = 'hide'");
		}
		else
		{
			eval("document.getElementById('" + id + "').style.visibility = 'hidden'");
		}
	}
