var kijs_map_path="https://wms.kartes.lv/JA22/lks/15/"; var kijs_map_options={LAYERS:'0', FORMAT:'image/png', y_delta:-6000000}; var kijs_kadastrs_ortopath="https://wms.kartes.lv/JA22/lks/LGIA_ORTO_NEW/"; var subdomain_index=1; var subdomain_count=3; var kijs_client_id="JA22";var kijs_dir="https://maps.kartes.lv/kijs/";var kijs_base_dir="https://wms.kartes.lv/";function LogoAndScale(A){var C=this;this.HideScale=function(){D.style.visibility="hidden"};this.ShowScale=function(){D.style.visibility="visible"};this.HideLogo=function(){F.style.visibility="hidden"};this.ShowLogo=function(){F.style.visibility="visible"};var F=CreateImageNoSelect();A.viewableMap.appendChild(F);F.src=kijs_dir+"images/logo-new.png";F.alt="Karšu izdevniecība Jāņa sēta";F.title="Karšu izdevniecība Jāņa sēta";F.onclick=function(){window.open("http://www.kartes.lv","_blank")};F.style.position="absolute";F.style.zIndex=A.viewableMap.style.zIndex+10;F.style.cursor="pointer";F.style.left="10px";F.style.bottom="10px";var D=document.createElement("div");A.viewableMap.appendChild(D);D.style.zIndex=A.viewableMap.style.zIndex+10;D.style.position="absolute";D.style.left="55px";D.style.bottom="10px";this.scale_image=CreateImageNoSelect();D.appendChild(this.scale_image);this.scale_image.src=kijs_dir+"/images/scale.gif";var B=document.createElement("div");D.appendChild(B);B.style.position="absolute";B.style.left="7px";B.style.top="0px";B.style.width="94px";B.style.fontWeight="bold";B.style.fontFamily="Arial";B.style.fontSize="12px";B.style.color="black";B.style.padding="0px";B.style.margin="0px";B.style.lineHeight="16px";this.scale_in_meters=0;this.GetScale=function(){G();return this.scale_in_meters};A.event_after_level_changed.AddCallback(G);function G(){if(A.tile_width_meter==null){return }if(A.tile_width_pix==null){return }var K="";var H=102;var L=Math.round((A.tile_width_meter/300)*(96*0.393700787401575*100));var J="";if(L>1000000){L=L/1000000;J=" M"}else{if(L>1000){L=L/1000;J=" K"}}L=Math.round(L);C.scale_in_meters=HorisontalPixelsToMeters(H,A.tile_width_meter,A.tile_width_pix);var I="";if(C.scale_in_meters<100){I=(Math.round(C.scale_in_meters))+" m"}else{if(C.scale_in_meters<1000){I=(Math.round(C.scale_in_meters/10)*10)+" m"}else{if(C.scale_in_meters<5000){I=(Math.round(C.scale_in_meters/100)*100/1000)+" km"}else{if(C.scale_in_meters<100000){I=(Math.round(C.scale_in_meters/1000))+" km"}else{I=(Math.round(C.scale_in_meters/10000)*10000/1000)+" km"}}}}I='1:'+L+J+""+I;B.innerHTML=I}G();Kijs_SetOpacity(D,0.7)}var kijs_traffic_index=null;var kijs_traffic_data=null;function Traffic(A){var F=A.navigation_frame.AddSlicedButton({title:kijs_language.Traffic,image_src:kijs_dir+"images/slice/traffic.png",off:{left:0,top:0,width:28,height:27},on:{left:0,top:32,width:28,height:27},active:{left:0,top:64,width:28,height:27}},function(){G()});var N=Array();var H=false;function G(){if(H==false){C()}else{M()}}this.ShowTrafficLayer=C;function C(){A.loader.Show();H=true;A.navigation_frame.SlicedButtonActive(F);call_back.LoadJson(kijs_dir+"server_scripts/traffic/get_traffic_info.php?kijs="+kijs_client_id,function(){try{D();L();var O=kijs_dir+"server_scripts/traffic/draw_image.php?i="+kijs_traffic_index;K=A.tile_manager.AddWmsLayer([O],false);I()}catch(P){log("Error ShowTrafficLayer(): , "+P+", "+P.name+", "+P.message)}A.loader.Hide()})}var K=-1;this.HideTrafficLayer=M;function M(){A.navigation_frame.SlicedButtonOff(F);D();L();H=false}function L(){for(var O=N.length-1;O>=0;O--){A.svg.lines.DeletePolyLine(N[O]);N.remove(O)}}function D(){if(K!=-1){A.tile_manager.RemoveWmsLayer(K);K=-1}}function I(){if(H==false){return }A.loader.Show();L();if(A.zoom_level<=3){if(K!=-1){A.tile_manager.RemoveWmsLayer(K);K=-1}var O=A.MapCorners();for(var Q=0;Q";U+="
Pēdējais caurbraukšanas laiks: "+Math.round(O.last_drive_time/60*10)/10+"min";U+="
Ticamība: ";if(O.auto_count<1){U+="nav datu"}else{if(O.auto_count<3){U+="zema"}else{if(O.auto_count<5){U+="laba"}else{if(O.auto_count<7){U+="augsta"}else{U+="ļoti augsta"}}}}U+="
Normālais caurbraukšanas laiks: "+Math.round(O.normal_drive_time/60*10)/10+"min";U+="
Datums: "+O.date+"";U+="
Vidējais caurbraukšanas laiks
darba dienās minūtēs šomēnesī:
";A.svg.lines.SetCustomParameter(Q,"mouse_over_text",U);A.svg.lines.AddEventMouseOver(Q,function(W){var V=A.svg.lines.GetCustomParameter(W,"mouse_over_text");A.tooltip.Show(V)});A.svg.lines.AddEventMouseOut(Q,function(){A.tooltip.Hide()})}}kijs_user_browser=new KijsBrowser();function log(A){setTimeout(function(){var B=E("kijs_debug");if(!B){B=E("debug")}if(B){var C=new Date();var D=C.getHours()+":"+C.getMinutes()+":"+C.getSeconds();B.innerHTML="["+D+"] - "+A+"\n
"+B.innerHTML;B.innerHTML=B.innerHTML.substring(0,7000)}},10)}function E(B){try{return document.getElementById(B)}catch(A){return false}}function pointerX_old(B){var A=0;if(!B){var B=window.event}if(B.pageX){A=B.pageX}else{if(B.clientX){A=B.clientX+document.body.scrollLeft+document.documentElement.scrollLeft}}return A}function pointerY_old(A){var B=0;if(!A){var A=window.event}if(A.pageY){B=A.pageY}else{if(A.clientY){B=A.clientY+document.body.scrollTop+document.documentElement.scrollTop}}return B}function pointerX(G){if(!kijs_user_browser.ie){return pointerX_old(G)}else{var A=0;try{if(!G){var G=window.event}var D=G.srcElement;var F=(D&&D.ownerDocument)||document;var C=((Kijs_IsIE()<6)||(F.compatMode=="BackCompat"))?F.body:F.documentElement;var H=Kijs_IeDocElemOffset();A=G.clientX+Kijs_FixIeBiDiScrollLeft(C.scrollLeft||0)-H.x}catch(B){}return A}}function pointerY(F){if(!kijs_user_browser.ie){return pointerY_old(F)}else{var H=0;try{if(!F){var F=window.event}var C=F.srcElement;var D=(C&&C.ownerDocument)||document;var B=((Kijs_IsIE()<6)||(D.compatMode=="BackCompat"))?D.body:D.documentElement;var G=Kijs_IeDocElemOffset();H=F.clientY+(B.scrollTop||0)-G.y}catch(A){}return H}}function findPosX(A){var B=0;if(A.offsetParent){while(A.offsetParent){B+=A.offsetLeft;A=A.offsetParent}}else{if(A.x){B+=A.x}}return B}function findPosY(B){var A=0;if(B.offsetParent){while(B.offsetParent){A+=B.offsetTop;B=B.offsetParent}}else{if(B.y){A+=B.y}}return A}function HorisontalMetersToPixels(A,B,D){var C=D/B;return Math.round(A*C)}function VerticalMetersToPixels(B,C,A){var D=A/C;return Math.round(B*D)}function HorisontalPixelsToMeters(D,A,C){var B=A/C;return Math.round(D*B)}function VerticalPixelsToMeters(D,B,A){var C=B/A;return Math.round(D*C)}function FromPixelsToMeters(L,J,G,C,H,M,I,K){var F=HorisontalPixelsToMeters(L,H,I);var B=VerticalPixelsToMeters(J,M,K);var D=G+F;var A=C-B+M;return{x:D,y:A}}function FromMetersToPixels(G,C,F,B,H,K,I,J){var D=G-F;var A=B-C;var M=HorisontalMetersToPixels(D,H,I);var L=VerticalMetersToPixels(A,K,J);L+=J;return{x:M,y:L}}function MetersToPixels(D,B,A){var C=FromMetersToPixels(B,A,D.first_tile_x,D.first_tile_y,D.tile_width_meter,D.tile_height_meter,D.tile_width_pix,D.tile_height_pix);return{x:C.x,y:C.y}}function PixelsToMeters(D,B,A){var C=FromPixelsToMeters(B,A,D.first_tile_x,D.first_tile_y,D.tile_width_meter,D.tile_height_meter,D.tile_width_pix,D.tile_height_pix);return{x:C.x,y:C.y}}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,"")};function MyLeft(A){if(A==null){return false}return stripPx(A.style.left)}function MyTop(A){if(A==null){return false}return stripPx(A.style.top)}function stripPx(A){if(A==""){return 0}else{return parseFloat(A.substring(0,A.length-2))}}function CreateImageNoSelect(){var A=document.createElement("img");A.setAttribute("style","-moz-user-select: none; ");A.unselectable="on";return A}function GetJsonData(B){document.write("