// JavaScript Document
function highlightmenu(selector,value){
 current_file_name = location.pathname.substring(location.pathname.lastIndexOf('/') + 1,location.pathname.length);
 paths = location.pathname.split('/');
 cur_dir = paths[paths.length -2];
 var menus = $$(selector);
 menus.each(
  function(element){
    var href = element.getAttribute('href');
  if(!isExternalLink(href)){
    var file = href.substring(href.lastIndexOf('/') + 1,href.length);
    if(current_file_name != '' && current_file_name == file){
      element.setAttribute('id',value);   
	} else if(cur_dir == element.getAttribute('class') || cur_dir == element.getAttribute('className')){
	    element.setAttribute('id' ,  value );
    } else {
      if(current_file_name == '' && file == 'index.html'){
        element.setAttribute('id',value);
      }
    }
  }
  }
 );

 function isExternalLink(href){
    paths = location.pathname.split('/');
  if( href.startsWith('http') && href.indexOf(paths[2]) == -1){
    return true;}
  return false;
//   tmp = href.split('/');
//   for(var i=0;i < 3;i++){
//    tmp.shift();
//   }
//   href = tmp.join('/');
//   externalLinkFlg = true;
 }
};
