<!-- javascript for animated moon
	//general animation functions here 

function moveObjTo( obj, x, y )
{
	if ( ! obj.style )
	{
		obj.top = y;
		obj.left = x;
	}
	else
	{
		obj.style.top = y + "px";
		obj.style.left = x + "px";
	}
}

function showObj( obj )
{
	if ( ! obj.style )
		obj.visibility = "visible";
	else
		obj.style.visibility = "visible";
}

function hideObj( obj )
{
	if ( ! obj.style )
		obj.visibility = "hidden";
	else
		obj.style.visibility = "hidden";
}
 	// specialised functions here 

var theMoon;
function moveMoon()//called first: 
{
	if ( document.getElementById )
		theMoon = document.getElementById("moon");
	else if ( document.layers )
		theMoon = document.layers["moon"];
	else if ( document.all )
		theMoon = document.all.item("moon");

	if ( theMoon )
	{
		doMove();
	}
}

var moonRadius = 75; //allow a bit over so its wholly obscured; actually 149 px dia
var yPos = 300 ;  //this is the first value used for y: hereafter its calculated
var xPos = 0;
var width;

function doMove()  //set up start point
{
 	var availheight=screen.availHeight;
  	width = screen.availWidth + moonRadius;
	xPos = - moonRadius*2;
	yTop = availheight/5;
	moveObjTo( theMoon, xPos , yPos );
	showObj( theMoon );
	orbit();
}

function orbit()
{
	xPos += 1;
	var x=((width/3) - xPos)/50; //set for 800*600 screen: highest is ytop, lowest is ytop+{(400/50)= 8}**2
	var xsq=x*x; 		   //i.e. lowest is ytop+64
	yPos=yTop + xsq;   //because screen position increases downwards

	if ( xPos <width)
	{
		moveObjTo( theMoon, xPos , yPos );
		setTimeout( "orbit()", 30 );
	}
	else{
	hideObj( theMoon );//now off screen I hope
	}
	
}

//-->
