javascript cleanup and fixes for media plugin: TypeError in Firefox
media plugins: bug fixing: prevent 'undifined variable'