
/* 2007 Copyright by */
/* Michael Kreutz, www.lumocad.de */
/* Sebastian Beutel, www.s-beutel.de */
 var aB=new Array();var aN;var aG=0;var aF=0;var map;var Bounds;var hw;var bK=4;var dC=0;var bn= -1;var aO=new Array();var en=false;if(document.all){cH="document.getElementById('map').offsetLeft";cT="document.getElementById('map').offsetTop";bd=true;}else{cH=0;cT=0;bd=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(42.69106, 23.307505),11);Bounds=map.getBounds();GEvent.addListener(map,"move",function(){aa()});GEvent.addListener(map,"zoom",function(){aa()});function aa(){Bounds=map.getBounds();di=Bounds.toString().slice(2,Bounds.toString().indexOf(","));bZ=Bounds.toString().slice(Bounds.toString().indexOf(",")+1,Bounds.toString().indexOf(", (")-1);cc=Bounds.toString().slice(Bounds.toString().indexOf(", (")+3,Bounds.toString().lastIndexOf(","));dh=Bounds.toString().slice(Bounds.toString().lastIndexOf(",")+1,Bounds.toString().indexOf("))"));if(aB[0]!=null){for(i=0;i<aB.length;i++){dw=(aB[i][1]-bZ)*document.getElementById("map").offsetWidth/(dh-bZ)-25;dy=(aB[i][0]-cc)*document.getElementById("map").offsetHeight/(di-cc)-25;cJ="block";if(dw<0||dw>650||dy<0||dy>450){cJ="none";}document.getElementById(i).style.left=dw+eval(cH)+"px";document.getElementById(i).style.top=dy+eval(cT)+"px";document.getElementById(i).style.display=cJ;}}};if(bd){GEvent.addListener(map,"click",function(){if(Strg){J('new')}});}else{var Map=document.getElementById("map");var mapClick=document.createAttribute("onclick");mapClick.nodeValue="if(Strg){J('new')}";Map.setAttributeNode(mapClick);document.addEventListener("mousedown",H,true);Map.addEventListener("mousedown",F,true);document.addEventListener("mousemove",U,true);Map.addEventListener("click",Q,true);}}function af(){document.preload=new Array();if(document.images){for(i=0;i<72;i++){document.preload[i]=new Image();document.preload[i].src="gfx/MDblack"+i*5+".png";}}};af();};function ap(){var address=document.getElementById('dm').value;if(address.length>0){var geocoder=new GClientGeocoder();geocoder.getLatLng(address,function(aN){if(!aN){alert('Address "'+address+'" not found');}else{map.setCenter(aN,13);}});}};function t(){if(aG>1){ct=new Array();for(i=0;i<aG;i++){ct[i]=new GLatLng(aB[i][0],aB[i][1]);}var dP=new GPolyline(ct,"#ff0000",5,0.8);map.clearOverlays();map.addOverlay(dP);}};var aD;var bW;var bQ;var bb;var aR;if(!bd){var rightButton;function H(Event){if(Event.button==2){rightButton=true;}};var cW;function F(Event){if(Event.button==1){cW=true;}};var dA;var dz;function U(Event){dA=Event.clientX;dz=Event.clientY;};var clickX;var clickY;function Q(Event){clickX=Event.clientX;clickY=Event.clientY;}}function j(aS){var x=0;do x+=aS.offsetLeft;while((aS=aS.offsetParent));return x;};function av(aS){var y=0;do y+=aS.offsetTop;while((aS=aS.offsetParent));return y;};var Strg;document.onkeydown=function(evt){if(!evt){evt=window.event;}if(evt.which){key=evt.which;}else if(evt.keyCode){key=evt.keyCode;}if(key=="17"){Strg=true;}};var Strg;document.onkeyup=function(evt){if(!evt){evt=window.event;}if(evt.which){key=evt.which;}else if(evt.keyCode){key=evt.keyCode;}if(key=="17"){Strg=false;}};function B(aS,evt){aD=aS;bW=j(aD);bQ=av(aD);bb=evt.clientX;aR=evt.clientY;document.onmousemove=ax;if(!blinking){blink(aD);}document.onselectstart=function(){event.returnValue=false};};function ax(evt){if(String(aD.id).indexOf("Elev")!= -1){aV=parseInt(aD.id.replace(/Elev/,''));bk="elv";}else{aV=aD.id;bk="pos";}aF=aV;aN=aB[aF];if(bd){if(window.event.button==2){rightButton=true;}}if(rightButton&&(bk=="pos")){if(bd){var dH=event.clientX;var aA=event.clientY;}else{var dH=evt.clientX;var aA=evt.clientY;}eo=bW+25;ep=bQ+25;var alpha=Math.atan2((eo-dH),(ep-aA));var al= -alpha*180/Math.PI;if(al<0){al=al+360;}al=Math.round(al);if(!bd){bm=(Math.round(al/5-0.5)*5);aD.style.background="url(gfx/MDblack"+bm+".png)";}else{aD.firstChild.style.rotation=al;}var ca=document.getElementById("ca");ca.value=al;aN[3]=al;aN[5]=1;document.onmouseup=function(){m();w(aF);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(bd){if(bk=="elv"){bu=bQ+event.clientY-aR-offsetY;dv=245+parseInt(aB[0][2])-parseInt(aN[2]);var bj=dv-bu;document.getElementById("be").value=bj;aD.style.top=bu+"px";aN[4]=bj;w(aF);}else{if(bW+event.clientX-bb-offsetX<=0){aD.style.pixelLeft=offsetX;}else if(bW+event.clientX-bb-offsetX>=mapWidth-50){aD.style.pixelLeft=offsetX+mapWidth-50;}else if(bQ+event.clientY-aR-offsetY<=0){aD.style.pixelTop=offsetY;}else if(bQ+event.clientY-aR-offsetY>=mapHeight-50){aD.style.pixelTop=offsetY+mapHeight-50;}else{if(dc==false){aD.style.pixelLeft=bW+event.clientX-bb;}if(dc==true){aD.style.pixelTop=bQ+event.clientY-aR-113;}else{aD.style.pixelTop=bQ+event.clientY-aR;}}var PosX=bW+event.clientX-bb-offsetX+25;var PosY=bQ+event.clientY-aR-offsetY+25;}}else{if(bk=="elv"){bu=bQ+evt.clientY-aR-offsetY;dv=245+parseInt(aB[0][2])-parseInt(aN[2]);var bj=dv-bu;document.getElementById("be").value=bj;aD.style.top=bu+"px";aN[4]=bj;w(aF);}else{if(bW+evt.clientX-bb-offsetX<=0){aD.style.left=0+"px";}else if(bW+evt.clientX-bb-offsetX>=mapWidth-50){aD.style.left=mapWidth-50+"px";}else if(bQ+evt.clientY-aR-offsetY<=0){aD.style.top=0+"px";}else if(bQ+evt.clientY-aR-offsetY>=mapHeight-50){aD.style.top=mapHeight-50+"px";}else{aD.style.left=bW+evt.clientX-bb-offsetX+"px";aD.style.top=bQ+evt.clientY-aR-offsetY+"px";}var PosX=bW+evt.clientX-bb-offsetX+25;var PosY=bQ+evt.clientY-aR-offsetY+25;}}if(bk=="pos"){di=Bounds.toString().slice(2,Bounds.toString().indexOf(","));bZ=Bounds.toString().slice(Bounds.toString().indexOf(",")+1,Bounds.toString().indexOf(", (")-1);cc=Bounds.toString().slice(Bounds.toString().indexOf(", (")+3,Bounds.toString().lastIndexOf(","));dh=Bounds.toString().slice(Bounds.toString().lastIndexOf(",")+1,Bounds.toString().indexOf("))"));aM=((di-cc)*PosY/document.getElementById("map").offsetHeight)+parseFloat(cc);aK=((dh-bZ)*PosX/document.getElementById("map").offsetWidth)+parseFloat(bZ);aM=D(aM);aK=D(aK);var cE=aF-1;Z(cE,aM,aK);aN[0]=aM;aN[1]=aK;w(aF);}document.onmouseup=function(){if(bk=="elv"){if(bj<=0){aD.style.top=245+parseInt(aB[0][2])-aN[2]+"px";aN[4]=0;w(aF);document.onmouseup=function(){return false};}}m();if(bk=="pos"){co=new Array(aN[0],aN[1],aF,0);aO.push(co);l();document.onmouseup=function(){return false};R();}};aD.onmouseup=function(){document.onmouseup};}};function m(){document.onmousemove=null;document.oncontextmenu=function(){return false;};aD=null;};function D(dS){fb=(Math.round(dS*1000000))/1000000;return fb;};function J(bk,du,ds,dq,ei){var top=document.getElementById("top");var offsetX=document.getElementById("map").offsetLeft+1;var offsetY=document.getElementById("map").offsetTop;aF=aG;di=Bounds.toString().slice(2,Bounds.toString().indexOf(","));bZ=Bounds.toString().slice(Bounds.toString().indexOf(",")+1,Bounds.toString().indexOf(", (")-1);cc=Bounds.toString().slice(Bounds.toString().indexOf(", (")+3,Bounds.toString().lastIndexOf(","));dh=Bounds.toString().slice(Bounds.toString().lastIndexOf(",")+1,Bounds.toString().indexOf("))"));if(bk=='new'){if(bd){var bT=window.event.clientX-25;var bR=window.event.clientY-25;aM=((di-cc)*(event.clientY-offsetY)/document.getElementById("map").offsetHeight)+parseFloat(cc);aK=((dh-bZ)*(event.clientX-offsetX)/document.getElementById("map").offsetWidth)+parseFloat(bZ);bU=0;bI=0;}else{var bT=clickX-offsetX-25;var bR=clickY-offsetY-25;aM=((di-cc)*(clickY-offsetY)/document.getElementById("map").offsetHeight)+parseFloat(cc);aK=((dh-bZ)*(clickX-offsetX)/document.getElementById("map").offsetWidth)+parseFloat(bZ);bU=0;bm=0;bI=0;}}else{if(bd){var bT=(ds-parseFloat(bZ))*document.getElementById("map").offsetWidth/(dh-bZ)+offsetX-25;var bR=(du-parseFloat(cc))*document.getElementById("map").offsetHeight/(di-cc)+offsetY-25;aM=du;aK=ds;var gA=dq;bU=dq;bI=ei;}else{var bT=(ds-parseFloat(bZ))*document.getElementById("map").offsetWidth/(dh-bZ)-25;var bR=(du-parseFloat(cc))*document.getElementById("map").offsetHeight/(di-cc)-25;aM=du;aK=ds;bm=(Math.round(dq/5-0.5)*5);bU=dq;bI=ei;}}if(bd){var cA="<div id='"+aG+"' style='z-index:100;width:50px;height:50px;position:absolute;left:";var cz="px;top:";var cC="px'  onmousedown='B(this, event);k(this.id)' onmouseup='m()'><v:image";var cD=" style='position:absolute; width:50px; height:50px; rotation:";var cG="' src='gfx/MDblack.png' /></div>";var hy=aF;top.innerHTML+=cA+bT+cz+bR+cC+cD+gA+cG;}else{var Map=document.getElementById("map");var bX=document.createElement("div");var id=document.createAttribute("id");id.nodeValue=aG;var style=document.createAttribute("style");style.nodeValue="background:url(gfx/MDblack"+bm+".png);width:50px;height:50px;position:absolute;left:"+bT+"px;top:"+bR+"px;";var bE=document.createAttribute("onmousedown");bE.nodeValue="B(this,event);k(this.id)";var cK=document.createAttribute("onmouseup");cK.nodeValue="rightButton=false;m()";bX.setAttributeNode(id);bX.setAttributeNode(style);bX.setAttributeNode(bE);bX.setAttributeNode(cK);Map.appendChild(bX);}co=new Array(aM,aK,aG,0);var cE=aG-1;if((aG>0)&&(aB[cE][5]==0)){Z(cE,aM,aK);}aO.push(co);aM=D(aM);aK=D(aK);aN=new Array(aM,aK,0,bU,bI,0);aB.push(aN);as(aG);l();an();t();I(aG);k(aG);aG++;v();R();};function Z(aI,cr,cO){if((aI> -1)&&(aB[aI][5]==0)){var fr=aB[aI][0];var fp=aB[aI][1];cr=D(cr);cO=D(cO);var fj=Math.cos(cr*Math.PI/180);var fq=(cr-fr);var fu=(cO-fp)*fj;var alpha=Math.atan2(fu,fq);var al=alpha*180/Math.PI;if(al<0){al=al+360;}al=Math.round(al);aB[aI][3]=al;var cY=aB[aI];document.getElementById('export').value=aB;if(!bd){bm=(Math.round(al/5-0.5)*5);document.getElementById(aI).style.background="url(gfx/MDblack"+bm+".png)";document.getElementById('pointList').options[aI].firstChild.nodeValue=cY;}else{document.getElementById(aI).firstChild.style.rotation=al;document.getElementById('pointList').options[aI].text=cY;}}if((aI<(aG-2))&&(aN[5]==0)){var da=aI+2;var dK=aB[da][0];var eZ=aB[da][1];var eS=Math.cos(dK*Math.PI/180);var eT=dK-cr;var eU=(eZ-cO)*eS;var fc=Math.atan2(eU,eT);var cM=fc*180/Math.PI;if(cM<0){cM=cM+360;}cM=Math.round(cM);aN[3]=cM;if(!bd){bm=(Math.round(cM/5-0.5)*5);aD.style.background="url(gfx/MDblack"+bm+".png)";}else{aD.firstChild.style.rotation=cM;}}};function az(eD,ez,eB){var offsetX=document.getElementById("map").offsetLeft+1;var offsetY=document.getElementById("map").offsetTop;di=Bounds.toString().slice(2,Bounds.toString().indexOf(","));bZ=Bounds.toString().slice(Bounds.toString().indexOf(",")+1,Bounds.toString().indexOf(", (")-1);cc=Bounds.toString().slice(Bounds.toString().indexOf(", (")+3,Bounds.toString().lastIndexOf(","));dh=Bounds.toString().slice(Bounds.toString().lastIndexOf(",")+1,Bounds.toString().indexOf("))"));bT=(ez-parseFloat(bZ))*document.getElementById("map").offsetWidth/(dh-bZ);bR=(eD-parseFloat(cc))*document.getElementById("map").offsetHeight/(di-cc);bm=(Math.round(eB/5-0.5)*5);var Map=document.getElementById("map");var bX=document.createElement("div");var id=document.createAttribute("id");id.nodeValue=aG;var style=document.createAttribute("style");style.nodeValue="background:url(gfx/MDblack"+bm+".png);width:50px;height:50px;position:absolute;left:"+(bT-25)+"px;top:"+(bR-25)+"px;";var bE=document.createAttribute("onmousedown");bE.nodeValue="B(this,event);k(this.id)";var cK=document.createAttribute("onmouseup");cK.nodeValue="rightButton=false;m()";bX.setAttributeNode(id);bX.setAttributeNode(style);bX.setAttributeNode(bE);bX.setAttributeNode(cK);Map.appendChild(bX);};function ai(){aI=document.getElementById('pointList').selectedIndex;if(aI!= -1){document.getElementById('pointList')[aI]=null;if(bd){document.getElementById("top").removeChild(document.getElementById(aI));}else{document.getElementById("map").removeChild(document.getElementById(aI));}document.getElementById("elevation").removeChild(document.getElementById("Ground"+aI));document.getElementById("elevation").removeChild(document.getElementById("Elev"+aI));document.getElementById("elevation").removeChild(document.getElementById("GrdDiv"+aI));document.getElementById("elevation").removeChild(document.getElementById("Base"+aI));aG--;bn= -1;T(aI+1,aG);aB.splice(aI,1);aF=aG-1;aN=aB[aF];k(aF);t();v();document.getElementById('export').value=aB;}};function aw(){for(i=0;i<aG;i++){document.getElementById('pointList')[0]=null;if(bd){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));}aG=0;aF=0;aB=[];bn= -1;map.clearOverlays();document.getElementById('bA').value="";document.getElementById('bw').value="";document.getElementById('bB').value="";document.getElementById('ca').value="";document.getElementById('be').value="";document.getElementById('export').value="";};function T(cE,gl){for(i=cE;i<=gl;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(aV){if(String(aV).indexOf("Elev")!= -1){aV=parseInt(aV.replace(/Elev/,''));}if(aV!= -1){document.getElementById('pointList').options[aV].selected="selected";aj(aV);document.getElementById('bA').value=aB[aV][0];document.getElementById('bw').value=aB[aV][1];document.getElementById('bB').value=aB[aV][2];document.getElementById('ca').value=aB[aV][3];document.getElementById('be').value=aB[aV][4];}};function an(){document.getElementById('pointList').options.add(new Option(aN));if(bd){document.getElementById('pointList').onclick=function(){G()};}else{var dD=document.createAttribute("onclick");dD.nodeValue="G()";document.getElementById('pointList').options[aG].setAttributeNode(dD);}};function G(){aV=document.getElementById('pointList').selectedIndex;aF=aV;aN=aB[aV];aj(aV);document.getElementById('bA').value=aB[aV][0];document.getElementById('bw').value=aB[aV][1];document.getElementById('bB').value=aB[aV][2];document.getElementById('ca').value=aB[aV][3];document.getElementById('be').value=aB[aV][4];P(aV);};function w(aI){if((aI!= -1)&&(aG>0)){if(bd){document.getElementById('pointList').options[aI].text=aN;}else{document.getElementById('pointList').options[aI].firstChild.nodeValue=aN;}document.getElementById('bA').value=aN[0];document.getElementById('bw').value=aN[1];document.getElementById('bB').value=aN[2];document.getElementById('ca').value=aN[3];document.getElementById('be').value=aN[4];document.getElementById('export').value=aB;}t();};function A(aI){if((aI!= -1)&&(aG>0)){if(bd){document.getElementById('pointList').options[aI].text=aB[aI];}else{document.getElementById('pointList').options[aI].firstChild.nodeValue=aB[aI];}document.getElementById('bA').value=aB[aI][0];document.getElementById('bw').value=aB[aI][1];document.getElementById('bB').value=aB[aI][2];document.getElementById('ca').value=aB[aI][3];document.getElementById('be').value=aB[aI][4];document.getElementById('export').value=aB;}if(aG>1){t();}};function v(){for(i=0;i<aG;i++){bu=(245+parseInt(aB[0][2])-parseInt(aB[i][2]));if(parseInt(aB[0][2])>parseInt(aB[i][2])){document.getElementById("Ground"+i).style.background="#ff0000";}else{document.getElementById("Ground"+i).style.background="#32CD32";}if(bd){document.getElementById("Ground"+i).style.pixelTop=String(bu);document.getElementById("Elev"+i).style.pixelTop=(bu-parseInt(aB[i][4]));}else{document.getElementById("Ground"+i).style.top=String(bu)+"px";document.getElementById("Elev"+i).style.top=(bu-parseInt(aB[i][4]))+"px";}fi=String(49+i*20)+"px";if(i>0){dg=String(Math.abs(parseInt(aB[i][2])-parseInt(aB[i-1][2])))+"px solid transparent";if(aB[i][2]<aB[i-1][2]){bY="0px";cd="20px solid #8FBC8F";eK=(249-(parseInt(aB[i-1][2])-parseInt(aB[0][2])))+"px";bJ=(249-(parseInt(aB[i][2])-parseInt(aB[0][2])));bs=450-bJ;}else{bY="20px solid #8FBC8F";cd="0px";eK=(249-(parseInt(aB[i][2])-parseInt(aB[0][2])))+"px";bJ=(249-(parseInt(aB[i-1][2])-parseInt(aB[0][2])));bs=450-bJ;}if(bs<0){bs=0;}document.getElementById("GrdDiv"+i).style.left=fi;document.getElementById("GrdDiv"+i).style.borderRight=bY;document.getElementById("GrdDiv"+i).style.borderLeft=cd;document.getElementById("GrdDiv"+i).style.borderTop=dg;document.getElementById("GrdDiv"+i).style.top=eK;document.getElementById("Base"+i).style.top=bJ+"px";document.getElementById("Base"+i).style.height=bs+"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 aL=false;dJ=document.location.host;if(dJ==""){url="http://www.j-lec.com/geodata/request.php";cv="?lng=";cF="&lat=";cx=true;}else if(dJ.indexOf("microdrones")!= -1){url="http://www.microdrones-bulgaria.com/request.php";cv="?X_value=";cF="&Y_value=";cx=false;}else{url="http://localhost/waypoints/request.php";cv="?X_value=";cF="&Y_value=";cx=false;}function l(){if(aO.length>0){aL=false;if(window.ActiveXObject){try{aL=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{aL=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}else if(window.XMLHttpRequest){if(cx){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");}catch(e){alert("Permission UniversalBrowserRead denied.");}}aL=new XMLHttpRequest();if(aL.overrideMimeType){aL.overrideMimeType('text/xml');}}if(!aL){alert("error :( Cannot create XMLHTTP-Instance");return false;}aL.onreadystatechange=ag;aL.open('GET',url+cv+aO[0][1]+cF+aO[0][0],true);aO[0][3]++;aL.send(null);}};function ag(){if(aL.readyState==4){if(aL.status==200){aV=aO[0][2];by=aL.responseText.slice(aL.responseText.indexOf("\">")+2,aL.responseText.indexOf("</"));if(by=="0"){if(aO[0][3]<bK){l();}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")){aO[0][3]=0;l();}else{aB[aV][2]=(by);A(aV);aO.shift();l();}}}else{aB[aV][2]=(by);A(aV);v();aO.shift();l();}}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 blinking;function blink(aD){var blink=document.createElement("img");var src=document.createAttribute("src");src.nodeValue="gfx/blink.gif";blink.setAttributeNode(src);aD.appendChild(blink);blinking=true;};function aj(dx){ah();aS=document.getElementById(dx);blink(aS);if(bn!= -1){document.getElementById("Elev"+bn).style.background="url(gfx/elevation_blue.gif)";}bn=dx;document.getElementById("Elev"+dx).style.background="url(gfx/elevation_blink.gif)";};function ah(){var dn=document.getElementsByTagName("img");for(i=0;i<dn.length;i++){if(dn[i].src.indexOf("gfx/blink.gif")!= -1){dn[i].parentNode.removeChild(dn[i]);}}blinking=false;};function R(){var distance=new Array();for(i=0;i<aB.length;i++){if(aB[i+1]){distance+=(new GLatLng(aB[i][0],aB[i][1])).distanceFrom(new GLatLng(aB[i+1][0],aB[i+1][1]));}distance=Math.round(distance);bL=document.getElementById("bL");bL.value=distance;}};function ae(){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 dc=false;function I(aV){var elevation=document.getElementById("elevation");if(bd){var cA="<div id='Ground"+aV+"' style='z-index:302;background:#32CD32;width:8px;height:8px;position:absolute;left:";var cz="px'></div>";var cC="<div id='Elev"+aV+"' style='z-index:303;background:url(gfx/elevation_blue.gif);width:8px;height:8px;position:absolute;left:";var cD="px' onmousedown='B(this,event);bW=this.style.left;k(this.id)' onmouseup='m()'></div>";var cG="<div id='GrdDiv"+aV+"' style='z-index:301;font-size:0px;line-height:0%;width:0px;position:absolute;left:";var ey="px'></div>";var ew="<div id='Base"+aV+"' style='z-index:301;background:#8FBC8F;width:20px;position:absolute;left:";var er="px'></div>";elevation.innerHTML+=cA+(65+aF*20)+cz+cC+(65+aF*20)+cD+cG+(49+aF*20)+ey+ew+(49+aF*20)+er;}else{var cg=document.createElement("div");var cP=document.createAttribute("id");cP.nodeValue="Ground"+aV;var cn=document.createAttribute("style");cn.nodeValue="z-index:302;background:#32CD32;width:8px;height:8px;position:absolute;left:"+(65+aF*20)+"px;";cg.setAttributeNode(cP);cg.setAttributeNode(cn);elevation.appendChild(cg);var bO=document.createElement("div");var dG=document.createAttribute("id");dG.nodeValue="Elev"+aV;var cL=document.createAttribute("style");cL.nodeValue="z-index:303;background:url(gfx/elevation_blue.gif);width:8px;height:8px;position:absolute;left:"+(65+aF*20)+"px;";var bE=document.createAttribute("onmousedown");bE.nodeValue="B(this,event);bW=this.style.left;k(this.id)";var cK=document.createAttribute("onmouseup");cK.nodeValue="m()";var gd=document.createAttribute("onmouseout");gd.nodeValue="m()";bO.setAttributeNode(dG);bO.setAttributeNode(cL);bO.setAttributeNode(bE);bO.setAttributeNode(cK);elevation.appendChild(bO);var bo=document.createElement("div");var bG=document.createAttribute("id");bG.nodeValue="GrdDiv"+aV;var bv=document.createAttribute("style");bv.nodeValue="z-index:301;font-size:0px;line-height:0%;width:0px;position:absolute;left:"+(49+aF*20)+"px;";bo.setAttributeNode(bv);bo.setAttributeNode(bG);elevation.appendChild(bo);var cw=document.createElement("div");var dN=document.createAttribute("id");dN.nodeValue="Base"+aV;var cI=document.createAttribute("style");cI.nodeValue="z-index:301;background:#8FBC8F;width:20px;position:absolute;left:"+(49+aF*20)+"px;";cw.setAttributeNode(cI);cw.setAttributeNode(dN);elevation.appendChild(cw);}}
