Dog gif javascript functional