/****************************************
 common_topography.js
 This file contains functionality related to the layout and position of elements on an 
 HTML page.
 
 *****************************************/

/*--------------
getCoordinates() function:

This function returns the coordinates of the input parament (el).
--------------*/

function getCoordinates(el) {

	var positionX = 0;
	var positionY = 0;

	var coordinates = new Object();

	//Climb up the heirarchy of enclosing elements to calculate the position of the clicked image on the screen.
	while (el) {

			positionX += el.offsetLeft;
			positionY += el.offsetTop;
			el = el.offsetParent;
	}

	// positionX is the x-coordinate, positionY is the y-coordinate.
	coordinates.x = positionX;
	coordinates.y = positionY;

	return coordinates;
}

