// disable all webcam div commond such as:
//change the size of tnt, all tnts

function MM_reloadPage(init) 
{  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) 
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

		var ie4 = (document.all && !document.getElementById);
		var ie5 = (document.all && document.getElementById);
		var ns6 = (!document.all && document.getElementById);
		
		function element(id)
		{
			if(ie4)	// Explorer 4
				return document.all[id];
			else	// Explorer 5+ Netscape 6+ and Mozilla and Firefox
				return document.getElementById(id);
		}
		
		function initTurnTool()
		{
			var tntWidth 			= 600; //606; //640;
			var tntHeight 			= 420; //455;  //480;
			var tntFilename 		= "steelworks.t2l";
			var tntColor 			= "#000000";
			var tntTransparent 		= 0;
			
			var tntInstalled 		= isTurnToolInstalled();
			if (tntInstalled==false)
			{
				createTurnTool(tntWidth,tntHeight,tntFilename,tntColor,tntTransparent,true);
				checkRefresh();
			}
			else
			{
				createTurnTool(tntWidth,tntHeight,tntFilename,tntColor,tntTransparent,false);
			}
			createFlash(158,420,"flash_1.swf","myFlashmap");
		}
		
		function isTurnToolInstalled()
		{
			var tntInstalled = false;
			if(ie4||ie5)
			{
				try
				{
					var xObj = new ActiveXObject("TNT.TNTCtrl");
					if (xObj)
						tntInstalled = true;
				}
				catch (e){}
			}
			else
			{
				if(navigator.plugins.namedItem("TurnTool XPCOM Plugin"))
					tntInstalled = true;
			}
			return tntInstalled;
		}
		
		function installTurnTool()
		{
			if(ie4||ie5)
				window.location.href = "http://www.true2life.co.uk/files/OfflineInstall.exe";
			else
			{
				var xpi = {'True2life Viewer Installation':'http://www.true2life.co.uk/files/ViewerInstall.xpi'};
				InstallTrigger.install(xpi,installFinish);
			}
		}
		
		function installFinish(url, result)
		{
			window.location.href = window.location;
		}
		
		var checkCounter = 0;
		function checkRefresh()
		{
			var tntInstalled = isTurnToolInstalled();
			if(tntInstalled==false)
			{
				checkCounter++;
				if (checkCounter==120)
				{
					//checkCounter=0;
					installTurnTool();
				}
				setTimeout('checkRefresh()',500);
			}
			else
				window.location.href = window.location;
		}
		
		function TNTDoCommand(string)
		{
			var control = element("TNTCtrl");
			if(control && control.ready)
				return control.TNTDoCommand(string);
			return "";
		}
		
		function setFocus()
		{
			if (!ns6)
				element("TNTCtrl").focus();
		}
		
		function doCommand()
		{
			var retval = TNTDoCommand( element("doCommandEdit").value );
			if(retval)
				element("returnval").innerHTML = 'Return Value = "' + retval + '"';
			else
				element("returnval").innerHTML = "";
		}
		
		function onDoCommandKeypress()
		{
			if(window.event.keyCode==13) // if return key was pressed
				doCommand();
		}


var CurrentT2L = "";
var TTOnReady = 0;
var TTZoneEnter = 0;
var IntroLoopMode = 0;
var IntroLoopTimer;

function OnReady()
{
	setFocus();
	window.status = "True2Life Resource Ready";	
	clearTimeout(MapTimer);
	
	TTOnReady = 1;
}



function OnReady_Listener()
{
	if (TTOnReady == 1)
	{
		TTOnReady=0;
		
		if (CurrentT2L=="steelworks.t2l")
		{
			show(mapname);
			hide('Sponsors');
			hide('Processes');
			hide('menu');
			
			//if (ie4||ie5)
			//{
				UpdateMap();
			//}
			
			if (FreshStart==1)
			{
				MapDisplacementVar = 0;
				MapDisplacementVar_phys = 100000;
				StartAnimationSequence();
			}
			else // came back from building interior
			{
				FreshStart=1;
				// Global looping animations
		
				LoopingAnimations();
				GotoArea(NextArea);
			}
			if (IntroLoopMode==1)
			{
				IntroLoopTimer = setTimeout("OnZoneEnter('Zone_primary')",118500);
			}


		}
		if (CurrentT2L=="steelworks_interior.t2l")
		{
				
			//TNTDoCommand('Objects(*).StopAnimation()');
			//TNTDoCommand('Objects(*).PlayAnimation(0,4000,true,30)');
			//TNTDoCommand('Objects(Pop_finish).SetVisible(true)');
			TNTDoCommand('Objects(Sphere01).SetEnable(false)');
			//TNTDoCommand('CameraCtrl.SetCurrent("intro_cam_1")');
			IntMapObject = "intro_cam_1";
			IntMapRotObject = "intro_cam_1";
			
			//if (ie4||ie5)
			//{
				UpdateMapInt();
			//}
			TNTDoCommand('Objects(*).PlayAnimation(0,4000,true,30)');
			StartInteriorAnimationSequence();

			if (IntroLoopMode==1)
			{
				IntroLoopTimer = setTimeout("OnZoneEnter('Zone_Exit01')",123000);

			}
		}
		if (CurrentT2L=="steelworks_hotmill.t2l")
		{
			TNTDoCommand('Objects(Sphere01).SetPhysicsGripThreshold(999)');
						//TNTDoCommand('Objects(Sphere01).SetPhysicsMoveSpeed(5688)');

			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			hide('menu');
			//show('webcams');
			show(mapname);                //if not already showing
			show('click_exterior3');
			//TNTDoCommand('Objects(Sphere01).SetEnable(false)');
			TNTDoCommand('Objects(*).PlayAnimation(0,5500,true,30)');
			StartHotmillAnimationSequence();
			MillMapObject = "Sphere01";
			MillMapRotObject = "Sphere01";
			//if (ie4||ie5)
			//{
				UpdateMapHotmill();
			//}

		}
	}
	setTimeout ("OnReady_Listener()",500);
}

