use javascript to add counters for theorem environments