//<script>

		var theMap = true;
		var ovBoxSize = 2; 	// Zoombox line width;
		var zoomBoxColor = "black";	// color of zoombox
		var zooming = false;
		
		// Global vars to save mouse position
		var mouseX=0;
		var mouseY=0;
		var x1=0;
		var y1=0;
		var x2=0;
		var y2=0;
		var thex1=0;
		var thex2=0;
		var they1=0;
		var they2=0;
		var zleft=0;
		var zright=0;
		var ztop=0;
		var zbottom=0;
		
		// Global vars for browser type and version
		var isNav = (navigator.appName.indexOf("Netscape")>=0);
		var isNav4 = false;
		var isIE4 = false;
		var is5up = false;
		//alert(navigator.appVersion);
		if (isNav) {
			if (parseFloat(navigator.appVersion)<5) {
				isNav4=true;
				//alert("Netscape 4.x or older");
			} else {
				is5up = true;
			}
		} else {
			isIE4=true;
			if (navigator.appVersion.indexOf("MSIE 5")>0) {
				isIE4 = false;
				is5up = true;
				//alert("IE5");
			}
		}
		
		//mapTracking();
		//moved into map.asp
		
		function mapTracking() {
			//alert('mapTracking');
			//alert('theAction:'+theAction);
			if (frm!=null) {
				if (frm['Action']!=null) {
					
					//set the map tool
					theAction = frm['Action'].value;
					theMapTool = frm['MapTool'].value;
					//alert('theAction2:'+theAction);
					//control the map tool
					//sometimes we want to override the setting
					//alert('theAction:' + theAction);
					//alert('theMapTool:' + theMapTool);					
					//if (theMapTool=='') {
						if ((theAction=='') || (theAction=="NoChange")  || (theAction=="Ident_removethistexttohaveidentifychangetozoom") || (theAction=="Pin") || (theAction=="Clear") || (theAction=="Move") || (theAction=="Z99") || (theAction=="Z1") || (theAction=="Z2") || (theAction=="Z3") || (theAction=="Z4") || (theAction=="Z5") || (theAction=="Z6") || (theAction=="Z7") || (theAction=="Z8")) {
							theAction = "Z99";
							theMapTool = "zoomin";
						}
						
						if (theAction=='Identify') {
							//alert('Identify');
							identParID = frm.parSelection.value;
							if (identParID!="") {
								//alert('showParcelInfo');
								showParcelInfo(identParID);
							}
						}
					//}
					//alert('theAction2:' + theAction);
					//alert('theMapTool2:' + theMapTool);
					//set the correct state
					//supports the drop downs first
					//var theMapTool2;
					theMapTool2 = theMapTool+"2";
					//alert('theMapTool2:' + theMapTool2);
					if (!isNav) {
						if (theMapTool2!='2' && frm[theMapTool2]!=null) {
							//alert('click1');
							frm[theMapTool2].click();
						}
						else if (frm[theMapTool]!=null) {
							//alert('click2');
							frm[theMapTool].click();
						}
					}
					//NS
					else {
						//alert(isNav);
						//alert(theMapTool);
						//alert(frm[theMapTool]);
						changeImage(theMapTool,'down');
						//frm[theMapTool].click();//not working?
						if (theMapTool=="zoomin") {
							selMode = -1; 
							changeValue('zoomtoselected','0');
							changeTool('Z99',"zoomin");
						}
						
					}
					box();
				}
			}
		}

		function box() {
			//alert('box');
			if (isNav) {
				document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
			}
			
			document.onmousedown = mapTool;
			document.onmouseup = chkMouseUp;
			document.onmousemove = getMouse;			
		}
		
		/*
		DHTML layer functions - used to create and manipulate style sheets
		*/
		
		// Create a DHTML layer
		function createLayer(name, inleft, intop, width, height, visible, content) {;
			  var layer;
			  if (isNav4) {
			    document.writeln('<layer name="' + name + '" left=' + inleft + ' top=' + intop + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
			    document.writeln(content);
			    document.writeln('</layer>');
			  } else {
				if ((name=="theMapLayer") || (name=="zoomBoxBottom")) {
					document.writeln('<div name="' + name + '" id="' + name + '" onMouseUp="chkSubmitForm();" style="cursor: crosshair; position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:0; visibility:' + (visible ? 'visible;' : 'hidden;') +  '" >');
				}
				else {
					document.writeln('<div name="' + name + '" id="' + name + '" style="position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:0; visibility:' + (visible ? 'visible;' : 'hidden;') +  '" >');				
				}
				document.writeln(content);
			    document.writeln('</div>');
			  }
		}
		
		// 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);
				if (theObj != null) {
					return theObj.style
				}
				else {
					theMap = false;
			  	}
			  }
			  else
			    return(null);
		}
				
		function isVisible(name) {
			  var layer = getLayer(name);
			  if (isNav && layer.visibility == "show")
			    return(true);
			  if (isIE && layer.visibility == "visible")
			    return(true);
			  return(false);
		}
		
		// move layer to x,y
		function moveLayer(name, x, y) {		
		  	var layer = getLayer(name);		
		  	if (isNav4)
		    	layer.moveTo(x, y);
			 else {
		    	layer.left = x + "px";
		   		layer.top  = y + "px";
		  	}
		}
		
		// set layer background color
		function setLayerBackgroundColor(name, color) {		
		  	var layer = getLayer(name);		
		 	 if (isNav4)
		    	layer.bgColor = color;
			else
		    	layer.backgroundColor = color;
		}
		
		// toggle layer to invisible
		function hideLayer(name) {
		  	var layer = getLayer(name);		
		  	if (isNav4)
		    	layer.visibility = "hide";
			else
		   		 if (theMap == true) {
		   			layer.visibility = "hidden";
				 }
		}
		
		//calls the hidelayer function to hide all Widget Layers
		function hideWidgetLayers() {
			hideLayer("mnuMapControlsWidgetLayer");
			hideLayer("mnuMapLayersWidgetLayer");
			changeStyle("mnuMapControls",'MapCustomWidgets');
			changeStyle("mnuMapLayers",'MapCustomWidgets');
			if (frm['layout'].value == 1) {

			}
		}
		
		// toggle layer to visible
		function showLayer(name) {
		  	if (name.indexOf("mnu")>-1) {
				MapFunctionMenu = name;
				//frm.MapFunctionMenu.value = MapFunctionMenu;
				frm['MapFunctionMenu'].value = MapFunctionMenu;
				changeStyle(name,'MapCustomWidgetsSelected');
				name = name + "WidgetLayer";
			}
			var layer = getLayer(name);
			if (isNav4)
		    	layer.visibility = "show";
			else
		   	 layer.visibility = "visible";
		}
		
		// clip layer display to clipleft, cliptip, clipright, clipbottom
		function clipLayer2(name, clipleft, cliptop, clipright, clipbottom) {		
			  var layer = getLayer(name);		
			  if (isNav4) {
				    layer.clip.left   = clipleft;
				    layer.clip.top    = cliptop;
				    layer.clip.right  = clipright;
				    layer.clip.bottom = clipbottom;
			  }
			  //if (document.all)
			  else if (isIE) {
				    layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
			  }
		}
		
		function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {		
			  var layer = getLayer(name);		
			  if (isNav4) {
				    layer.clip.left   = clipleft;
				    layer.clip.top    = cliptop;
				    layer.clip.right  = clipright;
				    layer.clip.bottom = clipbottom;
			  }	  else {
					if (theMap == true) {
						var newWidth = clipright - clipleft;
						var newHeight = clipbottom - cliptop;
						layer.height = newHeight;
						layer.width	= newWidth;
						layer.top	= cliptop + "px";
						layer.left	= clipleft + "px";
					}
				}
		
		}

		function boxIt(theLeft,theTop,theRight,theBottom) {
				clipLayer("zoomBoxTop",theLeft,theTop,theRight,theTop+ovBoxSize);
				clipLayer("zoomBoxLeft",theLeft,theTop,theLeft+ovBoxSize,theBottom);
				clipLayer("zoomBoxRight",theRight-ovBoxSize,theTop,theRight,theBottom);
				clipLayer("zoomBoxBottom",theLeft,theBottom-ovBoxSize,theRight,theBottom);	
				showLayer("zoomBoxTop");
				showLayer("zoomBoxLeft");
				showLayer("zoomBoxRight");
				showLayer("zoomBoxBottom");
		}
		
		/*
		Navigation functions - used to resize zoom box
		*/
		
		// 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;		
		}	

		// start zoom in.... box displayed
		function startZoomBox(e) {
			if ((frm['layout'].value!="0") || (frm['Action'].value=="99")) {
				getImageXY(e);	
				// keep it within the MapImage
				if ((mouseX-hspc<iWidth) && (mouseX>hspc) && (mouseY-vspc<iHeight) && (mouseY>vspc)) {
					if (zooming) {
						stopZoomBox(e);
					} else {
						x1=mouseX;
						y1=mouseY
						x2=x1+0;
						y2=y1+0;
						zleft=x1;
						ztop=y1;
						zbottom=y1;
						zright=x1
					
						boxIt(x1,y1,x2,y2);
						zooming=true;
					}
				}
				return false;
			
			}
		}
		
		// stop zoom box display... 
		function stopZoomBox(e) {
			zooming=false;
			hideLayer("zoomBoxTop");
			hideLayer("zoomBoxLeft");
			hideLayer("zoomBoxRight");
			hideLayer("zoomBoxBottom");
			//window.scrollTo(0,0);
			return true;
		
		}

