Moving images by selecting in the XML structure

I am trying to auto-format InDesign documents by selecting text and images in the XML structure.
I can select and move text but not images through the XML structure.

How do I accomplish the same with images

Any help would be greatly appreciated.

tell application “Adobe InDesign CS4”
activate
set myPageHeight to page height of document preferences of document 1
set myPageWidth to page width of document preferences of document 1
set myOldRulerOrigin to ruler origin of view preferences of document 1
set ruler origin of view preferences of document 1 to page origin
set zero point of document 1 to {0, 0}
set myPage to active page of active window
tell document 1
set pgcnt to count of every page
repeat with p from 1 to pgcnt
tell page p
set txtframe to count of every text frame
repeat with f from 1 to txtframe
set paracnt to count of paragraphs of text frame f
fit text frames given frame to content
tell text frame 1
try
set tagname to {}
repeat with ap from 1 to paracnt
set end of tagname to (name of markup tag of (item 1 of associated XML elements) of paragraph ap) as string
end repeat
if ((count of tagname) is greater than 1) and (every item of tagname contains “TextBox1”) then
select
move to {5.5677, 3.0613}
resize {2.4167, 0.5625}
else
select nothing
end if
end try
end tell
tell text frame 2
try
set tagname to {}
repeat with ap from 1 to paracnt
set end of tagname to (name of markup tag of (item 1 of associated XML elements) of paragraph ap) as string
end repeat
if ((count of tagname) is greater than 1) and (every item of tagname contains “TextBox1”) then
select
move to {3.0261, 3.0613}
else
select nothing
end if
end try
end tell

				tell text frame 3
					try
						set tagname to {}
						repeat with ap from 1 to paracnt
							set end of tagname to (name of markup tag of (item 1 of associated XML elements) of paragraph ap) as string
						end repeat
						if ((count of tagname) is greater than 1) and (every item of tagname contains "TextBox1") then
							select
							move to {0.4844, 3.0613}
						else
							select nothing
						end if
					end try
				end tell
			end repeat
		end tell
	end repeat
end tell
activate
tell application "Adobe InDesign CS4"
	set transform reference point of layout window 1 to center anchor
	tell document 1
		set theImages to all graphics
		repeat with i from 1 to count of theImages
			set MyImage to item i of theImages
			tell parent of MyImage to fit given frame to content
		end repeat
	end tell
end tell
display dialog "Process Completed..." with icon 1

end tell