var bMark = true;
var mapLayers="";
var bMapTipsLayer=true;
var iMaptipsMax=400;
var iMaptipsLayerMax=400;
var bMapTipsLoadCount=true;
var bMapTipsAnim=true;
var iOldMapTipCount=0;
var lMarkPointId = 0;
var sParam = "";
var umkreissucheaktiv = false;
var strUmkreis = "";
var kategorie = "";
var setPoly = false;
var myPoly = "";
var PolyPoint = 0;
var PointAnzahl = 100;
var isPolyAuflistung = false;
var pointid = "";
var changeLage = false;
var lastCall;
var AnimationVerstecken = false;
var OrtSpeicherung;
var MultipleOrt;
var viewType = "";
var started = 0;
var errorHappend = false;
var errorActive = false;
var submitString = "";
var IntervalId;
var timerId;
var waitTimerId;
var waitCount;
var processAbort = false;
var mapThemeId = 0;
var demogAttribute = "";
var mapServiceName = "";
var mapSource = "";
var staticImage = "";
var themeName = "";
var themePrint = "";
var demogName = "";
var minScale = 0;
var maxScale = 1;
var maxScaleFull = 3200000;
var scale = 0;
var themeListFirstTime = true;
var newmapThemeId = 0;
var newDemogAttribute = "";
var boldIdString = "";
var allThemeFeatureCount = 0;
var allThemeFeatureCountSave;
var mapThemeIdArray = new Array();
var mapThemeCategoryArray = new Array();
var mapThemeDescriptionArray = new Array();
var locMinX = 0;
var locMinY = 0;
var locMaxX = 0;
var locMaxY = 0;
var locationPortionCount;
var locationPortions = 100;
var completeLocationFeatureCount;
var locationFeatureCount;
var locationExtArray = new Array();
var locationNameArray = new Array();
var locationSearchString;
var originalSearchString;
var locationPoint = "";
var locationText = "";
var locationLand = "";
var locationPlz = "";
var locationOrt = "";
var locationStr = "";
var locationEvent = "";
var locationRadius = "";
var locationParams = "";
var anzahl = "";
var eventPoint = "";
var eventIDs = "";
var verortPoint = "";
var XPixel = -1;
var YPixel = -1;
var copyright = "";
var maxZoomLevels = 0;
var zoomLevelPercents = new Array();
var mapSize = "medium";
var searching = false;
var mapSourceSite = "blank.html";
var visLayerList = "";
var AdrPlzArray = new Array();
var AdrOrtArray = new Array();
var AdrGemArray = new Array();
var AdrRecArray = new Array();
var AdrStrArray = new Array();
var AdrBezNameArray = new Array();
var AdrLandNameArray = new Array();
var AdrStaatArray = new Array();
var AdrBLArray = new Array();

