<krpano>

<layer name="scene_name" type="text" align="bottomleft" x="70" y="15" bg="false" css="color:#fff;font-size:14px" keep="true" enabled="false" visible.mobile="false" vr="true"/>
//INTIAL VIEW

<events name="webvr_hlookat" keep="true"
  onxmlcomplete="if(fromvrmenu, webvr.lookat(get(xml.view.hlookat));delete(fromvrmenu));gotonextone();"
  />

<!--================================================ OVERRIDE KRPANO SETTINGS ======================================================-->

	<skin_settings webvr="true"
	               webvr_prev_next_hotspots="false"
	               />

		<events name="webvr_events" keep="true" devices="html5"
	        onxmlcomplete="vr_menu_setvisibility(false);"
	        onloadcomplete="delayedcall(0.5, if(webvr.isenabled AND scene.count GT 1 , vr_menu_setvisibility(true); ); );"
	        />

	<plugin name="WebVR" keep="true" devices="html5"
	        onentervr="webvr_onentervr(); webvr_setup(); "
	        onexitvr="webvr_onexitvr(); webvr_setup(); "
	        />

	<action name="webvr_setup">
		if(webvr.isenabled,
			vr_menu_setvisibility(true);
			,
			closevrmenu(false);
			);
	</action>

<!--================================================ SETTINGS ======================================================-->

<vrmenu
	angle="-45"
	groups="false"
	onlycat="false"
	firstgroup="false"
	onlygroups="false"
	displayprevnext="false"
	width="240"
	height="120"
	gpwidth="400"
	gpheight="200"
	rows="5"
	group_rows="1"
	spacing="20"
	gpspacing="50"
	timeout="2000"
	seen="true"
	from="-800"
	closevrmenu="true"
	fademenu="false"
	menualpha="100"

	add_txt_thumb="true"
	txt_thumb_css="color:#ffffff;font-family: Lato;font-weight:400;font-size:20px;text-align:center"
	txt_thumb_vcenter="true"
	txt_thumb_hasshadow="true"

	add_txt_group="true"
	txt_group_css="color:#ffffff;font-family: Lato;font-weight:400;font-size:36px;text-align:center"
	txt_group_vcenter="true"
	txt_group_hasshadow="true"

	add_thumb_border="true"
	thumb_border_border="0 0x000000 1.00"
	thumb_border_bgcolor="0x000000"
	thumb_border_bgalpha="0.7"

	thumb_border_over_border="2 0xffffff 1.00"
	thumb_border_over_bgcolor="0x000000"
	thumb_border_over_bgalpha="0.3"
/>

<!--================================================ SETUP ======================================================-->

	<events name="vrmenu_setup_events" keep="true"
	onviewchange="vr_menu_following()"
	onloadcomplete="
	copy(style[vr_menu_thumbnails].ty,vrmenu.from);

	copy(style[vr_menu_txtthumbnails].ty,vrmenu.from);
	copy(style[vr_menu_txtthumbnails].css,vrmenu.txt_thumb_css);
	copy(style[vr_menu_txtthumbnails].vcenter,vrmenu.txt_thumb_vcenter);
	if(vrmenu.txt_thumb_hasshadow,set(style[vr_menu_txtthumbnails].txtshadow,'1 1 4 0x000000 1'));

	copy(style[vr_menu_gptxtthumbnails].ty,vrmenu.from);
	copy(style[vr_menu_gptxtthumbnails].css,vrmenu.txt_group_css);
	copy(style[vr_menu_gptxtthumbnails].vcenter,vrmenu.txt_group_vcenter);
	if(vrmenu.txt_group_hasshadow,set(style[vr_menu_gptxtthumbnails].txtshadow,'1 1 4 0x000000 1'));

	copy(style[vr_menu_border].ty,vrmenu.from);
	copy(style[vr_menu_border].bgborder,vrmenu.thumb_border_border);
	copy(style[vr_menu_border].bgcolor,vrmenu.thumb_border_bgcolor);
	copy(style[vr_menu_border].bgalpha,vrmenu.thumb_border_bgalpha);

	copy(style[vr_menu_group_border].ty,vrmenu.from);
	copy(style[vr_menu_group_border].bgborder,vrmenu.thumb_border_border);
	copy(style[vr_menu_group_border].bgcolor,vrmenu.thumb_border_bgcolor);
	copy(style[vr_menu_group_border].bgalpha,vrmenu.thumb_border_bgalpha);

	copy(style[vr_menu_border_over].bgborder,vrmenu.thumb_border_over_border);
	copy(style[vr_menu_border_over].bgcolor,vrmenu.thumb_border_over_bgcolor);
	copy(style[vr_menu_border_over].bgalpha,vrmenu.thumb_border_over_bgalpha);

	copy(style[vr_menu_seen].ty,vrmenu.from);
	copy(hotspot[backtocategory].ty,vrmenu.from);
	copy(hotspot[closemenu].ty,vrmenu.from);
	copy(hotspot[closegpmenu].ty,vrmenu.from);

	if(vrmenu.onlycat AND !vrmenu.firstgroup,
		set(hotspot[backtocategory].onclick,hide_cat_thumbs);
		set(style[vr_group_menu_thumbnails].ty,calc(-1 * vrmenu.from));
		set(style[vr_menu_gptxtthumbnails].ty,calc(-1 * vrmenu.from));
		set(style[vr_menu_group_border].ty,calc(-1 * vrmenu.from));
		hidegroups(closegpmenu);
		,
		set(style[vr_group_menu_thumbnails].ty,calc(vrmenu.from));
		set(style[vr_menu_gptxtthumbnails].ty,calc(vrmenu.from));
		set(style[vr_menu_group_border].ty,calc(vrmenu.from));
	);

	if(vrmenu.closevrmenu,
	set(hotspot[backtocategory].ox,30);
	set(hotspot[closemenu].ox,-30);
	);

	div(percent_menualpha,vrmenu.menualpha,100);
	copy(hotspot[vr_menu_home].alpha,percent_menualpha);
	copy(hotspot[vr_menu_prevscene].alpha,percent_menualpha);
	copy(hotspot[vr_menu_nextscene].alpha,percent_menualpha);
	copy(hotspot[vr_menu_map].alpha,percent_menualpha);
	"
	onnewscene="set(scene[get(xml.scene)].seen,true);set(groupready,0);set(thumbready,0);set(vrmenuisactive,false)"
	/>

