<?xml version="1.0" encoding="UTF-8"?>
<krpano>
  <!-- Global variables used by actions and plugins -->
  <krpano 
        tour_soundson="false" 
        tour_soundsvolume="100" 
        tour_autotourenabled="false"
        tour_autorotateenabled="false"
        tour_controlmodemousetype="drag"
        tour_controlmodetouchtype="drag"
        tour_fullscreen="false"
        tour_displaymap="false"
        tour_displaythumbnails="true"
        tour_displayfloorplan="false"
        tour_displayinfo="false"
        tour_displayspots="true"
        tour_displaycontrols="true"
        tour_language="en" />
  <krpano tour_gyroscopedevices="true" devices="no-desktop.and.html5" />
  <krpano tour_vrdevices="true" devices="html5" />
  <krpano videos_sounds_path="%FIRSTXML%" devices="html5" />
  <krpano videos_sounds_path="%SWFPATH%" devices="flash" />
  <krpano projection_current_params="view.fisheyefovlink=0.5&amp;view.architectural=0.0&amp;view.pannini=0.0&amp;view.fisheye=0.0&amp;view.stereographic=false" />


  <krpano vrtourdevice.desktop="desktop" vrtourdevice.tablet="tablet" vrtourdevice.mobile="mobile" />
  <krpano vrtourdevicescale.desktop="1.0" vrtourdevicescale.tablet="1.0" vrtourdevicescale.mobile="2.0" />
  <action name="vrtourcurrentscale" autorun="preinit">
    mul(stagescale,get(vrtourdevicescale));
  </action>

  <!-- Control Mode Management -->
  <control mouse="drag" touch="drag" />
  <action name="setControlModeDragTo">setControlMode(drag);</action>
  <action name="setControlModeMoveTo">setControlMode(moveto);</action>
  <action name="setControlMode">
    if (device.desktop,
      set(control.mouse, %1);
      set(tour_controlmodemousetype, %1);
    ,
      set(control.touch, %1);
      set(tour_controlmodetouchtype, %1);
    );
    events.dispatch(oncontrolmodechanged);
  </action>



  <!-- Tour Messages -->
  <action name="getmessage">
    txtadd(real_message_id, get(tour_language), "_", %2);
    set(%1, get(data[get(real_message_id)].content));
  </action>

  <!-- Hide / Show Hotspots -->
  <action name="hideHotspots">
    set(tour_displayspots, false);
    set(nb_spots, get(hotspot.count));
    if (nb_spots != 0, hidepanospotsaction(); );
    events.dispatch(hotspots_visibility_changed);
  </action>
  <action name="showHotspots">
    set(tour_displayspots, true);
    set(nb_spots, get(hotspot.count));
    if (nb_spots != 0, showpanospotsaction(); );
    events.dispatch(hotspots_visibility_changed);
  </action>

  <events name="hideShowHotspotsOnNewPanoEvent" onPanoStart="hideShowHotspotsOnNewPanoAction" keep="true"/>
  <action name="hideShowHotspotsOnNewPanoAction">
    set(nb_spots, get(hotspot.count));
    if (nb_spots != 0,
      if (tour_displayspots, showpanospotsaction(); , hidepanospotsaction(); );
    );
  </action>



  <action name="startbehavioursxmlcompleteaction">
    ifnot (tour_firststartactiondone,
      set(tour_firststartactiondone, true);
      events.dispatch(onTourStart);
    );
    events.dispatch(onPanoStart);
  </action>





  <events name="startTourForJsEvents" onTourStart="startTourForJsEventsAction();" keep="true" />
  <action name="startTourForJsEventsAction">
    js(eventTourStarted());
  </action>




  <krpano panovideospotsstate="false" />
  <krpano panolivepanospotsstate="false" />
  <events name="panoVideosSpotsStateEvent" onTourStart="set(panovideospotsstate, true);set(panolivepanospotsstate, true);" keep="true" />

  <krpano ptblendmode="BLEND(1.0, easeInCubic)" />
  <action name="mainloadsceneStartup">
    loadscene(%1, get(projection_current_params), MERGE);
  </action>
  <action name="mainloadscene">
    if (xml.scene != %1,

      interruptAnimation();


      


      loadscene(%1, get(projection_current_params), MERGE, get(ptblendmode));



    );
  </action>

  <!-- Load Previous Scene -->
  <action name="loadPreviousScene">
    if (%1 != findscene, sub(sceneprevnexti, scene.count, 1));
    copy(scenenamei, scene[get(sceneprevnexti)].name);
    dec(sceneprevnexti);
    if (scenenamei == xml.scene,
      if (sceneprevnexti GE 0,
        mainloadscene(get(scene[get(sceneprevnexti)].name));
       ,
        sub(lasti, scene.count, 1);
        mainloadscene(get(scene[get(lasti)].name));
      );
     ,
      if(sceneprevnexti GE 0, loadPreviousScene(findscene));
    );
  </action>

  <!-- Load Next Scene -->
  <action name="loadNextScene">
    if (%1 != findscene, set(sceneprevnexti,0));
    copy(scenenamei, scene[get(sceneprevnexti)].name);
    inc(sceneprevnexti);
    if (scenenamei == xml.scene,
      if (sceneprevnexti LT scene.count,
        mainloadscene(get(scene[get(sceneprevnexti)].name));
       ,
        mainloadscene(get(scene[0].name)); );
     ,
      if(sceneprevnexti LT scene.count, loadNextScene(findscene));
    );
  </action>


  <!-- AUTOROTATION -->
  <autorotate enabled="false"/>
  <krpano tour_autorotation_pausecounter="0"/>
  <krpano tour_autorotation_pauseplugin="0"/>
  <krpano tour_autorotation_openatstartplugin="0"/>
  <action name="startautorotation">
    if(tour_autorotation_pausecounter LE 0,
      set(tour_autorotateenabled, true );

      invalidatescreen();
      set(autorotate.enabled, true);
      set(tour_autorotation_pausecounter, 0);
      events.dispatch(onstartautorotation);

      if(tour_autotourenabled,
        resetautotourvariables();
      );
    );
  </action>
  <action name="stopautorotation">
    set(tour_autorotateenabled, false);
    set(autorotate.enabled, false);
    events.dispatch(onstopautorotation);

    if(tour_autotourenabled,
      stopautotourtimer();
    );
  </action>
  <action name="pauseautorotation">
    if(%1 == forceplugin,
      inc(tour_autorotation_pauseplugin);
    );
    inc(tour_autorotation_pausecounter);
    if(tour_autorotateenabled,
      set(autorotate.enabled, false);
      events.dispatch(onpauseautorotation);

      if(tour_autotourenabled AND useautotourdelay == false,
        stopautotourtimer();
      );
    );
  </action>
  <action name="resumeautorotation">
    if(%1 == forceplugin,
      if (tour_autorotation_pauseplugin GT 0,
        dec(tour_autorotation_pauseplugin);
      );
    );
    if (tour_autorotation_pausecounter GE 0,
      if(%1 != forceresume,
        if ((tour_autorotation_pausecounter GT 0) AND (tour_autorotation_pausecounter GT tour_autorotation_pauseplugin),
         dec(tour_autorotation_pausecounter);
        );
      );
    );
    if(tour_autorotateenabled,
      if(tour_autorotation_pausecounter == 0,
        if(%1 != forceresume,
          set(autorotate.enabled, true);
          events.dispatch(onresumeautorotation);

          if(tour_autotourenabled,
            resetautotourvariables();
          );
        );
      );
    ,
      if(%1 != forceresume,
        if(%1 != forceplugin,
          if(%1 != forcehotspot,
            startautorotation();
          );
        ,

          set(forceAutorotationFromPluginUnload, false);
          if(action['autorotationatstart'],
            set(forceAutorotationFromPluginUnload, true);
          );
          if(action['autotouratstart'],
            set(forceAutorotationFromPluginUnload, true);
          );
          if(forceAutorotationFromPluginUnload,
            if(tour_autorotation_openatstartplugin == 1,
              if((tour_autorotation_pauseplugin LE 0) AND (tour_autorotation_pausecounter LE 0),
                startautorotation();
              );
            );
          );
        );
      );
    );
  </action>
  <events name="autorotation_events" onnewpano="if(tour_autorotation_pauseplugin LE 0,resumeautorotation(forceresume););" ongyroscopeon="pauseautorotation(forceplugin);" ongyroscopeoff="resumeautorotation(forceplugin);" keep="true"/>


  <!-- AUTOTOUR -->

  <krpano useautotourdelay="false" autotourdelay="5" autotourHorizontalStartValue="0" />
  <action name="startautotour">
    set(tour_autotourenabled, true);
