function OnInitialize(tntCtrlID)
{	
	tntCtrl = element(tntCtrlID);
	var ttInstallTag = element('TTInstallTag');
	if (ttInstallTag)
	{
		ttInstallTag.innerHTML = '';
	}
	doTNTCommand('Downloader().SetDownloadText("Loading Interactive Seating Plan...").ShowProgressBar(1)');
	var eventCount = doTNTCommand('EventManager().GetEventCount()');
	for (var eIdx=1; eIdx<eventCount; eIdx++)
	{
		var eventName = doTNTCommand('EventManager().GetEventName('+eIdx+')');
		if (eval("typeof("+eventName+")") == 'function')
		{
			doTNTCommand('EventManager().SetEventEnabled('+eIdx+',1)');
		}
	}
	doTNTCommand('Viewer().LoadScene("'+tntSource+'")');
	setTNTFocus();
	debugOut('OnInitialize("'+tntCtrlID+'")');
	 
}

function OnSceneLoad(fileName)
{
	debugOut('OnSceneLoad("'+fileName+'")');
	doTNTCommand('Mesh("*").SetMaterialSpecularColor(#000000).Viewport(0).SetViewportMinLight(#303030).SetViewportMaxLight(#FFFFFF)');
	setTNTFocus();
	document.forms.form.blockSelect.disabled = false;
	
	/* Enable mouse over events for seats */
	//doTNTCommand('Node("REF_*").SetMeshOcclusion(1)');
	//doTNTCommand('Node("REF_*").SetMeshMouseOverEvent(1)');		
}

function OnFileDownloadComplete(fileName,status)
{
	debugOut('OnFileDownloadComplete("'+fileName+','+status+'")');
}

function OnExternalResourceMerge(uniqueNodeName, nodeIndex, fileName)
{
	debugOut('OnExternalResourceMerge("'+uniqueNodeName+'",'+nodeIndex+',"'+fileName+'")');
}

function OnLODMerge(uniqueNodeName, nodeIndex, fileName)
{
	debugOut('OnLODMerge("'+uniqueNodeName+'",'+nodeIndex+',"'+fileName+'")');
}

var mouseKeyPressed = 0;

function OnMouseKeyPress(keyIndex)
{   
	debugOut('OnMouseKeyPress('+keyIndex+')');
	mouseKeyPressed = 1;
}

function OnMouseKeyRelease(keyIndex)
{
	debugOut('OnMouseKeyRelease('+keyIndex+')');
	mouseKeyPressed = 0;
	debugOut('mouseOver: '+mouseOver);
	if (mouseOver)
	{
		doTNTCommand('CursorIconHandler().SetCursorIconMode(1)');
		//g_Dest_Seat = mouseOver;
		//GoToSeat("NA","NA","NA");		
	}
}
function OnKeyPress(keyIndex)
{
	debugOut('OnKeyPress('+keyIndex+')');
}

function OnKeyRelease(keyIndex)
{
	debugOut('OnKeyRelease('+keyIndex+')');
}

var mouseOver = '';

function OnMouseEnter(nodeName, nodeIndex)
{
	mouseOver = nodeName;
	debugOut('OnMouseEnter("'+nodeName+'",'+nodeIndex+')');
}

function OnMouseExit(nodeName, nodeIndex)
{
	mouseOver = '';
	debugOut('OnMouseExit("'+nodeName+'",'+nodeIndex+')');
}

function OnScriptError(debugText)
{
	debugOut('OnScriptError("'+debugText+'")');
}

function OnError(fileName,status)
{
	debugOut('OnError("'+fileName+'",'+status+')');
}

