﻿function FindObjectByName(ObjName) {
  var AObj = null;
  if (document.getElementById)  //this is the way the standards work
    AObj = document.getElementById(ObjName);
  else if (document.all)        //this is the way old msie versions work
      AObj = document.all[ObjName];
  else if (document.layers)     //this is the way nn4 works
    AObj = document.layers[ObjName];
  return AObj;
}

var MapTableMouseStatus = 0;
var MousePosX = 0;

function MapTable_OnMouseDown(ev) {
  MapTableMouseStatus = 1;
  MousePosX = parseInt(ev.clientX);
  return;
}

function MapTable_OnMouseUp(ev) {
  MapTableMouseStatus = 0;
  MousePosX = 0;
  return;
}

function MapTable_OnMouseOut() {
  MapTableMouseStatus = 0;
  MousePosX = 0;
  return;
}

function MapTable_OnMouseMove(ev, ALeft, ObjName) {
  if (MapTableMouseStatus == 1) {
    var AObj = FindObjectByName(ObjName);
    if (AObj != null) {
      var IdxX = parseInt(ev.clientX);
      IdxX = IdxX - MousePosX + ALeft;
      MousePosX = parseInt(ev.clientX);
      var Wdt = parseInt(AObj.style.width);
      Wdt = Wdt + IdxX;
      if (Wdt < 150) Wdt = 150;
      if (Wdt > 750) Wdt = 750;
      AObj.style.width = Wdt + "px";
    }
  }
  return;
}