<action name="setup_categories" autorun="preinit" protect="true">
trace('VR Thumbnail Menu for VICINITY | 1.0');
for(set(i,0), i LT scene.count, inc(i),
	if(scene[get(i)].nogrid != true,
		copy(groupname,scene[get(i)].group);
		ifnot(panoramagroup[get(groupname)].sn ,
			set(panoramagroup[get(groupname)].sn,1)
			,
			add(panoramagroup[get(groupname)].sn,1);
		);
	);
);

calc_tb_offset(calc(vrmenu.width + vrmenu.spacing));
calc_gp_offset(calc(vrmenu.gpwidth + vrmenu.gpspacing));
</action>

<action name="calc_tb_offset">
calc_spherical_offset(calc(%1 / 2),tbh1);
calc(vrmenu_thumb_x, tbh1);
</action>

<action name="calc_gp_offset">
calc_spherical_offset(calc(%1 / 2),gph1);
calc(vrmenu_gp_thumb_x, gph1 );
</action>

<action name="calc_spherical_offset">
Math.atan2(a, %1, 500);
calc(%2, (a * 180.0) / Math.PI);
</action>



<!--================================================ VR MENU ======================================================-->

	<!-- the VR menu - home button, prev/next scene buttons -->
	<hotspot name="vr_menu_bg" depth="1300" distorted="true" ath="0" atv="calc:-vrmenu.angle" alpha="0" visible="false" keep="true" zorder="5" url="icons/blank.png" width="300" height="100" handcursor="false"/>

	<hotspot name="vr_menu_home" scale="0.5" depth="1300" distorted="true" ath="0" atv="calc:-vrmenu.angle" alpha="" visible="true" keep="true" zorder="6" url="icons/menu.png" onover="vr_menu_over(get(name));" onout="vr_menu_out(get(name));" onclick="show_vrmenu();" ox="-30"/>
	 <hotspot name="vr_menu_map" url="icons/heli.png" scale="0.5" depth="1300" distorted="true" ath="0" atv="calc:-vrmenu.angle" alpha="" visible="true" keep="true" zorder="6"  onclick="copy(previous_scene,scene[get(xml.scene)].name);loadscene(get(aerial_scene),fromvrmenu=true,MERGE|KEEPMOVING,BLEND(2))" onover="vr_menu_over(get(name));" onout="vr_menu_out(get(name));" ox="30"/>

	<hotspot name="vr_menu_prevscene" depth="1300" distorted="true" ath="0" atv="calc:-vrmenu.angle" alpha="" visible="false" keep="true" zorder="6" url="icons/prevnext_scene.png" onover="vr_menu_over(get(name));" onout="vr_menu_out(get(name));" onclick="loadPreviousScene();" ox="-95"/>
	<hotspot name="vr_menu_nextscene" depth="1300" distorted="true" ath="0" atv="calc:-vrmenu.angle" alpha="" visible="false" keep="true" zorder="6" url="icons/prevnext_scene.png" rotate="180" onover="vr_menu_over(get(name));" onout="vr_menu_out(get(name));" onclick="loadNextScene();" ox="-95"/>

	<action name="vr_menu_over">
		callwith(hotspot[%1], tween(alpha|depth,1|1200); );
	</action>

	<action name="vr_menu_out">
			txtadd(menuout,'callwith(hotspot[%1], tween(alpha|depth,',get(percent_menualpha),'|1300); );');
			menuout();
	</action>

	<action name="show_vrmenu">
	vrmenu_hidehs();
	if(vrmenu.groups,
		if(!vrmenu.onlycat OR vrmenu.firstgroup,
			build_group_vrmenu();
			set(vrmenu.firstgroup,false);
			,
			build_group_thumbnails(get(scene[get(xml.scene)].group),get(panoramagroup[get(scene[get(xml.scene)].group)].sn));
		);
		,
		build_thumbnails();
	);
	vr_menu_setvisibility(false);
	set(hotspot[blackbg].visible,true);
	tween(hotspot[blackbg].alpha,0.6);
	set(hotspot[play].enabled,true);
	</action>

	<action name="vr_menu_setvisibility">
		set(hotspot[vr_menu_home].visible, %1);
		if(vrmenu.displayprevnext,set(hotspot[vr_menu_prevscene].visible,%1);set(hotspot[vr_menu_nextscene].visible,%1);set(hotspot[vr_menu_bg].visible,%1));
		set(hotspot[vr_menu_map].visible, %1);
	</action>

		<hotspot name="hs_vr_cursor" keep="true"
	         url="icons/hs_loader.png"
			 atv="0"
	         visible="false"
	         enabled="false"
	         distorted="true"
	         crop="0|0|50|50"
	         scale="1"
	         depth="2000"
			 zorder="10"
	         />

	<!-- new krpano 1.19 feature: Javascript actions (can be faster than xml actions, HTML5 only) -->
	<action name="vr_menu_following" type="Javascript" devices="html5"><![CDATA[

		var hs1 = krpano.get("hotspot[vr_menu_home]");
		var hs2 = krpano.get("hotspot[blackbg]");
		var hs3 = krpano.get("hotspot[vr_menu_prevscene]");
		var hs4 = krpano.get("hotspot[vr_menu_nextscene]");
		var hs5 = krpano.get("hotspot[vr_menu_bg]");
		var hs6 = krpano.get("hotspot[vr_menu_map]");
		var angle = krpano.get("vrmenu.angle");
		var fademenu = krpano.get("vrmenu.fademenu");
		var menualpha = krpano.get("percent_menualpha");
		var h = krpano.view.hlookat;
		var v = krpano.view.vlookat;
		var dh;
		hs2.ath = h;
		hs2.atv = v;

		if(!hs1.hovering && !hs3.hovering && !hs4.hovering && !hs5.hovering && !hs6.hovering)
		{
			var f = 0.01;	// follow speed factor

			var hsh = hs1.ath;
			var hsv = hs1.atv;

			// map to -180 to +180
			h   = (h  -(h|0))   + (((h|0)  +360180)%360) - 180.0;
			hsh = (hsh-(hsh|0)) + (((hsh|0)+360180)%360) - 180.0;

			// get the shortest horizontal distance
			dh = h - hsh;
			dh += (dh>180) ? -360 : (dh<-180) ? 360 : 0

			// follow slowing horizontally
			hsh += dh*f;

			// fade out when farther away
			if(fademenu === 'true')
			{
			var a = Math.abs(v - hs1.atv) / 90.0;
			a = menualpha * Math.max(1.0 - 2.0*Math.sqrt(a), 0);
			}
			else{a = menualpha};

			// move up the more looking down
			v = v - angle - v*1.5;
			hsv = hsv*(1-f) + v*f;

			// set everything
			hs1.alpha = a;
			if(!hs3.hovering) hs3.alpha = a;
			if(!hs4.hovering) hs4.alpha = a;
			hs1.ath = hs3.ath = hs4.ath = hs5.ath = hs6.ath =hsh;
			hs1.atv = hs3.atv = hs4.atv = hs5.atv = hs6.atv =hsv;
		}

	]]></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,
        loadscene(get(scene[get(sceneprevnexti)].name),null,NOPREVIEW|MERGE|KEEPVIEW|KEEPMOVING,BLEND(1.0, easeInCubic));
       ,
        sub(lasti, scene.count, 1);
		loadscene(get(scene[get(lasti)].name),null,NOPREVIEW|MERGE|KEEPVIEW|KEEPMOVING,BLEND(1.0, easeInCubic));
      );
     ,
      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,
		loadscene(get(scene[get(sceneprevnexti)].name),null,NOPREVIEW|MERGE|KEEPVIEW|KEEPMOVING,BLEND(1.0, easeInCubic));
       ,
        loadscene(get(scene[0].name),null,NOPREVIEW|MERGE|KEEPVIEW|KEEPMOVING,BLEND(1.0, easeInCubic)); );
     ,
      if(sceneprevnexti LT scene.count, loadNextScene(findscene));
    );
  </action>

