
    var iconA = new GIcon();  //attracties
    iconA.image = '../images/map-icon-A.png';
    iconA.shadow = '../images/shade.png';
    iconA.iconSize = new GSize(23, 27);
    iconA.shadowSize = new GSize(39, 25);
    iconA.iconAnchor = new GPoint(23, 27);
    iconA.infoWindowAnchor = new GPoint(9, 4);

    var iconSs = new GIcon(); //siteseeing
    iconSs.image = '../images/map-icon-Ss.png';
    iconSs.shadow = '../images/shade.png';
    iconSs.iconSize = new GSize(23, 27);
    iconSs.shadowSize = new GSize(39, 25);
    iconSs.iconAnchor = new GPoint(23, 27);
    iconSs.infoWindowAnchor = new GPoint(9, 4);
    
    var iconSh = new GIcon(); //shopping
    iconSh.image = '../images/map-icon-Sh.png';
    iconSh.shadow = '../images/shade.png';
    iconSh.iconSize = new GSize(23, 27);
    iconSh.shadowSize = new GSize(39, 25);
    iconSh.iconAnchor = new GPoint(23, 27);
    iconSh.infoWindowAnchor = new GPoint(9, 4);
    
    var iconM = new GIcon();  //musea
    iconM.image = '../images/map-icon-M.png';
    iconM.shadow = '../images/shade.png';
    iconM.iconSize = new GSize(23, 27);
    iconM.shadowSize = new GSize(39, 25);
    iconM.iconAnchor = new GPoint(23, 27);
    iconM.infoWindowAnchor = new GPoint(9, 4);
    
    var iconH = new GIcon();  //horeca
    iconH.image = '../images/map-icon-H.png';
    iconH.shadow = '../images/shade.png';
    iconH.iconSize = new GSize(23, 27);
    iconH.shadowSize = new GSize(39, 25);
    iconH.iconAnchor = new GPoint(23, 27);
    iconH.infoWindowAnchor = new GPoint(9, 4);
    
    var iconSp = new GIcon();  //sport
    iconSp.image = '../images/map-icon-Sp.png';
    iconSp.shadow = '../images/shade.png';
    iconSp.iconSize = new GSize(23, 27);
    iconSp.shadowSize = new GSize(39, 25);
    iconSp.iconAnchor = new GPoint(23, 27);
    iconSp.infoWindowAnchor = new GPoint(9, 4);
    
    var iconO = new GIcon();  //overig
    iconO.image = '../images/map-icon-grey.png';
    iconO.shadow = '../images/shade.png';
    iconO.iconSize = new GSize(23, 27);
    iconO.shadowSize = new GSize(39, 25);
    iconO.iconAnchor = new GPoint(23, 27);
    iconO.infoWindowAnchor = new GPoint(9, 4);
    
    var iconE = new GIcon();  //empty
    iconE.image = '../images/map-icon-empty.png';
    iconE.shadow = '../images/shade.png';
    iconE.iconSize = new GSize(23, 27);
    iconE.shadowSize = new GSize(39, 25);
    iconE.iconAnchor = new GPoint(23, 27);
    iconE.infoWindowAnchor = new GPoint(9, 4);
    
    var iconNs = new GIcon();  //ns
    iconNs.image = '../images/map-icon-ns.png';
    iconNs.shadow = '../images/shade.png';
    iconNs.iconSize = new GSize(23, 27);
    iconNs.shadowSize = new GSize(39, 25);
    iconNs.iconAnchor = new GPoint(23, 27);
    iconNs.infoWindowAnchor = new GPoint(9, 4);
    
    var iconVv = new GIcon();  //vvv
    iconVv.image = '../images/map-icon-vvv.png';
    iconVv.shadow = '../images/shade.png';
    iconVv.iconSize = new GSize(23, 27);
    iconVv.shadowSize = new GSize(39, 25);
    iconVv.iconAnchor = new GPoint(23, 27);
    iconVv.infoWindowAnchor = new GPoint(9, 4);
    
    var iconWidh = new GIcon();  //widh
    iconWidh.image = '../afb9/home_icon.png';
    iconWidh.shadow = '../images/shade.png';
    iconWidh.iconSize = new GSize(23, 27);
    iconWidh.shadowSize = new GSize(39, 25);
    iconWidh.iconAnchor = new GPoint(23, 27);
    iconWidh.infoWindowAnchor = new GPoint(9, 4);
    
     var iconSfeer = new GIcon();  //widh
    iconSfeer.image = '../afb9/sfeer_icon.png';
    //iconSfeer.shadow = '../images/shade.png';
    iconSfeer.iconSize = new GSize(50, 50);
    //iconSfeer.shadowSize = new GSize(39, 25);
    iconSfeer.iconAnchor = new GPoint(25, 25);
    iconSfeer.infoWindowAnchor = new GPoint(25, 25);
    
    var customIcons = [];
    customIcons["2"] = iconA;
    customIcons["3"] = iconSs;
    customIcons["1"] = iconSh;
    customIcons["4"] = iconM;
    customIcons["5"] = iconH;
    customIcons["6"] = iconSp;
    customIcons["7"] = iconO;
    customIcons["8"] = iconE;
    customIcons["9"] = iconNs;
    customIcons["10"] = iconVv;
    customIcons["11"] = iconWidh;
    customIcons["12"] = iconSfeer;
    



    function replaceGreyIcon(path) {
     var iconC = new GIcon();  //custom
    iconC.image = path;
    iconC.shadow = '../images/shade.png';
    iconC.iconSize = new GSize(23, 27);
    iconC.shadowSize = new GSize(39, 25);
    iconC.iconAnchor = new GPoint(23, 27);
    iconC.infoWindowAnchor = new GPoint(9, 4);
     customIcons["7"] = iconC;
    }


    
    function setDirections(fromAddress, toAddress, locale) {
      map.closeInfoWindow(); 
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });        
    }

 // === Remove the API icons and add new markers in the same location ===
      function changeIcons() {
     // document.forms.directionsForm.directions.value="on";
        for (var i=0; i<gdir.getNumGeocodes(); i++) {
          var myMarker = gdir.getMarker(i);
          map.removeOverlay(myMarker);
          //custom marker
          //map.addOverlay(new GMarker(myMarker.getLatLng(),{icon:iconGrey}));
      showdiv("directions");
      showdiv("showmenu");
      hidediv("showroute");
      hidediv("side_bar");
      hidediv("main_menu");
      hidediv("smallmenu");
      hidediv("searchform");  
        }
      }


     

      

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}
	
	

