<?xml version="1.0" encoding="UTF-8"?>
<krpano version="1.19-pr16">

  <!-- unsupported kind of display : PointMap -->


    
  <!-- Spot Style - Default Point Spot Style -->


  <style name="IconDefaultPointSpotStyle"
         url="%FIRSTXML%/spots/circle_hotspot_3d_style_user_defaultpoint4.png"
         visible="false"
         edge="center"
         zoom="true"

         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconDefaultPointSpotStyle"
         onover="onoverIconDefaultPointSpotStyle"
         onout="onoutIconDefaultPointSpotStyle"


         />
  <action name="onhoverIconDefaultPointSpotStyle">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconDefaultPointSpotStyle">
tween(scale, 1.2);


  </action>
  <action name="onoutIconDefaultPointSpotStyle">
    hideTooltip();
    tween(scale, 1);


  </action>



<!-- ********** -->
<!-- Double clic -->
<!-- id : doubleclick -->
<!-- ********** -->
  <events name="doubleclick_events" keep="true" ondoubleclick="doubleclick_ondoubleclick"/>
  <action name="doubleclick_ondoubleclick">switchFullscreen();


  </action>
<!-- ********* -->
<!-- Gyroscope -->
<!-- ********* -->


<plugin name="gyroscope"
        url="%FIRSTXML%/graphics/gyro2.js"
        keep="true"
        devices="no-desktop.and.html5"

        camroll="false"

        onunavailable="checkGyroUnavailable();"
        sensor_mode="1"
        friction="auto"
        autocalibration="true"
        touch_mode="full"
        onavailable="delayedcall(1, checkGyroAvailability(););"
        enabled="false"
        activated="false"
        />



<action name="changeGyroscopeState">
  if(plugin[gyroscope],
    if (plugin[gyroscope].isavailable,
      if(%1,
        set(plugin[gyroscope].activated,true);
      ,
        set(plugin[gyroscope].activated,false);
      );
      if (%1 != plugin[gyroscope].enabled,
        if(plugin[gyroscope].activated,
          switch(plugin[gyroscope].enabled);
        ,
          set(plugin[gyroscope].enabled, false);
        );
        if (plugin[gyroscope].enabled, events.dispatch(ongyroscopeon);, events.dispatch(ongyroscopeoff););
      );
    );
  );
</action>

<action name="checkGyroAvailability">
  if(plugin[gyroscope],
    if (plugin[gyroscope].isavailable,
      
      set(sceneisfull360, false);
      if (scene[get(xml.scene)].full360,
        sub(viewhfov, panoview.hmax, panoview.hmin);
        if (viewhfov == 360,
          sub(viewvfov, panoview.vmax, panoview.vmin);
          if (viewvfov == 180,
            set(sceneisfull360, true);
          );
        );
      );
      set(delaythegyrocheck, false);
      if (sceneisfull360 AND tour_firstlittleplanet, set(delaythegyrocheck, true));

      ifnot(delaythegyrocheck,
        switch(plugin[gyroscope].enabled);
        set(plugin[gyroscope].activated,true);
        set(tour_gyroscopedevices, true);
        events.dispatch(ongyroscopeavailable);
      ,
        delayedcall(1, checkGyroAvailability(););
      );
    ,
      set(tour_gyroscopedevices, false);
    );
    if (plugin[gyroscope].enabled, events.dispatch(ongyroscopeon);, events.dispatch(ongyroscopeoff););
  ,
    checkGyroUnavailable();
  );
</action>

<action name="checkGyroUnavailable">
  set(plugin[gyroscope].activated, false);
  set(plugin[gyroscope].enabled, false);
  set(tour_gyroscopedevices, false);
  events.dispatch(ongyroscopeunavailable);
</action>

<!-- ********** -->
<!-- En-tête -->
<!-- id : header -->
<!-- ********** -->

  <layer name="header"
         keep="true"
         url="%FIRSTXML%/graphics/header/visit_inside_logo_2018.png" 
         align="top"
         x="5"
         y="0"
         zorder="3"
         enabled="false"
         capture="true"
         visible="false"
         height="9%"
         width="17%"
         
         />

  <events name="headerevents"
    onTourStart="showheader();"
    keep="true" />

  <action name="showheader">
    set(layer[header].visible, true);
  </action>

