function imenus_expandani_init(obj)
{
  var tid = obj.getElementsByTagName("UL")[0].id.substring(6);
  var tdto = ulm_boxa["dto" + tid];
  
  if (!(ulm_navigator && ulm_mac) && !(window.opera && ulm_mac) && !ulm_iemac && !tdto.expand_arrow_animation_disabled)
  {
    ulm_boxa["expani_go" + tid] = 1;
    ulm_boxa.expani_go = 1;
  }
  else
  {
    return;
  }
  ulm_mglobal.expani_lid = new Object();
  ulm_mglobal.expani_t = new Object();
  
  if (window.attachEvent)
  {
    document.attachEvent("onmouseover", imenus_expandani_bodyover);
  }
  else
  {
    document.addEventListener("mouseover", imenus_expandani_bodyover, false);
  }
  obj.onmouseover = function(e)
  {
    var we = e;
    
    if (!e)
    {
      we = event;
    }
    we.cancelBubble = 1;
  }
}

function imenus_expandani_bodyover()
{
  for (i in ulm_mglobal.expani_lid)
  {
    if ((uobj = ulm_mglobal.expani_lid[i]))
    {
      if (uobj.getAttribute("running"))
      {
        imenus_expandani_hideit(null, uobj, 1, i, 1);
      }
    }
  }
}

function imenus_expandani_animateit(hobj,show)
{
  var tid = parseInt(hobj.id.substring(6));
  
  if (!ulm_boxa["expani_go" + tid])
  {
    return;
  }
  var lev = hobj.level;
  var uge = ulm_mglobal.expani_lid["l" + lev];
  
  if (show)
  {
    if (mo = document.getElementById("ea" + hobj.id))
    {
      if (uge && (uge != mo))
      {
        imenus_expandani_hideit(null, uge, 1, "l" + lev);
      }
      
      if (ulm_mglobal.expani_t["l" + lev])
      {
        return;
      }
      
      if (!mo.getAttribute("mframe") || ulm_mglobal.design_mode)
      {
        var txy = parseInt(mo.style.left) + "," + parseInt(mo.style.top);
        tx = parseInt(mo.style.left);
        ty = parseInt(mo.style.top);
        
        if (!tx)
        {
          tx = 0;
        }
        
        if (!ty)
        {
          ty = 0;
        }
        mo.setAttribute("startxy", tx + "," + ty);
        mo.setAttribute("initxy", tx + "," + ty);
        var last_xy = new Array(tx,ty);
        var vid = hobj.id.substring(6);
        
        while (vid.indexOf("z") + 1)
        {
          vid = vid.replace("z", "_");
        }
        var ismain = false;
        
        if ((vid.split("_")).length == 2)
        {
          ismain = 1;
        }
        var j = 1;
        
        while (xy = imenus_expandani_gparam("expand_arrow_animation_movexy", j, ismain, vid, tid))
        {
          if ((xy.split(",")).length < 2)
          {
            j++;
            continue;
          }
          xy = eval("new Array(" + xy + ")");
          var frames = imenus_expandani_gparam("expand_arrow_animation_frames", j, ismain, vid, tid);
          
          if (!frames)
          {
            frames = 1;
          }
          xy[0] += tx;
          xy[1] += ty;
          mo.setAttribute("xy" + j, xy[0] + "," + xy[1]);
          var dx = (xy[0] - last_xy[0]) / frames;
          var dy = (xy[1] - last_xy[1]) / frames;
          mo.setAttribute("distxy" + j, dx + "," + dy);
          last_xy = xy;
          mo.setAttribute("msequences",j);
          mo.setAttribute("mframes" + j, frames);
          j++;
        }
        
        if (j == 1)
        {
          return;
        }
        mo.setAttribute("mframe",1);
        mo.setAttribute("msequence",1);
      }
      ulm_mglobal.expani_lid["l" + lev] = mo;
      
      if (ulm_mglobal.expani_t["l" + lev])
      {
        clearTimeout(ulm_mglobal.expani_t["l" + lev]);
        ulm_mglobal.expani_t["l" + lev] = null;
      }
      mo.setAttribute("startxy", mo.getAttribute("initxy"));
      mo.setAttribute("mframe",1);
      mo.setAttribute("msequence",1);
      imenus_expandani_run(mo,lev);
      return;
    }else if(uge)
    {
      imenus_expandani_hideit(null, uge, 1, "l" + lev);
    }
  }
  else
  {
    if (mo = document.getElementById("ea" + hobj.id))
    {
      if (!mo.getAttribute("running"))
      {
        if (!(hobj.className.indexOf("ishow") + 1))
        {
          imenus_expandani_hideit(null, uge, 1, "l" + lev);
        }
      }
    }
  }
}

function imenus_expandani_gparam(name,seq,ismain,id,index)
{
  if (rv = ulm_boxa["dto" + index]["s" + id + "_" + name + seq])
  {
    return rv;
  }
  else if (ismain && (rv = ulm_boxa["dto" + index]["main_" + name + seq]))
  {
    return rv;
  }
  return ulm_boxa["dto" + index][name + seq];
}

function imenus_expandani_hideit(hobj,mo,reset,lev_id,bover)
{
  if (hobj)
  {
    mo = document.getElementById("ea" + hobj.id);
  }
  
  if (mo)
  {
    if (ulm_mglobal.expani_t[lev_id])
    {
      clearTimeout(ulm_mglobal.expani_t[lev_id]);
      ulm_mglobal.expani_t[lev_id] = null;
    }
    initxy = eval("new Array(" + mo.getAttribute("initxy") + ")");
    
    if (reset)
    {
      mo.style.left = initxy[0] + "px";
      mo.style.top = initxy[1] + "px";
    }
  }
}

function imenus_expandani_run(mo,lev)
{
  mo.setAttribute("running",1);
  sxy = eval("new Array(" + mo.getAttribute("startxy") + ")");
  msequence = parseInt(mo.getAttribute("msequence"));
  msequences = parseInt(mo.getAttribute("msequences"));
  mframe = parseInt(mo.getAttribute("mframe"));
  mframes = parseInt(mo.getAttribute("mframes" + msequence));
  dxy = eval("new Array(" + mo.getAttribute("distxy" + msequence) + ")");
  mo.style.left = sxy[0] + parseInt(mframe * dxy[0]) + "px";
  mo.style.top = sxy[1] + parseInt(mframe * dxy[1]) + "px";
  
  if (mframe < mframes)
  {
    mframe++;
    mo.setAttribute("mframe",mframe);
  }
  else if (msequence < msequences)
  {
    txy = eval("new Array(" + mo.getAttribute("xy" + msequence) + ")");
    mo.style.left = txy[0] + "px";
    mo.style.top = txy[1] + "px";
    mo.setAttribute("startxy",txy[0] + "," + txy[1]);
    mo.setAttribute("mframe",1);
    msequence++;
    mo.setAttribute("msequence",msequence++);
  }
  else
  {
    mo.removeAttribute("running");
    return;
  }
  ulm_mglobal.expani_t["l" + lev] = setTimeout("imenus_expandani_run(document.getElementById('" + mo.id + "')," + lev + ")",8);
}