/**
 * Detailed status form scripts
 *
 * @copyright (c) 2004-2007, SWsoft
 */
function SbDetailedStatusForm(modalFormObjectId) {
	this._formObject = self.document.getElementById(modalFormObjectId);
}

SbDetailedStatusForm.prototype.hide = function() {
	this._formObject.hide();
}

SbDetailedStatusForm.prototype.show = function() {
	this._formObject.show();
}

SbDetailedStatusForm.prototype.filterMessages = function(level) {
	var levelsArray = new Array();
	levelsArray.push('error');
	if ('error' != level) {
		levelsArray.push('warning');
		if ('warning' != level) {
			levelsArray.push('success');
			if ('success' != level) {
				levelsArray.push('info');
			}
		}
	}
	for (var i = 1; i < 1000; i++) {
		var row = self.document.getElementById(this._formObject.id + 'Message' + i);
		if (row) {
			this._updateMessageVisibility(row, levelsArray);
		} else {
			break;
		}
	}
	
}

SbDetailedStatusForm.prototype._updateMessageVisibility = function(messageContainer, levelsArray) {
	var isVisible = false;
	for (var i = 0; i < levelsArray.length; i++) {
		if (messageContainer.statusLevel == levelsArray[i]) {
			isVisible = true;
			break;
		}
	}
	if (isVisible) {
		messageContainer.style.display = (document.all) ? 'block' : 'table-row';
	} else {
		messageContainer.style.display = 'none';
	}
}