Hi there, I have a quastion for you. I am developing an application with PHP - JQuery - Google Map.
Here is the link: http://www.nothingisclear.net/ndovadoIgnition/index.php/newTrip You can see inside the source page, that I load several js into the div="wrapper" Inside newtrip.js i have a initialize two google map object outside every function: $(document).ready(function(){ var data = []; var fromMap = new GMap2(document.getElementById('fromMap')); var toMap = new GMap2(document.getElementById('toMap')); var geo = new GClientGeocoder(); $("#fromLocation").focus(function(){ $("#fromMap").show(); loadGoogleMap("fromMap", fromMap); }) As you can see, I fire the loadGoogleMap function with two parameters: the div name and the map object. The loadGoogleMap is situated into the file gmap2.function.je that I include into the document before the newtrip.js. We decided to keep the function separated to reach a better code quality. My question is, why I have to pass the mapObject as a parameter of the function? indeed i have to pass it as a parameter becaouse of the it is nt reachable!!!! I this that if I declare the frommap object outside every function it would be global for the page. Am i wrong??