var kijs_client_id="5RF6";var kijs_dir="http://test.kartes.lv/kijs/";function NavigationControls(G){var C=this;this.hand_image_on=kijs_dir+"images/hand_on.png";this.hand_image_off=kijs_dir+"images/hand_off.png";var F=G.navigation_frame.AddCell();var B=document.createElement("div");F.appendChild(B);Kijs_SetDivAlfaSrc(B,this.hand_image_off,24,24);B.title=kijs_language.MoveMap;B.style.cursor="pointer";B.onclick=function(){G.MoveMap()};this.zoom_region_on=kijs_dir+"images/region_zoom_on.png";this.zoom_region_off=kijs_dir+"images/region_zoom_off.png";var A=G.navigation_frame.AddCell();var D=document.createElement("div");A.appendChild(D);Kijs_SetDivAlfaSrc(D,this.zoom_region_off,24,24);D.title=kijs_language.ZoomRegion;D.style.cursor="pointer";D.onclick=function(){G.ZoomMapRegion()};G.event_map_action_type_changed.AddCallback(H);function H(I){Kijs_SetDivAlfaSrc(B,C.hand_image_off);Kijs_SetDivAlfaSrc(D,C.zoom_region_off);switch(I){case G.MapActionType.Move:Kijs_SetDivAlfaSrc(B,C.hand_image_on);break;case G.MapActionType.ZoomRegion:Kijs_SetDivAlfaSrc(D,C.zoom_region_on);break}}this.HidePanningButton=function(){B.style.display="none";F.style.display="none"};this.HideZoomRegion=function(){D.style.display="none";A.style.display="none"};this.ShowPanningButton=function(){B.style.display="block";F.style.display="block"};this.ShowZoomRegion=function(){D.style.display="block";A.style.display="block"}}function RouteMain(D){var C=this;this.event_route_complete=new Event();var A=Array();this.GetRoute=function(G,I){if(G.length<2){C.event_route_complete.Fire(null);return }var K="";var J="";for(var F=0;F0){K+=",";J+=","}K+=""+G[F].x;J+=""+G[F].y;A.push({x:G[F].x,y:G[F].x})}var H=kijs_dir+"server_scripts/route.php?kijs="+kijs_client_id+"&r="+(K+","+J).Trim();H+="&x="+K+"&y="+J;if(I&&I.optimise){H+="&optimise="+I.optimise}call_back.LoadJson(H,B)};this.GetOptimizedRoute=function(F){};function B(){C.event_route_complete.Fire({minutes:kijs_route.t,meters:kijs_route.l,points:kijs_route.p,waypoints:kijs_route.w})}}function RouteClass(A){var L=this;this.event_route_complete=new Event();var G=Array();var F=5;var Q=[250,30,30,0.8];var N={color:[255,255,255,0.8],width:2};var C=Array();var K=null;this.Clear=function(){for(var S=0;S0){W+=",";V+=","}W+=""+T[S].x;V+=""+T[S].y;G.push({x:T[S].x,y:T[S].x})}var U=kijs_dir+"server_scripts/route.php?kijs="+kijs_client_id+"&r="+(W+","+V).Trim();U+="&x="+W+"&y="+V;call_back.LoadJson(U,H)};function H(){if(K!=null){A.svg.lines.DeletePolyLine(K);K=null}var T=Math.round(kijs_route.l*1/100)/10;K=A.svg.lines.AddPolyLine({color:[63,78,212,1],width:3});A.svg.lines.GetLine(K).usage_type="route";A.svg.lines.AddPoints(K,kijs_route.p);var U=kijs_language.Distance+": "+T+""+kijs_language.kilometers+", "+kijs_language.DriveTime+": "+KijsParseMinutes(kijs_route.t)+""+kijs_language.minutes+"";A.svg.lines.GetLine(K).mouse_over=function(){A.tooltip.Show(U)};A.svg.lines.GetLine(K).mouse_out=function(){A.tooltip.Hide()};for(var S=0;S0&&wms_frame.style.display=="none"){wms_buttone.style.display="block"}else{wms_buttone.style.display="none"}if(list_table_object!=null){KijsRemoveObject(list_table_object.table);list_table_object=null}list_table_object=new DomTable(wms_layers_frame);for(var i=0;i100){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.description=H.description.replace(/\r\n|\n/ig,"
");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");if(F.svg.lines.GetFill(G)!=null){I.fill=F.svg.lines.GetFill(G);D.event_user_polygon_saved.Fire(I)}else{D.event_user_line_saved.Fire(I)}F.info_box.Hide()}}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.borderRadius="6px";L.style.MozBorderRadius="6px";L.style.WebkitBorderRadius="6px";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=A.viewableMap.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";D.style.display="block";D.style.marginTop="2px";D.style.marginRight="2px";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_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){A.tile_manager.RemoveWmsLayer(L);L=-1}var P=A.MapCorners();for(var R=0;R";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+"";V+="
Vidējais caurbraukšanas laiks
darba dienās minūtēs šomēnesī:
";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 Tooltip(D){var C=document.createElement("div");C.style.border="1px solid #336600";C.style.position="absolute";C.style.top="1px";C.style.left="1px";C.style.padding="2px 4px 2px 4px";C.style.fontFamily="Tahoma";C.style.fontSize="12px";C.style.backgroundColor="#FFFFCC";C.style.display="none";C.style.whiteSpace="nowrap";C.style.zIndex=D.viewableMap.style.zIndex+3;document.body.appendChild(C);this.style=C.style;A(C,20,10);function A(H,G,F){if(typeof document.documentElement.style.minWidth!="undefined"){H.style.minWidth=G+"px"}else{H.style.width=G+"px"}if(typeof document.documentElement.style.minHeight!="undefined"){H.style.minHeight=F+"px"}else{H.style.height=F+"px"}}D.event_mouse_move.AddCallback(B);function B(F){if(C.style.display=="block"&&1==2){return }else{var H=0;var G=0;if((C.clientWidth+F.pointer_x+30)>document.body.clientWidth){H=(document.body.clientWidth-C.clientWidth)-10;G=F.pointer_y+20}else{H=(F.pointer_x+20)-10;G=F.pointer_y+0}if((C.clientHeight+F.pointer_y+30)>document.body.clientHeight){G=document.body.clientHeight-C.clientHeight-20}C.style.left=H+"px";C.style.top=G+"px"}}this.Show=function(F){C.innerHTML=F;C.style.visibility="hidden";C.style.display="block";var H=stripPx(C.style.left);var G=stripPx(C.style.top);if((C.clientWidth+stripPx(C.style.left)+30)>document.body.clientWidth){H=(document.body.clientWidth-C.clientWidth)-10;G=stripPx(C.style.top)+20}if((C.clientHeight+stripPx(C.style.top)+30)>document.body.clientHeight){G=document.body.clientHeight-C.clientHeight-20}C.style.left=H+"px";C.style.top=G+"px";C.style.visibility="visible"};this.Hide=function(){C.style.display="none"};D.event_before_level_changed.AddCallback(this.Hide);D.event_before_center_changed.AddCallback(this.Hide)}function Kijs_Lks_2_LatLon(H,F){H*=1;F*=1;F-=55;var Q=0,l=0;var M=0.9996;var P=500000;var J=0;var T,K,g,B,h,S,b,Z,D,C,A;var k,d,I,L,R,G,N,U,W,O;Z=1/298.257222101;h=6378137;b=Math.sqrt(2*Z-Z*Z);L=Math.sqrt(b*b+Math.pow(b,4)/(1-b*b));K=F-J;T=H-P;S=K/M;D=1-((b*b)/4)-((3*Math.pow(b,4))/64)-((5*Math.pow(b,6))/256);C=(3/8)*(b*b+Math.pow(b,4)/4+(15*Math.pow(b,6))/128);A=(15/256)*(Math.pow(b,4)+(3*Math.pow(b,6))/4);k=(35*Math.pow(b,6))/3072;B=S/(h*D);do{W=h*D*B-h*C*Math.sin(2*B)+h*A*Math.sin(4*B)-h*k*Math.sin(6*B);B=B+(S-W)/30.81851/3600*Math.PI/180}while(Math.abs(S-W)<=0.001);g=24*Math.PI/180;d=h/Math.sqrt(1-b*b);O=Math.cos(B);I=Math.sqrt(1+Math.pow(L,2)*Math.pow(O,2));R=d/Math.pow(I,3);G=d/I;N=Math.tan(B);U=G/R;D=B-N/(M*R)*Math.pow(T,2)/(2*M*G);C=N/(M*R)*Math.pow(T,4)/(24*Math.pow(M,3)*Math.pow(G,3))*(-4*Math.pow(U,3)+9*U*(1-N*N)+12*N*N);A=N/(M*R)*Math.pow(T,6)/(720*Math.pow(M,5)*Math.pow(G,5))*(8*Math.pow(U,4)*(11-24*N*N)-12*Math.pow(U,3)*(21-71*N*N)+15*U*U*(15-98*N*N+15*Math.pow(N,4))+180*U*(5*N*N-3*Math.pow(N,4))+360*Math.pow(N,4));k=N/(M*R)*Math.pow(T,8)/(40320*Math.pow(M,7)*Math.pow(G,7))*(1385+3633*N*N+4095*Math.pow(N,4)+1575*Math.pow(N,6));Q=(D+C+A+k)*180/Math.PI;W=1/O;D=W*T/(M*G);C=W*Math.pow(T,3)/(6*Math.pow(M,3)*Math.pow(G,3))*(U+2*N*N);A=W*Math.pow(T,5)/(120*Math.pow(M,5)*Math.pow(G,5))*(-4*Math.pow(U,3)*(1-6*N*N)+U*U*(9-68*N*N)+72*U*N*N+24*Math.pow(N,4));k=W*Math.pow(T,7)/(5040*Math.pow(M,7)*Math.pow(G,7))*(61+662*N*N+1320*Math.pow(N,4)+720*Math.pow(N,6));l=(g+D-C+A-k)*180/Math.PI;return{lat:Q,lon:l}}function Kijs_LatLon_2_Lks(c,r){c*=1;r*=1;var h;var n,W,t,B,G,w;var D,C,A,u;var S,Q,g,m,q,o,l,k,y,x;var s;var p;var b,a,Z,Y,O,X,U,T,H,e;var F,I,J,v,N,f,d;h=Math.PI/180;n=0.9996;W=6378137*n;t=6356752.3142*n;B=0;G=0;w=500000;D=(W-t)/(W+t);C=D*D;A=C*D;u=((W*W)-(t*t))/(W*W);S=c*h;Q=r*h;g=Math.sin(S);m=Math.cos(S);q=g/m;o=q*q;l=m*m;k=l*m;y=S-B;x=S+B;s=24;p=s*h;b=y*(1+D+1.25*(C+A));a=Math.sin(y)*Math.cos(x)*(3*(D+C+0.875*A));Z=Math.sin(2*y)*Math.cos(2*x)*(1.875*(C+A));Y=Math.sin(3*y)*Math.cos(3*x)*35/24*A;O=(b-a+Z-Y)*t;F=1-u*g*g;I=W/Math.sqrt(F);J=I*(1-u)/F;v=I/J-1;N=Q-p;f=N*N;d=f*f;b=O+G;a=I/2*g*m;Z=I/24*g*(k)*(5-(o)+9*v);Y=I/720*g*k*l*(61-58*(o)+o*o);H=b+f*a+d*Z+d*f*Y;X=I*m;U=I/6*k*(I/J-o);T=I/120*k*l;T=T*(5-18*o+o*o+14*v-58*o*v);e=w+N*X+f*N*U+d*N*T;return{x:Math.round(e),y:Math.round(H)}}function ColorPicker(F){var D=this;var G=document.createElement("div");F.appendChild(G);var J=new DomTable(G);J.style.borderWidth="1px";J.style.borderStyle="solid";J.style.borderColor="black";this.event_color_changed=new Event();this.color="";var H=12;for(var B=0;B';this.topo_layer_active=false;this.switch_topo_button=H(200,kijs_language.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,kijs_language.Ortofoto,"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,kijs_language.Map,"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"};this.event_layer_changed=new Event();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)}G.event_layer_changed.Fire({layer:L})}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.style.zIndex=A.viewableMap.style.zIndex+20;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;L0&&D.top>0&&D.leftD.map_width){G=D.map_width-F-2}H=Math.abs(H);if(K+H>D.map_height){H=D.map_height-K-2}if(G<15&&H<15){A.style.backgroundColor="red";B.style.borderColor="#981001";B.my_too_small=true}else{A.style.backgroundColor="blue";B.style.borderColor="#330099";B.my_too_small=false}B.style.width=G+"px";B.style.height=H+"px";A.style.width=G+"px";A.style.height=H+"px"});C.event_mouse_up.AddCallback(function(H){if(D.left==null){return }if(B.my_too_small==false){var J={x:B.offsetLeft,y:B.offsetTop};var I={x:J.x+B.clientWidth,y:J.y+B.clientHeight};J.x-=C.GetWholeMapLeft();J.y-=C.GetWholeMapTop();I.x-=C.GetWholeMapLeft();I.y-=C.GetWholeMapTop();var G=PixelsToMeters(C,J.x,J.y);var F=PixelsToMeters(C,I.x,I.y);C.ShowPoints([{x:G.x,y:G.y},{x:F.x,y:F.y}])}else{}D={top:null,left:null,map_width:null,map_height:null};B.style.display="none"})}function RouteWindow(Q){var S=this;var F=new Window(Q);F.title.innerHTML=kijs_language.Routing;F.content.style.height="280px";F.style.top="80px";this.disable_route_window=false;this.ShowRouteWindow=function(){if(this.disable_route_window==false){F.Show()}};this.route_main=new RouteMain(Q);var K=new Array();var L=null;var R=new Array();var C=document.createElement("div");F.content.appendChild(C);C.style.height="190px";C.style.width="235px";C.style.border="1px solid #C0C0C0";C.style.overflow="auto";C.style.margin="3px";C.style.textAlign="left";C.style.fontSize="11px";var M=document.createElement("div");F.content.appendChild(M);M.style.height="40px";M.style.border="1px solid #C0C0C0";M.style.margin="3px";var B=document.createElement("div");F.content.appendChild(B);B.style.height="30px";B.style.width="235px";B.style.border="1px solid #C0C0C0";B.style.margin="3px";var O=document.createElement("button");O.innerHTML="Optimizēt 1";O.title="Optimizē uz riņķi";O.onclick=function(){S.OptimisedRouting("1")};B.appendChild(O);var J=document.createElement("button");J.innerHTML="Optimizēt 2";J.title="Optimizē secīgi 7 punktus";J.onclick=function(){S.OptimisedRouting("2")};B.appendChild(J);this.OptimisedRouting=function(T){S.route_main.GetRoute(K,{optimise:T})};Q.event_right_click.AddCallback(function(T){Q.menu.ResetCommands();Q.menu.AddCommand(kijs_language.AddRoutePoint,function(){S.ShowRouteWindow();Q.loader.Show();var V=Q.svg.LayerCoords(T.pointer_x,T.pointer_y);var U=S.AddWayPoint(K.length,V.x_meter,V.y_meter);S.DoRoute()});if(L!=null){Q.menu.AddCommand(kijs_language.DeleteRoute,function(){P();G()})}Q.menu.Show()});this.event_route_completed=new Event();this.route_design={color:[63,78,212,1],width:3};this.route_design_small={color:[63,78,212,1],width:1.5};this.route_main.event_route_complete.AddCallback(function(V){try{Q.loader.Hide();D();if(V==null){}else{L=Q.svg.lines.AddPolyLine(S.route_design);R.push(L);for(var W=0;W"+kijs_language.DriveTime+": "+KijsParseMinutes(V.minutes)+"";M.innerHTML=U;Q.svg.lines.GetLine(L).mouse_over=function(){Q.tooltip.Show(U)};Q.svg.lines.GetLine(L).mouse_out=function(){Q.tooltip.Hide()};Q.svg.Refresh();S.event_route_completed.Fire(V.waypoints)}G()}catch(Z){log(["route_main.event_route_complete.AddCallback",Z.message])}});this.event_route_point_added=new Event();this.event_route_point_moved=new Event();this.event_route_point_deleted=new Event();this.AddWayPoint=function(Z,d,b,e){var W=-1;var X=6;var c={color:[0,0,0,0.99],width:0};var f=[250,30,30,0.95];var a=null;var T=false;do{a=kijs_color_object.GetRandomColor();if(a.n!="white"){T=true}}while(T==false);f[0]=a.r;f[1]=a.g;f[2]=a.b;if(e&&e.circle_fill){f=e.circle_fill}var W=Q.svg.points.AddMovable(d,b,X,f,c);Q.svg.points.GetPoint(W).usage_type="route";var Y="rgb("+f[0]+", "+f[1]+", "+f[2]+")";var U=Y;var V="5px solid "+Y;var g=new StaticInfoBox(Q,d,b,(Z+1)+". "+kijs_language.Point+"",10,-30,"white",V);g.style.zIndex="2";Q.svg.points.AddEventPointMoving(W,function(m,h,l,k){g.ChangeXY(h,l)});Q.svg.points.AddEventLeftClick(W,A,null);Q.svg.points.AddEventPointMoved(W,function(n,h,m,l){Q.loader.Show();var k=I(n);Q.svg.points.SetCoords(n,h,m);K[k].x=h;K[k].y=m;g.ChangeXY(h,m);S.route_main.GetRoute(K)});Q.svg.points.AddEventMouseOver(W,function(h){N(h)});Q.svg.points.AddEventMouseOut(W,function(){Q.tooltip.Hide()});S.event_route_point_added.Fire(W);K.push({x:d,y:b,index:K.length,id:W,info_box:g,address:"",km:0,min:0});G();return{point_id:W,static_info:g}};this.DoRoute=function(){S.route_main.GetRoute(K)};this.RemoveWayPointById=function(U){var T=I(U);S.RemoveWayPointByIndex(T)};this.RemoveWayPointByIndex=function(T){Q.svg.points.Remove(K[T].id);K[T].info_box.Remove();K.remove(T)};function A(T){Q.menu.ResetCommands();Q.menu.AddCommand(kijs_language.DeletePoint,function(){Q.loader.Show();var U=I(T);S.event_route_point_deleted.Fire(U);S.RemoveWayPointById(T);S.route_main.GetRoute(K);G()});if(L!=null){Q.menu.AddCommand(kijs_language.DeleteRoute,function(){P();G()})}Q.menu.Show()}this.Clear=P;function P(){H();G();D()}function D(){for(var T=0;T=0;T--){S.RemoveWayPointByIndex(T)}}function N(V){var T=I(V);var U=(T+1)+". "+kijs_language.Point+"";if(K[T].address!=""){U+=" - "+K[T].address}Q.tooltip.Show(U)}function I(V){var T=-1;for(var U=0;U0){var c=document.createElement("div");C.appendChild(c);c.innerHTML=K[X].km+""+kijs_language.kilometers+", "+KijsParseMinutes(K[X].min)+"";c.style.paddingLeft="40px";c.style.fontSize="10px";c.style.textAlign="left"}var f=new DomTable(C);f.table.width="98%";f.table.width="220";f.AddRow();var a=f.AddCell();var e=Q.svg.points.GetFill(K[X].id);a.innerHTML="
   
