function init_map(frameId)
{
  cpy="Copyright Richmond Borough Council. Licence No. 100019441. 2005."
  gsGcm="Richmond_Map_LDF";
  gnTl=1;
  gsAdDb="Richmond.mdb";
  gsGoDb="Richmond_Goto.mdb";
  gsImap = "Imap.asp";
  gsImapDb="Richmond_Imap.mdb";
  gsPcDb="Richmond_Postcode.mdb"
  gsRoot="http://www.cartogold.co.uk/Richmond/";
  gsPage="http://www.cartogold.co.uk/Richmond/Richmond.htm"
  gsBsTileRoot="http://www.cartogold.co.uk/Richmond/Tiles/";
  gcRoot="http://www.cartogold.co.uk/scripts/gcis.exe?";
  gsPolyDb="Richmond_Polygon.mdb"

//429688.33 329271.93,
//432691.23 329272.02,
//441745.69 329272.02,
//441745.69 341459.52,
//429683.19 341459.52,
//429688.33 329271.93



  gsExL=511605.43;
  gsExB=166940.48;
  gsExR=523730.45;
  gsExT=179740.49;
  gnAddZ=7;	
  gnCz=5;
  gnAt=0;
  gnMaxZ=0;
  gnMinZ=8;
  gnAmLyr=3;
  sVecFntSz="50px"
  baseCol='black';
  gnImwdth=5500;
  gsKyTp="HTML";
  gsWmString="RICHMOND_BOROUGH_COUNCIL";
  gbIndvKy=false;
  wsRoot=""
  lhWin=""
  fullMp=true;
  gsSb=new Array(5000,5,3000,3,2000,4,1000,4,500,5,200,4,100,4,50,5,20,4); 
  tWidth=57284;
  tHeight=60473;
  tAmnt=70903;  
  goAdd=false;
  imagMapObj=new Array();
  nVec=0;
  gnRnd=1;
  gnRq=2;
  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();
  
  if (parent.document.getElementById('MainKeyTabs')){fullMp=true;}else{fullMp=false;};
  if (frameId=='map'){start_map();}
  }
 
 function start_map()
  {
  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]
  //alert("gaDzw["+i+"]="+gaDzw[i]+"|"+"gaDzh["+i+"]="+gaDzh[i]+"|"+"gaDnumw["+i+"]="+gaDnumw[i]+"|"+"gaDtot["+i+"]="+gaDtot[i]+"|")
  c=c*2
  }
  
  
  
    Z = 0;//Is this needed*
   gsXgoUserID=document.getElementById('userID').className;
 //------------------------------------------------------------------------------
   if (parent.document.getElementById('Tab_HELP'))
   {
     parent.document.getElementById('Tab_HELP').style.visibility='visible'
     parent.document.getElementById('Tab_Policy_Info').style.visibility='visible'
     parent.document.getElementById('Tab_Search').style.visibility='visible'
     parent.document.getElementById('Tab_Written_Statement').style.visibility='visible'
     parent.document.getElementById('Tab_Links').style.visibility='visible'
     parent.document.getElementById('Tab_Key').style.visibility='visible'
     var tileChild= parent.document.getElementById("MainKeyTabs").childNodes 
     for(var i=0; i<parent.document.getElementById("MainKeyTabs").childNodes.length;i++)
     {
     if(tileChild[i].offsetHeight!=undefined){
     //tileChild[i].className=tileChild[i].offsetHeight
     //if(tileChild[i].style.visibility=='visible'){tileChild[i].style.height=tileChild[i].className;}
     //if(tileChild[i].style.visibility=='hidden'){tileChild[i].style.height="0px";}
     }
    }
 } 
  //------------------------------------------------------------------------------
    
    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="&copy; "+cpy;
   
   if(fullMp==true)
   {

      
      document.getElementById('tInfo').onmousedown=function()
      {
      document.getElementById('tInfo').src="images/toolbar_info_down.gif";
      document.getElementById('tInfo_s').src="images/toolbar_info_shadow_down.gif";
      }
      document.getElementById('tInfo').onmouseup=function()
      {
      document.getElementById('tInfo').src="images/toolbar_info_up.gif";
      document.getElementById('tInfo_s').src="images/toolbar_info_shadow_up.gif";
      }
      parent.document.getElementById('PolInfKey').onmousedown=function()
      {
      parent.document.getElementById('PolInfKey').src="images/toolbar_info_key_down.gif";
      //document.getElementById('tInfo_s').src="images/toolbar_info_shadow_down.gif";
      }
      parent.document.getElementById('PolInfKey').onmouseup=function()
      {
      parent.document.getElementById('PolInfKey').src="images/toolbar_info_up.gif";
      //document.getElementById('tInfo_s').src="images/toolbar_info_shadow_up.gif";
      }
    obFrame=parent.document.getElementById("info3");
    oText=parent.document.createElement("a");
    oText.innerHTML="Either select a place name from the list below.";
    oText.className='helpTextComp';
    obFrame.appendChild(oText);
    oForm=parent.document.createElement("form");
    oForm.id='GotoSelect';
    oSelect=parent.document.createElement("select");
    oSelect.id="sGotoVal";
    oSelect.value="Search";
    oSelect.onchange=function(){if (this.value!="null"){ParseFetchGoZoom(this.value);};}
    obFrame.appendChild(oForm);
    oForm.appendChild(oSelect);
    oOption=parent.document.createElement("option");
    oOption.value='';
    oSelect.appendChild(oOption);
    oBreak=parent.document.createElement("br");
    obFrame.appendChild(oBreak);
    oBreak=parent.document.createElement("br")
    obFrame.appendChild(oBreak) 
    oText=parent.document.createElement("a");
    oText.innerHTML="OR";
    oText.className='helpTextBoldComp';
    obFrame.appendChild(oText);
    oBreak=parent.document.createElement("br");
    obFrame.appendChild(oBreak);
    oText=parent.document.createElement("a");
    oText.innerHTML="enter a full or partial postcode <B>ie. SW15 5RH</B> in the box below then click SEARCH. Clicking on one of the results returned will show the address in the map window.";
    oText.className='helpTextComp';
    obFrame.appendChild(oText);
    oBreak=parent.document.createElement("br");
    obFrame.appendChild(oBreak);   
    oInput=parent.document.createElement("input");   
    oInput.type='text';
    oInput.style.position="absolute";
    oInput.style.top="118px";
    oInput.style.width="200px";
    oInput.id="AddressSearch";
    obFrame.appendChild(oInput); 
    oButton=parent.document.createElement("button");
    oButton.style.position="absolute";
    oButton.style.width="80px";
    oButton.style.height="25px";
    oButton.style.top="116px";
    oButton.style.position="absolute";
    oButton.style.left="210px";
    oButton.onclick=FindPost;
    oButton.innerHTML="Search"
    obFrame.appendChild(oButton);
    oDiv=parent.document.createElement("div");
    oDiv.id="info3Output";
    oDiv.style.position="absolute";
    oDiv.style.top="146px";
    oDiv.style.width="303px";
    oDiv.style.height="200px";
    //oDiv.style.border-style="solid";
    obFrame.appendChild(oDiv);
    
    var oPopDrop=new Ajax();
    oPopDrop.method='GET';
    oPopDrop.async=true;
    oPopDrop.doGet(gsRoot+"GetGotoAreas.asp?p="+gsGoDb,PopDd);     
}
  
  
  for(var p = 0;p <= gnMinZ;p++)
    {
    oZdv[p] = new oZdv(p,gaDzw[p],gaDzh[p]);
    if (oZdv[p].width>document.getElementById('map').offsetWidth){Z=p;}
    }
   gnMaxZ=Z;
   document.getElementById("map").style.top = 0;
   document.getElementById("map").style.left = 0; 
   
   if(fullMp==true){AdjLyt();}
   for(var p = 0;p <= gnMinZ;p++)
   {
   if (oZdv[p].width>document.getElementById('map').offsetWidth&&oZdv[p].height>document.getElementById('map').offsetHeight){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"
  document.getElementById("tInfo").style.top = parseInt(document.getElementById("ttrack").style.top)+document.getElementById("ttrack").offsetHeight+34+"px"
  document.getElementById("tInfo").style.left = "22px"  
  document.getElementById("tInfo_s").style.top = parseInt(document.getElementById("ttrack").style.top)+document.getElementById("ttrack").offsetHeight+34+"px"
  document.getElementById("tInfo_s").style.left = "22px"  
  //document.getElementById("toolbar_info_shadow_up").style.top = parseInt(document.getElementById("ttrack").style.top)+document.getElementById("ttrack").offsetHeight+28+"px"
  //document.getElementById("toolbar_info_shadow_up").style.left = "30px"  
  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';
  FtchCo(document.getElementById(oZdv[Z].id));
  if(fullMp==true)
  {
  ScaIMap();
  DrSc();
  //AjaxVec();
  OvUpd();
  Drag.init(document.getElementById("rc_"),null,((gaDzw[Z] *  - 1)) + document.getElementById("imHld").offsetWidth,0,(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
  }
}
  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(1,parent.location.search.length);
   	}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+","+sSearchId+","+gsExL+","+gsExB+","+gsPolyDb,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("~");
  		for(var i=0;i<aOpt.length-1;i++)
  			{
  			aOptSplit=aOpt[i].split(";"); 			
  			parent.document.forms['GotoSelect'].sGotoVal.options[i+1]=new Option(aOptSplit[0],aOptSplit[1]);
  			}
 		}
	} 
  }


