function escapeQuotes(value, bWantCharRef)
{
	if(value == null)
	{
		return "";
	}
	var returnValue = "";
	var i;
	var previousChar = 0;
	var thisChar = 0;
	for(i=0; i < value.length; i++)
	{
		previousChar = thisChar;
		thisChar = value.charAt(i);
		if(thisChar == '"')
		{
			if(bWantCharRef)
			{
				returnValue += "&quot;";
			}
			else
			{
				if(previousChar == '\\')
				{
					returnValue += thisChar;
				}
				else
				{
					returnValue += "\\\"";
				}
			}
		}
		else if((thisChar == '\\') && !bWantCharRef)
		{
			if(previousChar == '\\')
			{
				returnValue += thisChar;
			}
			else
			{
				var nextChar = 0;
				if(i+1 < value.length)
				{
					nextChar = data.charAt(i+1);
				}
				if((nextChar == '\\') || (nextChar == '"'))
				{
					returnValue += thisChar;
				}
				else
				{
					returnValue += "\\\\";
				}
			}
		}
		else if(!bWantCharRef && ((thisChar == '\n') || (thisChar == '\r')))
		{
			// strip it?
		}
		else
		{
			returnValue += thisChar;
		}
	}
	return returnValue;
}

function popUpPage(pageURL, width, height)
{
	if(isNaN(width))
	{
		width = 780;
	}
	if(isNaN(height))
	{
		height = 550;
	}
	var params = "";
	var bCenter = false;
	if(bCenter)
	{
		var left = (screen.availWidth - width) / 2;
		var top = (screen.availHeight - height) / 2;
		if(left < 0)
		{
			left = 0;
		}
		if(top < 0)
		{
			top = 0;
		}
		params += "left=" + left + ",top=" + top + ",";
	}
	params += "width=" + width + ",height=" + height;
	var popup = window.open(pageURL, "_blank", params + ",resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no");
	popup.focus();
}

var gPopupTitle = "";

function getPopUpTitle()
{
	return gPopupTitle;
}

var gPopUpTextHTML = "";

function getPopUpTextHTML()
{
	return gPopUpTextHTML;
}

function popupText(popUpTitle, popUpTextHTML, width, height)
{
	gPopupTitle = popUpTitle;
	gPopUpTextHTML = popUpTextHTML;
	popUpPage("../html/popuptext.htm", width, height);
}

function getVisualHTML(lessonFolder, visualName, flashParams, contentWidth, contentHeight, sTitle, sAutoPlay, sID)
{
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if(extension == "swf")
			{
				return getSWFHTML(visualName, flashParams, contentWidth, contentHeight, sTitle, false, sID, null);
			}
			else if(extension == "flv")
			{
				return getFLVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay);
			}
			else if((extension == "mpg") || (extension == "wmv"))
			{
				return getWMVorMPGHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay);
			}
			else if(extension == "mov")
			{
				return getMOVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay);
			}
			else if((extension == "rpm") || (extension == "ram"))
			{
				return getRealHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay);
			}
		}
	}
	return getImageHMTL(visualName, contentWidth, contentHeight, sTitle, null);
}

function writeVisual(visualName, flashParams, contentWidth, contentHeight)
{
	writeVisual2("", visualName, flashParams, contentWidth, contentHeight, "", "0")
}

function writeVisual2(lessonFolder, visualName, flashParams, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getVisualHTML(lessonFolder, visualName, flashParams, contentWidth, contentHeight, sTitle, sAutoPlay, null));
}

function getImageHMTL(visualName, contentWidth, contentHeight, sTitle, onClick)
{
	var sHTML = "";
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if((extension == "jpg") || (extension == "jpeg") || (extension == "png") || (extension == "gif"))
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		var params = "";
		if((contentWidth != null) && (contentWidth != 0))
		{
			params += ' width="' + contentWidth + '"';
		}
		if((contentHeight != null) && (contentHeight != 0))
		{
			params += ' height="' + contentHeight + '"';
		}
		if((sTitle != null) && (sTitle != ""))
		{
			params += ' title="' + escapeQuotes(sTitle, true) + '"';
		}
		if((onClick != null) && (onClick != ""))
		{
			params += ' onclick="' + onClick + '"';
		}
		sHTML += '<img src="' + visualName + '"' + params + '>';
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return sHTML;
}

function writeImage(visualName, contentWidth, contentHeight, sTitle, onClick)
{
	document.write(getImageHMTL(visualName, contentWidth, contentHeight, sTitle, onClick));
}

function doEmbed()
{
	return (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length);
}

