Fix IE8 test issues (closes #893).

There were a number of issues. Some of them were caused by
trailing commas that I detected thanks to JSHint.

Two of them were tougher to track down.

One was caused during the image preloading test. Apparently in
IE8, an image.onload handler can interrupt a javascript function
in the middle of execution.
The image onload handler used to set image.img to null,
which was done at one time to try to fight memory leaks in FF.
In IE8 this was causing problems, because the onload handler got executed
immediately after setting the onload handler up, causing code that followed
to blow up because it was expecting image.img to still be there.
In "normal" browsers JS functions aren't interrupted while they are
running, but it looks like IE8 will do that when it comes to image onload handlers.

The other issue that was hard to track down was caused by the advertise
dialog being closed asynchronously, after the advertise tests have already
finished, "leaking" into other tests, throwing funny "Unspecified error" errors.

I worked around that by stubbing out the $.cardstories.close_modal function
in the two tests that test the advertise function.

JSHint was complaining about property access syntax (obj['prop'] vs obj.prop)
and after I couldn't find a quick way to turn that warning off, I went ahead
and changed the syntax to suit JSHint and let me lint the rest of the code.
Make it possible to test owner changes from ?skin interface (closes #894).

When looking at one of the 'complete' states through the ?skin interface,
clicking the 'owner_change_self' link will initiate a cardstores_table
owner change event with the next owner being the current player,
while clicking the 'owner_change_other' will change the next game owner
to one of the other players.
Implement results fade out animation.

This commit implements the results fade out animation after pressing
the continue button.

The tricky part was handling the on_next_owner_change events properly.

I tried not to duplicate code, in which I succeeded but had to used
marker classes such as 'cardstories_results_closed', which I am not
very happy about.
Implements score legend fly-in (fixes #870)

This implements the GAME SCORE characters flying in from the left.  This
was done dynamically, so that the phrase can be altered at any time with
no ill effects.

It took *a lot* of trial and error to get the formula for the parabola
right, but it'll pay off in flexibility for the future.
Implement levelup stars/fireworks animations (closes #897).

This implements the first part of the levelup animations:

- the win/lose banner morphing into the "Level up!" banner;
- the stars sprite with stars comming in and then blinking in a loop;
- the fireworks going off in a loop.

The loop stops whenever the active element gains the class cardstories_results_closed,
which is applied to it when clicking the continue button or closing the results
box with the little "X" button.

The level progress bar animations were made so that they first go from 0 to 100% for
each level the player has advanced (taking into account that it's possible to jump
ahead more than one level at once), and then showing the remaining progress
towards the next level.

The tests are not very extensive because most of the code is animations which
are hard or impossible to test well.
Implement earned cards backend (fixes #896)

This implements the mechanism through which a player earns new cards as
levels are gained.  The basic idea is simple: for every level earned,
the player gets a new card, chosen randomly from the cards above number
36.

In order to achieve this, the biggest change was that the games.cards
field no longer stores which cards haven't been dealt yet. It now stores
the exact opposite: which cards have already been dealt.  This was done
to accomodate the fact that each player now has a different set of
possible cards to be dealt: the base set of 36, plus an unknown number
of earned cards. Most of the rest of the changes stem off from this
change in architecture.

It is also worth nothing that the game master's initial deck is no
longer generated client-side.  When a game is created server-side, the
game master hand is immediately dealt and communicated to the client.

For the sake of simplicity, I decided to store earned cards using the
same technique as the rest of the card fields: a TEXT field with a
char for each card.  It complicates management later on, but the code is
easier to read and also gives better performance.
Dancing star (fixes #898 and #901)

This implements the dancing star animation, as well as the relevant
results box elements being animated "off-stage" to the left.

It was necessary to modify animate_sprite() so that an animation can be
looped indefinitely.
iLevel up animations: "slot machine" (fixes #899)

Implements the level up slots-like animation.
Level up animations: "You earned a new card" (fixes #900)

Displays the new card a player won, if any.

I've decided not to implement the display of multiple cards, for two
reasons.  First, the text is currently static, and it only refers to one
card.  Second, it is technically possible to earn 3 or 4 cards at a time
(that's what's going to happen the first time someone levels up after
the migration), and such behavior would be undefined as well.
Level up animations: sound (fixes #902)

This implements playback of the appropriate level-up sounds.  Of note:

* The audio plugin had to be changed so that looping and volume could be
  specified upon sound creation.

* Unfortunately, SoundManager looping is not working in Firefox,
  Safari, and IE8.  Because of this, the final background music cannot
  be heard in these browsers (it works fine in Chrome and IE9).
Fix levelup machine slot on FF in OS X.

Also took the opportunity to add some png sprite images
to the images_to_preload array.
Use the same box for author and player results (closes #903).

With the new design, the two boxes were so similar that keeping
them separate led to needless code duplication.
In fact, the only thing that is different with author vs. player
results are the explanations.
Upgrade SoundManager2 to the latest version (refs #904).

I was hoping that this might help with the looping issue,
but unfortunately it doesn't change anything :(.
Update the django template with new sound definitions.
Make tabs aware of tables (closes #804).

Tabs are now highlighted if the player is the owner of the next
game in the table, or if the next game in the table is ready
to be played.

The postprocess plugin hook was used to add next_owner_id and
next_player_id info into the response of the 'tabs' type state
request.

Because I needed to access the player_id in the postprocess hook,
I changed the signature of the postprocess function to take a second
parameter, which is the original request.
I believe that even in the postprocess step, having access to the
request is a completely valid expectation.

There are currently two problems with tabs highlighting when it
comes to tables:

- Because a new game of the table opens in a new tab,
  the tab of the previous game always remains highlighted
  (since the next lame is obviously ready).
- If a table is destroyed (such as after a server restart),
  each player is marked as the next owner, which means that
  after a server restart, all tabs containing games in the
  'complete' state will be highlighted.

The first problem should be solved by one of the future tasks,
where the next game of the table will open in the same tab as
the previous game (or will at least create that illusion by
automatically closing the previoius game tab), so that shouldn't be
a problem.

The second problem is trickier and I don't have an answer yet.
Improve the table postprocess test (refs #804).
Replace the levelup banner image (refs #897).

The old image wasn't cropped properly.
Fixes sound looping (closes #909)

This implements sound looping using recursion, as opposed to
soundmanager's builtin "loops" parameter (which doesn't work).

Although looping works, there is a small delay between loops which I
could not manage to get rid of.
Uses proper squiggle slice (fixes #900)

Uses the new proper squiggle slice.
Fix typo in Django template (refs #909)