/*------------------------------------------------------------------------------
Purpose:
	Various functions used by the FFL site

History:
Ver			Inits	Date		Comments
1.00.00		JEM		03-23-04	Created
------------------------------------------------------------------------------*/

function explore (prefix, myNum, total, onClass, offClass) {
/* +=============================================-===========================================+
   | Given the ID attribute of the desired HTML element and the newClass to which the        |
   | element should change, do just that and assign newClass to the class property of the    |
   | the element ID.                                                                         |
   +=============================================-===========================================+ */
	for (i=0;i<total;i++) {
		currEl = prefix + i;
		changeClassById (currEl, offClass);
	}
	currEl = prefix + myNum;
	flicker (currEl, onClass, offClass);
} // end explore

function flicker (id, onClass, offClass) {
	changeClassById (id, onClass);
	changeClassById (id, offClass);
	changeClassById (id, onClass);
} // end flicker
		
		
function changeClassById(id, newClass) {
/* +=============================================-===========================================+
   | Given the ID attribute of the desired HTML element and the newClass to which the        |
   | element should change, do just that and assign newClass to the class property of the    |
   | the element ID.                                                                         |
   +=============================================-===========================================+ */
	//alert (id + " to class " + newClass); // good for debugging
	identity=document.getElementById(id);  // This is required for Mozilla-based browsers
	identity.className=newClass;  // Change the element's class to newClass
} // end changeClassById()

function goTopic(topicNum) {
	if (!topicNum) {return;};
	destURL = "/student/" + (document.getElementById('chapter').value * 1 + 1) + "/" + topicNum;
	window.location = destURL;
	}

function goStudent (level,topicNum,hsms) {
	if (!topicNum) {return;};
	var defaultChapURL = "/1/";
	switch (level) {
		case (0):
			window.location = "/"+hsms+"/student/" + topicNum + defaultChapURL;
			break;
		case (1):
			window.location = "/"+hsms+"/student/" + document.getElementById('chapter').value + "/" + topicNum;
			break;
		default:
	}	
}