function getSWFHTML(visualName, flashParams, contentWidth, contentHeight, sTitle, bAllowDistortion, sID, sCommandHandler)
{
	var sHTML = "";
	var extension = "";
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if(extension == "swf")
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		if((contentWidth == null) || (contentWidth == 0))
		{
			contentWidth = 300;
		}
		if((contentHeight == null) || (contentHeight == 0))
		{
			contentHeight = 300;
		}
		var objectparams = "";
		if((sTitle != null) && (sTitle != ""))
		{
			objectparams += ' title="' + escapeQuotes(sTitle, true) + '"';
		}
		if(flashParams == null)
		{
			flashParams = "";
		}
		if(doEmbed())
		{
			if(flashParams != "")
			{
				flashParams = ' flashvars="' + flashParams + '" ';
			}
			sHTML += '<embed src="' + visualName + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"';
			if((sID != null) && (sID != ""))
			{
				sHTML += ' id="' + sID + '"';
				sHTML += ' name="' + sID + '"';
			}
			sHTML += ' width="' + contentWidth +'" height="' + contentHeight +'" ' + flashParams + ' wmode="transparent"';
			sHTML += ' allowScriptAccess="sameDomain" swLiveConnect="true" ';
			if(bAllowDistortion)
			{
				sHTML += ' scale="exactfit"';
			}
			sHTML += '></embed>\n';
		}
		else
		{
			sHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
			if((sID != null) && (sID != ""))
			{
				sHTML += ' id="' + sID + '"';
			}
			sHTML += ' width="' + contentWidth +'" height="' + contentHeight +'"' + objectparams + '>\n';
			sHTML += '<param name="movie" value="' + visualName + '"/>\n';
			sHTML += '<param name="wmode" value="transparent"/>\n';
			sHTML += '<param name="quality" value="high"/>\n';
			sHTML += '<param name="allowScriptAccess" value="sameDomain"/>\n';
			sHTML += '<param name="swLiveConnect" value="true"/>\n';
			if(bAllowDistortion)
			{
				sHTML += '<param name="scale" value="exactfit"/>\n';
			}
			if(flashParams != "")
			{
				sHTML += '<param name="flashvars" value="' + flashParams + '"/>\n';
			}
			sHTML += '</object>\n';
		}
		if(sCommandHandler == null)
		{
			sCommandHandler = sID;
		}
		sHTML += '<script event="FSCommand(command, args)" for="' + sID + '">' + sCommandHandler + '_DoFSCommand(command, args);<\/script>';
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return sHTML;
}

function writeSWF(visualName, flashParams, contentWidth, contentHeight, sTitle, bAllowDistortion)
{
	document.writeln(getSWFHTML(visualName, flashParams, contentWidth, contentHeight, sTitle, bAllowDistortion, null, null));
}

function writeEventSWF(visualName, flashParams, contentWidth, contentHeight, sTitle, bAllowDistortion, sID, sCommandHandler)
{
	document.writeln(getSWFHTML(visualName, flashParams, contentWidth, contentHeight, sTitle, bAllowDistortion, sID, sCommandHandler));
}

function getFLVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if(extension == "flv")
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		var sURL = visualName;
		if((lessonFolder != null) && (lessonFolder != ""))
		{
			if(visualName.substring(0, 3) != "../")
			{
				sURL = "../" + lessonFolder + "/" + visualName;
			}
		}
		return getSWFHTML("../flash/mediaPlayer.swf", "movieurl=" + sURL + "&autoplay=" + sAutoPlay, contentWidth, contentHeight, sTitle, false, null, null);
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return "";
}

function writeFLV(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getFLVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay));
}

function getWMVorMPGHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	var sHTML = "";
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if((extension == "mpg") || (extension == "wmv"))
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		if((contentWidth == null) || (contentWidth == 0))
		{
			contentWidth = 300;
		}
		if((contentHeight == null) || (contentHeight == 0))
		{
			contentHeight = 300;
		}
		var objectparams = "";
		if(contentWidth > 0)
		{
			objectparams += " width=\"" + contentWidth + "\"";
		}
		if(contentHeight > 0)
		{
			objectparams += " height=\"" + contentHeight + "\"";
		}
		if((sTitle != null) && (sTitle != ""))
		{
			objectparams += ' title="' + escapeQuotes(sTitle, true) + '"';
		}
		var sbAutoStart = "false";
		if((sAutoPlay == "1") || (sAutoPlay == "true")) {
			sbAutoStart = "true";
		}
		sHTML += '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" type="application/x-oleobject" ' + objectparams + '>\n';
		sHTML += '<param name="URL" value="' + visualName + '">\n';
		sHTML += '<param name="fileName" value="' + visualName + '">\n';
		sHTML += '<param name="windowlessVideo" value="true">\n';
		sHTML += '<param name="autoStart" value="' + sbAutoStart + '">\n';
		sHTML += '<embed src="' + visualName + '" windowlessVideo="true" autoStart="' + sbAutoStart + '" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" type="application/x-mplayer2"' + objectparams + '></embed>\n';
		sHTML += '</object>\n';
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return sHTML;
}

