    writeMenus();
    
    function writeMenus()
    {
        document.write('<table id="menuTable" cellpadding="0" cellspacing="0" border="0"><tr><td>\n');
        document.write('<img src="picts/spacer.gif"><br>\n');
        document.write('</td></tr></table>\n');
        document.write('<div id="menuBackground">\n');
        document.write('<div class="parentMenu" style="left: 0pt;" onmouseover="displayMenu(event)" onmouseout="hideMenu(event)">\n');
        document.write('<a href="http://thetotalpack.com/index.htm">Home</a>\n');
        document.write('<div class="submenu"onmouseover="o[0].ShowMenu()" onmouseout="o[0].HideMenu()">\n');
        document.write('<a href="http://thetotalpack.com/index.htm">Home</a>\n');
        document.write('</div></div>\n');
        document.write('<div class="parentMenu" style="left: 125px;" onmouseover="displayMenu(event)" onmouseout="hideMenu(event)">\n');
        document.write('<a href="http://thetotalpack.com/about.html">About Us</a>\n');
        document.write('<div class="submenu"onmouseover="o[1].ShowMenu()" onmouseout="o[1].HideMenu()">\n');
        document.write('<a href="http://thetotalpack.com/about.html">About Us</a>\n');
        document.write('</div></div>\n');
        document.write('<div class="parentMenu" style="left: 250px;" onmouseover="displayMenu(event)" onmouseout="hideMenu(event)">\n');
        document.write('<a href="#">Products</a>\n');
        document.write('<div class="submenu"onmouseover="o[2].ShowMenu()" onmouseout="o[2].HideMenu()">\n');
        document.write('<a href="http://thetotalpack.com/mixing.html">Mixing & Filling Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/pcs.html">Plastic Container Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/lcts.html">Liquid Collapsible Tote Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/cws.html">Checkweighing Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/capping.html">Capping Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/labeling.html">Labeling Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/pouchbag.html">Pouch &amp; Bag Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/food.html">Food Handling Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/corrugated.html">Corrugated Machinery</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/palletizing.html">Palletizing Solutions</a><br/>\n');
        document.write('<a href="http://thetotalpack.com/custom.html">Custom Machinery</a><br/>\n');
        document.write('</div></div>\n');
        document.write('<div class="parentMenu" style="left: 375px;" onmouseover="displayMenu(event)" onmouseout="hideMenu(event)">\n');
        document.write('<a href="http://thetotalpack.com/resources.htm">Resources</a>\n');
        document.write('<div class="submenu" onmouseover="o[3].ShowMenu()" onmouseout="o[3].HideMenu()">\n');
        document.write('<a href="http://thetotalpack.com/resources.htm">Resources</a>\n');
        document.write('</div></div>\n');
        document.write('<div class="parentMenu" style="left: 500px;" onmouseover="displayMenu(event)" onmouseout="hideMenu(event)">\n');
        document.write('<a href="http://thetotalpack.com/contact.html">Contact Us</a>\n');
        document.write('<div class="submenu" onmouseover="o[4].ShowMenu()" onmouseout="o[4].HideMenu()">\n');
        document.write('<a href="http://thetotalpack.com/contact.html">Contact Us</a>\n');
        document.write('</div></div></div>\n');
    
    }
    
    
    function isMenu(element, type)
    {
        var result = false;
        // menuParent is an <li> element.
        if(element.nodeName == "DIV")
        {
            for(var i = 0; i < element.attributes.length; i++)
            {
                if((element.attributes[i].nodeName.toUpperCase() == "CLASS") &&
                   (element.attributes[i].nodeValue == type))
                {
                    result = true;
                    break;
                }
            }
        }
        return result;
    }
    
    function getParentList(e)
    {
        var element;
        if(!e) e = window.event;
        
        if (e.target) 
        {
            element = e.target;
        }
        else if (e.srcElement)       
        {
            element = e.srcElement;
        }
        
        if(element.nodeType == 3) // for a safari bug
        {
            element = element.parentNode;
        }
        
        while(!isMenu(element, "parentMenu"))
        {
            element = element.parentNode;
        }
        
        return element;
    }
       
    function getSubList(element)
    {
        var sub_list = element.lastChild;
        
        var i = 0;
        while(!isMenu(sub_list, "submenu"))
        {
            sub_list = element.childNodes[i];
            i++;
        }
        
        return sub_list;
    }
      
    
    function displayMenu(event)
    {
        var parent_list = getParentList(event);
        var element = getSubList(parent_list);
        element.style.visibility = "visible";
    }
        
    function hideMenu(event)
    {
        var parent_list = getParentList(event);
        var element = getSubList(parent_list);
        element.style.visibility = "hidden";
    }