
window.addEvent('domready', function() {
    new inputSaver({elements: $$('input[type=text]')});
});

var inputSaver = new Class({
    Implements: Options,
    options: {
        elements: $empty
    },
    initialize: function(options)
    {
        this.setOptions(options);
        this.options.elements.each(function(item){
            this.go(item);
        }.bind(this));
    },
    go: function(element)
    {
        element.store('intValue',
            element.getProperty('value')
        );

        element.addEvents({
            'focus': function(){
                if(element.getProperty('value') == element.retrieve('intValue')) {
                    element.setProperty('value', '');
                }
            },
            'blur': function(){
                if(element.getProperty('value').replace(' ', '')== '') {
                    element.setProperty('value', element.retrieve('intValue'));
                }
            }
        });
    }
});
