
var scX = 0, scY = 0;

/*
if(isMinNS4 || (isMinNS6 && IsMacOS))
  document.captureEvents(Event.MOUSEMOVE);
else if(isMinNS6)
  document.addEventListener("mousemove",document.onmousemove,true);
*/

document.onmousemove=MouseXY;

function MouseXY(evt){
  if(isMinNS4 || isMinNS6) {
    scX = evt.pageX;
    scY = evt.pageY;
  } else if(isMinIE4) {
    scX = event.clientX + document.body.scrollLeft;
    scY = event.clientY + document.body.scrollTop;
  }
}

function get(objectId) {
  return document.getElementById(objectId);
}

function getMain() {
  return document.body;
}

function create(tagName) {
  return document.createElement(tagName);
}

function Com_getWidth(object) {
  return (isMinIE || isMinNS6 ? object.offsetWidth : parseInt(object.style.width));
}

function Com_getHeight(object) {
  return (isMinIE || isMinNS6 ? object.offsetHeight : parseInt(object.style.height));
}

function preload() {
  var img;
  var arguments = preload.arguments;
  for (var i = 0; i < arguments.length; i++) {
    img = new Image(); img.src = arguments[i];
  }
}

var globalObjectId = 0;
function Com_globalObjectAccess(object, codeString) {
  var tmpObjectName;
  if ((object.classname != null) && (object.id != null)) {
    tmpObjectName = object.classname + '_' + object.id;
  } else {
    tmpObjectName = 'tmp' + globalObjectId++;
  }
  eval(tmpObjectName + '=object');
  return tmpObjectName + '.' + codeString;
}

function Com_globalObjectMethod(object, methodCodeString) {
  var tmpMethodName = Com_globalObjectAccess(object, methodCodeString);
  return function() { return eval(tmpMethodName); };
}

/* Classes */
var NODELAY = null;

function Timer(codeString, delay, object) {
  var timer = setTimeout('',0);
  this.object = object;
  if (delay != NODELAY) return this.launch(codeString, delay);
  
  this.clear = function() {
    clearTimeout(this.timer);
    return true;
  };
  
  this.launch = function(codeString, delay) {
    this.clear();
    if (this.object != null) {
      codeString = Com_globalObjectAccess(this.object, codeString);
    }
    if (delay != NODELAY) {
      this.timer = setTimeout(codeString, delay);
    } else {
      eval(codeString);
    }
  };
  
}

function _Timer() {}
_Timer.prototype = Timer.prototype;
_Timer.prototype.base = Timer.prototype.constructor;

