function animateIn()
{
	$('#content_wrapper').fadeIn('slow');
	var user = document.getElementById("userbox");
	var cart = document.getElementById("cartbox");
	if(user && !cart)
	{
		user.style.marginTop = '-8px';
		user.style.border = '1px solid silver';
	}
}

function animateOut()
{
	$('#content_wrapper').fadeOut('fast');
}

function csAnimateIn(step)
{
	switch(step)
	{
		case 0:
				$('#csHeader').hide();
				$('#csPage').hide();
				$('#csFooter').hide();
				$('#csNavBack').hide();		
				$('#bp1').hide();
				$('#bp2').hide();
				$('#bp3').hide();
				$('#bp4').hide();
				$('#bp5').hide();						
				$('#csHeader').fadeOut('fast');
				$('#csPage').fadeOut('fast');
				$('#csFooter').fadeOut('fast');
				$('#csNavBack').fadeOut('fast');
				$('#bp1').fadeOut('fast');
				$('#bp2').fadeOut('fast');
				$('#bp3').fadeOut('fast');
				$('#bp4').fadeOut('fast');
				$('#bp5').fadeOut('fast');						
				$('#content_wrapper').fadeIn('slow');
				var user = document.getElementById("userbox");
				var cart = document.getElementById("cartbox");
				if(user && !cart)
				{
					user.style.marginTop = '-8px';
					user.style.border = '1px solid silver';
				}
				$('#csHeader').fadeIn(3000);
				setTimeout('csAnimateIn(1);', 3000);
			break;
	
		case 1:
				$('#csPage').fadeIn(3000);
				setTimeout('csAnimateIn(2);', 3000);
			break;
		
		case 2:
				$('#bp1').fadeIn('slow');
				setTimeout('csAnimateIn(3);', 3000);
			break;
			
		case 3:
				$('#bp2').fadeIn('slow');
				setTimeout('csAnimateIn(4);', 3000);
			break;
			
		case 4:
				$('#bp3').fadeIn('slow');
				setTimeout('csAnimateIn(5);', 3000);
			break;
			
		case 5:
				$('#bp4').fadeIn('slow');
				setTimeout('csAnimateIn(6);', 3000);
			break;
			
		case 6:
				$('#bp5').fadeIn('slow');
				setTimeout('csAnimateIn(7);', 3000);
			break;
		
		case 7:
				$('#csFooter').fadeIn(3000);
				setTimeout('csAnimateIn(8);', 3000);
			break;
			
		case 8:
				$('#csHeader').show();
				$('#csPage').show();
				$('#csFooter').show();
				$('#bp1').show();
				$('#bp2').show();
				$('#bp3').show();
				$('#bp4').show();
				$('#bp5').show();	
				$('#csNavBack').fadeIn('slow');
				$('#csSkip').fadeOut('slow');
			break;
	}
}

function csAnimateIn2()
{
}

function csAnimateIn3()
{
	
}

function csImageOverlays()
{
	for(i = 0; i < $('.fullsizeLink').length; i++)
	{	
		var link = $('.fullsizeLink')[i];
		$('.fullsizeLink')[i].target = '';
		$('.fullsizeLink')[i].href = 'javascript:csExpandImage("' + $('img:first', $('.fullsizeLink')[i]).attr('src') + '");';
	}
}

function csExpandImage(src)
{
	$('.overlay').fadeOut();
	var minimumHeight = $('#footer').attr('bottom');
	$('body').append('<div class="overlay" style="height:' + minimumHeight + ';" onclick="csDestroyOverlays();" onkeydown="csDestroyOverlays();"><img src="' + src + '" style="max-width:80%;" /></div>');
	$('.overlay').fadeOut(0);
	$('.overlay').css('visibility', 'visible');
	$('.overlay').fadeIn('slow');
}

function csDestroyOverlays()
{
	//for(i = 0; i < $('.overlay').length; i++) $('.overlay')[i].fadeOut('slow');
	$('.overlay').fadeOut('slow', function() { 
		$('.overlay').remove();
		});
}
