﻿/*
    Arrays that define the names of the sub menu pages and default pages for menu
    items (respectively)
*/
var SubMenuPages = new Array ('navhome.htm', 'navproducts.htm', 'navservices.htm', 'navsupport.htm');
var DefaultContentPages = new Array ('home.htm', 'daisy.htm', 'services.htm', 'support.htm');


/*
    Indexes into the SubMenuPages and DefaultContentPages arrays
*/
var IDX_MENU_HOME     = 0;
var IDX_MENU_PRODUCTS = 1;
var IDX_MENU_SERVICES = 2;
var IDX_MENU_SUPPORT  = 3;


/*
    Function:   DoMenuClick
    Parameters: MenuItem - One of the IDX_MENU_XXX constants
    Purpose:    Changes the information displayed in the Navigation and Content
                frames in response to a menu item click.
*/
function DoMenuClick(MenuItem)
{
    parent.Navigation.location.href = SubMenuPages[MenuItem];
    parent.Content.location.href = DefaultContentPages[MenuItem];
}


/*
    Function:   DoSubMenuClick
    Parameters: ContentPage - The URL of a page to load into the Content frame
    Purpose:    Changes the information displayed in the Content frame in 
                response to a submenu item click.
*/
function DoSubMenuClick(ContentPage)
{
    parent.Content.location.href = ContentPage;
}


/*
    Function:   SetStyle
    Parameters: ID - The 'id' attribute of an element whose CSS class is to be changed
                StyleName - The name of the CSS class to use for the element 
    Purpose:    Changes the CSS class for the element ID to be the one specified
                in StyleName. This function is typically used by the menu and submenu
                items to show/hide their hover highlighting.
*/
function SetStyle(ID, StyleName)
{
    var Element = document.getElementById(ID);
    if (Element)
    {
        Element.className = StyleName;
    }
}


/*
    Function:   PopupWindow
    Parameters: ID - The 'id' attribute of a 'DIV' element that is our popup window
                Title - The title of the popup window
                ContentPage - The URL of a page to display in the popup window
    Purpose:    Shows/hides the DIV element identified by ID. When showing, it also
                sets the title of the window to Title and loads the URL specified
                by ContentPage into the popup window. 
*/
function PopupWindow(ID, Title, ContentPage)
{
    var obj = document.getElementById(ID);
    if (ContentPage)
    {
        document.getElementById('PopupTitle').firstChild.nodeValue = Title;
        document.getElementById('PopupContents').src = ContentPage;
        obj.style.display = 'block';
    }
    else
    {
        obj.style.display = 'none';
    }
}



