function validateForm() {
	if (validateField('SB_Validator.notEmpty', 'firstName', 'EMPTY-FIRSTNAME')
		&& validateField('SB_Validator.notEmpty', 'lastName', 'EMPTY-LASTNAME')
		&& validateField('SB_Validator.notEmpty', 'userName', 'EMPTY-USERNAME')
		&& validateField('SB_Validator.isLogin', 'userName', 'INVALID-LOGIN')
		&& (!isVisible(document.getElementById('rowPassword')) 
			|| validateField('SB_Validator.notEmpty', 'password', 'EMPTY-PASSWORD'))
		&& (!isVisible(document.getElementById('rowPassword')) 
			|| validateField('SB_Validator.notEmpty', 'confirmPassword', 'EMPTY-CONFIRMPASSWORD'))
		&& (
			!isVisible(document.getElementById('rowPassword')) 
			||
			(
				extendedValidateField("SB_Validator.isEqual(document.getElementById('password').value, document.getElementById('confirmPassword').value)", 'confirmPassword', 'PASSWORD-MISMATCH')
				&& validateField('SB_Validator.isAlnum', 'password', 'PASSWORD-INCORRECT')
			)
		)
		&& validateField('SB_Validator.notEmpty', 'email', 'EMPTY-EMAIL')
		&& validateField('SB_Validator.isEmail', 'email', 'INCORRECT-EMAIL')
	) {
		return true;
	} else {
		return false;
	}
}

function submitForm() {
	if (!validateForm()) {
		return false;
	}
	
	document.forms.objectForm.submit();
	return true;
}

function onRoleChanged() {
	roleObject = document.getElementById('roleId');
	isGoToSiteCreationObject = document.getElementById('isGoToSiteCreation');
	
	// if SiteOwner selected
	if (3 == roleObject.value) {
		isGoToSiteCreationObject.checked = true;
		
	} else {
		isGoToSiteCreationObject.checked = false;
	}
}