Cross-browser function for getting elements by its class name, always returning array