dynamic loading javascript and css, with a callback executed on resource loaded