views:

51

answers:

0

Can someone look below and tell me where I'm off? I can't get the custom icon to display - only the default.

thanks -

                        <script type="text/javascript">
                    //<![CDATA[

                    <?php if ($er_imglayout == 4 && $row->image2) { ?>
                        function domap()
                    <?php } else { ?>
                        function ezrealtymap()
                    <?php } ?>
                    {
                        // Check to see if this browser can run the Google API
                        if (GBrowserIsCompatible()) {

                            gmarkers = [];
                            htmls = [];
                            to_htmls = [];
                            from_htmls = [];
                            i=0;



                                  var icon = new GIcon();

icon.image = 'components/com_realtymap/images/image.png'; icon.shadow = 'components/com_realtymap/images/shadow.png'; icon.iconSize = new GSize(39,46); icon.shadowSize = new GSize(62,46); icon.iconAnchor = new GPoint(20,46); icon.infoWindowAnchor = new GPoint(20,0); icon.printImage = 'components/com_realtymap/images/printImage.gif'; icon.mozPrintImage = 'components/com_realtymap/images/mozPrintImage.gif'; icon.printShadow = 'components/com_realtymap/images/printShadow.gif'; icon.transparent = 'components/com_realtymap/images/transparent.png'; icon.imageMap = [32,1,34,2,35,3,36,4,36,5,37,6,37,7,37,8,37,9,37,10,37,11,37,12,37,13,37,14,37,15,37,16,37,17,37,18,37,19,37,20,37,21,37,22,37,23,37,24,37,25,37,26,37,27,37,28,37,29,37,30,37,31,37,32,36,33,35,34,35,35,33,36,31,37,29,38,27,39,27,40,26,41,25,42,24,43,23,44,21,45,18,45,16,44,14,43,13,42,13,41,12,40,11,39,10,38,7,37,5,36,3,35,3,34,2,33,1,32,1,31,1,30,1,29,3,28,3,27,3,26,3,25,3,24,3,23,3,22,3,21,3,20,3,19,3,18,3,17,3,16,3,15,3,14,3,13,3,12,3,11,3,10,3,9,3,8,1,7,1,6,2,5,2,4,3,3,4,2,6,1];

                            // Display the map, with some controls and set the initial location 
                            var map = new GMap2(document.getElementById("map"));
                            map.addControl(new GLargeMapControl3D ());
                            map.addControl(new GHierarchicalMapTypeControl());
                            map.setCenter(new GLatLng( <?php echo $row->declat;?>,<?php echo $row->declong;?>), <?php echo $er_mapres;?>);
                            map.setMapType(<?php echo $er_mapview;?>);
                            var customUI = map.getDefaultUI();
                            // Remove MapType.G_HYBRID_MAP
                            customUI.maptypes.satellite = false;
                            map.setUI(customUI);




                            // Set up three markers with info windows 

                            var point = new GLatLng( <?php echo $row->declat;?>,<?php echo $row->declong;?>);
                            var marker = createMarker(point,"<?php echo stripslashes($row->adline);?>","<?php echo stripslashes($row->adline);?>")
                            map.addOverlay(marker);

                        } else {

                            // display a warning if the browser was not compatible

                            alert("<?php echo _EZREALTY_MAPPING_INCOMPATIBLE;?>");
                        }
                    }

                    // This Javascript is based on code provided by the
                    // Blackpool Community Church Javascript Team
                    // http://www.commchurch.freeserve.co.uk/   
                    // http://www.econym.demon.co.uk/googlemaps/

                    //]]>

                    // A function to create the marker and set up the event window

                    function createMarker(point,icon,name,html) {
                        var marker = new GMarker(point,icon);

                        // The info window version with the "to here" form open

                        to_htmls[i] = html + '<br /><?php echo _EZREALTY_MAP_DIRECTIONS;?>: <strong><?php echo _EZREALTY_MAP_TOHERE;?></strong> - <a href="javascript:fromhere(' + i + ')"><?php echo _EZREALTY_MAP_FROMHERE;?></a>' +
                        '<br /><?php echo _EZREALTY_MAP_START;?>:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
                        '<input type="text" size="40" maxlength="40" name="saddr" id="saddr" value="" /><br />' +
                        '<input value="<?php echo _EZREALTY_MAP_DIRECTIONS;?>" type="submit">' +
                        '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                        // "(" + name + ")" + 
                        '"/>';

                        // The info window version with the "to here" form open

                        from_htmls[i] = html + '<br /><?php echo _EZREALTY_MAP_DIRECTIONS;?>: <a href="javascript:tohere(' + i + ')"><?php echo _EZREALTY_MAP_TOHERE;?></a> - <strong><?php echo _EZREALTY_MAP_FROMHERE;?></strong>' +
                        '<br /><?php echo _EZREALTY_MAP_END;?>:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
                        '<input type="text" size="40" maxlength="40" name="daddr" id="daddr" value="" /><br />' +
                        '<input value="<?php echo _EZREALTY_MAP_DIRECTIONS;?>" type="submit">' +
                        '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                        // "(" + name + ")" + 
                        '"/>';

                        // The inactive version of the direction info

                        html = html + '<br /><?php echo _EZREALTY_MAP_DIRECTIONS;?>: <a href="javascript:tohere('+i+')"><?php echo _EZREALTY_MAP_TOHERE;?></a> - <a href="javascript:fromhere('+i+')"><?php echo _EZREALTY_MAP_FROMHERE;?></a>';

                        GEvent.addListener(marker, "click", function() {
                            marker.openInfoWindowHtml(html);
                        });
                        gmarkers[i] = marker;
                        htmls[i] = html;
                        i++;
                        return marker;
                    }

                    // functions that open the directions forms
                    function tohere(i) {
                        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
                    }
                    function fromhere(i) {
                        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
                    }

                    </script>