function setlabeltext()
{
	var inputs = $$('input.labeltext[type=text], input.labeltext[type=password], textarea.labeltext');
	for (var i=0; i<inputs.length; i++)
	{
		if (inputs[i].getAttribute('label') == '' || inputs[i].getAttribute('label') == null)
			inputs[i].setAttribute('label', $F(inputs[i]));
			
		inputs[i].value = inputs[i].getAttribute('label');
		inputs[i].addClassName('label');
		if (inputs[i].getAttribute('type') == 'password')
		{
			inputs[i].setAttribute('label-field', 'password-field-label-'+i);
			//inputs[i].setAttribute('type', 'text');
			if (inputs[i].id == '') inputs[i].id = 'password-field-'+i;
			var labelfield = new Element('input', { id: 'password-field-label-'+i, type: 'text', value: $F(inputs[i]) });
			labelfield.setAttribute('password-field', inputs[i].id);
			labelfield.className = inputs[i].className;
			labelfield.onfocus = function() {
					$(this).hide();
					$(this.getAttribute('password-field')).show().focus();
				};
			inputs[i].insert({ after: labelfield });
			inputs[i].hide();
		}
		inputs[i].onfocus = function()
		{
			if ($F(this) == this.getAttribute('label')) 
			{
				this.value = '';
				$(this).removeClassName('label');
				if (this.getAttribute('isPassword') == 'true') this.setAttribute('type', 'password');
			}
		};
		inputs[i].onblur = function()
		{
			if ($F(this) == '')
			{ 
				this.value = this.getAttribute('label');
				$(this).addClassName('label');
				if (this.getAttribute('label-field') != '' && this.getAttribute('label-field') != null)
				{
					$(this).hide();
					$(this.getAttribute('label-field')).show();
				}
			}
		};
	}
}
function $LF(el)
{
	var value = ($(el) ? $F(el) : '');
	if ($(el) && value == $(el).getAttribute('label')) value = '';
	return value;
}
Event.observe(window, 'load', function() { setlabeltext(); });