function createMarkerSimple(point, icon, popuphtml) {
	//var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
	
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, 'click', function() {
		//marker.openLittleInfoWindow(popuphtml);
		marker.openInfoWin(popuphtml);
	});
	GEvent.addListener(marker,'mouseover',function() {
		marker.openToolTip(popuphtml);
	});
	GEvent.addListener(marker,'mouseout',function() {
		marker.closeToolTip();
	});

	return marker;
}


function createMarkerNoTabExternalContentNoRoute(point, name, type, image, content, url, contentpart, marker_id, overig, intIDlist, modelList, typeNameList, totalmarkers) {
//if (customIcon!="") {
//  replaceGreyIcon(customIcon);
//}

var str = StringcheckerJS(name);
name = str;

       /*labeledMarker, (vast label naast icon) functionaliteit uitgezet, 
       benodigde includes in map.asp: labeledmarker.js en labeledmarker_packed.js
       opts = { 
          "icon": customIcons[type],
          "clickable": true,
          "title": name,
          "labelText": name,
          "labelOffset": new GSize(-13, 0)
        };*/
      //  if (totalmarkers<21) {
	//var marker = new LabeledMarker(point, opts);
	//} else {
	var marker = new GMarker(point, customIcons[type]);
	//}
	var linkid = "link"+(gmarkers.length);
	var dq=String.fromCharCode(34);
	
	str = StringcheckerJS(content);
	content = str;
	//str = StringcheckerJSvoorFlash(contentpart);
	//contentpart = str;
	str = StringcheckerJS(overig);
	overig = str;
	
	str = StringcheckerJS(url);
	url = str;
	//str = StringcheckerJS(typeNameList);
	//typeNameList = str;
	var urlList=url.split("/");
	var urlShort=urlList[2];
	str = StringcheckerJS(contentpart);
	contentpart = str;
	
	
		
    var html1a = "<table width='300px' border='0'>";
	
	
	
		if (image!="") {
	      html1a += "<tr><td align='left'><div class='kop'>"+ name +"</div><div class='cr-map-cached-image'><img src=" + image + " align='left'/></div><div class='spacer'>&nbsp;</div></td></tr>";
	        } else {
	        html1a += "<tr><td align='right'><br /><b>"+ name +"</b><br /><br /></td></tr>";
	        }
	  
	if (content!="") {        
	html1a += "<tr><td align='left'><div class='content1'>" + content +"</div></td></tr>";
	}
	html1a += "<tr><td align='left'><div class='content2'>"
	for (q=0; q<intIDlist.length; q++) {
	if (intIDlist[q]!="") {
		html1a += "<a href='#' onClick="+dq+"javascipt:recordOutboundLink(this, 'Outbound Niki Links', '"+ name +": www.niki.nl/xml/action/detailresult?housetypeid="+ intIDlist[q] +"&housemodelid=" + modelList[q] +"');window.open('http://www.niki.nl/xml/action/detailresult?housetypeid="+ intIDlist[q] +"&housemodelid=" + modelList[q] +"');return false;"+dq+">"
	if (modelList[q]==1) {  
	html1a += "Vrijstaand, ";
	} else if (modelList[q]==2) {
	html1a += "Rijwoning, ";
	} else if (modelList[q]==3) {
	html1a += "Hoekwoning, ";
	} else if (modelList[q]==4) {
	html1a += "Appartement, ";     
	} else if (modelList[q]==5) {
	html1a += "Twee-onder-een-kap, ";
	} else if (modelList[q]==6) {
	html1a += "Vrije kavel, ";
	} else if (modelList[q]==7) {
	html1a += "Penthouse, " ;
	} else if (modelList[q]==8) {
	html1a += "Geschakeld, ";
	} else {
	html1a += "";
	}
	str = StringcheckerJS(typeNameList[q]);
	html1a += str;
	html1a +="</a>"
	
	//html1a += "<a href='http://wonenindenhaag.content.niki.nl/xml/action/detailresult?housetypeid="+ intIDlist[q] +"&housemodelid=" + modelList[q] +"' target='_blank'>o</a>"
	html1a +="<br />";
	}
	}
	html1a +="</div></td></tr>"
	if (contentpart!="") {
	html1a += "<tr><td align='left'><div class='content2'>" + contentpart +"</div></td></tr>";
	}
	
	
	
	if (url!="") {
	html1a += "<tr><td align='left'><div class='website'>website: <a href='#' onClick="+dq+"javascript:recordOutboundLink(this, 'Outbound Website Links', '" + urlShort + "');window.open('" + url + "');return false;"+dq+">" + urlShort + "</a></div></td></tr>";
	}

//if (image!="") {
//	html1a += "<tr><td><br /><br /></td></tr>";	      
// }
	
	 html1a += "</table>";
	

	//var infoTabs = [
	//	new GInfoWindowTab("Info", html1a),
		//new GInfoWindowTab("Meer info", html1b)
	//];
	
	GEvent.addListener(marker,'mouseover',function() {
		marker.openToolTip(name);
	});
	GEvent.addListener(marker,'mouseout',function() {
		marker.closeToolTip();
	});
	
GEvent.addListener(marker, "click", function() {
	//if (document.directionsForm.toAddress.value!="") {
	//document.directionsForm.fromAddress.value=document.directionsForm.toAddress.value;
	//}
		//document.directionsForm.toAddress.value=point;
		//document.directionsForm.marker.value=marker_id;
		//sendClick();
		//marker.openInfoWindowTabsHtml(infoTabs);
		marker.openInfoWindowHtml(html1a);
		
		//if (document.directionsForm.searchOn.value=='1') {
		//document.getElementById(linkid).style.background="#f0c800";		
       // lastlinkid=linkid;
        //}
       
	});
	// save the info we need to use later for the side_bar;
	gmarkers.push(marker);
	return marker;
}