function oZdv(Zm,w,h)
  {
  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=1;
  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+gnTl+"/"+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";
        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")){AjaxVec();};
   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(gnTl+"rc"+gnRnd).style.left=document.getElementById(oZdv[Z].id).style.left;
      //document.getElementById(gnTl+"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(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("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');
      }
    
    if(Drag.oObj.id=="rc_")
      {
      document.getElementById('rc_').onmouseup=FeCoord;
      }
    
    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()
   {
   var oGetVec=new Ajax();
   oGetVec.method='GET';
   oGetVec.async=true;
   oGetVec.doGet(gsRoot+gsImap+"?p="+oZdv[Z].nRvScaFa+","+oZdv[Z].height+","+gsImapDb+","+gsExL+","+gsExB+","+gnTl,parseScaIMap); 
   
   }
  
  function parseScaIMap(sResult)
  {
  imagMapObject = new Array();
  lft=document.getElementById("rc_").style.left
  tp=document.getElementById("rc_").style.top
   sResult=sResult.replace(/#/g,"<area shape='poly' coords='")
   sResult=sResult.replace(/ms/g," onmousedown='CMp(this.className)'")
   //sResult=sResult.replace(/ms/g," onmousedown='alert()'")
   sResult=sResult.replace(/vd/g," href='javascript:void(0)")
   gnRnd = Math.random() * 5;
   sResult="<MAP name='rc"+gnRnd+"' id='rc"+gnRnd+"'>"+sResult+"</MAP><DIV><IMG id='rc_' name='rc_' style='z-index:9' src='images/space.gif' useMap='#rc"+gnRnd+"'>" 
   goObj = document.getElementById("imap");
     if(goObj)
       {
       while(goObj.childNodes.length)
         {
         goObj.removeChild(goObj.firstChild);
         }
       }
    goObj = document.getElementById("imap");
    goObj.innerHTML=sResult;
document.getElementById("rc_").style.width=oZdv[Z].width+"px";
document.getElementById("rc_").style.height=oZdv[Z].height+"px";
document.getElementById("rc_").style.left=lft
document.getElementById("rc_").style.top=tp

document.getElementById("rc"+gnRnd).onmouseup = FeCoord;
//document.getElementById("rc"+gnRnd).onmouseup = function(){alert();}

for (var o=0;o<imagMapObj.length;o++)
		{
		imagMapObject[o] = document.createElement("AREA");
		imagMapObject[o].id=imagMapObj[o].substring(0,imagMapObj[o].indexOf(","))	
             	imagMapObject[o].shape = "rect";
             	imagMapObject[o].title = oImagObj[o].title;
             	imagMapObject[o].onmouseover = function(){if(document.body.style.cursor!="help"){document.body.style.cursor="pointer"}}
             	imagMapObject[o].onmouseout = function(){if(document.body.style.cursor!="help"){document.body.style.cursor="move"};}
             	imagMapObject[o].onmouseup=function()
             	{
             	
             		for (var i=0;i<imagMapObj.length;i++)
             		{
             		
             		if(imagMapObj[i].substring(0,imagMapObj[i].indexOf(","))==this.id)
             			{
             			imagMapObj.splice(i,1)
             			if (document.getElementById(this.id+"_shp"))
             				{
             				Obj = document.getElementById("vec")
					Obj.parentNode.removeChild(Obj)
					Obj = document.getElementById(this.id)
					Obj.parentNode.removeChild(Obj)
             				}
             			}             	
             		
             		}
             	}
             	
             	imagMapObject[o].coords=imagMapObj[o].substring(imagMapObj[o].indexOf(",")+1,imagMapObj[o].length)
		//alert(imagMapObject[o].coords)
		document.getElementById('rc'+gnRnd).appendChild(imagMapObject[o])
		//alert(goObj.innerHTML)
		}			
	


Drag.init(document.getElementById("rc_"),null,((gaDzw[Z] *  - 1)) + document.getElementById("imHld").offsetWidth,0,(gaDzh[Z] *  - 1),0-document.getElementById("imHld").offsetHeight);
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("rc_").onmouseover=function(){if(parent.document.body.style.cursor=="help"){document.body.style.cursor="help";};if(document.body.style.cursor != "help");if(document.body.style.cursor!="help"&&document.body.style.cursor!="pointer"){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")
   {
   clickID=id
   gsStCx=1+Math.abs(parseInt(document.getElementById("rc_").style.left));
   gsStCy=1+Math.abs(parseInt(document.getElementById("rc_").style.top));
   }
   if(idIndv[2]=="Map")
   {
   clickID=id
   gsStCx=1+Math.abs(parseInt(document.getElementById("rc_").style.left));
   gsStCy=1+Math.abs(parseInt(document.getElementById("rc_").style.top));
   } 
  };


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])
 setTimeout( "FtchCo(document.getElementById(oZdv[Z].id));", 200);  
 ScaIMap();

   }

function FetchPosGoto(sResult)
{
spSResult=sResult.split(";")
coords=spSResult[0].split(",")
sImageUrl=gcRoot+"XgoUserID="+gsXgoUserID+"&XgoPageName="+gsGcm+"&XgoTabs=Tab"+"&XgoAnswer=MapImage"+"&sizex=10&sizey=10"+"&XgoPointXY="+coords[0]+","+coords[1]+"&XgoNbReq="+gnRq+"&XgoSetLogicalScale=1";
oImgeo=new Ajax();
oImgeo.method='GET';
oImgeo.async=true;
oImgeo.doGet(sImageUrl,FetchPosData);

}


function FetchPosData()
  {
  sDataUrl=gcRoot+"&XgoNbReq="+gnRq+"&XgoPageName="+gsGcm+"&XgoNbReq="+gnRq+"XgoUserID="+gsXgoUserID+"&XgoTabs=Tab"+"&XgoAnswer=GETVAR"+"&XgoGetVarName=XgoFieldContent;XgoFieldContent1"+"&XgoFieldRequest1=Name"+"&XgoClickMap.x=10"+"&XgoClickMap.y=10"+"&XgoNoCenterClick=Y"; 
  oDataGeo=new Ajax();
  oDataGeo.method='GET';
  oDataGeo.async=true;
  oDataGeo.doGet(sDataUrl,ParseTabInf);
  gnRq++;
  }

