var glossary_folder = "00common/0004glossary/"
if (typeof CCFS.GLOSSARY_FOLDER != "undefined")
	glossary_folder = CCFS.GLOSSARY_FOLDER
if (glossary_folder.length && glossary_folder.slice(-1) != "/")
	glossary_folder += "/";
if(typeof CCFS.SUBJECT != "undefined") {
	document.write('<script language="JavaScript" src="../"' + CCFS.SUBJECT + '_common/glossary/popupdefns.js"></script>');
} 
else {
    document.write('<script language="JavaScript" src="../../' + CCFS.STARTUP_PARMS.course + "/" + glossary_folder + 'popupdefns.js"></script>');
}
//Find the course_root folder
/*file: popupsearch.js
Version: 0.0.0*/
/* Original version by - Liqiang Chen (00/04/28)
 * Modified by - Thao Pham */
function popUpSearch(textValue){
  var found = false;
  var str = null;
  var text = textValue;
  text = text.toLowerCase();

  if (typeof terms == "undefined" || typeof popupDefs == "undefined") {
    alert('DEVELOPER ALERT: Rollover glossary terms were not found.  This is most likely due to a syntax error in the "popupdefns.js" file.  Please check the contents of that file.')
  }

  for (var i=0; i<terms.length; i++){
	str = terms[i];
	str = str.toLowerCase();
	if (text == str ) {
		 found = true;
		 break;
	}
  }
  if (found) return popupDefs[i];
  return "Not Defined";
}

function search( word ) {
  showDefinition( word );
}

var glosWin = null;

function showGlossaryWin() {
  var surl = CCFS.getCourseDocRoot() + "00common/0004glossary/docs/gloswin.htm";
  glosWin = window.open(surl, "glosWin", "BGCOLOR=#000000,WIDTH=480,HEIGHT=360,ALIGN=center");
}

var term = null;

function showDefinition( word ) {
  term = word;
  if (glosWin == null) showGlossaryWin();
  else if (glosWin.closed) showGlossaryWin();
  else 	{
	glosWin.focus();
	glosWin.searchTerm(word);
  }
}

function getTerm(){
  return term;
}