function resetParams()
{
	bUmkreisSucheSeite = false;
	pointid = "";
	flagClearPoint = false;
	zoomstufe = 0;
	Umkreissuche=false;
	UmkreisPointX=0;
	UmkreisPointY=0;
	Radius="";
	katid="";
	ZoomStufe;
	theCFURL = CFServerPath;
	fixEvent = "Selfmade";
	ovMapvisible = true;
	selectionCount = 3;
	eventCount = 3;
	delLeft = 0;
	delRight = 0;
	delTop = 0;
	delBottom = 0;
	pointcode = 1;
	left = 0;
	right = 0;
	top = 0;
	bottom = 0;
	fullLeft = 0;
	fullRight = 0;
	fullTop = 0;
	fullBottom = 0;
	newLeft = 0;
	newBottom = 0;
	newRight = 0;
	newTop = 0;
	oldLeft = 0;
	oldRight = 0;
	oldTop = 0;
	oldBottom = 0;	
	medium_hspc = 227;
	medium_vspc = 160;
	ovHspc = 460;
	ovVspc = 1;
	hspc = 158; // Beginn left
	vspc = 15;		// Beginn top
	zoomButtonsHspc = 600;
	zoomButtonsVspc = 400;
	locHspc = 2; // 500
	locVspc = 2;
	locWidth = 135;
	locHeight = 89;
	medium_iWidth = 600;//600
	medium_iHeight = 400;//400
	zoomButtonHeight = 300;
	zoomButtonWidth = 75;
	ciWidth = 600;
	ciHeight = 400;
	mapLayers="";
	mapLayersUser="";
	checkContent=0;
	userLayersActive = false;
	userLayers="";
	userLayersUser="";
	ersterAufruf = true;
	routeName=""; // used route
	routeSetPoint=0;
	routePointID=-1;
	routeStartPoint="";
	routeStopPoint="";
	routeEndPoint="";
	umkreissucheaktiv = false;
	strUmkreis = "";
	kategorie = "";
	setPoly = false;
	myPoly = "";
	PolyPoint = 0;
	PointAnzahl = 100;
	isPolyAuflistung = false;
	pointid = "";
	changeLage = false;
	lastCall;
	AnimationVerstecken = false;
	OrtSpeicherung;
	MultipleOrt;
	viewType = ""; // plates or dynamicMap
	errorHappend = false;
	errorActive = false;
	submitString = "";
	IntervalId;
	timerId;
	waitTimerId;
	waitCount;
	processAbort = false;
	katid="";
	mapThemeId = 0;
	demogAttribute = "";
	mapServiceName = "";
	mapSource = "";
	staticImage = "";
	themeName = "";
	themePrint = "";
	demogName = "";
	minScale = 0;
	maxScale = 1;
	maxScaleFull = 3200000;
	scale = 0;
	themeListFirstTime = true;
	newmapThemeId = 0;
	newDemogAttribute = "";
	boldIdString = "";
	allThemeFeatureCount = 0;
	locMinX = 0;
	locMinY = 0;
	locMaxX = 0;
	locMaxY = 0;
	locationPortions = 100;
	locationPoint = "";
	locationText = "";
	locationLand = "";
	locationPlz = "";
	locationOrt = "";
	locationStr = "";
	locationEvent = "";
	locationRadius = "";
	locationParams = "";
	anzahl = "";
	eventPoint = "";
	eventIDs = "";
	verortPoint = "";
	XPixel = -1;
	YPixel = -1;
	copyright = "";
	maxZoomLevels = 0;
	mapSize = "medium";
	searching = false;
	mapSourceSite = "blank.html";
	visLayerList = "";
}

function findOrtResultNew(resultlist) {
	resultlist=prepareToGet(resultlist);
	var s =	resultlist.lastIndexOf("{");
	var e = resultlist.indexOf(";",eval(s+1));
	var i;
	var strNummer;
	
	if(resultlist == "") {
		locationFeatureCount = 0;
	} else {
		strNummer = "";
		for(i=s+1; i<=e-1; i++) {
			strNummer = strNummer + resultlist.charAt(i);
		}
		locationFeatureCount = parseInt(strNummer);
		e = 1;
		for (i=0; i<locationFeatureCount; i++) {
			s = e+1;
			e =	resultlist.indexOf(";",s);
			locationExtArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrPlzArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrOrtArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrGemArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrBezNameArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrLandNameArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrStaatArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf("{",s);
			if (e == -1) e = resultlist.length;
			AdrRecArray[i] = resultlist.substring(s,e);
		}
		MultipleOrt = true;
	}
	doPopup('700','350','/uab/ortsauswahl2.html','FindLocation');
	finish(true,true,true);
}

function findStrassenResult(resultlist) {
	resultlist=prepareToGet(resultlist);
	var s =	resultlist.lastIndexOf("{");
	var e = resultlist.indexOf(";",eval(s+1));
	var i;
	var strNummer;
	if(resultlist == "") {
		locationFeatureCount = 0;
	} else {
		strNummer = "";
		for(i=s+1; i<=e-1; i++) {
			strNummer = strNummer + resultlist.charAt(i);
		}
		locationFeatureCount = parseInt(strNummer);
		e = 1;
		for (i=0; i<locationFeatureCount; i++) {
			s = e+1;
			e =	resultlist.indexOf(";",s);
			locationExtArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrPlzArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrOrtArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrGemArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf(";",s);
			AdrStrArray[i] = resultlist.substring(s,e);
			s = e+1;
			e =	resultlist.indexOf("{",s);
			if (e == -1) e = resultlist.length;
			AdrRecArray[i] = resultlist.substring(s,e);
		}
		MultipleOrt = true;
	}
	doPopup('450','350','/uab/strassenauswahl.html','FindLocation');
	finish(true,true,true);
}

