var TextboxRem = Class.create(
{
	initialize: function(idsArray)
	{
		var TextArray = new Array();
		var PassArray = new Array();
		if(idsArray == undefined)
		{
			var inputTxtArray = new Array();
			var inputPassArray = new Array();
			$$('input').each(function(inputs)
			{
				if($(inputs).type == 'text')
				{
					inputTxtArray.push($(inputs));
				}
				else if($(inputs).type == 'password')
				{
					inputPassArray.push($(inputs));
				}
				
			});
		}
		
		inputTxtArray.each(function(elem)
		{
			TextArray[inputTxtArray.indexOf(elem)] = $(elem).value;
			$(elem).observe('focus', function()
			{
				if($(elem).value == TextArray[inputTxtArray.indexOf(elem)])
				{
					$(elem).value = '';
				}
			});
			$(elem).observe('blur', function()
			{
				if($(elem).value == '')
				{
					$(elem).value = TextArray[inputTxtArray.indexOf(elem)];
				}
			})
		});
		
		inputPassArray.each(function(elemP)
		{
			PassArray[inputPassArray.indexOf(elemP)] = $(elemP).value;
			$(elemP).setAttribute('type', 'text');
			//$(elemP).type = 'text';
			$(elemP).observe('focus', function()
			{
				if($(elemP).value == PassArray[inputPassArray.indexOf(elemP)])
				{
					$(elemP).value = '';
					$(elemP).setAttribute('type', 'password');
					//$(elemP).type = 'password';
				}	
				
			});
			$(elemP).observe('blur', function()
			{
				if($(elemP).value == '')
				{
					$(elemP).setAttribute('type', 'text');
					//$(elemP).type = 'text';
					$(elemP).value = PassArray[inputPassArray.indexOf(elemP)];
				}
			})
		});
	}
});
Event.observe(window, 'load', function()
{
	new TextboxRem();
	
	if(document.getElementById('login'))
{
	var loginform = document.getElementById('login');
	var inputs = loginform.getElementsByTagName('input');
	
	for(var i = 0; i < inputs.length; i++) {
		if(inputs[i].type != 'submit')
		{
			inputs[i].onfocus = function() {
				this.style.backgroundPosition = '0 -20px';
			}
			
			if(inputs[i].value != '')
			{
				inputs[i].style.backgroundPosition = '0 -20px';
			}
		}
	}
}
});




