function Tweets_Panel_Class() {
    this.max_results_to_display = 50;

    this.init = function() {
            this.redraw();
            // gui stuff
            $(".list_header_collapsed").hide();
            $(".show_link").click(function() {
                var tweet_id = $(this).parent().parent().attr('tweet_id');
                tweets_panel.expand_tweet(tweet_id);
            });
            $(".hide_link").click(function() {
                var tweet_id = $(this).parent().parent().attr('tweet_id');
                tweets_panel.collapse_tweet(tweet_id);
              });

            $(".show_all_link").click(function() {
                var profile_id = parseInt($(this).parent().parent().attr('profile_id'));
                jQuery.map(profile_to_tweet_map[profile_id], function(tweet_id) {tweets_panel.expand_tweet(tweet_id)});
            });
            $(".hide_all_link").click(function() {
                var profile_id = parseInt($(this).parent().parent().attr('profile_id'));
                jQuery.map(profile_to_tweet_map[profile_id], function(tweet_id) {tweets_panel.collapse_tweet(tweet_id)});
              });

            $('.list_content').hover(
                function() {    // over
                    var profile_id = $(this).parent().attr('profile_id');
                    for(i in profile_to_business_map[profile_id])
                        map_panel.highlight_business(profile_to_business_map[profile_id][i]);
                },
                function() {    // out
                    var profile_id = $(this).parent().attr('profile_id');
                    for(i in profile_to_business_map[profile_id])
                        map_panel.unhighlight_business(profile_to_business_map[profile_id][i]);
                }
            );
            $('.list_content .profile_image').click(function() {
                var profile_id = $(this).parent().parent().attr('profile_id');
//                if (business_ids.length == 1) {
                    if (!filters_panel.is_single_business_selected) {
                        filters_panel.show_single_profile(profile_id);
                    } else {
                        filters_panel.hide_single_business();
                    }
//                } else {
                    /*
                    var unselected_business_ids = [];
                    for(i in business_ids)
                        if (jQuery.inArray(parseInt(business_ids[i]), businesses_panel.selected_profile) == -1)
                            unselected_business_ids.push(business_ids[i]);

                    if (unselected_business_ids.length > 0) {
                        for(i in business_ids)
                            businesses_panel.selected_businesses.push(parseInt(business_ids[i]));
                    } else {
                        for(i in business_ids) {
                            var array_position = jQuery.inArray(business_ids[i], businesses_panel.selected_businesses);
                            businesses_panel.selected_businesses.splice(array_position,1);
                        }
                    }*/
            });
    }

    this.collapse_tweet = function(tweet_id) {
        var tweet_cell = $('.tweet_cell').filter('[tweet_id='+tweet_id+']');
        tweet_cell.children('.list_header_expanded').slideUp(200);
        tweet_cell.children('.list_header_collapsed').slideDown(200);
        tweet_cell.children('.list_content').slideUp(200);
    }
    this.expand_tweet = function(tweet_id) {
        var tweet_cell = $('.tweet_cell').filter('[tweet_id='+tweet_id+']');
        tweet_cell.children('.list_header_expanded').slideDown(200);
        //tweet_cell.children('.list_header_collapsed').slideUp(200);
        tweet_cell.children('.list_header_collapsed').hide();
        tweet_cell.children('.list_content').slideDown(200);
    }
    this.show_tweets = function(tweet_ids) {
        if (tweet_ids != null) {
            $('.tweet_cell').filter(function(){
                return (jQuery.inArray(parseInt($(this).attr('tweet_id')), tweet_ids) != -1);
            }).show();
        } else {
            $('.tweet_cell').show();
        }
    }
    this.hide_tweets = function(tweet_ids) {
        if (tweet_ids != null) {
            $('.tweet_cell').filter(function(){
                return (jQuery.inArray(parseInt($(this).attr('tweet_id')), tweet_ids) != -1);
            }).hide();
        } else {
            $('.tweet_cell').hide();
        }
    }

    this.redraw = function(){
        
            var profile_show = [];
            for(i in profiles)
                if (filters_panel.should_show_profile(i) && filters_panel.is_profile_on_map(i))
                    profile_show.push(i);

            tweets_panel.hide_tweets();
            jQuery.map(profile_show, function(profile_id) {
                tweets_panel.show_tweets(profile_to_tweet_map[profile_id]);
//                markers[profile_id].show();
            });
        $('.tweet_cell:visible').slice(tweets_panel.max_results_to_display, tweets.length).hide();
    }
}