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

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


  <style name="IconDefaultPointSpotStyle"
         url="%FIRSTXML%/spots/point2_user_defaultpoint0.png"
         visible="false"
         edge="center"
         alpha="0.8"
         onhover="onhoverIconDefaultPointSpotStyle"
         onover="onoverIconDefaultPointSpotStyle"
         onout="onoutIconDefaultPointSpotStyle"


         width="40"
         height="prop"
         />
  <action name="onhoverIconDefaultPointSpotStyle">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconDefaultPointSpotStyle">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

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

  </action>



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


      
  <!-- Picture Spot Style - Default Picture Spot Style -->

  <style name="RectPictureDefaultPictureSpotStyle"
         distorted="true"
         visible="false"
         scale="1.0" 
         onhover="onhoverRectPictureDefaultPictureSpotStyle"
         onout="onoutRectPictureDefaultPictureSpotStyle"
         />
  <action name="onhoverRectPictureDefaultPictureSpotStyle">
    showTooltip('hotspot');
  </action>
  <action name="onoutRectPictureDefaultPictureSpotStyle">
    hideTooltip();
    
  </action>



        
  <!-- Video Spot Style - Default Video Spot Style -->
  <style name="RectVideoDefaultVideoSpotStyleLoader" url="%FIRSTXML%/spots/loadanimation.png" crop="0|0|64|64" ypos="0" frame="0" distorted="true" visible="false" />
  <style name="RectVideoDefaultVideoSpotStyle"
         capture="false"
         visible="false"
         distorted="true"
         scale="1.0"
         url.flash="%SWFPATH%/graphics/videoplayer.swf"
         url.html5="%FIRSTXML%/graphics/videoplayer.js"
         loop="true"
         autoresume="true"
         pausedonstart="true"
         pausedonstart.android="false"
         pauseothersounds="true"
         canstart="false"
         onhover="onhoverRectVideoDefaultVideoSpotStyle"
         onover="onoverRectVideoDefaultVideoSpotStyle"
         onout="onoutRectVideoDefaultVideoSpotStyle"
         onvideoready="onvideoreadyRectVideoDefaultVideoSpotStyle"
         />
  <style name="RectVideoDefaultVideoSpotStyle" 
    directionalsound="true" 
    range="90" 
    devices="flash" 
  />
  <style name="RectVideoDefaultVideoSpotStyle" 
    directionalsound="false" 
    devices="html5" 
  />
  <style name="RectVideoDefaultVideoSpotStyle" stateVideo="startplaying" devices="no-ios"/>
  <style name="RectVideoDefaultVideoSpotStyle" stateVideo="startpaused"  devices="ios"   />
  <style name="RectVideoDefaultVideoSpotStyle" stateVideo="startplaying" devices="ios10" />
  <action name="onhoverRectVideoDefaultVideoSpotStyle">
    showTooltip('hotspot');
  </action>
  <action name="onoverRectVideoDefaultVideoSpotStyle">pauseautorotation(forcehotspot);

  </action>
  <action name="onoutRectVideoDefaultVideoSpotStyle">
    hideTooltip();resumeautorotation(forcehotspot);

  </action>
  <action name="onvideoreadyRectVideoDefaultVideoSpotStyle">
    set(isVideoReadyForPlaying, false);
    if (isvideoready,
      if(panovideospotsstate,set(canstart, true););
      if (canstart,
        set(isVideoReadyForPlaying, true);
      );
    );
    if(isVideoReadyForPlaying,
    ifnot(device.ios,
      inc(videospots_playing);
      pauseTourSoundsActions(true,true,true,true,true);
    );

    if(tour_displayspots,
      if(ispaused,
        if(stateVideo == "startplaying",
          set(stateVideo, "playing");
          play();
        );
      );
    );
    if(device.flash OR (device.webgl AND !device.ios),
      if (tour_soundson,
        div(volume, tour_soundsvolume, 100);
      ,
        set(volume, 0);
      );
    ,
      ifnot(device.ios,
        if (tour_soundson,
          js(kpanotour.Sounds.startVideosSounds(get(volume)));
        ,
          js(kpanotour.Sounds.stopVideosSounds());
        );              
      ,
        if (tour_soundson,
          set(muted, false);
        ,
          set(muted, true);
        );
      );
    );
    onvideoreadyspecific();
    ,

      delayedcall(0.5,onvideoreadyRectVideoDefaultVideoSpotStyle());
    );
  </action>
  <action name="animatevideospotloaderRectVideoDefaultVideoSpotStyle">
    if(hotspot[%1],
      if(hotspot[%1].activated,
        set(hotspot[%1].visible, true);
      );
      inc(hotspot[%1].frame,1, 11,0);
      mul(hotspot[%1].ypos, hotspot[%1].frame, 64);
      txtadd(hotspot[%1].crop, '0|', get(hotspot[%1].ypos),'|64|64');
      delayedcall(%2, 0.1, animatevideospotloaderRectVideoDefaultVideoSpotStyle(%1, %2) );
    ,
      stopdelayedcall(%2);
    );
  </action>
  <action name="stopvideospotloaderanimationRectVideoDefaultVideoSpotStyle">
    removehotspot(%1);
  </action>



    
  <!-- Spot Style - botao_fichas -->


  <style name="Iconbotao-fichas"
         url="%FIRSTXML%/spots/botao-info_user_defaultpoint1.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-fichas"
         onover="onoverIconbotao-fichas"
         onout="onoutIconbotao-fichas"


         width="45"
         height="prop"
         />
  <action name="onhoverIconbotao-fichas">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-fichas">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-fichas">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - botao_video -->


  <style name="Iconbotao-video"
         url="%FIRSTXML%/spots/vidbutton_user_defaultpoint2.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-video"
         onover="onoverIconbotao-video"
         onout="onoutIconbotao-video"


         width="55"
         height="prop"
         />
  <action name="onhoverIconbotao-video">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-video">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-video">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - botao_fichas 4 -->


  <style name="Iconbotao-fichas4"
         url="%FIRSTXML%/spots/infobutton3_user_defaultpoint11.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-fichas4"
         onover="onoverIconbotao-fichas4"
         onout="onoutIconbotao-fichas4"


         height="45"
         width="prop"
         />
  <action name="onhoverIconbotao-fichas4">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-fichas4">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-fichas4">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - botao_fichas 5 -->


  <style name="Iconbotao-fichas5"
         url="%FIRSTXML%/spots/infobutton2_user_defaultpoint12.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-fichas5"
         onover="onoverIconbotao-fichas5"
         onout="onoutIconbotao-fichas5"


         height="45"
         width="prop"
         />
  <action name="onhoverIconbotao-fichas5">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-fichas5">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-fichas5">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - botao_video 2 -->


  <style name="Iconbotao-video2"
         url="%FIRSTXML%/spots/video-left_user_defaultpoint15.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-video2"
         onover="onoverIconbotao-video2"
         onout="onoutIconbotao-video2"


         height="45"
         width="prop"
         />
  <action name="onhoverIconbotao-video2">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-video2">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-video2">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - botao_video 3 -->


  <style name="Iconbotao-video3"
         url="%FIRSTXML%/spots/video-right_user_defaultpoint16.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconbotao-video3"
         onover="onoverIconbotao-video3"
         onout="onoutIconbotao-video3"


         height="45"
         width="prop"
         />
  <action name="onhoverIconbotao-video3">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconbotao-video3">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconbotao-video3">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - video_vertical -->


  <style name="Iconvideo-vertical"
         url="%FIRSTXML%/spots/video-right_user_defaultpoint17.png"
         visible="false"
         edge="center"
         zoom="true"

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconvideo-vertical"
         onover="onoverIconvideo-vertical"
         onout="onoutIconvideo-vertical"


         height="45"
         width="prop"
         />
  <action name="onhoverIconvideo-vertical">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconvideo-vertical">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconvideo-vertical">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - YOUTUBE -->


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

         alpha="0.8"
         onloaded="if(scene[get(xml.scene)].planar,if(zoom,set(zoom, false);););"
         onhover="onhoverIconYOUTUBE"
         onover="onoverIconYOUTUBE"
         onout="onoutIconYOUTUBE"


         height="45"
         width="prop"
         />
  <action name="onhoverIconYOUTUBE">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconYOUTUBE">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconYOUTUBE">
    hideTooltip();
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



<!-- ********** -->
<!-- Header3 -->
<!-- id : header -->
<!-- ********** -->

  <layer name="header"
         keep="true"
         type="container"
         bgcolor="0xffffff"
         bgalpha="1"
         align="top"
         x="0"
         y="0"
         zorder="1"
         enabled="false"
         capture="true"
         visible="false"
         height="60"
         width="100%"
         accuracy="1"
         />

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

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

<!-- ********** -->
<!-- Header2 -->
<!-- id : header2 -->
<!-- ********** -->

  <layer name="header2"
         keep="true"
         url="%FIRSTXML%/graphics/header2/bottom.png" 
         align="top"
         x="0"
         y="60"
         zorder="2"
         enabled="false"
         capture="true"
         visible="false"
         height="10"
         width="100%"
         accuracy="1"
         />

  <events name="header2events"
    onTourStart="showheader2();"
    hidetourcontrols="hideheader2();"
    showtourcontrols="showheader2();"
    keep="true" />

  <action name="hideheader2">
    set(layer[header2].visible, false);
  </action>
  <action name="showheader2">
    set(layer[header2].visible, true);
  </action>

<!-- ********** -->
<!-- Header1 -->
<!-- id : header1 -->
<!-- ********** -->

  <layer name="header1"
         keep="true"
         url="%FIRSTXML%/graphics/header1/header.png" 
         align="topleft"
         x="0"
         y="0"
         zorder="3"
         enabled="false"
         capture="true"
         visible="false"
         height="143"
         width="220"
         
         />

  <events name="header1events"
    onTourStart="showheader1();"
    hidetourcontrols="hideheader1();"
    showtourcontrols="showheader1();"
    keep="true" />

  <action name="hideheader1">
    set(layer[header1].visible, false);
  </action>
  <action name="showheader1">
    set(layer[header1].visible, true);
  </action>

<!-- ********** -->
<!-- Rodapé -->
<!-- id : footer -->
<!-- ********** -->

  <layer name="footer"
         keep="true"
         url="%FIRSTXML%/graphics/footer/bottom.png" 
         align="bottom"
         x="0"
         y="-1"
         zorder="4"
         enabled="false"
         capture="true"
         visible="false"
         height="20"
         width="100%"
         accuracy="1"
         />

  <events name="footerevents" 
    onTourStart="showfooter();"
    hidetourcontrols="hidefooter();"
    showtourcontrols="showfooter();"
    keep="true" />

  <action name="hidefooter">
    set(layer[footer].visible, false);
  </action>
  <action name="showfooter">
    set(layer[footer].visible, true);
  </action>

<!-- ********** -->
<!-- Force Landscape on Mobile -->
<!-- id : ForceLandscapeMobilePlugin -->
<!-- ********** -->

	<events name="mobileorientation_events" devices="mobile" keep="true" onresize="mobileorientation_portrait_mode_check();"/>

	<action name="mobileorientation_portrait_mode_check" device="mobile">
		div(aspect, stagewidth, stageheight);
		if(aspect != lastaspect OR '%1' == 'true',
			copy(lastaspect, aspect);
			if(stagewidth GT stageheight,
				tween(layer[mobileorientation_rotate_device_required].alpha, 0.0, 0.0);
			,
				tween(layer[mobileorientation_rotate_device_required].alpha, 1.0);
				delayedcall(3.0, tween(layer[mobileorientation_rotate_device_required].alpha, 0.0, 1.0););
			);
		);
	</action>	

	<layer name="mobileorientation_rotate_device_required" keep="true" devices="mobile" 
		url="%FIRSTXML%/graphics/rotate_device.png" width="80%" height="prop"
		align="center" edge="center"
		autoalpha="true" alpha="0.0"
		enabled="false"
		/>	

<!-- ********** -->
<!-- logo oi futuro -->
<!-- id : logo1 -->
<!-- ********** -->


  <layer align="topleft"
         x="35"
         y="20"
         zorder="7"
         name="logo1"
         keep="true"
         visible="false"
         capture="false"

			tooltip="logo1tooltipText"
			onhover="showTooltip('plugin',logo1TooltipStyle);"
			onout="hideTooltip();"
         url="%FIRSTXML%/graphics/logo1/oifuturo_logocolorida-01.png" 
         onclick="
getmessage(urltoopen,logo1websiteurl);openurl(get(urltoopen),_blank);
"

         height="100"
         width="prop"

         />

  <events name="logo1events" 
    onTourStart="showlogo1();"
    hidetourcontrols="hidelogo1();"
    showtourcontrols="showlogo1();"
    keep="true" />

  <action name="hidelogo1">
    set(layer[logo1].visible, false);
  </action>
  <action name="showlogo1">
    if (tour_displaycontrols,
      set(layer[logo1].visible, true);
    );
  </action>



