///////////////////////////////////////////////////////////////////////////
// NAV ITEM

function navItem (btnId, subDiv) {
	this.subDiv = subDiv;
	this.btnId = btnId;

	this.on = new Image();
	this.on.src = this.getImgUrl(true);

	this.off = new Image();
	this.off.src = this.getImgUrl(false);

	this.state = false;
}

navItem.prototype.getImgUrl = function (state) {
	return '/images/' + this.btnId + "_" + (state ? "on" : "off") + ".gif";
}

navItem.prototype.setState = function (state) {
	if (state != this.state) {
		this.state = state;
			document.images[this.btnId].src = this.getImgUrl(state);
		if (this.subDiv) {
			setDivVisibility(this.subDiv, this.state);
		}
	}

}

///////////////////////////////////////////////////////////////////////////
// NAV ITEM GROUP

function navItemGroup () {
	this.navItems = new Array();
}

navItemGroup.prototype.setDefault = function (btnId) {
	this.defaultId = btnId;
}

navItemGroup.prototype.addItem = function (item) {
	this.navItems.push(item);
}


navItemGroup.prototype.selectItem = function (btnId) {
	if (!btnId) {
		btnId = this.defaultId;
	}

	var i;
	var navItems = this.navItems;
	for (i=0; i<navItems.length; i++) {
		var item = navItems[i];
		item.setState(item.btnId == btnId);
	}
}

///////////////////////////////////////////////////////////////////////////
//

function setDivVisibility(divName, state) {
	var visibility = state ? 'visible' : 'hidden';
	if (document.getElementById) { // DOM3 = IE5, Moz, KHTML
		document.getElementById(divName).style.visibility = visibility;
	} else {
		if (document.layers) { // Netscape 4
			document.subnav.document[divName].visibility = visibility;
		} else { // IE 4
			document.all[divName].style.visibility  = visibility;
		}
	}
}

///////////////////////////////////////////////////////////////////////////
//

function resetNav() {

}

function onNavRollout(e) {
		resetNav();
}

///////////////////////////////////////////////////////////////////////////
// MAINLINE

function onNavLoad() {

	resetNav();
}




