// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function setCurrentPage(){
  var navigationContainer = document.getElementById("menu")
  var navBarListCollection = navigationContainer.getElementsByTagName('li');
  var navBarLinkCollection = navigationContainer.getElementsByTagName('a');
  var currentPageArray = window.location.pathname.split('/');
  var currentPagePath = currentPageArray[1]	
 
	for (var j=0; j < navBarListCollection.length; j++) {
		navBarLinkPathCollectionArray = navBarLinkCollection[j].pathname.split('/')

		if (currentPagePath == '') {
			navBarListCollection[0].className = 'active';
			break;	
		}
		else if (currentPagePath == 'meta_datas') {
			navBarListCollection[2].className = 'active';
			break;
		}
		else if (currentPagePath == navBarLinkPathCollectionArray[1] || currentPagePath == navBarLinkPathCollectionArray[0]) {
			navBarListCollection[j].className = 'active';
			break;
	   	}
	}
}