<layer name="logo1TooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	type="text"
	align="center"
	bg="false"
	bgborder="0"
	txtshadow="1.0 1.0 4.0 0x000000 1"
	css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
	edge="bottom"
	interactivecontent="false"
	zorder="0"
	padding="2"
	xoffset="0"
	yoffset="0"
	visible="false"
	html=""
/>


<!-- ********** -->
<!-- logo Oi -->
<!-- id : button5 -->
<!-- ********** -->

  <layer name="button5"
         keep="true"
         url="%FIRSTXML%/graphics/button5/logooi_site.png"
         align="topright"
         x="250"
         y="10"
         zorder="8"
         visible="false"
         onclick="button5OnClick"
         tooltip="button5tooltip"
         onhover="showTooltip('plugin',button5TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         width="40"
         height="prop"
         />



  <action name="button5OnClick">getmessage(urltoopen,button5onclick104799openurlwebsiteurl);openurl(get(urltoopen),_blank);


  </action>

  <events name="button5events"
    onTourStart="showbutton5();"
    hidetourcontrols="hidebutton5();"
    showtourcontrols="showbutton5();"
    keep="true" />
  <action name="hidebutton5">set(layer[button5].visible, false);</action>
  <action name="showbutton5">if(tour_displaycontrols,set(layer[button5].visible, true);,hidebutton5(););</action>

<layer name="button5TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="false"
  bgborder="0"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- Partilha Social -->
<!-- id : socialShare -->
<!-- ********** -->


<ptplugin name="socialShare" engine="kolorBox">
	<settings>
		<option name="position" value="center" type="string" />
		<option name="margin_x" value="0" type="int" />
		<option name="margin_y" value="0" type="int" />
		<option name="external_padding" value="15" type="int" />
		<option name="animate" value="false" type="bool" />
		<option name="draggable_box" value="false" type="bool" />
		<option name="container_auto_size" value="true" type="bool" />
		<option name="container_color" value="434343" type="string" />
		<option name="container_alpha" value="0.80000000000000004" type="float" />
		<option name="container_topleft_border_radius" value="0" type="int" />
		<option name="container_topright_border_radius" value="0" type="int" />
		<option name="container_bottomleft_border_radius" value="0" type="int" />
		<option name="container_bottomright_border_radius" value="0" type="int" />
		<option name="container_border_width" value="0" type="int" />
		<option name="container_border_color" value="ffffff" type="string" />
		<option name="container_border_alpha" value="1" type="float" />
		<option name="overlay_displayed" value="false" type="bool" />
		<option name="overlay_color" value="000000" type="string" />
		<option name="overlay_alpha" value="0.50000762951094835" type="float" />

		<option name="social_btn" value="facebook#twitter#linkedin#email" type="string" />
		<option name="social_btn_icons" value="iconset1" type="string" />

		<option name="social_orientation" value="horizontal" type="string" />
		<option name="social_btn_size" value="40" type="int" />
		<option name="inner_margin" value="10" type="int" />
		
		
		<option name="title_displayed" value="false" type="bool" />
		<option name="caption_displayed" value="false" type="bool" />
		<option name="close_displayed" value="true" type="bool" />
		<option name="close_position" value="topright" type="string" />
		<option name="close_text" value="socialShareclose_text" type="string" />

		<option name="close_callback" value="invokeKrFunction('closeKolorBoxCallback_socialShare')" type="string" />
		<option name="zorder" value="9" type="int" />
		<option name="use_i18n" value="true" type="bool" />
	</settings>
	<internaldata>

	</internaldata>
</ptplugin>

<action name="kolorBoxJsReady_socialShare">
	set(ptplugin[socialShare].jsready, true);

</action>



<action name="showSocialShare_socialShare">
	ifnot(ptplugin[socialShare].isOpen,
		set(ptplugin[socialShare].isOpen, true);
		pauseautorotation(forceplugin);

			js(invokePluginFunction(socialShare, loadSingleArrayItem, social));
		events.dispatch(onremovedisplayedobject);
	);
</action>

<action name="toggleSocialShare_socialShare">
	js(invokePluginFunction(socialShare, toggleKolorBox, %1));
</action>


<action name="closeKolorBox_socialShare">
	js(invokePluginFunction(socialShare, closeKolorBox));
</action>

<action name="closeKolorBoxCallback_socialShare">
	resumeautorotation(forceplugin);

	
	set(ptplugin[socialShare].isOpen, false);
</action>

<action name="changeLanguage_socialShare">
	if(ptplugin[socialShare].jsready,
		js(invokePluginFunction(socialShare, changeLanguage));
	);
</action>

<events name="kolorBoxEvents_socialShare" 
	keep="true"
	onsharetour="showSocialShare_socialShare();" 
	
	
	changetourlanguage="changeLanguage_socialShare();"
	/>

<!-- ********* -->
<!-- Gyroscope -->
<!-- ********* -->


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

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

<events name="gyroscopeEvents" onnewpano="planarGyroscopeTest();" keep="true" />

<action name="planarGyroscopeTest">
  if(plugin[gyroscope],
    if(scene[get(xml.scene)].full360,
      set(sceneisfull360, false);
      sub(viewhfov, panoview.hmax, panoview.hmin);
      if (viewhfov == 360,
        sub(viewvfov, panoview.vmax, panoview.vmin);
        if (viewvfov == 180,
          set(sceneisfull360, true);
        );
      );
      if (sceneisfull360,
        set(plugin[gyroscope].camroll, true);
      ,
        set(plugin[gyroscope].camroll, false);
      );
    ,
      set(plugin[gyroscope].camroll, false);
    );
  );
</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>

<!-- ********** -->
<!-- Barra de Progresso e Loopings -->
<!-- id : progressbar -->
<!-- ********** -->

  <progress showwait.flash="loopings(
				0xffffff,
				15,20,
				0,0,
				0xffffff,10,
				0,120,bottom
				)"
			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="bottom"
         x="0" y="120"
         frame="0" frames="12"
         width="40"
         height="40" />

<!-- ********** -->
<!-- Controles -->
<!-- id : controlBar_i -->
<!-- ********** -->

  <krpano controlBar_ibarbuilt="false" controlBar_ibackgroundwidthwhenclosed="0" controlBar_ibackgroundwidthwhenopened="0" controlBar_iIsOpened="false" />
  <events name="controlBar_ievents" 
    onxmlcomplete="controlBar_ibuildMenuBar();" 


    keep="true" />



  <action name="controlBar_ibuildMenuBar">
    ifnot (controlBar_ibarbuilt, controlBar_ibuildMenu(); set(controlBar_ibarbuilt, true););
  </action>

  <style name="controlBar_i_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', controlBar_imenuTooltipStyle, bottom);"
         onout="hideTooltip();"
         />
  <style name="controlBar_i_btn_style_off"
         keep="true"
         edge="right"
         align="right"
         x="0" y="0"
         width="40" height="40"
         onhover="showTooltip('plugin', controlBar_imenuTooltipStyle, bottom);"
         onout="hideTooltip();"
         />

  <layer name="controlBar_i_menu_bg"
         keep="true"
         type="container"
         zorder="12"
         width="40"
         height="40"
         align="bottom"
         x="0" y="30"
         maskchildren="true"
         rotate="0"
         visible="false"
         >

    <layer name="controlBar_ibtn_gyroscope_off"
            url="%FIRSTXML%/graphics/icontrolbar/btn_gyroscope.png"
            style="controlBar_i_btn_style"
            onclick="disableGyroscope();
"
            devices="html5"
            tooltip="controlBar_igyroOffTip"
            visible="false"
            />
    <layer name="controlBar_ibtn_gyroscope_on"
            url="%FIRSTXML%/graphics/icontrolbar/btn_gyroscope.png"
            style="controlBar_i_btn_style"
            onclick="enableGyroscope();
"
            devices="html5"
            tooltip="controlBar_igyroOnTip"
            visible="false"
            />
    <layer name="controlBar_ibtn_gyroscope_not"
            url="%FIRSTXML%/graphics/icontrolbar/btn_gyroscope_off.png"
            style="controlBar_i_btn_style_off"
            enabled="true"
            capture="false"
            devices="html5"
            tooltip="controlBar_igyroNotTip"
            visible="false"
            />


    <layer name="controlBar_ibtn_in"
            url="%FIRSTXML%/graphics/icontrolbar/btn_zoom_in.png"
            ondown="viewControlZoomIn(false);"
            onup="viewControlZoomStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_izoomInTip"
            devices="desktop"
            />
    <layer name="controlBar_ibtn_out"
            url="%FIRSTXML%/graphics/icontrolbar/btn_zoom_out.png"
            ondown="viewControlZoomOut(false);
"
            onup="viewControlZoomStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_izoomOutTip"
            devices="desktop"
            />

    <layer name="controlBar_ibtn_left"
            url="%FIRSTXML%/graphics/icontrolbar/btn_move_left.png"
            ondown="viewControlMoveLeft(false);
"
            onup="viewControlMoveHoriStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_imoveLeftTip"
            devices="desktop"
            />
    <layer name="controlBar_ibtn_right"
            url="%FIRSTXML%/graphics/icontrolbar/btn_move_right.png"
            ondown="viewControlMoveRight(false);
"
            onup="viewControlMoveHoriStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_imoveRightTip"
            devices="desktop"
            />

    <layer name="controlBar_ibtn_up"
            url="%FIRSTXML%/graphics/icontrolbar/btn_move_up.png"
            ondown="viewControlMoveUp(false);
"
            onup="viewControlMoveVertStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_imoveUpTip"
            devices="desktop"
            />
    <layer name="controlBar_ibtn_down"
            url="%FIRSTXML%/graphics/icontrolbar/btn_move_down.png"
            ondown="viewControlMoveDown(false);
"
            onup="viewControlMoveVertStop();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_imoveDownTip"
            devices="desktop"
            />


    <layer name="controlBar_ibtn_sound_on"
            url="%FIRSTXML%/graphics/icontrolbar/btn_start_sound.png"
            onclick="playTourSounds();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_isoundsOnTip"
            />
    <layer name="controlBar_ibtn_sound_off"
            url="%FIRSTXML%/graphics/icontrolbar/btn_stop_sound.png"
            onclick="stopTourSounds();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_isoundsOffTip"
            />


    <layer name="controlBar_ibtn_prev_pano"
            url="%FIRSTXML%/graphics/icontrolbar/btn_previous_scene.png"
            onclick="loadPreviousScene();
"
            style="controlBar_i_btn_style"
            tooltip="controlBar_iprevSceneTip"
            visible="false"
            />
    <layer name="controlBar_ibtn_next_pano"
            url="%FIRSTXML%/graphics/icontrolbar/btn_next_scene.png"
            onclick="loadNextScene();
"
            style="controlBar_i_btn_style"
            tooltip="controlBar_inextSceneTip"
            visible="false"
            />


    <layer name="controlBar_ibtn_display_map"
            url="%FIRSTXML%/graphics/icontrolbar/btn_map.png"
            onclick="controlBar_idisplayMap();"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_idisplayMapTip"
            />
    <layer name="controlBar_ibtn_hide_map"
            url="%FIRSTXML%/graphics/icontrolbar/btn_map.png"
            onclick="controlBar_ihideMap();"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_ihideMapTip"
            />

    <layer name="controlBar_ibtn_share"
            url="%FIRSTXML%/graphics/icontrolbar/btn_share.png"
            onclick="shareTour();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_ishareTip"
            />


    <layer name="controlBar_ibtn_openfs"
            url="%FIRSTXML%/graphics/icontrolbar/btn_enter_fs.png"
            onclick="enterFullscreen();
"
            style="controlBar_i_btn_style"
            visible="false"
            devices="fullscreensupport"
            tooltip="controlBar_iopenFsTip"
            />
    <layer name="controlBar_ibtn_closefs"
            url="%FIRSTXML%/graphics/icontrolbar/btn_close_fs.png"
            onclick="exitFullscreen();
"
            style="controlBar_i_btn_style"
            visible="false"
            devices="fullscreensupport"
            tooltip="controlBar_icloseFsTip"
            />

    <layer name="controlBar_ibtn_autorotate_on"
            url="%FIRSTXML%/graphics/icontrolbar/btn_start_autorotation.png"
            onclick="resumeautorotation();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_iautorotateOnTip"
            />
    <layer name="controlBar_ibtn_autorotate_off"
            url="%FIRSTXML%/graphics/icontrolbar/btn_stop_autorotation.png"
            onclick="pauseautorotation();
"
            style="controlBar_i_btn_style"
            visible="false"
            tooltip="controlBar_iautorotateOffTip"
            />





    <layer name="controlBar_ibtn_hidecontrols"
           url="%FIRSTXML%/graphics/icontrolbar/btn_hide_controls.png"
           style="controlBar_i_btn_style"
           onclick="controlBar_ihideMenuControls();hideTourControls();
"
           visible="false"
           tooltip="controlBar_ihideControlsTip"
           />
    <layer name="controlBar_ibtn_showcontrols"
           url="%FIRSTXML%/graphics/icontrolbar/btn_show_controls.png"
           style="controlBar_i_btn_style"
           onclick="controlBar_ishowMenuControls();showTourControls();
