$(function() {
  var main = $('#main');
  var scroll = $('> .scrollable', main);

  if (scroll.length > 0) {  
    var scrollableHeight = main.height();  
    $('> *:not(.scrollable)', main).each(function() {
      scrollableHeight -= $(this).outerHeight();
    });

    if (scrollableHeight < scroll.outerHeight()) {
      scroll.css('overflow', 'hidden').css('overflow-x', 'hidden').css('overflow-y', 'hidden').height(scrollableHeight - 10
                 ).jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 16});
    }
  }

  // moving continue block at bottom right of main
  $('.continue', main).css('position', 'absolute').css('bottom', '1px').css('right', '1px').css('padding-right', '15px');

  // hack for opera browser for #main .continue absolute positioning
  if (jQuery.browser.opera) {
    main.css('height', '374px').css('padding-bottom', '0');
    $('.home #main').css('height', '399px');
  }


  // hack for drop down menus in IE 6
  if (jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6) {
    $('ul.navigation > li').each(function() {
      var input = $(this).addClass('sai-hacks-processed');
      input.bind('mouseenter mouseleave', function() {
        $(this).toggleClass('over');
        $('> a',this).toggleClass('over');
      });
    });
  }

});
