(function ($) {

Drupal.behaviors.viewportClasses = {
  attach: function(context) {
    setScreenClass();
    $(window).resize(
      function() {
        setScreenClass();
      }
    );
  }
}

function setScreenClass() {
  // Setup classes and maximum widths
  var classes = Drupal.settings.viewportClasses;
  
  // Get current width
  var width = $(window).width();
  
  // Determine which class should be set for current width
  for (var i in classes) {
    if (((width >= classes[i]['min width']) || (classes[i]['min width'] == undefined))
     && ((width <= classes[i]['max width']) || (classes[i]['max width'] == undefined) || (classes[i]['max width'] == 0))) {
      $('body').addClass(i);
    }
    else {
      $('body').removeClass(i);
    }
  }
}

})(jQuery);
;
(function ($) {
  $(document).ready(function () {

    /**
     *  Fade in
     */
    if ($.browser.webkit || $.browser.mozilla) {
      $('.node-page').hide().fadeIn(1500);    
    }

    /**
     *  Tall layout
     */
    balance();
    $(window).resize(function() {
      balance();
    });

    function balance() {
      var b='';
      if ($.browser.msie == true && $.browser.version == '8.0') {
          b = 'ie8';
      }
      if ($(window).width() >= 970) {
          // wide enough for scrolling layout
          $('.txt').addClass('scroll-pane');
          $('.scroll-pane').jScrollPane({showArrows:true});
      } else {
          $('.txt').removeClass('scroll-pane');
      }
    }

/*
      if ($(window).height() >= 614 && $(window).width() >= 970) {
        $('body').removeClass('vkrf-short');      
        $('body').addClass('vkrf-tall');      
        var n = ($(window).height()-418)/2;
//          $('#header,#footer').css("height",n+'px');
//          $('.vkrf-tall #main-wrapper').css("top",n+'px');
//          $('.vkrf-tall #main-wrapper').css("padding-bottom",n+'px');
//          if (b != 'ie8') {
//            $('#content .img').css("top",(n+1)+'px');
//          }
        
        $('.scroll-pane').jScrollPane({showArrows:true});
      } else {
        $('body').addClass('vkrf-short');      
        $('body').removeClass('vkrf-tall');      
//          $('#header,#footer').css("height","auto");
//          $('#main-wrapper').css("top",'');
//          $('#main-wrapper').css("padding-bottom",'0');
//          if (b != 'ie8') {
//            $('#content .img').css("top",'');
//          }
        var h = $('.img').width()/2;
      }
*/





 
  });
})(jQuery);
;

