function initDatePicker(form) {
	$(form + ' .dp').datepicker(
		{
			dateFormat: 'dd.mm.yy',
			prevText: '««',
			nextText: '»»'
		},
		$.datepicker.regional['de']
	);
}

function replaceOptions(target, options, replaceFirst) {
	var select = $('select[name="' + target + '"]');
	var first = null;
	if (!replaceFirst) {
		first = select.find('option:first-child');
	}
	select.empty();
	if (!replaceFirst) {
		select.append(first);
	}
	if (options != null) {
		for (i in options) {
			select.append($('<option></option>').val(options[i]).text(options[i]));
		}
	}
}

function disableSelect(target) {
	$('select[name="' + target + '"]').attr('disabled', true);
}

function enableSelect(target) {
	$('select[name="' + target + '"]').attr('disabled', false);
}