$( window ).load(function() {
	 $( ".listitem" ).hide();
	 var page = 1;               
//	                $('#tab-Friends').jscroll({
//	                    loadingHtml: '<img src="'+MAIN_URL+'project/files/default/loader.gif" alt="Loading" /> Loading...',
//	                    padding: 20,
//	                    autoTrigger: true
//	                    nextSelector: MAIN_URL+"user/listfriendsajax/"+page+"/"+ALIAS,
//	                    contentSelector: ''
//	                });
	//$( ".jShowFriends" ).click(function() { 
//	    alert(TOTAL_PAGES); 
		page = 1;	                
       	var _throttleTimer = null;
	  	var _throttleDelay = 100;
	    $( window ).scroll(function() { 
	        //alert("hi");
	    	clearTimeout(_throttleTimer);
	        _throttleTimer = setTimeout(function () {
	        	if($(window).scrollTop() + $(window).height() > $(document).height()-100) {
	            	// $(window).unbind('scroll');
	                //	alert($(document).height());	                	  
	                if(page <TOTAL_PAGES){
	                	page++;
	                	$(".listitem" ).show();	                  
	                    $.ajax({
//	                        	beforeSend: function(){page++;},
	                        	type:"POST",
	                            url: MAIN_URL+"user/pendingrequestajax/"+page,
	                            dataType:"html",
	                            success: function(res) {                                 
//	                            	alert(res);
	                                $('.find_friends_list_blk').append(res);
	                                $('.listitem').fadeIn(3000);
	                                $('.listitem').hide();
	                                //$(window).bind('scroll');	                                    	              
	                            }
	                        });		                   
	                }
	        	}
	        },_throttleDelay);
	    });
	//});
});