jQuery(document).ready(function($){	

	//Loop through all the lists in a specified area and add span tags before/after specified tags
	var oMenu = $('#menu').find('ul');
	oMenu.children().each(function(){
		$(this).find('a:first').html('<span>' + $(this).find('a:first').text() + '</span>');
	});

	
	//Add curved image to end of last Submenu item
	var oSubMenu = $('#menu ul:first').children().each(function(){
		$(this).find('ul:first').children('li:last').append('<span class="bottom"></span>');	
	});

	//Add curved image to end of last Sub-Submenu item
	var oSubSubMenu = $('#menu ul ul').children().each(function(){
		
		if( $(this).find('ul:first').children('li').length == 1 ) {
			$(this).find('ul:first').children('li:first').prepend('<span class="top"></span>');
			$(this).find('ul:first').children('li:first').append('<span class="bottom"></span>');
			} else {
				$(this).find('ul:first').children('li:first').prepend('<span class="top"></span>');
				$(this).find('ul:first').children('li:last').append('<span class="bottom"></span>');
				}
	});


	//Menu Hover Functions
	/*Normal*/
	var oShow = $('#menu ul li');
	oShow.hover( function() {
		/*$(this).addClass('hover');*/
		$(this).find('a:first').addClass('hover');
	},
	function () {
		/*$(this).removeClass('hover');*/
		$(this).find('a:first').removeClass('hover');
	});
	/*Selected*/
	var oShowSel = $('#menu ul li.selected');
	oShowSel.hover( function() {
		/*$(this).addClass('hover');*/
		$(this).find('a:first').addClass('hover');
	},
	function () {
		/*$(this).removeClass('hover');*/
		$(this).find('a:first').removeClass('hover');
	});

	//SubMenu Hover Functions	
	/*Normal*/
	/*var oSubShow = $('#menu ul li ul');
	oSubShow.hover( function() {
		$(this).parent().find('a:first').addClass('hover');
	},
	function () {
		$(this).parent().find('a:first').removeClass('hover');
	});*/
	/*Selected*/
	/*var oSubSel = $('#menu ul li.selected ul');
	oSubSel.hover( function() {
		$(this).parent().find('a:first').addClass('hover');
	},
	function () {
		$(this).parent().find('a:first').removeClass('hover');
	});*/
	
});
