// show a warning message to users of unsupported browsers

	function check_browser_support() {
		//alert(navigator.appVersion); return; // test user agent strings
		unsupported = new Array("MSIE 6");
		supported = 1;
		warned = 1;
		for (n=0; n<unsupported.length; n++) {
			if (navigator.appVersion.indexOf(unsupported[n]) != -1) {
				supported = 0;
			}
		}
		if (!supported) {
			warned = get_cookie("browser_support", "warned");
		}
		if ((!supported)&&(!warned)) {
			alert("Your browser is not supported by this website. Please consider upgrading to a newer browser. Otherwise, portions of this site may not display or function correctly.");
			set_cookie("browser_support", "warned", 1);
		}
	}


// open a popup window, specifying source, width, and height, and optionally a name; if no name, choose a random one

	function popup(source, width, height, window_name) {
		if (! window_name) { 
			now = new Date();
			window_name = now.getTime();
		} else {
			window_name = window_name.replace(/ /g, "_");
		}
		popup_window = window.open(source, window_name, "width=" + String(width) + ",height=" + String(height) + ",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status=yes");
		popup_window.focus();
		// return popup_window; // oops, this creates a weird behavior in Firefox and Win/IE
	}


// show an email link on a page in a way that spam harvesters can't see

	function show_email(user, domain, tld, label, subject, body) {
		if (!label) { label = user + "@" + domain + "." + tld; }
		if (!subject) { subject = ""; }
		if (!body) { body = ""; } else {
			body = body.replace(/\n/g, "%0A");
			body = body.replace(/\"/g, "'");
		}
		document.write("<a href=\"mailto:" + user + "@" + domain + "." + tld + "?subject=" + subject + "&body=" + body + "\">" + label + "<\/a>");
	}


// search some menu code for a page or section name and set its link ID to "active"
// it would be better to scan the objects within the given div, look for the object whose href matches the page, and change that object's class, but this seems to work fine for now

	function set_active_item(menu_name, page) {
		if (document.getElementById(menu_name)) {
			if (page) {
		
				// these menu items don't have IDs, so we have to get the HTML and parse the anchor tags
				menu_code = document.getElementById(menu_name).innerHTML; // note that IE capitalizes HTML tags, so we have to use case-insensitive regexps below
				re = new RegExp("(<a)([^>]*href=\"[^>]*" + page + "[^>]*\")", "i");
				menu_code = menu_code.replace(re, "$1 class=\"menu_active\"$2");
				document.getElementById(menu_name).innerHTML = menu_code;

			}
		}
	}
	


