/* JavaScript functions */


// Function to test dize of user display and get rid of floating page format if the display is too small
//  Otherwise the floating format means that the page doesn't scroll in the browser
function CheckPageSize()
{
   var w = 0;
   var h = 0;
   var wrapper = document.getElementById("MainWrapper");
   
   // We have to use various methods to find the screen height and width, depending on the user's browser
   if (window.innerheight)
   {
     h = window.innerheight;
     w = window.innerwidth;
   }
   else if (document.documentElement && document.documentElement.clientHeight && (document.documentElement.clientHeight > 0))
   {
     h = document.documentElement.clientHeight;
     w = document.documentElement.clientWidth;
   }
   else if (document.body)
   {
     h = document.body.clientHeight;
     w = document.body.clientWidth;
   }
   
   //alert("CheckPageSize called; h=" + h.toString() + "px, w=" + w.toString() + "px");
   
   if (h < 600) wrapper.className = "MainWrapperShort";
   if (w < 800) wrapper.className = "MainWrapperNarrow";
   if ((h < 600) && (w < 800)) wrapper.className = "MainWrapperNarrowShort";
}



// Function to highlight the navigation button which refers to the current page.
function NavButtonSetup(n)
{
  //alert("NavButtonSetup(" + n.toString() + ")" );
  var button = document.getElementById("NavButton" + n.toString() );
  //alert(button.id + "class " + button.className);
    
  if (pageNames[n] == currentPage)
  {
     if (n == 1)
     {
        //alert("First Button This");
        button.className = "NavButtonThisFirst";
     }
     else
     {
        //alert("Nth Button this");
        button.className = "NavButtonThis";
     }
  }

}


function SetupNavButtons()
{
  //alert("SetupNavButtons()" );
  var n;
  for (n=1; n<=navBarSize; n++)
  {
     NavButtonSetup(n);
  }
}

