function init_map(fr,max,min,typ,wtr,cp,db,str,lwt,che)
  {
  if(che=="true"){cachemap=true;}else{cachemap=false};
  cpy=cp;
  gsWmString=wtr;
  typeOfMap=typ;
  gnMaxZ=parseInt(max);
  gnMinZ=parseInt(min);
  gnMaxAuto=false;
  fxsStrCl=str;
  nToZoom=5;
  gsRtDb=db;
  frameId=fr;
  gsObDb="";
  pgSrc=document.title.replace(/ /g,"")
  mPgSrc=parent.document.title.replace(/ /g,"_")
  gsAddress = "GetGotoAreas.asp";
  gsRouteList = "RouteList.asp"  
  gsDB=pgSrc+".mdb";
  gsAdDb=pgSrc+".mdb";
  gsRtInf="RouteInfo.asp"
  gsGoDb=pgSrc+".mdb";
  gsImap = "Imap.asp";
  gsRouteDb=pgSrc+".mdb";
  gsImapDb=pgSrc+".mdb";
  gsRoot="http://www.cartogold.co.uk/"+mPgSrc+"/"
  gsPage="http://www.cartogold.co.uk/"+mPgSrc+"/"+pgSrc+"/"+pgSrc+".htm";
  gsTileRoot="http://www.cartogold.co.uk/"+mPgSrc+"/"+pgSrc+"/Tiles/";
  gsBsTileRoot="http://www.cartogold.co.uk/"+mPgSrc+"/"+pgSrc+"/Tiles/";
  if(typeOfMap=="raster"){gsBsTileRoot+="Base/";}
  gsMain ="http://www.cartogold.co.uk/"+mPgSrc+"/Main/Main.htm"
  gsMainRoot="http://www.cartogold.co.uk/"+mPgSrc+"/"+pgSrc+"/";
  gsRouteRoot = "http://www.cartogold.co.uk/"+mPgSrc+"/"+pgSrc+"/";
    sVecFntSz="70px"
  gaLiWt=new Array
  c=1
  for (i=gnMinZ;i>0;i--)
  {
  gaLiWt[i]=lwt/(c)
  c=c*2
  }
  var oGetProp=new Ajax();
  oGetProp.method='GET';
  oGetProp.async=true;
  oGetProp.doGet(gsRoot+"Raster.asp?p="+gsDB,cont_init);

  }

function cont_init(mapProp)
{
  
 divObj=parent.document.getElementById("info2Output");

   while(divObj.childNodes.length)
       {
       divObj.removeChild(divObj.firstChild)
       }

divObj=parent.document.getElementById("info2Output");
newObj=parent.document.createElement("A");
newObj.innerHTML="Tourism Routes (interactive)";
newObj.className="clHelpTextBold";
divObj.appendChild(newObj);

newObj=parent.document.createElement("br");
divObj.appendChild(newObj);

newObj=parent.document.createElement("A");
newObj.innerHTML="Clicking on a walks key item will highlight the walk<BR> in the map window.";
newObj.className="helpText_12";
divObj.appendChild(newObj);

newObj=parent.document.createElement("BR");
divObj.appendChild(newObj);
newObj=parent.document.createElement("BR");
divObj.appendChild(newObj);
newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Base.gif";
newObj.id="Base"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/North and West Highlands_1.gif";
newObj.id="North and West Highlands_1"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);


newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Borders Historic_2.gif";
newObj.id="Borders Historic_2"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Galloway_3.gif";
newObj.id="Galloway_3"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Forth Valley_4.gif";
newObj.id="Forth Valley_4"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Fife Coastal_5.gif";
newObj.id="Fife Coastal_5"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Deeside_6.gif";
newObj.id="Deeside_6"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Highland_7.gif";
newObj.id="Highland_7"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Angus Coastal_8.gif";
newObj.id="Angus Coastal_8"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Clyde Valley_9.gif";
newObj.id="Clyde Valley_9"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Argyll Coastal_10.gif";
newObj.id="Argyll Coastal_10"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Perthshire_11.gif";
newObj.id="Perthshire_11"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/Moray Firth_12.gif";
newObj.id="Moray Firth_12"
newObj.onmouseover=function(){hoverkey(this.id);};
newObj.onmouseout=function(){outkey(this.id);};
newObj.onmouseup=function(){onkey(this.id);};
newObj.className="off_4";
newObj.style.position="relative";
divObj.appendChild(newObj);












newObj=parent.document.createElement("p");
divObj.appendChild(newObj);

divObj=parent.document.getElementById("info2Output");
newObj=parent.document.createElement("A");
newObj.innerHTML="Other key items (not interactive)";
newObj.className="clHelpTextBold";
divObj.appendChild(newObj);

newObj=parent.document.createElement("p");
divObj.appendChild(newObj);

newObj=parent.document.createElement("img");
newObj.src=gsRoot+"/images/key_other.gif";
newObj.style.position="relative";
divObj.appendChild(newObj); 
  
  //parent.document.getElementById("tDIV_BUSROUTESTIMETABLES").onclick=function(){
  //sRlist = new Ajax();
  //sRlist.method = 'GET';
  //sRlist.responseFormat = 'text';
 //sRlist.async = true;
  //sRlist.doGet(gsRoot+gsRouteList+"?p="+gsRtDb+","+"*",RouteOutput);
  //parent.document.getElementById('idRteSrch').value=""
  //}
  rteMsg = parent.document.getElementById('info5Output').innerHTML;
  spMapProp=mapProp.split(":")
  mapProp=spMapProp[0].split(",")
  tilProp=spMapProp[1].split(",")
  tWidth=tilProp[0]
  tHeight=tilProp[1]
  tAmnt=tilProp[2] 
  //gsThisPage="Index.htm";
  gsExL=mapProp[0];
  gsExB=mapProp[1];
  gsExR=mapProp[2];
  gsExT=mapProp[3];
  obToBg=7;

  baseCol='black';
  gnImwdth=5500;
  gsKyTp="HTML";
  //gaLiWt = new Array(1,1,1,2,4,8,16,32,256,120);
  gsSb=new Array(20000,4,10000,5,8000,4,4000,4,2000,4,1000,4,500,5,200,4,100,4,50,5,20,4);  
  gsRngS=[[0,0],[1,0],[-1,0],[0,-1],[0,1],[-1,-1],[1,-1],[1,1],[-1,1],[-2,1],[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],[1,-2]];
  gsDel=[[-4,-4],[-3,-4],[-2,-4],[-1,-4],[0,-4],[1,-4],[2,-4],[3,-4],[-4,-3],[-4,-2],[-4,-1],[-4,0],[-4,1],[-4,2],[-4,3],[3,-3],[3,-2],[3,-1],[3,0],[3,1],[3,2],[3,3],[-3,3],[-2,3],[-1,3],[0,3],[1,3],[2,3]];
  gsStCx=0;
  gsStCy=0;
  gbSwKy=false;
  gaDzw=new Array();
  gaDzh=new Array();
  gaDnumw=new Array();
  gaDnumh=new Array();
  gaDtot=new Array();
  sColr="black" 
  goAdd=false;
  imagMapObj=new Array();
  nVec=0;
  gnRnd=1;
  gnRq=2;
  gbRDrvc=false;
  gsActvRt="";
  gnTl="Base"; 
  gbIndvKy=false;
  lhWin="";
  gsStCx=0;
  gsStCy=0;
  gnCz=5;
  gnAt=0;
  wsRoot="";
  shadOffset=.5;
  opacity = 100;
  gsPcDb="";
  gsPolyDb="";
  gsGcm=""; 
  gcRoot="http://www.cartogold.co.uk/scripts/gcis.exe?";
  
  if (parent.document.getElementById('MainKeyTabs')){fullMp=true;}else{fullMp=false;};
  if (frameId=='map'){start_map();}
 }
 


 function start_map()
  {
  sRlist = new Ajax();
  sRlist.method = 'GET';
  sRlist.responseFormat = 'text';
  sRlist.async = true;
  sRlist.doGet(gsRoot+gsRouteList+"?p="+gsRtDb+","+"*",RouteOutput);  
  c=1
  for (var i=gnMinZ;i>-1;i--)
  {
  gaDzw[i]=Math.floor(tWidth/c)
  gaDzh[i]=Math.floor(tHeight/c)
  gaDnumw[i]=Math.ceil(gaDzw[i]/256)
  gaDnumh[i]=Math.ceil(gaDzh[i]/256)
  gaDtot[i]=gaDnumw[i]*gaDnumh[i]
  c=c*2
  }  
  parent.document.getElementById("info3").innerHTML="<A class='clHelpTextBoldComp'>&nbsp&nbspEnter a place name to narrow search results.</A><BR><A class='clHelpTextBoldComp'>&nbsp;&nbsp;Select a name from the list to go to the</A><BR><A class='clHelpTextBoldComp'>&nbsp;&nbsp;town or place on the map.</A><INPUT id='idAddSrch' type='TEXT' ><DIV id='idOptionBox3'><SELECT  id='idSelectList3'><option value=''selected> </option></SELECT></DIV>" 
  parent.document.getElementById('idAddSrch').onkeyup=function(){MapEvent('address',this.value);}
  MapEvent('address','')   
  parent.document.getElementById("info4").innerHTML="<A class='clHelpTextBoldComp'>&nbsp&nbspEnter a known route number to filter results.</A><BR><A class='clHelpTextBoldComp'>&nbsp;&nbsp;Click on a route from the list to highlight the route on</A><BR><A class='clHelpTextBoldComp'>&nbsp;&nbsp;the map.</A><BR><INPUT id='idRteSrch' type='TEXT' ></DIV><DIV id='info4Output'></DIV>"
  parent.document.getElementById('idRteSrch').onkeyup=function(){MapEvent('route',this.value);} 
  //parent.document.getElementById('info5Output').innerHTML ="";
  Z = 0;//Is this needed* 
  if(typeof(window.innerWidth)=='number')
  {
  browser="nonIE";
  }
  else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
  {
  browser="ieComp";
  }
  else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
  {
  browser="ie4Comp";
  }else{browser="ieComp";}  
  document.getElementById("copyright").innerHTML=cpy;
  if(parent.document.getElementById("key"))
  {
  parent.document.getElementById("key").src="Key_Items/Key1.htm";
  }  
  for(var p = 0;p <= gnMinZ;p++)
  {
  oZdv[p] = new oZdv(p,gaDzw[p],gaDzh[p]);
  }
  document.getElementById("map").style.top = 0;
  document.getElementById("map").style.left = 0; 
  if(fullMp==true){AdjLyt();}
  Z=gnMaxZ;
  for(var p = 0;p <= gnMinZ;p++)
  {
  if (oZdv[p].width>document.getElementById('map').offsetWidth&&oZdv[p].height>document.getElementById('map').offsetHeight&&gnMaxAuto==true)
  {
  Z=p;
  gnMaxZ=p;
  break;
  }
  }
  if(fullMp==true)
  {
  tImg=document.createElement("img");
  tImg.style.height="5px"
  tImg.style.width="19px"
  tImg.src="images/toolbar_track_0.gif"
  document.getElementById("ttrack").appendChild(tImg);  
  n=gnMinZ
  for (i=Z;i<=gnMinZ;i++)
  {
  tSrc="images/toolbar_track_1.gif"
  tImg=document.createElement("img");
  tImg.id="tsec"+n;
  tImg.style.left="32px"
  tImg.style.top=5+((i-Z)*14)+"px";
  tImg.style.height="12px"
  tImg.style.width="19px"
  tImg.style.zIndex=100
  tImg.src=tSrc;
  document.getElementById("ttrack").appendChild(tImg); 
  tSp=document.createElement("img");
  tSp.id="tsp"+n;
  tSrc="images/toolbar_track_sp.gif"
  tSp.style.left="32px"
  tSp.style.top=((i-Z)*14)+12+"px";
  tSp.style.height="2px"
  tSp.style.width="19px"
  tSp.src=tSrc;
  document.getElementById("ttrack").appendChild(tSp);
  n=n-1
  }
  document.getElementById("tsp"+(n+1)).style.height="5px"
  document.getElementById("tsp"+(n+1)).style.width="19px"
  document.getElementById("tsp"+(n+1)).src="images/toolbar_track_2.gif"  
  document.getElementById("toolbar_out").style.top = parseInt(document.getElementById("ttrack").style.top)+document.getElementById("ttrack").offsetHeight+8+"px"
  document.getElementById("toolbar_out").style.left = "30px"
  document.getElementById("toolbar_out_shadow").style.top = parseInt(document.getElementById("ttrack").style.top)+document.getElementById("ttrack").offsetHeight+8+"px"
  document.getElementById("toolbar_out_shadow").style.left = "30px"
  document.getElementById("tbar").style.left="0px"
  Drag.init(document.getElementById("tbar"),null,0,0,4,parseInt(document.getElementById('ttrack').offsetHeight)-18); 
  document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top;
  document.getElementById("toolContainer").style.visibility='visible'
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  document.getElementById("rc_").style.left = 0-(oZdv[Z].width/2) + (document.getElementById("imHld").offsetWidth/2) + "px";
  document.getElementById("rc_").style.top = 0-(document.getElementById("imHld").offsetHeight/2) - (oZdv[Z].height/2) + "px";
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  sSearchId=location.search.substring(location.search.lastIndexOf("?")+1);
  if(sSearchId!=""){RouteGoto(sSearchId);}else{
  FtchCo(document.getElementById(oZdv[Z].id));}
  if(fullMp==true)
  { 
  ScaIMap();
  OvUpd();
  }
  }
  parent.document.body.onresize = function()
  {
  if(fullMp==true)
  {
  AdjLyt();
  OvUpd();
  }
  }
  parent.window.onresize = function()
  {
  if(fullMp==true)
  {
  AdjLyt();
  OvUpd();
  }
  }  
  if(!document.getElementById('inset'))
  {
  sSearchId=parent.location.search.substring(parent.location.search.indexOf("&contentId=")+11,parent.location.search.indexOf("&number="));
  }else{
  sSearchArr=(document.getElementById('inset').className).split(":")
  sSearchId=sSearchArr[0]
  gnTl=parseInt(sSearchArr[1])
  }
  if(sSearchId!='')
  {
  var oGetVec=new Ajax();
  oGetVec.method='GET';
  oGetVec.async=true;
  oGetVec.doGet(gsRoot+"GetVector.asp?p="+1+","+0+","+gsExL+","+gsExB+","+gsObDb+","+gsPolyDb+","+sSearchId,ParseFtchVMLZoom);
  }else{
  FtchCo(document.getElementById(oZdv[Z].id)); 
  }  
  }

