Asset = {
  upload: function(form, id, type) {
    form = $(form);
    content_id   = location.href.match(/\/(edit|upload)\/([0-9]+)/);
    if (id < 0) {
      form.action  = "/admin/" + type + ";upload";
    } else {
      form.action  = "/admin/" + type + "/" + id + ";addasset";
    }
    if(content_id) form.action += "/" + content_id[2];
    form.submit();
  },
  deleter: function(form, id, type, aid) {
    form = $(form);
    if (id < 0) {
      form.action = "/admin/"+type+"/removeasset/"+aid;
    }
    else {
      form.action = "/admin/"+type+"/"+id+"/removeasset/"+aid;
    }
    form.submit();
  }
};


MPF_Image = {
  upload: function() {
    form = $('mpf-form');
    form.action = '/admin/mpf;upload_image';
    form.submit();
  },
  destroy: function() {
    form = $('mpf-form');
    form.action = '/admin/mpf;delete_image';
    form.submit();
  }
};
