var ClientView = BaseView.extend({
    init: function(){
        this._super();
        this.current_client = null;
        this.current_content = null;
        
        this.setup_thumbs();
        this.setup_content();
    },
    setup_thumbs: function(){
        $('.thumb').bind('click', $.proxy(this.on_click_thumb, this));
        $('.seta').hide();
    },
    setup_content: function(){
        $('.box_select').bind('change',function(){
            if(this.value == "") {
                window.location.href = '/clients/';
            }else{
                window.location.href = this.value;
            }
            
        });
        
        $('.li_bordas_content_clientes').each(function(){
            var el = $(this),
                offset = $(this)[0].offsetTop;
            $('.content_info_clientes', el).css({top: offset + 161});
        });
        $('.content_info_clientes').hide();
        
        $('.bt_fechar').bind('click', $.proxy(this.close_content, this));
    },
    on_click_thumb: function(e){
        this.close_content(e);
        this.current_client = $(e.currentTarget).parent().parent();
        this.current_content = $('.content_info_clientes', this.current_client);
        $('a.thumb', this.current_client).addClass('selected');
        this.open_content();
        this.gallery(this.current_client, 8);
        e.preventDefault();
    },
    open_content: function(e){
        $('.content_info_clientes').fadeOut(300).hide();
        this.current_client.parent().animate({height:430}, 500, 'easeOutExpo', $.proxy(this.show_content, this));
    },
    show_content: function(){
        var client = this.current_client;
        this.current_content.fadeIn(300, function(){
            $('.seta', client).fadeIn();
        });
    },
    close_content: function(e){
        $('.seta').hide();
        $('.li_bordas_content_clientes a.thumb').removeClass('selected');
        this.current_content = null;
        $('.li_bordas_content_clientes').parent().animate({height:171}, 500, 'easeOutExpo');
        e.preventDefault();
    },
    slider: function(){
        
    }
});