// when a route is generated, don't display the map, wait for the second call
var bDoNotDisplayMap=false;
//the Routing-Server only generates the route, the map is generated by a map-server
function resumeWithoutRouting(sImgUrl,sImgPath)
	{
	bDoNotDisplayMap=false;
	refreshDynamicMap("Refresh",false,sImgUrl,sImgPath);
	}

function resumeWithOldString(_par) {
	start();
	if (started > 1) return;
	clearInterval(IntervalId);
	var started;
	hideLayer("errorLayer");
	theString = lastCall;
	theString = theString + _par;
	lastCall = theString;
	parent.PostFrame.location.replace("/gServer.asp?"+theString);
	clearTimeout(timerId);
	timerId = setTimeout("abort(\"Der Server ist zur Zeit überlastet! Bitte versuchen Sie es später wieder.\");",180000);
}

function findEventUmkreis(searchLand,UmkreisX,UmkreisY,searchEvent,startrow,initFlag) {
	start();
	if (started > 1) return;
	var i;
	var params = "";
	if (visLayerList != "")	params = params + "&visLayerList=" + visLayerList;
	params = params + "&LND=" + searchLand +  "&UmkreisX=" + UmkreisX + "&UmkreisY=" + UmkreisY + "&Event=" + searchEvent + "&Index=" + startrow;
	params = params + "&selCnt=" + selectionCount + "&evtCnt=" + eventCount;
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
  if (mapLayersUser!="") params += "&Layers=" + mapLayersUser;
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params+="&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params+="&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
	if (XPixel != -1 && YPixel != -1)
		params+="&XPixel=" + XPixel + "&YPixel=" + YPixel;
		var theCall = theCFURL + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
	if (locationPoint != "") theCall+="&point=" + locationPoint + "&text=" + locationText;
	if (eventIDs !="") theCall+="&EventIDs=" + eventIDs;
	if (initFlag==true) {
		theCall+="&winWidth=" + iWidth + "&winHeight=" + iHeight
			+ "&locWidth=" + locWidth + "&locHeight=" + locHeight
			+ "&Start=True";	
	}
	theCall+="&Browser=" + is.b;
	theCall+="&cmd=PUNKTUMKREIS_CENTER"; 
	callCF(theCall);
}


function findSelection(searchLand,searchPLZ,searchORT,searchSTR,searchEvent,searchRadius,searchParams, startrow,initFlag) {
	start();
if (started > 1) return;
	for( i=0;i<searchORT.length;i++ )
	{
		searchORT = searchORT.replace("#",""); 
	}
	for( i=0;i<searchSTR.length;i++ )
	{
		searchSTR = searchSTR.replace("#",""); 
	}
	
	locationLand = searchLand;
	locationPlz = searchPLZ;
	locationOrt = searchORT;
	locationStr = searchSTR;
	locationEvent = searchEvent;
	locationParams = searchParams;
	locationRadius = searchRadius;
	originalSearchString = searchORT;
	if(searchSTR != "" && searchSTR != null)
		originalSearchString = originalSearchString + ", " + searchSTR;

	var params = "";
	if (visLayerList != "")	params = params + "&visLayerList=" + visLayerList;
	params = params + "&LND=" + searchLand +  "&Ort=" + searchORT + "&Strasse=" + searchSTR + "&Event=" + searchEvent + "&Radius=" + searchRadius + "&Params=" + searchParams  + "&Index=" + startrow;
	params = params + "&selCnt=" + selectionCount + "&evtCnt=" + eventCount;
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params = params + "&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params = params + "&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
	if (XPixel != -1 && YPixel != -1)
		params = params + "&XPixel=" + XPixel + "&YPixel=" + YPixel;
		var theCall = theCFURL + "&cmd=Selection" + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
		
	if (locationPoint != "") theCall = theCall + "&point=" + locationPoint + "&text=" + locationText;
	if (initFlag==true) {
		theCall = theCall + "&winWidth=" + iWidth + "&winHeight=" + iHeight
			+ "&locWidth=" + locWidth + "&locHeight=" + locHeight
			+ "&Start=True";	
	}

	theCall = theCall + "&Browser=" + is.b;
	callCF(theCall);
}

