Using the SPiD API: Working examples for JavaScript