// für lars: x heisst hier nicht, dass die funktion gelöscht wir
function displayEnvironment() {
  show("userData");
  show("postings_top");
  show("teaser");
  show("postNavi");
  show("postings");
  show("furtherInformation_parent");
  show("featuring");
}

function xshow($sFrame) {
  // reset all to false;
  Plappadu.Environment.showPublicTimeline = false;
  Plappadu.Environment.showAlienProfile = false;
  Plappadu.Environment.showHome = false;
  Plappadu.Environment.showMyFollowers = false;
  Plappadu.Environment.showMyFriends = false;
  Plappadu.Environment.showMyFavorites = false;
  Plappadu.Environment.showAlienFriends = false;
  Plappadu.Environment.showAlienFollowers = false;
  Plappadu.Environment.showMyDirectMessages = false;
  Plappadu.Global.doRefresh = false;

  if ($sFrame == "alienProfile") {
    if (Plappadu.Environment.showAlienProfileNick == Plappadu.Environment.User.nickname) {
      xshow("home");
    } else {
      Plappadu.Environment.showAlienProfile = true;
    }
  } else if ($sFrame == "publicTimeline") {
    Plappadu.Environment.showPublicTimeline = true;
    Plappadu.Global.doRefresh = true;
  } else if ($sFrame == "home") {
    Plappadu.Environment.showHome = true;
  } else if ($sFrame == "myFriends") {
    Plappadu.Environment.showHome = true;
    Plappadu.Environment.showMyFriends = true;
  } else if ($sFrame == "myFollowers") {
    Plappadu.Environment.showHome = true;
    Plappadu.Environment.showMyFollowers = true;
  } else if ($sFrame == "myFavorites") {
    Plappadu.Environment.showHome = true;
    Plappadu.Environment.showMyFavorites = true;
  } else if ($sFrame == "alienFriends") {
    Plappadu.Environment.showAlienProfile = true;
    Plappadu.Environment.showAlienFriends = true;
  } else if ($sFrame == "alienFollowers") {
    Plappadu.Environment.showAlienProfile = true;
    Plappadu.Environment.showAlienFollowers = true;
  } else if ($sFrame == "myDirectMessages") {
    Plappadu.Environment.showHome = true;
    Plappadu.Environment.showMyDirectMessages = true;
  }
  displayEnvironment();
}

