Im trying to implement an active state for the maptype styles I created. The "map" maptype works because It is the default map to load but when I click through the others, they do not change. It is setup like this:
var typeMap = document.createElement("div");
container.appendChild(typeMap);
var elem = document.createElement("img");
if (map.getCurrentMapType().getName() == "Map"){
elem.src = "images/maptypes_active_01.png"; //active state
}else{
elem.src = "images/maptypes_normal_01.png"; //normal state
}
typeMap.appendChild(elem);
elem.className = "map-normal";
GEvent.addDomListener(typeMap, "click", function() {
map.setMapType(G_NORMAL_MAP);
});
var typeSat = document.createElement("div");
container.appendChild(typeSat);
var elem = document.createElement("img");
if (map.getCurrentMapType().getName() == "Satellite"){
elem.src = "images/maptypes_active_02.png";
}else{
elem.src = "images/maptypes_normal_02.png";
}
typeSat.appendChild(elem);
elem.className = "sat-normal";
GEvent.addDomListener(typeSat, "click", function() {
map.setMapType(G_SATELLITE_MAP);
});
var typeHy = document.createElement("div");
container.appendChild(typeHy);
var elem = document.createElement("img");
if (map.getCurrentMapType().getName() == "Hybrid"){
elem.src = "images/maptypes_active_03.png";
}else{
elem.src = "images/maptypes_normal_03.png";
}
typeHy.appendChild(elem);
elem.className = "hy-normal";
GEvent.addDomListener(typeHy, "click", function() {
map.setMapType(G_HYBRID_MAP);
});
http://www.trytyku.com/store_BACKUP/
Forgive me the setup is awful.