startautorotation();


    events.dispatch(onstartautotour);


  </action>
  <action name="resetautotourvariables">
    stopautotourtimer();
    if (scene[get(xml.scene)].planar,
      set(autotourdelay, 10);
      delayedcall(autotour_call_id, get(autotourdelay), autotourtimer);
    ,
      set(autotourHorizontalStartValue, get(view.hlookat));
      if ((panoview.hmin == -180) AND (panoview.hmax == 180),
        delayedcallAutotourFull360();
      ,
        set(previousStep, 0);
        set(panoramaHorizontalSize, 0);
        set(totalPartialSize, 0);
        set(firstBorderSize, 0);
        set(secondBorderSize, 0);
        set(firstStep, 0);
        set(firstStepTest, 0);
        set(firstStepKeep, 0);
        set(borderCounter, 0);
        sub(panoramaHorizontalSize, get(panoview.hmax), get(panoview.hmin));
        Math.abs(panoramaHorizontalSize);
        delayedcallAutotourPartial();
      );
    );
  </action>
  <action name="delayedcallAutotourPartial">
    sub(tempPosition, get(view.hlookat), get(autotourHorizontalStartValue));
    Math.ceil(tempPosition);
    Math.abs(tempPosition);
    if(borderCounter == 0 AND tempPosition LT previousStep,

      inc(borderCounter);
      Math.abs(firstStep, get(previousStep));
      sub(firstStepTest, get(previousStep), get(firstStep));
      set(firstStepKeep, get(firstStepTest));
      Math.abs(firstBorderSize, get(previousStep));
      add(totalPartialSize, get(firstBorderSize));
    );
    if(borderCounter GE 1,
      if(firstBorderSize != 0,
        sub(firstStepTest, get(previousStep), get(firstStep));
        Math.abs(firstStepTest, get(firstStepTest));
        if(firstStepTest LT firstStepKeep,

          add(totalPartialSize, get(firstBorderSize));
          set(firstBorderSize, 0);
        );
        set(firstStepKeep, get(firstStepTest));
      ,
        if(tempPosition LT previousStep,

          inc(borderCounter);
          Math.abs(secondBorderSize, get(previousStep));
          add(totalPartialSize, get(secondBorderSize));
        );
      );
    );
    set(previousStep, get(tempPosition));
    if(borderCounter GE 2 AND totalPartialSize GT panoramaHorizontalSize,
      delete(previousStep, panoramaHorizontalSize, totalPartialSize, firstBorderSize, secondBorderSize, firstStep, firstStepTest, firstStepKeep, borderCounter);
      autotourtimer();
    ,
      delayedcall(autotour_call_id, 0.5, delayedcallAutotourPartial);
    );
  </action>
  <action name="delayedcallAutotourFull360">
    sub(tempPosition, get(view.hlookat), get(autotourHorizontalStartValue));
    mod(tempPositionMod, get(tempPosition), 360);
    Math.ceil(tempPosition);
    Math.ceil(tempPositionMod);
    if(tempPositionMod == tempPosition,
      delayedcall(autotour_call_id, 0.5, delayedcallAutotourFull360);
    ,
      autotourtimer();
    );
  </action>
  <action name="stopautotour">
    set(tour_autotourenabled, false);
    stopautotourtimer();
