var ag=new Array();var aq;var ak=0;var aj=0;var map;var ai;var cR;var aJ=4;var bQ=0;var ax= -1;var ap=new Array();var cj=false;if(document.all){bl="document.getElementById('map').offsetLeft";bt="document.getElementById('map').offsetTop";av=true;}else{bl=0;bt=0;av=false;}function load(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"),{draggableCursor:"crosshair"});map.addControl(new GLargeMapControl());map.addControl(new GScaleControl());map.addControl(new GMapTypeControl());map.setCenter(new GLatLng(50.933509,8.006630),11);ai=map.getBounds();GEvent.addListener(map,"move",function(){M()});GEvent.addListener(map,"zoom",function(){M()});function M(){ai=map.getBounds();bE=ai.toString().slice(2,ai.toString().indexOf(","));aT=ai.toString().slice(ai.toString().indexOf(",")+1,ai.toString().indexOf(", (")-1);aV=ai.toString().slice(ai.toString().indexOf(", (")+3,ai.toString().lastIndexOf(","));bF=ai.toString().slice(ai.toString().lastIndexOf(",")+1,ai.toString().indexOf("))"));if(ag[0]!=null){for(i=0;i<ag.length;i++){bK=(ag[i][1]-aT)*document.getElementById("map").offsetWidth/(bF-aT)-25;bP=(ag[i][0]-aV)*document.getElementById("map").offsetHeight/(bE-aV)-25;bp="block";if(bK<0||bK>650||bP<0||bP>450){bp="none";}document.getElementById(i).style.left=bK+eval(bl)+"px";document.getElementById(i).style.top=bP+eval(bt)+"px";document.getElementById(i).style.display=bp;}}};if(av){GEvent.addListener(map,"click",function(){if(Strg){g('new')}});}else{var Map=document.getElementById("map");var mapClick=document.createAttribute("onclick");mapClick.nodeValue="if(Strg){g('new')}";Map.setAttributeNode(mapClick);document.addEventListener("mousedown",D,true);Map.addEventListener("mousedown",C,true);document.addEventListener("mousemove",I,true);Map.addEventListener("click",G,true);}}function R(){document.bH=new Array();if(document.images){for(i=0;i<72;i++){document.bH[i]=new Image();document.bH[i].src="gfx/MDblack"+i*5+".png";}}};R();};function aa(){var address=document.getElementById('txtAddress').value;if(address.length>0){var geocoder=new GClientGeocoder();geocoder.getLatLng(address,function(aq){if(!aq){alert('Address "'+address+'" not found');}else{map.setCenter(aq,13);}});}};function m(){if(ak>1){linepoints=new Array();for(i=0;i<ak;i++){linepoints[i]=new GLatLng(ag[i][0],ag[i][1]);}var polyline=new GPolyline(linepoints,"#ff0000",5,0.8);map.clearOverlays();map.addOverlay(polyline);}};var ah;var aQ;var aL;var at;var ar;if(!av){var rightButton;function D(Event){if(Event.button==2){rightButton=true;}};var bv;function C(Event){if(Event.button==1){bv=true;}};var cb;var bW;function I(Event){cb=Event.clientX;bW=Event.clientY;};var clickX;var clickY;function G(Event){clickX=Event.clientX;clickY=Event.clientY;}}function ac(au){var x=0;do x+=au.offsetLeft;while((au=au.offsetParent));return x;};function ad(au){var y=0;do y+=au.offsetTop;while((au=au.offsetParent));return y;};var Strg;document.onkeydown=function(evt){if(!evt){evt=window.event;}if(evt.which){bX=evt.which;}else if(evt.keyCode){bX=evt.keyCode;}if(bX=="17"){Strg=true;}};var Strg;document.onkeyup=function(evt){if(!evt){evt=window.event;}if(evt.which){bX=evt.which;}else if(evt.keyCode){bX=evt.keyCode;}if(bX=="17"){Strg=false;}};function w(au,evt){ah=au;aQ=ac(ah);aL=ad(ah);at=evt.clientX;ar=evt.clientY;document.onmousemove=ae;if(!aZ){blink(ah);}document.onselectstart=function(){event.returnValue=false};};function ae(evt){if(String(ah.id).indexOf("Elev")!= -1){as=parseInt(ah.id.replace(/Elev/,''));aw="elv";}else{as=ah.id;aw="pos";}aj=as;aq=ag[aj];if(av){if(window.event.button==2){rightButton=true;}}if(rightButton&&(aw=="pos")){if(av){var bS=event.clientX;var bT=event.clientY;}else{var bS=evt.clientX;var bT=evt.clientY;}cn=aQ+25;cq=aL+25;var alpha=Math.atan2((cn-bS),(cq-bT));var al= -alpha*180/Math.PI;if(al<0){al=al+360;}al=Math.round(al);if(!av){ay=(Math.round(al/5-0.5)*5);ah.style.background="url(gfx/MDblack"+ay+".png)";}else{ah.firstChild.style.rotation=al;}var yaw=document.getElementById("yaw");yaw.value=al;aq[3]=al;aq[5]=1;document.onmouseup=function(){l();t(aj);rightButton=false;};}else{var offsetX=document.getElementById("map").offsetLeft+1;var offsetY=document.getElementById("map").offsetTop;var mapWidth=document.getElementById("map").offsetWidth;var mapHeight=document.getElementById("map").offsetHeight;if(av){if(aw=="elv"){aC=aL+event.clientY-ar-offsetY;bO=245+parseInt(ag[0][2])-parseInt(aq[2]);var Elevation=bO-aC;document.getElementById("txtElevation").value=Elevation;ah.style.top=aC+"px";aq[4]=Elevation;t(aj);}else{if(aQ+event.clientX-at-offsetX<=0){ah.style.pixelLeft=offsetX;}else if(aQ+event.clientX-at-offsetX>=mapWidth-50){ah.style.pixelLeft=offsetX+mapWidth-50;}else if(aL+event.clientY-ar-offsetY<=0){ah.style.pixelTop=offsetY;}else if(aL+event.clientY-ar-offsetY>=mapHeight-50){ah.style.pixelTop=offsetY+mapHeight-50;}else{if(bD==false){ah.style.pixelLeft=aQ+event.clientX-at;}if(bD==true){ah.style.pixelTop=aL+event.clientY-ar-113;}else{ah.style.pixelTop=aL+event.clientY-ar;}}var cB=aQ+event.clientX-at-offsetX+25;var cA=aL+event.clientY-ar-offsetY+25;}}else{if(aw=="elv"){aC=aL+evt.clientY-ar-offsetY;bO=245+parseInt(ag[0][2])-parseInt(aq[2]);var Elevation=bO-aC;document.getElementById("txtElevation").value=Elevation;ah.style.top=aC+"px";aq[4]=Elevation;t(aj);}else{if(aQ+evt.clientX-at-offsetX<=0){ah.style.left=0+"px";}else if(aQ+evt.clientX-at-offsetX>=mapWidth-50){ah.style.left=mapWidth-50+"px";}else if(aL+evt.clientY-ar-offsetY<=0){ah.style.top=0+"px";}else if(aL+evt.clientY-ar-offsetY>=mapHeight-50){ah.style.top=mapHeight-50+"px";}else{ah.style.left=aQ+evt.clientX-at-offsetX+"px";ah.style.top=aL+evt.clientY-ar-offsetY+"px";}var cB=aQ+evt.clientX-at-offsetX+25;var cA=aL+evt.clientY-ar-offsetY+25;}}if(aw=="pos"){bE=ai.toString().slice(2,ai.toString().indexOf(","));aT=ai.toString().slice(ai.toString().indexOf(",")+1,ai.toString().indexOf(", (")-1);aV=ai.toString().slice(ai.toString().indexOf(", (")+3,ai.toString().lastIndexOf(","));bF=ai.toString().slice(ai.toString().lastIndexOf(",")+1,ai.toString().indexOf("))"));ao=((bE-aV)*cA/document.getElementById("map").offsetHeight)+parseFloat(aV);an=((bF-aT)*cB/document.getElementById("map").offsetWidth)+parseFloat(aT);ao=A(ao);an=A(an);var bg=aj-1;L(bg,ao,an);aq[0]=ao;aq[1]=an;t(aj);}document.onmouseup=function(){if(aw=="elv"){if(Elevation<=0){ah.style.top=245+parseInt(ag[0][2])-aq[2]+"px";aq[4]=0;t(aj);document.onmouseup=function(){return false};}}l();if(aw=="pos"){aY=new Array(aq[0],aq[1],aj,0);ap.push(aY);j();document.onmouseup=function(){return false};H();}};ah.onmouseup=function(){document.onmouseup};}};function l(){document.onmousemove=null;document.oncontextmenu=function(){return false;};ah=null;};function A(cf){cz=(Math.round(cf*1000000))/1000000;return cz;};function g(aw,bM,bN,bI,ck){var top=document.getElementById("top");var offsetX=document.getElementById("map").offsetLeft+1;var offsetY=document.getElementById("map").offsetTop;aj=ak;bE=ai.toString().slice(2,ai.toString().indexOf(","));aT=ai.toString().slice(ai.toString().indexOf(",")+1,ai.toString().indexOf(", (")-1);aV=ai.toString().slice(ai.toString().indexOf(", (")+3,ai.toString().lastIndexOf(","));bF=ai.toString().slice(ai.toString().lastIndexOf(",")+1,ai.toString().indexOf("))"));if(aw=='new'){if(av){var aO=window.event.clientX-25;var aN=window.event.clientY-25;ao=((bE-aV)*(event.clientY-offsetY)/document.getElementById("map").offsetHeight)+parseFloat(aV);an=((bF-aT)*(event.clientX-offsetX)/document.getElementById("map").offsetWidth)+parseFloat(aT);aP=0;aI=0;}else{var aO=clickX-offsetX-25;var aN=clickY-offsetY-25;ao=((bE-aV)*(clickY-offsetY)/document.getElementById("map").offsetHeight)+parseFloat(aV);an=((bF-aT)*(clickX-offsetX)/document.getElementById("map").offsetWidth)+parseFloat(aT);aP=0;ay=0;aI=0;}}else{if(av){var aO=(bN-parseFloat(aT))*document.getElementById("map").offsetWidth/(bF-aT)+offsetX-25;var aN=(bM-parseFloat(aV))*document.getElementById("map").offsetHeight/(bE-aV)+offsetY-25;ao=bM;an=bN;var cQ=bI;aP=bI;aI=ck;}else{var aO=(bN-parseFloat(aT))*document.getElementById("map").offsetWidth/(bF-aT)-25;var aN=(bM-parseFloat(aV))*document.getElementById("map").offsetHeight/(bE-aV)-25;ao=bM;an=bN;ay=(Math.round(bI/5-0.5)*5);aP=bI;aI=ck;}}if(av){var bd="<div id='"+ak+"' style='z-index:100;width:50px;height:50px;position:absolute;left:";var bc="px;top:";var bf="px'  onmousedown='w(this, event);k(this.id)' onmouseup='l()'><v:image";var bi=" style='position:absolute; width:50px; height:50px; rotation:";var bh="' src='gfx/MDblack.png' /></div>";var cS=aj;top.innerHTML+=bd+aO+bc+aN+bf+bi+cQ+bh;}else{var Map=document.getElementById("map");var aR=document.createElement("div");var id=document.createAttribute("id");id.nodeValue=ak;var style=document.createAttribute("style");style.nodeValue="background:url(gfx/MDblack"+ay+".png);width:50px;height:50px;position:absolute;left:"+aO+"px;top:"+aN+"px;";var aG=document.createAttribute("onmousedown");aG.nodeValue="w(this,event);k(this.id)";var bq=document.createAttribute("onmouseup");bq.nodeValue="rightButton=false;l()";aR.setAttributeNode(id);aR.setAttributeNode(style);aR.setAttributeNode(aG);aR.setAttributeNode(bq);Map.appendChild(aR);}aY=new Array(ao,an,ak,0);var bg=ak-1;if((ak>0)&&(ag[bg][5]==0)){L(bg,ao,an);}ap.push(aY);ao=A(ao);an=A(an);aq=new Array(ao,an,0,aP,aI,0);ag.push(aq);j();Z();m();F(ak);k(ak);ak++;o();H();};function L(am,ba,bs){if((am> -1)&&(ag[am][5]==0)){var cH=ag[am][0];var cK=ag[am][1];ba=A(ba);bs=A(bs);var cJ=Math.cos(ba*Math.PI/180);var cI=(ba-cH);var cL=(bs-cK)*cJ;var alpha=Math.atan2(cL,cI);var al=alpha*180/Math.PI;if(al<0){al=al+360;}al=Math.round(al);ag[am][3]=al;var bz=ag[am];document.getElementById('export').value=ag;if(!av){ay=(Math.round(al/5-0.5)*5);document.getElementById(am).style.background="url(gfx/MDblack"+ay+".png)";document.getElementById('pointList').options[am].firstChild.nodeValue=bz;}else{document.getElementById(am).firstChild.style.rotation=al;document.getElementById('pointList').options[am].text=bz;}}if(am<(ak-2)){var bA=am+2;var bR=ag[bA][0];var cy=ag[bA][1];var cD=Math.cos(bR*Math.PI/180);var cv=bR-ba;var cx=(cy-bs)*cD;var cE=Math.atan2(cx,cv);var bo=cE*180/Math.PI;if(bo<0){bo=bo+360;}bo=Math.round(bo);aq[3]=bo;if(!av){ay=(Math.round(bo/5-0.5)*5);ah.style.background="url(gfx/MDblack"+ay+".png)";}else{ah.firstChild.style.rotation=bo;}}};function af(cr,cp,cl){var offsetX=document.getElementById("map").offsetLeft+1;var offsetY=document.getElementById("map").offsetTop;bE=ai.toString().slice(2,ai.toString().indexOf(","));aT=ai.toString().slice(ai.toString().indexOf(",")+1,ai.toString().indexOf(", (")-1);aV=ai.toString().slice(ai.toString().indexOf(", (")+3,ai.toString().lastIndexOf(","));bF=ai.toString().slice(ai.toString().lastIndexOf(",")+1,ai.toString().indexOf("))"));aO=(cp-parseFloat(aT))*document.getElementById("map").offsetWidth/(bF-aT);aN=(cr-parseFloat(aV))*document.getElementById("map").offsetHeight/(bE-aV);ay=(Math.round(cl/5-0.5)*5);var Map=document.getElementById("map");var aR=document.createElement("div");var id=document.createAttribute("id");id.nodeValue=ak;var style=document.createAttribute("style");style.nodeValue="background:url(gfx/MDblack"+ay+".png);width:50px;height:50px;position:absolute;left:"+(aO-25)+"px;top:"+(aN-25)+"px;";var aG=document.createAttribute("onmousedown");aG.nodeValue="w(this,event);k(this.id)";var bq=document.createAttribute("onmouseup");bq.nodeValue="rightButton=false;l()";aR.setAttributeNode(id);aR.setAttributeNode(style);aR.setAttributeNode(aG);aR.setAttributeNode(bq);Map.appendChild(aR);};function V(){am=document.getElementById('pointList').selectedIndex;if(am!= -1){document.getElementById('pointList')[am]=null;if(av){document.getElementById("top").removeChild(document.getElementById(am));}else{document.getElementById("map").removeChild(document.getElementById(am));}document.getElementById("elevation").removeChild(document.getElementById("Ground"+am));document.getElementById("elevation").removeChild(document.getElementById("Elev"+am));document.getElementById("elevation").removeChild(document.getElementById("GrdDiv"+am));document.getElementById("elevation").removeChild(document.getElementById("Base"+am));ak--;ax= -1;J(am+1,ak);ag.splice(am,1);aj=ak-1;aq=ag[aj];k(aj);m();o();document.getElementById('export').value=ag;}};function Y(){for(i=0;i<ak;i++){document.getElementById('pointList')[0]=null;if(av){document.getElementById("top").removeChild(document.getElementById(i));}else{document.getElementById("map").removeChild(document.getElementById(i));}document.getElementById("elevation").removeChild(document.getElementById("Ground"+i));document.getElementById("elevation").removeChild(document.getElementById("Elev"+i));document.getElementById("elevation").removeChild(document.getElementById("GrdDiv"+i));document.getElementById("elevation").removeChild(document.getElementById("Base"+i));}ak=0;aj=0;ag=[];ax= -1;map.clearOverlays();document.getElementById('latitude').value="";document.getElementById('longitude').value="";document.getElementById('altitude').value="";document.getElementById('yaw').value="";document.getElementById('txtElevation').value="";document.getElementById('export').value="";};function J(bg,cO){for(i=bg;i<=cO;i++){document.getElementById(i).id=i-1;document.getElementById("Ground"+i).style.left=65+((i-1)*20)+"px";document.getElementById("Ground"+i).id="Ground"+String(i-1);document.getElementById("Elev"+i).style.left=65+((i-1)*20)+"px";document.getElementById("Elev"+i).id="Elev"+String(i-1);document.getElementById("GrdDiv"+i).style.left=49+((i-1)*20)+"px";document.getElementById("GrdDiv"+i).id="GrdDiv"+String(i-1);document.getElementById("Base"+i).style.left=49+((i-1)*20)+"px";document.getElementById("Base"+i).id="Base"+String(i-1);}};function k(as){if(String(as).indexOf("Elev")!= -1){as=parseInt(as.replace(/Elev/,''));}if(as!= -1){document.getElementById('pointList').options[as].selected="selected";X(as);document.getElementById('latitude').value=ag[as][0];document.getElementById('longitude').value=ag[as][1];document.getElementById('altitude').value=ag[as][2];document.getElementById('yaw').value=ag[as][3];document.getElementById('txtElevation').value=ag[as][4];}};function Z(){document.getElementById('pointList').options.add(new Option(aq));if(av){document.getElementById('pointList').onclick=function(){B()};}else{var bZ=document.createAttribute("onclick");bZ.nodeValue="B()";document.getElementById('pointList').options[ak].setAttributeNode(bZ);}};function B(){as=document.getElementById('pointList').selectedIndex;aj=as;aq=ag[as];X(as);document.getElementById('latitude').value=ag[as][0];document.getElementById('longitude').value=ag[as][1];document.getElementById('altitude').value=ag[as][2];document.getElementById('yaw').value=ag[as][3];document.getElementById('txtElevation').value=ag[as][4];};function t(am){if((am!= -1)&&(ak>0)){if(av){document.getElementById('pointList').options[am].text=aq;}else{document.getElementById('pointList').options[am].firstChild.nodeValue=aq;}document.getElementById('latitude').value=aq[0];document.getElementById('longitude').value=aq[1];document.getElementById('altitude').value=aq[2];document.getElementById('yaw').value=aq[3];document.getElementById('txtElevation').value=aq[4];document.getElementById('export').value=ag;}m();};function v(am){if((am!= -1)&&(ak>0)){if(av){document.getElementById('pointList').options[am].text=ag[am];}else{document.getElementById('pointList').options[am].firstChild.nodeValue=ag[am];}document.getElementById('latitude').value=ag[am][0];document.getElementById('longitude').value=ag[am][1];document.getElementById('altitude').value=ag[am][2];document.getElementById('yaw').value=ag[am][3];document.getElementById('txtElevation').value=ag[am][4];document.getElementById('export').value=ag;}if(ak>1){m();}};function o(){for(i=0;i<ak;i++){aC=(245+parseInt(ag[0][2])-parseInt(ag[i][2]));if(parseInt(ag[0][2])>parseInt(ag[i][2])){document.getElementById("Ground"+i).style.background="#ff0000";}else{document.getElementById("Ground"+i).style.background="#32CD32";}if(av){document.getElementById("Ground"+i).style.pixelTop=String(aC);document.getElementById("Elev"+i).style.pixelTop=(aC-parseInt(ag[i][4]));}else{document.getElementById("Ground"+i).style.top=String(aC)+"px";document.getElementById("Elev"+i).style.top=(aC-parseInt(ag[i][4]))+"px";}cM=String(49+i*20)+"px";if(i>0){bG=String(Math.abs(parseInt(ag[i][2])-parseInt(ag[i-1][2])))+"px solid transparent";if(ag[i][2]<ag[i-1][2]){aS="0px";aU="20px solid #8FBC8F";cw=(249-(parseInt(ag[i-1][2])-parseInt(ag[0][2])))+"px";aF=(249-(parseInt(ag[i][2])-parseInt(ag[0][2])));aB=450-aF;}else{aS="20px solid #8FBC8F";aU="0px";cw=(249-(parseInt(ag[i][2])-parseInt(ag[0][2])))+"px";aF=(249-(parseInt(ag[i-1][2])-parseInt(ag[0][2])));aB=450-aF;}if(aB<0){aB=0;}document.getElementById("GrdDiv"+i).style.left=cM;document.getElementById("GrdDiv"+i).style.borderRight=aS;document.getElementById("GrdDiv"+i).style.borderLeft=aU;document.getElementById("GrdDiv"+i).style.borderTop=bG;document.getElementById("GrdDiv"+i).style.top=cw;document.getElementById("Base"+i).style.top=aF+"px";document.getElementById("Base"+i).style.height=aB+"px";document.getElementById("Base"+i).style.width="20px";}else{document.getElementById("GrdDiv"+i).style.borderRight="0px";document.getElementById("GrdDiv"+i).style.borderLeft="0px";document.getElementById("GrdDiv"+i).style.borderTop="0px";document.getElementById("Base"+i).style.height="0px";document.getElementById("Base"+i).style.width="0px";}}};var http_request=false;bU=document.location.host;if(bU==""){url="http://gisdata.usgs.net/XMLWebServices/TNM_Elevation_Service.asmx/getElevation?Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=TRUE";bk="&X_Value=";be="&Y_Value=";bj=true;}else if(bU.indexOf("microdrones")!= -1){url="http://www.microdrones.com/waypoints/request.php";bk="?X_value=";be="&Y_value=";bj=false;}else{url="http://localhost/waypoints/request.php";bk="?X_value=";be="&Y_value=";bj=false;}function j(){if(ap.length>0){http_request=false;if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}else if(window.XMLHttpRequest){if(bj){try{netscape.cP.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}catch(e){alert("Permission UniversalBrowserRead denied.");}}http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}}if(!http_request){alert("error :( Cannot create XMLHTTP-Instance");return false;}http_request.onreadystatechange=T;http_request.open('GET',url+bk+ap[0][1]+be+ap[0][0],true);ap[0][3]++;http_request.send(null);}};function T(){if(http_request.readyState==4){if(http_request.status==200){as=ap[0][2];aE=http_request.responseText.slice(http_request.responseText.indexOf("\">")+2,http_request.responseText.indexOf("</"));if(aE=="0"){if(ap[0][3]<aJ){j();}else{if(confirm("Server says height = 0. Do you work at sea level? \r\n Hit \'OK\' to re-check height, or \'Cancel\' to accept height = 0")){ap[0][3]=0;j();}else{ag[as][2]=(aE);v(as);ap.shift();j();}}}else{ag[as][2]=(aE);v(as);o();ap.shift();j();}}else{alert("An error occured on this request");}}};function userGuide(){var Map=document.getElementById("map");var MapX=Map.offsetLeft;var MapY=Map.offsetTop;var userGuide=document.getElementById("userGuide");userGuide.style.left=MapX+70+"px";userGuide.style.top=MapY+70+"px";userGuide.style.display=(userGuide.style.display=="block")?"none":"block";};var aZ;function blink(ah){var blink=document.createElement("img");var src=document.createAttribute("src");src.nodeValue="gfx/blink.gif";blink.setAttributeNode(src);ah.appendChild(blink);aZ=true;};function X(bJ){U();au=document.getElementById(bJ);blink(au);if(ax!= -1){document.getElementById("Elev"+ax).style.background="url(gfx/elevation_blue.gif)";}ax=bJ;document.getElementById("Elev"+bJ).style.background="url(gfx/elevation_blink.gif)";};function U(){var bL=document.getElementsByTagName("img");for(i=0;i<bL.length;i++){if(bL[i].src.indexOf("gfx/blink.gif")!= -1){bL[i].parentNode.removeChild(bL[i]);}}aZ=false;};function H(){var aM=new Array();for(i=0;i<ag.length;i++){if(ag[i+1]){aM+=(new GLatLng(ag[i][0],ag[i][1])).distanceFrom(new GLatLng(ag[i+1][0],ag[i+1][1]));}aM=Math.round(aM);txtDistance=document.getElementById("txtDistance");txtDistance.value=aM;}};function P(){var elevation=document.getElementById("elevation");elevation.style.left=document.getElementById("map").offsetLeft+"px";elevation.style.top=document.getElementById("map").offsetTop+"px";elevation.style.display=(elevation.style.display=="block")?"none":"block";};var bD=false;function F(as){var elevation=document.getElementById("elevation");if(av){var bd="<div id='Ground"+as+"' style='z-index:302;background:#32CD32;width:8px;height:8px;position:absolute;left:";var bc="px'></div>";var bf="<div id='Elev"+as+"' style='z-index:303;background:url(gfx/elevation_blue.gif);width:8px;height:8px;position:absolute;left:";var bi="px' onmousedown='w(this,event);aQ=this.style.left;k(this.id)' onmouseup='l()'></div>";var bh="<div id='GrdDiv"+as+"' style='z-index:301;font-size:0px;line-height:0%;width:0px;position:absolute;left:";var ct="px'></div>";var co="<div id='Base"+as+"' style='z-index:301;background:#8FBC8F;width:20px;position:absolute;left:";var cs="px'></div>";elevation.innerHTML+=bd+(65+aj*20)+bc+bf+(65+aj*20)+bi+bh+(49+aj*20)+ct+co+(49+aj*20)+cs;}else{var aW=document.createElement("div");var bw=document.createAttribute("id");bw.nodeValue="Ground"+as;var aX=document.createAttribute("style");aX.nodeValue="z-index:302;background:#32CD32;width:8px;height:8px;position:absolute;left:"+(65+aj*20)+"px;";aW.setAttributeNode(bw);aW.setAttributeNode(aX);elevation.appendChild(aW);var aK=document.createElement("div");var cc=document.createAttribute("id");cc.nodeValue="Elev"+as;var bn=document.createAttribute("style");bn.nodeValue="z-index:303;background:url(gfx/elevation_blue.gif);width:8px;height:8px;position:absolute;left:"+(65+aj*20)+"px;";var aG=document.createAttribute("onmousedown");aG.nodeValue="w(this,event);aQ=this.style.left;k(this.id)";var bq=document.createAttribute("onmouseup");bq.nodeValue="l()";var cN=document.createAttribute("onmouseout");cN.nodeValue="l()";aK.setAttributeNode(cc);aK.setAttributeNode(bn);aK.setAttributeNode(aG);aK.setAttributeNode(bq);elevation.appendChild(aK);var az=document.createElement("div");var aH=document.createAttribute("id");aH.nodeValue="GrdDiv"+as;var aD=document.createAttribute("style");aD.nodeValue="z-index:301;font-size:0px;line-height:0%;width:0px;position:absolute;left:"+(49+aj*20)+"px;";az.setAttributeNode(aD);az.setAttributeNode(aH);elevation.appendChild(az);var bb=document.createElement("div");var bY=document.createAttribute("id");bY.nodeValue="Base"+as;var bm=document.createAttribute("style");bm.nodeValue="z-index:301;background:#8FBC8F;width:20px;position:absolute;left:"+(49+aj*20)+"px;";bb.setAttributeNode(bm);bb.setAttributeNode(bY);elevation.appendChild(bb);}}