function portalImageStreamCallback(pictures) {
    var anchor = document.getElementById("portalPictureEntries");   
    for(i=0; i<4; i++){
      var enclosingLink = document.createElement("a");
      enclosingLink.setAttribute("href", pictures.feed.entry[i].link[1].href);
      var pictureEntry = document.createElement("td");
      pictureEntry.className = "pictureEntry"
      enclosingLink.innerHTML += "<img style=\"margin-left:auto; margin-right:auto;\" alt=\""+pictures.feed.entry[i].summary.$t+"\"id=\"imageID_" +pictures.feed.title.$t+"_"+i+ "\" onload=\"imageLoaded('imageID_"+pictures.feed.title.$t+"_"+i+"');\" class=\"reflect rheight23 ropacity40\"  src=\"" + pictures.feed.entry[i].media$group.media$thumbnail[0].url.replace("s72", "s144") + "\" />";
      pictureEntry.appendChild(enclosingLink);
      anchor.appendChild(pictureEntry);
    }
}


function loadPortalAlbum() {
  var url = "http://picasaweb.google.com/data/feed/api/user/saschah/albumid/5086729064923376513?authkey=bkQ0NPXqGvY&alt=json-in-script&callback=portalImageStreamCallback";
  var oldScriptElement = document.getElementById("imageLoadingScriptElement");
  if(oldScriptElement != undefined){
    oldScriptElement.parentNode.removeChild(oldScriptElement);
  }
  var scriptNode = document.createElement("script");
  scriptNode.setAttribute("id", "imageLoadingScriptElement");
  scriptNode.setAttribute("type", "text/JavaScript");
  scriptNode.setAttribute("src", url);
  document.documentElement.firstChild.appendChild(scriptNode);
}