Refactor OCdialogs.

Fix #2557 and make the whole code more usable.
Small fixes

 * escapeHTML(everything)
 * curly braces for if
 * camelcase function_to_call
 * add missing semicolae (?)
Make directories clickable.

A bit bugged though ...
Make directories show at top.
Fix repeating directory names.

Also fix some CSS for Firefox.
Make files selectable again.
Make files _and_ directorys selectable/browsable.

Also make long variables more readable by splitting them
up into shorter ones.
Remove manual mimetype checking.
Fix OC.dialogs.form()

Don't do _too_ much escapeHTML()
Merge pull request #2758 from Kondou-ger/refactor_OCdialogs

Refactor OCdialogs.