function ParseTabInf(sResult)
{
gnTl=parseInt(sResult)
if(goAdd==false){
PostGoParse(coords[0]+","+coords[1]+";"+"");
}
else
{
AddressGoParse(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")){AjaxVec();};
  }

function FetchPolIm(nWx,nWy)
   {
   parent.document.getElementById("info2Output").style.visibility='hidden';
   document.getElementById("obLy").style.top=document.getElementById(oZdv[Z].id).style.top;
   document.getElementById("obLy").style.left=document.getElementById(oZdv[Z].id).style.left;
   document.getElementById("obLy").style.height=document.getElementById(oZdv[Z].id).offsetHeight+"px";
   document.getElementById("obLy").style.width=document.getElementById(oZdv[Z].id).offsetWidth+"px";
   if(!document.getElementById("imgPol"))
   	{
   	oPolImg=document.createElement("IMG");
   	oPolImg.id="imgPol";
   	document.getElementById("obLy").appendChild(oPolImg);
   	}
   	document.getElementById("imgPol").style.top=(nWy-16)+"px";
 	document.getElementById("imgPol").style.left=(nWx-16)+"px";  	
   	document.getElementById("imgPol").style.position="absolute"
   	document.getElementById("imgPol").src="images/policy_target.gif"; 	
   	document.getElementById("imgPol").style.visibility="visible";
   	document.getElementById("imgPol").style.zindex="20";
   sOutputString='';
   sXgoStVis='';
   count=1;
   document.getElementById("ajLodIm").style.visibility="visible";
   sImageUrl=gcRoot+"XgoUserID="+gsXgoUserID+"&XgoPageName="+gsGcm+"&XgoTabs=Info"+"&XgoAnswer=MapImage"+"&sizex=20&sizey=20"+"&XgoPointXY="+(gsExL+(nWx*oZdv[Z].nScaFa))+","+(gsExT-(nWy*oZdv[Z].nScaFa))+"&XgoNbReq="+gnRq+"&XgoSetLogicalScale=1";
   oImgeo=new Ajax();
   oImgeo.method='GET';
   oImgeo.async=false;
   oImgeo.doGet(sImageUrl,FetchPolData);
   gnRq++;
   }
 
 function FetchPolData()
   {
     sDataUrl=gcRoot+"&XgoNbReq="+gnRq+"&XgoPageName="+gsGcm+"&XgoNbReq="+gnRq+"XgoUserID="+gsXgoUserID+"&XgoTabs=Info"+"&XgoAnswer=GETVAR"+sXgoStVis+"&XgoGetVarName=XgoFieldContent;XgoFieldContent1;XgoFieldContent2;XgoFieldContent3"+"&XgoFieldRequest=displayName"+"&XgoFieldRequest1=Policy"+"&XgoFieldRequest2=Class"+"&XgoFieldRequest3=Subclass"+"&XgoClickMap.x=10"+"&XgoClickMap.y=10"+"&XgoNoCenterClick=Y";
   oDataGeo=new Ajax();
   oDataGeo.method='GET';
   oDataGeo.async=true;
   oDataGeo.doGet(sDataUrl,ParseDisInf);
   gnRq++;
   }

function ParseDisInf(sResult)
  {
  asDisString=sResult.split('\n');

 
  if(asDisString[2]==undefined||asDisString[2]=='')
    {
    if (count==1)
    {
    //sOutputString+="No site specific policies apply.<BR><B>Please note</B>:standard Derby City policies are applicable."+";"+""+";"+"blank"+";"+""+"|"
    }
    sOutputString=sOutputString.replace(/undefined/g,'')
    oBuildKey=new Ajax();
    oBuildKey.method='GET';
    oBuildKey.async=true;
    sOutputString=sOutputString.replace(/#/g,"~")
    oBuildKey.doGet(gsRoot+"GetPolicy.asp?p="+gsKyTp+"|"+sOutputString+"!"+wsRoot,PolicyFin);
    }
  else
    {
    sOutputString+=asDisString[0]+";"+asDisString[1]+";"+asDisString[0]+";"+""
    sOutputString+="|";
    sXgoStVis+="&XgoSetTstVisibility"+count+"=hide "+"'"+asDisString[2]+"','"+asDisString[3]+"'";
    count++;
    DisInf();
    }
  }

 function DisInf(sString)
   {
     sDataUrl=gcRoot+"&XgoNbReq="+gnRq+"&XgoPageName="+gsGcm+"&XgoNbReq="+gnRq+"XgoUserID="+gsXgoUserID+"&XgoTabs=Info"+"&XgoAnswer=GETVAR"+sXgoStVis+"&XgoGetVarName=XgoFieldContent;XgoFieldContent1;XgoFieldContent2;XgoFieldContent3"+"&XgoFieldRequest=displayName"+"&XgoFieldRequest1=Policy"+"&XgoFieldRequest2=Class"+"&XgoFieldRequest3=Subclass"+"&XgoClickMap.x=10"+"&XgoClickMap.y=10"+"&XgoNoCenterClick=Y";
   gnRq++;
   var oPolicyInfo=new Ajax();
   oPolicyInfo.method='GET';
   oPolicyInfo.async=true;
   oPolicyInfo.doGet(sDataUrl,ParseDisInf);
   }

function PolicyFin(sResult)
  {
  sResult=sResult.replace(/~/g,"#")
  gnRq++;
  sXgoStVis=sXgoStVis.replace(/hide/g,'show');
  sResetUrl=gcRoot+"&XgoNbReq="+gnRq+"XgoUserID="+gsXgoUserID+"&XgoTabs=Info"+"&XgoAnswer=GETVAR"+sXgoStVis+"&XgoNoCenterClick=Y";
  gnRq++;
  oResetLayers=new Ajax();
  oResetLayers.async=true;
  oResetLayers.method='GET';
  oResetLayers.oResetLayers;
  oResetLayers.doGet(sResetUrl,NoOutput);  
  oldDiv = parent.document.getElementById('info2Output'); 
  newDiv = parent.document.createElement(oldDiv.tagName); 
  newDiv.id = oldDiv.id;
  newDiv.className = oldDiv.className;
  newDiv.style.position = oldDiv.style.position
  newDiv.style.top = oldDiv.style.top
  newDiv.style.left = oldDiv.style.left
  newDiv.style.height = oldDiv.style.height
  newDiv.style.width = oldDiv.style.width
  newDiv.style.overflow="auto"
  newDiv.innerHTML = sResult;
  oldDiv.parentNode.replaceChild(newDiv, oldDiv); 
  document.body.style.cursor="move";
  switchTab('tDIV_POLICYINFO','key')
  parent.document.getElementById("info2Output").style.visibility='visible';
  parent.document.getElementById("info2Output").style.height=parent.document.getElementById("info2").offsetHeight-120+"px"
  gbSwKy=true;  
  document.getElementById("ajLodIm").style.visibility="hidden";
}

function FetchLayIm(nWx,nWy)
  {
  sImageUrl=gcRoot+"XgoUserID="+gsXgoUserID+"&XgoPageName="+gsGcm+"&XgoTabs=Tab"+"&XgoAnswer=MapImage"+"&sizex=100&sizey=100"+"&XgoPointXY="+(gsExL+(nWx*oZdv[Z].nScaFa))+","+(gsExT-(nWy*oZdv[Z].nScaFa))+"&XgoNbReq="+gnRq+"&XgoSetLogicalScale=1";
  oImgeo=new Ajax();
  oImgeo.method='GET';
  oImgeo.async=true;
  oImgeo.doGet(sImageUrl,FtchLayData);
  gnRq++;
  }

function FtchLayData()
  {
  sDataUrl=gcRoot+"&XgoNbReq="+gnRq+"&XgoPageName="+gsGcm+"&XgoUserID="+gsXgoUserID+"&XgoTabs=Tab"+"&XgoAnswer=GETVAR"+"&XgoGetVarName=XgoFieldContent1;"+"&XgoFieldRequest1=Name"+"&XgoClickMap.x=50"+"&XgoClickMap.y=50"+"&XgoNoCenterClick=Y";
  oDataGeo=new Ajax();
  oDataGeo.method='GET';
  oDataGeo.async=true;
  oDataGeo.doGet(sDataUrl,ParseLayInf);
  gnRq++;
  }

function ParseLayInf(sResult)
  {
  goZdivObj=document.getElementById(oZdv[Z].id);
  while(goZdivObj.childNodes.length)
    {
    sTileIdStrSeg=(goZdivObj.firstChild.id).split("-");
    goZdivObj.removeChild(goZdivObj.firstChild);
    }
  gnTl=parseInt(sResult);
  FtchCo(document.getElementById(oZdv[Z].id));
  if(fullMp==true){ScaIMap();}
       if(document.getElementById("obLy")&&goAdd==true)
           	{
       	document.getElementById("obLy").style.top=document.getElementById("rc_").style.top;
       	document.getElementById("obLy").style.left=document.getElementById("rc_").style.left;
       	document.getElementById("obLy").style.height=document.getElementById("rc_").offsetHeight+"px";
       	document.getElementById("obLy").style.width=document.getElementById("rc_").offsetWidth+"px";
     
       	addImg=document.createElement("img");
       	addImg.id="imgAdd";
       	addImg.style.position="absolute"
       	addImg.src="images/add_dot.gif";
     	addImg.style.left=(((parseInt(sCoordX)-gsExL)*oZdv[nToZoom].nRvScaFa)-10)+"px";
        addImg.style.top=(oZdv[Z].height-((parseInt(sCoordY)-gsExB)*oZdv[nToZoom].nRvScaFa)-10)+"px";
       	document.getElementById("obLy").appendChild(addImg);
	goAdd=false;
	} 
  }

function AjaxVec()
  {
  if(document.getElementById("vec"))
    {
    goObj=document.getElementById("vec");
    goObj.parentNode.removeChild(goObj);
    }
  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+"GetVector.asp?p="+oZdv[Z].nRvScaFa+","+oZdv[Z].height+","+sSearchId+","+gsExL+","+gsExB+","+gsPolyDb,ParseFetchVML); 
  //oGetVec.doGet(gsRoot+"GetVector.asp?p="+oZdv[Z].nRvScaFa+","+oZdv[Z].height+","+sSearchId,ParseFetchVML);

}

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+100<document.getElementById("map").offsetWidth*oZdv[z].nScaFa)&&(nGotoHt+100<document.getElementById("map").offsetHeight*oZdv[z].nScaFa))
      {
      nToZoom=z;
      break;
      }
    }
  goAdd=true;  
    FetchPosGoto(nGotoX+","+nGotoY+";");
  //AddressGo(nGotoX+","+nGotoY+";")  
  //AjaxVec(sSearchId);
  };

