<!--
var BROWSER_HEIGHT;
var BODY_HEIGHT;
var CURRENT_PAGE;
  //============================================================================
  //  FIND DOM
  //  This function defines which type of document object model is being used by
  //  the browser.
  //============================================================================
  var isDHTML = 0;
  var isID = 0;
  var isAll = 0;
  var isLayers = 0;

  if(document.getElementById)
  {
    isID = 1;
    isDHTML = 1;
  }
  else
  {
    if(document.all)
    {
      isAll = 1;
      isDHTML = 1;
    }
    else
    {
      browserVersion = parseInt(navigator.appVersion);
      if((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4))
      {
        isLayers = 1;
        isDHTML = 1;
      }
    }
  }

  function findDOM(objectID,withStyle)
  {
    if(withStyle == 1)
    {
      if(isID)
      {
        return(document.getElementById(objectID).style);
      }
      else
      {
        if(isAll)
        {
          return(document.all[objectID].style);
        }
        else
        {
          if(isLayers)
          {
            return(document.layers[objectID]);
          }
        }
      }
    }
    else
    {
      if(isID)
      {
        return(document.getElementById(objectID));
      }
      else
      {
        if(isAll)
        {
          return(document.all[objectID]);
        }
        else
        {
          if(isLayers)
          {
            return (document.layers[objectID]);
          }
        }
      }
    }
  }
/*************************************************************************
* $file: expander.js,v $
* $Revision: 1.0 $
* $Date: 2006/06/09 11:26:01 $
* @author Chris Potter
* @copyright Copyright © 2006, Chris Potter, All rights reserved.
*************************************************************************/
/*************************************************************************
* Initalize the menu so that it is expandable.
*************************************************************************/
function expandInit(menuDiv)
{
    // The location of the main window.
    var currentLocation = parent.location.href;
    // Get the childNodes of menuDiv
    var menus = menuDiv.childNodes;
    for (var i = 0; i < menus.length; i++)
    {
        // Get all ul lists.
        if (menus[i].nodeName == "UL")
        {
            // Get child nodes.
            var items = menus[i].childNodes;
            for (var j = 0; j < items.length; j++)
            {
                // Find list items.
                if (items[j].nodeName == "LI")
                {
                    // Get child nodes.
                    var childCount = 0;
                    var expandPoints = items[j].childNodes;
                    for (var k = 0; k < expandPoints.length; k++)
                    {
                        // Find sub lists.
                        if (expandPoints[k].nodeName == "UL")
                        {
                            childCount++;
                            // Reset displaySubMenu
                            var displaySubMenu = false;
                            // Check for current page link.
                            var links = expandPoints[k].getElementsByTagName("a")
                            for (var m = 0; m < links.length; m++)
                            {
                                if (links[m].href == currentLocation) displaySubMenu = true;
                            }
                        }
                    }
                    // If the list item has children set it to expandable
                    if (childCount > 0)
                    {
                        items[j].style.listStyleType = "none";
                        items[j].style.marginLeft = "0px";
                        // If there is a heading first set it to inline
                        if (items[j].firstChild.style != null) items[j].firstChild.style.display = "inline";
                        // Create Expand image
                        var expand = document.createElement('img');
                        expand.alt = "collapse";
                        expand.src = "http://www.byui.edu/css/v1/images/collapse.gif"; 
                        expand.style.margin = "0 0 -3px 0";
                        expand.onmouseover = new Function("this.style.cursor='pointer';");
                        expand.onmouseout = new Function("this.style.cursor='auto';");
                        expand.onclick = new Function("changeState(this);");
                        // Add expand image to the start of the list item.
                        items[j].insertBefore(expand,items[j].firstChild);
                        // If there were children and no links to the current page colapse menu
                        if (displaySubMenu == false)
                        {
                            changeState(expandPoints[0]);
                        }
                    }
                }
            }
        }
    }
}
function changeState (element)
{
    // Change Expand Image
    if (element.alt == "Expand")
    {
        element.alt = "Collapse";
        element.src = "http://www.byui.edu/css/v1/images/collapse.gif";
    }
    else
    {
        element.alt = "Expand";
        element.src = "http://www.byui.edu/css/v1/images/expand.gif";
    }
    var parent = element.parentNode;
    var children = parent.childNodes;
    for (var i = 0; i < children.length; i++)
    {
        if (children[i].nodeName == "UL")
        {
            if (children[i].style.display == "none") 
            {
                children[i].style.display = "block";
                changeSizeRevised();
            }
            else
            {
                children[i].style.display = "none";
                changeSizeRevised();
            }
        }
    }
}

