function RestoreMenuState ()
{
	var id = readCookie("menuState");
	
	if (id != "")
	{
		Show (id);
		if (id == "pm_open")
		{
			Show ('sb_open');
		}
	}
}

function ShowHide (id)
{
	elem = document.getElementById(id);
	
	if ( ! elem) return;
	
	if (elem.style.display == "none")
	{
		elem.style.display = "";
		if (id != "sb_open")
		{
			writeCookie ("menuState", id, 24);
		}
		return true;
	}
	else
	{
		elem.style.display = "none";
		if (id != "sb_open")
		{
			writeCookie ("menuState", "", 24);
		}
		return false;
	}
}

function Hide (id)
{
	elem = document.getElementById(id);
	
	if ( ! elem) return;
	
	if (elem.style.display == "")
	{
		elem.style.display = "none";
	}
}

function Show (id)
{
	elem = document.getElementById(id);
	
	if ( ! elem) return;
	
	if (elem.style.display == "none")
	{
		elem.style.display = "";
	}
}

function writeCookie(name, value, hours)
{
	var expire = "";
	
	if (hours != null)
	{
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire + "; path=/";
}

function readCookie(name)
{
	var cookieValue = "";
	var search = name + "=";
	
	if (document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = document.cookie.indexOf(";", offset);

			if (end == -1)
				end = document.cookie.length;
				
			cookieValue = unescape(document.cookie.substring(offset, end));
		}
	}
	return cookieValue;
}

function switchClass(item,c)
{
	item.className = c;
}

function email(address)
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var domain = '&#101;&#108;&#116;&#111;&#110;&#104;&#97;&#109;&#112;&#116;&#111;&#110;&#97;&#114;&#99;&#104;&#105;&#116;&#101;&#99;&#116;&#115;&#46;&#99;&#111;&#109;';
	document.write('<a class="smalllink" href="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('" title="');
	document.write(address);
	document.write(' (at) ');
	document.write(domain);
	document.write('">');
	document.write(address);
	document.write(' (at) ');
	document.write(domain);
	document.write('<\/a>');
}

function email_icon(address, name, x)
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var domain = '&#101;&#108;&#116;&#111;&#110;&#104;&#97;&#109;&#112;&#116;&#111;&#110;&#97;&#114;&#99;&#104;&#105;&#116;&#101;&#99;&#116;&#115;&#46;&#99;&#111;&#109;';
	document.write('<A ONMOUSEOVER="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Over.gif\');return true" ONMOUSEOUT="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Base.gif\');return true" HREF="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('" title="Send E-mail to ');
	document.write(name);
	document.write('"><IMG ID="Mail_Base');
	document.write(x);
	document.write('" SRC="images\/Mail2_Base.gif" ALT="Send E-mail" NAME="Mail_Base');
	document.write(x);
	document.write('" WIDTH="32" HEIGHT="32" ALIGN="absbottom" BORDER="0">');
	document.write('<\/a>');
}

function email_icon_and_string(address, name, x)
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var domain = '&#101;&#108;&#116;&#111;&#110;&#104;&#97;&#109;&#112;&#116;&#111;&#110;&#97;&#114;&#99;&#104;&#105;&#116;&#101;&#99;&#116;&#115;&#46;&#99;&#111;&#109;';
	document.write('<A ONMOUSEOVER="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Over.gif\');return true" ONMOUSEOUT="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Base.gif\');return true" HREF="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('" title="Send E-mail to ');
	document.write(name);
	document.write('"><IMG ID="Mail_Base');
	document.write(x);
	document.write('" SRC="images\/Mail2_Base.gif" ALT="Send E-mail" NAME="Mail_Base');
	document.write(x);
	document.write('" WIDTH="32" HEIGHT="32" ALIGN="absbottom" BORDER="0">');
	document.write('<\/a>&nbsp;');
	
	document.write('<A class="smalllink" ONMOUSEOVER="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Over.gif\');return true" ONMOUSEOUT="changeImages(\'Mail_Base');
	document.write(x);
	document.write('\',\'images\/Mail2_Base.gif\');return true" HREF="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('" title="');
	document.write(address);
	document.write(' (at) ');
	document.write(domain);
	document.write('">');
	document.write(address);
	document.write(' (at) ');
	document.write(domain);
	document.write('<\/a>');
}

function author_email()
{
	var first = 'ma';
	var second = 'il';
	var third = 'to:';
	var address = '&#109;&#97;&#116;&#116;&#46;&#98;&#111;&#119;&#101;&#110;';
	var domain = '&#109;&#97;&#99;&#46;&#99;&#111;&#109';
	var tag = 'Matt Bowen';
	document.write('<a CLASS="minilink" href="');
	document.write(first+second+third);
	document.write(address);
	document.write('&#64;');
	document.write(domain);
	document.write('" title="');
	document.write(tag);
	document.write('">');
	document.write(tag);
	document.write('<\/a>');
}

