<?xml version="1.0" encoding="UTF-8"?>
<krpano version="1.18">

    
  <!-- Spot Style - Open website -->
  <style name="IconOpenwebsite"
         url="%FIRSTXML%/spots/kn_user_defaultpoint4.png"
         visible="false"
         edge="bottom" ox="0" oy="0"
         zoom="true"
         
         alpha="0.8"
         onhover="onhoverIconOpenwebsite"
         onover="onoverIconOpenwebsite"
         onout="onoutIconOpenwebsite"
         />
  <action name="onhoverIconOpenwebsite">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconOpenwebsite">
tween(scale, 1.2);
tween(alpha, 1);
pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconOpenwebsite">
    hideTooltip();
tween(scale, 1);
tween(alpha, 0.8);
resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - Load panorama -->
  <style name="IconLoadpanorama"
         url="%FIRSTXML%/spots/hotspot_animated_user_defaultpoint5.png"
         visible="false"
         frame="0"
         lastframe="19"
         framewidth="64"
         frameheight="64"
         stopspotsequence="false"
         onloaded="setdefaultanimatedspotframe();startspotanimation(0.1);"
         onhover="onhoverIconLoadpanorama"
         onover="onoverIconLoadpanorama"
         onout="onoutIconLoadpanorama"
         />
  <action name="onhoverIconLoadpanorama">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconLoadpanorama">


pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconLoadpanorama">
    hideTooltip();


resumeautorotation(forcehotspot);

  </action>



    
  <!-- Spot Style - Display an image -->
  <style name="IconDisplayanimage"
         url="%FIRSTXML%/spots/hotspot_image_sequence_user_defaultpoint6.png"
         visible="false"
         frame="0"
         lastframe="12"
         framewidth="85"
         frameheight="85"
         stopspotsequence="false"
         onloaded="setdefaultanimatedspotframe();startspotanimation(0.1);"
         onhover="onhoverIconDisplayanimage"
         onover="onoverIconDisplayanimage"
         onout="onoutIconDisplayanimage"
         />
  <action name="onhoverIconDisplayanimage">
    showtooltip('hotspot');
  </action>
  <action name="onoverIconDisplayanimage">


pauseautorotation(forcehotspot);

  </action>
  <action name="onoutIconDisplayanimage">
    hideTooltip();


resumeautorotation(forcehotspot);

  </action>



  <!-- ******************************************** -->
  <!-- Picture : bottomleft -->
  <!-- ******************************************** -->
  <layer name="picture"
         keep="true"
         url="%FIRSTXML%/graphics/picture/logo_1.png" 
         align="bottomleft"
         x="10"
         y="65"
         zorder="0"
         handcursor="false"
         enabled="false"
         visible="false"
         />

  <events name="pictureevents" 
    onTourStart="showpicture();"
    keep="true" />

  <action name="showpicture">set(layer[picture].visible, true);</action>


<!-- ************ -->
<!-- Double click -->
<!-- ************ -->
  <plugin name="doubleclick" url="%FIRSTXML%/graphics/doubleclick/fieldofview_dc.swf" alturl="%FIRSTXML%/graphics/doubleclick/fieldofview_dc.js" keep="true" ondblclick="ondoubleclick();"/>
  <action name="ondoubleclick">switchFullscreen();


  </action>

<!-- ************ -->
<!-- Context Menu -->
<!-- ************ -->
  <contextmenu fullscreen="false" versioninfo="false" touch="true">
    <item name="author" onclick="getmessage(urltoopen,project_author_url);openurl(get(urltoopen),_blank);" />
    <item name="normal"        onclick="setViewNormal();
" separator="true"/>
    <item name="architectural" onclick="setViewArchitectural();
"/>
    <item name="littleplanet"  onclick="setViewLittlePlanet();
"/>
    <item name="fullscreenentry" onclick="enterFullscreen();
