$(document).ready(function() {
  var closeAll,
      $topLinks = $('#nav > ul > li > a');
 
  $('#nav ul ul').css('opacity', '1');
  $topLinks.click(function() {
    var $parentItem = $(this).parent(),
        slideAmt = $(this).next().width(),
        direction;
    $topLinks.removeClass('expanded');
    if (parseInt($parentItem.css('marginLeft'), 10) <0) {
      direction = '+=';
    } else {
      $(this).addClass('expanded');
      direction = '-=';
    }
    $parentItem
      .animate({marginLeft: direction + slideAmt}, 400)
        .siblings()
        .animate({marginLeft: '0'}, 150);
    return false;
  });
 
  $('#nav')
  .mouseleave(function() {
    closeAll = setTimeout(function() {
      $topLinks.removeClass('expanded')
        .parent().animate({marginLeft: '0'}, 400);
    }, 2000);
 
  })
  .mouseenter(function() {
    clearTimeout(closeAll);
  });

	// equal height cols
	// $.fn.setAllToMaxHeight = function(){
	// return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
	// }
	// $('#content,#sidebar').setAllToMaxHeight();
	// 
	// $('pre').addClass('brush: xml; wrap-lines: true');
	
 
});