function KMLObj(title,desc,op,fid){this.title=title;this.description=escape(desc);this.marks=[];this.folders=[];this.groundOverlays=[];this.open=op;this.folderid=fid;};function Lance$(mid){return document.getElementById(mid);};var topwin=self;function GeoXml(myvar,map,url,opts){this.myvar=myvar;this.opts=opts||{};this.mb=new MessageBox(map,this,"mb",this.opts.messagebox);this.map=map;this.url=url;if(typeof url=="string"){this.urls=[url];}else{this.urls=url;};this.mb.style=this.opts.messagestyle||{backgroundColor:"silver"};this.alwayspop=this.opts.alwaysinfopop||false;this.quiet=this.opts.quiet||false;this.titlestyle=this.opts.titlestyle||'style = "font-family: arial, sans-serif;font-size: medium;font-weight:bold;font-size: 100%;"';this.descstyle=this.opts.descstyle||'style = "font-family: arial, sans-serif;font-size: small;padding-bottom:.7em;"';this.directionstyle=this.opts.directionstyle||'style="font-family: arial, sans-serif;font-size: small;padding-left: 1px;padding-top: 1px;padding-right: 4px;"';this.sidebarfn=this.opts.sidebarfn||GeoXml.addSidebar;this.pointlabelopacity=this.opts.pointlabelopacity||100;this.polylabelopacity=this.opts.polylabelopacity||100;this.hilite=this.opts.hilite||{color:"#aaffff",opacity:0.3,textcolor:"#000000"};this.latestsidebar="";this.forcefoldersopen=false;if(typeof this.opts.allfoldersopen!="undefined"){this.forcefoldersopen=this.opts.allfoldersopen;};this.clickablepolys=true;if(typeof this.opts.clickablepolys=="boolean"){this.clickablepolys=this.opts.clickablepolys;};this.clickablemarkers=true;if(typeof this.opts.clickablemarkers=="boolean"){this.clickablemarkers=this.opts.clickablemarkers;};this.clickablelines=true;if(typeof this.opts.clickablelines=="boolean"){this.clickablelines=this.opts.clickablelines;};if(typeof this.opts.nolegend!="undefined"){this.nolegend=true;};if(typeof this.opts.preloadHTML=="undefined"){this.opts.preloadHTML=true;};this.hideall=false;if(typeof proxy!="undefined"){this.proxy=proxy;};if(!this.proxy&&typeof getcapproxy!="undefined"){if(fixUrlEnd){getcapproxy=fixUrlEnd(getcapproxy);}};if(this.opts.hideall){this.hideall=this.opts.hideall;};this.publishdirectory="http://www.dyasdesigns.com/tntmap/";topwin=top;try{topname=top.title;}catch(err){topwin=self;};if(topwin.publishdirectory){this.publishdirectory=topwin.publishdirectory;};if(topwin.standalone){this.publishdirectory="";};this.kmlicon=this.publishdirectory+"images/ge.png";this.docicon=this.publishdirectory+"images/ge.png";this.foldericon=this.publishdirectory+"images/folder.png";this.gmlicon=this.publishdirectory+"images/geo.gif";this.rssicon=this.publishdirectory+"images/rssb.png";this.globalicon=this.publishdirectory+"images/geo.gif";this.WMSICON="";GeoXml.WMSICON=this.WMSICON;this.baseLayers=[];this.bounds=new GLatLngBounds();this.style={width:2,opacity:0.75,fillopacity:0.4};this.style.color=this.randomColor();this.style.fillcolor=this.randomColor();this.iwwidth=this.opts.iwwidth||400;this.lastmarker={};this.verySmall=0.0000001;this.progress=0;this.ZoomFactor=2;this.NumLevels=18;this.maxtitlewidth=0;this.styles=[];this.jsdocs=[];this.jsonmarks=[];this.polyset=[];this.polygons=[];this.polylines=[];this.multibounds=[];this.overlayman=new Clusterer(map,this);this.overlayman.rowHeight=20;if(this.opts.sidebarid){this.basesidebar=this.opts.sidebarid;};this.kml=[new KMLObj("GeoXML","",true,0)];this.overlayman.folders.push([]);this.overlayman.subfolders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.folderBounds.push(new GLatLngBounds());this.wmscount=0;this.labels=new GTileLayerOverlay(G_HYBRID_MAP.getTileLayers()[1]);this.unnamedpath="un-named path";this.unnamedplace="un-named place";this.unnamedarea="un-named area";};GeoXml.prototype.showIt=function(str,h,w){var features="status=yes,resizable=yes,toolbar=0,height="+h+",width="+h+",scrollbars=yes";var myWin;if(topwin.widget){alert(str);this.mb.showMess(str);}else{myWin=window.open("","_blank",features);myWin.document.open("text/xml");myWin.document.write(str);myWin.document.close();}};GeoXml.prototype.clear=function(idx){for(var m=0;m"+"

"+name+"

"+"
"+desc+"
";if(this.opts.directions){html1=html+'
'+'Get Directions: To Here - '+'From Here
'+'Search nearby
';html2=html+'
'+'Get Directions: To here - '+'From Here
'+'Start address:
'+''+''+''+'
« Back
';html3=html+'
'+'Get Directions: To Here - '+'From Here
'+'End address:'+''+''+''+'
« Back
';html4=html+'
'+'Search nearby: e.g. "pizza"
'+''+''+''+''+'
« Back
';GEvent.addListener(m,"click2",function(){m.openInfoWindowHtml(html2+"",iwoptions);});GEvent.addListener(m,"click3",function(){m.openInfoWindowHtml(html3+"",iwoptions);});GEvent.addListener(m,"click4",function(){m.openInfoWindowHtml(html4+"",iwoptions);});}else{html1=html;}if(this.clickablemarkers){GEvent.addListener(m,"click",function(){eval(myvar+".lastmarker = m");m.openInfoWindowHtml(html1+"",iwoptions);});}if(this.opts.domouseover){m.mess=html1+"";m.geoxml=this;GEvent.addListener(m,"mouseover",function(point){if(!point){point=m.getPoint();}m.geoxml.mb.showMess(m.mess,5000);});}var nhtml="";var parm;if(this.opts.sidebarid){var folderid=this.myvar+"_folder"+idx;var n=this.overlayman.markers.length;var blob="  ";parm=this.myvar+"$$$"+name+"$$$marker$$$"+n+"$$$"+blob+"$$$"+visible+"$$$null";m.sidebarid=this.myvar+"sb"+n;m.hilite=this.hilite;m.geoxml=this;GEvent.addListener(m,"mouseover",function(){var bar=Lance$(this.sidebarid);if(bar&&typeof bar!="undefined"){bar.style.backgroundColor=this.hilite.color;bar.style.color=this.hilite.textcolor;}});GEvent.addListener(m,"mouseout",function(){var bar=Lance$(this.sidebarid);if(bar&&typeof bar!="undefined"){bar.style.background="none";bar.style.color="";}});}if(!!this.opts.addmarker){this.opts.addmarker(m,name,idx,parm,visible);}else{this.overlayman.AddMarker(m,name,idx,parm,visible);}};GeoXml.getDescription=function(node){var sub="";var n=0;var cn;if(document.all){for(;n","");u=u.replace(/\&/g,"&");u=u.replace(/\</g,"<");u=u.replace(/\"/g,'"');u=u.replace(/\'/g,"'");u=u.replace(/\>/g,">");return u;};GeoXml.prototype.processLine=function(pnum,lnum,idx){var that=this;var op=this.polylines[pnum];var line=op.lines[lnum];var obj;var p;if(!line){return;}var thismap=this.map;var iwoptions=this.opts.iwoptions||{};var polylineEncoder=new PolylineEncoder(this.NumLevels,this.ZoomFactor,this.verySmall,true);if(line.length>2){var result=polylineEncoder.dpEncode(line);obj={points:result.encodedPoints,levels:result.encodedLevels,color:op.color,weight:op.width,opacity:op.opacity,clickable:op.clickablepolys,zoomFactor:this.ZoomFactor,numLevels:this.NumLevels,type:"polyline"};p=new GPolyline.fromEncoded(obj);}else{obj={points:line,color:op.color,weight:op.width,opacity:op.opacity,type:"line",id:op.id};p=new GPolyline(line,op.color,op.width,op.opacity);}p.bounds=op.pbounds;p.id=op.id;var nhtml="";var n=this.overlayman.markers.length;this.polylines[pnum].lineidx.push(n);var parm;var awidth=this.iwwidth;var desc=op.description;if(desc.length*8"+desc+"";if(lnum==0){if(this.opts.sidebarid){var blob='    ';parm=this.myvar+"$$$"+op.name+"$$$polyline$$$"+n+"$$$"+blob+"$$$"+op.visibility+"$$$"+pnum+"$$$";this.latestsidebar=this.myvar+"sb"+n;}}if(lnum"+"
"+desc+"
";var newgeom=(lastpoly!="p_"+op.name);if(newgeom&&this.opts.sidebarid){this.latestsidebar=that.myvar+"sb"+this.overlayman.markers.length;}else{this.latestsidebar="";}if(that.opts.domouseover){p.mess=html;}p.strokeColor=op.polylines[0].color;p.mb=that.mb;p.hilite=that.hilite;p.strokeOpacity=op.polylines[0].opacity;p.fillOpacity=op.opacity;p.fillColor=op.color;if(!op.fill){p.fillOpacity=0.0;}if(that.domouseover){p.mess=html;}p.geoxml=that;p.title=op.name;p.id=op.id;var n=this.overlayman.markers.length;if(newgeom){that.multibounds.push(new GLatLngBounds());that.polygons.push([]);}var len=that.multibounds.length-1;that.multibounds[len].extend(p.getBounds().getSouthWest());that.multibounds[len].extend(p.getBounds().getNorthEast());that.polygons[that.polygons.length-1].push(n);p.polyindex=that.polygons.length-1;p.geomindex=len;p.sidebarid=this.latestsidebar;p.onOver=function(){if(this.sidebarid){var bar=Lance$(this.sidebarid);if(!!bar){bar.style.backgroundColor=this.hilite.color;bar.style.color=this.hilite.textcolor;}}if(this.geoxml.clickablepolys){var poly=this.geoxml.polygons[this.polyindex];if(poly){for(var pg=0;pg     ";parm=this.myvar+"$$$"+op.name+"$$$polygon$$$"+n+"$$$"+blob+"$$$"+op.visibility+"$$$null";}if(updatebound){var ne=p.getBounds().getNorthEast();var sw=p.getBounds().getSouthWest();this.bounds.extend(ne);this.bounds.extend(sw);this.overlayman.folderBounds[idx].extend(sw);this.overlayman.folderBounds[idx].extend(ne);}this.overlayman.AddMarker(p,op.name,idx,parm,op.visibility);return op.name;};GeoXml.prototype.finishLineJSON=function(po,idx,lastlinename){var m;var that=this;var thismap=this.map;if(po.type=="line"){m=new GPolyline(po.points,po.color,po.weight,po.opacity);}else{m=new GPolyline.fromEncoded(po);}m.mytitle=po.name;m.title=po.name;m.geoxml=this;m.strokeColor=po.color;m.strokeWeight=po.weight;m.strokeOpacity=po.opacity;m.hilite=this.hilite;var n=that.overlayman.markers.length;var lineisnew=false;var pnum;if(("l_"+po.name)!=lastlinename){lineisnew=true;that.polylines.push(po);pnum=that.polylines.length-1;that.polylines[pnum].lineidx=[];that.latestsidebar=that.myvar+"sb"+n;}else{pnum=that.polylines.length-1;that.polylines[pnum].lineidx.push(n);}if(this.opts.basesidebar){m.sidebarid=that.latestsidebar;}m.onOver=function(){if(!!this.sidebarid){var bar=Lance$(this.sidebarid);if(bar&&typeof bar!="undefined"){bar.style.backgroundColor=this.hilite.color;}}this.realColor=this.strokeColor;if(mark&&typeof mark!="undefined"){mark.setStrokeStyle({color:this.hilite.color});}this.redraw(true);if(this.mess){this.geoxml.mb.showMess(this.mess,5000);}else{this.title="Click for more information about "+this.mytitle;}};m.onOut=function(){if(!!this.sidebarid){var bar=Lance$(this.sidebarid);if(bar&&typeof bar!="undefined"){bar.style.background="none";}}if(mark&&typeof mark!="undefined")mark.setStrokeStyle({color:this.realColor});this.redraw(true);if(this.mess){this.geoxml.mb.hideMess();}};GEvent.addListener(m,"mouseover",m.onOver);GEvent.addListener(m,"mouseover",m.onOut);var parm="";that.kml[idx].marks.push(po);var desc=unescape(po.description);var awidth=this.iwwidth;if(desc.length*8"+desc+"";m.map=this.map;if(this.clickablelines){GEvent.addListener(m,"click",function(point){if(!point){point=m.getPoint();}this.map.openInfoWindowHtml(point,html,that.opts.iwoptions);});}if(that.basesidebar&&lineisnew){var blob='    ';if(typeof po.visibility=="undefined"){po.visibility=true;}parm=that.myvar+"$$$"+po.name+"$$$polyline$$$"+n+"$$$"+blob+"$$$"+po.visibility+"$$$"+(that.polylines.length-1)+"$$$";}var ne=m.getBounds().getNorthEast();var sw=m.getBounds().getSouthWest();that.bounds.extend(ne);that.bounds.extend(sw);that.overlayman.folderBounds[idx].extend(sw);that.overlayman.folderBounds[idx].extend(ne);that.overlayman.AddMarker(m,po.name,idx,parm,po.visibility);return(po.name);};GeoXml.prototype.handlePlaceObj=function(num,max,idx,lastlinename,depth){var that=this;var po=that.jsonmarks[num];var name=po.name;if(po.title){name=po.title;}if(name.length+depth>that.maxtitlewidth){that.maxtitlewidth=name.length+depth;}switch(po.type){case "polygon":lastlinename="p_"+that.finishPolygonJSON(po,idx,true,lastlinename);break;case "line":case "polyline":lastlinename="l_"+that.finishLineJSON(po,idx,lastlinename);break;case "point":that.createMarkerJSON(po,idx);lastlinename="";break;}if(num1))||doc.marks.length){if(depth<2||doc.marks.length<1){icon=that.globalicon;}else{icon=that.foldericon;}folderid=that.createFolder(idx,name,sbid,icon,description,snippet,keepopen,visible);}else{folderid=sbid;}var parm,blob;var nhtml="";var html;var m;var num=that.jsonmarks.length;var max=num+polys.length;for(var p=0;p'+graphic+name+'';break;case "polyline":h='
  •  '+graphic+name+'
  • ';break;case "polygon":h='
  •  '+graphic+name+'
  • ';break;case "groundoverlay":h='
  •  '+graphic+name+'
  • ';break;case "tiledoverlay":h='
  • '+GeoXml.WMSICON+' '+name+'
    '+graphic+'
  • ';break;}return h;};GeoXml.addDropdown=function(myvar,name,type,i,graphic){return '';};GeoXml.prototype.parse=function(titles){var that=this;var names=[];if(typeof titles!="undefined"){if(typeof titles!="string"){names=titles;}else{names=titles.split(",");}}that.progress+=that.urls.length;for(var u=0;u1){base=sec[1];}else{base=nn;}if(base.match(/^(visible|visibility|boundedBy|StyleMap|styleUrl|posList|coordinates|Style|Polygon|LineString|Point|LookAt|Envelope|Box|MultiPolygon|where)/)){currdeschead="";}else{if(base.match(/#text|the_geom|SchemaData|ExtendedData|#cdata-section/)){}else{if(base.match(/Snippet/i)){}else{if(base.match(/SimpleData/)){base=subelem.getAttribute("name");}currdeschead=" "+base+"  :";}}val=subelem.nodeValue;if(nn=="link"){var href=subelem.getAttribute("href");if(href){val=''+href+'';}}if(base.match(/(\S)*(name|title)(\S)*/i)){if(!val){val=GXml.value(subelem);}title=val;if(val&&typeof title!="undefined"&&title.length>this.maxtitlewidth){this.maxtitlewidth=title.length;}currdeschead="";}else{if(val&&val.match(/(\S)+/)){if(val.match(/^http:\/\/|^https:\/\//i)){val=''+val+'';}else{if(!title||title==""){title=val;if(val&&typeof title!="undefined"&&title.length>this.maxtitlewidth){this.maxtitlewidth=title.length;}}}}if(val&&(val.match(/(\s)*/)!=true)){d+=currdeschead+""+val+"
    ";currdeschead="";}if(subelem.childNodes.length){var con=this.makeDescription(subelem,title,depth+1);if(con){d+=con.desc;if(typeof con.title!="undefined"&&con.title){title=con.title;if(title.length>this.maxtitlewidth){this.maxtitlewidth=title.length+depth;}}}}}}ln++;}var dc={};dc.desc=d;dc.title=title;return dc;};GeoXml.prototype.randomColor=function(){var color="#";for(var i=0;i<6;i++){var idx=parseInt(Math.random()*16,10)+1;color+=idx.toString(16);}return color;};GeoXml.prototype.handleGeomark=function(mark,idx,trans){var that=this;var desc,title,name,style;title="";desc="";var styleid=0;var lat,lon;var visible=true;if(this.hideall){visible=false;}var fill=true;var outline=true;var width,color,opacity,fillOpacity,fillColor;var cor=[];var node,nv,cm;var coords="";var poslist=[];var point_count=0;var box_count=0;var line_count=0;var poly_count=0;var p;var points=[];var cc,l;var pbounds=new GLatLngBounds();var coordset=mark.getElementsByTagName("coordinates");if(coordset.length<1){coordset=mark.getElementsByTagName("gml:coordinates");}if(coordset.length<1){coordset=[];poslist=mark.getElementsByTagName("gml:posList");if(poslist.length<1){poslist=mark.getElementsByTagName("posList");}for(l=0;l"+coords+"";node=GXml.parse(cm);if(coordset.push){coordset.push(node);}}}var pos=mark.getElementsByTagName("gml:pos");if(pos.length<1){pos=mark.getElementsByTagName("gml:pos");}if(pos.length){for(p=0;p"+cor[1]+","+cor[0]+"");}else{node=GXml.parse(""+cor[0]+","+cor[1]+"");}if(coordset.push){coordset.push(node);}}}}var newcoords=false;point_count=0;box_count=0;line_count=0;poly_count=0;var dc=that.makeDescription(mark,"");desc="
      "+dc.desc+"
    ";if(!name&&dc.title){name=dc.title;if(name.length>this.maxtitlewidth){this.maxtitlewidth=name.length;}}if(newcoords&&typeof lat!="undefined"){coordset.push(""+lon+","+lat);}var lines=[];var point;var skiprender;var bits;for(var c=0;c0){if(!!style){width=style.width;color=style.color;opacity=style.opacity;}else{width=this.style.width;color=this.style.color;opacity=this.style.opacity;}if(typeof name=="undefined"){name=that.unnamedpath;}if(!!that.opts.createpolyline){that.opts.createpolyline(lines,color,width,opacity,pbounds,name,desc,idx,visible);}else{that.createPolyline(lines,color,width,opacity,pbounds,name,desc,idx,visible);}}var polygons=mark.getElementsByTagName("Polygon");if(polygons.length<1){polygons=mark.getElementsByTagName("gml:Polygon");}if(polygons.length||poly_count>0){if(!!style){width=style.width;color=style.color;opacity=style.opacity;fillOpacity=style.fillOpacity;fillColor=style.fillColor;fill=style.file;outline=style.outline;}fillColor=this.randomColor();color=this.randomColor();fill=1;outline=1;if(typeof name=="undefined"){name=that.unnamedarea;}if(!!that.opts.createpolygon){that.opts.createpolygon(lines,color,width,opacity,fillColor,fillOpacity,pbounds,name,desc,idx,visible,fill,outline);}else{that.createPolygon(lines,color,width,opacity,fillColor,fillOpacity,pbounds,name,desc,idx,visible,fill,outline);}}};GeoXml.prototype.handlePlacemark=function(mark,idx,depth,fullstyle){var that=this;var desc,title,name,style;title="";desc="";var styleid=0;var lat,lon;var visible=true;if(this.hideall){visible=false;}var newcoords=false;var outline;var opacity;var fillcolor;var fillOpacity;var color;var width;var pbounds;var fill;var points=[];var lines=[];var bits=[];var point;var cor,node,cm,nv;var l,pos,p,j,k,cc;var kml_id=mark.getAttribute("id");var point_count=0;var box_count=0;var line_count=0;var poly_count=0;var coords="";l=mark.getAttribute("lat");if(typeof l!="undefined"){lat=l;}l=mark.getAttribute("lon");if(typeof l!="undefined"){newcoords=true;lon=l;}l=0;var coordset=mark.getElementsByTagName("coordinates");if(coordset.length<1){coordset=mark.getElementsByTagName("gml:coordinates");}if(coordset.length<1){coordset=[];var poslist=mark.getElementsByTagName("gml:posList");if(!poslist.length){poslist=mark.getElementsByTagName("posList");}for(l=0;l"+coords+"";node=GXml.parse(cm);if(coordset.push){coordset.push(node);}}}pos=mark.getElementsByTagName("gml:pos");if(pos.length<1){pos=mark.getElementsByTagName("gml:pos");}if(pos.length){for(p=0;p"+cor[1]+","+cor[0]+"");}else{node=GXml.parse(""+cor[0]+","+cor[1]+"");}if(coordset.push){coordset.push(node);}}}}for(var ln=0;ln1){base=ns[1].toLowerCase();}else{base=ns[0].toLowerCase();}var processme=false;switch(base){case "name":name=nv;if(name.length+depth>this.maxtitlewidth){this.maxtitlewidth=name.length+depth;}break;case "title":title=nv;if(title.length+depth>this.maxtitlewidth){this.maxtitlewidth=title.length+depth;}break;case "desc":case "description":desc=GeoXml.getDescription(mark.childNodes.item(ln));if(!desc){desc=nv;}if(that.opts.preloadHTML&&desc&&desc.match(/<(\s)*img/i)){var preload=document.createElement("span");preload.style.visibility="visible";preload.style.position="absolute";preload.style.left="-1200px";preload.style.top="-1200px";preload.style.zIndex=this.overlayman.markers.length;document.body.appendChild(preload);preload.innerHTML=desc;}if(desc.match(/^http:\/\//i)){var flink=desc.split(/(\s)+/);if(flink.length>1){desc=""+flink[0]+"";for(var i=1;i"+desc+"";}}break;case "visibility":if(nv=="0"){visible=false;}break;case "href":case "link":if(nv){desc+="

    link

    ";}else{var href=mark.childNodes.item(ln).getAttribute("href");if(href){var imtype=mark.childNodes.item(ln).getAttribute("type");if(imtype&&imtype.match(/image/)){desc+="";}}}break;case "author":desc+="

    author:"+nv+"

    ";break;case "time":desc+="

    time:"+nv+"

    ";break;case "lat":lat=nv;break;case "long":lon=nv;newcoords=true;break;case "point":point_count++;processme=true;break;case "line":line_count++;processme=true;break;case "box":box_count++;processme=true;break;case "polygon":poly_count++;processme=true;break;case "styleurl":styleid=nv;break;case "stylemap":var found=false;node=mark.childNodes.item(ln);for(j=0;(j"+coords+"");if(coordset.push){coordset.push(node);}}}}if(!name&&title){name=title;}if(fullstyle){style=fullstyle;}if(styleid){style=this.styles[styleid];}if(typeof desc=="undefined"||!desc){var dc=that.makeDescription(mark,"");desc="
      "+dc.desc+"
    ";if(!name&&dc.title){name=dc.title;if((name.length+depth)>this.maxtitlewidth){this.maxtitlewidth=name.length+depth;}}}if(newcoords&&typeof lat!="undefined"){if(lat){var cs=""+lon+","+lat+" ";node=GXml.parse(""+cs+"");coordset.push(node);}}for(var c=0;c0){if(!!style){width=style.width;color=style.color;opacity=style.opacity;}else{width=this.style.width;color=this.style.color;opacity=this.style.opacity;}if(typeof name=="undefined"){name=unnamedpath;}if(!!that.opts.createpolyline){that.opts.createpolyline(lines,color,width,opacity,pbounds,name,desc,idx,visible,kml_id);}else{that.createPolyline(lines,color,width,opacity,pbounds,name,desc,idx,visible,kml_id);}}var polygons=mark.getElementsByTagName("Polygon");if(polygons.length<1){polygons=mark.getElementsByTagName("gml:Polygon");}if(polygons.length||poly_count>0){if(!!style){width=style.width;color=style.color;opacity=style.opacity;fillOpacity=style.fillOpacity;fillcolor=style.fillcolor;fill=style.fill;outline=style.outline;}if(typeof fill=="undefined"){fill=1;}if(typeof color=="undefined"){color=this.style.color;}if(typeof fillcolor=="undefined"){fillcolor=this.randomColor();}if(typeof name=="undefined"){name=that.unnamedarea;}if(!!that.opts.createpolygon){that.opts.createpolygon(lines,color,width,opacity,fillcolor,fillOpacity,pbounds,name,desc,idx,visible,fill,outline,kml_id);}else{that.createPolygon(lines,color,width,opacity,fillcolor,fillOpacity,pbounds,name,desc,idx,visible,fill,outline,kml_id);}}};GeoXml.prototype.makeIcon=function(tempstyle,href){if(!!href){if(!!this.opts.baseicon){tempstyle=new GIcon(this.opts.baseicon,href);tempstyle.href=href;}else{tempstyle=new GIcon(G_DEFAULT_ICON,href);tempstyle.iconSize=new GSize(32,32);tempstyle.shadowSize=new GSize(59,32);tempstyle.dragCrossAnchor=new GPoint(2,8);tempstyle.iconAnchor=new GPoint(16,32);tempstyle.href=href;if(this.opts.printgif){var bits=href.split("/");var gif=bits[bits.length-1];gif=this.opts.printgifpath+gif.replace(/.png/i,".gif");tempstyle.printImage=gif;tempstyle.mozPrintImage=gif;}if(!!this.opts.noshadow){tempstyle.shadow="";}else{if(href.indexOf("/red.png")>-1||href.indexOf("/blue.png")>-1||href.indexOf("/green.png")>-1||href.indexOf("/yellow.png")>-1||href.indexOf("/lightblue.png")>-1||href.indexOf("/purple.png")>-1||href.indexOf("/orange.png")>-1||href.indexOf("/pink.png")>-1||href.indexOf("-dot.png")>-1){tempstyle.shadow="http://maps.google.com/mapfiles/ms/icons/msmarker.shadow.png";}else if(href.indexOf("-pushpin.png")>-1||href.indexOf("/pause.png")>-1||href.indexOf("/go.png")>-1||href.indexOf("/stop.png")>-1){tempstyle.shadow="http://maps.google.com/mapfiles/ms/icons/pushpin_shadow.png";}else{var shadow=href.replace(".png",".shadow.png");if(shadow.indexOf(".jpg")){shadow="";}tempstyle.shadow=shadow;}}}}if(this.opts.noshadow){tempstyle.shadow="";}return tempstyle;};GeoXml.prototype.handleStyle=function(style,sid){var icons=style.getElementsByTagName("Icon");var tempstyle,opacity;var aa,bb,gg,rr;var fill,href,color,colormode,outline;if(icons.length>0){href=GXml.value(icons[0].getElementsByTagName("href")[0]);tempstyle=this.makeIcon(tempstyle,href);}var linestyles=style.getElementsByTagName("LineStyle");if(linestyles.length>0){var width=parseInt(GXml.value(linestyles[0].getElementsByTagName("width")[0]),10);if(width<1){width=5;}color=GXml.value(linestyles[0].getElementsByTagName("color")[0]);aa=color.substr(0,2);bb=color.substr(2,2);gg=color.substr(4,2);rr=color.substr(6,2);color="#"+rr+gg+bb;opacity=parseInt(aa,16)/256;if(!tempstyle){tempstyle={};}tempstyle.color=color;tempstyle.width=width;tempstyle.opacity=opacity;}var polystyles=style.getElementsByTagName("PolyStyle");if(polystyles.length>0){fill=parseInt(GXml.value(polystyles[0].getElementsByTagName("fill")[0]),10);outline=parseInt(GXml.value(polystyles[0].getElementsByTagName("outline")[0]),10);color=GXml.value(polystyles[0].getElementsByTagName("color")[0]);colormode=GXml.value(polystyles[0].getElementsByTagName("colorMode")[0]);if(polystyles[0].getElementsByTagName("fill").length==0){fill=1;}if(polystyles[0].getElementsByTagName("outline").length==0){outline=1;}aa=color.substr(0,2);bb=color.substr(2,2);gg=color.substr(4,2);rr=color.substr(6,2);color="#"+rr+gg+bb;opacity=parseInt(aa,16)/256;if(!tempstyle){tempstyle={};}tempstyle.fill=fill;tempstyle.outline=outline;if(colormode!="random"){tempstyle.fillcolor=color;}else{tempstyle.colortint=color;}tempstyle.fillOpacity=opacity;if(!fill){tempstyle.fillOpacity=0;}if(!outline){tempstyle.opacity=0;}}if(sid){this.styles["#"+sid]=tempstyle;}return tempstyle;};GeoXml.prototype.processKML=function(node,marks,title,sbid,depth,paren){var that=this;var thismap=this.map;var icon;var grouptitle;var keepopen=this.forcefoldersopen;if(node.nodeName=="kml"){icon=this.docicon;}if(node.nodeName=="Document"){icon=this.kmlicon;}if(node.nodeName=="Folder"){icon=this.foldericon;grouptitle=title;}var pm=[];var sf=[];var desc="";var snip="";var i;var visible=false;if(!this.hideall){visible=true;}var boundsmodified=false;var networklink=false;var url;var ground=null;var opacity=1.0;var wmsbounds;var makewms=false;var wmslist=[];var mytitle;var color;var ol;var n,ne,sw,se;var html;var kml_id=node.getAttribute("id");for(var ln=0;lnthis.maxtitlewidth){this.maxtitlewidth=title.length+depth;}break;case "Folder":case "Document":sf.push(nextn);break;case "GroundOverlay":url=GXml.value(nextn.getElementsByTagName("href")[0]);var north=parseFloat(GXml.value(nextn.getElementsByTagName("north")[0]));var south=parseFloat(GXml.value(nextn.getElementsByTagName("south")[0]));var east=parseFloat(GXml.value(nextn.getElementsByTagName("east")[0]));var west=parseFloat(GXml.value(nextn.getElementsByTagName("west")[0]));var attr=GXml.value(nextn.getElementsByTagName("attribution")[0]);sw=new GLatLng(south,west);ne=new GLatLng(north,east);this.bounds.extend(sw);this.bounds.extend(ne);color=GXml.value(nextn.getElementsByTagName("color")[0]);opacity=parseInt(color.substring(1,3),16)/256;mytitle=GXml.value(nextn.getElementsByTagName("name")[0]);var arcims=/arcimsproxy/i;if(url.match(arcims)){url+="&bbox="+west+","+south+","+east+","+north+"&response=img";wmsbounds=new GLatLngBounds(sw,ne);makewms=true;ol=this.makeWMSTileLayer(url,visible,mytitle,opacity,attr,title,wmsbounds);if(ol){ol.bounds=wmsbounds;ol.title=mytitle;ol.opacity=opacity;ol.visible=visible;ol.url=url;if(!this.quiet){this.mb.showMess("Adding Tiled ArcIms Overlay "+title,1000);}wmslist.push(ol);}}else{var rs=/request=getmap/i;if(url.match(rs)){url+="&bbox="+west+","+south+","+east+","+north;wmsbounds=new GLatLngBounds(sw,ne);makewms=true;ol=this.makeWMSTileLayer(url,visible,mytitle,opacity,attr,title,wmsbounds);if(ol){ol.bounds=wmsbounds;ol.title=mytitle;ol.opacity=opacity;ol.visible=visible;ol.url=url;if(!this.quiet){this.mb.showMess("Adding Tiled WMS Overlay "+title,1000);}wmslist.push(ol);}}else{wmsbounds=new GLatLngBounds(sw,ne);ground=new GGroundOverlay(url,wmsbounds);ground.bounds=wmsbounds;ground.getBounds=function(){return this.bounds;};boundsmodified=true;makewms=false;}}break;case "NetworkLink":url=GXml.value(nextn.getElementsByTagName("href")[0]);networklink=true;break;case "description":case "Description":desc=GeoXml.getDescription(nextn);break;case "open":if(GXml.value(nextn)=="1"){keepopen=true;}if(GXml.value(nextn)=="0"){keepopen=this.forcefoldersopen;}break;case "visibility":if(GXml.value(nextn)=="0"){visible=false;}break;case "snippet":snip=GXml.value(nextn);break;default:for(var k=0;k1||pm.length||ground||makewms){this.overlayman.folders.push([]);this.overlayman.subfolders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.folderBounds.push(new GLatLngBounds());this.kml.push(new KMLObj(title,desc,false,idx));me=this.kml.length-1;folderid=this.createFolder(idx,title,sbid,icon,desc,snip,true,visible);}else{folderid=sbid;}if(node.nodeName=="Folder"||node.nodeName=="Document"){this.kml[me].open=keepopen;this.kml[me].folderid=folderid;}if(ground||makewms){this.kml[this.kml.length-1].visibility=visible;this.kml[this.kml.length-1].groundOverlays.push({"url":url,"bounds":wmsbounds});}if(networklink){var re=/&/g;url=url.replace(re,"&");var nl=/\n/g;url=url.replace(nl,"");this.progress++;if(!topwin.standalone){if(typeof this.proxy!="undefined"){url=this.proxy+escape(url);}}var comm=this.myvar+".loadXMLUrl('"+url+"','"+title+"',null,null,'"+sbid+"');";setTimeout(comm,1000);return;}if(makewms&&wmslist.length){for(var wo=0;wo';}}parm=this.myvar+"$$$"+ol.title+"$$$tiledoverlay$$$"+n+"$$$"+blob+"$$$"+ol.visible+"$$$"+(this.baseLayers.length-1);var html=ol.desc;var thismap=this.map;GEvent.addListener(ol,"zoomto",function(){thismap.setZoom(thismap.getBoundsZoomLevel(this.getBounds()));thismap.panTo(this.getBounds().getCenter());});this.overlayman.AddMarker(ol,title,idx,parm,true,true);}}if(ground){if(this.basesidebar){var n=this.overlayman.markers.length;var blob='     ';parm=this.myvar+"$$$"+title+"$$$polygon$$$"+n+"$$$"+blob+"$$$"+visible+"$$$null";var html=desc;var thismap=this.map;GEvent.addListener(ground,"zoomto",function(){thismap.setZoom(thismap.getBoundsZoomLevel(ground.getBounds()));thismap.panTo(ground.getBounds().getCenter());});this.overlayman.folderBounds[idx].extend(ground.getBounds().getSouthWest());this.overlayman.folderBounds[idx].extend(ground.getBounds().getNorthEast());boundsmodified=true;this.overlayman.AddMarker(ground,title,idx,parm,visible);}this.map.addOverlay(ground);}for(i=0;ithis.maxtitlewidth){this.maxtitlewidth=title.length+depth;}}if(nn=="rte"){sf.push(nextn);}if(nn=="trk"){sf.push(nextn);}if(nn=="trkseg"){sf.push(nextn);}if(nn=="trkpt"){pm.push(nextn);l=nextn.getAttribute("lat");if(typeof l!="undefined"){lat=l;}l=nextn.getAttribute("lon");if(typeof l!="undefined"){lon=l;coords+=lon+","+lat+" ";}}if(nn=="rtept"){pm.push(nextn);l=nextn.getAttribute("lat");if(typeof l!="undefined"){lat=l;}l=nextn.getAttribute("lon");if(typeof l!="undefined"){lon=l;coords+=lon+","+lat+" ";}}if(nn=="wpt"){pm.push(nextn);}if(nn=="description"||nn=="desc"){desc=GXml.value(nextn);}}if(coords.length){var nc=""+title+""+desc+""+coords+"";var pathnode=GXml.parse(nc).documentElement;pm.push(pathnode);}var folderid;var idx=this.overlayman.folders.length;if(pm.length||node.nodeName=="gpx"){this.overlayman.folders.push([]);this.overlayman.subfolders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.folderBounds.push(new GLatLngBounds());this.kml.push(new KMLObj(title,desc,open,idx));folderid=this.createFolder(idx,title,sbid,icon,desc,snip,true,visible);}else{folderid=sbid;}for(i=0;i1){basename=bases[1];}var bar,sid,i;that.wfs=false;if(basename=="FeatureCollection"){bar=Lance$(that.basesidebar);if(!title){title=name;}if(typeof title=="undefined"){title="Un-named GML";}that.isWFS=true;if(title.length>that.maxtitlewidth){that.maxtitlewidth=title.length;}if(bar){bar.style.display="";}idx=that.overlayman.folders.length;that.processGML(root,title,latlon,desc,(that.kml.length-1));that.kml[0].folders.push(idx);}if(basename=="gpx"){if(!title){title=name;}if(typeof title=="undefined"){title="Un-named GPX";}that.title=title;if(title.length>that.maxtitlewidth){that.maxtitlewidth=title.length;}bar=Lance$(that.basesidebar);if(bar){bar.style.display="";}idx=that.overlayman.folders.length;that.processGPX(root,title,that.basesidebar,sbid);that.kml[0].folders.push(idx);}else{if(basename=="kml"){styles=root.getElementsByTagName("Style");for(i=0;ithat.maxtitlewidth){that.maxtitlewidth=title.length;}var marknames=["Placemark"];var schema=root.getElementsByTagName("Schema");for(var s=0;sthat.maxtitlewidth){that.maxtitlewidth=title.length;}var style;if(that.opts.baseicon){style=that.opts.baseicon;style.href=style.image;}else{style=new GIcon(G_DEFAULT_ICON,that.rssicon);style.iconSize=new GSize(32,32);style.shadowSize=new GSize(59,32);style.dragCrossAnchor=new GPoint(2,8);style.iconAnchor=new GPoint(16,32);style.href=that.rssicon;shadow=that.rssicon.replace(".png",".shadow.png");style.shadow=shadow+"_shadow.png";}style.color="#00FFFF";style.width="3";style.opacity=0.50;if(!desc){desc="RSS feed";}that.kml[0].folders.push(that.overlayman.folders.length);if(placemarks.length){bar=Lance$(that.basesidebar);if(bar){bar.style.display="";}that.overlayman.folders.push([]);that.overlayman.folderhtml.push([]);that.overlayman.folderhtmlast.push(0);that.overlayman.folderBounds.push(new GLatLngBounds());idx=that.overlayman.folders.length-1;that.kml.push(new KMLObj(title,desc,keepopen,idx));that.kml[that.kml.length-1].open=keepopen;if(that.basesidebar){var visible=true;if(that.hideall){visible=false;}var folderid=that.createFolder(idx,title,that.basesidebar,that.globalicon,desc,null,keepopen,visible);}for(i=0;i';htm+=' ';htm+=' ';htm+=''+title+'
    ';if(sb){sb.innerHTML=sb.innerHTML+htm;}return folderid;};GeoXml.prototype.processGML=function(root,title,latlon,desc,me){var that=this;var isWFS=false;var placemarks=[];var srsName;var isLatLon=false;var xmin=0;var ymin=0;var xscale=1;var yscale=1;var points,pt,pts;var coor,coorstr;var x,y,k,i;var name=title;var visible=true;if(this.hideall){visible=false;}var keepopen=that.allfoldersopen;var pt1,pt2,box;for(var ln=0;lnb.xmax){b.xmax=x;}if(y>b.ymax){b.ymax=y;}}xscale=(b.xmax-b.xmin)/(latlon.xmax-latlon.xmin);yscale=(b.ymax-b.ymin)/(latlon.ymax-latlon.ymin);xmin=b.xmin/xscale-latlon.xmin;ymin=b.ymin/yscale-latlon.ymin;}}}}break;}}if(kid=="gml:featureMember"||kid=="featureMember"){placemarks.push(n);}}var folderid;if(!title){title=name;}this.title=title;if(placemarks.length<1){alert("No features found in "+title);this.mb.showMess("No features found in "+title,3000);}else{this.mb.showMess("Adding "+placemarks.length+" features found in "+title);this.overlayman.folders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.folderBounds.push(new GLatLngBounds());var idx=this.overlayman.folders.length-1;if(this.basesidebar){folderid=this.createFolder(idx,title,this.basesidebar,this.gmlicon,desc,null,keepopen,visible);}this.kml.push(new KMLObj(title,desc,true,idx));this.kml[me].open=that.opts.allfoldersopen;this.kml[me].folderid=folderid;if(isLatLon){for(i=0;i0){current=stack.pop();maxDist=0;segmentLength=Math.pow(points[current[1]].lat()-points[current[0]].lat(),2)+Math.pow(points[current[1]].lng()-points[current[0]].lng(),2);for(i=current[0]+1;imaxDist){maxDist=temp;maxLoc=i;if(maxDist>absMaxDist){absMaxDist=maxDist;}}}if(maxDist>this.veryTiny){dists[maxLoc]=maxDist;stack.push([current[0],maxLoc]);stack.push([maxLoc,current[1]]);}}encodedPoints=this.createEncodings(points,dists);encodedLevels=this.encodeLevels(points,dists,absMaxDist);return{encodedPoints:encodedPoints,encodedLevels:encodedLevels,encodedPointsLiteral:encodedPoints.replace(/\\/g,"\\\\")};};PolylineEncoder.prototype.dpEncodeToJSON=function(points,color,weight,opacity){var result;result=this.dpEncode(points);return{color:color,weight:weight,opacity:opacity,points:result.encodedPoints,levels:result.encodedLevels,numLevels:this.numLevels,zoomFactor:this.zoomFactor,literals:result.encodePointsLiteral};};PolylineEncoder.prototype.dpEncodeToGPolyline=function(points,color,weight,opacity){return new GPolyline.fromEncoded(this.dpEncodeToJSON(points,color,weight,opacity));};PolylineEncoder.prototype.dpEncodeToGPolygon=function(pointsArray,boundaryColor,boundaryWeight,boundaryOpacity,fillColor,fillOpacity,fill,outline){var i,boundaries;boundaries=[];for(i=0;i=1){out=Math.pow(p0.lat()-p2.lat(),2)+Math.pow(p0.lng()-p2.lng(),2);}if(00;j--){i=len-j+1;if(dists[i]!=undefined){late5=floor(points[i].lat()*1e5);lnge5=floor(points[i].lng()*1e5);dlat=late5-plat;dlng=lnge5-plng;plat=late5;plng=lnge5;encoded_points+=this.encodeSignedNumber(dlat)+this.encodeSignedNumber(dlng);}}dlat=floor(points[len+1].lat()*1e5)-plat;dlng=floor(points[len+1].lng()*1e5)-plng;encoded_points+=this.encodeSignedNumber(dlat)+this.encodeSignedNumber(dlng);return encoded_points;};PolylineEncoder.prototype.computeLevel=function(dd){var lev;if(dd>this.veryTiny){lev=0;while(dd=0x20){nextValue=(0x20|(num&0x1f))+63;encodeString+=(String.fromCharCode(nextValue));num>>=5;}finalValue=num+63;encodeString+=(String.fromCharCode(finalValue));return encodeString;};PolylineEncoder.prototype.encodeSignedNumber=function(num){var sgn_num=num<<1;if(num<0){sgn_num=~(sgn_num);}return(this.encodeNumber(sgn_num));};PolylineEncoder.latLng=function(y,x){this.y=y;this.x=x;};PolylineEncoder.latLng.prototype.lat=function(){return this.y;};PolylineEncoder.latLng.prototype.lng=function(){return this.x;};PolylineEncoder.pointsToLatLngs=function(points){var i,latLngs;latLngs=[];for(i=0;i0){if(clusterer.paren.progress==0){clusterer.paren.setFolders();GEvent.trigger(clusterer.paren,"parsed");if(!clusterer.paren.opts.sidebarid){clusterer.paren.mb.showMess("Finished Parsing",1000);}var mifinish=new Date();var sec=((mifinish-clusterer.miStart)/1000+" seconds");clusterer.paren.mb.showMess("Loaded "+count+" GeoXML elements in "+sec,5000);clusterer.paren.ParseURL();if(!clusterer.paren.opts.nozoom){clusterer.paren.map.setZoom(clusterer.paren.map.getBoundsZoomLevel(clusterer.paren.bounds));clusterer.paren.map.setCenter(clusterer.paren.bounds.getCenter());}}}if(update_side&&typeof resizeKML!="undefined"){resizeKML();}var bounds,sw,ne,dx,dy;var newZoomLevel=clusterer.map.getZoom();if(newZoomLevel!=clusterer.currentZoomLevel){for(i=0;iclusterer.maxVisibleMarkers){if(!update_side){clusterer.paren.mb.showMess("Clustering on "+viscount+" GeoXML elements");}var latRange=bounds.getNorthEast().lat()-bounds.getSouthWest().lat();var latInc=latRange / clusterer.gridSize;var lngInc=latInc / Math.cos( ( bounds.getNorthEast().lat() + bounds.getSouthWest().lat() ) / 2.0 * Math.PI / 180.0);for(var lat=bounds.getSouthWest().lat();lat<=bounds.getNorthEast().lat();lat+=latInc){for(var lng=bounds.getSouthWest().lng();lng<=bounds.getNorthEast().lng();lng+=lngInc){cluster={};cluster.clusterer=clusterer;cluster.bounds=new GLatLngBounds(new GLatLng(lat,lng),new GLatLng(lat+latInc,lng+lngInc));cluster.markers=[];cluster.markerCount=0;cluster.onMap=false;cluster.marker=null;clusterer.clusters.push(cluster);}}for(i=0;i=0;--i){if(clusterer.clusters[i]!=null){break;}else{--clusterer.clusters.length;}}for(i=0;i';if(typeof marker.getIcon!="undefined"&&marker.getIcon().smallImage!=null){html+='';}else{html+='';}html+=''+marker.title+'';if(n==clusterer.maxLinesPerInfoBox-1&&cluster.markerCount>clusterer.maxLinesPerInfoBox){html+='...and '+(cluster.markerCount-n)+' more';break;}}}html+='';clusterer.map.closeInfoWindow();cluster.marker.openInfoWindowHtml(html);clusterer.poppedUpCluster=cluster;};Clusterer.RePop=function(clusterer){if(clusterer.poppedUpCluster!=null){Clusterer.PopUp(clusterer.poppedUpCluster);}};Clusterer.PopDown=function(clusterer){clusterer.poppedUpCluster=null;};Clusterer.prototype.ClearCluster=function(cluster){var i,marker;for(i=0;ithis.map.getSize().width){nw=parseInt(2*this.map.getSize().width/3,10);this.mb.style.width=nw+"px";this.centerMe=setTimeout(this.myvar+".centerThis()",5);return;}this.mb.style.left=(c.x-(nw/2))+"px";this.mb.style.top=(c.y-20-(this.mb.clientHeight/2))+"px";}else{this.centerMe=setTimeout(this.myvar+".centerThis()",10);}};MessageBox.prototype.showMess=function(val,temp){val=unescape(val);if(this.eraseMess){clearTimeout(this.eraseMess);}if(!this.mb){this.mb=Lance$(this.id);}if(this.mb){this.mb.innerHTML=""+val+"";if(temp){this.eraseMess=setTimeout(this.myvar+".hideMess();",temp);}this.mb.style.left="-1200px";this.mb.style.top="-1200px";this.mb.style.width="";this.mb.style.height="";this.centerMe=setTimeout(this.myvar+".centerThis()",5);this.mb.style.visibility="visible";}else{var d=document.createElement("div");d.innerHTML=val;d.id=this.myvar+"_message";d.style.position="absolute";d.style.backgroundColor=this.style.backgroundColor||"silver";d.style.opacity=this.style.opacity||0.80;d.style.filter="alpha(opacity="+parseInt(d.style.opacity*100,10)+")";d.style.color=this.style.color||"black";d.style.padding=this.style.padding||"6px";d.style.borderWidth=this.style.borderWidth||"3px";d.style.borderColor=this.style.borderColor||"";d.style.backgroundImage=this.style.backgroundImage||"";d.style.borderStyle=this.style.borderStyle||"outset";d.style.visibility="visible";d.style.left="-1200px";d.style.top="-1200px";this.centerMe=setTimeout(this.myvar+".centerThis()",5);d.style.zIndex=1000;document.body.appendChild(d);}};GMap2.prototype.getObjCenter=function(){var obj=this.getContainer();var container=obj;var y=0;var x=0;if(obj.offsetParent){x=obj.offsetLeft;y=obj.offsetTop;obj=obj.offsetParent;while(obj){x+=obj.offsetLeft;y+=obj.offsetTop;obj=obj.offsetParent;}return new GPoint(x+parseInt(this.getSize().width,10)/2,y+parseInt(this.getSize().height,10)/2);}};GeoXml.prototype.loadJSONUrl=function(url,title,latlon,desc,idx){var that=this;GDownloadUrl(url,function(doc){that.parseJSON(doc,title,latlon,desc,idx);});};GeoXml.prototype.loadXMLUrl=function(url,title,latlon,desc,idx){var that=this;that.DownloadURL(url,function(doc){that.processing(GXml.parse(doc),title,latlon,desc,idx)},title);};GeoXml.prototype.upgradeLayer=function(n){var mt=this.map.getMapTypes();var found=false;for(var i=0;i=lon){ex=ex/2;z++;}z--;if(z<1){z=1;}if(!attr){attr="Base Map from OGC WMS";}var cr0=new GCopyright(1,new GLatLngBounds(new GLatLng(bb.s,bb.w),new GLatLng(bb.n,bb.e)),0,attr);var cc0=new GCopyrightCollection("");cc0.addCopyright(cr0);var twms=new GTileLayer(cc0,z,19);twms.s=bb.s;twms.n=bb.n;twms.e=bb.e;twms.w=bb.w;twms.myBaseURL=baseurl;if(servicename){twms.servicename=servicename;}if(atlasname){twms.atlasname=atlasname;}twms.publishdirectory=this.publishdirectory;twms.epsg=epsg;twms.getTileUrl=function(a,b,c){if(typeof(this.myStyles)=="undefined"){this.myStyles="";}var lULP=new GPoint(a.x*256,(a.y+1)*256);var lLRP=new GPoint((a.x+1)*256,a.y*256);var lUL=G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);var lLR=G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);var west=lUL.x;var east=lLR.x;var north=lUL.y;var south=lLR.y;var ge=east;var gw=west;var gs=south;var gn=north;if(gn(this.n)||ge<(this.w)||gn<(this.s)||gw>(this.e)){var retstr=this.publishdirectory+"black.gif";}var lBbox=west+","+south+","+east+","+north;var lSRS="EPSG:41001";if(typeof this.epsg!="undefined"||this.srs=="4326"){lSRS=this.epsg;}var lURL=this.myBaseURL;if(typeof this.myVersion=="undefined"){this.myVersion="1.1.1";}var ver=parseFloat(this.myVersion);var arcims=/arcimsproxy/i;if(!this.myBaseURL.match(arcims)){lURL+="&SERVICE=WMS";if(this.myVersion!="1.0.0"){var gmap=/request=getmap/i;if(!lURL.match(gmap)){lURL+="&REQUEST=GetMap";}}else{lURL+="&REQUEST=Map";}}if(this.servicename){lURL+="?ServiceName="+this.servicename;}if(this.atlasname){lURL+="&AtlasName="+this.servicename;}lURL+="&VERSION="+this.myVersion;if(this.myLayers){lURL+="&LAYERS="+this.myLayers;lURL+="&STYLES="+this.myStyles;}if(this.mySLD){lURL+="&SLD="+this.mySLD;}lURL+="&FORMAT="+this.myFormat;lURL+="&BGCOLOR=0x000000";lURL+="&TRANSPARENT=TRUE";if(this.myVersion=="1.1.1"||ver<1.3){lURL+="&SRS="+lSRS;}else{lURL+="&CRS="+lSRS;}lURL+="&WIDTH="+w;lURL+="&HEIGHT="+h;lURL+="&BBOX="+lBbox;this.requestCount++;return lURL;};twms.myFormat=format;twms.myVersion=version;twms.myExtents=bbox;twms.queryable=queryable;twms.opacity=opacity;twms.getOpacity=function(){return this.opacity;};if(sld){twms.mySLD=sld;}else{twms.myLayers=layers;twms.myStyles=styles;}var ol=new GTileLayerOverlay(twms);ol.bounds=new GLatLngBounds();ol.bounds.extend(new GLatLng(bb.n,bb.e));ol.bounds.extend(new GLatLng(bb.s,bb.w));this.wmscount++;if(this.opts.doMapTypes){var twms2=new GTileLayer(cc0,z,19);twms2.s=bb.s;twms2.n=bb.n;twms2.e=bb.e;twms2.w=bb.w;twms2.myBaseURL=baseurl;twms2.servicename=servicename;twms2.publishdirectory=this.publishdirectory;twms2.getTileUrl=twms.getTileUrl;twms2.myFormat=twms.myFormat;twms2.myVersion=version;twms2.opacity=1.0;twms2.title=title;if(attr){twms2.attribution=attr;}twms2.getOpacity=function(){return this.opacity;};if(sld){twms2.mySLD=sld;}else{twms2.myLayers=layers;twms2.myStyles=styles;}twms2.epsg=epsg;var base=new GTileLayer(cc0,z,19);base.s=bb.s;base.n=bb.n;base.e=bb.e;base.w=bb.w;base.dir=this.publishdirectory;base.getTileUrl=function(){return(this.dir+"black.gif");};base.opacity=1.0;base.title=title;if(attr){base.attribution=attr;}base.getOpacity=function(){return this.opacity;};var layer=[twms2,G_HYBRID_MAP.getTileLayers()[1]];var cmap=new GMapType(layer,G_HYBRID_MAP.getProjection(),""+title+"",G_HYBRID_MAP);cmap.bounds=new GLatLngBounds(new GLatLng(bb.s,bb.w),new GLatLng(bb.n,bb.e));if(grouptitle){cmap.grouptitle=grouptitle;}that.baseLayers.push(cmap);that.map.addMapType(cmap);return null;}else{return ol;}};GeoXml.SEMI_MAJOR_AXIS=6378137.0;GeoXml.ECCENTRICITY=0.0818191913108718138;GeoXml.DEG2RAD=180.0/(Math.PI);GeoXml.merc2Lon=function(lon){return(lon*GeoXml.DEG2RAD)*GeoXml.SEMI_MAJOR_AXIS;};GeoXml.merc2Lat=function(lat){var rad=lat*GeoXml.DEG2RAD;var sinrad=Math.sin(rad);return(GeoXml.SEMI_MAJOR_AXIS*Math.log(Math.tan((rad+Math.PI/2) / 2) * Math.pow(((1 - GeoXml.ECCENTRICITY * sinrad) / (1 + GeoXml.ECCENTRICITY * sinrad)), (GeoXml.ECCENTRICITY/2))));};GeoXml.prototype.toggleLabels=function(on){if(!on){this.removeLabels();}else{this.addLabels();}};GeoXml.prototype.addLabels=function(){this.labels.onMap=true;this.map.addOverlay(this.labels);};GeoXml.prototype.removeLabels=function(){this.labels.onMap=false;this.map.removeOverlay(this.labels);};var useLegacyLocalLoad=true;GeoXml.prototype.DownloadURL=function(fpath,callback,title){if(!fpath){return;}var xmlDoc;var that=this;var cmlurl=fpath;if(!topwin.standalone&&this.proxy){cmlurl=this.proxy+"url="+escape(cmlurl);}if(topwin.standalone||useLegacyLocalLoad){if(cmlurl.substring(2,3)==":"){xmlDoc=new ActiveXObject("Msxml2.DOMDocument.4.0");xmlDoc.validateOnParse=false;xmlDoc.async=true;xmlDoc.load(cmlurl);if(xmlDoc.parseError.errorCode!=0){var myErr=xmlDoc.parseError;alert("GeoXml file appears incorrect\n"+myErr.reason+" at line:"+myErr.line);}else{callback(xmlDoc.doc);}return;}}var cmlreq;/*@cc_on @*//*@if(@_jscript_version>=5)try{cmlreq=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{cmlreq=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){alert("attempting xmlhttp");cmlreq=false;}}@end @*/if(!cmlreq&&typeof XMLHttpRequest!='undefined'){cmlreq=new XMLHttpRequest();}else{if(typeof ActiveXObject!="undefined"){cmlreq=new ActiveXObject("Microsoft.XMLHTTP");}}var here=cmlurl;if(cmlreq.overrideMimeType){cmlreq.overrideMimeType("text/xml");}cmlreq.open("GET",here,true);cmlreq.onreadystatechange=function(){switch(cmlreq.readyState){case 4:that.mb.showMess(title+" received",2000);if(typeof ActiveXObject!="undefined"){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";var response=cmlreq.responseText;callback(response);}else{if(cmlreq.responseXML){that.mb.showMess(title+" received",2000);callback(cmlreq.responseText);}else{if(cmlreq.status==200){var resp=cmlreq.responseText;var sresp=resp.substring(0,400);var isXML=resp.substring(0,5);if(isXML=="