Move <script> tags to top of body

Having <script> tags at the bottom of the <body> caused some widgets
that relied upon JavaScript to fail, as the required libraries had not
been loaded at the point where the widgets were added to the page.
Refactor edit handler JavaScript integration

Edit handler panels which required JavaScript provided the JavaScript in
a `render_js` function, the output of which was collected together and
inserted after the `<script>` tags in the footer. Now that the
`<script>` tags are at the top of the `<body>`, these collected
initialisations were failing when they could not find the elements.

A new set of widgets have been created: `AdminPageChooser`,
`AdminImageChooser`, `AdminSnippetChooser`, `AdminDocumentChooser`.
These widgets output the initialisation JavaScript in a `<script>` tag
immediately following the widget itself, assuming that the required
external libraries and scripts are now included further up in the page.
This is how the GeoDjango fields from Django work, as well as many other
third party widgets. It makes writing integrations for arbitary widgets
easy, as they do not have to know anything about Wagtail edit handlers.

This also removes the need for the `fixPrefix()` JavaScript function
wrapping all field initialisers. As the fields are initialised as they
are inserted in to the page, any scripts included with them are inserted
at the same time. Additionally, the `__prefix__` placeholder in empty
form fields is also present in the initialisation scripts, and is fixed
at the same time. A template tag `escapescript` has been added to help
with this, to prevent `<script>` initialisation blocks from prematurely
closing the `<script type='text/django-form-template'>` tags.
Merge branch 'bug/missing-migration' into bug/scripts-at-bottom

* bug/missing-migration:
  Add missing migrations
Fix migrations after merging in missing migrations
Fix Python 2.6 compatibility
Merge branch 'bug/scripts-at-bottom' of https://github.com/takeflight/wagtail into takeflight-bug/scripts-at-bottom
Fixed ZeroDivisionError in fill filter

When a focal point matches the size of the image, the crop sizes are
also the same.

These sizes are subtracted from each other in the fill filter
(which would equal zero) and this number then gets used as the
denominator in a division causing the ZeroDivisionError to be raised.

The fix is simple, don't do any crop closeness calculations if the focal
point size equals the image size. Crop closeness wouldn't work anyway in
this case
Make AdminPageChooser's content_type default to Page if left unspecified
Created failing test for #798
Use DjangoJSONEncoder for encoding form submission

Fixes #798
make InlinePanel check for the existence of an onAdd handler, so that we don't have to pass it an empty one
Fix page permissions formset in groups edit interface to work with refactored javascript and AdminPageChooser widget
Use jquery onready handlers so that editor's picks JS doesn't have to be placed after the HTML; fixes the editor's picks edit page. Also remove redundant closure-wrapping from page_permissions_formset
Fix page chooser on sites interface
Remove last remnants of fixPrefix.

In page_permissions_formset, fixPrefix is a null operation; in InlinePanel.buildExpandingFormset, it's only used within the function body (no longer passed on to the onAdd handler) and only needs to be applied to a single string, so wrapping it in an inner function is redundant.
Create changelog / release notes section for 0.8.2
Various fixes to Elasticsearch configuration

- It's now possible to specify http auth paramters in the URL
- I've changed the default port to 443 to SSL connections and 80 for
  non-SSL connections. Previously, both were set to 9200.
Merge branch 'fix-form-submission-encoding' of https://github.com/kaedroho/wagtail into kaedroho-fix-form-submission-encoding
Release note for #799
Merge branch 'kaedroho-fix-form-submission-encoding' into stable/0.8.x