var newMinx = 0;
var newMiny = 0;
var newMaxx = 0;
var newMaxy = 0;
var boxMinx = 0;
var boxMiny = 0;
var boxMaxx = 0;
var boxMaxy = 0;

// 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 zminx=0;
var zmaxx=0;
var zmaxy=0;
var zminy=0;

var mapX = 0; 
var mapY = 0; 
var zoomBoxWidth = 1;

var zooming=false;
var panning=false;
var bottomBorderHeight = 13;

// setup test for Nav 4.0
var isIE = false;
var isNav = (navigator.appName.indexOf("Netscape")>=0);
var isNav4 = false;
var isIE4 = false;
var is5up = false;
var isMac = false;
var isWin = false;


if (isNav) {
	
	if (parseFloat(navigator.appVersion)<5) {
		isNav4=true;
		//alert("Netscape 4.x or older");
	} else {
		is5up = true;
	}
} else {
	isIE4=true;
	isIE=true;
	if (navigator.appVersion.indexOf("MSIE 5")>0) {
		isIE4 = false;
		is5up = true;
		//alert("IE5");
	}
}	

if (navigator.userAgent.indexOf("Win") >= 0) 
	isWin = true;
else
	isMac = true;

//***********************************************	
//***************** FUNCTIONS *******************
//***********************************************

// check for mouseup
function chkMouseUp(e) { 
	if (zooming || panning) {
		if (mouseX<0)
		 	mouseX = 0;
		if (mouseX>iWidth)
			mouseX = iWidth;
		if (mouseY<0)
			mouseY = 0;
		if (mouseY>iHeight)
			mouseY = iHeight;
		mapTool(e);
	}
}


// check scrollbar click
function checkScrollbarClick(e){
	if (isNav) {
		cX=e.pageX;
		cY=e.pageY;
	} else {
		cX=event.clientX;
		cY=event.clientY;
	}
	if (isNav) {
		pW=window.innerWidth-16;
		pH=window.innerHeight-16;
	} else {
		pW=document.body.offsetWidth-20;
		pH=document.body.offsetHeight-20;
	}
	if((cX > pW)||(cY > pH)){
		return false;
	} else{
		return true;
	}
}


// get Image X Y
function getImageXY(e) {
	//if (document.layers) {
	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 right
	mouseX = mouseX-hspc;
	mouseY = mouseY-vspc;
}	


// convert mouse click xy's into map coordinates
function getMapXY(xIn,yIn) {

	mouseX = xIn;
	var pixelX = (maxx-minx) / iWidth;
	mapX = pixelX * mouseX + minx;
	mouseY = iHeight - yIn;
	var pixelY = (maxy-miny) / iHeight;
	mapY = pixelY * mouseY + miny;
}


// get the coords at mouse position
function getMouse(e) {
 
	window.status="";
	getImageXY(e);
	if (zooming) {
		if (mouseX<0)
		 	mouseX = 0;
		if (mouseX>iWidth)
			mouseX = iWidth;
		if (mouseY<0)
			mouseY = 0;
		if (mouseY>iHeight-bottomBorderHeight)
			mouseY = iHeight-bottomBorderHeight;
		x2=mouseX;
		y2=mouseY;
		setClip();
		return false;
	} else if (panning) {
		x2=mouseX;
		y2=mouseY;
		panMouse();	
		return false;
	} else 
    	return true;
	return true;
}


