//* template19 is the Vocabulary Exploration avtivity in the kids product.
var gIndex;
var dataStr = "";
function posFeedback(setEnergy)
{
/*	var state = asfGetPlayState();
	var curpos = asfGetCurrentPosition();
	var duration = asfGetDuration();
	dataStr += state + "," + curpos + "," + duration + "/";
*/	if (asfIsPlaying()) {
		timer = setTimeout ('posFeedback(' + setEnergy + ')', 100);
	} else {
//	alert(dataStr);
//	dataStr = "";
		document.flash.SetVariable("_level3:setEnergy", setEnergy);
		document.flash.TCallLabel("_level3","audioDone");
		gIndex = null;
	}
}

function stopSound()
{
	asfStop();
}
function playVocabSound(indexStr)
{
	var setEnergy;
	var indexAr = indexStr.split(",");
	var index = parseInt(indexAr[0]);	
	if (gIndex != index) {
		gIndex = index;
		playSound(Obj.Set[0].WordObj[index].Phrase.Aud);
		if (indexAr.length == 1)
			setEnergy = false;
		else
			setEnergy = true;;
		timer = setTimeout ('posFeedback(' + setEnergy + ')', 500);
	}
}

//* required for all templates
//* used by checkanswers.js

function initPage()
{
	initTemplate();
}

function exitPage()
{
	;
}

function drawContent(w)
{
	var s = "";
	var wordStr = "";
	for (var i = 0; i < Obj.Set.length; i++) {
		var sets = Obj.Set[i];
		for (var j = 0; j < sets.WordObj.length; j++) {
			wordStr += sets.WordObj[j].Phrase.Txt;
			if (j < sets.WordObj.length - 1)
				wordStr += "|";
		}
		if (i < Obj.Set.length - 1)
			wordStr += "*";
	}
	varStr = "&wordObjText=" + wordStr + "&numSets=" + Obj.Set.length + "&templateShared=flashtemplates/vocabex/vocabex_shared.swf&intro=flashtemplates/vocabex/vocabex_intro.swf";
	s += drawKidsActivityFlash(Ini.FlashPath + Obj.MainFlash, varStr);

	return (s);
}