var API_GOOGLE=0;var API_OPENLAYERS=1;var API=API_GOOGLE;var map;var ab;var layerList;var kmlOverlayControl;var bb=new Array();cb=function(A){eb="";for(var B in A){eb+=A[B]+" "}return eb};function ToggleButton(A,B){A.ticked=false;A.src="images/cs_off.gif";A.addEvent("click",function(C){A.setState(!A.ticked);if(B){B(A)}});A.setState=this.setState}ToggleButton.prototype.setState=function(A){this.ticked=A;if(this.ticked){this.src="images/cs_on.gif"}else{this.src="images/cs_off.gif"}};var RadioImageControl=new Class({Implements:Options,options:{on_images:[],off_images:[],imageElements:[],activeButton:0,onClick:null},initialize:function(C,A){this.setOptions(A);this.element=C;for(var B=0;B<this.options.on_images.length;B++){var D;if(B==this.options.activeButton){D=new Element("img",{src:this.options.on_images[B],index:B,style:"vertical-align:bottom"}).inject(this.element)}else{D=new Element("img",{src:this.options.off_images[B],index:B,style:"vertical-align:bottom"}).inject(this.element)}D.addEvent("click",this.clickHandler.bindWithEvent(this,B));this.options.imageElements[B]=D}},ib:function(){return this.options.activeButton},clickHandler:function(B,A){if(A!=this.options.activeButton){this.options.imageElements[this.options.activeButton].src=this.options.off_images[this.options.activeButton];this.options.imageElements[A].src=this.options.on_images[A];this.options.activeButton=A;if(this.options.onClick){this.options.onClick.call(this,B,A)}}}});function KMLOverlayControl(){this.mygmap=null;this.geokmloverlayurl=null;this.geokmloverlay=null;this.inputBox=null}KMLOverlayControl.prototype=new GControl();KMLOverlayControl.prototype.initialize=function(E){this.mygmap=E;var C=document.createElement("div");var D=document.createElement("div");this.setButtonStyle(D,"KML");C.appendChild(D);var F=document.createElement("div");F.style.display="none";F.style.position="absolute";F.style.width="240px";F.style.padding="4px";F.style.color="#000000";F.style.backgroundColor="#ffffff";F.style.font="13px Arial";F.style.borderWidth="1px 2px 2px 1px";F.style.borderColor="gray black black black";F.style.borderStyle="solid ridge ridge solid";C.appendChild(F);F.innerHTML="Enter the URL of a KML file here and click on the add button.<br />";this.inputBox=document.createElement("input");this.inputBox.type="text";this.inputBox.style.width="232px";F.appendChild(this.inputBox);var A=document.createElement("div");this.setButtonStyle(A,"Add");F.appendChild(A);GEvent.addDomListener(D,"mouseover",function(){F.style.display="block";var H=0,I=0;var G=C;while(G){H+=G.offsetLeft;I+=G.offsetTop;G=G.offsetParent}var J=H+F.offsetWidth;var K=I+F.offsetHeight+D.offsetHeight;var L=GEvent.addDomListener(document,"mousemove",function(N){if(!N){N=window.event}var M=N.clientX;var O=N.clientY;if((M<H)||(M>J)||(O<I)||(O>K)){F.style.display="none";GEvent.removeListener(L)}})});var B=this;GEvent.addDomListener(A,"click",function(){B.setKML(B.inputBox.value)});GEvent.addDomListener(this.inputBox,"change",function(){B.setKML(B.inputBox.value)});E.getContainer().appendChild(C);return C};KMLOverlayControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(216,7))};KMLOverlayControl.prototype.setButtonStyle=function(B,C){B.style.color="#000000";B.style.backgroundColor="#ffffff";B.style.font="13px Arial";B.style.border="1px solid black";B.style.padding="2px";B.style.marginBottom="3px";B.style.padding="0px";B.style.margin="0px";B.style.textAlign="center";B.style.width="65px";B.style.cursor="pointer";var A=document.createElement("div");A.style.color="#000000";A.style.backgroundColor="#ffffff";A.style.borderTop="none";A.style.borderLeft="1px solid white";A.style.borderRight="1px solid #b0b0b0";A.style.borderBottom="1px solid #b0b0b0";A.style.margin="0px";A.style.padding="0px";B.appendChild(A);A.appendChild(document.createTextNode(C))};KMLOverlayControl.prototype.setKML=function(A){if(this.geokmloverlay!=null){this.mygmap.removeOverlay(this.geokmloverlay)}if((A!=null)&&(A.length>0)){if(A.indexOf("http:\x2F\x2F")!=0){A="http:\x2F\x2F"+A}}this.geokmloverlayurl=A;this.geokmloverlay=new GGeoXml(A);this.inputBox.value=A;this.mygmap.addOverlay(this.geokmloverlay)};KMLOverlayControl.prototype.getKML=function(){return this.geokmloverlayurl};KMLOverlayControl.prototype.refresh=function(){if((this.geokmloverlayurl!=null)&&(this.geokmloverlayurl.length>0)){this.setKML(this.geokmloverlayurl)}};function ThumbnailList(F,G,A,B){this.parentDiv=F;this.upButton=G;this.downButton=A;this.divider=B;this.hasDivider=false;var E=$$("#sortablemapskml li.sortme");var C=E.length;E=E.concat($$("#sortablemapstiles li.sortme"));var D=E.length;this.hasDivider=((C>0)&&(D>C));this.fullListLength=E.length;this.sublistLength=0;this.thumbHeight=0;if(this.fullListLength>1){this.thumbHeight=E[1].offsetTop-E[0].offsetTop}else{if(this.fullListLength>0){this.thumbHeight=E[0].offsetHeight}}this.divHeight=0;this.listTop=0;this.upButton.addEvent("click",function(){F.scrollup()});this.downButton.addEvent("click",function(){F.scrolldown()});this.upButton.addEvent("mouseout",function(){this.setStyle("border-color",this.getStyle("background-color"))});this.upButton.addEvent("mouseover",function(){this.setStyle("border-color",this.getStyle("color"))});this.downButton.addEvent("mouseout",function(){this.setStyle("border-color",this.getStyle("background-color"))});this.downButton.addEvent("mouseover",function(){this.setStyle("border-color",this.getStyle("color"))});if(this.divider){if(this.hasDivider){this.divider.setStyle("display","block")}else{this.divider.setStyle("display","none")}}this.resize();$extend(F,this);window.addEvent("resize",function(){F.resize()})}ThumbnailList.prototype.resize=function(){var A=$$("#sortablemapskml li.sortme");A=A.concat($$("#sortablemapstiles li.sortme"));this.fullListLength=A.length;if(this.fullListLength>0){var B=this.parentDiv.offsetHeight;var C=0;if(this.hasDivider){C+=this.divider.offsetHeight}C+=this.upButton.offsetHeight;C+=this.downButton.offsetHeight;this.sublistLength=Math.floor((B-C)/this.thumbHeight);if(this.sublistLength<this.fullListLength){if(B-this.sublistLength*this.thumbHeight<C){--this.sublistLength}}this.refreshList()}};ThumbnailList.prototype.refreshList=function(){var C=$$("#sortablemapskml li.sortme");var A=C.length;C=C.concat($$("#sortablemapstiles li.sortme"));this.fullListLength=C.length;if(this.sublistLength<=this.fullListLength){this.upButton.style.display="block";this.downButton.style.display="block";if(this.listTop>0){this.upButton.style.visibility="visible"}else{this.upButton.style.visibility="hidden"}if(this.listTop+this.sublistLength<this.fullListLength){this.downButton.style.visibility="visible"}else{this.downButton.style.visibility="hidden"}}else{this.upButton.style.display="none";this.downButton.style.display="none";this.listTop=0}if((this.hasDivider)&&((this.listTop+this.sublistLength)>=A)&&(this.listTop<=A)){this.divider.style.display="block"}else{this.divider.style.display="none"}for(var B=0;B<this.fullListLength;B++){if((B>=this.listTop)&&(B<this.listTop+this.sublistLength)){if(window.ie){C[B].setStyle("display","block")}else{C[B].setStyle("visibility","visible");C[B].setStyle("height",this.thumbHeight+"px")}}else{if(window.ie){C[B].setStyle("display","none")}else{C[B].setStyle("visibility","hidden");C[B].setStyle("height","0px")}}}};ThumbnailList.prototype.scrollup=function(){if(this.listTop>0){--this.listTop;this.refreshList()}};ThumbnailList.prototype.scrolldown=function(){if(this.listTop<this.fullListLength-this.sublistLength){++this.listTop;this.refreshList()}};function resizeMapDiv(){var A=document.getElementById("map");var C=document.getElementById("thumbnails");var B=window.getHeight();var D=window.getWidth();if(B>=0){if(A.offsetTop){B-=A.offsetTop}A.style.height=B+"px";C.style.height=B+"px"}if(D>=0){A.style.width=(D-C.offsetWidth)+"px"}}function gc(){var G=new Object();var A=location.search.substring(1);var B=A.split("&");for(var E=0;E<B.length;E++){var D=B[E].indexOf("=");if(D<0){continue}var C=B[E].substring(0,D);var F=B[E].substring(D+1);G[C]=F}return G}function mc(F){var K="";var M=0;var B=6;var H="51.5265,-0.13102";var A=0;var G=0;switch(API){case API_GOOGLE:var O=map.getMapTypes();var C=map.getCurrentMapType();for(var R=0;R<O.length;R++){if(O[R]==C){M=R;break}}B=map.getZoom();H=map.getCenter().toUrlValue();A=layerList.getNumLayers();break;case API_OPENLAYERS:M=map.getLayerIndex(map.baseLayer);if(M<=3){M=3-M}B=map.getZoom();var I=map.getCenter();I.transform(map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));H=I.lat.toFixed(6)+","+I.lon.toFixed(6);A=OLUtils.getNumLayers(map);G=OLUtils.getFirstDataLayerIndex(map);break}if(F){if(F.maptype){M=parseInt(F.maptype)}if(F.zoom){M=parseInt(F.zoom)}if(F.lat){var P=H.split(H,",");H=F.lat+","+P[1]}if(F.lon){var P=H.split(H,",");H=P[0]+","+F.lon}}K+=M+","+B+","+H;for(var R=0;R<A;R++){var D=0;switch(API){case API_GOOGLE:D=layerList.getUserData(R);break;case API_OPENLAYERS:D=map.layers[A-R-1+G].mapid;if(typeof D=="undefined"){continue}break}var E=0,N=0,L=0,Q=0;var J=$("csWindow"+D);if(J!=null){switch(API){case API_GOOGLE:E=layerList.getOpacity(R);break;case API_OPENLAYERS:E=map.layers[A-R-1+G].opacity;break}N=parseInt(J.getStyle("left"))/window.getWidth();L=parseInt(J.getStyle("top"))/window.getHeight();Q=(J.getStyle("visibility")=="visible")?1:0}K+=","+D+","+E+","+Q+","+N.toFixed(3)+","+L.toFixed(3)}return xc(K)}function documentStateFromURI(){var D=gc();var K=D.s;var E=D.k;bb.kml=E;if(K==null){switch(API){case API_GOOGLE:if(layerList.getNumLayers()>0){bb.map={maptype:0,zoom:layerList.getInitialZoom(),latlng:layerList.getAllLayersCentre()};bb.defaultview=true}else{bb.map={maptype:0,zoom:6,latlng:new GLatLng(51.52650545529106,-0.13102327732138574)}}break;case API_OPENLAYERS:if(OLUtils.getNumLayers(map)>0){J=OLUtils.getAllLayersCentre(map);if(J){J.transform(map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"))}bb.map={maptype:0,zoom:OLUtils.getInitialZoom(map),latlng:J};bb.defaultview=true}else{bb.map={maptype:0,zoom:6,latlng:new OpenLayers.LonLat(-0.13102327732138574,51.52650545529106)}}break}return }var G=ad(K);var H=G.split(",");if(H.length<4){return }var M=parseInt(H[0]);var B=parseInt(H[1]);var L=parseFloat(H[2]);var S=parseFloat(H[3]);var J=null;if((L<=-90)||(L>=90)||(S<=-180)||(S>=180)||(B<0)){switch(API){case API_GOOGLE:J=layerList.getAllLayersCentre();B=layerList.getInitialZoom();break;case API_OPENLAYERS:J=OLUtils.getAllLayersCentre(map);J.transform(map.getProjectionObject(),new OpenLayers.Projection("EPSG:4326"));B=OLUtils.getInitialZoom(map);break}bb.defaultview=true}else{switch(API){case API_GOOGLE:J=new GLatLng(L,S);break;case API_OPENLAYERS:J=new OpenLayers.LonLat(S,L);break}}bb.map={maptype:M,zoom:B,latlng:J};var A=Math.floor((H.length-4)/5);var I=0;switch(API){case API_GOOGLE:I=layerList.getNumLayers();break;case API_OPENLAYERS:I=OLUtils.getNumLayers(map);break}if(A>I){A=I}var R=4;for(var Q=0;Q<A;Q++){var C=parseInt(H[R++]);var F=parseFloat(H[R++]);var P=parseInt(H[R++]);var O=parseFloat(H[R++]);var N=parseFloat(H[R++]);bb["mapid"+C]={opacity:F,winv:P,winx:O,winy:N}}}function xc(L){var C="0123456789.-,=";var K="===";var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!*";var B=L.length%3;if(B>0){L+=K.substr(B)}var H="";for(var F=0;F<L.length;F+=3){var J=C.indexOf(L.charAt(F));var E=C.indexOf(L.charAt(F+1));var A=C.indexOf(L.charAt(F+2));var I=(J<<2)|((E&12)>>2);var D=((E&3)<<4)|A;H+=G.charAt(I)+G.charAt(D)}return H}function ad(A){var C="0123456789.-,=";var H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!*";var I="";for(var F=0;F<A.length;F+=2){var D=0,K=0;D=H.indexOf(A.charAt(F));if((F+1)<A.length){K=H.indexOf(A.charAt(F+1))}var J=D>>2;var E=((D&3)<<2)|((K&48)>>4);var B=K&15;I=I+C.charAt(J)+C.charAt(E)+C.charAt(B)}var G=I.indexOf("=");if(G>0){I=I.substr(0,G)}return I}function sd(A){var C="";for(var B=A.length-1;B>=0;B--){var D=A.charAt(B);if((D<"0")||(D>"9")){C=A.substring(B+1,A.length);break}}return parseInt(C)}function td(A){if(A.ticked){ud(A.id)}else{vd(A.id)}}function ud(F){var E=sd(F);var G=$("csWindow"+E);var H=$("mapbutton"+E);var A=window.getWidth()-parseInt($("thumbnails").getStyle("width"))-parseInt(G.getStyle("width"));var D=window.getHeight()-parseInt(G.getStyle("height"));var C=parseInt(G.getStyle("left"));var B=parseInt(G.getStyle("top"));if(C<0){G.setStyle("left","0px")}else{if(C>A){G.setStyle("left",A+"px")}}if(B<96){G.setStyle("top","96px")}else{if(B>D){G.setStyle("top",D+"px")}}G.style.visibility="visible";H.setState(true)}function vd(B){var A=sd(B);var C=$("csWindow"+A);var D=$("mapbutton"+A);C.style.visibility="hidden";D.setState(false)}function _d(K){var G=sd(K.id);var J="sortme"+G;var C=$$("#sortablemapstiles li.sortme");var F=C.length;C=C.concat($$("#sortablemapskml li.sortme"));var B=0;while((B<C.length)&&(C[B].id!=J)){++B}if(B>=C.length){return }switch(API){case API_GOOGLE:var H=layerList.getNumLayers();var I=-1;for(var D=0;D<H;D++){if(parseInt(layerList.getUserData(D))==G){I=D;break}}if(I<0){return }layerList.moveLayer(I,B);kmlOverlayControl.refresh();break;case API_OPENLAYERS:var H=map.layers.length;var E=0;var I=-1;for(var D=0;D<H;D++){if(map.layers[D].isBaseLayer){E=D}if(parseInt(map.layers[D].mapid)==G){I=D;break}}if(I<0){return }var A;if(B>=F){A=C.length-B+F+E}else{A=F-B+E}if(I!=A){map.setLayerIndex(map.layers[I],A)}break}}function ge(B,A){switch(API){case API_GOOGLE:layerList.refreshOpacity();var E=layerList.getNumLayers();for(var D=0;D<E;D++){if((A>B)&&(A>layerList.getMaxZoomLevel(D))){var C=layerList.getUserData(D);$("thumbmap"+C).setOpacity(0.2)}else{if((A<B)&&(B<=layerList.getMaxZoomLevel(D)+1)){var C=layerList.getUserData(D);$("thumbmap"+C).setOpacity(1)}}}break;case API_OPENLAYERS:var F=map.getZoom();var E=map.layers.length;for(var D=OLUtils.getFirstDataLayerIndex(map);D<E;D++){if((map.layers[D])&&(map.layers[D].mapid)){var C=map.layers[D].mapid;if(F>map.layers[D].maxZoomLevel){$("thumbmap"+C).setOpacity(0.2)}else{$("thumbmap"+C).setOpacity(1)}}}break}}function ie(C){switch(API){case API_GOOGLE:var D=layerList.getNumLayers();for(var B=0;B<D;B++){var A=layerList.getUserData(B);if(C>layerList.getMaxZoomLevel(B)){$("thumbmap"+A).setOpacity(0.2)}else{$("thumbmap"+A).setOpacity(1)}}break;case API_OPENLAYERS:var D=map.layers.length;for(var B=OLUtils.getFirstDataLayerIndex(map);B<D;B++){if((map.layers[B])&&(map.layers[B].mapid)){var A=map.layers[B].mapid;if(C>map.layers[B].maxZoomLevel){$("thumbmap"+A).setOpacity(0.2)}else{$("thumbmap"+A).setOpacity(1)}}}break}}function je(){switch(API){case API_GOOGLE:layerList.refreshOpacity();break;case API_OPENLAYERS:}}function ke(E,D){var B=2;var C=parseInt(E.getStyle("z-index"));for(var A=0;A<D.length;A++){var F=parseInt(D[A].getStyle("z-index"));if(F>C){D[A].setStyle("z-index",F-1)}}E.setStyle("z-index",B+D.length)}function searchPage(){var D="search.aspx?";var C=gc();if(C.m){D+="m="+C.m+"&"}D+="s="+mc();var B;switch(API){case API_GOOGLE:if(kmlOverlayControl){B=kmlOverlayControl.getKML()}break;case API_OPENLAYERS:var A=map.getControlsByClass("KMLButtonControl");if(A.length>0){B=A[0].getKML()}break}if(B!=null){D+="&k="+encodeURIComponent(B)}window.location=D;return true}function linkPage(){var D="map-link.aspx?";var C=gc();if(C.m){D+="m="+C.m+"&"}D+="s="+mc();var B;switch(API){case API_GOOGLE:if(kmlOverlayControl){B=kmlOverlayControl.getKML()}break;case API_OPENLAYERS:var A=map.getControlsByClass("KMLButtonControl");if(A.length>0){B=A[0].getKML()}break}if(B!=null){D+="&k="+encodeURIComponent(B)}window.open(D,"linkwindow","");return true}function initialiseMap(){document.ondragstart=function(){return false};var H=new Sortables($("sortablemapstiles"),{constrain:true,clone:function(c,a,b){return a.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:a.getStyle("width"),opacity:0.5}).inject(b).position(a.getPosition(a.getOffsetParent()))},opacity:0.5,handle:".thumbmap"});H.addEvent("onComplete",_d);var O=new Sortables($("sortablemapskml"),{constrain:true,clone:function(c,a,b){return a.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:a.getStyle("width"),opacity:0.5}).inject(b).position(a.getPosition(a.getOffsetParent()))},opacity:0.5,handle:".thumbmap"});O.addEvent("onComplete",_d);var Z=$$("#sortablemapstiles img.mapbutton");for(var U=0;U<Z.length;U++){var C=Z[U];new ToggleButton(C,td);C.mapid=sd(C.id);C.setState(true)}var J=$$("#sortablemapstiles div.sliderarea");for(var U=0;U<J.length;U++){var V=J[U];var Q=5;var A=bb["mapid"+sd(V.id)];if(A){Q=A.opacity*10}var K=$$("#"+V.id+" div.sliderknob")[0];var S=new Slider(V,K,{initialize:function(){this.mapid=sd(V.id);this.fx=new Fx.Tween(K,{property:"left",duration:500})},onChange:function(b){switch(API){case API_GOOGLE:for(var a=0;a<layerList.getNumLayers();a++){if(layerList.getUserData(a)==this.mapid){layerList.setOpacity(a,b/10);break}}break;case API_OPENLAYERS:for(var a=0;a<map.layers.length;a++){if(map.layers[a].mapid==this.mapid){map.layers[a].setOpacity(b/10);break}}break}},onTick:function(a){this.fx.start(a)},steps:10}).set(Q)}var I=$("map");var B=$$("div.csWindow");if(B.length>0){var L=window.getHeight(),D=window.getWidth();var T=window.getWidth()-parseInt($("thumbnails").getStyle("width"))-parseInt(B[0].getStyle("width"));for(var U=0;U<B.length;U++){var G=new Drag.Move(B[U],{container:I});G.addEvent("onBeforeStart",function(){ke(this.element,B)});var A=bb["mapid"+sd(B[U].id)];if((A)&&(A.winx>=0)&&(A.winy>=0)){B[U].setStyle("left",A.winx*D+"px");B[U].setStyle("top",A.winy*L+"px");if(A.winv!=0){ud(B[U].id)}else{vd(B[U].id)}}else{B[U].setStyle("left",T+"px");var P=96+U*64;B[U].setStyle("top",P+"px");B[U].setStyle("visibility","visible")}}}var W=$$("input.csCloseButton");for(var U=0;U<W.length;U++){W[U].addEvent("click",function(a){vd(this.id)})}var F=new ThumbnailList($("thumbnails"),$("upbutton"),$("downbutton"),$("thumbdivider"));var M=bb.map;ie(M?M.zoom:6);switch(API){case API_GOOGLE:if(GBrowserIsCompatible()){if(M){var N=M.maptype<=3?M.maptype:0;map.setCenter(M.latlng,M.zoom,map.getMapTypes()[N])}else{map.setCenter(new GLatLng(51.52650545529106,-0.13102327732138574),6)}layerList.rebuildGMap();if((bb.defaultview==true)&&(layerList.containsKMLLayer())){layerList.scheduleMapDefaultView()}GEvent.addListener(map,"zoomend",ge);GEvent.addListener(map,"maptypechanged",je);var E=bb.kml;if(E!=null){kmlOverlayControl.setKML(decodeURIComponent(E))}}else{$("map").innerHTML="Sorry, but this browser doesn't support the necessary functionality to allow a Google Map to be drawn in this space."}break;case API_OPENLAYERS:if(M){var X=new OpenLayers.LonLat(M.latlng.lon,M.latlng.lat).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject());map.setCenter(X,M.zoom);var N=(M.maptype<=3)?(3-M.maptype):M.maptype;if((N<0)||(N>=map.layers.length)){N=6}map.setBaseLayer(map.layers[N])}else{var X=new OpenLayers.LonLat(-0.13102327732138574,51.52650545529106).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject());map.setCenter(X,6)}if((bb.defaultview==true)&&(OLUtils.containsKMLLayer(map))){OLUtils.scheduleMapDefaultView(map)}map.events.register("zoomend",map,ge);var E=bb.kml;if(E!=null){var Y=map.getControlsByClass("KMLButtonControl");if(Y.length>0){Y[0].setKML(decodeURIComponent(E))}}break}var R=new RadioImageControl($("APISwitcher"),{on_images:["images/on_Google2.gif","images/on_OpenLayers.gif"],off_images:["images/off_Google2.gif","images/off_OpenLayers.gif"],activeButton:API,onClick:function(f,c){var d;var g=null;switch(API){case API_GOOGLE:if(kmlOverlayControl){d=kmlOverlayControl.getKML()}if(map.getCurrentMapType()==map.getMapTypes()[0]){g={maptype:6}}break;case API_OPENLAYERS:var b=map.getControlsByClass("KMLButtonControl");if(b.length>0){d=b[0].getKML()}break}var a="";if(c==0){a="map.aspx?m=gm";var d}else{a="map.aspx?m=ol"}a+="&s="+mc(g);if(d!=null){a+="&k="+encodeURIComponent(d)}window.location=a}})}function defineMap(){switch(API){case API_GOOGLE:if(GBrowserIsCompatible){map=new GMap2(document.getElementById("map"),{mapTypes:[G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP]});map.addControl(new GLargeMapControl());kmlOverlayControl=new KMLOverlayControl();map.addControl(kmlOverlayControl);map.enableContinuousZoom();map.enableScrollWheelZoom();map.enableGoogleBar();layerList=new MLList(map);ab=new GHierarchicalMapTypeControl();ab.addRelationship(map.getMapTypes()[1],map.getMapTypes()[2],"Hybrid");map.addControl(ab);GEvent.addListener(map,"addmaptype",function(A){if(A.getName()=="Hybrid"){ab.addRelationship(map.getMapTypes()[2],map.getMapTypes()[3],"Hybrid")}})}break;case API_OPENLAYERS:OpenLayers.ProxyHost="/KMLProxy.ashx?k=";map=new OpenLayers.Map("map",{controls:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.PanZoomBar(),new OpenLayers.Control.Attribution(),new OpenLayers.Control.LayerSwitcher({ascending:false}),new OpenLayers.Control.MousePosition(),new OLUtils.KMLButtonControl()],maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543.0399,numZoomLevels:18,units:"m",projection:new OpenLayers.Projection("EPSG:900913"),displayProjection:new OpenLayers.Projection("EPSG:4326")});map.addLayers([new OpenLayers.Layer.Google("Google (Terrain)",{type:G_PHYSICAL_MAP,sphericalMercator:true}),new OpenLayers.Layer.Google("Google (Hybrid)",{type:G_HYBRID_MAP,sphericalMercator:true}),new OpenLayers.Layer.Google("Google (Sat)",{type:G_SATELLITE_MAP,sphericalMercator:true}),new OpenLayers.Layer.Google("Google (Map)",{type:G_NORMAL_MAP,sphericalMercator:true}),new OpenLayers.Layer.OSM.CycleMap("CycleMap"),new OpenLayers.Layer.OSM.Osmarender("Osmarender"),new OpenLayers.Layer.OSM.Mapnik("Mapnik")]);break}};