// perform appropriate action with mapTool
function mapTool (e) {

	if(checkScrollbarClick(e)){

		getImageXY(e);
		
		  // Deal with the possibility of an
		  // select, identify or area tool first, since it is a
		  // little different than the other
		  // states (doesn't require a mouse
		  // up event).  
		curTool = document.frmMain.tool.value;  
		
		//MEASURE ***  New to Prop Info 
		if ((curTool == "MEASURE") && 
			(mouseX >= 0) && (mouseX <= iWidth) &&  //determines if the click is within the map view window
			(mouseY >= 0) && (mouseY <= iHeight)){
					getMapXY(mouseX,mouseY); //converts the x,y position into map coordinates
					addMeasurePixel(mouseX,iHeight - mouseY);
					addMeasurePoint(mapX,mapY,0);
				//    sendMeasure(mapX,mapY)    
					return false;	
		}
			
		if ((curTool == "SELECT") && 
			(mouseX >= 0) && (mouseX <= iWidth) && 
			(mouseY >= 0) && (mouseY <= iHeight)){
				getMapXY(mouseX,mouseY);
				sendSelect(mapX,mapY);
				return false; // <-- false assures that the popup
							  //     box stays in front.
		}
		
		if ((curTool == "IDENTIFY") && 
			(mouseX >= 0) && (mouseX <= iWidth) && 
			(mouseY >= 0) && (mouseY <= iHeight)){
				getMapXY(mouseX,mouseY);
				sendIdentify(mapX,mapY);
				return false; // <-- false assures that the popup
							  //     box stays in front.
		}
		
		
		  // If we made it to here, it's a 
		  // navigational click and not an
		  // identify.
		
		if ((!zooming) && (!panning) && 
			(mouseX >= 0) && (mouseX <= iWidth) && 
			(mouseY >= 0) && (mouseY <= iHeight)) {
			if (curTool == "PAN")
				startPan(e);
			else 
				startZoomBox(e);
				
			return false;
		} else if (zooming) {
			getMouse(e);
			stopZoomBox(e);
		} else if (panning) {
			getMouse(e);
			stopPan(e);
		}
		return true;
		
	}
}


// refresh map
function refreshMap() {
  hideZoomBox();
  document.frmMain.cmd.value = "REFRESH";
  document.frmMain.minX.value = newMinx.toString();
  document.frmMain.minY.value = newMiny.toString();
  document.frmMain.maxX.value = newMaxx.toString();
  document.frmMain.maxY.value = newMaxy.toString();
  document.frmMain.submit();
  showLayer("loadLayer");
  	
}

// refresh map
function sendMap() {
  hideZoomBox();
  document.frmMain.submit(); 	
  showLayer("loadLayer");
}


// send select
function sendSelect(numMapX,numMapY) {
	document.frmMain.cmd.value = "SELECT";
    document.frmMain.selX.value = numMapX.toString();
    document.frmMain.selY.value = numMapY.toString();
    document.frmMain.submit();
	showLayer("loadLayer");	
}

// send measure - New to Prop Info
//***This function sends the map coordinates to the map.aspx.vb form
function sendMeasure(ptX1,PtY1,ptX2,ptY2) {
  document.frmMain.cmd.value = "MEASURE";  //change the command to measure so the measure function fires within map.aspx.vb
  getMapXY(ptX1,ptY1)//fire the function to convert screen pixels into real world coordinates
  ptX1 = mapX  //assign a new value to ptX1; this value is the mapX value returned from the getMapXY function
  ptY1 = mapY
  document.frmMain.ptX1.value = ptX1.toString();
  document.frmMain.ptY1.value = ptY1.toString();
  getMapXY(ptX2,ptY2)
  ptX2 = mapX
  ptY2 = mapY
  document.frmMain.ptX2.value = ptX2.toString();
  document.frmMain.ptY2.value = ptY2.toString();
  document.frmMain.submit();
  showLayer("Splash");
}

// send identify
function sendIdentify(numMapX,numMapY) {
	showIdentifyWin(numMapX, numMapY);
	showLayer("loadLayer");	
}


// set extent
function setExtent(_minx,_miny,_maxx,_maxy) {
	minx = _minx;
	miny = _miny;
	maxx = _maxx;
	maxy = _maxy;
}


// set tool
function setTool(newTool) {	
	if (newTool == "ZOOMIN") {
		setZoomBoxColor("#ff0000");
		setZoomBoxWidth(1);
	} else if (newTool == "ZOOMOUT") {
		setZoomBoxColor("#ff0000");
		setZoomBoxWidth(1);
	} else if (newTool == "PAN") {
	} else if (newTool == "SELECT") {
	} else if (newTool == "MEASURE") { //New To Prop Info
	} 
	setToolImage(newTool);
	document.frmMain.tool.value = newTool;
	document.frmMain.cmd.value = "REFRESH";
}