function umkreissuche(searchTable,searchLand,searchPLZ,searchORT,searchSTR,searchEvent,searchRadius,searchNumberOfShowingSymbols,searchParams,startrow,initFlag) {
	anzahl = searchNumberOfShowingSymbols;
	kategorie = searchEvent;
	umkreissucheaktiv = true;
	strUmkreis = searchRadius;
	locationParams = "Selfmade";
	start();
if (started > 1) return;
	
	for( i=0;i<searchORT.length;i++ )
	{
		searchORT = searchORT.replace("#",""); 
	}
	for( i=0;i<searchSTR.length;i++ )
	{
		searchSTR = searchSTR.replace("#",""); 
	}
	
	locationLand = searchLand;
	locationPlz = searchPLZ;
	locationOrt = searchORT;
	locationStr = searchSTR;
	locationEvent = searchEvent;
	locationParams = searchParams;
	locationRadius = searchRadius;
	originalSearchString = searchORT;
	if(searchSTR != "" && searchSTR != null)
		originalSearchString = originalSearchString + ", " + searchSTR;

	var params = "";
	if (visLayerList != "")	params = params + "&visLayerList=" + visLayerList;
	params = params + "&LND=" + searchLand +  "&Ort=" + searchORT + "&Strasse=" + searchSTR + "&Event=" + searchEvent + "&Radius=" + searchRadius + "&Params=" + searchParams  + "&Index=" + startrow + "&Code=" + searchEvent;
	params = params + "&selCnt=" + selectionCount + "&evtCnt=" + eventCount;
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
	if (anzahl != "") {
		params = params + "&anzahl=" + anzahl;
	}	
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params = params + "&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params = params + "&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
	if (XPixel != -1 && YPixel != -1)
		params = params + "&XPixel=" + XPixel + "&YPixel=" + YPixel;
		var theCall = theCFURL + "&cmd=Selection" + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
		
	if (locationPoint != "") theCall = theCall + "&point=" + locationPoint + "&text=" + locationText;
	if (initFlag==true) {
		theCall = theCall + "&winWidth=" + iWidth + "&winHeight=" + iHeight
			+ "&locWidth=" + locWidth + "&locHeight=" + locHeight
			+ "&Start=True";	
	}
	
	theCall = theCall + "&usertable=" + searchTable;
	theCall = theCall + "&Browser=" + is.b;
	callCF(theCall);
}

function StartUserDefinedArea(Area) {
	var params= "";
	
	// general settings
	setZoomBoxSettings();
	viewType = "dynamicMap"
	start();
	if (started > 1) return;
	
	newmapThemeId = 0;
	parent.MapFrame.startUpDynamicMapPrivate("images/austria2.gif","GeoLook_Aut","",3000,3976322, "3976322,2500000,1000000,500000,200000,50000,25000,12500,6250,3000",72559,703722,584473,160364,72559,703722,584473,160364,0,150,0,100);
	params= "&cmd=AreaSelection&Area=" + Area;
	params+= "&userid=" + userid;
	params+= "&winWidth=" + iWidth + "&winHeight=" + iHeight;

  parent.PostFrame.location.replace("/gServer.asp?"+params);
	clearTimeout(timerId);
	timerId = setTimeout("abort(\"Der Server ist zur Zeit überlastet! Bitte versuchen Sie es später wieder.\");",180000);
}


function startUpSimpleMap()
{
	// general settings
	setZoomBoxSettings();
	viewType = "dynamicMap"
	
	newmapThemeId = 0;

	parent.MapFrame.startUpDynamicMapPrivate("images/austria2.gif","GeoLook_Aut","",3000,3976322, "3976322,2500000,1000000,500000,200000,50000,25000,12500,6250,3000",72559,703722,584473,160364,72559,703722,584473,160364,0,150,0,100);
}