"
           tooltip="controlBar_idisplayControlsTip"
           visible="false"
           />
 </layer>




  <events name="controlBar_igyroscopeavailableevent"
          ongyroscopeavailable="controlBar_iupdateGyroscopeButtonsAvailability();"
          ongyroscopeunavailable="controlBar_iupdateGyroscopeButtonsAvailability();"
          ongyroscopeon="controlBar_ienableGyroscopeButtons(true);"
          ongyroscopeoff="controlBar_ienableGyroscopeButtons(false);"
          keep="true" devices="html5" />
  <krpano controlBar_imenugyroscopeavailable="false" controlBar_imenugyroscopeenabled="false"/>
  <action name="controlBar_iupdateGyroscopeButtonsAvailability">
    if (tour_gyroscopedevices,
      set(controlBar_imenugyroscopeavailable, true);
      controlBar_iupdateGyroscopeButtons();
    ,
      set(controlBar_imenugyroscopeavailable, false);
      controlBar_iupdateGyroscopeButtons();
    );
  </action>
  <action name="controlBar_ienableGyroscopeButtons">
    if (tour_gyroscopedevices,
      set(controlBar_imenugyroscopeenabled, %1);
      controlBar_iupdateGyroscopeButtons();
    );
  </action>
	<action name="controlBar_iHideGyroscopeButtons">
		set(layer[controlBar_ibtn_gyroscope_off].visible, false);
		set(layer[controlBar_ibtn_gyroscope_on].visible, false);
		if('%1' == 'true' AND plugin[gyroscope],
			set(layer[controlBar_ibtn_gyroscope_not].visible, true);
		,
			set(layer[controlBar_ibtn_gyroscope_not].visible, false);
		);
	</action>
	<action name="controlBar_iShowGyroscopeButtons">
		if (controlBar_imenugyroscopeavailable,
			if (controlBar_imenugyroscopeenabled,
				set(layer[controlBar_ibtn_gyroscope_off].visible, true);
				set(layer[controlBar_ibtn_gyroscope_on].visible, false);
			,
				set(layer[controlBar_ibtn_gyroscope_off].visible, false);
				set(layer[controlBar_ibtn_gyroscope_on].visible, true);
			);
			set(layer[controlBar_ibtn_gyroscope_not].visible, false);
		,
			controlBar_iHideGyroscopeButtons(true);
		);
	</action>
	<action name="controlBar_iupdateGyroscopeButtons">
	if (tour_gyroscopedevices,
		if (controlBar_iIsOpened,
			controlBar_iShowGyroscopeButtons();
		,
			controlBar_iHideGyroscopeButtons();
		);
	,
		if (controlBar_iIsOpened,
			controlBar_iHideGyroscopeButtons(true);
		,
			controlBar_iHideGyroscopeButtons();
		);
	);
	</action>



  <action name="controlBar_ihideMenuControls">
    set(controlBar_iIsOpened, false);
    set(layer[controlBar_ibtn_hidecontrols].visible, false);
    set(layer[controlBar_ibtn_showcontrols].visible, true);
if (scene.count GT 1,
	set(layer[controlBar_ibtn_next_pano].visible, false);
	set(layer[controlBar_ibtn_prev_pano].visible, false);
);

set(layer[controlBar_ibtn_share].visible, false);

if (device.desktop,
	set(layer[controlBar_ibtn_in].visible, false);
	set(layer[controlBar_ibtn_out].visible, false);
);
if (device.desktop,
	set(layer[controlBar_ibtn_up].visible, false);
	set(layer[controlBar_ibtn_down].visible, false);
);
if (device.desktop,
	set(layer[controlBar_ibtn_left].visible, false);
	set(layer[controlBar_ibtn_right].visible, false);
);
	controlBar_iupdateFullscreenButtons();


	controlBar_iupdateAutorotationButtons();

	controlBar_iupdateSoundButtons();
	controlBar_iupdateGyroscopeButtons();


	controlBar_iupdateMapButtons();



	set(layer[controlBar_i_menu_bg].width, get(controlBar_ibackgroundwidthwhenclosed));

	set(layer[controlBar_i_menu_bg].visible, true);
  </action>
  <action name="controlBar_ishowMenuControls">
    set(controlBar_iIsOpened, true);
    set(layer[controlBar_ibtn_hidecontrols].visible, true);
    set(layer[controlBar_ibtn_showcontrols].visible, false);
	set(layer[controlBar_i_menu_bg].visible, true);
if (scene.count GT 1,
	set(layer[controlBar_ibtn_next_pano].visible, true);
	set(layer[controlBar_ibtn_prev_pano].visible, true);
);

set(layer[controlBar_ibtn_share].visible, true);

if (device.desktop,
	set(layer[controlBar_ibtn_in].visible, true);
	set(layer[controlBar_ibtn_out].visible, true);
);
if (device.desktop,
	set(layer[controlBar_ibtn_up].visible, true);
	set(layer[controlBar_ibtn_down].visible, true);
);
if (device.desktop,
	set(layer[controlBar_ibtn_left].visible, true);
	set(layer[controlBar_ibtn_right].visible, true);
);
	controlBar_iupdateFullscreenButtons();


	controlBar_iupdateAutorotationButtons();

	controlBar_iupdateSoundButtons();
	controlBar_iupdateGyroscopeButtons();


	controlBar_iupdateMapButtons();


    set(layer[controlBar_i_menu_bg].width, get(controlBar_ibackgroundwidthwhenopened));
  </action>


  <action name="controlBar_idisplayMap">showMap();

  </action>
  <action name="controlBar_ihideMap">hideMap();

  </action>
  
  <events name="controlBar_idisplaymapchangeevent"
          onshowtourmap="controlBar_iupdateMapButtons();"
          onhidetourmap="controlBar_iupdateMapButtons();"
          keep="true"/>
	<action name="controlBar_iHideMapButtons">
		set(layer[controlBar_ibtn_display_map].visible, false);
		set(layer[controlBar_ibtn_hide_map].visible, false);
	</action>
	<action name="controlBar_iShowMapButtons">
		if (tour_displaymap,
			set(layer[controlBar_ibtn_hide_map].visible, true);
			set(layer[controlBar_ibtn_display_map].visible, false);
		,
			set(layer[controlBar_ibtn_display_map].visible, true);
			set(layer[controlBar_ibtn_hide_map].visible, false);
		);
	</action>
	<action name="controlBar_iupdateMapButtons">
		if (controlBar_iIsOpened,
			controlBar_iShowMapButtons();
		,
			controlBar_iHideMapButtons();
		);
	</action>



  <events name="controlBar_imenufullscreenchangeevent"
          onenterfullscreen="controlBar_iupdateFullscreenButtons();"
          onexitfullscreen="controlBar_iupdateFullscreenButtons();"
          keep="true"/>
	<action name="controlBar_iHideFullscreenButtons">
		set(layer[controlBar_ibtn_openfs].visible , false);
		set(layer[controlBar_ibtn_closefs].visible, false);
	</action>
	<action name="controlBar_iShowFullscreenButtons">
		if (device.fullscreensupport,
			if(tour_fullscreen,
				set(layer[controlBar_ibtn_openfs].visible , false);
				set(layer[controlBar_ibtn_closefs].visible, true);
			,
				set(layer[controlBar_ibtn_openfs].visible ,true);
				set(layer[controlBar_ibtn_closefs].visible,false);
			);
		,
			controlBar_iHideFullscreenButtons();
		);
	</action>
	<action name="controlBar_iupdateFullscreenButtons">
		if (controlBar_iIsOpened,
			controlBar_iShowFullscreenButtons();
		,
			controlBar_iHideFullscreenButtons();
		);
	</action>

	<events name="controlBar_iAutorotationEvents"
		onstartautorotation="controlBar_iupdateAutorotationButtons();"
		onresumeautorotation="controlBar_iupdateAutorotationButtons();"
		onstopautorotation="controlBar_iupdateAutorotationButtons();"
		onpauseautorotation="controlBar_iupdateAutorotationButtons();"
		keep="true"/>
	<action name="controlBar_iHideAutorotationButtons">
		set(layer[controlBar_ibtn_autorotate_off].visible, false);
		set(layer[controlBar_ibtn_autorotate_on].visible , false);
	</action>
	<action name="controlBar_iShowAutorotationButtons">
		if(autorotate.enabled == false,
			set(layer[controlBar_ibtn_autorotate_off].visible, false);
			set(layer[controlBar_ibtn_autorotate_on].visible , true);
		,
			set(layer[controlBar_ibtn_autorotate_off].visible, true);
			set(layer[controlBar_ibtn_autorotate_on].visible , false);
		);
	</action>
	<action name="controlBar_iupdateAutorotationButtons">
		if (controlBar_iIsOpened,
			controlBar_iShowAutorotationButtons();
		,
			controlBar_iHideAutorotationButtons();
		);
	</action>


  <events name="controlBar_iplaystopsoundsevent" playtoursoundsevent="controlBar_iupdateSoundButtons();" stoptoursoundsevent="controlBar_iupdateSoundButtons();" keep="true"/>
	<action name="controlBar_iHideSoundButtons">
		set(layer[controlBar_ibtn_sound_off].visible, false);
		set(layer[controlBar_ibtn_sound_on].visible , false);
	</action>
	<action name="controlBar_iShowSoundButtons">
		if (tour_soundson == false,
			set(layer[controlBar_ibtn_sound_off].visible, false);
			set(layer[controlBar_ibtn_sound_on].visible , true);
		,
			set(layer[controlBar_ibtn_sound_off].visible, true);
			set(layer[controlBar_ibtn_sound_on].visible , false);
		);
	</action>
	<action name="controlBar_iupdateSoundButtons">
		if (controlBar_iIsOpened,
			controlBar_iShowSoundButtons();
		,
			controlBar_iHideSoundButtons();
		);
	</action>


<layer name="controlBar_imenuTooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	type="text"
	align="center"
	bg="true"
	bgcolor="0x434343"
	bgalpha="0.80000000000000004"
  bgroundedge="3"
	bgborder="0"
	bgshadow="1.0 1.0 4.0 0x000000 1"
	txtshadow="1.0 1.0 4.0 0x000000 1"
	css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
	xoffset="0"
	yoffset="0"
	padding="2"
	interactivecontent="false"
	zorder="0"
	visible="false"
	html=""
	edge="bottom"