// set Tool Image
function setToolImage(tool) {
	if(isNav4){
		// Dull all images first.
		document.Toolbar.document.B_ZOOMIN.src = 'images/'+ 'b_zoomin_off.gif';
		document.Toolbar.document.B_ZOOMOUT.src = 'images/'+ 'b_zoomout_off.gif';
		document.Toolbar.document.B_PAN.src = 'images/'+ 'b_pan_off.gif';
		document.Toolbar.document.B_SELECT.src = 'images/'+ 'b_select_off.gif';
		document.Toolbar.document.B_MEASURE.src = 'image/'+ 'b_measure_off.gif';
		
		//Then brighten the passed tool.
		if (tool == "ZOOMIN") {
			document.Toolbar.document.B_ZOOMIN.src = 'images/'+ 'b_zoomin_on.gif';
		}
		if (tool == "ZOOMOUT") {
			document.Toolbar.document.B_ZOOMOUT.src = 'images/'+ 'b_zoomout_on.gif';
		}
		if (tool == "PAN") {
			document.Toolbar.document.B_PAN.src = 'images/'+ 'b_pan_on.gif';
		}
		if (tool == "SELECT") {
			document.Toolbar.document.B_SELECT.src = 'images/'+ 'b_select_on.gif';
		}
		//New To Prop Info
		if (tool == "MEASURE") { 
			document.Toolbar.document.B_MEASURE.src = 'images/'+ 'b_measure_on.gif';
		}	
	}else{
		// Dull all images first.
		document.B_ZOOMIN.src = 'images/'+ 'b_zoomin_off.gif';
		document.B_ZOOMOUT.src = 'images/'+ 'b_zoomout_off.gif';
		document.B_PAN.src = 'images/'+ 'b_pan_off.gif';
		document.B_SELECT.src = 'images/'+ 'b_select_off.gif';
		document.B_MEASURE.src = 'images/'+ 'b_measure_off.gif';
		
		//Then brighten the passed tool.
		if (tool == "ZOOMIN") {
			document.B_ZOOMIN.src = 'images/'+ 'b_zoomin_on.gif';
		}
		if (tool == "ZOOMOUT") {
			document.B_ZOOMOUT.src = 'images/'+ 'b_zoomout_on.gif';
		}
		if (tool == "PAN") {
			document.B_PAN.src = 'images/'+ 'b_pan_on.gif';
		}
		if (tool == "SELECT") {
			document.B_SELECT.src = 'images/'+ 'b_select_on.gif';
		}
		if (tool == "MEASURE") {
			document.B_MEASURE.src = 'images/'+ 'b_measure_on.gif';
		}
	}
}


// set Map Size Image
function setMapSizeImage() {
	s = document.frmMain.msize.value;
	if(s == ""){
		s = "M";
	}
	if(isNav4){
		if (s == "S") {
			document.Sizebar.document.MS_S.src = 'images/ms_s_on.gif';
		}
		if (s == "M") {
			document.Sizebar.document.MS_M.src = 'images/ms_m_on.gif';
		}
		if (s == "L") {
			document.Sizebar.document.MS_L.src = 'images/ms_l_on.gif';
		}	
	}else{
		if (s == "S") {
			document.MS_S.src = 'images/ms_s_on.gif';
		}
		if (s == "M") {
			document.MS_M.src = 'images/ms_m_on.gif';
		}
		if (s == "L") {
			document.MS_L.src = 'images/ms_l_on.gif';
		}
	}
}


// set cmd
function setCmd(newCmd) {
    document.frmMain.cmd.value = newCmd;
	sendMap();
}


//***********************************************	
//***************** ZOOM BOX ********************
//***********************************************

// set zoom box color
function setZoomBoxColor(color) {
	setLayerBackgroundColor("zoomBoxTop", color);
	setLayerBackgroundColor("zoomBoxLeft", color);
	setLayerBackgroundColor("zoomBoxRight", color);
	setLayerBackgroundColor("zoomBoxBottom", color);
}

