/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.0 (051123)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .sidelinksSel class to the <a> and its     *
 *   <td> that is contained in the element with id="nav" and points       *
 *   parent to the sidelinksSel URL                                       *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
function extractPageName(hrefString)
{
	var arr = hrefString.split('.');
	arr = arr[arr.length-2].split('/');
	return arr[arr.length-1].toLowerCase();		
}

function setActiveMenu(arr, crtPage, img_name)
{
	//var img_src="navBulletSelected.gif"
	//alert("img:" + img_name);
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			arr[i].className = "sidelinksSel";
			arr[i].parentNode.className = "sidelinksSel";
			//document[img_name].src = img_src;

		}
}

function setActiveMenu2(arr, crtPage, img_name)//for lower level navlinks
{
	//var img_src="navBulletSelected.gif"
	//alert("img:" + img_name);
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{
			arr[i].className = "sidelinks2Sel";
			arr[i].parentNode.className = "sidelinks2Sel";
			//document[img_name].src = img_src;

		}
}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("nav")!=null) 
		setActiveMenu(document.getElementById("nav").getElementsByTagName("a"), extractPageName(hrefString));
}

function setPage2()//for lower level navlinks
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("nav")!=null) 
		setActiveMenu2(document.getElementById("nav").getElementsByTagName("a"), extractPageName(hrefString));
}

//function for Disclaimer Message
function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}

//not being used:
// Function that is called by the onclick command within the anchor tag for links leaving the site
function linkConfirm(url)
{
//The confirm window and the text that will appear is quoted \n makes a new line
	if(confirm ("You are about to leave the Flood Control District Web site.\nClick OK to continue or Cancel to stay."))
		window.open(url);//if they click OK, a new window opens with the URL that is passed from the link
	else
		return;//if they click Cancel, nothing happens
}
