function menuHovers() {
	
	//wrap H6 with spans
	jQuery('#content h6').each(function() {
		
		jQuery(this).html('<span>'+jQuery(this).text()+'</span>');
		
	});
	
	//main vars
	var liLen = jQuery('#menu li:not(#menu li ul li)').length;
	var startOpacity = (10 - liLen);
	
	//sets the initial opacity and adds a class to them to indicate the initial opacity so we can access it later
	var i = startOpacity;
	var i2 = 1;
	
	jQuery('#menu li:not(#menu li ul li)').each(function() {
		
		jQuery(this).attr('id', 'menu_'+i2);
		jQuery(this).prepend('<span></span><span class="hover"></span>');
		jQuery(this).children('span').css({ opacity: '.'+i }).addClass(''+i);
		i++; i2++;
		
	});
	
	jQuery('#menu li ul li').each(function() {
		
		jQuery(this).prepend('<span></span>');
		
	});
	
	//hover effects
	jQuery('#menu li:not(#menu li ul li)').hover(function() {
		
		jQuery('#menu li.current span').stop().animate({ opacity: 0 }, 200);
		
		var curTemp = jQuery(this).attr('id').split('_');
		var current = curTemp[1];
		var current1 = (current-1)+2;
		
		var pos = (liLen - current);
		var initialOp = ((startOpacity - 1) + pos);
		
		if(current > 1) {
			
			var initOp = (startOpacity-2);
			
			for(i=current1; i<=liLen; i++) {
				
				jQuery('#menu_'+i).children('span:not(.hover)').stop().animate({ opacity: '.'+initOp }, 200);
				initOp++;
				
			}
			
			var pos2 = (pos-1)+2;
			var initOp2 = (startOpacity-2)+pos2;
			
			for(i=1;i<current;i++) {
				
				jQuery('#menu_'+i).children('span:not(.hover)').stop().animate({ opacity: '.'+initOp2 }, 200);
				initOp2++;
				
			}
			
		} else {
			
			var initOp = (startOpacity-2);
			
			for(i=current1; i<=liLen; i++) {
				
				jQuery('#menu_'+i).children('span:not(.hover)').stop().animate({ opacity: '.'+initOp }, 200);
				initOp++;
				
			}
			
		}
		
		jQuery(this).children('.hover').css({ display: 'block', opacity: 0 });
		jQuery(this).children('.hover').stop().animate({ opacity: 1 }, 200);
		
	}, function() {
		
		jQuery('#menu li span.hover').stop().animate({ opacity: 0 }, 200);
		var backOp2 = jQuery('#menu li.current span').attr('class');
		jQuery('#menu li.current span').stop().animate({ opacity: '.'+backOp2 }, 400);
		
	});
	
	jQuery('#menu li ul li').hover(function() {
		
		jQuery(this).children('span').css({ display: 'block', opacity: 0 }).stop().animate({ opacity: 1 }, 200);
		
	}, function() {
		
		jQuery(this).children('span').stop().animate({ opacity: 0 }, 200), function() {
			
			jQuery(this).hide();
			
		};
		
	});
	
	jQuery('#menu').children('li').hover(function() {
	
		jQuery(this).children('ul:first').stop().css({ display: 'block', opacity: 0 }).animate({ opacity: 1 }, 100);
		
	}, function() {
		
		jQuery(this).children('ul:first').stop().animate({ opacity: 0 }, 100, function() {
			
			jQuery(this).hide();
			
		});
		
	});
	
}


