$(document).ready(function(){
	//References
	var sections = $("#art_links a");
	var loading = $("#loading");
	var content = $("#artcent_cont");
	
	//Manage click events
	sections.click(function(){
		//show the loading bar
		showLoading();
		//load selected section
		switch(this.id){
			case "page1":
				content.fadeOut('slow', function() { 
				content.load("art_sec.html #section_page1", hideLoading);
				content.fadeIn('slow');
				});
				break;
			case "page2":
				content.fadeOut('slow', function() { 
				content.load("art_sec.html #section_page2", hideLoading);
				content.fadeIn('slow');
				});
				break;
			case "page3":
				content.fadeOut('normal', function() { 
				content.load("art_sec.html #section_page3", hideLoading);
				content.fadeIn('slow');
				});
				break;
			default:
				//hide loading bar if there is no selected section
				hideLoading();
				break;
		}
	});

	//show loading bar
	function showLoading(){
		loading
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"});
	};
	
	//hide loading bar
	function hideLoading(){
		loading.fadeTo(1000, 0);
		Shadowbox.setup();
		//begin mosaic init	
		$('.fade').mosaic({
			speed		:	2000		// 2 second fade
		});
				
		$('.bar').mosaic({
			animation	:	'slide',	// fade or slide
			speed		:	250			// point 25 seconds to slide 
		});
				
		$('.bar2').mosaic({
			animation	:	'slide'		//fade or slide
		});
				
		$('.bar3').mosaic({
			animation	:	'slide',	//fade or slide
			anchor_y	:	'top'		//Vertical anchor position
		});
		//end mosaic init
	};
		
	});