function ParseFetchGoZoom(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])+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;
      }
    }
    goAdd=true;
  FetchPosGoto(nGotoX+","+nGotoY+";");
  //AddressGo(nGotoX+","+nGotoY+";");
  if (document.getElementById("vec")){AjaxVec();};
  };

function ParseFetchVML(sResult)
  {
  sMapSep=sResult.split("-");
  sVmapId=sMapSep[0];
  VMap=sMapSep[1].split(";");  
  
 
  if(browser!="nonIE")
    {
    oNewVec=document.createElement("DIV");
    oNewVec.id="vec";
    oNewVec.style.zIndex=1;
    oNewVec.style.position="absolute";
    oNewVec.style.top="0px";
    oNewVec.style.left="0px";
    goObj=document.getElementById("ctrl");
    goObj.appendChild(oNewVec);
    document.getElementById("vec").style.left=document.getElementById("rc_").style.left;
    document.getElementById("vec").style.top=document.getElementById("rc_").style.top;
    document.getElementById("vec").style.width=document.getElementById("rc_").style.width;
    document.getElementById("vec").style.height=document.getElementById("rc_").style.height;
    oVml=document.getElementById("vec");
    oShp=document.createElement("v:shape");
    oShp.style.position="absolute";
    oShp.style.width=oZdv[Z].width;
    oShp.style.height=oZdv[Z].height;
    oShp.id=sVmapId+"_shp";
    oShp.coordsize=oZdv[Z].width+","+oZdv[Z].height;
    oShp.path=VMap[0];
    oShp.strokecolor="red";
    oShp.strokeweight="2px";
    oShp.filled="true";
    oShp.fillColor="red";
    oFill=document.createElement("v:fill");
    stroke=document.createElement("v:stroke");
    stroke.opacity="1";
    oFill.opacity=".2";
    stroke.endcap="round";
    oVml.appendChild(oShp);
    oShp.appendChild(stroke);
    oShp.appendChild(oFill);
    oShp2=document.createElement("v:shape");
    oShp2.style.position="absolute";
    oShp2.style.width=oZdv[Z].width;
    oShp2.style.height=oZdv[Z].height;
    oShp2.id=sVmapId+"_box";
    oShp2.coordsize=oZdv[Z].width+","+oZdv[Z].height;
    oShp2.path=VMap[1];
    oShp2.strokecolor="red";
    oShp2.strokeweight="1px";
    oShp2.filled="false";
    oVml.appendChild(oShp2);

    }
  else
    {
    sVstr=VMap[0]+="";
    sVstr=sVstr.replace(/E/g,"z");
    sVstr=sVstr.replace(/X/g,"");
    VMap[0]=VMap[0].replace(/X E/g,"Z");
    oNewVec=document.createElement("DIV");
    oNewVec.id="vec";
    oNewVec.style.zIndex=1;
    oNewVec.style.position="absolute";
    oNewVec.style.top="0px";
    oNewVec.style.left="0px";
    goObj=document.getElementById("ctrl");
    goObj.appendChild(oNewVec);
    document.getElementById("vec").style.left=document.getElementById("rc_").style.left;
    document.getElementById("vec").style.top=document.getElementById("rc_").style.top;
    document.getElementById("vec").style.width=document.getElementById("rc_").style.width;
    document.getElementById("vec").style.height=document.getElementById("rc_").style.height;
    //oVml=document.getElementById("vec");
    oSvg2=document.createElementNS('http://www.w3.org/2000/svg','svg');
    oSvg2.setAttribute('width','400000');
    oSvg2.setAttribute('height','400000');
    oSvg2.setAttribute('viewBox','0 0 400000 400000');
    oShp=document.createElementNS('http://www.w3.org/2000/svg','path');
    oShp.id=sVmapId+"_shp";
    oShp.setAttribute("d",sVstr);
    oShp.setAttribute("stroke","red");
    oShp.setAttribute("stroke-width","2px");
    oShp.setAttribute("fill","red");
    oShp.setAttribute("fill-opacity",".2");
    oShp.setAttribute("stroke-linecap","round");
    oShp.setAttribute("fill-rule","evenodd");
    oSvg2.appendChild(oShp);
    VMap[1]=VMap[1].replace("M","");
    VMap[1]=VMap[1].replace("L","");
    VMap[1]=VMap[1].replace("X","");
    VMap[1]=VMap[1].replace("E","");
    VMap[1]=VMap[1].replace(" ",",");
    oShp2=document.createElementNS('http://www.w3.org/2000/svg','polygon');
    oShp2.id=sVmapId
    oShp2.setAttribute("points",VMap[1]);
    oShp2.setAttribute("stroke","red");
    oShp2.setAttribute("stroke-width","1px");
    oShp2.setAttribute("fill","none");
    oSvg2.appendChild(oShp2);
    document.getElementById("vec").appendChild(oSvg2);
    }
  oImagObj = new Array()
  asImgCoord=VMap[2].split(",");
  oImagObj[0]=document.createElement("IMG");
  oImagObj[0].id=sVmapId;
  oImagObj[0].title="Remove Highlighted Policy";
  oImagObj[0].src="images/vml_cross.gif";
  oImagObj[0].style.position="absolute";
  oImagObj[0].style.top=parseInt(asImgCoord[1])-18+"px";
  oImagObj[0].style.left=parseInt(asImgCoord[0])-18+"px";
  oImagObj[0].style.width="17px";
  oImagObj[0].style.height="18px";
  oImagObj[0].style.zIndex=10;
  //oImagObj[0].onmouseover=function(){document.body.style.cursor="pointer";}
  //oImagObj[0].onclick=function(  
 
  if (document.getElementById("obLy"))
  { 
  document.getElementById("obLy").style.left=document.getElementById("rc_").style.left;
  document.getElementById("obLy").style.top=document.getElementById("rc_").style.top;
  document.getElementById("obLy").style.width=document.getElementById("rc_").style.width;
  document.getElementById("obLy").style.height=document.getElementById("rc_").style.height;
  document.getElementById("obLy").appendChild(oImagObj[0]);
  }

  for(var i=0;i<oImagObj.length;i++)
    {
    AddMap((parseInt(oImagObj[i].style.left)),(parseInt(oImagObj[i].style.top)+parseInt(oImagObj[i].style.height)),(parseInt(oImagObj[i].style.left)+parseInt(oImagObj[i].style.width)),(parseInt(oImagObj[i].style.top)),oImagObj[i].id);
    } 
    if(fullMp==true){ScaIMap();}  
    };

function AddMap(b,l,t,r,id)
  {
  imagMapObj=new Array();
  imagMapObj.push(id+","+b+","+l+","+t+","+r);
  };

