var IE4 = (document.all) ? true : false;
var NS4 = (document.layers) ? true : false;
var NS6IE6 = (document.getElementById) ? true : false;

var agent  = navigator.userAgent.toLowerCase();
var MSIE  = (agent.indexOf("msie") !=   -1);
/*
if (MSIE){
			 document.getElementById("MAPAimg").attachEvent("onload", MapLoaded);
			 }			 
			else{
			 document.getElementById("MAPAimg").addEventListener("load", MapLoaded, false);
			};
*/
var Path = ScriptPath + MapPath;
var TempClientKey1
var TempClientKey2
var ScaleValue;
var ZoomLevel;
ZoomLevel = MaxZoomLevel;

var Hint;
var timeId = 0;
var InfoWindow, LocateWindow, GotoWindow, OrientationWindow, SuggestRouteWindow, EnlargeWindow, FavoritesWindow;
var LegendID;
var print_string;
var ImageHolder = new Image();

function DoTheClearTags(){
		 DoTheClearTagsCustom();
		 SetTempQueryState();
		 DoAction('ClearTags');		 
		 }

function OpenBigScreenMap(){
  if (!(LaunchedWin) || (LaunchedWin.closed)) LaunchedWin=window.open("BigScreenMap.asp","LaunchedWin","top='10',left='10',status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes")
  else{
LaunchedWin.location="BigScreenMap.asp";
    LaunchedWin.focus();
  };
}

function PrintMap(WindowHeightNeed,WindowWidthNeed,FileInWindow){
  //var WindowHeightNeed = 530;
  //var WindowWidthNeed = 580;
  var TopTop;
  var LeftLeft;
  TopTop = (screen.height - WindowHeightNeed)/2;
  LeftLeft = (screen.width - WindowWidthNeed)/2;
  if (!(LaunchedWin) || (LaunchedWin.closed)) LaunchedWin=window.open(FileInWindow,"LaunchedWin","top="+TopTop+",left="+LeftLeft+",height="+WindowHeightNeed+",width="+WindowWidthNeed+",status=no,toolbar=no,menubar=yes,location=no,scrollbars=yes")
  else{
    LaunchedWin.location=FileInWindow;
    LaunchedWin.focus();
  }
}	

		 
		 
function CheckForm(){	 
		 if (NS6IE6){
		 	 if (document.getElementById("golflist").value == ""){
		      	 	return false;
			  	 	}
		     	 else{
		      	 	  return true;
		      	 	  };
			}
			else if(NS4) {
				 if (document.resultsForm.golflist.value == ""){
		    	 	return false;
				 	}
		   		 else{
		    	 	  return true;
		   		 	  };
				 } 
				 else if(IE4) {
				 	  if (document.resultsForm.golflist.value == ""){
		      	      	 return false;
			  			 }
		         	  else{
		      	      	 return true;
		      			 };	
					  };			 
			 
		 }

function SetTempQueryState(){
  	if (MapClickState == "Query"){
	   MapClickState = "TempQuery";
	   }
	else{
		 if (MapClickState == "TempQuery"){
	   	 	MapClickState = "Query";
	   		} 
	     }     
	}
	
	
	
function ClearTags()
	{
  	d=new Date();
	SetSrc("MAPA",MapScript+MapPath+"?Action=cleartags&width="+
	MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}

function CreateMap(Query, Width, Height, WhereX, WhereY)	
{
	//alert("CreateMap");
	WhatScale();
	//IE4 = (document.all) ? true : false;
  	//NS4 = (document.layers) ? true : false; 
	//NS6 = (document.getElementById) ? true : false; 	
	document.write
	(
    	'<STYLE TYPE="text/css">',
    	'#map {', 
		'position:absolute;',
      	'width:', Width, ';',
      	'height:', Height, ';',
		'left:'+WhereX+';'+
      	'top:'+WhereY+';'+
    	'}',
    	'</STYLE>',
    	'<DIV ID="map" style="visibility:visible">',
		CreateMapImageNS4("MAPA",0,0,Width,Height,Path+"?width="+Width+"&height="+MapHeight+"&scale="+ScaleValue+((Query!="")?"&"+Query:"")),
		CreateButtonNS4("PleaseWait", "MapNavNewImages/loading-map.gif", "", "", 172, 28, "", (Width-172)/2, (Height-28)/2, ""),
		CreateMapInterfaceNS4(Width, Height, 0, 0),
		CreateMapDummyNS4(Width, Height, 0, 0),
		
		CreateButtonNS4("PanUp", "MapNavNewImages/nOff.gif", "MapNavNewImages/nOn.gif", "", 17, 17, "Pan up", 187, 0, "Pan(0,60)"),
		CreateButtonNS4("PanDown", "MapNavNewImages/sOff.gif", "MapNavNewImages/sOn.gif", "", 17, 17, "Pan down", 187, 250, "Pan(0,-60)"),

		CreateButtonNS4("PanLeft", "MapNavNewImages/wOff.gif", "MapNavNewImages/wOn.gif", "", 17, 17, "Pan left", 0, 125, "Pan(-60,0)"),
		CreateButtonNS4("PanRight", "MapNavNewImages/eOff.gif", "MapNavNewImages/eOn.gif", "", 17, 17, "Pan right", 377, 125, "Pan(60,0)"),

		CreateButtonNS4("PanLeftUp", "MapNavNewImages/nwOff.gif", "MapNavNewImages/nwOn.gif", "", 17, 17, "Pan left and up", 0, 0, "Pan(-60,60)"),
		CreateButtonNS4("PanRightUp", "MapNavNewImages/neOff.gif", "MapNavNewImages/neOn.gif", "", 17, 17, "Pan right and up", 377, 0, "Pan(60,60)"),

		CreateButtonNS4("PanLeftDown", "MapNavNewImages/seOff.gif", "MapNavNewImages/seOn.gif", "", 17, 17, "Pan right and down", 377, 250, "Pan(60,-60)"),
		CreateButtonNS4("PanRightDown", "MapNavNewImages/swOff.gif", "MapNavNewImages/swOn.gif", "", 17, 17, "Pan left and down", 0, 250, "Pan(-60,-60)"),
		   
  	'</DIV>'
	);
		
     if (NS6IE6){
		 	 document.getElementById("MAPAimg").addEventListener("load", MapLoaded, false);
			}
			else if(NS4) {
				 } 
				 else if(IE4) {
					  };	

	}

	
function onLoad()
	{	
	ReSetMapTabs(DefaultViewTab);
	WhatScale();
	ZoomButtonSet();
	IE4 = (document.all) ? true : false;
  	NS4 = (document.layers) ? true : false;
	NS6 = (document.getElementById) ? true : false;

     if (NS6IE6){
		 	 if (document.getElementById("MAPAimg")){
				if (MSIE){
			 		document.getElementById("MapDummyimg").attachEvent("onclick", MapClick);
			 		}			 
				else{
			 		//document.getElementById("MAPAimg").addEventListener("load", MapLoaded, false);
			 		document.getElementById("MapDummyimg").addEventListener("mouseup", MapClick, false);
					};
			   //document.getElementById("MapDummyimg").attachEvent("onclick", MapClick);
			   //document.getElementById("MapDummyimg").addEventListener("mouseup", MapClick, false);
			   }
			}
			else if(NS4) {
				 if (document.map){
			   		  	 document.map.document.MapDummy.document.captureEvents(Event.MOUSEUP);
			   		  	 document.map.document.MapDummy.document.onmouseup=MapClick;
    		   		  	 }
    	    	 origWidth=innerWidth;
    			 origHeight=innerHeight;
    			 onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}
				 } 
				 else if(IE4) {					  
					  if (document.all.MapDummyimg)document.all.MapDummyimg.onclick=MapClick;
					  };	
		
	}
	
