
var map; 
var geocoder;
var zoom;

function openmap() {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}

function showAddress(address, zoom) {
	if (!zoom) {
		zoom = 13;
	}
	geocoder = new GClientGeocoder();
	geocoder.getLatLng(
	address,
		function(point) {
			if (!point) {
					alert(address + " not found");
				} else {
					map.setCenter(point, zoom);
					var marker = new GMarker(point);
					map.addOverlay(marker);
				}
			}
		);
}


var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
function showHotels() {
	geocoder = new GClientGeocoder();
	geocoder.getLatLng(
		'999 Canada Place, Vancouver, BC, V6C 3B5',
		function(point) {
			if (!point) {
				alert(address + " not found");
			} else {
				var marker = new GMarker(point);
				map.addOverlay(marker);
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml('Vancouver Convention &amp; Exhibit Centre<br /><br />and<br /><br /><a style="text-decoration:underline;font-weight:bold" href="hotel-panpacific.htm" onclick="popup = window.open(\'hotel-panpacific.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Pan Pacific</a>');
				});
			}
		}
	);	
	var hotels = new Array();
	hotels[0] = '654 Nelson St., Vancouver, BC, V6B 6K4';
	hotels[1] = '921 West Pender St., Vancouver, BC'; 
	hotels[2] = '550 West Hastings St., Vancouver, BC, V6B 1L6'; 
	hotels[3] = '1400 Robson St., Vancouver, BC, V6G 1B9'; 
	hotels[4] = '900 Canada Place Way, Vancouver, BC, V6C 3L5'; 
	hotels[5] = '111 Robson St., Vancouver, BC, V6B 2A8'; 
	hotels[6] = '655 Burrard St., Vancouver, BC, V6C 2R7'; 
	hotels[7] = '999 Canada Place, Vancouver, BC, V6C 3B5'; 
	hotels[8] = '500 West 12th Ave., Vancouver, BC, V5Z 1M2'; 
	hotels[9] = '435 West Pender St., Vancouver, BC, V6B 1V2'; 
	hotels[10] = '1221 Granville St., Vancouver, BC, V6C 2R7'; 
	hotels[11] = '180 West Georgia St., Vancouver, BC, V6B 4P4'; 
	hotels[12] = '2329 West Mall, Vancouver, BC, V6T 1Z4'; 
	hotels[13] = '733 Beatty St., Vancouver, BC, V6B 2M4'; 
	var hotel_name = new Array();
	hotel_name[0] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-comfortinn.htm" onclick="popup = window.open(\'hotel-comfortinn.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Comfort Inn</a><br />$149+';
	hotel_name[1] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-daysinn.htm" onclick="popup = window.open(\'hotel-daysinn.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Days Inn Downtown</a><br />$170+'; 
	hotel_name[2] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-delta.htm" onclick="popup = window.open(\'hotel-delta.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Delta Vancouver Suites</a><br />$229+'; 
	hotel_name[3] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-empire.htm" onclick="popup = window.open(\'hotel-empire.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Empire Landmark</a><br />$159+'; 
	hotel_name[4] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-fairmont.htm" onclick="popup = window.open(\'hotel-fairmont.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Fairmont Waterfront</a><br />$255+'; 
	hotel_name[5] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-hampton.htm" onclick="popup = window.open(\'hotel-hampton.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Hampton Inn & Suites</a><br />$169+'; 
	hotel_name[6] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-hyatt.htm" onclick="popup = window.open(\'hotel-hyatt.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Hyatt Regency Hotel</a><br />$240+'; 
	hotel_name[7] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-panpacific.htm" onclick="popup = window.open(\'hotel-panpacific.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Pan Pacific</a><br />$289+'; 
	hotel_name[8] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-plaza500.htm" onclick="popup = window.open(\'hotel-plaza500.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Plaza 500</a><br />$180+'; 
	hotel_name[9] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-ramadadowntown.htm" onclick="popup = window.open(\'hotel-ramadadowntown.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Ramada Limited Downtown Vancouver</a><br />$139+'; 
	hotel_name[10] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-ramadainn.htm" onclick="popup = window.open(\'hotel-ramadainn.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Ramada Inn &amp; Suites Downtown Vancouver</a><br />$120+'; 
	hotel_name[11] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-sandman.htm" onclick="popup = window.open(\'hotel-sandman.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">Sandman</a><br />$149+'; 
	hotel_name[12] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-ubc.htm" onclick="popup = window.open(\'hotel-ubc.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">University of British Columbia</a><br />$32-$129'; 
	hotel_name[13] = '<a style="text-decoration:underline;font-weight:bold" href="hotel-ywca.htm" onclick="popup = window.open(\'hotel-ywca.htm\', \'HOTEL\', \'height=540,width=520,scrollbars=yes,resizable=yes,status=no\'); popup.focus(); return false;" target="_blank">The YWCA Hotel</a><br />$59+'; 
	map.setCenter(new GLatLng(49.282336, -123.121719), 14);
	for (ii=0; ii<hotels.length; ii++)
	{
		addHotel(hotels[ii], hotel_name[ii]);
	}
}

function addHotel(address, info) {
	geocoder = new GClientGeocoder();
	geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
				alert(address + " not found");
			} else {
				createMarker(point,info);
			}
		}
	);
}

function createMarker(point,info) {
	var marker = new GMarker(point, icon);
	map.addOverlay(marker);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(info);
	});
}
