function input_placeholder (input, value)
{
    var thisCopy = this;

    this.Input = input;
    this.Value = value;
    this.SaveOriginal = (input.value == value);

    this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
    this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()})

    if (input.value == '') {
        this.onBlur();
    }

    return this;
}

input_placeholder.prototype.setupEvent = function (elem, eventType, handler)
{
    if (elem.attachEvent) {
        elem.attachEvent ('on' + eventType, handler);
    }

    if (elem.addEventListener) {
        elem.addEventListener (eventType, handler, false);
    }
}

input_placeholder.prototype.onFocus = function()
{
    if (!this.SaveOriginal &&  this.Input.value == this.Value) {
        this.Input.value = '';
    }
}

input_placeholder.prototype.onBlur = function()
{
    if (this.Input.value == '' || this.Input.value == this.Value) {
        this.Input.value = this.Value
    }
}
