var oiPlayer = false;
var iiPlayer = false;
var oiQueueFile = false;
var oiQueueType = false;
var oiQueuePreview = false;
function onYouTubePlayerReady( playerId) {
	if (playerId == 'oiPlayerID') {
		oiPlayer = document.getElementById(playerId);
	} else {
		iiPlayer = document.getElementById(playerId);
	}
}
function playerReady(thePlayer) {
	if (thePlayer.id == 'oiPlayerID') {
		oiPlayer = window.document[thePlayer.id];
		oiPlayer.sendEvent('MUTE',true);
		if (oiQueueFile) {
			oiPlayVideo( oiQueueFile, oiQueueType, oiQueuePreview);
			oiQueueFile = false;
			oiQueueType = false;
			oiQueuePreview = false;
		}
	} else {
		iiPlayer = window.document[thePlayer.id];
		iiPlayer.sendEvent('MUTE',true);
	}
}
function oiPlayVideo( thefile, thetype, thepreview) {
	window.scrollTo(0,0);
	if (oiPlayer) {
		if (!thetype) thetype = 'video';
		oiPlayer.sendEvent('LOAD',{file:thefile, type:thetype, image:thepreview});
	} else {
		oiQueueFile = thefile;
		oiQueueType = thetype;
		oiQueuePreview = thepreview;
	}
}
function iiPlayVideo( theYTId) {
	if (iiPlayer) {
		iiPlayer.loadVideoById( theYTId);
	} else { alert('not ready'); }
}
function oiCueVideo( theID) {
}
function oiGenHTML( theKeyword, theVideoID, theVideoType, theEntryID, theTopicID, theTopicTitle, thePreview) {
	txt = '<table border=1 cellpadding=5 cellspacing=0 width="100%"><tr>';
	if (theVideoID) {
		txt = txt + '<td width="100" align="center" valign="bottom"><a href="javascript:oiPlayVideo( \'' + theVideoID + '\', \'' + theVideoType + '\', \'' + thePreview + '\');" onclick="nd(0);"><img src="images/animInterpret.gif" width="80" height="80" alt="" border="0"><BR CLEAR=ALL>interpret</a></td>';
	}
	if (theEntryID) {
		txt = txt + '<td width="100" align="center" valign="bottom"><a href="dictionarydetail.php?prmEntryID=' + theEntryID + '" target="_top"><img src="images/animMeaning.gif" width="80" height="80" alt="" border="0"><BR CLEAR=ALL>full definition</a></td>';
	}
	if (theTopicID) {
		txt = txt + '<td width="100" align="center" valign="bottom"><a href="topicdetail.php?prmTopicID=' + theTopicID + '" target="_top">related topic: ' + theTopicTitle + '</a></td>';
	} 
	txt = txt + '</tr></table>';
	return txt;
}
function doMouseOver( theKeyword, theVideoID, thePlayerType, theEntryID, theTopicID, theTopicTitle, thePreview) {
	sizecnt = 0;
	if (theVideoID) sizecnt = 100;
	if (theEntryID) sizecnt = sizecnt + 100;
	if (theTopicID) sizecnt = sizecnt + 100;
	return overlib( oiGenHTML( theKeyword, theVideoID, thePlayerType, theEntryID, theTopicID, theTopicTitle, thePreview), CSSSTYLE, NOCLOSE, HAUTO, VAUTO, WIDTH, sizecnt, STATUS, 'Click on option in the box for more information and/or a translation.');
}