// old code for Opera browser removed, 13.07.2007/SD

function CM_Pos (x, y) { 
  this.x = (!x) ? 0: x;
  this.y = (!y) ? 0: y;
}

function CM_Box (x, y, width, height) { 
  this.x = (!x) ? 0: x;
  this.y = (!y) ? 0: y;
  this.width = (!width) ? 0: width;
  this.height = (!height) ? 0: height;
}

function CM_setPos ( obj, /* CM_Pos */ pos ) {
		/* not for NS4 if (document.layers) {
		}
		else */
		
		if (document.all) {
			obj.style.pixelLeft = pos.x + document.body.scrollLeft;
			obj.style.top       = pos.y + document.body.scrollTop;
		}
		else if (document.getElementById) {
			obj.style.left = pos.x + 'px';
			obj.style.top  = pos.y + 'px';
		}

}

function CM_getBox ( obj ) {
		var box = new CM_Box;

		/* not for NS4 if (document.layers) {
		}
		else */
		
		if (document.all || document.getElementById) {
		  recursive_obj = obj;
				box.width = obj.offsetWidth;
				box.height = obj.offsetHeight;
				while (recursive_obj) {
				  box.x += parseInt(recursive_obj.offsetLeft);
				  box.y += parseInt(recursive_obj.offsetTop);
						recursive_obj = recursive_obj.offsetParent;
				}
		}
		/* may be but does not work for td and not correct for some div
		else if (document.getElementById) {
		  var _styles = document.defaultView.getComputedStyle(obj, '');
				// alert (_styles.getPropertyValue('left') );  ... "auto"
				box.x = parseInt( _styles.getPropertyValue('left') );
				box.y = parseInt( _styles.getPropertyValue('top') );
				box.width = parseInt( _styles.getPropertyValue('width') );
				box.height = parseInt( _styles.getPropertyValue('height') );
		} */
  // window.status = box.x + ", " + box.y + ", " + box.width + ", " + box.height;
  return box;
}
