function validateForm() {
	return validateForm2(true);
}

function validateForm2(submitForm) {
	var errors = '';

	if (SB_Validator.isEmpty(document.getElementById('name').value) ) {
		errors += '- ' + SbGetLocaleByKey('EMPTY-NAME') + "\n";
	}

	var keys =  new Array('maxPages','maxRootPages','maxSites','maxUsers','maxHosts', 'trialLifeTime');
	for(var i = 0; i < keys.length; i++)
	{
		key       = keys[i];
		hiddenKey = 'hidden' + key;
		radioKey  = 'radio' + key;

		keyValue       = document.getElementById(key).value;
		hiddenKeyValue = document.getElementById(hiddenKey).value;

		if (key == 'trialLifeTime') {
			var ltChild  = document.forms['multiForm'].elements['trialLifeTypeId'].options[
				document.forms['multiForm'].elements['trialLifeTypeId'].selectedIndex
			].value;
			var ltParent = document.forms['multiForm'].elements['hiddentrialLifeTypeId'].value;
			if (ltChild != ltParent) {
				if (ltChild == 2) {
					hiddenKeyValue = hiddenKeyValue*24;
				}
				else {
					hiddenKeyValue = hiddenKeyValue/24;
				}
			}
		}

		if (document.forms['multiForm'].elements[radioKey][1].checked) {
			if (!SB_Validator.isInt(keyValue) ) {
				errors += '- ' + SbGetLocaleByKey('EMPTY-'+ key.toUpperCase()) + "\n";
			}
			else {
				if (parseInt(keyValue) < 0) {
					var msg = SbGetLocaleByKey('NEGATIVE-' + key.toUpperCase());
					errors += '- ' + msg + "\n";
				}
				else if (hiddenKeyValue >= 0) {
					if (parseInt(keyValue) > parseInt(hiddenKeyValue) || parseInt(keyValue) < 0) {
						var msg = SbGetLocaleByKey('INCORRECT-'+ key.toUpperCase());

						if (key == 'trialLifeTime') {
							msg = SbGetLocaleByKey('INCORRECT-'+ key.toUpperCase() + ltChild);
						}

						errors += '- ' + msg + ' {0,' + Math.round(hiddenKeyValue) + '}' + "\n";
					}
				}
			}
		}
	}

	if (errors != '') {
		alert(errors);
		return false;
	}

	if (submitForm) {
		document.forms['multiForm'].submit();
	}
	return true;
}