function saveImage()
{
	alert('A screenshot will now be saved on the desktop entitled ScreenShot.bmp')
	TNTDoCommand('Renderer.SaveImage("ScreenShot.bmp",0)')
}

function cleartime()
{
	clearTimeout(IntroTimer1);
	clearTimeout(IntroTimer2);
	clearTimeout(IntroTimer3);
	clearTimeout(IntroTimer3b);
	clearTimeout(IntroTimer4);
	clearTimeout(IntroTimer5);
	clearTimeout(IntroTimer6);
	clearTimeout(IntroTimer7);
	clearTimeout(IntroTimerx);
	
	clearTimeout(AnimationTimer1);
	clearTimeout(AnimationTimer2);
	clearTimeout(AnimationTimer3);
	clearTimeout(AnimationTimer4);
	clearTimeout(AnimationTimer5);
	clearTimeout(AnimationTimer6);
	clearTimeout(AnimationTimer7);
	clearTimeout(AnimationTimer8);
	clearTimeout(AnimationTimer9);
	clearTimeout(AnimationTimer10);
	clearTimeout(AnimationTimer11);
	clearTimeout(AnimationTimer12);
	clearTimeout(AnimationTimer13);
	clearTimeout(IntroLoopTimer);

}

function StartHotmillAnimationSequence()
{
	TNTDoCommand('Objects("Sphere01").SetEnable(false)');
	
	
	cleartime();
	clearTimeout(IntroTimer1);
	clearTimeout(IntroTimer2);
	clearTimeout(IntroTimer3);
	clearTimeout(IntroTimer3b);
	clearTimeout(IntroTimer4);
	clearTimeout(IntroTimer5);
	clearTimeout(IntroTimer6);
	clearTimeout(IntroTimer7);
	clearTimeout(IntroTimerx);
	
	TNTDoCommand('Objects(Pop_start).SetVisible(true)');
	TNTDoCommand('Objects(Popup_0).SetVisible(true)');
	TNTDoCommand('Objects(Popup_9).SetVisible(false)');
	IntroTimer1 = setTimeout("TNTDoCommand('Objects(Pop_start).SetVisible(false)');",5000);
	IntroTimerx = setTimeout("TNTDoCommand('Objects(Popup_0).SetVisible(false)');",10000);
	
	IntroTimer2 = setTimeout("TNTDoCommand('Objects(CameraClip01).PlayAnimation(0,500,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip01\")');MillMapObject=\"CameraClip01\";MillMapRotObject=\"CameraClip01\";",2);
	
	IntroTimer3 = setTimeout("TNTDoCommand('Objects(CameraClip02).PlayAnimation(500,1030,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip02\")');MillMapObject=\"CameraClip02\";MillMapRotObject=\"CameraClip02\";",16666);
	
	IntroTimer4 = setTimeout("TNTDoCommand('Objects(CameraClip03).PlayAnimation(1030,2259,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip03\")');MillMapObject=\"CameraClip03\";MillMapRotObject=\"CameraClip03\";",34333);	
	
	IntroTimer5 = setTimeout("TNTDoCommand('Objects(CameraClip04).PlayAnimation(2100,2768,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip04\")');MillMapObject=\"CameraClip04\";MillMapRotObject=\"CameraClip04\";",70100);
	
	IntroTimer6 = setTimeout("TNTDoCommand('Objects(CameraClip05).PlayAnimation(2790,3680,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip05\")');MillMapObject=\"CameraClip05\";MillMapRotObject=\"CameraClip05\";",93333);
	
	IntroTimer7 = setTimeout("TNTDoCommand('Objects(CameraClip06).PlayAnimation(3680,5500,false,30)'); TNTDoCommand('CameraCtrl.SetCurrent(\"CameraClip06\")');MillMapObject=\"CameraClip06\";MillMapRotObject=\"CameraClip06\";",123333);
	
	//setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"Camera02\")');",180000);
	IntroTimer3b = setTimeout("Walk();",180000);
	
}

var FreshStart = 1;
var NextArea = 0;
var steelplanttimer1;
var steelplanttimer2;

var IntroTimer1;
var IntroTimer2;
var IntroTimer3;
var IntroTimer3b;
var IntroTimer4;
var IntroTimer5;
var IntroTimerx;
var IntroTimer6;
var IntroTimer7;
var camera_name = "";

function StartInteriorAnimationSequence()
{
	
	cleartime();
	clearTimeout(IntroTimer1);
	clearTimeout(IntroTimer2);
	clearTimeout(IntroTimer3);
	clearTimeout(IntroTimer3b);
	clearTimeout(IntroTimer4);
	clearTimeout(IntroTimer5);
	clearTimeout(IntroTimer6);
	clearTimeout(IntroTimer7);
	clearTimeout(IntroTimerx);

	IntroTimer1 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_2\")');IntMapObject=\"intro_cam_2\";IntMapRotObject=\"intro_cam_2\";",13000);  //camera2
	IntroTimer2 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_3\")');IntMapObject=\"intro_cam_3\";IntMapRotObject=\"intro_cam_3\";",18000);  //camera3
	IntroTimer3 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_4\")');IntMapObject=\"intro_cam_4\";IntMapRotObject=\"intro_cam_4\";",41000);  //camera4
	IntroTimer3b = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_3\")');IntMapObject=\"intro_cam_3\";IntMapRotObject=\"intro_cam_3\";",51200);  //camera3
	IntroTimer4 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_5\")');IntMapObject=\"intro_cam_5\";IntMapRotObject=\"intro_cam_5\";",62000);  //camera5
	IntroTimerx = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_x\")');IntMapObject=\"intro_cam_x\";IntMapRotObject=\"intro_cam_x\";",83600);  //camerax
	IntroTimer5 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_6\")');IntMapObject=\"intro_cam_6\";IntMapRotObject=\"intro_cam_6\";",107000);  //camera6
	IntroTimer6 = setTimeout("TNTDoCommand('CameraCtrl.SetCurrent(\"intro_cam_7\")');IntMapObject=\"intro_cam_7\";IntMapRotObject=\"intro_cam_7\";",115000);  //camera7
	IntroTimer7 = setTimeout("HoldFinalSign()",2000);
}

