var drag_to_zoom_status = false;

function drag_to_zoom(){
	gzoomctrl.buttonClick_();
	/*if(!drag_to_zoom_status){
		drag_to_zoom_status = true;
		document.getElementById('bt_drag_to_zoom').src='/images/bt_drag_to_zoom_over.gif';
	}else{
		drag_to_zoom_status = false;
		document.getElementById('bt_drag_to_zoom').src='/images/bt_drag_to_zoom.gif';
	}*/
}

function zoom_map(act){
	switch(act){
		case 'in':
			extMap.zoomIn();
			break;
		case 'out':
			extMap.zoomOut();
			break;
		default:
			extMap.returnToSavedPosition();
			break;
	}
}
function move_map(direction){
	switch(direction){
		case 'north':
			extMap.panDirection(0,1);
			break;
		case 'south':
			extMap.panDirection(0,-1);
			break;
		case 'west':
			extMap.panDirection(1,0);
			break;
		case 'east':
			extMap.panDirection(-1,0);
			break;
	}
}
function resize_map(){
	//gzoomctrl.resetDragZoom_();
	drag_to_zoom_status = false;
	document.getElementById('bt_drag_to_zoom').src='/images/bt_drag_to_zoom.gif';
	var bmap = document.getElementById("map");
	var bt = document.getElementById("bt_expand");
	if (bmap.style.height == "92px") {
		bmap.style.height = "372px";
		extMap.checkResize();
		bt.innerHTML = '<a href="javascript:resize_map();"><img src="/images/07_reduce_map.jpg" alt="Minimize Map" width="170" height="26" border="0"></a>';
		return;
	}

	if (bmap.style.height == "372px") {
		bmap.style.height = "92px";
		extMap.checkResize();
		bt.innerHTML = '<a href="javascript:resize_map();"><img src="/images/07_expand_map.jpg" alt="Maximize Map" width="170" height="26" border="0"></a>';
		return;
	}
}

function full_map(){
	drag_to_zoom_status = false;
	document.getElementById('bt_drag_to_zoom').src='/images/bt_drag_to_zoom.gif';
	var bmap = document.getElementById("map");
	var bt = document.getElementById("bt_expand");
	if (bmap.style.height == "92px") {
		bmap.style.height = "372px";
		extMap.checkResize();
		bt.innerHTML = '<a href="javascript:resize_map();"><img src="/images/07_reduce_map.jpg" alt="Minimize Map" width="170" height="26" border="0"></a>';
		return;
	}
}

