$(document).ready(function(){
 var ht = 0;
 var tp = 0;
 var st2 = 0;
 var oht = 0;
 var per = 0;
 var t = true;
  
  $(window).scroll(function(){
  if(t){
	$('#blockk').oneTime("200ms", function() {
         if($(this).parent().parent('.formRow').length>0){
           oht = $(this).parent().parent('.formRow').height();
         } else {
           oht = $(this).parent().height();
         }    
         ht = $(this).height();
         tp = $(this).position().top;
	 st2 = $('html').scrollTop()-145;
         per = ht+st2;
	 if(st2>0&&per<=oht){
             $(this).animate({top:st2},{queue:false, complete: function(){ t = true;}});
         } else if(tp>0&&st2<0){$(this).animate({top:0},{queue:false, complete: function(){ t = true;}});}
         else if(per>oht){
          tp = oht - ht;
          if(tp>0){$(this).animate({top:tp},{queue:false, complete: function(){ t = true;}});}
          else{$(this).animate({top:0},{queue:false, complete: function(){ t = true;}});}
         }
	});
  } 
  });
  

});
