jQuery(function ($)
  {
    jQuery.ajax({

      url: 'http://alloworiginproxy.appspot.com/http://github.com/jablko/manual/raw/master/manual.html',

      success: function (data)
        {
          var $href = $('[href]', data);

          var index = $href.index($href.filter('[href="' + location + '"]'));
          if (-1 !== index)
          {
            $navigation = $('<div class="navigation"/>').appendTo('body');

            var href;

            href = $href.eq(index - 1).attr('href');
            if (undefined !== href)
            {
              var $next = $('<a href="' + href + '" rel="prev" title="Go to previous page"/>').appendTo($navigation);

              jQuery.ajax({

                url: href,

                success: function (data)
                  {
                    $next.text($('h1', data).text());
                  } });
            }

            href = $href.eq(index + 1).attr('href');
            if (undefined !== href)
            {
              var $prev = $('<a href="' + href + '" rel="next" title="Go to next page">').appendTo($navigation);

              jQuery.ajax({

                url: href,

                success: function (data)
                  {
                    $prev.text($('h1', data).text());
                  } });
            }
          }
        } });
  });