stopautorotation();


    events.dispatch(onstopautotour);
  </action>
  <action name="autotourtimer">
    if(tour_autotourenabled,
      if(tour_autorotateenabled,
        if(autorotate.enabled,
          stopautotour();loadNextScene();

          startautotour();
        );
      );
    );
  </action>
  <action name="stopautotourtimer">
    stopdelayedcall(autotour_call_id);
  </action>
  <events name="autotourevents" 
    onnewpano="autotouronnewpanoaction();" 
    onmouseup="autotouronuseraction(true);" 
    onmousedown="autotouronuseraction(false);" 
    onkeyup="autotouronuseraction(true);" 
    keep="true" />
  <action name="autotouronnewpanoaction">
    if(tour_autotourenabled, resetautotourvariables(););
  </action>
  <action name="autotouronuseraction">
    if(tour_autotourenabled, if(%1, resetautotourvariables();, stopautotourtimer();););
  </action>



  <krpano tour_deeplinkingvars=""/>
  <action name="computeDeepLinkingURL">
    txtadd(tour_deeplinkingvars, "s=", get(xml.scene));
    set(viewhlookat, get(view.hlookat));roundval(viewhlookat, 4);
    mod(viewhlookat, 360);
    if (viewhlookat GT 180,
      sub(viewhlookat, 360);
     ,
      if (viewhlookat LT -180, add(viewhlookat, 360));
    );
    set(viewvlookat, get(view.vlookat));roundval(viewvlookat, 4);
    set(viewfov, get(view.fov));roundval(viewfov, 4);
    txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&amp;h=", get(viewhlookat));
    txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&amp;v=", get(viewvlookat));
    txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&amp;f=", get(viewfov));
    if (%1 !== null,if (%1, txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&amp;skipintro");););
    if (%2 !== null,if (%2, txtadd(tour_deeplinkingvars, get(tour_deeplinkingvars), "&amp;norotation");););

  </action>


  <!-- Spot animation management -->
  <action name="animate">
    if (tour_stopsequence == false,
      if (stopspotsequence == false,
        txtadd(delayedname, %1, 'delay');
        if(hotspot[%1].loaded,
          inc(hotspot[%1].frame,1,get(hotspot[%1].lastframe),0);
          mul(hotspot[%1].ypos,get(hotspot[%1].frame),get(hotspot[%1].frameheight));
          txtadd(hotspot[%1].crop,'0|',get(hotspot[%1].ypos),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
        );
        delayedcall(get(delayedname),%2,animate(%1,%2));
      );
    );
  </action>
  <action name="startspotanimation">
    set(tour_stopsequence, false);
    set(stopspotsequence , false);
    animate(get(name), %1);
  </action>
  <action name="stopspotanimation">
    set(hotspot[%1].stopspotsequence, true);
    txtadd(delayedname, %1, 'delay');
    stopdelayedcall(get(delayedname));
  </action>
  <action name="interruptAnimation">
    if(tour_stopsequence == false,
      set(tour_stopsequence, true);

    );
  </action>

  <!-- Disable the default fullscreen mode as it does a fullscreen only on the viewer not "on the tour" -->
  <contextmenu fullscreen="false" versioninfo="false" />

  <!-- Tooltips management -->
<!-- Tooltip Management -->
<krpano tooltipCurrentTextfieldLayer="panotourTooltipDefaultText" coretooltipmess=""/>

<events name="showHideTooltipEvents" onremovepano="hideTooltip();" keep="true" />

<action name="showTooltip">
  if (tooltip !== null,
	getmessage(currentTooltipText, get(tooltip));
	if (%2 == null,
		set(tooltipCurrentTextfieldLayer, "panotourTooltipDefaultText");
	,
		set(tooltipCurrentTextfieldLayer, %2);
	);
	ifnot (currentTooltipText == "",

		tooltipTextSettingsUpdate(%1, %3, %4, %5, %6);
		
		set(tooltipHtmlText, get(currentTooltipText));
		escape(tooltipHtmlText);
		set(layer[get(tooltipCurrentTextfieldLayer)].html, get(tooltipHtmlText));
		set(layer[get(tooltipCurrentTextfieldLayer)].visible, true);
		
		div(halfWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width), 2);
		div(halfHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height), 2);
		
		<!-- Default edge center -->
		set(usedWidth, get(halfWidth));
		set(usedHeight, get(halfHeight));
		
		if(layer[get(tooltipCurrentTextfieldLayer)].edge == "left",
			set(usedWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width));
			add(rightMargin, get(mouse.x), get(usedWidth));
			set(leftMargin, get(mouse.x));
		,
			if(layer[get(tooltipCurrentTextfieldLayer)].edge == "right",
				set(usedWidth, get(layer[get(tooltipCurrentTextfieldLayer)].width));
				set(rightMargin, get(mouse.x));
				sub(leftMargin, get(mouse.x), get(usedWidth));
			,
				add(rightMargin, get(mouse.x), get(usedWidth));
				sub(leftMargin, get(mouse.x), get(usedWidth));
			);
		);
		
		add(rightMargin, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
		add(leftMargin, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
		
		if(layer[get(tooltipCurrentTextfieldLayer)].edge == "bottom",
			set(usedHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height));
			sub(topMargin, get(mouse.y), get(usedHeight));
			set(bottomMargin, get(mouse.y));
		,
			if(layer[get(tooltipCurrentTextfieldLayer)].edge == "top",
				set(usedHeight, get(layer[get(tooltipCurrentTextfieldLayer)].height));
				set(topMargin, get(mouse.y));
				add(bottomMargin, get(mouse.y), get(usedHeight));
			,
				sub(topMargin, get(mouse.y), get(usedHeight));
				add(bottomMargin, get(mouse.y), get(usedHeight));
			);
		);
		
		add(topMargin, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
		add(bottomMargin, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
		
		if(leftMargin LT 0,
			set(layer[get(tooltipCurrentTextfieldLayer)].align, "left");
			set(tooltipPositionX, get(usedWidth));
		,
			set(tooltipstagewidth, get(stagewidth));
			if(area.left, sub(tooltipstagewidth, get(area.left)));
			if(area.right, sub(tooltipstagewidth, get(area.right)));
			
			if(rightMargin GT tooltipstagewidth,
				set(layer[get(tooltipCurrentTextfieldLayer)].align, "right");
				set(tooltipPositionX, get(usedWidth));
			,
				div(tooltipPositionX, get(tooltipstagewidth), 2);
				sub(tooltipPositionX, get(mouse.x), get(tooltipPositionX));
				add(tooltipPositionX, get(layer[get(tooltipCurrentTextfieldLayer)].xoffset));
			);
		);
		
		set(layer[get(tooltipCurrentTextfieldLayer)].x, get(tooltipPositionX));
		
		if(topMargin LT 0,
			if(layer[get(tooltipCurrentTextfieldLayer)].align == "center",
				set(layer[get(tooltipCurrentTextfieldLayer)].align, "top");
			,
				txtadd(layer[get(tooltipCurrentTextfieldLayer)].align, "top");
			);
			set(tooltipPositionY, get(usedHeight));
		,
			set(tooltipstageheight, get(stageheight));
			if(area.top, sub(tooltipstageheight, get(area.top)));
			if(area.bottom, sub(tooltipstageheight, get(area.bottom)));
			
			if(bottomMargin GT tooltipstageheight,
				if(layer[get(tooltipCurrentTextfieldLayer)].align == "center",
					set(layer[get(tooltipCurrentTextfieldLayer)].align, "bottom");
				,
					txtadd(layer[get(tooltipCurrentTextfieldLayer)].align, "bottom");
				);
				set(tooltipPositionY, get(usedHeight));
			,
				div(tooltipPositionY, get(tooltipstageheight), 2);
				sub(tooltipPositionY, get(mouse.y), get(tooltipPositionY));
				add(tooltipPositionY, get(layer[get(tooltipCurrentTextfieldLayer)].yoffset));
			);
		);
		
		set(layer[get(tooltipCurrentTextfieldLayer)].y, get(tooltipPositionY));
	);
  );
</action>
<action name="hideTooltip">
	set(layer[get(tooltipCurrentTextfieldLayer)].visible, false);
	set(layer[get(tooltipCurrentTextfieldLayer)].html, '');
</action>

<action name="tooltipTextSettingsUpdate">
	if(get(tooltipCurrentTextfieldLayer) != "",

		set(layer[get(tooltipCurrentTextfieldLayer)].align, "center");
		if (%2 == null,
			set(layer[get(tooltipCurrentTextfieldLayer)].edge, "bottom");
		,
			set(layer[get(tooltipCurrentTextfieldLayer)].edge, %2);
		);
		if (%3 != null,
			set(layer[get(tooltipCurrentTextfieldLayer)].autowidth, false);
			set(layer[get(tooltipCurrentTextfieldLayer)].wordwrap, true);
			set(layer[get(tooltipCurrentTextfieldLayer)].width, %3);
		);
		if (%4 != null,
			set(layer[get(tooltipCurrentTextfieldLayer)].xoffset, %4);
		);
		if (%5 != null,
			set(layer[get(tooltipCurrentTextfieldLayer)].yoffset, %5);
		);
		set(layer[get(tooltipCurrentTextfieldLayer)].zorder, 99);
	);
</action>

<action name="showPermanentTooltip">
	if (tooltip !== null,
		getmessage(currentTooltipText, get(tooltip));
		ifnot (currentTooltipText == "",
			txtadd(permanentTooltipForSpot, get(tooltip), '_permanent');
			set(activateUsePermanentTooltip, false);
			if(%1 == "std",
				if(device.desktop,
					set(activateUsePermanentTooltip, true);
				);
			,
				if(%1 == "touch",
					if(device.tablet OR device.mobile,
						set(activateUsePermanentTooltip, true);
					);
				,
					set(activateUsePermanentTooltip, true);
				);
			);
			if(activateUsePermanentTooltip,
				addlayer(get(permanentTooltipForSpot));
				txtadd(plugin[get(permanentTooltipForSpot)].parent, 'hotspot[', get(name), ']');
				if (%2 == null,
					if(rotate,
						sub(newRotate, 0, get(rotate));
						if(rotate GE 0 AND rotate LT 45 OR rotate GE 315 AND rotate LT 360,
							set(plugin[get(permanentTooltipForSpot)].rotate,get(newRotate));
							set(plugin[get(permanentTooltipForSpot)].align,bottom);
						,
							if(rotate GE 45 AND rotate LT 135,
								set(plugin[get(permanentTooltipForSpot)].rotate,get(newRotate));
								set(plugin[get(permanentTooltipForSpot)].align,right);
							,
								if(rotate GE 135 AND rotate LT 225,
									set(plugin[get(permanentTooltipForSpot)].rotate,get(newRotate));
									set(plugin[get(permanentTooltipForSpot)].align,top);
								,
									set(plugin[get(permanentTooltipForSpot)].rotate,get(newRotate));
									set(plugin[get(permanentTooltipForSpot)].align,left);
								);
							);
						);
					,
						set(plugin[get(permanentTooltipForSpot)].align,bottom);
					);
					set(plugin[get(permanentTooltipForSpot)].edge,top);
				,

					set(plugin[get(permanentTooltipForSpot)].align,%2);
					set(plugin[get(permanentTooltipForSpot)].edge,%3);
				);
				set(plugin[get(permanentTooltipForSpot)].enabled,false);
				set(plugin[get(permanentTooltipForSpot)].capture,false);
				set(layer[get(permanentTooltipForSpot)].visible, true);
			
				set(plugin[get(permanentTooltipForSpot)].url,'%FIRSTXML%/graphics/textfield.swf');
				set(plugin[get(permanentTooltipForSpot)].background,false);
				set(plugin[get(permanentTooltipForSpot)].border,false);
				set(plugin[get(permanentTooltipForSpot)].textshadow,1);
				set(plugin[get(permanentTooltipForSpot)].textshadowrange,4.0);
				set(plugin[get(permanentTooltipForSpot)].textshadowangle,45);
				set(plugin[get(permanentTooltipForSpot)].textshadowcolor,0x000000);
				set(plugin[get(permanentTooltipForSpot)].textshadowalpha,1);
				set(plugin[get(permanentTooltipForSpot)].css,'color:#ffffff;font-family:Arial;font-weight:bold;font-size:14px;text-align:center;');
				set(plugin[get(permanentTooltipForSpot)].height,20);
				set(plugin[get(permanentTooltipForSpot)].autoheight,true);
				set(plugin[get(permanentTooltipForSpot)].selectable,false);
				set(plugin[get(permanentTooltipForSpot)].zorder,0);
				set(plugin[get(permanentTooltipForSpot)].padding,2);

				set(tooltipHtmlText, get(currentTooltipText));
				escape(tooltipHtmlText);
				set(layer[get(permanentTooltipForSpot)].html, get(tooltipHtmlText));
			);
		);
	);
</action>

<action name="updatePermanentTooltip">
	for(set(hsi, 0), hsi LT hotspot.count, inc(hsi),
		if(hotspot[get(hsi)].tooltip !== NULL AND hotspot[get(hsi)].tooltip != "",
			txtadd(permTooltipName, get(hotspot[get(hsi)].tooltip), '_permanent');
			if(permTooltipName,
				getmessage(changeTooltipTxt, get(hotspot[get(hsi)].tooltip));
				escape(changeTooltipTxt);
				set(layer[get(permTooltipName)].html, get(changeTooltipTxt));
			);
		);
	);
</action>

<events name="permanentTooltipEvents" keep="true" changetourlanguage="updatePermanentTooltip()" />



<!-- Default HTML5 tooltip style -->
<layer name="panotourTooltipDefaultText"
	keep="true"
	enabled="false"
	capture="false"
	url="%FIRSTXML%/graphics/textfield.swf"
	align="center"
	background="false"
	border="false"
	textshadow="1" textshadowrange="4.0" textshadowangle="45" textshadowcolor="0x000000" textshadowalpha="1"
	css="color:#ffffff;font-family:Arial;font-weight:bold;font-size:14px;text-align:left;"
	height="20" 
	autoheight="true"
	autowidth="auto"
	edge="bottom"
	selectable="false"
	zorder="0"
	padding="2"
	xoffset="0"
	yoffset="0"
	visible="false"
	html=""
/>






  <!-- Keyboard management 
  * use the keyboard +/- keys to zoom in/out
  * use the keyboard CTRL+0 keys to reset the default panorama view
  -->
  <control keycodesin="107,187" keycodesout="109,189" />
  <krpano tour_ctrlPressed="false"/>
  <events name="keycontrolZoomEvents" onkeydown="onKDZ" onkeyup="onKUZ" keep="true"/>
  <action name="onKDZ">if(keycode==17,set(tour_ctrlPressed,true);,if(tour_ctrlPressed==true,if(keycode==96,hideTooltip();lookto(get(panoview.h),get(panoview.v),get(panoview.fov)););););</action>
  <action name="onKUZ">if(keycode==17,set(tour_ctrlPressed,false););</action>

  <!-- Indicate if a scene is seen or not - dispatch an event if the state is changed -->
  <events name="sceneSeenEvents" onnewpano="changeSeenState" keep="true"/>
  <action name="changeSeenState">
    ifnot (scene[get(xml.scene)].seen,
      set(scene[get(xml.scene)].seen, true);
      events.dispatch(onSeenStateChanged);
    );
  </action>


  <!-- Cursors management -->
  <cursors standard="" dragging="" moving="" />
  <events name="cursorsEvents" onnewpano="setCursor" oncontrolmodechanged="setCursor" keep="true" devices="desktop" />
  <action name="setCursor">
    if (tour_controlmodemousetype == moveto, 
      setarrowcursors();
     ,
      sethandcursors();
    );
  </action>
  <!-- Change Cursors Appearance -->

  <action name="setarrowcursors">
    if (device.flash,
      ifnot(device.mac,
        set(cursors.url  , %FIRSTXML%/graphics/cursors_move.png); 
        set(cursors.type , 8way);
        set(cursors.move    ,   0|0|16|16);
        set(cursors.drag    ,  16|0|16|16);
        set(cursors.arrow_u ,  32|0|16|16);
        set(cursors.arrow_d ,  48|0|16|16);
        set(cursors.arrow_l ,  64|0|16|16);
        set(cursors.arrow_r ,  80|0|16|16);
        set(cursors.arrow_lu,  96|0|16|16);
        set(cursors.arrow_ru, 112|0|16|16);
        set(cursors.arrow_rd, 128|0|16|16);
        set(cursors.arrow_ld, 144|0|16|16);
      );
    ,
      js(kpanotour.Cursors.setMoveCursor());
    );
  </action>
  <action name="sethandcursors">
    if (device.flash,
      ifnot(device.mac,
        set(cursors.url , %FIRSTXML%/graphics/cursors_drag.png);
        set(cursors.type, 2way);
        set(cursors.move,  0|0|32|32);
        set(cursors.drag, 32|0|32|32);
      );
    ,
      js(kpanotour.Cursors.setDragCursor());
    );
  </action>



</krpano>