";var d=f.AddCell();d.innerHTML=(X+1)+".";d.style.fontSize="11px";var W=f.AddCell();W.width="100%";W.style.margin="1px";W.align="left";W.innerHTML=" "+kijs_language.Point+"";W.style.fontSize="11px";if(K[X].address!=""){W.innerHTML=" "+K[X].address}if(X>0){var Y=f.AddCell();var U=document.createElement("div");Y.appendChild(U);U.style.cursor="pointer";image_mapping.SetImage(U,"up_off");U.onmouseover=function(){image_mapping.SetImage(this,"up_on")};U.onmouseout=function(){image_mapping.SetImage(this,"up_off")};U.my_index=X;U.onclick=function(){var g=K[this.my_index];var h=K[this.my_index-1];K[this.my_index-1]=g;K[this.my_index]=h;G();S.route_main.GetRoute(K)}}if(X0){U+=","}U+="{x:"+K[T].x+",y:"+K[T].y+"}"}U+="]";return U};this.LoadStatusString=function(U){this.Clear();for(var T=0;T0){this.ShowRouteWindow()}}}var image_mapping=new ImagePosition();function ImagePosition(){var A=new Array();A.push({image:"images/arrows/all_images.gif",left:0,top:0,width:11,height:11,name:"down_off"});A.push({image:"images/arrows/all_images.gif",left:11,top:0,width:11,height:11,name:"down_on"});A.push({image:"images/arrows/all_images.gif",left:0,top:11,width:11,height:11,name:"up_off"});A.push({image:"images/arrows/all_images.gif",left:11,top:11,width:11,height:11,name:"up_on"});A.push({image:"images/arrows/all_images.gif",left:0,top:22,width:11,height:11,name:"close_off"});A.push({image:"images/arrows/all_images.gif",left:11,top:22,width:11,height:11,name:"close_on"});this.SetImage=function(C,B){for(var D=0;DK.x_min&&kijs_weather_list[L].xK.y_min&&kijs_weather_list[L].yL.x_min&&kijs_foto_list[M].xL.y_min&&kijs_foto_list[M].y"+T+"
",10,10)});C.push(R)}else{}}}else{if(1==1){var Q=new KijsGroupObjects(kijs_foto_list);var P=Q.GetForLevel(A.zoom_level);for(var M=0;ML.x_min&&P[M].obj_group_middle_xL.y_min&&P[M].obj_group_middle_yJ){J=K[H].x}if(!I||K[H].y>I){I=K[H].y}}return{min_x:G,min_y:F,max_x:J,max_y:I}}}function ImageLayer(B){var K=this;var H=Array();this.Get_LKS_X=function(O){try{return H[O].lks_x}catch(N){log("Error ImageLayer.Get_LKS_X("+O+"): "+N+", "+N.name+", "+N.message)}};this.Get_LKS_Y=function(O){try{return H[O].lks_y}catch(N){log("Error ImageLayer.Get_LKS_Y("+O+"): "+N+", "+N.name+", "+N.message)}};this.Add=function(T,P,O,S,R,Q,N){return M(T,P,O,S,R,false,Q,N)};this.AddLatLon=function(U,R,T,S,Q,P,N){var O=Kijs_LatLon_2_Lks(R,T);return M(U,O.x,O.y,S,Q,false,P,N)};this.AddMovable=function(T,P,O,S,R,Q,N){return M(T,P,O,S,R,true,Q,N)};function M(N,Q,P,U,T,W,O,V){try{var S=H.length;H.push({lks_x:Q,lks_y:P,pix_x:-1,pix_y:-1,src:N,movable:W,offset_pix_x:U,offset_pix_y:T,im_width:O,im_height:V,order_index:1});C(S);return S}catch(R){log(["image_layer.AddMain()",R,R.message])}}this.Remove=function(N){if(H[N]!=null){B.GetWholeMap().removeChild(H[N].object);H[N]=null}else{}};this.RemoveAll=function(){for(var N=0;N.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}}}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,kijs_language.RoadWork,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].ythis.min_tile_load_offset){var H="BBOX="+F.x+","+F.y;H+=","+(F.x+C.tile_height_meter)+","+(F.y+C.tile_width_meter);H+="&WIDTH="+C.tile_width_pix+"&HEIGHT="+C.tile_height_pix;H+="&KIJS="+kijs_client_id;B.push({row:I,col:D,top:F.top,left:F.left,parameters:H,loaded:false,bbx1:F.x,bby1:F.y,bbx2:(F.x+C.tile_height_meter),bby2:(F.y+C.tile_width_meter),bbw:C.tile_width_pix,bbh:C.tile_height_pix})}}else{}}catch(G){log("Error TileManager.NeedTile("+I+","+D+"): , "+G+", "+G.name+", "+G.message)}};this.RemoveAll=function(){try{while(B.pop()!=null){}for(var D=0;Dimg.onload:"+V.message)}};U.onerror=function(){K=false;log("bad: "+F())};var R=F();R+=(R.match(/\?/))?"&":"?";R+="BBOX=506880,6293760,520960,6307840&WIDTH=300&HEIGHT=300&KIJS="+kijs_client_id+"&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&TRANSPARENT=true&FORMAT="+encodeURIComponent(L)+"&SRS="+encodeURIComponent(A)+"&LAYERS="+encodeURIComponent(N);U.src=R;this.Refresh=function(){S.Remove()};this.Remove=function(){var V=null;while((V=O.pop())!=null){D(V)}};this.RemoveNoneVisibleTiles=function(){try{for(var V=O.length-1;V>=0;V--){var W=Q.TileInfo(O[V].row,O[V].col);if(W.min<-500){D(O[V]);O.remove(V)}}}catch(X){log("Error RemoveNoneVisibleTiles(): , "+X+", "+X.name+", "+X.message)}};function D(V){try{Q.GetWholeMap().removeChild(V);V.onload=null;V.onabort=null;V.onerror=null;V=null}catch(W){log("Error WmsLayer.RemoveTile(): , "+W+", "+W.name+", "+W.message)}}function F(){return S.image_files[(J++)%(S.image_files.length)]}this.LoadElement=function(X){try{var W="BBOX="+(X.bbx1+C)+","+(X.bby1+G)+","+(X.bbx2+C)+","+(X.bby2+G)+"&WIDTH="+X.bbw+"&HEIGHT="+X.bbh+"&KIJS="+kijs_client_id;W+="&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage";W+="&LAYERS="+encodeURIComponent(N);W+="&SRS="+encodeURIComponent(A);W+="&FORMAT="+encodeURIComponent(L)+"&TRANSPARENT="+encodeURIComponent(H);W+="&env="+encodeURIComponent(M);var V=F();V+=(V.match(/\?/))?"&":"?";V+=W;if(S.additional_parameters!=""){V+="&"+S.additional_parameters}var Z=null;if(P==false){Z=document.createElement("div")}else{Z=CreateImageNoSelect();Z.galleryimg="no";Z.style.display="none";Z.onload=function(){this.style.display="block"};Z.onabort=function(){log(["onabort",X.parameters])};Z.onerror=function(){log(["onerror",V])}}Z.row=X.row;Z.col=X.col;Z.style.zIndex=0;Z.style.position="absolute";Z.style.top=X.top+"px";Z.style.left=X.left+"px";Z.style.width=Q.tile_width_pix+"px";Z.style.height=Q.tile_height_pix+"px";Q.GetWholeMap().appendChild(Z);O.push(Z);Z.my_src=V;Kijs_SetOpacity(Z,I);if(K==true){if(P==false){Kijs_SetDivAlfaSrc(Z,V,Q.tile_width_pix,Q.tile_height_pix)}else{Z.src=V}}}catch(Y){log("Error WmsLayer.LoadElement(): , "+Y+", "+Y.name+", "+Y.message)}};this.ReloadSource=function(){try{if(K==true){for(var V=0;VL)?N:L;var O=(N>L)?L:N;var H=(C>B)?C:B;var A=(C>B)?B:C;var I=false;var Q=false;if(C==B){Q=true}if(N==L){I=true}this.Devide=function(T,S){if(T90){H=N}else{if(J.B>90){H=M}}return H}function LineSegmentLength(B,D,A,C){return Math.sqrt(Math.pow((B-A),2)+Math.pow((D-C),2))}function Angles(B,A,G){if(B>=A&&B>=G){var F=CosineRule(A,G,B);var D=SinRule(A,B,F);var C=180-F-D;return{A:F,B:D,C:C}}else{if(A>=A&&A>=G){var D=CosineRule(B,G,A);var F=SinRule(B,A,D);var C=180-D-F;return{A:F,B:D,C:C}}else{if(G>=A&&G>=B){var C=CosineRule(B,A,G);var F=SinRule(B,G,C);var D=180-C-F;return{A:F,B:D,C:C}}else{return false}}}}function CosineRule(B,A,G){var F=((B*B)+(A*A)-(G*G))/(2*B*A);var C=57.3;var D=Math.acos(F);D*=C;return D}function SinRule(A,H,C){var B=57.3;var G=C/B;var F=(A*Math.sin(G))/H;var D=Math.asin(F);D*=B;return D}function StaticInfoBox(A,D,C,J,I,H,B,G){var F=new InfoBox(A);F.BoxStyle().zIndex-=1;F.context.style.padding="1px 2px";F.context.style.fontFamily="Tahoma";F.context.style.fontSize="11px";F.CloseButton().style.display="none";F.SetWidthHeight("","");F.BoxStyle().backgroundColor=(B)?B:"#FFFFFF";F.BoxStyle().border=(G)?G:"1px solid black";F.show_in_map_frame=false;F.Show(D,C,J,I,H);this.Remove=function(){F.Remove()};this.ChangeXY=function(K,L){D=K;C=L;F.Show(D,C,J,I,H)};this.ChangeInnerHTML=function(K){J=K;F.Show(D,C,J,I,H)};this.style=F.BoxStyle();this.context=F.context}function NavigationRow(C){var B=new DomTable(C.viewableMap);B.table.cellSpacing=0;B.table.cellPadding=0;B.style.position="absolute";B.style.left="50px";B.style.top="10px";B.style.zIndex=C.viewableMap.style.zIndex+30;B.AddRow();this.AddCell=function(){var D=B.AddCell();D.width="10";return D};this.HideNavigationRow=function(){B.table.style.visibility="hidden"};this.ShowNavigationRow=function(){B.table.style.visibility="visible"};if(kijs_user_browser.ff==true){B.table.className="kijs_noprint"}if(kijs_client_id=="L4TK"||1==2){var A=document.createElement("div");A.style.position="absolute";A.style.left="49px";A.style.top="40px";A.style.zIndex="3";A.style.cursor="pointer";C.viewableMap.appendChild(A);Kijs_SetDivAlfaSrc(A,kijs_dir+"images/banner/gps_banner_white_h220.png",138,220);A.alt="Karšu izdevniecības Jāņa sēta GPS sekošanas sistēma";A.title="Karšu izdevniecības Jāņa sēta GPS sekošanas sistēma";A.onclick=function(){window.open("http://www.kartes.lv/lat/14c2_js_latvia_soft_trace.php","_blank")}}else{if(kijs_client_id=="AN1J"||1==2){var A=document.createElement("div");A.style.position="absolute";A.style.left="49px";A.style.top="40px";A.style.zIndex="3";A.style.cursor="pointer";C.viewableMap.appendChild(A);Kijs_SetDivAlfaSrc(A,kijs_dir+"images/banner/js_logo_new_lv.gif",220,56);A.alt="Karšu izdevniecības Jāņa sēta GPS sekošanas sistēma";A.title="Karšu izdevniecības Jāņa sēta GPS sekošanas sistēma";A.onclick=function(){window.open("http://www.kartes.lv/lat/14c2_js_latvia_soft_trace.php","_blank")}}}this.AddButton=function(I,L,H,F,K,G){var J=C.navigation_frame.AddCell();var D=document.createElement("div");J.appendChild(D);D.my_img=I;D.my_img_active=L;Kijs_SetDivAlfaSrc(D,D.my_img,H,F);D.title=K;D.style.cursor="pointer";D.my_active=false;D.onclick=function(){if(this.my_active==false){Kijs_SetDivAlfaSrc(this,this.my_img_active,H,F)}else{Kijs_SetDivAlfaSrc(this,this.my_img,H,F)}this.my_active=!this.my_active;G(this.my_active)};return J}}function ListManager(){var B=this;var D=new Array();var C=new Array();this.active_color="#E1E1E8";this.pasive_color="";this.AddElement=function(G,F){F._lm_active=false;F.onmouseover=function(){this.style.backgroundColor=B.active_color};F.onmouseout=function(){if(this._lm_active==false){this.style.backgroundColor=B.pasive_color}};D.push({object:F,id:G})};this.SetActive=function(G){var F=A(G);F.object._lm_active=true;F.object.style.backgroundColor=this.active_color};this.SetPassive=function(G){var F=A(G);F.object._lm_active=false;F.object.style.backgroundColor=this.pasive_color};this.SetPassiveAll=function(){for(var F=0;FF.GetWiewableMapWidth()){H=F.GetWiewableMapWidth()-G.offsetWidth}if(K<0){K=0}if(K+G.offsetHeight>F.GetWiewableMapHeight()){K=F.GetWiewableMapHeight()-G.offsetHeight}G.style.left=H+"px";G.style.top=K+"px"}});F.event_mouse_up.AddCallback(function(H){B=false});this.content=document.createElement("div");G.appendChild(this.content);this.content.style.padding="5px"}function ContextMenu(H){var F=this;var I=document.createElement("div");document.body.appendChild(I);I.style.border="1px solid #000000";I.style.position="absolute";I.style.top="1px";I.style.left="1px";I.style.fontFamily="Tahoma";I.style.fontSize="12px";I.style.backgroundColor="#FFFFFF";I.style.zIndex=H.viewableMap.style.zIndex+4;I.style.display="none";I.onblur=C;I.onclick=C;I.onmouseup=C;function C(J){I.style.display="none";Kijs_StopEvent(J)}var G=null;var A=new Array();this.AddCommand=function(K,J){A.push({text:K,command:J})};this.ResetCommands=function(){A=null;A=new Array()};this.Show=function(){B();I.innerHTML="";for(var K=0;K0){setTimeout(function(){I.style.display="block";I.focus()},10)}};this.Hide=function(){I.style.display="none"};H.event_mouse_move.AddCallback(D);function D(J){G={x:J.pointer_x,y:J.pointer_y};if(I.style.display=="block"){return }B()}function B(){if(G==null){return }I.style.left=(G.x+0)+"px";I.style.top=(G.y+0)+"px"}H.event_mouse_up.AddCallback(F.Hide)}document.write("");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(d,c){for(var a=0;aM){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;n12){m=12}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)}}this.CompactView=function(){X.style.display="none";H.style.top="36px"};this.NormalView=function(){X.style.display="block";H.style.top="199px"}}function Event(){var A=this;this.event_handlers=new Array();this.AddCallback=function(B){this.event_handlers.push(B)};this.Fire=function(B,C){if(C!=null){log("Event.Fire() takes just one argument")}setTimeout(function(){for(var D=0;DK){h=K}N.style.top=h+"px"}}function O(g){if(J==true){J=false;W()}}function G(){return R(stripPx(N.style.top)+((N.height-1)/2))}function R(m){var h=-1;var g=1000;for(var l=0;lO)?AD:O;O=(AF>O)?AF:O});this.event_mouse_up.AddCallback(function(AD){if(y==null){return }if(O==0){V.event_map_mouse_static_click.Fire({pointer_x:AD.pointer_x,pointer_y:AD.pointer_y})}y=null;w=null;O=0});V.viewableMap=E(v);V.viewableMap.innerHTML="";V.viewableMap.style.overflow="hidden";V.viewableMap.style.backgroundColor="#E4E4E4";V.viewableMap.style.position="relative";if(V.viewableMap.style.zIndex==""){V.viewableMap.style.zIndex=10}this.Load=function(AG,AE,AD){try{this.event_resize.AddCallback(function(){T()});V.viewableMap.oncontextmenu=function(AH){Kijs_StopEvent(AH);V.event_left_click.Fire({pointer_x:pointerX(AH),pointer_y:pointerY(AH)});V.event_right_click.Fire({pointer_x:pointerX(AH),pointer_y:pointerY(AH)})};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};c(AG);k(AE,AD);String.prototype.Trim=String.prototype.TrimTo;this.logo_and_scale=new LogoAndScale(this);this.zoom_tool=new ZoomTool(this,this,AG);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();a(B);this.event_double_click.AddCallback(function(AH){});B.onmousedown=X;B.ontouchstart=function(AH){if(AH.touches.length==1){AH.preventDefault();var AI=AH.touches[0];X(AH.touches[0])}};this.event_mouse_move.AddCallback(J);this.event_mouse_up.AddCallback(t);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(AB)}catch(AF){log("Error JanaSetaMap.Load(): "+AF+", "+AF.name+", "+AF.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(AD){V.MapAction=AD;V.event_map_action_type_changed.Fire(AD)}this.last_draw_polygon_id=null;this.event_started_polygon_drawing=new Event();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 e=0;var H=0;function X(AF){e=n();H=R();var AI=0;var AH=0;if(typeof (AF)!=="undefined"&&typeof (AF.pageX)!=="undefined"){AI=AF.pageX;AH=AF.pageY}else{var AI=pointerX(AF);var AH=pointerY(AF)}V.event_map_mouse_down.Fire({pointer_x:AI,pointer_y:AH,offset_x:findPosX(V.viewableMap),offset_y:findPosY(V.viewableMap)});if(V.MapAction==V.MapActionType.Line){Q(V.MapActionType.Move);var AE=V.svg.lines.AddPolyLineMovable({color:[63,78,212,1],width:4});var AG=V.svg.LayerCoords(AI,AH);V.svg.lines.DrawNextPoint(AE);V.svg.lines.AddEventClick(AE,function(AK,AJ){V.event_finished_line_drawing.Fire({id:AK,x:AJ.meter_x,y:AJ.meter_y})});V.svg.lines.AddEventStopedDrawing(AE,function(AK,AJ){V.event_map_action_type_changed.Fire(V.MapActionType.Move);V.event_finished_line_drawing.Fire({id:AK,x:AJ.meter_x,y:AJ.meter_y})})}else{if(V.MapAction==V.MapActionType.Polygon){Q(V.MapActionType.Move);var AE=V.svg.lines.AddPolygonMovable({color:[63,78,212,1],width:4},[10,181,30,0.3]);var AG=V.svg.LayerCoords(AI,AH);V.svg.lines.DrawNextPoint(AE);V.svg.lines.AddEventClick(AE,function(AK,AJ){V.event_finished_polygon_drawing.Fire({id:AK,x:AJ.meter_x,y:AJ.meter_y})});V.svg.lines.AddEventStopedDrawing(AE,function(AK,AJ){V.event_map_action_type_changed.Fire(V.MapActionType.Move);V.event_finished_polygon_drawing.Fire({id:AK,x:AJ.meter_x,y:AJ.meter_y})});V.last_draw_polygon_id=AE;V.event_started_polygon_drawing.Fire({polygon_id:AE})}else{if(V.MapAction==V.MapActionType.Point){Q(V.MapActionType.Move);var AG=V.svg.LayerCoords(AI,AH);var AD=V.svg.points.AddMovable(AG.x_meter,AG.y_meter,V.default_point_radius,V.default_point_fill,V.default_point_stroke);V.event_finished_point_drawing.Fire({id:AD,x:AG.x_meter,y:AG.y_meter});V.svg.points.AddEventClick(AD,function(AK,AJ){V.event_finished_point_drawing.Fire({id:AK,x:AJ.meter_x,y:AJ.meter_y})});V.svg.points.AddEventLeftClick(AD,function(){V.menu.ResetCommands();V.menu.AddCommand(kijs_language.DeletePoint,function(){V.info_box.Hide();V.svg.points.Remove(AD)});V.menu.Show()},null)}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=AI;G=AH}}}}}}}return false}this.event_stoped_paning=new Event();this.event_stoped_paning_map_moved=new Event();function t(AD){if(Y==true){Y=false;V.event_stoped_paning.Fire(AD);if(I!=AD.pointer_x||G!=AD.pointer_y){V.event_stoped_paning_map_moved.Fire(AD)}T()}}this.event_panning=new Event();function J(AD){if(Y){V.event_panning.Fire(AD);var AF=H+(AD.pointer_x-I);var AE=e+(AD.pointer_y-G);B.style.left=AF+"px";B.style.top=AE+"px"}}function n(){return stripPx(B.style.top)}function R(){return stripPx(B.style.left)}this.GetWholeMapTop=n;this.GetWholeMapLeft=R;function u(){return V.viewableMap.clientWidth}function W(){return V.viewableMap.clientHeight}this.GetWiewableMapWidth=u;this.GetWiewableMapHeight=W;var f=false;var U=null;var P=null;var AA=null;var F=null;this.Refresh=T;function T(){var AD=R();var AG=n();var AH=u();var AF=W();if(P==null||U==null){P=AG;U=AD}var AE=false;if(Math.abs(P-AG)>30){AE=true}else{if(Math.abs(U-AD)>30){AE=true}else{if(AA!=AH){AE=true}else{if(F!=AF){AE=true}}}}if(AE==true){if(f==false){f=true;V.tile_manager.RemoveNoneVisibleTiles();M();P=AG;U=AD;AA=AH;F=AF;f=false}}}var D=0;var N=0;this.CalcVisibleTiles=M;function M(){D=Math.ceil(u()/V.tile_width_pix);N=Math.ceil(W()/V.tile_height_pix);var AI=-Math.ceil((R()/V.tile_width_pix));var AF=-Math.ceil((n()/V.tile_height_pix));var AD=AI+D;var AH=AF+N;var AE=AF+Math.ceil(N/2)-0;var AG=AI+Math.ceil(D/2)-0;s(AE,AG)}this.event_before_center_changed=new Event();this.event_after_center_changed=new Event();this.ChangeLevelAndCenter=function(AH,AF,AD){try{var AE=c(AH);if(AE==true){this.event_before_level_changed.FireNoThread({new_level:V.zoom_level});this.event_before_center_changed.Fire();k(AF,AD);g();this.event_after_level_changed.Fire({new_level:V.zoom_level});this.event_after_center_changed.Fire({x:AF,y:AD})}else{this.SetCenter(AF,AD)}}catch(AG){log("Error JanaSetaMap.ChangeLevelAndCenter(): "+AG+", "+AG.name+", "+AG.message)}};this.SetCenter=function(AE,AD){this.event_before_center_changed.Fire();k(AE,AD);g();this.event_after_center_changed.Fire({x:AE,y:AD})};function k(AG,AF){try{V.first_tile_x=Math.floor(AG/V.tile_height_meter)*V.tile_height_meter;V.first_tile_y=Math.floor(AF/V.tile_width_meter)*V.tile_width_meter;q=HorisontalMetersToPixels(AG-V.first_tile_x,V.tile_width_meter,V.tile_width_pix);p=VerticalMetersToPixels(AF-V.first_tile_y,V.tile_height_meter,V.tile_height_pix);var AD=u()/2;var AE=W()/2;B.style.left=(AD-q)+"px";B.style.top=(AE-(V.tile_height_pix-p))+"px"}catch(AH){log("Error JanaSetaMap.SetCenterLocal(): "+AH+", "+AH.name+", "+AH.message)}}this.GetCenter=z;function z(){try{if(V.first_tile_x==null){return false}var AJ=R()-u()/2;var AE=n()-W()/2;var AG=HorisontalPixelsToMeters(AJ,V.tile_width_meter,V.tile_width_pix);var AH=VerticalPixelsToMeters(AE,V.tile_height_meter,V.tile_height_pix);var AD=V.first_tile_x-AG;var AF=V.first_tile_y+AH+V.tile_height_meter;return{x:AD,y:AF}}catch(AI){log("Error JanaSetaMap.GetCenter(): "+AI+", "+AI.name+", "+AI.message)}}this.SetLevel=c;function c(AD){try{AD=Math.round(AD);if(AD<-2){AD=-2}if(AD>12){AD=12}if(V.zoom_level!=AD){V.zoom_level=AD;var AF=V.GetLevelInfo(AD);V.tile_width_meter=AF.tile_width_meter;V.tile_height_meter=AF.tile_height_meter;return true}else{return false}}catch(AE){log("Error map.SetLevel("+AD+"): "+AE+", "+AE.name+", "+AE.message)}}this.first_level_meters=220;this.GetLevelInfo=function(AI){try{var AH=this.first_level_meters*Math.pow(2,AI);var AD=this.first_level_meters*Math.pow(2,AI);var AF=HorisontalPixelsToMeters(u(),AH,V.tile_width_pix);var AE=VerticalPixelsToMeters(W(),AD,V.tile_height_pix);return{tile_width_meter:AH,tile_height_meter:AD,map_width_meter:AF,map_height_meter:AE}}catch(AG){log("Error map.GetLevelInfo("+value+"): "+AG.name+", "+AG.message)}};this.LoadImageTilesFromCenter=s;function s(AJ,AF){try{var AK=Math.max(D,N)+4;V.tile_manager.NeedTile(AJ,AF);var AG=0;for(var AI=1;AI<=AK;AI++){for(var AD=0;AD<2;AD++){for(var AE=0;AEAD&&AH.map_height_meter>AG){break}}return AE};this.BestView=function(AM){var AJ=null;var AF=null;var AI=null;var AD=null;for(var AH=0;AHAJ){AJ=AM[AH].x}if(AF==null||AM[AH].xAI){AI=AM[AH].y}if(AD==null||AM[AH].y";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="+encodeURIComponent(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;irow.max_level){map.ChangeLevel(row.max_level)}map.SetCenter(this.x,this.y);var temp_text=this.innerHTML;map.svg.points.AddEventMouseOver(active_street_point_id,function(id){map.tooltip.Show(temp_text)});map.svg.points.AddEventMouseOut(active_street_point_id,function(id){map.tooltip.Hide()})}}}var prev_drawing_layer_id=false;function PrintDrawingResults(caption,data,total,OnClickFn){if(data.length==0){return }var list=CreateResultList(caption+" ("+data.length+" "+kijs_language.From+" "+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_admin_vien__min_max.min_x,y:kijs_admin_vien__min_max.min_y},{x:kijs_admin_vien__min_max.max_x,y:kijs_admin_vien__min_max.max_y}]);var H=kijs_dir+"server_scripts/admin_iedal/draw_image.php?i="+kijs_admin_vien__index;F=D.tile_manager.AddWmsLayer([H],false)}}function SvgPolyLine(V,f,H){var L=this;var e=new Array();this.AddPolyLine=function(q){return m(q,null,false)};this.AddPolyLineMovable=function(q){return m(q,null,true)};this.AddPolygon=function(r,q){return m(r,q,false)};this.AddPolygonMovable=function(r,q){return m(r,q,true)};function m(t,s,r){if(t.color[3]>1){t.color[3]=1}if(t.color[3]<0){t.color[3]=0}var q=e.length;t.cap="round";t.join="round";e.push({stroke:t,fill:s,points:new Array(),line_objects:new Array(),movable:r,type:"",draw_arrow:false});return q}this.ChangePolyLine=function(q,r){if(r.color[3]>1){r.color[3]=1}if(r.color[3]<0){r.color[3]=0}e[q].stroke=r};this.GetStroke=function(q){return e[q].stroke};this.ChangeStrokeColor=function(s,u,t,q){e[s].stroke.color[0]=u;e[s].stroke.color[1]=t;e[s].stroke.color[2]=q;this.RefreshStrokeAndFill(s)};this.RefreshStrokeAndFill=function(q){for(var r=0;r1){var AA=f.createPolyline(AB).setStroke(x);if(AF!=null&&AF[3]!=0){AA.setFill(AF)}AA.getEventSource().setAttribute("poly_line_id",y);Kijs_AddClass(AA.getEventSource(),"kijs_pointer");AB.length=0;e[y].line_objects.push(AA)}}catch(AL){log("Error SvgLine.DrawLine("+y+"): "+AL+", "+AL.name+", "+AL.message)}}function K(s){if(e[s]==null){return false}if(e[s].movable==false){return }var v=-1;var x=e[s].points.length;for(var t=0;t30){I()}}function I(){if(c==null){return }for(var q=0;q0){w+=","}w+="{x:"+e[t].points[r].x+",y:"+e[t].points[r].y+"}"}w+="]";w+=',name:"'+this.GetCustomParameter(t,"name").replace(/"/g,'\\"')+'"';w+=',descr:"'+this.GetCustomParameter(t,"descr").replace(/"/g,'\\"')+'"';w+="}"}w+="]"}catch(v){log(["svg.lines.GetStatusString",v.message])}return w};this.event_object_loaded_from_status_string=new Event();this.LoadStatusString=function(v){for(var t=0;t0&&(s[0].x!=s[s.length-1].x||s[0].y!=s[s.length-1].y)){s.push({x:s[0].x,y:s[0].y})}var q=0;for(var r=0;r0){var S=U;var T=KijsDistance(Y.points[S].x,Y.points[S].y,Y.points[S-1].x,Y.points[S-1].y);X+=": "+KijsParseMeters(T)}var R=0;for(var S=1;S<=U;S++){R+=KijsDistance(Y.points[S].x,Y.points[S].y,Y.points[S-1].x,Y.points[S-1].y)}X+="
"+kijs_language.FromForstPoint+": "+KijsParseMeters(R)+"";var V=0;for(var S=1;S"+kijs_language.Total+": "+KijsParseMeters(V)+"";var Q=C.svg.lines.LineArea(W);if(Q<600000){X+="
"+kijs_language.Area_+": "+Q+" m2, "+KijsRound(Q/10000,2)+" ha"}else{if(Q<100*1000000){X+="
"+kijs_language.Area_+": "+KijsRound(Q/1000000,2)+" km2"}else{X+="
"+kijs_language.Area_+": "+KijsRound(Q/1000000)+" km2"}}return X}function G(U,V,S){var Y=C.svg.lines.GetLine(U);var T=0;for(var Q=1;Q"+KijsParseMeters(T+R)+"";W+="
"+kijs_language.DoubleClickToStopDrawing;C.tooltip.Show(W)}this.GetStatusString=function(){var T="[";for(var R=0;R0){T+=","}T+="[";var S=C.svg.lines.GetLine(D[R]).points;for(var Q=0;Q0){T+=","}T+="{x:"+S[Q].x+", y:"+S[Q].y+"}"}T+="]"}T+="]";return T};this.LoadStatusString=function(T){if(T.length>0){for(var R=0;R0){var S=A();for(var Q=0;Q=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}}var kijs_sab_transp_list=null;function SabTranspBox(Y){var a=this;var B=null;var J=new Window(Y);J.title.innerHTML=kijs_language.RigaPublicTransport;var c=new SabTranspLayer(Y);var G=new SabTranspLayer2(Y);this.image_on=kijs_dir+"images/sab_transp_on.png";this.image_off=kijs_dir+"images/sab_transp_off.png";var P=Y.navigation_frame.AddCell();var D=document.createElement("div");P.appendChild(D);Kijs_SetDivAlfaSrc(D,this.image_off,24,24);D.title=kijs_language.RigaPublicTransport;D.style.cursor="pointer";D.onclick=function(){J.ToggleDisplay()};var X=document.createElement("div");J.content.appendChild(X);X.style.paddingTop="6px";var C=document.createElement("span");X.appendChild(C);C.innerHTML=kijs_language.Trams;C.style.color="white";C.style.backgroundColor="red";C.style.padding="2px 5px 2px 5px";C.style.margin="4px";C.style.cursor="pointer";C.style.fontWeight="bold";C.onclick=function(){L(N.Tram)};var W=document.createElement("span");X.appendChild(W);W.innerHTML=kijs_language.Trolleys;W.style.color="white";W.style.backgroundColor="green";W.style.padding="2px 5px 2px 5px";W.style.margin="4px";W.style.cursor="pointer";W.style.fontWeight="bold";W.onclick=function(){L(N.Trol)};var I=document.createElement("span");X.appendChild(I);I.innerHTML=kijs_language.Buses;I.style.color="white";I.style.backgroundColor="blue";I.style.padding="2px 5px 2px 5px";I.style.margin="4px";I.style.cursor="pointer";I.style.fontWeight="bold";I.onclick=function(){L(N.Auto)};var S=document.createElement("div");J.content.appendChild(S);S.style.padding="3px";S.style.margin="3px";S.style.height="200px";S.style.overflow="auto";S.style.textAlign="left";var V=document.createElement("div");S.appendChild(V);V.style.color="red";V.style.display="block";var U=document.createElement("div");S.appendChild(U);U.style.color="green";U.style.display="none";var F=document.createElement("div");S.appendChild(F);F.style.color="blue";F.style.display="none";var N={Tram:1,Trol:2,Auto:3};function L(d){V.style.display="none";U.style.display="none";F.style.display="none";switch(d){case N.Tram:V.style.display="block";break;case N.Trol:U.style.display="block";break;case N.Auto:F.style.display="block";break}}function b(k,f){var d=document.createElement("div");d.style.padding="3px";k.appendChild(d);var e=document.createElement("span");e.style.cursor="pointer";e.innerHTML="Rādīt visus";e.onclick=function(){A(f)};d.appendChild(e);var h=document.createElement("span");h.innerHTML="  /  ";d.appendChild(h);var g=document.createElement("span");g.style.cursor="pointer";g.innerHTML="Slēpt visus";g.onclick=function(){K(f)};d.appendChild(g)}call_back.LoadJson(kijs_dir+"server_scripts/sab_transp_list.php?kijs="+kijs_client_id,function(){Z()});var H=-1;var R=new Array();var M=new Array();var T=new Array();var Q=new ListManager();function Z(){if(kijs_sab_transp_list!=null){b(V,R);b(U,M);b(F,T);for(var d=0;d"+e.name+": "+e.name2;f.onclick=function(){a.ShowSingle(this.my_id);return ;Q.SetPassiveAll();Q.SetActive(this.my_id);O()};Q.AddElement(e.id,f)}}}this.ShowSingle=function(d){Q.SetPassiveAll();Q.SetActive(d);O()};function A(e){for(var d=0;d0){I+=","}I+=B[G]}kijs_temp_sab_transp_index=null;call_back.LoadJson(kijs_dir+"server_scripts/sab_transp/set_coords.php?kijs="+kijs_client_id+"&id="+I+"&r="+I.Trim(),function(){C()})}catch(H){log("Error SabTranspLayer2.Show(): , "+H+", "+H.name+", "+H.message)}};function C(){try{if(kijs_temp_sab_transp_index!=null){A();var G=kijs_dir+"server_scripts/sab_transp/draw_image.php?i="+kijs_temp_sab_transp_index;F=D.tile_manager.AddWmsLayer([G],false)}}catch(H){log("Error SabTranspLayer2.CallBack(): , "+H+", "+H.name+", "+H.message)}}}var kijs_sab_transp;function SabTranspLayer(H){var D=this;var C=new Array();var B=new Array();this.Add=function(I){B.push(I)};this.RemoveAll=function(){B.remove(0,B.length);for(var I=0;I0){J+=","}J+=B[I]}kijs_sab_transp=null;call_back.LoadJson(kijs_dir+"server_scripts/sab_transp/stops_info.php?kijs="+kijs_client_id+"&id="+J+"&r="+J.Trim(),function(){G()})};function G(){if(kijs_sab_transp!=null){F()}}function F(){var K=3;var Q=[0,0,0,1];var P={color:[255,255,255,1],width:1};var N=new Array();for(var L=0;L"+H.svg.points.GetCustomParameter(T,"name")+"";S+=" uz "+H.svg.points.GetCustomParameter(T,"to_stop");S+="
vairāk info uz klikšķi";H.tooltip.Show(S)});H.svg.points.AddEventMouseOut(M,function(S){H.tooltip.Hide()});C.push(M);H.svg.points.SetCustomParameter(M,"others",O.others);H.svg.points.AddEventClick(M,A)}H.ShowPoints(N);return ;var R="";var I="";var J=null;var R=sab_transp_data[index].data.name+" "+I+"
"+sab_transp_data[index].data.name2;sab_transp_data[index].svg_points=new Array();var K=4;var Q=[0,0,0,1];var P={color:[255,255,255,1],width:2};var N=new Array();for(var L=0;L"+H.svg.points.GetCustomParameter(T,"name")+"";H.tooltip.Show(S)});H.svg.points.AddEventMouseOut(M,function(S){H.tooltip.Hide()});sab_transp_data[index].svg_points.push(M);N.push({x:O.x,y:O.y})}H.ShowPoints(N)}function A(I){H.info_box.Hide();H.info_box.context.innerHTML="";var J=H.svg.points.GetCustomParameter(I,"others");var L=H.svg.points.GetCustomParameter(I,"name");var K=document.createElement("div");K.innerHTML=""+L+"

Transporti, kas šeit pietur";H.info_box.context.appendChild(K);var O=new Array();var Q=new Array();var N=new Array();for(var M=0;M0){S(H.info_box.context,"red","Tramvaji: ",O)}if(Q.length>0){S(H.info_box.context,"green","Trolejbusi: ",Q)}if(N.length>0){S(H.info_box.context,"blue","Autobusi: ",N)}function S(Y,W,V,Z){var a=document.createElement("div");a.innerHTML=V;a.style.color=W;Y.appendChild(a);for(var U=0;U"+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("