addLoadEvent(onLoad);
function onLoad() {
// page load for 'view all' checkbox
	var sa = document.getElementById("chkViewAll");
	if(typeof(IsPrinterFriendly) == "undefined") sa.checked = false;
	else sa.checked = true;
}

function toggleAll() {
// click the 'view all' checkbox
	var sa = document.getElementById("chkViewAll");
	var ch = sa.checked;
	toggleQuestions(ch);
}

function toggleAll2() {
// click the 'view all' checkbox
	var sa = document.getElementById("chkViewAll2");
	var ch = sa.checked;
	toggleQuestions2(ch);
}

function toggleAll3() {
// click the 'view all' checkbox
	var sa = document.getElementById("chkViewAll3");
	var ch = sa.checked;
	toggleQuestions3(ch);
}

function toggleAll4() {
// click the 'view all' checkbox
	var sa = document.getElementById("chkViewAll4");
	var ch = sa.checked;
	toggleQuestions4(ch);
}
function toggleAll5() {
// click the 'view all' checkbox
    var sa = document.getElementById("chkViewAll5");
	var ch = sa.checked;
	toggleQuestions5(ch);
}
function toggleQuestions(checked) {
// turn all questions on or off depending on bool checked
// changed this funciton to be more generic, works with any number of q's with any number after title & answer - still requires tr's with title_n and answer_n
	var trs = document.getElementById("QandAEntry").getElementsByTagName("tr");
	for(var i=0;i<trs.length;i++){
	// loop thru the table rows
		var tr = trs[i];
		var pos = tr.id.indexOf("answer");
		if(pos!=-1){
		// get the number from the answer row
			var qnum = tr.id.substr(6);
			if(checked == true)
				expandQuestion(qnum);
			else
				collapseQuestion(qnum);
		}
	}

	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll");
		sa.checked = false;
	}
}

function toggleQuestions2(checked) {
// turn all questions on or off depending on bool checked
// changed this funciton to be more generic, works with any number of q's with any number after title & answer - still requires tr's with title_n and answer_n
	var trs = document.getElementById("QandAEntry2").getElementsByTagName("tr");
	for(var i=0;i<trs.length;i++){
	// loop thru the table rows
		var tr = trs[i];
		var pos = tr.id.indexOf("answer");
		if(pos!=-1){
		// get the number from the answer row
			var qnum = tr.id.substr(6);
			if(checked == true)
				expandQuestion(qnum);
			else
				collapseQuestion(qnum);
		}
	}

	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll2");
		sa.checked = false;
	}
}

function toggleQuestions3(checked) {
// turn all questions on or off depending on bool checked
// changed this funciton to be more generic, works with any number of q's with any number after title & answer - still requires tr's with title_n and answer_n
	var trs = document.getElementById("QandAEntry3").getElementsByTagName("tr");
	for(var i=0;i<trs.length;i++){
	// loop thru the table rows
		var tr = trs[i];
		var pos = tr.id.indexOf("answer");
		if(pos!=-1){
		// get the number from the answer row
			var qnum = tr.id.substr(6);
			if(checked == true)
				expandQuestion(qnum);
			else
				collapseQuestion(qnum);
		}
	}

	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll3");
		sa.checked = false;
	}
}

function toggleQuestions4(checked) {
// turn all questions on or off depending on bool checked
// changed this funciton to be more generic, works with any number of q's with any number after title & answer - still requires tr's with title_n and answer_n
	var trs = document.getElementById("QandAEntry4").getElementsByTagName("tr");
	for(var i=0;i<trs.length;i++){
	// loop thru the table rows
		var tr = trs[i];
		var pos = tr.id.indexOf("answer");
		if(pos!=-1){
		// get the number from the answer row
			var qnum = tr.id.substr(6);
			if(checked == true)
				expandQuestion(qnum);
			else
				collapseQuestion(qnum);
		}
	}

	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll4");
		sa.checked = false;
	}
}
function toggleQuestions5(checked) {
// turn all questions on or off depending on bool checked
// changed this funciton to be more generic, works with any number of q's with any number after title & answer - still requires tr's with title_n and answer_n
	var trs = document.getElementById("QandAEntry5").getElementsByTagName("tr");
	for(var i=0;i<trs.length;i++){
	// loop thru the table rows
		var tr = trs[i];
		var pos = tr.id.indexOf("answer");
		if(pos!=-1){
		// get the number from the answer row
			var qnum = tr.id.substr(6);
			if(checked == true)
				expandQuestion(qnum);
			else
				collapseQuestion(qnum);
		}
	}

	if(checked == false)
	{
	  var sa = document.getElementById("chkViewAll4");
		sa.checked = false;
	}
}

function toggleQuestion(which) {
// toggle an individual question - which is a numerical string identifier
	if (which == null) return;
	var title = document.getElementById('title'+which);
	var ans = document.getElementById('answer'+which);
	var que = document.getElementById('question'+which);
	var plusMinus = document.getElementById('plusMinus'+which);
	if (ans.style.display == '')
	{
	  if (que != null) que.style.display = 'none';
		ans.style.display = 'none';
		plusMinus.innerHTML = '[+]';
		var sa = document.getElementById("chkViewAll");
		sa.checked = false;
	}
	else
	{
		if (que != null) que.style.display = '';
		ans.style.display = '';
		plusMinus.innerHTML = '[-]';
	}
}

function expandQuestion(which) {
// expand a particular question - which is a numerical string id
	var title = document.getElementById('title'+which);
	if (title == null) return;
	var ans = document.getElementById('answer'+which);
	if (ans == null) return;
	var que = document.getElementById('question'+which);
	var plusMinus = document.getElementById('plusMinus'+which);
	if (que != null) que.style.display = '';
	ans.style.display = '';
	plusMinus.innerHTML = '[-]';
}

function collapseQuestion(which) {
// collapse a particular question - which is a numerical string id
	var title = document.getElementById('title'+which);
	if (title == null) return;
	var ans = document.getElementById('answer'+which);
	if (ans == null) return;
	var que = document.getElementById('question'+which);
	var plusMinus = document.getElementById('plusMinus'+which);
	if (que != null) que.style.display = 'none';
	ans.style.display = 'none';
	plusMinus.innerHTML = '[+]';
}
