<?xml version="1.0" encoding="UTF-8"?>
<rmml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L:\collaborative-nir\program\Cscl3DWS\rmml\RMML.xsd">		
	<composition name="CScaleFrame" >
		<image name="imLU" />
		<image name="imU" />
		<image name="imRU" />
		<image name="imL" />
		<image name="imC" />
		<image name="imR" />
		<image name="imLD" />
		<image name="imD" />
		<image name="imRD" />
		<script>
			this.clipWidth = 0;
			this.clipHeight = 0;
			this.Width = 0;
			this.Height = 0;
			this.OriginalWidth = 0;
			this.OriginalHeight = 0;
		</script>
		<script>
			
			function init(afileImage, aw, ah)
			{
				var fileImage = "rmgr:task/" + afileImage;
				this.visible = false;
				this.imLU.src = fileImage;
				//trace("FileImage = "+fileImage);
				this.imU.src = fileImage;
				this.imRU.src = fileImage;
				this.imL.src = fileImage;
				this.imC.src = fileImage;				
				this.imR.src = fileImage;
				this.imLD.src = fileImage;
				this.imD.src = fileImage;
				this.imRD.src = fileImage;
				
				this.clipWidth = aw;
				this.clipHeight = ah;
				//trace("clip ="+this.clipWidth+" "+this.clipHeight);
				
				this.imCrop();
				
				this.imLU.x = 0;
				this.imLU.y = 0;
				this.imU.x = this.clipWidth;
				this.imU.y = 0;
				this.imRU.y = 0;
				this.imL.x = 0;
				this.imL.y = this.clipHeight;				
				this.imC.x = this.clipWidth;
				this.imC.y = this.clipHeight;
				this.imR.y = this.clipHeight;
				this.imLD.x = 0;
				this.imD.x = this.clipWidth;
				
			}
			
			function imCrop()
			{
				this.OriginalWidth = this.imLU.getMediaSize().width;
				this.OriginalHeight = this.imLU.getMediaSize().height;
				
				this.imLU.crop(0, 0, this.clipWidth, this.clipHeight);
				this.imU.crop(this.clipWidth, 0, this.OriginalWidth - 2*this.clipWidth, this.clipHeight);
				this.imRU.crop(this.OriginalWidth - this.clipWidth, 0, this.clipWidth, this.clipHeight);
				this.imL.crop(0, this.clipHeight, this.clipWidth, this.OriginalHeight - 2*this.clipHeight);
				this.imC.crop(this.clipWidth, this.clipHeight, this.OriginalWidth - 2*this.clipWidth, this.OriginalHeight - 2*this.clipHeight);
				this.imR.crop(this.OriginalWidth - this.clipWidth, this.clipHeight, this.clipWidth, this.OriginalHeight - 2*this.clipHeight);
				this.imLD.crop(0, this.OriginalHeight - this.clipHeight, this.clipWidth, this.clipHeight);
				this.imD.crop(this.clipWidth, this.OriginalHeight - this.clipHeight, this.OriginalWidth - 2*this.clipWidth, this.clipHeight);
				this.imRD.crop(this.OriginalWidth - this.clipWidth, this.OriginalHeight - this.clipHeight, this.clipWidth, this.clipHeight);
			}
			
			function getSize()
			{
				this.imU.width = this.Width - 2*this.clipWidth;
				this.imL.height = this.Height - 2*this.clipHeight;
				this.imC.width = this.Width - 2*this.clipWidth;
				this.imC.height = this.Height - 2*this.clipHeight;				
				this.imR.height = this.Height - 2*this.clipHeight;				
				this.imD.width = this.Width - 2*this.clipWidth;
			}
			
			function getPos()
			{
				this.imRU.x = this.Width - this.clipWidth;
				this.imR.x = this.Width - this.clipWidth;
				this.imLD.y = this.Height - this.clipHeight;
				this.imD.y = this.Height - this.clipHeight;
				this.imRD.x = this.Width - this.clipWidth;
				this.imRD.y = this.Height - this.clipHeight;
			}
			
			function show(ax, ay, awidth, aheight)
			{
				this.x = ax;
				this.y = ay;
				this.Width = awidth;
				this.Height = aheight;
				
				this.getSize();
				this.getPos();
				
				this.visible = true;
			}
		</script>
	</composition>
</rmml>