var deactivateAccount = false;
var lwidth = 1;

$(function(){
 
  $('.bb-popup-close-x, .bb-popup-close-button, .bb-popup-curtain').click(function(){
    $('.bb-popup-curtain, .bb-popup-content').fadeOut(500,function(){
      $('.bb-popup-curtain, .bb-popup-content').remove();
    });
    return false;
  });
  
  $('.bb-input-select').select();

  $('.bb-couponpage-coupons-coupon .bb-button')
    .css({
        'right' : 4
      , 'width' : 232
    }).animate({
        'right' : -40
      , 'width' : 277      
    }, 3000, 'easeOutBounce');
  
  
  $('.bb-pageboxes').each( function() {
    if( $(this).find('.bb-pagebox').length > 2 )
    {
      var $pbp = $('<div class="bb-pageboxes-preview bb-box"></div>')
        , $pfp = $('<div class="bb-pageboxes-folder"></div>');
      $pbp.append($('<strong>mehr ▼</strong>'));
      $(this).append($pfp).append($pbp);
      $pfp.hide();
      $pbp.toggle(function(){
        $(this).find('strong').text( 'weniger ▲' );
        $(this).prev().slideDown();
      },function(){
        $(this).find('strong').text( 'mehr ▼' );
        $(this).prev().slideUp();
      });
      var count = 0; 
      $(this).find('.bb-pagebox').each(function(i,obj){
        count += $(this).hasClass('bb-pagebox-halb') ? .5 : 1;
        if( count > 1 )
        {
          $(this).appendTo( $pfp );
          $pbp.append( $(this).attr('title') + ' +++ ' );
        }
        
      });      
      
    }
  });
  
});

