$(function() {
	
	$('#home').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/home.jpg)');
			$('#bg').fadeIn(500);
		});
		
		$('#selector').fadeOut('fast');
		$('#selectortwo').fadeOut('fast');
		$('#selectorthree').fadeOut('fast');
		$('#selectorfour').fadeOut('fast');
		$('#submenu').slideUp('fast');
		
		$('#preview a').attr("href", "./images/lightbox/home/home_light.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#gals').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/gallery.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		
		$('#selector').fadeOut('fast');
		$('#selectortwo').fadeOut('fast');
		$('#selectorthree').fadeOut('fast');
		$('#selectorfour').fadeOut('fast');
		$('#submenu').slideToggle('fast');
		
		$('#preview a').attr("href", "./images/lightbox/home/gallery_light.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	//TOP LEVEL GALLERIES
	
	$('#g1').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/xx_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/xx_lite.jpg");
		
		$('#selectortwo').fadeOut('fast',function() {
			
			$('#selectorthree').fadeOut('fast',function() {
				
				$('#selectorfour').fadeOut('fast',function() {
						
						$('#selector').fadeIn('fast');
						
					});
				
			});
			
		});
		
		
	});
	
	$('#g2').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/editorial/windowcleaners_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		$('#preview a').attr("href", "./images/lightbox/editorial/windowcleaners_lite.jpg");
		
		$('#selector').fadeOut('fast',function() {
			
				$('#selectorthree').fadeOut('fast',function() {
			
					$('#selectorfour').fadeOut('fast',function() {
						
						$('#selectortwo').fadeIn('fast');
						
					});
			
			});
			
		});
		
		
		
	});
	
	$('#g3').click(function() {
		
		$('#bg').fadeOut(500, function() {
		
			$('#bg').css('background-image','url(images/backgrounds/travel_illustration/yabulipano_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		$('#preview a').attr("href", "./images/lightbox/travel_illustration/yabulipano_lite.jpg");
		
		$('#selector').fadeOut('fast',function() {
			
			$('#selectortwo').fadeOut('fast',function() {
			
				$('#selectorfour').fadeOut('fast',function() {
					
					$('#selectorthree').fadeIn('fast');
					
				});
			
			});
			
		});
		
		
		
		
	});
	
	$('#g4').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/products_and_commercial/lobsters_bk.jpg)');
			$('#bg').fadeIn(500);	
			
		});
		
		$('#preview a').attr("href", "./images/lightbox/products_and_commercial/lobsters_lite.jpg");
		
		$('#selector').fadeOut('fast',function() {
			
			$('#selectortwo').fadeOut('fast',function() {
				
				$('#selectorthree').fadeOut('fast',function() {
					
					$('#selectorfour').fadeIn('fast');
					
				});
				
			});
			
		});
		
		
	});
	
	$('#about').click(function() {
		
		
		
		$('#selector').fadeOut('fast');
		$('#selectortwo').fadeOut('fast');
		$('#selectorthree').fadeOut('fast');
		$('#selectorfour').fadeOut('fast');
		$('#submenu').slideUp('fast');
		$('#preview').fadeOut('fast');
		
		$('#bg').fadeOut(500,function() {
		
			$('#bg').css('background-image','url(images/aboutme.jpg)');
			$('#bg').fadeIn(1000,function() {
				
				$("#aboutlightbox").fancybox({
				'width': 740,
				'height': 280,
				'transitionIn'		: 'fade',
				'transitionOut'		: 'fade',
				'autoScale'			: true,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			}).trigger('click');
			
		});
		
		});
		
	});
	
	
	//GALLERY ONE
	
	$('#p1').click(function() {
		
		$('#bg').fadeOut(500, function() {
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/boodle_bk.jpg)');
			$('#bg').fadeIn(500);	
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/boodle_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p2').click(function() {
		
		$('#bg').fadeOut(500, function()  {
		
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/armstrongs_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/armtstrongs_lite.jpg");
		$('#preview').fadeIn('fast');
		
		
	});
	
	$('#p3').click(function() {
		
		$('#bg').fadeOut(500, function() {
		
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/bridgefashion_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/bridgefashion_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p4').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/fashionableeinor_bk.jpg)');
			$('#bg').fadeIn(500);	
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/fashionableeinor_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p5').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/castlefashion_bk.jpg)');
			$('#bg').fadeIn(500);	
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/castlefashion_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p6').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/mer_bk.jpg)');
			$('#bg').fadeIn(500);
				
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/mer_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p7').click(function() {
		
		$('#bg').fadeOut(500, function() {
		
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/remy_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/remy_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p8').click(function() {
		
		$('#bg').fadeOut(500, function() {
			
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/tom_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/tom_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
	$('#p9').click(function() {
		
		$('#bg').fadeOut(500, function() {
		
			$('#bg').css('background-image','url(images/backgrounds/people_and_fashion/xx_bk.jpg)');
			$('#bg').fadeIn(500);
			
		});
		
		
		$('#preview a').attr("href", "./images/lightbox/people_and_fashion/xx_lite.jpg");
		$('#preview').fadeIn('fast');
		
	});
	
});
