//set the object's popup display status
//INPUT:    td_object - the item contains a popup
//          popup_table - the popup table
//          display_status - the value of style.display property to be set
function set_popup_display(td_object, popup_table, display_status)
{
    if (display_status != "none")
    {
        var isIE = navigator.appName == "Microsoft Internet Explorer";
        if (popup_table.className.indexOf("popup_sub_table") != -1)
        {
            if (isIE) 
            {
                popup_table.style.left = (td_object.clientWidth + td_object.clientLeft) + "px";
                popup_table.style.top = td_object.offsetTop + "px";
            }
        }
        else
        {
            //set left position of the menu
            var popup_left = 0;
            var parent_object = td_object;
            while (parent_object.offsetParent)
            {
		        popup_left += parent_object.offsetLeft;
    		    parent_object = parent_object.offsetParent;
            }
            popup_table.style.left = (popup_left - 8) + "px";
            //set top position of the menu
            var popup_top = 0;
            var parent_object = td_object;
            while (parent_object.offsetParent)
            {
		        popup_top += parent_object.offsetTop;
    	        parent_object = parent_object.offsetParent;
            }
            popup_table.style.top = (popup_top + td_object.clientHeight - (isIE ? 17 : 16)) + "px";
        }
        if (!isIE) popup_table.style.marginLeft = "1px";
    }
    popup_table.style.display = display_status;
}
//set menu item's status to 'active' and invoke the popup menu for the item if there is one
function set_active(this_td)
{
    this_td.className = this_td.className + " active";
    //if a td has more than one child node then the second node is implied to be a child menu
    if (this_td.childNodes.length > 1) set_popup_display(this_td, this_td.childNodes[1], "inline");
}


//unset menu item's status 'active' and hide the popup menu for the item if there is one
function set_unactive(this_td)
{
    if (this_td.className == "active") this_td.className = "";
    else this_td.className = this_td.className.replace(" active", "");
    //if a td has more than one child node then the second node is implied to be a child menu
    if (this_td.childNodes.length > 1) set_popup_display(this_td, this_td.childNodes[1], "none");
}

//function delayHideMenu() { 
//setTimeout("set_unactive(xxx)",1000);
//} 