<!--================================================ UI ======================================================-->

<hotspot name="backtocategory" url="icons/back.png" distorted="true" visible="false" alpha="0" zorder="40" depth="2000" onclick="hide_group_thumbs()" handcursor="false" onover="copy(hotspot[hs_vr_cursor].ath,ath);copy(hotspot[hs_vr_cursor].oy,oy);copy(hotspot[hs_vr_cursor].ox,ox);tween(scale,0.9);set(hotspot[hs_vr_cursor].visible,true);playsound(over,over.m4a);" onout="tween(scale,1.0);set(hotspot[hs_vr_cursor].visible,false);" keep="true" vr_timeout="calc(vrmenu.timeout)" autoalpha="true"/>

<hotspot name="closegpmenu" url="icons/closemenu.png" distorted="true" visible="false" alpha="0" zorder="40" depth="2000" onclick="closevrmenu(true)" handcursor="false" onover="copy(hotspot[hs_vr_cursor].ath,ath);copy(hotspot[hs_vr_cursor].oy,oy);copy(hotspot[hs_vr_cursor].ox,ox);tween(scale,0.9);set(hotspot[hs_vr_cursor].visible,true);playsound(over,over.m4a);" onout="tween(scale,1.0);set(hotspot[hs_vr_cursor].visible,false);" keep="true" vr_timeout="calc(vrmenu.timeout)" autoalpha="true"/>

<hotspot name="closemenu" url="icons/closemenu.png" distorted="true" visible="false" alpha="0" zorder="40" depth="2000" onclick="closevrmenu(true)" handcursor="false" onover="copy(hotspot[hs_vr_cursor].ath,ath);copy(hotspot[hs_vr_cursor].oy,oy);copy(hotspot[hs_vr_cursor].ox,ox);tween(scale,0.9);set(hotspot[hs_vr_cursor].visible,true);playsound(over,over.m4a);" onout="tween(scale,1.0);set(hotspot[hs_vr_cursor].visible,false);" keep="true" vr_timeout="calc(vrmenu.timeout)" autoalpha="true"/>

<hotspot name="play" url="icons/hs_play.png" distorted="true" alpha="0" scale="0.4" zorder="50" depth="2000" handcursor="false" visible="false" onover="callwith(hotspot[get(activethumb)],onover);set(hotspot[hs_vr_cursor].visible,true);if(simulatevr,vr_auto_click_thumb(get(vr_timeout)))" onout="set(hotspot[hs_vr_cursor].visible,false);" keep="true" vr_timeout="calc(vrmenu.timeout)" capture="false" enabled="false"/>


<hotspot name="blackbg" url="icons/overlay.png" distorted="true" visible="false" alpha="0" zorder="10" depth="1" enabled="false" width="100" height="100" keep="true"/>

<!--================================================ SHOW HIDE HOTSPOTS ======================================================-->

	<action name="vrmenu_hidehs">
	for(set(i,0), i LT hotspot.count, inc(i),
		copy(hsvr, hotspot[get(i)]);
	    if(hsvr.tag != tbhs AND hsvr.name != 'vr_cursor' AND hsvr.name != 'vr_controller_l' AND hsvr.name != 'vr_controller_r' AND hsvr.name != 'nadir_logo' AND hsvr.zorder != 99998,
			copy(hsvr.vr_backup_visible, hsvr.visible);
			set(hsvr.visible, false);
		);
	);
	set(vrmenuisactive,true);
	</action>

	<action name="vrmenu_showhs">
	for(set(i,0), i LT hotspot.count, inc(i),
		copy(hsvr, hotspot[get(i)]);
			if(hsvr.vr_backup_visible,
				copy(hsvr.visible, hsvr.vr_backup_visible);
				delete(hsvr.vr_backup_visible);
			  );
		);
	set(vrmenuisactive,false);
	</action>