/******************************************************************
* $file: leftLinks.js $
* $Revision: 1.0 $
* $Date: 2007/02/13 $
* @author James Ricks
*****************************************************************/

/******************************************************************
* Function: Parse Expanded
* Parses the cookie to find which links should be expanded. This 
* function also displays the hidden body once the links are 
* correctly displayed, removing the link flitter.
******************************************************************/
function parseExpanded(cookieName)
{
   try
   {
      var previousExpandedLinks = getExpandedLinks(cookieName)
      var currentLink = ""
      var length = previousExpandedLinks.length
      var end = 0
      var start = 0
      var linkNumberIndex
      var linkNumber = 0;
      while (end < length)  
      {
         end = previousExpandedLinks.indexOf(",")
         currentLink = previousExpandedLinks.substring(start, end)
         linkNumberIndex = currentLink.lastIndexOf("t")
         linkNumber = currentLink.substring(linkNumberIndex + 1)
         document.getElementById(currentLink).style.display = "block";
         document.getElementById("image" + linkNumber).alt = "Expand";
         document.getElementById("image" + linkNumber).src = "http://www.byui.edu/css/v1/images/collapse.gif";
         previousExpandedLinks = previousExpandedLinks.substring(end + 1, length)
         length = previousExpandedLinks.length
      }
      document.body.style.visibility = "visible";
   }
   catch(err)
   {
   writeCookie('expandedLinks', "", -1)
   document.body.style.visibility = "visible";
   }
}

/******************************************************************
* Function: Change Link State
* This function expands and collapses the list when it is clicked
* and this fuction is called. It also updates the cookie on whether
* the list should be expanded or collapsed. 
* parameters - image - The id of the image that was clicked
*            - list  - the id of the list that was clicked
******************************************************************/
function changeLinkState(image, list)
{
    var cookieName = 'expandedLinks'
    //Expand or Collapse the link if clicked
    if (document.getElementById(image).alt == "Expand")
    {
        document.getElementById(image).alt = "Collapse";
        document.getElementById(image).src = "http://www.byui.edu/css/v1/images/expand.gif";
    }
    else
    {
        document.getElementById(image).alt = "Expand";
        document.getElementById(image).src = "http://www.byui.edu/css/v1/images/collapse.gif";
    }
    //Display or hide the link if clicked
    if (document.getElementById(list).style.display == "none") 
    {
       document.getElementById(list).style.display = "block";
       expandMenu(cookieName, list)
       changeSizeRevised();
    }
    else
    {
       document.getElementById(list).style.display = "none";
       collapseMenu(cookieName, list)
       changeSizeRevised();
    }
}

/******************************************************************
* Function: Expand Menu
* Adds the list name to the cookie so that it will remain expanded.
******************************************************************/
function expandMenu(cookieName, link)
{
   var previousExpandedLinks = getExpandedLinks(cookieName)
   var currentLink = ""
   var length = previousExpandedLinks.length
   var end = 0
   var start = 0
   while (end < length)  
   {
      end = previousExpandedLinks.indexOf(",")
      currentLink = previousExpandedLinks.substring(start, end)
      if (currentLink == link)
      {
         return true
      }
      else
      {
         previousExpandedLinks = previousExpandedLinks.substring(end + 1, length)
         length = previousExpandedLinks.length
      }
   }
   writeCookie(cookieName, (getExpandedLinks(cookieName) + link + ","), 0)
   return false
}

/******************************************************************
* Function: Collapse Menu
* Removes the list name from the cookie so it will not remain expanded. 
******************************************************************/
function collapseMenu(cookieName, link)
{
   var previousExpandedLinks = getExpandedLinks(cookieName)
   var previousExpandedLinksBegin = ""
   var currentLink = ""
   var length = previousExpandedLinks.length
   var end = 0
   var start = 0
   while (end < length)  
   {
      end = previousExpandedLinks.indexOf(",")
      currentLink = previousExpandedLinks.substring(start, end)
      if (currentLink == link)
      {
         previousExpandedLinks = previousExpandedLinksBegin + previousExpandedLinks.substring(end + 1, length)
         writeCookie(cookieName, previousExpandedLinks, 1)
         return true
      }
      else
      {
         previousExpandedLinksBegin = previousExpandedLinksBegin + currentLink + ","
         previousExpandedLinks = previousExpandedLinks.substring(end + 1, length)
         length = previousExpandedLinks.length
      }
   }
   return false
}