// set zoom box width	
function setZoomBoxWidth(size) {
	zoomBoxWidth = size;
}

// set zoom box settings
function setZoomBoxSettings() {
	// Set up event capture for mouse movement
	if (isNav && is5up) {
		document.captureEvents(Event.MOUSEMOVE);
		document.captureEvents(Event.MOUSEDOWN);
		document.captureEvents(Event.MOUSEUP);
		document.onmousemove = getMouse;
		document.onmousedown = mapTool;
		document.onmouseup = chkMouseUp;
	} else if (isNav4) {
		// otherwise the buttons don't work
		getLayer("theTop").captureEvents(Event.MOUSEMOVE);
		getLayer("theTop").captureEvents(Event.MOUSEDOWN);
		getLayer("theTop").captureEvents(Event.MOUSEUP);
		getLayer("theTop").onmousemove = getMouse;
		getLayer("theTop").onmousedown = mapTool;
		getLayer("theTop").onmouseup = chkMouseUp;
	} else {
		document.onmousemove = getMouse;
		document.onmousedown = mapTool;
		document.onmouseup = chkMouseUp;
	}
	setMapSizeImage();
}

// show zoom box
function showZoomBox() {
	showLayer("zoomBoxTop");
	showLayer("zoomBoxLeft");
	showLayer("zoomBoxRight");
	showLayer("zoomBoxBottom");
}

// hide zoom box
function hideZoomBox() {
	hideLayer("zoomBoxTop");
	hideLayer("zoomBoxLeft");
	hideLayer("zoomBoxRight");
	hideLayer("zoomBoxBottom");
}

// start zoom in.... box displayed
function startZoomBox(e) {

	getImageXY(e);	

	// keep it within the MapImage
	if ((mouseX<iWidth) && (mouseY<iHeight-bottomBorderHeight)) {
		if (!zooming) {
			x1=mouseX;
			y1=mouseY;
			x2=x1+1;
			y2=y1+1;
			zooming=true;
			clipLayer("zoomBoxTop",x1,y1,x2,y2);
			clipLayer("zoomBoxLeft",x1,y1,x2,y2);
			clipLayer("zoomBoxRight",x1,y1,x2,y2);
			clipLayer("zoomBoxBottom",x1,y1,x2,y2);
			showZoomBox();
		}
	} else {
		if (zooming) {
			stopZoomBox(e);
		}
	}
	return false;	
}

// stop zoom box display... zoom in
function stopZoomBox(e) {
	zooming=false;
	var width = Math.abs(maxx - minx);
	var height = Math.abs(maxy - miny);
	var pixelX = width / iWidth;
	var theY = iHeight - zmaxy;
	var pixelY = height / iHeight;
	newMaxy = pixelY * theY + miny;
	newMaxx = pixelX * zmaxx + minx;
	newMinx = pixelX * zminx + minx;
	theY = iHeight - zminy;
	pixelY = height / iHeight;
	newMiny = pixelY * theY + miny;
	curTool = document.frmMain.tool.value;
	if ((zmaxx <zminx+2) && (zmaxy < zminy+2)) {
		// if the zoom box is too small
		// recenter(e);
		if (curTool == "ZOOMOUT") {
			newMinx = newMinx - width;
			newMiny = newMiny - height;
			newMaxx = newMaxx + width;
			newMaxy = newMaxy + height;
		} else {
			newMinx = newMinx - width / 4;
			newMiny = newMiny - height / 4;
			newMaxx = newMaxx + width / 4;
			newMaxy = newMaxy + height / 4;
		}
		refreshMap();

	} else {
		
		if (curTool == "ZOOMOUT") {
			percentX = (maxx-minx)/(newMaxx-newMinx);
			percentY = (maxy-miny)/(newMaxy-newMiny);
			percent = (percentX+percentY)/2;
			
			widthH = (maxx-minx)/2;
			heightH = (maxy-miny)/2;
			cx = newMinx + widthH;
			cy = newMiny + heightH;
			
			newMinx = cx - percent * widthH;
			newMiny = cy - percent * heightH;
			newMaxx = cx + percent * widthH;
			newMaxy = cy + percent * heightH;
		}
		refreshMap();
					
	}
	return true;
}

