/******************************************************************************/
/* D'Fusion Web JavaScript Library                                            */
/*                                                                            */
/* IMPORTANT REMARKS:                                                         */
/*   - To use this file you have to include totalimmersion_dfusion_web.js     */
/******************************************************************************/

function ExecuteCommand(command)
{
	if (document.embeds && document.embeds[g_tiPluginName]) {
		if (document.embeds[g_tiPluginName].ExecuteCommand) {	
			document.embeds[g_tiPluginName].ExecuteCommand(command);
			return true;
		} else {
			alert("Cannot find 'ExecuteCommand' function.\nPlease restart your web browser and retry to play the D'Fusion application.");
			return false;
		}
	} 
	
	if (document.getElementById) {
		document.getElementById(g_tiPluginName).excecuteCommand(command);
		return true;
	}
	
	return false;
}

function CreateOptions()
{    
		var SelectFormHtml = "";
		var options="";
		
		for (var i = 0; i < arguments.length; i++) 
		{
			options+= "<option value=\"" + arguments[i] + "\">" + arguments[i] + "</option>";
		
		}
		
		SelectFormHtml += "<div id=\"ChooseCamera\ align=\"center\">";
		SelectFormHtml += "<SELECT NAME=\"CAMERAS\" ID=\"CAMERAS\">";
		SelectFormHtml += options;
		SelectFormHtml += "</SELECT>";
		SelectFormHtml += "<input type=button value=\"camera selected\" onclick=\"CamSelected(document.getElementById('CAMERAS').options[(document.getElementById('CAMERAS').selectedIndex)].value)\" />";
		SelectFormHtml += "<font color=\"red\" face=\"arial\"><b> &nbsp;&nbsp;&nbsp;&nbsp; Please select one of the cameras listed  </b></font> ";
		SelectFormHtml += "</div>";
		
		var temp = document.getElementById("InteractionCell");
		try
		{
			temp.innerHTML = SelectFormHtml;
			
		}
		catch(ex)
		{
			alert("error");
		}
}


function CamSelected(camname)
{
	document.getElementById("InteractionCell").innerHTML = "";
	ExecuteCommand("CamSelected '"+camname+"'");
}
function goFullScreen()
{
	ExecuteCommand("GoFullScreen");
}

function MakeKeystrokeActions()
{
	for (var i = 0; i < arguments.length; i++) 
	{
		ExecuteCommand("PLAYWITHKEY '"+arguments[i]+"'");
	}
}
//-- end of file --