    var bigGMap;
    var setPoints = [];
    var houseRefs = [];
    var currentIconObject;
    var zoomLevel = 8;
    var geocoder = null;
    var approxIcon;	///
    var approxIcon_v2;
    var houseIcon_v2;
    var isPartner;
    // the icon information is passed to this function
    function bigGMap_createMarker(point, icon, html)
    {
      var bigmarker = new GMarker(point, icon);
      GEvent.addListener(bigmarker, "click", function() {
        bigmarker.openInfoWindowHtml(html);
      });
      return bigmarker;
    }
    
    function bigGMap_createCountryMarker(point, icon, searchTerm)
    {
        var marker = new GMarker(point,icon);
        marker.title = searchTerm;
        return marker;
    }
   
    function PointHasMark(aLat, aLon)
    {
        if (setPoints.length == 0) return false;
        for (var counter=0; counter < setPoints.length; counter++)
        {
            var aPoint = setPoints[counter];
            if (aPoint.y==aLat && aPoint.x==aLon) 
            {
                var matchingHouseRef = houseRefs[counter];
                return matchingHouseRef;               
            }
        }
        return "";
    }
    
    function RandomMove(coorValue)
    {
        var randNum = Math.random();
        if (randNum > 0.5)
        {   
            return coorValue - 0.003;
        }
        else
        {
            return coorValue + 0.003;
        }
    }
    
    function bigGMap_drawGoogleMap(divId)
    {   
        setPoints = [];
        houseRefs = [];
        
        if (GBrowserIsCompatible()) 
        { 
            // This icon is a different shape, so we need our own settings
            var houseIcon = new GIcon();
            houseIcon.image = houseIconUrl;    
            if (isPartner)  
            houseIcon.iconSize = new GSize(21, 34 );
            else houseIcon.iconSize = new GSize(40, 60 );
            houseIcon.shadowSize = new GSize(36, 34);
            houseIcon.iconAnchor = new GPoint(5, 34);
            houseIcon.infoWindowAnchor = new GPoint(5, 2);
            houseIcon.infoShadowAnchor = new GPoint(14, 25);

			// global var Icon for approx markers (i.e. markers placed by way of geocoding region, country
			// TODO: these should be changed to new marker info
			/// (begin)

            approxIcon = new GIcon();
	        approxIcon.image = '/Templates/Styles/Images/redHouse.png';      
            if (isPartner)  
            houseIcon.iconSize = new GSize(21, 34 );
            else houseIcon.iconSize = new GSize(40, 60 );
            approxIcon.shadowSize = new GSize(36, 34);
            approxIcon.iconAnchor = new GPoint(5, 34);
            approxIcon.infoWindowAnchor = new GPoint(5, 2);
            approxIcon.infoShadowAnchor = new GPoint(14, 25);
            /// (end)

            var mapDiv = document.getElementById(divId);
            if (mapDiv == null)
            {
                return;
            }
            
            bigGMap = new GMap2(mapDiv);  
            bigGMap.addControl(new GLargeMapControl());
            bigGMap.addControl(new GScaleControl());
            bigGMap.addControl(new GMapTypeControl()); 
            if (bigGMap.getCenter()==null)
            {
                bigGMap.setCenter(new GLatLng(48.8069, 18.5449), 3);
            }

            if (markers.length == 0)
            {
                var point = new GLatLng(52.23315,14.0625);
                bigGMap.setCenter(point, zoomLevel);

                geocoder = new GClientGeocoder();
                for (var counter = 0; counter < whereToSearchMarkers.length; counter++)
                {
                    var whereToMarker = whereToSearchMarkers[counter];
                    geocoder.getLocations(whereToMarker[0], bigGMap_addToMap);
                }
            }
            else
            {
                for (var counter=0; counter < markers.length; counter++)
                { 
                    var marker = markers[counter];
                    if (counter == 0)
                        bigGMap_CenterMap(marker);
                    bigGMap_AddMarker(marker, houseIcon);
                }
            }          
        }
    }
    
    function bigGMap_AddMarker(markerObject, iconObject)
    {
        var markerName = markerObject[0];
        var latitude = markerObject[1];
        var longitude = markerObject[2];
        var fullAddress = markerObject[3];    
        var houseRefNumber = markerObject[4];    
        
        if (IsValidGpsCoor(longitude) && IsValidGpsCoor(latitude))
        {
            var latitudeF = parseFloat(latitude);
            var longitudeF = parseFloat(longitude);
            
            var point = new GLatLng(latitudeF, longitudeF);
            markerName = markerName + "<p style=\"Color:White;\">valid</p><p style=\"Color:White;\">long=" + longitude + "; lat=" + latitude + "</p>";
            var marker = bigGMap_createMarker(point, iconObject, markerName);
            bigGMap.addOverlay(marker);
        }
        else
        {
            currentIconObject = iconObject;
            geocoder = new GClientGeocoder();
            var aMarkerName = markerName;
            geocoder.getLocations(fullAddress, function(response)
            {
                if (response.Status.code == '200')
                {
                    place = response.Placemark[0];
                    var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
                    
                    var houseRefOnPoint = PointHasMark(place.Point.coordinates[1], place.Point.coordinates[0]);
                    if (houseRefOnPoint != "") 
                    {   
                        var movedLatitude = RandomMove(place.Point.coordinates[1]);
                        var movedLongitude = RandomMove(place.Point.coordinates[0]);                        
                        aMarkerName = aMarkerName + "<p>Approximation</p><p style=\"Color:White;\">moved of " + houseRefOnPoint + "</p><p style=\"Color:White;\">long=" + longitude + "; lat=" + latitude + "</p>";
                        
                        var movedPoint = new GLatLng(movedLatitude, movedLongitude);
                        var movedMarker = bigGMap_createMarker(movedPoint, approxIcon, aMarkerName);    /// currentIconObject -> approxIcon
                        bigGMap.addOverlay(movedMarker);
                        setPoints.push(point);
                        houseRefs.push(houseRefNumber)
                    }
                    else
                    {
                        aMarkerName = aMarkerName + "<p>Approximation</p><p style=\"Color:White;\">long=" + longitude + "; lat=" + latitude + "</p>";
                        var marker = bigGMap_createMarker(point, approxIcon, aMarkerName);   /// currentIconObject -> approxIcon
                        if (bigGMap.getCenter()==null)
                        {
                            bigGMap.setCenter(new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]), zoomLevel);
                        }
                        bigGMap.addOverlay(marker);
                        setPoints.push(point);
                        houseRefs.push(houseRefNumber)
                    }
                    
                }
            });
        }
    }
    
    function IsValidGpsCoor(gpsCoorString)
    {
        return (gpsCoorString!=null && gpsCoorString!=0 && gpsCoorString<90);
    }
    
    function bigGMap_addToMap(response)
    {
        if (response.Status.code == '200')
        {  
            place = response.Placemark[0];
            var latitude = place.Point.coordinates[1];
            var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
            
            var countryHasPropertiesIcon = new GIcon();
            countryHasPropertiesIcon.image = countryHasPropertiesImage + '?countryName=' + response.name;      
            countryHasPropertiesIcon.iconSize = new GSize(40, 25);
            countryHasPropertiesIcon.shadowSize = new GSize(0, 0);
            countryHasPropertiesIcon.iconAnchor = new GPoint(0, 0);
            countryHasPropertiesIcon.infoWindowAnchor = new GPoint(0, 0);
            countryHasPropertiesIcon.infoShadowAnchor = new GPoint(0, 0);
            
            var marker = bigGMap_createCountryMarker(point, countryHasPropertiesIcon, response.name);
            bigGMap.addOverlay(marker);
        }
    }
    
    function bigGMap_CenterMap(markerObject)
    {
        var markerName = markerObject[0];
        var latitude = markerObject[1];
        var longitude = markerObject[2];
        var fullAddress = markerObject[3];
        
        if (IsValidGpsCoor(longitude) && IsValidGpsCoor(latitude))
        {
            bigGMap.setCenter(new GLatLng(latitude,longitude), zoomLevel);
        }
        else
        {
            geocoder = new GClientGeocoder();
            geocoder.getLocations(fullAddress, bigGMap_CenterMapCallBack);
        }
    }
    
    function bigGMap_CenterMapCallBack(response)
    {
        if (response.Status.code=='200') //code 200=G_GEO_SUCCESS
        {  
            place = response.Placemark[0];
            var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
            bigGMap.setCenter(point, zoomLevel);
        }
        else if (response.Status.code=='602') //code 602=G_GEO_UNKNOWN_ADDRESS - if subregion not found use country
        {
            place = response.name;
            var countryName = place.substring(place.indexOf(',')+2, place.length);
            geocoder = new GClientGeocoder();
            geocoder.getLocations(countryName, bigGMap_CenterMapCountryCallBack);
        }
    }
    
    function bigGMap_CenterMapCountryCallBack(responseCountry)
    {
        if (responseCountry.Status.code=='200') //code 200=G_GEO_SUCCESS
        {  
            place = responseCountry.Placemark[0];
            var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
            bigGMap.setCenter(point, 6);
        }
    }

	/* this is a v2 version which is used only on the redesigned website */
    function bigGMap_drawGoogleMap_v2(divId)
    {   
        setPoints = [];
        houseRefs = [];
        
        if (GBrowserIsCompatible()) 
        { 
            // This icon is a different shape, so we need our own settings
            houseIcon_v2 = new GIcon();
            houseIcon_v2.image = houseIconUrl;   
			houseIcon_v2.image = "/Templates/Styles/Images/googlemap_icon_precise_arrow.png";
			houseIcon_v2.shadow = "/Templates/Styles/Images/googlemap_icon_precise_shadow.png";
			houseIcon_v2.iconSize = new GSize( 45, 60 );
			houseIcon_v2.shadowSize = new GSize( 45, 60);
			houseIcon_v2.iconAnchor = new GPoint( 23, 46 );
			houseIcon_v2.infoWindowAnchor = new GPoint( 23, 3 );
   
			// global var Icon for approx markers (i.e. markers placed by way of geocoding region, country
            approxIcon_v2 = new GIcon();
			approxIcon_v2.image = "/Templates/Styles/Images/googlemap_icon_unprecise_arrow.png";
			approxIcon_v2.shadow = "/Templates/Styles/Images/googlemap_icon_unprecise_shadow.png";
			approxIcon_v2.iconSize = new GSize( 45, 60 );
			approxIcon_v2.shadowSize = new GSize( 45, 60);
			approxIcon_v2.iconAnchor = new GPoint( 23, 46 );
			approxIcon_v2.infoWindowAnchor = new GPoint( 23, 3 );

            var mapDiv = document.getElementById(divId);
            if (mapDiv == null)
            {
                return;
            }
            
            bigGMap = new GMap2(mapDiv);  
            bigGMap.addControl(new GLargeMapControl());
            bigGMap.addControl(new GScaleControl());
            bigGMap.addControl(new GMapTypeControl()); 
            if (bigGMap.getCenter()==null)
            {
                bigGMap.setCenter(new GLatLng(48.8069, 18.5449), 3);
            }

            if (markers.length == 0)
            {
                var point = new GLatLng(52.23315,14.0625);
                bigGMap.setCenter(point, zoomLevel);

                geocoder = new GClientGeocoder();
                for (var counter = 0; counter < whereToSearchMarkers.length; counter++)
                {
                    var whereToMarker = whereToSearchMarkers[counter];
                    geocoder.getLocations(whereToMarker[0], bigGMap_addToMap_v2);
                }
            }
            else
            {
                for (var counter=0; counter < markers.length; counter++)
                { 
                    var marker = markers[counter];
                    if (counter == 0)
                        bigGMap_CenterMap(marker);
                    bigGMap_AddMarker_v2(marker, houseIcon_v2);
                }
            }          
        }
    }

	/* v2 version for use in redesigned pages */
    function bigGMap_AddMarker_v2(markerObject, iconObject)
    {
        var markerName = markerObject[0];
        var latitude = markerObject[1];
        var longitude = markerObject[2];
        var fullAddress = markerObject[3];    
        var houseRefNumber = markerObject[4];    
        
        if (IsValidGpsCoor(longitude) && IsValidGpsCoor(latitude))
        {
            var latitudeF = parseFloat(latitude);
            var longitudeF = parseFloat(longitude);
            
            var point = new GLatLng(latitudeF, longitudeF);
            markerName = markerName;
            var marker = bigGMap_createMarker(point, iconObject, markerName);
            bigGMap.addOverlay(marker);
        }
        else
        {
            currentIconObject = iconObject;
            geocoder = new GClientGeocoder();
            var aMarkerName = markerName;
            geocoder.getLocations(fullAddress, function(response)
            {
                if (response.Status.code == '200')
                {
                    place = response.Placemark[0];
                    var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
                    
                    var houseRefOnPoint = PointHasMark(place.Point.coordinates[1], place.Point.coordinates[0]);
                    if (houseRefOnPoint != "") 
                    {   
                        var movedLatitude = RandomMove(place.Point.coordinates[1]);
                        var movedLongitude = RandomMove(place.Point.coordinates[0]);                        
                        aMarkerName = aMarkerName;
                        
                        var movedPoint = new GLatLng(movedLatitude, movedLongitude);
                        var movedMarker = bigGMap_createMarker(movedPoint, approxIcon_v2, aMarkerName);    /// currentIconObject -> approxIcon
                        bigGMap.addOverlay(movedMarker);
                        setPoints.push(point);
                        houseRefs.push(houseRefNumber)
                    }
                    else
                    {
                        aMarkerName = aMarkerName;
                        var marker = bigGMap_createMarker(point, approxIcon_v2, aMarkerName);   /// currentIconObject -> approxIcon
                        if (bigGMap.getCenter()==null)
                        {
                            bigGMap.setCenter(new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]), zoomLevel);
                        }
                        bigGMap.addOverlay(marker);
                        setPoints.push(point);
                        houseRefs.push(houseRefNumber)
                    }
                    
                }
            });
        }
    }

    function bigGMap_addToMap_v2(response)
    {
        if (response.Status.code == '200')
        {  
            place = response.Placemark[0];
            var latitude = place.Point.coordinates[1];
            var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
            
            var countryHasPropertiesIcon = new GIcon();
            countryHasPropertiesIcon.image = countryHasPropertiesImage + '?countryName=' + response.name;      
            countryHasPropertiesIcon.iconSize = new GSize(40, 25);
            countryHasPropertiesIcon.shadowSize = new GSize(0, 0);
            countryHasPropertiesIcon.iconAnchor = new GPoint(0, 0);
            countryHasPropertiesIcon.infoWindowAnchor = new GPoint(0, 0);
            countryHasPropertiesIcon.infoShadowAnchor = new GPoint(0, 0);
            
            var marker = bigGMap_createCountryMarker(point, countryHasPropertiesIcon, response.name);
            bigGMap.addOverlay(marker);
        }
    }