function startUpDynamicPrivateHP(uid, pid, _ispoly)
{
	setZoomBoxSettings();
	viewType = "dynamicMap"
	newmapThemeId = 0;
	var theURLValues = document.location.search;
	start();
	if (started > 1) return;
	parent.MapFrame.startUpDynamicMapPrivate("images/pixel.gif","GeoLook_Aut","",3000,3976322, "3976322,2500000,1000000,500000,200000,50000,25000,12500,6250,3000",72559,703722,584473,160364,72559,703722,584473,160364,0,150,0,100);
	if(_ispoly == 1) {
		theURLValues = "&cmd=showpoly"
	}
	else {
		theURLValues = "&cmd=privatecall"
	}
	var theCall =  theCFURL + theURLValues
					+ "&winWidth=" + iWidth + "&winHeight=" + iHeight
					+ "&locWidth=" + locWidth + "&locHeight=" + locHeight
					+ "&Browser=" + is.b + "&userid=" + uid + "&pointid=" + pid;
	callCF(theCall)
}

function startUpDynamicMapPrivate(_mapURL, _mapServiceName, _visLayerList, 
						_minScale, _maxScale, _zoomLevels,
						_left, _right, _top, _bottom, _fullLeft, _fullRight, _fullTop, _fullBottom,
						_locLeft, _locRight, _locTop, _locBottom) {
	setZoomBoxSettings();
	if(document.layers)
		{
		document.layers['theMap'].document.theImage.src=_mapURL;
		}
	else
		{
		document.theImage.src=_mapURL;
		}
	left = parseFloat(_left);
	top = parseFloat(_top);
	bottom = parseFloat(_bottom);
	right = parseFloat(_right); 
	fullLeft = parseFloat(_fullLeft);
	fullRight = parseFloat(_fullRight);
	fullTop = parseFloat(_fullTop);
	fullBottom = parseFloat(_fullBottom);
	oldLeft = left;
	oldRight = right;
	oldTop = top;
	oldBottom = bottom;
	mapServiceName = _mapServiceName;
	visLayerList = _visLayerList;
	minScale = _minScale / _maxScale;
	maxScaleFull = _maxScale;
	maxScale = 1;
	zoomLevels = _zoomLevels;
	if (left <= fullLeft && right >= fullRight && bottom <= fullBottom && top >= fullTop) {
		locMinX = _locLeft;
		locMinY = _locBottom;
		locMaxX = _locRight;
		locMaxY = _locTop;
	} else 
		locMinX = locMinY = locMaxX = locMaxY = 0;
	//drawRectOnLocatorMap(parseFloat(_locLeft),parseFloat(_locBottom),parseFloat(_locRight),parseFloat(_locTop));	
	fillZoomButtonArray(zoomLevels);
}

function startUpDynamicMapResult(_mapURL, _mapServiceName, _visLayerList, 
						_minScale, _maxScale, _zoomLevels,
						_left, _right, _top, _bottom, _fullLeft, _fullRight, _fullTop, _fullBottom,
						_locLeft, _locRight, _locTop, _locBottom) {
	if(document.layers)
		{
		document.layers['theMap'].document.theImage.src=_mapURL;
		}
	else
		{
		document.theImage.src=_mapURL;
		}

	left = parseFloat(_left);
	top = parseFloat(_top);
	bottom = parseFloat(_bottom);
	right = parseFloat(_right); 
	fullLeft = parseFloat(_fullLeft);
	fullRight = parseFloat(_fullRight);
	fullTop = parseFloat(_fullTop);
	fullBottom = parseFloat(_fullBottom);
	oldLeft = left;
	oldRight = right;
	oldTop = top;
	oldBottom = bottom;
	mapServiceName = _mapServiceName;
	visLayerList = _visLayerList;
	minScale = _minScale / _maxScale;
	maxScaleFull = _maxScale;
	maxScale = 1;
	zoomLevels = _zoomLevels;
	//drawRectOnLocatorMap(parseFloat(_locLeft),parseFloat(_locBottom),parseFloat(_locRight),parseFloat(_locTop));	
	fillZoomButtonArray(zoomLevels);
	finish(true,false,true);
}