var map_loaded = false;
function show_google_map() {
if(map_loaded) return false;
map_element = document.getElementById("map");
var map = new GMap(document.getElementById("map"));
map.addControl(new GMapTypeControl());
gzoomctrl = new GZoomControl({nOpacity:.0},{nOverlayRemoveMS:0,bStickyZoom:false});
map.addControl(gzoomctrl);

map.centerAndZoom(new GPoint("-62.6393762", "46.1624315"), 7);
marker0 = new GMarker(new GPoint("-62.6393762", "46.1624315"));
map.addOverlay(marker0);
var html0 = '<table width="227" border=0 cellpadding=1 cellspacing=0 bgcolor="ffffff"><tbody><tr><td valign=top align=left width="0"></td><td width="223" align=left valign=top><table width="100%" border="0"><tr><td width="38%" valign="top"><span class="body"><img src="/listing_images/5/2715_1.jpg" width="80" height="80" border="0"></span></td><td width="62%" valign="top"><strong class="MarkerTxtCap">Mae\'s Place</strong><br /><span class="MarkerTxtAdd">4115 Prov. Hwy Route 17</span><br /><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2715\',\'Mae\\\'s Place\',\'/listing_images/5/2715_1.jpg\',\'Prince Edward Island\',\'Montague\',\'compare\',\'maesplace\')" href="#" class="Markerlinks">Add To Compare</a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2715\',\'Mae\\\'s Place\',\'/listing_images/5/2715_1.jpg\',\'Prince Edward Island\',\'Montague\',\'enquiry\',\'maesplace\')" href="#" class="Markerlinks">Add To Reservation Cart </a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a href="/maesplace/" class="Markerlinks">See Detailed Listing</a></td></tr></table></td></tr></tbody></table><p><a href="javascript:zoom_map(\'in\');"><img src="/images/zoom_in.gif" width="61" height="16" border="0"></a>&nbsp;&nbsp;<a href="javascript:zoom_map(\'out\');"><img src="/images/zoom_out.gif" width="61" height="16" border="0"></a></p>';
//map.openInfoWindowHtml(map.getCenterLatLng(), html0);	
GEvent.addListener(marker0, "click", function() {
extMap.panTo(new GLatLng("46.1624315", "-62.6393762"));
marker0.openInfoWindowHtml(html0);
});
marker1 = new GMarker(new GPoint("-62.6444360", "46.1602540"));
map.addOverlay(marker1);
var html1 = '<table width="227" border=0 cellpadding=1 cellspacing=0 bgcolor="ffffff"><tbody><tr><td valign=top align=left width="0"></td><td width="223" align=left valign=top><table width="100%" border="0"><tr><td width="38%" valign="top"><span class="body"><img src="/listing_images/5/2732_1.jpg" width="80" height="80" border="0"></span></td><td width="62%" valign="top"><strong class="MarkerTxtCap">Van Dyke\'s Lakeview Bed & Breakfast</strong><br /><span class="MarkerTxtAdd">Montague RR 3 New Perth</span><br /><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2732\',\'Van Dyke\\\'s Lakeview Bed & Breakfast\',\'/listing_images/5/2732_1.jpg\',\'Prince Edward Island\',\'Montague\',\'compare\',\'lakeview\')" href="#" class="Markerlinks">Add To Compare</a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2732\',\'Van Dyke\\\'s Lakeview Bed & Breakfast\',\'/listing_images/5/2732_1.jpg\',\'Prince Edward Island\',\'Montague\',\'enquiry\',\'lakeview\')" href="#" class="Markerlinks">Add To Reservation Cart </a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a href="/lakeview/" class="Markerlinks">See Detailed Listing</a></td></tr></table></td></tr></tbody></table><p><a href="javascript:zoom_map(\'in\');"><img src="/images/zoom_in.gif" width="61" height="16" border="0"></a>&nbsp;&nbsp;<a href="javascript:zoom_map(\'out\');"><img src="/images/zoom_out.gif" width="61" height="16" border="0"></a></p>';
//map.openInfoWindowHtml(map.getCenterLatLng(), html1);	
GEvent.addListener(marker1, "click", function() {
extMap.panTo(new GLatLng("46.1602540", "-62.6444360"));
marker1.openInfoWindowHtml(html1);
});
marker2 = new GMarker(new GPoint("-62.638833", "46.192998"));
map.addOverlay(marker2);
var html2 = '<table width="227" border=0 cellpadding=1 cellspacing=0 bgcolor="ffffff"><tbody><tr><td valign=top align=left width="0"></td><td width="223" align=left valign=top><table width="100%" border="0"><tr><td width="38%" valign="top"><span class="body"><img src="/listing_images/5/2733_1.jpg" width="80" height="80" border="0"></span></td><td width="62%" valign="top"><strong class="MarkerTxtCap">Elms at Brudenell B&B</strong><br /><span class="MarkerTxtAdd">304 Brudenell Point Road</span><br /><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2733\',\'Elms at Brudenell B&B\',\'/listing_images/5/2733_1.jpg\',\'Prince Edward Island\',\'Montague\',\'compare\',\'elmsatbrudenell\')" href="#" class="Markerlinks">Add To Compare</a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2733\',\'Elms at Brudenell B&B\',\'/listing_images/5/2733_1.jpg\',\'Prince Edward Island\',\'Montague\',\'enquiry\',\'elmsatbrudenell\')" href="#" class="Markerlinks">Add To Reservation Cart </a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a href="/elmsatbrudenell/" class="Markerlinks">See Detailed Listing</a></td></tr></table></td></tr></tbody></table><p><a href="javascript:zoom_map(\'in\');"><img src="/images/zoom_in.gif" width="61" height="16" border="0"></a>&nbsp;&nbsp;<a href="javascript:zoom_map(\'out\');"><img src="/images/zoom_out.gif" width="61" height="16" border="0"></a></p>';
//map.openInfoWindowHtml(map.getCenterLatLng(), html2);	
GEvent.addListener(marker2, "click", function() {
extMap.panTo(new GLatLng("46.192998", "-62.638833"));
marker2.openInfoWindowHtml(html2);
});
marker3 = new GMarker(new GPoint("-62.642636", "46.156354"));
map.addOverlay(marker3);
var html3 = '<table width="227" border=0 cellpadding=1 cellspacing=0 bgcolor="ffffff"><tbody><tr><td valign=top align=left width="0"></td><td width="223" align=left valign=top><table width="100%" border="0"><tr><td width="38%" valign="top"><span class="body"><img src="/listing_images/4/2056_1.jpg" width="80" height="80" border="0"></span></td><td width="62%" valign="top"><strong class="MarkerTxtCap">Maplehurst Properties</strong><br /><span class="MarkerTxtAdd">PO Box 1447 Montague, Prince Ed. Isl.</span><br /><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2056\',\'Maplehurst Properties\',\'/listing_images/4/2056_1.jpg\',\'Prince Edward Island\',\'Montague\',\'compare\',\'maplehurstproperties\')" href="#" class="Markerlinks">Add To Compare</a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a onclick="add_listing(\'2056\',\'Maplehurst Properties\',\'/listing_images/4/2056_1.jpg\',\'Prince Edward Island\',\'Montague\',\'enquiry\',\'maplehurstproperties\')" href="#" class="Markerlinks">Add To Reservation Cart </a><br /><img src="/images/bulletArrow.gif" width="11" height="7" /> <a href="/maplehurstproperties/" class="Markerlinks">See Detailed Listing</a></td></tr></table></td></tr></tbody></table><p><a href="javascript:zoom_map(\'in\');"><img src="/images/zoom_in.gif" width="61" height="16" border="0"></a>&nbsp;&nbsp;<a href="javascript:zoom_map(\'out\');"><img src="/images/zoom_out.gif" width="61" height="16" border="0"></a></p>';
//map.openInfoWindowHtml(map.getCenterLatLng(), html3);	
GEvent.addListener(marker3, "click", function() {
extMap.panTo(new GLatLng("46.156354", "-62.642636"));
marker3.openInfoWindowHtml(html3);
});
extMap = map;
extMap.savePosition();
map_loaded = true;
}

window.onunload=GUnload;