<!-- ********** -->
<!-- Barres et Boucles de Progression -->
<!-- id : progressbar -->
<!-- ********** -->

  <progress showwait.flash="loopings(
				0xffffff,
				25,15,
				40,28,
				0xffffff,7,
				0,0,center
				)"
			showreloads.flash="false"
			parent=""
			/>


  <action name="progressbar_start">
    if(scene[get(xml.scene)].video,
      progressbar_stop();
    ,
    if (device.html5, 
      mul(xcrop, layer[progressbarwheel].frame, 64);
      txtadd(layer[progressbarwheel].crop, get(xcrop), '|0|64|64');
      
      inc(layer[progressbarwheel].frame);
      if(layer[progressbarwheel].frame GE layer[progressbarwheel].frames, set(layer[progressbarwheel].frame,0));
    );
      delayedcall(progressbar_progresscall, 0.1,progressbar_start());
      if(progress_val == 100,
        progressbar_stop();
      );
    );
  </action>
  <action name="progressbar_stop">
    stopdelayedcall(progressbar_progresscall);
    if (device.html5, set(layer[progressbarwheel].visible, false););
  </action>
  <events name="progressbar_events" onloadcomplete="progressbar_stop();" onxmlcomplete="if (device.html5,set(layer[progressbarwheel].visible, true););progressbar_start();" keep="true" />

  <!-- loading wheel -->
  <layer name="progressbarwheel"
         keep="true"
         devices="html5"
         visible="false"
         url="%FIRSTXML%/graphics/progressbarandloopings/loadingwheel.png"
         crop="0|0|64|64"
         align="center"
         x="0" y="0"
         frame="0" frames="12"
         width="30"
         height="30" />

<!-- ********** -->
<!-- Transition de chargement -->
<!-- id : blendmode -->
<!-- ********** -->
	<action name="blendmode_prepareblendmode" autorun="preinit">

		if(device.html5 AND device.webgl,

			set(ptblendmode, 'ZOOMBLEND(1, 2.0, easeInOutSine)');

		,
			set(ptblendmode, 'BLEND(1.0, easeInCubic)');
		);

	</action>

<!-- ********** -->
<!-- Sans Control Bar -->
<!-- id : SansControlBar -->
<!-- ********** -->

  <krpano SansControlBarbarbuilt="false" SansControlBarbackgroundwidthwhenclosed="0" SansControlBarbackgroundwidthwhenopened="0" SansControlBarIsOpened="false" />
  <events name="SansControlBarevents" 
    onxmlcomplete="SansControlBarbuildMenuBar();" 


    keep="true" />



  <action name="SansControlBarbuildMenuBar">
    ifnot (SansControlBarbarbuilt, SansControlBarbuildMenu(); set(SansControlBarbarbuilt, true););
  </action>

  <style name="SansControlBar_btn_style"
         keep="true"
         edge="right"
         align="right"
         x="0" y="0"
         width="40" height="40"
         crop="0|0|60|60"
         onovercrop="0|60|60|60"
         ondowncrop="0|120|60|60"
         onhover="showTooltip('plugin', SansControlBarmenuTooltipStyle, bottom);"
         onout="hideTooltip();"
         />
  <style name="SansControlBar_btn_style_off"
         keep="true"
         edge="right"
         align="right"
         x="0" y="0"
         width="40" height="40"
         onhover="showTooltip('plugin', SansControlBarmenuTooltipStyle, bottom);"
         onout="hideTooltip();"
         />

  <layer name="SansControlBar_menu_bg"
         keep="true"
         type="container"
         zorder="6"
         width="40"
         height="40"
         align="bottom"
         x="0" y="10"
         maskchildren="true"
         rotate="0"
         visible="false"
         >

    <layer name="SansControlBarbtn_enter_vr"
            url="%FIRSTXML%/graphics/sans controlbar/btn_vr_mode.png"
            style="SansControlBar_btn_style"
            onclick="if(scene[get(xml.scene)].full360 AND disableCurrentSceneVrConservation !== true,
    js(accessWebVr(get(xml.scene),get(videoscenestarttime)));
,
    js(accessWebVr(null));
);"
            tooltip="SansControlBarenterVRTip"
            visible="false"
            devices="html5"
            />
    <layer name="SansControlBarbtn_enter_vr_not"
            url="%FIRSTXML%/graphics/sans controlbar/btn_vr_mode_off.png"
            style="SansControlBar_btn_style"
            tooltip="SansControlBarenterVRNotTip"
            enabled="true"
            capture="false"
            visible="false"
            devices="html5"
            />

    <layer name="SansControlBarbtn_left"
            url="%FIRSTXML%/graphics/sans controlbar/btn_move_left.png"
            ondown="viewControlMoveLeft(false);
"
            onup="viewControlMoveHoriStop();
