var theHelpChoiceDiv = null;
function showHelpChoice() {
	if (!theHelpChoiceDiv) {
	theHelpChoiceDiv = document.createElement('div');
	theHelpChoiceDiv.style.width = "120px";
	theHelpChoiceDiv.style.border = "1px solid #ccc";
	theHelpChoiceDiv.style.padding = "2px";
	theHelpChoiceDiv.style.position = "absolute";
	theHelpChoiceDiv.style.backgroundColor = "white";
	theHelpChoiceDiv.style.zIndex = "99999";
	theHelpChoiceDiv.id = "helpChoice";
	thepos = findPos(document.getElementById('showhelp'));
	theHelpChoiceDiv.style.left = thepos.left + 2 + 'px';
	theHelpChoiceDiv.style.top = thepos.top + document.getElementById('showhelp').offsetHeight + 2 + 'px';
	theHelpChoiceDiv.innerHTML = '<ul><li><a href="javascript:showHelp()">do this activity</a></li><li><a href="javascript:showHelpNav()">navigate</a></li></ul>';
	document.body.appendChild(theHelpChoiceDiv);
	} else {
	document.body.removeChild(document.getElementById('helpChoice'));
	theHelpChoiceDiv = null;
	}
}

function showHelpNav() {
	helpDiv = document.getElementById('help_content');	
	Helpfile = '/training/navigating_a_lesson_non-specific.flv';
	createPlayer('help_content','mediaspace1','player1',Helpfile,'true');
	document.getElementById('help_div').style.display = 'block';

}

function showHelp() {
	helpDiv = document.getElementById('help_content');	
	Helpfile = '/'+HelpType + '.flv';
	createPlayer('help_content','mediaspace1','player1',Helpfile,'true');
	document.getElementById('help_div').style.display = 'block';

}
var oldWrapper = null;
var oldCode;


function removeOldPlayer(theOldWrapper, theOldCode) { 
	document.getElementById(theOldWrapper).innerHTML = theOldCode;
}
function createPlayer(theWrapper, thePlaceholder, thePlayer, theFile, theStart) { 
	if (oldWrapper != null) { removeOldPlayer(oldWrapper, oldCode); }

	oldWrapper = theWrapper; 
	oldCode = document.getElementById(oldWrapper).innerHTML; 
	s1 = new SWFObject("/jw/player.swf", thePlayer, "556", "345", "9", '#ffffff');
	  s1.addParam('allowfullscreen','true');
	  s1.addParam('allowscriptaccess','always');
	  s1.addParam('wmode','opaque');
	  s1.addParam('flashvars','file='+theFile+'&autostart=true');
	  s1.write(thePlaceholder);
}
function closeHelp() {
if (oldWrapper != null) { removeOldPlayer(oldWrapper, oldCode); oldWrapper = null;}
document.getElementById('help_div').style.display = 'none';
document.body.removeChild(document.getElementById('helpChoice'));
theHelpChoiceDiv = null;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);
	}
	return {left: curleft, top: curtop};
}


