﻿// JScript File
	var strHtml; 
	var map;
	var iPoint; //coordinates of center
	var cPoint; //center of map
	var zLevel; //zoomlevel of map
	var bPoint; //point of building
	var strColor = "#B22222";
	var strColorb = "#0000CD";
	var numWidth = 5;
	var polyline=[];

function MIDN_loadmap() {
    if (GBrowserIsCompatible()) {
        cPoint = new GLatLng(51.05545, 4.51924);
        zLevel = 11;
        ShowMap();
        Setup_stores();
	}
}       

function ShowMap () {
    map = new GMap2(document.getElementById("map"));
    map.setCenter(cPoint, zLevel);
    map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
    // Monitor the window resize event and let the map know when it occurs
    if (window.attachEvent) { 
        window.attachEvent("onresize", function() {this.map.onResize()} );
    } else {
        window.addEventListener("resize", function() {this.map.onResize()} , false);
    }
}
	
function createMarkerOFF(point, html) {
    var marker = new GMarker(new GLatLng(51.94415, 4.47268));
    GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
    return marker;
}
    
function createMarker(titel, point, mhtml, mpic, mx, my) {
    //Aanmaken	Marker met tab-ballon
    
    // Info window content
    
        /*var tabText = "<table border=0 width=420px><tr><td width=300px>" + mhtml + "";
        tabText = tabText + '<br><br>Route per auto: geef <u>de cijfers van uw postcode</u> of <u>uw adres (straat, woonplaats)</u> van uw vertrekpunt:<br>'
        tabText = tabText + '<form action="http://maps.google.nl/maps" method="get"" target="_blank"><input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" />'
        tabText = tabText + '<br><br><INPUT value="Laat route zien" TYPE="SUBMIT"><input type="hidden" name="daddr" value="'  + point.lat() + ',' + point.lng() +   "(" + titel + ")" + '"/>';	
        tabText = tabText + '</td>'		
        if (mpic) {tabText = tabText + "<td><img width=100px src=\"" + mpic + "\"></td>"};
        tabText = tabText + "</tr></table>";*/

                    var tabText = "<table width=\"200px;\" cellpadding=\"0\" cellspacing=\"0\" style=\"color: Black;\">";
	                    tabText = tabText + "<tr>";
	                        tabText = tabText + "<td>";
	                            tabText = tabText + "<div style=\"margin: 10px\">";
	                                tabText = tabText + mhtml
	                            tabText = tabText + "</div>";
	                        tabText = tabText + "</td>";
	                    tabText = tabText + "</tr>";
	                    tabText = tabText + "<tr>";
	                        tabText = tabText + "<td>";
	                            tabText = tabText + "<div style=\"margin: 5px; background-color: #F0F0F0; padding-bottom: 5px; padding-left: 5px; padding-right: 5px;\">";
	                                tabText = tabText + "<u>Geef uw vertrekpunt op</u>:";
                                    tabText = tabText + "<form action=\"http://maps.google.be/maps\" method=\"get\" target=\"_blank\">";
                                    tabText = tabText + "<div align=\"center\">";
                                    tabText = tabText + "<input type=\"text\" SIZE=20 MAXLENGTH=40 name=\"saddr\" id=\"saddr\" value=\"\" />";
                                    tabText = tabText + "<INPUT value=\"toon route\" TYPE=\"submit\">";
                                    tabText = tabText + "</div>";
                                    tabText = tabText + "<input type=\"hidden\" name=\"daddr\" value=\""  + point.lat() + ',' + point.lng() + "\"/>";	
                                    tabText = tabText + "</form>";
                                tabText = tabText + "</div>";
	                        tabText = tabText + "</td>";
	                    tabText = tabText + "</tr>";
	                tabText = tabText + "</table>";
	                
	                var tabText2 = "<table width=\"200px;\" height=\"40px;\" cellpadding=\"0\" cellspacing=\"0\" style=\"color: Black;\">";
	                    tabText2 = tabText2 + "<tr>";
	                        tabText2 = tabText2 + "<td>";
	                            tabText2 = tabText2 + "<div style=\"margin: 5px\">";
	                                tabText2 = tabText2 + "<strong>" + titel + "</strong><br /><br /><span style=\"font-size: 0.8em;\"><em>Voor openingsuren, contactgegevens en routeplan, dubbelklik op het icoon.</em></span>";
                                tabText2 = tabText2 + "</div>";
	                        tabText2 = tabText2 + "</td>";
	                    tabText2 = tabText2 + "</tr>";
	                tabText2 = tabText2 + "</table>";
      
    // Extra tab
    
    /*
    var tabText2 = "<script type=\"text/javascript\">"; 
        tabText2 = tabText2 + "var map2;";
        tabText2 = tabText2 + "var directionsPanel;";
        tabText2 = tabText2 + "var directions;";

        tabText2 = tabText2 + "function initialize() {";
          tabText2 = tabText2 + "map2 = new GMap2(document.getElementById(\"map_canvas\"));";
          tabText2 = tabText2 + "map2.setCenter(new GLatLng(42.351505,-71.094455), 15);";
          tabText2 = tabText2 + "directionsPanel = document.getElementById(\"route\");";
          tabText2 = tabText2 + "directions = new GDirections(map2, directionsPanel);";
          tabText2 = tabText2 + "directions.load(\"from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)\");";
        tabText2 = tabText2 + "}";
    tabText2 = tabText2 + "</scri";
    tabText2 = tabText2 + "pt>";
    tabText2 = tabText2 + "<form>";
    tabText2 = tabText2 + "<input type=\"button\" onclick=\"javascript:initialize();return true\">";
    tabText2 = tabText2 + "</form>";
    tabText2 = tabText2 + "<div id=\"map_canvas\" style=\"width: 70%; height: 480px; float:left; border: 1px solid black;\"></div>";
    tabText2 = tabText2 + "<div id=\"route\" style=\"width: 25%; height:480px; float:right; border; 1px solid black;\"></div>";
    */

    //		alert(tabText);
    var infoTabs = [
    new GInfoWindowTab(titel, tabText)
    ];
    var infoTabs2 = [
    new GInfoWindowTab(titel, tabText2)
    ];
    //Aanmaken	
    var icon = new GIcon(G_DEFAULT_ICON, mpic)
    icon.iconSize = new GSize(mx, my);
    var marker = new GMarker(point,icon);

    //toevoegen hover op de kaart
    
    GEvent.addListener(marker, "mouseover", function() {
    marker.openInfoWindowTabsHtml(infoTabs2);
    });

    //tekst er permanent aanhangen
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowTabsHtml(infoTabs);
    });
    
    map.addOverlay(marker);



    //	return marker;
    }

function newText(mText){
    strHtml = mText
}
function addText(mText){
    strHtml = strHtml + mText
}
	
//define area's
function Setup_stores() {
    CM_Hoofdkantoor()
}

function CM_Hoofdkantoor() {
			bPoint = new GLatLng(51.05545, 4.51924);
            
            newText("<div>");
            addText("<p>");
            addText("<strong>");
            addText("VAHL SPORTSGEAR<br />");
            addText("</strong>");
            addText("Kastanjelei 12j<br />");
            addText("2860 Sint-Katelijne-Waver<br />");
            addText("België");
            addText("</p>");
            addText("</div>");
			createMarker("VAHL SPORTSGEAR", bPoint, strHtml, "http://labs.google.com/ridefinder/images/mm_20_red.png", 12, 20);
}