Cleaned up availability javascript