" separator="true"/>
  </contextmenu>

  <events name="contextmenuevents" keep="true" onenterfullscreen="updateContextMenu" onexitfullscreen="updateContextMenu" onxmlcomplete="updateContextMenu"/>
  <action name="updateContextMenu">
    getmessage(contextmenu.item[author].caption, project_author_name);
    getmessage(contextmenu.item[normal].caption, contextmenunormallabel);
    getmessage(contextmenu.item[architectural].caption, contextmenuarchitecturallabel);
    
    set(sceneisfull360, false);
    if(scene[get(xml.scene)].full360,
      sub(viewhfov, view.hlookatmax, view.hlookatmin);
      if (viewhfov == 360,
        sub(viewvfov, view.vlookatmax, view.vlookatmin);
        if (viewvfov == 180,
          set(sceneisfull360, true);
        );
      );
    );
    if (sceneisfull360 AND (device.webgl OR device.flash),
      set(contextmenu.item[littleplanet].visible, true);
      getmessage(contextmenu.item[littleplanet].caption, contextmenulittleplanetlabel);
    ,
      set(contextmenu.item[littleplanet].visible, false);
    );
    if (device.fullscreensupport,
      if(tour_fullscreen,
        getmessage(contextmenu.item[fullscreenentry].caption, contextmenucloseFsLabel);
        set(contextmenu.item[fullscreenentry].onclick, exitFullscreen();
);
       ,
        getmessage(contextmenu.item[fullscreenentry].caption, contextmenuopenFsLabel);
        set(contextmenu.item[fullscreenentry].onclick, enterFullscreen();
);
      );
     ,
      set(contextmenu.item[fullscreenentry].visible, false);
    );
  </action>


  <!-- ******************** -->
  <!-- Previous / Next Tabs -->
  <!-- ******************** -->

  <layer name="prevnexttheme1btn_prev_pano"
         keep="true"
         align="left"
         url="%FIRSTXML%/graphics/prevnexttabs/thumb_left.png"
         zorder="3"
         alpha="0.5"
         onclick="loadPreviousScene();
"
         onover="set(alpha, 1);"
         onout="set(alpha, 0.5);"
         visible="false">
	<layer name="prevnexttheme1prevPanoramaArrowBg" keep="true"
		url="%FIRSTXML%/graphics/prevnexttabs/btn_scroll_left_bg.png"
		crop="0|0|48|48"
		onovercrop="0|48|48|48"
		ondowncrop="0|96|48|48"
		align="left"
		x="0"
		zorder="0"
		height="36"
		width="36"
		onclick="loadPreviousScene();
"/>
  <layer name="prevnexttheme1prevPanoramaArrow" keep="true"
         url="%FIRSTXML%/graphics/prevnexttabs/btn_scroll_left.png"
               crop="0|0|48|48"
         onovercrop="0|48|48|48"
         ondowncrop="0|96|48|48"
         align="left"
         x="0"
         zorder="1"
         height="36"
         width="36"
         onclick="loadPreviousScene();
"/>
  </layer>
  <layer name="prevnexttheme1btn_next_pano"
         keep="true"
         align="right"
         url="%FIRSTXML%/graphics/prevnexttabs/thumb_right.png"
         zorder="3"
         alpha="0.5"
         onclick="loadNextScene();
"
         onover="set(alpha, 1);"
         onout="set(alpha, 0.5);"
         visible="false">
	<layer name="prevnexttheme1nextPanoramaArrowBg" keep="true"
		url="%FIRSTXML%/graphics/prevnexttabs/btn_scroll_right_bg.png"
		crop="0|0|48|48"
		onovercrop="0|48|48|48"
		ondowncrop="0|96|48|48"
		align="right"
		x="0"
		zorder="0"
		height="36"
		width="36"
		onclick="loadNextScene();
"/>
  <layer name="prevnexttheme1nextPanoramaArrow"
         keep="true"
         url="%FIRSTXML%/graphics/prevnexttabs/btn_scroll_right.png"
               crop="0|0|48|48"
         onovercrop="0|48|48|48"
         ondowncrop="0|96|48|48"
         align="right"
         zorder="1"
         height="36"
         width="36"
         onclick="loadNextScene();