"
            style="SansControlBar_btn_style"
            visible="false"
            tooltip="SansControlBarmoveLeftTip"
            devices="desktop"
            />
    <layer name="SansControlBarbtn_right"
            url="%FIRSTXML%/graphics/sans controlbar/btn_move_right.png"
            ondown="viewControlMoveRight(false);
"
            onup="viewControlMoveHoriStop();
"
            style="SansControlBar_btn_style"
            visible="false"
            tooltip="SansControlBarmoveRightTip"
            devices="desktop"
            />

    <layer name="SansControlBarbtn_up"
            url="%FIRSTXML%/graphics/sans controlbar/btn_move_up.png"
            ondown="viewControlMoveUp(false);
"
            onup="viewControlMoveVertStop();
"
            style="SansControlBar_btn_style"
            visible="false"
            tooltip="SansControlBarmoveUpTip"
            devices="desktop"
            />
    <layer name="SansControlBarbtn_down"
            url="%FIRSTXML%/graphics/sans controlbar/btn_move_down.png"
            ondown="viewControlMoveDown(false);
"
            onup="viewControlMoveVertStop();
"
            style="SansControlBar_btn_style"
            visible="false"
            tooltip="SansControlBarmoveDownTip"
            devices="desktop"
            />



    <layer name="SansControlBarbtn_prev_pano"
            url="%FIRSTXML%/graphics/sans controlbar/btn_previous_scene.png"
            onclick="loadPreviousScene();
"
            style="SansControlBar_btn_style"
            tooltip="SansControlBarprevSceneTip"
            visible="false"
            />
    <layer name="SansControlBarbtn_next_pano"
            url="%FIRSTXML%/graphics/sans controlbar/btn_next_scene.png"
            onclick="loadNextScene();
"
            style="SansControlBar_btn_style"
            tooltip="SansControlBarnextSceneTip"
            visible="false"
            />



    <layer name="SansControlBarbtn_openfs"
            url="%FIRSTXML%/graphics/sans controlbar/btn_enter_fs.png"
            onclick="enterFullscreen();
"
            style="SansControlBar_btn_style"
            visible="false"
            devices="fullscreensupport"
            tooltip="SansControlBaropenFsTip"
            />
    <layer name="SansControlBarbtn_closefs"
            url="%FIRSTXML%/graphics/sans controlbar/btn_close_fs.png"
            onclick="exitFullscreen();
"
            style="SansControlBar_btn_style"
            visible="false"
            devices="fullscreensupport"
            tooltip="SansControlBarcloseFsTip"
            />





 </layer>



<events name="SansControlBarvravailableevent"
		onvravailable="SansControlBarupdateVrButtonsAvailability();"
		onvrunavailable="SansControlBarupdateVrButtonsAvailability();"
		keep="true" devices="html5" />
	<krpano SansControlBarmenuvravailable="false" />
	<action name="SansControlBarupdateVrButtonsAvailability">
		if (tour_vrdevices,
			set(SansControlBarmenuvravailable, true);
		,
			set(SansControlBarmenuvravailable, false);
		);
		SansControlBarupdateVrButtons();
	</action>
	<action name="SansControlBarHideVrButtons">
		set(layer[SansControlBarbtn_enter_vr].visible, false);
		if('%1' == 'true' AND plugin[ptpvrmode],
			set(layer[SansControlBarbtn_enter_vr_not].visible, true);
		,
			set(layer[SansControlBarbtn_enter_vr_not].visible, false);
		);
	</action>
	<action name="SansControlBarShowVrButtons">
		if (SansControlBarmenuvravailable,
			set(layer[SansControlBarbtn_enter_vr].visible, true);
			set(layer[SansControlBarbtn_enter_vr_not].visible, false);
		,
			SansControlBarHideVrButtons(true);
		);
	</action>
	<action name="SansControlBarupdateVrButtons">
	if (tour_vrdevices,
		if (SansControlBarIsOpened,
			SansControlBarShowVrButtons();
		,
			SansControlBarHideVrButtons();
		);
	,
		if (SansControlBarIsOpened,
			SansControlBarHideVrButtons(true);
		,
			SansControlBarHideVrButtons();
		);
	);
	</action>



  <action name="SansControlBarhideMenuControls">
    set(SansControlBarIsOpened, false);
if (scene.count GT 1,
	set(layer[SansControlBarbtn_next_pano].visible, false);
	set(layer[SansControlBarbtn_prev_pano].visible, false);
);


