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

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


  <style name="IconDefaultPointSpotStyle"
         url="%FIRSTXML%/spots/hotspot_neutral_user_defaultpoint0.png"
         visible="false"
         edge="center"
         onhover="onhoverIconDefaultPointSpotStyle"
         onout="onoutIconDefaultPointSpotStyle"


         />
  <action name="onhoverIconDefaultPointSpotStyle">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconDefaultPointSpotStyle">
    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"
         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="onoutRectVideoDefaultVideoSpotStyle">
    hideTooltip();
  </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>



<!-- ********** -->
<!-- iControl Bar -->
<!-- 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="1"
         width="40"
         height="40"
         align="bottom"
         x="0" y="10"
         maskchildren="true"
         rotate="0"
         visible="false"
         >


    <layer name="controlBar_ibtn_ctrlmode_move_to"
            url="%FIRSTXML%/graphics/icontrolbar/btn_move_to.png"
            style="controlBar_i_btn_style"
            tooltip="controlBar_ictrlmodeMoveTip"
            onclick="setControlModeMoveTo();
"
            visible="false"
            devices="desktop"
            />
    <layer name="controlBar_ibtn_ctrlmode_drag_to"
            url="%FIRSTXML%/graphics/icontrolbar/btn_drag_to.png"
            style="controlBar_i_btn_style"
            tooltip="controlBar_ictrlmodeDragTip"
            onclick="setControlModeDragTo();