function HoldFinalSign()
{
	TNTDoCommand('Objects(Pop_finish).StopAnimation()');
}

function SteelPlantRepeatAnimation()
{
	if(TNTDoCommand('Objects(*).GetStopFrame()')!=750)
	{
		TNTDoCommand('Objects(*).PlayAnimation(0,750,false,30)');
	}
	else
	{
		TNTDoCommand('Objects(*).PlayAnimation(750,0,false,30)');
	}
	TNTDoCommand('CameraCtrl.SetCurrent("Camera04",2000)');
	TNTDoCommand('Objects(*).SetFrame(0)');
	
}

var AnimationTimer1;
var AnimationTimer2;
var AnimationTimer3;
var AnimationTimer4;
var AnimationTimer5;
var AnimationTimer6;
var AnimationTimer7;
var AnimationTimer8;
var AnimationTimer9;
var AnimationTimer10;
var AnimationTimer11;
var AnimationTimer12;
var AnimationTimer13;


function StartAnimationSequence()
{
	TNTDoCommand('Objects(Sphere01).SetEnable(false)');
	TNTDoCommand('CameraCtrl.SetCurrent("Camera02")');
	
	TNTDoCommand('Objects(Box01_boat).PlayAnimation(0,399,false,30)');//boat
	TNTDoCommand('Objects(Camera02).PlayAnimation(0,3612,false,30)');
	TNTDoCommand('Objects(Pop_start).PlayAnimation(0,152,false,30)');
	TNTDoCommand('Objects(Popup1_*).PlayAnimation(0,3612,false,30)');

// Global looping animations

	LoopingAnimations();
	 
// Timed animations	
	cleartime();
	clearTimeout(AnimationTimer1);
	clearTimeout(AnimationTimer2);
	clearTimeout(AnimationTimer3);
	clearTimeout(AnimationTimer4);
	clearTimeout(AnimationTimer5);
	clearTimeout(AnimationTimer6);
	clearTimeout(AnimationTimer7);
	clearTimeout(AnimationTimer8);
	clearTimeout(AnimationTimer9);
	clearTimeout(AnimationTimer10);
	clearTimeout(AnimationTimer11);
	clearTimeout(AnimationTimer12);
	clearTimeout(AnimationTimer13);

	/*AnimationTimer6 = setTimeout("TNTDoCommand('Objects(Popup1_06).PlayAnimation(0,100,false,25)');",9000);  //ship to shore
	AnimationTimer7 = setTimeout("TNTDoCommand('Objects(Popup1_00).PlayAnimation(0,100,false,25)');",42000);  //coal
	AnimationTimer8 = setTimeout("TNTDoCommand('Objects(Popup1_01).PlayAnimation(0,100,false,25)');",54000);  //coke ovens
	AnimationTimer9 = setTimeout("TNTDoCommand('Objects(Popup1_05).PlayAnimation(0,100,false,25)');",66000);  //iron ore
	AnimationTimer1 = setTimeout("TNTDoCommand('Objects(Popup1_08).PlayAnimation(0,100,false,25)');",80000);  //hot mill
	AnimationTimer10 = setTimeout("TNTDoCommand('Objects(Popup1_02).PlayAnimation(0,100,false,25)');",88000); //sinter plant
	AnimationTimer11 = setTimeout("TNTDoCommand('Objects(Popup1_03).PlayAnimation(0,100,false,25)');",98000); //blast furnace
	AnimationTimer2 = setTimeout("TNTDoCommand('Objects(truck).PlayAnimation(0,1000,false,25)');",95000);//truck
	AnimationTimer13 = setTimeout("TNTDoCommand('Objects(Popup1_07).PlayAnimation(0,100,false,25)');",106000); //r&d
	AnimationTimer12 = setTimeout("TNTDoCommand('Objects(Popup1_04).PlayAnimation(0,100,false,25)');",116000); //primary steel*/
	//AnimationTimer5 = setTimeout("StartAnimationSequence();",120000);
	AnimationTimer5 = setTimeout("Walk();",120000);
}

function LoopingAnimations()
{
	
// Global looping animations

	//non-looping but required
	TNTDoCommand('Objects(Box01_boat).PlayAnimation(0,399,false,30)');//boat
	
	//labels
	TNTDoCommand('Objects(walk_inside*).PlayAnimation(0,200,true,300)');
	//crane
	TNTDoCommand('SceneGraph.ObjectTree([Crane]).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Iron_anim09).PlayAnimation(0,3499,true,30)');
    TNTDoCommand('SceneGraph.ObjectTree([TrainA02]).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(outdoor01).PlayAnimation(0,3499,true,30)');
	//reclaimers
	TNTDoCommand('Objects(Cylinder1234543661).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Cylinder1234543662).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Cylinder1234543658).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Object1123391).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Object1123399).PlayAnimation(0,99,true,30)'); 
	//blast
	TNTDoCommand('Objects(Object31).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(outdoor02).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Box28).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Box1623424529).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Box04).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(CO_Fontdoor).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(St*).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(CO_Backdoor).PlayAnimation(0,3499,true,30)'); 
	TNTDoCommand('Objects(Object67).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Object32).PlayAnimation(0,3499,true,30)');
	TNTDoCommand('Objects(Coal_door).PlayAnimation(0,3499,true,30)');
	//reclaimers iron
	TNTDoCommand('Objects(Cylinder1234543596).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Iron_anim01).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim02).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim03).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim04).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim05).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim06).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim07).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Iron_anim08).PlayAnimation(0,61,true,30)');
	TNTDoCommand('Objects(Cylinder12343253).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Cylinder1234543652).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Object1123333).PlayAnimation(0,99,true,30)');	
	TNTDoCommand('Objects(Object1123386).PlayAnimation(0,99,true,30)');
	TNTDoCommand('Objects(Cylinder1234543654).PlayAnimation(0,99,true,30)'); 
	//sinter
	TNTDoCommand('SceneGraph.ObjectTree([Group13]).PlayAnimation(0,84,true,30)');
	TNTDoCommand('Objects(Plane197).PlayAnimation(0,498,true,30)');
	TNTDoCommand('Objects(Plane198).PlayAnimation(0,498,true,30)');
	TNTDoCommand('Objects(Plane199).PlayAnimation(0,498,true,30)');
	TNTDoCommand('Objects(Plane200).PlayAnimation(0,498,true,30)');
	TNTDoCommand('Objects(Plane201).PlayAnimation(0,498,true,30)');
	TNTDoCommand('Objects(Plane203).PlayAnimation(0,498,true,30)');
	//hotmill
	TNTDoCommand('Objects(talonANI*).PlayAnimation(0,1550,true,25)'); 
	TNTDoCommand('Objects(ANI_MovTab1).PlayAnimation(0,40,true,25)'); 

	
}

