// based on http://groups.google.com/group/jquery-ui/msg/90e37a2d2bdb1278?
// pass it the template, and the replacement vor the variables.
// Example:
//   $.simpleTemplate('<div class="{myClass}'>And some {something}!</div>,
//        {myclass: 'important', something: 'fun'});
//
//   If the result should be appended to a node:
//     $(node).simpleTemplate(...);
(function($){
    $.fn.extend({
        simpleTemplate: function(template, replacements) {
            return this.each(function() {
                $(this).append($.simpleTemplate(template, replacements));
            });
        }
    });  
    $.extend({
        simpleTemplate: function(template, replacements) {
            return template.replace(/{([^{}]*)}/g,
                function (a, b) {
                    var r = replacements[b];
                    return typeof r === 'string' || typeof r === 'number'
                        ? r
                        : a;
                }
            )
        }
    });
})(jQuery);
