
	attachHover = function ()
	{
		// List of tags to add hover and focus to
		var elmnts = new Array ('li', 'tr');

		// Do it up!
		for (var i = 0; i < elmnts.length; i++)
		{
			var elmPntrs = document.getElementsByTagName (elmnts[i]);
			for (var j = 0; j < elmPntrs.length; j++)
			{
				// Hover
				elmPntrs[j].onmouseover = function () { this.className += ' hover'; }
				elmPntrs[j].onmouseout = function () { this.className = this.className.replace (' hover', ''); }
			}
		}
	}
	if (window.attachEvent)
		window.attachEvent('onload', attachHover);

	alphaBackgrounds = function ()
	{
		var rslt = navigator.appVersion.match (/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number (rslt[1]) >= 5.5);
		for (i = 0; i < document.all.length; i++)
		{
			var bg = document.all[i].currentStyle.backgroundImage;
			if (itsAllGood && bg)
			{
				if (bg.match (/\.png/i) != null)
				{
					var mypng = bg.substring (5,bg.length-2);
					document.all[i].style.zoom = '1.0';
					document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='crop')";
					document.all[i].style.backgroundImage = "url('/images/spacer.gif')";
				}
			}
		}
	}
	if (navigator.platform == 'Win32' && navigator.appName == 'Microsoft Internet Explorer' && window.attachEvent)
		window.attachEvent('onload', alphaBackgrounds);

	widest = 0;
	function shade (obj)
	{
		for (i = 0; i < obj.childNodes.length; i++)
				if (obj.childNodes[i].className == 'content')
					target = i;

		obj.style.height = obj.offsetHeight + 'px';
		if (obj.className.match (/ focused/))
		{
			obj.className = obj.className.replace (' focused', '');
			obj.childNodes[target].style.marginLeft = '0px';
			obj.childNodes[target].style.width = 'auto';
		}
		else
		{
			obj.className += ' focused';

			widest = 0;
			objWidth = getWidestChild (obj.childNodes[target]);
			obj.childNodes[target].style.width = objWidth + 'px';
			obj.childNodes[target].style.marginLeft = (objWidth / -2) + 'px';
		}
	}

	function getWidestChild (obj)
	{
		for (var i = 0; i < obj.childNodes.length; i++)
		{
			if (obj.childNodes[i].offsetWidth > widest)
			{
				widest = obj.childNodes[i].offsetWidth;
			}

			if (obj.childNodes[i].childNodes.length > 0)
			{
				getWidestChild (obj.childNodes[i]);
			}
		}

		return widest;
	}

	// Get the selected item, or make it false
	itm = false;
	getSelectedMenuItem = function ()
	{
		menuItems = document.getElementById ('menu').childNodes;
		for (i = 0; i < menuItems.length; i++)
		{
			if (menuItems[i].className.indexOf ('selected') != -1)
			{
				itm = menuItems[i];
			}
		}
	}

	function toggleMenu (obj)
	{
		obj = obj.parentNode;

		// Collapse the last-clicked item
		if (itm)
		{
			itm.className = itm.className.replace ('selected', '');
		}

		// Collapse if this obj IS the last-clicked item, otherwise, open it.
		if (itm == obj)
		{
			itm.className = itm.className.replace ('selected', '');
			itm = false;
		}
		else
		{
			itm = obj;
			itm.className = 'selected';
		}

		return false;
	}

	function doOnload ()
	{
		getSelectedMenuItem ();
	}
	window.onload = doOnload;


	/* Gallery
	--------------------------------------------------------*/
	zoomer = false;
	stepVal = 75;
	tickVal = 10;
	curObj = false;

	function enlarge (imgObj, w, h)
	{
		w = w + 10;
		h = h + 10;

		if (curObj)
		{
			document.body.removeChild (curObj);
			curObj = false;
		}

		contnr = document.createElement ('div');
		contnr.id = 'bigImage';

		clonedObj = imgObj.cloneNode (true);
		clonedObj.id = 'bigImageImg';
		clonedObj.style.width = '0px';
		clonedObj.style.height = '0px';

		clonedObj.src = clonedObj.src.replace ('-t.jpg', '.jpg');
		clonedObj.onclick = function ()
		{
			document.body.removeChild (this.parentNode);
			curObj = false;
		}

		contnr.appendChild (clonedObj);

		contnr.style.marginLeft = (w / 2 * -1) + 'px';
		if (navigator.appVersion.indexOf ('MSIE') != -1)
			contnr.style.top = (document.body.parentNode.clientHeight / 2 + document.body.parentNode.scrollTop - h / 2) + 'px';
		else
			contnr.style.marginTop = (h / 2 * -1) + 'px';

		document.body.appendChild (contnr);

		zoomer = setInterval ('imgZoom ('+w+', '+h+');', tickVal);

		curObj = contnr;
	}

	function imgZoom (w, h)
	{
		obj = document.getElementById ('bigImageImg');
		if (obj)
		{
			curH = parseInt (obj.style.height);
			curW = parseInt (obj.style.width);

			if (curH < h)
			{
				nextH = curH + stepVal;
				if (nextH > h)
				{
					nextH = h;
				}

				obj.style.height = nextH + 'px';
			}

			if (curW < w)
			{
				nextW = curW + stepVal;
				if (nextW > w)
				{
					nextW = w;
				}

				obj.style.width = nextW + 'px';
			}

			if (nextW == w && nextH == h)
			{
				zoomer = clearInterval (zoomer);
			}
		}
	}


	function fixMaxWidth ()
	{
		selects = document.getElementsByTagName ('select');
		for (i = 0; i < selects.length; i++)
		{
			if (selects[i].className == 'maxWidth')
			{
				selects[i].onfocus = detachSelect;
				selects[i].onblur = attachSelect;
			}
		}
	}

	if (window.attachEvent)
		window.attachEvent('onload', fixMaxWidth);

	function detachSelect ()
	{
		this.parentNode.style.height = (this.parentNode.clientHeight - 6) + 'px';
		this.style.position = 'absolute';
		this.style.left = this.offsetLeft + 'px';
		this.style.top = (this.offsetTop - 12) + 'px';
		this.style.width = 'auto';
	}

	function attachSelect ()
	{
		this.parentNode.style.height = '';
		this.style.position = '';
		this.style.left = '';
		this.style.top = '';
		this.style.width = '';
	}