
//The functions included here are used for various things throughout the Manual

//These functions are used to vary the visibility of elements

	function Show_Disp(elementid)
		{
		document.getElementById(elementid).style.display = "block";
		}

	function Hide_Disp(elementid)
		{
		document.getElementById(elementid).style.display = "none";
		}


	function Show_Vis(elementid)
		{
		document.getElementById(elementid).style.visibility = "visible";
		}

	function Hide_Vis(elementid)
		{
		document.getElementById(elementid).style.visibility = "hidden";
		}

	function Switch_Display(showid,hideid)
		{
		Show_Disp(showid);
		Hide_Disp(hideid);
		}

	function Remove_Area(RemoveId,ParentId)
		{
		var Field = document.getElementById(RemoveId);
		document.getElementById(ParentId).removeChild(Field);
		}



//The following funtion inserts the introductory text to the CMs, Cases, etc. index pages

	function Insert_Introduction(id,Type)
		{
		if(Type == 'CM')
			var Text = document.createTextNode(CMDescriptions[id]);
		else
			var Text = document.createTextNode(Case_Descriptions[id]);
		var Line = document.createElement('hr');
		document.getElementById("Introductory_Text").appendChild(Text);
		document.getElementById("Introductory_Text").appendChild(Line);
		document.getElementById("Introductory_Text").style.textAlign = 'center';
		document.getElementById("Introductory_Text").style.fontWeight = 'bold';
		}


//The following functions handle inserting and removing the comments for CMs, cases, etc.


	//Text and location for CMs

	function CMComment(CMName)
		{
		var Comment_Text = document.createTextNode(CMDescriptions[CMName]);
		if(document.getElementById('Content').style.display == 'block')
			var Location_Number = 0;
		else
			var Location_Number = 1;
		InsertComment(CMName,Location_Number,Comment_Text);
		}

	//Text and location for Subchapters

	function SubchapterComment(SCName)
		{
		Comment_Text = document.createTextNode(Subchapterdescriptions[SCName]);
		InsertComment(SCName,0,Comment_Text);
		}

	//The following three functions handel Text and location for Cases

	function Sort_Cases()
		{
		var Cases_Number = Case_Listing.length;
		for(var i = 0; i < Cases_Number; i++)
			{
			var Case = Case_Listing[i];
			if(document.getElementsByName(Case)[0])
				{
				for(var j = 0; j < 99; j++)
					{
					if(document.getElementsByName(Case)[j])
						{
						var Comment_Function = 'Case_Comment("'+ Case + '","' + j + '")';
						if(window.netscape)
							document.getElementsByName(Case)[j].setAttribute("onMouseover",Comment_Function);
						else
							document.getElementsByName(Case)[j].onmouseover = IE_Case_Comment;
						}
					}
				}
			}
		}

	//This function handles some IE peculiarities

	function IE_Case_Comment()
		{
		var Source = window.event.srcElement;
		var CaseName = Source.name;
		for(var i=0;i<99;i++)
			{
			var All_Cases = document.getElementsByName(CaseName)[i];
			if(All_Cases == Source)
				var Location_Number = i;
			}
		Case_Comment(CaseName,Location_Number);
		}


	function Case_Comment(CaseName,Location_Number)
		{
		Comment_Text = document.createTextNode(Case_Descriptions[CaseName]);
		InsertComment(CaseName,Location_Number,Comment_Text);
		}

	//Creates the Comment Box and adds it to the document

	function InsertComment(Location_Name,Location_Number,Comment_Text)
		{
		var Box = document.createElement("div");
		Box.setAttribute("id", "Description");
		Box.appendChild(Comment_Text);
		var Target = document.getElementsByName(Location_Name)[Location_Number];
		Target.parentNode.appendChild(Box);
		if(window.netscape)
			Box.setAttribute("class", "CommentBox");
		else
			document.all.Description.className = "CommentBox";
		}

	//Removes the Comment Box

	function RemoveComment()
		{
		var Box = document.getElementById("Description");
		document.getElementById("Description").parentNode.removeChild(Box);
		}

//The following function creates the new window for constants, etc.

	function Help_Window(source)
		{
		window.open(source,"Help","width=500px,height=800px,scrollbars=yes")
		}

//Used in the time identification exercise

	function Compare_Number(Correct)
		{
		if(show == Correct)
			Fb_Correct(Correct_Feedback)
		else
			Fb_Wrong(Wrong_Feedback);
		}