if (device.desktop,
	set(layer[SansControlBarbtn_up].visible, false);
	set(layer[SansControlBarbtn_down].visible, false);
);
if (device.desktop,
	set(layer[SansControlBarbtn_left].visible, false);
	set(layer[SansControlBarbtn_right].visible, false);
);
	SansControlBarupdateFullscreenButtons();





	SansControlBarupdateVrButtons();



	set(layer[SansControlBar_menu_bg].width, get(SansControlBarbackgroundwidthwhenclosed));

	set(layer[SansControlBar_menu_bg].visible, true);
  </action>
  <action name="SansControlBarshowMenuControls">
    set(SansControlBarIsOpened, true);
	set(layer[SansControlBar_menu_bg].visible, true);
if (scene.count GT 1,
	set(layer[SansControlBarbtn_next_pano].visible, true);
	set(layer[SansControlBarbtn_prev_pano].visible, true);
);


if (device.desktop,
	set(layer[SansControlBarbtn_up].visible, true);
	set(layer[SansControlBarbtn_down].visible, true);
);
if (device.desktop,
	set(layer[SansControlBarbtn_left].visible, true);
	set(layer[SansControlBarbtn_right].visible, true);
);
	SansControlBarupdateFullscreenButtons();



	SansControlBarupdateVrButtons();




    set(layer[SansControlBar_menu_bg].width, get(SansControlBarbackgroundwidthwhenopened));
  </action>




  <events name="SansControlBarmenufullscreenchangeevent"
          onenterfullscreen="SansControlBarupdateFullscreenButtons();"
          onexitfullscreen="SansControlBarupdateFullscreenButtons();"
          keep="true"/>
	<action name="SansControlBarHideFullscreenButtons">
		set(layer[SansControlBarbtn_openfs].visible , false);
		set(layer[SansControlBarbtn_closefs].visible, false);
	</action>
	<action name="SansControlBarShowFullscreenButtons">
		if (device.fullscreensupport,
			if(tour_fullscreen,
				set(layer[SansControlBarbtn_openfs].visible , false);
				set(layer[SansControlBarbtn_closefs].visible, true);
			,
				set(layer[SansControlBarbtn_openfs].visible ,true);
				set(layer[SansControlBarbtn_closefs].visible,false);
			);
		,
			SansControlBarHideFullscreenButtons();
		);
	</action>
	<action name="SansControlBarupdateFullscreenButtons">
		if (SansControlBarIsOpened,
			SansControlBarShowFullscreenButtons();
		,
			SansControlBarHideFullscreenButtons();
		);
	</action>



<layer name="SansControlBarmenuTooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	url="%FIRSTXML%/graphics/textfield.swf"
	align="center"
	background="false"
	border="false"
	css="color:#ffffff;font-family:Helvetica;font-weight:bold;font-size:14px;text-align:left;"
	height="20"
	autoheight="true"
	autowidth="auto"
	xoffset="0"
	yoffset="0"
	padding="2"
	selectable="false"
	zorder="0"
	visible="false"
	html=""
	edge="bottom"
