if (isset($options)) {
     $opt = $options;
     if ($opt == "withfriends") {
         $withvirtual = false;
     }
 }
 if ($opt == "onlyfriends") {
     $lst1 = $fac->getAllFriendGroups($usr->getUid());
 } else {
     if ($parentgroupid == -1) {
         $lst1 = $fac->getRootGroups($usr->getUid(), $withvirtual);
     }
 }
 if ($lst1 != null) {
     for ($i = 0; $i < count($lst1); $i++) {
         $fac->parseChildren($usr->getUid(), $lst1[$i]);
         $lst1[$i]->prepareForTree(-1);
         $gc->addGroup($lst1[$i]);
     }
     if ($opt == "withfriends") {
         $lst2 = $fac->getAllFriendGroups($usr->getUid());
         if ($lst2 != null) {
             for ($i = 0; $i < count($lst2); $i++) {
                 //$fac->parseChildren($usr->getUid(),$lst1[$i]);
                 //$lst1[$i]->prepareForTree(-1);
                 $gc->addGroup($lst2[$i]);
             }
         }
     }
 }
 echo application_getMessage($gc);