// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function animation() {
    var el_to_drop_on = $$('.general_content .page_item')[0]
    var pos = Position.cumulativeOffset(el_to_drop_on);

    //el_to_drop_on.addClassName('message_receiver_background');
    var comp = MessageReceiver.getComponentForElement(el_to_drop_on);
    var editor = Draggables.drags[0];
    var editor_pos = Position.cumulativeOffset(editor.element);

    comp.onActivate(editor.options.message_options);

    new Effect.Move($('page_item_send_edit'), {x:pos[0], y:pos[1], duration:4, afterFinish:function() { comp.onSelected(editor.element); return_animation(editor.element, editor_pos[0], editor_pos[1]) }});

}

function return_animation(element, x,y) {
    new Effect.Move(element, {x:x, y:y, duration:0.5});
}