$(document).ready(function() {                
	
	// match active page with a nav link
  pattern = /^p-(.*)$/; // anything in a string after 'p-'
	activePage = $('body').attr('id').match(pattern)[1]; // grab the body's id attribute, strip 'p-' located at beginning of line (e.g p-products becomes products)
  activeLink = $('ul#nav').find('a#nav-' + activePage); // find a matching link item (p-products, find nav-products)
  $(activeLink).addClass('active'); // add '.active' class to nav link
	
	

	$('ul.sf-menu ul a:first').css('border-top', 'none');
	$('ul.sf-menu ul ul a:first').css('border-top', 'none');


									
	$('ul.sf-menu  li ul li a').hover (
		function () {
			$(this).parent().parent().parent().children('a').addClass('active');
		}, function () {
			$(this).parent().parent().parent().children('a').removeClass('active');
		}
	);
			
	$('ul.sf-menu  li ul li ul li a').hover (
		function () {
			$(this).parent().parent().parent().parent().parent().children('a').addClass('active');
		}, function () {
			$(this).parent().parent().parent().parent().parent().children('a').removeClass('active');
		}
	);
			



});
