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

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


  <style name="IconDefaultPointSpotStyle"
         url="%FIRSTXML%/spots/hotspot_animated_user_defaultpoint0.png"
         visible="false"
         frame="0"
         lastframe="19"
         framewidth="64"
         frameheight="64"
         stopspotsequence="false"
         crop="0|0|64|64"
         edge="center"
         onloaded="startspotanimation(0.1);"
         onover="onoverIconDefaultPointSpotStyle"
         onout="onoutIconDefaultPointSpotStyle"


         />
  <action name="onoverIconDefaultPointSpotStyle">


pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconDefaultPointSpotStyle">


resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - YouTube Video -->


  <style name="IconYouTubeVideo"
         url="%FIRSTXML%/spots/hotspot_video_frame_sequence_user_defaultpoint5.png"
         visible="false"
         frame="0"
         lastframe="22"
         framewidth="85"
         frameheight="85"
         stopspotsequence="false"
         crop="0|0|85|85"
         edge="center"
         onloaded="startspotanimation(0.1);"
         onhover="onhoverIconYouTubeVideo"
         onover="onoverIconYouTubeVideo"
         onout="onoutIconYouTubeVideo"


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

pauseautorotation(forcehotspot);

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

resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - Call Out -->


  <style name="IconCallOut"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint3.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOut"
         onout="onoutIconCallOut"


         />
  <action name="onhoverIconCallOut">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOut">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Call Out Down -->


  <style name="IconCallOutDown"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint9.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutDown"
         onout="onoutIconCallOutDown"


         />
  <action name="onhoverIconCallOutDown">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutDown">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Wejscie _ hotspot -->


  <style name="IconWejscie-hotspot"
         url="%FIRSTXML%/spots/wejscie_user_defaultpoint10.png"
         visible="false"
         edge="center"
         alpha="0.8"
         onover="onoverIconWejscie-hotspot"
         onout="onoutIconWejscie-hotspot"

         height="75"
         width="75"
         />
  <action name="onoverIconWejscie-hotspot">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconWejscie-hotspot">
    tween(scale, 1);
    tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - Call Out Left -->


  <style name="IconCallOutLeft"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint11.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutLeft"
         onout="onoutIconCallOutLeft"


         />
  <action name="onhoverIconCallOutLeft">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutLeft">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Call Out Titles Descrp BG left -->


  <style name="IconCallOutTitlesDescrpBGleft"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint12.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutTitlesDescrpBGleft"
         onout="onoutIconCallOutTitlesDescrpBGleft"


         />
  <action name="onhoverIconCallOutTitlesDescrpBGleft">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutTitlesDescrpBGleft">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Call Out Titles Descrp BG -->


  <style name="IconCallOutTitlesDescrpBG"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint13.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutTitlesDescrpBG"
         onout="onoutIconCallOutTitlesDescrpBG"


         />
  <action name="onhoverIconCallOutTitlesDescrpBG">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutTitlesDescrpBG">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Call Out Titles Descrp BG top long -->


  <style name="IconCallOutTitlesDescrpBGtoplong"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint15.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutTitlesDescrpBGtoplong"
         onout="onoutIconCallOutTitlesDescrpBGtoplong"


         />
  <action name="onhoverIconCallOutTitlesDescrpBGtoplong">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutTitlesDescrpBGtoplong">
    hideTooltip();



  </action>



    
  <!-- Spot Style - Call Out Titles Descrp BG right down -->


  <style name="IconCallOutTitlesDescrpBGrightdown"
         url="%FIRSTXML%/spots/hotspot_information_user_defaultpoint16.png"
         visible="false"
         edge="center"
         onhover="onhoverIconCallOutTitlesDescrpBGrightdown"
         onout="onoutIconCallOutTitlesDescrpBGrightdown"


         />
  <action name="onhoverIconCallOutTitlesDescrpBGrightdown">
    showtooltip('hotspot');
  </action>
  <action name="onoutIconCallOutTitlesDescrpBGrightdown">
    hideTooltip();



  </action>



