var swf_width = 350;
var swf_height = 400;

if (screen.width <= 800) {
	swf_width = 200;
	swf_height = 229;
} else if (screen.width <= 1024) {
	swf_width = 262;
	swf_height = 300;
}

function fitMapToBrowser() {
	//var intHeight=document.documentElement.clientHeight - 200;
	var intHeight = screen.height - 340;
	if(intHeight<300){
		intHeight=300;
	}
	intHeight+='px';
	
	document.getElementById('divGoogle').style.height = intHeight;
	document.getElementById('divMap').style.height = intHeight;
	
	var intWidth=document.documentElement.clientWidth - 200;
	if(intWidth<400){
		intWidth=400;
	}
	intWidth+='px';
	
	document.getElementById('divGoogle').style.width = intWidth;
	document.getElementById('divMap').style.width = intWidth;
	
	if(typeof(objMap)!=='undefined'){
		objMap.checkResize();
		objMap.setCenter(objMap._lastCenter);
		//GLog.write(objMap.getSize());
	}
}
						
function closeMap() {
	var divGoogle = document.getElementById("divGoogle"); 
	divGoogle.style.display = "none";
	divFlash.style.display = "block";
	divText.style.display = "block";
}

// Add markers to the map at specific locations...
var arrPoints = new Array();
arrPoints[0] = "BSC;12;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/bird_safari_camp_gambia.asp'><img align='left' src='../images/logos/bird_safari_camp_map.gif' border='0' hspace='5'></a>Bird Safari Camp;13.543706680634816;-14.79008674621582;<p align='left' class='small'>A peaceful riverside camp 200 miles<br />inland in the freshwater part of the<br />Gambia river. Choice of safari tents or rondavels.</p>".split(";");
arrPoints[1] = "CRT;14;1;<a href='http://www.hiddengambia.com/adventure_holidays/chimpanzee_safari.asp'><img align='left' src='images/logos/chimpanzee_project_map.gif' border='0' hspace='5'></a>Chimpanzee Project;13.645840851081933;-14.958443641662597;<p align='left' class='small'>Africa's longest running<br>chimpanzee rehabilitation project.</p>".split(";");
arrPoints[2] = "SGH;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/safari_garden_hotel_gambia.asp'><img align='left' src='../images/logos/safari_garden_map.gif' border='0' hspace='5'></a>Safari Garden Hotel;13.467223316751962;-16.69475555419922;<p align='left' class='small'>In a quiet residential area,<br>a short walk from other<br>restaurants, this is a lovely little<br>hotel with a friendly welcoming atmosphere.</p>".split(";");
arrPoints[3] = "HIB;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/hibiscus_house_gambia.asp'><img align='left' src='../images/logos/hibiscus_house_map.gif' border='0' hspace='5'></a>Hibiscus House;13.39025104171368;-16.746758222579956;<p align='left' class='small'>A quality private hotel with 7 rooms<br>in the village of Brufut - 20 minutes<br>walk from the beach.</p>".split(";");
arrPoints[4] = "PAR;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/paradise_inn_lodge_gambia.asp'><img align='left' src='../images/logos/paradise_map.gif' border='0' hspace='5'></a>Paradise Inn Lodge;13.35749695723286;-16.786808967590332;<p align='left' class='small'>A pleasant camp on the banks<br>of the Tanji river and adjacent to the Tanji bird reserve.</p>".split(";");
arrPoints[5] = "FOT;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/footsteps_ecolodge_gambia.asp'><img align='left' src='../images/logos/footsteps_map.gif' border='0' hspace='5'></a>Footsteps Ecolodge;13.19763979259977;-16.77040994167328;<p align='left' class='small'>A peaceful retreat 45<br>minutes south of the<br>main tourist areas.</p>".split(";");
arrPoints[6] = "SAN;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/sandele_bay_eco-retreat_gambia.asp'><img align='left' src='../images/logos/sandele_map.gif' border='0' hspace='5'></a>Sandele Eco-retreat;13.121830507815051;-16.764578819274902;<p align='left' class='small'>A new up-market eco-lodge<br />in a stunning location<br>on miles of sandy beaches.</p>".split(";");
arrPoints[7] = "JIN;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/jinack_lodge_gambia.asp'><img align='left' src='../images/logos/jinack_lodge_map.gif' border='0' hspace='5'></a>Jinack Lodge (Jinack Island);13.571721309247857;-16.536022424697876;<p align='left' class='small'>A simple lodge with raffia huts located in the Niumi<br>National Park near the border with Senegal.</p>".split(";");
arrPoints[8] = "TEN;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/tendaba_camp_gambia.asp'><img align='left' src='../images/logos/tendaba_camp_map.gif' border='0' hspace='5'></a>Tendaba Camp;13.439316416021688;-15.809251070022583;<p align='left' class='small'>Opposite the BaoBolong Wetlands -<br />a simple camp in lovely location.</p>".split(";");
arrPoints[9] = "BIN;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/bintang_bolong_lodge_gambia.asp'><img align='left' src='../images/logos/bintang_bolong_lodge_map.gif' border='0' hspace='5'></a>Bintang Bolong Lodge;13.24926106386529;-16.210745573043823;<p align='left' class='small'>A simple camp in a lovely location<br>on a tribuatary to the Gambia River.<br />Join our <a href='discover_the_river_gambia.asp'>Safari Queen</a> here<br />and sail upriver to Tendaba Camp, avoiding the<br />terribly potholed south bank road from this point<br />east to Georgetown.</p>".split(";");
arrPoints[10] = "BOB;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/boboi_beach_lodge_gambia.asp'><img align='left' src='../images/logos/boboi_beach_lodge_map.gif' border='0' hspace='5'></a>Boboi Beach Lodge;13.114626022766927;-16.765066981315613;<p align='left' class='small'>A simple backpacker-style<br /> lodge in a beautiful location<br />directly by the sea.</p>".split(";");
arrPoints[11] = "FAR;13;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/farakunku_lodges_gambia.asp'><img src='../images/logos/farakunku_lodges_map.gif' border='0'></a>;13.302458419466333;-16.777177155017853;".split(";");
//arrPoints[11] = "SIM;14;0;<a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/simenti_camp_niokolokoba_senegal.asp'><img align='left' src='images/logos/simenti_camp_map.gif' border='0' hspace='5'></a>Simenti Camp;13.01785445033151;-13.293371200561523;<p align='left' class='small'>In the Niokolo Koba National <br />Park of Senegal...</p>".split(";");
arrPoints[12] = "BJL;14;1;Banjul - Barra ferry;13.446584314206164;-16.572178602218628;<p align='left' class='small'>Anyone planning to cross by ferry (either here or further upriver at Farafenni<br>- Soma) should expect long delays - especially northbound in the mornings and<br>southbound in the evenings. You'll avoid this hassle and will get to see more<br />wildlife on our <a href='../adventure_holidays/discover_the_river_gambia.asp'>Discover the River</a> combination of road and boat transport.</p>".split(";");
arrPoints[13] = "KUN;14;1;Kuntaur Jetty;13.67306153602208;-14.890594482421875;<p align='left' class='small'>Join the Lady Hippo from here and sail upriver<br>through the River Gambia National Park to<br>Bird Safari Camp.</p>".split(";");
arrPoints[14] = "FFN;14;1;Farafenni Jetty;13.52135831969358;-15.573720932006836;<p align='left' class='small'>Zoom in to the satellite image to see how many vehicles<br>are waiting to cross on the ferry! You'll avoid these<br>frustrating delays on our <a href='discover_the_river_gambia.asp'>Discover the River</a> itinerary.</p>".split(";");
arrPoints[15] = "BSG;14;1;Bansang Quarry;13.435538900230424;-14.707260131835937;<p align='left' class='small'>See the breeding colony of Red Throated Bee-eaters<br />- visit here on a day trip from <a href='http://www.hiddengambia.com/adventure_holidays/hotels_lodges/bird_safari_camp_gambia.asp'>Bird Safari Camp</a></p>".split(";");
arrPoints[16] = "BAS;14;1;Basse Santa Su;13.313290684362996;-14.212875366210937;<p align='left' class='small'>Another popular spot for birdwatchers - this is a good place<br>to see Carmine Bee-Eaters and Egyptian Plover<br>(aka. crocodile bird). You can visit here on a day trip<br>as part of your <a href='http://www.hiddengambia.com/adventure_holidays/discover_the_river_gambia.asp'>Discover the River</a> trip</p>".split(";");
arrPoints[17] = "ABK;14;1;Abuko Nature Reserve;13.394937288034109;-16.645982265472412;<p align='left' class='small'>The satellite image shows just how important<br />this area of protected woodland is. The marker<br />is positioned on the observation platform near<br />the water hole.</p>".split(";");
arrPoints[18] = "PIR;14;1;Pirang Shrimp Farm;13.275237281191666;-16.525583267211914;<p align='left' class='small'>An important birdwatching site - well known<br />for Black-crowned Cranes and Long-crested<br />Eagles.</p>".split(";");
arrPoints[19] = "JAM;14;1;James Island;13.31751905146501;-16.361539363861084;<p align='left' class='small'>UNESCO World Heritage Site - James Island is<br />significant for its relation to the beginning of<br />the slave trade as well as its abolition.</p>".split(";");
arrPoints[20] = "KEM;14;1;Kemoto Point;13.434641470604994;-16.146522760391235;<p align='left' class='small'>We often see bottlenose dolphins just downstream<br />of this area - they sometimes like to try and<br>outswim the Safari Queen!</p>".split(";");
arrPoints[21] = "BAO;14;1;BaoBolong Wetlands;13.456700569334637;-15.787718296051025;<p align='left' class='small'>Listed in the Ramsar Wetlands Convention as a<br />site of international importance for birds and<br />wildlife.</p>".split(";");
arrPoints[22] = "KAU;14;1;Kau-ur Wetlands;13.694525189265297;-15.346012115478515;<p align='left' class='small'>This is the approximate point at which the<br />river changes from saltwater to freshwater<br />the wetlands here are also an excellent<br />birdwatching site.<br /></p>".split(";");
arrPoints[23] = "YUN;14;2;Banjul Airport (Yundum);13.343775034751173;-16.65231227874756;<p align='left' class='small'>We'll pick you up and drop you off from here<br />as part of your <a href='http://www.hiddengambia.com/adventure_holidays/discover_the_river_gambia.asp'>Discover the River</a> trip.</p>".split(";");