function writeMPG(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getWMVorMPGHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay));
}

function writeWMV(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getWMVorMPGHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay));
}

function getMOVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	var sHTML = "";
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if(extension == "mov")
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		var objectparams = "";
		if(contentWidth <= 0)
		{
			if(contentHeight > 0)
			{
				contentWidth = contentHeight;
			}
			else
			{
				contentWidth = 300;
			}
		}
		if(contentHeight <= 0)
		{
			if(contentWidth > 0)
			{
				contentHeight = contentWidth;
			}
			else
			{
				contentHeight = 300;
			}
		}
		if(contentWidth > 0)
		{
			objectparams += " width=\"" + contentWidth + "\"";
		}
		if(contentHeight > 0)
		{
			objectparams += " height=\"" + contentHeight + "\"";
		}
		if((sTitle != null) && (sTitle != ""))
		{
			objectparams += ' title="' + escapeQuotes(sTitle, true) + '"';
		}
		var sbAutoPlay = "false";
		if((sAutoPlay == "1") || (sAutoPlay == "true"))
		{
			sbAutoPlay = "true";
		}
		sHTML += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"' + objectparams + '>\n';
		sHTML += '<param name="src" value="' + visualName + '">\n';
		sHTML += '<param name="AUTOPLAY" value="' + sbAutoPlay + '">\n';
		sHTML += '<param name="CONTROLLER" value="true">\n';
		sHTML += '<PARAM NAME="SCALE" VALUE="tofit">\n';
		sHTML += '<embed src="' + visualName + '" AUTOPLAY="' + sbAutoPlay + '" CONTROLLER="TRUE" scale="tofit" pluginspage="http://www.apple.com/quicktime/download/"' + objectparams + '></embed>\n';
		sHTML += '</object>\n';
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return sHTML;
}

function writeMOV(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getMOVHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay));
}

var nthReal = 0;

function getRealHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	var sHTML = "";
	var isFile = false;
	if(visualName.length > 4)
	{
		var doti = visualName.lastIndexOf(".");
		if(doti > 0)
		{
			var extension = visualName.substring(doti + 1).toLowerCase();
			if((extension == "rpm") || (extension == "ram"))
			{
				isFile = true;
			}
		}
	}
	if(isFile)
	{
		var objectparams = "";
		if(contentWidth <= 0)
		{
			if(contentHeight > 0)
			{
				contentWidth = contentHeight;
			}
			else
			{
				contentWidth = 300;
			}
		}
		if(contentHeight <= 0)
		{
			if(contentWidth > 0)
			{
				contentHeight = contentWidth;
			}
			else
			{
				contentHeight = 300;
			}
		}
		if(contentWidth > 0)
		{
			objectparams += " width=\"" + contentWidth + "\"";
		}
		if(contentHeight > 0)
		{
			objectparams += " height=\"" + contentHeight + "\"";
		}
		if((sTitle != null) && (sTitle != ""))
		{
			objectparams += ' title="' + escapeQuotes(sTitle, true) + '"';
		}
		nthReal++;
		sHTML += '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ' + objectparams + '>\n';
		sHTML += '<param name="src" value="' + visualName + '">\n';
		sHTML += '<param name="controls" value="imagewindow">\n';
		sHTML += '<param name="console" value="video' + nthReal + '">\n';
		var autostart = "false";
		if((sAutoPlay == "1") || (sAutoPlay == "true"))
		{
			autostart = "true";
		}
		sHTML += '<param name="autostart" value="' + autostart + '">\n';
		sHTML += '<embed src="' + visualName + '" controls="imagewindow" console="video' + nthReal + '" ' + objectparams + '></embed>\n';
		sHTML += '</object>\n';
		sHTML += '<br>\n';
		sHTML += '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' + contentWidth + '" height="30">\n';
		sHTML += '<param name="src" value="' + visualName + '">\n';
		sHTML += '<param name="controls" value="ControlPanel">\n';
		sHTML += '<param name="console" value="video' + nthReal + '">\n';
		sHTML += '<embed src="' + visualName + '" controls="ControlPanel" console="video' + nthReal + '" width="' + contentWidth + '" height="30"></embed>\n';
		sHTML += '</object>\n';
	}
	else if(visualName != "")
	{
		return getBoxHTML(visualName, contentWidth, contentHeight);
	}
	return sHTML;
}

