function initMoving(id,xleft,ytop) {
  target = document.getElementById(id);
  if (!target) return false;
  var obj = target;
  obj.initLeft = xleft;
  obj.initTop = ytop;
  obj.bottomLimit = document.documentElement.scrollHeight - 0;
  obj.topLimit = 188; 
 
  obj.style.position = "absolute";
  obj.top = obj.initTop;
  obj.left = obj.initLeft;
  obj.style.top = obj.top + "px";
  obj.style.left = obj.left + "px";
 
  obj.getTop = function() {
    if (document.documentElement.scrollTop) {
      return document.documentElement.scrollTop;
    } else if (window.pageYOffset) {
      return window.pageYOffset;
    } else {
      return 0;
    }
  }
  obj.getHeight = function() {
    if (self.innerHeight) {
      return self.innerHeight;
    } else if(document.documentElement.clientHeight) {
      return document.documentElement.clientHeight;
    } else {
      return 500;
    }
  }
  obj.move = setInterval(function() {
    pos = obj.getTop() + obj.getHeight() / 2 - 310;
 
    if (pos > obj.bottomLimit)
      pos = obj.bottomLimit
    if (pos < obj.topLimit)
      pos = obj.topLimit
 
    interval = obj.top - pos;
    obj.top = obj.top - interval / 3;
    obj.style.top = obj.top + "px";
  }, 40)
} 