/>
  <action name="controlBar_ibuildMenu">
    
    set(controlBar_ibutton_pos, 0);

	set(controlBar_ibackgroundwidthwhenclosed, 40);
    set(layer[controlBar_ibtn_hidecontrols].x, get(controlBar_ibutton_pos));
    set(layer[controlBar_ibtn_showcontrols].x, get(controlBar_ibutton_pos));
    inc(controlBar_ibutton_pos, 45);



      if (device.fullscreensupport,
        set(layer[controlBar_ibtn_openfs].x , get(controlBar_ibutton_pos));
        set(layer[controlBar_ibtn_closefs].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
      );


      set(layer[controlBar_ibtn_share].x, get(controlBar_ibutton_pos));
      inc(controlBar_ibutton_pos, 45);

      set(layer[controlBar_ibtn_display_map].x , get(controlBar_ibutton_pos));
      set(layer[controlBar_ibtn_hide_map].x    , get(controlBar_ibutton_pos));
      inc(controlBar_ibutton_pos, 45);


      set(layer[controlBar_ibtn_autorotate_on].x , get(controlBar_ibutton_pos));
      set(layer[controlBar_ibtn_autorotate_off].x, get(controlBar_ibutton_pos));
      inc(controlBar_ibutton_pos, 45);


      set(layer[controlBar_ibtn_sound_on].x , get(controlBar_ibutton_pos));
      set(layer[controlBar_ibtn_sound_off].x, get(controlBar_ibutton_pos));
      inc(controlBar_ibutton_pos, 45);





      if(plugin[gyroscope],
        set(controlBar_iDisplayGyroscopeButton, false);
        if (device.tablet, set(controlBar_iDisplayGyroscopeButton, true););
        if (device.mobile, set(controlBar_iDisplayGyroscopeButton, true););
        if(controlBar_iDisplayGyroscopeButton,
          set(layer[controlBar_ibtn_gyroscope_on].x , get(controlBar_ibutton_pos));
          set(layer[controlBar_ibtn_gyroscope_off].x, get(controlBar_ibutton_pos));
          set(layer[controlBar_ibtn_gyroscope_not].x, get(controlBar_ibutton_pos));
          inc(controlBar_ibutton_pos, 45);
        );
      );


      if (device.desktop,
        set(layer[controlBar_ibtn_right].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
        set(layer[controlBar_ibtn_left].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
      );

      if (device.desktop,
        set(layer[controlBar_ibtn_down].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
        set(layer[controlBar_ibtn_up].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
      );

      if (device.desktop,
        set(layer[controlBar_ibtn_out].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
        set(layer[controlBar_ibtn_in].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
      );

    if (scene.count GT 1,
        set(layer[controlBar_ibtn_next_pano].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
        set(layer[controlBar_ibtn_prev_pano].x, get(controlBar_ibutton_pos));
        inc(controlBar_ibutton_pos, 45);
      );



      dec(controlBar_ibutton_pos, 5);

      set(controlBar_ibackgroundwidthwhenopened, get(controlBar_ibutton_pos));


    
      set(layer[controlBar_i_menu_bg].width, get(controlBar_ibackgroundwidthwhenopened));
	
	
	
    </action>

	<events name="controlBar_iStartTourEvents" onTourStart="controlBar_iCallOnStartTour();" keep="true" />
	
	<action name="controlBar_iCallOnStartTour">
		
		controlBar_ishowMenuControls();
	</action>




<!-- ********** -->
<!-- Ajuda -->
<!-- id : webvrbutton -->
<!-- ********** -->


	<layer name="webvrbutton"
		keep="true"
		blocked="false"
		alpha="1"
		url="%FIRSTXML%/graphics/webvrbutton/btn_webvr.png"
		align="topright"
		x="20"
		y="80"
		zorder="13"
		visible="false"
		onclick="if(scene[get(xml.scene)].full360 AND disableCurrentSceneVrConservation !== true,
    js(accessWebVr(get(xml.scene),get(videoscenestarttime)));
,
    js(accessWebVr(null));
);"

		width="60"
		height="prop"
		crop="0|0|100|63"
		/>

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


<!-- ********** -->
<!-- Ajuda1 -->
<!-- id : button -->
<!-- ********** -->

  <layer name="button"
         keep="true"
         url="%FIRSTXML%/graphics/button/help_button.png"
         align="topright"
         x="20"
         y="15"
         zorder="14"
         visible="false"
         onclick="buttonOnClick"
         tooltip="buttontooltip"
         onhover="showTooltip('plugin',buttonTooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         width="30"
         height="prop"
         />



  <action name="buttonOnClick">
displayImage(%FIRSTXML%/graphics/button/ajuda.png
             ,center,0,0
             ,700,prop
             ,true
             ,true
             ,false
             ,false
             ,000000
             ,0.80000000000000004);

  </action>

  <events name="buttonevents"
    onTourStart="showbutton();"
    hidetourcontrols="hidebutton();"
    showtourcontrols="showbutton();"
    keep="true" />
  <action name="hidebutton">set(layer[button].visible, false);</action>
  <action name="showbutton">if(tour_displaycontrols,set(layer[button].visible, true);,hidebutton(););</action>

<layer name="buttonTooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="false"
  bgborder="0"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- instagram -->
<!-- id : button4 -->
<!-- ********** -->

  <layer name="button4"
         keep="true"
         url="%FIRSTXML%/graphics/button4/k1gogv-logo-instagram-cut-out-png.png"
         align="topright"
         x="70"
         y="15"
         zorder="15"
         visible="false"
         onclick="button4OnClick"
         tooltip="button4tooltip"
         onhover="showTooltip('plugin',button4TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         width="30"
         height="prop"
         />



  <action name="button4OnClick">getmessage(urltoopen,button4onclick105517openurlwebsiteurl);openurl(get(urltoopen),_blank);


  </action>

  <events name="button4events"
    onTourStart="showbutton4();"
    hidetourcontrols="hidebutton4();"
    showtourcontrols="showbutton4();"
    keep="true" />
  <action name="hidebutton4">set(layer[button4].visible, false);</action>
  <action name="showbutton4">if(tour_displaycontrols,set(layer[button4].visible, true);,hidebutton4(););</action>

<layer name="button4TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="false"
  bgborder="0"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- twitter -->
<!-- id : button3 -->
<!-- ********** -->

  <layer name="button3"
         keep="true"
         url="%FIRSTXML%/graphics/button3/twitter-logo-1-1.png"
         align="topright"
         x="120"
         y="15"
         zorder="16"
         visible="false"
         onclick="button3OnClick"
         tooltip="button3tooltip"
         onhover="showTooltip('plugin',button3TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         width="30"
         height="prop"
         />



  <action name="button3OnClick">getmessage(urltoopen,button3onclick105265openurlwebsiteurl);openurl(get(urltoopen),_blank);


  </action>

  <events name="button3events"
    onTourStart="showbutton3();"
    hidetourcontrols="hidebutton3();"
    showtourcontrols="showbutton3();"
    keep="true" />
  <action name="hidebutton3">set(layer[button3].visible, false);</action>
  <action name="showbutton3">if(tour_displaycontrols,set(layer[button3].visible, true);,hidebutton3(););</action>

<layer name="button3TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="false"
  bgborder="0"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- facebook -->
<!-- id : button2 -->
<!-- ********** -->

  <layer name="button2"
         keep="true"
         url="%FIRSTXML%/graphics/button2/facebooks.png"
         align="topright"
         x="170"
         y="15"
         zorder="17"
         visible="false"
         onclick="button2OnClick"
         tooltip="button2tooltip"
         onhover="showTooltip('plugin',button2TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         width="30"
         height="prop"
         />



  <action name="button2OnClick">getmessage(urltoopen,button2onclick104799openurlwebsiteurl);openurl(get(urltoopen),_blank);


  </action>

  <events name="button2events"
    onTourStart="showbutton2();"
    hidetourcontrols="hidebutton2();"
    showtourcontrols="showbutton2();"
    keep="true" />
  <action name="hidebutton2">set(layer[button2].visible, false);</action>
  <action name="showbutton2">if(tour_displaycontrols,set(layer[button2].visible, true);,hidebutton2(););</action>

<layer name="button2TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="false"
  bgborder="0"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- INTRODUCAO -->
<!-- id : picture -->
<!-- ********** -->

  <layer name="picture"
         keep="true"
         url="%FIRSTXML%/graphics/picture/unas_oifuturo_janela_v03-1.jpg" 
         align="center"
         x="0"
         y="0"
         zorder="18"

         handcursor="true"
         onclick="hidepicture();"
         visible="false"
         height="500"
         width="prop"
         />

  <events name="pictureevents" 
    onTourStart="showpicture(false);"
    hidetourcontrols="hidepicture();" 
    showtourcontrols="showpicture(false);" 
    keep="true" />

  <action name="hidepicture">set(layer[picture].visible, false);</action>
  <action name="showpicture">if(%1 == true,set(layer[picture].visible, true);,if(tour_displaycontrols,set(layer[picture].visible, true);,hidepicture();););</action>

<!-- ********** -->
<!-- Logo3 -->
<!-- id : logo3 -->
<!-- ********** -->


  <layer align="bottomright"
         x="20"
         y="30"
         zorder="19"
         name="logo3"
         keep="true"
         visible="false"
         capture="false"

			tooltip="logo3tooltipText"
			onhover="showTooltip('plugin',logo3TooltipStyle);"
			onout="hideTooltip();"
         url="%FIRSTXML%/graphics/logo3/logo_vpc_mini.png" 
         onclick="
getmessage(urltoopen,logo3websiteurl);openurl(get(urltoopen),_blank);
"

         width="65"
         height="prop"

         />

  <events name="logo3events" 
    onTourStart="showlogo3();"
    keep="true" />

  <action name="hidelogo3">
    set(layer[logo3].visible, false);
  </action>
  <action name="showlogo3">
      set(layer[logo3].visible, true);
  </action>



<layer name="logo3TooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	type="text"
	align="center"
	bg="false"
	bgborder="0"
	txtshadow="1.0 1.0 4.0 0x000000 1"
	css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
	edge="bottom"
	interactivecontent="false"
	zorder="0"
	padding="2"
	xoffset="0"
	yoffset="0"
	visible="false"
	html=""
/>


<!-- ********** -->
<!-- PanotourMaps -->
<!-- id : panotourmaps -->
<!-- ********** -->

		<ptplugin name="panotourmaps" lat="-22.930109212644" lng="-43.176519259316" zoom="18" maptypelayer="road" position="left" size="20" resizable="true" multimap="false" openatstart="false" state="false" bgcolor="f2f2f2" zorder="20" centeronspots="true" engine="KolorMap">
	
		<radar visible="true" radius="8000" linktozoom="true" quality="8" linecolor="ffffff" lineopacity="0.50000762951094835" linewidth="1" fillcolor="ffffff" fillopacity="0.30000762951094834" />
		
		<markers animation="false" />
		
		
		<controls zoom="true" pan="true" scale="false" maptype="true" overview="false">
			<ui draggable="true" scrollable="true" dblclick="true" />
			<specific streetview="true" />
		</controls>
		
		<markerSelected name="" heading="" fov="" />
		
		
			<!-- PanotourMaps markers counter : 1 -->



				<marker name="spotmap762" 
					lat="-22.930107502252" 
					lng="-43.176516093254" 
					heading="5.5999999999997669" 
					draggable="false" 
					animated="false" 
					desc="spotmap762_tooltip" 
					desctype="info" 
					onhover="false" 
					isscene="true" 
					scene="pano5640" 
					hasradar="true" 
					jsclick="spotmap762ActionSpotMap">
					<markericon url="spots/hotspot_plan_user_defaultmap0.png" iconwidth="20" iconheight="20" shadow="false" iconanchor="center" />
				</marker>
		


		
	</ptplugin>
	
	<action name="kolorMapJsReady_panotourmaps">
		set(ptplugin[panotourmaps].jsready, true);
	</action>
	
	
	
		<!-- PanotourMaps markers counter : 1 -->
				<action name="spotmap762ActionSpotMap">
          mainloadscene(pano5640);lookat(get(panoview.h), get(panoview.v), get(panoview.fov));

</action>
	


	
	
	
	<!-- Begin PanotourMaps events and actions -->
	<events name="panotourmapsEvents" 
	onxmlcomplete="ifnot(panotourmapsMapLoaded,set(tour_displaymap,false););" 
	onnewpano="panotourmapsActivateDefaultMarker();" 
	onviewchanged="panotourmapsOnviewchange()" 
	onhidetourmap="panotourmapsClosetourmap();" 
	onshowtourmap="if(tour_displaymap,panotourmapsOpentourmap(););" 
	onenterfullscreen="panotourmapsUpdateMaxMapSize();" 
	onexitfullscreen="panotourmapsUpdateMaxMapSize();" 
	keep="true" />
	
	
	<krpano panotourmapsMarkerDefaultSet="false" />
	<krpano panotourmapsMapLoaded="false" />
	
	
	<action name="panotourmapsUpdateMaxMapSize">
		js(invokePluginFunction(panotourmaps, updateResizableMapMaxSize));
	</action>
	
	<action name="kolorMapJsReadyLoop_panotourmaps">
		if(ptplugin[panotourmaps].jsready,
			stopdelayedcall(jsReadyLoopId_panotourmaps);
			if(%1 == "close",
				panotourmapsClosetourmap();
			,
				panotourmapsOpentourmap();
			);
		,
			delayedcall(jsReadyLoopId_panotourmaps, 0.2, kolorMapJsReadyLoop_panotourmaps(%1));
		);
	</action>
	
	<action name="panotourmapsClosetourmap">
		if(ptplugin[panotourmaps].jsready,
			set(ptplugin[panotourmaps].state, false);
			js(invokePluginFunction(panotourmaps, openCloseMap, close));
		,
			kolorMapJsReadyLoop_panotourmaps(close);
		);
	</action>
	
	
	<action name="panotourmapsOpentourmap">
		if(ptplugin[panotourmaps].jsready,
			set(ptplugin[panotourmaps].state, true);
			js(invokePluginFunction(panotourmaps, openCloseMap, open));
		,
			kolorMapJsReadyLoop_panotourmaps(open);
		);
	</action>
	
	
	<action name="panotourmapsChangescene">
		mainloadscene(%1);if(xml.scene != %1,panotourmapsGoMarker(%2););
	</action>
	
	<action name="panotourmapsOnviewchange">
		if ( panotourmapsMapLoaded == true,
			ifnot(ptplugin[panotourmaps].markerSelected.name == "",
				js(invokePluginFunction(panotourmaps, changeDirection, get(view.hlookat), get(view.hfov)));
			);
		);
	</action>
	
	<action name="panotourmapsGoMarker">
		if ( panotourmapsMapLoaded == true,
			
			set(ptplugin[panotourmaps].markerSelected.name, %1);
			set(ptplugin[panotourmaps].markerSelected.heading, get(view.hlookat));
			set(ptplugin[panotourmaps].markerSelected.fov, get(view.hfov));
			js(invokePluginFunction(panotourmaps, changeCurrentMarker, %1, get(view.hlookat), get(view.hfov), get(ptplugin[panotourmaps].centeronspots)));
			
			if( panotourmapsMarkerDefaultSet == false,
				js(setMapDefaultMarker(panotourmaps, %1, get(view.hlookat), get(view.hfov)));
				set(panotourmapsMarkerDefaultSet,true);
			);
		);
	</action>
	
	<action name="panotourmapsUnselectMarker">
		set(ptplugin[panotourmaps].markerSelected.name, "");
		js(invokePluginFunction(panotourmaps, unselectCurrentMarker));
		
		js(setMapDefaultMarker(panotourmaps, null, null, null));
	</action>

	<action name="panotourmapsActivateDefaultMarker">
		set(panotourmapsMapLoaded, true);
		
		set(panotourmapsMapSpotFound, false);
		for(set(defaultmarkerinc,0), defaultmarkerinc LT ptplugin[panotourmaps].marker.count , inc(defaultmarkerinc),
                        if(ptplugin[panotourmaps].marker[get(defaultmarkerinc)].isscene == true,
				if(panotourmapsMapSpotFound == false,
					if(ptplugin[panotourmaps].marker[get(defaultmarkerinc)].scene == xml.scene,
						ifnot(ptplugin[panotourmaps].marker[get(defaultmarkerinc)].name == ptplugin[panotourmaps].markerSelected.name,
							panotourmapsGoMarker(get(ptplugin[panotourmaps].marker[get(defaultmarkerinc)].name));
						);
						set(panotourmapsMapSpotFound, true);
					);
				);
			);
		);
		
		if(panotourmapsMapSpotFound == false,
			panotourmapsUnselectMarker();
		);
	</action>



<!-- ********** -->
<!-- expo unas -->
<!-- id : button6 -->
<!-- ********** -->

  <layer name="button6"
         keep="true"
         url="%FIRSTXML%/graphics/button6/expo2.png"
         align="topleft"
         x="20"
         y="160"
         zorder="21"
         visible="false"
         onclick="button6OnClick"
         tooltip="button6tooltip"
         onhover="showTooltip('plugin',button6TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         height="30"
         width="100"
         />



  <action name="button6OnClick">
          mainloadscene(pano5640);lookat(get(panoview.h), get(panoview.v), get(panoview.fov));


  </action>

  <events name="button6events"
    onTourStart="showbutton6();"
    hidetourcontrols="hidebutton6();"
    showtourcontrols="showbutton6();"
    keep="true" />
  <action name="hidebutton6">set(layer[button6].visible, false);</action>
  <action name="showbutton6">if(tour_displaycontrols,set(layer[button6].visible, true);,hidebutton6(););</action>

<layer name="button6TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="true"
  bgcolor="0x272727"
  bgalpha="0.80000000000000004"
  bgroundedge="3"
  bgborder="0"
  bgshadow="1.0 1.0 4.0 0x000000 1"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- expo luiz -->
<!-- id : button7 -->
<!-- ********** -->

  <layer name="button7"
         keep="true"
         url="%FIRSTXML%/graphics/button7/expo1.png"
         align="topleft"
         x="20"
         y="200"
         zorder="22"
         visible="false"
         onclick="button7OnClick"
         tooltip="button7tooltip"
         onhover="showTooltip('plugin',button7TooltipStyle);"
         onout="hideTooltip();tween(scale, 1.0,0.5,easeOutQuad);"
         onover="tween(scale, 1.2,0.5,easeOutQuad);"
         height="30"
         width="100"
         />



  <action name="button7OnClick">getmessage(urltoopen,button7onclick133315openurlwebsiteurl);openurl(get(urltoopen),_blank);


  </action>

  <events name="button7events"
    onTourStart="showbutton7();"
    hidetourcontrols="hidebutton7();"
    showtourcontrols="showbutton7();"
    keep="true" />
  <action name="hidebutton7">set(layer[button7].visible, false);</action>
  <action name="showbutton7">if(tour_displaycontrols,set(layer[button7].visible, true);,hidebutton7(););</action>

<layer name="button7TooltipStyle"
  keep="true"
  enabled="false"
  capture="false"
  type="text"
  align="center"
  bg="true"
  bgcolor="0x272727"
  bgalpha="0.80000000000000004"
  bgroundedge="3"
  bgborder="0"
  bgshadow="1.0 1.0 4.0 0x000000 1"
  txtshadow="1.0 1.0 4.0 0x000000 1"
  css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
  interactivecontent="false"
  zorder="0"
  padding="2"
  xoffset="0"
  yoffset="0"
  visible="false"
  html=""
  edge="top"
/>

<!-- ********** -->
<!-- Pilha de Miniaturas -->
<!-- id : stackthumbs -->
<!-- ********** -->

  <krpano stackthumbsIsOpen="false" stackthumbsFirstLoad="true" />

  <events name="stackthumbsEvents"
          onnewpano="stackthumbsClose(0);"
          onTourStart="stackthumbsBuild();"
          hidetourcontrols="stackthumbsHide();"
          showtourcontrols="stackthumbsShow();"
          hidetourthumbnails="stackthumbsHide();"
          showtourthumbnails="stackthumbsShow();"
          keep="true"/>

  <layer name="stackthumbsMainLayer" type="container" zorder="23" width="1" height="1" alpha="1" keep="true" x="0" y="0" visible="true" align="bottomleft" />

  <action name="stackthumbsHide">
    for (set(hstcstackthumbsi, 0), hstcstackthumbsi LT scene.count, inc(hstcstackthumbsi),
      txtadd(thumbname,'stackthumbs_', get(hstcstackthumbsi));
      txtadd(thumbnameimg, get(thumbname), '_img');
      set(layer[get(thumbname)].visible, false);
      set(layer[get(thumbnameimg)].visible, false);
    );
  </action>
  <action name="stackthumbsShow">
  if (tour_displaythumbnails, 
    for (set(sstcstackthumbsi, 0), sstcstackthumbsi LT scene.count, inc(sstcstackthumbsi),
      txtadd(thumbname,'stackthumbs_', get(sstcstackthumbsi));
      txtadd(thumbnameimg, get(thumbname), '_img');
      set(layer[get(thumbname)].visible, true);
      set(layer[get(thumbnameimg)].visible, true);
    );
  );
  </action>

  <action name="stackthumbsMagnify">
    tween(layer[%1].alpha,  1.0, 0.3, easeInQuad);
    tween(layer[%1].scale, 1.05, 0.3, easeInQuad);
    tween(layer[get(layer[%1].thumbborder)].alpha,  1.0, 0.3, easeInQuad);
    tween(layer[get(layer[%1].thumbborder)].scale, 1.05, 0.3, easeInQuad);
    set(layer[get(layer[%1].thumbborder)].bgborder, '2 0xffffff 1');
    set(layer[get(layer[%1].thumbborder)].mergedalpha, false);
  </action>

  <action name="stackthumbsLies">
    tween(layer[%1].alpha, 0.8, 0.3, easeInQuad);
    tween(layer[%1].scale, 1.0, 0.3, easeInQuad);
    tween(layer[get(layer[%1].thumbborder)].alpha, 0.8, 0.3, easeInQuad);
    tween(layer[get(layer[%1].thumbborder)].scale, 1.0, 0.3, easeInQuad);
    set(layer[get(layer[%1].thumbborder)].bgborder, '2 0xffffff 0.20000000000000001');
    set(layer[get(layer[%1].thumbborder)].mergedalpha, false);
  </action>


<krpano stackthumbsBuilt="false"/>

  <action name="stackthumbsBuild">
    ifnot (stackthumbsBuilt,
    for (set(bststackthumbsi, 0), bststackthumbsi LT scene.count, inc(bststackthumbsi),

        copy(thumburl, scene[get(bststackthumbsi)].thumburl);
        txtadd(thumbname,'stackthumbs_', get(bststackthumbsi));
        txtadd(thumbnameimg, get(thumbname), '_img');

        addplugin(get(thumbname));
        addplugin(get(thumbnameimg));
        set(layer[get(thumbnameimg)].parent, "stackthumbsMainLayer");
        set(layer[get(thumbname)].parent, get(thumbnameimg));
        set(layer[get(thumbnameimg)].url   , get(thumburl));
        set(layer[get(thumbname)].type, 'container');
        set(layer[get(thumbnameimg)].keep  , true);
        set(layer[get(thumbname)].keep  , true);
        set(layer[get(thumbnameimg)].align , bottomleft);
        set(layer[get(thumbname)].align , topleft);
        set(layer[get(thumbnameimg)].edge  , center);

        set(layer[get(thumbnameimg)].width , 45);
        set(layer[get(thumbnameimg)].height, 22);
        set(layer[get(thumbname)].width , 45);
        set(layer[get(thumbname)].height, 22);

        set(layer[get(thumbnameimg)].alpha , 0.8);
        set(layer[get(thumbnameimg)].visible , false);
        set(layer[get(thumbname)].alpha , 0.8);
        set(layer[get(thumbname)].visible , false);

        if (bststackthumbsi GE 4, set(reali, 4), set(reali, get(bststackthumbsi)));

        mul(layer[get(thumbnameimg)].x, get(reali),3);
        mul(layer[get(thumbnameimg)].y, get(reali),3);

        add(closedthumboffsetx, 20, 22);
        add(layer[get(thumbnameimg)].x, get(closedthumboffsetx));

        add(closedthumboffsety, 30, 11);
        add(layer[get(thumbnameimg)].y, get(closedthumboffsety));

        copy(layer[get(thumbnameimg)].xsmall, layer[get(thumbnameimg)].x);
        copy(layer[get(thumbnameimg)].ysmall, layer[get(thumbnameimg)].y);

        add(layer[get(thumbnameimg)].zorder, 0, bststackthumbsi);
        add(layer[get(thumbname)].zorder, 0, bststackthumbsi);
        set(layer[get(thumbname)].bgborder, '2 0xffffff 0.20000000000000001');
        set(layer[get(thumbname)].mergedalpha, false);

          set(layer[get(thumbnameimg)].tooltip,get(scene[get(bststackthumbsi)].titleid));
        set(layer[get(thumbnameimg)].thumbborder, get(thumbname));
        set(layer[get(thumbnameimg)].thumbpos, get(bststackthumbsi));
        set(layer[get(thumbnameimg)].linkedpano, get(scene[get(bststackthumbsi)].name) );
        set(layer[get(thumbnameimg)].onclick, stackthumbsOpen() );
      );

      set(stackthumbsBuilt, true);

      stackthumbsShow();


    );
  </action>

  <action name="stackthumbsOpenThumb">
    if(%3 != NEXT,
      set(pos,0);
      copy(curpos, layer[%1].thumbpos);
      set(xdst, 0);
      set(ydst, 0);
    );
    if (pos LT curpos,
      inc(pos);

        inc(ydst, 55);
        if (ishtml5,
          sub(ymax, stageheight, 45);
         ,
          sub(ymax, area.pixelheight, 45);
        );
        dec(ymax, 50);
        if(ydst GT ymax,
          inc(xdst, 100);
          set(ydst,0);
        );

      stackthumbsOpenThumb(%1,%2,NEXT);
     ,
      set(openthumboffsetx, 45);
      add(openthumboffsetx, 20);
      add(xdst, get(openthumboffsetx));

      set(openthumboffsety, 22);
      add(openthumboffsety, 30);
      add(ydst, get(openthumboffsety));

      tween(layer[%1].x, get(xdst) );
      tween(layer[%1].y, get(ydst) );
      tween(layer[%1].width , 90);
      tween(layer[%1].height, 45);
      tween(layer[%2].width , 90);
      tween(layer[%2].height, 45);
    );
  </action>

  <action name="stackthumbsOpen">
    for (set(oststackthumbsi, 0), oststackthumbsi LT scene.count, inc(oststackthumbsi),
      txtadd(thumbname,'stackthumbs_',get(oststackthumbsi));
      txtadd(thumbnameimg, get(thumbname), '_img');
      stackthumbsOpenThumb(get(thumbnameimg), get(thumbname));
      set(layer[get(thumbnameimg)].onover, stackthumbsMagnify(get(name)); );
      set(layer[get(thumbnameimg)].onout, stackthumbsLies(get(name)); hideTooltip(); );
      set(layer[get(thumbnameimg)].onhover, showTooltip('plugin',stackthumbsTooltipStyle); );
      set(layer[get(thumbnameimg)].onclick, stackthumbsLies(get(name)); stackthumbsClose(0); mainloadscene(get(linkedpano)); );
    );

    set(stackthumbsIsOpen, true);
  </action>

  <action name="stackthumbsClose">
    if (stackthumbsIsOpen,
    for (set(cststackthumbsi, 0), cststackthumbsi LT scene.count, inc(cststackthumbsi),
      txtadd(thumbname,'stackthumbs_', get(cststackthumbsi));
      txtadd(thumbnameimg, get(thumbname), '_img');
      stackthumbsCloseThumb(get(thumbnameimg), get(thumbname));
    );

    set(stackthumbsIsOpen, false);
    );
  </action>
  <action name="stackthumbsCloseThumb">
    tween(layer[%1].x, get(layer[%1].xsmall));
    tween(layer[%1].y, get(layer[%1].ysmall));
    tween(layer[%1].width, 45);
    tween(layer[%1].height, 22);
    tween(layer[%2].width, 45);
    tween(layer[%2].height, 22);
    set(layer[%1].alpha, 0.8);
    set(layer[%1].onover, '');
    set(layer[%1].onout, '');
    set(layer[%1].onhover, '');hideTooltip();
    set(layer[%1].onclick, stackthumbsOpen() );
  </action>

<layer name="stackthumbsTooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	type="text"
	align="center"
	bg="false"
	bgborder="0"
	txtshadow="1.0 1.0 4.0 0x000000 1"
	css="color:#ffffff;font-family:Tahoma;font-weight:bold;font-size:12px;text-align:left;"
	interactivecontent="false"
	zorder="0"
	padding="2"
	xoffset="0"
	yoffset="0"
	visible="false"
	html=""
	edge="left"
/>


<!-- ********** -->
<!-- Call actions on tour events -->
<!-- id : callActionsOnTourEvents -->
<!-- ********** -->
    <events name="callActionsOnTourEventsevents" keep="true"
            ontourstart="callActionsOnTourEventsontourstart()"

     />



    <action name="callActionsOnTourEventsontourstart">
setControlModeDragTo();



    </action>






  <action name="displayImage">
    if (layer[displayedStandardImage],
      if(layer[displayedStandardImage].doNotDeleteMe,
        set(layer[displayedStandardImage].currentCall, false);
        set(layer[displayedStandardImage].doNotDeleteMe, false);
        
        if (%1 == layer[displayedStandardImage].url,
          applyDisplayedImageObjectAnimation(%8);
        ,
          setDisplayedImageObjectParameters(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10);
        );
      ,
        set(layer[displayedStandardImage].currentCall, false);
        set(layer[displayedStandardImage].doNotDeleteMe, true);
        events.dispatch(onremovedisplayedobject);
        delayedcall(0.2,displayImage(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12););
      );
    ,
      if(%10,
        addlayer(displayedStandardImageOverlay);
        set(layer[displayedStandardImageOverlay].keep, false);
        set(layer[displayedStandardImageOverlay].width, 100%);
        set(layer[displayedStandardImageOverlay].height, 100%);
        set(layer[displayedStandardImageOverlay].type, container);
        set(layer[displayedStandardImageOverlay].zorder, 98);
        set(layer[displayedStandardImageOverlay].visible, false);
        set(layer[displayedStandardImageOverlay].onclick, applyDisplayedImageObjectAnimation(%8););
        set(layer[displayedStandardImageOverlay].bgcolor, "0x%11");
        set(layer[displayedStandardImageOverlay].bgalpha, %12);
        set(layer[displayedStandardImageOverlay].bgcapture, true);
      );
      addlayer(displayedStandardImage);
      set(layer[displayedStandardImage].keep, false);
      set(layer[displayedStandardImage].onclick, applyDisplayedImageObjectAnimation(%8););
      set(layer[displayedStandardImage].zorder , 99);
      set(layer[displayedStandardImage].currentCall, true);
      set(layer[displayedStandardImage].doNotDeleteMe, true);
      set(layer[displayedStandardImage].onloaded, resizeDisplayedImageObject());
      events.dispatch(onremovedisplayedobject);
      delayedcall(0.2,displayImage(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12););
      set(layer[displayedStandardImage].visible, false);
    );
  </action>
  <action name="applyDisplayedImageObjectAnimation">resumeautorotation(forcehotspot);

    if (%1,
      stoptween(layer[displayedStandardImage].width, layer[displayedStandardImage].height);
      tween(layer[displayedStandardImage].width|layer[displayedStandardImage].height, 1|1, 1, easeOutQuad, WAIT);
      if(layer[displayedStandardImage].overlay,removelayer(displayedStandardImageOverlay););removelayer(displayedStandardImage);
    ,
      if(layer[displayedStandardImage].overlay,removelayer(displayedStandardImageOverlay););removelayer(displayedStandardImage);
    );
  </action>
  <action name="setDisplayedImageObjectParameters">
    set(layer[displayedStandardImage].url       , %1);
    set(layer[displayedStandardImage].align     , %2);
    set(layer[displayedStandardImage].x         , %3);
    set(layer[displayedStandardImage].y         , %4);
    set(layer[displayedStandardImage].imgwidth  , %5);
    set(layer[displayedStandardImage].imgheight , %6);
    set(layer[displayedStandardImage].animated  , %8);
    set(layer[displayedStandardImage].applyratio, %9);
    set(layer[displayedStandardImage].overlay   , %10);
    if (%7,pauseautorotation(forcehotspot);
);
  </action>
  <action name="resizeDisplayedImageObject">
    if(layer[displayedStandardImage].url,
    set(layer[displayedStandardImage].fullwidth, get(layer[displayedStandardImage].width));
    set(layer[displayedStandardImage].fullheight, get(layer[displayedStandardImage].height));
    if(layer[displayedStandardImage].animated,
      set(layer[displayedStandardImage].width , 1);
      set(layer[displayedStandardImage].height, 1);
    );
    if(layer[displayedStandardImage].imgwidth != "" AND layer[displayedStandardImage].imgheight != "",
      if(layer[displayedStandardImage].imgwidth == "prop",
        set(tempDisplayedImageObjectHeight, get(layer[displayedStandardImage].imgheight));
        indexoftxt(tempDisplayedImageObjectHeightPercent, get(tempDisplayedImageObjectHeight), "%");
        if(tempDisplayedImageObjectHeightPercent GT 0,
          txtreplace(tempDisplayedImageObjectHeight, '%', '');
          mul(tempDisplayedImageObjectHeight, get(stageheight));
          div(tempDisplayedImageObjectHeight, 100);
          Math.round(tempDisplayedImageObjectHeight);
        );
        mul(flyingImgWidth,get(layer[displayedStandardImage].fullwidth),get(tempDisplayedImageObjectHeight));
        div(flyingImgWidth,get(layer[displayedStandardImage].fullheight));
        Math.round(flyingImgWidth);
        set(layer[displayedStandardImage].imgwidth , get(flyingImgWidth));
        set(layer[displayedStandardImage].imgheight, get(tempDisplayedImageObjectHeight));
      ,
        if(layer[displayedStandardImage].imgheight == "prop",
          set(tempDisplayedImageObjectWidth, get(layer[displayedStandardImage].imgwidth));
          indexoftxt(tempDisplayedImageObjectWidthPercent, get(tempDisplayedImageObjectWidth), "%");
          if(tempDisplayedImageObjectWidthPercent GT 0,
            txtreplace(tempDisplayedImageObjectWidth, '%', '');
            mul(tempDisplayedImageObjectWidth, get(stagewidth));
            div(tempDisplayedImageObjectWidth, 100);
            Math.round(tempDisplayedImageObjectWidth);
          );
          mul(flyingImgHeight,get(layer[displayedStandardImage].fullheight),get(tempDisplayedImageObjectWidth));
          div(flyingImgHeight,get(layer[displayedStandardImage].fullwidth));
          Math.round(flyingImgHeight);
          set(layer[displayedStandardImage].imgwidth , get(tempDisplayedImageObjectWidth));
          set(layer[displayedStandardImage].imgheight , get(flyingImgHeight));
        ,
          set(tempDisplayedImageObjectWidth, get(layer[displayedStandardImage].imgwidth));
          set(tempDisplayedImageObjectHeight, get(layer[displayedStandardImage].imgheight));
          indexoftxt(tempDisplayedImageObjectWidthPercent, get(tempDisplayedImageObjectWidth), "%");
          indexoftxt(tempDisplayedImageObjectHeightPercent, get(tempDisplayedImageObjectHeight), "%");
          if(tempDisplayedImageObjectWidthPercent GT 0,
            txtreplace(tempDisplayedImageObjectWidth, '%', '');
            mul(tempDisplayedImageObjectWidth, get(stagewidth));
            div(tempDisplayedImageObjectWidth, 100);
            Math.round(tempDisplayedImageObjectWidth);
          );
          if(tempDisplayedImageObjectHeightPercent GT 0,
            txtreplace(tempDisplayedImageObjectHeight, '%', '');
            mul(tempDisplayedImageObjectHeight, get(stageheight));
            div(tempDisplayedImageObjectHeight, 100);
            Math.round(tempDisplayedImageObjectHeight);
          );
          set(layer[displayedStandardImage].imgwidth , get(tempDisplayedImageObjectWidth));
          set(layer[displayedStandardImage].imgheight, get(tempDisplayedImageObjectHeight));
        );
      );
    ,
      set(layer[displayedStandardImage].imgwidth , get(layer[displayedStandardImage].fullwidth));
      set(layer[displayedStandardImage].imgheight, get(layer[displayedStandardImage].fullheight));
    );
    
    set(resizedwidth, get(layer[displayedStandardImage].imgwidth));
    set(resizedheight, get(layer[displayedStandardImage].imgheight));
    if(layer[displayedStandardImage].applyratio,
      sub(resizedstagewidth, get(stagewidth), get(layer[displayedStandardImage].x));
      sub(resizedstageheight, get(stageheight), get(layer[displayedStandardImage].y));
      Math.abs(resizedstagewidth);
      Math.abs(resizedstageheight);
      if(resizedwidth GT resizedstagewidth,
        mul(tempresizedheight, get(resizedheight), get(resizedstagewidth));
        div(tempresizedheight, get(resizedwidth));
        Math.round(tempresizedheight);
        set(resizedwidth, get(resizedstagewidth));
        set(resizedheight, get(tempresizedheight));
      );
      if(resizedheight GT resizedstageheight,
        mul(tempresizedwidth, get(resizedwidth), get(resizedstageheight));
        div(tempresizedwidth, get(resizedheight));
        Math.round(tempresizedwidth);
        set(resizedheight, get(resizedstageheight));
        set(resizedwidth, get(tempresizedwidth));
      );
    );
    
    if(layer[displayedStandardImage].animated,
      set(layer[displayedStandardImage].animated, false);
      tween(layer[displayedStandardImage].width , get(resizedwidth), 1, easeOutQuad);
      tween(layer[displayedStandardImage].height, get(resizedheight), 1, easeOutQuad);
    ,
      set(layer[displayedStandardImage].width , get(resizedwidth));
      set(layer[displayedStandardImage].height, get(resizedheight));
    );
    if(layer[displayedStandardImage].overlay,set(layer[displayedStandardImageOverlay].visible, true););
    set(layer[displayedStandardImage].visible, true);
    ,
      delayedcall(0.2,resizeDisplayedImageObject(););
    );
  </action>
  <events name="displayedImageObjectEvents" keep="true" onremovedisplayedobject="displayedImageObjectOnRemoveDisplayedObject" onresize="if(layer[displayedStandardImage],resizeDisplayedImageObject());" />
  <action name="displayedImageObjectOnRemoveDisplayedObject">
    ifnot(layer[displayedStandardImage].currentCall,if(layer[displayedStandardImage].visible,resumeautorotation(forcehotspot);

      if(layer[displayedStandardImage].overlay,removelayer(displayedStandardImageOverlay););
      removelayer(displayedStandardImage);
    ););
  </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>

  <!-- Sounds Management -->
  <plugin name="soundinterface"
          preload="true"
          url.flash="%SWFPATH%/graphics/soundinterface.swf"
          url.html5="%FIRSTXML%/graphics/soundinterface.js"
          rootpath="%$videos_sounds_path%/sounds"
          backgroundsound=""
          backgroundsoundloops="0"
          bgsound="false"
          bgsoundpaused="false"
          bgsoundloopended="false"
          bgsoundtoforce = "false"
          volumeinitialized="false"
          started="true"
          keep="true"/>
  <events name="soundmanagementevents"
          onnewpano="if(plugin[soundinterface].started,playbackgroundsound(););"
          onxmlcomplete="soundinterfaceonxmlcomplete();"
          keep="true"/>
  <action name="soundinterfaceonxmlcomplete">
    ifnot(plugin[soundinterface].volumeinitialized,
      div(plugin[soundinterface].volume, tour_soundsvolume, 100);
      set(plugin[soundinterface].volumeinitialized,true);
    );
  </action>
  <action name="playsound3Dwhenpossible">
    set(really_play_sound, true);
    if (tour_current_played_sound,
      if (%1 == tour_current_played_sound,
        delete(tour_current_played_sound);
        set(tour_current_played_sound_state, 0);
        delete(tour_current_played_sound_paused);
        stopsound(%1);
        set(really_play_sound, false);
        if(%4,
          delete(tour_current_played_sound_pausesound);
          resumeTourSoundsActions(true,true,true,true,true);
        );
      );
    );
    if (really_play_sound,
      if (tour_current_played_sound,
        stopsound(get(tour_current_played_sound));

        ifnot(%4,
          if(tour_current_played_sound_pausesound,
            delete(tour_current_played_sound_pausesound);
            resumeTourSoundsActions(true,true,true,true,true);
          );
        );
      );
      if(%4,
        set(tour_current_played_sound_pausesound, true);
        pauseTourSoundsActions(true,false,true,true,true);
      );
      set(tour_current_played_sound, %1);
      if(tour_current_played_video,
        set(tour_current_played_sound_state, 2);
      ,
        set(tour_current_played_sound_state, 1);
      );
      set(tour_current_played_sound_paused, false);
      if (%3,
        if (device.flash,
          div(volume, tour_soundsvolume, 100);
          if(%9 != null,
            playsound3D(%1,%2,%5,%6,%7,get(volume),%8,stopsound3Dwhenpossible(%1,%4));
          ,
            playsound3D(%1,%2,%5,%6,%7,get(volume),%8);
          );
        ,
          if(%9 != null,
            playsound(%1,%2,%8,stopsound3Dwhenpossible(%1,%4));
          ,
            playsound(%1,%2,%8);
          );
        );
      ,
        if(%6 != null,
          playsound(%1,%2,%5,stopsound3Dwhenpossible(%1,%4));
        ,
          playsound(%1,%2,%5);
        );
      );

      ifnot(tour_soundson,
        set(tour_current_played_sound_paused, true);
        pausesound(%1);
      );
    );
  </action>
  <action name="stopsound3Dwhenpossible">
    if (%1 == tour_current_played_sound,
      delete(tour_current_played_sound);
      set(tour_current_played_sound_state, 0);
      delete(tour_current_played_sound_paused);

      ifnot(device.safari,
        stopsound(%1);
      );
      if(%2,
        delete(tour_current_played_sound_pausesound);
        resumeTourSoundsActions(true,true,true,true,true);
      );
    );
  </action>
  <action name="playbackgroundsound">
  if(playsound,
    if (xml.scene,
      if (scene[get(xml.scene)].backgroundsound,
        if (plugin[soundinterface].backgroundsound != scene[get(xml.scene)].backgroundsound,
          copy(plugin[soundinterface].backgroundsound, scene[get(xml.scene)].backgroundsound);
          copy(plugin[soundinterface].backgroundsoundloops, scene[get(xml.scene)].backgroundsoundloops);
          if (tour_soundson,
            set(plugin[soundinterface].bgsound, true);
            set(plugin[soundinterface].bgsoundpaused, false);
            set(plugin[soundinterface].bgsoundloopended, false);
            set(plugin[soundinterface].bgsoundtoforce, false);
            if(scene[get(xml.scene)].video == false OR (scene[get(xml.scene)].video == true AND scene[get(xml.scene)].scenevideomute == true),
              if(plugin[soundinterface].backgroundsoundloops GT 0,
                playsound(bgsoundname, get(plugin[soundinterface].backgroundsound), get(plugin[soundinterface].backgroundsoundloops), stopbackgroundsoundoncomplete());
              ,
                playsound(bgsoundname, get(plugin[soundinterface].backgroundsound), get(plugin[soundinterface].backgroundsoundloops));
              );
            );
           ,
            set(plugin[soundinterface].bgsoundtoforce, true);
            set(plugin[soundinterface].bgsound, false);
          );
        ,
          if (tour_soundson,
            if((plugin[soundinterface].bgsoundpaused == true AND scene[get(xml.scene)].video == false) OR (scene[get(xml.scene)].video == true AND scene[get(xml.scene)].scenevideomute == true),
              resumesound(bgsoundname);
              set(plugin[soundinterface].bgsoundpaused, false);
            );
          ,
            set(plugin[soundinterface].bgsoundtoforce, true);
            set(plugin[soundinterface].bgsound, false);
          );
        );
      );
    );
  ,
    delayedcall(0.2, playbackgroundsound());
  );
  </action>
  <action name="stopbackgroundsoundoncomplete">
    if (plugin[soundinterface].backgroundsound,
    if (plugin[soundinterface].backgroundsoundloops GT 0,

      set(plugin[soundinterface].backgroundsoundloops, 0);
      set(plugin[soundinterface].bgsound, false);
      set(plugin[soundinterface].bgsoundpaused, false);
      set(plugin[soundinterface].bgsoundloopended, true);
    );
    );
  </action>
  <action name="resetbackgroundsoundifneeded">
    if (xml.scene,
      if (scene[get(xml.scene)].backgroundsound != scene[%1].backgroundsound,
        if(plugin[soundinterface].backgroundsound,
          stopsound(bgsoundname);
        );
        set(plugin[soundinterface].backgroundsound, "");
        set(plugin[soundinterface].backgroundsoundloops, 0);
        set(plugin[soundinterface].bgsound, false);
        set(plugin[soundinterface].bgsoundpaused, false);
        set(plugin[soundinterface].bgsoundloopended, false);
      );
    );
  </action>
  <action name="pausebackgroundsound">
    if(plugin[soundinterface].backgroundsound,
      if (plugin[soundinterface].bgsound,
        if(plugin[soundinterface].bgsoundpaused == false AND plugin[soundinterface].bgsoundloopended == false,
          pausesound(bgsoundname);
          set(plugin[soundinterface].bgsoundpaused, true);
        );
      );
    );
    
  </action>
  <action name="resumebackgroundsound">
    set(bgSoundOnResume, true);
    set(forceBgSoundOnResume, true);
    if(layer[displayedStandardVideo],
    if(layer[displayedStandardVideo].pausebgsound AND tour_current_played_video,
      set(bgSoundOnResume, false);
      set(forceBgSoundOnResume, false);
    ););
    if(layer[webvideodisplay_player],
    if(layer[webvideodisplay_player].pausebgsound AND tour_current_played_web_video,
      set(bgSoundOnResume, false);
      set(forceBgSoundOnResume, false);
    ););
    if(tour_current_played_sound_pausesound AND tour_current_played_sound,
      set(bgSoundOnResume, false);
    );
    ifnot(plugin[soundinterface].backgroundsound AND scene[get(xml.scene)].backgroundsound,
      set(bgSoundOnResume, false);
    );
    if(videospots_playing GT 0,
      set(bgSoundOnResume, false);
      set(forceBgSoundOnResume, false);
    );
    if(bgSoundOnResume,
      if (plugin[soundinterface].backgroundsound,
        if (tour_soundson,
          if (plugin[soundinterface].bgsound AND plugin[soundinterface].bgsoundloopended == false,
            if((plugin[soundinterface].bgsoundpaused == true AND scene[get(xml.scene)].video == false) OR (scene[get(xml.scene)].video == true AND scene[get(xml.scene)].scenevideomute == true),
              resumesound(bgsoundname);
              set(plugin[soundinterface].bgsoundpaused, false);
            ,

              if(device.mobile OR device.tablet OR device.safari OR device.chrome,
                resumesound(bgsoundname);
                set(plugin[soundinterface].bgsoundpaused, false);
              );
            );
          ,
            if(((plugin[soundinterface].bgsoundpaused == true OR plugin[soundinterface].bgsoundtoforce == true) AND scene[get(xml.scene)].video == false) OR (scene[get(xml.scene)].video == true AND scene[get(xml.scene)].scenevideomute == true),
              set(plugin[soundinterface].bgsound, true);
              set(plugin[soundinterface].bgsoundpaused, false);
              set(plugin[soundinterface].bgsoundloopended, false);
              set(plugin[soundinterface].bgsoundtoforce, false);
              if(plugin[soundinterface].backgroundsoundloops GT 0,
                playsound(bgsoundname, get(plugin[soundinterface].backgroundsound), get(plugin[soundinterface].backgroundsoundloops), stopbackgroundsoundoncomplete());
              ,
                playsound(bgsoundname, get(plugin[soundinterface].backgroundsound), get(plugin[soundinterface].backgroundsoundloops));
              );
            );
          );
        );
      );
      
    ,
      if(forceBgSoundOnResume,
        playbackgroundsound();
        
      );
    );
  </action>
  <action name="preloadSounds">
  </action>

  <action name="play3DLocalSounds">
    if (xml.scene, if (scene[get(xml.scene)].haslocalsounds, playpanolocalsounds();););
  </action>
  <action name="stop3DLocalSounds">
    if (xml.scene, if (scene[get(xml.scene)].haslocalsounds, stoppanolocalsounds();););
  </action>
  <action name="resume3DLocalSounds">
    if (xml.scene, if (scene[get(xml.scene)].haslocalsounds, 
      set(kill3dSoundOnResume, true);
      if(layer[displayedStandardVideo],
      if(layer[displayedStandardVideo].pausebgsound,
      if(tour_current_played_video,
        set(kill3dSoundOnResume, false);
      );););
      if(layer[webvideodisplay_player],
      if(layer[webvideodisplay_player].pausebgsound,
      if(tour_current_played_web_video,
        set(kill3dSoundOnResume, false);
      );););
      if(tour_current_played_sound_pausesound,
      if(tour_current_played_sound,
        set(kill3dSoundOnResume, false);
      ););
      if(kill3dSoundOnResume,
        resumepanolocalsounds();
      );
    ););
  </action>
  <action name="pause3DLocalSounds">
    if (xml.scene, if (scene[get(xml.scene)].haslocalsounds, pausepanolocalsounds();););
  </action>
  <action name="set3DLocalSoundsVolume">
    if (xml.scene, if (scene[get(xml.scene)].haslocalsounds, setpanolocalsoundsvolume();););
  </action>
  <action name="playTourSounds">
    set(tour_soundson, true);events.dispatch(playtoursoundsevent);
    resumeTourSoundsActions(true,true,true,true,true);
  </action>
  <action name="stopTourSounds">
    set(tour_soundson, false);events.dispatch(stoptoursoundsevent);
    pauseTourSoundsActions(true,true,true,true,true);
  </action>
  <action name="setTourSoundsVolume">
    set(tour_soundsvolume, %1);events.dispatch(changetoursoundsevent);
    div(volume, tour_soundsvolume, 100);
    set(plugin[soundinterface].volume, get(volume));
    set3DLocalSoundsVolume();
  </action>
  <action name="playTourSoundsActions">
    if(%1,
      if(plugin[soundinterface],
        if(plugin[soundinterface].started,
        play3DLocalSounds();
        );
      );
    );
    if(%2,
      if(plugin[soundinterface],
        if(plugin[soundinterface].started,
          resumebackgroundsound();
        );
      );
    );
  </action>
  <action name="stopTourSoundsActions">
    if(%1,
      stop3DLocalSounds();
    );
    if(%2,
      stopSoundActionsSounds();
    );
    if(%3,
      stopVideoActionsSounds();
    );
    if(%4,
      pausebackgroundsound();
    );
  </action>
  <action name="resumeTourSoundsActions">
    if(%1,
      if(plugin[soundinterface],
        if(plugin[soundinterface].started,
        resume3DLocalSounds();
        );
      );
    );
    if(%2,
      resumeSoundActionsSounds();
    );
    if(%3,
      resumeVideoActionsSounds();
    );
    if(%4,
      if(%5,
        if(plugin[soundinterface],
          if(plugin[soundinterface].started,
            resumebackgroundsound();
          );
        );
      ,
        pausebackgroundsound();
      );
    );
  </action>
  <action name="pauseTourSoundsActions">
    if(%1,
      pause3DLocalSounds();
    );
    if(%2,
      pauseSoundActionsSounds();
    );
    if(%3,
      pauseVideoActionsSounds();
    );
    if(%4,
      if(%5,
        pausebackgroundsound();
      ,
        if(plugin[soundinterface],
          if(plugin[soundinterface].started,
            resumebackgroundsound();
          );
        );
      );
    );
  </action>
  <action name="stopSoundActionsSounds">
    if (tour_current_played_sound,
      delete(tour_current_played_sound_paused);
      stopsound(get(tour_current_played_sound));
      delete(tour_current_played_sound);
      set(tour_current_played_sound_state, 0);
    );
  </action>
  <action name="stopVideoActionsSounds">
    if(tour_current_played_video,
      if(layer[displayedStandardVideo],
        layer[displayedStandardVideo].stop();
        removelayer(displayedStandardVideo);
        if(layer[displayedStandardVideoOverlayButton], removelayer(displayedStandardVideoOverlayButton); );
        if(layer[displayedStandardVideoOverlay], removelayer(displayedStandardVideoOverlay); );
        delete(tour_current_played_video);
        set(tour_current_played_video_state, 0);
      );
    );
    if(tour_current_played_web_video,
      displayWebVideoObjectClose();
    );
  </action>
  <action name="resumeSoundActionsSounds">
    if (tour_current_played_sound,
      set(resumeSoundActionsVerification, true);
      if(tour_current_played_video,
        if(tour_current_played_sound_state LT tour_current_played_video_state,
          set(resumeSoundActionsVerification, false);
        );
      );
      if(resumeSoundActionsVerification,
        if (tour_soundson,
          if(tour_current_played_sound_paused,
            set(tour_current_played_sound_paused, false);
            resumesound(get(tour_current_played_sound));
          ,

            if(device.mobile OR device.tablet OR device.safari OR device.chrome,
              set(tour_current_played_sound_paused, false);
              resumesound(get(tour_current_played_sound));
            );
          );
        );
      );
    );
  </action>
  <action name="resumeVideoActionsSounds">
    if(tour_current_played_video,
      set(resumeVideoActionsVerification, true);
      if(tour_current_played_sound,
        if(tour_current_played_video_state LT tour_current_played_sound_state,
          set(resumeVideoActionsVerification, false);
        );
      );
      if(resumeVideoActionsVerification,
        if (tour_soundson,
          if(device.flash OR (device.webgl AND !device.ios),
            div(volume, tour_soundsvolume, 100);
            set(layer[displayedStandardVideo].volume, get(volume));
          ,
            ifnot(device.ios,
              js(kpanotour.Sounds.startVideosSounds(get(volume)));
            ,
              if(tour_soundsvolume GT 0,
                set(layer[displayedStandardVideo].muted, false);
              ,
                set(layer[displayedStandardVideo].muted, true);
              );
            );
          );
        ,
          if(device.flash OR (device.webgl AND !device.ios),
            set(layer[displayedStandardVideo].volume, 0);
          ,
            ifnot(device.ios,
              js(kpanotour.Sounds.stopVideosSounds());
            ,
              set(layer[displayedStandardVideo].muted, true);
            );
          );
        );
      );
    );
  </action>
  <action name="pauseSoundActionsSounds">
    if (tour_current_played_sound,
      ifnot(tour_current_played_sound_paused,
        set(tour_current_played_sound_paused, true);
        pausesound(get(tour_current_played_sound));
      );
    );
  </action>
  <action name="pauseVideoActionsSounds">
    if(tour_current_played_video,
      if(device.flash OR (device.webgl AND !device.ios),
        set(layer[displayedStandardVideo].volume, 0);
      ,
        ifnot(device.ios,
          js(kpanotour.Sounds.stopVideosSounds());
        ,
          set(layer[displayedStandardVideo].muted, true);
        );
      );
    );
  </action>

  <!-- MAP -->
  <action name="hideMap">set(tour_displaymap, false);events.dispatch(onhidetourmap);</action>
  <action name="showMap">set(tour_displaymap, true); events.dispatch(onshowtourmap);</action>

  <action name="displayVideo">
    set(displayedVideoObjectToCreate, true);
    set(displayedVideoObjectForDesktop, true);
    if(%10,
      set(displayedVideoObjectForDesktop, false);
    ,
      if (device.tablet, set(displayedVideoObjectForDesktop, false););
      if (device.mobile, set(displayedVideoObjectForDesktop, false););
    );
    
    if (layer[displayedStandardVideo],
      if(layer[displayedStandardVideo].donotdeleteme,
        set(layer[displayedStandardVideo].fromdesktop, get(displayedVideoObjectForDesktop));
        set(layer[displayedStandardVideo].currentCall, false);
        set(layer[displayedStandardVideo].visible, true);
        if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, true););
        set(layer[displayedStandardVideo].donotdeleteme, false);
        set(layer[displayedStandardVideo].pausebgsound, %11);
        ifnot(layer[displayedStandardVideo].pausedonstart,
          if(layer[displayedStandardVideo].pausebgsound,
            pauseTourSoundsActions(true,true,false,true,true);
          );
        );
        if (%1 == layer[displayedStandardVideo].videourl,
          layer[displayedStandardVideo].stop();
          ifnot(layer[displayedStandardVideo].fromdesktop,
            removelayer(displayedStandardVideoOverlayButton);
            removelayer(displayedStandardVideoOverlay);
          );resumeautorotation(forcehotspot);

          delete(tour_current_played_video);
          set(tour_current_played_video_state, 0);
          if(layer[displayedStandardVideo].pausebgsound,
            resumeTourSoundsActions(true,true,true,true,true);
          );
          if(layer[displayedStandardVideo].overlay,removelayer(displayedStandardVideoOverlayBkg););
          removelayer(displayedStandardVideo);
        ,
          
          set(tour_current_played_video, %1);
          if(tour_current_played_sound,
            set(tour_current_played_video_state, 2);
          ,
            set(tour_current_played_video_state, 1);
          );
          set(layer[displayedStandardVideo].onloaded, displayVideoWhenLoaded(%1,%10););
          set(layer[displayedStandardVideo].autoresume, true);
          if(device.html5,
            set(layer[displayedStandardVideo].url, %FIRSTXML%/graphics/videoplayer.js);
          ,
            set(layer[displayedStandardVideo].url, %SWFPATH%/graphics/videoplayer.swf);
          );
        );
      ,
        events.dispatch(onremovedisplayedobject);
        if (%1 != layer[displayedStandardVideo].videourl,
          delayedcall(0.2,displayVideo(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14););
        );
      );
    ,
      if(%12,
        addlayer(displayedStandardVideoOverlayBkg);
        set(layer[displayedStandardVideoOverlayBkg].keep, false);
        set(layer[displayedStandardVideoOverlayBkg].visible , false);
        set(layer[displayedStandardVideoOverlayBkg].onclick, displayedVideoObjectStartStopAction(););
        set(layer[displayedStandardVideoOverlayBkg].zorder , 97);
        set(layer[displayedStandardVideoOverlayBkg].type, container);
        set(layer[displayedStandardVideoOverlayBkg].width   , 100%);
        set(layer[displayedStandardVideoOverlayBkg].height  , 100%);
        set(layer[displayedStandardVideoOverlayBkg].bgcolor, "0x%13");
        set(layer[displayedStandardVideoOverlayBkg].bgalpha, %14);
        set(layer[displayedStandardVideoOverlayBkg].bgcapture, true);
      );
      addlayer(displayedStandardVideo);
      set(layer[displayedStandardVideo].keep, false);
      set(layer[displayedStandardVideo].visible , false);
      set(layer[displayedStandardVideo].onclick, displayedVideoObjectStartStopAction(););
      set(layer[displayedStandardVideo].zorder , 98);
      set(layer[displayedStandardVideo].align   , %2);
      set(layer[displayedStandardVideo].x       , %3);
      set(layer[displayedStandardVideo].y       , %4);
      set(layer[displayedStandardVideo].width   , %5);
      set(layer[displayedStandardVideo].height  , %6);
      set(layer[displayedStandardVideo].overlay , %12);
      set(layer[displayedStandardVideo].iphoneworkarounds, false);
      
      if (%7,
        set(layer[displayedStandardVideo].loop, true);
       ,
        set(layer[displayedStandardVideo].onvideocomplete, displayedVideoObjectStartStopAction(););
      );
      if (displayedVideoObjectForDesktop,
        set(layer[displayedStandardVideo].pausedonstart, false);
        set(layer[displayedStandardVideo].onvideoready, set(layer[displayedStandardVideo].visible, true);if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, true);););
      ,
        
        set(layer[displayedStandardVideo].pausedonstart, true);
        set(layer[displayedStandardVideo].onvideoready, set(layer[displayedStandardVideo].started, false);set(layer[displayedStandardVideo].visible, true);if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, true););delayedcall(0.1,applyDisplayedStandardVideoOverlay(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11)););
      );
      
      set(layer[displayedStandardVideo].currentCall, true);
      set(layer[displayedStandardVideo].donotdeleteme, true);
      events.dispatch(onremovedisplayedobject);
      delayedcall(0.2,displayVideo(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14););
      if (%8,pauseautorotation(forcehotspot);
);
    );
  </action>
  <action name="applyDisplayedStandardVideoOverlay">
      addlayer(displayedStandardVideoOverlay);
      
      set(layer[displayedStandardVideoOverlay].type, container);
      set(layer[displayedStandardVideoOverlay].visible, true);
      set(layer[displayedStandardVideoOverlay].zorder, 99);
      set(layer[displayedStandardVideoOverlay].keep, false);
      set(layer[displayedStandardVideoOverlay].align, %2);
      set(layer[displayedStandardVideoOverlay].x, %3);
      set(layer[displayedStandardVideoOverlay].y, %4);
      set(layer[displayedStandardVideoOverlay].width, get(layer[displayedStandardVideo].pixelwidth));
      set(layer[displayedStandardVideoOverlay].height, get(layer[displayedStandardVideo].pixelheight));
      
      addlayer(displayedStandardVideoOverlayButton);
      set(layer[displayedStandardVideoOverlayButton].visible, true);
      set(layer[displayedStandardVideoOverlayButton].keep, false);
      set(layer[displayedStandardVideoOverlayButton].parent, displayedStandardVideoOverlay);
      set(layer[displayedStandardVideoOverlayButton].align, center);
      set(layer[displayedStandardVideoOverlayButton].url, %FIRSTXML%/graphics/videoplayer_play_button.png);
      set(layer[displayedStandardVideoOverlayButton].width, 50);
      set(layer[displayedStandardVideoOverlayButton].height, 50);
      set(layer[displayedStandardVideoOverlayButton].alpha, 0.5);
      set(layer[displayedStandardVideoOverlayButton].enabled, false);
      set(layer[displayedStandardVideoOverlayButton].capture, false);
      set(layer[displayedStandardVideoOverlayButton].onclick, displayedVideoObjectStartStopAction(););
  </action>
  <action name="displayVideoWhenLoaded">
    layer[displayedStandardVideo].playVideo(%1,,%2);
    ifnot(tour_soundson,
      pauseVideoActionsSounds();
    );
  </action>
  <action name="displayedVideoObjectStartStopAction">
    if(layer[displayedStandardVideo].fromdesktop,
      layer[displayedStandardVideo].stop();
      set(layer[displayedStandardVideo].visible, false);
      if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, false););resumeautorotation(forcehotspot);

      delete(tour_current_played_video);
      set(tour_current_played_video, null);
      set(tour_current_played_video_state, 0);
      if(layer[displayedStandardVideo].pausebgsound,
        resumeTourSoundsActions(true,true,true,true,true);
      );
      if(layer[displayedStandardVideo].overlay,removelayer(displayedStandardVideoOverlayBkg););
      removelayer(displayedStandardVideo);
    ,
      if (layer[displayedStandardVideo].started == false,
        set(layer[displayedStandardVideo].visible , true);
        if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, true););
        set(layer[displayedStandardVideoOverlay].visible , false);
        removelayer(displayedStandardVideoOverlayButton);
        removelayer(displayedStandardVideoOverlay);
        set(layer[displayedStandardVideo].started, true);
        if(layer[displayedStandardVideo].pausedonstart,
          if(layer[displayedStandardVideo].pausebgsound,
            pauseTourSoundsActions(true,true,false,true,true);
          );
        );
        layer[displayedStandardVideo].play();
        ifnot(tour_soundson,
          pauseVideoActionsSounds();
        );
      ,
        layer[displayedStandardVideo].stop();
        set(layer[displayedStandardVideo].visible , false);
        if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, false););resumeautorotation(forcehotspot);

        delete(tour_current_played_video);
        set(tour_current_played_video, null);
        set(tour_current_played_video_state, 0);
        if(layer[displayedStandardVideo].pausebgsound,
          resumeTourSoundsActions(true,true,true,true,true);
        );
        if(layer[displayedStandardVideo].overlay,removelayer(displayedStandardVideoOverlayBkg););
        removelayer(displayedStandardVideo);
      );
    );
  </action>
  <events name="displayedVideoObjectEvents" keep="true" onremovedisplayedobject="displayedVideoObjectOnRemoveDisplayedObject"/>
  <action name="displayedVideoObjectOnRemoveDisplayedObject">
    ifnot(layer[displayedStandardVideo].currentCall,
      if(layer[displayedStandardVideo].visible,
        layer[displayedStandardVideo].stop();
        ifnot(layer[displayedStandardVideo].fromdesktop,
          removelayer(displayedStandardVideoOverlayButton);
          removelayer(displayedStandardVideoOverlay);
        );
        set(layer[displayedStandardVideo].visible , false);
        if(layer[displayedStandardVideo].overlay,set(layer[displayedStandardVideoOverlayBkg].visible, false););resumeautorotation(forcehotspot);

        delete(tour_current_played_video);
        set(tour_current_played_video, null);
        set(tour_current_played_video_state, 0);
        if(layer[displayedStandardVideo].pausebgsound,
          resumeTourSoundsActions(true,true,true,true,true);
        );
        if(layer[displayedStandardVideo].overlay,removelayer(displayedStandardVideoOverlayBkg););
        removelayer(displayedStandardVideo);
      );
    );
  </action>