function writeReal(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay)
{
	document.writeln(getRealHTML(lessonFolder, visualName, contentWidth, contentHeight, sTitle, sAutoPlay));
}

function getBoxHTML(visualName, contentWidth, contentHeight)
{
	var params = "";
	if((contentWidth == null) || (contentWidth == 0))
	{
		contentWidth = 300;
	}
	if((contentHeight == null) || (contentHeight == 0))
	{
		contentHeight = 300;
	}
	params += ' width:' + contentWidth + 'px; ';
	params += ' height:' + contentHeight + 'px; ';
	return '<table border="1" style="border-style: solid; ' + params + '"><tr><td style="vertical-align: middle; text-align: center">' + visualName + '</td></tr></table>';
}

function writePageHeading(pageHeading, sectionName, pageName)
{
	if((pageHeading != null) && (pageHeading != ""))
	{
		document.write(pageHeading);
	}
	else
	{
		if((sectionName != null) && (sectionName != "") && (sectionName != pageName))
		{
			document.write(sectionName);
			if((pageName == null) || (pageName == "")) {
				return;
			}
			document.write(': ');
		}
		document.write(pageName);
	}
}

var popDownContainerId = null;
var popDownTimer = null;
var popDownTop = 0;

function animatePopDown()
{
	if((popDownContainerId != null) && (popDownContainerId != ""))
	{
		var popDownContainerElem = document.getElementById(popDownContainerId);
		if(popDownContainerElem != null)
		{
			popDownContainerElem.style.display = "inline";
			popDownTop = - popDownContainerElem.offsetHeight;
			dropinPopDown();
		}
	}
}

function dropinPopDown()
{
	if(popDownTop < 0)
	{
		var popDownContainerElem = document.getElementById(popDownContainerId);
		if(popDownContainerElem != null)
		{
			popDownTop += 2;
			popDownContainerElem.style.top = popDownTop + "px";
			popDownTimer = setTimeout("dropinPopDown()", 10);
		}
	}
	else
	{
		clearTimeout(popDownTimer);
	}
}

function closePopDown()
{
	var popDownContainerElem = document.getElementById(popDownContainerId);
	if(popDownContainerElem != null)
	{
		popDownContainerElem.style.display = "none";
	}
}

function writePopDown(sTitle, sHTML, sClose)
{
	if((sTitle != "") && (sTitle != "{Pop Down Title}"))
	{
		document.write('<div id="popDownContainer" class="popDownContainer" style="position:absolute; z-index: 9000; display:none; left:200px; top:0px; width:500px;">');
		document.write('<div class="popDownTitle">');
		document.write(sTitle);
		document.write('</div><br><br><div class="popDownText">');
		document.write(sHTML);
		document.write('</div>');
		document.write('<div align="right"><a href="#" class="popDownLink" onClick="closePopDown(); return false;">' + sClose + ' </a></div>');
		document.writeln('</div>');
		popDownContainerId = "popDownContainer";
	}
}

function getOffsetLeft(elem)
{
	var left = 0;
	while(elem != null)
	{
		left += elem.offsetLeft;
		elem = elem.offsetParent;
	}
	return left;
}

function writeGlossaryTermContainer()
{
	document.writeln('<div id="glossaryTermContainer" class="glossaryItemContainer" style="display:none; position:absolute; z-index:1; overflow: hidden"></div>');
}

var animateHeight = 2;
var glossaryWindowHeight = 200;
var glossaryTimer = null;

function showGlossaryTerm(sTerm, sDefinition, termAnchorElem)
{
	var glossaryTermContainerElem = document.getElementById("glossaryTermContainer");
	if(glossaryTermContainerElem != null)
	{
		if((sDefinition.length < 100) && (sDefinition.toLowerCase().indexOf("<br>") < 0))
		{
			glossaryWindowHeight = 100;
		}
		else if(sDefinition.length > 600)
		{
			glossaryWindowHeight = 400;
		}
		else if(sDefinition.length > 400)
		{
			glossaryWindowHeight = 300;
		}
		else
		{
			glossaryWindowHeight = 200;
		}
		glossaryTermContainerElem.style.width = "300px";
		animateHeight = 2;
		glossaryTermContainerElem.style.height = animateHeight + "px";
		glossaryTermContainerElem.style.top = glossaryTermContainerElem.parentNode.scrollTop + parent.getAvailHeight() + "px";
		var termLeft = getOffsetLeft(termAnchorElem);
		if(termLeft > 325)
		{
			glossaryTermContainerElem.style.left = "0px";
		}
		else
		{
			glossaryTermContainerElem.style.left = "375px";
		}
		glossaryTermContainerElem.style.display = "inline";
		glossaryTermContainerElem.innerHTML = '<table border="0"><tr><td class="glossaryTerm">' + sTerm + ':</td></tr><tr><td class="glossaryDefinition">' + sDefinition + '</td></tr></table>';
		annimateGlossaryTerm();
	}
}

