var PhotoUpload = Behavior.create ({
  initialize: function() {
    this.add_link = this.element;
    this.photo_upload = this.add_link.up('.subsection').down('#photo_upload');
    this.cancel_link = this.photo_upload.down('input.cancel');
 
    this.add_link.observe('click', this.slideDown.bind(this));
    this.cancel_link.observe('click', this.slideUp.bind(this));
  },
  
  slideDown: function(event) {
   event.stop();
   new Effect.Parallel ([
    Effect.SlideDown(this.photo_upload, { sync: true})
   ], { duration: 0.5 });
  },

  slideUp: function(event) {
   event.stop();
   new Effect.Parallel ([
    Effect.SlideUp(this.photo_upload, { sync: true})
   ], { duration: 0.5 });
  }
});

Event.addBehavior ({
  "body.people.edit .photos .container a.add" : PhotoUpload
});
