//
// $Id$
// inspired by <http://www.nngroup.com/script/nng.js>
//
function GetVersion() {
	var s = navigator.appVersion;
	var msie_i = s.indexOf("MSIE");
	var v = 0;
	// Grab the first number appearing after "MSIE"
	if (msie_i != -1)
		v = parseFloat(s.substr(msie_i + 4));
	else v = parseFloat(s);
	return v;
}
function GetCSS()
{
	var css = "johnh.css";
	// currently, just specialize for netscape 4
	var is_ns = (navigator.appName.indexOf("Netscape") != -1);
	var version = GetVersion();
	if (is_ns && version < 5)
		css = "johnh_ns4.css";
	return css;

}
function GetCSSLink(path)
{
	var rec_css = GetCSS();
	if (rec_css.length > 0)
		return "<link rel=\"stylesheet\" href=\"" + path + "/" + rec_css + "\">";
	else return "<link rel=\"stylesheet\" href=\"" + path + "/johnh.css\">";
}
function WriteCSS(path)
{
	document.write(GetCSSLink(path));
}
function DebugWriteCSS(path)
{
	var rec_css = GetCSS();
	document.write(GetCSSLink(path) + "johnh.js writes partly " + rec_css);
}