window.onload=onLoad;



function CreateMapImage(MapMeVars){
	d=new Date();
	//alert(MapMeVars);
	var LoadedString;	
     if (NS6IE6){
		 	 if (document.getElementById("MAPAimg")){
			   LoadedString = "";
			   }
			}
			else if(NS4) {
				 LoadedString = "MapLoaded()";
				 } 
				 else if(IE4) {
					 LoadedString = "MapLoaded()";
					  };		
		
		
		 document.write(
		 '<STYLE TYPE="text/css">#MAPA{position:absolute; left:0; top:0;width:'+MapWidth+'; height:'+MapHeight+'; cursor:hand; z-index:1}</STYLE>'+
    	 '<DIV ID="MAPA">');
		 document.write(
    	 '<IMG NAME="MAPAimg" ID="MAPAimg" SRC="'+ Path +'?'+MapMeVars+'&HEIGHT='+MapHeight+'&WIDTH='+MapWidth+'&Time='+d.getTime()+'"'
		 );

		 document.write(
    	 '" BORDER="'+MapBorder+'" onLoad="'+LoadedString+'"  onMouseover="" HEIGHT="'+MapHeight+'" WIDTH="'+MapWidth+'" STYLE="{cursor:hand;}">'+
    	 '</DIV>'			 
		 );

		 }	

function CreateMapImageNS4(ID, X, Y, Width, Height, URL){	
	var LoadedString;
	if (NS6IE6){
	    LoadedString = "";
  		}
  	else{
		if (NS4){
	   		LoadedString = "MapLoaded()";
			}
		else{
	   		LoadedString = "MapLoaded()";
  			}
		};
  	return '<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+Width+';'+
      	'height:'+Height+';'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
    	'<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+URL+
    	'" BORDER="'+MapBorder+'" onLoad="'+LoadedString+'" HEIGHT="'+Height+'" WIDTH="'+Width+' STYLE="{cursor:hand;}">'+
    	'</DIV>';
	}

	
	
function CreateButton(ID, NormalURL, HighlightURL, ClickedURL, Width, Height, Alt, X, Y, onClick){
  document.write( '<STYLE TYPE="text/css">'+
    '#'+ID+' {'+
      'position:absolute;'+
      'left:'+X+';'+
      'top:'+Y+';'+
      'width:'+Width+';'+
      'height:'+Height+';'+
	  'cursor:hand;'+
      'z-index:1'+
    '}'+
    '</STYLE>'+
    '<DIV ID="'+ID+'">'+
    '<A HREF="javascript:'+
    ((ClickedURL)?"SetSrc('"+ID+"','"+ClickedURL+"');":"")+
    onClick+'"'+
    ((HighlightURL)?
      ' onMouseOver="'+'if (MapClickState!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+HighlightURL+"')"+'"'+
      ' onMouseOut=" if (MapClickState!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+NormalURL+"')"+'"':'')+
    '>'+
    '<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+((MapClickState==ID)?ClickedURL:NormalURL)+'" ALT="'+Alt+
    '" BORDER="0" HEIGHT="'+Height+'" WIDTH="'+Width+'">'+
    '</A></DIV>');
}
	
	function CreateButtonNS4(ID, NormalURL, HighlightURL, ClickedURL, Width, Height, Alt, X, Y, onClick){
  	//alert("CreateButtonNS4");
	return '<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+Width+';'+
      	'height:'+Height+';'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
    	'<A HREF="javascript:'+
    	((ClickedURL)?"SetSrc('"+ID+"','"+ClickedURL+"');":"")+
    	onClick+'"'+
    	((HighlightURL)?
    	' onMouseOver="'+'if (MapClickState!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+HighlightURL+"')"+'"'+
      	' onMouseOut="if (MapClickState!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+NormalURL+"')"+'"':'')+
    	'>'+
    	'<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+((MapClickState==ID)?ClickedURL:NormalURL)+'" ALT="'+Alt+
    	'" BORDER="0" HEIGHT="'+Height+'" WIDTH="'+Width+'">'+
    	'</A></DIV>';
	}
	
	
	
