$(document).ready(function() {
	/*Add this independantly to each class that uses it
	$('a').hover(
		function(){
			$(this).animate({color: '#e2ae3f'},300);
		},
		function(){
			 $(this).animate({color: '#936520'},100);
		}
	);*/
	
	$(".pageRight").mouseover(
		function()	{
			$(".pageRight").animate({right: '10'},150);
			$(".plaqueSection").show().animate({opacity: '1'},200);
		}
	);
	$(".pageRight").mouseout(
		function()	{
			//$(".pageRight").animate({right: '-97'},150);
			$(".pageRight").animate({right:'-97'},{queue:false, duration:400, easing:'easeOutBounce'});
			$(".plaqueSection").animate({opacity: '0'},200).hide();
		}
	);
	$(".pageLeft").mouseover(
		function()	{
			$(".pageLeft").animate({left: '10'},200);
			$(".plaqueSection").show().animate({opacity: '1'},200);
		}
	);
	$(".pageLeft").mouseout(
		function()	{
			//$(".pageLeft").animate({left: '-97'},200);
			$(".pageLeft").animate({left:'-97'},{queue:false, duration:400, easing:'easeOutBounce'});
			$(".plaqueSection").animate({opacity: '0'},200).hide();
		}
	);
	
	$('li#menuHome a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#menuConfession a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#menuArtwork a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#menuDesign a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#menuProstitution a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#menuRelics a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#home a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#home a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('li#confession a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#confession a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('li#artwork a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#artwork a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('li#design a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#design a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('li#prostitution a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#prostitution a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('li#relics a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$('li#relics a.active')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
		function(){$(this).stop().animate({'opacity': 0}, 200);},
		function(){$(this).stop().animate({'opacity': 0}, 200);}
	);
	
	$('div.decompose a')
	.css({ 'backgroundPosition': '0 0' })
	.hover(
	  function(){$(this).stop().animate({'opacity': 0}, 300);},
	  function(){$(this).stop().animate({'opacity': 1}, 300);}
	);
	
	//Lamp Glows
	$(".lampGlow").mouseover(
		function()	{$(this).animate({opacity: '80'},300);}
	);
	
	$(".lampGlow").mouseout(
		function()	{
			$(this).animate({opacity: '0'},300);
		}
	);
	
	$(".lampSign a").mouseover(
		function()	{
			$(".lampGlow").animate({opacity: '80'},300);
			$(this).animate({color: '#e2ae3f'},300);
		}
	);
	
	$(".lampSign a").mouseout(
		function()	{
			$(".lampGlow").stop().animate({opacity: '0'},100);
			$(this).animate({color: '#b66920'},100);
		}
	);
	
	//Randomize Banner
	bgImageTotal=2;
	randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
	imgPath=('images/elements/banners/'+randomNumber+'.png');
	$('.banner').css('background-image', ('url("'+imgPath+'")'));
	
	//BEGIN: Submenu
	$('#showAll').animate({'opacity': '0.50'}, 300)

	$('#showSubMenu')
		.hover(
		  function(){$(this).stop().animate({'opacity': 0.5}, 200);},
		  function(){$(this).stop().animate({'opacity': 1}, 200);}
	);
	
	$("#showSubMenu").mouseover(
		function()	{
			$(".overlaySubMenu").show();
		}
	);
	$("#showSubMenu").mouseout(
		function()	{
			$(".overlaySubMenu").hide();
		}
	);
	
	$('.overlaySubMenu')
		.hover(
		  function(){$("#showSubMenu").stop().animate({'opacity': 0.5}, 200);},
		  function(){$("#showSubMenu").stop().animate({'opacity': 1}, 200);}
	);
	
	$(".overlaySubMenu").mouseover(
		function()	{
			$(this).show();
		}
	);
	$(".overlaySubMenu").mouseout(
		function()	{
			$(this).hide();
		}
	);
	//END: Submenu
	
	//BEGIN: Design Highlighting
	$("#showAll").click(function()	{
		//Move Background
		$("#showSubMenu").css({ 'backgroundPosition': '0 0' });
		//Dims The Link
		$(this).stop().animate({'opacity': 0.50}, 300);
		//Un-Dims The Other Buttons
		$("showIdentity, #showInterface, #showIllustration, #showMotion, #showFive").stop().animate({'opacity': 1}, 300);
		//Highlights The Categories
		$(".interface, .identity, .illustration, .motion, .five").stop().animate({'opacity': 1}, 300);
	});
	
	$("#showInterface").click(function()	{
		//Move Background
		$("#showSubMenu").css({ 'backgroundPosition': '0 -110px' });
		//Dims The Link
		$(this).stop().animate({'opacity': 0.50}, 300);
		//Un-Dims The Other Buttons
		$("#showIdentity, #showIllustration, #showMotion, #showFive, #showAll").stop().animate({'opacity': 1}, 300);
		//Highlights The Category
		$(".interface").stop().animate({'opacity': 1}, 300);
		//Dims The Other Categories
		$(".identity, .illustration, .motion, .five").stop().animate({'opacity': 0.15}, 300);
		//Highlights The Stacked Categories
		$(".identity").filter(".interface").stop().animate({'opacity': 1}, 300);
		$(".illustration").filter(".interface").stop().animate({'opacity': 1}, 300);
		$(".motion").filter(".interface").stop().animate({'opacity': 1}, 300);
	});
	
	$("#showIdentity").click(function()	{
		//Move Background
		$("#showSubMenu").css({ 'backgroundPosition': '0 -220px' });
		//Dims The Link
		$(this).stop().animate({'opacity': 0.50}, 300);
		//Un-Dims The Other Buttons
		$("#showInterface, #showIllustration, #showMotion, #showFive, #showAll").stop().animate({'opacity': 1}, 300);
		//Highlights The Category
		$(".identity").stop().animate({'opacity': 1}, 300)
		//Dims The Other Categories
		$(".interface, .illustration, .motion, .five").stop().animate({'opacity': 0.15}, 300);
		//Highlights The Stacked Categories
		$(".interface").filter(".identity").stop().animate({'opacity': 1}, 300);
		$(".illustration").filter(".identity").stop().animate({'opacity': 1}, 300);
		$(".motion").filter(".identity").stop().animate({'opacity': 1}, 300);
	});
	
	$("#showIllustration").click(function()	{
		//Move Background
		$("#showSubMenu").css({ 'backgroundPosition': '0 -330px' });
		//Dims The Link
		$(this).stop().animate({'opacity': 0.50}, 300);
		//Un-Dims The Other Buttons
		$("#showIdentity, #showInterface, #showMotion, #showFive, #showAll").stop().animate({'opacity': 1}, 300);
		//Highlights The Category
		$(".illustration").stop().animate({'opacity': 1}, 300);
		//Dims The Other Categories
		$(".interface, .identity, .motion, .five").stop().animate({'opacity': 0.15}, 300);
		//Highlights The Stacked Categories
		$(".interface").filter(".illustration").stop().animate({'opacity': 1}, 300);
		$(".identity").filter(".illustration").stop().animate({'opacity': 1}, 300);
		$(".motion").filter(".illustration").stop().animate({'opacity': 1}, 300);
	});
	
	$("#showMotion").click(function()	{
		//Move Background
		$("#showSubMenu").css({ 'backgroundPosition': '0 -440px' });
		//Dims The Link
		$(this).stop().animate({'opacity': 0.50}, 300);
		//Un-Dims The Other Buttons
		$("#showIdentity, #showInterface, #showIllustration, #showFive, #showAll").stop().animate({'opacity': 1}, 300);
		//Highlights The Category
		$(".motion").stop().animate({'opacity': 1}, 300);
		//Dims The Other Categories
		$(".interface, .identity, .illustration, .five").stop().animate({'opacity': 0.15}, 300);
		//Highlights The Stacked Categories
		$(".interface").filter(".motion").stop().animate({'opacity': 1}, 300);
		$(".identity").filter(".motion").stop().animate({'opacity': 1}, 300);
		$(".illustration").filter(".motion").stop().animate({'opacity': 1}, 300);
	});
	//END: Design Highlighting
	
	//BEGIN: Design Detail & Doors
	//Expose Left
	$('.exposeLeft').hover(function(){
		$(".door2x1", this).stop().animate({left:'-246px'},{queue:false,duration: 250});
		}, function() {
		$(".door2x1", this).stop().animate({left:'0px'},{queue:false, duration:800, easing:'easeOutBounce'});
	});
		
	//Expose Top
	$('.exposeTop').hover(function(){
		$(".door2x2", this).stop().animate({top:'-246px'},{queue:false,duration: 250});
		}, function() {
		$(".door2x2", this).stop().animate({top:'0px'},{queue:false, duration:800, easing:'easeOutBounce'});
	});
	
	//Thumbnails
	$("#thumb-A").click(function()	{
		/*EXHIBITS*/
		$(".detail-A").fadeIn(500);
		$(".detail-B, .detail-C, .detail-D, .detail-E, .detail-F").hide();
		/*LABELS*/
		$("#label-A").show();
		$("#label-B, #label-C, #label-D, #label-E, #label-F").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x1').hide();
		//Arrows
		$("#containerArrows-A").show();
		$("#containerArrows-B, #containerArrows-C, #containerArrows-D, #containerArrows-E, #containerArrows-F").hide();
	});
	
	$("#thumb-B").click(function()	{
		/*EXHIBITS*/
		$(".detail-B").fadeIn(500);
		$(".detail-A, .detail-C, .detail-D, .detail-E, .detail-F").hide();
		/*LABELS*/
		$("#label-B").show();
		$("#label-A, #label-C, #label-D, #label-E, #label-F").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x1').hide();
		//Arrows
		$("#containerArrows-B").show();
		$("#containerArrows-A, #containerArrows-C, #containerArrows-D, #containerArrows-E, #containerArrows-F").hide();
	});
	
	$("#thumb-C").click(function()	{
		/*EXHIBITS*/
		$(".detail-C").fadeIn(500);
		$(".detail-A, .detail-B, .detail-D, .detail-E, .detail-F").hide();
		/*LABELS*/
		$("#label-C").show();
		$("#label-A, #label-B, #label-D, #label-E, #label-F").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x2').hide();
		//Arrows
		$("#containerArrows-C").show();
		$("#containerArrows-A, #containerArrows-B, #containerArrows-D, #containerArrows-E, #containerArrows-F").hide();
	});
	
	$("#thumb-D").click(function()	{
		/*EXHIBITS*/
		$(".detail-D").fadeIn(500);
		$(".detail-A, .detail-B, .detail-C, .detail-E, .detail-F").hide();
		/*LABELS*/
		$("#label-D").show();
		$("#label-A, #label-B, #label-C, #label-E, #label-F").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x1').hide();
		//Arrows
		$("#containerArrows-D").show();
		$("#containerArrows-A, #containerArrows-B, #containerArrows-C, #containerArrows-E, #containerArrows-F").hide();
	});
	
	$("#thumb-E").click(function()	{
		/*EXHIBITS*/
		$(".detail-E").fadeIn(500);
		$(".detail-A, .detail-B, .detail-C, .detail-D, .detail-F").hide();
		/*LABELS*/
		$("#label-E").show();
		$("#label-A, #label-B, #label-C, #label-D, #label-F").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x1').hide();
		//Arrows
		$("#containerArrows-E").show();
		$("#containerArrows-A, #containerArrows-B, #containerArrows-C, #containerArrows-D, #containerArrows-F").hide();
	});
	
	$("#thumb-F").click(function()	{
		/*EXHIBITS*/
		$(".detail-F").fadeIn(500);
		$(".detail-A, .detail-B, .detail-C, .detail-D, .detail-E").hide();
		/*LABELS*/
		$("#label-F").show();
		$("#label-A, #label-B, #label-C, #label-D, #label-E").hide();
		/*DOORS*/
		$(".door2x1, .door2x2").show();
		$(this).find('.door2x2').hide();
		//Arrows
		$("#containerArrows-F").show();
		$("#containerArrows-A, #containerArrows-B, #containerArrows-C, #containerArrows-D, #containerArrows-E").hide();
	});

	
	// Scroll Page
	$('.scrollPage').click(function() {
	   var elementClicked = $(this).attr("href");
	   var destination = $(elementClicked).offset().top;
	   //$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 500 );
	   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 500 );
	   return false;
	});
	
	//Arrows Hover
	$('.frameLeft').hover(function(){
		$(this).stop().animate({left: '16'},{queue:false,duration: 150});
		}, function() {
		$(this).stop().animate({left: '0'},{queue:false,duration: 300});
	});
	
	$('.frameRight').hover(function(){
		$(this).stop().animate({right: '16'},{queue:false,duration: 150});
		}, function() {
		$(this).stop().animate({right: '0'},{queue:false,duration: 300});
	});
	
	//Arrows A
	$("#arrowRight-A").click(function()	{
		//EXHIBITS
		$(".detail-B").fadeIn(500);
		$(".detail-A, .detail-C, .detail-D, .detail-E, .detail-F").hide();
		/*LABELS*/
		$("#label-B").show();
		$("#label-A, #label-C, #label-D, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-B").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-A").hide();
		$("#containerArrows-B").show();
	});
	
	//Arrows B
	$("#arrowLeft-B").click(function()	{
		//EXHIBITS
		$(".detail-A").fadeIn(500);
		$(".detail-B").hide();
		/*LABELS*/
		$("#label-A").show();
		$("#label-B, #label-C, #label-D, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-A").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-B").hide();
		$("#containerArrows-A").show();
	});
	
	$("#arrowRight-B").click(function()	{
		//EXHIBITS
		$(".detail-C").fadeIn(500);
		$(".detail-B").hide();
		/*LABELS*/
		$("#label-C").show();
		$("#label-A, #label-B, #label-D, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-C").find('.door2x2').hide();
		//Arrows
		$("#containerArrows-B").hide();
		$("#containerArrows-C").show();
	});
	
	//Arrows C
	$("#arrowLeft-C").click(function()	{
		//EXHIBITS
		$(".detail-B").fadeIn(500);
		$(".detail-C").hide();
		/*LABELS*/
		$("#label-B").show();
		$("#label-A, #label-C, #label-D, #label-E, #label-F").hide();
		/*LABELS*/
		$("#label-B").show();
		$("#label-A, #label-C, #label-D, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-B").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-C").hide();
		$("#containerArrows-B").show();
	});
	
	$("#arrowRight-C").click(function()	{
		//EXHIBITS
		$(".detail-D").fadeIn(500);
		$(".detail-C").hide();
		/*LABELS*/
		$("#label-D").show();
		$("#label-A, #label-B, #label-C, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-D").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-C").hide();
		$("#containerArrows-D").show();
	});
	
	//Arrows D
	$("#arrowLeft-D").click(function()	{
		//EXHIBITS
		$(".detail-C").fadeIn(500);
		$(".detail-D").hide();
		/*LABELS*/
		$("#label-C").show();
		$("#label-A, #label-B, #label-D, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-C").find('.door2x2').hide();
		//Arrows
		$("#containerArrows-D").hide();
		$("#containerArrows-C").show();
	});
	
	$("#arrowRight-D").click(function()	{
		//EXHIBITS
		$(".detail-E").fadeIn(500);
		$(".detail-D").hide();
		/*LABELS*/
		$("#label-E").show();
		$("#label-A, #label-B, #label-C, #label-D, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-E").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-D").hide();
		$("#containerArrows-E").show();
	});
	
	//Arrows E
	$("#arrowLeft-E").click(function()	{
		//EXHIBITS
		$(".detail-D").fadeIn(500);
		$(".detail-E").hide();
		/*LABELS*/
		$("#label-D").show();
		$("#label-A, #label-B, #label-C, #label-E, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-D").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-E").hide();
		$("#containerArrows-D").show();
	});
	
	$("#arrowRight-E").click(function()	{
		//EXHIBITS
		$(".detail-F").fadeIn(500);
		$(".detail-E").hide();
		/*LABELS*/
		$("#label-F").show();
		$("#label-A, #label-B, #label-C, #label-D, #label-E").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-F").find('.door2x2').hide();
		//Arrows
		$("#containerArrows-E").hide();
		$("#containerArrows-F").show();
	});
	
	//Arrows F
	$("#arrowLeft-F").click(function()	{
		//EXHIBITS
		$(".detail-E").fadeIn(500);
		$(".detail-F").hide();
		/*LABELS*/
		$("#label-E").show();
		$("#label-A, #label-B, #label-C, #label-D, #label-F").hide();
		//DOORS
		$(".door2x1, .door2x2").show();
		$("#thumb-E").find('.door2x1').hide();
		//Arrows
		$("#containerArrows-F").hide();
		$("#containerArrows-E").show();
	});
	//END: Design Detail & Doors
	
	$(".shrinkFooter").click(
		function()	{
			$(".footer").animate({bottom: '-300'},700)
			$(".bittyFooter").delay(100).animate({bottom: '0'},700)
		}
	);
	
	$(".showFooter").click(
		function()	{
			$(".bittyFooter").animate({bottom: '-300'},700)
			$(".footer").delay(200).animate({bottom: '0'},700)
		}
	);
});
