$.fn.labelize = function() {
    // conf = conf || {};
    // var label = conf.label;
    
    function onFocus(e) {
        if(e.target.value == $(e.target).data('label')) {
            e.target.value = '';
            $(e.target).removeClass('gray')
        }
    }
    function onBlur(e) {
        if(e.target.value == '') {
            e.target.value = $(e.target).data('label');
            $(e.target).addClass('gray')            
        }
    }    
    
    this.each(function() {
        var textbox = $(this);
        var label = textbox.attr('title') || textbox[0].value;
        // console.log('label: ', label);
        textbox.data('label', label);
        
        textbox.bind('focus', onFocus);
        textbox.bind('blur', onBlur);
        if(this.value == label) {
            textbox.addClass('gray');
        }
        
    })
}
