function initCustomMarker(marker){
	
	var markerType = marker.getAttribute("type")
	// init marker
	var oMarker = new Object()
	
	// type, segment, icon, colorstyle
	oMarker.type = marker.getAttribute("type")
	oMarker.segment = marker.getAttribute("segment")
	oMarker.icon = marker.getAttribute("icon")
	oMarker.colorstyle = marker.getAttribute("colorstyle")
	
	// relatienr, name, title
	oMarker.orgkey = marker.getAttribute("orgkey")
	oMarker.name = marker.getAttribute("name")
	oMarker.title = marker.getAttribute("title")
	
	// lat, lng, coords
	oMarker.lat = marker.getAttribute("lat")
	oMarker.lng = marker.getAttribute("lng")
	oMarker.coord = new GLatLng(parseFloat(oMarker.lat), parseFloat(oMarker.lng))
	
	// get contents of marker child node infobox
	if (marker.childNodes.length > 0) {
		
		for (var i=0; i < marker.childNodes.length; i++) {
			if (marker.childNodes[i].nodeType == 1 && marker.childNodes[i].nodeName == 'infobox') {
				if (marker.childNodes[i].nodeName == 'infobox') {
					var oInfobox = marker.childNodes[i]
					// address info
					oMarker.infobox = new Object()
					oMarker.infobox.street = oInfobox.getAttribute("street")
					oMarker.infobox.zip = oInfobox.getAttribute("zip")
					oMarker.infobox.city = oInfobox.getAttribute("city")
					oMarker.infobox.province = oInfobox.getAttribute("province")
					oMarker.infobox.phone = oInfobox.getAttribute("phone")
					oMarker.infobox.fax = oInfobox.getAttribute("fax")
					oMarker.infobox.website = oInfobox.getAttribute("website")
					oMarker.infobox.teaser_image = ""
					oMarker.infobox.teaser_text = ""
					oMarker.infobox.html = ""
					// teaser
					if (oInfobox.childNodes.length > 0) {
						for (var j = 0; j < oInfobox.childNodes.length; j++) {
							if (oInfobox.childNodes[j].nodeName == 'teaser' && oInfobox.childNodes[j].nodeType == 1) {
								var oTeaser = oInfobox.childNodes[j]
								oMarker.infobox.teaser_image = oTeaser.getAttribute("image")
								oMarker.infobox.teaser_text = ""
								if (oTeaser.firstChild && oTeaser.firstChild.nodeType == 3) oMarker.infobox.teaser_text = oTeaser.firstChild.nodeValue
							}
						}
					}
					// init contents of infobox
					if (oInfobox.attributes.length > 0) {
						
						oMarker.infobox.html += '<table cellpadding="0" cellspacing="0" border="0"><tr><td>'

						// winkel title
						oMarker.infobox.html += '<table cellpadding="4" cellspacing="0" border="0"><tr><td class="InfoBox' + oMarker.colorstyle + 'Title" style="white-space: nowrap">' + oMarker.title + '</td></tr>'
						
						// START address information
						oMarker.infobox.html += '<tr><td class="InfoBoxAddress">'
						// address
						if (trim(oMarker.infobox.street).length > 0) oMarker.infobox.html += oMarker.infobox.street + '<br/>'
						// zip
						if (trim(oMarker.infobox.zip).length > 0) oMarker.infobox.html += oMarker.infobox.zip + '&nbsp;&nbsp;'
						// city
						if (trim(oMarker.infobox.city).length > 0) oMarker.infobox.html += oMarker.infobox.city  
						// province
						//if (trim(oMarker.infobox.province).length > 0) oMarker.infobox.html += oMarker.infobox.province + '<br/>'
						// phone
						if (trim(oMarker.infobox.phone).length > 0) oMarker.infobox.html += '<br/>T. ' + oMarker.infobox.phone + ''
						// fax
						//if (trim(oMarker.infobox.fax).length > 0) oMarker.infobox.html += '<br/>F. ' + oMarker.infobox.fax
						// website
						if (trim(oMarker.infobox.website).length > 0) oMarker.infobox.html += '<br/>I. <a href="http://' + oMarker.infobox.website + '">' + oMarker.infobox.website + '</a>'
						// END address information
						oMarker.infobox.html += '</td></tr>'
						// meer info
						oMarker.infobox.html += '<tr><td class="InfoBox' + oMarker.colorstyle + 'LinkMoreBorder"><a href="' + _webfolder + 'view.cfm?website_id=' + _website_id + '&template=winkel_detail&orgkey=' + oMarker.orgkey + '" class="InfoBoxLinkMore"/>Meer info &raquo;</a></td></tr></table>'
						
						// image
						if (trim(oMarker.infobox.teaser_image).length > 0) oMarker.infobox.html += '</td><td class="InfoBoxImage"><a href="' + _webfolder + 'view.cfm?website_id=' + _website_id + '&template=lid_detail&orgkey=' + oMarker.orgkey + '"/><img src="' + _gfxfolder_infobox + oMarker.infobox.teaser_image + '?ts=1" border="0"/></a>'
						
						oMarker.infobox.html +='</td></tr></table>'
						
					}
					
				}
			}
		}
	}
	
	// return marker object
	return oMarker
}

