//%attributes = {}
#DECLARE($parameter : Object)

PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Picture; $width; $height)
PICTURE PROPERTIES:C457(Form:C1466.selectedPicture.Thumbnail; $thumbwidth; $thumbheight)
$picturesize:=600
OBJECT GET COORDINATES:C663(*; "Rectangle"; $l; $t; $r; $b)
$rectanglesize:=New object:C1471("width"; $r-$l; "height"; $b-$t)

Case of 
	: ($parameter.mode=1)
		$rate:=$thumbheight/$height
		If (($b+(50*$rate))>=(Form:C1466.thumbnailTop+$thumbheight))
			OBJECT SET COORDINATES:C1248(*; "Rectangle"; Form:C1466.thumbnailLeft; Form:C1466.thumbnailTop+$thumbheight-$rectanglesize.height; Form:C1466.thumbnailLeft+$rectanglesize.width; Form:C1466.thumbnailTop+$thumbheight)
		Else 
			OBJECT SET COORDINATES:C1248(*; "Rectangle"; Form:C1466.thumbnailLeft; $t+(50*$rate); Form:C1466.thumbnailLeft+$rectanglesize.width; $b+(50*$rate))
		End if 
	: ($parameter.mode=2)
		$rate:=$thumbwidth/$width
		If (($r+(450*$rate))>=(Form:C1466.thumbnailLeft+$thumbwidth))
			OBJECT SET COORDINATES:C1248(*; "Rectangle"; Form:C1466.thumbnailLeft+$thumbwidth-$rectanglesize.width; $t; Form:C1466.thumbnailLeft+$thumbwidth; $b)
		Else 
			OBJECT SET COORDINATES:C1248(*; "Rectangle"; $l+(450*$rate); $t; $r+(450*$rate); $b)
		End if 
	Else 
		
End case 