// clip zoom box layer to mouse coords
function setClip() {	

	if (x1>x2) {
		zmaxx=x1;
		zminx=x2;
	} else {
		zminx=x1;
		zmaxx=x2;
	}
	if (y1>y2) {
		zminy=y1;
		zmaxy=y2;
	} else {
		zmaxy=y1;
		zminy=y2;
	}
	
	if ((x1 != x2) && (y1 != y2)) {
		clipLayer("zoomBoxTop",zminx,zmaxy,zmaxx,zmaxy+zoomBoxWidth);
		clipLayer("zoomBoxLeft",zminx,zmaxy,zminx+zoomBoxWidth,zminy);
		clipLayer("zoomBoxRight",zmaxx-zoomBoxWidth,zmaxy,zmaxx,zminy);
		clipLayer("zoomBoxBottom",zminx,zminy-zoomBoxWidth,zmaxx,zminy);
	}
}


//***********************************************	
//***************** PAN *************************
//***********************************************

// start pan.... image will move
function startPan(e) {

	moveLayer("theMap",hspc,vspc);

	getImageXY(e);
	// keep it within the MapImage
	if ((mouseX<iWidth) && (mouseY<iHeight)) {
		if (panning) {
			stopPan(e);
		} else {
			x1=mouseX;
			y1=mouseY
			x2=x1+1;
			y2=y1+1;
			panning=true;
		}
	}
	return false;

}

// stop moving image.... pan 
function stopPan(e) {

	if ((Math.abs(x2-x1) < 2) && (Math.abs(y2-y1) < 2)) {
		// the move is too small
		recenter(e);
	} else  {
		window.scrollTo(0,0);
		panning=false;
		var width = Math.abs(maxx - minx);
		var height = Math.abs(maxy - miny);
		var tempLeft=minx;
		var tempRight=maxx;
		var tempTop=maxy;
		var tempBottom=miny;
		var ixOffset = x2-x1;
		var iyOffset = y1-y2;
		pixelX = width / iWidth;
		var theY = iHeight - zmaxy;
		pixelY = height / iHeight;
		var xOffset = pixelX * ixOffset;
		var yOffset = pixelY * iyOffset;
		newMaxy = maxy - yOffset;
		newMaxx = maxx - xOffset;
		newMinx = minx - xOffset;
		newMiny = miny - yOffset;		
		refreshMap();
	}
		
	return true;
	
}


// move map image with mouse
function panMouse() {
	var xMove = x2-x1;
	var yMove = y2-y1;
	var cLeft = -xMove;
	var cTop = -yMove;
	var cRight = iWidth;
	var cBottom = iHeight;
	if (xMove>0) {
		cLeft = 0;
		cRight = iWidth - xMove;
	}
	if (yMove>0) {
		cTop = 0;
		cBottom = iHeight - yMove;
	}
	clipLayer("theMap",cLeft,cTop,cRight,cBottom);
	moveLayer("theMap",xMove+hspc,yMove+vspc);
	return false;
}

// recenter map is the default option
function recenter(e) {
	hideZoomBox();
	getMapXY(mouseX,mouseY);
	var widthHalf = Math.abs(maxx - minx) / 2;
	var heightHalf = Math.abs(maxy - miny) / 2;
	newMinx = mapX - widthHalf;
	newMaxx = mapX + widthHalf;
	newMaxy = mapY + heightHalf;
	newMiny = mapY - heightHalf;
	refreshMap(); 
}


//***********************************************	
//************* LAYER SUPPORT *******************
//***********************************************

// clip layer display to clipleft, cliptip, clipright, clipbottom
function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {		
	var layer = getLayer(name);		
	if (layer != null) {
  		if (isNav4) {
			layer.clip.left   = clipleft;
			layer.clip.top    = cliptop;
		      layer.clip.right  = clipright;
			layer.clip.bottom = clipbottom;
		} else {
			layer.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';
		}
	}
}