function CreateMapInterfaceNS4(InterfaceWidth, InterfaceHeight, X, Y){
	 return '<STYLE TYPE="text/css">'+
    	'#MapInterface {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+InterfaceWidth+';'+
      	'height:'+InterfaceHeight+';'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
		 
		 '<DIV ID="MapInterface" >'+
    	 '<IMG NAME="MapInterfaceimg" ID="MapInterfaceimg" SRC="MapNavNewImages/Viewer.gif"'+
    	 '" BORDER="0" onLoad=""  onMouseover="" HEIGHT="'+InterfaceHeight+'" WIDTH="'+InterfaceWidth+'" >'+
    	 '</DIV>'			 
		 ;
		}	
	
	
function CreateMapInterfaceOld(){
		 document.write(
		 '<STYLE TYPE="text/css">#MapInterface{position:absolute; left:0; top:0; width:'+MapWidth+'; height:'+MapHeight+'; cursor:hand; z-index:1}</STYLE>'+
    	 '<DIV ID="MapInterface">');
		 document.write(
    	 '<IMG NAME="MapInterfaceimg" ID="MapInterfaceimg" SRC="MapNavNewImages/Viewer.gif"'
		 );
		 //alert("building2");
		 document.write(
    	 '" BORDER="0" onLoad=""  onMouseover="" HEIGHT="'+MapHeight+'" WIDTH="'+MapWidth+'" >'+
    	 '</DIV>'			 
		 );
		 //alert("building3");	
		}	
	
function CreateMapInterface(){
		CreateMapInterfaceLevel(0,0,"MapInterfaceNW",28,28, MapGifImagesFolder+"level1tlc.gif");
		CreateMapInterfaceLevel((MapWidth/2)-(45/2),0,"MapInterfaceN",28,45,MapGifImagesFolder+"level1tm.gif"); 
		CreateMapInterfaceLevel((MapWidth-28),0,"MapInterfaceNE",28,28,MapGifImagesFolder+"level1tr.gif");
		CreateMapInterfaceLevel(0,((MapHeight/2)-(49/2)),"MapInterfaceE",49,28,MapGifImagesFolder+"level1ml.gif");
		CreateMapInterfaceLevel((MapWidth-28),((MapHeight/2)-(49/2)),"MapInterfaceW",49,28,MapGifImagesFolder+"level1mr.gif");  
		CreateMapInterfaceLevel(0,(MapHeight-28),"MapInterfaceSW",28,28,MapGifImagesFolder+"level1bl.gif"); 
		CreateMapInterfaceLevel((MapWidth/2)-(45/2),(MapHeight-28),"MapInterfaceS",28,45,MapGifImagesFolder+"level1bm.gif"); 
		CreateMapInterfaceLevel((MapWidth-28),(MapHeight-28),"MapInterfaceSE",28,28,MapGifImagesFolder+"level1br.gif");  
		
		CreateMapInterfaceLevel((28),0,"MapInterfaceTopLeft",28,(MapWidth-28-28-45)/2,MapGifImagesFolder+"level1top.gif"); 
		CreateMapInterfaceLevel(((MapWidth+45)/2),0,"MapInterfaceTopRight",28,((MapWidth-28-28-45)/2)+1,MapGifImagesFolder+"level1top.gif"); 
		
		CreateMapInterfaceLevel((28),(MapHeight-28),"MapInterfaceBottomLeft",28,(MapWidth-28-28-45)/2,MapGifImagesFolder+"level1bottom.gif"); 
		CreateMapInterfaceLevel(((MapWidth+45)/2),(MapHeight-28),"MapInterfaceBottomRight",28,((MapWidth-28-28-45)/2)+1,MapGifImagesFolder+"level1bottom.gif"); 
		
		CreateMapInterfaceLevel(0,28,"MapInterfaceLeftTop",((MapHeight-28-28-45)/2)+1,28,MapGifImagesFolder+"level1left.gif"); 
		CreateMapInterfaceLevel(0,((MapHeight+45)/2),"MapInterfaceLeftBottom",((MapHeight-28-28-45)/2)+1,28,MapGifImagesFolder+"level1left.gif"); 
		
		CreateMapInterfaceLevel((MapWidth-28),28,"MapInterfaceRightTop",((MapHeight-28-28-45)/2)+1,28,MapGifImagesFolder+"level1right.gif"); 
		CreateMapInterfaceLevel((MapWidth-28),((MapHeight+45)/2),"MapInterfaceRightBottom",((MapHeight-28-28-45)/2)+1,28,MapGifImagesFolder+"level1right.gif"); 
		}	
	
