var     ns  = (document.layers) ? true : false;                // ns4x
var     dom = (document.getElementById) ? true : false;        // DOM compatible browser (ie6+, ns6+, mozilla...)
var     ie  = (document.all) ? true : false;                   // ie4x

function        menuCss(id, cls)
{
  if (dom)
    {      
      var m = document.getElementById(id);
      if (m)
        m.className = cls;
    }
}

function	changeCss(e, cls)
{
  if (dom && e)
    e.className = cls;
}

function	setBgColor(c){
  document.body.style.backgroundColor=c;
}

function	setMgColor(c){
  document.getElementById('mg').style.backgroundColor=c;
}

function	getCoordsOfElement(e)
{
  if (!e)
    return new coords(0, 0);

  var r = new coords(e.offsetLeft, e.offsetTop);
  var l = null
  for (e = e.offsetParent; e; e = e.offsetParent) {
    //alert(e.tagName+'='+e.id);
    r.add(e.offsetLeft, e.offsetTop);
    if (e.offsetTop != 0)
     l = e;
  }
  return r;
}
function	coords(ex, ey)
{
  if (!ex)
    this.x = 0;
  else
    this.x = ex;
  if (!ey)
    this.y = 0;
  else
    this.y = ey;
  
  this.addC = function(c) { this.x += c.x; this.y += c.y; };
  this.add = function(nx, ny) {this.x += nx; this.y += ny; }
  this.addX = function(nx) { this.x += nx; };
  this.addY = function(ny) { this.y += ny; };
}
