function doSearch() {
	window.location = "index.php?topic=search&searchTerm=" + escape($F('searchTerm'));
}

function resetRegForm() {
	$('regForm').reset();
}

function checkElement(id) {
	isValid = true;
	if ($F(id) == "" || $F(id).length == 0) {
		$(id).addClassName('errorHere');
		isValid = false;
	} else {
		$(id).removeClassName('errorHere');
	}
	return isValid;
}

function checkRegForm() {
	var isValid = true;
	
	if (!checkElement('registrationName'))
		isValid = false;
	if (!checkElement('registrationPhone'))
		isValid = false;
	if (!checkElement('registrationEmail'))
		isValid = false;
		
	if (!checkElement('registrationCourse'))
		isValid = false;
		
	if (!checkElement('registrationDate'))
		isValid = false;
	
	
	return isValid;
}

function submitRegForm() {
	if (checkRegForm()) {
		new Effect.Fade($('registrationFormContent'), { duration: .5, from: 1.0, to: 0.0, afterFinish: function() {
			$('regFormLoaderbar').style.display = 'block';
			query = $('regForm').serialize();
			new Ajax.Request("staticfiles/submitRegForm.php", {
				method: 'post',
				parameters: query,
				onComplete: function(transport) {
						if (transport.responseText == "success") {
							$('regFormLoaderbar').style.display = 'none';
							new Effect.Appear($('regFormSuccess'), { from: 0.0, to: 1.0, duration: .5 });
						} else {
							$('regFormLoaderbar').style.display = 'none';
							new Effect.Appear($('regFormError'), { from: 0.0, to: 1.0, duration: .5 });
							new Effect.Appear($('registrationFormContent'), { from: 0.0, to: 1.0, duration: .5 });
						}
					}
				});
			}
		});
	}
}