function Pos(obj)
{
   this.Obj = obj;
   this.e = null;

   var IE = document.all?true:false;
   if (!IE) document.captureEvents(Event.MOUSEMOVE)
   if(obj!=null)
      this.e =(window.event) ? window.event : obj.event;
   this.IE = IE;   
   
   this.SetObject = function(o){
      this.Obj = o;
      this.e = (window.event) ? window.event : o.event;
   }

   this.ScreenY = function()
   {
      var y;
      if(this.IE)
         y = event.clientY + document.body.scrollTop;
      else 
         y = this.e.pageY;
      
      return y;
   }
   
   this.ScreenX = function()
   {
      var x;
      if(this.IE)
         x = event.clientX + document.body.scrollLeft;
      else 
         x = this.e.pageX;
     
      return x;
   }

   this.ObjX = function()
   {
      //Old use X
	   var curleft = 0;
	   var obj = this.Obj;
	   
	   if (obj.offsetParent)
	   {
		   while (obj.offsetParent)
		   {
			   curleft += obj.offsetLeft
			   obj = obj.offsetParent;
		   }
	   }
	   else if(obj.clientX)
		   curleft += obj.clientX;
   		
	   return curleft;
   }
   
   this.ObjY = function()
   {
      //Old use Y
      var curtop = 0;
      var obj = this.Obj;
      
  	   if (obj.offsetParent)
	   {
		   while (obj.offsetParent)
		   {
			   curtop += obj.offsetTop
			   obj = obj.offsetParent;
		   }
	   }
	   else if (obj.clientY)
		   curtop += obj.clientY;

      return curtop;
   }
   
   this.Y = function()
   {
      var curtop = 0;
      var oElement = this.Obj;
      
  	   if (oElement.offsetParent)
	   {
         while( oElement != null ) {
            curtop += oElement.offsetTop;
            oElement = oElement.offsetParent;
         }
	   }
	   else if (obj.clientY)
		   curtop += obj.clientY;

      return curtop;
   }

   this.X = function()
   {
	   var curleft = 0;
	   var oElement = this.Obj;

	   if (oElement.offsetParent)
	   {
		   while (oElement != null)
		   {
			   curleft += oElement.offsetLeft;
			   oElement = oElement.offsetParent;
		   }
	   }
	   else if(obj.clientX)
		   curleft += obj.clientX;

	   return curleft;
   }
   
   this.InElementX = function()
   {
	   var curleft = 0;
	   var oElement = this.Obj;

	   if (oElement.offsetParent)
	   {
         curleft += oElement.offsetLeft;
	   }
	   else if(obj.clientX)
		   curleft += obj.clientX;

	   return curleft;
   }
   
   this.InElementY = function()
   {
      var curtop = 0;
      var oElement = this.Obj;
      
  	   if (oElement.offsetParent)
	   {
         curtop += oElement.offsetTop;
	   }
	   else if (obj.clientY)
		   curtop += obj.clientY;

      return curtop;
   }
}