function show($sId) {
  // Plappadu.log(Plappadu);
  // Plappadu.log("show(" + $sId + ")");

  var $nElement = document.getElementById($sId);
  if($nElement != null) {
    cleanNode($nElement);

    var $html = '';

    // NAVI
    if ($sId === "postings_top") {
      $html += '<span class="navi">';
      if (Plappadu.Environment.User.isLoggedIn === false) {
        $html += '  <a href="javascript:void(0);" onclick="xshow(\'publicTimeline\');">alle Zeilen</a> | ';
        $html += '  <a href="javascript:void(0);" onclick="showMainNavi(\'/public/empfehlen.php\');">Freunde einladen</a> | ';
        $html += '  <a href="javascript:void(0);" onclick="showMainNavi(\'/public/impressum.php\');">Impressum</a> | ';
        $html += '  <a href="javascript:void(0);" onclick="showMainNavi(\'/public/agb.php\');">AGB</a> | ';
        $html += '  <a href="javascript:void(0);" onclick="showMainNavi(\'/presse/presse.php\');">Presse</a>';
      } else if (Plappadu.Environment.User.isLoggedIn === true) {
        $html +=  '  <a href="javascript:void(0);" onclick="xshow(\'publicTimeline\');">alle Zeilen</a> | ';
        $html +=  '  <a href="javascript:void(0);" onclick="xshow(\'home\');">meine Freunde und ich</a> | ';
        $html +=  '  <a href="javascript:void(0);" onclick="showMainNavi(\'/public/empfehlen.php\');">Freunde einladen</a> |';
        $html +=  '  <a href="javascript:void(0);" onclick="showMainNavi(\'/public/settings.php\');">mein Profil</a> |';
        $html +=  '  <a href="" onclick="logout();">Ausloggen</a>';
      }
      $html += '</span>';
      $nElement.innerHTML = $html;
    }
  }
  // TEASER
  if ($sId === "teaser") {
    if (Plappadu.Environment.showMyFriends === true) {
      $html += '<h1>Freunde von ' + Plappadu.Environment.User.nickname + '</h1>';
    } else if (Plappadu.Environment.showMyFollowers === true) {
      $html += '<h1>Verfolger von ' + Plappadu.Environment.User.nickname + '</h1>';
    } else if (Plappadu.Environment.showMyFavorites === true) {
      $html += '<h1>Favoriten von ' + Plappadu.Environment.User.nickname + '</h1>';
    } else if (Plappadu.Environment.showAlienFriends === true) {
      $html += '<h1>Freunde von ' + Plappadu.Environment.Alien.nickname + '</h1>';
    } else if (Plappadu.Environment.showAlienFollowers === true) {
      $html += '<h1>Verfolger von ' + Plappadu.Environment.Alien.nickname + '</h1>';
    } else if (Plappadu.Environment.showAlienProfile === true) {
      $html += '<h1>Was tut ' + Plappadu.Environment.showAlienProfileNick + '? Und die Freunde von ' + Plappadu.Environment.showAlienProfileNick +'?</h1>';
    } else if (Plappadu.Environment.showPublicTimeline === true) {
      $html += '<h1>'+Plappadu.Environment.Channel.oChannel.headline1+'</h1>';
      if(Plappadu.Environment.Channel.oChannel.subline1 != "") {
        $html += '<h3>'+Plappadu.Environment.Channel.oChannel.subline1+'</h3>';
      }
    } else if (Plappadu.Environment.User.isLoggedIn === true) {
      $html +=  '<h1>'+Plappadu.Environment.Channel.oChannel.headline2+'</h1>';
      $html += '<span class="addIcon"><a href="javascript:void(0);" onclick="toggleNode(\'iconBar\');">Icon hinzufügen</a></span>';
      $html += '<div id="iconBar" style="display: none;">';
      var $suffix = '.png';
      if (Plappadu.Utils.Browser.isIE6) {
        $suffix = '.gif';
      }
      for (var $i = 1; $i <= 24; $i++) {
        $html += '  <div class="icon"><a href="javascript:void(0);" onclick="addEmoticon(\'' + $i + '\');"><img src="/img/emoticons/' + $i + $suffix +'" alt="" border="0"/></a></div>';
      }
      $html += '</div>';
      $html += '<div class="postingsUser">';
      $html += '  <div class="avatar"><a href="/' + Plappadu.Environment.User.nickname + '"><img src="' + Plappadu.Environment.User.avatarPath + '"/></a></div>';
      $html += '  <form id="form2post" onsubmit="sendPosting(); return false;">';
      $html += '    <textarea id="text2post" name="text2post" onkeyup="proofPostSigns();"></textarea>';
      $html += '    <input type="hidden" name="emoticon" value="" id="emoticon"/>';
      $html += '    <input type="hidden" name="channelId" value="'+Plappadu.Environment.Channel.oChannel.channelId+'"/>';
      $html += '    <span class="button submit">';
      $html += '      <input type="submit" value="senden"/>';
      $html += '    </span>';
      $html += '    <span class="button submit" style="margin-right: 5px; display: none;" id="removeIconSpan">';
      $html += '      <input type="button" value="Icon löschen" onclick="removeEmoticon();"/>';
      $html += '    </span>';
      $html += '    <span id="signs2post"><span id="signNumber">0</span> von 130 Zeichen</span>';
      $html += '  </form>';
      $html += '</div>';
    }
    $nElement.innerHTML = $html;
    try { document.getElementById("text2post").focus(); } catch(oe) {}
  }

  // NAVI
  if ($sId === "postNavi") {
    if (Plappadu.Environment.showMyFriends === true) {
      $html += '';
    } else if (Plappadu.Environment.showMyFollowers === true) {
      $html += '';
    } else if (Plappadu.Environment.showMyFavorites === true) {
      $html += '';
    } else if (Plappadu.Environment.showAlienFriends === true) {
      $html += '';
    } else if (Plappadu.Environment.showAlienFollowers === true) {
      $html += '';
    } else if (Plappadu.Environment.showAlienProfile === true) {
      if (Plappadu.Environment.Alien.postNaviState == null || Plappadu.Environment.Alien.postNaviState == "actual") {
        $html += '  <span class="active">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.Alien.postNaviState = \'actual\'; show(\'postings\'); show(\'postNavi\');">aktuell</a>';
        $html += '  </span>';
        $html += '  <span class="inactive">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.Alien.postNaviState = \'archive\'; Plappadu.Environment.Alien.postNaviPage = 0; show(\'postings\'); show(\'postNavi\');">mit Freunden</a>';
        $html += '  </span>';

      } else if (Plappadu.Environment.Alien.postNaviState == "archive") {
        var $oPages = ResourceLoader.getJsonObject('/json/ajax_getRecentPostingsWithFriendsPages.php?nickname=' + Plappadu.Environment.showAlienProfileNick);
        $html += '  <span class="inactive">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.Alien.postNaviState = \'actual\'; show(\'postings\'); show(\'postNavi\');">aktuell</a>';
        $html += '  </span>';
        $html += '  <span class="active">';
        if (Plappadu.Environment.Alien.postNaviPage > 0) {
          $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.Alien.postNaviState = \'archive\'; Plappadu.Environment.Alien.postNaviPage--; show(\'postings\'); show(\'postNavi\');">&lt;</a>';
        }
        $html += '    <span style="font-weight:bold;">mit Freunden</span>';
        if (($oPages.num - 1) > Plappadu.Environment.Alien.postNaviPage) {
          $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.Alien.postNaviState = \'archive\'; Plappadu.Environment.Alien.postNaviPage++; show(\'postings\'); show(\'postNavi\');">&gt;</a>';
        }
        $html += '  </span>';

      }
    } else if (Plappadu.Environment.showPublicTimeline === true) {
      $html += '';
    } else if (Plappadu.Environment.showMyDirectMessages === true) {
      $html += '  <span class="active">';
      $html += '    EINGANG';
      $html += '  </span>';
      $html += '  <span class="inactive">';
      $html += '    AUSGANG';
      $html += '  </span>';
    } else if (Plappadu.Environment.User.isLoggedIn === true) {
      if (Plappadu.Environment.User.postNaviState == null || Plappadu.Environment.User.postNaviState == "actual") {
        $html += '  <span class="active">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.User.postNaviState = \'actual\'; show(\'postings\'); show(\'postNavi\');">aktuell</a>';
        $html += '  </span>';
        $html += '  <span class="inactive">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.User.postNaviState = \'archive\'; Plappadu.Environment.User.postNaviPage = 1; show(\'postings\'); show(\'postNavi\');">Archiv</a>';
        $html += '  </span>';

      } else if (Plappadu.Environment.User.postNaviState == "archive") {
        var $oPages = ResourceLoader.getJsonObject('/json/ajax_getRecentPostingsWithFriendsPages.php');
        $html += '  <span class="inactive">';
        $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.User.postNaviState = \'actual\'; show(\'postings\'); show(\'postNavi\');">aktuell</a>';
        $html += '  </span>';
        $html += '  <span class="active">';
        if (Plappadu.Environment.User.postNaviPage > 1) {
          $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.User.postNaviState = \'archive\'; Plappadu.Environment.User.postNaviPage--; show(\'postings\'); show(\'postNavi\');">&lt;</a>';
        }
        $html += '    <span style="font-weight:bold;">Archiv</span>';
        if (($oPages.num - 1) > Plappadu.Environment.User.postNaviPage) {
          $html += '    <a href="javascript:void(0);" onclick="Plappadu.Environment.User.postNaviState = \'archive\'; Plappadu.Environment.User.postNaviPage++; show(\'postings\'); show(\'postNavi\');">&gt;</a>';
        }
        $html += '  </span>';

      }
    } else if (Plappadu.Environment.User.isLoggedIn === false) {
      $html += '';
    }
    $nElement.innerHTML = $html;
  }

  // POSTINGS
  if ($sId === "postings") {
    var $oPostings = null;

    if (Plappadu.Environment.showMyFriends === true) {
      $oPostings = ResourceLoader.getJsonObject("/json/ajax_getFriends.php?userId="+Plappadu.Environment.User.userId);
    } else if (Plappadu.Environment.showMyFollowers === true) {
      $oPostings = ResourceLoader.getJsonObject("/json/ajax_getFollowers.php?userId="+Plappadu.Environment.User.userId);
    } else if (Plappadu.Environment.showMyFavorites === true) {
      $oPostings = ResourceLoader.getJsonObject("/json/ajax_getFavorites.php?userId="+Plappadu.Environment.User.userId);
    } else if (Plappadu.Environment.showAlienFriends) {
      $oPostings = ResourceLoader.getJsonObject("/json/ajax_getFriends.php?userId="+Plappadu.Environment.Alien.userId);
    } else if (Plappadu.Environment.showAlienFollowers) {
      $oPostings = ResourceLoader.getJsonObject("/json/ajax_getFollowers.php?userId="+Plappadu.Environment.Alien.userId);
    } else if (Plappadu.Environment.showAlienProfile === true) {
      if (Plappadu.Environment.Alien.postNaviState == null || Plappadu.Environment.Alien.postNaviState == "actual") {
        $oPostings = getPostings('alien', null, 0, Plappadu.Environment.showAlienProfileNick, null, null);
      } else if (Plappadu.Environment.Alien.postNaviState == "archive") {
        $oPostings = getPostings('alien', null, Plappadu.Environment.Alien.postNaviPage, Plappadu.Environment.showAlienProfileNick, true, null);
      }
    } else if (Plappadu.Environment.showPublicTimeline === true) {
      $oPostings = getPostings("all", null, null, null, null, null);
    } else if (Plappadu.Environment.User.isLoggedIn === true) {
      if (Plappadu.Environment.User.postNaviState == null || Plappadu.Environment.User.postNaviState == "actual") {
        $oPostings = getPostings('mine', null, 0, null, null, null);
      } else if (Plappadu.Environment.User.postNaviState == "archive") {
        $oPostings = getPostings('mine', null, Plappadu.Environment.User.postNaviPage, null, true, null);
      }
    }

    if ($oPostings != null) {
      createPostings($oPostings);
    }
    try { document.getElementById("text2post").focus(); } catch(oe) {}
  }

  // USER
  if ($sId === "userData") {
    if (Plappadu.Environment.showAlienProfile === true) {
      $nElement.className = 'userLogout';
      $html += '<div id="udTop"></div>';
      $html += '<div id="udLogo">';
      if(Plappadu.Environment.Skin.boxLogoImg != "") {
        $html += '<img src="'+Plappadu.Environment.Skin.boxLogoImg+'" style="padding-left: 10px;"/>';
      }
      $html += '</div>';
      $html += '<div id="udMain" class="loggedUser"><strong>Profil von</strong><br/>';
      $html += '  <a href="/' + Plappadu.Environment.Alien.nickname + '" class="user">' + Plappadu.Environment.Alien.nickname + '</a>';
      $html += '  <div class="alienProfile">';
      if (Plappadu.Environment.Alien.oneLineBio != null && Plappadu.Environment.Alien.oneLineBio != "") {
        $html += '<span class="alienProfileLabel">Bio:</span> ' + Plappadu.Environment.Alien.oneLineBio + '<br/>';
      }
      if (Plappadu.Environment.Alien.placeInWorld != null && Plappadu.Environment.Alien.placeInWorld != "") {
        $html += '<span class="alienProfileLabel">Ort:</span> ' + Plappadu.Environment.Alien.placeInWorld + '<br/>';
      }
      if (Plappadu.Environment.Alien.fiURL != null && Plappadu.Environment.Alien.fiURL != "") {
        $html += '<span class="alienProfileLabel">Web:</span> ' + Plappadu.Environment.Alien.fiURL + '<br/>';
      }

      $html += '  </div>';
      $html += '  <div class="userContactsData" id="userContactsData" style="margin-bottom: 0px;">';
      $html += '    <a href="javascript:void(0);" onclick="xshow(\'alienFriends\');" class="friends">' + Plappadu.Environment.Alien.numberOfFriends + ' Freund' + ((Plappadu.Environment.Alien.numberOfFriends != 1) ? "e" : "") + '</a>';
      $html += '    <a href="javascript:void(0);" onclick="xshow(\'alienFollowers\');" class="follower">' + Plappadu.Environment.Alien.numberOfFollowers + ' Verfolger</a>';
      $html += '    <a href="javascript:void(0);" class="updates" style="cursor: default;">' + Plappadu.Environment.Alien.numberOfPostings + ' plapp' + ((Plappadu.Environment.Alien.numberOfPostings != 1) ? "s" : "") + '</a>';
      $html += '  </div>';
      // Freundschaft beenden / Zum Freund machen
      $html += ResourceLoader.getContent('/json/ajax_getAlienAction.php?nickname=' + Plappadu.Environment.Alien.nickname, null);
      // Freundesliste anzeigen
      $html += '  <div class="userContactsData" id="userFriendsList">';
      $html += '  </div>';
      $html += '</div>';
      $html += '<div id="udBottom"></div>';
      // TODO: ne ganze menge
      $html += '';
    } else if (Plappadu.Environment.User.isLoggedIn === true) {
      $nElement.className = 'userLogout';
      $html += '<div id="udTop"></div>';
      $html += '<div id="udLogo">';
      if(Plappadu.Environment.Skin.boxLogoImg != "") {
        $html += '<img src="'+Plappadu.Environment.Skin.boxLogoImg+'" style="padding-left: 10px;"/>';
      }
      $html += '</div>';
      $html += '<div id="udMain" class="loggedUser"><strong>Willkommen,</strong><br/>';
      $html += '  <a href="javascript:void(0);" onclick="xshow(\'home\');" class="user">' + Plappadu.Environment.User.name + '</a>';
      $html += '  <div class="userContactsData" id="userContactsData">';
      if (Plappadu.Environment.User.userId == 1) {
        Plappadu.Environment.User.numberOfDirectMessages = 0;
        $html += '    <a href="javascript:void(0);" onclick="xshow(\'myDirectMessages\');" class="directMessages">' + Plappadu.Environment.User.numberOfDirectMessages + ' ' + ((Plappadu.Environment.User.numberOfDirectMessages != 1) ? "Direkte plapps" : "Direkter plapp") + '</a>';
      }
      $html += '    <a href="javascript:void(0);" onclick="xshow(\'myFavorites\');" class="favorites">' + Plappadu.Environment.User.numberOfFavorites + ' Favorit' + ((Plappadu.Environment.User.numberOfFavorites != 1) ? "en" : "") + '</a>';
      $html += '    <a href="javascript:void(0);" onclick="xshow(\'myFriends\');" class="friends">' + Plappadu.Environment.User.numberOfFriends + ' Freund' + ((Plappadu.Environment.User.numberOfFriends != 1) ? "e" : "") + '</a>';
      $html += '    <a href="javascript:void(0);" onclick="xshow(\'myFollowers\');" class="follower">' + Plappadu.Environment.User.numberOfFollowers + ' Verfolger</a>';
      $html += '    <a href="javascript:void(0);" class="updates" style="text-decoration: underline;" onclick="alert(\'Bald kannst Du hier Deine eigenen Plapps verwalten.\')">' + Plappadu.Environment.User.numberOfPostings + ' plapp' + ((Plappadu.Environment.User.numberOfPostings != 1) ? "s" : "") + '</a>';
      $html += '  </div>';
      $html += '  <div class="userContactsData" id="userFriendsList">';
      $html += '  </div>';
      $html += '</div>';
      $html += '<div id="udBottom"></div>';
    } else if (Plappadu.Environment.User.isLoggedIn === false) {
      if($nElement != null) {
        $nElement.className = 'userLogout';
      }
      $html += '<div id="udTop"></div>';
      $html += '<div id="udLogo">';
      if(Plappadu.Environment.Skin.boxLogoImg != "") {
        $html += '<img src="'+Plappadu.Environment.Skin.boxLogoImg+'" style="padding-left: 10px;"/>';
      }
      $html += '</div>';
      $html += '<div id="udMain">';
      $html += '  <form class="login" id="loginForm" onsubmit="getUserFromServer(\'login\', this); return false;">';
      $html += '    <label for="login_user">Nickname</label>';
      $html += '    <input type="text" class="s10" name="login_user" id="login_user"/>';
      $html += '    <label for="login_pwd">Passwort</label>';
      $html += '    <input type="password" class="s10" name="login_pwd" id="login_pwd"/>';
      $html += '    <span class="button submit"><input type="submit" value="Einloggen"></span>';
      $html += '    <a href="javascript:void(0);" onclick="forgottenPass(); return false;">Passwort vergessen?</a>';
      $html += '    <br style="clear:both;"/>';
      $html += '  </form>';
      $html += '</div>';
      $html += '<div id="udBottom"></div>';
    }
    if($nElement != null) {
      $nElement.innerHTML = $html;
    }
    if (Plappadu.Environment.showAlienProfile === true || ((Plappadu.Environment.showHome === true || Plappadu.Environment.showPublicTimeline === true) && Plappadu.Environment.User.isLoggedIn === true)) {
      // show friend's list icons
      fillFriendsList();
    }
  }

  // further informations
  if ($sId === "furtherInformation_parent") {
    if (Plappadu.Environment.showAlienProfile === true) {
      // TODO: ne ganze menge
      showFurtherInformation('aActions', '/actionBoxes/alienActionBox.php?nickname=' + Plappadu.Environment.Alien.nickname);
    } else if (Plappadu.Environment.User.isLoggedIn === false) {
      // show "register now"
      if($actChannel == "fanzeile") {
        showFurtherInformation('aRegisterNow', '/actionBoxes/registerNowFanzeile.php');
      } else {
        showFurtherInformation('aRegisterNow', '/actionBoxes/registerNow.php');
      }

      showFurtherInformation('aFeaturedUser', '/actionBoxes/featuredUser.php');
      fillFeaturedUser();
    } else if (Plappadu.Environment.User.isLoggedIn === true) {
      if(Plappadu.Environment.User.status == 2) {
        // bedingung: wenn user handy bereits freigeschaltet hat
        showFurtherInformation('aSMS', '/actionBoxes/sendSMS.php');
      } else {
        // bedingung: wenn user handy noch nicht freigeschaltet hat
        showFurtherInformation('aMobile', '/actionBoxes/mobileActivation.php');
      }
      if($actChannel == "fanzeile") {
        showFurtherInformation('aFriends', '/actionBoxes/inviteFriendsFanzeile.php');
      } else {
        showFurtherInformation('aFriends', '/actionBoxes/inviteFriends.php');
      }
    }
  }

  if ($sId === "featuring") {
    var FL = Plappadu.Environment.Channel.getFeatureList();
    var $elemId = "furtherInformation_featuring";
    if(FL[0].length == 0) {
      if(document.getElementById($elemId) != null) {
        document.getElementById("furtherInformation_parent").removeChild(document.getElementById($elemId));
      }
    } else {
      if(document.getElementById($elemId) == null) {
        var $div = document.createElement("div");
        document.getElementById("furtherInformation_parent").appendChild($div);
        $div.className = "furtherInformation";
        $div.setAttribute("id", $elemId, false);
      }

      $html += '<div class="aTop"></div>';
      $html += '<div class="aMain"><strong>Featured Channel</strong>';
      $html += '  <ul style="margin: 0; padding: 0 0 0 15px;">';
      for(var i = 0; i < FL[0].length; i++) {
        $html += "    <li style=\"padding-top: 5px; list-style: none;\"><a href=\"javascript:void(0);\" onclick=\"document.location.href='http://"+FL[1][i]+".plappadu.com'\" class=\"friends\">" + FL[0][i]+"</a></li>";
      }
      $html += '  </ul>';
      $html += '</div>';
      $html += '<div class="aBottom"></div>';
      $div.innerHTML = $html;
    }
  }
}