<!--================================================ STYLES ======================================================-->

		<style name="vr_group_menu_thumbnails" distorted="true" depth="2000" alpha="0" zorder="13" tag="tbhs" thumbtype="group"
			onover="
			copy(hotspot[play].activethumb,name);
			copy(hotspot[play].ath,ath);
			copy(hotspot[play].oy,oy);
			copy(hotspot[hs_vr_cursor].ath,ath);
			copy(hotspot[hs_vr_cursor].ox,ox);
			copy(hotspot[hs_vr_cursor].oy,oy);
			copy(hotspot[play].onclick,onclick);
			tween(hotspot[get(bgborder)].bgalpha,calc(style[vr_menu_border_over].bgalpha));
			set(hotspot[get(bgborder)].bgborder,calc(style[vr_menu_border_over].bgborder));
			delayedcall(0.1,set(hotspot[play].enabled,true););
			"
			onout="
			tween(hotspot[get(bgborder)].bgalpha,calc(style[vr_menu_group_border].bgalpha));
			set(hotspot[get(bgborder)].bgborder,calc(style[vr_menu_group_border].bgborder));
			"
			enabled="false"
			handcursor="false"
			onloaded="
			if(vrmenu.onlygroups,
			txtadd(gpclicaction,'gotonextone(get(panoramagroup[',get(groupid),'].mainscene))')
			,
			txtadd(gpclicaction,'show_group_thumbs(',get(groupid),',',get(sn),')')
			);
			copy(onclick,gpclicaction);inc(groupready);check_groups_ready()
			"
			ready="tween(ty|alpha,0|1,2,easeOutQuad|easeOutQuint,set(enabled,true));"

			/>


		<style name="vr_menu_thumbnails" distorted="true" depth="2000" alpha="0" zorder="13" tag="tbhs" thumbtype="thumb" vr_timeout="500"
			onover="
			copy(hotspot[play].activethumb,name);
			copy(hotspot[play].ath,ath);
			copy(hotspot[play].oy,oy);
			if(simulatevr,tween(hotspot[play].alpha,1));
			copy(hotspot[hs_vr_cursor].ath,ath);
			copy(hotspot[hs_vr_cursor].ox,ox);
			copy(hotspot[hs_vr_cursor].oy,oy);
			copy(hotspot[play].onclick,onclick);
			if(simulatevr,tween(hotspot[get(bgtext)].alpha,0));
			tween(hotspot[get(bgborder)].bgalpha,calc(style[vr_menu_border_over].bgalpha));
			set(hotspot[get(bgborder)].bgborder,calc(style[vr_menu_border_over].bgborder));
			delayedcall(0.1,set(hotspot[play].enabled,true););
			"
			onout="
			if(simulatevr,tween(hotspot[play].alpha,0));
			if(simulatevr,tween(hotspot[get(bgtext)].alpha,1));
			tween(hotspot[get(bgborder)].bgalpha,calc(style[vr_menu_border].bgalpha));
			set(hotspot[get(bgborder)].bgborder,calc(style[vr_menu_border].bgborder));
			"
			enabled="false"
			handcursor="false"
			onloaded="txtadd(clicaction,'loadscene(',get(linkedscene),',fromvrmenu=true,MERGE|KEEPMOVING,BLEND(1.0, easeInCubic));');copy(onclick,clicaction);inc(thumbready);check_thumbs_ready();"
			ready="tween(ty|alpha,0|1,2,easeOutQuad|easeOutQuint,ifnot(active,set(enabled,true)))"

			/>

		<style name="vr_menu_txtthumbnails" distorted="true" depth="2000" alpha="0" zorder="15"  tag="tbhs" thumbtype="thumb"
			enabled="false" capture="false"
			onloaded="inc(thumbready);check_thumbs_ready();"
			ready="tween(ty|alpha,0|1, 2,easeOutQuad|easeOutQuint)"
			type="text" wordwrap="true"
			bg="false"
			mipmapping="true" oversampling="2"
			/>

		<style name="vr_menu_gptxtthumbnails" distorted="true" depth="2000" alpha="0" zorder="15"  tag="tbhs" thumbtype="group"
			enabled="false" capture="false"
			onloaded="inc(groupready);check_groups_ready()"
			ready="tween(ty|alpha,0|1, 2,easeOutQuad|easeOutQuint)"
			type="text" wordwrap="true"
			bg="false"
			/>

		<style name="vr_menu_border" distorted="true" depth="2000" alpha="0" zorder="14" tag="tbhs" thumbtype="thumb"
			enabled="false"
			onloaded="inc(thumbready);check_thumbs_ready();"
			ready="tween(ty|alpha,0|1, 2,easeOutQuad|easeOutQuint)"
			type="text"
			/>

		<style name="vr_menu_group_border" distorted="true" depth="2000" alpha="0" zorder="14" tag="tbhs" thumbtype="group"
			enabled="false"
			onloaded="inc(groupready);check_groups_ready()"
			ready="tween(ty|alpha,0|1, 2,easeOutQuad|easeOutQuint)"
			type="text"
			/>

		<style name="vr_menu_border_over" bgalpha="0" bgborder="3 0xffffff 1"
			/>

		<style name="vr_menu_seen" distorted="true" depth="2000" alpha="0" zorder="11" tag="tbhs" thumbtype="seen"
			enabled="false"
			onloaded="if(vrmenu.add_txt_thumb,add(oy,calc(vrmenu.height / 3)));"
			ready="tween(ty|alpha,0|1, 2,easeOutQuad|easeOutQuint)"
			url="icons/seen.png"
			/>


