function initMenu()
{
	if( document.getElementById('navList')) {
		// section_1
		// find current section #
		var currentLoc = window.location.href.toLowerCase();
		var totalSections = 7;
		var theSection = 0;
		for( i = 1; i <= totalSections && theSection == 0; i++)
		{
			if( currentLoc.indexOf("/section_" + i) > 0 )
				theSection = i;
		}
		var liTag = document.getElementById("section" + theSection);
		if( liTag ) {
			liTag.className += " selectedMenu";
			var aTags = liTag.getElementsByTagName('a');
			var linkLetter = currentLoc.indexOf("n_"+theSection+"/") + 5;
			for(var i = 0; i < aTags.length; i++) {
				var aLetter = aTags[i].href.indexOf("n_"+theSection+"/") + 5;
				if(currentLoc.charAt(linkLetter) == aTags[i].href.charAt(aLetter)) var myLink = aTags[i];
			}
			if(myLink) {
				//insert style information
				myLink.style.backgroundColor = "#FFFFFF";
			}
		}
		
	}
}
//window.onload=initMenu;

function showMenu(whichTag)
{
	whichTag.parentNode.getElementsByTagName('div')[0].style['display'] = 'inline';
	if( document.getElementById('isFlash') )
		document.getElementById('isFlash').style['visibility'] = 'hidden';
}

function hideMenu(whichTag)
{
	whichTag.parentNode.getElementsByTagName('div')[0].style['display'] = 'none';
	if( document.getElementById('isFlash') )
		document.getElementById('isFlash').style['visibility'] = 'visible';
}


