// Swaps down/left arrows when content is displayed or hidden.  This differs
// from the down/left arrow swap on the Help Pharmacy page in that it changes
// the class name of a container with down or left arrows background images.

function toggleClass(listName, obj) {
	var e1 = document.getElementById(obj);
		if (e1.style.display != "none" ) {
			document.getElementById(listName).className = "innerMainListOpen";
		}
		else {
			document.getElementById(listName).className = "innerMainListClosed";
		}
	}

// This function is used only on the attend meeting or attend event pages.  It works just
// like toggleClass() in that it changes class names to switch right/down arrow background images.
function toggleRSVP(tableName, obj) {
	var e1 = document.getElementById(obj);
		if (e1.style.display != "none" ) {
			document.getElementById(tableName).className = "rsvpTableOpened";
		}
		else {
			document.getElementById(tableName).className = "rsvpTableClosed";
		}
	}

// The expandOrCollapse() fuction works fine but was replaced throughout the site
// with toggleDisplay() found in the toggle.js file because that
// code is a bit more versatile.  It ensures that images will display in all browsers
// in the event the hidden/displayed content contains images.  See comments in toggle.js.

//function expandOrCollapse(obj) {
//	var f1 = document.getElementById(obj);
//		if ( f1.style.display != "block" ) {
//			f1.style.display = 'block';
//		}
//		else {
//			f1.style.display = 'none';
//		}
//	}

// Javascript to swap down/left arrows and hide/display content.  It preloads the arrow images
// on the Help Pharmacy page (just in case stupid browsers -- IE6 in particular -- get confused).
function preloadToggleImages() {
	if (document.images) {
		var imgFiles = preloadToggleImages.arguments;
		if (document.preloadArray == null) document.preloadArray = new Array();
		var img = document.preloadArray.length;
		with (document) for (var j = 0; j < imgFiles.length; j++) if (imgFiles[j].charAt(0) != "#") {
			preloadArray[img] = new Image;
			preloadArray[img++].src = imgFiles[j];
		}
	}
}
// Image array for the above function
preloadToggleImages("../../images/drugArrowRight.gif");
preloadToggleImages("../../images/drugArrowDown.gif");

// Toggle an image.  Right for closed, down for opened.  Used only on the Help Pharmacy page.
function toggleImage(imageName, obj) {
	var e1 = document.getElementById(obj);
		if (e1.style.display != "block" ) {
			document.getElementById(imageName).src = "../../images/drugArrowDown.gif";
		}
		else {
			document.getElementById(imageName).src = "../../images/drugArrowRight.gif";
		}
	}
