var jCanvas = null,
	jMsg1 = null,
	jMsg2 = null,
	jMsg3 = null,
	jPhoto1 = null,
	jPhoto2 = null,
	jPhoto3 = null,
	jPhoto4 = null,
	jPhoto5 = null;

$(function() {
	jCanvas = $('#splash-canvas');
	jMsg1 = $('#msg-1');
	jMsg2 = $('#msg-2');
	jMsg3 = $('#msg-3');
	jPhoto1 = $('#photo1');
	jPhoto2 = $('#photo2');
	jPhoto3 = $('#photo3');
	jPhoto4 = $('#photo4');
	jPhoto5 = $('#photo5');
	animPhase1();
});

// show canvas
function animPhase1() {
	jCanvas.animate({opacity: .5}, 1000, animPhase2);
}

// show 'devoted to...'
function animPhase2() {
	jMsg1.find('.line-1').animate({opacity: 1}, 1000, animPhase3 );
}

// show 'with integrity'
function animPhase3() {
	setTimeout(
		function() {
			jMsg1.find('.line-3').animate({opacity: 1}, 1000, animPhase4);
		}, 1000
	);
}
// show 'offering the security...'
function animPhase4() {
	setTimeout(
		function() {
			jMsg2.find('.line-1').animate({opacity: 1}, 1000, animPhase5);
		}, 1000
	);
}

// hide msg1 and msg2
// swap photos
// stretch canvas
function animPhase5() {
	setTimeout(
		function() {
			jPhoto1.animate({opacity:0},500);
			jPhoto2.animate({opacity:1},500)
			jMsg1.fadeOut('slow');
			jMsg2.fadeOut('slow');
			jCanvas.animate({width: '984px', height: '100px', top: '174px'}, 1000, animPhase6);
		}, 3000
	);
}

// show left text segment: "a forcast lifetime warranty roof..."
function animPhase6() {
	jMsg3.find('.line-1').animate({left: '120px'}, 1000, animPhase7);
}

// show right text segment: "provides peace of mind"
function animPhase7() {
	jMsg3.find('.line-2').animate({right: '200px'}, 1000, animPhase8);
}

// show final text segment: "a solid warranty from a solid company"
function animPhase8() {
	jMsg3.find('.line-3').animate({opacity: 1}, animPhase9);
}

// photo swap
function animPhase9() {
	setTimeout(
		function() {
			jPhoto2.animate({opacity:0},500);
			jPhoto3.animate({opacity:1},500, animPhase10);
		}, 2000
	);
}

// photo swap
function animPhase10(){
	setTimeout(
		function() {
			jPhoto3.animate({opacity:0},500);
			jPhoto4.animate({opacity:1},500, animPhase11);
		}, 3000
	);
}

// final photo swap: pop 5 into view, exposing 4, and move 5 down to body area, then show testimonial header/link
function animPhase11() {
	jPhoto5.removeClass('opac-0');
	jPhoto4.animate({
		width: '372px',
		height: '104px',
		top: '310px',
		left: '240px'
	},1500);
	$('#testimonial').show();
}



