generating dynamic info windows php Javascript Googlemaps
===

I wanna be able to dynamically generate the info for each info window using the php for loop i created due to certain variables in locations[i][3] so it will dynamically pull the information on each pass and i can simply assign it. but for some reason if i try to insert this. the code generates fine ... on the source page... but the map wont even load.. does anyone have a fix for this... and to help make it work... MUCH THX in ADVANCE!! the info has been dynamically pulled in a seperate script the $vars are just used for the count to pull the information from the individual arrays. the map markers generate fine with the lats and lng's its that [i][3] part of the location array thats being funky and -- ps. yes the $vars in the code have been set to zero again. but thats in the side script. so it DOES pull all the proper info. for the [3] string - the map just does not generate in the array.
    
    
    
    
    '<'script type="text/javascript">
    
    	//PHP - Lat,Lng ARRAY
    	var locations = [
    
    	php code <?php
    	$x = 0; $i = 0; $j = 0;
    	for($aa = 0; $aa < $count; $aa++) {
    	echo "['" . $business_name[$x] . "'," . $lat[$i] . "," . $lng[$j] . "," . "<div class='coupon'><div class='ribbon'><div class='ribbon-stitches-top'></div><strong class='ribbon-content'><h1>$deal[$y]</h1></strong><div class='ribbon-stitches-bottom'></div></div><div class='picture_coupon'><img src='$deal_photo[$b]' width='150' height='100' /></div><div class='deal'><center><h1>$deal[$y]</h1>$deal_info[$a]<b>Expires: $deal_expiration[$c]</b></center></div></div>" . "],";
    	$x++; $i++; $j++; $id++;
    	}
    	?>  END of PHP CODE
    	[ , , , ]
    	//['Maroubra Beach', -33.950198, 151.259302, 6]
    	];	
    	//PHP - Lat,Lng ARRAY 
          var map;
    
          function initialize() {
            var myOptions = {
              zoom: 13,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById('map_canvas'),
                myOptions);
    
            // Try HTML5 geolocation
            if(navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(function(position) {
                var pos = new google.maps.LatLng(position.coords.latitude,
                                                 position.coords.longitude);
    
    // INVERSE CODE PHP DYNAMIC
     
        var infowindow = new google.maps.InfoWindow();
    
        var marker, i;
    	
    	var image = '../images/map-icons/blue.png';
        for (i = 0; i < locations.length; i++) {  
          marker = new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][1], locations[i][2]),
            map: map,
    		icon: image
          });
    
          google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
              infowindow.setContent(locations[i][3]);
              infowindow.open(map, marker);
            }
          })(marker, i));
        }
    /* */
    // INVERSE CODE PHP DYNAMIC 
    // GEO LOCATION SET CENTER AND ERROR HANDLING
                map.setCenter(pos);
              }, function() {
                handleNoGeolocation(true);
              });
            } else {
              // Browser doesn't support Geolocation
              handleNoGeolocation(false);
            }
          }
    
          function handleNoGeolocation(errorFlag) {
            if (errorFlag) {
              var content = 'Error: The Geolocation service failed.';
            } else {
              var content = 'Error: Your browser doesn\'t support geolocation.';
            }	
    // GEO LOCATION SET CENTER AND ERROR HANDLING		
    		
          }
    
        //  google.maps.event.addDomListener(window, 'load', initialize);
        </script>