<krpano version="1.18">
	
	<!-- the skin -->
	<include url="../../../../js/vendor/pano/skin/defaultskin.xml" />
	
	<!-- view settings -->
	<view hlookat="0" vlookat="5" fovtype="MFOV" mfovratio="1.66667" fov="90" maxpixelzoom="1.5" fovmax="100" limitview="auto" />
	

	<image>
		<cube url="%$imgpath%360_%s.jpg" />
	</image>

	<action name="do_crop_animation" scope="local" args="framewidth, frameheight, framerate">
		<!-- define local variables -->
		calc(local.xframes, (caller.imagewidth /framewidth) BOR 0);
		calc(local.frames, xframes * ((caller.imageheight / frameheight) BOR 0));
		def(local.frame, integer, 0);
		
		<!-- set the first frame -->
		calc(caller.crop, '0|0|' + framewidth + '|' + frameheight);
		
		<!-- do the animation -->
		setinterval(calc('crop_anim_' + caller.name), calc(1.0 / framerate),
			if(caller.loaded,
				inc(frame);
				if(frame GE frames, if(caller.onlastframe !== null, callwith(caller, onlastframe() ) ); set(frame,0); );
				mod(xpos, frame, xframes);
				div(ypos, frame, xframes);
				Math.floor(ypos);
				mul(xpos, framewidth);
				mul(ypos, frameheight);
				calc(caller.crop, xpos + '|' + ypos + '|' + framewidth + '|' + frameheight);
			  ,
				<!-- stop the interval when the hotspot gets removed -->
				clearinterval(calc('crop_anim_' + caller.name));
			);
		);
	</action>

	<hotspot name="spot" visible="false" url="../../../img/shared/spot.png" onloaded="do_crop_animation(100,100, 10);" width="50" height="50" scale.mobile="1.5" atv="+23" ath="+10.182" onclick="show" />

	<layer name="detail" visible="false" url="../../../img/chevroletblazer-rs/360/overlay.png" align="center" width="375" height="243" onclick="close" />

	<action name="show">
		set(layer[detail].visible, true);
	</action>

	<action name="close">
		set(layer[detail].visible, false);
	</action>
</krpano>