function CreateMapInterfaceLevel(PosX,PosY,NameT,HeightT,WidthT,URL){
		 document.write(
		 '<STYLE TYPE="text/css">#'+NameT+'{position:absolute; left:'+PosX+'; top:'+PosY+'; width:'+WidthT+'; height:'+HeightT+'; cursor:hand; z-index:1}</STYLE>'+
    	 '<DIV ID="'+NameT+'">'+
    	 '<IMG NAME="'+NameT+'img" ID="'+NameT+'img" SRC="'+URL+'"'+
    	 ' BORDER="0" onLoad=""  onMouseover="" HEIGHT="'+HeightT+'" WIDTH="'+WidthT+'" >'+
    	 '</DIV>'			 
		 );
		}	
	
function CreateMapPanButtons(){
		CreateButton("PanUp", MapGifImagesFolder+"pan/nOff.gif", MapGifImagesFolder+"pan/nOn.gif", "", 17, 17, "Pan up", ((MapWidth/2)-8), 2, "Pan(0,60)");
		CreateButton("PanDown", MapGifImagesFolder+"pan/sOff.gif", MapGifImagesFolder+"pan/sOn.gif", "", 17, 17, "Pan down", ((MapWidth/2)-8), (MapHeight-28+8), "Pan(0,-60)");

		CreateButton("PanLeft", MapGifImagesFolder+"pan/wOff.gif", MapGifImagesFolder+"pan/wOn.gif", "", 17, 17, "Pan left", 3, ((MapHeight/2)-8), "Pan(-60,0)");
		CreateButton("PanRight", MapGifImagesFolder+"pan/eOff.gif", MapGifImagesFolder+"pan/eOn.gif", "", 17, 17, "Pan right", (MapWidth-28+7), ((MapHeight/2)-8), "Pan(60,0)");

	  	CreateButton("PanLeftUp", MapGifImagesFolder+"pan/nwOff.gif", MapGifImagesFolder+"pan/nwOn.gif", "", 17, 17, "Pan left and up", 3,3, "Pan(-60,60)");
  		CreateButton("PanRightUp", MapGifImagesFolder+"pan/neOff.gif", MapGifImagesFolder+"pan/neOn.gif", "", 17, 17, "Pan right and up", (MapWidth-20), 3, "Pan(60,60)");

	  	CreateButton("PanLeftDown", MapGifImagesFolder+"pan/seOff.gif", MapGifImagesFolder+"pan/seOn.gif", "", 17, 17, "Pan right and down", (MapWidth-20), (MapHeight-20), "Pan(60,-60)");
	 	CreateButton("PanRightDown", MapGifImagesFolder+"pan/swOff.gif", MapGifImagesFolder+"pan/swOn.gif", "", 17, 17, "Pan left and down", 3, (MapHeight-20), "Pan(-60,-60)");
		}	
		
		
	
function CreateMapDummyNS4(DummyWidth, DummyHeight, X, Y){
		 return '<STYLE TYPE="text/css">'+
    	'#MapDummy {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+DummyWidth+';'+
      	'height:'+DummyHeight+';'+
		'cursor:hand;'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
		 
		 '<DIV ID="MapDummy" >'+
		 ''+
    	 '<IMG NAME="MapDummyimg" ID="MapDummyimg" SRC="MapNavNewImages/TransParentPixel.gif"'+
    	 ' BORDER="0" onLoad=""  onMouseover="" HEIGHT="'+DummyHeight+'" WIDTH="'+DummyWidth+'" >'+
    	 ''+
		 '</DIV>'			 
		 ; 		 
		 }	
	
function CreateMapDummy(){
		 document.write(
		 '<STYLE TYPE="text/css">#MAPDummy{position:absolute; left:0; top:0;width:'+MapWidth+'; height:'+MapHeight+'; cursor:hand; z-index:1}</STYLE>'+
    	 '<DIV ID="MAPDummy">');
		 //alert("building");
		 document.write(
    	 '<IMG NAME="MapDummyimg" ID="MapDummyimg" SRC="'+MapGifImagesFolder+'TransParentPixel.gif"'
		 );
		 //alert("building2");
		 document.write(
    	 '" BORDER="'+MapBorder+'" onLoad=""  onMouseover="" HEIGHT="'+MapHeight+'" WIDTH="'+MapWidth+'" STYLE="{cursor:hand;}">'+
    	 '</DIV>'			 
		 );
		 //alert("building3");		 		 
		 }		
	
function CreateScaleButton(ID, NormalURL, HighlightURL, ClickedURL, Width, Height, Alt, X, Y, onClick){
  	return '<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+Width+';'+
      	'height:'+Height+';'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
    	'<A HREF="javascript:'+
    	((ClickedURL)?"SetSrc('"+ID+"','"+ClickedURL+"');":"")+
    	onClick+'"'+
    	((HighlightURL)?
    	' onMouseOver="SetHint('+"'"+Alt+"', false); "+'if (Scale!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+HighlightURL+"')"+'"'+
      	' onMouseOut="RestoreHint(); if (Scale!='+"'"+ID+"') "+"SetSrc('"+ID+"','"+NormalURL+"')"+'"':'')+
    	'>'+
    	'<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+((Scale=="ID")?ClickedURL:NormalURL)+'" ALT="'+Alt+
    	'" BORDER="0" HEIGHT="'+Height+'" WIDTH="'+Width+'">'+
    	'</A></DIV>';
	}	
	
function CreatePleaseWait(ID, NormalURL, HighlightURL, ClickedURL, Width, Height, Alt, X, Y, onClick){
  	document.write( 
		'<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+Width+';'+
      	'height:'+Height+';'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
    	'<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+NormalURL+'" ALT="'+Alt+
    	'" BORDER="0" HEIGHT="'+Height+'" WIDTH="'+Width+'">'+
    	'</DIV>');
	}	

