                    
            /**
             * Callback function that displays the content.
             *
             * Gets called every time the user clicks on a pagination link.
             *
             * @param {int}page_index New Page index
             * @param {jQuery} jq the container with the pagination links as a jQuery object
             */
			function pageselectCallback(page_index, jq){
                var items_per_page = 10;
                var max_elem = Math.min((page_index+1) * items_per_page, smurls.length);
                var newcontent = '';

                // Iterate through a selection of the content and build an HTML string

				var i=(page_index*items_per_page);

                for(i=i; i<max_elem ; i++)
                {
                    newcontent += '<dt><span class="counter">' + smurls[i][2] + '</span><a href="http://smurl.ca/' + smurls[i][0] + '" target="_blank">smurl.ca/' + smurls[i][0] + '</a></dt>';
                    newcontent += '<dd class="url">' + smurls[i][3] + ': ' + smurls[i][1] + '</dd>';
                }
                
                // Replace old content with new content
                $('#Searchresult').html(newcontent);
                
                // Prevent click eventpropagation
                return false;
            }
            
			function pageselectCallback2(page_index, jq){
                var items_per_page = 10;
                var max_elem = Math.min((page_index+1) * items_per_page, smurls2.length);
                var newcontent = '';

                // Iterate through a selection of the content and build an HTML string

				var i=(page_index*items_per_page);

                for(i=i; i<max_elem ; i++)
                {
                    newcontent += '<dt><span class="counter">' + smurls2[i][2] + '</span><a href="http://smurl.ca/' + smurls2[i][0] + '" target="_blank">smurl.ca/' + smurls2[i][0] + '</a></dt>';
                    newcontent += '<dd class="url">' + smurls2[i][3] + ': ' + smurls2[i][1] + '</dd>';
                }
                
                // Replace old content with new content
                $('#Searchresult2').html(newcontent);
                
                // Prevent click eventpropagation
                return false;
            }

		
            // When document has loaded, initialize pagination and form 
            $(document).ready(function(){
				// Create pagination element with options from form

                $("#Pagination").pagination(smurls.length, {
                    num_edge_entries: 2,
                    num_display_entries: 4,
                    callback: pageselectCallback
                });

                $("#Pagination2").pagination(smurls2.length, {
                    num_edge_entries: 2,
                    num_display_entries: 4,
                    callback: pageselectCallback2
                });



            });