function showCustomMarkers() {
	// clear existing overlays
	gMap.clearOverlays()
	// add markers to map
	if (aMarkers.length > 0) {
		for (var i = 0; i < aMarkers.length; i++) {
			gMap.addOverlay( new CustomMarker(aMarkers[i]) )
		}
	}
}

function getCustomMarker(name) {
	// find the requested marker
	var oMarker = new Object()
	for (var i = 0; i < aMarkers.length; i++) {
		if (aMarkers[i].name == name) {
			oMarker = aMarkers[i]
			break
		}
	}
	// return the marker
	return oMarker
}

/* CustomMarkers Class */

function CustomMarker(oMarker) {
	this.oMarker = oMarker
}

CustomMarker.prototype = new GOverlay()

CustomMarker.prototype.initialize = function(map) 
{
	var div = document.createElement("div")
	div.style.position = "absolute"
	div.oMarker = this.oMarker
	
	// set extention for image used
	var imgExtention = (browserDetect.isWinIE && !(browserDetect.isWinIE7 || browserDetect.isWinIEVista)) ? 'gif' : 'png'
	
	var sText = '<table cellpadding="0" cellspacing="0" border="0" onmouseover="if(typeof(infoBoxTimeoutID)==\'number\'){clearTimeout(infoBoxTimeoutID)}"><tr><td>'
	// normal marker
	if (trim(div.oMarker.colorstyle).length > 0) sText += '<img src="' + _gfxfolder_maps + 'markers/' + div.oMarker.colorstyle + '.' + imgExtention + '"/>'
	sText += '</td></tr></table>'
	
	// add contents to container
	div.innerHTML = sText
	
	// attach events
	GEvent.addDomListener(div, "mouseover", function() { if (typeof(openInfoBox) == 'function') openInfoBox(this.oMarker); })
	GEvent.addDomListener(div, "mouseout", function() { if (typeof(closeInfoBox) == 'function' && infoBoxTimeoutID) infoBoxTimeoutID = setTimeout("closeInfoBox()", 500); })
	
	this.map_ = map	
	this.div_ = div
	
	// add container to map
	map.getPane(G_MAP_MARKER_PANE).appendChild(this.div_)
}

CustomMarker.prototype.remove = function() 
{
	this.div_.parentNode.removeChild(this.div_)
	this.div_ = null
}

CustomMarker.prototype.copy = function() 
{
	return new CustomMarker(this.oMarker)
}

CustomMarker.prototype.redraw = function(force)
{
	if (!force) return
	
	var bounds = gMap.getBounds()
	var c = this.map_.fromLatLngToDivPixel(this.oMarker.coord)
	
	//alert('left: ' + c.x + '\ntop: ' + c.y + '\nthis.div_.offsetWidth: ' + this.div_.offsetWidth + '\nthis.div_.offsetHeight: ' + this.div_.offsetHeight)
	
	//this.div_.style.border = "1px solid red"
	this.div_.style.left = (c.x - 3) + "px"
	this.div_.style.top = ((c.y + 3) - this.div_.offsetHeight) + "px"
	
	//alert('left: ' + this.div_.style.left + '\ntop: ' + this.div_.style.top)
}

/* End CustomMarker Class */
