General nitpick: JS code should conform to JSLint conventions. A few things I noticed:
* spaces for `if`, `for`, etc. should always be before parens and not inside (e.g. do `if (foo)`, not `if( foo )`)
* should have spaces around operators (e.g. do `url + "?count="`, not `url+"?count="`)
* always use `===` instead of `==` (I know there are good reasons for sometimes using `==`, but we've decided to live with enforcing `===`)