﻿ function Index_DD_OpenSection(SectionID)
{  
    /* First, close all other sections */
   Index_DD_CloseOtherSections(2, SectionID);
    Index_DD_CloseOtherSections(3, SectionID);
    Index_DD_CloseOtherSections(4, SectionID);
            
 Index_DD_ToggleSection(SectionID);
    
    
}

function Index_DD_CloseOtherSections(thisSectionID, SectionOpened)
{
    var NavDD = document.getElementById('Nav_DD_' + thisSectionID);
    
    if (NavDD != document.getElementById('Nav_DD_' + SectionOpened))
    {
        Index_DD_Close(thisSectionID);
    }   
    
}

function Index_DD_ToggleSection(SectionID)
{
     var Div = document.getElementById('Nav_DD_' + SectionID);
     
  if(Div.style.display == "none"){
    // div is hidden, so let's slide down
   Index_DD_Open(SectionID);
  }else{
    // div is not hidden, so slide up
    
    document.getElementById('colour_bar').style.background = 'url(/Images/home_menu_topbg.gif)';
    
     Index_DD_Close(SectionID);
  }
}


function Index_DD_Open(SectionID)
{
  var Div = document.getElementById('Nav_DD_' + SectionID);
  var ColourBar = document.getElementById('colour_bar');
  var ColourBarBG = '';
  var NavLi = document.getElementById('Nav' + SectionID);
  
  switch (SectionID)
  {
  case 2:
    ColourBarBG = 'url(/Images/yourrights_menu_topbg.gif)';
    NavLi.className = 'yourrights_button_selected';
    
     break;
  case 3:
    ColourBarBG = 'url(/Images/goodpractice_menu_topbg.gif)';
    NavLi.className = 'goodpractice_button_selected';
     break;
  case 4:
    ColourBarBG = 'url(/Images/community_menu_topbg.gif)';
    NavLi.className = 'community_button_selected';
     break;
  }
    
   ColourBar.style.background = ColourBarBG;
  // Div.style.display = "block";  
   
   $('#Nav_DD_' + SectionID ).show('slow');
   
   }

function Index_DD_Close(SectionID)
{
  var Div = document.getElementById('Nav_DD_' + SectionID);
  var NavLi = document.getElementById('Nav' + SectionID);
  
  switch (SectionID)
  {
  case 2:
    NavLi.className = 'yourrights_button';    
     break;
  case 3:
    NavLi.className = 'goodpractice_button';
     break;
  case 4:
    NavLi.className = 'community_button';
     break;
  }
    

   $('#Nav_DD_' + SectionID ).hide('fast');
    
    
}











