/**
 * core.js
 *
 * Version history (please keep backward compatible):
 * 1.0, 2007-12-19: Thomas Schedler
 *
 * @author Thomas Schedler <tsh@massiveart.com>
 * @version 1.0
 */

var Core = Class.create({

  initialize: function() {},

  /**
   * putCenter
   */
  putCenter: function(item) {
    item = $(item);
    var xy = item.getDimensions();
    var win = this.windowDimensions();
    var scrol = this.scrollOffset();
    item.style.left = (win[0] / 2) + scrol[0] - (xy.width / 2) + "px";
    item.style.top = (win[1] / 2) + scrol[1] - (xy.height / 2) + "px";
  },

  /**
   * fullScreen
   */
  fullScreen: function(item) {
    item = $(item);
    var win = this.windowDimensions();
    var scroll = this.scrollOffset();
    item.style.height = scroll[1] + win[1] + "px";
  },

  /**
   * windowDimensions
   */
  windowDimensions: function() {
    var x, y;
    if (self.innerHeight) {
      // all except Explorer
      x = self.innerWidth;
      y = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
      // Explorer 6 Strict Mode
      x = document.documentElement.clientWidth;
      y = document.documentElement.clientHeight;
    } else if (document.body) {
      // other Explorers
      x = document.body.clientWidth;
      y = document.body.clientHeight;
    }
    if (!x) x = 0;
    if (!y) y = 0;
    arrayWindowSize = new Array(x,y);
    return arrayWindowSize;
  },

  /**
   * scrollOffset
   */
  scrollOffset: function() {
    var x, y;
    if (self.pageYOffset) {
      // all except Explorer
      x = self.pageXOffset;
      y = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
      // Explorer 6 Strict
      x = document.documentElement.scrollLeft;
      y = document.documentElement.scrollTop;
    } else if (document.body) {
      // all other Explorers
      x = document.body.scrollLeft;
      y = document.body.scrollTop;
    }
    if (!x) x = 0;
    if (!y) y = 0;
    arrayScrollOffset = new Array(x,y);
    return arrayScrollOffset;
  }
});

/**
 * initialize Core Object
 */
var myCore = new Core();