function insertLoadedImage($oImage, $oNode, $oATag) {
  $oNode.appendChild($oImage);
  if ($oATag != null) {
    $oNode.appendChild($oATag);
  }
}

function fillFeaturedUser() {
  var $aFeaturedUser = new Array();
  var $oFeaturedUser = ResourceLoader.getJsonObject("json/ajax_getFeaturedUser.php");
  for (var $i = 0; $i < $oFeaturedUser.featuredUser.length; $i++) {
     $aFeaturedUser[$i] = [$oFeaturedUser.featuredUser[$i].nickname, $oFeaturedUser.featuredUser[$i].userId];
  }

  if (document.getElementById("furtherInformation_aFeaturedUser") != null) {
    var $oNodeToFill = document.getElementById("furtherInformation_aFeaturedUser").getElementsByTagName("ul")[0];
    for (var $i=0; $i<$aFeaturedUser.length; $i++) {
      var $li = document.createElement("li");
      $li.style.listStyle = "none";
      $li.style.paddingTop = "5px";

      var $aTag = document.createElement("a");
      $aTag.href = '/' + $aFeaturedUser[$i][0];
      var $aText = document.createTextNode($aFeaturedUser[$i][0]);
      $aTag.appendChild($aText);

      var $image = new Image();
      if (Plappadu.Utils.Browser.isIE) {
        $image.onload = Plappadu.Utils.Function.bind(function(c, d){c.appendChild(this); c.appendChild(d)}, $image, $li, $aTag);
      } else {
        $image.onload = insertLoadedImage($image, $li, $aTag);
      }
      $image.src = '/image.php?userId=' + $aFeaturedUser[$i][1] + '&width=24&height=24&type=jpg';
      $oNodeToFill.appendChild($li);
    }
  }
}

