added resizing and dragging functionality, similar to marquee.html