// JavaScript Document
// Labi Egbeyemi v1 13/04/05 

                window.onload = onLoad;

                function onLoad()
                {
                    var thecheckbox = document.getElementById("checkShowAll");
                    if(typeof(IsPrinterFriendly) == "undefined") thecheckbox.checked = false;
                    else thecheckbox.checked = true;
					hideAllTD();
                }
				
				function hideAllTD()
				{
				var QuesEntryCount = 10;
				for (var i=9; i<=QuesEntryCount; i++){
                      if(typeof(IsPrinterFriendly) == "undefined")
					  {
					 	var question = document.getElementById('answer' + i);
							if(question != null) 
							{
							question.style.display = "none";
							document.getElementById('answer'+i).style.display = "none";
							} 
						}
				 }
				}
                function showAllTD()
                {
                    var thecheckbox = document.getElementById("checkShowAll");
                    var isch = thecheckbox.checked;
                    showAllAnswer(isch);
				  }

                function showAllAnswer(checked)
                {
                           if(checked == true)
                                expandAll();
                            else
                                hideAllTD();
                      
                    if(checked == false)
                    {
                      var thecheckbox = document.getElementById("checkShowAll");
	                    thecheckbox.checked = false;
                    }
                }

                function showAns(tdName, questionName, aswerName)
                {
                    var title = document.getElementById(tdName);
                    if (title == null) return;
                    var ans = document.getElementById(aswerName);
                    if (ans == null) return;
                    var que = document.getElementById(questionName);
                    if (ans.style.display == '')
                    {
                      if (que != null) que.style.display = 'none';
	                    ans.style.display = 'none';
	                    var thecheckbox = document.getElementById("checkShowAll");
	                    thecheckbox.checked = false;
                    }
                    else
                    {
                        if (que != null) que.style.display = '';
	                    ans.style.display = '';
                    }
                }

                function expandAll()
                {
                   var QuesEntryCount = 10;
				for (var i=9; i<=QuesEntryCount; i++){
                      if(typeof(IsPrinterFriendly) == "undefined")
					  {
					 	var question = document.getElementById('title' + i);
							if(question != null) 
							{
							question.style.display = '';
							document.getElementById('title'+i).style.display = '';
							document.getElementById('answer'+i).style.display = '';
							} 
						}
				 }
                }
               
