var What = new Class({
    
    Implements: Options,
    options: { 'text': 'Поиск' },
    
    initialize: function(element, options) {
        this.element = $(element);
        this.setOptions(options);
        this.element.addEvents({
            'focus': this.onFocus.bind(this),
            'blur': this.onBlur.bind(this)
        });
        if ( this.element.get('value') ) return;
        this.element.set('value', this.options.text);
        if ( this.options['class'] ) this.element.addClass(this.options['class']);
    },
    
    onFocus: function() {
        if ( this.element.get('value') == this.options.text ) {
            this.element.erase('value');
            if ( this.options['class'] ) this.element.removeClass(this.options['class']);
        }
    },
    
    onBlur: function() {
        if ( !this.element.get('value') ) {
            this.element.set('value', this.options.text);
            if ( this.options['class'] ) this.element.addClass(this.options['class']);
        }
    }
    
});
