
/**
 * 
 */
function initMapCanvasOnPubOrg() {

	var dbg = true;
	var compatible = GBrowserIsCompatible();
	var map_canvas = document.getElementById('map_canvas');
	//var map_canvas = $('map_canvas'); // Das wäre doch ne schickere Variante, oder?
	map_canvas.style.display = 'block';
	
	if (compatible && map_canvas) {

		var map = new GMap2(map_canvas);
		//map.setMapType(G_NORMAL_MAP); // Warum wird hier kein MapType gesetzt?
		map.setCenter(new GLatLng(16.804798, 20.323900), 2);
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());

		// Create a base icon for all of our markers that specifies the shadow, icon dimensions, etc.
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);

		// Liste der Countries als Array
		var Country = new Array();

		Country[0] = new Object();
		Country[0]["name"] = "Algerie";
		Country[0]["point"] = new GLatLng(28.033886,1.659626);
		Country[0]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=32&menu=05000000'>TPF Algerie</a></div>";

		Country[1] = new Object();
		Country[1]["name"] = "Angola";
		Country[1]["point"] = new GLatLng(-8.815762,13.230522);
		Country[1]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=30&menu=05000000'>TPF Planege Angola</a></div>";

		Country[2] = new Object();
		Country[2]["name"] = "Belgium";
		Country[2]["point"] = new GLatLng(50.8048, 4.3239);
		Country[2]["Contentblock"] = "\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=7&menu=05000000'>TPF S.A.</a></div>\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=20&menu=05000000'>BE Hubert Louis</a></div>\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=19&menu=05000000'>TPF Basse Sambre</a></div>\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=17&menu=05000000'>TPF Engineering</a></div>\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=16&menu=05000000'>TPF Utilities</a></div>\n"+
				"<div><a href='/red4net/pub_content.asp?content=5&id=50&org=48&menu=05000000'>TTR Energie</a></div>";

		Country[3] = new Object();
		Country[3]["name"] = "France";
		Country[3]["point"] = new GLatLng(43.27989, 5.403922);
		Country[3]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=21&menu=05000000'>Beterem</a></div>";

		Country[4] = new Object();
		Country[4]["name"] = "India";
		Country[4]["point"] = new GLatLng(19.01254, 73.11977);
		Country[4]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=24&menu=05000000'>S.N. Bhobe & Associates Pvt. Ltd</a></div>";

		Country[4] = new Object();
		Country[4]["name"] = "India";
		Country[4]["point"] = new GLatLng(19.01254, 73.11977);
		Country[4]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=24&menu=05000000'>S.N. Bhobe & Associates Pvt. Ltd</a></div>";

		Country[5] = new Object();
		Country[5]["name"] = "Luxembourg";
		Country[5]["point"] = new GLatLng(49.815273,6.129583);
		Country[5]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=28&menu=05000000'>TPF Luxembourg</a></div>";

		Country[6] = new Object();
		Country[6]["name"] = "Poland";
		Country[6]["point"] = new GLatLng(52.22199, 20.97882);
		Country[6]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=23&menu=05000000'>E&L Architects</a></div>";

		Country[7] = new Object();
		Country[7]["name"] = "Portugal";
		Country[7]["point"] = new GLatLng(38.7408, -9.150066);
		Country[7]["Contentblock"] = "<div><a target='_blank' href='/red4net/pub_content.asp?content=5&id=50&org=15&menu=05000000'>TPF Planege</a></div>";

		Country[8] = new Object();
		Country[8]["name"] = "Romania";
		Country[8]["point"] = new GLatLng(45.943161,24.96676);
		Country[8]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=25&menu=05000000'>TPF Romania</a></div>";

		Country[9] = new Object();
		Country[9]["name"] = "Spain";
		Country[9]["point"] = new GLatLng(43.37012, -8.402824);
		Country[9]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=26&menu=05000000'>Econoler Spain</a></div>";

		Country[10] = new Object();
		Country[10]["name"] = "Brazil";
		Country[10]["point"] = new GLatLng(-14.235004, -51.925280);
		Country[10]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=43&menu=05000000'>PROJETEC S.A.</a></div>";

		Country[11] = new Object();
		Country[11]["name"] = "Ecuador";
		Country[11]["point"] = new GLatLng(-1.831239, -78.183406);
		Country[11]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=45&menu=05000000'>PROJETEC PROYECTOS TECNICOS CIA. LTDA</a></div>";

		Country[12] = new Object();
		Country[12]["name"] = "Maroc";
		Country[12]["point"] = new GLatLng(31.791702, -7.092620);
		Country[12]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=39&menu=05000000'>Société Pyramide Ingénierie sarl</a></div>";

		Country[13] = new Object();
		Country[13]["name"] = "Panama";
		Country[13]["point"] = new GLatLng(8.537981, -80.782127);
		Country[13]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=47&menu=05000000'>PROJETEC S.A.</a></div>";

		Country[14] = new Object();
		Country[14]["name"] = "Tunisie";
		Country[14]["point"] = new GLatLng(33.886917, 9.537499);
		Country[14]["Contentblock"] = "<div><a href='/red4net/pub_content.asp?content=5&id=50&org=47&menu=05000000'>Société MonaStab sarl</a></div>";

		for (var i = 0; i < Country.length; i++) {
			var marker = createCountryMarker(baseIcon, Country[i]);
			map.addOverlay(marker);
		}

	}

	window.onunload = GUnload;

}

/**
 * Creates a marker whose info window displays the letter corresponding to the given index.
 */
function createCountryMarker(icon, country) {

	var countryPoint = country["point"];
	var countryName = country["name"];
	var countryContentBlock = country["Contentblock"];

	var icon = new GIcon(icon);
	icon.image = "/template/tpf_flag.png";

	// Set up our GMarkerOptions object
	var marker = new GMarker(countryPoint, {icon: icon});

	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<b>" + countryName + "</b><br />" + countryContentBlock);
	});

	return marker;

}

// Dieses JavaScript soll nur in pub_org ausgeführt werden! 
if ('/red4net/pub_org.asp' == document.location.pathname) {
	$(document).ready(initMapCanvasOnPubOrg);
}


