function createMarker(point, title, html, n, tooltip, routeplanner) 
{
	if(n >= 0) 
	{ 
		n = -1; 
	}
	var marker = new GMarker(point,{'title': tooltip});
	var tabFlag = isArray(html);
	if(!tabFlag) 
	{ 
		html = [{"contentElem": html}]; 
	}
	
	if (routeplanner == "1")
	{
		to_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirTo" action="http://maps.google.com/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadTo" style="font-family:Verdana;font-size:11px;">Route berechnen: Hierher</span>' +
                     '<p class="gmapDirItem" id="gmapDirItemTo"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelTo" style="font-family:verdana,sans-serif; font-size:11px;">Start: </label>' +
                     '<input style="font-family:verdana,sans-serif; font-size:11px;" type="text" size="16" maxlength="40" name="saddr" class="gmapTextBox" id="gmapDirSaddr" value="" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsTo"><input style="font-family:verdana,sans-serif; font-size:11px;" value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonTo" /></span></p>' +
                     '<input type="hidden" name="daddr" value="' + point.y + ',' + point.x + "(" + title.replace(new RegExp(/"/g),'&quot;') + ")" + '" /></form>';
	}
	else if (routeplanner == "3")
	{
			to_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirTo" action="http://maps.google.com/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadTo" style="font-family:Verdana;font-size:11px;">Route berechnen: Hierher - <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:fromhere(' + counter + ')">Von hier</a></span>' +
                     '<p class="gmapDirItem" id="gmapDirItemTo"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelTo" style="font-family:verdana,sans-serif; font-size:11px;">Start: </label>' +
                     '<input style="font-family:verdana,sans-serif; font-size:11px;" type="text" size="16" maxlength="40" name="saddr" class="gmapTextBox" id="gmapDirSaddr" value="" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsTo"><input style="font-family:verdana,sans-serif; font-size:11px;" value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonTo" /></span></p>' +
                     '<input type="hidden" name="daddr" value="' + point.y + ',' + point.x + "(" + title.replace(new RegExp(/"/g),'&quot;') + ")" + '" /></form>';
	
	}
	if (routeplanner == "2")
	{
		    from_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirFrom" action="http://maps.google.de/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadFrom" style="font-family:Verdana;font-size:11px;">Route berechnen: Von hier</span>' +
                     '<p class="gmapDirItem" id="gmapDirItemFrom"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelFrom" style="font-family:verdana,sans-serif; font-size:11px;">Ziel: </label>' +
                     '<input style="font-family:verdana,sans-serif; font-size:11px;" type="text" size="16" maxlength="40" name="daddr" class="gmapTextBox" id="gmapDirSaddr" value="" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsFrom"><input style="font-family:verdana,sans-serif; font-size:11px;" value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonFrom" /></span></p>' +
                     '<input type="hidden" name="saddr" value="' + point.y + ',' + point.x + encodeURIComponent("(" + title.replace(new RegExp(/"/g),'&quot;') + ")") + '" /></form>';
	}
	else if (routeplanner == "3")
	{
		    from_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirFrom" action="http://maps.google.de/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadFrom" style="font-family:Verdana;font-size:11px;">Route berechnen: <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:tohere(' + counter + ')">Hierher</a> - Von hier</span>' +
                     '<p class="gmapDirItem" id="gmapDirItemFrom"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelFrom" style="font-family:verdana,sans-serif; font-size:11px;">Ziel: </label>' +
                     '<input style="font-family:verdana,sans-serif; font-size:11px;" type="text" size="16" maxlength="40" name="daddr" class="gmapTextBox" id="gmapDirSaddr" value="" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsFrom"><input style="font-family:verdana,sans-serif; font-size:11px;" value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonFrom" /></span></p>' +
                     '<input type="hidden" name="saddr" value="' + point.y + ',' + point.x + encodeURIComponent("(" + title.replace(new RegExp(/"/g),'&quot;') + ")") + '" /></form>';
	}
    
    if (routeplanner == "1")
    {
    	html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="font-family:Verdana;font-size:11px;">Route berechnen: <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:tohere(' + counter + ')">Hierher</a></div>';
    }
    else if (routeplanner == "2")
    {
    	html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="font-family:Verdana;font-size:11px;">Route berechnen: <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:fromhere(' + counter + ')">Von hier</a></div>';
    }
    else if (routeplanner == "3")
    {
	    html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="font-family:Verdana;font-size:11px;">Route berechnen: <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:tohere(' + counter + ')">Hierher</a> - <a style="font-family:Verdana;font-size:11px;text-decoration:underline;" href="javascript:fromhere(' + counter + ')">Von hier</a></div>';
    }
	    
	if(!tabFlag) 
	{ 
		html = html[0].contentElem; 
	}
	if(isArray(html)) 
	{ 
		GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowTabsHtml(html); }); 
		GEvent.addListener(marker, "visibilitychanged", function() { marker.openInfoWindowTabsHtml(html); }); 
	}
	else 
	{ 
		GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowHtml(html); }); 
		GEvent.addListener(marker, "visibilitychanged", function() { marker.openInfoWindowHtml(html); }); 
	}
	points[counter] = point;
	markers[counter] = marker;
	counter++;
	return marker;
}

function isArray(a) 
{
	return isObject(a) && a.constructor == Array;
}
function isObject(a) 
{
	return (a && typeof a == 'object') || isFunction(a);
}
function isFunction(a) 
{
	return typeof a == 'function';
}
function showInfoWindow(idx,html) 
{
	map.centerAtLatLng(points[idx]);
	markers[idx].openInfoWindowHtml(html);
}
function tohere(idx) 
{
	markers[idx].openInfoWindowHtml(to_htmls[idx]);
}
function fromhere(idx) 
{
	markers[idx].openInfoWindowHtml(from_htmls[idx]);
}
