Just find a site that has the exact function you want and view the source....