$(function(){
  $('.lenta-comp-tabs a').click(function(){
    var type = $(this).attr('class');

    var cn = '.lenta-';
    switch (type) {
      case 'f' : cn+= 'news'; break;
      case 't' : cn+= 'goods'; break;
      case 's' : cn+= 'pr'; break;
      case 'o' : cn+= 'offers'; break;
    }

    $.each(['f', 's', 't', 'o'], function(i, t){
      $('.lenta-comp-tabs li a.' + t).parent().removeClass(t + '-act').addClass(t + '-inact');
    })

    $(this).parent().removeClass(type + '-inact').addClass(type + '-act');

    var hide = $('.lenta-visible');
    var show = $(cn);

    if (!$.browser.msie) {
      var anime = $(show).height() + 'px';
      $(show).height($(hide).height());
    }

    $(hide).removeClass('lenta-visible');
    $(hide).hide();

    $(show).addClass('lenta-visible');
    $(show).show();

    if (!$.browser.msie) {
        $(show).height('auto');
        $.each($('.lenta-block'), function(i, item){
          if (!$(item).hasClass('lenta-visible')) $(item).hide();
        });
    }

    return false;
  });
});