//
//		// get the coords at mouse position
//		function getMouse(e) {
//			if (theMap == true) {
//				window.status="";
//				getImageXY(e);
//				if ((mouseX-hspc>iWidth) || (mouseY-vspc>iHeight) || (mouseX<=hspc) ||(mouseY<=vspc)) {
//					stopZoomBox(e);
//					
//					//for testing
//					//x2=mouseX;
//					//y2=mouseY;
//					//setClip();
//					//thex1=x1-hspc
//					//thex2=x2-hspc
//					//they1=y1-vspc
//					//they2=y2-vspc
//				
//					//var mouseString = "";
//					//if (zooming) mouseString += "Box: [" + thex1 + "," + they1 + " x " + thex2 + "," + they2 + "]    ";
//					//mouseString += "Coords: " + (mouseX-hspc) + " , " + (mouseY-vspc);	
//					//window.status = mouseString;
//					
//				} else {
//			
//					if (zooming) {
//						x2=mouseX;
//						y2=mouseY;
//						setClip();
//					}
//					thex1=x1-hspc
//					thex2=x2-hspc
//					they1=y1-vspc
//					they2=y2-vspc
//				
//					var mouseString = "";
//					if (zooming) mouseString += "Box: [" + thex1 + "," + they1 + " x " + thex2 + "," + they2 + "]    ";
//					mouseString += "Coords: " + (mouseX-hspc) + " , " + (mouseY-vspc);	
//					if (!nocoords) {
//						window.status = mouseString;
//						//document.getElementById('coords').innerHTML = mouseString;
//					}
//				}
//				// next line needed for Mac
//				return false;
//			}
//		}

