<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  
  	<style><!--
	TD {
		font-family: Arial;
		font-size: 12px;
	}
	SMALL {
		font-weight: bold;
	}
	--></style>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" content="text/html; charset=utf-8"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>{{PRG_NAME}} Geoauswertung</title>
    <script src="https://maps.google.com/maps?file=api&v=3&key=&key={{GOOGLE_API_KEY}}" type="text/javascript"></script>
    <script src="cluster.js" type="text/javascript"></script>

    <script type="text/javascript">
    // <![CDATA[
    var icsmallPartner = new GIcon(); 
    icsmallPartner.image = '{{MAP_SYM}}small_partner.png';
    icsmallPartner.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icsmallPartner.iconSize = new GSize(24, 24);
    icsmallPartner.shadowSize = new GSize(24, 24);
    icsmallPartner.iconAnchor = new GPoint(6, 20);
    icsmallPartner.infoWindowAnchor = new GPoint(5, 1);

    var icsmallSystem = new GIcon(); 
    icsmallSystem.image = '{{MAP_SYM}}small_system.png';
    icsmallSystem.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icsmallSystem.iconSize = new GSize(24, 24);
    icsmallSystem.shadowSize = new GSize(24, 24);
    icsmallSystem.iconAnchor = new GPoint(6, 20);
    icsmallSystem.infoWindowAnchor = new GPoint(5, 1);

    var icmediumPartner = new GIcon(); 
    icmediumPartner.image = '{{MAP_SYM}}medium_partner.png';
    icmediumPartner.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icmediumPartner.iconSize = new GSize(32, 32);
    icmediumPartner.shadowSize = new GSize(32, 32);
    icmediumPartner.iconAnchor = new GPoint(6, 20);
    icmediumPartner.infoWindowAnchor = new GPoint(5, 1);

    var icmediumSystem = new GIcon(); 
    icmediumSystem.image = '{{MAP_SYM}}medium_system.png';
    icmediumSystem.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icmediumSystem.iconSize = new GSize(32, 32);
    icmediumSystem.shadowSize = new GSize(32, 32);
    icmediumSystem.iconAnchor = new GPoint(6, 20);
    icmediumSystem.infoWindowAnchor = new GPoint(5, 1);

    var iclargePartner = new GIcon(); 
    iclargePartner.image = '{{MAP_SYM}}large_partner.png';
    iclargePartner.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iclargePartner.iconSize = new GSize(48, 48);
    iclargePartner.shadowSize = new GSize(48, 48);
    iclargePartner.iconAnchor = new GPoint(6, 20);
    iclargePartner.infoWindowAnchor = new GPoint(5, 1);

    var iclargeSystem = new GIcon(); 
    iclargeSystem.image = '{{MAP_SYM}}large_system.png';
    iclargeSystem.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iclargeSystem.iconSize = new GSize(48, 48);
    iclargeSystem.shadowSize = new GSize(48, 48);
    iclargeSystem.iconAnchor = new GPoint(6, 20);
    iclargeSystem.infoWindowAnchor = new GPoint(5, 1);

    var icgiantPartner = new GIcon(); 
    icgiantPartner.image = '{{MAP_SYM}}giant_partner.png';
    icgiantPartner.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icgiantPartner.iconSize = new GSize(72, 72);
    icgiantPartner.shadowSize = new GSize(72, 72);
    icgiantPartner.iconAnchor = new GPoint(6, 20);
    icgiantPartner.infoWindowAnchor = new GPoint(5, 1);

    var icgiantSystem = new GIcon(); 
    icgiantSystem.image = '{{MAP_SYM}}giant_system.png';
    icgiantSystem.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    icgiantSystem.iconSize = new GSize(72, 72);
    icgiantSystem.shadowSize = new GSize(72, 72);
    icgiantSystem.iconAnchor = new GPoint(6, 20);
    icgiantSystem.infoWindowAnchor = new GPoint(5, 1);
	
    var iccluster1 = new GIcon(); 
    iccluster1.image = '{{MAP_SYM}}User_1.png';
    iccluster1.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iccluster1.iconSize = new GSize(24, 24);
    iccluster1.shadowSize = new GSize(24, 24);
    iccluster1.iconAnchor = new GPoint(6, 20);
    iccluster1.infoWindowAnchor = new GPoint(5, 1);
    
    var iccluster2 = new GIcon(); 
    iccluster2.image = '{{MAP_SYM}}User_2.png';
    iccluster2.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iccluster2.iconSize = new GSize(32, 32);
    iccluster2.shadowSize = new GSize(32, 32);
    iccluster2.iconAnchor = new GPoint(6, 20);
    iccluster2.infoWindowAnchor = new GPoint(5, 1);
    
    var iccluster3 = new GIcon(); 
    iccluster3.image = '{{MAP_SYM}}User_3.png';
    iccluster3.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iccluster3.iconSize = new GSize(48, 48);
    iccluster3.shadowSize = new GSize(48, 48);
    iccluster3.iconAnchor = new GPoint(6, 20);
    iccluster3.infoWindowAnchor = new GPoint(5, 1);
    
    // Beginn Bildblock
    var iccluster4 = new GIcon(); 
    iccluster4.image = '{{MAP_SYM}}User_4.png';
    iccluster4.shadow = 'https://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iccluster4.iconSize = new GSize(72, 72);
    iccluster4.shadowSize = new GSize(72, 72);
    iccluster4.iconAnchor = new GPoint(6, 20);
    iccluster4.infoWindowAnchor = new GPoint(5, 1);
    // Ende Bildblock
	
    var customIcons = [];
    customIcons["smallPartner"] = icsmallPartner;
    customIcons["smallSystem"] = icsmallSystem;
    customIcons["mediumPartner"] = icmediumPartner;
    customIcons["mediumSystem"] = icmediumSystem;
    customIcons["largePartner"] = iclargePartner;
    customIcons["largeSystem"] = iclargeSystem;
    customIcons["giantPartner"] = icgiantPartner;
    customIcons["giantSystem"] = icgiantSystem;

    var display_type=3;

    if (GBrowserIsCompatible())
    {
    	var map, clusterer;
    }

    function click (e) {
     if (!e) e = window.event;
      if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
       if (window.opera)
        window.alert("Sorry: Diese Funktion ist deaktiviert.");
       return false;
      }
     }
    
    function load()
    {
    	if (GBrowserIsCompatible())
    	{


    		map = new GMap2(document.getElementById("map"));
    		clusterer = new Clusterer(map);
    		clusterer.SetMaxVisibleMarkers(5);
    		map.addControl(new GLargeMapControl());
    		map.addControl(new GMapTypeControl());
        	map.addMapType(G_PHYSICAL_MAP);


 	        map.setCenter(new GLatLng({{MAP_POS_L}},{{MAP_POS_B}}), {{MAP_POS_ZOOM}});


    		GDownloadUrl("afs_geo.xml", function(data, responseCode)
    		{
    			var xml = GXml.parse(data);
    			var markers = xml.documentElement.getElementsByTagName("marker");
    			
    			for (var i = 0; i < markers.length; i++)
    			{


            var name = markers[i].getAttribute("Firma");
            var address = markers[i].getAttribute("Strasse");
            var ort = markers[i].getAttribute("Ort");
            var plz = markers[i].getAttribute("PLZ");
	    var lat = markers[i].getAttribute("lat");
	    var lng = markers[i].getAttribute("lng");
	    var logox = markers[i].getAttribute("Logo");
	    var Tel = markers[i].getAttribute("Tel");
            if(Tel!="" && Tel!=null)
            {
             Tel=Tel+"<BR>";
            }
            else
            {
             Tel="";
            }
	    var mailx = markers[i].getAttribute("Mail");
            var x="MAILTO:";
            var mail=""
            if(mailx!="" && mailx!=null) mail="<a href="+x+mailx +">"+mailx+"</a><BR>";
	    var wwwx = markers[i].getAttribute("www");
            var www="";
            if(wwwx!="" && wwwx!=null)
            {
             if(wwwx.substring(0,7).toLowerCase()!="https://") wwwx="http://"+wwwx;
             www="<a href="+ wwwx +" target=_blank>"+wwwx+"</a><BR>";
            }
            var logo="";
            if(logox!="" && logox!=null) logo="<img src="+ logox +" width=150><BR>";
            var type = markers[i].getAttribute("Typ");



    				var umsatz  = 1;
    				
    				var point   = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
    				var marker  = createMarker(point, name, address, ort, plz, lat, lng, logo, type, umsatz);
    				//map.addOverlay(marker);
    				clusterer.AddMarker(marker, name);
    			}
    		});
    		
		}
    }

    function createMarker(point, name, address, ort, plz, lat, lng, logo, type, umsatz)
    {
    	var marker = new GMarker(point, customIcons[type]);
    	marker.setUmsatz(parseFloat(umsatz));
    	var html = "<b>" + name + "</b><br/>" + address + "<br />" + plz + ", " + ort + "<br /><img src="+ logo +"><br />";
    	GEvent.addListener(marker, 'click', function()
    	{
    		marker.openInfoWindowHtml(html);
    	});
    	return marker;
    }


if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;


    //]]>
    </script>
  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: {{MAP_WEB_WIDTH}}px; height: {{MAP_WEB_HEIGHT}}px"></div>
  </body>
</html>
