function ajax_started_for(name) {
	Element.show(name + '_indicator');
	if ($(name + '_form_error'))
		Element.hide(name + '_form_error');
}

function ajax_ended_for(name) {
	if ($(name + '_indicator'))
		Element.hide(name + '_indicator');
}

function clear_course_form() {
	$('course_name').value = '';
	$('course_name').focus();
}

function clear_exam_form() {
	$('exam_name').value = '';
	$('exam_score').value = '';
	$('exam_name').focus();
}

function clear_activity_form() {
	$('activity_name').value = '';
	$('activity_name').focus();
}

function toggle_form_tray_for(name) {
	tray = name + '_form_tray';
	
	if (Element.visible(tray)) {
		tray_queue_position = 'front';
		link_queue_position = 'end';
	} else {
		tray_queue_position = 'end';
		link_queue_position = 'front';
	}
	
	Effect.toggle(tray, 'blind', { duration: 0.3, queue: tray_queue_position });
	Effect.toggle('add_' + name + '_link', 'appear', { duration: 0.2, queue: link_queue_position });
	
	if ($(name + '_form_error'))
		Element.hide(name + '_form_error');
}

function toggle_school_address(check_box) {
	if (check_box.checked) {
		$('school_street').clear();
		$('school_city').clear();
		$('school_zip').clear();
		
		$('school_state').selectedIndex = 0;
		$('school_country').selectedIndex = 0;
		
		$('school_street').disabled = true;
		$('school_city').disabled = true;
		$('school_state').disabled = true;
		$('school_zip').disabled = true;
		$('school_country').disabled = true;
	} else {
		$('school_street').disabled = false;
		$('school_city').disabled = false;
		$('school_state').disabled = false;
		$('school_zip').disabled = false;
		$('school_country').disabled = false;
	}
}
