//  Auto roll-OVER or pages that are active.
// Must be in Footer of page,

// extract the file name from a URL
//(if input is '/files/index.html', output is 'index')
function ROextractPageName(hrefString)
{
// //  var arr = hrefString.split('.');
// //  arr = arr[arr.length-2].split('/');
//  var arr = hrefString.split('/');
//  return arr[arr.length-1].toLowerCase();
  return hrefString;
}

// search through all the links in array, if one points to
// the same file, apply the class .current to it and to its
// parent
function ROsetActiveMenu(arr, crtPage)
{
  for(var i=0; i < arr.length; i++)
  if(ROextractPageName(arr[i].href) == crtPage)
  {

 if (arr[i].onmouseout!=null && arr[i].onmouseout!=null)
   {
    arr[i].onmouseout = arr[i].onmouseover ;
    arr[i].onmouseover();
   }    
   else
   {    arr[i].className = 'CurrentPage';
    arr[i].parentNode.className = 'CurrentPage';

   }
  }
}

// call this method from your page
function ROsetPage()
{
  if(document.location.href)
    hrefString = document.location.href;
      else
    hrefString = document.location;

//    if (document.getElementById('navbar')!=null)
//    {//alert(hrefString);
//    ROsetActiveMenu(document.getElementById('navbar').getElementsByTagName('a'),ROextractPageName(hrefString));
    ROsetActiveMenu(document.getElementsByTagName('a'),ROextractPageName(hrefString));
//    }
}

/* window 'load' attachment */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

addLoadEvent(ROsetPage);