window.onunload = function(e) {
	GUnload();
	var title = getActiveStyleSheet();
	createCookie("style", title, 365);
}

function GMapLoad(lat, lng, zoom, mapname, showcontrol, showmaker) {
	if (GBrowserIsCompatible()) {
		gmap = new GMap2(document.getElementById(mapname));
		gmap.setCenter(new GLatLng(lat,lng), zoom);
		if (showcontrol != false) {
			if (showcontrol == 'large')
				gmap.addControl(new GLargeMapControl());
			else
				gmap.addControl(new GSmallMapControl());
		}
		if (showmaker != false) {
			if (showmaker == true)
				gmap.addOverlay(new GMarker(new GLatLng(lat, lng)));
			else {
				var oda9Icon = new GIcon();
				oda9Icon.image = "/images/marker/oda9marker-" + showmaker + ".png";
				oda9Icon.iconSize = new GSize(24, 34);
				oda9Icon.shadow = "/images/marker/oda9marker-shadow.png";
				oda9Icon.shadowSize = new GSize(37, 34);
				oda9Icon.iconAnchor = new GPoint(11, 33);
				oda9Icon.infoWindowAnchor = new GPoint(12, 16);
				oda9Icon.infoShadowAnchor = new GPoint(18, 25);
				markerOptions = { icon:oda9Icon };
				gmap.addOverlay(new GMarker(new GLatLng(lat, lng), markerOptions));
			}
		}
	}
	return gmap;
}
function createMarker(shopinfo) {
    var shopIcon = new GIcon();
    shopIcon.iconSize = new GSize(24, 34);
    shopIcon.shadow = "/images/marker/oda9marker-shadow.png";
    shopIcon.shadowSize = new GSize(37, 34);
    shopIcon.iconAnchor = new GPoint(11, 33);
    shopIcon.infoWindowAnchor = new GPoint(12, 16);
    shopIcon.infoShadowAnchor = new GPoint(18, 25);
    shopIcon.image = "/images/marker/oda9marker-" + shopinfo["markertype"] + ".png";
	markerOptions = { icon:shopIcon };
	var marker = new GMarker(new GLatLng(shopinfo["lat"], shopinfo["lng"]), markerOptions);

	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(shopinfo["text"]);
	});
	return marker;
}
function set_marker(gmap, shoplist) {
	for (var i = 0; i < shoplist.length; i++) {
		gmap.addOverlay(createMarker(shoplist[i]));
/*		gmap.addOverlay(new GMarker(new GLatLng(shoplist[i]["lat"], shoplist[i]["lng"])));*/
	}	
}