This type of technology can not (or at least should not) be run through a client-side language such as Javascript. You would need to use PHP or ASP depending on the programming language your server uses. There is also a third party option being tested by Microsoft, available for use on web sites for free, called
Asirra