title: How to create pagination like behavior for an array in javascript
body: <p>In my application after getting my application Authorized by Facebook I get all their friends info which is returned in an array.</p>
  
  <p>I sort this array in order of the friends whose birthday is closest to the current date.(code not shown for this)</p>
  
  <p>I want to display the information for 20  friends at a time as some users may have hundreds of friends.</p>
  
  <p>Currently I am putting all of the friends on the page at one time.</p>
  
  <p>Here is the code I was using to loop through the entire array and put the info on the page </p>
  
  <pre><code>$.each(json.data,function(i,fb){
  
                    var pic_url = "http://graph.facebook.com/"+fb.id+"/picture";
                    json_details = {name: fb.name, provider_user_id: fb.id, birthday: fb.birthday, provider_name : 'Facebook' }; 
                    var celebrant_details = escape(JSON.stringify(json_details) );
                    html += "&lt;form id='new_celebration"+fb.id+"' method='post' action='/celebrations' accept-charset='UTF-8'&gt;";
                    html += "&lt;input type='hidden' id='friend' value='"+celebrant_details +"'  name='celebrant_details'  /&gt;"
                    html += "&lt;input type='hidden' id='manager' value='"+manager_details +"'  name='manager_details' /&gt;"
  
                    html += "&lt;li&gt;" + fb.name + "&lt;/li&gt;";
                    if(fb.birthday != null){  html += "&lt;li&gt;" + fb.birthday + "&lt;/li&gt;"; } //don't show if don't have a birthday
                    html += "&lt;li&gt;&lt;img src="+pic_url+" /&gt;&lt;/li&gt;";       
                    html += "&lt;input class='button-mini-subtle submit' type='submit' value='select' alt='select'  &gt;";    
                    html += "&lt;/form&gt;";
  
                  });//.each loop
  </code></pre>
  
  <p>I am a NOOB so would appreciate some guidance.  </p>
  
  <p>I want to give the users a button they can click to display more users from the array. 
  So I know I need to create some kind of a function call and I need to know where I am in the array.</p>
  
  <p>How can I get this kind of behavior?</p>