// JavaScript Document

currentRound = 1;

function initializeAnim()
{
	animDone = false;

	currentStep = 1;

	document.getElementById('companyAnimDiv1').style.marginTop = '87px';
	document.getElementById('companyAnimText1').className = 'opacity0';
	image1top = 87;
	image1opac = 0;

	document.getElementById('companyAnimDiv2').style.marginTop = '87px';
	document.getElementById('companyAnimText2').className = 'opacity0';
	image2top = 87;
	image2opac = 0;

	document.getElementById('companyAnimDiv3').style.marginTop = '73px';
	document.getElementById('companyAnimText3').className = 'opacity0';
	image3top = 73;
	image3opac = 0;

	document.getElementById('companyAnimDiv4').style.marginTop = '64px';
	document.getElementById('companyAnimText4').className = 'opacity0';
	image4top = 64;
	image4opac = 0;

	document.getElementById('companyAnimDiv5').style.marginTop = '87px';
	document.getElementById('companyAnimText5').className = 'opacity0';
	image5top = 87;
	image5opac = 0;

	document.getElementById('companyAnimDiv6').style.marginTop = '87px';
	document.getElementById('companyAnimText6').className = 'opacity0';
	image6top = 87;
	image6opac = 0;

	document.getElementById('companyAnimDiv7').style.marginTop = '87px';
	document.getElementById('companyAnimText7').className = 'opacity0';
	image7top = 87;
	image7opac = 0;
	
	image8top = 87;
	image8opac = 0;
	
	image9top = 87;
	image9opac = 0;
	
	
	image10top = 87;
	image10opac = 0;
	
	
	

	animateCompany();
}

function animateCompany()
{
	waitFor = 40;

	if (currentStep == 1)
	{
		image1opac += 5;
		document.getElementById('companyAnimText1').className = 'opacity' + image1opac;

		if (image1opac == 100)
		{
			waitFor = 1000;
			currentStep = 2;
		}
	}
	else if (currentStep == 2)
	{
		image1top -= 5.5;
		document.getElementById('companyAnimDiv1').style.marginTop = image1top + 'px';

		image2opac += 5;
		document.getElementById('companyAnimText2').className = 'opacity' + image2opac;

		if (image2opac == 100)
		{
			currentStep = 3;
		}
	}
	else if (currentStep == 3)
	{
		image2top += 3.65;
		document.getElementById('companyAnimDiv2').style.marginTop = image2top + 'px';

		image3opac += 5;
		document.getElementById('companyAnimText3').className = 'opacity' + image3opac;

		if (image3opac == 100)
		{
			currentStep = 33;
			waitFor = 1000;
		}

	}
	else if (currentStep == 33)
	{
	
		document.getElementById('companyAnimDiv4').style.marginTop =  160+ 'px';

		image4opac += 5;
		document.getElementById('companyAnimText4').className = 'opacity' + image4opac;


		if (image4opac == 100)
		{
			if (currentRound == 3)
			{
				currentStep = 99;
				animDone = true;
			}else{

			currentStep = 4;
			waitFor = 5000;
		}
		}

	}
	else if (currentStep == 4)
	{
		image1opac -= 5;
		document.getElementById('companyAnimText1').className = 'opacity' + image1opac;
		image3opac -= 5;
		document.getElementById('companyAnimText3').className = 'opacity' + image3opac;
		image2opac -= 5;
		document.getElementById('companyAnimText2').className = 'opacity' + image2opac;
		document.getElementById('companyAnimText4').className = 'opacity' + image2opac;

		if (image3opac == 0)
		{
			currentStep = 5;
		}
	}

	else if (currentStep == 9)
	{
		image9opac += 5;
		document.getElementById('companyAnimText8').className = 'opacity' + image9opac;

		if (image9opac == 100)
		{
			waitFor = 5000;
			currentStep = 10;
		}
	}

	else if (currentStep == 10)
	{
		image9opac -= 5;
		document.getElementById('companyAnimText8').className = 'opacity' + image9opac;

		if (image9opac == 0)
		{
			currentStep = 5;
		}
	}


	else if (currentStep == 5)
	{
		image5opac += 5;
		document.getElementById('companyAnimText6').className = 'opacity' + image5opac;

		if (image5opac == 100)
		{
			waitFor = 1000;
			currentStep = 6;
		}
	}
	else if (currentStep == 6)
	{
		image6top -= 5.5;
		document.getElementById('companyAnimDiv6').style.marginTop = image6top + 'px';

		image7opac += 5;
		document.getElementById('companyAnimText7').className = 'opacity' + image7opac;

		if (image7opac == 100)
		{
			currentStep = 7;
		}
	}
	else if (currentStep == 7)
	{
		image7top += 5.5;
		document.getElementById('companyAnimDiv7').style.marginTop = image7top + 'px';

		image8opac += 5;
		document.getElementById('companyAnimText5').className = 'opacity' + image8opac;

		if (image8opac == 100)
		{
				currentStep = 8;
				waitFor = 5000;
		}
	}
	else if (currentStep == 8)
	{
		image5opac -= 5;
		document.getElementById('companyAnimText6').className = 'opacity' + image5opac;
		image8opac -= 5;
		document.getElementById('companyAnimText5').className = 'opacity' + image8opac;
		image7opac -= 5;
		document.getElementById('companyAnimText7').className = 'opacity' + image7opac;

		if (image7opac == 0)
		{
			currentStep = 11;
		}
	}
		else if (currentStep == 11)
	{
		image9opac += 5;
		document.getElementById('companyAnimText8').className = 'opacity' + image9opac;

		if (image9opac == 100)
		{
			waitFor = 5000;
			currentStep = 12;
		}
	}

	else if (currentStep == 12)
	{
		image9opac -= 5;
		document.getElementById('companyAnimText8').className = 'opacity' + image9opac;

		if (image9opac == 0)
		{
			currentStep = 13;
		}
	}
	else if (currentStep==13)
	{
		
			image1opac=0;
			image2opac=0;
			image3opac=0;
			image4opac=0;
			image5opac=0;
			image6opac=0;
			image7opac=0;
			image8opac=0;
			image9opac=0;
			image10opac=0;
			
			image1top=87;
			image2top=87;
			image3top=73;
			image4top=64;
			image5top=87;
			image6top=87;
			image7top=87;
			image8top=87;
			image9top=87;
			image10top=87;
			document.getElementById('companyAnimDiv1').style.marginTop = 87 + 'px';
			document.getElementById('companyAnimDiv2').style.marginTop = 87 + 'px';

			document.getElementById('companyAnimDiv4').style.marginTop = 175 + 'px';


			document.getElementById('companyAnimDiv6').style.marginTop = 87 + 'px';
			document.getElementById('companyAnimDiv7').style.marginTop = 87 + 'px';

			
			currentRound=currentRound+1;
			currentStep = 1;
		
		}



	else
	{
		animDone = true;
	}

	if (!animDone)
	{
		setTimeout('animateCompany()', waitFor);
	}
	else if (currentStep < 99)
	{
		setTimeout('initializeAnim()', 1000);
	}
}

setTimeout('initializeAnim()', 1000);

