JavaScript Utility Functions