

/*
 * Declare global variables
 */
var ie = true;
var nav = false;
var userAgent = navigator.userAgent;
	
/*
 * Browser detection
 */
if (userAgent.indexOf("MSIE") > -1) {
	ie = true;
	nav = false;
} else if ((userAgent.indexOf("Mozilla") > -1) && (userAgent.indexOf("compatible") < 0)) {
	nav = true;
	ie = false;
}

// This function makes the proper association (based upon 
// browser DOM) for a layer object, and returns it.
// it also simplifies interaction by extending the IE
// object to have a name.  Not necessary, but nice.
//
function getObject(strObj) {
	var myObj = null;

	if (nav) {
		if (document.layers[strObj]) {
			myObj = document.layers[strObj];
		} else if (document.layers['topnav']) {
			myObj = document.layers['topnav'].document.layers[strObj];
		}
	} else if (ie) {
		if (document.all[strObj]) {
			myObj = document.all[strObj].style;
			myObj.name = document.all[strObj].id;
		}
	}
	return myObj;
}

function windowUpdate() {

	if (ie) {
		var myWindow = getObject("top_button");
//FMC 6-30-04 references to myWindow were creating javascript errors.
// TODO: find out why this was failing.
		if( myWindow == null ) return; //suppress errors FMC
		if (document.body.scrollTop != 0) {
			myWindow.visibility = "visible";	
		} else {
			myWindow.visibility = "hidden";	
		}
	}

}


function setHiddenValue (fieldName, fieldValue) {
		document.forms[0].elements[fieldName].value = fieldValue;
}
