I am trying to implement a system where images can either be dragged to a certain location and then trigger an ajax call on doing so (which is working fine) or alternatively be clicked on without dragging and act as a normal link

Unfortunately I cannot work out how to stop the link (or onclick) from firing after a drag has been performed. I need to somehow detect if the image has been dragged and prevent the onclick from firing if it has.

I am currently using prototype/scriptaculous in Rails for the drag-and-drop but I am not averse to any solution

Any help much appreciated!