// JavaScript Document
$(document).ready(function(){
	if($('#stage').length){

		$('#stage > div').not(':first-child').hide();
		$('#stageNav a:first').addClass('active');
		Cufon.refresh('#subnav ul a');
		
		if($.browser.msie){
			$('#stage > div').css('background-color', '#FFF');	
		}
		
		$('#stageNav a').click(function(){
			var theClick = $(this);
			var targetHash = $(this).attr('href');
			theTarget = $(targetHash);
			
			if(theTarget.is(':hidden')){
				$('#stageNav a.active').removeClass('active');
				theClick.addClass('active');
				Cufon.refresh('#subnav ul a');
				
				$('#stage > div:visible').fadeOut(function(){
					theTarget.fadeIn();
				});
				
			}
			
			return false;
		});
		
		// Create anon function to keep variable scope local
		(function(){
			var theHash = window.location.hash;
			if(theHash){
				theHash = theHash.split('_')[0];
				$('#stageNav a[href$="' + theHash + '"]').click();
			}
		})();
	}
});
