//-----------------------------------------------------------------
// Object hdtDocument
//
// hdtDocument helps to speed up printing to the screen from Javascripts.
// Tests have shown that String concatenation (using +=) takes up some
// considerable time.  Many Javascripts create an output string by concatenating
// throughout the run, which eats up the clock.  In order to alleviate that,
// hdtDocument stores data in an array, and then joins all array elements with one
// join command, making for much speedier processing.
//-----------------------------------------------------------------
function hdtDocument() {
	this.text     = new Array();		//array to store the string
	this.write    = function (str) { this.text[this.text.length] = str; }
	this.writeln  = function (str) { this.text[this.text.length] = str + "\n"; }
	this.toString = function () { return this.text.join(""); }
	this.clear    = function () { delete this.text; this.text = null; this.text = new Array; }
}