<!-- ********** -->
<!-- Logo -->
<!-- id : logo -->
<!-- ********** -->


  <hotspot ath="0" atv="90"
         zorder="0"
         name="logo"
         keep="true"
         visible="false"
         capture="false"
         url="%FIRSTXML%/graphics/logo/_3dtrip-logo-wirtualne-spacery-nadir.png" 
         handcursor="false"


         />

  <events name="logoevents" 
    onTourStart="showlogo();"
    keep="true" />

  <action name="hidelogo">
    set(hotspot[logo].visible, false);
  </action>
  <action name="showlogo">
      set(hotspot[logo].visible, true);
  </action>

    <events name="logorotationevents" onviewchanged="updatelogorotation" keep="true"/>
    <action name="updatelogorotation">
        copy(hotspot[logo].rz, view.hlookat);
    </action>


  <events name="logoshowevents" onremovepano="hidelogo" onPanoStart="showlogo" keep="true"/>




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

<ptplugin name="analytics" engine="kolorAnalytics">
	<settings>
		<option name="source" value="google" type="string" />
		<option name="tracking_id" value="UA-17387243-4" type="string" />
		<option name="anonymizeIp" value="true" type="bool" />
		<option name="force_ssl" value="false" type="bool" />
		<option name="force_test" value="false" type="bool" />
		<option name="start_page" value="hart-tech/vr" type="string" />
		<option name="start_title" value="Hart-Tech - Wirtualny spacer" type="string" />
		<option name="start_lang" value="pl" type="string" />
		<option name="use_i18n" value="true" type="bool" />
	</settings>
</ptplugin>

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

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

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

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

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

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

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

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

  <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);
        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].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);
          ,
          );
        );
      ,
        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].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);
        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].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].overlay,removelayer(displayedStandardVideoOverlayBkg););
        removelayer(displayedStandardVideo);
      );
    );
  </action>

  <!-- Tour Information -->
  <action name="hideTourInfo">set(tour_displayinfo, false);events.dispatch(onhidetourinfo);</action>
  <action name="showTourInfo">set(tour_displayinfo, true); events.dispatch(onshowtourinfo);</action>

<action name="setTourLanguage">
  if (%1 == null,
    showlog();
    trace("CHANGE TOUR LANGUAGE : NO LANGUAGE SET");
   ,
    set(tour_language, %1);
    js(eventTourChangeLanguage(get(tour_language)));
    events.dispatch(changetourlanguage);
  );
