/*
	Custom object for manipulating big strings, faster than concat


	var bs = new BigString()

	Properties:
		length - length of string
	
	Methods:
		toString() - default method

*/


function BigString(sString) {
	// public
	this.length = 0;
	
	this.add = function (sString) {
		// append argument
		this.length += (_parts[_current++] = String(sString)).length;
		
		// reset cache
		_string = null;
		return this;
	};
	
	this.toString = function () {
		if (_string != null)
			return _string || '';
		
		return _string = _parts.join("") || '';
	};

	// private
	var _current	= 0;
	var _parts		= [];
	var _string	= null;	// used to cache the string
	
	// init
	if (sString != null)
		this.add(sString);
}
