//<![CDATA[
	
	//initial points to be added
	var geoHome = new LatLon("45.685163","-121.903393");
	var geoCenter = new LatLon("45.691","-121.884");	//where to senter map when loading - makes "home" slightly offset

	//the map object
	var map = new Map("mapContainer", "skamania", geoCenter, 5);
	//var map = new Map("mapContainer", "skamania", geoCenter, 5, MapViews.MAP);	//for use with satellite widget


	//toolbar and widgets
	var pan = new PanTool();
	var nav = new NavigatorWidget("closed");
	//var view = new SatelliteControlWidget();
	var toolbar = new ToolBarWidget();
	var toolLogo = new CustomSWFTool("","ymap/tool-logo.swf");
	var toolCar = new CustomSWFTool("","ymap/tool-car.swf");
	var toolPlane = new CustomSWFTool("","ymap/tool-plane.swf");
	var toolStar = new CustomSWFTool("","ymap/tool-star.swf");

	
	//markers and details
	var htmlHome = "<ul><li><a href='javascript:showAirport();'>Airport Information</a></li><li><a href='javascript:driveAirport();'>Driving Directions from PDX</a></li><li><a href='javascript:showAttractions();'>Area Attractions</a></li></ul>";
	var mkHome = new CustomPOIMarker( 'Skamania Lodge', 'Helpful Information', htmlHome, '0xBA8647', '0xffffff' );
	
	var htmlAirport = "<ul><li><a href='javascript:driveAirport();'>Driving Directions to Skamania Lodge</a></li><li><a href='javascript:zoomAirport();'>Zoom In Closer</a></li><li><a href='http://www.flypdx.com' target='_blank'>Visit Website</a></li></ul>";
	var mkAirport = new CustomPOIMarker( 'Portland Int\'l Airport', 'Helpful Information', htmlAirport, '0x526f27', '0xffffff' );

	
	//Airport Information
	var geoAirportCenter = new LatLon("45.7","-122.25");	//where to center map when showing airport route
	var geoAirport = new LatLon("45.5875","-122.59");	//airport

	
	//Driving Directions Information
	var htmlDirections = new Array();
	var mkDirections = new Array();
	var geoDirections = new Array();
	
	htmlDirections[0] = "Leave the airport via I-205 South<br /><a href='javascript:driveNext(0,6,1000);'>Next &gt;</a>";
	mkDirections[0] = new CustomPOIMarker( '1.', 'Exit Airport', htmlDirections[0], '0x526f27', '0xffffff' );
	geoDirections[0] = new LatLon("45.5709553478594","-122.551889419556");
	
	htmlDirections[1] = "Exit to I-84 East (toward The Dalles)<br /><a href='javascript:driveNext(1,6,3000);'>Next &gt;</a>";
	mkDirections[1] = new CustomPOIMarker( '2.', 'I-84 E', htmlDirections[1], '0x526f27', '0xffffff' );
	geoDirections[1] = new LatLon("45.5476117498166","-122.558240890503");

	htmlDirections[2] = "Continue east on I-84 until exit #44 -<br />Cascade Locks/Bridge of the Gods/Stevenson<br /><a href='javascript:driveNext(2,4,1000);'>Next &gt;</a>";
	mkDirections[2] = new CustomPOIMarker( '3.', 'Bridge of the Gods', htmlDirections[2], '0x526f27', '0xffffff' );
	geoDirections[2] = new LatLon("45.6588639526376","-121.898149251938");

	htmlDirections[3] = "Take the Bridge of the Gods across<br />the Columbia River (toll bridge), <br />and then turn east (right) on Highway 14<br /><a href='javascript:driveNext(3,4,1000);'>Next &gt;</a>";
	mkDirections[3] = new CustomPOIMarker( '4.', 'Highway 14', htmlDirections[3], '0x526f27', '0xffffff' );
	geoDirections[3] = new LatLon("45.6630705620333","-121.905230283737");

	htmlDirections[4] = "Immediately after entering<br />Stevenson city limits (approx. 1½ miles),<br />turn left onto Rock Creek Drive.<br /><a href='javascript:driveNext(4,2,1000);'>Next &gt;</a>";
	mkDirections[4] = new CustomPOIMarker( '5.', 'Stevenson', htmlDirections[4], '0x526f27', '0xffffff' );
	geoDirections[4] = new LatLon("45.6823299461653","-121.901550292969");

	htmlDirections[5] = "Travel a short distance on<br />Rock Creek Drive before turning<br />left onto Skamania Lodge Way.<br />You will then see the entrance.";
	mkDirections[5] = new CustomPOIMarker( '6.', 'Skamania Lodge', htmlDirections[5], '0x526f27', '0xffffff' );
	geoDirections[5] = new LatLon("45.6856803570988","-121.900058984756");


	var polyAirport = new PolylineOverlay("poly-airport.xml");
    //var polyAirport = new PolylineOverlay("http://skamania.com/poly-airport.xml");


	//Attractions Information
	
	var htmlAttractions = new Array();
	var mkAttractions = new Array();
	var geoAttractions = new Array();

	htmlAttractions[0] = "990 SW Rock Creek Dr<br />Stevenson, WA<br />509-427-8211<br /><a href='http://www.columbiagorge.org' target='_blank'>Visit Website</a>";
	mkAttractions[0] = new CustomPOIMarker( '1.', 'Columbia Gorge Interpretive Center', htmlAttractions[0], '0x79480f', '0xffffff' );
	geoAttractions[0] = new LatLon("45.689347","-121.899228");
	
	htmlAttractions[1] = "10 Wanapa St<br />Cascade Locks, OR<br />541-374-8427<br /><a href='http://www.sternwheeler.com' target='_blank'>Visit Website</a><br /><a href='mailto:sales@sternwheeler.com'>Email</a>";
	mkAttractions[1] = new CustomPOIMarker( '2.', 'Sternwheeler <em>Columbia Gorge</em>', htmlAttractions[1], '0x79480f', '0xffffff' );
	geoAttractions[1] = new LatLon("45.67084","-121.887231");
	


	//need to wait until map is ready, then add our tools and such
	map.addEventListener(Map.EVENT_INITIALIZE, onInitialize);


	function onInitialize(oEvent){ 

		map.addWidget(toolbar);	
		map.addTool(pan, true); 
		map.addTool(toolCar, true);
		map.addTool(toolPlane, true);
		map.addTool(toolStar, true);
		map.addTool(toolLogo, true);
		
		map.addWidget(nav);
		map.addMarkerByLatLon(mkHome, geoHome);

		//map.addWidget(view);
		
		delay("map.setActiveTool(pan)",3000);
		delay("toolbar.open()",3000);
		delay("addListener()",3000);
	}

	function addListener() {
		map.addEventListener(Map.EVENT_TOOL_CHANGE, changeTool);
	}

	function changeTool(e) {
		switch (e.tool) {
			case pan:
				break;
			case toolLogo:
				goHome();
				map.setActiveTool(pan);
				break;
			case toolStar:
				showAttractions();
				map.setActiveTool(pan);
				break;
			case toolPlane:
				zoomAirport();
				map.setActiveTool(pan);
				break;
			case toolCar:
				driveAirport();
				map.setActiveTool(pan);
				break;
		}
	}

	//a way to slow things down
	function delay(func,milliseconds) {
		setTimeout(func,milliseconds);
	}
	
	//pan with delay and then zoom if necessary after more delay
	function panZoom(geo,zoom,milliseconds) {
		if (zoom != map.getZoomLevel()) {
			map.setCenterByLatLon(geo,milliseconds);
			delay("map.setZoomLevel("+zoom+")",milliseconds);
		}
		else {
			map.setCenterByLatLon(geo,milliseconds);
		}
	}
	
	//re-center map
	function goHome() {
		panZoom(geoCenter, 5, 3000);
	}

	//show airport marker
	function showAirport() {
		map.addMarkerByLatLon(mkAirport, geoAirport);
		map.setCenterByLatLonAndZoom(geoAirportCenter, 9);
		mkHome.close();
	}
	
	//zoom in to airport
	function zoomAirport() {
		mkAirport.close();
		map.setCenterByLatLonAndZoom(geoAirport, 5);
	}

	//shows poly overlay for driving directions
	function driveAirport() {
		mkAirport.close();
		map.setCenterByLatLonAndZoom(geoDirections[0], 6);
		
		for (var i=0; i<geoDirections.length; i++) {
			map.addMarkerByLatLon(mkDirections[i], geoDirections[i]);
		}
		
		map.addOverlay(polyAirport);
		delay("mkDirections[0].open()",5000);
	}
	
	//moves from one directions marker to next
	function driveNext(next,zoom,milliseconds) {
		if (next!=-1) {
			mkDirections[next].close();
		}
		next++;

		//see if zoom level needs to change
		if (zoom != map.getZoomLevel()) {
			map.removeOverlay(polyAirport);
			panZoom(geoDirections[next],zoom,milliseconds);
			map.addOverlay(polyAirport);
		}
		else {
			map.setCenterByLatLon(geoDirections[next],milliseconds);
		}

		mkDirections[next].open();
	}
	
	//show attraction markers
	function showAttractions() {
		goHome();
		for (var i=0; i<geoAttractions.length; i++) {
			map.addMarkerByLatLon(mkAttractions[i], geoAttractions[i]);
		}
	}

//]]>
