function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}


// check if the current url matches a given string
function CurrentURL (theURL) {
        // store the current url (well, uri)
        currentURL = window.location;

        // check if the url matches the passed url
        if (currentURL == theURL) {
                // it matches, success
                return true;
        }
        else {
                // no match
                return false;
        }
}

// try and grab a given <a> tag's href
function TargetURL() {
        // grab all anchor tags in the page
        var anchorTags = document.getElementsByTagName("a");

        // loop through anchor tags and see if any match the current url
        for (var i = 0; i < anchorTags.length ; i++)
        {
                if (CurrentURL(anchorTags[i].href)) {
                        // create a new string with the html of this anchor tag
                        //oldHTML = new String(anchorTags[i].innerHTML);
						oldHTML = new String(anchorTags[i]);

						anchorTags[i].className += " on";

                        // replace _off with _on (clicked state of button)
                        //newHTML = oldHTML.replace("\">","\" class=\"on\">");
                        //newHTML = "<span style=\"font-weight: bold;text-decoration: none;\">" + oldHTML + "</span>";

                        // send the new html back to the browser
                        //anchorTags[i].innerHTML = newHTML;
                }
        }
}



var menu = new Array("employeeflyout", "clientflyout");
var HideDelay;
var ShowDelay;
var clickCheck = false;


/* changeColor - changes the color of the element with id "main" + idName to newColor
    parameters: 	string idName - HTML element ID;
			string newColor - new color to be set
    return: void

*/

function changeColor(idName, newColor) {
	var f = document.getElementById("main"+idName);
	if(f) {
		f.style.color = newColor;
	}
}


/* setVisibility - sets/resets visibility of the element with id idName
    parameters: 	string idName - HTML element ID;
			boolean isVisible - true if the element should be visible, false if the element should be hidden
    return: void
*/

function setVisibility(idName, isVis) {
	var e = document.getElementById(idName);
	var mainnav = idName.replace(/subnav/, "nav");
	var f = document.getElementById(mainnav);

	if(e) {
		if(isVis) {
			e.style.visibility = "visible";
			changeColor(idName, "#FFFFFF");

			// Check to see if this Menu has class="on" otherwise highlight it
			if(f.className == "on") {
				f.className = "on";
			} else {
				f.className = "mouseon";
			}
		} else {
			e.style.visibility = "hidden";

			// Check to see if this Menu has class="on" otherwise remove the highlight
			if(f.className == "on") {
				f.className = "on";
			} else {
				f.className = "mouseoff";
			}

			if(idName == "subnavhome" || idName == "subnav08") {
				changeColor(idName, "#7a7974");
			} else {
				changeColor(idName, "#333333");
			}
		}
	}
}


/* isVisible - checks whether the visibility of an element with id idName is set
    parameters: 	string idName - HTML element ID;
			boolean isVisible - true if the element should be visible, false if the element should be hidden
    return: false if element has it's visibility set to hidden, true otherwise
*/

function isVisible(idName) {
	var isVis = true; /* let's assume that the element is visible if it is not hidden */
	var e = document.getElementById(idName);
	if(e) {
		if(e.style.visibility == "hidden") {
			isVis = false;
		}
	}
	return isVis;
}


function HideContent(idName) {
	setVisibility(idName, false);
}


function ShowContent(idName) {
	setVisibility(idName, true);
}


function ReverseDisplay(idName) {
	if(!isVisible(idName)) {
		setVisibility(idName, true);
	} else {
		if (clickCheck != true) {
			HideDelay = setTimeout("setVisibility('"+idName+"', false)", 500);
		}
	}
}


function hideMenus(except) {
	for(i = 0; i < menu.length; i++) {
		if(menu[i] != except) {
			setVisibility(menu[i], false);
		}
	}
}


function submenuOver(idName) {
	clearTimeout(HideDelay);
	clearTimeout(ShowDelay);
	hideMenus(idName);
	setVisibility(idName, true);
}



function submenuHide(d) {
	if (clickCheck != true) {
		HideDelay = setTimeout("HideContent('"+d+"')", 500);
	}
}


function submenuShow(d) {
	if (clickCheck != true) {
		ShowDelay = setTimeout("ShowContent('"+d+"')", 500);
	}
}


function submenuClick() {
	clickCheck = true;
}



// Show / Hide
function Hide(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}


function Show(d) {
	if(d.length < 1) { return; }
		document.getElementById(d).style.display = "block";
}


function Reverse(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
	else { document.getElementById(d).style.display = "none"; }
}
// END Show / Hide
