function init()
{
	try
	{
		var obj = document.getElementsByName('passwd')[0];

		if (typeof(input_restore_texts[obj.name]) == 'undefined' || obj.value == input_restore_texts[obj.name])
			obj.setAttribute('type', 'text');
	}
	catch (e) {}
}

function $(id)
{
	if (typeof(id) == 'object')
		return id;
	else
		return document.getElementById(id);
}

// -- input utils
// usage: onFocus="input_clear(this)" onBlur="input_restore(this)"
// form submit: onSubmit="return input_check('inputid');"

input_restore_texts = {};
function input_clear(id)
{
	var obj = $(id);

	if (typeof(obj) != 'object')
		return;

	if (typeof(input_restore_texts[obj.name]) == 'undefined')
		input_restore_texts[obj.name] = obj.value;

	if (obj.value == input_restore_texts[obj.name])
		obj.value = '';
}

function input_restore(id)
{
	var obj = $(id);

	if (typeof(obj) != 'object')
		return;

	if (obj.value == '')
		obj.value = input_restore_texts[obj.name];
}

function input_clear_pw(id)
{
	var obj = $(id);

	if (typeof(obj) != 'object')
		return;

	if (typeof(input_restore_texts[obj.name]) == 'undefined')
		input_restore_texts[obj.name] = obj.value;

	if (obj.value == input_restore_texts[obj.name])
	{
		obj.value = '';
		try { document.getElementsByName(obj.name)[0].setAttribute('type', 'password'); } catch (e) {}
	}
}

function input_restore_pw(id)
{
	var obj = $(id);

	if (typeof(obj) != 'object')
		return;

	if (obj.value == '')
	{
		try { document.getElementsByName(obj.name)[0].setAttribute('type', 'text'); } catch (e) {}
		obj.value = input_restore_texts[obj.name];
	}
}

function input_check(id)
{
	var obj = $(id);

	if (typeof(obj) != 'object')
		return false;

	if (typeof(input_restore_texts[obj.name]) == 'undefined' || input_restore_texts[obj.name] == obj.value)
		return false;

	return true;
}