/******************************************************************
* Writes the cookie to the browser
* A zero value will cause the cookie to expire at the end of the 
* session, a negative value will delete the cookie
******************************************************************/
function writeCookie(cookieName, values, expireDays)
{
   var exdate=new Date()
   exdate.setDate(exdate.getDate()+ expireDays)
   if (expireDays == 0)
   {
      document.cookie = cookieName + "=" + /*escape(*/ values + ((expireDays==null) ? "" : ";")
   }
   else
   {
   document.cookie = cookieName + "=" + /*escape(*/ values + ((expireDays==null) ? "" : ";expires=" + exdate.toGMTString())
   }
}

/******************************************************************
* Function: Get Expanded Links
* Returns a comma delimited list of the id's of the unordered lists
* which are set to remain expanded. 
******************************************************************/
function getExpandedLinks(cookieName)
{
   var expandedLinks = "" 
   if (document.cookie.length > 0)
   { 
      start = document.cookie.indexOf(cookieName + "=")
      if (start != -1)
      { 
         start = start + cookieName.length + 1 
         end = document.cookie.indexOf( ";", start)
         if (end == -1)
         {
            end = document.cookie.length
         }
         expandedLinks = unescape(document.cookie.substring(start,end))
      } 
   }
   else
   {
      expandedLinks = ""
   }
   return expandedLinks
}
/******************************************************************
* Call Functions (author James Ricks) 
* This function calls the other function which place the footer
* and control the expandable links.
*****************************************************************/
function callFunctions()
{
    var menuDiv = findDOM("expandableNavigation", 0);
    /******************************************************************
    *  If the links are to be expanded, call the parseExpand function 
    *  to expand the menus, else display the hidden body.
    *  --The body is hidden so that the links do not flitter when the 
    *  --javascript function renders them properly.   
    *****************************************************************/
    //if the expanded menus exist, than call parse expanded
    if (menuDiv != null)
    {
      parseExpanded('expandedLinks');
      changeSizeRevised();
    }
    else
    {
     document.body.style.visibility = "visible";
     changeSizeRevised();
    }
}

/******************************************************************
* Change Size Revised(Author Chris Potter) revision 1.1 (James Ricks)
* This function resizes the main_body div to use more space (if needed) to
* place the footer on the bottom of the browser window. It will also 
* expand or shrink when the expandable menu is expanded or collapsed. 
*
* depends on FINDDOM
*****************************************************************/
function changeSizeRevised()
{
   var leftLinks = findDOM("left_column", 0);
   var rightSide = findDOM("right_section", 0);
   var mainBody = findDOM("main_body", 0)
   if (rightSide == null)
   {
      rightSide = mainBody;
   }
   var leftHeight;
   var footerHeight = 45;
   var headerHeight = 94;
   currentPage = location.href
   //update the global body variables only once when the page is loaded, or if the page changes
   if (BROWSER_HEIGHT == undefined || BODY_HEIGHT == undefined || currentPage != CURRENT_PAGE)
   {
      if(typeof(window.innerWidth) == 'number')
      {
         //Non-IE
         BROWSER_HEIGHT = window.innerHeight;
      }
      else if(document.documentElement && document.documentElement.clientHeight)
      {
         //IE 6+ in 'standards compliant mode'
         BROWSER_HEIGHT = document.documentElement.clientHeight;
      }
      else if(document.body && document.body.clientHeight)
      {
         //IE 4 compatible
         BROWSER_HEIGHT = document.body.clientHeight;
      }
      CURRENT_PAGE = location.href;      
      BODY_HEIGHT = rightSide.offsetHeight;
      BROWSER_HEIGHT = BROWSER_HEIGHT - headerHeight - footerHeight;  
   }  
   //when there is a left_column in the document
   if(leftLinks != null)
   {
      leftHeight = leftLinks.offsetHeight;
      if(leftHeight >= BODY_HEIGHT && leftHeight > BROWSER_HEIGHT)
      {
         mainBody.style.height = leftHeight + "px";
      }
      else if(BODY_HEIGHT > leftHeight && BODY_HEIGHT > BROWSER_HEIGHT)
      {
         mainBody.style.height = BODY_HEIGHT + "px";
      }
      else
      {
         mainBody.style.height = BROWSER_HEIGHT + "px";
      }
   }
   else
   {
      if(BODY_HEIGHT > BROWSER_HEIGHT)
      {
         mainBody.style.height = BODY_HEIGHT + "px";
      }
      else
      {
         mainBody.style.height = BROWSER_HEIGHT + "px";
      }
   }
}
-->
