Replace findPos with a compatible function using Prototype's built in method