function mooInit(adiv) {
	// generate some element arrays for global use
	divs = document.getElementsByClassName("sidelinks");
	buts = document.getElementsByClassName("mooButton");
	sb_images = document.getElementsByClassName("sbimg");
	
	sb_hideAllExcept(adiv); // hide all except specified
	
	// use blue button for specified open element
	if (adiv) { document.getElementById(adiv + 'Butimg').src = 'images/buttons/butt_' + adiv + '_open.gif'; }

	// attach mouseover & mouseout functions to all buttons
	for (m = 0; m < sb_images.length; m++) {
		theimg = sb_images[m];
		theimg.onmouseover = function() {
			thisProd = this.id.substring(0, (this.id.length - 6));
			if (Element.visible(thisProd + 'Links') == false) {
				this.src = 'images/buttons/butt_' + thisProd + '_over.gif';
			}
		}
		theimg.onmouseout = function() {
			thisProd = this.id.substring(0, (this.id.length - 6));
			if (Element.visible(thisProd + 'Links') == false) {
				this.src = 'images/buttons/butt_' + thisProd + '.gif';
			}
		}
	}
}

function sb_hideAllExcept(except) {
	divs = document.getElementsByClassName("sidelinks");
	for (i = 0; i < divs.length; i++) {
		var toHide = divs[i];
		if (toHide.id != (except + 'Links')) {
			toHide.style.display = 'none';
		}
	}
}

function sb_hideOpenOne() {
	divs = document.getElementsByClassName("sidelinks");
	for (i = 0; i < divs.length; i++) {
		var toHide = divs[i];
		if (Element.visible(toHide)) {
			// change to the closed button color
			closeProd = toHide.id.substring(0, (toHide.id.length - 5));
			document.getElementById(closeProd + 'Butimg').src = 'images/buttons/butt_' + closeProd + '.gif';

			// slide the links away
			new Effect.SlideUp(toHide, { queue: {position:'front', scope: 'menuscope'} });
		}
	}
}

function accordionOpen(name) {
	toOpen = document.getElementById(name + 'Links');
	if (Element.visible(toOpen) == false) {
		sb_hideOpenOne(); // hide the currently open set of links

		// change to the open button color
		document.getElementById(name + 'Butimg').src = 'images/buttons/butt_' + name + '_open.gif';

		// slide in the new set of links
		new Effect.SlideDown(toOpen, { queue: {position:'end', scope: 'menuscope'} });
	} else {
		sb_hideOpenOne();
		
		// change to the closed button color
		document.getElementById(name + 'Butimg').src = 'images/buttons/butt_' + name + '.gif';
	}
}