var markerOptions;
var infoOptions;

function createMarker(point, text) {
	var marker = new GMarker(point, markerOptions);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(text, infoOptions);
	});
	return marker;
}

function initialize() {
	if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("map_canvas"));
	map.setCenter(new GLatLng(21.539502,-0.126343), 2);
	map.setMapType(G_SATELLITE_MAP);
	map.addControl(new GLargeMapControl3D());
	map.addControl(new GMapTypeControl());
	map.disableScrollWheelZoom();
	map.enableGoogleBar();
		
	// Create blue marker icon
	var blueIcon = new GIcon(G_DEFAULT_ICON);
	blueIcon.image = "images/layout/blue_marker.png";
	blueIcon.printImage = "images/layout/blue_marker_print.gif";
	blueIcon.mozPrintImage = "images/layout/blue_marker_mozPrint.gif";
	markerOptions = { icon:blueIcon };
	
	// set max width of info window
	infoOptions = { maxWidth:300 };
	
	// Ghana (Accra)
	point = new GLatLng(5.555848,-0.196381);
	address = "<strong>Ghana (Accra)</strong><br />Closing the Malaria Treatment Gap: working with the informal sector for malaria treatment and education.<br /><a href=\"searchresults.php?id=114\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Tanzania (Dar es Salaam)
	point = new GLatLng(-6.822921,39.269661);
	address = "<strong>Tanzania (Dar es Salaam)</strong><br />Evaluating the Treated Nets Voucher Scheme (TNVS): scaling up the distribution of Insecticide Treated Nets (ITNs) and informing delivery strategies.<br /><a href=\"searchresults.php?id=16\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// India (Adilabad District, Andhra Pradesh)
	point = new GLatLng(19.675565,78.541946);
	address = "<strong>India (Adilabad District, Andhra Pradesh)</strong><br />Bringing Programme and Community Perspectives Together: constructing a communicable diseases database on tribal health.<br /><a href=\"searchresults.php?id=61\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Peru (Lima)
	point = new GLatLng(-12.093039,-77.047119);
	address = "<strong>Peru (Lima)</strong><br />Fighting Poverty to Control TB: promoting health rights for TB-affected patients and families.<br /><a href=\"searchresults.php?id=111\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Zambia
	point = new GLatLng(-13.133897,27.849332);
	address = "<strong>Zambia</strong><br />The ZAMSTAR study (Zambia and South Africa TB and AIDS Reduction): a community-randomized trial evaluating two interventions into TB care in high HIV areas.<br /><a href=\"searchresults.php?id=46\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Afghanistan
	point = new GLatLng(33.93911,67.709953);
	address = "<strong>Afghanistan</strong><br />Malaria control in a complex emergency context - analysis and dissemination of policy-relevant evidence.<br /><a href=\"searchresults.php?id=124\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Uganda (Makerere)
	point = new GLatLng(0.322808,32.569399);
	address = "<strong>Uganda (Makerere)</strong><br />Sputum instruction cards: patient-based educational materials to improve TB smear microscopy.<br /><a href=\"searchresults.php?id=119\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	// Kenya (Nairobi)
	point = new GLatLng(-1.274309,36.812439);
	address = "<strong>Kenya (Nairobi)</strong><br />Malaria Transmission Consortium: monitoring and evaluating malaria interventions in epidemic-prone areas of Kenya.<br /><a href=\"searchresults.php?id=115\">&gt; More project infomation</a>";
	marker = createMarker(point, address);
	map.addOverlay(marker);
	
	}
}