/*
give the popup links classes
use the classes to set the onclick events of the popups

var winNew;
winNew=window.open('route.htm','newWinRoute','width=620, height=472');
winNew.focus()
*/
function ShowLayer(numLayer)
{
	/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
	   | Toggles the visibility of <li> elements in the "content." |
	   | [example: /parks/peoples/southeast.htm]                   |
	   +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ */

	if ( document.getElementById )
	{
		/* First, search through all the <li>s in the content 
		   until you find the one that was last visible...
		*/
		var listElements = document.getElementById("content").getElementsByTagName("li");

		for ( var i=0; i < listElements.length; i++ )
		{
			if ( listElements[i].style.visibility != "hidden" )
			{
				/* ...then turn it off. */
				listElements[i].style.visibility = "hidden";
				break;
			}
		}

		/* Finally, show the <li> element "layer" passed as an argument. */
		document.getElementById(numLayer).style.visibility = "visible";
	}
}

function CanCreateCookie()
{
	/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
	   | Tests whether the client's browser can handle cookies, |
	   |  returning true if it can.                             |
	   +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ */

	document.cookie = "testCookie=Yes;";

	if ( GetCookie("testCookie")==null )
		return false;
	else
		return true;	
}

function GetCookie(cookieName)
{
	/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
	   | Returns the value of the cookie         |
	   | whose name you pass as an argument,     |
	   | or returns null if it can't.            |
	   | [example: ...] |
	   +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ */

	var cookieValue = document.cookie;
	var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "=");	// semicolons and spaces separate cookies in the cookie string

	if (cookieStartsAt==-1)		// then maybe the cookie you want is first in the object, in which case there would be no space
		cookieStartsAt = cookieValue.indexOf(cookieName + "=");

	if (cookieStartsAt==-1)		// then your cookie doesn't exist and/or cookies have been disabled
		cookieValue = null;
	else				// otherwise...
	{				// ...capture the value
		cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1;	// the start will be the first equal sign after the beginning of our cookie
		var cookieEndsAt = cookieValue.indexOf(";",cookieStartsAt);	// the end will be the first semicolon

		if (cookieEndsAt==-1)	// unless there were no more semicolons...
			cookieEndsAt = cookieValue.length;	// ...meaning that the cookie is at the end of the string
								// (string's length = index of last string character)

		cookieValue = cookieValue.substring(cookieStartsAt, cookieEndsAt);
	}

	return cookieValue;
}