function dcsIENS6NS4(AA){
	if (IE4)
  		{
	    dcs(AA);
		};
  }	
  
function ndIENS6NS4(){
	if (IE4)
  		{
	    nd();
		};
  }
  
function ReSetMapTabs(CurrentTab){
	 CurrentMapTab = CurrentTab;
	 if (NS6IE6){
		 	 if(document.getElementById("Tab1")){(CurrentTab=="Tab1")?document.getElementById("Tab1").className="MapTabOnURL":document.getElementById("Tab1").className="MapTabURL"};
		   	 if(document.getElementById("Tab2")){(CurrentTab=="Tab2")?document.getElementById("Tab2").className="MapTabOnURL":document.getElementById("Tab2").className="MapTabURL"};
		   	 if(document.getElementById("Tab3")){(CurrentTab=="Tab3")?document.getElementById("Tab3").className="MapTabOnURL":document.getElementById("Tab3").className="MapTabURL"};
		   	 if(document.getElementById("Tab4")){(CurrentTab=="Tab4")?document.getElementById("Tab4").className="MapTabOnURL":document.getElementById("Tab4").className="MapTabURL"};
		   	 if(document.getElementById("Tab5")){(CurrentTab=="Tab5")?document.getElementById("Tab5").className="MapTabOnURL":document.getElementById("Tab5").className="MapTabURL"};
		   	 if(document.getElementById("Tab6")){(CurrentTab=="Tab6")?document.getElementById("Tab6").className="MapTabOnURL":document.getElementById("Tab6").className="MapTabURL"};
			 if(document.getElementById("Tab7")){(CurrentTab=="Tab7")?document.getElementById("Tab7").className="MapTabOnURL":document.getElementById("Tab7").className="MapTabURL"};
		   	 if(document.getElementById("Tab8")){(CurrentTab=="Tab8")?document.getElementById("Tab8").className="MapTabOnURL":document.getElementById("Tab8").className="MapTabURL"};
			}
			else if(NS4) {
				 if(document.Tab1){(CurrentTab=="Tab1")?document.Tab1.className="MapTabOnURL":document.Tab1.className="MapTabURL"};
	   			 if(document.Tab2){(CurrentTab=="Tab2")?document.Tab2.className="MapTabOnURL":document.Tab2.className="MapTabURL"};
	   			 if(document.Tab3){(CurrentTab=="Tab3")?document.Tab3.className="MapTabOnURL":document.Tab3.className="MapTabURL"};
	   			 if(document.Tab4){(CurrentTab=="Tab4")?document.Tab4.className="MapTabOnURL":document.Tab4.className="MapTabURL"};
	   			 if(document.Tab5){(CurrentTab=="Tab5")?document.Tab5.className="MapTabOnURL":document.Tab5.className="MapTabURL"};
	   			 if(document.Tab6){(CurrentTab=="Tab6")?document.Tab6.className="MapTabOnURL":document.Tab6.className="MapTabURL"};
				 if(document.Tab7){(CurrentTab=="Tab7")?document.Tab7.className="MapTabOnURL":document.Tab7.className="MapTabURL"};
	   			 if(document.Tab8){(CurrentTab=="Tab8")?document.Tab8.className="MapTabOnURL":document.Tab8.className="MapTabURL"};
				 } 
				 else if(IE4) {					 
					 if(document.all.Tab1){(CurrentTab=="Tab1")?document.all.Tab1.className="MapTabOnURL":document.all.Tab1.className="MapTabURL"};
	   			 	 if(document.all.Tab2){(CurrentTab=="Tab2")?document.all.Tab2.className="MapTabOnURL":document.all.Tab2.className="MapTabURL"};
	   			 	 if(document.all.Tab3){(CurrentTab=="Tab3")?document.all.Tab3.className="MapTabOnURL":document.all.Tab3.className="MapTabURL"};
	   			 	 if(document.all.Tab4){(CurrentTab=="Tab4")?document.all.Tab4.className="MapTabOnURL":document.all.Tab4.className="MapTabURL"};
	   			 	 if(document.all.Tab5){(CurrentTab=="Tab5")?document.all.Tab5.className="MapTabOnURL":document.all.Tab5.className="MapTabURL"};
	   			 	 if(document.all.Tab6){(CurrentTab=="Tab6")?document.all.Tab6.className="MapTabOnURL":document.all.Tab6.className="MapTabURL"};
				 	 if(document.all.Tab7){(CurrentTab=="Tab7")?document.all.Tab7.className="MapTabOnURL":document.all.Tab7.className="MapTabURL"};
	   			 	 if(document.all.Tab8){(CurrentTab=="Tab8")?document.all.Tab8.className="MapTabOnURL":document.all.Tab8.className="MapTabURL"};
					  };	
	}	
	
function SetTempQuery(){
         if (MapClickState =="Query"){MapClickState ="TempQuery"};
		 } 
		 
