anchor.diff:            }
             //Set a global func to replace current element
             window[ target +"_replace"] = function( params ){
  -            media_fields.delete_element(field, counter, unique_id);
  +            var position = media_fields.delete_element(field, counter, unique_id);
               params["options"] = params["options"] || {};
               params.options.unique_id = params.options.unique_id || unique_id;
  +            if( position > 0 ) params.options.position = position;
               media_fields.add_element(field, params["id"], params["asset_name"], counter, params["thumbnail_url"], params["view_link"], params["asset_name"],params["options"]);
  -          }
  +          };
             if( Object.isFunction( options["update_target_callback"] ) ){ options.update_target_callback( target ); }
           }
   
  
positive.code:         var templ = new Template(
          "<li class='element element_#{unique_id}'>"+
            "<input type='hidden' name='#{field_name}[#{field}_ids][#{unique_id}][id]' value='#{id}' />"+
            "<input type='hidden' name='#{field_name}[#{field}_ids][#{unique_id}][position]' value='' />"+
            "<a class='handle'>handle</a>"+
            "<h4>#{asset_name}</h4>" +
            "<img src='#{thumb}' alt='#{asset_name}'/>" +
  
negative.code:       },
  
        //Deletes a selected element from a media field
        //and returns current position before removing it
        delete_element: function(field, counter, unique_id){
          var parent = $('media_selector_'+ counter).select(".element_"+unique_id).first();
          var position = parent.select(".position").first().value;
          parent.remove();
          this.fields[counter]['size']--;
          this.reload(field, counter);
          return position;
        },
  
        //Hides or show 'add' and 'search' links (and inner content)
  