function PopDd(sResult)
  {
  if(fullMp==true)  	
  { 	  	
  parent.document.forms['GotoSelect'].sGotoVal.options[0]=new Option("------Click here------","null");	
  aOpt=sResult.split("~");
  aOpt.sort()
  for(var i=1;i<aOpt.length;i++)
  {
  aOptSplit=aOpt[i].split(";");   	
  parent.document.forms['GotoSelect'].sGotoVal.options[i]=new Option(aOptSplit[0],aOptSplit[1]);
  }
  }
  }

function oZdv(Zm,w,h)
  {
  this.route = new Array(100);
  for(var p = 0;p < 1;p++)
  {
  this.route[p] = new Array();
  }
  this.id="oZdv_"+Zm;
  this.width=w;
  this.height=h;
  this.nScaFa=((gsExR-gsExL)/gaDzw[Zm]);
  if(parent.document.getElementById("MainKeyDiv"))
  { 
  this.nScaOvFa=(parseInt(document.getElementById("ov").offsetWidth))/this.width;
  this.nRvScaOvFa=this.width/(parseInt(document.getElementById("ov").offsetWidth));
  this.initX = Math.round((document.getElementById("imHld").offsetWidth-this.width)/2);
  this.initY = Math.round((document.getElementById("imHld").offsetHeight-this.height)/2)-(document.getElementById("imHld").offsetHeight);
  }
  this.nRvScaFa=(gaDzw[Zm]/(gsExR-gsExL));  
  oNewDiv=document.createElement("div");
  oNewDiv.id=this.id;
  document.getElementById("ctrl").appendChild(oNewDiv);
  document.getElementById(this.id).style.visibility="hidden";
  document.getElementById(this.id).style.position="absolute";
  document.getElementById(this.id).style.top="0px";
  document.getElementById(this.id).style.left="0px";
  document.getElementById(this.id).style.height=this.height+"px";
  document.getElementById(this.id).style.width=this.width+"px";
  document.getElementById(this.id).style.zIndex=5;
  document.getElementById(this.id).style.overflow="hidden";
  }

function FtchCo(oZoomObject)
  {
  if(document.getElementById("imgPol")){document.getElementById("imgPol").style.visibility="hidden";parent.document.getElementById("info2Output").style.visibility='hidden';}
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  if(parent.document.getElementById('MainKeyDiv')&&gbIndvKy==true&&gnTl!=parseInt(parent.document.getElementById("info6Output").className))
  {
  switchTab('tDIV_KEY','key')
  parent.document.getElementById("info6Output").src="Key_Items/key"+gnTl+".htm";
  parent.document.getElementById("info6Output").className=gnTl
  parent.document.getElementById("info6Output").style.visibility="visible";
  parent.document.getElementById("info6Output").style.overflow="hidden"; 
  document.body.style.cursor="move";
  }
  nCEN_X=((parseInt(oZoomObject.style.left)*-1)+parseInt(document.getElementById("imHld").offsetWidth/2));
  nCEN_Y=((parseInt(oZoomObject.style.top))+parseInt((document.getElementById("imHld").offsetHeight/2)))*-1;
  nCEN_X+=128;
  nCEN_Y+=128;
  nCEN_X=Math.abs(Math.floor(nCEN_X/256));
  nCEN_Y=Math.abs(Math.floor(nCEN_Y/256));  
  for(var i=0;i<gsRngS.length;i++)
  {
  if((parseInt(nCEN_X+gsRngS[i][0])>=0&&parseInt(nCEN_Y+gsRngS[i][1])>=0))
  {
  oNewTile=new Array();
  oNewTile[i]=document.createElement("img");
  sFolder=parseFloat(parseInt((nCEN_Y+gsRngS[i][1])*gaDnumw[Z])+(parseInt(nCEN_X+gsRngS[i][0])));
  for(l=0;l<Z;l++)
  {
  sFolder+=gaDtot[l];
  } 
  sFolder="TileGroup"+Math.floor(sFolder/256.0);
  sTileRoot=gsBsTileRoot+"/"+sFolder+"/";   
  sTileId=Z+"-"+Math.abs(parseInt(nCEN_X+gsRngS[i][0]))+"-"+Math.abs(parseInt(nCEN_Y+gsRngS[i][1]));
  if(!document.getElementById(sTileId))
  {
  oNewTile[i].id=sTileId;
  oNewTile[i].style.zIndex=2;
  oNewTile[i].style.position="absolute";
  oNewTile[i].style.top=parseInt(nCEN_Y+gsRngS[i][1])*256+"px";
  oNewTile[i].style.left=parseInt(nCEN_X+gsRngS[i][0])*256+"px";
  oNewTile[i].src=sTileRoot+sTileId+".jpg";
  oNewTile[i].style.filter="alpha(opacity="+opacity+")";
  oNewTile[i].style.opacity=opacity/100;
  oNewTile[i].onerror=function(){this.src="images/blank_tile.gif";}
  document.getElementById(oZdv[Z].id).appendChild(oNewTile[i]);
  }
  }
  }
  for(var i=0;i<gsDel.length;i++)
  {
  if((parseInt(nCEN_X+gsDel[i][0])>=0&&parseInt(nCEN_Y+gsDel[i][1])>=0))
  {
  sTileId=Z+"-"+parseInt(nCEN_X+gsDel[i][0])+"-"+parseInt(nCEN_Y+gsDel[i][1]);
  var oDoc=document.getElementById(sTileId);
  if(oDoc)
  {
  oDoc.parentNode.removeChild(oDoc);
  }
  }
  }
  }

function SnpTool()
  {
  goZdivObj = document.getElementById(oZdv[Z].id)
  while(goZdivObj.childNodes.length)
  {
  sTileIdStrSeg = (goZdivObj.firstChild.id).split("-");
  goZdivObj.removeChild(goZdivObj.firstChild)
  }
  gnTby=parseInt(document.getElementById('tbar').style.top);   
  nTBY=Math.round(((parseInt(document.getElementById('ttrack').offsetHeight)-14)-gnTby)/14)+gnMaxZ;
  stp=Math.abs(Z-nTBY)
  if(Z<nTBY)
  {
  for (var i=0;i<stp;i++)
  {
  MapEvent('dragin')
  }
  }
  else if(Z>nTBY)
  {
  for (var i=0;i<stp;i++)
  {
  MapEvent('dragout')
  }
  }	
  Z=nTBY
  FtchCo(document.getElementById(oZdv[Z].id));
  OvUpd();
  if(fullMp==true){ScaIMap();}
  if (document.getElementById("vec")){RdrVec();};
  //DrSc();
  document.getElementById('tbar').style.top=document.getElementById('tsec'+Z).style.top
  }