function DrSc()
  {
  if(document.getElementById("scBa"))
    {
    goObj=document.getElementById("scBa");
    goObj.parentNode.removeChild(goObj);
    }
   
  if(parent.document.getElementById("MainKeyDiv"))
    { 
  oNewVec=document.createElement("DIV");
  oNewVec.id="scBa";
  oNewVec.style.zIndex=3;
  oNewVec.style.position="absolute";
  oNewVec.style.bottom="0px";
  oNewVec.style.left="0px";
  goObj=document.getElementById("map");
  goObj.appendChild(oNewVec);
  oVml=document.getElementById("scBa");
  nKspc=20;
  nKsx=10;
  nKsy=20;
  sFcol="black";
  nRect1yS=nKsy+nKspc/2;
  nRect1xS=nKsx+nKspc/2;
  nRectlngth=((oZdv[Z].width/(gsExR-gsExL)))*(gsSb[Z*2]/1)/gsSb[(Z*2)+1];

  if(browser!="nonIE")
    {
    //sRect3=document.createElement("v:rect");
    //sRect3.fillColor="black";
    //sRect3.fillOpacity=".2";
    //sRect3.style.position="absolute";
    //sRect3.style.left=nKsx+4+"px";
    //sRect3.style.bottom=nKsy+3+"px";
    //sRect3.style.width=((oZdv[Z].width/(gsExR-gsExL)))*(gsSb[Z*2])+(nKspc*2)+"px";
    //sRect3.style.height=5+(nKspc*2)+"px";
    //sRect3.strokecolor="none";
    //sRect3.strokeweight="0px";
    //sRect3f=document.createElement("v:fill");
    //sRect3f.opacity="50%";
    //sRect3.appendChild(sRect3f);
    //sRecS=document.createElement("v:stroke");
    //sRecS.opacity="0";
    //sRecS.endcap="round";
    //sRecS.weight="2";
    //oVml.appendChild(sRect3);

    //sRect3.appendChild(sRecS);
    //sRect2=document.createElement("v:rect");
    //sRect2.fillcolor="white";
    //sRect2.style.position="absolute";
    //sRect2.style.left=nKsx+"px";
    //sRect2.style.bottom=nKsy+7+"px";
    //sRect2.style.width=((oZdv[Z].width/(gsExR-gsExL)))*(gsSb[Z*2])+(nKspc*2)+"px";
    //sRect2.style.height=5+(nKspc*2)+"px";
    //sRecS=document.createElement("v:stroke");
    //sRecS.opacity="1";
    //sRecS.endcap="round";
    //sRecS.weight="2";
    //oVml.appendChild(sRect2);
    //sRect2.appendChild(sRecS);

    for(var i=0;i<gsSb[(Z*2)+1];i++)
      {
      nRect1xS=nKsx+nKspc+(nRectlngth*i+1);
      sRect1=document.createElement("v:rect");
      sRect1.fillcolor=sFcol;
      sRect1.style.position="absolute";
      sRect1.style.left=nRect1xS+"px";
      sRect1.style.bottom=nRect1yS+10+"px";
      sRect1.style.width=nRectlngth+"px";
      sRect1.style.height=5+"px";
      sRecS=document.createElement("v:stroke");
      sRecS.opacity="1";
      sRecS.endcap="round";
      sRecS.weight="1";
      oVml.appendChild(sRect1);
      sRect1.appendChild(sRecS);
      if(sFcol=="black")
        {
        sFcol="white";
        }
      else
        {
        sFcol="black";
        }
      }
    }
  else
    {

    oSvg=document.createElementNS('http://www.w3.org/2000/svg','svg');
    oSvg.setAttribute('width','400');
    oSvg.setAttribute('height','100');
    oSvg.setAttribute('viewBox','0 0 400 100');
    //sRect3=document.createElementNS('http://www.w3.org/2000/svg','rect');
    //sRect3.setAttribute("fill","black");
    //sRect3.setAttribute("fill-opacity",".2");
    //sRect3.setAttribute("x",nKsx+4);
    //sRect3.setAttribute("y",nKsy+8);
    //sRect3.setAttribute("width",((oZdv[Z].width/(gsExR-gsExL)))*(gsSb[Z*2])+(nKspc*2)+"px");
    //sRect3.setAttribute("height",5+(nKspc*2)+"px");
    oNewVec.appendChild(oSvg);
    //oSvg.appendChild(sRect3);

    //sRect2=document.createElementNS('http://www.w3.org/2000/svg','rect');
    //sRect2.setAttribute("fill","white");
    //sRect2.setAttribute("stroke","black");
    //sRect2.setAttribute("stroke-width","2px");
    //sRect2.setAttribute("x",nKsx+"px");
    //sRect2.setAttribute("y",nKsy+4+"px");
    //sRect2.setAttribute("width",((oZdv[Z].width/(gsExR-gsExL)))*(gsSb[Z*2])+(nKspc*2)+"px");
    //sRect2.setAttribute("height",5+(nKspc*2)+"px");
    //oSvg.appendChild(sRect2);

    for(var i=0;i<gsSb[(Z*2)+1];i++)
      {
      nRect1xS=nKsx+nKspc+(nRectlngth*i+1);
      sRect1=document.createElementNS('http://www.w3.org/2000/svg','rect');
      sRect1.setAttribute("fill",sFcol);
      sRect1.setAttribute("x",nRect1xS+"px");
      sRect1.setAttribute("y",nRect1yS+22+"px");
      sRect1.setAttribute("width",nRectlngth+"px");
      sRect1.setAttribute("height",5+"px");
      sRect1.setAttribute("stroke","black");
      sRect1.setAttribute("stroke-width","2px");
      oSvg.appendChild(sRect1);
      if(sFcol=="black")
        {
        sFcol="white";
        }
      else
        {
        sFcol="black";
        }
      }
    }
  sText1=document.createElement("A");
  sText1.style.position="absolute";
  sText1.style.bottom=nRect1yS+20+"px";
  sText1.style.left=nRect1yS+"px";
  sText1.style.fontSize="15px";
  sText1.style.fontFamily="Arial";
  sText1.innerHTML="0";
  oVml.appendChild(sText1);
  var sSufx="";
  nDvide=gsSb[(Z*2)]/1000;
  if(nDvide>=1)
    {
    sSufx="km";
    sPrfx=parseInt(gsSb[(Z*2)]/1000)+"";
    }
  else
    {
    sSufx="m";
    sPrfx=gsSb[(Z*2)]+"";
    }
  sTextDiv=document.createElement("DIV");
  sTextDiv.style.position="absolute";
  sTextDiv.id="textDiv";
  sTextDiv.style.width="40px";
  sTextDiv.style.height="20px";
  sTextDiv.style.textAlign="right";
  sTextDiv.style.left=(nRect1xS=nKsx+nKspc+(nRectlngth*gsSb[(Z*2)+1]))-38+"px";
  sTextDiv.style.bottom=nRect1yS+18+"px";
  oVml.appendChild(sTextDiv);
  sText2=document.createElement("A");
  sText2.style.fontSize="15px";
  sText2.style.fontFamily="Arial";
  sText2.innerHTML=sPrfx+sSufx;
  document.getElementById("textDiv").appendChild(sText2);
   }
  };

 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";
     }
   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("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;
    }
  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;
      }
      {
      switch(document.body.style.cursor)
        {
        case 'help':       
          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))))<5)         
          {
          FetchPolIm(nWx,nWy);
          }
          break;
        case 'pointer':
          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))))<5)
            {
             gbSwKy=true;
           changeTab();
            }
          break;
        }
      }
    }

  };


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"
             }
           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.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"
             }
           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;
         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)
           {
           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) * 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"
             }
           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.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
         FtchCo(document.getElementById(oZdv[Z].id));
         OvUpd();
         DrSc();
         //RdrVec();
         if(fullMp==true){ScaIMap();}
         if (document.getElementById("vec")){AjaxVec();};
         }
       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)
           {
           sTileIdStrSeg = (goZdivObj.firstChild.id).split("-");
           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"
             }
           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;
         document.getElementById(oZdv[Z].id).style.visibility = 'visible';
         document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top
         FtchCo(document.getElementById(oZdv[Z].id));        
         OvUpd();
         DrSc();
         //RdrVec();
         if(fullMp==true){ScaIMap();}
        if (document.getElementById("vec")){AjaxVec();};
         }
       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("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;
        }
      goZdivObj=document.getElementById(oZdv[Z].id);
      while(goZdivObj.childNodes.length)
        {
        goZdivObj.removeChild(goZdivObj.firstChild);
        }
      FtchCo(document.getElementById(oZdv[Z].id));
      break;

    case 'policy':
      sOutputString='';
      sXgoStVis='';
      count=1;
      DisInf();
      break;

      case 'info':
      document.body.style.cursor="help";
      document.getElementById("MainIframe").contentWindow.document.body.style.cursor = "help";
      break;

    case 'pan_left':
      count=0;
      nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
      oBeginZoom=setInterval("ZoomStep((10*Z),0)",1);
      break;

    case 'pan_right':
      count=0;
      nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
      oBeginZoom=setInterval("ZoomStep((-10*Z),0)",1);
      break;

    case 'pan_up':
      count=0;
      nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
      oBeginZoom=setInterval("ZoomStep(0,(10*Z))",1);
      break;

    case 'pan_down':
      count=0;
      nTmp=parseInt(document.getElementById("imHld").offsetHeight)*.015;
      oBeginZoom=setInterval("ZoomStep(0,(-10*Z))",1);
      break;

    case 'reset':
    window.parent.location.replace( gsPage );
     // location.reload(true);
      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 AddressGoParse(sResult)
  {
  //nToZoom=8;
  //goAdd=true;
  AddressGo(sResult)
  if (document.getElementById("vec")){AjaxVec();};
  }

function PostGoParse(sResult)
  {
  nToZoom=8;
  //goAdd=false;
  AddressGo(sResult)
  if (document.getElementById("vec")){AjaxVec();};
  }

function AddressGo(sResult)
  {
  document.getElementById(oZdv[Z].id).style.visibility='hidden';
    if(document.getElementById("imgAdd"))
    {
    reOj=document.getElementById("imgAdd")
    reOj.parentNode.removeChild(reOj)
  }
  var aAddString=sResult.split(";");
  var asCoords=aAddString[0].split(",");
  sCoordX=asCoords[0];
  sCoordY=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(oZdv[nToZoom].id).style.visibility='visible';
    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 (document.getElementById('MainKeyDiv'))
      {
    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(document.getElementById("vec"))
     //{
     //AjaxVec();
     //}
    if(fullMp==true)
    {
    ScaIMap();
    document.getElementById("tbar").style.top=document.getElementById("tsec"+Z).style.top;
    OvUpd();
    DrSc();
    FtchCo(document.getElementById(oZdv[Z].id));
    }else{
    FtchCo(document.getElementById(oZdv[Z].id));
    }
    
     
    
    }
 
 };

 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-60+"px";
       parent.document.getElementById("MainIframe").style.width = myWidth-400+"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-400-(kyAdjust)+"px";
       parent.document.getElementById("MainKeyDiv").style.height = myHeight-60-(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<7;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").style.height=parent.document.getElementById("info3").offsetHeight-150+"px"
 	}
 	}

}

}

