function showGroup(groupUid, back){

   if (back == undefined){back = false}

   userUpdates = DB.child("users/"+userUuid+"/entityNotifications/"+activeEntity.entity+"/"+activeEntity.uid);

   userUpdates.once('value', function(data) {
      userUpdatesSet = data.child("ownerCalls").exists();
   });

   setAcitveEntity("groups", groupUid);

   if(!back){
      setUrl("group", groupUid);
   }

   var showGroupCallback = function(dataSnapshot){
      var title = dataSnapshot.val().title;
      renderTemplate("#groupHeaderTitle-tmpl", {group: title}, "#headerTitle");
      renderTemplate("#headerMenu-tmpl", {chatUid: groupUid, entityType: "groups"}, "#headerMenu");
      //    getLocalNotifications();
      if (userUpdatesSet) {
         $("#globalNotificationsSub").css("color", activeColor);
      } else {
         $("#globalNotificationsSub").css("color", inactiveColor);
      }
   };

   setAcitveEntity("groups", groupUid, "value", showGroupCallback);

   isMembership();

   DB.child("groups/"+groupUid).once("value", showGroupCallback);
   showGroupTopics (groupUid);

   $("footer").html("");
}


//show group topics
function showGroupTopics(groupUid){
   //get group topics

   DB.child("groups/"+ groupUid.toString()+"/topics").on("value",function(topics){

      if(topics.exists()){

         var topicsUnderGroup = topics.val();
         var numberOfTopics = Object.keys(topicsUnderGroup).length;
         var topicsArray = new Array();

         var i = 1;

         topics.forEach(function(topic){

            DB.child("topics/"+topic.key).once("value", function(data){

               var preContext = new Object();

               if (data.exists()){

                  var title = data.val().title;
                  var description = data.val().description;
                  //          console.log("t: "+ title + ", d: "+ description);

                  preContext = {
                     uuid: topic.key,
                     title: title,
                     description: description
                  }

                  topicsArray.push(preContext);
               }

               if (i === numberOfTopics){
                  var context = {groups: topicsArray};
                  renderTemplate("#groupPage-tmpl", context, "wrapper");
                  $("wrapper").hide();
                  $("wrapper").fadeIn();
               }

               i++;
            })
         })
      } else {
         renderTemplate("#groupPage-tmpl",{}, "wrapper");
      }
   });
}

@@ -24,309 +24,49 @@
 pUid
-, back
 )%7B%0A%0A   
-if (back == undefined)%7Bback = false%7D%0A%0A   userUpdates = DB.child(%22users/%22+userUuid+%22/entityNotifications/%22+activeEntity.entity+%22/%22+activeEntity.uid);%0A%0A   userUpdates.once('value', function(data) %7B%0A      userUpdatesSet = data.child(%22ownerCalls%22).exists();%0A   %7D);%0A%0A   setAcitveEntity
+//show header%0A%0A   DB.child
 (%22groups
 %22, g
@@ -53,35 +53,35 @@
 DB.child(%22groups
-%22, 
+/%22+
 groupUid);%0A%0A   i
@@ -77,91 +77,22 @@
 Uid)
-;%0A%0A   if(!back)%7B%0A      setUrl(%22group%22, groupUid);%0A   %7D%0A%0A   var showGroupCallback = 
+.once(%22value%22,
 func
@@ -368,24 +368,26 @@
 ications();%0A
+//
       if (us
@@ -402,16 +402,18 @@
 sSet) %7B%0A
+//
         
@@ -465,24 +465,26 @@
 tiveColor);%0A
+//
       %7D else
@@ -478,32 +478,34 @@
 /      %7D else %7B%0A
+//
          $(%22#glo
@@ -559,23 +559,94 @@
 r);%0A
+//
       %7D
+%0A%0A      isMembership();
 %0A   %7D
+)
 ;%0A%0A
+   //show footer%0A   $(%22footer%22).html(%22%22);%0A%0A//
    s
@@ -714,114 +714,367 @@
 );%0A%0A
-   isMembership();%0A%0A   DB.child(%22groups/%22+groupUid)
+%0A%0A%0A   showGroupTopics (groupUid);%0A%0A%0A%0A   //   if (back == undefined)%7Bback = false%7D%0A%0A//   userUpdates = DB.child(%22users/%22+userUuid+%22/entityNotifications/%22+activeEntity.entity+%22/%22+activeEntity.uid);%0A//%0A//   userUpdates
 .once(
-%22
+'
 value
-%22, showGroupCallback);%0A   showGroupTopics (
+', function(data) %7B%0A//      userUpdatesSet = data.child(%22ownerCalls%22).exists();%0A//   %7D);%0A%0A%0A%0A//   if(!back)%7B%0A//      setUrl(%22group%22, 
 grou
@@ -1084,33 +1084,14 @@
 d);%0A
-%0A   $(%22footer%22).html(%22%22);
+//   %7D
 %0A%7D%0A%0A

group 1