if (Drupal.jsEnabled) {

	$(document).ready(function() {
		var selector;
		selector = 'div.left_navigation .level1 .menu_item:first[class*="level1"][class*="always_selected"]';
		$(selector).attr('style', 'background-image: url(/images/navigation/bg_first_'+$(selector).height()+'.png);');
		$(selector+' a').attr('style', ' color: #FFFFFF;');
		
		selector = 'div.left_navigation .level1 .menu_item:not(:first)[class*="level1"][class*="always_selected"]';
		$(selector).attr('style', 'background-image: url(/images/navigation/bg_'+$(selector).height()+'.png);');
		$(selector+' a').attr('style', ' color: #FFFFFF;');
		
		// apply divider(separator) for level1 menu items
		$('div.left_navigation .level1 .menu_item[class*="level1"]').parent().children().each(function(i){
			if($(this).prev().hasClass('menu_item') && !$(this).prev().hasClass('always_selected') && !$(this).hasClass('always_selected')) {
				$(this).prev().attr('style', 'background-image: url(/images/navigation/divider.png); background-repeat: no-repeat; background-position: bottom right;');
			}
		});
		
		$('div.left_navigation .level1 .menu_item[class*="level1"]:not(:first):not([class*="always_selected"])').hover(function(){
			$(this).prev(':not([class*="always_selected"])').attr('style', 'background-image: none');
			$(this).attr('style', 'background-image: url(/images/navigation/bg_'+$(this).height()+'.png); background-repeat: no-repeat; background-position: left center;');
			$(this).find('a').attr('style', 'color: #FFFFFF');
		}, function(){
			$(this).prev(':not([class*="always_selected"])').attr('style', 'background-image: url(/images/navigation/divider.png); background-repeat: no-repeat; background-position: bottom right;');
			if($(this).next().hasClass('always_selected') || !$(this).next().hasClass('menu_item')) {
				$(this).attr('style', 'background-image: none;');
			}
			else {
				$(this).attr('style', 'background-image: url(/images/navigation/divider.png); background-repeat: no-repeat; background-position: bottom right;');
			}
			$(this).find('a').attr('style', 'color: #857F7F');			
		});

		// first menu item
		$('div.left_navigation .level1 .menu_item[class*="level1"]:first:not([class*="always_selected"])').hover(function(){
			$(this).prev(':not([class*="always_selected"])').attr('style', 'background-image: none');
			$(this).attr('style', 'background-image: url(/images/navigation/bg_first_'+$(this).height()+'.png); background-repeat: no-repeat; background-position: left center;');
			$(this).find('a').attr('style', 'color: #FFFFFF');
		}, function(){
			$(this).prev(':not([class*="always_selected"])').attr('style', 'background-image: url(/images/navigation/divider.png); background-repeat: no-repeat; background-position: bottom right;');
			if($(this).next().hasClass('always_selected')) {
				$(this).attr('style', 'background-image: none;');				
			}
			else {
				$(this).attr('style', 'background-image: url(/images/navigation/divider.png); background-repeat: no-repeat; background-position: bottom right;');
			}
			$(this).find('a').attr('style', 'color: #857F7F');			
		});

		// submenu item
		$('div.left_navigation .level1 .level2 .menu_item:not([class*="always_selected"])').hover(function(){
			$(this).addClass('selected');
		}, function(){
			$(this).removeClass('selected');
		});

	});
}
