function initSubNav() {
	
	// Remove default CSS functions
	$('.sub_nav').removeClass('css_function');
	
	// Hide all sub-categories
	$('.sub_nav ul').hide();
	
	// If a categories has the class 'show' expand it and set the arrow
	$.each($('.sub_nav li > a.show'), function(){
		$(this).addClass('expanded');
		$(this).next().show();
		// Makes the parent elements of any deep nested categories show correctly
		$(this).parents().show();
		$(this).parents().prev().addClass('expanded');
	});
	
	// When you click on a category set the arrow to up if it's down/down if it's up
	// When you click on a category show it if it's hidden/hide it if it's shown: Accordion and dropdown option
	$('.sub_nav li > a').click(function(){
		$(this).toggleClass('expanded');
		if ($('.sub_nav').hasClass('accordion')){
			$(this).next().slideToggle('normal').parent().siblings('li:has(ul)').children('ul').slideUp('400').parent().children('a').removeClass('expanded');
			} else {
			$(this).next().slideToggle('normal');
			}
		}
	);

}
$(document).ready(function() {initSubNav();});