I'm have no idea about a solution, but I noticed in your source that you're doing a string comparison. May I suggest that you convert this to a boolean check as its a bit faster?

Also there's a function called IntersectRect. It think you'll find it useful in your collision tests.