function StringBuffer() {
	this.length = 0;

	this._cache = null;
	this._data = [];
	this._joiner = (arguments.length == 1) ? arguments[0] : "";

	if (arguments.length > 0) {
		for (var i = 0; i < arguments.length; i++) {
			this.append(arguments[i]);
		}
	}
}

var _p = StringBuffer.prototype;

_p.append = function (s) {
	this.length += String(s).length;
	this._data[this._data.length] = String(s);
}

_p.clear = function () {
	this._cache = null;

	for (var i = 0; i < this._data.length; i++) {
		this._data[i] = null;
	}

	this._data = [];
}

_p.toString = function () {
	if (this._cache != null) {
		return this._cache;
	}

	return (this._cache = this._data.join(this._joiner));
}

function LimpaResposta() {
	$('resposta').innerHTML = "";
}

function datedifference(dt1, dt2)
{
    var strDate1 = dt1;
    var strDate2 = dt2;
    var bldatediff = false;

    //Start date split to UK date format and add 31 days for maximum datediff
    strDate1 = strDate1.split("/");
    starttime = new Date(strDate1[2],strDate1[1]-1,strDate1[0]);
    starttime = new Date(starttime.valueOf());

    //End date split to UK date format
    strDate2 = strDate2.split("/");
    endtime = new Date(strDate2[2],strDate2[1]-1,strDate2[0]);
    endtime = new Date(endtime.valueOf());

    if(endtime > starttime)
    {
        bldatediff = true;
    }

    return bldatediff;
}

