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

    
  <!-- Spot Style - nt_160x80 -->
  <style name="Iconnt_160x80"
         url="%FIRSTXML%/spots/hotspot_image_user_defaultpoint0.png"
         visible="false"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconnt_160x80"
         onover="onoverIconnt_160x80"
         onout="onoutIconnt_160x80"


         />

  <action name="onhoverIconnt_160x80">
    showtooltip('hotspot');
  </action>

  <action name="onoverIconnt_160x80">

tween(alpha, 1);

  </action>

  <action name="onoutIconnt_160x80">
    hideTooltip();

    tween(alpha, 0.8);

  </action>



<!-- ********** -->
<!-- Double clic -->
<!-- id : doubleclick -->
<!-- ********** -->

  <plugin name="doubleclick" url.flash="%FIRSTXML%/graphics/doubleclick/fieldofview_dc.swf" url.html5="%FIRSTXML%/graphics/doubleclick/dctouch.min.js" keep="true" ondblclick="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="planarGyroscopeTest">
  if(plugin[gyroscope],
  );
</action>

<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-fond-blanc-small.png" 
         align="top"
         x="5"
         y="0"
         zorder="3"
         enabled="false"
         capture="true"
         visible="false"
         height="8%"
         width="20%"
         
         />

  <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, 'SLIDEBLEND(1.3999999999999999, 0.0, 0.5, linear)');

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

	</action>

<!-- ********** -->
<!-- Analytics -->
<!-- id : analytics -->
<!-- ********** -->

<ptplugin name="analytics" engine="kolorAnalytics">
	<settings>
		<option name="source" value="google" type="string" />
		<option name="tracking_id" value="UA-60895660-1" type="string" />
		<option name="force_ssl" value="true" type="bool" />
		<option name="force_test" value="false" type="bool" />
		<option name="start_page" value="m65" type="string" />
		<option name="start_title" value="M65" type="string" />
		<option name="start_lang" value="fr" type="string" />
		<option name="use_i18n" value="true" type="bool" />
	</settings>
</ptplugin>

<action name="kolorAnalyticsJsReady_analytics">
	set(ptplugin[analytics].jsready, true);
</action>

<action name="activate_analytics">
	if(ptplugin[analytics].jsready,
		stopdelayedcall(delay_analytics_active);
		js(invokePluginFunction(analytics, toggleDeactivation, false));
	,
		delayedcall(delay_analytics_active, 0.1, activate_analytics(););
	);
</action>

<action name="deactivate_analytics">
	if(ptplugin[analytics].jsready,
		stopdelayedcall(delay_analytics_active);
		js(invokePluginFunction(analytics, toggleDeactivation, true));
	,
		delayedcall(delay_analytics_active, 0.1, deactivate_analytics(););
	);
</action>

<action name="sendPage_analytics">
	if(ptplugin[analytics].jsready,
		stopdelayedcall(delay_analytics_page);
		js(invokePluginFunction(analytics, sendPageview, %1, %2));
	,
		delayedcall(delay_analytics_page,0.5,sendPage_analytics(%1,%2));
	);
</action>

<!-- 
sendEvent_analytics action :
* param1 : category
* param2 : action
* param3 : label
* param4 : number value
-->
<action name="sendEvent_analytics">
	if(ptplugin[analytics].jsready,
		stopdelayedcall(delay_analytics_event);
		js(invokePluginFunction(analytics, sendEvent, %1, %2, %3, %4));
	,
		delayedcall(delay_analytics_event,0.5,sendEvent_analytics(%1,%2,%3,%4));
	);
</action>

<action name="changeLanguage_analytics">
	if(ptplugin[analytics].jsready,
		stopdelayedcall(delay_analytics_lang);
		js(invokePluginFunction(analytics, changeLanguage));
	,
		delayedcall(delay_analytics_lang,0.1,changeLanguage_analytics());
	);
</action>

<events name="kolorAnalyticsEvents_analytics" 
	keep="true"
	onTourStart="sendEvent_analytics('panotour','tour start', 'M65');"
	onnewpano="sendPage_analytics(get(scene[get(xml.scene)].name), get(scene[get(xml.scene)].titleid));"
	changetourlanguage="changeLanguage_analytics();"
	/>

<!-- ********** -->
<!-- Include of a XML file -->
<!-- id : includePlugin -->
<!-- ********** -->
<include url="%FIRSTXML%/graphics/include/next_thumb.xml"/>

<!-- ********** -->
<!-- Bouton du mode VR -->
<!-- id : webvrbutton -->
<!-- ********** -->

	<layer name="webvrbutton"
		keep="true"
		blocked="false"
		url="%FIRSTXML%/graphics/webvrbutton/icon-vr.png" 
		align="topright"
		x="10"
		y="10"
		zorder="9"
		visible="false"
		onclick="js(accessWebVr());
"
		tooltip="webvrbuttontooltip"
		onhover="showTooltip('plugin');"
		onout="hideTooltip();"

		height="8%"
		width="5%"
		/>

	<events name="webvrbuttonevents"
		onvrunavailable="hidewebvrbutton(true);"
		onTourStart="showwebvrbutton();"
		keep="true" />
	<action name="hidewebvrbutton">if(%1 == true,set(layer[webvrbutton].blocked, true););set(layer[webvrbutton].visible, false);</action>
	<action name="showwebvrbutton">if(layer[webvrbutton].blocked == false,set(layer[webvrbutton].visible, true););</action>


<!-- ********** -->
<!-- Bouton Bascule -->
<!-- id : togglebutton -->
<!-- ********** -->



  <layer name="togglebutton"
         keep="true"
         url="%FIRSTXML%/graphics/togglebutton/avant.png" 
         align="bottom"
         x="10"
         y="10"
         zorder="10"
         state="true"
         onclick="togglebuttonOnClick"
         onout=""
         height="5%"
         width="15%"
         visible="false"
         />

  <action name="togglebuttonOnClick">
    if (state,
      set(state, false);
          mainloadscene(pano36);lookat(get(panoview.h), get(panoview.v), get(panoview.fov));


      set(url,%FIRSTXML%/graphics/togglebutton/apres.png);
     ,
      set(state, true);
          mainloadscene(pano14);lookat(get(panoview.h), get(panoview.v), get(panoview.fov));


      set(url,%FIRSTXML%/graphics/togglebutton/avant.png);
    );
  </action>

  <events name="togglebuttonevents" 
    onTourStart="showtogglebutton();"
    hidetourcontrols="hidetogglebutton();" 
    showtourcontrols="showtogglebutton();" 
    keep="true" />
  <action name="hidetogglebutton">set(layer[togglebutton].visible, false);</action>
  <action name="showtogglebutton">if(tour_displaycontrols,set(layer[togglebutton].visible, true);,hidetogglebutton(););</action>


  <!-- Fullscreen Management -->
  <action name="exitFullScreen" devices="fullscreensupport">set(tour_fullscreen,false);js(setFullscreen(false));</action>
  <action name="enterFullScreen" devices="fullscreensupport">set(tour_fullscreen,true);js(setFullscreen(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>
  <action name="enterFullScreenChangeEvent" devices="fullscreensupport">set(tour_fullscreen,true);events.dispatch(onenterfullscreen);</action>
  <action name="exitFullScreenFallback">set(fullscreen,false);</action>
  <action name="enterFullScreenFallback">set(fullscreen,true);</action>
  
  <action name="resizeFullScreenEvent">delayedcall(0,updatescreen(););</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>