/* // there's already such a function in jQuery, which is loaded in page header
function $(id) {
	return document.getElementById(id);
}
*/

function in_array(needle, haystack) {
	for (var i=0; i<haystack.length; ++i) {
		if (needle == haystack[i]) {
			return true;
		}
	}
	return false;
}

function cancelForm(alt_url) {
	if (alt_url == null)
		alt_url = "/about/contact";
	window.location = alt_url;
}

function showBlock(id) {
	element = document.getElementById(id);
	if (element) {
		if (element.tagName == "SPAN")
			dispType = "inline";
		else
			dispType = "block";
		element.style.display = dispType;
	}
}

function hideBlock(id) {
	element = document.getElementById(id);
	if (element) {
		element.style.display = "none";
	}
}

function resetInput(id) {
	input = document.getElementById(id);
	if (input && input.tagName == "INPUT") {
		input.value = "";
	}
}