function load_products(cat, order, by, url){
   
   var count = $("#lcol").find(".product_box").size();
   
   $.ajax({
      type: "POST",
      url: "/content/ajax/load_products.php",
      data: "cat="+cat+"&order="+order+"&by="+by+"&count="+count+"&url="+url,
      success: function(content){
         $("#older_pointer").before(content);
      }
   });
   
}

$(document).ready(function(){
   
   $(window).scroll(function(){
      
      var foot_pos = $("#foot").position();
      var foot_height = $("#foot").outerHeight();
      
      var scroll_top = $(window).scrollTop();
      var window_height = $(window).height();
      
      if((scroll_top + window_height) >= (foot_pos.top + foot_height)){
         //console.log((scroll_top + window_height)+' - '+(foot_pos.top + foot_height));
         load_products(global_cat, global_order, global_by, global_url);
      }
      
   });
   
});