//new getMouse function with support for distance tools

		function getMouse(e) {
			if (theMap == true) {
				window.status="";
				getImageXY(e);
				if ((mouseX-hspc>iWidth) || (mouseY-vspc>iHeight) || (mouseX<=hspc) ||(mouseY<=vspc)) {
					stopZoomBox(e);
				} else {
			
					if (zooming) {
						x2=mouseX;
						y2=mouseY;
						setClip();
					}
					thex1=x1-hspc
					thex2=x2-hspc
					they1=y1-vspc
					they2=y2-vspc
				
					var mouseString = "";
					if (zooming) mouseString += "Box Coords: [" + thex1 + "," + they1 + " x " + thex2 + "," + they2 + "]";
					else mouseString += "Coords: [" + (mouseX-hspc) + "," + (mouseY-vspc) + "]";	
					
					if (isMap) {
						//for measure
						if ((theAction=='Measure') || (theAction=='Area')) {
							mouseString += "  Distance: [";
							if (bDraw) {
								CalcLineDist2(mouseX-hspc,mouseY-vspc);
								mouseString += "Current:" + curDist.toFixed(2);
								mouseString += " Logged:" + realDist.toFixed(2) + " ";
								totDist = realDist + curDist;
							}
							mouseString += "Total Distance:" + totDist.toFixed(2) + " " + distUnits + "]";
							if (theAction=='Area') {
								mouseString += "  Area: [Total Area:" + totArea.toFixed(2) + " " + distUnits + "2]";					
							}
						}
					}
					
					window.status = mouseString;
				}
				// next line needed for Mac
				return false;
			}
		}
		
		
		// clip zoom box layer to mouse coords
		function setClip() {	
			var tempX=x1;
			var tempY=y1;
			if (x1>x2) {
				zright=x1;
				zleft=x2;
			} else {
				zleft=x1;
				zright=x2;
			}
			if (y1>y2) {
				zbottom=y1;
				ztop=y2;
			} else {
				ztop=y1;
				zbottom=y2;
			}
			
			if ((x1 != x2) && (y1 != y2)) {
				boxIt(zleft,ztop,zright,zbottom);
			}
		}

		/*		
		Click/Mouse functions - used to catch mouse button events	
		*/

		// check for mouseup
		function chkMouseUp(e) { 
			//alert('chkMouseUp');
			stopZoomBox(e);
			// next line needed for Mac	
			//alert('chkMouseUp2');
			return false;
		}
		
		// perform appropriate action with mapTool
		function mapTool (e) {
			//alert('mapTool');
			theAction = frm['Action'].value;
			//alert(theAction);
			if ((theAction=="Add" || (theAction=="Remove")) && (frm['layout'].value==1)) {
				startZoomBox(e);
			}
			else if (theAction=="Z99") {
				startZoomBox(e);	
			}
			//alert('mapTool2');	
			return false;
			
		}

		function changeTool(inAction,theid,forceSubmit) {
			//alert('changeTool');
			//alert('theAction:'+theAction);
			//alert('theAction:'+inAction);
			if (isNav) {
				//nothing
			}
			else {
				if (event!=null) {
					if (event.button == 2) return false;		
				}
			}
			//set the action
			
			//added to make sure the thgeAction gets set
			theAction = inAction;
			
			frm['Action'].value = theAction;
			if (theAction=='PanMove') document.getElementById('theMapLayer').style.cursor="move";
			else document.getElementById('theMapLayer').style.cursor="crosshair";
			//alert(document.getElementById('theMapLayer'));
			//alert(frm.Action.value);
			//set the tool state if necessary
			if (theid!=null) {
				frm['MapTool'].value = theid;
			}
			//alert('MapTool:'+frm['MapTool'].value)
			//alert('Action:'+frm['Action'].value)
			//submit the form if necessary
			if (forceSubmit) {
				frm['clickx'].value=iWidth/2;
				frm['clicky'].value=iHeight/2;
				mapformsubmit();
			}
		}	
	    
		var bSubmitted = false;
		function mapformsubmit() {
			//alert('mapformsubmit');
			if (frm['clickx'].value<0 || frm['clicky'].value <0) return false;
			if (bSubmitted) return;
			//var waitDiv = document.all.item('getMap');
			//waitDiv.style.display='block';
			//alert(frm.Action.value);
			bSubmitted = true;
			//alert('test');
			updateform();
			//alert(frm.MLayers.value);
			//frm.MLayers.value = "";
			//alert(frm.MLayers.value);
			//alert('MapTool:'+frm['MapTool'].value)
			//alert('Action:'+frm['Action'].value)
			//alert('test');
			frm.submit();
			//alert(frm.Action.value);
			//waitDiv.innerHTML = "<img name='getmapimg' border=0 src='images/common/map/getmap.gif'>";
		}

		function updateform() {
			var expB = frm['expandrecorddataB'];
			if (frm['listrecs']!=null) {
				if (frm['listrecs'].style.display=="") {
					frm['expandrecordsB'].value="true";
				} else {
					frm['expandrecordsB'].value="false";
				}
			}
			if (frm['recdatamaxContainer']!=null) {
				//alert(document.all.item("recdatamaxContainer").style.display);
				if (frm['recdatamaxContainer'].style.display!="none") {
					var thepos = frm['recdatamaxContainer'];
					frm['expandrecorddataB'].value="true";
					frm['thetoppos'].value=thepos.style.pixelTop;
					frm['theleftpos'].value=thepos.style.pixelLeft;
				} else {
					if (expB) expB.value="false";
				}
			} else {
				if (expB) expB.value="false";
			}
			
		}

		function chkSubmitForm() {
			
			if (isNav) {
				//nothing
			}
			else {
				if (event.button == 2) return false;		
			}
			
			if (theAction=='PolyAdd') return false;
			if (theAction=='LineAdd') return false;
			if (theAction=='PolyRemove') return false;
			if (theAction=='LineRemove') return false;
			if (theAction=='Ident') return false;
			if (theAction=='MeasureParcel') return false;
			if (theAction=='Measure') return false;
			if (theAction=='Area') return false;
			
			//alert('chkSubmitForm');
			
			//alert('Action:'+frm.Action.value);
			//alert('MapTool:'+frm.MapTool.value);
			
			//alert('theAction:'+theAction);
			//alert('theMapTool:'+theMapTool);
			
			if (frm['Action'].value=="ID") {
				frm['cp'].value = "1";
				frm['tp'].value = "1";
			}
			if ((theAction!='PanMove') && (mouseX-hspc!='') && (mouseY-vspc!='') && (thex1>0) && (they1>0) && (thex1!=mouseX-hspc) && (they1!=mouseY-vspc)) {
				var theclickx = mouseX-hspc + "," + thex1;
				var theclicky = mouseY-vspc + "," + they1;
				frm.clickx.value = theclickx;
				frm.clicky.value = theclicky;
			}
			else {
				frm.clickx.value = mouseX-hspc;
				frm.clicky.value = mouseY-vspc;
			}
			
			if (theAction=='Pan') {
				frm.clickx.value = mouseX-hspc;
				frm.clicky.value = mouseY-vspc;
			}
			
			if (theAction=='PanMove') {

				//alert(dragapproved);
				//if (dragapproved==false) {
					//alert('dragapproved:'+dragapproved);
					//alert('You cannot drag outside the map bounds');
				//	return false;
				//}
				//changeTool('Pan','pan',false);
				
				frm['Action'].value = "Pan";

				getImageXY(event);
				myx=mouseX-hspc;
				myy=mouseY-vspc;
				if (myx<=0) myx = 1;
				if (myy<=0) myy = 1;
				//alert('x:'+frm.clickx.value + " , " + 'y:'+frm.clicky.value);
				//alert('myx:'+myx + " , " + 'myy:'+myy);
				myx = frm.clickx.value + "," + myx;
				myy = frm.clicky.value + "," + myy;
				//alert('myx:'+myx + " , " + 'myy:'+myy);
				frm.clickx.value = myx;
				frm.clicky.value = myy;
				//alert('mouseX-hspc:'+mouseX-hspc + " , " + 'mouseY-vspc:'+mouseY-vspc);
				//frm.clickx.value = frm.clickx.value + "," + mouseX-hspc;
				//frm.clicky.value = frm.clicky.value + "," + mouseY-vspc;
				//alert('x:'+frm.clickx.value + " , " + 'y:'+frm.clicky.value);
				
			}
			
			//alert('x:'+frm.clickx.value + " , " + 'y:'+frm.clicky.value);
			//alert('Action'+frm.Action.value);
			//alert('MapTool'+frm.MapTool.value);
			
			mapformsubmit();
		}

		function DoPan(direction) {
			frm.Dir.value = direction;
			//alert(frm.Dir.value);
			changeTool('Move',null,true);
			//frm.Action.value = "Move";
			//mapformsubmit();
		}