// resumewithoutrouting
function refreshDynamicMap(_cmd,_timeout,sImgUrl,sImgPath) {
	if(!_cmd)_cmd="Refresh";
	start();
	if (started > 1) return;
  if (!_timeout)_timeout=60000;
	oldLeft = left;
	oldRight = right;
	oldTop = top;
	oldBottom = bottom;
	var params = "";
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params = params + "&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params = params + "&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
	if (XPixel != -1 && YPixel != -1)
		params = params + "&XPiXel=" + XPixel + "&YPixel=" + YPixel;
	
	// resumewithoutrouting
	if(sImgUrl!="" && sImgUrl!=null)
	 	{
		params+="&imgUrl="+sImgUrl;	 		
	}
	if(sImgPath!="" && sImgPath!=null)
	 	{
	 	params+="&imgPath="+sImgPath;
	 	}
	
	var theCall = theCFURL + "&cmd=" + _cmd + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
	if (locationPoint != "") theCall = theCall + "&Point=" + locationPoint;
	if (eventPoint != "") theCall = theCall + "&EventPoint=" + eventPoint;	
	if (eventIDs !="") theCall = theCall + "&EventIDs=" + eventIDs;
	if (mapLayersUser!="") theCall += "&Layers=" + mapLayersUser;
	theCall = theCall + "&Browser=" + is.b;
	callCF(theCall,_timeout);
}

function refreshDynamicMapResult(_mapURL, _ovimgURL, _left, _right, _top, _bottom,
								 _locLeft, _locRight, _locBottom, _locTop, _point, _eventIDs) {
	ersterAufruf = false;
	
	// resumewithoutrouting
	if(bDoNotDisplayMap==false)
		{
		if(document.layers)
			{
			document.layers['theMap'].document.theImage.src=_mapURL;
			}
		else
			{
			document.theImage.src=_mapURL;
			}
		}
		
	left = parseFloat(_left);
	top = parseFloat(_top);
	bottom = parseFloat(_bottom);
	right = parseFloat(_right); 
	XPixel = YPixel = -1;
	locationPoint = _point;
	eventPoint = "";
	eventIDs = _eventIDs;
	locationParams="";
	locationRadius="";
	newLeft = newRight = newBottom = newTop = 0;
	drawRectOnLocatorMap(parseFloat(_locLeft),parseFloat(_locBottom),parseFloat(_locRight),parseFloat(_locTop));	
	finish(true,true,true);
}

function GetID() {
	start();
	if (started > 1) return;
	var params = "";
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params = params + "&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params = params + "&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
		
	params = params + "&XPixel=" +mapX + "&YPixel=" + mapY;
	params = params + "&Event=" + fixEvent;
	var theCall = theCFURL + "&cmd=ID" + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
	theCall = theCall + "&Browser=" + is.b;
	callCF(theCall);
}

function findEvent(searchLand,searchPLZ,searchORT,searchSTR,searchEvent,startrow,initFlag) {
	start();
if (started > 1) return;
	var i;
	if( searchORT != "" )
	{
		for( i=0;i<searchORT.length;i++ )
		{
			searchORT = searchORT.replace("#",""); 
		}
	}
	if( searchSTR != "" )
	{
		for( i=0;i<searchSTR.length;i++ )
		{
			searchSTR = searchSTR.replace("#",""); 
		}
	}
	locationLand = searchLand;
	locationOrt = searchORT;
	locationStr = searchSTR;
	locationEvent = searchEvent;
	originalSearchString = searchORT;
	if(searchSTR != "" && searchSTR != null)
		originalSearchString = originalSearchString + ", " + searchSTR;
	var params = "";
	if (visLayerList != "")	params = params + "&visLayerList=" + visLayerList;
	params = params + "&LND=" + searchLand +  "&PLZ=" + searchPLZ + "&Ort=" + searchORT + "&Strasse=" + searchSTR + "&Event=" + searchEvent + "&Index=" + startrow;
	params = params + "&selCnt=" + selectionCount + "&evtCnt=" + eventCount;
	params = params + "&minScale=" + minScale + "&maxScale=" + maxScale;
	params = params + "&oldLeft=" + left + "&oldTop=" + top + "&oldBottom=" + bottom + "&oldRight=" + right;
	params = params + "&locWidth=" + locWidth + "&locHeight=" + locHeight;
	if (newLeft == 0 && newTop == 0 && newBottom == 0 && newRight == 0)
		params = params + "&newLeft=" + left + "&newTop=" + top + "&newBottom=" + bottom + "&newRight=" + right;
	else
		params = params + "&newLeft=" + newLeft + "&newTop=" + newTop + "&newBottom=" + newBottom + "&newRight=" + newRight;
	if (XPixel != -1 && YPixel != -1)
		params = params + "&XPixel=" + XPixel + "&YPixel=" + YPixel;
		var theCall = theCFURL + "&cmd=Adresse" + params + "&winWidth=" + iWidth + "&winHeight=" + iHeight;
	if (locationPoint != "") theCall = theCall + "&point=" + locationPoint + "&text=" + locationText;
	if (eventIDs !="") theCall = theCall + "&EventIDs=" + eventIDs;
	if (initFlag==true) {
		theCall = theCall + "&winWidth=" + iWidth + "&winHeight=" + iHeight
			+ "&locWidth=" + locWidth + "&locHeight=" + locHeight
			+ "&Start=True";	
	}
	theCall = theCall + "&Browser=" + is.b;
	callCF(theCall);
}

