Access to global variable within jQuery?

Access to global variable within jQuery?

I assume it's a problem with the scope, but no matter what I try, I can't get the variable to accessible within jQuery. I understand that variables created within a function are only accessible by that function. But global variable should be accessible also within functions, no?

I define a global variable on a page using Google maps. Using a jQuery function, I then draw a marker and push that marker to the global variable.

When I try to remove the marker, using a click event jQuery I can't get the function to access the variable "mCirc2". Why is it not accessible for the jQuery function when it was possible to change it with the other jQuery function?

The function below creates the marker, with the one in the middle, I try to remove it.

  1. var mCirc2;
  2. var mCirc2 = [];
  3.   function initialize() {
  4.      mapoptions = ...
  5.      map = new google.maps.Map...

  6.         $(document).ready(function(){
                $('#lSpeed').live('click', function(event) {       

                $('#rSpeed').live('click', function(event) {       
                     toggleRoutes(false, mCirc2)
                     var mCirc2 = [];

                $('#sSpeed').live('click', function(event)  {
                     var vtime = $("input#time").val();
                     var vta   = $("input#ta").val();
                     var vspeed= $("input#speed").val();
                     var vR3 = Math.round((vtime/2/60 - 25/60 - vta/2/60)*vspeed * 1000, 0)
                     var marker = new google.maps.Marker({map: map, position: new google.maps.LatLng(vMapC[0], vMapC[1]), title: vAptC, visible: false });
                     var c2000  = new google.maps.Circle({map:map, radius: vR3, fillColor: '#0000FF', strokeColor: '#0000FF', strokeWeight:0, fillOpacity:0.1, visible: true});
                     c2000.bindTo('center', marker, 'position');
                     return false;

In Firebug I can see that the variable mCirc2 is defined in the global scope, but under the function mCirc2 is undefined and therefore the function is not working.

I tried replacing mCirc2 with window.mCirc2 but that just throws another error.

How can I access the variable mCirc2 here?

Thanks in advance.