function NoOutput(){};



function ClpsDiv(id)
  {
  id=id.split('cont');
  if(document.getElementById(id[0]+"div").style.display=='none')
    {
    document.getElementById(id[0]+"div").style.display='block';

    document.getElementById(id[0]+"cont").src="images/contract.gif";

    var n=0;
    var o=0;
    for(var i=1;i<5;i++)
      {
      if(document.getElementById((id[0]).substring(0,id[0].length-1)+i))
        {
        n++;
        if(document.getElementById((id[0]).substring(0,id[0].length-1)+i+'cont').className=='contract')
          {
          o++;
          }
        }
      }
    document.getElementById(id[0]+"cont").className='contract';

    for(var i=1;i<n+1;i++)
      {
      if(document.getElementById((id[0]).substring(0,id[0].length-1)+i+'cont').className=='contract')
        {
        switch(o+1)
          {
          case 1:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="78%";
            break;
          case 2:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="44%";
            break;
          case 3:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="31%";
            break;
          }         
        }
      }

    if(fullMp=true){AdjLyt();}
   
   }
  else
    {
   document.getElementById(id[0]+"div").style.display='none';
    document.getElementById(id[0]).style.height="7%";
    document.getElementById(id[0]+"cont").src="images/expand.gif";
    document.getElementById(id[0]+"cont").className="expand";
    var n=0;
    var o=0;

    for(var i=1;i<5;i++)
      {
      if(document.getElementById((id[0]).substring(0,id[0].length-1)+i))
        {
        n++;
        if(document.getElementById((id[0]).substring(0,id[0].length-1)+i+'cont').className=='contract')
          {
          o++;
          }
        }
      }
    for(var i=1;i<n+1;i++)
      {
      if(document.getElementById((id[0]).substring(0,id[0].length-1)+i+'cont').className=='contract')
        {
        switch(o)
          {
          case 1:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="78%";
            break;
          case 2:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="44%";       
            break;
          case 3:
            document.getElementById(((id[0]).substring(0,id[0].length-1)+i)).style.height="31%";
            break;
          }
        }
      }

       if(fullMp=true){AdjLyt();}
    }
     if(parent.document.getElementById('MainKeyDiv'))
  {
  if(document.getElementById("imgPol")&&document.getElementById("imgPol").style.visibility=="hidden"||!document.getElementById("imgPol"))
  {
  document.getElementById("info2OutputIfr").src="Key_Items/key"+gnTl+".htm";
  }
  document.getElementById("info2OutputIfr").style.overflow="hidden";
  }      
  };


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 PostOutput(sResult)
{
 aAjaxHtml=sResult.split("~");
 oldDiv = parent.document.getElementById('info3Output'); 
 newDiv = parent.document.createElement(oldDiv.tagName); 
 newDiv.id = oldDiv.id;
 newDiv.className = oldDiv.className;
 newDiv.style.position = oldDiv.style.position
 newDiv.style.top = oldDiv.style.top
 newDiv.style.left = oldDiv.style.left
 newDiv.style.height = oldDiv.style.height
 newDiv.style.width = oldDiv.style.width
 newDiv.style.overflow="auto"
 newDiv.style.height=parent.document.getElementById("info3").offsetHeight-150
// aAjaxHtml[1]=aAjaxHtml[1].replace(/@/g," title='Goto address' onmouseover=this.className='on' onmouseout=this.className='off'");
 //aAjaxHtml[1]=aAjaxHtml[1].replace(/#/g," title='Add to saved' onmouseover=this.className='on_2' onmouseout=this.className='off_2'");
 newDiv.innerHTML = aAjaxHtml[1];
  var aChild= newDiv.childNodes
  for(var i=0; i!=newDiv.childNodes.length; i++)
  {
  aChild[i].onclick=function(){goAdd=false;FetchPosGoto(this.id)}
  if(aChild[i].id=='mrResults'){aChild[i].onclick=function(){MorePoRes(sPosString);};}
  } 
 oldDiv.parentNode.replaceChild(newDiv, oldDiv);
  
 if (parent.document.getElementById("toTop"))
 {
 parent.document.getElementById("toTop").scrollIntoView(true);
 }
  nBkMrk=parseInt(aAjaxHtml[0]);
  document.getElementById('ajLodIm').style.visibility='hidden';
  //gnAt=0;
  };

function MorePoRes(variable)
  {
  sElem=parent.document.getElementById("info3Output");
  sElem.innerHTML="";
  document.getElementById('ajLodIm').style.visibility='visible';
  var oPostFetch=new Ajax();
  oPostFetch.method='GET';
  oPostFetch.async=true;
  oPostFetch.doGet(gsRoot+"Postcode_search.asp?p="+sPosString+"&bk="+nBkMrk+"&db="+gsPcDb,PostOutput);
  };

function FindAdd()
  {
  sPutString=parent.document.getElementById("AddressSearch").value;
  document.getElementById('ajLodIm').style.visibility='visible';
  nBkMrk=0;
  bNum=0;
  sNumString='';
  sRoadString='';
  nLetCnt=0;
  nUnSpecCnt=0;
  sUnSpecStr='';
  sPostCodeString='';
  inDivString=new Array("");
  anString=new Array("");
  asAlphaString=new Array("");
  nString=new Array("");
  sPutString=sPutString.replace(/,/g,"").replace(/\s+/g," ").replace(/^\s|\s$/g,"");
  sPutString=sPutString.split(" ");
  for(i=0;i<sPutString.length;i++)
    {
    sPutString[i]=sPutString[i].replace(/,/g,"").replace(/ \s+/g," ").replace(/^\s|\s$/g,"");
    }
  aSuf=new Array("Rd","Gr","Str","Ave","Ct","Cl","nWy","Ln","Cr","Wlk","Tr","Arc","Mws","Pl","Dr","Sq");
  aWhlSuf=new Array("Road","Grove","Street","Avenue","Court","Close","Way","Lane","Crescent","Walk","Terrace","Arcade","Mews","Place","Drive","Square");
  
  for(var o=0;o<=sPutString.length-1;o++)
    {
    for(var i=0;i<=aSuf.length-1;i++)
      {
      if(sPutString[o].toUpperCase()==aSuf[i].toUpperCase()||sPutString[o].toUpperCase()==aWhlSuf[i].toUpperCase())
        {
        if(sPutString.length>1)
          {            
            sPutString[o]=aWhlSuf[i];
            bNum=o;
            bExist=true;
            break;
          }
        }
      else
        {
        bExist=false;
        }
      }
    if(bExist==true)
      {
      if(o>0)
        {
        for(p=o;p+1>0;p--)
          {
          asLetString=sPutString[p].split('');
          for(i=0;i<asLetString.length;i++)
            {
            if(isNaN(asLetString[i]))
              {
              nLetCnt++;
              }
            }
          if(nLetCnt==sPutString[p].length)
            {
            sRoadString=sPutString[p]+" "+sRoadString;
            nLetCnt=0;
            }
          else
            {
            sNumString=(sPutString[p]);
            nLetCnt=0;
            }
          }
        }
      }
    else
      {
      inDivString[nUnSpecCnt]=sPutString[o];
      nUnSpecCnt++;
      bExist=false;
      }
    }

  sElem=parent.document.getElementById("info3Output");
  sElem.innerHTML="";
  anCount=0;
  nAcount=0;
  nNcnt=0;
  nLcnt=0;

  for(o=0;o<=inDivString.length-1;o++)
    {
    asLetString=inDivString[o].split('');
    for(i=0;i<=inDivString[o].length-1;i++)
      {
      if(isNaN(asLetString[i]))
        {
        nLcnt++;
        }
      }

    if(nLcnt==inDivString[o].length)
      {
      asAlphaString[anCount]=inDivString[o];
      asAlphaString[anCount]=asAlphaString[anCount].toLowerCase();
      asAlphaString[anCount]=asAlphaString[anCount].substr(0,1).toUpperCase()+asAlphaString[anCount].substr(1,asAlphaString[anCount].length);
      anCount++
      }
    else if(nLcnt>0&&nLcnt<inDivString[o].length)
      {
      anString[anCount]=inDivString[o];
      anCount++;
      }
    else if(nLcnt==0)
      {
      nString[nNcnt]=inDivString[o];
      nNcnt++;
      }
    nLcnt=0;
    }

  for(i=0;i<anString.length;i++)
    {
    if(anString[i]!=""&&anString[i]!=undefined)
      {
      sPostCodeString+=anString[i];
      }
    }

  sNumString=nString[0];

  if(!nString[0])
    {
    nString[0]="";
    }
  if(!nString[0])
    {
    nString[0]="";
    }

  if(sNumString!="")
    {
    sNumString=parseInt(sNumString.replace(/,/g,"").replace(/ \s+/g," ").replace(/^\s|\s$/g,""));
  };
  sRoadString=sRoadString.replace(/,/g,"").replace(/ \s+/g," ").replace(/^\s|\s$/g,"");
  sPostCodeString=sPostCodeString.replace(/,/g,"").replace(/ \s+/g," ").replace(/^\s|\s$/g,"");
  if(sRoadString!="")
    {
    asAlphaString[0]="";
    }
  var oAddFetch=new Ajax();
  oAddFetch.method='GET';
  oAddFetch.async=true;
  oAddFetch.doGet(gsRoot+"Address_search_(v2.0).asp?n="+sNumString+"&r="+sRoadString+"&p="+sPostCodeString+"&a="+asAlphaString[0]+"&nu="+nString[0]+"&bk="+nBkMrk+"&be="+bExist+"&bn="+bNum+"&db="+gsAdDb,AddOutput);
  };