function WebCam(cam_num)
{
	cleartime();
	if(CurrentT2L=="steelworks.t2l")
	{
		TNTDoCommand('Objects("Pop_start").StopAnimation()');
		TNTDoCommand('Objects("Camera02").StopAnimation()');
		TNTDoCommand('Objects(Sphere01).SetEnable(false)');
	}
	else if(CurrentT2L=="steelworks_hotmill.t2l")
	{
		MillMapObject = "View_Cam_0" + cam_num;
		MillMapRotObject = "View_Cam_0" + cam_num;
		TNTDoCommand('Objects(Sphere01).SetEnable(false)');
	}
	
	TNTDoCommand('CameraCtrl.SetCurrent(\"View_Cam_0' + cam_num + '\")');
}

function Walk()
{
	IntroLoopMode = 0;
	hide('loop');
	cleartime();
	if(CurrentT2L=="steelworks.t2l")
	{
		clearTimeout(AnimationTimer1);
		clearTimeout(AnimationTimer2);
		clearTimeout(AnimationTimer3);
		clearTimeout(AnimationTimer4);
		clearTimeout(AnimationTimer5);
		clearTimeout(AnimationTimer6);
		clearTimeout(AnimationTimer7);
		clearTimeout(AnimationTimer8);
		clearTimeout(AnimationTimer9);
		clearTimeout(AnimationTimer10);
		clearTimeout(AnimationTimer11);
		clearTimeout(AnimationTimer12);
		clearTimeout(AnimationTimer13);
		MapDisplacementVar = 100000;
		MapDisplacementVar_phys = 0;
		TNTDoCommand('Objects("Pop_start").StopAnimation()');
		TNTDoCommand('Objects("Camera02").StopAnimation()');
		TNTDoCommand('Objects("Pop_start").SetFrame(152)');
		TNTDoCommand('CameraCtrl.SetCurrent("PhysicsCamera01")');
		TNTDoCommand('Objects("Sphere01").SetEnable(true)');
	}
	else if (CurrentT2L=="steelworks_hotmill.t2l")
	{
		clearTimeout(IntroTimer1);
		clearTimeout(IntroTimer2);
		clearTimeout(IntroTimer3);
		clearTimeout(IntroTimer3b);
		clearTimeout(IntroTimer4);
		clearTimeout(IntroTimer5);
		clearTimeout(IntroTimer6);
		clearTimeout(IntroTimer7);
		clearTimeout(IntroTimerx);
		MapDisplacementVar_phys = 0;
		MillMapObject="Sphere01";
		MillMapRotObject="Sphere01";
		
		TNTDoCommand('Objects(Sphere01).SetEnable(true)');
		TNTDoCommand('CameraCtrl.SetCurrent("Camera01")');

	}
	setFocus();
}

function Walk_beginning()
{
	cleartime();
	GotoArea(0);
}

var srcPosX = 0.0;
var srcPosY = 0.0;
var srcPosZ = 0.0;
var srcRotZ = 0.0;

function GotoArea(areanum)
{
	IntroLoopMode = 0;
	hide('loop');
	cleartime();
	clearTimeout(AnimationTimer1);
	clearTimeout(AnimationTimer2);
	clearTimeout(AnimationTimer3);
	clearTimeout(AnimationTimer4);
	clearTimeout(AnimationTimer5);
	clearTimeout(AnimationTimer6);
	clearTimeout(AnimationTimer7);
	clearTimeout(AnimationTimer8);
	clearTimeout(AnimationTimer9);
	clearTimeout(AnimationTimer10);
	clearTimeout(AnimationTimer11);
	clearTimeout(AnimationTimer12);
	clearTimeout(AnimationTimer13);
	
	MapDisplacementVar = 100000;
	MapDisplacementVar_phys = 0;
	
	TNTDoCommand('Objects("Popup_*").SetVisible(false)');
	TNTDoCommand('Objects("Popup_' + areanum + '").SetVisible(true)');
		
	//TNTDoCommand('Objects("Popup*").SetFrame(0)');
	TNTDoCommand('Objects(Camera02).StopAnimation()');
	
	TNTDoCommand('Objects("Popup_' + areanum + '").PlayAnimation(0,100,false,25)');
	
	srcPosX = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalX()'));
	srcPosY = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalY()'));
	srcPosZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalZ()'));
	srcRotZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetRotationLocalZ()'));
	
	TNTDoCommand('Objects(Sphere01).SetPositionLocal('+srcPosX+','+srcPosY+','+srcPosZ+')');
	TNTDoCommand('Objects(Sphere01).SetRotationLocal(0,0,'+srcRotZ+')');
	TNTDoCommand('Objects(Sphere01).SetEnable(true)');
	TNTDoCommand('CameraCtrl.SetCurrent("PhysicsCamera01")');

	setFocus();
}

