		
		// Global vars for browser type and version
		var isNav = (navigator.appName.indexOf("Netscape")>=0);
		var isNav4 = false;
		var isIE4 = false;
		var is5up = false;
		
		var aktXco;
		var aktYco;
		
		if (isNav) {
			
			if (parseFloat(navigator.appVersion)<5) {
				isNav4=true;
			} else {
				is5up = true;
			}
		} else {
			isIE4=true;
			if (navigator.appVersion.indexOf("MSIE 5")>0) {
				isIE4 = false;
				is5up = true;
			}
		}
		
		function startUp() {	
			var divLayer = document.getElementById("locatorDiv");			
			divLayer.onclick = doClick;
		}
		
		function doClick(e){	
	  	getImageXY(e);	
	        
	    if (checkInMap()){	        	
				leftTop = new Array(mouseX,mouseY);				
				resCoords1 = img2Map(leftTop);	
				aktXco = Math.round(resCoords1[0]);
				aktYco = Math.round(resCoords1[1]);
	    	refreshMap();
	    }
	        
		}
		
		
		// Allgemeine Einstellungen
		function generalSettings(iw,ih,hs,vs,coordL,coordT,coordR,coordB) {
			mapWidth = iw;
			mapHeight = ih;
			mapLeft = hs;
			mapTop = vs;	
			mapLeftInit = hs;
			mapTopInit = vs;
			
			extentL = parseFloat(coordL);
			extentT = parseFloat(coordT); 
			extentR = parseFloat(coordR); 
			extentB = parseFloat(coordB); 			
			
			//window.status = extentL + " / " + extentT + " / " + extentR + " / " + extentB
		
		   iWidth = iw;
		   iHeight = ih;
		   hspc = hs;
		   vspc = vs;	   
		}		
			
	
		/*
		***************************************************************************************
		
		Navigation functions - used to resize zoom box
			Extended versions of these functions are used by the ArcIMS HTML Viewer - found in aimsNavigation.js
		
		***************************************************************************************
		*/
		
		// get cursor location
		function getImageXY(e) {
			if (isNav) {
				mouseX=e.pageX;
				mouseY=e.pageY;
			} else {
				mouseX=event.clientX + document.body.scrollLeft;
				mouseY=event.clientY + document.body.scrollTop;
			}
			// subtract offsets from page left and top
			mouseX = mouseX-hspc;
			mouseY = mouseY-vspc;		
		}	




	//reload the Map
	function refreshMap() {								
		var f2 = window.parent.frames[2];
		var fo = f2.document.forms['mapForm'];
		//f2.toggleLayer('loadMap',1);
		f2.showLayer('loadMap');
		var l = fo.EXL.value;
		var t = fo.EXT.value;
		var r = fo.EXR.value;
		var b = fo.EXB.value;
		
		var wHalf = (r - l) / 2;
		var hHalf = (t - b) / 2;
		l = aktXco - wHalf;
		t = aktYco + hHalf;
		r = aktXco + wHalf;
		b = aktYco - hHalf;

		url = "map.php?EXL=" + l + "&EXT=" + t + "&EXR=" + r + "&EXB=" + b;
		
		
		//setTimeout('gotoUrl(url)' ,500);
		var f2 = window.parent.frames[2];
		var fo = f2.document.forms['mapForm'];
		fo.EXL.value = l;
		fo.EXT.value = t;
		fo.EXR.value = r;
		fo.EXB.value = b;
		//fo.projid.value = "LAM_WGS84";

		fo.searchId.value = "";
		fo.allPoints.value = "";
		fo.allLines.value = "";

		fo.submit();
		
	}

  	function gotoUrl(URL){        
			var f2 = window.parent.frames[2];
			f2.location = URL;
 	}
 	
	//check if mouse is inside the Map
	function checkInMap(){
			mapR = mapWidth; //mapR = mapLeft + mapWidth;
			mapB = mapHeight; //mapB = mapTop + mapHeight;
			if (mouseX >= 0 && mouseX <= mapR && mouseY >= 0 && mouseY <= mapB){ //			if (mouseX >= mapLeft && mouseX <= mapR && mouseY >= mapTop && mouseY <= mapB){
				var f2 = window.parent.frames[2];
				var fo = f2.document.forms['mapForm'];
				if (fo.SKN.value == "2"){
					if (mouseX >= 0 && mouseX <= 44 && mouseY >= 59 && mouseY <= 71){
						return false;
					}
					if (mouseX >= 0 && mouseX <= 56 && mouseY >= 71 && mouseY <= 100){
						return false;
					}
				}
				return true;
			} else {
				return false;
			}
	}
	
	
 
	//convert image coordinates to map coordinates
	function img2Map(imgPnt){
		x = imgPnt[0];
		y = imgPnt[1];
		
		extentW = extentR - extentL;
		extentH = extentT - extentB;
		xco = (extentL + x * (extentW / mapWidth));
		yco = extentT - y * (extentH / mapHeight);
		return new Array(xco,yco);
	}
	
	// get the layer object called "name"
	function getLayer(name) {
		  if (isNav4)
		    return(document.layers[name]);
		  else if (isIE4) {
		    layer = eval('document.all.' + name + '.style');
		    return(layer);
		  } else if (is5up) {
				var theObj = document.getElementById(name);
				return theObj.style
		  }
		  else
		    return(null);
	}
	
	
	// toggle layer to invisible
	function hideLayer(name) {		
	  	var layer = getLayer(name);		
	  	if (isNav4)
	    	layer.visibility = "hide";
	  	//if (document.all)
		else
	   		 layer.visibility = "hidden";
			 //layer.display="none";
	}
	
	// toggle layer to visible
	function showLayer(name) {		
	  	var layer = getLayer(name);		
	  	if (isNav4)
	    	layer.visibility = "show";
	  	//if (document.all)
		else
	   	 layer.visibility = "visible";
		 //layer.display="block";
	}
	
 

