
//--  --  --  --  --  --  --  --  --  --  --  --  --  --

var scroller_shown = false;

//--  --  --  --  --  --  --  --  --  --  --  --  --  --

function get_doc_height() {
   var D = document;
   return Math.max(
      //Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
      Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
      Math.max(D.body.clientHeight, D.documentElement.clientHeight)
   );
}

//--  --  --  --  --  --  --  --  --  --  --  --  --  --

function the_resize() {
   var DOC_H = get_doc_height();

   try {
      var content_bottom = $("#node").offset().top + $("#node").height();
      var foot_top = content_bottom + 84; // 84     70 104  60
      var foot_height = $("#NodeFooter").height();
      if (foot_top+foot_height < DOC_H) {
         foot_top = DOC_H - foot_height;
         $("#NodeFooter").css("top", foot_top );
      }
      
      $("#NodeFooter").css("left", 0);
//      $("#NodeFooter").css('width, '$("Wrapper").width());
   }
   catch (e) {
   }
   
   var scroll_left_mod = 0;
   var loc = jQuery.trim(window.location).split('=');
   if (loc[1]=='72')
      scroll_left_mod = 10;
   else
      scroll_left_mod = 80;
   try {
      $('#scroller').css('left',
         $('.node_content').offset().left + $('.node_content').width() +scroll_left_mod );
   } catch (e) {
      $('#scroller').css('left', $('#Content').offset().left + $('#Content').width() -10 );
   }
   
   $('#main_content').css('top', DOC_H/2 - $('#main_content').height()*0.62/*0.51 0.87*/ );
   $("#main_content").css("visibility", "visible");
   
   //$(".gallery_view_imgholder").css("width", $(".gallery_view_img").width()-14); //-10
   
   //var w = document.body.clientWidth;
   //$("#NodeFooter").css("left", w- );
   //$("#NodeFooter").width(w - );
   
//   $("#header").css("visibility", "visible");
//   $("#tail").css("visibility", "visible");
}

function the_scroll() {
   if (window.pageYOffset > 120) {
      if (! scroller_shown) {
         $("#scroller").css('visibility','visible');
         $("#scroller").fadeTo(200, 1.0);
         scroller_shown = true;
      }
   } else {
      if (scroller_shown) {
         $("#scroller").fadeTo(200, 0.0, function() {
               $("#scroller").css('visibility','hidden');
               scroller_shown = false;
                  });
      }
   }
}

//--  --  --  --  --  --  --  --  --  --  --  --  --  --

window.onload = function() {
   the_resize();
   the_scroll();
   setInterval(the_scroll, 80);
}

window.onresize = the_resize;

//--  --  --  --  --  --  --  --  --  --  --  --  --  --