function annimateGlossaryTerm()
{
	if(animateHeight <= glossaryWindowHeight)
	{
		var glossaryTermContainerElem = document.getElementById("glossaryTermContainer");
		glossaryTermContainerElem.style.top = glossaryTermContainerElem.parentNode.scrollTop + parent.getAvailHeight() - animateHeight + "px";
		glossaryTermContainerElem.style.height = animateHeight + "px";
		animateHeight += 2;
		glossaryTimer = setTimeout("annimateGlossaryTerm()", 10);
	}
	else
	{
		clearTimeout(glossaryTimer);
	}
}

function closeGlossaryTerm()
{
	clearTimeout(glossaryTimer);
	var glossaryTermContainerElem = document.getElementById("glossaryTermContainer");
	if(glossaryTermContainerElem != null)
	{
		glossaryTermContainerElem.style.display = "none";
	}
}

function writeStickyNote(left, top, sNoteHTML, sCloseText)
{
	document.write('<div id="stickyNoteContainer" class="stickyNote" style="visibility:hidden; position:absolute; z-index: 10000; left: ' + left + '; top: ' + top + 'px; width: 300px;">');
	document.write(sNoteHTML);
	document.write('<div align="right"><a class="stickyNoteLink" href="#" onClick="hideStickyNote();return false;">' + sCloseText + '</a></div></div>');
}

function animateStickyNote(millisecs)
{
	var elem = document.getElementById("stickyNoteContainer");
	if(elem != null)
	{
		if(elem.filters)
		{
			elem.filters[0].Apply();
			elem.filters[0].Play();
		}
		elem.style.visibility = "visible";
		setTimeout('hideStickyNote()', millisecs);
	}
}

function hideStickyNote()
{
	var elem = document.getElementById("stickyNoteContainer");
	if(elem != null)
	{
		elem.style.display = "none";
	}
}

function writeButtonToPlayAudioHTML(lessonFolder, audioFileURL)
{
	var soundurl = audioFileURL;
	if((lessonFolder != null) && (lessonFolder != ""))
	{
		if(audioFileURL.substring(0, 3) != "../")
		{
			soundurl = "../" + lessonFolder + "/" + audioFileURL;
		}
	}
	var flashParams = "soundurl=" + soundurl;
	writeSWF("../flash/playaudiobtn.swf", flashParams, "40", "38", null, false);
}

function preloadImage(sImage)
{
	if(document.images)
	{
		if(document.preloadImagesArray == null)
		{
			document.preloadImagesArray = new Array();
		}
		var oImage = new Image;
		oImage.src = sImage;
		document.preloadImagesArray[document.preloadImagesArray.length] = oImage;
	}
}

function writeClassButtonHTML(sID, sStyles, sOnClick, sButtonNormalClass, sButtonDownClass, sButtonHoverClass)
{
	var sHTML = '<button type="button"';
	if(sID != null)
	{
		sHTML += ' id="';
		sHTML += sID;
		sHTML += '"';
	}
	if(sStyles != null)
	{
		sHTML += ' style="';
		sHTML += sStyles;
		sHTML += '"';
	}
	sHTML += ' onclick="';
	sHTML += sOnClick;
	sHTML += '" class="';
	sHTML += sButtonNormalClass;
	sHTML += '" onMouseDown="javascript:this.className=';
	sHTML += "'" + sButtonDownClass + "';";
	sHTML += '" onMouseOver="javascript:this.className=';
	sHTML += "'" + sButtonHoverClass + "'; return true;";
	sHTML += '" onMouseOut="javascript:this.className=';
	sHTML += "'" + sButtonNormalClass + "'; return true;";
	sHTML += '"></button>';
	document.writeln(sHTML);
}

function writeButtonToPopUpTextHTML(popUpTitleVariableName, popUpTextHTMLVariableName, width, height)
{
	preloadImage("../timages/popuptexthover.jpg");
	preloadImage("../timages/popuptextdown.jpg");
	var sOnClick = "popupText(" + popUpTitleVariableName + ", " + popUpTextHTMLVariableName + ", " + width + "," + height + ")";
	writeClassButtonHTML(null, null, sOnClick, "audioTextButtonNormal", "audioTextButtonDown", "audioTextButtonHover");
}
