function KMLObj(c,b,d,a){this.title=c;this.description=escape(b);this.marks=[];this.folders=[];this.groundOverlays=[];this.open=d;this.folderid=a}function GeoXml(d,c,a,b){this.myvar=d;this.opts=b||{};this.mb=new MessageBox(c,this,"mb",this.opts.messagebox);this.map=c;this.url=a;if(typeof a=="string"){this.urls=[a]}else{this.urls=a}this.mb.style=this.opts.messagestyle||{backgroundColor:"silver"};this.alwayspop=this.opts.alwaysinfopop||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;this.clickablelines=true;this.clickablemarkers=true;if(typeof this.opts.clickablemarkers!="undefined"){this.clickablemarkers=this.opts.clickablemarkers}if(typeof this.opts.clickablepolys!="undefined"){this.clickablepolys=this.opts.clickablepolys}if(typeof this.opts.clickablelines!="undefined"){this.clickablelines=this.opts.clickablelines}this.nolegend=false;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}if(top.publishdirectory){this.publishdirectory=top.publishdirectory}else{this.publishdirectory="http://www.dyasdesigns.com/tntmap/"}if(top.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='<img src="'+this.publishdirectory+'images/geo.gif" style="border:none" />';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=1e-7;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(c,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])}GeoXml.prototype.showIt=function(e,c,a){var b="status=yes,resizable=yes,toolbar=0,height="+c+",width="+c+",scrollbars=yes";var d;if(top.widget){alert(e);this.mb.showMess(e)}else{d=window.open("","_blank",b);d.document.open("text/xml");d.document.write(e);d.document.close()}};GeoXml.prototype.clear=function(b){for(var a=0;a<this.overlayman.markers.length;a++){this.overlayman.RemoveMarker(this.overlayman.markers[a])}this.kml=[new KMLObj("GeoXML","",true,0)];this.maxtitlewidth=0;this.styles=[];this.jsdocs=[];this.jsonmarks=[];this.polyset=[];this.polylines=[];this.multibounds=[];this.bounds=new GLatLngBounds();this.overlayman=new Clusterer(this.map,this);this.overlayman.rowHeight=20;$(this.basesidebar).innerHTML="";this.overlayman.folders.push([]);this.overlayman.subfolders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.byname=[];this.overlayman.byid=[];this.overlayman.folderBounds.push(new GLatLngBounds());this.wmscount=0};GeoXml.prototype.createMarkerJSON=function(e,b){var d=this;var c=d.makeIcon(c,e.href);var a=new GLatLng(e.y,e.x);d.overlayman.folderBounds[b].extend(a);d.bounds.extend(a);if(e.shadow){c.shadow=e.shadow}else{c.shadow=null}if(!!d.opts.createmarker){d.opts.createmarker(a,e.title,unescape(e.description),null,b,c,e.visibility,e.id)}else{d.createMarker(a,e.title,unescape(e.description),null,b,c,e.visibility,e.id)}};GeoXml.prototype.createMarker=function(point,name,desc,style,idx,instyle,visible,kml_id){var myvar=this.myvar;var icon;var bicon=new GIcon();if(this.opts.baseicon){bicon.iconSize=this.opts.baseicon.iconSize;bicon.iconAnchor=this.opts.baseicon.iconAnchor;bicon.shadowSize=this.opts.baseicon.shadowSize;bicon.infoWindowAnchor=this.opts.baseicon.infoWindowAnchor}else{bicon.infoWindowAnchor=new GPoint(16,0);bicon.iconSize=new GSize(32,32);bicon.shadowSize=new GSize(32,32);bicon.iconAnchor=new GPoint(16,32)}var shadow;var href;if(this.opts.iconFromDescription){var text=desc;var pattern=new RegExp("<\\s*img","ig");var result;var pattern2=/src\s*=\s*[\'\"]/;var pattern3=/[\'\"]/;while((result=pattern.exec(text))!=null){var stuff=text.substr(result.index);var result2=pattern2.exec(stuff);if(result2!=null){stuff=stuff.substr(result2.index+result2[0].length);var result3=pattern3.exec(stuff);if(result3!=null){var imageUrl=stuff.substr(0,result3.index);href=imageUrl}}}shadow=null;if(!href){href="http://maps.google.com/mapfiles/kml/pal3/icon40.png"}icon=new GIcon(bicon,href,null,shadow)}else{href="http://maps.google.com/mapfiles/kml/pal3/icon40";if(instyle==null||typeof instyle=="undefined"){shadow=href+"s.png";href+=".png";if(this.opts.baseicon){href=this.opts.baseicon.image;shadow=this.opts.baseicon.shadow}}else{if(instyle.href){href=instyle.href}if(instyle.shadow){shadow=instyle.shadow}}icon=new GIcon(bicon,href,null,shadow)}var iwoptions=this.opts.iwoptions||{};var markeroptions=this.opts.markeroptions||{};var icontype=this.opts.icontype||"style";if(icontype=="style"){if(!!this.styles[style]){icon=new GIcon(bicon,this.styles[style].href,null,this.styles[style].shadow);icon.src=this.styles[style].href;href=this.styles[style].href}}if(!markeroptions.icon){markeroptions.icon=icon}markeroptions.title=name;var m=new GMarker(point,markeroptions);m.title=name;m.id=kml_id;var obj={type:"point",title:name,description:escape(desc),href:href,shadow:shadow,visibility:visible,x:point.x,y:point.y,id:m.id};this.kml[idx].marks.push(obj);if(this.opts.pointlabelclass){var l=new ELabel(point,name,this.opts.pointlabelclass,this.opts.pointlabeloffset,this.pointlabelopacity,true);m.label=l;this.map.addOverlay(l)}var html,html1,html2,html3,html4;var awidth=this.iwwidth;if(desc.length*8<awidth){awidth=desc.length*8}if(awidth<name.length*10){awidth=name.length*10}html="<div style = 'width:"+this.iwwidth+"px'><h1 "+this.titlestyle+">"+name+"</h1><div "+this.descstyle+">"+desc+"</div>";if(this.opts.directions){html1=html+"<div "+this.directionstyle+'>Get Directions: <a href="#" onclick="GEvent.trigger('+this.myvar+'.lastmarker,\'click2\');return false;">To Here</a> - <a href="#" onclick="GEvent.trigger('+this.myvar+'.lastmarker,\'click3\');return false;">From Here</a><br><a href="#" onclick="GEvent.trigger('+this.myvar+".lastmarker,'click4');return false;\">Search nearby</a></div>";html2=html+"<div "+this.directionstyle+'>Get Directions: To here - <a href="#" onclick="GEvent.trigger('+this.myvar+'.lastmarker,\'click3\');return false;">From Here</a><br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank"><input type="text" SIZE=35 MAXLENGTH=80 name="saddr" id="saddr" value="" /><INPUT value="Go" TYPE="SUBMIT"><input type="hidden" name="daddr" value="'+point.lat()+","+point.lng()+"("+name+')"/><br><a href="# onclick="GEvent.trigger('+this.myvar+".lastmarker,'click');return false;\">&#171; Back</a></div>";html3=html+"<div "+this.directionstyle+'>Get Directions: <a href="#" onclick="GEvent.trigger('+this.myvar+'.lastmarker,\'click2\');return false;">To Here</a> - From Here<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank"><input type="text" SIZE=35 MAXLENGTH=80 name="daddr" id="daddr" value="" /><INPUT value="Go" TYPE="SUBMIT"><input type="hidden" name="saddr" value="'+point.lat()+","+point.lng()+"("+name+')"/><br><a href="#" onclick="GEvent.trigger('+this.myvar+".lastmarker,'click');return false;\">&#171; Back</a></div>";html4=html+"<div "+this.directionstyle+'>Search nearby: e.g. "pizza"<br><form action="http://maps.google.com/maps" method="get"" target="_blank"><input type="text" SIZE=35 MAXLENGTH=80 name="q" id="q" value="" /><INPUT value="Go" TYPE="SUBMIT"><input type="hidden" name="near" value="'+name+" @"+point.lat()+","+point.lng()+'"/><br><a href="# onclick="GEvent.trigger('+this.myvar+".lastmarker,'click');return false;\">&#171; Back</a></div>";GEvent.addListener(m,"click2",function(){m.openInfoWindowHtml(html2+"</div>",iwoptions)});GEvent.addListener(m,"click3",function(){m.openInfoWindowHtml(html3+"</div>",iwoptions)});GEvent.addListener(m,"click4",function(){m.openInfoWindowHtml(html4+"</div>",iwoptions)})}else{html1=html}if(this.clickablemarkers){GEvent.addListener(m,"click",function(){eval(myvar+".lastmarker = m");m.openInfoWindowHtml(html1+"</div>",iwoptions)})}if(this.opts.domouseover){m.mess=html1+"</div>";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='&nbsp;<img style="vertical-align:text-top;padding:0;margin:0" height="16" border="0" src="'+href+'">&nbsp;';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(){$(this.sidebarid).style.backgroundColor=this.hilite.color;$(this.sidebarid).style.color=this.hilite.textcolor});GEvent.addListener(m,"mouseout",function(){$(this.sidebarid).style.background="none";$(this.sidebarid).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(e){var d="";var g=0;var f;if(document.all){for(;g<e.childNodes.length;g++){f=e.childNodes.item(g);d+=f.xml}}else{var c=new XMLSerializer();for(;g<e.childNodes.length;g++){f=c.serializeToString(e.childNodes.item(g));d+=f}}var b=d.replace("<![CDATA[","");var a=b.replace("]]>","");a=a.replace(/\&amp;/g,"&");a=a.replace(/\&lt;/g,"<");a=a.replace(/\&quot;/g,'"');a=a.replace(/\&apos;/g,"'");a=a.replace(/\&gt;/g,">");return a};GeoXml.prototype.processLine=function(b,g,m){var f=this.polylines[b];var h=f.lines[g];var l;var q;if(!h){return}var c=this.map;var d=this.opts.iwoptions||{};var o=new PolylineEncoder(this.NumLevels,this.ZoomFactor,this.verySmall,true);if(h.length>2){var i=o.dpEncode(h);l={points:i.encodedPoints,levels:i.encodedLevels,color:f.color,weight:f.width,opacity:f.opacity,clickable:f.clickablepolys,zoomFactor:this.ZoomFactor,numLevels:this.NumLevels,type:"polyline"};q=new GPolyline.fromEncoded(l)}else{l={points:h,color:f.color,weight:f.width,opacity:f.opacity,type:"line",id:f.id};q=new GPolyline(h,f.color,f.width,f.opacity)}q.bounds=f.pbounds;q.id=f.id;var e="";var r=this.overlayman.markers.length;this.polylines[b].lineidx.push(r);var t;var k=this.iwwidth;var s=f.description;if(s.length*8<k){k=s.length*8}if(k<f.name.length*12){k=f.name.length*12}var j="<div style='font-weight: bold; font-size: medium; margin-bottom: 0em;'>"+f.name;j+="</div><div style='font-family: Arial, sans-serif;font-size: small;width:"+k+"px;'>"+s+"</div>";if(g==0){if(this.opts.sidebarid){var a='&nbsp;&nbsp;<span style=";border-left:'+f.width+"px solid "+f.color+';">&nbsp;</span> ';t=this.myvar+"$$$"+f.name+"$$$polyline$$$"+r+"$$$"+a+"$$$"+f.visible+"$$$"+b+"$$$";this.latestsidebar=this.myvar+"sb"+r}}if(g<h.length){setTimeout(this.myvar+".processLine("+b+","+(g+1)+",'"+m+"');",15);if(this.opts.sidebarid){q.sidebar=this.latestsidebar}}if(this.opts.domouseover){q.mess=j}q.title=f.name;q.geoxml=this;q.strokeColor=f.color;q.strokeWeight=f.width;q.strokeOpacity=f.opacity;q.hilite=this.hilite;q.mytitle=q.title;q.map=this.map;q.idx=b;q.onOver=function(){var p=this.geoxml.polylines[this.idx];for(var n=0;n<p.lineidx.length;n++){var u=this.geoxml.overlayman.markers[p.lineidx[n]];u.realColor=u.strokeColor;u.setStrokeStyle({color:this.hilite.color});u.redraw(true)}if(this.sidebar){$(this.sidebar).style.backgroundColor=this.hilite.color;$(this.sidebar).style.color=this.hilite.textcolor}if(this.mess){this.geoxml.mb.showMess(this.mess,5000)}else{this.title="Click for more information about "+this.mytitle}};q.onOut=function(){var p=this.geoxml.polylines[this.idx];for(var n=0;n<p.lineidx.length;n++){var u=this.geoxml.overlayman.markers[p.lineidx[n]];u.setStrokeStyle({color:this.realColor});u.redraw(true)}this.geoxml.mb.hideMess();if(this.sidebar){$(this.sidebar).style.background="none";$(this.sidebar).style.color=""}};GEvent.addListener(q,"mouseout",q.onOut);GEvent.addListener(q,"mouseover",q.onOver);GEvent.addListener(q,"click",function(n){var p=false;if(!n){n=this.getPoint();p=true}if(this.geoxml.clickablelines||p){this.map.openInfoWindowHtml(n,j,d)}});l.name=f.name;l.description=escape(f.description);l.visibility=f.visibility;this.kml[m].marks.push(l);this.overlayman.AddMarker(q,f.name,m,t,f.visibility)};GeoXml.prototype.createPolyline=function(k,e,c,g,h,a,f,i,d,j){var b={};if(!e){b.color=this.randomColor()}else{b.color=e}if(!g){b.opacity=0.45}else{b.opacity=g}if(!c){b.width=2}else{b.width=c}b.idx=i;b.visibility=d;if(this.hideall){b.visibility=false}b.name=a;b.description=f;b.lines=k;b.lineidx=[];b.id=j;this.polylines.push(b);setTimeout(this.myvar+".processLine("+(this.polylines.length-1)+",0,'"+i+"');",15)};GeoXml.prototype.processPLine=function(h,d,b){var g=this.polyset[h];var c=g.lines[d];var f={};if(c&&c.length){var e=new PolylineEncoder(18,2,0.00001,true);var a=e.dpEncode(c);f={};f.points=a.encodedPoints;f.levels=a.encodedLevels;f.color=g.color;f.weight=g.weight;f.numLevels=18;f.zoomFactor=2;f.opacity=g.opacity;g.obj.polylines.push(f)}if(d==g.lines.length-1){this.finishPolygon(g.obj,b)}else{setTimeout(this.myvar+".processPLine("+h+","+(d+1)+",'"+b+"');",5)}};GeoXml.prototype.finishPolygon=function(b,a){b.type="polygon";this.finishPolygonJSON(b,a,false)};GeoXml.prototype.finishPolygonJSON=function(h,j,q,o){var g=this;var c=g.opts.iwoptions||{};if(typeof h.visibility=="undefined"){h.visibility=true}if(g.hideall){h.visibility=false}var u=unescape(h.description);h.opacity=h.fillOpacity;var m=new GPolygon.fromEncoded(h);var i="<div style='font-weight: bold; font-size: medium; margin-bottom: 0em;'>"+h.name+"</div><div style='font-family: Arial, sans-serif;font-size: small;width:"+this.iwwidth+"px'>"+u+"</div>";var w=(o!="p_"+h.name);if(w){this.latestsidebar=g.myvar+"sb"+this.overlayman.markers.length}if(g.opts.domouseover){m.mess=i}m.strokeColor=h.polylines[0].color;m.mb=g.mb;m.hilite=g.hilite;m.strokeOpacity=h.polylines[0].opacity;m.fillOpacity=h.opacity;m.fillColor=h.color;if(!h.fill){m.fillOpacity=0}if(g.domouseover){m.mess=i}m.geoxml=g;m.title=h.name;m.id=h.id;var r=this.overlayman.markers.length;if(w){g.multibounds.push(new GLatLngBounds());g.polygons.push([])}var t=g.multibounds.length-1;g.multibounds[t].extend(m.getBounds().getSouthWest());g.multibounds[t].extend(m.getBounds().getNorthEast());g.polygons[g.polygons.length-1].push(r);m.polyindex=g.polygons.length-1;m.geomindex=t;if(this.opts.sidebarid){m.sidebarid=this.latestsidebar;m.onOver=function(){if(this.sidebarid){$(this.sidebarid).style.backgroundColor=this.hilite.color;$(this.sidebarid).style.color=this.hilite.textcolor}if(this.geoxml.clickablepolys){var l=this.geoxml.polygons[this.polyindex];if(l){for(var p=0;p<l.length;p++){var n=this.geoxml.overlayman.markers[l[p]];n.realColor=n.fillColor;n.setFillStyle({color:this.hilite.color});n.redraw(true)}}}if(this.mess){m.geoxml.mb.showMess(this.mess,5000)}};m.onOut=function(){if(this.sidebarid){$(this.sidebarid).style.background="none";$(this.sidebarid).style.color=""}var l;if(this.geoxml.clickablepolys){l=this.geoxml.polygons[this.polyindex]}if(l){for(var p=0;p<l.length;p++){var n=this.geoxml.overlayman.markers[l[p]];n.setFillStyle({color:n.realColor});n.redraw(true)}}}}GEvent.addListener(m,"mouseout",m.onOut);GEvent.addListener(m,"mouseover",m.onOver);h.description=escape(u);this.kml[j].marks.push(h);m.map=this.map;var e;GEvent.addListener(m,"click",function(l,n){if(!l&&this.geoxml.alwayspop){e=this.geoxml.multibounds[this.geomindex];this.map.setCenter(e.getCenter(),this.map.getBoundsZoomLevel(e));l=e.getCenter()}if(!l){this.geoxml.mb.showMess("Zooming to "+m.title,3000);e=this.geoxml.multibounds[this.geomindex];this.map.setZoom(this.map.getBoundsZoomLevel(e));this.map.panTo(e.getCenter())}else{if(this.geoxml.clickablepolys){this.map.openInfoWindowHtml(l,i,c)}}});if(this.opts.polylabelclass&&w){var b=m.getBounds().getCenter();var y=this.opts.polylabeloffset;if(!y){y=new GSize(0,0)}y.x=-(h.name.length*6);var s=new ELabel(b," "+h.name+" ",this.opts.polylabelclass,y,this.polylabelopacity,true);m.label=s;this.map.addOverlay(s)}var f="";var v;if(this.basesidebar&&w){var x=this.myvar+"_folder"+j;var a='<span style="background-color:'+h.color+";border:2px solid "+m.strokeColor+';">&nbsp;&nbsp;&nbsp;&nbsp;</span> ';v=this.myvar+"$$$"+h.name+"$$$polygon$$$"+r+"$$$"+a+"$$$"+h.visibility+"$$$null"}if(q){var d=m.getBounds().getNorthEast();var k=m.getBounds().getSouthWest();this.bounds.extend(d);this.bounds.extend(k);this.overlayman.folderBounds[j].extend(k);this.overlayman.folderBounds[j].extend(d)}this.overlayman.AddMarker(m,h.name,j,v,h.visibility);return h.name};GeoXml.prototype.finishLineJSON=function(e,q,c){var g;var l=this;var p=this.map;if(e.type=="line"){g=new GPolyline(e.points,e.color,e.weight,e.opacity)}else{g=new GPolyline.fromEncoded(e)}g.mytitle=e.name;g.title=e.name;g.geoxml=this;g.strokeColor=e.color;g.strokeWeight=e.weight;g.strokeOpacity=e.opacity;g.hilite=this.hilite;var d=l.overlayman.markers.length;var b=false;var f;if(("l_"+e.name)!=c){b=true;l.polylines.push(e);f=l.polylines.length-1;l.polylines[f].lineidx=[];l.latestsidebar=l.myvar+"sb"+d}else{f=l.polylines.length-1;l.polylines[f].lineidx.push(d)}if(this.opts.basesidebar){g.sidebarid=l.latestsidebar}g.onOver=function(){if(!!this.sidebarid){$(this.sidebarid).style.backgroundColor=this.hilite.color}this.realColor=this.strokeColor;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}};g.onOut=function(){if(!!this.sidebarid){$(this.sidebarid).style.background="none"}mark.setStrokeStyle({color:this.realColor});this.redraw(true);if(this.mess){this.geoxml.mb.hideMess()}};GEvent.addListener(g,"mouseover",g.onOver);GEvent.addListener(g,"mouseover",g.onOut);var j="";l.kml[q].marks.push(e);var k=unescape(e.description);var r=this.iwwidth;if(k.length*8<r){r=k.length*8}if(r<e.name.length*12){r=e.name.length*12}var i="<div style='font-weight: bold; font-size: medium; margin-bottom: 0em;'>"+e.name;i+="</div><div style='font-family: Arial, sans-serif;font-size: small;width:"+r+"px'>"+k+"</div>";g.map=this.map;if(this.clickablelines){GEvent.addListener(g,"click",function(m){if(!m){m=g.getPoint()}this.map.openInfoWindowHtml(m,i,l.opts.iwoptions)})}if(l.basesidebar&&b){var a='&nbsp;&nbsp;<span style=";border-left:'+e.weight+"px solid "+e.color+';">&nbsp;</span> ';if(typeof e.visibility=="undefined"){e.visibility=true}j=l.myvar+"$$$"+e.name+"$$$polyline$$$"+d+"$$$"+a+"$$$"+e.visibility+"$$$"+(l.polylines.length-1)+"$$$"}var h=g.getBounds().getNorthEast();var o=g.getBounds().getSouthWest();l.bounds.extend(h);l.bounds.extend(o);l.overlayman.folderBounds[q].extend(o);l.overlayman.folderBounds[q].extend(h);l.overlayman.AddMarker(g,e.name,q,j,e.visibility);return(e.name)};GeoXml.prototype.handlePlaceObj=function(e,h,i,b,d){var f=this;var c=f.jsonmarks[e];var a=c.name;if(c.title){a=c.title}if(a.length+d>f.maxtitlewidth){f.maxtitlewidth=a.length+d}switch(c.type){case"polygon":b="p_"+f.finishPolygonJSON(c,i,true,b);break;case"line":case"polyline":b="l_"+f.finishLineJSON(c,i,b);break;case"point":f.createMarkerJSON(c,i);b="";break}if(e<h-1){var g=f.myvar+".handlePlaceObj("+(e+1)+","+h+","+i+',"'+b+'",'+d+");";document.status="processing "+a;setTimeout(g,1)}else{b="";if(e==f.jsonmarks.length-1){f.progress--;if(f.progress<=0){if(!f.opts.nozoom){f.map.setZoom(f.map.getBoundsZoomLevel(f.bounds));f.map.setCenter(f.bounds.getCenter())}GEvent.trigger(f,"parsed");f.setFolders();if(!f.opts.sidebarid){f.mb.showMess("Finished Parsing",1000);f.ParseURL()}}}}};GeoXml.prototype.parseJSON=function(doc,title,latlon,desc,sbid){var that=this;that.overlayman.miStart=new Date();that.jsdocs=eval("("+doc+")");var bar=$(that.basesidebar);if(bar){bar.style.display=""}that.recurseJSON(that.jsdocs[0],title,desc,that.basesidebar,0)};GeoXml.prototype.setFolders=function(){var d=this;var a=d.kml.length;for(var c=1;c<a;c++){var e=d.kml[c].folderid;var b=document.getElementById(e);if(b!=null){if(!!d.kml[c].open){b.style.display="block"}else{b.style.display="none"}}}};GeoXml.prototype.recurseJSON=function(D,E,w,B,C){var i=this;var d=D.marks;var F=D.title;if(!B){B=0}var t=unescape(D.description);if(!t&&w){t=w}var k=i.forcefoldersopen;if(D.open){k=true}var e=false;if(typeof D.visibility!="undefined"&&D.visibility){e=true}var j=D.snippet;var o=i.overlayman.folders.length;if(!t){t=F}var A;var z;i.overlayman.folders.push([]);i.overlayman.subfolders.push([]);i.overlayman.folderhtml.push([]);i.overlayman.folderhtmlast.push(0);i.overlayman.folderBounds.push(new GLatLngBounds());i.kml.push(new KMLObj(E,t,k));if((!C&&(D.folders&&D.folders.length>1))||D.marks.length){if(C<2||D.marks.length<1){z=i.globalicon}else{z=i.foldericon}A=i.createFolder(o,F,B,z,t,j,k,e)}else{A=B}var y,b;var g="";var l;var s;var h=i.jsonmarks.length;var v=h+d.length;for(var r=0;r<d.length;r++){var u=d[r];i.jsonmarks.push(u);w=unescape(u.description);s=null;if(i.opts.preloadHTML&&w&&w.match(/<(\s)*img/i)){var n=document.createElement("span");n.style.visibility="visible";n.style.position="absolute";n.style.left="-1200px";n.style.top="-1200px";n.style.zIndex=this.overlayman.markers.length;document.body.appendChild(n);n.innerHTML=w}}if(i.groundOverlays){}if(d.length){i.handlePlaceObj(h,v,o,null,C)}var q=0;var a=0;if(typeof D.folders!="undefined"){q=D.folders.lenth;for(var x=0;x<D.folders.length;++x){var c=i.jsdocs[D.folders[x]];a=i.recurseJSON(c,c.title,c.description,A,(C+1));i.overlayman.subfolders[o].push(a);i.overlayman.folderBounds[o].extend(i.overlayman.folderBounds[a].getSouthWest());i.overlayman.folderBounds[o].extend(i.overlayman.folderBounds[a].getNorthEast());if(a!=o){i.kml[o].folders.push(a)}}}if(q||d.length){i.bounds.extend(i.overlayman.folderBounds[o].getSouthWest());i.bounds.extend(i.overlayman.folderBounds[o].getNorthEast())}return o};GeoXml.prototype.createPolygon=function(q,g,d,i,f,l,j,b,h,o,e,n,a,m){var k=this.map;var c={};c.obj={description:h,name:b};c.obj.polylines=[];c.obj.id=m;c.obj.visibility=e;c.obj.fill=n;c.obj.outline=a;c.fillcolor=f;c.obj.strokecolor=g;if(!g){c.color=this.style.color}else{c.color=g}if(!f){c.obj.color=this.randomColor()}else{c.obj.color=f}if(!i){c.obj.opacity=this.style.opacity}else{c.obj.opacity=i}if(typeof l=="undefined"){c.obj.fillOpacity=this.style.fillOpacity}else{c.obj.fillOpacity=l}if(!d){c.weight=this.style.width}else{c.weight=d}c.bounds=j;c.lines=q;c.sidebarid=this.opts.sidebarid;this.polyset.push(c);document.status="processing poly "+b;setTimeout(this.myvar+".processPLine("+(this.polyset.length-1)+",0,'"+o+"')",5)};GeoXml.prototype.toggleFolder=function(b){var c=$(this.myvar+"_folder"+b);var a=$(this.myvar+"TB"+b);if(c.style.display=="none"){c.style.display="";if(a){a.style.fontWeight="normal"}}else{c.style.display="none";if(a){a.style.fontWeight="bold"}}};GeoXml.prototype.saveJSON=function(){if(top.standalone){var a=browseForSave("Select a directory to place your json file","JSON Data Files (*.js)|*.js|All Files (*.*)|*.*","JSON-DATA");if(typeof a!="undefined"){saveLocalFile(a+".js",this.kml.toJSONString())}return}if(this.kml.toJSONString){if(typeof serverBlessJSON!="undefined"){serverBlessJSON(escape(this.kml.toJSONString()),"MyKJSON")}else{this.showIt(this.kml.toJSONString())}}else{alert("No JSON methods currently available")}};GeoXml.prototype.toggleContents=function(e,c){var h=this.overlayman.folders[e];var b;var d;var a;if(c){for(d=0;d<h.length;d++){a=this.overlayman.markers[h[d]];a.hidden=false;b=$(this.myvar+""+h[d]+"CB");if(b){b.checked=true}if(a.hide){a.show()}else{this.map.addOverlay(a)}if(!!a.label){a.label.show()}}}else{for(d=0;d<h.length;d++){a=this.overlayman.markers[h[d]];a.hidden=true;b=$(this.myvar+""+h[d]+"CB");if(b){b.checked=false}if(a.hide){a.hide()}else{this.map.removeOverlay(a)}if(!!a.label){a.label.hide()}}}var g=this.overlayman.subfolders[e];if(typeof g!="undefined"){for(d=0;d<g.length;d++){if(g[d]!=e){b=$(this.myvar+""+g[d]+"FCB");if(b){b.checked=(!!c)}this.toggleContents(g[d],c)}}}};GeoXml.prototype.showHide=function(d,c,g){var b,f;if(d!=null){if(c){this.overlayman.markers[d].show();this.overlayman.markers[d].hidden=false;if(!!this.overlayman.markers[d].label){this.overlayman.markers[d].label.show()}}else{this.overlayman.markers[d].hide();this.overlayman.markers[d].hidden=true;if(!!this.overlayman.markers[d].label){this.overlayman.markers[d].label.hide()}}}else{var e=this.polylines[g];if(c){for(f=0;f<e.lineidx.length;f++){b=this.overlayman.markers[e.lineidx[f]];b.hidden=false;if(b.hide){b.show()}else{this.map.addOverlay(b)}if(!!b.label){b.show()}}}else{for(f=0;f<e.lineidx.length;f++){b=this.overlayman.markers[e.lineidx[f]];b.hidden=true;if(b.hide){b.hide()}else{this.map.removeOverlay(b)}if(!!b.label){b.hide()}}}}};GeoXml.prototype.toggleOff=function(c,b){if(b){this.map.addOverlay(this.overlayman.markers[c]);this.overlayman.markers[c].hidden=false}else{this.map.removeOverlay(this.overlayman.markers[c]);this.overlayman.markers[c].hidden=true}if(this.labels.onMap){this.map.removeOverlay(this.labels);this.map.addOverlay(this.labels)}};GeoXml.addSidebar=function(l,b,j,g,a,m,d){var c="checked";if(m=="false"){c=""}var f="";var k=l+"sb"+g;switch(j){case"marker":f='<li id="'+k+'" onmouseout="GEvent.trigger('+l+".overlayman.markers["+g+"],'mouseout');\" onmouseover=\"GEvent.trigger("+l+".overlayman.markers["+g+"],'mouseover');\" ><input id=\""+l+""+g+'CB" type="checkbox" style="vertical-align:middle" '+c+' onclick="'+l+".showHide("+g+',this.checked)"><a href="#" onclick="GEvent.trigger('+l+".overlayman.markers["+g+"],'click');return false;\">"+a+b+"</a></li>";break;case"polyline":f='<li id="'+k+'"  onmouseout="'+l+".overlayman.markers["+g+'].onOut();" onmouseover="'+l+".overlayman.markers["+g+'].onOver();" ><input id="'+l+""+g+'CB" type="checkbox" '+c+' onclick="'+l+".showHide(null,this.checked,"+d+')"><span style="margin-top:6px;"><a href="#" onclick="GEvent.trigger('+l+".overlayman.markers["+g+"],'click');return false;\">&nbsp;"+a+b+"</a></span></li>";break;case"polygon":f='<li id="'+k+'"  onmouseout="'+l+".overlayman.markers["+g+'].onOut();" onmouseover="'+l+".overlayman.markers["+g+'].onOver();" ><input id="'+l+""+g+'CB" type="checkbox" '+c+' onclick="'+l+".showHide("+g+',this.checked)"><span style="margin-top:6px;"><a href="#" onclick="GEvent.trigger('+l+".overlayman.markers["+g+"],'click');return false;\">&nbsp;"+a+b+"</a></span></nobr></li>";break;case"groundoverlay":f='<li id="'+k+'"><input id="'+l+""+g+'CB" type="checkbox" '+c+' onclick="'+l+".showHide("+g+',this.checked)"><span style="margin-top:6px;"><a href="#" onclick="GEvent.trigger('+l+".overlayman.markers["+g+"],'zoomto');return false;\">&nbsp;"+a+b+"</a></span></li>";break;case"tiledoverlay":f='<li id="'+k+'"><nobr><input id="'+l+""+g+'CB" type="checkbox" '+c+' onclick="'+l+".toggleOff("+g+',this.checked)"><span style="margin-top:6px;"><a href="#" oncontextMenu="'+l+".upgradeLayer("+d+');return false;" onclick="GEvent.trigger('+l+".overlayman.markers["+g+"],'zoomto');return false;\">"+GeoXml.WMSICON+"&nbsp;"+b+"</a><br />"+a+"</span></li>";break}return f};GeoXml.addDropdown=function(d,a,c,b,e){return'<option value="'+b+'">'+a+"</option>"};GeoXml.prototype.parse=function(g){var d=this;var e=[];if(typeof g!="undefined"){if(typeof g!="string"){e=g}else{e=g.split(",")}}d.progress+=d.urls.length;for(var b=0;b<d.urls.length;b++){var f=e[b];if(typeof f=="undefined"||!f||f=="null"){var a=d.urls[b].split("/");f=a[a.length-1]}d.mb.showMess("Loading "+f);var c=/\.js$/i;if(d.urls[b].search(c)!=-1){d.loadJSONUrl(this.urls[b],f)}else{d.loadXMLUrl(this.urls[b],f)}}};GeoXml.prototype.parseString=function(d,e,b){var c=[];if(e){c=e.split(",")}if(typeof d=="string"){this.docs=[d]}else{this.docs=d}this.progress+=this.docs.length;for(var a=0;a<this.docs.length;a++){this.mb.showMess("Processing "+c[a]);this.processing(GXml.parse(this.docs[a]),c[a],b)}};GeoXml.prototype.parseXML=function(d,e,b){var c=[];if(typeof e!="undefined"){if(typeof e=="string"){c=e.split(",")}else{c=e}}if(typeof d=="array"){this.docs=d}else{this.docs=[d]}this.progress+=this.docs.length;for(var a=0;a<this.docs.length;a++){this.mb.showMess("Processing "+c[a]);this.processing(this.docs[a],c[a],b)}};var currdeschead="";GeoXml.prototype.makeDescription=function(f,l,g){var j="";var i=f.childNodes.length;var k=0;var e;while(i--){var c=f.childNodes.item(k);var n=c.nodeName;var h=n.split(":");var b="";if(h.length>1){b=h[1]}else{b=n}if(b.match(/^(visible|visibility|boundedBy|StyleMap|styleUrl|posList|coordinates|Style|Polygon|LineString|Point|LookAt|Envelope|Box|MultiPolygon)/)){currdeschead=""}else{if(b.match(/#text|the_geom|SchemaData|ExtendedData|#cdata-section/)){}else{if(b.match(/Snippet/i)){}else{if(b.match(/SimpleData/)){b=c.getAttribute("name")}currdeschead="<b>&nbsp;"+b+"&nbsp;</b> :"}}e=c.nodeValue;if(b.match(/(\S)*(name|title)(\S)*/i)){if(!e){e=GXml.value(c)}l=e;if(e&&typeof l!="undefined"&&l.length>this.maxtitlewidth){this.maxtitlewidth=l.length}currdeschead=""}else{if(e&&e.match(/(\S)+/)){if(e.match(/^http:\/\/|^https:\/\//i)){e='<a href="'+e+'">'+e+"</a>"}else{if(!l||l==""){l=e;if(e&&typeof l!="undefined"&&l.length>this.maxtitlewidth){this.maxtitlewidth=l.length}}}}if(e&&(e.match(/(\s)*/)!=true)){j+=currdeschead+"<span>"+e+"</span><br />";currdeschead=""}if(c.childNodes.length){var a=this.makeDescription(c,l,g+1);if(a){j+=a.desc;if(typeof a.title!="undefined"&&a.title){l=a.title;if(l.length>this.maxtitlewidth){this.maxtitlewidth=l.length+g}}}}}}k++}var m={};m.desc=j;m.title=l;return m};GeoXml.prototype.randomColor=function(){var d="0123456789abcdef";var b="#";for(var c=0;c<6;c++){var a=parseInt(Math.random()*16,10);b+=d.substring(a,a+1)}return b};GeoXml.prototype.handleGeomark=function(h,T,I){var H=this;var K,B,m,N;B="";K="";var q=0;var C,d;var s=true;var o=true;var f=true;var b,u,R,z,V;var e=[];var A,O,v;var i="";var t=[];var r=0;var x=0;var Q=0;var g=0;var M;var J=[];var F,P;var S=new GLatLngBounds();var G=h.getElementsByTagName("coordinates");if(G.length<1){G=h.getElementsByTagName("gml:coordinates")}if(G.length<1){G=[];t=h.getElementsByTagName("gml:posList");if(t.length<1){t=h.getElementsByTagName("posList")}for(P=0;P<t.length;P++){i=" ";e=GXml.value(t.item(P)).split(" ");for(F=0;F<(e.length-1);F++){if(e[F]&&e[F]!=" "&&!isNaN(parseFloat(e[F]))){i+=""+parseFloat(e[F])+","+parseFloat(e[F+1]);i+=" "}F++}if(i){if(t.item(P).parentNode&&(t.item(P).parentNode.nodeName=="gml:LineString")){Q++}else{g++}v="<coordinates>"+i+"</coordinates>";A=GXml.parse(v);if(G.push){G.push(A)}}}var y=h.getElementsByTagName("gml:pos");if(y.length<1){y=h.getElementsByTagName("gml:pos")}if(y.length){for(M=0;M<y.length;M++){O=GXml.value(y.item(M));e=O.split(" ");A=GXml.parse("<coordinates>"+e[0]+","+e[1]+"</coordinates>");if(G.push){G.push(A)}}}}var k=false;r=0;x=0;Q=0;g=0;var n=H.makeDescription(h,"");K="<ul>"+n.desc+"</ul>";if(!m&&n.title){m=n.title;if(m.length>this.maxtitlewidth){this.maxtitlewidth=m.length}}if(k&&typeof C!="undefined"){G.push(""+d+","+C)}var E=[];var D;var w;var a;for(var U=0;U<G.length;U++){w=false;if(G[U].parentNode&&(G[U].parentNode.nodeName=="gml:Box"||G[U].parentNode.nodeName=="gml:Envelope")){w=true}i=GXml.value(G[U]);i+=" ";i=i.replace(/\s+/g," ");i=i.replace(/^ /,"");i=i.replace(/, /,",");var L=i.split(" ");if(L.length==1||L[1]==""){a=L[0].split(",");D=new GLatLng(parseFloat(a[1])/I.ys-I.y,parseFloat(a[0])/I.xs-I.x);H.bounds.extend(D);if(!w){if(!m){m="un-named place"}if(!!H.opts.createmarker){H.opts.createmarker(D,m,K,q,T,null,s)}else{H.createMarker(D,m,K,q,T,null,s)}}}else{for(M=0;M<L.length-1;M++){a=L[M].split(",");D=new GLatLng(parseFloat(a[1])/I.ys-I.y,parseFloat(a[0])/I.xs-I.x);J.push(D);S.extend(D)}H.bounds.extend(S.getNorthEast());H.bounds.extend(S.getSouthWest());if(!w){E.push(J)}}}if(!E||E.length<1){return}var j=h.getElementsByTagName("LineString");if(j.length<1){j=h.getElementsByTagName("gml:LineString")}if(j.length||Q>0){if(!!N){b=N.width;u=N.color;R=N.opacity}else{b=this.style.width;u=this.style.color;R=this.style.opacity}if(!m){m="un-named path"}if(!!H.opts.createpolyline){H.opts.createpolyline(E,u,b,R,S,m,K,T,s)}else{H.createPolyline(E,u,b,R,S,m,K,T,s)}}var W=h.getElementsByTagName("Polygon");if(W.length<1){W=h.getElementsByTagName("gml:Polygon")}if(W.length||g>0){if(!!N){b=N.width;u=N.color;R=N.opacity;z=N.fillOpacity;V=N.fillColor;o=N.file;f=N.outline}V=this.randomColor();u=this.randomColor();o=1;f=1;if(!m){m="un-named area"}if(!!H.opts.createpolygon){H.opts.createpolygon(E,u,b,R,V,z,S,m,K,T,s,o,f)}else{H.createPolygon(E,u,b,R,V,z,S,m,K,T,s,o,f)}}};GeoXml.prototype.handlePlacemark=function(m,an,i,E){var X=this;var Z,Q,u,ad;Q="";Z="";var z=0;var R,d;var F=true;var v=false;var f;var ak;var n;var O;var I;var b;var al;var x;var Y=[];var U=[];var a=[];var T;var e,P,J,ae;var af,N,ac,ai,ah,V;var B=m.getAttribute("id");var C=0;var L=0;var ag=0;var g=0;var q="";af=m.getAttribute("lat");if(typeof af!="undefined"){R=af}af=m.getAttribute("lon");if(typeof af!="undefined"){v=true;d=af}af=0;var W=m.getElementsByTagName("coordinates");if(W.length<1){W=m.getElementsByTagName("gml:coordinates")}if(W.length<1){W=[];var H=m.getElementsByTagName("gml:posList");for(af=0;af<H.length;af++){q=" ";var ab=GXml.value(H.item(af))+" ";e=ab.split(" ");for(V=0;V<(e.length-1);V++){if(e[V]&&e[V]!=" "&&!isNaN(parseFloat(e[V]))){q+=""+parseFloat(e[V])+","+parseFloat(e[V+1]);q+=" "}V++}if(q){if(H.item(af).parentNode&&(H.item(af).parentNode.nodeName=="gml:LineString")){ag++}else{g++}J="<coordinates>"+q+"</coordinates>";P=GXml.parse(J);if(W.push){W.push(P)}}}N=m.getElementsByTagName("gml:pos");if(N.length<1){N=m.getElementsByTagName("gml:pos")}if(N.length){for(ac=0;ac<N.length;ac++){ae=GXml.value(N.item(ac))+" ";e=ae.split(" ");P=GXml.parse("<coordinates>"+e[0]+","+e[1]+"</coordinates>");if(W.push){W.push(P)}}}}for(var M=0;M<m.childNodes.length;M++){var am=m.childNodes.item(M).nodeName;ae=GXml.value(m.childNodes.item(M));var aj=am.split(":");var A;if(aj.length>1){A=aj[1].toLowerCase()}else{A=aj[0].toLowerCase()}var S=false;switch(A){case"name":u=ae;if(u.length+i>this.maxtitlewidth){this.maxtitlewidth=u.length+i}break;case"title":Q=ae;if(Q.length+i>this.maxtitlewidth){this.maxtitlewidth=Q.length+i}break;case"desc":case"description":Z=GeoXml.getDescription(m.childNodes.item(M));if(!Z){Z=ae}if(X.opts.preloadHTML&&Z&&Z.match(/<(\s)*img/i)){var o=document.createElement("span");o.style.visibility="visible";o.style.position="absolute";o.style.left="-1200px";o.style.top="-1200px";o.style.zIndex=this.overlayman.markers.length;document.body.appendChild(o);o.innerHTML=Z}break;case"visibility":if(ae=="0"){F=false}break;case"href":case"link":if(ae){Z+="<p><a target='_blank' href='"+ae+"'>link</a></p>"}else{var D=m.childNodes.item(M).getAttribute("href");if(D){var y=m.childNodes.item(M).getAttribute("type");if(y.match(/image/)){Z+='<img style="width:256px" src=\''+D+"' />"}}}break;case"author":Z+="<p><b>author:</b>"+ae+"</p>";break;case"time":Z+="<p><b>time:</b>"+ae+"</p>";break;case"lat":R=ae;break;case"long":d=ae;v=true;break;case"point":C++;S=true;break;case"line":ag++;S=true;break;case"box":L++;S=true;break;case"polygon":g++;S=true;break;case"styleurl":z=ae;break;case"stylemap":var h=false;P=m.childNodes.item(M);for(ai=0;(ai<P.childNodes.length&&!h);ai++){var r=P.childNodes[ai];for(ah=0;(ah<r.childNodes.length&&!h);ah++){var t=r.childNodes[ah].nodeName;if(t=="Style"){ad=this.handleStyle(r.childNodes[ah]);h=true}}}break;case"style":ad=this.handleStyle(m.childNodes.item(M));break}if(S){e=ae.split(" ");q="";for(V=0;V<(e.length-1);V++){if(e[V]&&e[V]!=" "&&!isNaN(parseFloat(e[V]))){q+=""+parseFloat(e[V+1])+","+parseFloat(e[V]);if(V>1&&V<(e.length-2)){q+=" "}}V++}if(q!=""){P=GXml.parse("<coordinates>"+q+"</coordinates>");if(W.push){W.push(P)}}}}if(!u&&Q){u=Q}if(E){ad=E}if(z){ad=this.styles[z]}if(typeof Z=="undefined"||!Z){var w=X.makeDescription(m,"");Z="<ul>"+w.desc+"</ul>";if(!u&&w.title){u=w.title;if((u.length+i)>this.maxtitlewidth){this.maxtitlewidth=u.length+i}}}if(v&&typeof R!="undefined"){if(R){var G=""+d+","+R+" ";P=GXml.parse("<coordinates>"+G+"</coordinates>");W.push(P)}}for(var ao=0;ao<W.length;ao++){var K=false;if(W[ao].parentNode&&(W[ao].parentNode.nodeName.match(/^(gml:Box|gml:Envelope)/i))){K=true}q=GXml.value(W[ao]);q+=" ";q=q.replace(/\s+/g," ");q=q.replace(/^ /,"");q=q.replace(/, /,",");var aa=q.split(" ");if(aa.length==1||aa[1]==""){a=aa[0].split(",");T=new GLatLng(parseFloat(a[1]),parseFloat(a[0]));this.overlayman.folderBounds[an].extend(T);if(!K){if(!u){u="un-named place"}if(!!X.opts.createmarker){X.opts.createmarker(T,u,Z,z,an,ad,F,B)}else{X.createMarker(T,u,Z,z,an,ad,F,B)}}}else{Y=[];al=new GLatLngBounds();for(ac=0;ac<aa.length-1;ac++){a=aa[ac].split(",");T=new GLatLng(parseFloat(a[1]),parseFloat(a[0]));Y.push(T);al.extend(T)}this.overlayman.folderBounds[an].extend(al.getSouthWest());this.overlayman.folderBounds[an].extend(al.getNorthEast());if(!K){U.push(Y)}}}if(!U||U.length<1){return}var s=m.getElementsByTagName("LineString");if(s.length<1){s=m.getElementsByTagName("gml:LineString")}if(s.length||ag>0){if(!!ad){b=ad.width;I=ad.color;ak=ad.opacity}else{b=this.style.width;I=this.style.color;ak=this.style.opacity}if(!u){u="un-named path"}if(!!X.opts.createpolyline){X.opts.createpolyline(U,I,b,ak,al,u,Z,an,F,B)}else{X.createPolyline(U,I,b,ak,al,u,Z,an,F,B)}}var ap=m.getElementsByTagName("Polygon");if(ap.length<1){ap=m.getElementsByTagName("gml:Polygon")}if(ap.length||g>0){if(!!ad){b=ad.width;I=ad.color;ak=ad.opacity;O=ad.fillOpacity;n=ad.fillcolor;x=ad.fill;f=ad.outline}if(typeof x=="undefined"){x=1}if(typeof I=="undefined"){I=this.style.color}if(typeof n=="undefined"){n=this.randomColor()}if(!u){u="un-named area"}if(!!X.opts.createpolygon){X.opts.createpolygon(U,I,b,ak,n,O,al,u,Z,an,F,x,f,B)}else{X.createPolygon(U,I,b,ak,n,O,al,u,Z,an,F,x,f,B)}}};GeoXml.prototype.makeIcon=function(d,a){if(!!a){if(!!this.opts.baseicon){d=new GIcon(this.opts.baseicon,a);d.href=a}else{d=new GIcon(G_DEFAULT_ICON,a);d.iconSize=new GSize(32,32);d.shadowSize=new GSize(59,32);d.dragCrossAnchor=new GPoint(2,8);d.iconAnchor=new GPoint(16,32);d.href=a;if(this.opts.printgif){var c=a.split("/");var b=c[c.length-1];b=this.opts.printgifpath+b.replace(/.png/i,".gif");d.printImage=b;d.mozPrintImage=b}if(!!this.opts.noshadow){d.shadow=""}else{if(a.indexOf("/red.png")>-1||a.indexOf("/blue.png")>-1||a.indexOf("/green.png")>-1||a.indexOf("/yellow.png")>-1||a.indexOf("/lightblue.png")>-1||a.indexOf("/purple.png")>-1||a.indexOf("/orange.png")>-1||a.indexOf("/pink.png")>-1||a.indexOf("-dot.png")>-1){d.shadow="http://maps.google.com/mapfiles/ms/icons/msmarker.shadow.png"}else{if(a.indexOf("-pushpin.png")>-1||a.indexOf("/pause.png")>-1||a.indexOf("/go.png")>-1||a.indexOf("/stop.png")>-1){d.shadow="http://maps.google.com/mapfiles/ms/icons/pushpin_shadow.png"}else{var e=a.replace(".png",".shadow.png");if(e.indexOf(".jpg")){e=""}d.shadow=e}}}}}if(this.opts.noshadow){d.shadow=""}return d};GeoXml.prototype.handleStyle=function(e,g){var p=e.getElementsByTagName("Icon");var k,l;var c,m,n,j;var q,d,i,b,a;if(p.length>0){d=GXml.value(p[0].getElementsByTagName("href")[0]);k=this.makeIcon(k,d)}var o=e.getElementsByTagName("LineStyle");if(o.length>0){var f=parseInt(GXml.value(o[0].getElementsByTagName("width")[0]),10);if(f<1){f=5}i=GXml.value(o[0].getElementsByTagName("color")[0]);c=i.substr(0,2);m=i.substr(2,2);n=i.substr(4,2);j=i.substr(6,2);i="#"+j+n+m;l=parseInt(c,16)/256;if(!k){k={}}k.color=i;k.width=f;k.opacity=l}var h=e.getElementsByTagName("PolyStyle");if(h.length>0){q=parseInt(GXml.value(h[0].getElementsByTagName("fill")[0]),10);a=parseInt(GXml.value(h[0].getElementsByTagName("outline")[0]),10);i=GXml.value(h[0].getElementsByTagName("color")[0]);b=GXml.value(h[0].getElementsByTagName("colorMode")[0]);if(h[0].getElementsByTagName("fill").length==0){q=1}if(h[0].getElementsByTagName("outline").length==0){a=1}c=i.substr(0,2);m=i.substr(2,2);n=i.substr(4,2);j=i.substr(6,2);i="#"+j+n+m;l=parseInt(c,16)/256;if(!k){k={}}k.fill=q;k.outline=a;if(b!="random"){k.fillcolor=i}else{k.colortint=i}k.fillOpacity=l;if(!q){k.fillOpacity=0}if(!a){k.opacity=0}}if(g){this.styles["#"+g]=k}return k};GeoXml.prototype.processKML=function(M,P,N,D,f,W){var R=this;var ah=this.map;var j;var q;var H=this.forcefoldersopen;if(M.nodeName=="kml"){j=this.docicon}if(M.nodeName=="Document"){j=this.kmlicon}if(M.nodeName=="Folder"){j=this.foldericon;q=N}var l=[];var s=[];var U="";var b="";var aa;var z=true;var C=false;var T=false;var e;var a=null;var ab=1;var g;var af=false;var B=[];var p;var E;var O;var V,c,h,u;var F;var v=M.getAttribute("id");for(var L=0;L<M.childNodes.length;L++){var w=M.childNodes.item(L);var ad=w.nodeName;var X=w.nodeValue;switch(ad){case"name":case"title":N=GXml.value(w);if(N.length+f>this.maxtitlewidth){this.maxtitlewidth=N.length+f}break;case"Folder":case"Document":s.push(w);break;case"GroundOverlay":e=GXml.value(w.getElementsByTagName("href")[0]);var m=parseFloat(GXml.value(w.getElementsByTagName("north")[0]));var K=parseFloat(GXml.value(w.getElementsByTagName("south")[0]));var A=parseFloat(GXml.value(w.getElementsByTagName("east")[0]));var t=parseFloat(GXml.value(w.getElementsByTagName("west")[0]));var o=GXml.value(w.getElementsByTagName("attribution")[0]);h=new GLatLng(K,t);c=new GLatLng(m,A);this.bounds.extend(h);this.bounds.extend(c);E=GXml.value(w.getElementsByTagName("color")[0]);ab=parseInt(E.substring(1,3),16)/256;p=GXml.value(w.getElementsByTagName("name")[0]);var G=/arcimsproxy/i;if(e.match(G)){e+="&bbox="+t+","+K+","+A+","+m+"&response=img";g=new GLatLngBounds(h,c);af=true;O=this.makeWMSTileLayer(e,z,p,ab,o,N,g);if(O){O.bounds=g;O.title=p;O.opacity=ab;O.visible=z;O.url=e;if(!this.quiet){this.mb.showMess("Adding Tiled ArcIms Overlay "+N,1000)}B.push(O)}}else{var J=/request=getmap/i;if(e.match(J)){e+="&bbox="+t+","+K+","+A+","+m;g=new GLatLngBounds(h,c);af=true;O=this.makeWMSTileLayer(e,z,p,ab,o,N,g);if(O){O.bounds=g;O.title=p;O.opacity=ab;O.visible=z;O.url=e;if(!this.quiet){this.mb.showMess("Adding Tiled WMS Overlay "+N,1000)}B.push(O)}}else{g=new GLatLngBounds(h,c);a=new GGroundOverlay(e,g);a.bounds=g;a.getBounds=function(){return this.bounds};C=true;af=false}}break;case"NetworkLink":e=GXml.value(w.getElementsByTagName("href")[0]);T=true;break;case"description":case"Description":U=GeoXml.getDescription(w);break;case"open":if(GXml.value(w)=="1"){H=true}if(GXml.value(w)=="0"){H=this.forcefoldersopen}break;case"visibility":if(GXml.value(w)=="0"){z=false}break;case"snippet":b=GXml.value(w);break;default:for(var Z=0;Z<P.length;Z++){if(ad==P[Z]){l.push(w)}}}}var I;var ac=this.overlayman.folders.length;var r=W;if(s.length>1||l.length||a||af){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(N,U,false,ac));r=this.kml.length-1;I=this.createFolder(ac,N,D,j,U,b,false,z)}else{I=D}if(M.nodeName=="Folder"||M.nodeName=="Document"){this.kml[r].open=H;this.kml[r].folderid=I}if(a||af){this.kml[this.kml.length-1].visibility=z;this.kml[this.kml.length-1].groundOverlays.push({url:e,bounds:g})}if(T){var S=/&amp;/g;e=e.replace(S,"&");var ag=/\n/g;e=e.replace(ag,"");this.progress++;if(!top.standalone){if(typeof this.proxy!="undefined"){e=this.proxy+escape(e)}}var d=this.myvar+".loadXMLUrl('"+e+"','"+N+"',null,null,'"+D+"');";setTimeout(d,1000);return}if(af&&B.length){for(var ai=0;ai<B.length;ai++){var O=B[ai];var y="";if(this.basesidebar){var V=this.overlayman.markers.length;if(!this.nolegend){var ae=O.url.replace(/height=(\d)+/i,"height=100");ae=ae.replace(/width=(\d)+/i,"width=100");y='<img src="'+ae+'" style="width:100px" />'}}parm=this.myvar+"$$$"+O.title+"$$$tiledoverlay$$$"+V+"$$$"+y+"$$$"+O.visible+"$$$"+(this.baseLayers.length-1);var F=O.desc;var ah=this.map;GEvent.addListener(O,"zoomto",function(){ah.setZoom(ah.getBoundsZoomLevel(this.getBounds()));ah.panTo(this.getBounds().getCenter())});this.overlayman.AddMarker(O,N,ac,parm,true,true)}}if(a){if(this.basesidebar){var V=this.overlayman.markers.length;var y='<span style="background-color:black;border:2px solid brown;">&nbsp;&nbsp;&nbsp;&nbsp;</span> ';parm=this.myvar+"$$$"+N+"$$$polygon$$$"+V+"$$$"+y+"$$$"+z+"$$$null";var F=U;var ah=this.map;GEvent.addListener(a,"zoomto",function(){ah.setZoom(ah.getBoundsZoomLevel(a.getBounds()));ah.panTo(a.getBounds().getCenter())});this.overlayman.folderBounds[ac].extend(a.getBounds().getSouthWest());this.overlayman.folderBounds[ac].extend(a.getBounds().getNorthEast());C=true;this.overlayman.AddMarker(a,N,ac,parm,z)}this.map.addOverlay(a)}for(aa=0;aa<l.length;aa++){this.handlePlacemark(l[aa],ac,f+1)}var Q=0;for(aa=0;aa<s.length;aa++){var Y=this.processKML(s[aa],P,N,I,f+1,r);if(typeof Y=="number"&&Y!=ac){var x=this.overlayman.folderBounds[Y];if(!x){this.overlayman.folderBounds[Y]=new GLatLngBounds()}else{var h=this.overlayman.folderBounds[Y].getSouthWest();var c=this.overlayman.folderBounds[Y].getNorthEast();this.overlayman.folderBounds[ac].extend(h);this.overlayman.folderBounds[ac].extend(c)}this.overlayman.subfolders[ac].push(Y);if(Y!=ac){this.kml[ac].folders.push(Y)}Q++}}if(Q||l.length||C){this.bounds.extend(this.overlayman.folderBounds[ac].getSouthWest());this.bounds.extend(this.overlayman.folderBounds[ac].getNorthEast())}if(s.length==0&&l.length==0&&!this.opts.basesidebar){this.ParseURL()}return ac};GeoXml.prototype.processGPX=function(o,z,w,y){var u;if(o.nodeName=="gpx"){u=this.gmlicon}if(o.nodeName=="rte"||o.nodeName=="trk"||o.nodeName=="trkseg"){u=this.foldericon}var t=[];var x=[];var s="";var h="";var r,d,f,p;var m=this.forcefoldersopen;var q="";var c=true;for(var j=0;j<o.childNodes.length;j++){var k=o.childNodes.item(j);var b=k.nodeName;if(b=="name"||b=="title"){z=GXml.value(k);if(z.length+y>this.maxtitlewidth){this.maxtitlewidth=z.length+y}}if(b=="rte"){x.push(k)}if(b=="trk"){x.push(k)}if(b=="trkseg"){x.push(k)}if(b=="trkpt"){t.push(k);p=k.getAttribute("lat");if(typeof p!="undefined"){f=p}p=k.getAttribute("lon");if(typeof p!="undefined"){d=p;q+=d+","+f+" "}}if(b=="rtept"){t.push(k);p=k.getAttribute("lat");if(typeof p!="undefined"){f=p}p=k.getAttribute("lon");if(typeof p!="undefined"){d=p;q+=d+","+f+" "}}if(b=="wpt"){t.push(k)}if(b=="description"||b=="desc"){s=GXml.value(k)}}if(q.length){var g='<?xml version="1.0"?><Placemark><name>'+z+"</name><description>"+s+"</description><LineString><coordinates>"+q+"</coordinates></LineString></Placemark>";var e=GXml.parse(g).documentElement;t.push(e)}var v;var n=this.overlayman.folders.length;if(t.length||o.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(z,s,m,n));v=this.createFolder(n,z,w,u,s,h,m,c)}else{v=w}for(r=0;r<t.length;r++){this.handlePlacemark(t[r],n,y+1)}for(r=0;r<x.length;r++){var a=this.processGPX(x[r],z,v,y+1);this.overlayman.subfolders[n].push(a);this.overlayman.folderBounds[n].extend(this.overlayman.folderBounds[a].getSouthWest());this.overlayman.folderBounds[n].extend(this.overlayman.folderBounds[a].getNorthEast())}if(this.overlayman.folderBounds[n]){this.bounds.extend(this.overlayman.folderBounds[n].getSouthWest());this.bounds.extend(this.overlayman.folderBounds[n].getNorthEast())}return n};GeoXml.prototype.ParseURL=function(){var e=top.location.search.substring(1);var a=e.split("&");var j=this.overlayman.markers;for(var d=0;d<a.length;d++){var g=a[d].indexOf("=");var f=a[d].substring(0,g).toLowerCase();var b=unescape(a[d].substring(g+1));var c=0;var h;if(b){switch(f){case"openbyid":for(c=0;c<j.length;c++){h=j[c].id;if(h==b){this.overlayman.markers[c].show();this.overlayman.markers[c].hidden=false;GEvent.trigger(this.overlayman.markers[c],"click");break}}break;case"kml":case"url":case"src":case"geoxml":this.urls.push(b);this.parse();break;case"openbyname":for(c=0;c<j.length;c++){h=j[c].title;if(h==b){this.overlayman.markers[c].show();this.overlayman.markers[c].hidden=false;GEvent.trigger(this.overlayman.markers[c],"click");break}}break}}}};GeoXml.prototype.processing=function(h,J,r,G,I){this.overlayman.miStart=new Date();if(!G){G=J}var g=this;if(!I){I=0}var f;var u;var z=h.documentElement;if(!z){alert("No document found");return 0}var m=[];var K;var c;var l;var b=z.nodeName;var n=g.opts.allfoldersopen;var o=b.split(":");if(o.length>1){b=o[1]}var F,e,C;if(b=="FeatureCollection"){F=$(g.basesidebar);if(!J){J=K}if(typeof J=="undefined"){J="Un-named GML"}if(J.length>g.maxtitlewidth){g.maxtitlewidth=J.length}F.style.display="";u=g.overlayman.folders.length;g.processGML(z,J,r,G);g.kml[0].folders.push(u)}if(b=="gpx"){if(!J){J=K}if(typeof J=="undefined"){J="Un-named GPX"}g.title=J;if(J.length>g.maxtitlewidth){g.maxtitlewidth=J.length}F=$(g.basesidebar);if(F){F.style.display=""}u=g.overlayman.folders.length;g.processGPX(z,J,g.basesidebar,I);g.kml[0].folders.push(u)}else{if(b=="kml"){l=z.getElementsByTagName("Style");for(C=0;C<l.length;C++){e=l[C].getAttribute("id");if(e){g.handleStyle(l[C],e)}}l=z.getElementsByTagName("StyleMap");for(C=0;C<l.length;C++){e=l[C].getAttribute("id");if(e){var p=false;var y=l[C];for(var B=0;(B<y.childNodes.length&&!p);B++){var x=y.childNodes[B];for(var A=0;(A<x.childNodes.length&&!p);A++){var E=x.childNodes[A].nodeName;if(E=="styleUrl"){var t=GXml.value(x.childNodes[A]);g.styles["#"+e]=g.styles[t];p=true}if(E=="Style"){g.handleStyle(x.childNodes[A],e);p=true}}}}}if(!J){J=K}if(typeof J=="undefined"){J="KML Document"}g.title=J;if(J.length>g.maxtitlewidth){g.maxtitlewidth=J.length}var d=["Placemark"];var v=z.getElementsByTagName("Schema");for(var q=0;q<v.length;q++){c=v[q].getAttribute("parent");if(c=="Placemark"){c=v[q].getAttribute("name");d.push(c)}}F=$(g.basesidebar);if(F){F.style.display=""}u=g.overlayman.folders.length;var w=g.kml.length-1;var a=g.processKML(z,d,J,g.basesidebar,0,w);g.kml[0].folders.push(u)}else{m=z.getElementsByTagName("item");if(m.length<1){m=z.getElementsByTagName("atom")}if(m.length<1){m=z.getElementsByTagName("entry")}if(!J){J=K}if(typeof J=="undefined"){J="News Feed"}g.title=J;if(J.length>g.maxtitlewidth){g.maxtitlewidth=J.length}var D;if(g.opts.baseicon){D=g.opts.baseicon;D.href=D.image}else{D=new GIcon(G_DEFAULT_ICON,g.rssicon);D.iconSize=new GSize(32,32);D.shadowSize=new GSize(59,32);D.dragCrossAnchor=new GPoint(2,8);D.iconAnchor=new GPoint(16,32);D.href=g.rssicon;f=g.rssicon.replace(".png",".shadow.png");D.shadow=f+"_shadow.png"}D.color="#00FFFF";D.width="3";D.opacity=0.5;if(!G){G="RSS feed"}g.kml[0].folders.push(g.overlayman.folders.length);if(m.length){F=$(g.basesidebar);if(F){F.style.display=""}g.overlayman.folders.push([]);g.overlayman.folderhtml.push([]);g.overlayman.folderhtmlast.push(0);g.overlayman.folderBounds.push(new GLatLngBounds());u=g.kml.length-1;g.kml[u].open=n;g.kml.push(new KMLObj(J,G,n,u));if(g.basesidebar){var H=g.createFolder(u,J,g.basesidebar,g.globalicon,G,null,n,true)}for(C=0;C<m.length;C++){g.handlePlacemark(m[C],u,I,D)}}}}g.progress--;if(g.progress==0){GEvent.trigger(g,"initialized");if(!g.opts.sidebarid){g.mb.showMess("Finished Parsing",1000)}if(!g.opts.nozoom&&!g.basesidebar){g.map.setZoom(g.map.getBoundsZoomLevel(g.bounds));g.map.setCenter(g.bounds.getCenter())}}};GeoXml.prototype.createFolder=function(l,j,e,i,g,a,b,c){var h=$(e);b=true;var n=this.myvar+"_folder"+l;var k="";if(c){k=" checked "}this.overlayman.folderhtml[n]="";var m="display:block";var d="font-weight:normal";if(typeof b=="undefined"||!b){m="display:none";d="font-weight:bold"}if(!g||g==""){g=j}g=escape(g);var f='<ul><input type="checkbox" id="'+this.myvar+""+l+'FCB" style="vertical-align:middle" ';f+=k;f+='onclick="'+this.myvar+".toggleContents("+l+',this.checked)">';f+='&nbsp;<span title="'+a+'" id="'+this.myvar+"TB"+l+'" oncontextmenu="'+this.myvar+".saveJSON("+l+');" onclick="'+this.myvar+".toggleFolder("+l+')" style="'+d+'">';f+='<img style="vertical-align:text-top;padding:0;margin:0" height="16" border="0" src="'+i+'" /></span>&nbsp;';f+='<a href="#" onclick="'+this.myvar+".overlayman.zoomToFolder("+l+");"+this.myvar+".mb.showMess('"+g+"',3000);return false;\">"+j+'</a><br><div id="'+n+'" style="'+m+'"></div></ul>';if(h){h.innerHTML=f+h.innerHTML}return n};GeoXml.prototype.processGML=function(l,u,O,G){var B=this;var A=false;var M=[];var H;var t=false;var d=0;var v=0;var o=1;var a=1;var D,e,R;var h,r;var F,E,K,N;var f=u;var z,w,c;for(var s=0;s<l.childNodes.length;s++){var g=l.childNodes.item(s).nodeName;var I=l.childNodes.item(s);if(g=="gml:boundedBy"||g=="boundedBy"){for(var L=0;L<I.childNodes.length;L++){var Q=I.childNodes.item(L).nodeName;var p=/CRS:84|(4326|4269)$/i;if(Q=="Box"||Q=="gml:Box"){c=I.childNodes.item(L);H=I.childNodes.item(L).getAttribute("srsName");if(H.match(p)){t=true}else{alert("SRSname ="+H+"; attempting to create transform");for(K=0;K<c.childNodes.length;K++){h=c.childNodes.item(K);if(h.nodeName=="gml:coordinates"||h.nodeName=="coordinates"){r=GXml.value(h);R=r.split(" ");z=R[0].split(",");w=R[1].split(",");o=(parseFloat(w[0])-parseFloat(z[0]))/(O.xmax-O.xmin);a=(parseFloat(w[1])-parseFloat(z[1]))/(O.ymax-O.ymin);d=z[0]/o-O.xmin;v=z[1]/a-O.ymin}}}break}if(Q=="Envelope"||Q=="gml:Envelope"){c=I.childNodes.item(L);H=I.childNodes.item(L).getAttribute("srsName");if(H.match(p)){t=true}else{alert("SRSname ="+H+"; attempting to create transform");for(K=0;K<c.childNodes.length;K++){h=c.childNodes.item(K);if(h.nodeName=="gml:coordinates"||h.nodeName=="coordinates"){R=h.split(" ");var S={xmin:100000000,ymin:100000000,xmax:-100000000,ymax:-100000000};for(var J=0;J<R.length-1;J++){e=R[J].split(",");F=parseFloat(e[0]);E=parseFloat(e[1]);if(F<S.xmin){S.xmin=F}if(E<S.ymin){S.ymin=E}if(F>S.xmax){S.xmax=F}if(E>S.ymax){S.ymax=E}}o=(S.xmax-S.xmin)/(O.xmax-O.xmin);a=(S.ymax-S.ymin)/(O.ymax-O.ymin);d=S.xmin/o-O.xmin;v=S.ymin/a-O.ymin}}}}break}}if(g=="gml:featureMember"||g=="featureMember"){M.push(I)}}var q;if(!u){u=f}this.title=u;if(M.length<1){alert("No features found in "+u);this.mb.showMess("No features found in "+u,3000)}else{this.mb.showMess("Adding "+M.length+" features found in "+u);this.overlayman.folders.push([]);this.overlayman.folderhtml.push([]);this.overlayman.folderhtmlast.push(0);this.overlayman.folderBounds.push(new GLatLngBounds());var P=this.overlayman.folders.length-1;this.kml.push(new KMLObj(u,G,true,P));if(this.basesidebar){q=this.createFolder(P,u,this.basesidebar,this.gmlicon,G,null,true,true)}if(t){for(N=0;N<M.length;N++){this.handlePlacemark(M[N],P,0)}}else{var C={xs:o,ys:a,x:d,y:v};for(N=0;N<M.length;N++){this.handleGeomark(M[N],P,C,0)}}}this.progress--};PolylineEncoder=function(c,b,e,d){var a;if(!c){c=18}if(!b){b=2}if(!e){e=1e-7}if(!d){d=true}this.numLevels=c;this.zoomFactor=b;this.verySmall=e;this.veryTiny=e*e;this.forceEndpoints=d;this.zoomLevelBreaks=[];for(a=0;a<c;a++){this.zoomLevelBreaks[a]=e*Math.pow(b,c-a-1);this.zoomLevelBreaks[a]*=this.zoomLevelBreaks[a]}};PolylineEncoder.prototype.dpEncode=function(n){var l=0;var k=[];var h=[];var g,b,o,f,m,j;var e,a,d;var c;k.push([0,n.length-1]);while(k.length>0){j=k.pop();g=0;c=Math.pow(n[j[1]].lat()-n[j[0]].lat(),2)+Math.pow(n[j[1]].lng()-n[j[0]].lng(),2);for(e=j[0]+1;e<j[1];e++){o=this.distance(n[e],n[j[0]],n[j[1]],c);if(o>g){g=o;b=e;if(g>l){l=g}}}if(g>this.veryTiny){h[b]=g;k.push([j[0],b]);k.push([b,j[1]])}}a=this.createEncodings(n,h);d=this.encodeLevels(n,h,l);return{encodedPoints:a,encodedLevels:d,encodedPointsLiteral:a.replace(/\\/g,"\\\\")}};PolylineEncoder.prototype.dpEncodeToJSON=function(d,b,e,c){var a;a=this.dpEncode(d);return{color:b,weight:e,opacity:c,points:a.encodedPoints,levels:a.encodedLevels,numLevels:this.numLevels,zoomFactor:this.zoomFactor,literals:a.encodePointsLiteral}};PolylineEncoder.prototype.dpEncodeToGPolyline=function(c,a,d,b){return new GPolyline.fromEncoded(this.dpEncodeToJSON(c,a,d,b))};PolylineEncoder.prototype.dpEncodeToGPolygon=function(g,c,f,h,b,j,k,a){var e,d;d=[];for(e=0;e<g.length;e++){d.push(this.dpEncodeToJSON(g[e],c,f,h))}return new GPolygon.fromEncoded({polylines:d,color:b,opacity:j,fill:k,outline:a})};PolylineEncoder.prototype.distance=function(j,h,g,e){var i,c;var d=g.lat()-h.lat();var a=g.lng()-h.lng();if(d==0&&a==0){c=Math.pow(g.lat()-j.lat(),2)+Math.pow(g.lng()-j.lng(),2)}else{var f=j.lat()-h.lat();var b=j.lng()-h.lng();i=((f)*(d)+(b)*(a))/e;if(i<=0){c=Math.pow(f,2)+Math.pow(b,2)}if(i>=1){c=Math.pow(j.lat()-g.lat(),2)+Math.pow(j.lng()-g.lng(),2)}if(0<i&&i<1){c=Math.pow(f-i*(d),2)+Math.pow(b-i*(a),2)}}return c};PolylineEncoder.prototype.createEncodings=function(o,h){var c;var b;var g=Math.floor;var k=o.length-2;var a;var n;var l=g(o[0].lat()*100000);var m=g(o[0].lng()*100000);var e=l;var f=m;var d=this.encodeSignedNumber(l)+this.encodeSignedNumber(m);for(b=k;b>0;b--){c=k-b+1;if(h[c]!=undefined){a=g(o[c].lat()*100000);n=g(o[c].lng()*100000);l=a-e;m=n-f;e=a;f=n;d+=this.encodeSignedNumber(l)+this.encodeSignedNumber(m)}}l=g(o[k+1].lat()*100000)-e;m=g(o[k+1].lng()*100000)-f;d+=this.encodeSignedNumber(l)+this.encodeSignedNumber(m);return d};PolylineEncoder.prototype.computeLevel=function(a){var b;if(a>this.veryTiny){b=0;while(a<this.zoomLevelBreaks[b]){b++}return b}};PolylineEncoder.prototype.encodeLevels=function(d,e,b){var a;var c="";if(this.forceEndpoints){c+=this.encodeNumber(this.numLevels-1)}else{c+=this.encodeNumber(this.numLevels-this.computeLevel(b)-1)}for(a=1;a<d.length-1;a++){if(e[a]!=undefined){c+=this.encodeNumber(this.numLevels-this.computeLevel(e[a])-1)}}if(this.forceEndpoints){c+=this.encodeNumber(this.numLevels-1)}else{c+=this.encodeNumber(this.numLevels-this.computeLevel(b)-1)}return c};PolylineEncoder.prototype.encodeNumber=function(b){var a="";var c,d;while(b>=32){c=(32|(b&31))+63;a+=(String.fromCharCode(c));b>>=5}d=b+63;a+=(String.fromCharCode(d));return a};PolylineEncoder.prototype.encodeSignedNumber=function(a){var b=a<<1;if(a<0){b=~(b)}return(this.encodeNumber(b))};PolylineEncoder.latLng=function(b,a){this.y=b;this.x=a};PolylineEncoder.latLng.prototype.lat=function(){return this.y};PolylineEncoder.latLng.prototype.lng=function(){return this.x};PolylineEncoder.pointsToLatLngs=function(b){var a,c;c=[];for(a=0;a<b.length;a++){c.push(new PolylineEncoder.latLng(b[a][0],b[a][1]))}return c};PolylineEncoder.pointsToGLatLngs=function(c){var b,a;a=[];for(b=0;b<c.length;b++){a.push(new GLatLng(c[b][0],c[b][1]))}return a};GPolyline.prototype.getPoint=function(){return(this.getVertex(Math.round(this.getVertexCount()/2)))};GPolyline.prototype.computeBounds=function(){var c=new GLatLngBounds();for(var b=0;b<this.getVertexCount();b++){var a=this.getVertex(b);if(a){c.extend(a)}}this.bounds=c;return c};GTileLayerOverlay.prototype.getBounds=function(){return this.bounds};GPolyline.prototype.getBounds=function(){if(typeof this.bounds!="undefined"){return this.bounds}else{return(this.computeBounds())}};GTileLayer.prototype.getBounds=function(){return this.bounds};GPolygon.prototype.getPoint=function(){return(this.getBounds().getCenter())};Clusterer=function(b,a){this.myvar=a.myvar;this.paren=a;this.map=b;this.markers=[];this.byid=[];this.byname=[];this.clusters=[];this.timeout=null;this.folders=[];this.folderBounds=[];this.folderhtml=[];this.folderhtmlast=[];this.subfolders=[];this.currentZoomLevel=b.getZoom();this.isParsed=false;this.maxVisibleMarkers=Clusterer.defaultMaxVisibleMarkers;this.gridSize=Clusterer.defaultGridSize;this.minMarkersPerCluster=Clusterer.defaultMinMarkersPerCluster;this.maxLinesPerInfoBox=Clusterer.defaultMaxLinesPerInfoBox;this.icon=Clusterer.defaultIcon;GEvent.addListener(b,"zoomend",Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(b,"moveend",Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(b,"infowindowclose",Clusterer.MakeCaller(Clusterer.PopDown,this))};Clusterer.defaultMaxVisibleMarkers=650;Clusterer.defaultGridSize=15;Clusterer.defaultMinMarkersPerCluster=5;Clusterer.defaultMaxLinesPerInfoBox=15;Clusterer.defaultIcon=new GIcon();Clusterer.defaultIcon.image="http://www.acme.com/resources/images/markers/blue_large.PNG";Clusterer.defaultIcon.shadow="http://www.acme.com/resources/images/markers/shadow_large.PNG";Clusterer.defaultIcon.iconSize=new GSize(30,51);Clusterer.defaultIcon.shadowSize=new GSize(56,51);Clusterer.defaultIcon.iconAnchor=new GPoint(13,34);Clusterer.defaultIcon.infoWindowAnchor=new GPoint(13,3);Clusterer.defaultIcon.infoShadowAnchor=new GPoint(27,37);Clusterer.prototype.SetIcon=function(a){this.icon=a};Clusterer.prototype.SetMaxVisibleMarkers=function(a){this.maxVisibleMarkers=a};Clusterer.prototype.SetMinMarkersPerCluster=function(a){this.minMarkersPerCluster=a};Clusterer.prototype.SetMaxLinesPerInfoBox=function(a){this.maxLinesPerInfoBox=a};Clusterer.prototype.AddMarker=function(f,h,i,a,e,j){if(f.setMap!=null){f.setMap(this.map)}f.hidden=false;if(e!=true){f.hidden=true}if(this.paren.hideall){f.hidden=true}f.title=h;this.folders[i].push(this.markers.length);var c=this.map.getBounds();var d=false;if(typeof f.getBounds=="undefined"){if(c.contains(f.getPoint())){d=true}}else{var g=f.getBounds();if(!g.isEmpty()){if(c.intersects(g)){d=true}}}if(j){d=true}this.markers.push(f);if(d){f.onMap=true;this.map.addOverlay(f);if(f.hidden){f.hide();if(!!f.label){f.label.hide()}}}this.DisplayLater();if(a){this.folderhtml[i].push(a)}};Clusterer.prototype.zoomToFolder=function(a){var b=this.folderBounds[a];this.map.setZoom(this.map.getBoundsZoomLevel(b));this.map.panTo(b.getCenter())};Clusterer.prototype.RemoveMarker=function(b){for(var e=0;e<this.markers.length;++e){if(this.markers[e]==b){if(b.onMap){this.map.removeOverlay(b)}for(var d=0;d<this.clusters.length;++d){var a=this.clusters[d];if(a!=null){for(var c=0;c<a.markers.length;++c){if(a.markers[c]==b){a.markers[c]=null;--a.markerCount;break}}if(a.markerCount==0){this.ClearCluster(a);this.clusters[d]=null}else{if(a==this.poppedUpCluster){Clusterer.RePop(this)}}}}this.markers[e]=null;break}}this.DisplayLater()};Clusterer.prototype.DisplayLater=function(){if(this.timeout!=null){clearTimeout(this.timeout)}this.timeout=setTimeout(Clusterer.MakeCaller(Clusterer.Display,this),50)};Clusterer.Display=function(D){var O,N,M,P,z,K;clearTimeout(D.timeout);var r=false;var J=0;var H,a;var L;var n;if(D.paren.basesidebar){for(M=0;M<D.folderhtml.length;M++){var o=D.folderhtml[M].length;var h=D.folderhtmlast[M];if(h<o){var u=D.paren.myvar+"_folder"+M;var A=$(u);if(A){if(D.paren.opts.sortbyname){n=A.innerHTML;H=D.folderhtml[M].sort();for(K=0;K<o;K++){a=H[K].split("$$$",7);n+=D.paren.sidebarfn(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}}else{n=A.innerHTML;H=D.folderhtml[M];for(K=h;K<o;K++){a=H[K].split("$$$",7);n+=D.paren.sidebarfn(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}}D.folderhtmlast[M]=o;A.innerHTML=n;if(D.paren.forcefoldersopen){A.style.display="block"}r=true;J=o}else{alert("target folder not found "+u)}}}}if(r&&J>0){if(D.paren.progress==0){D.paren.setFolders();GEvent.trigger(D.paren,"parsed");if(!D.paren.opts.sidebarid){D.paren.mb.showMess("Finished Parsing",1000)}var e=new Date();var G=((e-D.miStart)/1000+" seconds");D.paren.mb.showMess("Loaded "+J+"  GeoXML elements in "+G,5000);D.paren.ParseURL();if(!D.paren.opts.nozoom){D.paren.map.setZoom(D.paren.map.getBoundsZoomLevel(D.paren.bounds));D.paren.map.setCenter(D.paren.bounds.getCenter())}}}if(r&&typeof resizeKML!="undefined"){resizeKML()}var E,m,c,g,f;var y=D.map.getZoom();if(y!=D.currentZoomLevel){for(O=0;O<D.clusters.length;++O){if(D.clusters[O]!=null){D.ClearCluster(D.clusters[O]);D.clusters[O]=null}}D.clusters.length=0;D.currentZoomLevel=y}E=D.map.getBounds();m=E.getSouthWest();c=E.getNorthEast();g=c.lng()-m.lng();f=c.lat()-m.lat();if(g<300&&f<150){g*=0.05;f*=0.05;E=new GLatLngBounds(new GLatLng(m.lat()-f,m.lng()-g),new GLatLng(c.lat()+f,c.lng()+g))}var C=[];var q=[];var F=0;for(O=0;O<D.markers.length;++O){P=D.markers[O];L=false;if(P!=null){var d=D.paren.myvar+"sb"+O;if(typeof P.getBounds=="undefined"){if(E.contains(P.getPoint())){L=true;if($(d)){$(d).className="inView"}F++}else{if($(d)){$(d).className="outView"}}}else{var Q=P.getBounds();if($(d)){if(E.intersects(Q)){$(d).className="inView"}else{$(d).className="outView"}}L=true}if(L){C.push(O)}else{q.push(O)}}}for(O=0;O<q.length;++O){P=D.markers[q[O]];if(P.onMap){D.map.removeOverlay(P);P.onMap=false}}for(O=0;O<D.clusters.length;++O){z=D.clusters[O];if(z!=null&&z.marker){L=false;if(typeof z.marker.getBounds=="undefined"){if(E.contains(z.marker.getPoint())){L=true}}else{L=true}if(!L&&z.onMap){D.map.removeOverlay(z.marker);z.onMap=false}}}if(F>D.maxVisibleMarkers){if(!r){D.paren.mb.showMess("Clustering on "+F+"  GeoXML elements")}var x=E.getNorthEast().lat()-E.getSouthWest().lat();var t=x/D.gridSize;var w=t/Math.cos((E.getNorthEast().lat()+E.getSouthWest().lat())/2*Math.PI/180);for(var B=E.getSouthWest().lat();B<=E.getNorthEast().lat();B+=t){for(var v=E.getSouthWest().lng();v<=E.getNorthEast().lng();v+=w){z={};z.clusterer=D;z.bounds=new GLatLngBounds(new GLatLng(B,v),new GLatLng(B+t,v+w));z.markers=[];z.markerCount=0;z.onMap=false;z.marker=null;D.clusters.push(z)}}for(O=0;O<C.length;++O){P=D.markers[C[O]];if(P!=null&&!P.inCluster){for(N=0;N<D.clusters.length;++N){z=D.clusters[N];if(z!=null){L=false;if(typeof P.getBounds=="undefined"){if(z.bounds.contains(P.getPoint())){L=true}}if(L){P.inCluster=true;D.clusters[N].markers.push(P);++D.clusters[N].markerCount}}}}}for(O=0;O<D.clusters.length;++O){if(D.clusters[O]!=null&&D.clusters[O].markerCount<D.minMarkersPerCluster){D.ClearCluster(D.clusters[O]);D.clusters[O]=null}}for(O=D.clusters.length-1;O>=0;--O){if(D.clusters[O]!=null){break}else{--D.clusters.length}}for(O=0;O<D.clusters.length;++O){z=D.clusters[O];if(z!=null){for(N=0;N<z.markers.length;++N){P=z.markers[N];if(P!=null&&P.onMap){D.map.removeOverlay(P);P.onMap=false}}}}for(O=0;O<D.clusters.length;++O){z=D.clusters[O];if(z!=null&&z.marker==null){var p=0;var I=0;for(N=0;N<z.markers.length;++N){P=z.markers[N];if(P!=null){p+=(+P.getPoint().lng());I+=(+P.getPoint().lat())}}var s=new GLatLng(I/z.markerCount,p/z.markerCount);P=new GMarker(s,{icon:D.icon});z.marker=P;GEvent.addListener(P,"click",Clusterer.MakeCaller(Clusterer.PopUp,z))}}}for(O=0;O<C.length;++O){P=D.markers[C[O]];if(P!=null&&!P.onMap&&!P.inCluster){if(P.addedToMap!=null){P.addedToMap()}if(P.hidden){if(P.hide){D.map.addOverlay(P);P.hide();if(!!P.label){P.label.hide()}}}else{D.map.addOverlay(P)}P.onMap=true}}for(O=0;O<D.clusters.length;++O){z=D.clusters[O];if(z!=null&&z.marker){L=false;if(typeof P.getPoint!="undefined"){if(E.contains(z.marker.getPoint())){L=true}}else{if(E.intersects(z.marker.getBounds())){L=true}}if(!z.onMap&&L){D.map.addOverlay(z.marker);z.onMap=true}}}Clusterer.RePop(D)};Clusterer.PopUp=function(a){var c=a.clusterer;var e='<table width="300">';var f=0;for(var d=0;d<a.markers.length;++d){var b=a.markers[d];if(b!=null){++f;e+="<tr><td>";if(typeof b.getIcon!="undefined"&&b.getIcon().smallImage!=null){e+='<img src="'+b.getIcon().smallImage+'">'}else{e+='<img src="'+b.getIcon().image+'" width="'+(b.getIcon().iconSize.width/2)+'" height="'+(b.getIcon().iconSize.height/2)+'">'}e+="</td><td>"+b.title+"</td></tr>";if(f==c.maxLinesPerInfoBox-1&&a.markerCount>c.maxLinesPerInfoBox){e+='<tr><td colspan="2">...and '+(a.markerCount-f)+" more</td></tr>";break}}}e+="</table>";c.map.closeInfoWindow();a.marker.openInfoWindowHtml(e);c.poppedUpCluster=a};Clusterer.RePop=function(a){if(a.poppedUpCluster!=null){Clusterer.PopUp(a.poppedUpCluster)}};Clusterer.PopDown=function(a){a.poppedUpCluster=null};Clusterer.prototype.ClearCluster=function(a){var c,b;for(c=0;c<a.markers.length;++c){if(a.markers[c]!=null){a.markers[c].inCluster=false;a.markers[c]=null}}a.markers.length=0;a.markerCount=0;if(a==this.poppedUpCluster){this.map.closeInfoWindow()}if(a.onMap){this.map.removeOverlay(a.marker);a.onMap=false}};Clusterer.MakeCaller=function(b,a){return function(){b(a)}};GMarker.prototype.setMap=function(a){this.map=a};GMarker.prototype.addedToMap=function(){this.map=null};GMarker.prototype.origOpenInfoWindow=GMarker.prototype.openInfoWindow;GMarker.prototype.openInfoWindow=function(b,a){if(this.map!=null){return this.map.openInfoWindow(this.getPoint(),b,a)}else{return this.origOpenInfoWindow(b,a)}};GMarker.prototype.origOpenInfoWindowHtml=GMarker.prototype.openInfoWindowHtml;GMarker.prototype.openInfoWindowHtml=function(a,b){if(this.map!=null){return this.map.openInfoWindowHtml(this.getPoint(),a,b)}else{return this.origOpenInfoWindowHtml(a,b)}};GMarker.prototype.origOpenInfoWindowTabs=GMarker.prototype.openInfoWindowTabs;GMarker.prototype.openInfoWindowTabs=function(b,a){if(this.map!=null){return this.map.openInfoWindowTabs(this.getPoint(),b,a)}else{return this.origOpenInfoWindowTabs(b,a)}};GMarker.prototype.origOpenInfoWindowTabsHtml=GMarker.prototype.openInfoWindowTabsHtml;GMarker.prototype.openInfoWindowTabsHtml=function(a,b){if(this.map!=null){return this.map.openInfoWindowTabsHtml(this.getPoint(),a,b)}else{return this.origOpenInfoWindowTabsHtml(a,b)}};GMarker.prototype.origShowMapBlowup=GMarker.prototype.showMapBlowup;GMarker.prototype.showMapBlowup=function(a){if(this.map!=null){return this.map.showMapBlowup(this.getPoint(),a)}else{return this.origShowMapBlowup(a)}};MessageBox=function(c,a,b,d){this.map=c;this.paren=a;this.myvar=a.myvar+"."+b;this.eraseMess=null;this.centerMe=null;this.mb=null;if(d){this.mb=d}this.id=this.myvar+"_message"};MessageBox.prototype.hideMess=function(){this.mb.style.visiblity="hidden";this.mb.style.left="-1200px";this.mb.style.top="-1200px"};MessageBox.prototype.centerThis=function(){var b=this.map.getObjCenter();if(!this.mb){this.mb=$(this.id)}if(this.centerMe){clearTimeout(this.centerMe)}if(this.mb){var a=this.mb.clientWidth;if(a>this.map.getSize().width){a=parseInt(2*this.map.getSize().width/3,10);this.mb.style.width=a+"px";this.centerMe=setTimeout(this.myvar+".centerThis()",5);return}this.mb.style.left=(b.x-(a/2))+"px";this.mb.style.top=(b.y-20-(this.mb.clientHeight/2))+"px"}else{this.centerMe=setTimeout(this.myvar+".centerThis()",10)}};MessageBox.prototype.showMess=function(c,a){c=unescape(c);if(this.eraseMess){clearTimeout(this.eraseMess)}if(!this.mb){this.mb=$(this.id)}if(this.mb){this.mb.innerHTML="<span>"+c+"</span>";if(a){this.eraseMess=setTimeout(this.myvar+".hideMess();",a)}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 b=document.createElement("div");b.innerHTML=c;b.id=this.myvar+"_message";b.style.position="absolute";b.style.backgroundColor=this.style.backgroundColor||"silver";b.style.opacity=this.style.opacity||0.8;b.style.filter="alpha(opacity="+parseInt(b.style.opacity*100,10)+")";b.style.color=this.style.color||"black";b.style.padding=this.style.padding||"6px";b.style.borderWidth=this.style.borderWidth||"3px";b.style.borderColor=this.style.borderColor||"";b.style.backgroundImage=this.style.backgroundImage||"";b.style.borderStyle=this.style.borderStyle||"outset";b.style.visibility="visible";b.style.left="-1200px";b.style.top="-1200px";this.centerMe=setTimeout(this.myvar+".centerThis()",5);b.style.zIndex=1000;document.body.appendChild(b)}};GMap2.prototype.getObjCenter=function(){var c=this.getContainer();var b=c;var d=0;var a=0;if(c.offsetParent){a=c.offsetLeft;d=c.offsetTop;c=c.offsetParent;while(c){a+=c.offsetLeft;d+=c.offsetTop;c=c.offsetParent}return new GPoint(a+parseInt(this.getSize().width,10)/2,d+parseInt(this.getSize().height,10)/2)}};GeoXml.prototype.loadJSONUrl=function(b,f,c,e,a){var d=this;GDownloadUrl(b,function(g){d.parseJSON(g,f,c,e,a)})};GeoXml.prototype.loadXMLUrl=function(b,f,c,e,a){var d=this;d.DownloadURL(b,function(g){d.processing(GXml.parse(g),f,c,e,a)},f)};GeoXml.prototype.upgradeLayer=function(d){var a=this.map.getMapTypes();var c=false;for(var b=0;b<a.length;b++){if(a[b]==this.baseLayers[d]){c=true;this.map.removeMapType(this.baseLayers[d])}}if(!c){this.map.addMapType(this.baseLayers[d])}};GeoXml.prototype.makeWMSTileLayer=function(j,y,x,N,k,l,f){var D=this;j=j.replace("&amp;","&");var I=j.split("?");var n=I[0]+"?";var O="1.1.0";var u="image/png";var w="";var G="";var r=false;var M=1;if(typeof N!="undefined"){M=N}var o="-180,-90,180,90";var v=I[1].split("&");var m="";var a="";var t="";var B="";var K;for(var L=0;L<v.length;L++){var C=v[L];var c=v[L].split("=");var h=c[0].toLowerCase();switch(h){case"version":O=c[1];break;case"bbox":o=c[1];break;case"width":case"height":break;case"service":break;case"servicename":a=c[1];break;case"atlasname":t=c[1];break;case"styles":w=c[1];break;case"layers":G=c[1];break;case"format":u=c[1];break;case"opacity":M=parseFloat(c[1]);break;case"crs":case"srs":K=c[1];break;case"gmcrs":B=c[1];break;case"queryable":r=c[1];break;default:if(c[0]){n+="&"+v[L]}break}}if(B){K=B}var s=o.split(",");var P={w:parseFloat(s[0]),s:parseFloat(s[1]),e:parseFloat(s[2]),n:parseFloat(s[3])};var e=(P.n-P.s);var E=0;var H=180;while(H>=e){H=H/2;E++}E--;if(E<1){E=1}if(!k){k="Base Map from OGC WMS"}var J=new GCopyright(1,new GLatLngBounds(new GLatLng(P.s,P.w),new GLatLng(P.n,P.e)),0,k);var F=new GCopyrightCollection("");F.addCopyright(J);var b=new GTileLayer(F,E,19);b.s=P.s;b.n=P.n;b.e=P.e;b.w=P.w;b.myBaseURL=n;if(a){b.servicename=a}if(t){b.atlasname=t}b.publishdirectory=this.publishdirectory;b.epsg=K;b.getTileUrl=function(am,al,ai){if(typeof(this.myStyles)=="undefined"){this.myStyles=""}var T=new GPoint(am.x*256,(am.y+1)*256);var V=new GPoint((am.x+1)*256,am.y*256);var i=G_NORMAL_MAP.getProjection().fromPixelToLatLng(T,al,ai);var ah=G_NORMAL_MAP.getProjection().fromPixelToLatLng(V,al,ai);var S=i.x;var W=ah.x;var af=i.y;var Z=ah.y;var ak=W;var aa=S;var ac=Z;var ae=af;if(ae<ac){ac=ae;ae=Z}if(this.epsg!="EPSG:4326"&&this.epsg!="CRS:84"&&this.epsg!="4326"){S=GeoXml.merc2Lon(S);af=GeoXml.merc2Lat(af);W=GeoXml.merc2Lon(W);Z=GeoXml.merc2Lat(Z)}var Y=Math.abs(W-S);var ag=Math.abs(af-Z);var ab=ag/Y;ag=Math.round((256*ab)+0.5);Y=256;var U=Z;if(af<Z){Z=af;af=U}if(ac>(this.n)||ak<(this.w)||ae<(this.s)||aa>(this.e)){var R=this.publishdirectory+"black.gif"}var aj=S+","+Z+","+W+","+af;var z="EPSG:41001";if(typeof this.epsg!="undefined"||this.srs=="4326"){z=this.epsg}var X=this.myBaseURL;if(typeof this.myVersion=="undefined"){this.myVersion="1.1.1"}var Q=parseFloat(this.myVersion);var ad=/arcimsproxy/i;if(!this.myBaseURL.match(ad)){X+="&SERVICE=WMS";if(this.myVersion!="1.0.0"){X+="&REQUEST=GetMap"}else{X+="&REQUEST=Map"}}if(this.servicename){X+="?ServiceName="+this.servicename}if(this.atlasname){X+="&AtlasName="+this.servicename}X+="&VERSION="+this.myVersion;if(this.myLayers){X+="&LAYERS="+this.myLayers;X+="&STYLES="+this.myStyles}if(this.mySLD){X+="&SLD="+this.mySLD}X+="&FORMAT="+this.myFormat;X+="&BGCOLOR=0x000000";X+="&TRANSPARENT=TRUE";if(this.myVersion=="1.1.1"||Q<1.3){X+="&SRS="+z}else{X+="&CRS="+z}X+="&WIDTH="+Y;X+="&HEIGHT="+ag;X+="&BBOX="+aj;this.requestCount++;return X};b.myFormat=u;b.myVersion=O;b.myExtents=o;b.queryable=r;b.opacity=M;b.getOpacity=function(){return this.opacity};if(m){b.mySLD=m}else{b.myLayers=G;b.myStyles=w}var A=new GTileLayerOverlay(b);A.bounds=new GLatLngBounds();A.bounds.extend(new GLatLng(P.n,P.e));A.bounds.extend(new GLatLng(P.s,P.w));this.wmscount++;if(this.opts.doMapTypes){var q=new GTileLayer(F,E,19);q.s=P.s;q.n=P.n;q.e=P.e;q.w=P.w;q.myBaseURL=n;q.servicename=a;q.publishdirectory=this.publishdirectory;q.getTileUrl=b.getTileUrl;q.myFormat=b.myFormat;q.myVersion=O;q.opacity=1;q.title=x;if(k){q.attribution=k}q.getOpacity=function(){return this.opacity};if(m){q.mySLD=m}else{q.myLayers=G;q.myStyles=w}q.epsg=K;var p=new GTileLayer(F,E,19);p.s=P.s;p.n=P.n;p.e=P.e;p.w=P.w;p.dir=this.publishdirectory;p.getTileUrl=function(){return(this.dir+"black.gif")};p.opacity=1;p.title=x;if(k){p.attribution=k}p.getOpacity=function(){return this.opacity};var d=[q,G_HYBRID_MAP.getTileLayers()[1]];var g=new GMapType(d,G_HYBRID_MAP.getProjection(),""+x+"",G_HYBRID_MAP);g.bounds=new GLatLngBounds(new GLatLng(P.s,P.w),new GLatLng(P.n,P.e));if(l){g.grouptitle=l}D.baseLayers.push(g);D.map.addMapType(g);return null}else{return A}};GeoXml.SEMI_MAJOR_AXIS=6378137;GeoXml.ECCENTRICITY=0.08181919131087181;GeoXml.DEG2RAD=180/(Math.PI);GeoXml.merc2Lon=function(a){return(a*GeoXml.DEG2RAD)*GeoXml.SEMI_MAJOR_AXIS};GeoXml.merc2Lat=function(c){var b=c*GeoXml.DEG2RAD;var a=Math.sin(b);return(GeoXml.SEMI_MAJOR_AXIS*Math.log(Math.tan((b+Math.PI/2)/2)*Math.pow(((1-GeoXml.ECCENTRICITY*a)/(1+GeoXml.ECCENTRICITY*a)),(GeoXml.ECCENTRICITY/2))))};GeoXml.prototype.toggleLabels=function(a){if(!a){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(!top.standalone&&this.proxy){cmlurl=this.proxy+"url="+escape(cmlurl)}if(top.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=="<?xml"&&sresp.indexOf("kml")!=-1){that.mb.showMess(title+" response received",2000);callback(resp.responseText)}else{that.mb.showMess("File does not appear to be a valid GeoData"+resp,6000)}}}}break;case 3:that.mb.showMess("Receiving "+title+"...");break;case 2:that.mb.showMess("Waiting for "+title,2000);break;case 1:that.mb.showMess("Sent request for "+title,2000);break}};try{cmlreq.send(null)}catch(err){if(cmlurl.substring(2,3)==":"&&!useLegacyLocalLoad){useLegacyLocalLoad=true;this.DownloadURL(cmlurl)}}};