function createMarkerSmall(point, name, type, image, content, url, contentpart, marker_id, overig) {
//if (customIcon!="") {
//  replaceGreyIcon(customIcon);
//}
	var marker = new GMarker(point, customIcons[type]);
	var linkid = "link"+(gmarkers.length);
	
	var str = StringcheckerJS(content);
	content = str;
	//str = StringcheckerJSvoorFlash(contentpart);
	//contentpart = str;
	str = StringcheckerJS(overig);
	overig = str;
	str = StringcheckerJS(name);
	name = str;
	str = StringcheckerJS(url);
	url = str;
	var urlList=url.split("/");
	var urlShort=urlList[2];
	str = StringcheckerJS(contentpart);
	contentpart = str;
	
	
		
    var html1a = "<table width='150px' border='0'>";
	
	
	
		if (image!="") {
	      html1a += "<tr><td align='left'><div class='kop'>"+ name +"</div><div class='cr-map-cached-image'><img src=" + image + " align='left'/></div><div class='spacer'>&nbsp;</div></td></tr>";
	        } else {
	        html1a += "<tr><td align='right'><br /><b>"+ name +"</b><br /><br /></td></tr>";
	        }
	  
	if (content!="") {        
	html1a += "<tr><td align='left'><div class='content1'>" + content +"</div></td></tr>";
	}
	
	if (contentpart!="") {
	html1a += "<tr><td align='left'><div class='content2'>" + contentpart +"</div></td></tr>";
	}
	
	
	
	if (url!="") {
	html1a += "<tr><td align='left'><div class='website'>website: <a class='hotspot' href='" + url + "' target='_blank'>" + urlShort + "</div></a></td></tr>";
	}

//if (image!="") {
//	html1a += "<tr><td><br /><br /></td></tr>";	      
// }
	
	 html1a += "</table>";
	

	//var infoTabs = [
	//	new GInfoWindowTab("Info", html1a),
		//new GInfoWindowTab("Meer info", html1b)
	//];
	
	
	
GEvent.addListener(marker, "click", function() {
	//if (document.directionsForm.toAddress.value!="") {
	//document.directionsForm.fromAddress.value=document.directionsForm.toAddress.value;
	//}
		//document.directionsForm.toAddress.value=point;
		//document.directionsForm.marker.value=marker_id;
		//sendClick();
		//marker.openInfoWindowTabsHtml(infoTabs);
		marker.openInfoWindowHtml(html1a);
		
		//if (document.directionsForm.searchOn.value=='1') {
		//document.getElementById(linkid).style.background="#f0c800";		
       // lastlinkid=linkid;
        //}
       
	});
	// save the info we need to use later for the side_bar;
	gmarkers.push(marker);
	return marker;
}