function findAdressResult(resultlist) {
	var s = 0;
	var e =	resultlist.indexOf(";",s);
	var art =resultlist.substring(s,e);
	s = e+1;
	e =	resultlist.indexOf(";",s);
	locationFeatureCount = parseFloat(resultlist.substring(s,e));
	for (var i=0; i<locationFeatureCount; i++) {
		s = e+1;
		e =	resultlist.indexOf(":",s);
		locationExtArray[i] = resultlist.substring(s,e);
		s = e+1;
		e =	resultlist.indexOf(";",s);
		if (e == -1) e = resultlist.length;
		locationNameArray[i] = resultlist.substring(s,e);
	}
	MultipleOrt = true;
	doPopup('350','300','findlocation_content1.html','FindLocation');
	finish(true,true,true);
}

function getAdress(newOrt,index) {
	closePopup();
	if (umkreissucheaktiv==false) {
		if (index > "-1")
			findEvent(locationLand,locationPlz,locationOrt,locationStr,locationEvent,index,true);
		else 
			findEvent(locationLand,locationPlz,newOrt,locationStr,locationEvent,index,true);
		}
	else {
		if (index > "-1")
			findSelection(locationLand,locationPlz,locationOrt,locationStr,locationEvent,locationRadius,locationParams,index,true);
		else 
			findSelection(locationLand,locationPlz,newOrt,locationStr,locationEvent,locationRadius,locationParams,index,true);
	}
}

function showErrorAlert(errorText) {
	finish(false,false,false);
	closePopup();
	var theErrorText = unescape(errorText);
	theErrorText = theErrorText.replace(/\+/g," ");
	alert(theErrorText);
}

function stopMapMachine() {
	errorActive = false;
	searching = false;
	closePopup();
	if (viewType == "plates" || viewType == "dynamicMap") {
		hideZoomBox();
		hideLayer("loadLayer");
		showLayer("theTop");
	}
}

function tryAgain() {
	errorActive = false;
	searching = true;
	callCF(submitString);
	if (viewType == "plates" || viewType == "dynamicMap") {
		showLayer("theTop");	}
}

function abort(errorText) {
	processAbort = true;
	showErrorAlert(errorText);
}

function refreshMap(zooming) {
	refreshDynamicMap();
}

