// include the ability to extract metadata from elements (and add it in too)
Element.addMethods({
  getMetaData: function(element){
    element = $(element);
    var found = element.className.match(/\{.*\}/);
    if (found) {
      try {
        return eval("(" + found[0] + ")");
      } catch(e) {
        return {};
      }
    } else {
      return {};
    }
  },

  setMetaData: function(element, md){
    element = $(element);
    // strip out any existing metadata (sorry!)
    var found = element.className.match(/\{.*\}/);
    if (found) {
      element.removeClassName(found);
    }
    // add in the new stuff
    element.addClassName(Object.toJSON(md));
  }
});