function switchTab(myTab) { 
map.getInfoWindow().selectTab(myTab)
} 


// Clear all overlays
function clearOverlays() {
	map.clearOverlays();
	GEvent.clearListeners(map, "mouseover");
	GEvent.clearListeners(map, "click");
	GEvent.clearListeners(map, "move");
}


 function ToolTip(marker, html, width)
        {
                this.html_ = html;
                this.width_ = (width ? width + 'px' : 'auto');
                this.marker_ = marker;
        }

        ToolTip.prototype = new GOverlay;

        ToolTip.prototype.initialize = function(map)
        {
                var div = document.createElement('div');
                div.style.display = 'none';
                map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
                this.map_ = map;
                this.container_ = div;
        }

        ToolTip.prototype.remove = function()
        {
                this.container_.parentNode.removeChild(this.container_);
        }

        ToolTip.prototype.copy = function()
        {
                return new ToolTip(this.html_);
        }

        ToolTip.prototype.redraw = function(force)
        {
                if(!force)
                {
                        return;
                }

                var pixelLocation = this.map_.fromLatLngToDivPixel
(this.marker_.getPoint());
                this.container_.innerHTML = this.html_;
                this.container_.style.position = 'absolute';
                xpos = pixelLocation.x + 2;
                this.container_.style.left = xpos + 'px';
                ypos = pixelLocation.y - 20;
                this.container_.style.top = ypos + 'px';
                this.container_.style.width = this.width_;
                this.container_.style.font = '10px Verdana';
                this.container_.style.border = '1px solid #ffd300';
                this.container_.style.background = '#ffe980';
                this.container_.style.padding = '1px';
                //this.container_.style.opacity = '0.7';

                this.container_.style.whiteSpace = 'nowrap';

                if(this.width_ != 'auto')
                {
                        this.container_.style.overflow = 'hidden';
                }

                this.container_.style.display = 'block';
        }

        GMarker.prototype.ToolTipInstance = null;

        GMarker.prototype.openToolTip = function(content)
        {
                if(this.ToolTipInstance == null)
                {
                        this.ToolTipInstance = new ToolTip(this, content);
                        map.addOverlay(this.ToolTipInstance);
                }
        }

        GMarker.prototype.closeToolTip = function()
        {
                if(this.ToolTipInstance != null)
                {
                        map.removeOverlay(this.ToolTipInstance);
                        this.ToolTipInstance = null;
                }
        }

