// depends on common.js: QQ
QQ.Element = function(){

  return {
  	// returns element, id might be element itself or id of the element
    getObject: function(id){
      if (obj(id) != null) return obj(id);
      else return id;
    },
		// returns the element that triggered the event
		getEventObject: function(evt){
			if (evt.srcElement !== undefined) return event.srcElement;  // for IE7
			return evt.target; // for other browsers
		},
    getSize: function(id){
			var object = this.getObject(id);
			
      var Size = {};
			Size.width = object.scrollWidth;
			Size.height = object.scrollHeight; 
			
			return Size;	
		},
		getWidth: function(id){
			return this.getSize(id).width;
		},
		getHeight: function(id){
			return this.getSize(id).height;
		},
		getPosition: function(id){
		  var object = this.getObject(id);
		  
      var leftOffset = object.offsetLeft;
			var topOffset = object.offsetTop;
			var parent = object.offsetParent;
			//alert(parent+" "+object);
			
			while (parent != document.body && parent != null){				
        leftOffset += parent.offsetLeft;
				topOffset += parent.offsetTop;
				parent = parent.offsetParent;				
		  }
		  
			var Position = {};
			Position.x = leftOffset;
			Position.y = topOffset; 
			
			return Position;	
		},
		getX: function(id){
			return this.getPosition(id).x;			
		},
		getY: function(id){
			return this.getPosition(id).y;		
		}
  };
}();