function fillFriendsList() {
  var $aFriendsList = new Array();
  var $oFriendsList = null;
  if (Plappadu.Environment.showAlienProfile === true) {
    $oFriendsList = ResourceLoader.getJsonObject('/json/ajax_getAlienFriends.php?userId=' + Plappadu.Environment.Alien.userId);
  } else {
    $oFriendsList = ResourceLoader.getJsonObject('/json/ajax_getAlienFriends.php?userId=' + Plappadu.Environment.User.userId);
  }
  for (var $i = 0; $i < $oFriendsList.friends.length; $i++) {
     $aFriendsList[$i] = [$oFriendsList.friends[$i].nickname, $oFriendsList.friends[$i].userId];
  }
  if (document.getElementById("userFriendsList") != null) {
    var $oNodeToFill = document.getElementById("userFriendsList");

    for (var $i=0; $i<$aFriendsList.length; $i++) {
      var $aTag = document.createElement("a");
      $aTag.href = '/' + $aFriendsList[$i][0];
      $aTag.style.paddingLeft = "0";
      $aTag.title = $aFriendsList[$i][0];

      var $image = new Image();

      if (Plappadu.Utils.Browser.isIE) {
        $image.style.styleFloat = "left";
      } else {
        $image.style.cssFloat = "left";
      }
      $image.style.paddingRight = "3px";
      $image.style.paddingBottom = "3px";
      $image.style.border = "none";

      if (Plappadu.Utils.Browser.isIE) {
        $image.onload = Plappadu.Utils.Function.bind(function(c){c.appendChild(this);}, $image, $aTag);
      } else {
        $image.onload = insertLoadedImage($image, $aTag, null);
      }
      $image.src = '/image.php?userId=' + $aFriendsList[$i][1] + '&width=24&height=24&type=jpg';
      $oNodeToFill.appendChild($aTag);
    }
  }
}