<action name="viewControlZoomIn">
	if(%1,
		if(%2,
			if(%2 LT view.fovmin,
				zoomto(get(view.fovmin));
			,
				if(%2 LT view.fov,
					zoomto(%2);
				);
			);
		,
			set(fov_moveforce, -1);
			delayedcall(0.1, viewControlZoomStop());
		);
	,
		set(fov_moveforce, -1);
	);
</action>
<action name="viewControlZoomOut">
	if(%1,
		if(%2,
			if(%2 GT view.fovmax,
				zoomto(get(view.fovmax));
			,
				if(%2 GT view.fov,
					zoomto(%2);
				);
			);
		,
			set(fov_moveforce, +1);
			delayedcall(0.1, viewControlZoomStop());
		);
	,
		set(fov_moveforce, +1);
	);
</action>
<action name="viewControlZoomStop">
	set(fov_moveforce, 0);
</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>

  <!-- Hide / Show Controls -->
  <action name="hideTourControls">set(tour_displaycontrols, false);events.dispatch(hidetourcontrols);</action>
  <action name="showTourControls">set(tour_displaycontrols, true); events.dispatch(showtourcontrols);</action>


  <action name="enableGyroscope">
    changeGyroscopeState(true);
  </action>
  <action name="disableGyroscope">
    changeGyroscopeState(false);
  </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>
  <!-- Share Tour -->
  <action name="shareTour">events.dispatch(onsharetour);</action>

</krpano>