var g_parent,g_child;
var g_hideTimer = null;
var g_locked = false;

function $id(id)
{
 return document.getElementById(id);
}

function getPos(parentObj)
{
 var parentPos = [];
 parentPos[0] = parentObj.offsetLeft;//x
 parentPos[1] = parentObj.offsetTop;//y
 while (parentObj = parentObj.offsetParent)
 {
  parentPos[0] += parentObj.offsetLeft;
  parentPos[1] += parentObj.offsetTop;
 }
 return parentPos;
}

function showMoreSoftware(parentObj,childName)
{
 if (g_hideTimer != null)
 {
  clearTimeout(g_hideTimer);
  return;
 }
 var parentPos = getPos(parentObj);
 $id(childName).style.left = parentPos[0] + "px";
 $id(childName).style.top = parentPos[1] + 23 + "px";
 $id("lockBtn").style.left = "163px";
 parentObj.className = "active";
 $id(childName).style.display = "block";
 g_parent = parentObj;
 g_child = $id(childName);
}

function hideMoreSoftware()
{
 if (g_locked == true)
 {
  return;
 }
 else
 {
  g_hideTimer = setTimeout(function(){hidingMenu();},1);
 }
}

function hidingMenu()
{
 g_parent.className = "normal";
 g_child.style.display = "none";
 clearTimeout(g_hideTimer);
 g_hideTimer = null;
 if (g_locked == true)
 {
  $id("lockBtn").className = "drawingPin";
  g_locked = false;
 }
}

function lockMenu()
{
 if (g_locked == false)
 {
  $id("lockBtn").className = "drawingPin_2";
  $id("lockBtn").title="½â³ý¹Ì¶¨";
  g_locked = true;
 }
 else
 {
  $id("lockBtn").className = "drawingPin";
  $id("lockBtn").title="¹Ì¶¨";
  g_locked = false;
 }
}