
        /**
         * Configuration object.
         */
        function Config() {
            this.baseUrl = ""
            this.extraParams = ""
        }

        // configuration variable.
        var config = new Config()


        jQuery(document).ready(function($) {
            $('a[rel*=facebox]').facebox()
        }) 

        var map = null;
        var rect = null;

        // Special bounds for Australia to increase zooming.
        var australiaSw = new GLatLng(-41.90227704096369, 97.20703125)
        var australiaNe = new GLatLng(-2.7235830833483856, 167.16796875)
        var australiaBounds = new GLatLngBounds(australiaSw, australiaNe)

        // Special bounds for Europe to increase zooming.
        var europeSw = new GLatLng(32.39851580247402, -25.400390625)
        var europeNe = new GLatLng(61.227957176677876, 44.47265625)
        var europeBounds = new GLatLngBounds(europeSw, europeNe)

        // Special bounds for South America 
        var sAmericaSw = new GLatLng(-57.61010702068388, -129.55078125)
        var sAmericaNe = new GLatLng(15.961329081596647, 9.66796875)
        var sAmericaBounds = new GLatLngBounds(sAmericaSw, sAmericaNe)

        // Special bounds for North America 
        var nAmericaSw = new GLatLng(12.811801316582619, -128.583984375)
        var nAmericaNe = new GLatLng(48.922499263758255, -58.53515625)
        var nAmericaBounds = new GLatLngBounds(nAmericaSw, nAmericaNe)

        // Special bounds for Canada
        var canadaSw = new GLatLng(40.111688665595956, -133.857421875)
        var canadaNe = new GLatLng(65.44000165965534, -63.80859375)
        var canadaBounds = new GLatLngBounds(canadaSw, canadaNe)

        // Special bounds for South India
        var sIndiaSw = new GLatLng(5.659718554577285, 60.7763671875)
        var sIndiaNe = new GLatLng(26.391869671769022, 95.80078125)
        var sIndiaBounds = new GLatLngBounds(sIndiaSw, sIndiaNe)

        // Special bounds for Africa
        var sAfricaSw = new GLatLng(-38.34165619279593, -10.986328125)
        var sAfricaNe = new GLatLng(2.0210651187669897, 58.88671875)
        var sAfricaBounds = new GLatLngBounds(sAfricaSw, sAfricaNe)

        var boundsArray = [australiaBounds, europeBounds, sAmericaBounds, 
                           nAmericaBounds, canadaBounds, sIndiaBounds, sAfricaBounds]

        /**
         * Loads the Google Maps with an event handler.
         */
        function load(icon, shadow, iconWidth, iconHeight, baseUrl, extraParams) {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
				
                //map.addControl(new GSmallMapControl());

                var icon = new GIcon();
                icon.image = icon;
                icon.shadow = shadow;
                icon.iconSize = new GSize();
                icon.shadowSize = new GSize(22, 20);
                icon.iconAnchor = new GPoint(6, 20);
                icon.infoWindowAnchor = new GPoint(5, 1);

                map.setCenter(new GLatLng(28.0, 24.0), 1);

                // Add event listeners here.
                GEvent.addListener(map, "click", handleMapClick);
                GEvent.addListener(map, "mousemove", handleMouseOver);

                if(baseUrl) {
                    config.baseUrl = baseUrl
                }
                if(extraParams) {
                   config.extraParams = extraParams
                }
            }
        }

        /**
         * Handles the interactive map link click.
         */
        function handleInteractiveMapLinkClick() {
            var link = '<iframe src="' + config.baseUrl + 'venue_google_map.jsp?lat=' 
                + 20 + '&lon=' + 20 + '&approximation=' + 2 + '&' + config.extraParams + '" width="800px" height="500px" name="events"  marginheight="0" marginwidth="0" frameborder="0"></iframe>'
            jQuery.facebox(link)
        }

        /**
         * Handles the click on the map by showing the popup with the special 
         * map containing the markers with the BK Events.
         * The Australia and Europe regions have an higher zoom factor.
         */
        function handleMapClick(overlay, latlng) {
            if (latlng) { 
                var point = latlng
                var approximation = (sAmericaBounds.containsLatLng(point)) ? 3 : 4
                if(sIndiaBounds.containsLatLng(point)) {
                    approximation = 5;
                }
                for ( var i in boundsArray ) {
                    var bounds = boundsArray[i]
                    if(bounds.containsLatLng(latlng)) {
                        point = bounds.getCenter()
                        break;
                    }
                }
                var iFrameHtml = '<iframe src="' + config.baseUrl + 'venue_google_map.jsp?lat=' + point.y + '&lon=' 
                    + point.x + '&approximation=' + approximation 
                    + '&' + config.extraParams 
                    + '" width="800px" height="500px" name="events"  marginheight="0" marginwidth="0" frameborder="0"></iframe>'
                jQuery.facebox(iFrameHtml)
            }
        }

        /**
         * Handles the mouse over event by checking, if the cursor 
         * is in one of the pre-defined areas. If it is, it just highlights the 
         * areas with a specific color.
         * @param latlng The coordinates of the mouse.
         */ 
        function handleMouseOver(latlng) {
            if(latlng) {
                var found = false;
                for ( var i in boundsArray ) {
                    var bounds = boundsArray[i]
                    if(bounds.containsLatLng(latlng)) {
                        showRect(bounds, "#ff0000")
                        found = true
                        break;
                    }
                }
                if(!found) {
                    if(rect) {
                        map.removeOverlay(rect);
                    }
                }
            }
        }

        /**
         * Shows a rectangle with the value specified in <code>bounds</code>.
         * @param color The color used for filling the rectangle.
         */ 
        function showRect(bounds, color) {
            if (rect) {
                map.removeOverlay(rect);
            }
            var polyPoints = [	bounds.getSouthWest(),
                                new GLatLng(bounds.getSouthWest().lat(),bounds.getNorthEast().lng()),
                                bounds.getNorthEast(),
                                new GLatLng(bounds.getNorthEast().lat(),bounds.getSouthWest().lng()),
                                bounds.getSouthWest()
                                ]

            rect = new GPolygon(polyPoints, color, 1, 0.5, color, 0.1);
            GEvent.addListener(rect, "click", function(latlng) {
                handleMapClick(rect, latlng)
            });
            map.addOverlay(rect);
        }