function AddOutput(sResult)
  {
  aAjaxHtml=sResult.split("~");
  if(aAjaxHtml[1]==""&&gnAt==0)
    {
    gnAt=1;
    asIndRdNames=sRoadString.split(" ");
    if(asIndRdNames.length>3)
      {
      sRoadString=asIndRdNames[asIndRdNames.length-2]+" "+asIndRdNames[asIndRdNames.length-1];
      var oAddFetch=new Ajax();
      oAddFetch.method='GET';
      oAddFetch.async=true;
      oAddFetch.doGet(gsRoot+"n="+sNumString+"&r="+sRoadString+"&p="+sPostCodeString+"&a="+asAlphaString[0]+"&nu="+nString[0]+"&bk="+nBkMrk+"&db="+gsAdDb,AddOutput);
      }
    }
 oldDiv = parent.document.getElementById('info3Output'); 
 newDiv = parent.document.createElement(oldDiv.tagName); 
 newDiv.id = oldDiv.id;
 newDiv.className = oldDiv.className;
 newDiv.style.position = oldDiv.style.position
 newDiv.style.top = oldDiv.style.top
 newDiv.style.left = oldDiv.style.left
 newDiv.style.height = oldDiv.style.height
 newDiv.style.width = oldDiv.style.width
 newDiv.style.overflow="auto"
 newDiv.style.height=parent.document.getElementById("info3").offsetHeight-150
 aAjaxHtml[1]=aAjaxHtml[1].replace(/@/g," title='Goto address'");
// aAjaxHtml[1]=aAjaxHtml[1].replace(/#/g,'class="off" ') 
 newDiv.innerHTML = aAjaxHtml[1]; 
  var aChild= newDiv.childNodes
  for(var i=0; i<newDiv.childNodes.length; i++)
  {
  if(aChild[i].tagName=="DIV"&&aChild[i].className!="adtp"){
  aChild[i].className="off"
  aChild[i].onclick=function(){goAdd=true;FetchPosGoto(this.id);}
  aChild[i].onmouseover=function(){this.className="on"}
  
  aChild[i].onmouseout=function(){this.className="off"}
  if(aChild[i].id=='mrResults'){aChild[i].onclick=function(){MoreRes(sRoadString);};}
  }
  } 
 
 oldDiv.parentNode.replaceChild(newDiv, oldDiv);

 if (parent.document.getElementById("toTop"))
 {
 parent.document.getElementById("toTop").scrollIntoView(true);
 }
  nBkMrk=parseInt(aAjaxHtml[0]);
  document.getElementById('ajLodIm').style.visibility='hidden';
  gnAt=0;
  //parent.document.getElementById("info1Output").style.height=document.getElementById("info1ScrollHold").offsetHeight-30+"px"
  };

function MoreRes(variable)
  {
  sElem=parent.document.getElementById("info3Output");
  sElem.innerHTML="";
  document.getElementById('ajLodIm').style.visibility='visible';
  var oAddFetch=new Ajax();
  oAddFetch.method='GET';
  oAddFetch.async=true;
  oAddFetch.doGet(gsRoot+"Address_search_(v2.0).asp?n="+sNumString+"&r="+sRoadString+"&p="+sPostCodeString+"&a="+asAlphaString[0]+"&nu="+nString[0]+"&bk="+nBkMrk+"&db="+gsAdDb,AddOutput);
  };

function printASP(scaString,widString,idString,oZdvWidthString,gsExRString,gsExLString,gsSbString,gsSbString2,sVecFntSz)
  {
  wmString=document.title
  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";
      } 
  oVml=document.createElement("DIV");
  oVml.id="prWater";
  oVml.style.zIndex=4;
  oVml.style.position="absolute";
  oVml.style.top="0px";
  oVml.style.left="0px";  
  goObj=document.getElementById("map");
  goObj.appendChild(oVml);
  wmArray=wmString.split(' ') 

   if(browser!="nonIE")
   {  
   for (var i=0;i <wmArray.length;i++)
   {   	
    oVml= document.getElementById("prWater"); 
    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-(sVecFntSz*(wmArray.length)))/2+(sVecFntSz*(i+1))-(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+"px";
    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);
    }
           
    
    }
   else
    {
    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-(sVecFntSz*(wmArray.length)))/2+(sVecFntSz*(i+1))-(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);  
    oVml.appendChild(oSvg2);
    }    
}   
  oNewVec=document.createElement("DIV");
  oNewVec.id="scBa";
  oNewVec.style.zIndex=3;
  oNewVec.style.position="absolute";
  oNewVec.style.bottom="0px";
  oNewVec.style.left="0px";
  goObj=document.getElementById("map");
  goObj.appendChild(oNewVec);
  oVml=document.getElementById("scBa");
  nKspc=20;
  nKsx=10;
  nKsy=20;
  sFcol="black";
  nRect1yS=nKsy+nKspc/2;
  nRect1xS=nKsx+nKspc/2;
  nRectlngth=((oZdvWidthString/(gsExRString-gsExLString)))*(gsSbString/1)/gsSbString2;
  