function Ajax()
  {
  this.req=null;
  this.sUrl=null;
  this.method=null;
  this.async=null;
  this.status=null;
  this.statusText='';
  this.postData=null;
  this.readyState=null;
  this.responseText=null;
  this.responseXML=null;
  this.handleResp=null;
  this.responseFormat='text';
  this.mimeType='text';
  this.init=function()
  {
  if(!this.req)
  {
  try
  {
  // Try to create object for Firefox, Safari, IE7, etc.
  this.req=new XMLHttpRequest();
  }
  catch(e)
  {
  try
  {
  // Try to create object for later versions of IE. 
  this.req=new ActiveXObject('MSXML2.XMLHTTP');
  }
  catch(e)
  {
  try
  {
  // Try to create object for early versions of IE. 
  this.req=new ActiveXObject('Microsoft.XMLHTTP');
  }
  catch(e)
  {
  // Could not create an XMLHttpRequest object.
  return false;
  }
  }
  }
  }
  return this.req;
  };
  this.doReq=function()
  {
  if(!this.init())
  {
  alert('Could not create XMLHttpRequest object.');
  return;
  }
  this.req.open(this.method,this.sUrl,this.async);
  if(this.mimeType)
  {
  try
  {
  this.req.overrideMimeType(this.mimeType);
  }
  catch(e)
  {
  // couldn't override MIME type  --  IE6 or Opera? 
  }
  }
  var self=this; // Fix loss-of-scope in inner function
  this.req.onreadystatechange=function()
  {
  var sResp=null;
  if(self.req.readyState==4)
  {
  switch(self.responseFormat)
  {
  case 'text':
  sResp=self.req.responseText;
  break;
  case 'xml':
  sResp=self.req.responseXML;
  break;
  case 'object':
  sResp=req;
  break;
  }
  if(self.req.status>=200&&self.req.status<=299)
  {
  self.handleResp(sResp);
  }
  else
  {
  //self.handleErr(sResp); 
  }
  }
  };
  this.req.send(this.postData);
  };
  this.setMimeType=function(mimeType)
  {
  this.mimeType=mimeType;
  };
  this.setHandlerErr=function(sFuncRef)
  {
  this.handleErr=sFuncRef;
  };
  this.abort=function()
  {
  if(this.req)
  {
  this.req.onreadystatechange=function()
  {
  };
  this.req.abort();
  this.req=null;
  }
  };
  this.doGet=function(sUrl,sHand,sFormat)
  {
  this.sUrl=sUrl;
  this.handleResp=sHand;
  this.responseFormat=sFormat||'text';
  this.doReq();
  };
  }
  var Drag=
  {
  oObj: null,
  init: function(o,oRoot,nMinX,nMaxX,nMinY,nMaxY,bSwapHorzRef,bSwapVertRef,nFxmapper,nFymapper)
  {
  o.onmousedown=Drag.start;
  o.bHmode=bSwapHorzRef?false : true;
  o.bVmode=bSwapVertRef?false : true;
  o.root=oRoot&&oRoot!=null?oRoot : o;
  if(o.bHmode&&isNaN(parseInt(o.root.style.left)))
  {
  o.root.style.left="0px";
  }
  if(o.bVmode&&isNaN(parseInt(o.root.style.top)))
  {
  o.root.style.top="0px";
  }
  if(!o.bHmode&&isNaN(parseInt(o.root.style.right)))
  {
  o.root.style.right="0px";
  }
  if(!o.bVmode&&isNaN(parseInt(o.root.style.bottom)))
  {
  o.root.style.bottom="0px";
  }
  o.nMinX=typeof nMinX!='undefined'?nMinX : null;
  o.nMinY=typeof nMinY!='undefined'?nMinY : null;
  o.nMaxX=typeof nMaxX!='undefined'?nMaxX : null;
  o.nMaxY=typeof nMaxY!='undefined'?nMaxY : null;
  o.XMapper=nFxmapper?nFxmapper : null;
  o.YMapper=nFymapper?nFymapper : null;
  o.root.onDragStart=function()
  {
  if(o="rc_"&&document.body.style.cursor!="pointer"&&document.body.style.cursor!="help"&&parent.document.body.style.cursor!="help"&&parent.document.body.style.cursor!="pointer")
  {
  document.body.style.cursor="move";
  }
  };
  o.root.onDragEnd=new Function();
  o.root.onDrag=new Function();
  }
  ,
  start: function(e)
  {
  var o=Drag.oObj=this;
  s=o;
  if (s.id=="rc_"&&document.body.style.cursor=="help")
  {
  gsStCx=1+Math.abs(parseInt(document.getElementById("rc_").style.left));
  gsStCy=1+Math.abs(parseInt(document.getElementById("rc_").style.top));
  }
  e=Drag.FixE(e);
  var y=parseInt(o.bVmode?o.root.style.top : o.root.style.bottom);
  var x=parseInt(o.bHmode?o.root.style.left : o.root.style.right);
  o.root.onDragStart(x,y);
  o.nLastMouseX=e.clientX;
  o.nLastMouseY=e.clientY;
  if(o.bHmode)
  {
  if(o.nMinX!=null)
  {
  o.nMinMouseX=e.clientX-x+o.nMinX;
  }
  if(o.nMaxX!=null)
  {
  o.nMaxMouseX=o.nMinMouseX+o.nMaxX-o.nMinX;
  }
  }
  else
  {
  if(o.nMinX!=null)
  {
  o.nMaxMouseX=-o.nMinX+e.clientX+x;
  }
  if(o.nMaxX!=null)
  {
  o.nMinMouseX=-o.nMaxX+e.clientX+x;
  }
  }
  if(o.bVmode)
  {
  if(o.nMinY!=null)
  {
  o.nMinMouseY=e.clientY-y+o.nMinY;
  }
  if(o.nMaxY!=null)
  {
  o.nMaxMouseY=o.nMinMouseY+o.nMaxY-o.nMinY;
  }
  }
  else
  {
  if(o.nMinY!=null)
  {
  o.nMaxMouseY=-o.nMinY+e.clientY+y;
  }
  if(o.nMaxY!=null)
  {
  o.nMinMouseY=-o.nMaxY+e.clientY+y;
  }
  }
  document.onmousemove=Drag.Drag;
  document.onmouseup=Drag.End;
  return false;
  }
  ,
  Drag: function(e)
  {
  e=Drag.FixE(e);
  var o=Drag.oObj;
  var nEy=e.clientY;
  var nEx=e.clientX;
  var y=parseInt(o.bVmode?o.root.style.top : o.root.style.bottom);
  var x=parseInt(o.bHmode?o.root.style.left : o.root.style.right);
  var nNx,nNy;
  if(o.nMinX!=null)
  {
  nEx=o.bHmode?Math.max(nEx,o.nMinMouseX): Math.min(nEx,o.nMaxMouseX);
  }
  if(o.nMaxX!=null)
  {
  nEx=o.bHmode?Math.min(nEx,o.nMaxMouseX): Math.max(nEx,o.nMinMouseX);
  }
  if(o.nMinY!=null)
  {
  nEy=o.bVmode?Math.max(nEy,o.nMinMouseY): Math.min(nEy,o.nMaxMouseY);
  }
  if(o.nMaxY!=null)
  {
  nEy=o.bVmode?Math.min(nEy,o.nMaxMouseY): Math.max(nEy,o.nMinMouseY);
  }
  nNx=x+((nEx-o.nLastMouseX)*(o.bHmode?1 : -1));
  nNy=y+((nEy-o.nLastMouseY)*(o.bVmode?1 : -1));
  if(o.XMapper)
  nNx=o.XMapper(y);
  else if(o.YMapper)
  nNy=o.YMapper(x);
  {
  Drag.oObj.root.style[o.bHmode?"left" : "right"]=nNx+"px";
  }
  Drag.oObj.root.style[o.bVmode?"top" : "bottom"]=nNy+"px";
  Drag.oObj.nLastMouseX=nEx;
  Drag.oObj.nLastMouseY=nEy;
  Drag.oObj.root.onDrag(nNx,nNy);
  if(o.id=="rc_")
  {
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  document.getElementById("rc"+gnRnd).style.left=document.getElementById(oZdv[Z].id).style.left;
  document.getElementById("rc"+gnRnd).style.top=document.getElementById(oZdv[Z].id).style.top;  
  //if(document.getElementById('obly'))
  //{
  //document.getElementById("obly").style.left=document.getElementById("rc_").style.left;
  //document.getElementById("obly").style.top=document.getElementById("rc_").style.top;
  //}
  FtchCo(document.getElementById(oZdv[Z].id));  
  if(parent.document.getElementById('MainKeyDiv')){OvUpd();}
  }
  else if(o.id==gnTl+"rc"+gnRnd)
  {
  document.getElementById(oZdv[Z].id).style.top=document.getElementById(gnTl+"rc"+gnRnd).style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById(gnTl+"rc"+gnRnd).style.left;
  document.getElementById("rc_").style.left=document.getElementById(gnTl+"rc"+gnRnd).style.left;
  document.getElementById("rc_").style.top=document.getElementById(gnTl+"rc"+gnRnd).style.top;
  //document.getElementById("obly").style.left=document.getElementById("rc_").style.left;
  //document.getElementById("obly").style.top=document.getElementById("rc_").style.top;
  FtchCo(document.getElementById(oZdv[Z].id));
  if(parent.document.getElementById('MainKeyDiv')){OvUpd();}
  }
  if(o.id=="rc"+gnRnd)
  {
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc"+gnRnd).style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc"+gnRnd).style.left;
  document.getElementById("rc_").style.left=document.getElementById(oZdv[Z].id).style.left;
  document.getElementById("rc_").style.top=document.getElementById(oZdv[Z].id).style.top;  
  //if(document.getElementById('obly'))
  //{
  //document.getElementById("obly").style.left=document.getElementById("rc"+gnRnd).style.left;
  //document.getElementById("obly").style.top=document.getElementById("rc"+gnRnd).style.top;
  //}
  FtchCo(document.getElementById(oZdv[Z].id)); 
  if(parent.document.getElementById('MainKeyDiv')){OvUpd();}
  }
  else if(o.id==gnTl+"rc"+gnRnd)
  {
  document.getElementById(oZdv[Z].id).style.top=document.getElementById(gnTl+"rc"+gnRnd).style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById(gnTl+"rc"+gnRnd).style.left;
  document.getElementById("rc_").style.left=document.getElementById(gnTl+"rc"+gnRnd).style.left;
  document.getElementById("rc_").style.top=document.getElementById(gnTl+"rc"+gnRnd).style.top;
  //document.getElementById("obly").style.left=document.getElementById("rc"+gnRnd).style.left;
  //document.getElementById("obly").style.top=document.getElementById("rc"+gnRnd).style.top;
  FtchCo(document.getElementById(oZdv[Z].id));
  if(parent.document.getElementById('MainKeyDiv')){OvUpd();}
  }     
  if(document.getElementById("vec"))
  {
  document.getElementById("vec").style.left=document.getElementById("rc_").style.left;
  document.getElementById("vec").style.top=document.getElementById("rc_").style.top;
  document.getElementById("vecSh").style.left = parseInt(document.getElementById("rc_").style.left)+(shadOffset*Z)+"px";
  document.getElementById("vecSh").style.top = parseInt(document.getElementById("rc_").style.top)+(shadOffset*Z)+"px" 
  }   
  document.getElementById("ovBx").style.left=parseInt(document.getElementById("ovCrs").style.left)-(parseInt(document.getElementById("ovBx").offsetWidth)/2)+(parseInt(document.getElementById("ovCrs").offsetWidth)/2)+"px";
  document.getElementById("ovBx").style.top=parseInt(document.getElementById("ovCrs").style.top)-(parseInt(document.getElementById("ovBx").offsetHeight)/2)+(parseInt(document.getElementById("ovCrs").offsetHeight)/2)+"px";
  return false;
  }
  ,
  End: function()
  {
  //document.body.style.cursor="sUrl('images/hand_open.cur')"
  document.onmousemove=null;
  document.onmouseup=null;
  document.onmousedown=null;
  Drag.oObj.root.onDragEnd(parseInt(Drag.oObj.root.style[Drag.oObj.bHmode?"left" : "right"]),parseInt(Drag.oObj.root.style[Drag.oObj.bVmode?"top" : "bottom"]));
  if(Drag.oObj.id == 'tbar')
  {
  SnpTool();
  }
  if(Drag.oObj.id=="ovCrs")
  {
  MapEvent('overpan');
  } 
  Drag.oObj=null;
  }
  ,  
  FixE: function(e)
  {
  if(typeof e=='undefined')
  {
  e=window.event;
  }
  if(typeof e.layerX=='undefined')
  {
  e.layerX=e.offsetX;
  }
  if(typeof e.layerY=='undefined')
  {
  e.layerY=e.offsetY;
  }
  return e;
  }
  }

