on testIntersection(rect1, rect2)
set {left1, top1, right1, bottom1} to bounds of rect1
set {left2, top2, right2, bottom2} to bounds of rect2
if left1 > right1 then
set {left1, right1} to {right1, left1}
end if
if top1 < bottom1 then
set {top1, bottom1} to {bottom1, top1}
end if
if left2 > right2 then
set {left2, right2} to {right2, left2}
end if
if top2 < bottom2 then
set {top2, bottom2} to {bottom2, top2}
end if
if left1 > right2 then return false
if left2 > right1 then return false
if top1 < bottom2 then return false
if top2 < bottom1 then return false
return true
end testIntersection