var FieldShifter = Class.create();
FieldShifter.prototype = {
	
	initialize: function()
	{
		if (!this.element) return;
		this.element = arguments[0];
		this.text = arguments[1];
		this.tag = this.element.tagName.toLowerCase();
		
		this.setSource(this.text);
		
		Event.observe(this.element, 'focus', this.focused.bind(this));
		Event.observe(this.element, 'blur', this.blurred.bind(this));
	},
	
	focused: function()
	{
		if (this.getSource() == this.text) {
			this.setSource('');
		}
	},
	
	blurred: function()
	{
		if (this.getSource() == '') {
			this.setSource(this.text);
		}
	},
	
	getSource: function()
	{
		if ( this.tag == 'input') {
			return this.element.value;
		} else {
			return this.element.innerHTML;
		}
	},
	
	setSource: function(text)
	{
		if ( this.tag == 'input') {
			this.element.value = text;
		} else {
			this.element.innerHTML = text;
		}
	}
	
};

/**
 * 
**/

Event.observe(window, 'load', function()
{
	var email = $('sendersEmail');
	var name = $('sendersName');
	var text = $('sendersText');

	var emailTxt = ( langCategory == 2442 ) ? 'Senders E-mail:' : 'Afsenders E-mail:';
	var nameTxt = ( langCategory == 2442 ) ? 'Senders name:' : 'Afsenders navn:';
	var textTxt = ( langCategory == 2442 ) ? 'Write message' : 'Indsæt besked';
	
	new FieldShifter(email, emailTxt );
	new FieldShifter(name, nameTxt );
	new FieldShifter(text, textTxt );
	
	
});