function checkboxTogglesInput(check_id, input_id)
{
	var input_obj = document.getElementById(input_id);
	if (check_id.checked)
	{
		input_obj.disabled = true;
	}
	else
	{
		input_obj.disabled = false;
	}
}

/**
 * Toggling HTML Elements
 * @param id string: Element Identifier
 * @return void
*/
function toggle (id) 
{
	var obj = document.getElementById(id);
	if (obj.style.display == 'none')
	{
		obj.style.display = '';
	}
	else 
	{
		obj.style.display = 'none';
	}
}

function updateDecisionHourInput(category_id)
{
	if (category_id != '')
	{
		$.ajax({
			type: 'GET',
			url: 'ajax.php?f=getCategoryIsSubject&q='+category_id,
			success: function(text)
			{
				if (text == 1)
				{
					$('#label_hours').html('Wochenstunden');
					$('#input_hours').replaceWith('<input type="text" name="weekly_hours" id="input_hours" style="width:99%;" />');
				}
				else
				{
					$('#label_hours').html('LFB-Stunden');
					$('#input_hours').replaceWith('<input type="text" name="lfb_hours" id="input_hours" style="width:99%;" />');
				}
			}
		});
	}
}

function updateFachbereichInput(checkbox)
{
	if (checkbox.checked)
	{
		// Nur neue Tabellenzeile hinzufügen, wenn diese noch nicht generiert wurde
		if ($('#generated').length == 0)
		{
			$('#fachbereichsleiter_checkbox').after('<tr id="generated"><td>Fachbereich</td><td><input type="text" name="fachbereich" maxlength="1" style="width:20px;" /></td></tr>');
		}
	}
	else
	{
		if ($('#generated').length > 0)
		{
			$('#generated').remove();
		}
	}
}

function showConfirm(message)
{
	return window.confirm(message);
}