// browser detection
var IE4 = (document.all&&(!document.getElementById)) ? 1 : 0
var IE5 = (document.getElementById && document.all) ? 1 : 0
var NS4 = (document.layers) ? 1 : 0
var NS6 = (document.getElementById && (!document.all)) ? 1 : 0

// add getElementById functionality to IE4
if (IE4) { document.getElementById = ie4getElementById }
function ie4getElementById(tsElementId) {
	return eval("document.all." + tsElementId);
}

/*
// include proper style sheet
if(NS4) {
	document.write('<link rel=stylesheet href=styles_ns4.css>');
} else {
	document.write('<link rel=stylesheet href=styles.css>');
}
*/

// browser tests:
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var version;
if (((browserName == "Netscape") && (browserVer >= 3)) ||
    ((browserName == "Microsoft Internet Explorer") && (browserVer >= 3)))
     version = "1";
else version = "2";

// load images:
if (version == "1") {

mnu_home_on = new Image(48, 18);
mnu_home_on.src = "/images/mnu_home_on_48x18.gif";

mnu_home_off = new Image(48, 18);
mnu_home_off.src = "/images/mnu_home_off_48x18.gif";

mnu_corp_on = new Image(121, 18);
mnu_corp_on.src = "/images/mnu_corp_on_121x18.gif";

mnu_corp_off = new Image(121, 18);
mnu_corp_off.src = "/images/mnu_corp_off_121x18.gif";

mnu_contact_on = new Image(82, 18);
mnu_contact_on.src = "/images/mnu_contact_on_82x18.gif";

mnu_contact_off = new Image(82, 18);
mnu_contact_off.src = "/images/mnu_contact_off_82x18.gif";

mnu_products_on = new Image(70, 18);
mnu_products_on.src = "/images/mnu_products_on_70x18.gif";

mnu_products_off = new Image(70, 18);
mnu_products_off.src = "/images/mnu_products_off_70x18.gif";

mnu_testimonials_on = new Image(92, 18);
mnu_testimonials_on.src = "/images/mnu_testimonials_on_92x18.gif";

mnu_testimonials_off = new Image(92, 18);
mnu_testimonials_off.src = "/images/mnu_testimonials_off_92x18.gif";

mnu_science_on = new Image(64, 18);
mnu_science_on.src = "/images/mnu_science_on_64x18.gif";

mnu_science_off = new Image(64, 18);
mnu_science_off.src = "/images/mnu_science_off_64x18.gif";

mnu_order_on = new Image(104, 18);
mnu_order_on.src = "/images/mnu_order_on_104x18.gif";

mnu_order_off = new Image(104, 18);
mnu_order_off.src = "/images/mnu_order_off_104x18.gif";

}

// functions
function toggleMenuItem(sItemName, sEvent){
	if (version == "1") {
		document.images["mnu_" + sItemName].src = eval("mnu_" +sItemName + "_" + sEvent + ".src");
	}
}

// thanks to Jon Kelling for this complete universal trim function
// he posted in comp.lang.javascript
function trim(inputString) {
  if (typeof inputString != "string") return inputString;
    return inputString
 /*     //clear leading spaces and empty lines
      .replace(/^(\s|\n|\r)*((.|\n|\r)*?)(\s|\n|\r)*$/g,"$2")

      //take consecutive spaces down to one
      .replace(/(\s(?!(\n|\r))(?=\s))+/g,"")

      //take consecutive lines breaks down to one
      .replace(/(\n|\r)+/g,"\n\r")

      //remove spacing at the beginning of a line
      .replace(/(\n|\r)\s/g,"$1")

      //remove spacing at the end of a line
      .replace(/\s(\n|\r)/g,"$1"); */
}