// Create a DHTML layer
function createLayer(name, left, top, width, height, visible, content) {
	  var layer;
	  if (isNav4) {
	    document.writeln('<layer name="' + name + '" align="center" left=' + left + ' top=' + top + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
	    document.writeln(content);
	    document.writeln('</layer>');
	    layer = getLayer(name);
	    layer.width = width;
	    layer.height = height;
	  } else {
	    document.writeln('<div id="' + name + '" align="center" style="position:absolute; overflow:none; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
	    document.writeln(content);
	    document.writeln('</div>');
	  }
	  	//  clipLayer(name, 0, 0, width, height);
}

// Create a DHTML layer
function createLayerStyle(name, left, top, width, height, visible, classname, content) {
	  var layer;
	  if (isNav4) {
	    document.writeln('<layer name="' + name + '" align="center" class="' + classname + '" left=' + left + ' top=' + top + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
	    document.writeln(content);
	    document.writeln('</layer>');
	    layer = getLayer(name);
	    layer.width = width;
	    layer.height = height;
	  } else {
	    document.writeln('<div id="' + name + '" align="center" class="' + classname + '" style="position:absolute; overflow:visible; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
	    document.writeln(content);
	    document.writeln('</div>');
	  }
	  	//  clipLayer(name, 0, 0, width, height);
}

// Create a DHTML layer
function createLayerStyle2(name, left, top, width, height, visible, classname, content) {
	  var layer;
	  if (isNav4) {
	    document.writeln('<layer name="' + name + '" align="center" class="' + classname + '" left=' + left + ' top=' + top + ' width=' + width + ' height=' + height +  ' visibility=' + (visible ? '"show"' : '"hide"') +  '>');
	    document.writeln(content);
	    document.writeln('</layer>');
	    layer = getLayer(name);
	    layer.width = width;
	    layer.height = height;
	  } else {
	    document.writeln('<div id="' + name + '" align="center" class="' + classname + '" style="position:absolute; overflow:auto; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +  '">');
	    document.writeln(content);
	    document.writeln('</div>');
	  }
	  	//  clipLayer(name, 0, 0, width, height);
}

// get the layer object called "name"
function getLayer(name) {
	  if (isNav4)
	    return(document.layers[name]);
	  else if (isIE4) {
	  	if ( eval('document.all.' + name) != null) {
		    layer = eval('document.all.' + name + '.style');
		    return(layer);
		} else
			return(null);
	  } 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 (layer != null) {
	 	if (isNav4)
    		layer.visibility = "hide";
		else
   		 layer.visibility = "hidden";
	}
}

// move layer to x,y
function moveLayer(name, x, y) {
	var layer = getLayer(name);		
	if (layer != null) {
	  	if (isNav4)
    		layer.moveTo(x, y);
	 	else if (isIE) {
    		layer.left = x + "px";
   			layer.top  = y + "px";
		} else {
			layer.height = iHeight - y;
			layer.width	= iWidth - x;
    		layer.left = x + "px";
   			layer.top  = y + "px";
	  	}
	}
}

// replace layer's content with new content
function replaceLayerContent(name, content) {
	  if (isNav4) {
		    var layer = getLayer(name);
			if (layer != null) {
			    layer.document.open();
			    layer.document.writeln(content);
			    layer.document.close();
			}
	  }  else if (isIE) {
			if (eval("document.all." + name) != null) {
		  		content = content.replace(/\'/g,"\\'");
			    var str = "document.all." + name + ".innerHTML = '" + content + "'";
			    eval(str);
			}
	  }
}

// set layer background color
function setLayerBackgroundColor(name, color) {		
  	var layer = getLayer(name);		
	if (layer != null) {
	    if (isNav4) 
    		layer.bgColor = color;
		else 
    		layer.backgroundColor = color;
	}
}

// toggle layer to visible
function showLayer(name) {		
  	var layer = getLayer(name);		
	if (layer != null) {
	  	if (isNav4)
    		layer.visibility = "show";
		else
   		 	layer.visibility = "visible";
	}
}

// replace layer content - New To Prop Info
function replaceLayerContent(name, content) {
	if (document.getElementById(name) != null) {
		document.getElementById(name).innerHTML = content;
	}
}