function GotoIntArea(areanum)
{
	IntroLoopMode = 0;
	hide('loop');
	cleartime();
	Frame=areanum-1;
	IntMapObject="Camera01";
	IntMapRotObject="Sphere01";
	TNTDoCommand('Objects(Pop_finish).SetVisible(false)');

	/*switch (areanum) {
	case 1:
		document.myFlashmap.GotoFrame(0);		
	break;
	case 2:
		document.myFlashmap.GotoFrame(1);	
	break;
	case 3:
		document.myFlashmap.GotoFrame(2);	
	break;
	case 4:
		document.myFlashmap.GotoFrame(0);	
	break;
	case 5:
		document.myFlashmap.GotoFrame(0);	
	break;
	case 6:
		document.myFlashmap.GotoFrame(1);	
	break;
	case 7:
		document.myFlashmap.GotoFrame(1);	
	break;
	case 8:
		document.myFlashmap.GotoFrame(0);	
	break;
	case 9:
		document.myFlashmap.GotoFrame(2);	
	break;
	case 10:
		document.myFlashmap.GotoFrame(0);	
	break;
	}*/
	
	clearTimeout(IntroTimer1);
	clearTimeout(IntroTimer2);
	clearTimeout(IntroTimer3);
	clearTimeout(IntroTimer3b);
	clearTimeout(IntroTimer4);
	clearTimeout(IntroTimer5);
	clearTimeout(IntroTimer6);
	clearTimeout(IntroTimer7);
	clearTimeout(IntroTimerx);
	
	srcPosX = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalX()'));
	srcPosY = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalY()'));
	srcPosZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalZ()'));
	srcRotZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetRotationLocalZ()'));
	
	TNTDoCommand('Objects(Sphere01).SetPositionLocal('+srcPosX+','+srcPosY+','+srcPosZ+')');
	TNTDoCommand('Objects(Sphere01).SetRotationLocal(0,0,'+srcRotZ+')');
	TNTDoCommand('Objects(Pop_start).SetVisible(false)');
	TNTDoCommand('Objects(Sphere01).SetEnable(true)');
	TNTDoCommand('CameraCtrl.SetCurrent("Camera01")');

	setFocus();
}

function GotoHotmillArea(areanum)
{
	IntroLoopMode = 0;
	hide('loop');
	cleartime();
	MillMapObject="Sphere01";
	MillMapRotObject="Sphere01";
	
	clearTimeout(IntroTimer1);
	clearTimeout(IntroTimer2);
	clearTimeout(IntroTimer3);
	clearTimeout(IntroTimer3b);
	clearTimeout(IntroTimer4);
	clearTimeout(IntroTimer5);
	clearTimeout(IntroTimer6);
	clearTimeout(IntroTimer7);
	clearTimeout(IntroTimerx);
	srcPosX = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalX()'));
	srcPosY = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalY()'));
	srcPosZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetPositionLocalZ()'));
	srcRotZ = parseFloat(TNTDoCommand('Objects(' + "GotoSphere" + areanum + ').GetRotationLocalZ()'));
	
	TNTDoCommand('Objects(Sphere01).SetPositionLocal('+srcPosX+','+srcPosY+','+srcPosZ+')');
	TNTDoCommand('Objects(Sphere01).SetRotationLocal(0,0,'+srcRotZ+')');
	TNTDoCommand('Objects(Pop_start).SetVisible(false)');
	TNTDoCommand('Objects(Sphere01).SetEnable(true)');
	TNTDoCommand('CameraCtrl.SetCurrent("Camera01")');

	setFocus();

}

function SinterCam()
{
	TNTDoCommand('Objects(Sphere01).SetEnable(false)');
	TNTDoCommand('Objects(Sphere02).SetEnable(true)');
	TNTDoCommand('CameraCtrl.SetCurrent("PhysicsCamera02")');
	setFocus();
}

function OnClick( obj )
{
	if(TNTDoCommand('Objects(' + obj + ').GetStopFrame()')!=100)
		TNTDoCommand('Objects(' + obj + ').PlayAnimation(,100)');
	else
		TNTDoCommand('Objects(' + obj + ').PlayAnimation(,0)');
	window.status = "Object clicked: " + obj;	
}

function OnMouseEnter( obj )
{
	TNTDoCommand('Objects(' + obj + ').SetDiffuseColor(#FF0000)');
	window.status = "Mouse Entered: " + obj;	
}

function OnMouseExit( obj )
{
	TNTDoCommand('Objects(' + obj + ').ResetMaterial()');
	window.status = "Mouse Exited: " + obj;	
}

var Zone_Name = "";

function OnZoneEnter( zone, physics )
{
	TTZoneEnter = 1;
	Zone_Name = String(zone);
}

