$(document).ready(function(){
// get the url
var $path = location.pathname;

if ($path.match('/categories/')){
// if it's category page, get the last breadcrumb item
var $currentPage = $("div.Breadcrumb ul:first-child li:last").text();
// target the category list
var $WhichList = '#Menu';
}
// go through every item in the chosen list
$($WhichList+' ul li').each(function() {
// get the text for the list item
text = $(this).text();
if (text.match($currentPage)) {
// Add a class to the list item if you find a text match and return
return $(this).addClass('ActiveSection');
}
})
});
