Javascript library to determine indefinite article
Here's a really simple one I wrote a little while ago:
https://github.com/rigoneri/indefinite-article.js
I hope it helps!
The following Javascript library by Eamon Nerbonne should be what you are looking for:
http://home.nerbonne.org/A-vs-An/AvsAn.js
This was actually created as an answer to a similar question here on SO:
https://stackoverflow.com/a/1288473/505154
The approach used here was to download Wikipedia, filter it, and create a prefix database to determine a/an, which should be more accurate than most rules-based systems. You can find more information at the following location (also linked in the above answer):
http://home.nerbonne.org/A-vs-An/
There is also a link there to an alternative implementation by Chad Kirby:
https://github.com/uplake/Articles