$(function(){
   var windowHeight
   ,topValue
   ,scrollTop
   ,asidNavTopValue = $(".pagebox").children().eq(0).offset().top
   ,bottomNavHeight = $(".pagebox").children().eq(0).height()
   ,asidNavHeight
   ,asidNav = $(".pagebox").children().eq(0);
 	 console.log(asidNav.height());
  $(window).on("scroll",function(){
  	 windowHeight  = $("body").height();
    asidNavHeight =  $(".type01").height();
    scrollTop =  $(window).scrollTop();
    topValue = windowHeight - bottomNavHeight - asidNavHeight;
    if(scrollTop >= asidNavTopValue+140 && scrollTop < topValue-145){
      asidNav.css({"position":"fixed","top":"0px","left":"0"});//,"background":"rgba(255,255,255,1)"
      asidNav.addClass("backs");
    }else if(scrollTop >= topValue -60){
      asidNav.css({"position":"fixed","top":topValue,"left":"auto"});//,"background":"rgba(255,255,255,0)"
    }else{
       asidNav.css({"top":asidNavTopValue,"background":"rgba(255,255,255,0)"});
      asidNav.removeClass("backs");
      //"position":"absolute",
    }
  });
});