function RedrawView(XX){
	//alert(XX);
	d=new Date();
 	SetSrc("MAPA", Path+"?Action=Redraw"+"&view="+XX+"&width="+
	MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}
	
function WhatScale() {
switch (Scale){
   case "ZoomSTa" : 
      ScaleValue=ZoomSTaValue;
      break;
   case "ZoomSTb" : 
      ScaleValue=ZoomSTbValue;
      break;
   case "ZoomSTc" : 
      ScaleValue=ZoomSTcValue;
      break;  
   case "ZoomSTd" : 
      ScaleValue=ZoomSTdValue;
      break;
   case "ZoomSTe" : 
      ScaleValue=ZoomSTeValue;
      break;
   case "ZoomSTf" : 
      ScaleValue=ZoomSTfValue;
      break; 
   case "ZoomSTg" : 
      ScaleValue=ZoomSTgValue;
      break;
   case "ZoomSTh" : 
      ScaleValue=ZoomSThValue;
      break;
   default : ScaleValue=ZoomSTdValue;
};
}	

//var Donna = true;
var ImageStack = new Array();
function LoadImageHolder(request)
   {
     id = ImageStack.length;
     ImageStack[id] = new Image();
     ImageStack[id].src = request;
     ImageStack[id].onload = function(){ ImageHolderLoaded(id); };
	 //alert("Donna="+Donna);
	 //ImageHolder.addEventListener("load",ImageHolderLoaded,false);
	 //ImageHolder.removeEventListener("load",ImageHolderLoaded,false);
	 //if(Donna){	   
	   //Donna = false;
	   //document.getElementById("MAPAimg").addEventListener("load", MapLoaded, false);
	   //document.getElementById("ImageHolder").addEventListener("load",ImageHolderLoaded,false);
	   //ImageHolder.onload = function(){ ImageHolderLoaded(); };
	   //}
	 //else{
	  //Donna = true;
	   //document.getElementById("ImageHolder").addEventListener("onload",ImageHolderLoaded,false);
	  //};  
	 //ImageHolder.src = request;
	 //alert("LoadImageHolder2");
	 //alert(Donna);
	 
     //ImageHolder.onload = function(){ ImageHolderLoaded(); };
	 //alert("LoadImageHolder3");
   }
   
function ImageHolderLoaded()
   {
   //alert(ImageHolder.src);
   //dd= request;
   //if (document.getElementById){alert("document.getElementById")};
   //if (document.getElementByID(dd)){alert("document.getElementByID(AAA)")};
   //document.images['AA'].src = ImageHolder.src;
   //document.getElementByID("AA").setAttribute('src',ImageHolder.src);
   //alert("gert1");
   document.getElementById("MAPAimg").setAttribute("src",ImageStack[id].src);
   //alert("gert");
   //document.getElementById(id+"img").src = ImageHolder.src;
   MapLoaded();   
   }

function SetSrc(id, url){
     //alert("aaaa");
	 if (NS6IE6){
		 	  if (id=="MAPA"){ 
     		   document.getElementById("PleaseWaitimg").style.visibility="visible";
			   };
		      //document.getElementById(id+"img").src = url;
		   	  if (id=="MAPA"){ 
     		   if (MSIE){
			  		document.getElementById(id+"img").src = url;
			    	}			 
			   else{
			  		LoadImageHolder(url);
			    	}	
			   
			   //document.getElementById("MAPAimg").onload = MapLoaded();
			   //document.getElementById("MAPAimg").attachEvent(onload, MapLoaded())	
			   //document.getElementById("MAPA").attachEvent(onload, MapLoaded())		   
			   }
			   else{
			  	document.getElementById(id+"img").src = url;
			   };
			}
			else if(NS4) {
				 if (id=="MAPA"){ 
			   	 	document.map.document.PleaseWait.visibility="visible";
			   		};    	   
		         
				 eval("document.map.document." + id + ".document." + id + "img").src = url;
				 	} 
				 else if(IE4) {
					 if (id=="MAPA"){					   
					   document.all.PleaseWait.style.visibility="visible";
					   };
			         eval("document.all." + id + "img").src = url;
					  };	

	}

	
function SetSrcButtons(id, url){
     if (NS6IE6){
		 	  if (document.getElementById(id+"img")){
		   	  	 document.getElementById(id+"img").src = url;
		   	  	 }
			}
			else if(NS4) {
				    if (eval("document." + id + "img")){
					 	eval("document." + id + "img").src = url;
						}					
				 	} 
				 else if(IE4) {
					 if (eval("document.all." + id + "img")){
		   		       eval("document.all." + id + "img").src = url;
		   		   	   }
					  };	
	}
	
	
function SetMapClickStateOnly(S){
  	MapClickState=S;
	SetSrcButtons("Query", (MapClickState=="Query")?MapGifImagesFolder + "/Zoom/infoOn.gif":MapGifImagesFolder + "/Zoom/infoOff.gif");
  	SetSrcButtons("ZoomInX5", (MapClickState=="ZoomInX2")?MapGifImagesFolder + "Zoom/zoomInOn.gif":MapGifImagesFolder + "Zoom/zoomInOff.gif");
  	SetSrcButtons("ZoomOutX5", (MapClickState=="ZoomOutX2")?MapGifImagesFolder + "Zoom/zoomOutOn.gif":MapGifImagesFolder + "Zoom/zoomOutOff.gif");
  	SetSrcButtons("Pan", (MapClickState=="Pan")?MapGifImagesFolder + "Zoom/centerOn.gif":MapGifImagesFolder + "Zoom/centerOff.gif");
	}
	
function getCookie(Name){	
   		 var search = Name + "="	
		 if (document.cookie.length != 0)
			{
   			if (document.cookie.length > 0)
		 		{
      			offset = document.cookie.indexOf(search) 
      			if (offset != -1)
				   {
					   offset += search.length 
					   end = document.cookie.indexOf(";", offset) 
					   if (end == -1) end = document.cookie.length;
						return unescape(document.cookie.substring(offset, end))
      			} 
   			}
	      }
	 }	
	 
function SetInfoHTMLOld(){
	var ClientKey = getCookie("CLIENT_KEY");	
	if (ClientKey > 0 && ClientKey < 500000){
		var InfoPath;
		InfoPath = PagePath + "?ID="+ClientKey+"&MustCenter=No";
		window.location.href = InfoPath;
		};
	} 

	
	
	
	
function SetTempClientKey2(){	
	if(TempClientKey1 == TempClientKey2) {
	  setTimeout("SetTempClientKey2()", 1000);
	  TempClientKey2 = getCookie("CLIENT_KEY");
	  }
	else{
	  SetInfoHTML();
	  };
	}
	
function MapLoaded(){  	
	//alert("MapLoaded()");
	TempClientKey1 = getCookie("CLIENT_KEY");
	TempClientKey2 = getCookie("CLIENT_KEY");
	
     if (NS6IE6){
		 	  document.getElementById("PleaseWaitimg").style.visibility="hidden";
		   	  if(MapClickState=="Query"){		    
				  SetInfoHTML();
				  //alert("dd");
				  } 
			}
			else if(NS4) {				    
					document.map.document.PleaseWait.visibility="hidden";
					if(MapClickState=="Query"){
							SetInfoHTML();
							};
				 	} 
				 else if(IE4) {
					 document.all.PleaseWait.style.visibility="hidden";
		   			 if(MapClickState=="Query"){
					 		SetInfoHTML();
							 };
					  };	
	if(MapClickState=="TempQuery"){
			SetTempQueryState()
			};	 
	}

function DoAction(v){
	d=new Date();
	Action=v;
	SetSrc("MAPA", Path + "?Action="+Action+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}		
	
function ZoomScale(L){
	SetTempQueryState();
	d=new Date();	
	Scale=L;
	WhatScale();
	ZoomLevel=ScaleValue;
  	SetSrc("MAPA",Path+"?Action=Zoom&scale="+ScaleValue+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	ZoomButtonSet();
	}

function ZoomButtonSet(){
	SetSrcButtons("ZoomSTa", (ScaleValue==ZoomSTaValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_01_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_01_MID.gif");
  	SetSrcButtons("ZoomSTb", (ScaleValue==ZoomSTbValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_02_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_02_MID.gif");
	SetSrcButtons("ZoomSTc", (ScaleValue==ZoomSTcValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_03_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_03_MID.gif");
	SetSrcButtons("ZoomSTd", (ScaleValue==ZoomSTdValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_06_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_06_MID.gif");
	SetSrcButtons("ZoomSTe", (ScaleValue==ZoomSTeValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_04_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_04_MID.gif");
  	SetSrcButtons("ZoomSTf", (ScaleValue==ZoomSTfValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_06_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_06_MID.gif");
 	SetSrcButtons("ZoomSTg", (ScaleValue==ZoomSTgValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_06_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_06_MID.gif");	
	SetSrcButtons("ZoomSTh", (ScaleValue==ZoomSThValue)?MapGifImagesFolder + "ZoomLevelImages/BB2_10_ON.gif":MapGifImagesFolder + "ZoomLevelImages/BB2_10_MID.gif");
	}	
	
function MapClick(e){

	 if (NS6IE6){	 
	        if (MSIE){
			  	x=window.event.offsetX;
    		    y=window.event.offsetY;
			    }			 
			else{
			  	x=e.layerX;
    		    y=e.layerY;
			    }	
			}  
	  else if(NS4){
				    x=e.layerX;
    				y=e.layerY;
				 	} 
	  else if(IE4){					 
					 x=window.event.offsetX;
    				 y=window.event.offsetY;
					  };	
    //alert("MapClickState="+MapClickState);
	switch (MapClickState){ 
   	   case "Info" : 
           DoInfo(x, y); 
       	   break; 
   	   case "ZoomInX2" : 
           d=new Date();
		   //alert(ZoomLevel);
		   ZoomLevel = ZoomLevel/2;
		   if (ZoomLevel < MinZoomLevel){
	  	   	  ZoomLevel = MinZoomLevel;
			  SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action=Zoom&Scale="+ZoomLevel+
		   	  				"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime()); 
	  	   	  }
    	   else{
		      SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action="+MapClickState+
		   	      "&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
			  }
       	   break;
	   case "ZoomOutX2" : 
           d=new Date();
		   ZoomLevel = ZoomLevel * 2;
		   //if (ZoomLevel > MaxZoomLevel){
			  //ZoomLevel = MaxZoomLevel;
			  //SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action=Zoom&Scale="+ZoomLevel+
		   	  				//"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime()); 
			  //SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action=SavedLocation&SavedLocationID=Proposed Zoning2&Scale="+ZoomLevel+
		   	  				//"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime()); 			
	  	   	  //}
    	   //else{
		      SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action="+MapClickState+
		   	      "&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
			  //}
       	   break;
	   default : 
           d=new Date();
		   //alert(Path+"?clickX="+x+"&clickY="+y+"&Action="+MapClickState);
    	   SetSrc("MAPA", Path+"?clickX="+x+"&clickY="+y+"&Action="+MapClickState+
		   "&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	   } 
	}
	
	
	
	
//////////////////////////////////////////////////////////////
//                     Old Functions                        //
//////////////////////////////////////////////////////////////
function Printfloater2() {
window.print(); 
//window.open("http://maps.jurock.com/PrintJurock.htm","Printfloater2","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0=0,resizable,copyhistory=0,width=400,height=400") 
}

function SetAlt(id, alt)
	{
  	if (NS4)
 		{
		eval("document.map.document." + id + ".document." + id + "img").alt = alt
		}
  	else
		{
		eval("document.all." + id + "img").alt = alt
		}
	}

function SetState(S)
	{
  	MapClickState=S;
	SetSrc("Query", (MapClickState=="Query"||MapClickState=="TempQuery")?MapGifImagesFolder + "CLICK_TO_TAG_MID.gif":MapGifImagesFolder + "CLICK_TO_TAG_OFF.gif");
  	SetSrc("Pan", (MapClickState=="Pan")?MapGifImagesFolder + "CLICK_TO_CENTER_MID.gif":MapGifImagesFolder + "CLICK_TO_CENTER_OFF.gif");
  	if (MapClickState=="Query")
		SetHint(' ', true)
  	else
		if ((MapClickState=="ZoomInX2") || (MapClickState=="ZoomInX5"))
			SetHint('Click on the map to zoom in', true)
  		else
			if ((MapClickState=="ZoomOutX2") || (MapClickState=="ZoomOutX5"))
				SetHint('Click on the map to zoom out', true)
  			else
				if (MapClickState=="Pan")
					SetHint('Click on the map to center that position', true);
	}

function SetHint(Text, Permanent){
  	if (timeId>0)
		clearTimeout(timeId);
  	timeId=0;
  	if (NS4){
    		with (document.map.document.hint.document){
      			write('<FONT Size=1 Face="Verdana,Arial,sans-serif">'+Text+'</FONT>');
      			close();
    			}
  		}
  	else
		document.all.hint.innerHTML=Text;
  	if (Permanent){
    		Hint=Text;
    		SetAlt("MapArea", Text);
  		}
  	window.MapArea=Text;
	}

function RestoreHint()
	{
  	if (timeId==0)
		timeId=setTimeout("SetHint('"+Hint+"')", 50);
	}




function CreateHint(ID, X, Y, Width, Height, Text)
	{
  	Hint=Text;
  	return '<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position: absolute;'+
      	'left: '+X+';'+
      	'top: '+Y+';'+
      	'width: '+Width+';'+
      	'height: '+Height+';'+
      	'z-index: 1;'+
      	'font: 9pt Verdana'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
   	 Text+
   	'</DIV>';
	}

function DoInfo(x, y)
	{
  	if (!(InfoWindow) || (InfoWindow.closed))
		InfoWindow=window.open
		(MapScript+MapPath+"?info&clickX="+x+"&clickY="+y, "InfoWindow", 		"width=200,height=250,resizable=yes,scrollbars=yes")
  	else
  		{
    		InfoWindow.location=MapScript+MapPath+"?info&clickX="+x+"&clickY="+y;
    		InfoWindow.focus();
  		}
	}

function DoZoomAll()
	{
  	d=new Date();
  	SetSrc("MAPA", Path+"?Action=ZoomAll"+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}

function DoTag()
	{
  	d=new Date();
  	SetSrc("MAPA", 	Path+"?Action=tag"+"&display="+Entity.Feature.Name+
	"&key="+Entity.Key+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}

function DoZoomPrev()
	{
  	d=new Date();
  	SetSrc("MAPA", Path+"?Action=ZoomPrev"+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}

function Redraw()
	{
  	d=new Date();
  	SetSrc("MAPA", Path+"?Action=Redraw"+"&width="+MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}

function DoOrientate()
	{
  	d=new Date();
  	if (!(OrientationWindow) || (OrientationWindow.closed)) 				OrientationWindow=window.open(Path+
		"?noupdate&Action=zoom&scale=100000&width=350&height=220&time="
		+d.getTime(), "OrientationWindow", "width=370,height=250,resizable=no,scrollbars=no")
  	else 		OrientationWindow.location=Path+
		"?noupdate&Action=zoom&scale=500000&width=350&height=250&time="+d.getTime();
  	OrientationWindow.focus();
	}

function DoFavorites()
{
  if (!(FavoritesWindow) || (FavoritesWindow.closed)) FavoritesWindow=window.open(Path+"?favorites", "FavoritesWindow", "width=400,height=300,resizable=yes,scrollbars=yes")
  else
  {
    FavoritesWindow.location=Path+"?favorites";
    FavoritesWindow.focus();
  }
}

function Pan(X,Y)
	{
  	d=new Date();
  	SetSrc("MAPA", 	Path+"?Action=Pan&X="+X+"&Y="+Y+"&width="+
	MapWidth+"&height="+MapHeight+"&time="+d.getTime());
	}	
	
	function CreateMapImageOld(ID, X, Y, Width, Height, URL)
	{
	var LoadedString;
	if (IE4)
  		{
	    LoadedString = "MapLoaded()";
  		}
  	else
	    {
		if (NS6)
		   	{
	   		LoadedString = "";
			}
		else
  			{
	   		LoadedString = "MapLoaded()";
  			}
		};
  	return '<STYLE TYPE="text/css">'+
    	'#'+ID+' {'+
      	'position:absolute;'+
      	'left:'+X+';'+
      	'top:'+Y+';'+
      	'width:'+Width+';'+
      	'height:'+Height+';'+
      	'cursor:hand;'+
      	'z-index:1'+
    	'}'+
    	'</STYLE>'+
    	'<DIV ID="'+ID+'">'+
    	'<IMG NAME="'+ID+'img" ID="'+ID+'img" SRC="'+URL+
    	'" BORDER="0" onLoad="'+LoadedString+'" HEIGHT="'+Height+'" WIDTH="'+Width+' STYLE="{cursor:hand;}">'+
    	'</DIV>';
	}