<!--================================================ BUILD GROUPS ======================================================-->


		<action name="build_group_vrmenu" protect="true">
		set(hotspot[play].visible,true);

		copy(startx,view.hlookat);

		set(ngp,0);
		for(set(i,0),i LT panoramagroup.count,inc(i),
			if(panoramagroup[get(i)].nogrid != true, inc(ngp,1));
		);
		div(perRow,ngp,vrmenu.group_rows);

   		Math.ceil(perRow);

		set(initialX,calc((perRow * vrmenu_gp_thumb_x) / -2));

		add(initialX,calc(vrmenu_gp_thumb_x / 2));
		add(initialX,startx);
		set(startb,0);

		if(vrmenu.closevrmenu,
		copy(hotspot[closegpmenu].ath,startx);
		set(hotspot[closegpmenu].oy,calc((vrmenu.group_rows * (vrmenu.gpheight + vrmenu.gpspacing)) - ((vrmenu.group_rows * vrmenu.gpheight) / 2) + (vrmenu.gpheight / 2) - vrmenu.gpspacing));
		);

		for(set(i,0), i LT panoramagroup.count, inc(i),
			if(panoramagroup[get(i)].nogrid != true,

			if(panoramagroup[get(i)].name != panoramagroup[get(xml.scene)].name,
				txtadd(gphotspotname,'gphotspot_',get(i));

				addhotspot(get(gphotspotname));

				copy(hotspot[get(gphotspotname)].groupid,panoramagroup[get(i)].name);
				copy(hotspot[get(gphotspotname)].sn,panoramagroup[get(i)].sn);

				copy(hotspot[get(gpbghotspotname)].mainthumb,hotspotname);

				set(hotspot[get(gphotspotname)].url,get(panoramagroup[get(i)].thumburl));

				hotspot[get(gphotspotname)].loadstyle(vr_group_menu_thumbnails);

				set(hotspot[get(gphotspotname)].width,get(vrmenu.gpwidth));
				set(hotspot[get(gphotspotname)].height,get(vrmenu.gpheight));

				if(vrmenu.add_txt_group,
				txtadd(gptxthotspotname,'gptxthotspot_',get(i));
				copy(hotspot[get(gphotspotname)].bgtext,gptxthotspotname);
				addhotspot(get(gptxthotspotname));
				set(hotspot[get(gptxthotspotname)].html,get(panoramagroup[get(i)].title));
				hotspot[get(gptxthotspotname)].loadstyle(vr_menu_gptxtthumbnails);
				set(hotspot[get(gptxthotspotname)].width,get(vrmenu.gpwidth));
				set(hotspot[get(gptxthotspotname)].height,get(vrmenu.gpheight));
				);

				if(vrmenu.add_thumb_border,
				txtadd(borderhotspotname,'borderhotspot_',get(i));
				copy(hotspot[get(gphotspotname)].bgborder,borderhotspotname);
				addhotspot(get(borderhotspotname));
				hotspot[get(borderhotspotname)].loadstyle(vr_menu_group_border);
				set(hotspot[get(borderhotspotname)].width,get(vrmenu.gpwidth));
				set(hotspot[get(borderhotspotname)].height,get(vrmenu.gpheight));
				);

				div(row,startb,perRow);
				Math.floor(row);

				mod(line,startb,perRow);

				if(line === 0,
					copy(x,initialX);
					,
					add(x,vrmenu_gp_thumb_x);
				);

				copy(hotspot[get(gphotspotname)].ath,x);
				set(hotspot[get(gphotspotname)].oy,calc(row * (vrmenu.gpheight + vrmenu.gpspacing) - ((vrmenu.group_rows * vrmenu.gpheight) / 2) + (vrmenu.gpheight / 2) - vrmenu.gpspacing));

				if(vrmenu.add_txt_group,
				copy(hotspot[get(gptxthotspotname)].ath,x);
				set(hotspot[get(gptxthotspotname)].oy,calc(row * (vrmenu.gpheight + vrmenu.gpspacing) - ((vrmenu.group_rows * vrmenu.gpheight) / 2) + (vrmenu.gpheight / 2) - vrmenu.gpspacing));
				);

				if(vrmenu.add_thumb_border,
				copy(hotspot[get(borderhotspotname)].ath,x);
				set(hotspot[get(borderhotspotname)].oy,calc(row * (vrmenu.gpheight + vrmenu.gpspacing) - ((vrmenu.group_rows * vrmenu.gpheight) / 2) + (vrmenu.gpheight / 2) - vrmenu.gpspacing));
				);

				add(startb,1);
			);
			);
		);
		</action>


