function Business_Panel_Class() {
    this.selected_profiles = [];

    this.init = function() {
        // tool tips
        $('.business_button').each(function() {
            $(this).qtip({
                content: profiles[$(this).attr('profile_id')].name,
                show: 'mouseover',
                hide: 'mouseout',
                style: {
                  name: 'dark' // Inherit from preset style
                },
                position: {
                    corner: {
                     target: 'topMiddle',
                     tooltip: 'bottomMiddle'
                    }
                }
            });
        });
        $('.business_button').hover(function() {
            var profile_id = $(this).attr('profile_id')
            $(this).addClass('business_button_hover');
            for(i in profile_to_business_map[profile_id])
                map_panel.highlight_business(profile_to_business_map[i]);
        }, function() {
            var profile_id = $(this).attr('profile_id')
            $(this).removeClass('business_button_hover');
            for(i in profile_to_business_map[profile_id])
                map_panel.unhighlight_business(profile_to_business_map[i]);
        })

        var mythis = this;
        // interaction with tweets panel and map
        $(".business_button").click(function() {
            profile_id = $(this).attr('profile_id');
            mythis.business_button_click(profile_id);
        });
    }

    this.business_button_click = function(profile_id) {
        var profile_id = parseInt(profile_id);
        var array_position = jQuery.inArray(profile_id, businesses_panel.selected_profiles);
        if (array_position == -1) {
            // profile was not already selected
            businesses_panel.selected_profiles.push(profile_id);
        } else {
            businesses_panel.selected_profiles.splice(array_position,1);
        }
        tweets_panel.redraw();
        map_panel.redraw();
        this.redraw();
    }

    this.redraw = function() {
        for(profile_id in profiles) {
            var array_position = jQuery.inArray(parseInt(profile_id), this.selected_profiles);
            var biz_panel = $('.business_button').filter('[profile_id='+profile_id+']');
            if (array_position == -1) {
                // business was not already selected
                biz_panel.removeClass('business_button_selected');
            } else {
                // business was already selected
                biz_panel.addClass('business_button_selected');
                
            }
        }
    }
}
