			
		/*
		***************************************************************************************
		
		DHTML layer functions - used to create and manipulate style sheets
			These functions are used by the ArcIMS HTML Viewer - found in aimsDHTML.js
		
		***************************************************************************************
		*/
		
		// 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 {
			    document.writeln('<div id="' + name + '" style="position:absolute; overflow:hidden; left:' + inleft + 'px; top:' + intop + 'px; width:' + width + 'px; height:' + height + 'px;' + '; z-index:1; 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);
				return theObj.style
			  }
			  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);
		  	//if (document.all) {
			 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 if (document.all)
			else
		    	layer.backgroundColor = color;
				//alert(layer.backgroundColor.value);

		}
		
		// 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";
		}
		
		// clip layer display to clipleft, cliptip, clipright, clipbottom
			// Not working with Mozilla Milestone 12 (Nav5)
		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 {
					var newWidth = clipright - clipleft;
					var newHeight = clipbottom - cliptop;
					layer.height = newHeight;
					layer.width	= newWidth;
					layer.top	= cliptop + "px";
					layer.left	= clipleft + "px";
				}
		
		}
		function resizeLayer(w,h){
			var layer = getLayer("theMap");
			
			//layer.width	= w;
			//layer.height = h;
			//layer.top	= 0 + "px";
			//layer.left	= 0 + "px";
		}
		
		
		function boxIt(theLeft,theTop,theRight,theBottom) {
            if (hspc>0) {
                theLeft += hspc;
                theRight += hspc;
            }
            if (vspc>0) {
                theTop += vspc;
                theBottom += vspc;
            }
				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");
				
		}

		function boxOV(theLeft,theTop,theRight,theBottom) {

				clipLayer("zoomBoxTop",theLeft,theTop,theRight,parseFloat(theTop)+parseFloat(ovBoxSize));
				clipLayer("zoomBoxLeft",theLeft,theTop,parseFloat(theLeft)+parseFloat(ovBoxSize),theBottom);
				clipLayer("zoomBoxRight",theRight-ovBoxSize,theTop,theRight,theBottom);
				clipLayer("zoomBoxBottom",theLeft,theBottom-ovBoxSize,theRight,theBottom);	
				showLayer("zoomBoxTop");
				showLayer("zoomBoxLeft");
				showLayer("zoomBoxRight");
				showLayer("zoomBoxBottom");
		}
		
function hasLayer(name) {
	var result = false;
	if (eval('document.all.' + name)!=null) result=true;
	return result;
}
