//<![CDATA[
var map;
var ResizeFlg=0;
var ToolFlg=0;
function ResizeControl() {}
	ResizeControl.prototype = new GControl();
ResizeControl.prototype.initialize = function(map) {
	var container = document.createElement("div");
	var ResizeDiv = document.createElement("div");
	this.setButtonStyle_(ResizeDiv);
	container.appendChild(ResizeDiv);
	ResizeDiv.appendChild(document.createTextNode("E"));
	GEvent.addDomListener(ResizeDiv, "click", function() {
if(ResizeFlg == 0){
	document.getElementById("map_ctl").style.display="none";
	document.getElementById("map").style.marginLeft="0px";
	ResizeFlg = 1;
	} else{
	document.getElementById("map").style.marginLeft="300px";
	document.getElementById("map_ctl").style.display="block";
	ResizeFlg = 0;
}
	map.checkResize();
	});

      var ToolDiv = document.createElement("div");
      this.setButtonStyle_(ToolDiv);
      container.appendChild(ToolDiv);
      ToolDiv.appendChild(document.createTextNode("X"));
      GEvent.addDomListener(ToolDiv, "click", function() {
	if(ToolFlg == 0){	
	map.removeControl(obj1);
	map.removeControl(obj2);
	map.removeControl(obj3);
	map.removeControl(obj4);
	ToolFlg=1;
	} else {
	map.addControl(obj1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(25,0)));
	map.addControl(obj2);
	map.addControl(obj3);
	map.addControl(obj4);
	ToolFlg=0;
	}
      });

	map.getContainer().appendChild(container);
	return container;
}

ResizeControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
}

ResizeControl.prototype.setButtonStyle_ = function(button) {
	button.style.backgroundColor = "white";
	button.style.font = "small Arial";
	button.style.fontSize = "12px";
	button.style.border = "1px solid black";
	button.style.padding = "0px";
	button.style.marginBottom = "1px";
	button.style.textAlign = "center";
	button.style.width = "1em";
	button.style.cursor = "pointer";
}


function load()
{
	if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
	obj1 = new GLargeMapControl()
	obj2 = new GMapTypeControl()
	obj3 = new GOverviewMapControl(new GSize(170,170))
	obj4 = new GScaleControl()
	map.addControl(obj1, new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(20,0)));
	map.addControl(obj2);
	map.addControl(obj3);
	map.addControl(obj4);
        map.addControl(new ResizeControl());
        map.setCenter(lt_lg, zm, G_DEFAULT_MAP_TYPES[m_type]);
	map.enableDoubleClickZoom();
	map.enableContinuousZoom();
	new GKeyboardHandler(map);
	}
}

function form_write()
{
var f0 = '<form action="."></form>';
var f1 = '<form method=GET action="http://www.google.com/search" target="_blank"><INPUT type=hidden name=q maxlength=255><INPUT name=num type=hidden value=30><input type=hidden name="ie" value="UTF-8"><input type=hidden name="oe" value="UTF-8"><input type=hidden name=hl value=""><INPUT type="hidden" name=btnG value="Google Search"></form>';
var f2 = '<form action="http://images.google.com/images" target="_blank"><input name="q" type="hidden"><input type="hidden" name="oe" value="UTF-8"><input name="hl" type="hidden" value="en"><input name="btnG" type="hidden" value="Google Search"></form>'
var f3 = '<form method="get" action="http://news.google.com/news" target="_blank"><input type=hidden name=q value=""><input type=hidden name=num value="30"><input type=hidden name=hl value="en"><input type=hidden name=ie value="UTF-8"><input type=hidden name="btnG" value="Google Search"></form>';
var f4 = '<form action="http://books.google.com/books" method="get" target="_blank"><input type=hidden name=q value=""><input name=as_brr type=hidden value="0"><input name=btnG type=hidden value="Google Books"></form>';
var f5 ='<form method="get" action="http://www.google.com/search" target="_blank"><input type="hidden" name="q"><input type="hidden" name="as_sitesearch" value=".wikipedia.org"><input name="num" type="hidden" value="30"><input type="hidden" name="ie" value="UTF-8"><input type="hidden" name="oe" value="UTF-8"><input type="hidden" name="hl" value="en"><input type="hidden" name="btnG" value="Google Search"></form>';
document.write(f0+f1+f2+f3+f4+f5);
}

function p(a){if(a.match(/\-/)){a= a.replace(/\-/,'');return parseInt(a,36)/(-10000);}else{return parseInt(a,36)/10000;}}
function s(a){
	var point;
	var b = a.options[a.selectedIndex].value;
	if (b)
	{
		var lg = a.options[a.selectedIndex].value.split(',')[0];
		var lt = a.options[a.selectedIndex].value.split(',')[1];
		var lng = p(lg); //base36
		var lat = p(lt);
		if (lat != NaN)
		{
			var txt = a.options[a.selectedIndex].text;
			a.options[a.selectedIndex].style.color = "red";
			if (txt.match(/ \- /)) { txt = txt.split(' \- ')[0];}
			point = new GLatLng(lat, lng);
//			map.setCenter(point);
			var htm0 = "<div id=\"infowd\"><b>"+ txt + "</b><br />( "+lat+", "+lng+" )<hr /> Google ";
			var htm1 = "<a href=\"javascript:void(0)\" onclick=\"seek(2)\">Web</a> ";
			var htm2 = "<a href=\"javascript:void(0)\" onclick=\"seek(3)\">Images</a> ";
			var htm3 = "<a href=\"javascript:void(0)\" onclick=\"seek(4)\">News</a> ";
			var htm4 = "<a href=\"javascript:void(0)\" onclick=\"seek(5)\">Books</a> ";
			var htm5 = "<a href=\"javascript:void(0)\" onclick=\"seek(6)\">Wikipedia</a>";
			if (txt.match(/[^ -~]/)){var html = htm0 + htm1 + htm2 + htm5;} else{var html = htm0 + htm1 + htm2 + htm3 + htm4 + htm5;}
			map.openInfoWindowHtml(point, html);
			for(i=2;i<7;i++)document.forms[i].elements[0].value=txt;
		}
	}
}

function seek(a){document.forms[a].submit();}
function rst(){map.closeInfoWindow();}
//]]>
