var items = {
	'Enter search term':'',
	'Enter your first name':'',
	'Enter your family name':'',
	'Enter your email address':'',
	'Enter your telephone number':'',
	'e.g. Builder\'s Merchant':'',
	'Enter your company name':'',
	'Enter your house number or name':'',
	'Enter your street name':'',
	'Enter your town':'',
	'Enter your county':'',
	'Enter your postcode':'',
	'Enter your search keywords':'',
	'Enter a full description of goods required including quantities':'',
	'Enter any additional comments/information':'',
	'Enter your full trading name':'',
	'Enter your trading address':'',
	'Enter your mobile number':'',
	'Enter your mobile number':'',
	'Enter your e-mail':'',
	'Enter your date of birth':'',
	'Enter your fax number':'',
	'Enter the year of incorporation':'',
	'Enter your registration number':'',
	'Enter your home address':'',
	'Enter your required credit amount':'',
	'Enter the persons name':'',
	'Enter the names and addresses of Bankers':'',
	'Enter supplier name':'',
	'Enter the suppliers address':'',
	'Enter the suppliers contact details':'',
	'Enter your full name':''
};

window.addEvent('domready', function() {
	$$('input.formelement').each(function(input) {
		var original = input.get('value');
		var type = input.get('type');
				
		input.addEvents({
			'focus': function(e){
				e.stop();
				var id = input.get('id');
				var value = input.get('value');
				
				hide_text(id,value,type);
			},
			'blur': function(e){
				e.stop();
				var id = input.get('id');
				var value = input.get('value');

				set_text(id,value,original,type);
			}
		});
		
		if(type=='password') {
			if((input).get('value') in items) {
				$(input).set('type','input');
			}
		}
	});
	$$('textarea.formelement').each(function(input) {
		var original = input.get('value');
		var type = input.get('type');
				
		input.addEvents({
			'focus': function(e){
				e.stop();
				var id = input.get('id');
				var value = input.get('value');
				
				hide_text(id,value,type);
			},
			'blur': function(e){
				e.stop();
				var id = input.get('id');
				var value = input.get('value');

				set_text(id,value,original,type);
			}
		});
	});
});
	
function hide_text(id,val,type)
{
	if(type=='password') {
		$(id).set('type','password');
	}

	if(val in items) {
		$(id).set('value','');
	}
}

function set_text(id,val,original,type)
{
	$(id).set('value',val);
	
	if($(id).get('value')=='') {
		if(type=='password') {
			$(id).set('type','text');
		}
		$(id).set('value',original);
	}
}

