var tm_sel = {id: 0, id2: 0, bg: '', bg2: ''};

function top_menu_select(id ,aaa)
{
  if (aaa) return;

  var tm2 = _ge("top_menu2");
  var new_tm2 = _ge("top_menu_of_"+id);

  if (!tm2 || !new_tm2) return;

  var tmp = new_tm2.cloneNode(true);
  tmp.id = "top_menu2";

  tm2.parentNode.replaceChild(tmp, tm2);
}

/*
function top_menu_bg(id, pic)
{
  var tm = _ge('top_menu_td_'+id);
  if (tm)
  {
    tm.style.backgroundImage = "url('"+pic+"')";
  }
}
*/

function top_menu_bg(id, id2, pic, pic2, m_over, aaa)
{
  if (m_over && tm_sel.id && tm_sel.id != id)
  {
    var tm = _ge('top_menu_td_'+tm_sel.id);
    if (tm)
    {
      tm.style.backgroundImage = "url('"+tm_sel.bg+"')";
    }
    var tm2 = _ge('top_menu_td_'+tm_sel.id2);
    if (tm2)
    {
      tm2.style.backgroundImage = "url('"+tm_sel.bg2+"')";
    }
  }

  if (m_over && !aaa)
  {
    tm_sel.id = id;
    tm_sel.id2 = id2;
  }
  else
  {
    if (tm_sel.id == id)
    {
      tm_sel.bg = pic;
      tm_sel.bg2 = pic2;

      return;
    }
  }

  var tm = _ge('top_menu_td_'+id);
  if (tm)
  {
    tm.style.backgroundImage = "url('"+pic+"')";
  }
  var tm2 = _ge('top_menu_td_'+id2);
  if (tm2)
  {
    tm2.style.backgroundImage = "url('"+pic2+"')";
  }
}
