var titleElement, titlePosition, centerPosition, titleAcceleration, offCenter, bannerInterval;

addEvent(window, "load", initializePage);

function initializePage(event)
	{
	moveTitle();	
	}


titleAcceleration = [0, 0];
offCenter = [-50, -12];

function moveTitle()
	{
	titleElement = getId("bronwynLovesMatthew");
	titlePosition = [(getBrowserWidth() / 2) - (titleElement.clientWidth / 2) + offCenter[0], (titleElement.clientHeight / 2) + offCenter[1] - 100 ];
	centerPosition = [(getBrowserWidth() / 2) - (titleElement.clientWidth / 2), (titleElement.clientHeight / 2) - 100];
	bannerInterval = setInterval("nextAnimationStep_Title();", 50);
	}


function nextAnimationStep_Title()
	{
	if(titlePosition[0] > centerPosition[0])
		{
		titleAcceleration[0] -= 1;
		}
	else
		{
		titleAcceleration[0] += 1;
		}
	if(titlePosition[1] > centerPosition[1])
		{
		titleAcceleration[1] -= 1;
		}
	else
		{
		titleAcceleration[1] += 1;
		}
	titlePosition[0] += titleAcceleration[0];
	titlePosition[1] += titleAcceleration[1];
	titleElement.style.left = titlePosition[0] + "px"
	titleElement.style.top = titlePosition[1] + "px"
	}

function nextAnimationStep_dropTitle()
	{
	titleAcceleration[1] += 1;
	titlePosition[0] += titleAcceleration[0];
	titlePosition[1] += titleAcceleration[1];
	titleElement.style.left = titlePosition[0] + "px"
	titleElement.style.top = titlePosition[1] + "px"
	if(titlePosition[1] > 1280)
		{
		clearInterval(bannerInterval);
		titleElement.style.display = "none";
		document.location = "game.html"
		}
	}


var step2_timer;
var step2_height = 1;

function animateBeam()
	{
	getId("explosionStart").style.display = "block";
	step2_timer = setInterval("animateBeam_step2()", 50);
	}

function animateBeam_step2()
	{
	step2_height += 5;
	var explosionBeam = getId("explosionBeam");
	explosionBeam.style.display = "block";
	var beamImage = explosionBeam.getElementsByTagName("img")[0];
	explosionBeam.style.paddingTop = (308 - step2_height) + "px";	
	beamImage.style.width = "36px";
	beamImage.style.height = step2_height + "px";
	if(step2_height > 300)
		{
		clearInterval(step2_timer);
		setTimeout("animateBeam_step3()", 0);
		}

	}


function animateBeam_step3()
	{
	getId("explosionCloud").style.display = "block";
	clearInterval(bannerInterval);
	titleAcceleration[1] -= 10;
	bannerInterval = setInterval("nextAnimationStep_dropTitle()", 50);
	}