//geneeric function for controlling form controls

//changes any value on the form, optional reload
function changeValue(theItem, theValue, forceSubmit) {
	frm[theItem].value = theValue;
	if (forceSubmit) {
		mapformsubmit();
	}
}
		
//changes the check box setting
function changeCheckBoxSetting(theid) {
	if (frm['theid'].value=="notchecked") {
		frm['theid'].value = "checked";
	}
	else {
		frm['theid'].value = "notchecked";
	}
}

//changes the radio button setting
function changeRadioSetting(theid, theval, checkstate) {
	document.all.item(theid)[theval].checked = checkstate;
}

function disableItem(theid, bool) {
	document.all.item(theid).disabled = bool;
}

function setLayers(theChkBox) {
var lyrs = ""
var lyr = ""
var anyChecked = false;
	for( i=0; i < 20; i++ ) {
		lyr = "c" + i
		//alert(lyr);
		if (frm[lyr]!=null) {
			//alert(document.all.item(lyr).checked);
			if (frm[lyr].checked) {
				anyChecked = true;
				lyrs = lyrs + + i + ",";
				//alert(lyrs);
			}
		}
	}
	
	
	if (!anyChecked) {
		alert('At least one layer must be checked and visible');
		theChkBox.checked = true;
		return false;
	}
	
	frm['MLayers'].value = lyrs;
	
	//alert('MLayers' + frm.MLayers.value);
}