function OnZoneEnter_Listener()
{
	
	if (TTZoneEnter==1)
	{
		TTZoneEnter = 0;
		setFocus();
		if (Zone_Name=="Zone_Exit01")  //exit interior - back to exterior
		{
			cleartime();
			createFlash(158,420,"flash_1.swf","myFlashmap");
			show(mapname);
			hide('click_exterior');
			show('click_menu');
			//show('webcams');
			clearTimeout(IntroTimer1);
			clearTimeout(IntroTimer2);
			clearTimeout(IntroTimer3);
			clearTimeout(IntroTimer3b);
			clearTimeout(IntroTimer4);
			clearTimeout(IntroTimer5);
			clearTimeout(IntroTimer6);
			clearTimeout(IntroTimer7);
			clearTimeout(IntroTimerx);

			if (IntroLoopMode==0)
			{
				FreshStart=0;
			}
			NextArea=6;
			createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_Exit02")
		{
			createFlash(158,420,"flash_1.swf","myFlashmap");
			FreshStart=0;
			NextArea=6;
			createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_Exit03")
		{
			createFlash(158,420,"flash_1.swf","myFlashmap");
			show(mapname);
			FreshStart=0;
			NextArea=5;
			hide('click_exterior2');
			show('click_menu');
			//show('webcams');
			createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_Exit04")
		{
			createFlash(158,420,"flash_1.swf","myFlashmap");
			show(mapname);
			FreshStart=0;
			NextArea=5;
			hide('click_exterior2');
			show('click_menu');
			//show('webcams');
			createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_Exit05")
		{
			createFlash(158,420,"flash_1.swf","myFlashmap");
			show(mapname);
			FreshStart=0;
			NextArea=7;
			hide('click_exterior3');
			show('click_menu');
			//show('webcams');
			createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_blast")
		{
			hidemap();
			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			show('click_exterior2');
			//hide('webcams');
			createTurnTool(600,420,"blastfurnace.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_primary")            // enter primary steelmaking building
		{
			clearTimeout(AnimationTimer5);
			clearTimeout(MapTimer);
			createFlash(158,420,"flash_int_1.swf","myFlashmap");
			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			hide('menu');
			//hide('webcams');
			show(mapname);                //if not already showing
			show('click_exterior');
			createTurnTool(600,420,"steelworks_interior.t2l", "#000000", 0, false);
		}
		else if (Zone_Name=="Zone_sinter")
		{
			GotoArea(9);
		}
		else if (Zone_Name=="shoot_top")
		{
			Frame=0;
			if (CurrentT2L=="steelworks_interior.t2l")
			{
				document.myFlashmap.GotoFrame(2);
			}
			TNTDoCommand('Objects(shoot_bottom).SetEnable(false)');
			setTimeout("TNTDoCommand('Objects(shoot_bottom).SetEnable(true)');",5000);   //enable bottom zone in 5 sec
			srcPosX = parseFloat(TNTDoCommand('Objects(shoot_bottom).GetPositionWorldX()'));
			srcPosY = parseFloat(TNTDoCommand('Objects(shoot_bottom).GetPositionWorldY()'));
			srcPosZ = parseFloat(TNTDoCommand('Objects(shoot_bottom).GetPositionWorldZ()'));
			srcRotZ = parseFloat(TNTDoCommand('Objects(shoot_bottom).GetRotationWorldZ()'));
			TNTDoCommand('Objects(Sphere01).SetPositionWorld('+srcPosX+','+srcPosY+','+srcPosZ+')');
			TNTDoCommand('Objects(Sphere01).SetRotationWorld(0,0,'+srcRotZ+')');
		}
		else if (Zone_Name=="shoot_bottom")
		{
			Frame=2;
			//if (ie4||ie5)
			//{
				if (CurrentT2L=="steelworks_interior.t2l")
				{
					document.myFlashmap.GotoFrame(2);
				}
			//}
			TNTDoCommand('Objects(shoot_top).SetEnable(false)');
			setTimeout("TNTDoCommand('Objects(shoot_top).SetEnable(true)');",5000);   //enable top zone in 5 sec
			srcPosX = parseFloat(TNTDoCommand('Objects(shoot_top).GetPositionWorldX()'));
			srcPosY = parseFloat(TNTDoCommand('Objects(shoot_top).GetPositionWorldY()'));
			srcPosZ = parseFloat(TNTDoCommand('Objects(shoot_top).GetPositionWorldZ()'));
			srcRotZ = parseFloat(TNTDoCommand('Objects(shoot_top).GetRotationWorldZ()'));
			TNTDoCommand('Objects(Sphere01).SetPositionWorld('+srcPosX+','+srcPosY+','+srcPosZ+')');
			TNTDoCommand('Objects(Sphere01).SetRotationWorld(0,0,'+srcRotZ+')');
		}
		else if (Zone_Name.slice(0,10)=="bshoot_top")
		{
			var TempZonNum = Zone_Name.slice(11,12);
			
			TNTDoCommand('Objects(bshoot_bottom_' + TempZonNum + ').SetEnable(false)');
			setTimeout("TNTDoCommand('Objects(bshoot_bottom_" + TempZonNum + ").SetEnable(true)');",5000);   //enable top zone in 5 sec
			srcPosX = parseFloat(TNTDoCommand('Objects(bshoot_bottom_' + TempZonNum + ').GetPositionWorldX()'));
			srcPosY = parseFloat(TNTDoCommand('Objects(bshoot_bottom_' + TempZonNum + ').GetPositionWorldY()'));
			srcPosZ = parseFloat(TNTDoCommand('Objects(bshoot_bottom_' + TempZonNum + ').GetPositionWorldZ()'));
			srcRotZ = parseFloat(TNTDoCommand('Objects(bshoot_bottom_' + TempZonNum + ').GetRotationWorldZ()'));
			TNTDoCommand('Objects(Sphere01).SetPositionWorld('+srcPosX+','+srcPosY+','+srcPosZ+')');
			TNTDoCommand('Objects(Sphere01).SetRotationWorld(0,0,'+srcRotZ+')');
		}
		else if (Zone_Name.slice(0,13)=="bshoot_bottom")
		{
			var TempZonNum = Zone_Name.slice(14,15);
			TNTDoCommand('Objects(bshoot_top_' + TempZonNum + ').SetEnable(false)');
			setTimeout("TNTDoCommand('Objects(bshoot_top_" + TempZonNum + ").SetEnable(true)');",5000);   //enable top zone in 5 sec
			srcPosX = parseFloat(TNTDoCommand('Objects(bshoot_top_' + TempZonNum + ').GetPositionWorldX()'));
			srcPosY = parseFloat(TNTDoCommand('Objects(bshoot_top_' + TempZonNum + ').GetPositionWorldY()'));
			srcPosZ = parseFloat(TNTDoCommand('Objects(bshoot_top_' + TempZonNum + ').GetPositionWorldZ()'));
			srcRotZ = parseFloat(TNTDoCommand('Objects(bshoot_top_' + TempZonNum + ').GetRotationWorldZ()'));
			TNTDoCommand('Objects(Sphere01).SetPositionWorld('+srcPosX+','+srcPosY+','+srcPosZ+')');
			TNTDoCommand('Objects(Sphere01).SetRotationWorld(0,0,'+srcRotZ+')');
		}
		//  zones inside interior------------------------------------------------------------------------------------
		else if (Zone_Name=="#Zone_Stairs1")
		{
			if (Frame==0)
			{
				Frame=1;
				document.myFlashmap.GotoFrame(1);
			}
			else
			{
				Frame=0;
				document.myFlashmap.GotoFrame(0);	
			}
		}
		else if (Zone_Name=="#Zone_Stairs2")
		{
			if (Frame==1)
			{
				Frame=2;
				document.myFlashmap.GotoFrame(2);
			}
			else
			{
				Frame=1;
				document.myFlashmap.GotoFrame(1);	
			}
		}
		else if (Zone_Name=="Zone_blast01")
		{
			createFlash(158,401,"flash_hotmill.swf","myFlashmap");
			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			hide('menu');
			//show('webcams');
			show(mapname);                //if not already showing
			show('click_exterior3');
			createTurnTool(600,420,"steelworks_hotmill.t2l", "#000000", 0, false);
		}
		else if (Zone_Name.slice(0,9)=="speedzone") //slow the speed
		{
			TNTDoCommand('Objects(Sphere01).SetPhysicsMoveSpeed(2688)');
		}
		
	}
	setTimeout("OnZoneEnter_Listener();",500);
}

function Go_Int()
{
			clearTimeout(MapTimer);
			createFlash(158,420,"flash_int_1.swf","myFlashmap");
			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			hide('menu');
			//hide('webcams');
			show(mapname);                //if not already showing
			show('click_exterior');
			createTurnTool(600,420,"steelworks_interior.t2l", "#000000", 0, false);
}

function Go_Blast()
{
			hidemap();
			hide('menu');
			hide('Processes');
			hide('Sponsors');
			hide('click_menu');
			show('click_exterior2');
			//hide('webcams');
			createTurnTool(600,420,"blastfurnace.t2l", "#000000", 0, false);
}

function OnZoneExit( zone, physics )
{
	if (zone.slice(0,9)=="speedzone") //slow the speed
	{
		TNTDoCommand('Objects(Sphere01).SetPhysicsMoveSpeed(8988)');
	}
}

function OnKeyPress( keyCode, ascii )
{


	if (keyCode==67)
	{
		if (CurrentT2L=="steelworks.t2l")
		{
			IntroLoopMode = 0;
			hide('loop');
			clearTimeout(IntroLoopTimer);
			Walk_beginning();
		}
		else if (CurrentT2L=="steelworks_interior.t2l")
		{
			IntroLoopMode = 0;
			hide('loop');
			clearTimeout(IntroLoopTimer);
	        cleartime();

			clearTimeout(IntroTimer1);
			clearTimeout(IntroTimer2);
			clearTimeout(IntroTimer3);
			clearTimeout(IntroTimer3b);
			clearTimeout(IntroTimer4);
			clearTimeout(IntroTimer5);
			clearTimeout(IntroTimer6);
			clearTimeout(IntroTimer7);
			clearTimeout(IntroTimerx);
			
			TNTDoCommand('Objects(Pop_finish).SetVisible(false)');
			
			IntMapObject="Camera01";
			IntMapRotObject="Sphere01";
			
			TNTDoCommand('Objects(Pop_start).SetVisible(false)');
			TNTDoCommand('Objects(Sphere01).SetEnable(true)');
			TNTDoCommand('CameraCtrl.SetCurrent("Camera01")');
		}
		else if (CurrentT2L=="steelworks_hotmill.t2l")
		{
			Walk();
 		}
	}

	if (keyCode==12)
	{

		if (IntroLoopMode==0)
		{
			IntroLoopMode = 1;
			show('loop');
			OnZoneEnter('Zone_Exit01');
		}
		else
		{
			IntroLoopMode = 0;
			hide('loop');
			clearTimeout(IntroLoopTimer);
		}
	}
}

function OnKeyRelease( keyCode, ascii )
{
}
function show(object)
{
    element(object).style.visibility = 'visible';
}


function hide(object)
{
    element(object).style.visibility = 'hidden';
}


function hidemap()
{
	hide('map_ext');
	hide('map_int');
	hide('map_hot');
}

function ShowMenu()
{
	hidemap();
	show('menu');
	changepic();
}

function HideMenu()
{
	hide('menu');
	hide('Processes');
	hide('Sponsors');
	show(mapname);
}

function ShowProcess()
{
	changepic();
	element("changeprocess").src="../../../steelworks_v5/process1.png";
	hide('Sponsors');
	show('Processes');
}

function ShowSponsors()
{
	changepic();
	element("changesponsor").src="../../../steelworks_v5/sponsors1.png";
	hide('Processes');
	show('Sponsors');
}

function changepic()
{
	element("changeprocess").src="../../../steelworks_v5/process.png";
	element("changesponsor").src="../../../steelworks_v5/sponsors.png";
}

function Restart()
{
	setFocus();
	cleartime();

	
	if (CurrentT2L!="steelworks.t2l")
	{
		clearTimeout(IntroTimer1);
		clearTimeout(IntroTimer2);
		clearTimeout(IntroTimer3);
		clearTimeout(IntroTimer3b);
		clearTimeout(IntroTimer4);
		clearTimeout(IntroTimer5);
		clearTimeout(IntroTimer6);
		clearTimeout(IntroTimer7);
		clearTimeout(IntroTimerx);
		hide('click_exterior');
		hide('click_exterior2');
		hide('click_exterior3');
		hide('Processes');
		show('click_menu');
		FreshStart=1;
		createFlash(158,420,"flash_1.swf","myFlashmap");
		createTurnTool(600,420,"steelworks.t2l", "#000000", 0, false);
	}
	else
	{
		MapDisplacementVar = 0;
		MapDisplacementVar_phys = 100000;
		TNTDoCommand('SceneGraph.Physics.Reset()');
		TNTDoCommand('Objects(*).StopAnimation()');
		TNTDoCommand('Objects("Popup1_00").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_01").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_02").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_03").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_04").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_05").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_06").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_07*").SetFrame(100)');
		TNTDoCommand('Objects("Popup1_08").SetFrame(100)');
		TNTDoCommand('CameraCtrl.SetCurrent("Camera02")');
		StartAnimationSequence();
	}
	//show('webcams');
}

function Movie()
{
	if (CurrentT2L=="steelworks.t2l")
	{
		Restart();
	}
	if (CurrentT2L=="steelworks_interior.t2l"||CurrentT2L=="steelworks_hotmill.t2l")
	{
		cleartime();
		clearTimeout(IntroTimer1);
		clearTimeout(IntroTimer2);
		clearTimeout(IntroTimer3);
		clearTimeout(IntroTimer3b);
		clearTimeout(IntroTimer4);
		clearTimeout(IntroTimer5);
		clearTimeout(IntroTimer6);
		clearTimeout(IntroTimer7);
		clearTimeout(IntroTimerx);
		
		TNTDoCommand('Objects(Pop_finish).SetVisible(true)');
		TNTDoCommand('CameraCtrl.SetCurrent("intro_cam_1")');
		
		OnReady();
	}
}

//---------------------------------------------------------------------flash
var Frame=0; //really is frame = 1
var MapDisplacementVar = 0;
var MapDisplacementVar_phys = 0;

function doPassVar_Map(PosX,PosY,RotZ,PosXC,PosYC,RotZC)
{
	var sendPosX = PosX;
	var sendPosY = PosY;
	var sendRotZ = RotZ; 
	
	var sendPosXC = PosXC;
	var sendPosYC = PosYC;
	var sendRotZC = RotZC;
	
	//alert(flashname);
	window.document[flashname].SetVariable("myVarPosX", sendPosX);
	window.document[flashname].SetVariable("myVarPosY", sendPosY);
	window.document[flashname].SetVariable("myVarRotZ", sendRotZ);
	window.document[flashname].SetVariable("myVarPosX2", sendPosXC);
	window.document[flashname].SetVariable("myVarPosY2", sendPosYC);
	window.document[flashname].SetVariable("myVarRotZ2", sendRotZC);
}

var MapTimer;
var srcPosX;
var srcPosY;
var srcRotZ;
var srcRotZ1;
var desPosY;
var desPosX;
var srcPosXC;
var srcPosYC;
var srcRotZC;
var srcRotZ1C;
var desPosYC;
var desPosXC;

var MapYConstant = 0.032016908258984915055090223935334;
var MapXConstant = 0.029573934837092731829573934837093;

function UpdateMap()      //flash map exterior
{
	// physics arrow
	srcPosX = 2300 - parseInt(TNTDoCommand('Objects(Sphere01).GetPositionWorldX()')) + MapDisplacementVar_phys;
	srcPosY = parseInt(TNTDoCommand('Objects(Sphere01).GetPositionWorldY()')) + 7750 + MapDisplacementVar_phys;
	srcRotZ1 = parseInt(TNTDoCommand('Objects(Sphere01).GetRotationLocalZ()'));

	srcRotZ = 180 - srcRotZ1;

	desPosX = (srcPosX * MapXConstant);
	desPosY= (srcPosY * MapYConstant);

	// camera arrow
	srcPosXC = 2300 - parseInt(TNTDoCommand('Objects(Camera02).GetPositionWorldX()')) + MapDisplacementVar;
	srcPosYC = parseInt(TNTDoCommand('Objects(Camera02).GetPositionWorldY()')) + 7750 + MapDisplacementVar;
	srcRotZ1C = parseInt(TNTDoCommand('Objects(Camera02).GetRotationLocalZ()'));

	srcRotZC = 180 - srcRotZ1C;

	desPosXC = (srcPosXC * MapXConstant);
	desPosYC= (srcPosYC * MapYConstant);

	doPassVar_Map(desPosX, desPosY, srcRotZ, desPosXC, desPosYC, srcRotZC);
	
	
	MapTimer = setTimeout("UpdateMap()", 50);
}

var IntMapYConstant = 0.61;
var IntMapXConstant = 0.59;
var IntMapObject = "";
var IntMapRotObject = "";

function UpdateMapInt()      //flash map interior
{
	// physics arrow
	srcPosX = parseInt(TNTDoCommand('Objects(' + IntMapObject + ').GetPositionWorldX()')) + 187 + MapDisplacementVar_phys;
	srcPosY = 448 - parseInt(TNTDoCommand('Objects(' + IntMapObject + ').GetPositionWorldY()')) + MapDisplacementVar_phys;
	srcRotZ1 = parseInt(TNTDoCommand('Objects(' + IntMapRotObject + ').GetRotationLocalZ()'));
	
	srcRotZ = 180 - srcRotZ1 - 180;
	
	desPosX = (srcPosX * IntMapXConstant);
	desPosY= (srcPosY * IntMapYConstant);
	
	doPassVar_Map(desPosX, desPosY, srcRotZ, -50, -50, -50);
	
	
	MapTimer = setTimeout("UpdateMapInt()", 50);
}

var MillMapYConstant = 0.011267605633802816901408450704225;
var MillMapXConstant = 0.011256931608133086876155268022181;
var MillMapObject = "";
var MillMapRotObject = "";

function UpdateMapHotmill()      //flash map interior
{

	aa = parseInt(TNTDoCommand('Objects(' + MillMapObject + ').GetPositionWorldX()'));
	bb = parseInt(TNTDoCommand('Objects(' + MillMapObject + ').GetPositionWorldY()'));
	cc = parseInt(TNTDoCommand('Objects(' + MillMapRotObject + ').GetRotationLocalZ()'));
	// physics arrow
	srcPosX = parseInt(TNTDoCommand('Objects(' + MillMapObject + ').GetPositionWorldX()')) + 6280;
	srcPosY = 50840 - parseInt(TNTDoCommand('Objects(' + MillMapObject + ').GetPositionWorldY()'));
	srcRotZ1 = parseInt(TNTDoCommand('Objects(' + MillMapRotObject + ').GetRotationLocalZ()'));
	
	srcRotZ = -srcRotZ1;
	
	desPosX = (srcPosX * MillMapXConstant);
	desPosY= (srcPosY * MillMapYConstant);
	
	doPassVar_Map(desPosX, desPosY, srcRotZ, -50, -50, -50);
	
	//window.status = aa+'*'+bb+'*'+cc+ '*'+desPosX + '*' + desPosY + '*' + srcRotZ;	

	
	MapTimer = setTimeout("UpdateMapHotmill()", 50);
}

