var Corners = {
  all: function(element) {
    Corners.topBoth(element);
    Corners.bottomBoth(element);
  },

  topBoth: function(element) {
    Corners.topLeft(element);
    Corners.topRight(element);
  },

  bottomBoth: function(element) {
    Corners.bottomLeft(element);
    Corners.bottomRight(element);
  },

  topLeft: function(element) {
    var image = Corners.buildCorner('top-left');
    image.style.top = 0;
    image.style.left = 0;
    Corners.addCorner(element, image);
  },
  
  topRight: function(element) {
    var image = Corners.buildCorner('top-right');
    image.style.top = 0;
    image.style.right = 0;
    Corners.addCorner(element, image);
  },
  
  bottomLeft: function(element) {
    var image = Corners.buildCorner('bottom-left');
    image.style.bottom = 0;
    image.style.left = 0;
    Corners.addCorner(element, image);
  },

  bottomRight: function(element) {
    var image = Corners.buildCorner('bottom-right');
    image.style.bottom = 0;
    image.style.right = 0;
    Corners.addCorner(element, image);
  },

  buildCorner: function(position) {
    var image = document.createElement('img');
    image.setAttribute('src', '/css/images/corner-' + position + '.gif');
    image.style.position = 'absolute';    
    return image;
  },

  addCorner: function(element, image) {
    if (!document.all) {
      element.style.position = 'relative';
      element.appendChild(image);
    }
  }
}