<!--================================================ BUILD GROUG THUMBS ======================================================-->

		<action name="build_group_thumbnails" protect="true">
		set(hotspot[play].visible,true);

		if(%2 == 1, set(vrmenu.rows2,1),set(vrmenu.rows2,get(vrmenu.rows)));
		if(panoramagroup[%1].rows, set(vrmenu.rows2,get(panoramagroup[%1].rows)));
		copy(startx,view.hlookat);
		div(perRow,%2,vrmenu.rows2);
   		Math.ceil(perRow);
		set(initialX,calc((perRow * vrmenu_thumb_x) / -2));
		add(initialX,calc(vrmenu_thumb_x / 2));
		add(initialX,startx);
		set(startb,0);

		copy(hotspot[backtocategory].ath,startx);
		set(hotspot[backtocategory].oy,calc((vrmenu.rows2 * (vrmenu.height + vrmenu.spacing)) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
		if(vrmenu.from GT 0,
		set(hotspot[backtocategory].rotate,180);
		);
		set(hotspot[backtocategory].visible,true);
		showgroups(backtocategory);

		if(vrmenu.closevrmenu,
		copy(hotspot[closemenu].ath,startx);
		set(hotspot[closemenu].oy,calc((vrmenu.rows2 * (vrmenu.height + vrmenu.spacing)) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
		set(hotspot[closemenu].visible,true);
		showgroups(closemenu);
		);

		set(nsc,0);

		for(set(i,0), i LT scene.count, inc(i),
			if(scene[get(i)].group == %1 AND scene[get(i)].nogrid != true,

				inc(nsc,1);

				txtadd(hotspotname,'hotspot_',get(i));

				addhotspot(get(hotspotname));

				copy(hotspot[get(hotspotname)].bgthumb,bghotspotname);

				set(hotspot[get(hotspotname)].url,calc('vrthumbs/' + scene[get(i)].name + '.jpg'));

				set(hotspot[get(hotspotname)].linkedscene,get(scene[get(i)].name));

				hotspot[get(hotspotname)].loadstyle(vr_menu_thumbnails);

				set(hotspot[get(hotspotname)].width,get(vrmenu.width));
				set(hotspot[get(hotspotname)].height,get(vrmenu.height));

				if(vrmenu.add_txt_thumb,
				txtadd(txthotspotname,'txthotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgtext,txthotspotname);
				addhotspot(get(txthotspotname));
				calc(hotspot[get(txthotspotname)].html,'[span style="font-size:40px;font-weight:700"]' + layer[get(scene[get(i)].level)].html +'[/span][br]'+ scene[get(i)].vrtitle);
				hotspot[get(txthotspotname)].loadstyle(vr_menu_txtthumbnails);
				set(hotspot[get(txthotspotname)].width,get(vrmenu.width));
				set(hotspot[get(txthotspotname)].height,get(vrmenu.height));
				);

				if(vrmenu.add_thumb_border,
				txtadd(borderhotspotname,'thumbborderhotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgborder,borderhotspotname);
				addhotspot(get(borderhotspotname));
				hotspot[get(borderhotspotname)].loadstyle(vr_menu_border);
				set(hotspot[get(borderhotspotname)].width,get(vrmenu.width));
				set(hotspot[get(borderhotspotname)].height,get(vrmenu.height));
				);

				div(row,startb,perRow);
				Math.floor(row);

				mod(line,startb,perRow);

				if(line === 0,
					copy(x,initialX);
					,
					add(x,vrmenu_thumb_x);
				);

				copy(hotspot[get(hotspotname)].ath,x);
				set(hotspot[get(hotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

				if(vrmenu.add_txt_thumb,
				copy(hotspot[get(txthotspotname)].ath,x);
				set(hotspot[get(txthotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
				);

				if(vrmenu.add_thumb_border,
				copy(hotspot[get(borderhotspotname)].ath,x);
				set(hotspot[get(borderhotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
				);

				if(vrmenu.seen,
					if(scene[get(i)].seen == true,
					txtadd(seen,'seen_',get(i));
					addhotspot(get(seen));
					copy(hotspot[get(hotspotname)].seen,seen);
					hotspot[get(seen)].loadstyle(vr_menu_seen);
					copy(hotspot[get(seen)].ath,x);
					set(hotspot[get(seen)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows2 * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

					);
				);

				if(scene[get(i)].name == scene[get(xml.scene)].name,set(hotspot[get(hotspotname)].active,true));

				add(startb,1);
			);
		);
		</action>

<!--================================================ BUILD THUMBS ======================================================-->

		<action name="build_thumbnails" protect="true">
		set(hotspot[play].visible,true);

		copy(startx,view.hlookat);

		set(nsc,0);
		for(set(i,0),i LT scene.count,inc(i),
			if(scene[get(i)].vrmenu === true, inc(nsc,1));
		);
		div(perRow,nsc,vrmenu.rows);

   		Math.ceil(perRow);
		set(initialX,calc((perRow * vrmenu_thumb_x) / -2));
		add(initialX,calc(vrmenu_thumb_x / 2));
		add(initialX,startx);
		set(startb,0);

		if(vrmenu.closevrmenu,
		copy(hotspot[closemenu].ath,startx);
		set(hotspot[closemenu].oy,calc((vrmenu.rows * (vrmenu.height + vrmenu.spacing)) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
		set(hotspot[closemenu].visible,true);
		showgroups(closemenu);
		);

//CHOOSE ORDER

	if(!vrmenu.order,
		for(set(i,0), i LT scene.count, inc(i),
			if(scene[get(i)].vrmenu === true,
				txtadd(hotspotname,'hotspot_',get(i));

				addhotspot(get(hotspotname));

				set(hotspot[get(hotspotname)].url,calc('vrthumbs/' + scene[get(i)].name + '.jpg'));

				set(hotspot[get(hotspotname)].linkedscene,get(scene[get(i)].name));

				hotspot[get(hotspotname)].loadstyle(vr_menu_thumbnails);

				set(hotspot[get(hotspotname)].width,get(vrmenu.width));
				set(hotspot[get(hotspotname)].height,get(vrmenu.height));


				if(vrmenu.add_txt_thumb,
				txtadd(txthotspotname,'txthotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgtext,txthotspotname);
				addhotspot(get(txthotspotname));
				calc(hotspot[get(txthotspotname)].html,'[span style="font-size:40px;font-weight:700"]' + layer[get(scene[get(i)].level)].html +'[/span][br]'+ scene[get(i)].vrtitle);
				hotspot[get(txthotspotname)].loadstyle(vr_menu_txtthumbnails);
				set(hotspot[get(txthotspotname)].width,get(vrmenu.width));
				set(hotspot[get(txthotspotname)].height,get(vrmenu.height));
				);

				if(vrmenu.add_thumb_border,
				txtadd(borderhotspotname,'thumbborderhotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgborder,borderhotspotname);
				addhotspot(get(borderhotspotname));
				hotspot[get(borderhotspotname)].loadstyle(vr_menu_border);
				set(hotspot[get(borderhotspotname)].width,get(vrmenu.width));
				set(hotspot[get(borderhotspotname)].height,get(vrmenu.height));
				);


				div(row,startb,perRow);
				Math.floor(row);

				mod(line,startb,perRow);

				if(line === 0,
					copy(x,initialX);
					,
					add(x,vrmenu_thumb_x);
				);

				copy(hotspot[get(hotspotname)].ath,x);
				set(hotspot[get(hotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

				copy(hotspot[get(txthotspotname)].ath,x);
				set(hotspot[get(txthotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

				if(vrmenu.add_thumb_border,
				copy(hotspot[get(borderhotspotname)].ath,x);
				set(hotspot[get(borderhotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
				);

				if(vrmenu.seen,
					if(scene[get(i)].seen == true,
					txtadd(seen,'seen_',get(i));
					addhotspot(get(seen));
					copy(hotspot[get(hotspotname)].seen,seen);
					hotspot[get(seen)].loadstyle(vr_menu_seen);
					copy(hotspot[get(seen)].ath,x);
					set(hotspot[get(seen)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
					);
				);

				if(scene[get(i)].name == scene[get(xml.scene)].name,set(hotspot[get(hotspotname)].active,true));

				add(startb,1);

			);

		);
	);

	if(vrmenu.order,
		for(sub(i,scene.count,1), i GE 0, dec(i),
			if(scene[get(i)].vrmenu === true,
				txtadd(hotspotname,'hotspot_',get(i));

				addhotspot(get(hotspotname));

				set(hotspot[get(hotspotname)].url,calc('vrthumbs/' + scene[get(i)].name + '.jpg'));

				set(hotspot[get(hotspotname)].linkedscene,get(scene[get(i)].name));

				hotspot[get(hotspotname)].loadstyle(vr_menu_thumbnails);

				set(hotspot[get(hotspotname)].width,get(vrmenu.width));
				set(hotspot[get(hotspotname)].height,get(vrmenu.height));


				if(vrmenu.add_txt_thumb,
				txtadd(txthotspotname,'txthotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgtext,txthotspotname);
				addhotspot(get(txthotspotname));
				calc(hotspot[get(txthotspotname)].html,'[span style="font-size:40px;font-weight:700"]' + layer[get(scene[get(i)].level)].html +'[/span][br]'+ scene[get(i)].vrtitle);
				hotspot[get(txthotspotname)].loadstyle(vr_menu_txtthumbnails);
				set(hotspot[get(txthotspotname)].width,get(vrmenu.width));
				set(hotspot[get(txthotspotname)].height,get(vrmenu.height));
				);

				if(vrmenu.add_thumb_border,
				txtadd(borderhotspotname,'thumbborderhotspot_',get(i));
				copy(hotspot[get(hotspotname)].bgborder,borderhotspotname);
				addhotspot(get(borderhotspotname));
				hotspot[get(borderhotspotname)].loadstyle(vr_menu_border);
				set(hotspot[get(borderhotspotname)].width,get(vrmenu.width));
				set(hotspot[get(borderhotspotname)].height,get(vrmenu.height));
				);


				div(row,startb,perRow);
				Math.floor(row);

				mod(line,startb,perRow);

				if(line === 0,
					copy(x,initialX);
					,
					add(x,vrmenu_thumb_x);
				);

				copy(hotspot[get(hotspotname)].ath,x);
				set(hotspot[get(hotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

				copy(hotspot[get(txthotspotname)].ath,x);
				set(hotspot[get(txthotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));

				if(vrmenu.add_thumb_border,
				copy(hotspot[get(borderhotspotname)].ath,x);
				set(hotspot[get(borderhotspotname)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
				);

				if(vrmenu.seen,
					if(scene[get(i)].seen == true,
					txtadd(seen,'seen_',get(i));
					addhotspot(get(seen));
					copy(hotspot[get(hotspotname)].seen,seen);
					hotspot[get(seen)].loadstyle(vr_menu_seen);
					copy(hotspot[get(seen)].ath,x);
					set(hotspot[get(seen)].oy,calc(row * (vrmenu.height + vrmenu.spacing) - ((vrmenu.rows * vrmenu.height) / 2) + (vrmenu.height / 2) - vrmenu.spacing));
					);
				);

				if(scene[get(i)].name == scene[get(xml.scene)].name,set(hotspot[get(hotspotname)].active,true));

				add(startb,1);

			);

		);
	);
		</action>

<!--================================================ DISPLAY ======================================================-->
		<action name="check_groups_ready">
		set(mul_gp_layers,1);
		if(vrmenu.add_thumb_border,add(mul_gp_layers,1));
		if(vrmenu.add_txt_group,add(mul_gp_layers,1));
		if(groupready === calc(ngp * mul_gp_layers),
		for(set(i,0), i LT hotspot.count, inc(i),
			if((hotspot[get(i)].style == vr_group_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_gptxtthumbnails) OR (hotspot[get(i)].style == vr_menu_group_border),
			callwith(hotspot[get(i)],ready)
			);
		if(vrmenu.closevrmenu,set(hotspot[closegpmenu].visible,true));
		showgroups(closegpmenu);
		);
		);
		</action>

		<action name="check_thumbs_ready">
		set(mul_tb_layers,1);
		if(vrmenu.add_thumb_border,add(mul_tb_layers,1));
		if(vrmenu.add_txt_thumb,add(mul_tb_layers,1));
		if(thumbready === calc(nsc * mul_tb_layers),
		for(set(i,0), i LT hotspot.count, inc(i),
			if((hotspot[get(i)].style == vr_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_txtthumbnails) OR (hotspot[get(i)].style == vr_menu_border) OR (hotspot[get(i)].style == vr_menu_seen),
			callwith(hotspot[get(i)],ready)
			);
		);
		);
		</action>

		<action name="show_group_thumbs">
		delete(initialX);
		set(banzai,0);
		set(hotspot[play].alpha,0);
		set(hotspot[play].enabled,false);

		for(set(i,0), i LT hotspot.count, inc(i),
			if((hotspot[get(i)].style == vr_group_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_gptxtthumbnails) OR (hotspot[get(i)].style == vr_menu_group_border),
				hidegroups(get(hotspot[get(i)].name));
			);
		);
		if(vrmenu.closevrmenu,
			hidegroups(closegpmenu);
		);
		build_group_thumbnails(%1,%2);
		</action>

<action name="hidegroups">
set(hotspot[%1].enabled,false);
callwith(hotspot[%1], tween(alpha|ty,calc('0|'+ - vrmenu.from),1.5,easeOutQuad));
callwith(hotspot[%1], onout);
callwith(hotspot[play], onout);
</action>

<action name="showgroups">
callwith(hotspot[%1], tween(alpha|ty,1|0,1.5,easeOutQuad,
ifnot((hotspot[%1].style == vr_menu_gptxtthumbnails) OR (hotspot[%1].style == vr_menu_group_border) ,
set(hotspot[%1].enabled,true);
);
));
</action>

<action name="hidethumbs">
set(thumbready,0);
set(hotspot[%1].enabled,false);
callwith(hotspot[%1], tween(alpha|ty,calc('0|'+vrmenu.from),1.5,easeOutQuad,removehotspot(%1)); );
callwith(hotspot[backtocategory], tween(alpha|ty,calc('0|'+vrmenu.from),1.5,easeOutQuad); );
if(vrmenu.closevrmenu,
callwith(hotspot[closemenu], tween(alpha|ty,calc('0|'+vrmenu.from),1.5,easeOutQuad); );
);
</action>

		<action name="hide_group_thumbs">
		for(set(i,0), i LT hotspot.count, inc(i),
			if((hotspot[get(i)].style == vr_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_txtthumbnails) OR (hotspot[get(i)].style == vr_menu_border) OR (hotspot[get(i)].style == vr_menu_seen),
				hidethumbs(get(hotspot[get(i)].name));
			);
			if((hotspot[get(i)].style == vr_group_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_gptxtthumbnails) OR (hotspot[get(i)].style == vr_menu_group_border),
				showgroups(get(hotspot[get(i)].name));
			);
		);

		if(vrmenu.closevrmenu,
		showgroups(closegpmenu);
		);
		</action>

		<action name="hide_cat_thumbs">
		set(groupready,0);
		for(set(i,0), i LT hotspot.count, inc(i),
			if((hotspot[get(i)].style == vr_menu_thumbnails) OR (hotspot[get(i)].style == vr_menu_txtthumbnails) OR (hotspot[get(i)].style == vr_menu_border) OR (hotspot[get(i)].style == vr_menu_seen),
				hidethumbs(get(hotspot[get(i)].name));
			);
		);
		set(hotspot[backtocategory].onclick,hide_group_thumbs);
		build_group_vrmenu();

		</action>





		<action name="gotonextone">
		set(hotspot[play].enabled,false);
		delete(initialX);
		set(hotspot[play].alpha,0);
		set(hotspot[play].visible,false);
		set(hotspot[backtocategory].visible,false);
		copy(hotspot[backtocategory].ty,vrmenu.from);
		if(vrmenu.closevrmenu,
		set(hotspot[closemenu].visible,false);
		set(hotspot[closegpmenu].visible,false);
		copy(hotspot[closemenu].ty,vrmenu.from);
		copy(hotspot[closegpmenu].ty,vrmenu.from);
		);
		for(set(i,0), i LT hotspot.count, inc(i),
			if(hotspot[get(i)].tag === 'tbhs',
				tween(hotspot[get(i)].alpha,0);
			);
		);
		tween(hotspot[blackbg].alpha,0,,,set(hotspot[blackbg].visible,false););
		</action>

		<action name="closevrmenu">
		set(groupready,0);set(thumbready,0);
		delete(initialX);
		set(hotspot[play].alpha,0);
		set(hotspot[play].visible,false);
		set(hotspot[backtocategory].visible,false);
		copy(hotspot[backtocategory].ty,vrmenu.from);
		if(vrmenu.closevrmenu,
		set(hotspot[closemenu].visible,false);
		set(hotspot[closegpmenu].visible,false);
		copy(hotspot[closemenu].ty,vrmenu.from);
		copy(hotspot[closegpmenu].ty,vrmenu.from);
		);

		for(set(i,0), i LT hotspot.count, inc(i),
 			if(hotspot[get(i)].tag === 'tbhs',
     			removehotspot(get(hotspot[get(i)].name));
     			dec(i);
   			);
		);
		if(vrmenu.onlycat,
		set(hotspot[backtocategory].onclick,hide_cat_thumbs);
		);
		tween(hotspot[blackbg].alpha,0,,,set(hotspot[blackbg].visible,false);vr_menu_setvisibility(%1););

		vrmenu_showhs();
		</action>
	<action name="removehotspotmenu">
	removehotspot(%1)
	</action>
	<action name="vr_auto_click_thumb">
		if(webvr.isenabled,
			if(%1 != null, set(vr_aclk_timeout, %1), set(vr_aclk_timeout, 2000));
			copy(vr_aclk_t1, timertick);
			set(vr_aclk_waiting, true);
			set(hotspot[hs_vr_cursor].crop,'0|0|50|50');
			asyncloop(vr_aclk_waiting,
				sub(dt, timertick,vr_aclk_t1);
				if(!hovering,
					set(vr_aclk_waiting, false);
					set(hotspot[hs_vr_cursor].crop,'0|0|50|50');
				,
					div(f, dt, vr_aclk_timeout);
					mul(f, 16);
					roundval(f);
					Math.min(f, 16);
					mul(f, 50);
					txtadd(hotspot[hs_vr_cursor].crop,get(f),'|0|50|50');

					sub(dt, 100);
					if(dt GT vr_aclk_timeout,
						set(vr_aclk_waiting,false);
						set(hotspot[hs_vr_cursor].crop,'0|0|50|50');

						onclick();


					);
				);
			);
		);
	</action>

	<action name="check_for_web_fonts_loading" autorun="preinit" type="Javascript" devices="html5"><![CDATA[
    function new_fonts_loaded()
    {
        var layers = krpano.get("layer").getArray();
        var hotspots = krpano.get("hotspot").getArray();

        var i;

        for (i=0; i < layers.length; i++)
        {
            if (layers[i]._istextfield)
            {
                // force an update by changing the vcenter setting two times
                layers[i].vcenter = !layers[i].vcenter;
                layers[i].vcenter = !layers[i].vcenter;
            }
        }

        for (i=0; i < hotspots.length; i++)
        {
            if (hotspots[i]._istextfield)
            {
                // force an update by changing the vcenter setting two times
                hotspots[i].vcenter = !hotspots[i].vcenter;
                hotspots[i].vcenter = !hotspots[i].vcenter;
            }
        }
    }

    if (document.fonts)
    {
        document.fonts.addEventListener("loadingdone", new_fonts_loaded, true);
    }
]]></action>


</krpano>