var over;
var map;
var directions;
var emptied=0;
var route=0;
var konect;

function writemail(what) {
	if (!what) what = 0;
	if (what == "phone") {
		document.write("503.");
		document.write("376.0190");
	}
	if (what == "fax") {
		document.write("270.");
		document.write("398.0190");
	}
	if (what == 0) {
		document.write("mail@");
		if (document.getElementById('map')) mapload();
	}
}

function showhead() {
	over = 1;
	$('mainnavi').appear({duration:0.3});
}

function hidehead() {
	over = 0;
	window.setTimeout("fadenow()", 500);
}

function fadenow() {
	if (over ==0 ) {
		$('mainnavi').fade({duration:0.5});
	}
}

function mapload() {
	if (GBrowserIsCompatible()) {
		konect = new GLatLng(45.199259,-123.138869);
		map = new GMap2(document.getElementById("map"));
		map.setMapType(G_HYBRID_MAP);
		map.setCenter(konect, 14);
		map.addControl(new GSmallZoomControl());
		var marke = new GMarker(konect);
		var html1 = "<i>konect</i> Aviation<p>McMinnville Airport<br />503.376.0190<br />www.konect-aviation.com</p>";
		GEvent.addListener(marke, "click", function() {marke.openInfoWindowHtml(html1)});
		map.addOverlay(marke);
	}
}

function emptydrive() {
	if (emptied == 0) document.forms["directions"].start.value = "";
	emptied = 1;
}

function drivetokonect() {
	from = document.forms["directions"].start.value;
	if (from == "") {
		directions.load();
		map.setCenter(konect, 14);
	}
	else {
		if (route == 0) directions = new GDirections(map);
		route = 1;
		directions.load("from: " + from + " to: " + konect);
	}
	return false;
}