if(browser!="nonIE")
    {    
    sRect2=document.createElement("v:rect");
    sRect2.fillcolor="white";
    sRect2.style.position="absolute";
    sRect2.style.left=nKsx+"px";
    sRect2.style.bottom=nKsy+7+"px";
    sRect2.style.width=((oZdvWidthString/(gsExRString-gsExLString)))*(gsSbString)+(nKspc*2)+"px";
    sRect2.style.height=5+(nKspc*2)+"px";
    sRecS=document.createElement("v:stroke");
    sRecS.opacity="1";
    sRecS.endcap="round";
    sRecS.weight="2";
    oVml.appendChild(sRect2);
    sRect2.appendChild(sRecS);

    for(var i=0;i<gsSbString2;i++)
      {
      nRect1xS=nKsx+nKspc+(nRectlngth*i+1);
      sRect1=document.createElement("v:rect");
      sRect1.fillcolor=sFcol;
      sRect1.style.position="absolute";
      sRect1.style.left=nRect1xS+"px";
      sRect1.style.bottom=nRect1yS+10+"px";
      sRect1.style.width=nRectlngth+"px";
      sRect1.style.height=5+"px";
      sRecS=document.createElement("v:stroke");
      sRecS.opacity="1";
      sRecS.endcap="round";
      sRecS.weight="1";
      oVml.appendChild(sRect1);
      sRect1.appendChild(sRecS);
      if(sFcol=="black")
        {
        sFcol="white";
        }else{
        sFcol="black";
        }
      }
   }else{
   oSvg=document.createElementNS('http://www.w3.org/2000/svg','svg');
   oSvg.setAttribute('width','400');
   oSvg.setAttribute('height','100');
   oSvg.setAttribute('viewBox','0 0 400 100');
   sRect2=document.createElementNS('http://www.w3.org/2000/svg','rect');
   sRect2.setAttribute("fill","white");
   sRect2.setAttribute("stroke","black");
   sRect2.setAttribute("stroke-width","2px");
   sRect2.setAttribute("x",nKsx+"px");
   sRect2.setAttribute("y",nKsy+4+"px");
   sRect2.setAttribute("width",((oZdvWidthString/(gsExRString-gsExLString)))*(gsSbString)+(nKspc*2)+"px");
   sRect2.setAttribute("height",5+(nKspc*2)+"px");
   oSvg.appendChild(sRect2);

   
   for(var i=0;i<gsSbString2;i++)
   {
   nRect1xS=nKsx+nKspc+(nRectlngth*i+1);
   sRect1=document.createElementNS('http://www.w3.org/2000/svg','rect');
   sRect1.setAttribute("fill",sFcol);
   sRect1.setAttribute("x",nRect1xS+"px");
   sRect1.setAttribute("y",nRect1yS+22+"px");
   sRect1.setAttribute("width",nRectlngth+"px");
   sRect1.setAttribute("height",5+"px");
   sRect1.setAttribute("stroke","black");
   sRect1.setAttribute("stroke-width","2px");
   oSvg.appendChild(sRect1);
   if(sFcol=="black")
   {
   sFcol="white";
   }
   else
   {
   sFcol="black";
   }
   }
    oVml.appendChild(oSvg)
    }  
  sText1=document.createElement("A");
  sText1.style.position="absolute";
  sText1.style.bottom=nRect1yS+20+"px";
  sText1.style.left=nRect1yS+"px";
  sText1.style.fontSize="15px";
  sText1.style.fontFamily="Arial";
  sText1.innerHTML="0";
  oVml.appendChild(sText1);
  var sSufx="";
  nDvide=gsSbString/1000;
  if(nDvide>=1)
    {
    sSufx="km";
    sPrfx=parseInt(gsSbString/1000)+"";
    }
  else
    {
    sSufx="m";
    sPrfx=gsSbString+"";
    }
  sTextDiv=document.createElement("DIV");
  sTextDiv.style.position="absolute";
  sTextDiv.id="textDiv";
  sTextDiv.style.width="40px";
  sTextDiv.style.height="20px";
  sTextDiv.style.textAlign="right";
  sTextDiv.style.left=(nRect1xS=nKsx+nKspc+(nRectlngth*gsSbString2))-38+"px";
  sTextDiv.style.bottom=nRect1yS+18+"px";
  oVml.appendChild(sTextDiv);
  sText2=document.createElement("A");
  sText2.style.fontSize="15px";
  sText2.style.fontFamily="Arial";
  sText2.innerHTML=sPrfx+sSufx;
  document.getElementById("textDiv").appendChild(sText2);  
  gsRoot='http://www.cartogold.co.uk/Milton_Keynes_3/';
  wdth=780;
  ht=480;
  var oGetVec=new Ajax();
  oGetVec.method='GET';
  oGetVec.async=true;
  oGetVec.doGet(gsRoot+"GetVector.asp?p="+scaString+","+widString+","+idString,ParseAspFetchVML);
  }
  

  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")
     {
     oNewVec=document.createElement("DIV");
     oNewVec.id="vec";
     oNewVec.style.zIndex=100;
     oNewVec.style.position="absolute";
     oNewVec.style.top="0px";
     oNewVec.style.left="0px";
     goObj=document.getElementById("zDiv");
     goObj.appendChild(oNewVec);
     oVml=document.getElementById("vec");
     oShp=document.createElement("v:shape");
     oShp.style.position="absolute";
     oShp.style.width=wdth;
     oShp.style.height=ht;
     oShp.id=sVmapId+"_shp";
     oShp.coordsize=wdth+","+ht;
     oShp.path=VMap[0];
     oShp.strokecolor="red";
     oShp.strokeweight="2px";
     oShp.filled="true";
     oShp.fillColor="red";
     oFill=document.createElement("v:fill");
     stroke=document.createElement("v:stroke");
     stroke.opacity="1";
     oFill.opacity=".2";
     stroke.endcap="round";
     oVml.appendChild(oShp);
     oShp.appendChild(stroke);
     oShp.appendChild(oFill);
     }else{
     
    sVstr=VMap[0]+="";
    sVstr=sVstr.replace(/E/g,"z");
    sVstr=sVstr.replace(/X/g,"");
    VMap[0]=VMap[0].replace(/X E/g,"Z");
    oNewVec=document.createElement("DIV");
    oNewVec.id="vec";
    oNewVec.style.zIndex=100;
    oNewVec.style.position="absolute";
    oNewVec.style.top="0px";
    oNewVec.style.left="0px";
    goObj=document.getElementById("zDiv");
    goObj.appendChild(oNewVec);
    oSvg2=document.createElementNS('http://www.w3.org/2000/svg','svg');
    oSvg2.setAttribute('width','400000');
    oSvg2.setAttribute('height','400000');
    oSvg2.setAttribute('viewBox','0 0 400000 400000');
    oShp=document.createElementNS('http://www.w3.org/2000/svg','path');
    oShp.id=sVmapId+"_shp";
    oShp.setAttribute("d",sVstr);
    oShp.setAttribute("stroke","red");
    oShp.setAttribute("stroke-width","2px");
    oShp.setAttribute("fill","red");
    oShp.setAttribute("fill-opacity",".2");
    oShp.setAttribute("stroke-linecap","round");
    oShp.setAttribute("fill-rule","evenodd");
    oSvg2.appendChild(oShp);
    document.getElementById("vec").appendChild(oSvg2);
    }
   }

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)
 {
 if(document.getElementById('info1')){
 document.getElementById('info1').style.display='none';
 document.getElementById('info2').style.display='none';
 document.getElementById('info3').style.display='none';
 document.getElementById('info4').style.display='none';
 document.getElementById('info5').style.display='none';
 document.getElementById('info6').style.display='none';
 document.getElementById('info7').style.display='none';
 pageObj=document
 }
 
 if(parent.document.getElementById('info1')){
 parent.document.getElementById('info1').style.display='none';
 parent.document.getElementById('info2').style.display='none';
 parent.document.getElementById('info3').style.display='none';
 parent.document.getElementById('info4').style.display='none';
 parent.document.getElementById('info5').style.display='none';
 parent.document.getElementById('info6').style.display='none';
 parent.document.getElementById('info7').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_POLICYINFO':
 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';
 break;
 
 case 'tDIV_SEARCH':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info3').style.visibility='visible'
 pageObj.getElementById('info3').style.display='block';
 pageObj.getElementById("info3Output").style.height=pageObj.getElementById("info3").offsetHeight-150+"px"
 break;
 
 case 'tDIV_WRITTENSTATEMENT':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info4').style.visibility='visible'
 document.getElementById('info4').style.display='block';
 pageObj;
 break;
 
 case 'tDIV_LINKS':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info5').style.visibility='visible'
 pageObj.getElementById('info5').style.display='block';
 break;
 
 case 'tDIV_SAVED':
 document.getElementById(id).className="on_3"
 pageObj.getElementById('info7').style.visibility='visible'
 pageObj.getElementById('info7').style.display='block';
 pageObj.getElementById('info7Output').style.visibility='visible'
 pageObj.getElementById('info7Output').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('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;
 }
}

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 saveAd(content,id)
{



 objDiv = document.getElementById('info7Output');
 newDiv = document.createElement("DIV");
 newDiv.className="adtp";
 objDiv.appendChild(newDiv);
 
 newDiv = document.createElement("DIV");
 newDiv.id=id;
 newDiv.className="off";
 objDiv.appendChild(newDiv);
  
 newTxt = document.createElement("A");
 newTxt.className="addressSaved";
 newTxt.innerHTML=content;
 newDiv.appendChild(newTxt);
 
 
  
 //newDiv.innerHTML=document.getElementById(content).innerHTML+"</DIV>"

 //newDiv.id = oldDiv.id;
 //newDiv.className = oldDiv.className;
 //newDiv.style.position = oldDiv.style.position
 //newDiv.style.top = oldDiv.style.top
 //newDiv.style.left = oldDiv.style.left
 //newDiv.style.height = oldDiv.style.height
 //newDiv.style.width = oldDiv.style.width
 //newDiv.style.overflow="auto"
 //newDiv.style.height=document.getElementById("info7").offsetHeight-150
 //aAjaxHtml[1]=aAjaxHtml[1].replace(/@/g," title='Goto address' onmouseover=this.className='on' onmouseout=this.className='off'");
 //aAjaxHtml[1]=aAjaxHtml[1].replace(/#/g," title='Add to saved' onmouseover=this.className='on_2' onmouseout=this.className='off_2'");
 //newDiv.innerHTML = document.getElementById(content).innerHTML+"</DIV>"; 
 //var aChild= newDiv.childNodes
 // for(var i=0; i!=newDiv.childNodes.length; i++)
 // {
 // aChild[i].onclick=function(){AddressGoParse(this.id);}
 // if(aChild[i].id=='mrResults'){aChild[i].onclick=function(){MoreRes(sRoadString);};}
 // } 
 //oldDiv.parentNode.replaceChild(newDiv, oldDiv); 
 //if (parent.document.getElementById("toTop"))
 //{
 //parent.document.getElementById("toTop").scrollIntoView(true);
 //}
 // nBkMrk=parseInt(aAjaxHtml[0]);
 //document.getElementById('ajLodIm').style.visibility='hidden';
 //gnAt=0;
 //parent.document.getElementById("info1Output").style.height=document.getElementById("info1ScrollHold").offsetHeight-30+"px"

}

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 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;
  }
