Google Maps - Custom Gadgets



Simple Google Maps : Google Code - Custom Maps
Simple Custom Gadgets and Test your Google Gadget : Google Code - Custom Gadjets

Google Map Search

In Google Sites Insert > More Gadgets >Add Gaget by URL
The Google Map Search URL:

Google Map Search

The gadget spec URL could not be found


You can also modify the code by using the Google Gadget Editor.

Advanced Google Maps

Google Maps can be created for Google Gadgets so you can embed your custom Javascript and Module Code.


Example : Weather Map

94040 Weather Map




<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="__UP_loc__ Weather Map"
directory_title="Weather Map"
author="Doug R."
author_email="dougr.feedback+weathermap@gmail.com"
author_affiliation="Google Inc."
author_location="Mountain View, CA"
thumbnail="/ig/modules/weathermap-thm.png"
screenshot="/ig/modules/weathermap.png"
category="news" category2="tools"
height="600"
width="600"
description="Enter your zip code to get a local map with weather for various regions nearby.">
<Locale lang="en" country="us"/>
</ModulePrefs>
<UserPref name="loc" display_name="Zip Code" datatype="location" required="true" default_value="94040" />
<UserPref name="zoom" display_name="Zoom" default_value="Metro" datatype="enum">
<EnumValue value="City" />
<EnumValue value="Metro" />
<EnumValue value="Region" />
<EnumValue value="Nation" />
</UserPref>
<Content type="html" ><![CDATA[

<script src="http://maps.google.com/maps?file=api&amp;v=2.70" type="text/javascript"></script>

<div id="WMAP_map" style="width: 100%; height: 230px"></div>
<font size="-2">
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._setDaysOffset(0);"
id="WMAP_f+0">Current Conditions</a>
<a id="WMAP_bar0"> | </a>
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._setDaysOffset(1);"
id="WMAP_f+1">Today</a>
<a id="WMAP_bar1">|</a>
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._setDaysOffset(2);"
id="WMAP_f+2">Tomorrow</a>
<a id="WMAP_bar2"> | </a>
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._setDaysOffset(3);"
id="WMAP_f+3">+3</a>
<a id="WMAP_bar3"> | </a>
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._setDaysOffset(4);"
id="WMAP_f+4">+4</a>
<a id="WMAP_bar4"> | </a>
<a href="javascript:void(0);"
onclick="javascript:WMAP_handle._toggleWeather();"
id="WMAP_toggle">Off</a>
</font>

<script type="text/javascript">


function WMAP() {

// ***************** GLOBAL VARIABLES ***************

this.mini = true; // Distinguishes full-size vs. small size app
this.showWeather = true; // Global control to show / hide all weather

this.weatherApiUrl = "http://www.google.com/ig/api";
this.weathermapBaseDir = "/ig/modules/weathermap_content/";
this.iconBaseDir = this.weathermapBaseDir + "icons/";
this.iconDir = "small";
this.iconSize = 0;
this.iconAnchor = 0;
this.numberSize = 0;
this.numberSpacing = 0;
this.zeroPoint = new GPoint(0,0);

// city and tile load status:
this.NOT_LOADED = 0;
this.LOAD_REQUESTED = 1;
this.LOAD_COMPLETED = 2;
this.LOAD_CANCELLED = 3;
this.LOAD_NOT_FOUND = 4; // for cities with no weather data

this.GC_MIN = 15; // Garbage collecting
this.GC_MAX = 30;

this.numCitiesShown = 0;
this.numCitiesLoaded = 0;
this.tilesShown = new Array();
this.tilesLoaded = new Array();

this.currentZoomLevel = -1;
this.map = new GMap(document.getElementById("WMAP_map"));

this.pixelScale = new Array(
0.000010728836059570312,
0.000021457672119140625,
0.00004291534423828125,
0.0000858306884765625,
0.000171661376953125,
0.00034332275390625,
0.0006866455078125,
0.001373291015625,
0.00274658203125,
0.0054931640625,
0.010986328125,
0.02197265625,
0.0439453125,
0.087890625,
0.17578125,
0.3515625,
0.703125,
1.40625); // 45/32

// Tiling parameters:
this.MIN_LAT = 0;
this.MAX_LAT = 90;
this.MIN_LNG = -180;
this.MAX_LNG = 0;
this.LAT_RANGE = this.MAX_LAT - this.MIN_LAT;
this.LNG_RANGE = this.MAX_LNG - this.MIN_LNG;

// Note that the zoom level here is GMap (0: finest, 17: world).
this.MIN_ZOOM = 17;
this.MAX_ZOOM = 5; // Finest zoom level.
this.numTiles = new Array(
256, // 0 - 4: unused.
256,
256,
256,
256,
256, // 5: start from here.
256, // 6: city level.
128,
64, // 8: metro level.
32,
16,
8, // 11: region level.
4,
2,
1, // 14: nation level.
1,
1,
1 // 17: world view.
);

this.allTiles; //[zoom][x][y]

this.minTile = new GPoint(0,0);
this.maxTile = new GPoint(0,0);

this.offsetDays = 0;

// Timezone Offsets
this.UTCO = 0;
this.EST = -5;
this.CST = -6;
this.MST = -7;
this.PST = -8;
this.AKST = -9;
this.HST = -10;

// ************* Object Methods ************* //

this.toggleWeather = function() {
this.showWeather = ! this.showWeather;
var barText = "";
if (this.showWeather) {
document.getElementById("WMAP_toggle").innerHTML = "Off";
barText = "|";
} else {
document.getElementById("WMAP_toggle").innerHTML = "Weather On";
}

for (var o = 0; o < 5; o++) {
document.getElementById("WMAP_f+" + o).innerHTML = this.getNameForOffsetDays(o);
document.getElementById("WMAP_bar" + o).innerHTML = barText;
}

this.resetIcons();
}

this.getNameForOffsetDays = function (offset) {

if (!this.showWeather)
return "";

var name;
if (offset == 0)
name = "Current";
else if (offset == 1)
name = "Today";
else {
var d = new Date();
d.setDate(d.getDate() + offset - 1);

name = this.weekday[d.getDay()]
if (!this.mini)
name +=" " + (d.getMonth() + 1) + "/"+ d.getDate();
}

if (offset == this.offsetDays)
name = "<b>" + name + "</b>";

return name;
}

function showMap(point, map, zoom) {
if (point != null) {
map.centerAndZoom(point, zoom);
}
}

this.processUserPrefs = function () {
var startLng = -90; // Center on full USA by default
var startLat = 38;
this.currentZoomLevel = 14;

var prefs = new _IG_Prefs();
var zoomPref = prefs.getString("zoom");
if (zoomPref == "City")
this.currentZoomLevel = 6;
else if (zoomPref == "Metro")
this.currentZoomLevel = 8;
else if (zoomPref == "Region")
this.currentZoomLevel = 11;
else if (zoomPref == "Nation")
this.currentZoomLevel = 14;

var location = prefs.getString("loc");
if (location) {
var geocoder = new GClientGeocoder();
geocoder.getLatLng(
location, _IG_Callback(showMap, this.map, this.currentZoomLevel));
}

// Scan the URL for this page
var pairs = window.location.search.substring(1).split("&");
for (var i = 0; i < pairs.length; i++) {
var pos = pairs[i].indexOf('=');
if (pos == -1) continue;
var key = pairs[i].substring(0,pos);
key = key.replace(/\+/g, " ");
var value = pairs[i].substring(pos+1);
value = value.replace(/\+/g, " ");
value = window.decodeURIComponent ? decodeURIComponent(value) :
unescape(value);

if (key == "icons")
this.iconDir = value;
else if (key == "mini") {
if (value == "on")
this.mini = true;
else
this.mini = false;
} else if (key == "weather") {
if (value == "on")
this.showWeather = true;
else
this.showWeather = false;
} else if (key == "zoom")
this.currentZoomLevel = value;
}
}


// Allocate a 3-dimensional array:
this.initializeCityDataTiles = function () {
var i;
this.allTiles = [];
for (var z = this.MAX_ZOOM; z <= this.MIN_ZOOM; z++) {
this.allTiles[z] = new Array(this.numTiles[z]);
for (var x = 0; x < this.numTiles[z]; x++)
this.allTiles[z][x] = new Array(this.numTiles[z]);
}
}

// Put result into point
this.getTileForLatLng = function (lng, lat, zoom, point) {
var tiles = this.numTiles[zoom];

var x = Math.floor(tiles * (lng - this.MIN_LNG) / this.LNG_RANGE);
var y = Math.floor(tiles * (lat - this.MIN_LAT) / this.LAT_RANGE);

point.x = Math.min(Math.max(x,0),this.numTiles[zoom]-1);
point.y = Math.min(Math.max(y,0),this.numTiles[zoom]-1);
}

this.resetIcons = function() {
this.removeAllMarkers();
this.updateZoom();
this.isZoomChanged = true;
this.updateTiles();
}

this.setDaysOffset = function (newOffsetDays) {
var oldDays = this.offsetDays;
this.offsetDays = newOffsetDays;

document.getElementById("WMAP_f+" + oldDays).innerHTML =
this.getNameForOffsetDays(oldDays);
document.getElementById("WMAP_f+" + this.offsetDays).innerHTML =
this.getNameForOffsetDays(this.offsetDays);

this.resetIcons();
}

this.onMoveEnd = function () {
this.updateZoom();
this.updateTiles();
}

this.isZoomChanged = false;
this.oldZoomLevel = this.currentZoomLevel;
this.updateZoom = function () {
var newZoomLevel = this.map.getZoomLevel();
this.isZoomChanged = newZoomLevel != this.currentZoomLevel;
this.oldZoomLevel = this.currentZoomLevel;
this.currentZoomLevel = newZoomLevel;
}

this.removeElementFromArray = function (array, el) {
for (var i = array.length - 1; i >= 0; i--) {
if (array[i] == el) {
array.splice(i, 1); // cut this one element
return i;
}
}
return -1; // not found
}

this.hideCity = function (city) {
if (city.tempMarkers != null)
for (var i = city.tempMarkers.length - 1; i >= 0; i--)
this.map.removeOverlay(city.tempMarkers[i]);
this.map.removeOverlay(city.marker);
city.shown = false;
this.numCitiesShown--;
}

this.hideTile = function (tile) {
if (!tile.shown) {
return;
}

if (tile.loadStatus == this.LOAD_REQUESTED) {
tile.LoadStatus = this.LOAD_CANCELLED;
}

for (var i = 0; i < tile.length; i++) {
var city = tile[i];
if (city.loadStatus == this.LOAD_REQUESTED)
city.loadStatus = this.LOAD_CANCELLED
else
if (city.shown)
this.hideCity(city);
}
tile.shown = false;
this.removeElementFromArray(this.tilesShown, tile);
}

this.unloadTile = function(tileNum) {
var tile = this.tilesLoaded[tileNum];
if (tile.shown) {
return;
}

// Unload Cities:
var cities = this.allTiles[tile.z][tile.x][tile.y];
for (var i=0; i<cities.length; i++) {
cities[i] = null; // **** Does this truly release the memory?
this.numCitiesLoaded--;
}

this.allTiles[tile.z][tile.x][tile.y] = null;

// this one searches the array, but we know the # already:
// this.removeElementFromArray(this.tilesLoaded, tile);
this.tilesLoaded.splice(tileNum, 1);
}


// Shows a tile with batch fetching cities' weather.
this.showTile = function(tile) {
var citiesToLoad = [];
var bounds = this.map.getBounds();
for (var i = 0; i < tile.length; ++i) {
var city = tile[i];
if (city.loadStatus == this.LOAD_COMPLETED && !city.shown) {
this.showCity(city);
} else if (city.loadStatus == this.NOT_LOADED &&
bounds.containsLatLng(city.latLng)) {
city.loadStatus = this.LOAD_REQUESTED;
citiesToLoad.push(city);
}
}
this.loadCities(citiesToLoad);
tile.shown = true;
this.tilesShown.push(tile);
}

this.loadCities = function(cities) {
var MAX_BATCH_NUM_CITIES = 10;
var batchCities = [];
for (var i = 0; i < cities.length; ++i) {
batchCities.push(cities[i]);
if (batchCities.length >= MAX_BATCH_NUM_CITIES) {
this.fetchCities(batchCities);
batchCities = [];
}
}
if (batchCities.length > 0) {
this.fetchCities(batchCities);
}
};

this.fetchCities = function(cities) {
var params = [];
for (var i = 0; i < cities.length; ++i) {
params.push("weather=" + _esc(cities[i].name));
}
var url = this.weatherApiUrl + "?" + params.join("&");
var self = this;
_IG_FetchXmlContent(url, function(response) {
self.loadCitiesFromResponseXML(response, cities);});
};

this.loadTile = function (x, y, z) {
var tileRequest = GXmlHttp.create();
var tileUrl = this.weathermapBaseDir + "citytiles/zoom" + z + "/" +
z + "_" + y + "x" + x + ".xml";

this.allTiles[z][x][y] = new Object;
this.allTiles[z][x][y].loadStatus = this.LOAD_REQUESTED;
this.allTiles[z][x][y].x = x;
this.allTiles[z][x][y].y = y;
this.allTiles[z][x][y].z = z;

tileRequest.open("GET", tileUrl, true);
var thisRef = this;
tileRequest.onreadystatechange = function() {
if (tileRequest.readyState == 4) {
thisRef.loadTilesFromRequestXML(tileRequest.responseXML, x, y, z);
}
}
tileRequest.send(null);
}

this.loadTilesFromRequestXML = function (tileResponseXML, x, y, z) {
var cities;
if (tileResponseXML != null) {
var xmlTileMarkers = tileResponseXML.getElementsByTagName("marker");
cities = new Array(xmlTileMarkers.length);
for (var i=0; i<xmlTileMarkers.length; i++) {
cities[i] = new Object;
cities[i].name = xmlTileMarkers[i].getAttribute("city");
cities[i].name = cities[i].name.toLowerCase();
var lng = 1.0 * xmlTileMarkers[i].getAttribute("lng");
var lat = 1.0 * xmlTileMarkers[i].getAttribute("lat");
cities[i].point = new GPoint(lng, lat);
cities[i].latLng = new GLatLng(lat, lng);
cities[i].z = z;
cities[i].shown = false;
cities[i].marker = null;
cities[i].tempMarkers = null;
cities[i].temp = null;
cities[i].condition = null;
cities[i].html = null;
cities[i].loadStatus = this.NOT_LOADED;
}
} else {
cities = new Array();
}
// It could have been cancelled or completed by another request:
if (this.allTiles[z][x][y].loadStatus != this.LOAD_REQUESTED) {
return;
}
cities.loadStatus = this.LOAD_COMPLETED;
cities.x = x;
cities.y = y;
cities.z = z;
this.allTiles[z][x][y] = cities;

//this.numTilesLoaded++;
this.tilesLoaded.push(cities);

this.showTile(this.allTiles[z][x][y]);
}

this.removeAllMarkers = function () {
for (var t = this.tilesShown.length - 1; t >= 0; t--) {
var x = this.tilesShown[t].x;
var y = this.tilesShown[t].y;
var z = this.tilesShown[t].z;
this.hideTile(this.allTiles[z][x][y]);
}
}

this.minTile = new GPoint(0,0);
this.maxTile = new GPoint(0,0);
this.updateTiles = function () {
if (!this.showWeather) {
return;
}

var bounds = this.map.getBoundsLatLng();
var width = bounds.maxX - bounds.minX;
var height = bounds.maxY - bounds.minY;
// extend the view by 20%
bounds.minX -= width/5;
bounds.maxX += width/5;
bounds.minY -= height/5;
bounds.maxY += height/5;

this.getTileForLatLng(bounds.minX, bounds.minY, this.currentZoomLevel, this.minTile);
this.getTileForLatLng(bounds.maxX, bounds.maxY, this.currentZoomLevel, this.maxTile);

this.hideTiles();
this.addTiles();
if (this.tilesLoaded.length > this.GC_MAX)
this.garbageCollectTiles();
}

this.garbageCollectTiles = function() {
for (var i=0; i<this.tilesLoaded.length; i++) {
var tile = this.tilesLoaded[i];
if (tile.shown) {
continue;
}

var dist = 0;

if (tile.z == this.currentZoomLevel) {
if (tile.x < this.minTile.x)
dist += this.minTile.x - tile.x;
else
dist += tile.x - this.maxTile.x;

if (tile.y < this.minTile.y)
dist += this.minTile.y - tile.y;
else
dist += tile.y - this.maxTile.y;
} else {
dist = 100;
}

if (dist > 3) {
this.unloadTile(i);
i--; // repeat this index
if (this.tilesLoaded.length < this.GC_MIN)
break;
}
}
}

this.hideTiles = function() {
for (var t = this.tilesShown.length - 1; t >= 0; t--) {
var tx = this.tilesShown[t].x;
var ty = this.tilesShown[t].y;
var tz = this.tilesShown[t].z;
if (tz != this.currentZoomLevel ||
tx < this.minTile.x || tx > this.maxTile.x ||
ty < this.minTile.y || ty > this.maxTile.y) {
this.hideTile(this.allTiles[tz][tx][ty]);
}
}
}

this.addTiles = function() {

for (var x = this.minTile.x; x <= this.maxTile.x; x++) {
for (var y = this.minTile.y; y <= this.maxTile.y; y++) {
var tile = this.allTiles[this.currentZoomLevel][x][y];
if (tile == null ||
tile.loadStatus != this.LOAD_COMPLETED) { // we need to load it!
this.loadTile(x, y, this.currentZoomLevel);
} else {
this.showTile(tile);
}
}
}
}

this.showCity = function (city) {
if (this.iconSize == 0) // icon info not loaded yet
return;

var condition = city.condition[this.offsetDays];

var iconName = "";
if (condition == "sunny")
iconName += "clear";
else if (condition.indexOf("partly") != -1 &&
condition.indexOf("cloudy") != -1)
iconName += "partlycloudy";
else if (condition.indexOf("cloud") != -1 ||
condition.indexOf("overcast") != -1)
iconName += "cloudy";
else if (condition.indexOf("rain") != -1 ||
condition.indexOf("storm") != -1)
iconName += "rainy";
else if (condition.indexOf("snow") != -1 ||
condition.indexOf("sleet") != -1 ||
condition.indexOf("flurries") != -1)
iconName += "snowy";
else if (condition.indexOf("fog") != -1 ||
condition.indexOf("haze") != -1)
iconName += "foggy";
else
iconName += "clear";

// use night time icons
var hour = this.today.getHours();
if (this.offsetDays == 0 && (hour > 18 || hour < 7))
iconName = iconName + "moon";

city.marker = new GMarker(city.point, this.getIcon(iconName));

this.map.addOverlay(city.marker);

if (!this.mini) {
GEvent.addListener(city.marker, "click", function() {
city.marker.openInfoWindowHtml(city.html);
});
}

this.showCityTemp(city);

city.shown = true;
this.numCitiesShown++;
}

this.loadIconParameters = function() {
var iconsRequest = GXmlHttp.create();
iconsRequest.open("GET", this.iconBaseDir + this.iconDir + "/icons.xml", true);

var thisRef = this;
iconsRequest.onreadystatechange = function() {
if (iconsRequest.readyState == 4) {
thisRef.loadIconParametersFromResponseXML(iconsRequest.responseXML);
}
}
iconsRequest.send(null);
}

this.loadIconParametersFromResponseXML = function(xdoc) {
var iconInfo = xdoc.getElementsByTagName("icons")[0];
if (iconInfo != null) {
this.iconSize = new GSize(1*iconInfo.getAttribute("width"),
1*iconInfo.getAttribute("height"));
this.iconAnchor = new GPoint(this.iconSize.width / 2,
this.iconSize.height / 2);
}
var numberInfo = xdoc.getElementsByTagName("numbers")[0];
if (numberInfo != null) {
this.numberSize = new GSize(1*numberInfo.getAttribute("width"),
1*numberInfo.getAttribute("height"));
this.numberSpacing = 1*numberInfo.getAttribute("spacing");
}

this.createIcons();
this.resetIcons();
}

this.createIcons = function() {
var conditions = new Array("clear", "partlycloudy", "cloudy", "rainy", "snowy", "foggy");

for (var i=0; i<conditions.length; i++) {
eval("this.icon" + conditions[i] + " = this.createIcon(\"" + conditions[i] + "\");");
eval("this.icon" + conditions[i] + "moon = this.createIcon(\"" + conditions[i] + "-moon\");");
}
}

this.getIcon = function(condition) {
return eval("this.icon" + condition);
}

// createIcon is only used to create exactly 1 of the icons we need!
this.createIcon = function(condition) {
var icon = new GIcon();
icon.image = this.iconBaseDir + this.iconDir + "/" + condition + ".png";
icon.iconSize = this.iconSize;
icon.iconAnchor = this.iconAnchor;
icon.infoWindowAnchor = this.iconAnchor;

if (this.mini) { // prevent clicking
icon.imageMap = new Array();
icon.transparent = this.weathermapBaseDir + "transparent.png";
}

return icon;
}

this.loadCitiesFromResponseXML = function(xdoc, cities) {
var weathers = xdoc && xdoc.getElementsByTagName("weather");
if (weathers == null || weathers.length != cities.length) {
for (var i = 0; i < cities.length; ++i) {
cities[i].loadStatus = this.NOT_LOADED;
}
return;
}
for (var i = 0; i < cities.length; ++i) {
this.loadCityFromResponseXML(weathers[i], cities[i]);
}
};

this.loadCityFromResponseXML = function (xdoc, city) {
if (xdoc == null) {
city.loadStatus = this.NOT_LOADED;
return;
}

var units = xdoc.getElementsByTagName("unit_system");
if (units == null) {
city.loadStatus = this.LOAD_NOT_FOUND;
return;
}

if (units[0].getAttribute("data") == "SI")
city.units = "C";
else
city.units = "F";

// Load temp and condition -- both arrays of 5
city.temp = new Array(5);
city.condition = new Array(5);
var highs = xdoc.getElementsByTagName("high");
// "condition" data is buggy, so use "icon"
var conditions = xdoc.getElementsByTagName("icon");

var temp0xml = xdoc.getElementsByTagName("temp_" + city.units.toLowerCase())[0];

// Load date-time
city.datetime = xdoc.getElementsByTagName("current_date_time")[0].getAttribute("data");

city.temp[0] = temp0xml.getAttribute("data");
city.condition[0] = conditions[0].getAttribute("data");

for (var o = 1; o < 5; o++) {
city.temp[o] = highs[o-1].getAttribute("data");;
city.condition[o] = conditions[o].getAttribute("data");
}

if (!this.mini) {
// Now create the HTML
city.html = "<h3>"+xdoc.getElementsByTagName("city")[0].getAttribute("data")
+ "</h3><table border=0>";

for (var o = 0; o < 5; o++) {
city.html += "<tr>";
city.html += "<td><img src=\"http://www.google.com" + city.condition[o] + "\"></td>";
city.html += "<td>" + this.getNameForOffsetDays(o) + ":";
city.html += "</td><td>";
city.html += " " + city.temp[o] + "&deg;F";
city.html += "</td></tr>";
}
city.html += "</table>";
}

if (city.loadStatus != this.LOAD_REQUESTED) {
city.loadStatus = this.LOAD_COMPLETED; // we did load it, but no need to show
this.numCitiesLoaded++;
return;
}

city.loadStatus = this.LOAD_COMPLETED;
this.numCitiesLoaded++;

// helps prevent rapid zoom shifting causing many cities
if (this.currentZoomLevel == city.z)
this.showCity(city);

}

this.showCityTemp = function (city) {
if (city.tempMarkers == null || city.tempShownOffsetDays != this.offsetDays)
this.addCityTempMarkers(city);
for (var i = city.tempMarkers.length - 1; i >= 0; i--)
this.map.addOverlay(city.tempMarkers[i]);
}

this.addCityTempMarkers = function (city) {
city.tempShownOffsetDays = this.offsetDays;
city.tempMarkers = new Array();

var temp = city.temp[this.offsetDays];
var isNegative = (temp < 0);
if (isNegative)
temp *= -1;
var hundreds = Math.floor(temp / 100);
var tens = Math.floor(temp / 10);
var ones = temp % 10;

var start = this.numberSize.width / 2;
var step = this.numberSpacing;

if (isNegative) { // Position the minus
var pos;
if (hundreds > 0)
pos = start - step*2;
else if (tens > 0)
pos = start - step;
else
pos = start;
this.addDigitMarker("minus", pos, city);
}

if (hundreds >= 1)
this.addDigitMarker(hundreds, start - step, city);
if (hundreds >= 1 || tens >= 1)
this.addDigitMarker(tens, start, city);
this.addDigitMarker(ones, start + step, city);
this.addDigitMarker(city.units, start + step*2, city);
}

// TODO: reuse digit icons instead of NEW
this.addDigitMarker = function (digit, xPosition, city) {
var icon = new GIcon();
icon.image = this.iconBaseDir + this.iconDir + "/" + digit + ".png";
icon.iconSize = this.numberSize;
icon.iconAnchor = this.zeroPoint;
icon.windowAnchor = this.zeroPoint;

if (this.mini) { // prevent clicking
icon.imageMap = new Array();
icon.transparent = this.weathermapBaseDir + "transparent.png";
}

var point = new GPoint(city.point.x + xPosition * this.pixelScale[city.z], city.point.y);
var marker = new GMarker(point,icon);

if (!this.mini) {
GEvent.addListener(marker, "click", function() {
city.marker.openInfoWindowHtml(city.html);
});
}

city.tempMarkers.push(marker);
}

// ********************* MAIN *************************

if (this.mini)
this.map.addControl(new GSmallZoomControl());
else
this.map.addControl(new GLargeMapControl());

// Limit the zoom range.
var mapTypes = this.map.getMapTypes();
var maps2MinRes = 17 - this.MIN_ZOOM;
var maps2MaxRes = 17 - this.MAX_ZOOM;
for (var i = 0; i < mapTypes.length; ++i) {
mapTypes[i].getMinimumResolution = function() { return maps2MinRes; };
mapTypes[i].getMaximumResolution = function() { return maps2MaxRes; };
}

// Processes URL line parameters. It also resets the center of map.
this.processUserPrefs();

this.initializeCityDataTiles();

var thisRef = this;

this.loadIconParameters();

// Initialization:
if (this.mini) {
this.weekday = new Array("Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat");
} else {
this.weekday = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");
}
this.today = new Date();

for (var o = 0; o < 5; o++)
document.getElementById("WMAP_f+" + o).innerHTML =
this.getNameForOffsetDays(o);

// Main -- Listener Functions ------------------------

GEvent.addListener(this.map, 'moveend', function() {
thisRef.onMoveEnd();
});

// For JS Compiler: External function calls
this._setDaysOffset = this.setDaysOffset;
this._toggleWeather = this.toggleWeather;

// **************** END OF MAIN ************************
}

var WMAP_handle;
_IG_RegisterOnloadHandler(function() {
WMAP_handle = new WMAP();
});

</script>
]]>

</Content>
</Module>