
document.onmousedown=hideSubMenu;var currentSubMenu;var overSubMenu;var hoverTrigger;var subMenuTimeoutId;function unHoverSubMenu()
{if(hoverTrigger)
{var id=currentSubMenu;subMenuTimeoutId=setTimeout(function(){if(id!=null&&overSubMenu!=true)
id.style.display='none';},100);}}
function showSubMenu(id){if(subMenuTimeoutId!=0){clearTimeout(subMenuTimeoutId);subMenuTimeoutId=0;}
var newSubMenu=$get(id);hideSubMenu();if(newSubMenu!=null)
{currentSubMenu=newSubMenu;newSubMenu.style.display='block';}}
function hideSubMenu()
{if(currentSubMenu!=null&&overSubMenu!=true)
{currentSubMenu.style.display='none';currentSubMenu=null;}}
function hideTargetSubMenu(id)
{if(id!=null&&overSubMenu!=true)
id.style.display='none';}
function menu_OnMouseOver(evt,context)
{hoverTrigger=true;showSubMenu(context.childMenu);}
function menu_OnMouseClick(evt,context)
{if(currentSubMenu==$get(context.childMenu))
hideSubMenu();else
showSubMenu(context.childMenu);}
function subMenu_OnMouseOver()
{overSubMenu=true;}
function subMenu_OnMouseOut()
{overSubMenu=false;unHoverSubMenu();}
function registerPopupMenu(id,showOnHover)
{if(showOnHover){$addHandler($get("mi_"+id),'mouseover',Function.createCallback(menu_OnMouseOver,{childMenu:"sm_"+id}));$addHandler($get("mi_"+id),'mouseout',Function.createCallback(unHoverSubMenu,{childMenu:"sm_"+id}));}else
$addHandler($get("cd_"+id),'click',Function.createCallback(menu_OnMouseClick,{childMenu:"sm_"+id}));$addHandler($get("smul_"+id),'mouseover',subMenu_OnMouseOver);$addHandler($get("smul_"+id),'mouseout',subMenu_OnMouseOut);}