// Bjorn Sortland 080323 - http://www.kaofisis.com/
// Unobtrusive JavaScript based on the Core library; Kevin Yank and Cameron Adams, "Simply JavaScript", SitePoint (2007)
// Original 'toggleOnOff' function is copyright 2005-2007 Stu Nicholls - http://www.stunicholls.com/various/more.html

// Important: 'core.js' must load prior to this script

// Observation: Opera quits if real link is missing in toggled link content

toggleOnOff = function(reveal,element,cname)
{
	var getEls = document.getElementById(reveal).getElementsByTagName(element);
	for (var i=0; i<getEls.length; i++)
	{
		getEls[i].onclick=function()
		{
			if ((this.className.indexOf(cname))!=-1)
			{
				if ((this.className.indexOf('click'))!=-1)
				{
					this.className=this.className.replace("click", "");
					}
					else 
					{
					this.className+=" click";
				}
			}
		}
	}
}

var Toggle =
{
	init: function()
	{
		toggleOnOff('wrapper','div','envelope');
	}
}

Core.start(Toggle);