function Album() {}

/**positions and displays the profile of DIVobject & IMGobject of the selected Image */

Album.prototype.showProfile = function(id, img) {
  var profile = document.getElementById(id);
  if (profile.style.visibility == "visible") {    return;  }

  var bigImg = document.getElementById("new_" + img.getAttribute("id"));
  bigImg.src = bigImg.getAttribute("src");
  var xy = new Array();
  xy = this.getXY(img);
  var browserWidth = document.body.clientWidth;  var browserHeight = document.body.clientHeight;

  if (xy[0] + img.width + profile.clientWidth > browserWidth) {
    profile.style.left = xy[0] - 5 - profile.clientWidth;
  } else {
    profile.style.left = xy[0] + 5 + img.width;
  }

  var totalHeight = browserHeight + this.getScrollHeight();
  if (xy[1] + profile.clientHeight > totalHeight) {
    profile.style.top = totalHeight - 5 - profile.clientHeight;
  } else {
    profile.style.top = xy[1];
  }

  profile.style.visibility = "visible";
}

Album.prototype.hideProfile = function(id) {
  var profile = document.getElementById(id);
  profile.style.visibility = "hidden";
}
/********************* * UTILITY FUNCTIONS * *********************/
/**get the xy-coordinate for a given node by iteratively summing the xy-offset of each parent object*/
Album.prototype.getXY = function(node) {
  if (node.offsetParent) {
    for (var x=0,y=0; node.offsetParent; node = node.offsetParent) {
      x += node.offsetLeft; 
      y += node.offsetTop; 
    }
    return [x,y];
  }
  return [node.x,node.y];
}

/** * get the height for the scroll area * * @returns the height for the scroll area */

Album.prototype.getScrollHeight = function() {
  // firefox
  if (typeof(window.pageYOffset) == "number") {    return window.pageYOffset;  }
  // IE
  else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
    return document.body.scrollTop;  }
}
