/* This library function creates the glossary popup, searches an array and displays the results
   Refer to the all_terms.js library for the glossary data */

// Declare the global variable for the window

var popup

function GlossaryTerm(Click_Text) {

/* Close the old window if it's there. This now catches a close action in Netscape.
  If the window is already created, we rewrite the contents and bring it to the front using focus() 
  at the end of the script. */

if (!popup || popup.closed) { 
	
// Set the window properties

	window_Properties='toolbar=no,location=no,directories=no,status=no,menubar=no,' 
	window_Properties += 'scrollbars=no,resizable=no,height=250,width=250, left = 200, top = 200' 
	popup = window.open ("","", window_Properties)

}
// Handle an error if no search term found (unlikely)

var Found = false;

// Now we build the display variable and search the array

var contents = '<FONT SIZE=1 FACE="verdana">'

contents += "<title>"+Click_Text+'</title><B>'+Click_Text+"</B><BR><BR>"

      for (var i=0; i < Glossary_Size; i++) {
  	  if(Click_Text == Gloss_Array[i].name) {     	          
	    Found = true;		
		contents += ""+Gloss_Array[i].definition+"<BR><BR>"
	
// We'll need to display a picture if there is one	

		if (!Gloss_Array[i].picture == "") {
		contents += '<CENTER><img src="Glossary/'+Gloss_Array[i].picture+'"></CENTER><BR><BR>'
		}

// Display a link to close the popup

	    contents += '<CENTER><a href="javascript:window.close();">Close</A></CENTER></FONT>'
	   }
      }
      if(!Found)
	  
contents += "Nothing Found</FONT>"

// Finally, write the document

popup.document.write(contents)
popup.document.close()
popup.focus()
	
}


