if(typeof(DT) == 'undefined') DT = {};

DT.Template = function(id){
    this.id = id;
    this.html = this.readHTML();
    this.writeHTML();
}

DT.Template.prototype.readHTML = function() {
    var html;
    var id = this.id;
    var ptn = new RegExp('<tmpl id="' + id + '"><!\\[CDATA\\[((.|\n)*?)\\]\\]><\/tmpl>');
    new Ajax.Request("http://www.accia.net/InTemp/tmpl.xml", {
        asynchronous: false,
        method: 'get',
        onComplete: function(res) {
            ptn.test(res.responseText);
            html = RegExp.$1;
        }
    });
    return html;
}

DT.Template.prototype.writeHTML = function() {
    document.write(this.html);

}