</action>

  <action name="displayWebVideo">
    if(layer[webvideodisplay_bg],

    ,
      <!-- add overlay -->
      addlayer(webvideodisplay_bg);
      set(layer[webvideodisplay_bg].type, container);
      set(layer[webvideodisplay_bg].zorder, 98);
      set(layer[webvideodisplay_bg].align, topleft);
      set(layer[webvideodisplay_bg].width, 100%);
      set(layer[webvideodisplay_bg].height, 100%);
      set(layer[webvideodisplay_bg].bgcolor, %16);
      set(layer[webvideodisplay_bg].bgalpha, %17);
      set(layer[webvideodisplay_bg].bgcapture, true);
      set(layer[webvideodisplay_bg].handcursor, false);
      set(layer[webvideodisplay_bg].alpha, 0.0);
      set(layer[webvideodisplay_bg].onclick, displayWebVideoObjectClose() );
      tween(layer[webvideodisplay_bg].alpha, 1.0, 0.5, default,


        addlayer(webvideodisplay_player);
        set(layer[webvideodisplay_player].parent, layer[webvideodisplay_bg]);
        set(layer[webvideodisplay_player].align, %13);
        set(layer[webvideodisplay_player].x, %14);
        set(layer[webvideodisplay_player].y, %15);
        set(layer[webvideodisplay_player].alpha, 0.0);
        set(layer[webvideodisplay_player].pauseautorotate, %18);
        set(layer[webvideodisplay_player].pausebgsound, %19);

        sub(maxstagewidth, get(stagewidth), %14);
        sub(maxstageheight, get(stageheight), %15);

        if('4:3' == '%3',
          div(aspect, 4, 3);
        ,
          if('2.39:1' == '%3',
            div(aspect, 2.39, 1);
          ,
            div(aspect, 16, 9);
          );
        );
        if(%9,
          if(%10 == 'pixel',
            set(new_videowidth, %9);
            div(new_videoheight, get(new_videowidth), get(aspect));
          ,
            mul(new_videowidth, get(maxstagewidth), %9);
            div(new_videowidth, 100);
            div(new_videoheight, get(new_videowidth), get(aspect));
          );
        ,
          ifnot(%11,
            set(max_videoheight, %2);
            set(new_videowidth, %1);
            set(new_videoheight, %2);
          );
        );
        if(%11,
          ifnot(%9,
            if(%12 == 'pixel',
              set(new_videoheight, %11);
              mul(new_videowidth, get(new_videoheight), get(aspect));
            ,
              mul(new_videoheight, get(maxstageheight), %11);
              div(new_videoheight, 100);
              mul(new_videowidth, get(new_videoheight), get(aspect));
            );
            set(max_videoheight, get(new_videoheight));
          ,
            if(%12 == 'pixel',
              set(max_videoheight, %11);
            ,
              mul(max_videoheight, get(maxstageheight), %11);
              div(max_videoheight, 100);
            );
          );
        ,
          set(max_videoheight, get(new_videoheight));
        );
        if(new_videowidth GT maxstagewidth,
          set(new_videowidth, get(maxstagewidth));
          div(new_videoheight, get(new_videowidth), get(aspect));
        );
        if(max_videoheight GT maxstageheight,
          set(max_videoheight, get(maxstageheight));
        );
        if(new_videoheight GT max_videoheight,
          set(new_videoheight, get(max_videoheight));
          mul(new_videowidth, get(new_videoheight), get(aspect));
        );
        roundval(new_videowidth);
        roundval(new_videoheight);
        set(layer[webvideodisplay_player].width, get(new_videowidth));
        set(layer[webvideodisplay_player].height, get(new_videoheight));

        set(tour_current_played_web_video, %8);

        if(device.html5,

          txtadd(iframecode, '[iframe width="',get(layer[webvideodisplay_player].width),'" height="',get(layer[webvideodisplay_player].height),'" src="','%4','%8','?','%6','" frameborder="0" allowfullscreen][/iframe]');
          set(layer[webvideodisplay_player].html, get(iframecode));
          set(layer[webvideodisplay_player].padding, 0);
          set(layer[webvideodisplay_player].type, 'text');
          set(layer[webvideodisplay_player].onloaded, displayWebVideoObjectReady() );
        ,

          txtadd(embedurl, '%5','%8','%7');
          set(layer[webvideodisplay_player].onloaded, registercontentsize(%1,%2);displayWebVideoObjectReady(); );
          set(layer[webvideodisplay_player].url, get(embedurl));
        );
      );
    );
  </action>
  <action name="displayWebVideoObjectReady">
    if(layer[webvideodisplay_player],
      set(layer[webvideodisplay_player].currentCall, true);
      events.dispatch(onremovedisplayedobject);
      tween(layer[webvideodisplay_player].alpha, 1.0, default, default,
        if(layer[webvideodisplay_player].pauseautorotate,pauseautorotation(forcehotspot);
);
      );
    );
  </action>
  <action name="displayWebVideoObjectClose">
    if(layer[webvideodisplay_player],
      if(layer[webvideodisplay_player].currentCall,
        set(layer[webvideodisplay_player].currentCall, false);
      ,
        set(layer[webvideodisplay_bg].onclick, null);
        delete(tour_current_played_web_video);
        tween(layer[webvideodisplay_player].alpha, 0.0, 0.25, default);
        tween(layer[webvideodisplay_bg].alpha,0.0, 0.50, default,
          if(layer[webvideodisplay_player].pauseautorotate,resumeautorotation(forcehotspot);
);
          removelayer(webvideodisplay_bg);
          removelayer(webvideodisplay_player);
        );
      );
    );
  </action>
  <events name="displayWebVideoObjectEvents" keep="true" onremovedisplayedobject="displayWebVideoObjectClose();"/>

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

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


</krpano>