// This function updates the 'add frequently asked question' form by showing/hiding the internal/external page part.
function updateAddFrequentlyAskedQuestionForm(){
	// Which dropdown list needs to be shown?
	FAQTopics = document.getElementById('addFrequentlyAskedQuestionTopics');
	FAQTopicsValue = FAQTopics.options[FAQTopics.selectedIndex].value;

	FAQTopicsIds = document.getElementById('addFrequentlyAskedQuestionTopicsIds').value;
	FAQTopicsIdsSplit = FAQTopicsIds.split(/;/);
	for (i = 0; i < FAQTopicsIdsSplit.length; i++) {
		if (FAQTopicsIdsSplit[i] == FAQTopicsValue) {
			document.getElementById('addFrequentlyAskedQuestionPosition' + FAQTopicsIdsSplit[i]).style.display = 'block';
			document.getElementById('addFrequentlyAskedQuestionPositionLabel' + FAQTopicsIdsSplit[i]).style.display = 'block';
		} else {
			document.getElementById('addFrequentlyAskedQuestionPosition' + FAQTopicsIdsSplit[i]).style.display = 'none';
			document.getElementById('addFrequentlyAskedQuestionPositionLabel' + FAQTopicsIdsSplit[i]).style.display = 'none';
		}
	}
}

// This function asks the user whether he's sure he wants to delete the frequently asked question.
function confirmFrequentlyAskedQuestionDeletion(frequentlyAskedQuestionToDelete){
	if (window.confirm('Are you sure you wish to delete this frequently asked question?')) {
		location.href='frequentlyAskedQuestions.php?deleteFrequentlyAskedQuestion='+frequentlyAskedQuestionToDelete;
	}
}
