﻿var cur_id = null;
var hide_delay = 500;
var tstat = 0; 

var isNS4 = (document.layers) ? true : false;
var isIE4 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;

function getelementbyid(id)
{
  if (isNS4)
  {
    obj = document.layers[id];
  }
  else if (isIE4)
  {
    obj = document.all[id];
  }
  else if (isIE5 || isNS6)
  {
    obj = document.getElementById(id);
  }
  
  return(obj);
}

function get_pos(el, prop)
{
  var pos = 0;
  while (el != null)
  {
    pos += el["offset" + prop];
	el = el.offsetParent;
  }
  
  return pos;
}

function show_menu(cell, id)
{
  if (cur_id != null)
  {
    cur_id.style.visibility = "hidden";
    cur_id.style.display = "none";
    cur_id = null;
  }
  if ((cell != null) && (id != null))
  {
    id = getelementbyid('im'+id);
    id.style.left  = get_pos(cell, "Left") + "px";
    id.style.top   = get_pos(cell, "Top")  + cell.offsetHeight + "px";
    id.style.visibility = "visible";
    id.style.display = "block";
    cur_id = id;
  }
}

function hide_menu()
{
  timer1 = setTimeout("show_menu(null,null)", hide_delay);
  tstat = 1;

  return 1;
}

function cancel_hide()
{
  if (tstat == 1)
  {
    clearTimeout(timer1);
    tstat = 0;
  }

  return 1;
}