function callCF(theString,_timeout) {
	clearInterval(IntervalId);
	var started;
  if (!_timeout) _timeout=60000;
	if (theString == "")
		theString = submitString;
	else {
		var today = new Date();
		submitString = theString + "&again=" + (today.getMilliseconds());
	}		
	processAbort = false;
	while (theString.indexOf(" ") > -1){
	theString = theString.replace(" ","+");}
	if( theString.search(/userid/) == -1 ) {
		theString += "&userid=" + userid;
	}
	if (delLeft != null && delLeft != 0 && delRight != null && delRight != 0 && delTop != null && delTop != 0 && delBottom != null && delBottom != 0 ) {
		theString = theString + "&delLeft=" + delLeft + "&delRight=" + delRight + "&delTop=" + delTop + "&delBottom=" + delBottom;
	}
	if(Umkreissuche == true) {
		theString = theString + "&umkreis=true";
	}
	if(UmkreisPointX != 0) {
		theString = theString + "&umkreispointx=" + UmkreisPointX;
	}
	if(UmkreisPointY != 0) {
		theString = theString + "&umkreispointy=" + UmkreisPointY;
		theString = theString + "&Radius=" + Radius;
	}
	if(kategorie != "" && flagClearPoint == false) {
		theString = theString + "&Code=" + kategorie;
	}
	if(userLayersActive) {
		theString = theString + "&userLayersActive=1";
	}
	if(ersterAufruf && userLayersActive) {
		theString = theString + "&InitUserLayers=1";
	}
	if(userLayersActive && !ersterAufruf) {
		userLayerModifyFirst();
	}
	if (userLayersUser!="")
		theString += "&userLayers=" + userLayersUser;
	if (routeName!="") theString+="&routeName="+routeName;
	if (routePointID>=0) {
		theString=theString+"&routePID="+routePointID;
  		if (routeStartPoint)
  			theString+="&routeSP="+routeStartPoint;
			if (routeStopPoint)
  			theString+="&routeHP="+routeStopPoint;
			if (routeEndPoint)
				theString+="&routeEP="+routeEndPoint;
	}

	/*if(bMark) {
		theString += "&mark=true";
		theString += "&pointid=" + lMarkPointId;
	}*/
	
	if(pointid != "") {
		theString += "&pointid=" + pointid;
		theString += "&mark=true";
		theString += "&pointid=" + lMarkPointId;
	}
	if (routePointID==0) {
		theString += "&Action=Routing";
	}
	if(bMapTipsLayer==true)
		{
		theString=theString+"&maptipslayer=true"
		}	
	if(iMaptipsMax > 0)
		{
		theString=theString+"&MaptipsMax="+iMaptipsMax;
		}
	if(iMaptipsLayerMax > 0)
		{
		theString=theString+"&MaptipsLayerMax="+iMaptipsLayerMax;
	}	
	if(bMapTipsLoadCount == true) theString=theString+"&MapTipsLoadCount=true";
	theString+="&TYP=Neu";
	if(sParam != "") theString += sParam;
	theString+="&server=" + strServerName;
	theStringGlobal = theString;
	lastCall = theString;	
	
	parent.PostFrame.location.replace("/gServer.asp?"+theString);
	clearTimeout(timerId);
	timerId = setTimeout("abort(\"Der Server ist zur Zeit überlastet! Bitte versuchen Sie es später wieder.\");",180000);
}

function callCFNow(_name) {
	myServerName = _name;
	theStringGlobal = theStringGlobal.replace(CFServerPath, CFServerPath + "?name=" + _name);
	theStringGlobal = theStringGlobal.replace("?name=" + _name + "?name=" + metaMapServiceName, "?name=" + _name);
	parent.PostFrame.location.replace( theStringGlobal );
	clearTimeout(timerId);
	timerId = setTimeout("abort(\"Der Server ist zur Zeit überlastet! Bitte versuchen Sie es später wieder.\");",180000);
}

function checkIfBold(id) {
	if (boldIdString.indexOf(","+id+",",0) != -1)
		return true;
	else
		return false;
}

function value(str,search) {
	var s = str.indexOf(search,0);
	if (s == -1) return -1;
	var e = str.indexOf("&",s+1);
	if (e == -1) e = str.length;
	return str.substring(s+search.length+1,e);
}

function start() {
	if (started > 0) {
		started ++;
		return;
	}
	else	{
	showLayer("loadLayer");
	started += 1;
	
	searching = true;
	}
}

function finish(hasZoomBox,hasZoomButtons,doReloadAd) {
	
	clearTimeout(timerId);
	hideLayer("loadLayer");
	searching = false;
	if (hasZoomButtons) setZoomButtons();
	if (hasZoomBox) 	hideZoomBox();
	started = 0;
}