function showFurtherInformation($id, $contentURL) {
  var $elemId = "furtherInformation_" + $id;
  if(document.getElementById($elemId) == null) {
    var $div = document.createElement("div");
    document.getElementById("furtherInformation_parent").appendChild($div);
    $div.className = "furtherInformation";
    $div.setAttribute("id", $elemId, 0);
  }
  var $dfdiv = document.createElement("div");
  $dfdiv.innerHTML = ResourceLoader.getContent($contentURL);

  if ($dfdiv.firstChild != null) {
    document.getElementById("furtherInformation_parent").replaceChild($dfdiv.firstChild,document.getElementById($elemId));
    document.getElementById("furtherInformation_parent").style.display = "block";
  }
}

function addEmoticon($iId) {
  var $suffix = '.png';
  if (Plappadu.Utils.Browser.isIE6) {
    $suffix = '.gif';
  }
  document.getElementById("removeIconSpan").style.display = 'inline';
  document.getElementById("emoticon").value = $iId;
  document.getElementById("text2post").style.backgroundImage = 'url(/img/emoticons/' + $iId + $suffix + ')';
  document.getElementById("text2post").style.backgroundRepeat = 'no-repeat';
  document.getElementById("text2post").style.backgroundPosition = '13px 13px';
  document.getElementById("text2post").style.paddingLeft = '52px';
  document.getElementById("text2post").style.width = '405px';
  toggleNode('iconBar');
}

function removeEmoticon() {
  document.getElementById("removeIconSpan").style.display = 'none';
  document.getElementById("emoticon").value = '';
  document.getElementById("text2post").style.background = 'none';
  document.getElementById("text2post").style.paddingLeft = '2px';
  document.getElementById("text2post").style.width = '455px';
}