$(document).ready(function() {
	
	$('li.no_js').css('display', 'none');
	$('.subnav2_wrap').css('display', 'none');
	
}); // end doc .ready


function highlight_nav(page) {
	var page = './' + page;
	var count = 0;
	var parent_class;
	var only_one = true;
	$('.subnav li a').each(function() {
		// find the link that has the same url as the current page
		if($(this).attr('href') == page) {
			count++;
			$(this).addClass('current_nav');
			// slide the correct subnav down
				// *** $(this).parent().parent().parent().slideDown(500); *** \\
			$(this).parent().parent().parent().show();
			// only get this parent class is we are in subnav2 otherwise one page (like an overview page)
			if($(this).parent().parent().attr('id') != 'subnav1') {
				only_one = false;
				parent_class = $(this).parent().attr('class');
			}
			
			
		}
	});
	/**
	 * if count > 1 we don't need need this as the href is the same
	 * count == 1 make sure that we don't get an error when we are NOT in the first subpage
	 */
	if(count == 1 && only_one == false) {
		$('#subnav1 .' + parent_class).addClass('current_nav');
	}
	
}