function checkStat() {
	var checkBox = document.getElementById('statTurnOn');
	var counterCheckBox = document.getElementById('counterTurnOn');
	var counterValue	= document.getElementById('counterValue');
	var counterStyle	= document.getElementById('counterStyle');
	
	if (!checkBox.checked) {
		counterCheckBox.disabled = true;
		counterValue.disabled 	 = true;
		counterStyle.disabled 	 = true;
	} else {
		counterCheckBox.disabled = '';
		counterValue.disabled 	 = '';
		counterStyle.disabled 	 = '';
	}
}

function validateStatisticsSettings() {
	var checkBox = document.getElementById('statTurnOn');
	if (!checkBox.checked) {
		return true;
	}
	
	if (validateField('SB_Validator.notEmpty', 		'counterValue', 	'EMPTY-COUNTER-VALUE')
		&& validateField('SB_Validator.isInt', 		'counterValue', 	'INVALID-COUNTER-VALUE')
		&& extendedValidateField("SB_Validator.isGreaterThan(document.getElementById('counterValue').value, -1)", 'counterValue', 'INVALID-COUNTER-VALUE')
	) {
		return true;
	} else {
		return false;
	}
}

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

function setSaveStatus() {
	document.forms.editStatSettings.saveStatSettings.value = 'yes';
}