/>
  <action name="SansControlBarbuildMenu">
    
    set(SansControlBarbutton_pos, 0);



      if (device.fullscreensupport,
        set(layer[SansControlBarbtn_openfs].x , get(SansControlBarbutton_pos));
        set(layer[SansControlBarbtn_closefs].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
      );






    if(plugin[ptpvrmode] AND device.html5,
      set(layer[SansControlBarbtn_enter_vr].x, get(SansControlBarbutton_pos));
      set(layer[SansControlBarbtn_enter_vr_not].x, get(SansControlBarbutton_pos));
      inc(SansControlBarbutton_pos, 45);
    );



      if (device.desktop,
        set(layer[SansControlBarbtn_right].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
        set(layer[SansControlBarbtn_left].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
      );

      if (device.desktop,
        set(layer[SansControlBarbtn_down].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
        set(layer[SansControlBarbtn_up].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
      );

    if (scene.count GT 1,
        set(layer[SansControlBarbtn_next_pano].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
        set(layer[SansControlBarbtn_prev_pano].x, get(SansControlBarbutton_pos));
        inc(SansControlBarbutton_pos, 45);
      );



      dec(SansControlBarbutton_pos, 5);

      set(SansControlBarbackgroundwidthwhenopened, get(SansControlBarbutton_pos));


    
      set(layer[SansControlBar_menu_bg].width, get(SansControlBarbackgroundwidthwhenopened));
	
	
	
    </action>

	<events name="SansControlBarStartTourEvents" onTourStart="SansControlBarCallOnStartTour();" keep="true" />
	
	<action name="SansControlBarCallOnStartTour">
		
		SansControlBarshowMenuControls();
	</action>



<action name="viewControlMoveUp">
	if(%1,
		if(%2,
			set(isfullvertical, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewvfov, panoview.vmax, panoview.vmin);
				if (viewvfov == 180,
					set(isfullvertical, true);
				);
			);
			if(isfullvertical == false AND calc(view.vlookat-%2) LT view.vlookatmin,
				moveto(get(view.hlookat), get(view.vlookatmin));
			,
				moveto(get(view.hlookat), calc(view.vlookat-%2));
			);
		,
			set(vlookat_moveforce, -1);
			delayedcall(0.1, viewControlMoveVertStop());
		);
	,
		set(vlookat_moveforce, -1);
	);
</action>
<action name="viewControlMoveDown">
	if(%1,
		if(%2,
			set(isfullvertical, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewvfov, panoview.vmax, panoview.vmin);
				if (viewvfov == 180,
					set(isfullvertical, true);
				);
			);
			if(sceneisfull360 == false AND calc(view.vlookat+%2) GT view.vlookatmax,
				moveto(get(view.hlookat), get(view.vlookatmax));
			,
				moveto(get(view.hlookat), calc(view.vlookat+%2));
			);
		,
			set(vlookat_moveforce, +1);
			delayedcall(0.1, viewControlMoveVertStop());
		);
	,
		set(vlookat_moveforce, +1);
	);
</action>
<action name="viewControlMoveLeft">
	if(%1,
		if(%2,
			set(isfullhorizontal, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewhfov, panoview.hmax, panoview.hmin);
				if (viewhfov == 360,
					set(isfullhorizontal, true);
				);
			);
			if(isfullhorizontal == false AND calc(view.hlookat-%2) LT view.hlookatmin,
				moveto(get(view.hlookatmin), get(view.vlookat));
			,
				moveto(calc(view.hlookat-%2), get(view.vlookat));
			);
		,
			set(hlookat_moveforce, -1);
			delayedcall(0.1, viewControlMoveHoriStop());
		);
	,
		set(hlookat_moveforce, -1);
	);
</action>
<action name="viewControlMoveRight">
	if(%1,
		if(%2,
			set(isfullhorizontal, false);
			ifnot(scene[get(xml.scene)].planar,
				sub(viewhfov, panoview.hmax, panoview.hmin);
				if (viewhfov == 360,
					set(isfullhorizontal, true);
				);
			);
			if(isfullhorizontal == false AND calc(view.hlookat+%2) GT view.hlookatmax,
				moveto(get(view.hlookatmax), get(view.vlookat));
			,
				moveto(calc(view.hlookat+%2), get(view.vlookat));
			);
		,
			set(hlookat_moveforce, +1);
			delayedcall(0.1, viewControlMoveHoriStop());
			
		);
	,
		set(hlookat_moveforce, +1);
	);
</action>
<action name="viewControlMoveHoriStop">
	set(hlookat_moveforce, 0);
</action>
<action name="viewControlMoveVertStop">
	set(vlookat_moveforce, 0);
</action>

  <!-- Fullscreen Management -->
  <action name="exitFullScreen" devices="fullscreensupport">set(tour_fullscreen,false);set(fullscreen,false);</action>
  <action name="enterFullScreen" devices="fullscreensupport">set(tour_fullscreen,true);set(fullscreen,true);</action>
  <action name="switchFullScreen">if(tour_fullscreen,exitFullScreen();,enterFullScreen(););</action>

  
  <events name="krpanoExitFullscreenEvent"
    onexitfullscreen="if(tour_fullscreen,exitFullScreenChangeEvent(););"
    keep="true" />

  <action name="exitFullScreenChangeEvent" devices="fullscreensupport">set(tour_fullscreen,false);events.dispatch(onexitfullscreen);</action>

	<!-- WebVR plugin for VR availability tests -->

	<plugin name="ptpvrmode" devices="html5" keep="true"
		url="%FIRSTXML%/graphics/webvr.js"
		mobilevr_support="true"
		mobilevr_fake_support="false"
		vr_cursor=""
		vr_cursor_enabled="false"
		onavailable="delayedcall(1, checkVrAvailability(););"
		onunavailable="checkVrUnavailable();"
		/>
	<action name="checkVrAvailability">
		if(plugin[ptpvrmode],
			if (plugin[ptpvrmode].isavailable,
				set(tour_vrdevices, true);
				events.dispatch(onvravailable);
			,
				set(tour_vrdevices, false);
			);
		,
			checkVrUnavailable();
		);
	</action>
	<action name="checkVrUnavailable">
		set(tour_vrdevices, false);
		events.dispatch(onvrunavailable);
	</action>
</krpano>