Improved fullscreen functionality.

- the requestFullScreen function now has two boolean arguments:
  "doLockPointer" and "doResizeCanvas"
- when using "doResizeCanvas", the SDL application gets notified via the
  "SDL_VIDEORESIZE" event of the new resolution, the old resolution setting
  is saved and gets restored when the canvas returns to windowed mode
- when setting "doLockPointer" to false the mouse pointer remains visible
  in fullscreen mode and allows e.g. RTS (Real Time Strategy) type games
- the SDL application can check via the "SDL_FULLSCREEN" flag in the flags
  field of the SDL_Surface struct whether the canvas is currently
  in fullscreen mode or not.
- depending on the browser the SDL application can switch out of the
  fullscreen mode with the "SDL_WM_ToggleFullScreen(SDL_Surface*);" call
  (currently chrome supports it, firefox does not)
- Also, the requestFullScreen has been fixed to avoid repeated adding of
  the event listeners every time requestFullScreen is called.
- src/shell.html got changed to demonstrate all variants to switch to
  fullscreen mode

Note:
Due to the security model of web browsers, the SDL model cannot be
fully supported.

What is not possible?
- Initiating the switch to fullscreen from the SDL application.
- Initiating the pointer lock from the SDL application when *not* in
  fullscreen mode

How to work around the limitations?
All the actions that cannot be initiated by the SDL application have to be
initiated by the web browser instead.

A good practice should be to start the application in windowed mode and
have a button situated close to the canvas which switches the canvas into
fullscreen mode and also changes the canvas size to fullscreen resolution.
This way, the SDL application receives a SDL_VIDEORESIZE event and can
check in the even handler whether it is now in fullscreen mode and take
further actions.
When leaving fullscreen mode the old windowed canvas resolution gets
restored and triggers another SDL_VIDEORESIZE event which - again - can be
used to adapt the application to windowed mode.

Signed-off-by: Michael Riss <Michael.Riss@gmx.de>
Fixed the following problems in the perror function:
- putc is not declared -> replaced by fputc
- puts was used to output the user message which automatically
  introduced an unwanted newline between user message and error
  description -> replaced by fputs which does not add the newline

Signed-off-by: Michael Riss <Michael.Riss@gmx.de>
Merge branch 'perrorFix' into incoming
Merge branch 'selectFix' into incoming
prepare jpeg as well as jpg
fix gl flush assertion
fix and test glIsProgram
set alpha to false in WebGL rendering - it represents the screen, so no alpha is needed
memory checks for glReadPixels
ensure no writes out of the buffer area in glReadPixels
improve glIsProgram testing
Merge branch 'incoming' of https://github.com/kripken/emscripten.git into incoming
show version and git revision in emcc --version
disable closure if debug info was requested (-g)
use registerize only when not keeping debug, and also use it when closure is disabled, not just ASM_JS mode (which is just one case where closure is disabled)
fix registerize bug on functions with arguments but no locals
default closure to off in all optimization levels - we rely on registerize for much faster effects on runtime speed
remove no longer needed --closure 0 from some tests
remove not-yet-needed assert in addFunction
remove asm memory masking per the new spec