"
            visible="false"
            devices="desktop"
            />

    <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_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_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_display_help"
            url="%FIRSTXML%/graphics/icontrolbar/btn_help.png"
            onclick="controlBar_idisplayHelp();"
            style="controlBar_i_btn_style"
            devices="desktop"
            visible="false"
            tooltip="controlBar_idisplayHelpTip"
            />
    <layer name="controlBar_ibtn_close_help"
            url="%FIRSTXML%/graphics/icontrolbar/btn_help.png"
            onclick="controlBar_icloseHelp();"
            style="controlBar_i_btn_style"
            visible="false"
            devices="desktop"
            tooltip="controlBar_ihideHelpTip"
            />



    <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_icontrolmodechangedevent" 
		oncontrolmodechanged="controlBar_iupdateControlModeButtons();" 
		keep="true" />
	<action name="controlBar_iHideControlModeButtons">
		set(layer[controlBar_ibtn_ctrlmode_move_to].visible, false);
		set(layer[controlBar_ibtn_ctrlmode_drag_to].visible, false);
	</action>
	<action name="controlBar_iShowControlModeButtons">
		if (tour_controlmodemousetype == "moveto",
			set(layer[controlBar_ibtn_ctrlmode_drag_to].visible, true);
			set(layer[controlBar_ibtn_ctrlmode_move_to].visible, false);
		,
			set(layer[controlBar_ibtn_ctrlmode_move_to].visible, true);
			set(layer[controlBar_ibtn_ctrlmode_drag_to].visible, false);
		);
	</action>
	<action name="controlBar_iupdateControlModeButtons">
	if (device.desktop,
		if (controlBar_iIsOpened,
			controlBar_iShowControlModeButtons();
		,
			controlBar_iHideControlModeButtons();
		);
	,
		controlBar_iHideControlModeButtons();
	);
	</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);
);


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_iupdateHelpButtons();


	controlBar_iupdateAutorotationButtons();


	controlBar_iupdateControlModeButtons();




	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);
);


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_iupdateHelpButtons();


	controlBar_iupdateAutorotationButtons();


	controlBar_iupdateControlModeButtons();



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

  <layer name="controlBar_ihelpScreenBg"
         align="center"
         keep="true"
         onclick="controlBar_icloseHelp();"
         url="%FIRSTXML%/graphics/icontrolbar/help_screen_bg.png"
         visible="false"
         rotate="-90"
         height="50%"
         width="prop"
         zorder="97"
         x="100%" />
  <layer name="controlBar_ihelpScreenFg"
         align="center"
         keep="true"
         onclick="controlBar_icloseHelp();"
         url="%FIRSTXML%/graphics/icontrolbar/help_screen_fg.png"
         height="50%"
         width="prop"
         visible="false"
         rotate="90"
         zorder="98"
         x="-100%"
         displayed="false" />
  <action name="controlBar_idisplayHelp">
  if (device.desktop,
    set(layer[controlBar_ihelpScreenFg].displayed,true);
    set(layer[controlBar_ihelpScreenBg].visible,true);
    set(layer[controlBar_ihelpScreenFg].visible,true);
    tween(layer[controlBar_ihelpScreenFg].rotate,0, 1);
    tween(layer[controlBar_ihelpScreenFg].x,0, 1);
    tween(layer[controlBar_ihelpScreenBg].rotate,0, 1);
    tween(layer[controlBar_ihelpScreenBg].x,0, 1);
    controlBar_iupdateHelpButtons();
  );
  </action>
  <action name="controlBar_icloseHelp">
  if (device.desktop,
    set(layer[controlBar_ihelpScreenFg].displayed,false);
    tween(layer[controlBar_ihelpScreenFg].rotate,  90, 1, easeOutQuad, set(layer[controlBar_ihelpScreenFg].visible,false););
    tween(layer[controlBar_ihelpScreenFg].x, -100%, 1);
    tween(layer[controlBar_ihelpScreenBg].rotate, -90, 1, easeOutQuad, set(layer[controlBar_ihelpScreenBg].visible,false););
    tween(layer[controlBar_ihelpScreenBg].x, 100%, 1);
    controlBar_iupdateHelpButtons();
  );
  </action>
	<action name="controlBar_iHideHelpButtons">
		set(layer[controlBar_ibtn_display_help].visible, false);
		set(layer[controlBar_ibtn_close_help].visible, false);
	</action>
	<action name="controlBar_iShowHelpButtons">
		if (layer[controlBar_ihelpScreenFg].displayed,
			set(layer[controlBar_ibtn_close_help].visible, true);
			set(layer[controlBar_ibtn_display_help].visible, false);
		,
			set(layer[controlBar_ibtn_display_help].visible, true);
			set(layer[controlBar_ibtn_close_help].visible, false);
		);
	</action>
	<action name="controlBar_iupdateHelpButtons">
	if (device.desktop,
		if (controlBar_iIsOpened,
			controlBar_iShowHelpButtons();
		,
			controlBar_iHideHelpButtons();
		);
	,
		controlBar_iHideHelpButtons();
	);
	</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>



<layer name="controlBar_imenuTooltipStyle"
	keep="true"
	enabled="false"
	capture="false"
	type="text"
	align="center"
	bg="false"
	bgborder="0"
	css="color:#000000;font-family:Helvetica;font-weight:bold;font-size:14px;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.desktop,
        set(layer[controlBar_ibtn_display_help].x, get(controlBar_ibutton_pos));
        set(layer[controlBar_ibtn_close_help].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_autorotate_on].x , get(controlBar_ibutton_pos));
      set(layer[controlBar_ibtn_autorotate_off].x, get(controlBar_ibutton_pos));
      inc(controlBar_ibutton_pos, 45);



    if (device.desktop,
      set(layer[controlBar_ibtn_ctrlmode_drag_to].x, get(controlBar_ibutton_pos));
      set(layer[controlBar_ibtn_ctrlmode_move_to].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>




<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>

<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);set(fullscreen,false);</action>
  <action name="enterFullScreen" devices="fullscreensupport">set(tour_fullscreen,true);set(fullscreen,true);</action>
  <action name="switchFullScreen">if(tour_fullscreen,exitFullScreen();,enterFullScreen(););</action>

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

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

  <!-- 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>


  <!-- 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>

</krpano>