function underline() {
	var nav = document.getElementById('menu');
	if(nav != undefined) {
		var navlinks = nav.getElementsByTagName('A');
		for (var i = 0; i < navlinks.length; i++) {
			var accesskey = navlinks[i].getAttribute('accesskey');
			if (accesskey) {
				var link = navlinks[i];
				var linktext = link.childNodes[0].nodeValue;
				var keypos = linktext.indexOf(accesskey);
				var firstportion = linktext.substring(0,keypos);
				var keyportion = linktext.substring(keypos,keypos+1);
				var lastportion = linktext.substring(keypos+1,linktext.length);
				
				link.childNodes[0].nodeValue = firstportion;
				var s = document.createElement("span");
				var span = link.appendChild(s);
				var keyt = document.createTextNode(keyportion);
				span.appendChild(keyt);
				var lastt = document.createTextNode(lastportion);
				link.appendChild(lastt);
			}
		}
	}
}


function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  createCookie("style", title, 365);
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var style = null;
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) style = a.getAttribute("title");
  }
  return style;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function getStyleAttribute(attribName) {
	var result = '';
	var cookie = readCookie("style");
	var ca = cookie.split(',');
	for(var i=0; i<ca.length; i++) {
		var ci=ca[i].split(':');
		if(ci[0] == attribName) {
			result = ci[1];
		}
	}
	return result;
}

function setStyleAttribute(attribName, attribValue) {
	var style = readCookie("style");
	var newStyle = '';
	var setNewValue = false;
	
	if(style != 'null') {
		var ca = style.split(',');
		for(var i=0; i<ca.length; i++) {
			var ci = ca[i].split(':');
			if(newStyle.length>0) {
				newStyle += ',';
			}
			if(ci[0] == attribName) {
				newStyle += ci[0] + ':' + attribValue;
				setNewValue = true;
			} else {
				newStyle += ci[0] + ':' + ci[1];
			}
		}
	}
	
	if(!setNewValue) {
		if(newStyle.length != 0) { newStyle += ','; }
		newStyle += attribName + ':' + attribValue;
	}

	createCookie("style", newStyle, 365);
	setActiveStyleSheet(newStyle);
}

function toggleStyleAttribute(attribName, attribValues, wrap) {
	var curValue = getStyleAttribute(attribName);
	var newValue = null;
	var values = attribValues.split(',');
	for(var i=0; i<values.length; i++) {
		if(values[i] == curValue) {
			if(wrap) {
				newValue = values[(i+1)%values.length];
			} else {
				vidx = ((i+1) >= values.length) ? values.length-1 : i+1;
				newValue = values[vidx];
			}
		}
	}
	if(newValue == null) {
		newValue = values[0];
	}
	setStyleAttribute(attribName, newValue);
}

window.onload = function(e) {
  var style = readCookie("style");;
  if(style == 'null') {
  	style = getPreferredStyleSheet();
  } 
  setActiveStyleSheet(style);
  underline();
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

function doprint() 
{ print() ;}
function doclose() 
{ close() ;}
// -->
		
function addBookmark(title,url) {
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}

//window.defaultStatus='Illinois ADA Project ? Your Resource for Americans with Disabilities Act (ADA) Information';