remove massive loops in profile.php (addresses #5)
remove massive loops in profile.php (addresses #5)

- use pre-initialized associative arrays instead of separated arrays
- use GROUP BY instead of separate statements for each possible key in
  all SELECT statements
- simplify JavaScript by using functions instead of duplicated inline
  code

coffeestats/coffeestats,coffeestats/coffeestats,coffeestats/coffeestats