Convert google maps snippet into function.