var DefaultValue = {};
DefaultValue = function(formName,inputName, el_value)
{
    this.form = document.forms[formName];
	this.el = this.form[inputName];
    this.defaultValue = el_value;
    this.valueHasChanged = false;
    this.initDefaultValue();
};
DefaultValue.prototype = {    
    initDefaultValue: function()
    {
        var $this = this;       
		if(this.defaultValue === '' || this.el.value !== '')
			return
        else
            this.el.value = this.defaultValue;
        this.el.onfocus = function()
        {
            if (!$this.valueHasChanged) 
				this.value = '';
        };
        this.el.onblur = function()
        {
            if (!$this.valueHasChanged) 
                this.value = $this.defaultValue;
        };
        this.el.onchange = function()
        {
            $this.valueHasChanged = true;
        };
		$(this.form).addEvent('submit', function()
        {
            if ($this.el.value == $this.defaultValue) 
				$this.el.value = '';
			if(/^--.+--$/.test($this.el.value))
				$this.el.value = '';
        });
    }
}