var Page_Name;

function PageName() {
  var LpathName = location.pathname.toLowerCase(); 
  var separator="/";
  //var separator="\\";
  var LpathArray = LpathName.split(separator);
  var LpathLength= LpathArray.length;

           
  for (var i=(LpathLength - 1); i >= 0; i--) {
    if (LpathArray[i].search("htm") != -1 || 
        LpathArray[i].search("asp") != -1 ||
        LpathArray[i].search("php") != -1 ){
      Page_Name = LpathArray[i];
      return; 
    }       

  }
} 






//************************************************************************************************************************
//************************************************************************************************************************
//CHANGES:SXP - change index.php to represent the proper index page name and extension.
//This change must be made in linkID Array as well as the Page_Name check below.  Find on SXP.

var linkID  =new Array("index.htm","bio.htm","gallery.php","events.htm","reviews.htm","sets.php","contact.php");
var linkName=new Array("Home","Bio","Gallery","Events","Reviews","Set Pieces","Contact");
var LID_Length = linkID.length
var inc        = 0;
var ButtonClass;


function MainNavigation(navlayout)
{
  //Get Current Page Name - Page_Name
  PageName()


  //SXP: If no page name is present (index.htm) only, a null will be present.
  //     Set the Page_Name variable to index.htm for proper function of the navigation menu.
  if(!Page_Name)Page_Name="index.htm";


  //loop through the LinkID until the end variable is found.
  //This can be done in other ways, like finding the number of variables in the array and then using a for loop.
  while (inc < LID_Length)
  { 

    if (Page_Name == linkName[inc] || Page_Name == linkID[inc]){
      ButtonClass = "NavOn";
    }
    else
    {
      ButtonClass = "NavMain";
    }

              
    document.write('<a class="' + ButtonClass + '" href="' + linkID[inc] + '">' + linkName[inc] + '</a>');

    //Navigation Layout
    //  0 = Left to right with no space inbetween
    //  1 = Left to right with space inbetween
    //  2 = Top to bottom
    if (navlayout == 1) document.write('&nbsp;');
    if (navlayout == 2) document.write('<br />');

    
    //Go get the next page
    inc = inc + 1;    
  }
}      



