Currently developing a minor app that gets the users location and returns it by centering the map on it. The problem I have is retrieving data. Using alert I've found out that the array that is meant to return the values doesn't contain anything. Any ideas?

Code:
var locations = new Array();

var directLocX, directLocY;

//get positions
function getLocation()
{ 
 //alert("@_)");
 directLoc = document.getElementById("trackLocs");
 
	if (navigator.geolocation)
 	{
   		navigator.geolocation.getCurrentPosition(showPosition);
 	}	
 	else
 	{
	  	directLoc.innerHTML="Geolocation is not supported by this browser.";
	}
}
  
function showPosition(position)
{
	directLocX = position.coords.latitude;
	directLocY = position.coords.longitude;
	//alert(directLocX + " " + directLocY);
  	directLoc.innerHTML="Latitude: " + position.coords.latitude + "<br>Longitude: " +  position.coords.longitude;
	locations[directLocX, directLocY];
	return locations;	
  
}

//load map
function initialize()
{
	getLocation();
	var mapProp = { center:new google.maps.LatLng(locations[0],locations[1]), zoom:5,  mapTypeId:google.maps.MapTypeId.ROADMAP };
	var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}