(function($){ 
    $.fn.extend({ 
	
		portfolioSlide: function() {
			
			var mainCont = this;
			var ulCont = this.children('ul');
			
			ulCont.children('li:first').next().addClass('next');
			ulCont.children('li:last').addClass('prev');
			
			//LETS FIND THE TOTAL WIDTH FIRST
			var totalWidth = 0;
			ulCont.children('li').each(function() {
				
				totalWidth = (totalWidth + jQuery(this).width()) - 30;
				
			});
			
			mainCont.parent().children('.more').click(function() {
				
				var currentLi = ulCont.children('li.next');
				var nextLi = ulCont.children('li.next').next();
				
				var prevLi = ulCont.children('li.prev');
				var nextPrevLi = ulCont.children('li.prev').next();
				
				if(nextLi.length == 0) { nextLi = ulCont.children('li:first'); }
				if(nextPrevLi.length == 0) { nextPrevLi = ulCont.children('li:first'); }
				
				//Calculate how many items are in front of this guy
				var i = 0;
				var currentGone = 0;
				ulCont.children('li').each(function() {
					
					if(jQuery(this).attr('class') == 'next') {
							
						currentGone = 1;
							
					}
					
					if(currentGone === 0) {
						
						i++;
					
					}
					
				});
				
				//Calculate the width of the items in front of this guy
				var scrollWidth = 0;
				ulCont.children('li:lt('+i+')').each(function() {
					
					scrollWidth = (scrollWidth - jQuery(this).width()) - 30;
					
				});
				
				//animates our UL
				ulCont.stop().animate({ left: scrollWidth }, 200, function() {
					
					currentLi.removeClass('next');
					nextLi.addClass('next');
					
					prevLi.removeClass('prev');
					nextPrevLi.addClass('prev');
					
				});
				
			});
			
			mainCont.parent().children('.minus').click(function() {
				
				var prevLi = ulCont.children('li.prev');
				var nextPrevLi = ulCont.children('li.prev').prev();
				var currentLi = ulCont.children('li.next');
				var nextLi = ulCont.children('li.next').prev();
				
				if(nextPrevLi.length === 0) { nextPrevLi = ulCont.children('li:last'); }
				
				if(nextLi.length === 0) { nextLi = ulCont.children('li:last'); }
				
				//Calculate how many items are in front of this guy
				var i = 0;
				var currentGone = 0;
				ulCont.children('li').each(function() {
					
					if(jQuery(this).attr('class') == 'prev') {
							
						currentGone = 1;
							
					}
					
					if(currentGone === 0) {
						
						i++;
					
					}
					
				});
				
				//Calculate the width of the items in front of this guy
				var scrollWidth = 0;
				ulCont.children('li:lt('+i+')').each(function() {
					
					scrollWidth = (scrollWidth - jQuery(this).width()) - 30;
					
				});
				
				//animates our UL
				ulCont.stop().animate({ left: scrollWidth }, 200, function() {
					
					currentLi.removeClass('next');
					nextLi.addClass('next');
					
					prevLi.removeClass('prev');
					nextPrevLi.addClass('prev');
					
				});
				
			});
			
		},
		
		portfolioImageSlider: function() {
			
			//main vars
			var mainCont = this;
			var contHeight = mainCont.parent().parent().height();
			
			//lets fix all extra images top position and add our selectors
			if(mainCont.children('a').children('img').length > 1) {
				
				//inserts our UL selector
				mainCont.append('<ul></ul>');
				
				//fixes the top position
				mainCont.children('a').children('img:not(.first)').css({ top: contHeight });
				
				var i = 1;
				
				//adds our selectors
				mainCont.children('a').children('img').each(function() {
					
					if(i === 1) {
					
						mainCont.children('ul').append('<li class="'+i+' currentSel"></li>');
						
					} else {
						
						mainCont.children('ul').append('<li class="'+i+'"></li>');
						
					}
					
					i++;
					
				});
				
			}
			
			//whenever the user interacts
			mainCont.children('ul').children('li').click(function() {
				
				//gets our class
				var classTemp = jQuery(this).attr('class').split(' ');
				
				if(classTemp[1] != 'currentSel') {
				
					classTemp = classTemp[0];
					
					//changes the selector
					mainCont.children('ul').children('li.currentSel').removeClass('currentSel');
					jQuery(this).addClass('currentSel');
					
					//animates the image
					if(mainCont.children('a').children('img:eq('+(classTemp - 1)+')').attr('class') == 'first') {
						
						mainCont.children('a').children('img:not(.first)').stop().animate({ top: contHeight }, 300);
						
					} else {
						
						mainCont.children('a').children('img:not(.first)').css({ 'z-index': 1 });
						mainCont.children('a').children('img:eq('+(classTemp - 1)+')').css({ 'z-index': 2, 'top': contHeight }).stop().animate({ top: 0 }, 300);
						
					}
					
				}
				
			});
			
		}
	
	});
	
})(jQuery);