courseChangeWin = "";
 function openWindow(type, width, height)
 {
	courseChangeWin = open(type, "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=50,left=50,width=" + width + ",height=" + height);
	return false;
 }
 
 function openGlobalWindow(type, width, height)
 {
	courseChangeWin = open(type, "", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=50,left=50,width=" + width + ",height=" + height);
	//return false;
 }
 
  function showInfo(numbContent, width, height)
 {
	var newContent = "";
	newContent += "<table width='100%' cellspacing='0' cellpadding='8' bgColor='#FFFFFF'><tr><td>";
	newContent += "<table width='100%' cellspacing='0' cellpadding='10' style='border: 2px solid #0C9CB6;'><tr><td>";
	if( numbContent == -1 ) {
		for( i = 0; i < pageContent.length; i++)
		newContent += "<p>" + pageContent[i] + "</p>";
	}
	else
		newContent += "<p>" + pageContent[numbContent] + "</p>";
	newContent += "<p align='right'><a href='javascript:window.close();'><img src='../_images/closeWin.gif' width='98' height='18' border='0' alt='Close Window' hspace='0' vspace='0'></a></p>";
	newContent += "</td></tr></table></td></tr></table>";
	writeWindow(newContent, width, height);
	
	return false;
 }
 
 
function writeWindow(newContent_Text, w, h)
{
 // 444, 227 default width, height for Netscape
 // 600, 400 is max 
 if( document.all && (navigator.userAgent.indexOf("Opera") == -1) ) {
 	w += 21;
	h += 17;
 }
 
 nets = open("", "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=50,top=50,width=" + w + ",height=" + h);
 nets.document.open();
 nets.document.writeln("<html><head><title>Information</title>");
 nets.document.writeln("<link href='../_css/print.css' rel='stylesheet' type='text/css' media='print' />");
 nets.document.writeln("<link href='../_css/course.css' rel='stylesheet' type='text/css' media='screen' />");
 nets.document.writeln("<link href='../_css/main.css' rel='stylesheet' type='text/css' media='screen' />");
 nets.document.writeln("<link href='../_css/navigation.css' rel='stylesheet' type='text/css' media='screen' />");
 nets.document.writeln("<style type='text/css'><!--");
 nets.document.writeln(".bold {  font-weight: bold; }");
 nets.document.writeln(".italic { font-style: italic; }");
 nets.document.writeln(".underline { text-decoration: underline; }");
 nets.document.writeln(".ds_lists li { 	margin-top: 1em; margin-bottom: 1em; }");
 nets.document.writeln(" td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: .8em; } " );
 nets.document.writeln("-->");
 nets.document.writeln("</style>");
 nets.document.writeln("</head>");
 nets.document.writeln("<body bgcolor='#FFFFFF' text='#000000' style='margin:10px;'>");
 nets.document.writeln("<div align='center'>");
 nets.document.writeln(newContent_Text);
 nets.document.writeln("</div></body></html>");
 nets.document.close();
}

function checkAnswer(formID, numbResponses, questionNumb, correctAnswer, moreInfo)
{
	var form = document[formID];
	var i = 0;
	var responseAnswer = "";
	while( i < numbResponses && responseAnswer == "")
	{
		if( form[questionNumb][i].checked) {
			responseAnswer = "Incorrect";
			if( form[questionNumb][i].value == correctAnswer ) { 
				responseAnswer = "Correct!"
				if( moreInfo != "" ) 
					responseAnswer += " - " + moreInfo;
			}
		}
		i++;
	}
	if( responseAnswer != "" ) 
		alert(responseAnswer);
	else
		alert("Please select a response first!");
}

function leaveSite(URL)
{
	window.open(URL,"","width=720,height=570,location=yes,directories=no,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,top=150,left=0");
	//window.moveTo(0,0);
}

version=1.0;
function printPage()
{
	if( version == 1.0 )
		alert("Please go to File->Print in your browser.");
	else
		printFullPage();
}

function loadPage(newPage)
 {
	if( opener && !opener.closed) {	
		opener.location.href=newPage;
		window.close();	
	}
	else
		window.location.href=newPage;
		
 	return false;
 }


// Glossary Hint Functionality

function FindAbsolutePosition(obj) {
	var posObj = {left:0,top:0};
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	posObj.left = curleft;
	posObj.top = curtop;
	return posObj;
}
function showHint() {
	var params = showHint.arguments;
	var element = params[0];
	var term_str = params[1];
	var xOffset = -100;
	var yOffset = 25;
	if(params.length > 2) xOffset = params[2];
	if(params.length == 4) yOffset = params[3];
	
	var posObj = FindAbsolutePosition(element);
	var leftPos = posObj.left+xOffset;
	var topPos = posObj.top+yOffset;

	var nTerm = "";
	var nDef = "";

	for(var i = 0; i < ds1.getRowCount(); i++) {
		var cRow = ds1.getRowByRowNumber(i,true);
		var cTerm = cRow['term'];
		if(cTerm == term_str) {
			nTerm = cTerm;
			nDef = cRow['definition'];
		}
	}
	var oldContainer = document.getElementById("hintContainer");
	
	if(!oldContainer) {

		var hintCode = "";
		hintCode += "<span id='hintContainer' style='color:#000; position:absolute; left:"+leftPos+"px; top:"+topPos+"px;'>";
		hintCode += "<span style='width:291px; background:#F1F0F1; position:relative;'>";
		hintCode += "<span style='width:291px; background:#DBDADB; position:relative; left:-1px;top:-1px;'>";
		hintCode += "<span style='width:291px; background:#B8B6B8; position:relative; left:-1px;top:-1px;'>";
		hintCode += "<span style='width:270px; background:#fff; text-decoration:none; border:1px solid #73338f; border-top:5px solid #73338f; position:relative; left:-2px; top:-1px; padding:10px;padding-top:4px;'>";
		hintCode += "<b>"+nTerm+" - </b>"+nDef;
		hintCode += "</span></span></span></span></span>";
		
		var spanId = "";
		if(term_str.indexOf(' ') != -1) {
			for(var i = 0; i < term_str.length; i++) {
				if(term_str.charAt(i) == ' ') spanId += '_';
				else spanId += term_str.charAt(i);
			}
		} else spanId = term_str;
		
		var areaCont = document.getElementById(spanId);
		if( areaCont ) areaCont.innerHTML = hintCode;
	}	
	
}
function hideHint(term_str) {
	
	var areaCont = document.getElementById(term_str);
	areaCont.innerHTML = "";
	
}
function toggleShowAll(names) {
	for( x = 1; x <= names.length; x++)
	{
	  ulElement = document.getElementById(names[x-1]);
	  if (ulElement) {
		  ulElement.className = 'here';
	  }
	}
}
function toggleHideAll(names) {
	for( x = 1; x <= names.length; x++)
	{
	  ulElement = document.getElementById(names[x-1]);
	  if (ulElement) {
		  ulElement.className = 'gone';
	  }
	}
}

function toggle(id) {
  ulElement = document.getElementById(id);
  if (ulElement) {
if (ulElement.className == 'gone'){
ulElement.className = 'here';
} else {
ulElement.className = 'gone';
}
}
}

function toggle2(id) {
  ulElement = document.getElementById(id);
  if (ulElement) {
if (ulElement.className == 'here2'){
ulElement.className = 'gone2';
} else {
ulElement.className = 'here2';
}
}
}
function toggle3(id) {
  ulElement = document.getElementById(id);
  if (ulElement) {
if (ulElement.className == 'gone2'){
ulElement.className = 'here2';
} else {
ulElement.className = 'gone2';
}
}
}
function toggle4(id) {
  ulElement = document.getElementById(id);
  if (ulElement) {
if (ulElement.className == 'here3'){
ulElement.className = 'gone3';
} else {
ulElement.className = 'here3';
}
}
}

function on(id) {
  ulElement = document.getElementById(id);
  
  if (ulElement) {
    if (ulElement.className == 'gone' || ulElement.className == 'here'){
      ulElement.className = 'here';
  } else {
      ulElement.className = 'here';
	  }
    }
}
function off(id) {
  ulElement = document.getElementById(id);
  if (ulElement) {
    if (ulElement.className == 'gone' || ulElement.className == 'here'){
      ulElement.className = 'gone';
    } else {
      ulElement.className = 'gone';
    }
  }
}
function on2(id) {
  ulElement = document.getElementById(id);
  
  if (ulElement) {
    if (ulElement.className == 'gone' || ulElement.className == 'here'){
      ulElement.className = 'here2';
  } else {
      ulElement.className = 'here2';
	  }
    }
}
function nw(URL)
{
	windowID = window.open(URL,"","width=720,height=570,location=yes,directories=no,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,top=150,left=0");
 if (windowID == null){

           alert('Please turn off your pop-up blocker to view the content!');
}
}
function fw(URL)
{
	windowID = window.open(URL,"","width=740,height=610,location=yes,directories=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,top=0,left=0");
 if (windowID == null){

           alert('Please turn off your pop-up blocker to view the content!');
}
}
function nvw(URL)
{
	windowID = window.open(URL,"","width=420,height=540,location=no,directories=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,top=50,left=0");

      if (windowID == null){

           alert('Please turn off your pop-up blocker to view the content!');
}
}

 function updateMovie(whichMov, movieID)
 {
	 if( document[movieID] ) {
		 document[movieID].SetURL(whichMov);
		 document[movieID].Stop();
//		 document[movieID].enablejavascript = true;
		 document[movieID].SetAutoPlay(false);
//		 document[movieID].autoplay = false;
	 }
 }
function change(URL)
{
	window.location.href=URL;
}
