(function(a){a.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(b,a){this.defaults.type=b;this.defaults.name=a},"get":function(d,h){var c=a.extend({},this.defaults,h);if(!c.single.length)c.single="metadata";var b=a.data(d,c.single);if(b)return b;b="{}";if(c.type=="class"){var g=c.cre.exec(d.className);if(g)b=g[1]}else if(c.type=="elem"){if(!d.getElementsByTagName)return undefined;var f=d.getElementsByTagName(c.name);if(f.length)b=a.trim(f[0].innerHTML)}else if(d.getAttribute!=undefined){var e=d.getAttribute(c.name);if(e)b=e}if(b.indexOf("{")<0)b="{"+b+"}";b=eval("("+b+")");a.data(d,c.single,b);return b}}});a.fn.metadata=function(b){return a.metadata.get(this[0],b)}})(jQuery)