// JavaScript Document
$(document).ready(function() {
	
	//self selecting version
	$(".brown #nav li").prepend("<span></span>");
	$(".brown ul#nav li:contains('work')").addClass("work");
	$(".brown ul#nav li:contains('about')").addClass("about");
	$('.brown #nav li').each(function() { 
		var linkText = $(this).find('a').html();
		$(this).find('span').show().html(linkText);
		}); 
	var pageID = $('body').attr('id');// Get Page ID
	
	$('#nav li').hover(function() {
		var navClass = $(this).attr('class');	//Get current list class name	
		if (pageID != navClass) { //If page ID is not the same as hovered list class name...
			$(this).find('span').stop().animate({ 
				marginTop: '-28' //Find the span tag and move it up 40 pixels
				}, 200);
				}
			} , function() { //On hover out...
					var navClass = $(this).attr('class');	//Get current list class name	
					if (pageID != navClass) { //If page ID is not the same as hovered list class name...
						$(this).find('span').stop().animate({
							marginTop: '0' //Move the span back to its original state (0px)
							}, 200);
							}
							});
							
							
						
	
	$('.bottom #nav2 li').prepend('<span></span>');
	$("ul#nav2 li:contains('philosophy')").addClass('philosophy');
	$("ul#nav2 li:contains('people')").addClass('people');
	$("ul#nav2 li:contains('clients')").addClass('clients');
	$("ul#nav2 li:contains('employment')").addClass('employment');
	$("ul#nav2 li:contains('contact')").addClass('contact');
	
	
	$(function(){
		var path = location.pathname.substring(7);
			if ( path )
     		//$('#nav2 a[href$="' + path + '"]').attr('class', ' + path + ');
			$('body').attr({ 'class': path });
			});
				 
			
			
			$('#nav2 li').each(function() { 
				var linkText = $(this).find('a').html();
				$(this).find('span').show().html(linkText);
				}); 
			var pageClass = $('body').attr('class');
			
			$('#nav2 li').hover(function() {
				var navClassTest = $(this).attr('class');	//Get current list class name	
				if (pageClass != navClassTest) { //If page ID is not the same as hovered list class name...
			$(this).find('span').stop().animate({ 
				marginTop: '-28' //Find the span tag and move it up 40 pixels
				}, 200);
				}
			} , function() { //On hover out...
					var navClassTest = $(this).attr('class');	//Get current list class name	
					if (pageClass != navClassTest) { //If page ID is not the same as hovered list class name...
						$(this).find('span').stop().animate({
							marginTop: '0' //Move the span back to its original state (0px)
							}, 200);
							}
							});
			
				
	


							
});