//Image Stuff

//changes images
function changeImage(theid, state) {
	//alert('changeImage');
	//alert(theid);
	//alert(state);
	
	//added for menu select layer
	if (frm.maptoolmenu!=null) {
		alert('no');
		for( i=0; i < document.all.item("maptoolmenu").length; i++ ) {
			if (document.all.item("maptoolmenu").options[i].value==theid) {
				document.all.item("maptoolmenu").selectedIndex = i;
			}
		}
	}

	if (frm[theid] != null)
	{
		if (frm[theid].className=="mapTools") {
			for( i=0; i < document.images.length; i++ ) {
				if (document.images[i].className=="mapTools") {
					theImageSource = document.images[i].src;
					theImageSource2 = theImageSource.replace(/_down/i,"_up");
					document.images[i].src = theImageSource2;
				}
			}
		}
		
		if (theid!=null) {
			theImageSource=frm[theid].src;
			if (state!=null) {
				if (state=="down") {
					theImageSource=theImageSource.replace(/_up/i,"_down");
				}
				else {
					theImageSource=theImageSource.replace(/_down/i,"_up");
				}
			}
			else {
				theImageSource=theImageSource.replace(/_up/i,"_down");
			}	
			frm[theid].src=theImageSource;
		}
	}
	//alert('done changeImage');
}

