﻿var y = -170; //Starting Location - top
var x = 350;
var dest_y = 50;  //Ending Location - top
var dest_y1 = -100
var interval = 2; //Move 10px every initialization
var y1 = 200



function moveImage() {

	//Keep on moving the image up until dest_y is reached
	document.getElementById("ufo").style.visibility = 'visible';
	if(y<dest_y) {
		y = y + interval;
	}
				
		//Move the image to the new location
		document.getElementById("ufo").style.top  = y+'px';
		//document.getElementById("ufo").style.left = x+'px';
	//Keep on calling this function every 100 microsecond 
	//	till the dest_y is reached
	if(y<dest_y) {
		window.setTimeout('moveImage()',0.05);
	}
	else {
		document.getElementById("main").style.zIndex = 10;
		moveImageDown();
	}
}

function moveImageDown() {

	//Keep on moving the image down until dest_y1 is reached
	if(y>dest_y1) {
		y = y - interval;
	}
				
		//Move the image to the new location
		document.getElementById("ufo").style.top  = y+'px';
		//document.getElementById("ufo").style.left = x+'px';
	//Keep on calling this function every 100 microsecond 
	//	till the dest_y1 is reached
	if(y>dest_y1) {
		window.setTimeout('moveImageDown()',0.05);
	}
}
