You need to include fnLDAPQuery() in the script. Use the last one posted in the link.