$(document).ready(function() {
	
	
	
	
	// FADE ON HOVER (ISSUES WE SOLVE)

	$(function() {
	
	$("#issues-we-solve").hover(
		function() {}, 
		function() {
			$('#issues-we-solve>div').fadeTo("fast", 1.0); 
		}
	);
	
	$("#issues-we-solve>div").hoverIntent(
		function(){
			$(this).attr('class', 'current'); // Add class .current
			$(this).siblings().fadeTo("fast", 0.3); // Fade other items to 30%
			$(this).fadeTo("slow", 1.0); // Fade current to 100%
		},
		function(){ 
			$(this).removeClass("current"); // Remove class .current
			$(this).fadeTo("fast", 1.0); // This should set the other's opacity back to 100% on mouseout
		});
		
	});
	
	
	
	
	// FADE ON HOVER (TOOLKIT)

	$(function() {
	
	$("#toolkit, #issue section").hover(
		function() {}, 
		function() {
			$('#toolkit>h2, #issue section>div').fadeTo("fast", 1.0); 
		}
	);
	
	$("#toolkit>h2, #issue section>div").hoverIntent(
		function(){
			$(this).attr('class', 'current'); // Add class .current
			$(this).siblings("#toolkit>h2, #issue section>div").fadeTo("fast", 0.3); // Fade other items to 30%
			$(this).fadeTo("slow", 1.0); // Fade current to 100%
		},
		function(){ 
			$(this).removeClass("current"); // Remove class .current
			$(this).fadeTo("fast", 1.0); // This should set the other's opacity back to 100% on mouseout
		});
		
	});
	
	
	
	
	// ISSUE SLIDE DOWN
	
	$(function() {
		$("#issue aside").slideToggle(2000);
	});
	
	
	
	
	// HOME FADE IN
	
	$(function() {
		$("#home blockquote").fadeIn(4000);
	});


	
	
	
	// ACTIVE STATES ON TOOLKIT & ISSUES
	
	$("#toolkit").hover(function(){
		$("#content section").removeClass("bg-growth");
		$("#content section").removeClass("bg-proposition");
		$("#content section").removeClass("bg-commercialisation");
		$("#content section").removeClass("bg-execution");
		$("#content section").addClass("bg-toolkit");
		$("#list-growth").addClass("hide");
		$("#list-proposition").addClass("hide");
		$("#list-commercialisation").addClass("hide");
		$("#list-execution").addClass("hide");
	});
	
	$("#issue #google, #issue #o2, #issue #hewlett-packard, #issue #cadbury, #issue #carphone-warehouse, #issue #the-times, #issue #green-blacks, #issue #richmond-walls").hover(function(){
		$("#content section").removeClass("bg-growth");
		$("#content section").removeClass("bg-proposition");
		$("#content section").removeClass("bg-commercialisation");
		$("#content section").removeClass("bg-execution");
		$("#content section").addClass("bg-norm");
	});
	
	$("#growth").hover(function(){
		$("#content section").removeClass("bg-toolkit");
		$("#content section").removeClass("bg-norm");
		$("#content section").removeClass("bg-proposition");
		$("#content section").removeClass("bg-commercialisation");
		$("#content section").removeClass("bg-execution");
		$("#list-growth").removeClass("hide");
		$("#content section").addClass("bg-growth");
		$("#list-proposition").addClass("hide");
		$("#list-commercialisation").addClass("hide");
		$("#list-execution").addClass("hide");
	});
	
	$("#proposition").hover(function(){
		$("#content section").removeClass("bg-toolkit");
		$("#content section").removeClass("bg-norm");
		$("#content section").removeClass("bg-growth");
		$("#content section").removeClass("bg-commercialisation");
		$("#content section").removeClass("bg-execution");
		$("#list-proposition").removeClass("hide");
		$("#content section").addClass("bg-proposition");
		$("#list-growth").addClass("hide");
		$("#list-commercialisation").addClass("hide");
		$("#list-execution").addClass("hide");
	});
	
	$("#commercialisation").hover(function(){
		$("#content section").removeClass("bg-toolkit");
		$("#content section").removeClass("bg-growth");
		$("#content section").removeClass("bg-proposition");
		$("#content section").removeClass("bg-execution");
		$("#list-commercialisation").removeClass("hide");
		$("#content section").addClass("bg-commercialisation");
		$("#list-growth").addClass("hide");
		$("#list-proposition").addClass("hide");
		$("#list-execution").addClass("hide");
	});
	
	$("#execution").hover(function(){
		$("#content section").removeClass("bg-toolkit");
		$("#content section").removeClass("bg-growth");
		$("#content section").removeClass("bg-proposition");
		$("#content section").removeClass("bg-commercialisation");
		$("#list-execution").removeClass("hide");
		$("#content section").addClass("bg-execution");
		$("#list-growth").addClass("hide");
		$("#list-proposition").addClass("hide");
		$("#list-commercialisation").addClass("hide");
	});
	
	


	
	// ACTIVE STATES ON SKILLSET
	
	$("#skillset, #skillset .one, #skillset .two, #skillset .three, #skillset .four, #skillset .five, #skillset .six, #skillset .seven, #skillset .eight").hover(function(){
		$("#content section").removeClass("bg-skillset");
		$("#content section").removeClass("bg-skillset-one");
		$("#content section").removeClass("bg-skillset-two");
		$("#content section").removeClass("bg-skillset-three");
		$("#content section").removeClass("bg-skillset-four");
		$("#content section").removeClass("bg-skillset-five");
		$("#content section").removeClass("bg-skillset-six");
		$("#content section").removeClass("bg-skillset-seven");
		$("#content section").removeClass("bg-skillset-eight");
	});
	
	$("#skillset .one").hover(function(){
		$("#content section").addClass("bg-skillset-one");
	});
	
	$("#skillset .two").hover(function(){
		$("#content section").addClass("bg-skillset-two");
	});
	
	$("#skillset .three").hover(function(){
		$("#content section").addClass("bg-skillset-three");
	});
	
	$("#skillset .four").hover(function(){
		$("#content section").addClass("bg-skillset-four");
	});
	
	$("#skillset .five").hover(function(){
		$("#content section").addClass("bg-skillset-five");
	});
	
	$("#skillset .six").hover(function(){
		$("#content section").addClass("bg-skillset-six");
	});
	
	$("#skillset .seven").hover(function(){
		$("#content section").addClass("bg-skillset-seven");
	});
	
	$("#skillset .eight").hover(function(){
		$("#content section").addClass("bg-skillset-eight");
	});
	
	$("#skillset").hover(function(){
		$("#content section").addClass("bg-skillset");
	});
	
	
	
	
	// FANCYBOX FUNCTIONS
  
  $("a[rel=group], a[rel=group2], a[rel=group3], a[rel=group4]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'inside',
		'overlayOpacity'	: '0.9',
		'overlayColor'		: '#000',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-inside">' + (title && title.length ? '<strong>' + title + '</strong>' : '' ) + (currentIndex + 1) + ' of ' + currentArray.length + '</span>';
		}
	});




});
