Added  managesRelation() from UploadField

In 3.1 rc2 the item edir form throws managesRelation not found on GalleryUploadField, just copied teh code from UploadField
Updated for Compatibilty with SS3.1 RC2

SS3.1 RC2 uses a different Item loop and includses a new hidden field to help with writing related objects on unsaved objects
Merge pull request #5 from thezenmonkey/master

Changes for SS3.1 RC2 compatabilty