function TrigweeDream() {
    var me = this;

    me.setActions = function() {

        $('.dream-block').each( function() {

            me.setControlActions( $(this) );

            me.setUserActions( $(this) );
            //do lots of events

        } );       

    }

    me.setControlActions = function( element ) {
        $(element).find('.dream-img img, .dream-controls').hover(
            function() { $(this).parents('.dream-img:first').find('.dream-controls').show(); },
            function() { $(this).parents('.dream-img:first').find('.dream-controls').hide(); }
        );
        $(element).find('.dream-controls button.inspire-dream').click( function() {
            $.post( $(this).attr('action'), undefined, function(response, state) {
                if( response.dreamId ) {
                    $('#dream-'+response.dreamId+' .dream-controls button.inspire-dream').parents('li:first').remove();
                    $('#dream-'+response.dreamId+' .dream-block-meta').html( response.html );
                }
            }, 'json' );
            return false;
        } );
        $(element).find('.dream-controls button.inadequate-dream').click( function() {
            trigweeDialog
                .show()
                .showLoader()
                .loadContent( $(this).attr('action') );
        } );

        $(element).find('.dream-controls button.add-to-list-dream').click( function() {
            trigweeDialog
                .show()
                .showLoader()
                .loadContent( $(this).attr('action') );
        } );

    }

    me.setUserActions = function( element ) {

        $(element).find('.dream-footer-actions button.join-handler').click( function() {
            if( $(this).hasClass( 'normal-button-inactive') ) return false;
            $(this).parents('.dream-footer-actions:first').find('button').addClass( 'normal-button-inactive' );

            $.ajax( {
                type: 'POST',
                url: $(this).attr('action'),
                success: function( data ) {
                    if( data.redirect ) {
                        location = data.redirect; 
                    }
                    else {
                        $(element).find( '.dream-footer' ).replaceWith( $(data.html) );
                        me.setUserActions( element );
                    }
                },
                dataType: 'json'
            } );    
        } );
        $(element).find(
            '.dream-controls button.remove-dream, '+
            '.dream-footer-actions button.achieve-handler, '+
            '.dream-controls button.remove-dream-from-list').click( function() {

            trigweeDialog
                .show()
                .showLoader()
                .loadContent( $(this).attr('action') );
        } );
    }

    me.setActions();

}