"/>
  </layer>

  <events name="prevnexttheme1hideshowcontrolsevent" 
    onTourStart="prevnexttheme1showPrevNextControls();"
    keep="true"/>
  <action name="prevnexttheme1hidePrevNextControls">
    set(layer[prevnexttheme1btn_prev_pano].visible, false);
    set(layer[prevnexttheme1btn_next_pano].visible, false);
  </action>
  <action name="prevnexttheme1showPrevNextControls">
    set(layer[prevnexttheme1btn_prev_pano].visible, true);
    set(layer[prevnexttheme1btn_next_pano].visible, true);
  </action>



  <!-- ************************ -->
  <!-- Title : current panorama -->
  <!-- ************************ -->

  <events name="title_currentpanorama_events" 
    onTourStart="showtitle_currentpanorama();"
    hidetourcontrols="hidetitle_currentpanorama();" 
    showtourcontrols="showtitle_currentpanorama();" 
    onnewpano="updatetitle_currentpanorama();" 
    keep="true" />

  <action name="hidetitle_currentpanorama">set(layer[title_currentpanorama].visible, false);</action>
  <action name="showtitle_currentpanorama">set(layer[title_currentpanorama].visible, true );</action>

  <action name="updatetitle_currentpanorama">
    getmessage(layer[title_currentpanorama].html, get(scene[get(xml.scene)].titleid));
    escape(layer[title_currentpanorama].html);
  </action>
  <layer name="title_currentpanorama" keep="true" zorder="4"
         url="%FIRSTXML%/graphics/textfield.swf"
         align="top" x="0" y="10" width="100%" autoheight="true"
         background="false" capture="false" handcursor="false" selectable="false" enabled="false"
         borderwidth="0"
         alpha="1"
         visible="false"
         textshadow="1"
         css="text-align:center;
              color:#ffffff;
              font-family:Arial;
              font-weight:bold;
              font-size:16px;"/>



  <events name="Bootstrap_External_Commandsevents" onnewpano="Bootstrap_External_Commandsonp" keep="true"/>
  <action name="Bootstrap_External_Commandsonp">
  	js(updatePanorama(get(xml.scene)););
  </action>

  <action name="displayImage">
    if (%1 == null,
      showlog();trace("Display Image : function called without any image. Verify its parameters in Panotour.");
    ,
    if (layer[displayedStandardImage],
      if(layer[displayedStandardImage].doNotDeleteMe,
        set(layer[displayedStandardImage].currentCall, false);
        set(layer[displayedStandardImage].visible, true);
        set(layer[displayedStandardImage].doNotDeleteMe, false);
        
        if (%1 == layer[displayedStandardImage].url,resumeautorotation(forcehotspot);

          applyDisplayedImageObjectAnimation(%8);
        ,
          setDisplayedImageObjectParameters(%1, %2, %3, %4, %5, %6, %8);
        );
      ,
        set(layer[displayedStandardImage].currentCall, true);
        set(layer[displayedStandardImage].doNotDeleteMe, true);
        events.dispatch(onremovedisplayedobject);
        delayedcall(0.2,displayImage(%1, %2, %3, %4, %5, %6, %7, %8););
      );
    ,
      addlayer(displayedStandardImage);
      set(layer[displayedStandardImage].keep, false);
      set(layer[displayedStandardImage].onclick, resumeautorotation(forcehotspot);
applyDisplayedImageObjectAnimation(%8););
      set(layer[displayedStandardImage].zorder , 99);
      
      set(layer[displayedStandardImage].currentCall, true);
      set(layer[displayedStandardImage].doNotDeleteMe, true);
      events.dispatch(onremovedisplayedobject);
      delayedcall(0.2,displayImage(%1, %2, %3, %4, %5, %6, %7, %8););
      if (%7,pauseautorotation(forcehotspot);
);
      set(layer[displayedStandardImage].visible, false);
    );
    );
  </action>
  <action name="applyDisplayedImageObjectAnimation">
    if (%1,
      tween(layer[displayedStandardImage].width, 1, 1, easeOutQuad, removelayer(displayedStandardImage););
      tween(layer[displayedStandardImage].height, 1, 1, easeOutQuad);
    ,
      removelayer(displayedStandardImage);
    );
  </action>
  <action name="setDisplayedImageObjectParameters">
    set(layer[displayedStandardImage].url    , %1);
    set(layer[displayedStandardImage].align  , %2);
    set(layer[displayedStandardImage].x      , %3);
    set(layer[displayedStandardImage].y      , %4);
    if(%7,
      set(layer[displayedStandardImage].width , 1);
      set(layer[displayedStandardImage].height, 1);
      tween(layer[displayedStandardImage].width , %5, 1, easeOutQuad);
      tween(layer[displayedStandardImage].height, %6, 1, easeOutQuad);
    ,
      set(layer[displayedStandardImage].width , %5);
      set(layer[displayedStandardImage].height, %6);
    );
  </action> 
  <events name="displayedImageObjectEvents" keep="true" onremovedisplayedobject="displayedImageObjectOnRemoveDisplayedObject"/>
  <action name="displayedImageObjectOnRemoveDisplayedObject">
    ifnot(layer[displayedStandardImage].currentCall,if(layer[displayedStandardImage].visible,resumeautorotation(forcehotspot);

      removelayer(displayedStandardImage);
    ););
  </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="setViewArchitectural">
	stopSetViewTweens();
	setViewArchitecturalComplete();
