function toggleAll(pDisplayState, pElementIds) {
	debug("toggleAll:");

	var idArray = new Array();
		idArray = arguments;

	debug("toggleAll: idArray.length = " + idArray.length);
	for (i = 1; i < idArray.length; i++) {
		debug("toggleAll: idArray[" + i + "] = " + idArray[i]);

		if (document.getElementById(idArray[i])) {
			debug("toggleAll: toggleDisplay(" + pDisplayState + ", " + idArray[i] + ")");
			toggleDisplay(pDisplayState, idArray[i]);
		}
	}

	// Clear out existing idArray elements, ensuring no cached elements are carried over to the next call of toggleAll
	idArray.length = 0;
}

// ----------------------------------------------------------------------
// Functions specific to /unique/unique_broadband.htm
// ----------------------------------------------------------------------
function toggleStarterFeatures(showId, hideId) {
	debug("toggleStarterFeatures(" + showId + ", " + hideId + ")");
	toggleAll("off", "starterBox1b", "starterBox2b", "starterBox3b", "starterBox4b"); // Toggle off all feature expansion boxes
	toggleAll("on", "starterBox1a", "starterBox2a", "starterBox3a", "starterBox4a");  // Toggle on all feature headers
	toggleDisplay("on", showId);  // Toggle on desired feature box
	toggleDisplay("off", hideId); // Toggle off desired feature's header box
}
function toggleMaxFeatures(showId, hideId) {
	debug("toggleMaxFeatures(" + showId + ", " + hideId + ")");
	toggleAll("off", "maxBox1b", "maxBox2b", "maxBox3b", "maxBox4b", "maxBox5b"); // Toggle off all feature expansion boxes
	toggleAll("on", "maxBox1a", "maxBox2a", "maxBox3a", "maxBox4a", "maxBox5a");  // Toggle on all feature headers
	toggleDisplay("on", showId);  // Toggle on desired feature box
	toggleDisplay("off", hideId); // Toggle off desired feature's header box
}
function toggleSelectFeatures(showId, hideId) {
	debug("toggleSelectFeatures(" + showId + ", " + hideId + ")");
	toggleAll("off", "selectBox1b", "selectBox2b", "selectBox3b", "selectBox4b", "selectBox5b"); // Toggle off all feature expansion boxes
	toggleAll("on", "selectBox1a", "selectBox2a", "selectBox3a", "selectBox4a", "selectBox5a");  // Toggle on all feature headers
	toggleDisplay("on", showId);  // Toggle on desired feature box
	toggleDisplay("off", hideId); // Toggle off desired feature's header box
}

// ----------------------------------------------------------------------
// Functions specific to /offerinfo/cli_results.cfm
// ----------------------------------------------------------------------
var mainProductIds = ["homeWithStarter","homeWithSelect","homeWithMax"];

function displayProducts(pProductId, pIsUnique) {
	debug("displayProducts(" + pProductId + ", " + pIsUnique + ") <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ");
	debug("displayProducts: pIsUnique     = " + pIsUnique);

	// TO DO: Find out why toggleAll() doesn't work when switching visibility of elements en-masse
	// toggleAll("off",mainProductIds);
	toggleDisplay("off","homeWithStarter");
	toggleDisplay("off","homeWithSelect");
	toggleDisplay("off","homeWithMax" );

	debug("displayProducts: showSelectedProduct(" + pProductId + ", " + mainProductIds);
	showSelectedProduct(pProductId, mainProductIds);
}

function showSelectedProduct(pProductId, pProductIdArray) {
	debug("showSelectedProduct(" + pProductId + ", " + pProductIdArray + ")");

	// Toggle off product blocks;
	debug("showSelectedProduct: toggleAll(off, " + pProductIdArray + ")");
	// TO DO: Find out why toggleAll() doesn't work when switching visibility of elements en-masse
	toggleAll("off", pProductIdArray);

	// Toggle on selected main product block
	debug("showSelectedProduct: toggleDisplay(on, " + pProductId + ")");
	toggleDisplay("on", pProductId);
}

// ----------------------------------------------------------------------
// Functions specific to /time/broadbandstarter, /time/broadbandselect,
// and /time/broadbandmax
// ----------------------------------------------------------------------
function toggleTerms(pObjId) {
	var objId = "";

	if (typeof(pObjId) == "undefined" || typeof(pObjId) == null) {
		objId = "terms";
	} else {
		objId = pObjId;
	}

	debug("objId = " + objId);

	var displayState = getStyleObject(""+objId).display;
	var linkObject   = document.getElementById(objId + "Link");

	debug("displayState = " + displayState);

	if (displayState == "block") {
		toggleDisplay('off',objId);
		linkObject.className = "downTriangle";
	} else {
		toggleDisplay('on',objId);
		linkObject.className = "upTriangle";
	}
}

// This function also used by /time/broadbandaccess, besides 3 x product pages
function hideDivsWithClassName(className){
	var allDivs    = document.getElementsByTagName('div');
	var rootLength = allDivs.length;

	for (i=0; i < rootLength; i++) {
		if (allDivs[i].className.indexOf(className) != -1) {
			allDivs[i].style.display = "none";
		}
	}
} // getDivsByClass

// Function implements show/hide slide reveal effect, utilising prototype.js and effects.js
function handleSection(pSectionId,pSlideDirection) {
	if (pSlideDirection) {
		toggleDisplay("off", pSectionId + "0"); // hide img.triangle;
		toggleDisplay("on",  pSectionId + "1"); // reveal img.triangle_down
		Effect.SlideDown(pSectionId);           // slide section_content into view
	} else {
		Effect.SlideUp(pSectionId);             // slide section_content out of view
		toggleDisplay("on",  pSectionId + "0"); // show img.triangle;
		toggleDisplay("off", pSectionId + "1"); // hide img.triangle_down
	}
}