if (typeof $Tpls == "undefined") var $Tpls = {
	tpl: '',
	load: function(id) {
		$Tpls.tpl = $(id).html();
	},
	repl: function(search, replace, default_value) {
            if ($Tpls.tpl) {
		var v;
		if (replace) {
			v = replace;
		} else if (default_value) {
			v = default_value;
		} else {
			v = '';
		}

		var n = 'T' + search + 'T';
                var r = new RegExp(n, 'g');
		$Tpls.tpl = $Tpls.tpl.replace(r, v);

                n = '{' + search + '}'; // try the old fashioned way
                r = new RegExp(n, 'g');
                $Tpls.tpl = $Tpls.tpl.replace(r, v);
            }
	},
	get: function() {
		return $Tpls.tpl;
	}
}

