code: function incrementOrCreateGroup(object, group, value)
  {
    if(!object[group]) object[group] = new Object();
  
    var myGroup = object[group];
  
    if(myGroup[value]) myGroup[value] += 1;
    else 		          myGroup[value] = 1;
  }
docs: Looks for a field with the given group and value in the object and if found increments it. Otherwise, creates it with a value of 1.