var objMap;
//<![CDATA[
function googleEarth(strCode) {
	var divGoogle = document.getElementById("divGoogle");
	var divFlash = document.getElementById("divFlash"); 
	
	divGoogle.style.display = "block";
	//divGoogle.style.height = (parseInt(divGoogle.style.height) + 100) + "px";
	divFlash.style.display = "none";
	divText.style.display = "none";
	
	googleMapInit(strCode);
}

function googleMapInit(strCode) {
	if (GBrowserIsCompatible()) {
		fitMapToBrowser();
		
		objMap = new GMap2(document.getElementById("divMap"));
		for (var i=0; i<arrPoints.length; i++) {
			if (arrPoints[i][0] == strCode) {
				objMap.setCenter(new GLatLng(arrPoints[i][4], arrPoints[i][5]), Number(arrPoints[i][1]));
				break;
			}
		}
		objMap.setUI(new GMapUIOptions(new GSize(500, 500))); 
		//objMap.addControl(new GLargeMapControl());
	    //objMap.addControl(new GMapTypeControl());
    	objMap.setMapType(G_HYBRID_MAP);
		
		if(window.addEventListener){
			window.addEventListener( 'resize', function(){
				fitMapToBrowser();
			}, false );
		} else {
			window.attachEvent( 'onresize', function(){
				fitMapToBrowser();
			});
		}

		objMap._lastCenter=objMap.getCenter();
		GEvent.addListener(objMap, 'moveend', function(){
			objMap._lastCenter=objMap.getCenter();
		});

		
		var objSafariQueenLine = new GPolyline.fromEncoded({
			color: "#0000FF", 
			weight: 4, 
			points: "}vzoArc}aBckCtGeqCkp@ahAhRsdCr}BchDd_@woEy}C{jIktJ||A}cNao@ssFcZmcWuoBq~Gjw@cgHzg@mc@yf@yv@u~@ujJelAsdFybDsvE~gAujDfuCggCqLw_Cy{DqbAe{BknAue@wTwMhE", 
			levels: "BBBBBBBBBBBBBBBBBBBBBBBBB", 
			zoomFactor: 32, 
			numLevels: 4
		});
		
		var objLadyHippoLine = new GPolyline.fromEncoded({
			color: "#0000FF", 
			weight: 4, 
			points: "qlmrA`j{yAbAfHph@hIpe@b^jy@tmC~WlLtZfh@~WhyBp}@rgBvi@pd@piAre@btCum@th@en@fDuhB_Jq_BpX}x@~o@urAlm@w}@hj@w_@ja@gC~Vu^fPkuAa|@imAwaAwlAu[aiA~Jg`CxQqk@v]{a@jl@u_@vQm[bByh@", 
			levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", 
			zoomFactor: 32, 
			numLevels: 4
		});
	
		var objSouthBankLine = new GPolyline.fromEncoded({
			color: "#FF0000", 
			weight: 4, 
			points: "s`apAl|hdBoIcjAwh@cyAbiAknAzj@}zBdjA}vA`@cWl`Gi{AdaBqnBeC_mBfQifApqAqnB~a@wkAdDabAk_@_uB{mAsjDsNkaC}w@u|@sAwzAwnBawPw[gn@_WeM_fA}jAcMuImAgE`EqBIaC", 
			levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBB", 
			zoomFactor: 32, 
			numLevels: 4
		});
		
		var objNorthBankLine = new GPolyline.fromEncoded({
			color: "#FF0000", 
			weight: 4, 
			points: "q{oqAzv`~AqeBzx@cxD``BqL{~C`Xg{AvyA_rCjHqxD{SmlBc}E_jF{jMuwEwj@{eGalDqiDqoBelLeiEi`FlIqzCky@uhEgkEclFoKeiBrg@gsDeoAgsDxSioFjy@kwCjIqtKjuDk_GrbDgxBvlHbAbTfg@", 
			levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBB", 
			zoomFactor: 32, 
			numLevels: 4
		});
		
		var objBasseLine = new GPolyline.fromEncoded({
			color: "#FF0000", 
			weight: 4, 
			points: "uhtqAfwgyApX}SfRecDvdBnTjiBoj@a@ccDxQor@fmDwkDboBwg@llC}bC`eF_wAvbEqGtkAmb@zj@go@nWyeAgEcm@m|AooDwEc{@|a@}gAfoBmq@hnAwdAbYseCsY_hDdPmgD_L_aDxi@mgDfdBsgEbxBg`@O{a@gh@mq@wg@y{AsB}nDaXy~@eyBsvBgt@m}ApyCogMa{@v_@m`@}S", 
			levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", 
			zoomFactor: 32, 
			numLevels: 4
		});
		
		objMap.addOverlay(objSafariQueenLine);
		objMap.addOverlay(objLadyHippoLine);
		objMap.addOverlay(objNorthBankLine);
		objMap.addOverlay(objSouthBankLine);
		objMap.addOverlay(objBasseLine);
		
		
		// Create our "tiny" marker icon...
		var icon = new GIcon();
		icon.image = "http://www.hiddengambia.com/adventure_holidays/images/maps/accom.png";
		icon.shadow = "http://www.hiddengambia.com/adventure_holidays/images/maps/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, 6);
		
		// Creates a marker at the given point with the given label text...
		function createMarker(point, i) {
			switch (arrPoints[i][2]) {
				case "0":
					icon.image = "http://www.hiddengambia.com/adventure_holidays/images/maps/accom.png";
					break;
				case "1":
					icon.image = "http://www.hiddengambia.com/adventure_holidays/images/maps/info.png";
					break;
				case "2":
					icon.image = "http://www.hiddengambia.com/adventure_holidays/images/maps/airport.png";
					icon.shadow = "";
					break;
			}
			var marker = new GMarker(point, icon);
			var strHeading = arrPoints[i][3];
			var strText = arrPoints[i][6];
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml("<b>" + strHeading + "</b><br>" + strText);
			});
			return marker;
		}
		
		for (i=0; i<arrPoints.length; i++) {
			var point = new GLatLng(arrPoints[i][4], arrPoints[i][5]);
			objMap.addOverlay(createMarker(point, i));
		}
	}
}

//]]>
