if (! northlich){
	var northlich = new Object();
}
if (! northlich.validate){
	northlich.validate = new Object();
}

northlich.validate.ErrorsTracker=function(header){
	this._header = header;
	this._hasErrors = false;
	this._errorIDsDelimStr = "";
	this._errorsMsgList = new Array();
}


northlich.validate.ErrorsTracker.prototype={
	appendError:function(tagid, errorMessage){
		if (this._hasErrors){
			this._errorIDsDelimStr += ";";
		}
		this._errorIDsDelimStr += tagid;
		
		this._errorsMsgList[this._errorsMsgList.length] = errorMessage;
		
		this._hasErrors = true;
	}, //end appendError(tagid, errorMessage)
	hasErrors:function(){
		return this._hasErrors;
	}, //end hasErrors()
	getMessage:function(){
		return this._header + this._getErrorsUnorderedList();
	}, //getMessage
	getErrorIDsDelimStr:function(){
		return this._errorIDsDelimStr;
	},
	getFirstErrorTag:function(){
		if(this._errorIDsDelimStr == '')
		{
			return null;
		}
		var id = this._errorIDsDelimStr.split(";")[0];
		var e = document.getElementById(id);
		return e;
	}, //end getFirstErrorTag
	_getErrorsUnorderedList:function(){
		if( this._errorsMsgList.length == 0){
			return "";
		}
		
		var sb = "";

		
		sb += "<ul>";

		for(var i=0; i < this._errorsMsgList.length; i++){
			sb += "<li>" + this._errorsMsgList[i] + "</li>";
		}
		
		sb += "</ul>";

		
		return sb;
	} //end _getErrorsUnorderedList
} //end prototype
