// Copyright 2007-2008 NEW3S s.a. - NEW3S.com
// Christophe LEMOINE + Michael BRICOUT

AddScene ("etage2_1", "etage2_1", "Scenes/etage1_ter.tnt", 'SP3D_E02H01');

function Add_etage2_1_option() {
	if (gSceneDebug > 1) { alert ("Add_etage2_1_option()"); }
	AddSceneOptionWithStyle (1,"2 - Gérard Godin",'LoadScene("etage2_1")','SP3D_E02H01','color:#FF7200;font-weight:bold;');
	AddSceneOptionWithStyle (2,"Peinture 01",'LoadSceneAndGo("etage2_1","camera1")','SP3D_E02H01_S01','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 02",'LoadSceneAndGo("etage2_1","camera2")','SP3D_E02H01_S02','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 03",'LoadSceneAndGo("etage2_1","camera3")','SP3D_E02H01_S03','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 04",'LoadSceneAndGo("etage2_1","camera4")','SP3D_E02H01_S04','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 05",'LoadSceneAndGo("etage2_1","camera5")','SP3D_E02H01_S05','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 06",'LoadSceneAndGo("etage2_1","camera6")','SP3D_E02H01_S06','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 07",'LoadSceneAndGo("etage2_1","camera7")','SP3D_E02H01_S07','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 08",'LoadSceneAndGo("etage2_1","camera8")','SP3D_E02H01_S08','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 09",'LoadSceneAndGo("etage2_1","camera9")','SP3D_E02H01_S09','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 10",'LoadSceneAndGo("etage2_1","camera10")','SP3D_E02H01_S10','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 11",'LoadSceneAndGo("etage2_1","camera11")','SP3D_E02H01_S11','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 12",'LoadSceneAndGo("etage2_1","camera12")','SP3D_E02H01_S12','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 13",'LoadSceneAndGo("etage2_1","camera13")','SP3D_E02H01_S13','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 14",'LoadSceneAndGo("etage2_1","camera14")','SP3D_E02H01_S14','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 15",'LoadSceneAndGo("etage2_1","camera15")','SP3D_E02H01_S15','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 16",'LoadSceneAndGo("etage2_1","camera16")','SP3D_E02H01_S16','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 17",'LoadSceneAndGo("etage2_1","camera17")','SP3D_E02H01_S17','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 18",'LoadSceneAndGo("etage2_1","camera18")','SP3D_E02H01_S18','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 19",'LoadSceneAndGo("etage2_1","camera19")','SP3D_E02H01_S19','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 20",'LoadSceneAndGo("etage2_1","camera20")','SP3D_E02H01_S20','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 21",'LoadSceneAndGo("etage2_1","camera21")','SP3D_E02H01_S21','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 22",'LoadSceneAndGo("etage2_1","camera22")','SP3D_E02H01_S22','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 23",'LoadSceneAndGo("etage2_1","camera23")','SP3D_E02H01_S23','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 24",'LoadSceneAndGo("etage2_1","camera24")','SP3D_E02H01_S24','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 25",'LoadSceneAndGo("etage2_1","camera25")','SP3D_E02H01_S25','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 26",'LoadSceneAndGo("etage2_1","camera26")','SP3D_E02H01_S26','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 27",'LoadSceneAndGo("etage2_1","camera27")','SP3D_E02H01_S27','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 28",'LoadSceneAndGo("etage2_1","camera28")','SP3D_E02H01_S28','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 29",'LoadSceneAndGo("etage2_1","camera29")','SP3D_E02H01_S29','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 30",'LoadSceneAndGo("etage2_1","camera30")','SP3D_E02H01_S30','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 31",'LoadSceneAndGo("etage2_1","camera31")','SP3D_E02H01_S31','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 32",'LoadSceneAndGo("etage2_1","camera32")','SP3D_E02H01_S32','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 33",'LoadSceneAndGo("etage2_1","camera33")','SP3D_E02H01_S33','color:#669DFF;');
	AddSceneOptionWithStyle (2,"Peinture 34",'LoadSceneAndGo("etage2_1","camera34")','SP3D_E02H01_S34','color:#669DFF;');
}

function OnLoad_etage2_1() {
	soundManager.createSound ( {id:'SP3D_E02H01', url:'etage2_1/Sounds/entree_hall.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S01_IN', url:'etage2_1/Sounds/entree_stand01.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S02_IN', url:'etage2_1/Sounds/entree_stand02.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S03_IN', url:'etage2_1/Sounds/entree_stand03.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S04_IN', url:'etage2_1/Sounds/entree_stand04.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S05_IN', url:'etage2_1/Sounds/entree_stand05.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S06_IN', url:'etage2_1/Sounds/entree_stand06.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S07_IN', url:'etage2_1/Sounds/entree_stand07.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S08_IN', url:'etage2_1/Sounds/entree_stand08.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S09_IN', url:'etage2_1/Sounds/entree_stand09.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S10_IN', url:'etage2_1/Sounds/entree_stand10.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S11_IN', url:'etage2_1/Sounds/entree_stand11.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S12_IN', url:'etage2_1/Sounds/entree_stand12.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S13_IN', url:'etage2_1/Sounds/entree_stand13.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S14_IN', url:'etage2_1/Sounds/entree_stand14.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01S15_IN', url:'etage2_1/Sounds/entree_stand15.mp3'} );
	soundManager.createSound ( {id:'SP3D_E02H01_BG', url:'etage2_1/Sounds/ambiance.mp3'} );
}

function OnUnload_etage2_1() {
	soundManager.destroySound ('SP3D_E02H01');
	soundManager.destroySound ('SP3D_E02H01S01_IN');
	soundManager.destroySound ('SP3D_E02H01S02_IN');
	soundManager.destroySound ('SP3D_E02H01S03_IN');
	soundManager.destroySound ('SP3D_E02H01S04_IN');
	soundManager.destroySound ('SP3D_E02H01S05_IN');
	soundManager.destroySound ('SP3D_E02H01S06_IN');
	soundManager.destroySound ('SP3D_E02H01S07_IN');
	soundManager.destroySound ('SP3D_E02H01S08_IN');
	soundManager.destroySound ('SP3D_E02H01S09_IN');
	soundManager.destroySound ('SP3D_E02H01S10_IN');
	soundManager.destroySound ('SP3D_E02H01S11_IN');
	soundManager.destroySound ('SP3D_E02H01S12_IN');
	soundManager.destroySound ('SP3D_E02H01S13_IN');
	soundManager.destroySound ('SP3D_E02H01S14_IN');
	soundManager.destroySound ('SP3D_E02H01S15_IN');
	soundManager.destroySound ('SP3D_E02H01_BG');
}

function loadExternalTextures_etage2_1() {
	loadExternalTextures();
}

function OnReady_etage2_1() {
	//window.status = "TurnTool Ready (" + gLastScene + " -> " + gCurrentScene + ")";
	switch (gLastScene) {
		case "ascenseur":
			soundManager.stopAll ();
			soundManager.play ('Ding', {volume: 80, onfinish:function() {soundManager.play ('SP3D_E02H01', {volume: 100, onfinish:NextSound_etage2_1}); } } );
			//OpenDoor(gLastScene);
			//TNTDoCommand('CameraCtrl.Match("camera0",2000)'); // Sortir
			//CloseDoor(gLastScene);
		break;
		default:
			soundManager.play ('SP3D_E02H01', {volume: 100, onfinish:NextSound_etage2_1});
		break;
	}
	//TNTDoCommand('ObjectTree("*").PlayAnimation(0,255,true,20)');
	ResetRing_Scene (20, 200);
}

function OnClick_etage2_1(obj) {
	window.status = "Mouse click: etage2_1/" + obj;
	var scene = "SP3D_E02H01";
	switch(obj) {
		//Liens inter-scene
		case "ascenseur":
		case "hall_suivant":
		case "hall_precedent":
		case "acces_hall01":
		case "acces_hall02":
		case "acces_hall03":
		case "acces_hall04":
		case "acces_hall05":
		case "acces_hall06":
		case "acces_hall07":
		case "acces_hall08":
		case "acces_hall09":
		case "acces_hall10":
		case "acces_hall11":
		case "acces_hall12":
		case "acces_hall13":
			var precedent = "ascenseur";
			var suivant   = "etage1_2";
			ClickGotoSalon (obj, precedent, suivant, "etage1");
		break;
		
		//Liens intra-scene
		case "acces_stand01":
		case "acces_stand02":
		case "acces_stand03":
		case "acces_stand04":
		case "acces_stand05":
		case "acces_stand06":
		case "acces_stand07":
		case "acces_stand08":
		case "acces_stand09":
		case "acces_stand10":
		case "acces_stand11":
		case "acces_stand12":
		case "acces_stand13":
		case "acces_stand14":
		case "acces_stand15":
			ClickGotoStand (obj, "SP3D_E02H01");
		break;

		//Liens commun à plusieurs scenes
		case "message01": soundManager.stopAll (); soundManager.play ('message01', {volume: 100, onfinish:NextSound_etage2_1}); break;
		case "message02": soundManager.stopAll (); soundManager.play ('message02', {volume: 100, onfinish:NextSound_etage2_1}); break;
		case "message03": soundManager.stopAll (); soundManager.play ('message03', {volume: 100, onfinish:NextSound_etage2_1}); break;
		case "message04": soundManager.stopAll (); soundManager.play ('message04', {volume: 100, onfinish:NextSound_etage2_1}); break;
		case "message05": soundManager.stopAll (); soundManager.play ('message05', {volume: 100, onfinish:NextSound_etage2_1}); break;

		//Liens SPONSORS
		case "sponsors01":
		case "sponsors02":
		case "sponsors03":
		case "sponsors04":
			window.open ("media.asp?Id="+scene+"&IdMedia="+obj);
			SceneTracker("Sponsor", obj, "");
		break;
		case "coface01":
			window.open ("http://www.coface.fr/dmt/rubb_asspro/ap01_assenligne.htm");
			SceneTracker("Sponsor", obj, "");
		break;
		case "coface02":
			window.open ("http://www.coface.fr/dmt/rubb_asspro/ap01_assenligne.htm");
			SceneTracker("Sponsor", obj, "");
		break;
		case "coface03":
			window.open ("http://www.coface.fr/dmt/rubb_asspro/ap01_assenligne.htm");
			SceneTracker("Sponsor", obj, "");
		break;
		case "coface04":
			window.open ("http://www.coface.fr/dmt/rubb_asspro/ap01_assenligne.htm");
			SceneTracker("Sponsor", obj, "");
		break;
		case "coface05":
			window.open ("http://www.coface.fr/dmt/rubb_asspro/ap01_assenligne.htm");
			SceneTracker("Sponsor", obj, "");
		break;
			
		//Visite guidée
		case "visite_guidee":
			gSceneCamera = TNTDoCommand('CameraCtrl.GetCurrent()');
			ChangeSceneCamera("visite_guidee");
			TNTDoCommand('Objects("pause").SetVisible(1)');
			TNTDoCommand('Objects("stop").SetVisible(1)');
			var name = gSalonProtocol + "//" + gSalonURL + "/" + gSalonPath + tntRepository + "/images/icone_";
			TNTDoCommand('SceneGraph.Bitmap("icone_pause").Load("'+name+'pause.png")');
			//TNTDoCommand('SceneGraph.Bitmap("icone_stop").Load("'+name+'stop.png")');
			TNTDoCommand('Objects(*).PlayAnimation(0,3500,true)');
			gAnimationStatus = 1;
		break;
		case "stop":
			TNTDoCommand('Objects("pause").SetVisible(0)');
			TNTDoCommand('Objects("stop").SetVisible(0)');
			gAnimationStatus = 0;
			if (gSceneCamera != "") {
				ChangeSceneCamera(gSceneCamera);
				gSceneCamera = "";
			}
		break;
		case "pause":
			if (gAnimationStatus != 0) {
				var name = gSalonProtocol + "//" + gSalonURL + "/" + gSalonPath + tntRepository + "/images/icone_";
				if (gAnimationStatus > 0) {
					TNTDoCommand('Objects(*).StopAnimation()');
					name += "lecture.png";
				} else {
					TNTDoCommand('Objects(*).StartAnimation()');
					name += "pause.png";
				}
				TNTDoCommand('SceneGraph.Bitmap("icone_pause").Load("'+name+'")');
				gAnimationStatus = -gAnimationStatus;
			}
		break;

		default: ClickOnStand (obj, scene); break;
	}
}

function OnMouseEnter_etage2_1(obj) {
	//alert ("OnMouseEnter_etage2_1("+obj+")");
}

function OnMouseExit_etage2_1(obj) {
}

function OnZoneEnter_etage2_1(zone, physics) {
	window.status = "Zone enter: etage2_1/" + zone + " by " + physics;
	ZoneEnterOnStandWithBGSound (zone, physics, "SP3D_E02H01");
}

function OnZoneExit_etage2_1(zone, physics) {
}

function OnKeyPress_etage2_1(keyCode, ascii) {
}

function OnKeyRelease_etage2_1(keyCode, ascii) {
}

function NextSound_etage2_1() {
	soundManager.play ('SP3D_E02H01_BG', {volume: 50, onfinish:NextSound_etage2_1});
}
// Copyright 2007-2008 NEW3S s.a. - NEW3S.com
// Christophe LEMOINE + Michael BRICOUT

