function status_change(response_text)
{
	var target = $('alert');

	switch (response_text)
	{
		case "Valid Login":
			window.location.reload(true);
			break;
		case "Logged Out":
			window.location.reload(true);
			break;
		case "Invalid Login":
			hide_element('loading');
			target.innerHTML = "Login Error: Please try again.";
			target.style.backgroundColor = "#ff9999";
			target.style.color = "#333333";
			target.style.border = "solid black 1px";
			target.style.fontWeight = "bold";
			opacity(target, 1);
			$('password').clear();
			$('username').activate();
			setTimeout("fade('alert', 1, 0)", 1500);
			break;
		default:
			hide_element('loading');
			target.innerHTML = "An unknown error has occurred; please try again.";
			target.style.color = "red";
			target.style.fontWeight = "bold";
			opacity(target, 1);
			setTimeout("fade('alert', 1, 0)", 1500);
			break;
	}
}

function show_element(target)
{
	$(target).style.visibility = "visible";
}

function hide_element(target)
{
	$(target).style.visibility = "hidden";
}

function pause(time) // the time is in milliseconds
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while (curDate-date < time);
}

function fade(target, start, end) // (string) target, (float) start, (float) end -- floats are between 0.0 and 1.0
{
	new Effect.Opacity(target, { from: start, to: end });
}

function opacity(target, to_what) // (string) target, (float) to_what -- float is between 0.0 and 1.0
{
	new Element.setOpacity(target, to_what);
}

function init()
{
	// Add global init stuff here,
	// and then run the local init stuff:
	local_init();
}

Event.observe(window, 'load', init);
