var kijs_client_id="4D4Z";var kijs_dir="http://test.kartes.lv/kijs/";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.jpg";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="4";F.style.cursor="pointer";F.style.left="10px";F.style.bottom="10px";var D=document.createElement("div");A.viewableMap.appendChild(D);D.style.zIndex="4";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.fontWeight="bold";B.style.fontFamily="Arial";B.style.fontSize="12px";B.style.color="black";B.style.padding="0px";B.style.margin="0px";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 J="";var H=102;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"}}}}B.innerHTML=I}G();Kijs_SetOpacity(D,0.7)}function DomTable(C){this.table=document.createElement("table");C.appendChild(this.table);this.style=this.table.style;var B=0;var A=null;this.AddRow=function(){A=this.table.insertRow(B++);A.style.background="none";A.style.padding="0px";A.style.margin="0px"};this.AddCell=function(){if(A==null){return false}var D=document.createElement("td");A.appendChild(D);D.style.background="none";D.style.padding="0px";D.style.margin="0px";return D};this.AddCellText=function(F){var D=this.AddCell();var G=document.createElement("div");D.appendChild(G);G.innerHTML=F;return G};this.AddCellInput=function(G){var D=this.AddCell();var F=document.createElement("input");F.type="text";D.appendChild(F);F.style.width=G+"px";return F};this.AddCellInputWithText=function(H,G){var D=this.AddCell();var F=document.createElement("input");F.type="text";D.appendChild(F);F.style.width=H+"px";var I=document.createElement("span");D.appendChild(I);I.innerHTML=G;return F}}var kijs_weather_list=new Array();function KijsWeather(A){var H=this;var F=A.navigation_frame.AddButton(kijs_dir+"server_scripts/weather/weather_off.png",kijs_dir+"server_scripts/weather/weather_on.png",24,24,"Laika apstākļu slānis",I);function I(K){if(K==true){H.ShowImages()}else{H.HideImages()}}this.event_loaded=new Event();this.LoadImages=function(K){if(kijs_weather_list.length==0){A.loader.Show();call_back.LoadJson(kijs_dir+"/server_scripts/weather/get_data_json.php?kijs="+kijs_client_id,function(){K()})}else{K()}};this.ShowImages=function(){B=true;this.LoadImages(J)};this.HideImages=function(){B=false;G()};this.ShowButton=function(){F.style.display="block"};this.HideButton=function(){F.style.display="none"};var D=new Array();var C=new Array();var B=false;function J(){G();if(kijs_weather_list.length==0||B==false){A.loader.Hide();return }var K=A.MapCorners();A.loader.Show();for(var L=0;LK.x_min&&kijs_weather_list[L].xK.y_min&&kijs_weather_list[L].y100){this.value=100}if(this.value<1){this.value=1}F.svg.points.SetRadius(O,this.value)};W.AddRow();W.AddCellText("Līnijas krāsa");var N=W.AddCell();var V=new ColorPicker(N);V.event_color_changed.AddCallback(function(X){F.svg.points.SetStrokeColor(O,X.r,X.g,X.b)});W.AddRow();W.AddCellText("Līnijas platums");var J=W.AddCellInputWithText(30," (1-50)");J.maxLength=2;J.value=F.svg.points.GetStroke(O).width;J.onblur=function(){if(this.value>50){this.value=50}if(this.value<1){this.value=1}F.svg.points.SetStrokeWidth(O,this.value)};W.AddRow();W.AddCellText("Līnijas
caurspīdīgums");var T=W.AddCellInputWithText(30," (1-100)");T.maxLength=3;T.value=F.svg.points.GetStroke(O).color[3]*100;T.onblur=function(){if(this.value>100){this.value=100}if(this.value<1){this.value=1}F.svg.points.SetStrokeOpacity(O,this.value/100)};W.AddRow();W.AddCellText("Aizpildījuma krāsa");var N=W.AddCell();var V=new ColorPicker(N);V.event_color_changed.AddCallback(function(X){F.svg.points.SetFillColor(O,X.r,X.g,X.b)});W.AddRow();W.AddCellText("Aizpildījuma
caurspīdīgums");var M=W.AddCellInputWithText(30," (1-100)");M.maxLength=3;M.value=F.svg.points.GetFill(O)[3]*100;M.onblur=function(){if(this.value>100){this.value=100}if(this.value<1){this.value=1}F.svg.points.SetFillOpacity(O,this.value/100)};W.AddRow();var L=W.AddCell();var R=W.AddCell();R.align="right";var I=document.createElement("input");I.type="button";R.appendChild(I);I.value="Saglabāt";I.onclick=function(){B(O)};F.info_box.ShowNoContextChange(K,H,10,10)}catch(S){alert("Error SavePoint(). "+S.message)}};this.event_user_point_saved=new Event();function B(G){var H={};H.name=F.svg.points.GetCustomParameter(G,"name");H.description=F.svg.points.GetCustomParameter(G,"descr");H.stroke=F.svg.points.GetStroke(G);H.fill=F.svg.points.GetFill(G);H.point_id=G;H.x=F.svg.points.Get_LKS_X(G);H.y=F.svg.points.Get_LKS_Y(G);D.event_user_point_saved.Fire(H);F.info_box.Hide()}this.Show=function(S,I,G){F.info_box.Hide();F.info_box.context.innerHTML="";var T=new DomTable(F.info_box.context);T.AddRow();T.AddCellText("Nosaukums");var O=T.AddCellInput(200);O.value=F.svg.lines.GetCustomParameter(S,"name");O.onblur=function(){F.svg.lines.SetCustomParameter(S,"name",this.value)};T.AddRow();T.AddCellText("Apraksts");var R=T.AddCell();var M=document.createElement("textarea");R.appendChild(M);M.style.width="200px";M.style.height="35px";M.value=F.svg.lines.GetCustomParameter(S,"descr");M.onblur=function(){F.svg.lines.SetCustomParameter(S,"descr",this.value)};T.AddRow();T.AddCellText("Līnijas platums");var V=T.AddCellInputWithText(30," (1-50)");V.maxLength=2;V.value=F.svg.lines.GetStrokeWidth(S);V.onblur=function(){if(this.value>50){this.value=50}if(this.value<1){this.value=1}F.svg.lines.SetStrokeWidth(S,this.value)};T.AddRow();T.AddCellText("Līnijas krāsa");var L=T.AddCell();var U=new ColorPicker(L);U.event_color_changed.AddCallback(function(W){F.svg.lines.ChangeStrokeColor(S,W.r,W.g,W.b)});T.AddRow();T.AddCellText("Līnijas
caurspīdīgums");var P=T.AddCellInputWithText(30," (1-100)");P.maxLength=3;P.value=F.svg.lines.GetStrokeOpacity(S)*100;P.onblur=function(){if(this.value>100){this.value=100}if(this.value<1){this.value=1}F.svg.lines.SetStrokeOpacity(S,this.value/100)};if(F.svg.lines.GetFill(S)!=null){T.AddRow();T.AddCellText("Aizpildījuma krāsa");var L=T.AddCell();var K=new ColorPicker(L);K.event_color_changed.AddCallback(function(W){F.svg.lines.ChangeFillColor(S,W.r,W.g,W.b)});T.AddRow();T.AddCellText("Aizpildījuma
caurspīdīgums");var N=T.AddCellInputWithText(30," (1-100)");N.maxLength=3;N.value=F.svg.lines.GetFillOpacity(S)*100;N.onblur=function(){if(this.value>100){this.value=100}if(this.value<1){this.value=1}F.svg.lines.SetFillOpacity(S,this.value/100)}}T.AddRow();var J=T.AddCell();var Q=T.AddCell();Q.align="right";var H=document.createElement("input");H.type="button";Q.appendChild(H);H.value="Saglabāt";H.onclick=function(){A(S)};F.info_box.ShowNoContextChange(I,G,10,10)};this.event_user_line_saved=new Event();this.event_user_polygon_saved=new Event();function A(G){var I={};I.line_id=G;var H=F.svg.lines.GetLine(G).points;for(i=0;i=0&&B>=0&&I>=0&&G>=0){return{p1x:C,p1y:B,p2x:I,p2y:G}}else{var F=_GetXYCrosspoints(C,B,I,G);if(F.crossx<=0&&F.crossy<=0){return false}else{var A=null;var K=null;if(C>=0&&B>=0){A={x:C,y:B}}if(I>=0&&G>=0){if(A==null){A={x:I,y:G}}else{if(K==null){K={x:I,y:G}}}}if(F.crossy>=0&&((C>=0&&I<=0)||(I>=0&&C<=0))){if(A==null){A={x:0,y:F.crossy}}else{if(K==null){K={x:0,y:F.crossy}}}}if(F.crossx>=0&&((B>=0&&G<=0)||(G>=0&&B<=0))){if(A==null){A={x:F.crossx,y:0}}else{if(K==null){K={x:F.crossx,y:0}}}}A.x=Math.round(A.x);A.y=Math.round(A.y);K.x=Math.round(K.x);K.y=Math.round(K.y);var H=Math.abs(A.x-C);var D=Math.abs(K.x-I);if(H>D){var J=A;A=K;K=J}return{p1x:A.x,p1y:A.y,p2x:K.x,p2y:K.y}}}}}}}}}function _GetXYCrosspoints(B,A,D,C){if(A==0&&C==0){return{crossx:null,crossy:0}}else{if(B==0&&D==0){return{crossx:0,crossy:null}}else{var F=_GetLineEquation(B,A,D,C);return{crossx:-F.b/F.m,crossy:F.b}}}}function _GetLineEquation(D,C,G,F){var B=(F-C)/(G-D);var A=C-B*D;return{m:B,b:A}}function InfoBox(A){var C=A.GetWholeMap();var P=this;this.get_box_element=function(){return L};var L=document.createElement("div");C.appendChild(L);this.BoxStyle=function(){return L.style};this.SetClassName=function(Q){L.className=Q};L.style.color="black";L.style.padding="0px";L.style.backgroundColor="#FFFFFF";L.style.border="1px solid green";L.style.top="0px";L.style.left="0px";N(L,320,100);L.onmousedown=function(Q){if(!Q){var Q=window.event}Q.cancelBubble=true;if(Q.stopPropagation){Q.stopPropagation()}};L.style.display="none";L.style.position="absolute";L.style.zIndex="3";L.style.fontSize="12px";L.style.fontFamily="Tahoma";this.close_button_active_src=kijs_dir+"images/arrows/close_akt.gif";this.close_button_not_active_src=kijs_dir+"images/arrows/close_neakt.gif";var D=document.createElement("img");L.appendChild(D);D.src=this.close_button_not_active_src;D.onmouseover=function(){this.src=P.close_button_active_src};D.onmouseout=function(){this.src=P.close_button_not_active_src};D.onclick=function(){P.context.innerHTML="";L.style.display="none"};D.style.cursor="pointer";D.style.styleFloat="right";D.style.cssFloat="right";this.CloseButton=function(){return D};this.context=document.createElement("div");L.appendChild(this.context);this.context.style.padding="4px";function N(T,S,Q){var U=(S=="")?"":S+"px";var R=(Q=="")?"":Q+"px";T.style.width=U;if(kijs_user_browser.ie6==true&&kijs_user_browser.ie7==false){T.style.height=R}else{if(typeof document.documentElement.style.minHeight!="undefined"){T.style.minHeight=R}else{T.style.height=R}}}this.SetWidthHeight=function(R,Q){N(L,R,Q)};this.SetOpacity=function(Q){Kijs_SetOpacity(L,Q/100)};this.SetOpacity(100);this.Remove=function(){C.removeChild(L)};this.Hide=function(){L.style.display="none"};function O(){if(L.style.display=="none"){return false}else{return true}}var I=null;var H=null;var F=null;var B=null;this.show_in_map_frame=true;this.Show=function(S,Q,R,U,T){I=S;H=Q;this.context.innerHTML=R;F=U;B=T;M(this.show_in_map_frame)};this.ShowNoContextChange=function(R,Q,T,S){I=R;H=Q;F=T;B=S;M(this.show_in_map_frame)};function M(R){if(I!=null&&H!=null){L.style.visibility="hidden";L.style.display="block";var U=MetersToPixels(A,I,H);L.style.left=U.x+F+"px";L.style.top=U.y+B+"px";var T=(U.x+F)+A.GetWholeMapLeft();var S=(U.y+B)+A.GetWholeMapTop();if(T>A.GetWiewableMapWidth()/2&&R==true){L.style.left=U.x-stripPx(L.style.width)-F+"px"}if(S>A.GetWiewableMapHeight()/2&&R==true){L.style.top=U.y-L.offsetHeight-B+"px"}if(R==true){var V=stripPx(L.style.left)+A.GetWholeMapLeft();var Q=stripPx(L.style.top)+A.GetWholeMapTop();if(V<45){L.style.left=stripPx(L.style.left)-V+45+"px"}if(Q<35){L.style.top=stripPx(L.style.top)-Q+35+"px"}}L.style.visibility="visible"}}A.event_before_level_changed.AddCallback(G);var K=false;function G(Q){if(O()==true){P.Hide();K=true}}A.event_after_level_changed.AddCallback(J);function J(Q){if(K==true){M(false)}K=false}}var kijs_admin_iedal;var kijs_lt_address;var kijs_address;var kijs_nature;var kijs_apdz_viet;var kijs_streets;var kijs_terit_vien;function SearchBox(map){var me=this;this.search_lv=true;this.search_lt=false;var search_window=new Window(map);search_window.title.innerHTML=kijs_language.SearchAddress;this.Show=function(){search_window.Show()};this.address_point_right_click=new Event();this.HideSearchButton=function(){image.style.display="none"};this.ShowSearchButton=function(){image.style.display="block"};var image_src=kijs_dir+"images/search.png";var cel=map.navigation_frame.AddCell();var image=document.createElement("div");cel.appendChild(image);Kijs_SetDivAlfaSrc(image,image_src,24,24);image.title=kijs_language.SearchAddress;image.style.cursor="pointer";image.onclick=function(){search_window.ToggleDisplay()};var search_box=document.createElement("input");search_box.type="text";search_window.content.appendChild(search_box);search_box.value="rīgas 2";search_box.value=kijs_language.InputAddress;search_box.style.width="160px";search_box.style.margin="4px";search_box.style.fontFamily="Tahoma";search_box.style.fontSize="11px";search_box.onkeydown=function(e){if(KijsKeyCode(e)==13){Search(this.value);return false}};var search_button=document.createElement("input");search_button.type="button";search_window.content.appendChild(search_button);search_button.value=kijs_language.Search;search_button.style.margin="4px";search_button.style.fontFamily="Tahoma";search_button.style.fontSize="11px";search_button.onclick=function(){Search(search_box.value)};var results_head=document.createElement("div");search_window.content.appendChild(results_head);results_head.innerHTML="";results_head.style.height="10px";var results=document.createElement("div");search_window.content.appendChild(results);results.style.width="95%";results.style.height="220px";results.style.border="1px solid #C0C0C0";results.style.padding="0px";results.style.margin="4px";results.style.textAlign="left";results.style.overflow="auto";this.SearchAddress=function(query,callback){var country_query="&lv=";country_query+=(me.search_lv==true)?"1":"0";country_query+="<=";country_query+=(me.search_lt==true)?"1":"0";query=query.trim();query=BaltToEng(query);call_back.LoadJson(kijs_dir+"server_scripts/search.php?kijs="+kijs_client_id+"&r="+query.Trim()+"&q="+query+country_query,callback)};this.Search=Search;function Search(query){if(search_button.disabled==true){return }search_box.value=query;query=query.trim();query=BaltToEng(query);if(query!=""){var image="";results.innerHTML="
"+image+"
";kijs_admin_iedal=null;kijs_lt_address=null;kijs_address=null;search_button.disabled=true;var country_query="&lv=";country_query+=(me.search_lv==true)?"1":"0";country_query+="<=";country_query+=(me.search_lt==true)?"1":"0";call_back.LoadJson(kijs_dir+"server_scripts/search.php?kijs="+kijs_client_id+"&r="+query.Trim()+"&q="+query+country_query,Callback)}}var result_street_rows=new Array();var active_street_point_id=null;function RemoveStreetPoint(){if(active_street_point_id!=null){map.svg.points.Remove(active_street_point_id);active_street_point_id=null}}function Callback(){RemoveStreetPoint();results.innerHTML="";result_street_rows=new Array();active_street_point_id=null;var count=0;if(kijs_admin_iedal){count+=kijs_admin_iedal.data.length}if(kijs_address){count+=kijs_address.length}var total=0;if(kijs_admin_iedal){total+=kijs_admin_iedal.total}if(kijs_address){total+=kijs_address_count}results_head.innerHTML=kijs_language.Results+" "+count+" "+kijs_language.From+" "+total;if(kijs_streets==null&&kijs_admin_iedal==null&&kijs_lt_address==null&&kijs_address==null&&kijs_terit_vien==null){var foo_text=kijs_language.NoResults;results.innerHTML="
"+foo_text+"
"}PrintPointResults(kijs_language.PopulatedPlaces,kijs_apdz_viet.data,kijs_apdz_viet.total);PrintPointResults(kijs_language.Mountains,kijs_nature.hills.data,kijs_nature.hills.total);PrintDrawingResults(kijs_language.Lakes,kijs_nature.lakes.data,kijs_nature.lakes.total,me.ShowAndCenterLake);PrintDrawingResults(kijs_language.Rivers,kijs_nature.rivers.data,kijs_nature.rivers.total,me.ShowAndCenterRiver);var all_streets_data=new Array();var all_streets_total=kijs_streets.lv.total+kijs_streets.lt.total+kijs_streets.lv_riga.total+kijs_streets.ee_tallina.total+kijs_streets.lt_vilna.total;for(var i=0;i0){var list=CreateResultList(caption_text);for(var i=0;iN){O=N}if(M==null||M>L){M=L}}}D.ShowPoints([{x:G,y:P},{x:O,y:M}],4)}function B(G){D.ShowPoints([{x:kijs_temp_parish_min_max.min_x,y:kijs_temp_parish_min_max.min_y},{x:kijs_temp_parish_min_max.max_x,y:kijs_temp_parish_min_max.max_y}]);var H=kijs_dir+"server_scripts/admin_iedal/draw_image.php?i="+kijs_temp_parish_index;F=D.tile_manager.AddWmsLayer([H],false)}}var kijs_road_work_list=new Array();function KijsRoadWork(A){var H=this;var F=A.navigation_frame.AddButton(kijs_dir+"images/road_work.png",kijs_dir+"images/road_work_active.png",24,24,"Ceļu remontu slānis",I);function I(L){if(L==true){H.ShowImages()}else{H.HideImages()}}this.event_loaded=new Event();this.LoadImages=function(L){if(kijs_road_work_list.length==0){A.loader.Show();call_back.LoadJson(kijs_dir+"/server_scripts/remonti/get_data_json.php?kijs="+kijs_client_id,function(){L()})}else{L()}};this.ShowImages=function(){B=true;this.LoadImages(K)};this.HideImages=function(){B=false;G()};this.ShowButton=function(){F.style.display="block"};this.HideButton=function(){F.style.display="none"};var D=new Array();var C=new Array();var J=new Array();var B=false;function K(){G();if(kijs_road_work_list.length==0||B==false){A.loader.Hide();return }var L=A.MapCorners();A.loader.Show();if(A.zoom_level<=7){for(var N=0;NL.x_min&&kijs_road_work_list[N].xL.y_min&&kijs_road_work_list[N].y';this.topo_layer_active=false;this.switch_topo_button=H(200,"Topo","topo",I,"black",Array(kijs_dir+"server_scripts/topo/get_image.php"));this.ActivateTopo=function(){D(this.switch_topo_button,"topo")};this.ShowTopoButton=function(){this.switch_topo_button.style.display="block"};this.HideTopoButton=function(){this.switch_topo_button.style.display="none"};var B='';this.orto_layer_active=false;this.switch_orto_button=H(120,"Aerofoto","orto",B,"white",Array(kijs_dir+"server_scripts/orto/get_orto_foto.php"));this.ActivateOrto=function(){D(this.switch_orto_button,"orto")};this.ShowOrtoButton=function(){this.switch_orto_button.style.display="block"};this.HideOrtoButton=function(){this.switch_orto_button.style.display="none"};var K='';this.map_layer_active=false;this.switch_map_button=H(40,"Karte","map",K,"black",Array(kijs_dir+"get_map.php"));this.ActivateMap=function(){D(this.switch_map_button,"map")};this.ShowMapButton=function(){this.switch_map_button.style.display="block"};this.HideMapButton=function(){this.switch_map_button.style.display="none"};function D(M,L){if(M.my_active==true){return }G.topo_layer_active=(L=="topo")?true:false;G.orto_layer_active=(L=="orto")?true:false;G.map_layer_active=(L=="map")?true:false;J(M);if(A.main_wma_layer==null){A.main_wma_layer=A.tile_manager.AddWmsLayer(M.my_tile_array,true)}else{A.tile_manager.ChangeWmsSource(A.main_wma_layer,M.my_tile_array)}}function H(M,L,N,Q,P,O){var R=document.createElement("div");G.button_frame.appendChild(R);R.style.width="70px";R.style.fontSize="13px";R.style.fontFamily="Arial";R.style.backgroundColor="white";R.style.border="1px solid black";R.style.cursor="pointer";R.style.textAlign="center";R.style.display="none";R.style.styleFloat="right";R.style.cssFloat="right";R.innerHTML=L;R.my_active=false;R.my_text=Q;R.my_text_color=P;R.my_tile_array=O;R.onclick=function(){D(this,N)};C.push(R);return R}function J(M){for(var L=0;LM){l=M}P.style.top=l+"px"}}function Q(k){if(L==true){L=false;Y()}}function I(){return V(stripPx(P.style.top)+((P.height-1)/2))}function V(o){var m=-1;var l=1000;for(var n=0;nK.length){m=K.length-1}var k=K[m]-((P.height-1)/2);P.style.top=k+"px"}catch(l){log("Error at ZoomTool.SetLevel("+m+") "+l.message)}}U(C);S.event_after_level_changed.AddCallback(d);function d(k){try{W(k.new_level)}catch(l){log("Error at GlobalChangedLevel("+k+") "+l)}}}var kijs_traffic_index=null;var kijs_traffic_data=null;function Traffic(A){var J=A.navigation_frame.AddCell();var F=document.createElement("div");J.appendChild(F);F.src_off=kijs_dir+"images/btn_traffic_off.png";F.src_on=kijs_dir+"images/btn_traffic_on.png";Kijs_SetDivAlfaSrc(F,F.src_off,24,24);F.title=kijs_language.Traffic;F.style.cursor="pointer";F.onclick=function(){G()};var O=Array();var H=false;function G(){if(H==false){C()}else{N()}}this.ShowTrafficLayer=C;function C(){A.loader.Show();H=true;Kijs_SetDivAlfaSrc(F,F.src_on,24,24);call_back.LoadJson(kijs_dir+"server_scripts/traffic/get_traffic_info.php?kijs="+kijs_client_id,function(){try{if(1==1&&kijs_traffic_index!=null){D();M();var Q=kijs_dir+"server_scripts/traffic/draw_image.php?i="+kijs_traffic_index;L=A.tile_manager.AddWmsLayer([Q],false);I()}if(1==2&&kijs_traffic_data!=null){for(var P=0;P=0;P--){A.svg.lines.DeletePolyLine(O[P]);O.remove(P)}}function D(){if(L!=-1){A.tile_manager.RemoveWmsLayer(L);L=-1}}function I(){if(kijs_traffic_index==null){return }if(H==false){return }A.loader.Show();M();if(A.zoom_level<=2){if(L!=-1){}var P=A.MapCorners();for(var Q=0;Q";V+="
Pēdējais caurbraukšanas laiks: "+Math.round(P.last_drive_time/60*10)/10+"min";V+="
Ticamība: ";if(P.auto_count<1){V+="nav datu"}else{if(P.auto_count<3){V+="zema"}else{if(P.auto_count<5){V+="laba"}else{if(P.auto_count<7){V+="augsta"}else{V+="ļoti augsta"}}}}V+="
Normālais caurbraukšanas laiks: "+Math.round(P.normal_drive_time/60*10)/10+"min";V+="
Datums: "+P.date+"";A.svg.lines.SetCustomParameter(R,"mouse_over_text",V);A.svg.lines.AddEventMouseOver(R,function(X){var W=A.svg.lines.GetCustomParameter(X,"mouse_over_text");A.tooltip.Show(W)});A.svg.lines.AddEventMouseOut(R,function(){A.tooltip.Hide()})}}function JanaSetaMap(u,S){var V=this;this.viewableMap=null;if(S){switch(S){case"lv":kijs_language=kijs_lan_lv;break;case"ru":kijs_language=kijs_lan_ru;break;case"en":kijs_language=kijs_lan_en;break;case"lt":kijs_language=kijs_lan_lt;break;case"de":kijs_language=kijs_lan_de;break}}if(document.addEventListener){document.addEventListener("mouseup",K,false);document.addEventListener("mousemove",g,false)}else{if(document.attachEvent){document.attachEvent("onmouseup",K);document.attachEvent("onmousemove",g)}}var C=false;this.DetachMouseMove=function(){return ;C=true};this.AttachMouseMove=function(){C=false};this.event_mouse_move=new Event();var w=new Kijs_ThreadControl();w.timeout=100;function g(AC,AE,AD){if(!AE){AE=pointerX(AC)}if(!AD){AD=pointerY(AC)}if(w.Start(g,AC,AE,AD)==false){return false}if(C==false){V.event_mouse_move.Fire({pointer_x:AE,pointer_y:AD,offset_x:findPosX(V.viewableMap),offset_y:findPosY(V.viewableMap)})}w.End()}this.event_mouse_up=new Event();this.event_click=new Event();var L={time:0,x:0,y:0};function K(AE){var AD=pointerX(AE);var AC=pointerY(AE);V.event_mouse_up.Fire({pointer_x:AD,pointer_y:AC});if((new Date()).getTime()-L.time<500&&L.x==AD&&L.y==AC){V.event_double_click.Fire({pointer_x:AD,pointer_y:AC})}else{if(I==AD&&G==AC){V.event_click.Fire({pointer_x:AD,pointer_y:AC})}}L={time:(new Date()).getTime(),x:AD,y:AC}}this.event_document_mouse_down=new Event();function a(AC){V.event_document_mouse_down.Fire({pointer_x:pointerX(AC),pointer_y:pointerY(AC),offset_x:findPosX(V.viewableMap),offset_y:findPosY(V.viewableMap)})}this.event_resize=new Event();var c=window.onresize;window.onresize=k;var AB=document.body.clientWidth;function k(AC){if(AB!=document.body.clientWidth){if(c!=null){c(AC)}V.event_resize.Fire();AB=document.body.clientWidth}}this.event_double_click=new Event();function q(AC){V.event_double_click.Fire({pointer_x:pointerX(AC),pointer_y:pointerY(AC)})}this.event_left_click=new Event();this.event_right_click=new Event();this.zoom_tool=null;var B=null;this.GetWholeMap=function(){return B};this.svg=null;this.tooltip=null;this.menu=null;this.info_box;this.save_box;this.image_layer;this.ruler;this.route;this.adm_vien;this.region_zoom;this.navigation_frame=null;this.navigation_controls;this.loader;this.wms_control;this.event_map_mouse_down=new Event();this.zoom_level;this.tile_width_meter=null;this.tile_height_meter=null;this.tile_width_pix=300;this.tile_height_pix=300;this.first_tile_x=null;this.first_tile_y=null;var p=null;var o=null;this.logo_and_scale=null;this.GetScaleMeters=function(){if(this.logo_and_scale!=null){return this.logo_and_scale.scale_in_meters}else{return 0}};this.event_map_mouse_static_click=new Event;var x=null,v=null,O=0;this.event_map_mouse_down.AddCallback(AA);function AA(AC){x=AC.pointer_x;v=AC.pointer_y;O=0}this.event_mouse_move.AddCallback(function(AD){if(x==null){return }var AC=Math.abs(x-AD.pointer_x);var AE=Math.abs(v-AD.pointer_y);O=(AC>O)?AC:O;O=(AE>O)?AE:O});this.event_mouse_up.AddCallback(function(AC){if(x==null){return }if(O==0){V.event_map_mouse_static_click.Fire({pointer_x:AC.pointer_x,pointer_y:AC.pointer_y})}x=null;v=null;O=0});V.viewableMap=E(u);V.viewableMap.innerHTML="";V.viewableMap.style.overflow="hidden";V.viewableMap.style.backgroundColor="#E4E4E4";V.viewableMap.style.position="relative";this.Load=function(AF,AD,AC){try{if(V.viewableMap.style.zIndex==""){V.viewableMap.style.zIndex=10}V.viewableMap.ondblclick=q;this.event_resize.AddCallback(function(){T()});V.viewableMap.oncontextmenu=function(AG){Kijs_StopEvent(AG);V.event_left_click.Fire({pointer_x:pointerX(AG),pointer_y:pointerY(AG)});V.event_right_click.Fire({pointer_x:pointerX(AG),pointer_y:pointerY(AG)})};B=document.createElement("div");V.viewableMap.appendChild(B);B.style.position="relative";B.style.left="0px";B.style.top="0px";B.onmousemove=function(){return false};b(AF);h(AD,AC);String.prototype.Trim=String.prototype.TrimTo;this.logo_and_scale=new LogoAndScale(this);this.zoom_tool=new ZoomTool(this,this,AF);this.svg=new SvgClass(B,this);this.tooltip=new Tooltip(this);this.info_box=new InfoBox(this);this.menu=new ContextMenu(this);this.save_box=new SaveBox(this);this.image_layer=new ImageLayer(this);this.route=new RouteClass(this);this.region_zoom=new RegionZoom(this);this.adm_vien=new AdminVienShow(this);this.navigation_frame=new NavigationRow(this);this.navigation_controls=new NavigationControls(this);this.ruler=new Ruler(this);this.loader=new KijsLoader(this);this.wms_control=new WmsControl(this);M();Z(B);B.onmousedown=X;this.event_mouse_move.AddCallback(J);this.event_mouse_up.AddCallback(s);Q(this.MapActionType.Move);if(kijs_user_browser.ie==true){V.viewableMap.onresize=function(){V.event_resize.Fire()}}else{setInterval(function(){if(V.viewableMap.my_last_resize_width!=false&&V.viewableMap.my_last_resize_height!=false){if(V.viewableMap.my_last_resize_width!=V.viewableMap.clientWidth||V.viewableMap.my_last_resize_height!=V.viewableMap.clientHeight){V.event_resize.Fire()}}V.viewableMap.my_last_resize_width=V.viewableMap.clientWidth;V.viewableMap.my_last_resize_height=V.viewableMap.clientHeight},500)}this.svg.points.event_svg_layer_mouse_down.AddCallback(AA)}catch(AE){log("Error JanaSetaMap.Load(): "+AE+", "+AE.name+", "+AE.message)}};this.MapActionType={Move:1,Line:2,Polygon:3,Point:4,Ruler:5,ZoomRegion:6};this.MapAction=this.MapActionType.Move;this.MoveMap=function(){Q(V.MapActionType.Move)};this.ZoomMapRegion=function(){Q(V.MapActionType.ZoomRegion)};this.DrawLine=function(){Q(V.MapActionType.Line)};this.DrawPolygon=function(){Q(V.MapActionType.Polygon)};this.DrawPoint=function(){Q(V.MapActionType.Point)};this.DrawRuler=function(){Q(V.MapActionType.Ruler)};this.event_map_action_type_changed=new Event();function Q(AC){V.MapAction=AC;V.event_map_action_type_changed.Fire(AC)}this.last_draw_polygon_id=null;this.event_finished_line_drawing=new Event();this.event_finished_polygon_drawing=new Event();this.event_finished_point_drawing=new Event();this.event_start_panning=new Event();this.default_point_radius=10;this.default_point_fill=[240,10,10,0.7];this.default_point_stroke={color:[250,250,250,1],width:2};this.skip_one_drag=false;var Y=false;var I=0;var G=0;var d=0;var H=0;function X(AE){d=m();H=R();var AH=pointerX(AE);var AG=pointerY(AE);V.event_map_mouse_down.Fire({pointer_x:AH,pointer_y:AG,offset_x:findPosX(V.viewableMap),offset_y:findPosY(V.viewableMap)});if(V.MapAction==V.MapActionType.Line){Q(V.MapActionType.Move);var AD=V.svg.lines.AddPolyLineMovable({color:[63,78,212,1],width:4});var AF=V.svg.LayerCoords(AH,AG);V.svg.lines.DrawNextPoint(AD);V.svg.lines.AddEventClick(AD,function(AJ,AI){V.event_finished_line_drawing.Fire({id:AJ,x:AI.meter_x,y:AI.meter_y})});V.svg.lines.AddEventStopedDrawing(AD,function(AJ,AI){V.event_map_action_type_changed.Fire(V.MapActionType.Move);V.event_finished_line_drawing.Fire({id:AJ,x:AI.meter_x,y:AI.meter_y})})}else{if(V.MapAction==V.MapActionType.Polygon){Q(V.MapActionType.Move);var AD=V.svg.lines.AddPolygonMovable({color:[63,78,212,1],width:4},[10,181,30,0.3]);var AF=V.svg.LayerCoords(AH,AG);V.svg.lines.DrawNextPoint(AD);V.svg.lines.AddEventClick(AD,function(AJ,AI){V.event_finished_polygon_drawing.Fire({id:AJ,x:AI.meter_x,y:AI.meter_y})});V.svg.lines.AddEventStopedDrawing(AD,function(AJ,AI){V.event_map_action_type_changed.Fire(V.MapActionType.Move);V.event_finished_polygon_drawing.Fire({id:AJ,x:AI.meter_x,y:AI.meter_y})});V.last_draw_polygon_id=AD}else{if(V.MapAction==V.MapActionType.Point){Q(V.MapActionType.Move);var AF=V.svg.LayerCoords(AH,AG);var AC=V.svg.points.AddMovable(AF.x_meter,AF.y_meter,V.default_point_radius,V.default_point_fill,V.default_point_stroke);V.event_finished_point_drawing.Fire({id:AC,x:AF.x_meter,y:AF.y_meter});V.svg.points.AddEventClick(AC,function(AJ,AI){V.event_finished_point_drawing.Fire({id:AJ,x:AI.meter_x,y:AI.meter_y})})}else{if(V.MapAction==V.MapActionType.Ruler){Q(V.MapActionType.Move);V.ruler.StartDraw()}else{if(V.skip_one_drag==true){V.skip_one_drag=false}else{if(V.MapAction==V.MapActionType.ZoomRegion){}else{if(V.MapAction==V.MapActionType.Move){V.event_start_panning.Fire();Y=true;I=AH;G=AG}}}}}}}return false}this.event_stoped_paning=new Event();this.event_stoped_paning_map_moved=new Event();function s(AC){if(Y==true){Y=false;V.event_stoped_paning.Fire(AC);if(I!=AC.pointer_x||G!=AC.pointer_y){V.event_stoped_paning_map_moved.Fire(AC)}T()}}this.event_panning=new Event();function J(AC){if(Y){V.event_panning.Fire(AC);var AE=H+(AC.pointer_x-I);var AD=d+(AC.pointer_y-G);B.style.left=AE+"px";B.style.top=AD+"px"}}function m(){return stripPx(B.style.top)}function R(){return stripPx(B.style.left)}this.GetWholeMapTop=m;this.GetWholeMapLeft=R;function t(){return V.viewableMap.clientWidth}function W(){return V.viewableMap.clientHeight}this.GetWiewableMapWidth=t;this.GetWiewableMapHeight=W;var e=false;var U=null;var P=null;var z=null;var F=null;this.Refresh=T;function T(){var AC=R();var AF=m();var AG=t();var AE=W();if(P==null||U==null){P=AF;U=AC}var AD=false;if(Math.abs(P-AF)>30){AD=true}else{if(Math.abs(U-AC)>30){AD=true}else{if(z!=AG){AD=true}else{if(F!=AE){AD=true}}}}if(AD==true){if(e==false){e=true;V.tile_manager.RemoveNoneVisibleTiles();M();P=AF;U=AC;z=AG;F=AE;e=false}}}var D=0;var N=0;this.CalcVisibleTiles=M;function M(){D=Math.ceil(t()/V.tile_width_pix);N=Math.ceil(W()/V.tile_height_pix);var AH=-Math.ceil((R()/V.tile_width_pix));var AE=-Math.ceil((m()/V.tile_height_pix));var AC=AH+D;var AG=AE+N;var AD=AE+Math.ceil(N/2)-0;var AF=AH+Math.ceil(D/2)-0;r(AD,AF)}this.event_before_center_changed=new Event();this.event_after_center_changed=new Event();this.ChangeLevelAndCenter=function(AG,AE,AC){try{var AD=b(AG);if(AD==true){this.event_before_level_changed.FireNoThread({new_level:V.zoom_level});this.event_before_center_changed.Fire();h(AE,AC);f();this.event_after_level_changed.Fire({new_level:V.zoom_level});this.event_after_center_changed.Fire({x:AE,y:AC})}else{this.SetCenter(AE,AC)}}catch(AF){log("Error JanaSetaMap.ChangeLevelAndCenter(): "+AF+", "+AF.name+", "+AF.message)}};this.SetCenter=function(AD,AC){this.event_before_center_changed.Fire();h(AD,AC);f();this.event_after_center_changed.Fire({x:AD,y:AC})};function h(AF,AE){try{V.first_tile_x=Math.floor(AF/V.tile_height_meter)*V.tile_height_meter;V.first_tile_y=Math.floor(AE/V.tile_width_meter)*V.tile_width_meter;p=HorisontalMetersToPixels(AF-V.first_tile_x,V.tile_width_meter,V.tile_width_pix);o=VerticalMetersToPixels(AE-V.first_tile_y,V.tile_height_meter,V.tile_height_pix);var AC=t()/2;var AD=W()/2;B.style.left=(AC-p)+"px";B.style.top=(AD-(V.tile_height_pix-o))+"px"}catch(AG){log("Error JanaSetaMap.SetCenterLocal(): "+AG+", "+AG.name+", "+AG.message)}}this.GetCenter=y;function y(){try{if(V.first_tile_x==null){return false}var AI=R()-t()/2;var AD=m()-W()/2;var AF=HorisontalPixelsToMeters(AI,V.tile_width_meter,V.tile_width_pix);var AG=VerticalPixelsToMeters(AD,V.tile_height_meter,V.tile_height_pix);var AC=V.first_tile_x-AF;var AE=V.first_tile_y+AG+V.tile_height_meter;return{x:AC,y:AE}}catch(AH){log("Error JanaSetaMap.GetCenter(): "+AH+", "+AH.name+", "+AH.message)}}this.SetLevel=b;function b(AC){try{AC=Math.round(AC);if(AC<-2){AC=-2}if(AC>11){AC=11}if(V.zoom_level!=AC){V.zoom_level=AC;var AE=V.GetLevelInfo(AC);V.tile_width_meter=AE.tile_width_meter;V.tile_height_meter=AE.tile_height_meter;return true}else{return false}}catch(AD){log("Error map.SetLevel("+AC+"): "+AD+", "+AD.name+", "+AD.message)}}this.first_level_meters=220;this.GetLevelInfo=function(AH){try{var AG=this.first_level_meters*Math.pow(2,AH);var AC=this.first_level_meters*Math.pow(2,AH);var AE=HorisontalPixelsToMeters(t(),AG,V.tile_width_pix);var AD=VerticalPixelsToMeters(W(),AC,V.tile_height_pix);return{tile_width_meter:AG,tile_height_meter:AC,map_width_meter:AE,map_height_meter:AD}}catch(AF){log("Error map.GetLevelInfo("+value+"): "+AF.name+", "+AF.message)}};this.LoadImageTilesFromCenter=r;function r(AI,AE){try{var AJ=Math.max(D,N)+4;V.tile_manager.NeedTile(AI,AE);var AF=0;for(var AH=1;AH<=AJ;AH++){for(var AC=0;AC<2;AC++){for(var AD=0;ADAC&&AG.map_height_meter>AF){break}}return AD};this.BestView=function(AL){var AI=null;var AE=null;var AH=null;var AC=null;for(var AG=0;AGAI){AI=AL[AG].x}if(AE==null||AL[AG].xAH){AH=AL[AG].y}if(AC==null||AL[AG].y.kijs_pointer{cursor: pointer;}");document.write("");function SvgPoints(B,O,D){var C=Array();var X=this;this.Get_LKS_X=function(a){return C[a].lks_x};this.Get_LKS_Y=function(a){return C[a].lks_y};this.Add=function(e,d,a,c,b){return P(e,d,a,c,b,false)};this.AddMovable=function(e,d,a,c,b){return P(e,d,a,c,b,true)};function P(h,g,a,k,l,m){var f=Kijs_Clone(k);var d=Kijs_Clone(l);try{var c=C.length;C.push({type:"circle",lks_x:h,lks_y:g,cx:-1,cy:-1,r:a,fill:f,stroke:d,object:null,mouse_over:null,mouse_out:null,point_moving:null,point_moving_args:null,point_moved:null,point_clicked:null,left_click:null,left_click_args:null,movable:m,last_position:null,belongs_to_line_id:null,usage_type:""});X.Draw(c);return c}catch(b){log("Error SvgPoints.AddMain(): "+b+", "+b.name+", "+b.message)}}this.AddImage=function(g,e,c,a,f,d,b){return U(g,e,c,a,f,d,b,false)};this.AddImageMovable=function(g,e,c,a,f,d,b){return U(g,e,c,a,f,d,b,true)};function U(g,f,b,h,a,d,c,k){var e=C.length;C.push({type:"image",lks_x:g,lks_y:f,x:-1,y:-1,width:b,height:h,src:a,offset_x:d,offset_y:c,object:null,mouse_over:null,mouse_out:null,point_moving:null,point_moving_args:null,point_moved:null,point_clicked:null,left_click:null,left_click_args:null,movable:k,last_position:null});X.Draw(e);return e}this.Remove=function(a){if(ab&&g>b){var c=null;if(d.type=="circle"){c=O.createCircle({cx:a,cy:g,r:d.r}).setFill(d.fill).setStroke(d.stroke)}else{if(d.type=="image"){c=O.createImage({x:a,y:g,width:d.width,height:d.height,src:d.src})}}c.getEventSource().setAttribute("circle_id",h);Kijs_AddClass(c.getEventSource(),"kijs_pointer");C[h].object=c}else{}}}}catch(f){log("Error SvgPoints.Draw(): "+f.name+", "+f.message)}};function I(e){var b=C[e];if(b!=null){var c=MetersToPixels(D.parent,b.lks_x,b.lks_y);var a=c.x-MyLeft(B);var d=c.y-MyTop(B);if(b.type=="circle"){C[e].cx=a;C[e].cy=d}else{if(b.type=="image"){C[e].x=a;C[e].y=d}}}}this.RedrawPoints=function(){for(var a=0;a0){e+=","}var c=d.stroke.color;e+="{x:"+d.lks_x+",y:"+d.lks_y+",r:"+d.r+",fill:["+d.fill[0]+","+d.fill[1]+","+d.fill[2]+","+d.fill[3]+"]";e+=",stroke:{color:["+c[0]+","+c[1]+","+c[2]+","+c[3]+"],width:"+d.stroke.width+"}";e+=',name:"'+this.GetCustomParameter(a,"name").replace(/"/g,'\\"')+'"';e+=',descr:"'+this.GetCustomParameter(a,"descr").replace(/"/g,'\\"')+'"';e+="}";b++}e+="]";return e};this.event_object_loaded_from_status_string=new Event();this.LoadStatusString=function(c){for(var a=0;a.kijs_noprint{display:none;visibility:hidden;width:0px;height:0px;}");document.write("");function SvgClass(H,D){var F=this;this.parent=D;this.whole_map=H;this.test="test";var B=document.createElement("div");B.style.position="absolute";B.style.zIndex=2;H.appendChild(B);if(kijs_user_browser.ff==true&&kijs_user_browser.ff3==false){B.className="kijs_noprint"}if(kijs_user_browser.op==true){B.className="kijs_noprint"}Kijs_Require("dojox.gfx");var G=Kijs_CreateSurface(B,3000,3000);B.style.top="-500px";B.style.left="-500px";var F=this;this.points=new SvgPoints(B,G,this);this.lines=new SvgPolyLine(B,G,this);D.event_before_level_changed.AddCallback(A);D.event_before_center_changed.AddCallback(A);function A(I){B.style.visibility="hidden"}D.event_after_level_changed.AddCallback(C);D.event_after_center_changed.AddCallback(C);D.event_stoped_paning_map_moved.AddCallback(C);this.Refresh=C;function C(I){B.style.visibility="hidden";B.style.left=(-1*MyLeft(F.whole_map)-500)+"px";B.style.top=(-1*MyTop(F.whole_map)-500)+"px";B.style.visibility="visible";F.lines.RedrawPolyLines();F.points.RedrawPoints()}this.LayerCoords=function(R,Q){var K=D.viewableMap;var I=findPosX(K);var V=findPosY(K);var M=R-I;var L=Q-V;M-=MyLeft(this.whole_map);L-=MyTop(this.whole_map);var P=M-MyLeft(B);var O=L-MyTop(B);var T=R-I;var S=Q-V;var U=PixelsToMeters(D,M,L);var N=U.x;var J=U.y;return{pix_x:P,pix_y:O,x_meter:N,y_meter:J}}}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("