// Returns a reference to the style object for all object models
function getStyleObj(objectID) {
	var objStyle = false;
	// get DOM properties
    if (objDom.isNN4) {
		objStyle = document.layers[objectID];
    }
	else if (objDom.isMSIE4) {
		objStyle = document.all(objectID).style;
    }
	else if(objDom.isW3C) {
		objStyle = document.getElementById(objectID).style;
    }
	return objStyle;
}

// Returns a reference to the object for all object models
function getObj(objectID) {
	var objElement = false;
	// get DOM properties
    if (objDom.isNN4) {
		objElement = document.layers[objectID];
    }
	else if (objDom.isMSIE4) {
		objElement = document.all(objectID);
    }
	else if(objDom.isW3C) {
		objElement = document.getElementById(objectID);
    }
	return objElement;
}

//Changes the display of an element. Parameters are:
//object ID, 1:0 visibility properties, 1:0 display properties
function doDisplay () {

	for (var i=0; i < doDisplay.arguments.length; i+=3) {

		var objectId = doDisplay.arguments[i];
		var objStyle = getStyleObj(objectId);
		var strVisState = doDisplay.arguments[i+1];
		var strDisState = doDisplay.arguments[i+2];
		if (objDom.isNN4) {
			var strStyleVis = (strVisState ? 'show' : 'hide');
			var strStyleDis = (strDisState? 'block' : 'none');
		}
		else if (objDom.isMSIE4) {
			var strStyleVis = (strVisState ? 'visible' : 'hidden');
			var strStyleDis = (strDisState ? 'block' : 'none');
		}
		else if (objDom.isW3C) {
			var strStyleVis = (strVisState ? 'visible' : 'hidden');
			var strStyleDis = (strDisState ? 'block' : 'none');
		}
		if(objStyle) {
			objStyle.visibility = strStyleVis;
			objStyle.display = strStyleDis;
		}

	}
}

function doDisplayFAQ() {
	// combine constant "question" id with the unique question number
	var strOnQuestionID = "question" + doDisplayFAQ.arguments[0];
	// teamsite defined number of faqs per page
	var intQuestions = doDisplayFAQ.arguments[1];
	// iterate though all the defined question/answer pairs
	for(i = 1; i <= intQuestions; i++) {
		// create ID strings for qeustion/answer pairs
		var strQuestionID = "question" + i;
		var strAnswerID = "answer" + i;
		// get a referance to this question object
		var objQuestion = eval('getObj("' + strQuestionID + '")');
		// determine if this object ID is the one to display
		if(strQuestionID == strOnQuestionID) {
			if(objQuestion) {
				// toggle style properties of the matching object
				if(objQuestion.className == "grayhoverlink") {
					objQuestion.className = "questionon";
					eval('doDisplay("' + strAnswerID + '",1,1)');
				}
				else if(objQuestion.className == "questionon") {
					objQuestion.className = "grayhoverlink";
					eval('doDisplay("' + strAnswerID + '",0,0)');
				}
			}
		}
		else {
			// hide all non-matching answer obejcts
			if(objQuestion) {
				objQuestion.className = "grayhoverlink";
				eval('doDisplay("' + strAnswerID + '",0,0)');
			}
		}
	}
	return false;
}