function ScaIMap()
  {
  document.getElementById("rc_").style.width=oZdv[Z].width+"px";
  document.getElementById("rc_").style.height=oZdv[Z].height+"px";
  if(parseInt(document.getElementById("rc_").style.left) > 0)
  {
  document.getElementById("rc_").style.left = 0+"px"
  }
  if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top = 0-document.getElementById("imHld").offsetHeight + "px"
  }
  if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
  }
  if (parseInt(oZdv[Z].width)<parseInt(document.getElementById("imHld").style.width)&&parseInt(oZdv[Z].height)>parseInt(document.getElementById("imHld").style.height))
  {
  Drag.init(document.getElementById("rc_"),null,(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2),(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2),(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
  document.getElementById("rc_").style.left=(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2)+"px"
  }  
  else if (oZdv[Z].height<parseInt(document.getElementById("imHld").style.height)&&oZdv[Z].width>parseInt(document.getElementById("imHld").style.width))
  {
  Drag.init(document.getElementById("rc_"),null,((gaDzw[Z] *  - 1)) + document.getElementById("imHld").offsetWidth,0,0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2),0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2))
  document.getElementById("rc_").style.top=0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2)+"px"
  }
  else if (oZdv[Z].height<parseInt(document.getElementById("imHld").style.height)&&oZdv[Z].width<parseInt(document.getElementById("imHld").style.width))
  {
  Drag.init(document.getElementById("rc_"),null,(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2),(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2),0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2),0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2));
  document.getElementById("rc_").style.left=(parseInt(document.getElementById("imHld").style.width)/2)-(oZdv[Z].width/2)+"px"
  document.getElementById("rc_").style.top=0-(parseInt(document.getElementById("imHld").style.height)/2)-(oZdv[Z].height/2)+"px"
  }
  else
  {
  Drag.init(document.getElementById("rc_"),null,((gaDzw[Z] *  - 1)) + document.getElementById("imHld").offsetWidth,0,(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
  Drag.init(document.getElementById("rc"+gnRnd),null,((gaDzw[Z] *  - 1)) + document.getElementById("imHld").offsetWidth,0,(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
  }
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  var oGetVec=new Ajax();
  oGetVec.method='GET';
  oGetVec.async=true;
  oGetVec.doGet(gsRoot+gsImap+"?p="+oZdv[Z].nRvScaFa+","+oZdv[Z].height+","+gsImapDb+","+gsExL+","+gsExB,parseScaIMap); 
  }
  
function parseScaIMap(sResult)
  {
  sResult=sResult.replace(/#/g,"<area shape='polygon' coords='")
  sResult=sResult.replace(/@/g," Click for route information")
  sResult=sResult.replace(/~/g," onmousedown='CMp(this.className)'")
  sResult=sResult.replace(/vd/g," href='javascript:void(0)")
  goObj = document.getElementById("rc" + gnRnd);
  if(goObj)
  {
  while(goObj.childNodes.length)
  {
  goObj.removeChild(goObj.firstChild);
  }
  }
  goObj = document.getElementById("ctrl");
  oMapObj = document.createElement("map");
  gnRnd = Math.random() * 5;
  oMapObj.id = "rc" + gnRnd;
  oMapObj.name = "rc" + gnRnd;
  goObj.appendChild(oMapObj);
  oMapObj = document.getElementById("rc" + gnRnd);   
  document.getElementById("rc" + gnRnd).innerHTML=sResult
  document.getElementById("rc_").useMap = "#rc" + gnRnd;
  document.getElementById("rc" + gnRnd).onmouseover=function()
  {
  document.body.style.cursor = "pointer";
  }
  document.getElementById("rc" + gnRnd).onmouseout=function(){document.body.style.cursor = "move";}   
  document.getElementById("rc" + gnRnd).onmouseup = FeCoord;
  document.getElementById("wMk").style.left=0+((document.getElementById("imHld").offsetWidth)/2)-((document.getElementById("wMkIm").offsetWidth)/2)+"px";
  document.getElementById("wMk").style.top=0-(document.getElementById("imHld").offsetHeight)/2-((document.getElementById("wMkIm").offsetHeight)/2)+"px";
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  document.getElementById("rc"+gnRnd).style.left=document.getElementById(oZdv[Z].id).style.left;
  document.getElementById("rc"+gnRnd).style.top=document.getElementById(oZdv[Z].id).style.top; 
  document.getElementById('rc_').onmouseup=FeCoord;
  document.getElementById("rc" + gnRnd).onmouseover=function(){if(document.body.style.cursor!="help"){document.body.style.cursor = "pointer";};};
  document.getElementById("rc" + gnRnd).onmouseout=function(){if(document.body.style.cursor!="help"){document.body.style.cursor = "move";}; };
  document.getElementById("wMk").style.left=0+((document.getElementById("imHld").offsetWidth)/2)-((document.getElementById("wMkIm").offsetWidth)/2)+"px";
  document.getElementById("wMk").style.top=0-(document.getElementById("imHld").offsetHeight)/2-((document.getElementById("wMkIm").offsetHeight)/2)+"px"; 
  }

function CMp(id)
  {
  idIndv=id.split(";")
  if(idIndv[2]=="Route"||idIndv[2]=="Map")
  {
  gsClickID=id
  gsStCx=1+Math.abs(parseInt(document.getElementById("rc_").style.left));
  gsStCy=1+Math.abs(parseInt(document.getElementById("rc_").style.top));
  }
  };

function ParseData(gaResult)
  {
  gaResult = gaResult.split(';');	
  switch(gaResult[2])
  {    
  case 'Route':  
  switchTab('tDIV_ROUTEINFO','key')
  if(gaResult[0] != "" && gaResult[0] != oZdv[Z].route[0][0])
  { 	  
  if(typeOfMap=='vector' && gaResult[3]!='' && gaResult[3]!='no')
  {
  gbRDrvc=true;
  if (gaResult[1]!='')
  {
  sStrCl="#"+gaResult[1];
  }else{
  sStrCl = fxsStrCl
  }
  var oVroute = new Ajax();
  oVroute.method = 'GET';
  oVroute.responseFormat = 'text';
  oVroute.async = true;
  oVroute.doGet(gsRoot+"Route.asp?p=" + oZdv[gnMinZ].nRvScaFa + "," + oZdv[gnMinZ].height + "," + gaResult[0] +","+gsRouteDb+","+gsExL+","+gsExB,ParseFetchVml);
  gsActvRt=(gaResult[0]);  	  
  var tileChild= document.getElementById(oZdv[Z].id).childNodes;
  opacity=50  
  for(var i=0; i<document.getElementById(oZdv[Z].id).childNodes.length; i++)
  {
  tileChild[i].style.opacity=opacity/100
  tileChild[i].style.filter="alpha(opacity="+opacity+")";
  }  
  }else if (typeOfMap=='raster' && gaResult[3]!='' && gaResult[3]!='no')
  {
  oZdivObj = document.getElementById(oZdv[Z].id)
  while(oZdivObj.childNodes.length)
  {
  oZdivObj.removeChild(oZdivObj.firstChild)
  }
   gsActvRt=(gaResult[0]);
  //gsBsTileRoot=gsRouteRoot+(rtDir.replace(" (limited service)",""))
  gsBsTileRoot=gsTileRoot+gaResult[0].replace("/","_")

 
  }
  sRlist = new Ajax();
  sRlist.method = 'GET';
  sRlist.responseFormat = 'text';
  sRlist.async = true;
  sRlist.doGet(gsRoot+gsRtInf+"?p="+gsRtDb+","+gaResult[0],AddRteInf);  
  }  
  break;
   
  case 'Map':
  parent.document.getElementById("MainIframe").src=gsRoot+(removeSpaces(gaResult[0]))+"/"+(removeSpaces(gaResult[0]))+".htm"  
  break;
  default:
  break;
  }   	
  }
 
   
 function RemRteInf()  
   { 
   opacity=100
   actRoute="";
   gbRDrvc=false;   
   if (typeOfMap=="vector")
   {
   if (document.getElementById("vec"))
   {
   oObj = document.getElementById("vec")
   oObj.parentNode.removeChild(oObj)
   oObj = document.getElementById("vecSh")
   oObj.parentNode.removeChild(oObj)
   var tileChild= document.getElementById(oZdv[Z].id).childNodes
   for(var i=0; i<document.getElementById(oZdv[Z].id).childNodes.length; i++)
   {
   tileChild[i].style.opacity=opacity/100;
   tileChild[i].style.filter="alpha(opacity"+opacity+")";
   }  
   }
   if (parent.document.getElementById("RInfo"))
   {
   oObj = parent.document.getElementById("RInfo")
   oObj.parentNode.removeChild(oObj)    
   }
   }
   else if (typeOfMap=="raster")
   {
   oZdivObj = document.getElementById(oZdv[Z].id)
   while(oZdivObj.childNodes.length)
   {
   oZdivObj.removeChild(oZdivObj.firstChild)
   }  
   gsBsTileRoot = gsTileRoot+"Base"+"/"
   setTimeout( "FtchCo(document.getElementById(oZdv[Z].id));", 200);
   }
   parent.document.getElementById('info5Output').innerHTML = rteMsg
   }
   

function AddRteInf(sResult)
  {
  parent.document.getElementById('info5Output').innerHTML = sResult;
  parent.document.getElementById('remRoute').onclick=function(){RemRteInf();}
  if(typeOfMap=="raster"){setTimeout( "FtchCo(document.getElementById(oZdv[Z].id));", 200);}  
  }

function changeTab()
  {
  document.getElementById(oZdv[Z].id).style.visibility = 'hidden';
  goZdivObj = document.getElementById(oZdv[Z].id)
  while(goZdivObj.childNodes.length)
  {
  goZdivObj.removeChild(goZdivObj.firstChild)
  }
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';   
  gnTl=parseInt(idIndv[0])
  MapEvent('rte')
  setTimeout( "FtchCo(document.getElementById(oZdv[Z].id));", 200);  
  ScaIMap();
  }

function ParseTabInf(sResult)
  {
  gnTl=parseInt(sResult)
  PostGoParse(coords[0]+","+coords[1]+";"+"")
  }

function parseGoInf(sResult)
  {
  sResult=sResult.split(",");
  AddressGo(sResult[0].substr(0,6)+","+sResult[1].substr(0,6)+";"+""); 
  if (document.getElementById("vec")){RdrVec();};
  }

function ObFtch()
  {
  //if(document.getElementById("obLy"))
  //{
  //while(document.getElementById("obly").childNodes.length)
  //{
  //document.getElementById("obly").removeChild(document.getElementById("obly").firstChild);
  //}
  //}
  //var oGetVec=new Ajax();
  //oGetVec.method='GET';
  //oGetVec.async=true;
  //oGetVec.doGet(gsRoot+"GetOB.asp?p="+oZdv[Z].nRvScaFa+","+oZdv[Z].height+","+gsExL+","+gsExB+","+gsObDb,ParseFetchOB);
  } 

function ParseFetchOB(sOb)
  {
  document.getElementById("obly").style.zIndex="100"
  gaOb=sOb.split(";")
  for (o=0;o<gaOb.length-1;o++)
  { 
  gaObSp=gaOb[o].split(":") 
  if(gaObSp[1]!="")
  {
  gaObCoordsSp=gaObSp[1].split(" ") 
  oNewOb=document.createElement("IMG");
  oNewOb.id=gaObSp[2]
  oNewOb.style.zIndex="100";
  oNewOb.style.filter="alpha(opacity=60)" 
  oNewOb.style.position="absolute";
  oNewOb.style.top=gaObCoordsSp[1]+"px";
  oNewOb.style.left=gaObCoordsSp[0]+"px";
  oNewOb.title="Proposal "+gaObSp[0]+" - "+"Click for specific information about this site"
  oNewOb.onmouseover=function(){if(document.body.style.cursor!="help"){document.body.style.cursor="pointer";};}
  oNewOb.onmouseout=function(){if(document.body.style.cursor!="help"){document.body.style.cursor="move";};}  
  oNewOb.onclick=function(){lhPage(wsRoot+this.id);}
  if (Z<obToBg)
  {
  oNewOb.src=gsRoot+"images/"+gaObSp[3]+"_sm.gif"
  }
  else
  {
  oNewOb.src=gsRoot+"images/"+gaObSp[3]+".gif"
  }
  document.getElementById("obly").appendChild(oNewOb)
  }
  }
  //document.getElementById("obly").style.top=document.getElementById("rc_").style.top
  //document.getElementById("obly").style.left=document.getElementById("rc_").style.left
  //document.getElementById("obly").style.visibility="visible"
  }

function lhPage(lhUrl)
  {
  if (lhWin && !lhWin.closed && lhWin.focus){
  lhWin.location.href=lhUrl
  lhWin.focus();
  }else {
  lhWin = window.open(lhUrl,"","resizable=1,height=600,width=800,MainKeyDivbar=1,menubar=1,scrollbars=1,titlebar=1,toolbar=1,location=1");
  }
  }

function ParseFtchVMLZoom(sResult)
  {
  var asCoords=sResult.split(",");
  var nGotoX=(parseInt(asCoords[0])+parseInt(asCoords[2]))/2;
  var nGotoY=(parseInt(asCoords[1])+parseInt(asCoords[3]))/2;
  var nGotoWd=parseInt(asCoords[2])-parseInt(asCoords[0])+25
  var nGotoHt=parseInt(asCoords[3])-parseInt(asCoords[1])+25
  nToZoom=gnMaxZ;  
  for(z=gnMinZ;z>gnMaxZ;z--)
  {
  if((nGotoWd<document.getElementById("map").offsetWidth*oZdv[z].nScaFa)&&(nGotoHt<document.getElementById("map").offsetHeight*oZdv[z].nScaFa))
  {
  nToZoom=z;
  break;
  }
  }
  AddressGo(nGotoX+","+nGotoY+":")  
  };

function ParseFetchGoZoom(sResult)
  {
  spResult=sResult.split(":") 
  var asCoords=spResult[0].split(",");
  var nGotoX=(parseInt(asCoords[0])+parseInt(asCoords[2]))/2;
  var nGotoY=(parseInt(asCoords[1])+parseInt(asCoords[3]))/2;
  var nGotoWd=parseInt(asCoords[2])-parseInt(asCoords[0])+10;
  var nGotoHt=parseInt(asCoords[3])-parseInt(asCoords[1])+10;
  nToZoom=gnMaxZ;
  for(z=gnMinZ;z>gnMaxZ;z--)
  {
  if((nGotoWd<document.getElementById("map").offsetWidth*oZdv[z].nScaFa)&&(nGotoHt<document.getElementById("map").offsetHeight*oZdv[z].nScaFa))
  {
  nToZoom=z;
  break;
  }
  }
  //FetchPosGoto(nGotoX+","+nGotoY+";");
  AddressGo(nGotoX+","+nGotoY+":"+spResult[1]); 
  };

function ParseFetchVml(gaResult)
  {
  asVecDiv = gaResult.split("|");
  for(var o = 0;o < asVecDiv.length;o++)
  {
  asCoordVectorDiv = asVecDiv[o].split(",");
  nHalfDiv = 1;
  for(var Z = gnMinZ;Z >  - 1;Z--)
  {
  oZdv[Z].route[0][o + 2] = "";
  for(var i = 0;i < asCoordVectorDiv.length;i++)
  {
  oZdv[Z].route[0][o + 1] += parseInt(asCoordVectorDiv[i]/nHalfDiv) + ",";
  }
  oZdv[0].route[0][0] = asVecDiv[0].substr(0,(asVecDiv[0].length-1));
  nHalfDiv *= 2
  }
  gnVecLen = asVecDiv.length + 1
  }
  RdrVec()
  }
 
function RdrVec()
  {
  if(gbRDrvc==true)
  {
  oPolyline = new Array();
  oStroke = new Array();
  oShadow = new Array();
  oshStroke = new Array();
  if(document.getElementById("vec"))
  {
  goObj = document.getElementById("vec");
  goObj.parentNode.removeChild(goObj)   
  }
  if(document.getElementById("vecSh"))
  {
  goObj = document.getElementById("vecSh");
  goObj.parentNode.removeChild(goObj)   
  }  
  oNewVec = document.createElement("DIV");
  oNewVec.id = "vec";
  oNewVec.style.zIndex = 2;
  oNewVec.style.position = "absolute";
  oNewVec.style.bottom = "50px";
  oNewVec.style.left = "0px";
  oNewVecSh = document.createElement("DIV");
  oNewVecSh.id = "vecSh";
  oNewVecSh.style.zIndex = 1;
  oNewVecSh.style.position = "absolute";
  oNewVecSh.style.bottom = "50px";
  oNewVecSh.style.left = "0px";  
  goObj = document.getElementById("ctrl");
  goObj.appendChild(oNewVec)
  goObj.appendChild(oNewVecSh)
  if(browser != "nonIE")
  {
  oVml = document.getElementById("vec") 
  oVmlsh = document.getElementById("vecSh") 
  for(var i = 1;i < gnVecLen;i++)
  {
  oPolyline[i] = document.createElement("v:Polyline");
  oPolyline[i].id = "idVec" + i;
  oPolyline[i].points = oZdv[Z].route[0][i];
  oPolyline[i].strokecolor = sStrCl;
  oPolyline[i].strokeweight = gaLiWt[Z] + "px";
  oPolyline[i].filled = "false";
  oShadow[i] = document.createElement("v:Polyline");
  oShadow[i].id = "idVecSh" + i;
  oShadow[i].points = oZdv[Z].route[0][i];
  oShadow[i].strokecolor = sStrCl;
  oShadow[i].strokeweight = gaLiWt[Z] + "px";
  oShadow[i].filled = "false";
  oStroke[i] = document.createElement("v:stroke");
  oStroke[i].opacity = "1";
  oStroke[i].endcap = "round";
  oshStroke[i] = document.createElement("v:stroke");
  oshStroke[i].opacity = "1";
  oshStroke[i].endcap = "round";
  oVml.appendChild(oPolyline[i]);
  //oVmlsh.appendChild(oShadow[i]);
  oPolyline[i].appendChild(oStroke[i])
  oShadow[i].appendChild(oshStroke[i])
  } 
  }
  else
  {  
  svgVec = document.createElementNS('http://www.w3.org/2000/svg','svg');
  svgVec.setAttribute('width','400000'); //is needed
  svgVec.setAttribute('height','400000'); //is needed
  svgVec.setAttribute('viewBox','0 0 400000 400000'); //is needed
  svgVec.setAttribute('id','svgVec') 
  svgSh = document.createElementNS('http://www.w3.org/2000/svg','svg');
  svgSh.setAttribute('width','400000'); //is needed
  svgSh.setAttribute('height','400000'); //is needed
  svgSh.setAttribute('viewBox','0 0 400000 400000'); //is needed

  for(var i = 2;i < gnVecLen-1;i++)
  {
  oPolyline[i] = document.createElementNS('http://www.w3.org/2000/svg','polyline');
  oPolyline[i].id = "idVec" + i;
  oPolyline[i].setAttribute("points",oZdv[Z].route[0][i].substr(0,oZdv[Z].route[0][i].length-1)); 
  oPolyline[i].setAttribute("stroke",sStrCl);
  oPolyline[i].setAttribute("stroke-width",gaLiWt[Z] + "px");
  oPolyline[i].setAttribute("fill","none");
  oPolyline[i].setAttribute("stroke-opacity","1");
  oPolyline[i].setAttribute("stroke-linecap","round");
  oPolyline[i].setAttribute("stroke-linejoin","round");
  oShadow[i] = document.createElementNS('http://www.w3.org/2000/svg','polyline');
  oShadow[i].id = "idVec" + i;
  oShadow[i].setAttribute("points",oZdv[Z].route[0][i].substr(0,oZdv[Z].route[0][i].length-1));
  oShadow[i].setAttribute("stroke",sStrCl);
  oShadow[i].setAttribute("stroke-width",gaLiWt[Z] + "px");
  oShadow[i].setAttribute("fill","none");
  oShadow[i].setAttribute("stroke-opacity","1");
  oShadow[i].setAttribute("stroke-linecap","round");
  oShadow[i].setAttribute("stroke-linejoin","round");   
  svgVec.appendChild(oPolyline[i]);
  svgSh.appendChild(oShadow[i]);
  }
  document.getElementById("vec").appendChild(svgVec) 
  document.getElementById("vecSh").appendChild(svgSh)
  }
  document.getElementById("vec").style.left = document.getElementById("rc_").style.left;
  document.getElementById("vec").style.top = document.getElementById("rc_").style.top 
  document.getElementById("vecSh").style.left = parseInt(document.getElementById("rc_").style.left)+(shadOffset*Z)+"px";
  document.getElementById("vecSh").style.top = parseInt(document.getElementById("rc_").style.top)+(shadOffset*Z)+"px" 
  }
  }

function OvUpd()
  {
  if(Z > gnCz-1)
  {
  document.getElementById("ovCrsImg").src = 'images/OverviewCross.gif'
  }
  else
  {
  document.getElementById("ovCrsImg").src = 'images/OverviewCross_Blank.gif';
  };
  document.getElementById("ovBx").style.width = document.getElementById("map").offsetWidth * oZdv[Z].nScaOvFa + "px";
  document.getElementById("ovBx").style.height = document.getElementById("map").offsetHeight * oZdv[Z].nScaOvFa + "px";
  document.getElementById("ovBx").style.left = (((parseInt(document.getElementById(oZdv[Z].id).style.left) *  - 1) - parseInt(document.getElementById("imHld").offsetWidth)/2) * oZdv[Z].nScaOvFa) + document.getElementById("map").offsetWidth/2 * oZdv[Z].nScaOvFa + "px";
  document.getElementById("ovBx").style.top = (((parseInt(document.getElementById(oZdv[Z].id).style.top) *  - 1) - parseInt(document.getElementById("imHld").offsetHeight)/2) * oZdv[Z].nScaOvFa) - document.getElementById("map").offsetHeight/2 * oZdv[Z].nScaOvFa + "px";
  document.getElementById("ovCrs").style.left = parseInt(document.getElementById("ovBx").style.left) - (parseInt(document.getElementById("ovCrs").offsetWidth)/2) + (parseInt(document.getElementById("ovBx").offsetWidth)/2)+ "px";;
  document.getElementById("ovCrs").style.top = parseInt(document.getElementById("ovBx").style.top) - (parseInt(document.getElementById("ovCrs").offsetHeight)/2) + (parseInt(document.getElementById("ovBx").offsetHeight)/2)+ "px";;
  if(parseInt(document.getElementById("ovBx").style.left) < 1)
  {
  document.getElementById("ovBx").style.left = "0px";
  }
  if(parseInt(document.getElementById("ovBx").style.top) < 1)
  {
  document.getElementById("ovBx").style.top = "0px";
  }
  if(parseInt(document.getElementById("ovBx").style.left) > document.getElementById("ov").offsetWidth - document.getElementById("ovBx").offsetWidth)
  {
  document.getElementById("ovBx").style.left = document.getElementById("ov").offsetWidth - document.getElementById("ovBx").offsetWidth + "px";
  }
  if(parseInt(document.getElementById("ovBx").style.top) > document.getElementById("ov").offsetHeight - document.getElementById("ovBx").offsetHeight)
  {
  document.getElementById("ovBx").style.top = document.getElementById("ov").offsetHeight - document.getElementById("ovBx").offsetHeight + "px";
  }  
  if (parseInt(document.getElementById("ovBx").style.width) > document.getElementById("ov").offsetWidth&&parseInt(document.getElementById("ovBx").style.height) > document.getElementById("ov").offsetHeight)
  {
  document.getElementById("ovBx").style.visibility = "hidden";
  }
  else
  {
  document.getElementById("ovBx").style.visibility = "visible";
  }  
  Drag.init(document.getElementById("ovCrs"),null,((document.getElementById("ovCrs").offsetWidth)/2 *  - 1) + ((document.getElementById("ovBx").offsetWidth)/2),(((document.getElementById("ovCrs").offsetWidth)/2 *  - 1) + ((document.getElementById("ovBx").offsetWidth)/2)) + ((document.getElementById("ov").offsetWidth) - (document.getElementById("ovBx").offsetWidth)),((document.getElementById("ovCrs").offsetHeight) *  - 1) + ((document.getElementById("ovCrs").offsetHeight)/2) + ((document.getElementById("ovBx").offsetHeight)/2),((document.getElementById("ovCrs").offsetHeight) *  - 1) + ((document.getElementById("ovCrs").offsetHeight)/2) + ((document.getElementById("ovBx").offsetHeight)/2) + ((document.getElementById("ov").offsetHeight) - (document.getElementById("ovBx").offsetHeight)));
  } 
  Math.Sqr=function(x)
  {
  return x*x;
  };

function ClrZoom()
  {
  if(parent.document.getElementById('MainKeyDiv')){OvUpd();}
  if(window.oBeginZoom)
  {
  clearInterval(oBeginZoom);
  }
  }

function ZoomStep(gnXinc,gnYinc)
  {
  if(parseInt(document.getElementById("ovBx").style.left)<3&&gnXinc>0)
  {
  ClrZoom();
  gnXinc=0;
  }
  if(parseInt(document.getElementById("ovBx").style.top)<3&&gnYinc>0)
  {
  document.getElementById("ovBx").style.top=0;
  ClrZoom();
  gnYinc=0;
  }
  if(parseInt(document.getElementById("ovBx").style.left)>(document.getElementById("ov").offsetWidth-document.getElementById("ovBx").offsetWidth)-2&&gnXinc<0)
  {
  document.getElementById("ovBx").style.left=document.getElementById("ov").offsetWidth-document.getElementById("ovBx").offsetWidth+"px";
  gnXinc=0;
  ClrZoom();
  }
  if(parseInt(document.getElementById("ovBx").style.top)>(document.getElementById("ov").offsetHeight-document.getElementById("ovBx").offsetHeight)-2&&gnYinc<0)
  {
  document.getElementById("ovBx").style.top=document.getElementById("ov").offsetHeight-document.getElementById("ovBx").offsetHeight+"px";
  ClrZoom();
  gnYinc=0;
  }
  document.getElementById("rc_").style.top=(parseInt(document.getElementById(oZdv[Z].id).style.top)+gnYinc)+"px";
  document.getElementById("rc_").style.left=(parseInt(document.getElementById(oZdv[Z].id).style.left)+gnXinc)+"px";
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  document.getElementById("rc"+gnRnd).style.left=document.getElementById(oZdv[Z].id).style.left;
  document.getElementById("rc"+gnRnd).style.top=document.getElementById(oZdv[Z].id).style.top;  
  //document.getElementById("obLy").style.left=document.getElementById("rc_").style.left;
  //document.getElementById("obLy").style.top=document.getElementById("rc_").style.top;
  if(document.getElementById("vec"))
  {
  document.getElementById("vec").style.left=document.getElementById("rc_").style.left;
  document.getElementById("vec").style.top=document.getElementById("rc_").style.top;
  document.getElementById("vecSh").style.left = parseInt(document.getElementById("rc_").style.left)+(shadOffset*Z)+"px";
  document.getElementById("vecSh").style.top = parseInt(document.getElementById("rc_").style.top)+(shadOffset*Z)+"px" 
  }
  FtchCo(document.getElementById(oZdv[Z].id));
  document.getElementById("ovBx").style.left=(((parseInt(document.getElementById(oZdv[Z].id).style.left)*-1)-parseInt(document.getElementById("imHld").offsetWidth)/2)*oZdv[Z].nScaOvFa)+document.getElementById("map").offsetWidth/2*oZdv[Z].nScaOvFa+"px";
  document.getElementById("ovBx").style.top=(((parseInt(document.getElementById(oZdv[Z].id).style.top)*-1)-parseInt(document.getElementById("imHld").offsetHeight)/2)*oZdv[Z].nScaOvFa)-document.getElementById("map").offsetHeight/2*oZdv[Z].nScaOvFa+"px";
  document.getElementById('ovCrs').style.top=parseInt(document.getElementById("ovBx").style.top)-(document.getElementById('ovCrs').offsetHeight/2)+(document.getElementById('ovBx').offsetHeight/2)+"px";
  document.getElementById('ovCrs').style.left=parseInt(document.getElementById("ovBx").style.left)-(document.getElementById('ovCrs').offsetWidth/2)+(document.getElementById('ovBx').offsetWidth/2)+"px";
  if(count>=nTmp)
  {
  ClrZoom();
  }
  count++;   
  };

function FeCoord(e)
  {
  if(document.body.style.cursor!="move")
  {
  if(typeof e=='undefined')
  {
  nWx=event.offsetX;
  nWy=event.offsetY;
  }
  else
  {
  nWx=GetOffsets(e).offsetX;
  nWy=GetOffsets(e).offsetY;
  }
  {
  if(Math.sqrt((Math.Sqr(Math.abs(parseInt(document.getElementById("rc_").style.left))-gsStCx)+(Math.Sqr(Math.abs(parseInt(document.getElementById("rc_").style.top))-gsStCy))))<50)
  {
  ParseData(gsClickID)
  gsClickID='';
  }
  }
  }
  };

function GetOffsets(eEvt)
  {
  var target=document.getElementById("rc_");
  if(typeof target.offsetLeft=='undefined')
  {
  target=target.parentNode;
  }
  var nPageCoords=GetPageCoords(target);
  var nEventCoords=
  {
  x: window.pageXOffset+eEvt.clientX,y: window.pageYOffset+eEvt.clientY
  };
  var Offsets=
  {
  offsetX: nEventCoords.x-nPageCoords.x,offsetY: nEventCoords.y-nPageCoords.y
  }
  return Offsets;
  }

function GetPageCoords(element)
  {
  var nCoords=
  {
  x: 0,y: 0
  };
  while(element.offsetParent)
  {
  nCoords.x+=element.offsetLeft;
  nCoords.y+=element.offsetTop;
  element=element.offsetParent;
  }
  return nCoords;
  };

function MapEvent(sPointerMode,sAdSeVal)
  {
  switch(sPointerMode)
  {
  case 'dragin':
  if(Z < gnMinZ)
  {
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  Z++;
  document.getElementById(oZdv[Z - 1].id).style.visibility = 'hidden';
  goZdivObj = document.getElementById(oZdv[Z - 1].id)
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById("rc_").style.top = parseInt(document.getElementById(oZdv[Z - 1].id).style.top) * 2+document.getElementById("imHld").offsetHeight/2+"px";
  document.getElementById("rc_").style.left = parseInt(document.getElementById(oZdv[Z - 1].id).style.left) * 2-document.getElementById("imHld").offsetWidth/2+"px";
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  if(oZdv[Z].width > document.getElementById("imHld").offsetWidth)
  {
  if(parseInt(document.getElementById("rc_").style.left) < ((gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth))
  {
  document.getElementById("rc_").style.left = (gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth + "px"
  }
  if(parseInt(document.getElementById("rc_").style.left) > 0)
  {
  document.getElementById("rc_").style.left = 0+"px"
  }
  if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top = 0-(document.getElementById("imHld").offsetHeight) + "px"
  }
  if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
  }
  }
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width = document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height = document.getElementById("rc_").style.height;
  }
  break;
  
  case 'dragout':
  if(Z > gnMaxZ)
  {
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  Z--;
  document.getElementById(oZdv[Z + 1].id).style.visibility = 'hidden'
  goZdivObj = document.getElementById(oZdv[Z + 1].id)
  document.getElementById("rc_").style.top = parseInt(document.getElementById(oZdv[Z + 1].id).style.top)/2-parseInt(document.getElementById("imHld").offsetHeight/4) + "px";
  document.getElementById("rc_").style.left = parseInt(document.getElementById(oZdv[Z + 1].id).style.left)/2+parseInt(document.getElementById("imHld").offsetWidth/4) + "px";
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  if(oZdv[Z].width > document.getElementById("imHld").offsetWidth)
  {
  if(parseInt(document.getElementById("rc_").style.left) < ((gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth))
  {
  document.getElementById("rc_").style.left = (gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth + "px"
  }
  if(parseInt(document.getElementById("rc_").style.left) > 0)
  {
  document.getElementById("rc_").style.left = 0+"px"
  }
  if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top = 0-document.getElementById("imHld").offsetHeight + "px"
  }
  if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
  }
  }
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width = document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height = document.getElementById("rc_").style.height;
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  }
  break;
   
  case 'zoomin':
  if(Z < gnMinZ)
  {
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  Z++;
  document.getElementById(oZdv[Z - 1].id).style.visibility = 'hidden';
  goZdivObj = document.getElementById(oZdv[Z - 1].id)
  while(goZdivObj.childNodes.length)
  {
  goZdivObj.removeChild(goZdivObj.firstChild)
  } 
  document.getElementById("rc_").style.top = parseInt(document.getElementById(oZdv[Z - 1].id).style.top) * 2+document.getElementById("imHld").offsetHeight/2+"px";
  document.getElementById("rc_").style.left = parseInt(document.getElementById(oZdv[Z - 1].id).style.left) * 2-document.getElementById("imHld").offsetWidth/2+"px";
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  if(oZdv[Z].width > document.getElementById("imHld").offsetWidth)
  {
  if(parseInt(document.getElementById("rc_").style.left) < ((gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth))
  {
  document.getElementById("rc_").style.left = (gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth + "px"
  }
  if(parseInt(document.getElementById("rc_").style.left) > 0)
  {
  document.getElementById("rc_").style.left = 0+"px"
  }
  if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top = 0-(document.getElementById("imHld").offsetHeight) + "px"
  }
  if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
  }
  }
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width = document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height = document.getElementById("rc_").style.height;   
  document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top
  //if(document.getElementById("obly")){document.getElementById("obly").style.visibility="hidden";}
  FtchCo(document.getElementById(oZdv[Z].id));
  OvUpd();
  if(fullMp==true){ScaIMap();}
  if (document.getElementById("vec")){RdrVec();};
  ObFtch(); 
  }
  break;
 
  case 'zoomout':
  if(Z > gnMaxZ)
  {
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  Z--;
  document.getElementById(oZdv[Z + 1].id).style.visibility = 'hidden'
  goZdivObj = document.getElementById(oZdv[Z + 1].id)
  while(goZdivObj.childNodes.length)
  {
  goZdivObj.removeChild(goZdivObj.firstChild)
  }
  document.getElementById("rc_").style.top = parseInt(document.getElementById(oZdv[Z + 1].id).style.top)/2-parseInt(document.getElementById("imHld").offsetHeight/4) + "px";
  document.getElementById("rc_").style.left = parseInt(document.getElementById(oZdv[Z + 1].id).style.left)/2+parseInt(document.getElementById("imHld").offsetWidth/4) + "px";
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  if(oZdv[Z].width > document.getElementById("imHld").offsetWidth)
  {
  if(parseInt(document.getElementById("rc_").style.left) < ((gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth))
  {
  document.getElementById("rc_").style.left = (gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth + "px"
  }
  if(parseInt(document.getElementById("rc_").style.left) > 0)
  {
  document.getElementById("rc_").style.left = 0+"px"
  }
  if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top = 0-document.getElementById("imHld").offsetHeight + "px"
  }
  if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
  }
  }
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width = document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height = document.getElementById("rc_").style.height;
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top  
  //if(document.getElementById("obly")){document.getElementById("obly").style.visibility="hidden";}
  FtchCo(document.getElementById(oZdv[Z].id));
  OvUpd();
  if(fullMp==true){ScaIMap();}
  if (document.getElementById("vec")){RdrVec();};
  }
  ObFtch();
  break;

  case 'rte':
  if(Z < gnMinZ)
  {
  if(document.getElementById("imgAdd")){document.getElementById("imgAdd").style.visibility="hidden";}
  Z++;
  document.getElementById(oZdv[Z - 1].id).style.visibility = 'hidden';
  goZdivObj = document.getElementById(oZdv[Z - 1].id)
  while(goZdivObj.childNodes.length)
  {
  sTileIdStrSeg = (goZdivObj.firstChild.id).split("-");
  goZdivObj.removeChild(goZdivObj.firstChild)
  } 
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById("rc_").style.top = parseInt(document.getElementById(oZdv[Z - 1].id).style.top)+10+"px";
  document.getElementById("rc_").style.left = parseInt(document.getElementById(oZdv[Z - 1].id).style.left)+10+"px";
  document.getElementById("rc_").style.width = oZdv[Z].width + "px";
  document.getElementById("rc_").style.height = oZdv[Z].height + "px";
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  document.getElementById(oZdv[Z].id).style.top = document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left = document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width = document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height = document.getElementById("rc_").style.height;   
  document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top
  //if(document.getElementById("obly")){document.getElementById("obly").style.visibility="hidden";} 
  document.getElementById(oZdv[Z].id).style.visibility = 'hidden';
  Z--
  document.getElementById(oZdv[Z].id).style.visibility = 'visible';
  FtchCo(document.getElementById(oZdv[Z].id));
  OvUpd();
  if(fullMp==true){ScaIMap();}
  if (document.getElementById("vec")){RdrVec();};
  ObFtch(); 
  }
  break;

  case 'overpan':
  document.getElementById("rc_").style.top=0-(((parseInt(document.getElementById("ovBx").style.top))*oZdv[Z].nRvScaOvFa))-document.getElementById("imHld").offsetHeight+"px";
  document.getElementById("rc_").style.left=0-((parseInt(document.getElementById("ovBx").style.left)*oZdv[Z].nRvScaOvFa))+"px";
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  document.getElementById("rc"+gnRnd).style.left=document.getElementById(oZdv[Z].id).style.left;
  document.getElementById("rc"+gnRnd).style.top=document.getElementById(oZdv[Z].id).style.top;
  //document.getElementById("obLy").style.left=document.getElementById("rc_").style.left;
  //document.getElementById("obLy").style.top=document.getElementById("rc_").style.top;
  if(document.getElementById("vec"))
  {
  document.getElementById("vec").style.top=document.getElementById("rc_").style.top;
  document.getElementById("vec").style.left=document.getElementById("rc_").style.left;
  document.getElementById("vecSh").style.left = parseInt(document.getElementById("rc_").style.left)+(shadOffset*Z)+"px";
  document.getElementById("vecSh").style.top = parseInt(document.getElementById("rc_").style.top)+(shadOffset*Z)+"px" 
  }
  goZdivObj=document.getElementById(oZdv[Z].id);
  while(goZdivObj.childNodes.length)
  {
  goZdivObj.removeChild(goZdivObj.firstChild);
  }
  FtchCo(document.getElementById(oZdv[Z].id));
  break;

  case 'address':   
  sAddress = new Ajax();
  sAddress.method = 'GET';
  sAddress.responseFormat = 'text';
  sAddress.async = true;
  sAddress.doGet(gsRoot+gsAddress+"?q="+gsAdDb+","+sAdSeVal,AddOutput);   
  break;

  case 'route':
  sAddress = new Ajax();
  sAddress.method = 'GET';
  sAddress.responseFormat = 'text';
  sAddress.async = true;
  sAddress.doGet(gsRoot+gsRouteList+"?p="+gsRtDb+","+sAdSeVal,RouteOutput);   
  break;  

  case 'info':
  document.body.style.cursor="help";
  break;

  case 'pan_left':
  count=0;
  nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
  oBeginZoom=setInterval("ZoomStep((40),0)",1);
  break;

  case 'pan_right':
  count=0;
  nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
  oBeginZoom=setInterval("ZoomStep((-40),0)",1);
  break;

  case 'pan_up':
  count=0;
  nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
  oBeginZoom=setInterval("ZoomStep(0,(40))",1);
  break;

  case 'pan_down':
  count=0;
  nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
  oBeginZoom=setInterval("ZoomStep(0,(-40))",1);
  break;

  case 'reset':
  window.parent.location.replace( window.parent.location );
  break;

  case 'resetInner':
  parent.document.getElementById("MainIframe").src=gsMain
  break;

  case 'print':
  prWin = window.open(gsRoot+"Print(v2.0).htm","","resizable=1,height=600,width=800,MainKeyDivbar=1,menubar=1,scrollbars=1,titlebar=1,toolbar=1,location=1");
  break;
  }
  }

function AddOutput(gaResult)
  {
  parent.document.getElementById('idOptionBox3').innerHTML = gaResult;
  parent.document.getElementById("idSelectList3").size = "10";
  parent.document.getElementById('idSelectList3').onchange=function()
  {  	
  opacity=100
  actRoute="";
  gbRDrvc=false;
  if (document.getElementById("vec"))
  {
  oObj = document.getElementById("vec")
  oObj.parentNode.removeChild(oObj)
  oObj = document.getElementById("vecSh")
  oObj.parentNode.removeChild(oObj)
  var tileChild= document.getElementById(oZdv[Z].id).childNodes
  for(var i=0; i<document.getElementById(oZdv[Z].id).childNodes.length; i++)
  {
  tileChild[i].style.opacity=opacity/100;
  tileChild[i].style.filter="alpha(opacity"+opacity+")";
  }  
  }
  if (parent.document.getElementById("RInfo"))
  {
  oObj = parent.document.getElementById("RInfo")
  oObj.parentNode.removeChild(oObj)    
  }
  	 
  AddressGo(this.value);
  }
  }
 
 function RouteOutput(gaResult)
  {
  htmResult=gaResult.substr(0,gaResult.indexOf("~"));
  idResult=gaResult.substr(gaResult.indexOf("~")+1);
  parent.document.getElementById('info4Output').innerHTML = htmResult;
  resultArr=idResult.split("#");
  for (i=0;i<resultArr.length-1;i++)
  {
  parent.document.getElementById(resultArr[i]).onclick=function(){RouteGoto(this.id);}
  }
  } 
  
 function RouteGoto(gsRoute)
  {
  gsRouteArr=gsRoute.split(";")

  if(gsRouteArr[0]!="")
  {
  var oGetVec=new Ajax();
  oGetVec.method='GET';
  oGetVec.async=true;
  oGetVec.doGet(gsRoot+"Route.asp?p=" + "1" + "," + "0" + "," + gsRouteArr[0] +","+gsRouteDb+","+gsExL+","+gsExB,ParseFetchGoZoom)
  }
  }
  








function AddressGo(sResult)
  {
  spResult=sResult.split(":")
  document.getElementById(oZdv[Z].id).style.visibility='hidden';
  if(document.getElementById("imgAdd"))
  {
  reOj=document.getElementById("imgAdd")
  reOj.parentNode.removeChild(reOj)
  }
  var aAddString=spResult[0].split(":");
  var asCoords=aAddString[0].split(",");
  sCoordX=parseInt(asCoords[0]);
  sCoordY=parseInt(asCoords[1]);
  if(sCoordX>gsExL&&sCoordX<gsExR&&sCoordY<gsExT&&sCoordY>gsExB)
  {
  nGotoX=(parseInt(sCoordX)-gsExL)*oZdv[nToZoom].nRvScaFa;
  nGotoY=(parseInt(sCoordY)-gsExB)*oZdv[nToZoom].nRvScaFa;   
  document.getElementById(oZdv[Z].id).style.visibility='hidden';
  goZdivObj=document.getElementById(oZdv[Z].id);
  while(goZdivObj.childNodes.length)
  {
  goZdivObj.removeChild(goZdivObj.firstChild);
  }
  document.getElementById("rc_").style.top=(nGotoY)-(oZdv[nToZoom].height)-document.getElementById("imHld").offsetHeight/2+"px";
  document.getElementById("rc_").style.left=(0-nGotoX)+document.getElementById("imHld").offsetWidth/2+"px";
  document.getElementById("rc_").style.width=oZdv[nToZoom].width+"px";
  document.getElementById("rc_").style.height=oZdv[nToZoom].height+"px";
  Z= nToZoom;
  if (fullMp==true)
  {
  if(oZdv[Z].width>document.getElementById("imHld").offsetWidth)
  {
  if(parseInt(document.getElementById("rc_").style.left)<((gaDzw[Z]*-1)+document.getElementById("imHld").offsetWidth))
  {
  document.getElementById("rc_").style.left=(gaDzw[Z]*-1)+document.getElementById("imHld").offsetWidth+"px";
  }
  if(parseInt(document.getElementById("rc_").style.left)>0)
  {
  document.getElementById("rc_").style.left=0+"px";
  }
  if(parseInt(document.getElementById("rc_").style.top)>0-document.getElementById("imHld").offsetHeight)
  {
  document.getElementById("rc_").style.top=0-document.getElementById("imHld").offsetHeight;
  }
  if(parseInt(document.getElementById("rc_").style.top)<0-gaDzh[Z])
  {
  document.getElementById("rc_").style.top=0-gaDzh[Z]+"px";
  } 
  Drag.init(document.getElementById("rc_"),null,(gaDzw[Z]*-1)+document.getElementById("imHld").offsetWidth,0,(gaDzh[Z]*-1),0-document.getElementById("imHld").offsetHeight);
  }
  else
  {
  Drag.init(document.getElementById("rc_"),null,0,document.getElementById("imHld").offsetWidth-gaDzw[Z],gaDzh[Z]*-1,0-document.getElementById("imHld").offsetHeight);
  }
  } 
  document.getElementById(oZdv[Z].id).style.top=document.getElementById("rc_").style.top;
  document.getElementById(oZdv[Z].id).style.left=document.getElementById("rc_").style.left;
  document.getElementById(oZdv[Z].id).style.width=document.getElementById("rc_").style.width;
  document.getElementById(oZdv[Z].id).style.height=document.getElementById("rc_").style.height;
  if(fullMp==true)
  {
  ScaIMap();
  document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top;
   FtchCo(document.getElementById(oZdv[Z].id)); 
  OvUpd();
  }else{
  FtchCo(document.getElementById(oZdv[Z].id));
  }
  //if (document.getElementById("vec")){RdrVec();}; 
  }
  document.getElementById(oZdv[Z].id).style.visibility='visible'; 
  };

function AddressGoParse(sResult)
  {
  nToZoom=9;
  //goAdd=true;
  AddressGo(sResult)
  if (document.getElementById("vec")){RdrVec();};
  }

  function AdjLyt()
   {  
   var myWidth = 0,myHeight = 0;
   if(browser == "nonIE")
   {
   ovAdjust = 7;
   kyAdjust = 3;
   myWidth = parent.window.innerWidth;
   myHeight = parent.window.innerHeight;
   }
   else if(browser == "ieComp")
   {
   myWidth = parent.document.body.clientWidth;
   myHeight = parent.document.body.clientHeight;
   ovAdjust = 6;
   kyAdjust = 3;
   }
   else if(browser == "ie4Comp")
   {
   myWidth = parent.document.body.clientWidth;
   myHeight = parent.document.body.clientHeight;
   ovAdjust = 6;
   kyAdjust = 3;
   }
   if(myHeight>400)
   {
   parent.document.getElementById("MainIframe").style.height = myHeight-55+"px";
   parent.document.getElementById("MainIframe").style.width = myWidth-370+"px";
   document.getElementById("map").style.height=parent.document.getElementById("MainIframe").offsetHeight+"px";
   document.getElementById("imHld").style.height=parent.document.getElementById("MainIframe").offsetHeight-5+"px";
   document.getElementById("map").style.width=parent.document.getElementById("MainIframe").offsetWidth+"px";
   document.getElementById("imHld").style.width=parent.document.getElementById("MainIframe").offsetWidth-5+"px";
   parent.document.getElementById("MainTopIfrDiv").style.width = myWidth-370-(kyAdjust)+"px";
   parent.document.getElementById("MainKeyDiv").style.height = myHeight-55-(kyAdjust)+"px";   
   document.getElementById("wMk").style.left=0+((document.getElementById("imHld").offsetWidth)/2)-((document.getElementById("wMkIm").offsetWidth)/2)+"px";
   document.getElementById("wMk").style.top=0-(document.getElementById("imHld").offsetHeight)/2-((document.getElementById("wMkIm").offsetHeight)/2)+"px";
   document.getElementById("ajLod").style.left=0+((document.getElementById("imHld").offsetWidth)/2)-((document.getElementById("ajLodIm").offsetWidth)/2)+"px";
   document.getElementById("ajLod").style.top=0-(document.getElementById("imHld").offsetHeight)/2-((document.getElementById("ajLodIm").offsetHeight)/2)+"px";
   }  
   document.getElementById("ov").style.left = parseInt(document.getElementById("map").style.left) + document.getElementById("imHld").offsetWidth - document.getElementById("ov").offsetWidth + 2+"px";
   document.getElementById("ov").style.top = document.getElementById("imHld").offsetHeight - document.getElementById("ov").offsetHeight + "px";
   document.getElementById("ov_blank").style.left = parseInt(document.getElementById("map").style.left) + document.getElementById("imHld").offsetWidth - document.getElementById("ov").offsetWidth - ovAdjust + 2+"px";
   document.getElementById("ov_blank").style.top = document.getElementById("imHld").offsetHeight - document.getElementById("ov").offsetHeight - ovAdjust + "px";
   document.getElementById("ov_blank").style.height=document.getElementById("ov").offsetHeight+5+"px"
   document.getElementById("ov_blank").style.width=document.getElementById("ov").offsetWidth+5+"px"
   if(oZdv[Z].width > document.getElementById("imHld").offsetWidth)
   {
   if(parseInt(document.getElementById("rc_").style.left) < ((gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth))
   {
   document.getElementById("rc_").style.left = (gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth + "px"
   }
   if(parseInt(document.getElementById("rc_").style.left) > 0)
   {
   document.getElementById("rc_").style.left = 0+"px"
   }
   if(parseInt(document.getElementById("rc_").style.top) > 0-document.getElementById("imHld").offsetHeight)
   {
   document.getElementById("rc_").style.top = 0-(document.getElementById("imHld").offsetHeight) + "px"
   }
   if(parseInt(document.getElementById("rc_").style.top) < 0-gaDzh[Z])
   {
   document.getElementById("rc_").style.top = 0-gaDzh[Z] + "px"
   }
   Drag.init(document.getElementById("rc_"),null,(gaDzw[Z] *  - 1) + document.getElementById("imHld").offsetWidth,0,(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
   }
   else
   {
   Drag.init(document.getElementById("rc_"),null,0,document.getElementById("imHld").offsetWidth - gaDzw[Z],gaDzh[Z] *  - 1,0-document.getElementById("imHld").offsetHeight);
   } 
   for (var i=0;i<10;i++)
   {
   if(parent.document.getElementById("info"+i))
   {
   parent.document.getElementById("info"+i).style.height = parent.document.getElementById("MainIframe").offsetHeight - 30 +"px"
   if(parent.document.getElementById("info"+i+"Output")&&parent.document.getElementById("info"+i).style.display=='block')
   {
   parent.document.getElementById("info"+i+"Output").style.height=parent.document.getElementById("info"+i).offsetHeight-10+"px";  
   }
   if(parent.document.getElementById("info3").style.display=='block'&&parent.document.getElementById("info3Output"))
   {
   parent.document.getElementById("info3Output").style.height=parent.document.getElementById("info3").offsetHeight-150+"px"
   }
   if(parent.document.getElementById("info4").style.display=='block'&&parent.document.getElementById("info4Output"))
   {
   parent.document.getElementById("info4Output").style.height=parent.document.getElementById("info4").offsetHeight-150+"px"
   }
   }
   }
  }

function NoOutput(){};

function FindPost()
  {
  nBkMrk=0
  sPosString=parent.document.getElementById("AddressSearch").value
  sPosString=sPosString.replace(/ /g,"")
  var oPostFetch=new Ajax();
  oPostFetch.method='GET';
  oPostFetch.async=true;
  oPostFetch.doGet(gsRoot+"Postcode_search.asp?p="+sPosString+"&bk="+nBkMrk+"&db="+gsPcDb,PostOutput);
  }


function ParseAspFetchVML(sResult)
  {
  if(typeof(window.innerWidth)=='number')
  {
  browser="nonIE";  
  }
  else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
  {
  browser="ieComp";
  }
  else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
  {
  browser="ie4Comp";
  }   
  sMapSep=sResult.split("|");
  sVmapId=sMapSep[0];
  VMap=sMapSep[1].split(";");
  if(browser!="nonIE")
  {
  oVml = document.getElementById("vec") 
  //oVmlsh = document.getElementById("vecSh") 
  for(var i = 1;i < sMapSep.length-1;i++)
  {
  oPoly = document.createElement("v:Polyline");
  oPoly.id = "idVec" + i;
  oPoly.points = sMapSep[i];
  oPoly.strokecolor = coString;
  oPoly.strokeweight = wtString + "px";
  oPoly.filled = "false";
  //oShad = document.createElement("v:Polyline");
  //oShad.id = "idVecSh" + i;
  //oShad.points = sMapSep[i];
  //oShad.strokecolor = "black";
  //oShad.strokeweight = wtString + "px";
  //oShad.filled = "false";
  oStr = document.createElement("v:stroke");
  oStr.opacity = "1";
  oStr.endcap = "round";
  //oshStr = document.createElement("v:stroke");
  //oshStr.opacity = "1";
  //oshStr.endcap = "round";  
  oVml.appendChild(oPoly);
  //oVmlsh.appendChild(oShad);
  oPoly.appendChild(oStr)
  //oShad.appendChild(oshStr)
  }
  }
  else
  {
  svgVec = document.createElementNS('http://www.w3.org/2000/svg','svg');
  svgVec.setAttribute('width','400000'); //is needed
  svgVec.setAttribute('height','400000'); //is needed
  svgVec.setAttribute('viewBox','0 0 400000 400000'); //is needed
  svgVec.setAttribute('id','svgVec'); 
  //svgSh = document.createElementNS('http://www.w3.org/2000/svg','svg');
  //svgSh.setAttribute('width','400000'); //is needed
  //svgSh.setAttribute('height','400000'); //is needed
  //svgSh.setAttribute('viewBox','0 0 400000 400000'); //is needed
  for(var i = 1;i < sMapSep.length-1;i++)
  {
  oPoly = document.createElementNS('http://www.w3.org/2000/svg','polyline');
  oPoly.id = "idVec" + i;
  oPoly.setAttribute("points",sMapSep[i]); 
  oPoly.setAttribute("stroke",coString);
  oPoly.setAttribute("stroke-width",wtString + "px");
  oPoly.setAttribute("fill","none");
  oPoly.setAttribute("stroke-opacity","1");
  oPoly.setAttribute("stroke-linecap","round");
  oPoly.setAttribute("stroke-linejoin","round");   
  //oShad = document.createElementNS('http://www.w3.org/2000/svg','polyline');
  //oShad.id = "idVec" + i;
  //oShad.setAttribute("points",sMapSep[i]);
  //oShad.setAttribute("stroke","black");
  //oShad.setAttribute("stroke-width",wtString + "px");
  //oShad.setAttribute("fill","none");
  //oShad.setAttribute("stroke-opacity","1");
  //oShad.setAttribute("stroke-linecap","round");
  //oShad.setAttribute("stroke-linejoin","round"); 
  svgVec.appendChild(oPoly);
  //svgSh.appendChild(oShad);
  document.getElementById("vec").appendChild(svgVec) 
  //document.getElementById("vecSh").appendChild(svgSh)  
  }
   document.getElementById("vec").style.left = document.getElementById("rc_").style.left;
   document.getElementById("vec").style.top = document.getElementById("rc_").style.top 
  //document.getElementById("vecSh").style.left = parseInt(document.getElementById("rc_").style.left)+200+"px";
  //document.getElementById("vecSh").style.top = parseInt(document.getElementById("rc_").style.top)+200+"px" 
  }
  }

function popWin(vecId)
  {
  vecArray=vecId.split(":")
  win=window.open("http://www.cartogold.co.uk/Milton_Keynes_3/Milton_Keynes_Map.htm?"+vecArray[0],"_blank","resizable=1,height=600,width=800,MainKeyDivbar=1")
  }

function ifit(id)
  {
  //parent.document.getElementById(id).style.height=document.getElementById(id).style.height
  //parent.document.getElementById(id).style.width=document.getElementById(id).offsetWidth+"px"
  //parent.document.getElementById('info2ScrollHold').style.height=parseInt(parent.document.getElementById('info2ScrollHold').offsetHeight)+parseInt(parent.document.getElementById(id).offsetHeight)
  }

function resizeKey(id)
  {
  //parent.document.getElementById('info6OutputIfr').style.height=id+50+"px"
  if (document.getElementById("keyToTop"))
  {
  document.getElementById("keyToTop").scrollIntoView(true);
  }
  }

function switchTab(id,source)
 {
 
 for (i=0;i<11;i++)
 {
 if(document.getElementById('info'+i)){
 document.getElementById('info'+i).style.display='none';
 pageObj=document;
 }
 }
 
 for (i=0;i<11;i++)
 {
 if(parent.document.getElementById('info'+i)){
 parent.document.getElementById('info'+i).style.display='none';
 pageObj=parent.document;
 }
 }
 
    if (document.getElementById("MainKeyTabs"))
    {
    Obj = document.getElementById("MainKeyTabs")
    }
    else
    {
    Obj = parent.document.getElementById("MainKeyTabs")
    }
    var children = Obj.childNodes;
    for(i=0;i<children.length;i++)
        {
        if(children[i].id!=id&&(children[i].className=="off_3"||children[i].className=="on_3")){children[i].className="off_3";}        
        }
 
 switch(id)
 {

 case 'tDIV_HELP':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info1').style.visibility='visible'
 pageObj.getElementById('info1').style.display='block';
 break;
 
 case 'tDIV_KEY':
 if (source=='key')
 {
 parent.document.getElementById(id).className="on_3"
 source=null;
 }
 else
 {
 document.getElementById(id).className="on_3"
 }
 pageObj.getElementById('info2').style.visibility='visible'
 pageObj.getElementById('info2').style.display='block';
 parent.document.getElementById("info2Output").style.height=parent.document.getElementById("info2").offsetHeight+"px"
 pageObj.getElementById('info2Output').style.visibility='visible'
 pageObj.getElementById('info2Output').style.display='block';
 break;
 
 
 case 'tDIV_SEARCH':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info3').style.visibility='visible'
 pageObj.getElementById('info3').style.display='block';
 break;

 case 'tDIV_BUSROUTESTIMETABLES':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info4').style.visibility='visible'
 pageObj.getElementById('info4').style.display='block';
 parent.document.getElementById("info4Output").style.height=parent.document.getElementById("info4").offsetHeight+"px"
 pageObj.getElementById('info4Output').style.visibility='visible'
 pageObj.getElementById('info4Output').style.display='block';
 break;
 
 case 'tDIV_ROUTEINFO':
  if (source=='key')
  {
  parent.document.getElementById(id).className="on_3"
  source=null;
  }
  else
  {
  document.getElementById(id).className="on_3"
  }
 pageObj.getElementById('info5').style.visibility='visible'
 pageObj.getElementById('info5').style.display='block';
 break;
 
 case 'tDIV_OPERATORDETAILS':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info6').style.visibility='visible'
 pageObj.getElementById('info6').style.display='block';
 parent.document.getElementById("info6Output").style.height=parent.document.getElementById("info6").offsetHeight+"px"
 pageObj.getElementById('info6Output').style.visibility='visible'
 pageObj.getElementById('info6Output').style.display='block';
 break;
 
 case 'tDIV_LINKS':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info7').style.visibility='visible'
 pageObj.getElementById('info7').style.display='block';
 break; 
 
 case 'tDIV_OTHERTRANSPUB':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info8').style.visibility='visible'
 pageObj.getElementById('info8').style.display='block';
 break;  
 
 case 'tDIV_VISITORINFORMATION':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info9').style.visibility='visible'
 pageObj.getElementById('info9').style.display='block';
 break; 
 
 case 'tDIV_LATESTNEWS':
  document.getElementById(id).className="on_3"
  pageObj.getElementById('info10').style.visibility='visible'
  pageObj.getElementById('info10').style.display='block';
  parent.document.getElementById("info10Output").style.height=parent.document.getElementById("info10").offsetHeight+"px"
  pageObj.getElementById('info10Output').style.visibility='visible'
  pageObj.getElementById('info10Output').style.display='block';
 break; 

}
}

function hover(id)
  {
  if(document.getElementById(id).className!="on_3")
  {
  document.getElementById(id).className="hover_3"
  }
  }

function out(id)
  {
  if(document.getElementById(id).className!="on_3")
  {
  document.getElementById(id).className="off_3"
  }
  }

function removeSpaces(sString)
  {
  var sTstring = "";
  sString = '' + sString;
  sSplitstring = sString.split(" ");
  for(i = 0; i < sSplitstring.length; i++)
  sTstring += sSplitstring[i];
  return sTstring;
  }

function printV3()
  {
  if(typeof(window.innerWidth)=='number')
  {
  browser="nonIE";  
  }
  else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
  {
  browser="ieComp";
  }
  else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
  {
  browser="ie4Comp";
  }
  newTileChild=new Array();
  var tileChildo= window.opener.document.getElementById("ctrl").childNodes 
  for(var o=0; o<window.opener.document.getElementById("ctrl").childNodes.length; o++)
  {
  if (tileChildo[o].id&&tileChildo[o].id.indexOf("oZdv_")!=-1&&tileChildo[o].style.visibility=='visible')
  {
  document.getElementById("tiles").style.position="absolute"
  document.getElementById("tiles").style.left=parseInt(tileChildo[o].style.left)+((780-parseInt(window.opener.document.getElementById("map").style.width))/2)+"px";
  document.getElementById("tiles").style.top=parseInt(tileChildo[o].style.top)+480-((480-parseInt(window.opener.document.getElementById("map").style.height))/2)+"px";
  document.getElementById("tiles").style.width=tileChildo[o].style.width;
  document.getElementById("tiles").style.height=tileChildo[o].style.height;
  var tileChildi= window.opener.document.getElementById(tileChildo[o].id).childNodes 
  for(var i=0; i<window.opener.document.getElementById(tileChildo[o].id).childNodes.length; i++)
  {
  newTileChild[i]=document.createElement("img")
  newTileChild[i].id=tileChildi[i].id
  newTileChild[i].style.position="absolute"
  newTileChild[i].style.filter=tileChildi[i].style.filter
  newTileChild[i].style.opacity=tileChildi[i].style.opacity
  newTileChild[i].style.left=tileChildi[i].style.left
  newTileChild[i].style.top=tileChildi[i].style.top
  newTileChild[i].src=tileChildi[i].src
  document.getElementById("tiles").appendChild(newTileChild[i])
  }  
  }
  }
  wmArray=gsWmString.split('_') 
  if (browser=="nonIE")
  {
  oObj = window.opener.document.getElementById("svgVec")
  var children = oObj.childNodes;
  svgVc = document.createElementNS('http://www.w3.org/2000/svg','svg');
  svgVc.setAttribute('width','400000');
  svgVc.setAttribute('height','400000');
  svgVc.setAttribute('viewBox','0 0 400000 400000');
  for(var i=0;i<children.length;i++)
  {
  pol = document.createElementNS('http://www.w3.org/2000/svg','polyline');
  pol.setAttribute("points",children[i].getAttribute('points')) 
  pol.setAttribute("stroke",children[i].getAttribute('stroke'))
  pol.setAttribute("stroke-width",children[i].getAttribute('stroke-width'))
  pol.setAttribute("fill",children[i].getAttribute('fill'))
  pol.setAttribute("stroke-opacity",children[i].getAttribute('stroke-opacity'))
  pol.setAttribute("stroke-linecap",children[i].getAttribute('stroke-linecap'))
  pol.setAttribute("stroke-linejoin",children[i].getAttribute('stroke-linejoin'))  
  svgVc.appendChild(pol);
  } 	 	
  document.getElementById("vec").appendChild(svgVc)
  oSvg2=document.createElementNS('http://www.w3.org/2000/svg','svg');
  oSvg2.setAttribute('width','780px');
  oSvg2.setAttribute('height','480px');
  oSvg2.setAttribute('viewBox','0 0 400 400');  
  for (var i=0;i <wmArray.length;i++)
  {
  oShp=document.createElementNS('http://www.w3.org/2000/svg','text');
  oShp.style.position='absolute';
  oShp.setAttribute('x',(parseInt(document.getElementById('map').style.width)/2)-(400/2)+'px');
  oShp.setAttribute('y',(480-(parseInt(sVecFntSz)*(wmArray.length)))/2+(parseInt(sVecFntSz)*(i+1))-(parseInt(sVecFntSz)/2)+'px');
  oShp.setAttribute('font-family','arial');
  oShp.setAttribute('font-size',sVecFntSz);
  oShp.setAttribute('font-weight','bold');
  oShp.setAttribute('text-anchor','middle');
  oShp.setAttribute('fill-opacity','.1');
  textNode = document.createTextNode(wmArray[i]);
  oSvg2.appendChild(oShp);
  oShp.appendChild(textNode);
  document.getElementById("wMk").appendChild(oSvg2);
  document.getElementById("wMk").style.zIndex=50;
  }
  }else{
  if(window.opener.document.getElementById("vec"))
  {
  document.getElementById("vec").innerHTML=window.opener.document.getElementById("vec").innerHTML;
  document.getElementById("vec").style.zIndex="5";
  }
  for (var i=0;i <wmArray.length;i++)
  {   
  oVml= document.getElementById("wMk"); 
  oText=document.createElement("v:line");
  oText.strokecolor="black";
  oText.strokeweight="none";
  oText.filled="true";
  oText.fillColor="black";
  oText.style.position="absolute";
  oText.style.left=(parseInt(document.getElementById("map").style.width)/2)-(400/2);
  oText.style.top=(480-(parseInt(sVecFntSz)*(wmArray.length)))/2+(parseInt(sVecFntSz)*(i+1))-(parseInt(sVecFntSz)/2)+'px'  
  oText.style.width=780+"px";
  oText.style.height=480+"px";
  oText.from="0,0";
  oText.to="400,0"; 
  oTextS=document.createElement("v:stroke");
  oTextS.opacity=".2";   
  oTextF=document.createElement("v:fill");
  oTextF.opacity=".1";  
  oTextT=document.createElement("v:textpath");  
  oTextT.style.fontSize=sVecFntSz;
  oTextT.style.fontFamily="arial";
  oTextT.style.fontWeight="Bold";
  oTextT.on="true";
  oTextT.string=wmArray[i]
  oTextT.style.vtextalign="center";
  oTextP=document.createElement("v:path");
  oTextP.textpathok=true;
  oText.appendChild(oTextS);
  oText.appendChild(oTextF);
  oText.appendChild(oTextP);
  oText.appendChild(oTextT);
  oVml.appendChild(oText);
  }
  }
  document.getElementById("vec").style.left = document.getElementById("tiles").style.left;
  document.getElementById("vec").style.top = document.getElementById("tiles").style.top 
  document.getElementById("vec").style.width = document.getElementById("tiles").style.width;
  document.getElementById("vec").style.height = document.getElementById("tiles").style.height;
  }
  
  function hover(id)
  {
   if(document.getElementById(id).className!="on_3")
   {
   document.getElementById(id).className="hover_3"
   }
  }
  
  function out(id)
  {
   if(document.getElementById(id).className!="on_3")
   {
   document.getElementById(id).className="off_3"
   }
  }
  
  function hoverkey(id)
  {
   if(parent.document.getElementById(id).className!="on_4")
   {
   parent.document.getElementById(id).className="hover_4"
   }
  }
  
  function outkey(id)
  {
   if(parent.document.getElementById(id).className!="on_4")
   {
   parent.document.getElementById(id).className="off_4"
   }
  }
  
  function onkey2(id)
  {
  }
  
  
  function onkey(id)
  {
  
  
   if(parent.document.getElementById(id).className!="on_4")
   {
     goZdivObj = document.getElementById(oZdv[Z].id)
     while(goZdivObj.childNodes.length)
         {
         goZdivObj.removeChild(goZdivObj.firstChild)
         }
         
         
  gsRouteNum=id  
  gsBsTileRoot=gsTileRoot+gsRouteNum
  
 
  var keyChild= parent.document.getElementById("info2Output").childNodes  
  for(var i=0; i<parent.document.getElementById("info2Output").childNodes.length; i++)
  		{
  		if(keyChild[i].id!=id&&keyChild[i].tagName=="IMG" && id!="Base"){
  		keyChild[i].style.opacity=.5
  		keyChild[i].style.filter="alpha(opacity="+50+")";
  		}
  		else
  		{
  		keyChild[i].style.opacity=1
  		keyChild[i].style.filter="alpha(opacity="+100+")";		
  		}
    		}
  }
  
   if (id=="Base"){onroute(id);}else
  {
  RouteGoto(id)   
  }
  }
  
  
  function onroute(id)
  {
     goZdivObj = document.getElementById(oZdv[Z].id)
     while(goZdivObj.childNodes.length)
         {
         goZdivObj.removeChild(goZdivObj.firstChild)
         }
  gsRouteNum=id
  gsBsTileRoot=gsTileRoot+gsRouteNum
  FtchCo(document.getElementById(oZdv[Z].id));
  }
  
  
  
  
  
  
  
  
  
   function removeSpaces(sString) {
   	var sTstring = "";
   	sString = '' + sString;
   	sSplitstring = sString.split(" ");
   	for(i = 0; i < sSplitstring.length; i++)
   	sTstring += sSplitstring[i];
   	return sTstring;
 }