</action>

<action name="setViewArchitecturalComplete">
	tween(view.fovmax, get(panoview.fovmax), distance(179, 1.00), easeoutquad);
	tween(view.architectural, 1.0, distance(1.0, 0.45), easeoutquad, 
		tween(view.pannini, 0.0, distance(1.0, 0.45));
		tween(view.fisheye, 0.0, distance(1.0, 0.45), easeoutquad, 
			set(view.fisheyefovlink, 0.5);
			set(view.stereographic,false);
			tween(view.vlookat, get(panoview.v), 1.25);
			if(panoview.fov LE view.fov, tween(view.fov, get(panoview.fov), distance(50, 0.45)); );
		);
	);
</action>

<action name="setViewLittlePlanet">
	set(sceneisfull360, false);
	if(scene[get(xml.scene)].full360,
		sub(viewhfov, view.hlookatmax, view.hlookatmin);
		if (viewhfov == 360,
			sub(viewvfov, view.vlookatmax, view.vlookatmin);
			if (viewvfov == 180,
				set(sceneisfull360, true);
			);
		);
	);
	if (sceneisfull360 AND (device.webgl OR device.flash),
		stopSetViewTweens();
		setViewLittlePlanetComplete();
	);
</action>

<action name="setViewLittlePlanetComplete">
	tween(view.architectural, 0.0, 0.25, easeoutquad, 
		tween(view.vlookat, 90, distance(179, 1.50), easeoutquad);
		set(backtonormalfirst,false);
		if(view.pannini GE 1.0, set(backtonormalfirst,true) );
		if(view.stereographic == false, set(backtonormalfirst,true) );
		if(backtonormalfirst, hideTooltip();tween(view.fisheye, 0.0 ,distance(1.0, 0.25), easeoutquad, WAIT); );
		tween(view.pannini, 0.0, distance(1.0, 0.75));
		if(panoview.fovmax LE 150, set(view.fovmax, 150); , set(view.fovmax, get(panoview.fovmax)); );
		set(view.stereographic, true);
		set(view.fisheyefovlink, 1.5);
		tween(view.fisheye, 1.0, distance(1.0, 0.75), easeoutquad);
		tween(view.fov, 150, distance(179, 0.75), easeoutquad);
	);
</action>

<action name="setViewNormal">
	stopSetViewTweens();
	setViewNormalComplete();
</action>

<action name="setViewNormalComplete">
	tween(view.architectural, 0.0, distance(1.0, 0.45), easeoutquad,
		tween(view.fovmax, get(panoview.fovmax), distance(179, 1.00));
		tween(view.vlookat, get(panoview.v), distance(90, 0.45));
		tween(view.pannini, 0.0, distance(1.0, 0.45));
		tween(view.fisheye, 0.0, distance(1.0, 0.45), easeoutquad,
			set(view.stereographic,false);
			set(view.fisheyefovlink, 0.5);
			if(panoview.fov LE view.fov, tween(view.fov, get(panoview.fov), distance(50, 0.45)); );
		);
	);
</action>

<action name="stopSetViewTweens">
	stoptween(view.fov);
	stoptween(view.fovmax);
	stoptween(view.vlookat);
	stoptween(view.fisheye);
	stoptween(view.architectural);
	stoptween(view.pannini);
</action>

</krpano>