// JavaScript Document

function loadMap() {
	if (!GBrowserIsCompatible()){
		alert('Your browser does not support Google Maps.');
		return;
	}


	var opts = {size:new GSize(600,400)};
	var map = new GMap2(document.getElementById("cttMap"));
	map.setCenter(new GLatLng(37.274722, -76.701867), 13);
	map.addControl (new GLargeMapControl());
	
	//Attraction
	var iconAttraction = new GIcon();
	iconAttraction.image = "images/gmapicons/attraction.png";
	iconAttraction.shadow = "images/gmapicons/attraction_shadow.png";
	iconAttraction.iconSize = new GSize(32,32);
	iconAttraction.shadowSize = new GSize(56,28);
	iconAttraction.iconAnchor = new GPoint(16,28);
	
	//Golf
	var iconGolf = new GIcon();
	iconGolf.image = "images/gmapicons/golf.png";
	iconGolf.shadow = "images/gmapicons/golf_shadow.png";
	iconGolf.iconSize = new GSize(32,32);
	iconGolf.shadowSize = new GSize(56,28);
	iconGolf.iconAnchor = new GPoint(16,28);
	
	//Hotel/Resort
	var iconHotel = new GIcon();
	iconHotel.image = "images/gmapicons/hotel.png";
	iconHotel.shadow = "images/gmapicons/hotel_shadow.png";
	iconHotel.iconSize = new GSize(32,32);
	iconHotel.shadowSize = new GSize(56,28);
	iconHotel.iconAnchor = new GPoint(16,28);
	
	//Restaurant
	var iconRestaurant = new GIcon();
	iconRestaurant.image = "images/gmapicons/restaurant.png";
	iconRestaurant.shadow = "images/gmapicons/restaurant_shadow.png";
	iconRestaurant.iconSize = new GSize(32,32);
	iconRestaurant.shadowSize = new GSize(56,28);
	iconRestaurant.iconAnchor = new GPoint(16,28);
	
	//School
	var iconSchool = new GIcon();
	iconSchool.image = "images/gmapicons/school.png";
	iconSchool.shadow = "images/gmapicons/school_shadow.png";
	iconSchool.iconSize = new GSize(32,32);
	iconSchool.shadowSize = new GSize(56,28);
	iconSchool.iconAnchor = new GPoint(16,28);
	
	//Shopping
	var iconShopping = new GIcon();
	iconShopping.image = "images/gmapicons/shopping.png";
	iconShopping.shadow = "images/gmapicons/shopping_shadow.png";
	iconShopping.iconSize = new GSize(32,32);
	iconShopping.shadowSize = new GSize(56,28);
	iconShopping.iconAnchor = new GPoint(16,28);
	
	createMarker(map,37.236003,-76.649961,"Busch Gardens Europe",iconAttraction);
	createMarker(map,37.274722,-76.701867,"Colonial Williamsburg",iconAttraction);
	createMarker(map,37.354229,-76.763562,"Go-Karts Plus",iconAttraction);
	createMarker(map,37.310753,-76.731757,"Haunted Dinner Theater",iconAttraction);
	createMarker(map,37.225069,-76.786218,"Jamestown Settlement",iconAttraction);
	createMarker(map,37.286998,-76.718743,"Pirate's Cove Adventure Golf",iconAttraction);
	createMarker(map,37.260954,-76.640249,"President's Park",iconAttraction);
	createMarker(map,37.295692,-76.725588,"Ripley's Belive It or Not",iconAttraction);
	createMarker(map,37.261345,-76.641018,"Water Country USA",iconAttraction);
	createMarker(map,37.238441,-76.516869,"Yorktown Victory Center",iconAttraction);
	createMarker(map,37.393287,-76.870422,"The Colonial Golf Course",iconGolf);
	createMarker(map,37.266794,-76.699602,"Golden Horseshoe Golf Club",iconGolf);
	createMarker(map,37.223584,-76.663525,"Kingsmill Golf Club & Resort",iconGolf);
	createMarker(map,37.310017,-76.732332,"Clarion Inn and Suites Williamsburg",iconHotel);
	createMarker(map,37.259601,-76.639709,"Days Inn Busch Gardens",iconHotel);
	createMarker(map,37.286179,-76.721131,"Fairfield Inn and Suites",iconHotel);
	createMarker(map,37.266545,-76.635134,"King's Creek Plantation",iconHotel);
	createMarker(map,37.292183,-76.723743,"Residence Inn Williamsburg",iconHotel);
	createMarker(map,37.29427,-76.725253,"Springhill Suites Williamsburg",iconHotel);
	createMarker(map,37.285278,-76.716671,"Waller Mill Inn",iconHotel);
	createMarker(map,37.272376,-76.706481,"Aroma's Specialty Coffees Cafe",iconRestaurant);
	createMarker(map,37.310753,-76.731757,"Captain George's Seafood Restaurant",iconRestaurant);
	createMarker(map,37.272113,-76.706373,"The Cheese Shop",iconRestaurant);
	createMarker(map,37.270829,-76.706051,"Fat Canary",iconRestaurant);
	createMarker(map,37.293164,-76.724348,"Food For Thought Restaurant",iconRestaurant);
	createMarker(map,37.269895,-76.720948,"College of William & Mary",iconSchool);
	createMarker(map,37.321368,-76.738136,"Prime Outlets",iconShopping);
	createMarker(map,37.343234,-76.747278,"Williamsburg Antique Mall",iconShopping);
	createMarker(map,37.338142,-76.754987,"Williamsburg Outlet Mall",iconShopping);
	createMarker(map,37.348175,-76.757190,"Williamsburg Pottery Factory",iconShopping);
	createMarker(map,37.234659,-76.720607,"Williamsburg Winery",iconShopping);
}

GEvent.addDomListener(window,'load',loadMap);
GEvent.addDomListener(window,'unload',GUnload);

function createMarker(map,lat,lng,title,iconAttraction) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconAttraction});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}

function createMarker(map,lat,lng,title,iconGolf) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconGolf});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}

function createMarker(map,lat,lng,title,iconHotel) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconHotel});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}

function createMarker(map,lat,lng,title,iconRestaurant) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconRestaurant});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}

function createMarker(map,lat,lng,title,iconSchool) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconSchool});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}

function createMarker(map,lat,lng,title,iconShopping) {
	var marker = new GMarker(new GLatLng(lat,lng),{icon:iconShopping});
	var tooltip = new Tooltip(marker,title,4);
	marker.tooltip = tooltip;
	map.addOverlay(marker);
	map.addOverlay(tooltip);
	
	GEvent.addListener(marker,'mouseover',function(){
		this.tooltip.show();
	});
	GEvent.addListener(marker,'mouseout',function(){
		this.tooltip.hide();
	});
	
}