//loads a new image
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

//swaps images
function genericImageSwap(theid, theSrc) {
	document.all.item(theid).src = theSrc;
}

//changes style classes
function changeStyle(theid, newstyle) {
	//alert('changeStyle');
	//alert(theid);
	if (theid!=null) {
		//alert(document.all.item(theid));
		//alert(frm[theid]);
		if (!isNav) {
			if (document.all.item(theid)!=null) {
				document.all.item(theid).className = newstyle;
			}
			else if (frm[String(theid)]!=null) {
				frm[String(theid)].className = newstyle;
			}
		}
		else if (frm[String(theid)]!=null) {
			frm[String(theid)].className = newstyle;
		}
		

	}
}

	
	function setAttributes(theObj) {
		theatts = '';
		for( i=0; i < theObj.options.length; i++ ) {
			//alert(theObj.options[i].value);
			if (theObj.options[i].selected==true) {
				theatts = theatts + theObj.options[i].value  +  ','
			}
		}
		frm.theattributes.value = theatts;
	}
	
	function attributeinfoState(iState) {
		//alert(iState);
		if (iState == '') {
			iState = frm.attributeinfo.value;
			if (iState == 0) iState = 1;
			else if (iState == 1) iState = 0;
		}
		//alert(iState);
		if (iState == 1) {
			frm.attributeinfo.value = "1";
			frm.AttributeInfoBox.checked=true;
			frm.MouseoverAttributes.disabled=false;
		} else {
			frm.attributeinfo.value = "0";
			frm.AttributeInfoBox.checked=false;
			frm.MouseoverAttributes.disabled=true;
		}
		//alert(frm.attributeinfo.value);
	}
	
	
	function keyMapState(iState) {
		hideLayer("KeyMap"); 
		hideLayer("KeyMapFull");
		//if no state sent in than we are toggling
		//so switch it
		if (iState == '') {
			iState = frm.keymapstate.value;
			if (iState == 0) iState = 1;
			else if (iState == 1) iState = 0;
		}
		
		//setup the correct state, value, button
		//alert(iState);
		if (iState == 2) {
			showLayer("KeyMapFull");
			changeImage('key','');
			frm.keymapstate.value = "2";
			isFullMapReloaded = true;
			//frm.keymapstate[2].checked = true; //old
		} else if (iState == 1) {
			showLayer("KeyMap");
			changeImage('key','down');
			frm.keymapstate.value = "1";
			//frm.keymapstate[iState].click(); //old
		} else {
			changeImage('key','up');
			frm.keymapstate.value = "0";
		}
		
	}

	function mapsizeState(iState,img) {
		//if no state sent in than we are toggling
		//so switch it
		if (iState == '') {
			iState = frm.mapsizestate.value;
			if (iState == 0) iState = 1;
			else if (iState == 1) iState = 0;
		}
		
		//setup the correct state, value, button
		//alert(iState);
		if (iState == 2) {
			//changeImage('mapsize','');
			frm.mapsizestate.value = "2";
		} else if (iState == 1) {
			if (img) changeImage('mapsize','down');
			frm.mapsizestate.value = "1";
		} else {
			if (img) changeImage('mapsize','up');
			frm.mapsizestate.value = "0";
		}
		
	}
	
	function zLevelChange(intChange) {
		zVal = frm.zLevel.value;
		zVal = zVal.replace(/Z/i,"");
		//alert('Z'+String(parseInt(zVal)+parseInt(intChange)));
		var zLevelObj = document.all.item(String(parseInt(zVal)+parseInt(intChange)));
		//alert(zLevelObj);
		if (zLevelObj!=null) {
			//alert('2:'+zLevelObj.name);
			zLevelObj.click();
		}
	}
	
	function changeDropDown(theid) {
		//alert('changeDropDown');
		//alert(theid);
		//alert(document.all.item(theid));
		
		theParent = document.all.item(theid).parentElement
		//alert(theParent.children.length);
		for( i=0; i < theParent.children.length; i++ ) {
			otherids = theParent.children[i].name;
			//alert(otherids);
			otherids = otherids.replace(/2/i,"");
			//alert(otherids);
			document.all.item(otherids).style.display='none';
		}
		
		theid = theid.replace(/2/i,"");
		//alert('click5');
		document.all.item(theid).click();
		document.all.item(theid).style.display='';
	}
	
function setSelection() {
	if (frm['hdSelected'].value=="") return 0;
	else return 1;
}
	
	
//</script>