Fixed bug in escaping playlist 'thedir' variable.
Refactoring playlist html generation.
Fixed bug in ajax calls referencing index.php