I'm displaying a geographical map, which is divided in sectors, as apposed to counties, which are more recognisable off course. Therefore I want to display the names of the towns for the particular sector, which has the mouse arrow over it, so that the sector will make more sense to those viewing them. So far I have managed to get the coordinates of the mouse arrow and display them on the screen, by using onmousemove.

What I want next, is use a perl function at the server side to receive a set of coords from the client and send back to them a list of towns for this sector. This will also check if a new list needs to be sent - because the mouse arrow might still cover the same county.

First off, can I call a perl function from within a javascript function - the javascript function that is associated with onmousemove. How will the returned list be accessible to the calling function?

Second off, is this a stupid way of achieving what I want to do. What other ways might it be done? Remember that all the pixels in the map need to be associated with a sector.

The way I plan to this this would be to create a second map and give each sector a unique color.