/*
Author: Krzysztof Borys
Publisher: GEOBID sp. z o.o.
Copyright: GEOBID sp. z o.o.
Niniejszy skrypt jest własnością przedsiębiorstwa GEOBID
jego kopiowanie, powielanie i modernizacja jest zabroniona
*/
var  MainMapTop = -1;
var  MainMapLeft = -1;
var  RefMapTop = -1;
var  RefMapLeft = -1;
var  jest_submit=0;
var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
if (ie4) var docRoot = 'document.body';
var ie5 = false;
var jest_wewnatrz=false; //czy jest wewnątrz mapy?
var myCanvasSelect = "myCanvas";
var przerysuj_legende=false;
if (ie4) {
if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)|| (navigator.userAgent.indexOf('MSIE 7') > 0)|| (navigator.userAgent.indexOf('MSIE 8') > 0)|| (navigator.userAgent.indexOf('MSIE 9') > 0)) {
if(document.compatMode && document.compatMode == 'CSS1Compat') docRoot = 'document.documentElement';
ie5 = true;
myCanvasSelect = "myCanvas-ie5";
}
if (ns6) {
ns6 = false;
}
}
opera=(navigator.userAgent.search('Opera')<0)?false:true;
konqueror=false; //(navigator.userAgent.indexOf('KHTML')<0)?false:true;
imgzoomin=new Image;
imgzoomin1=new Image;
imgzoomout=new Image;
imgzoomout1=new Image;
imgpan=new Image;
imgpan1=new Image;
imginfo=new Image;
imginfo1=new Image;
imgmiara=new Image;
imgmiara1=new Image;
imgq=new Image;
imgq1=new Image;
imgprev=new Image;
imgprev1=new Image;
imgnext=new Image;
imgnext1=new Image;
imgzoomin.src="/map/images/nzoomin.gif";
imgzoomin1.src="/map/images/nzoomin1.gif";
imgzoomout.src="/map/images/nzoomout.gif";
imgzoomout1.src="/map/images/nzoomout1.gif";
imgpan.src="/map/images/npan.gif";
imgpan1.src="/map/images/npan1.gif";
imginfo.src="/map/images/ninfo.gif";
imginfo1.src="/map/images/ninfo1.gif";
imgmiara.src="/map/images/nmiara.gif";
imgmiara1.src="/map/images/nmiara1.gif";
imgq.src="/map/images/nmeta.gif";
imgq1.src="/map/images/nmeta1.gif";
imgprev.src="/map/images/nprev.gif";
imgprev1.src="/map/images/nprev1.gif";
imgnext.src="/map/images/nnext.gif";
imgnext1.src="/map/images/nnext1.gif";
var zoomtab = new Array();
var zoommax = -1;
var zoomakt = -1;
var blokada_osrodek = false;
var icombolayer=0;
var szuk_x=0.0;
var szuk_y=0.0;
var oznacz_marker='';
var licznik_wyw=0;//licznik wywołań
function zoom_add(){
zoomakt+=1;
zoommax=zoomakt;
zoomtab[zoomakt]=document.mapserv.imgext.value;
zoom_przyciski();
}
function zoom_przyciski(){
if (zoomakt<=0)
document.mapserv.prev_zoom.src=imgprev.src;
else
document.mapserv.prev_zoom.src=imgprev1.src;
if (zoomakt==zoommax)
document.mapserv.next_zoom.src=imgnext.src;
else
document.mapserv.next_zoom.src=imgnext1.src;
}
function zoom_prev(){
if (zoomakt>0){
zoomakt-=1;
wskazany_obszar(zoomtab[zoomakt]);
przerysuj(3);
zoom_przyciski()
}
}
function zoom_next(){
if (zoomakt<zoommax){
zoomakt+=1;
wskazany_obszar(zoomtab[zoomakt]);
przerysuj(3);
zoom_przyciski()
}
}
function przyciski(ktory){
blokada_osrodek = false;
document.mapserv.zoominico.src=imgzoomin.src;
document.mapserv.zoomoutico.src=imgzoomout.src;
document.mapserv.panico.src=imgpan.src;
document.mapserv.infoico.src=imginfo.src;
if(document.mapserv.miaraico) document.mapserv.miaraico.src=imgmiara.src;
if (ktory!=''){
document.mapserv.operacja.value=ktory;
ChanceFunctionality();
}
if (document.mapserv.operacja.value=='zoom_rect'){document.mapserv.zoominico.src=imgzoomin1.src}
if (document.mapserv.operacja.value=='zoom_out'){document.mapserv.zoomoutico.src=imgzoomout1.src}
if (document.mapserv.operacja.value=='move'){document.mapserv.panico.src=imgpan1.src}
if (document.mapserv.operacja.value=='query_point'){document.mapserv.infoico.src=imginfo1.src}
if (document.mapserv.operacja.value=='measure')
if (document.mapserv.miaraico){document.mapserv.miaraico.src=imgmiara1.src}
}
function wyslij_obszar(){
if (document.mapserv.operacja.value!='measure' || myCanvas_clicks < 2)
{
alert('Najpierw zaznacz obszar przy pomocy opcji pomiaru powierzchni');
exit;
}
blokada_osrodek = true;
var req = mint.Request();
req.method='POST';
req.OnAbort =
function()
{
alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
blokada_osrodek = false;
}
req.OnSuccess =
function()
{
alert(this.responseText);
blokada_osrodek = false;
}
req.AddParam("polecenie",'d');
req.AddParam("id",encode(document.mapserv.osrodek.value));
var s='R\r\n'+kod_ukladu+'\r\n'+myCanvas_clicks+'\r\n';
for (i = 1; i <= myCanvas_clicks; i++) {
s+=(Math.round((miny+cellsize*(MainMapHeight-draw_y[i]))*100)/100)+' '+(Math.round((minx+cellsize*draw_x[i])*100)/100)+'\r\n';
}
s+='****\r\n';
req.AddParam("zakres", encode(s));
req.Send("/map/php/osrodek.php");
}
function kontrola_skali(){
var ms=100;
if (typeof minscale!="undefined") ms=minscale;
var gr=2834/ms;
if (MainMapWidth/(maxx-minx)>gr) return false; else return true;
}
function unormuj() {
var ms=100;
if (typeof minscale!="undefined") ms=minscale;
var gr=2834/ms;
if (MainMapWidth/(maxx-minx)>=gr){
var tt=(maxx+minx)/2;
maxx=tt+MainMapWidth/(gr*2);
minx=tt-MainMapWidth/(gr*2);
}
var wdh=MainMapWidth/MainMapHeight;
if ((wdh)<((maxx-minx)/(maxy-miny))){
var dd=((maxx-minx)/wdh - (maxy-miny))/2;
miny=miny-dd;
maxy=maxy+dd;
}else{
var dd=((maxy-miny)*wdh - (maxx-minx))/2;
minx=minx-dd;
maxx=maxx+dd;
}
imgdx=maxx-minx;
imgdy=maxy-miny;
cellsize=imgdx/MainMapWidth;
}
function wskazany_obszar(str) {
var s = "";
var nr=0;
str+=' ';
for (i = 0; i < str.length; i++) {
if (str.charAt(i) == " ") {
if (nr==0) minx=parseFloat(s);
if (nr==1) miny=parseFloat(s);
if (nr==2) maxx=parseFloat(s);
if (nr==3) maxy=parseFloat(s);
nr++;
s='';
}
else s += str.charAt(i);
}
}
function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
target.style.MozUserSelect="none"
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
}
function init() {
self.name = "main_map_window";
jest_submit=0;
disableSelection(document.body);
if (document.mapserv.sobreb)
if (s_obreb!='' && s_obreb!='[sobreb]'){
for (i=0;i<obreby.length;i++)
if (obreby[i].split('=')[0]==s_obreb){
document.mapserv.sobreb.selectedIndex=i+2;
}
}
unormuj();
document.mapserv.imgext.value=minx+' '+miny+' '+maxx+' '+maxy;
zoom_add();
przyciski('');
inimyqlayers();
if (MainMapWidth==400) {document.mapserv.rozmiar.selectedIndex=0}
else
if (MainMapWidth==500) {document.mapserv.rozmiar.selectedIndex=1}
else
if (MainMapWidth==700) {document.mapserv.rozmiar.selectedIndex=2}
else
document.mapserv.rozmiar.selectedIndex=3;
if (document.mapserv.obiekt)
document.mapserv.obiekt.selectedIndex=document.mapserv.obiektid.value;
MouseMoveDefault = document.onmousemove;
MouseDownDefault = document.onmousedown;
MouseUpDefault = document.onmouseup;
if ( (ns4) || (ie4) || (ns6)) {
document.onmousemove = mouseMove;
if (ns4) document.captureEvents(Event.MOUSEMOVE);
}
MainMapTop = DL_GetElementTop(document.getElementsByName('mainmap')[0]);
MainMapLeft = DL_GetElementLeft(document.getElementsByName('mainmap')[0]);
if (document.getElementsByName('ref')[0]){
RefMapTop = DL_GetElementTop(document.getElementsByName('ref')[0]);
RefMapLeft = DL_GetElementLeft(document.getElementsByName('ref')[0]);
}
document.getElementsByName('mainmap')[0].style.position = 'absolute';
document.getElementsByName('mainmap')[0].style.top = MainMapTop;
document.getElementsByName('mainmap')[0].style.left = MainMapLeft;
document.getElementById(myCanvasSelect).style.top = MainMapTop;
document.getElementById(myCanvasSelect).style.left = MainMapLeft;
jg = new jsGraphics(myCanvasSelect);
jg.setColor("#ff0000");
document.getElementById("loadmap-img").style.top = MainMapTop + (MainMapHeight / 2) - 15;
document.getElementById("loadmap-img").style.left = MainMapLeft + (MainMapWidth / 2) - 137;
textnode = document.createTextNode("");
document.getElementById("tipp").appendChild(textnode);
MainMapMovedLeft = MainMapLeft;
MainMapMovedTop = MainMapTop;
if (window.addEventListener)
window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
if (document.mapserv.osrodek)
if (document.mapserv.osrodek.value!="[osrodek]")
document.getElementById("osrodek-btn").style.visibility = 'visible';
if (komunikat!='') alert(komunikat);
}
function to852(s)
{
var ss='';
for (i=0;i<s.length;i++){
switch(s.charAt(i)) {
case 'Ą':
ss+='A';
break;
case 'Ć':
ss+='C';
break;
case 'Ę':
ss+='E';
break;
case 'Ł':
ss+='L';
break;
case 'Ń':
ss+='N';
break;
case 'Ó':
ss+='O';
break;
case 'Ś':
ss+='S';
break;
case 'Ź':
ss+='Z';
break;
case 'Ż':
ss+='Z';
break;
default:
ss+=s.charAt(i)
}
}
return ss;
}
function toregex(s)
{
var ss='';
for (i=0;i<s.length;i++){
switch(s.charAt(i)) {
case '/':
ss+='[^0-9,A-Z,a-z,-,\.]';
break;
case '.':
ss+='\.';
break;
default:
ss+=s.charAt(i)
}
}
return ss;
}
function ustaw_warstwy(){
document.mapserv.mylayers.value=' ';
document.mapserv.operacja2.value='';
document.mapserv.qstring.value='';
document.mapserv.scale.value='';
document.mapserv.imgxy.value='';
document.mapserv.mode.value='';
document.mapserv.obiekttmp.value='';
document.mapserv.adrestmp.value='';
document.mapserv.nrdztmp.value='';
document.mapserv.myqlayers.value=' ';
for (i=0;i<document.getElementsByName('qchecklayer').length;i++){
if (document.getElementsByName('qchecklayer')[i].src==imgq1.src)
document.mapserv.myqlayers.value+=document.getElementsByName('qchecklayer')[i].id+' ';
}
var cc='';
if (document.mapserv.combolayer){
cc=document.mapserv.combolayer.options[document.mapserv.combolayer.selectedIndex].value;
icombolayer=document.mapserv.combolayer.selectedIndex;
}
if (cc!='') {document.mapserv.mylayers.value+=cc+' '}
if (document.mapserv.checklayer.length==null){
if (document.mapserv.checklayer.checked)
{document.mapserv.mylayers.value+=document.mapserv.checklayer.value+' '}
}
else{
for (i=0;i<document.mapserv.checklayer.length;i++){
if (document.mapserv.checklayer[i].checked)
{document.mapserv.mylayers.value+=document.mapserv.checklayer[i].value+' '}
}
}
if (document.mapserv.obiekt)
{
if (document.mapserv.obiekt.value!=''){
var s=document.mapserv.obiekt.value;
var poz=s.indexOf(',');
if (poz!=-1) s=s.substr(0,poz);
document.mapserv.obiekttmp.value='^'+s+'_.*|^'+s+'[0-9]*$';
}
}
if(document.mapserv.ulica){
document.mapserv.adrestmp.value=to852(document.mapserv.ulica.value.toUpperCase());
if (document.mapserv.nrdomu.value!='')
document.mapserv.adrestmp.value+='.*#'+document.mapserv.nrdomu.value.toUpperCase()+'#'
document.mapserv.adrestmp.value='^'+document.mapserv.adrestmp.value+'|[^A-Z,0-9]'+document.mapserv.adrestmp.value;
if (document.mapserv.ulica.value!='')
document.mapserv.mylayers.value+="padr ";
}
if(document.mapserv.nrdz){
nrdzx=document.mapserv.nrdz.value;
if (document.mapserv.sobreb){
if(document.mapserv.sobreb.value!='')
nrdzx=document.mapserv.sobreb.value+'-'+nrdzx;
}
document.mapserv.nrdztmp.value='[\\.,-]'+toregex(nrdzx)+'$|^'+toregex(nrdzx)+'$';
if (document.mapserv.nrdz.value!='')
document.mapserv.mylayers.value+="dzzaz ";
}
}
function przelicz_ne(wsp){
if (wsp=='') return 0.0;
if (wsp.indexOf(',')==-1)
return parseFloat(wsp);
var par=parseFloat(wsp.split(',')[0])+parseFloat(wsp.split(',')[1])/60;
if (wsp.split(',')[2]) par+=parseFloat(wsp.split(',')[2])/3600;
return(par);
}
function kasuj_ne(){
document.mapserv.szerokosc.value='';
document.mapserv.dlugosc.value='';
if (document.mapserv.mark)
document.mapserv.mark.value='';
przerysuj(2);
}
function szukaj_ne(){
var sze=przelicz_ne(document.mapserv.szerokosc.value);
var dlu=przelicz_ne(document.mapserv.dlugosc.value);
if (sze<48 || sze>55 || isNaN(sze)){
alert('Określ szerokość geograficzną w formacie:\n<stopnie>,<minuty>,<sekundy>.<ułamki sekund>\nnp.:50,17,7.67\nlub w formacie:\n<stopnie>.<ułamek stopnia>\nnp.:50.2854639');
return;
}
if (dlu<13 || dlu>24 || isNaN(dlu)){
alert('Określ długość geograficzną w formacie:\n<stopnie>,<minuty>,<sekundy>.<ułamki sekund>\nnp.:18,52,25.21\nlub w formacie:\n<stopnie>.<ułamek stopnia>\nnp.:18.8736694');
return;
}
szuk_y=oblicz_x(sze/180*Math.PI,dlu/180*Math.PI);
szuk_x=oblicz_y(sze/180*Math.PI,dlu/180*Math.PI);
if (document.mapserv.mark && (szuk_x!=0 || szuk_y!=0))
document.mapserv.mark.value=szuk_x+' '+szuk_y;
if (maxx-minx>800){
maxx = szuk_x+400.0;
maxy = szuk_y+400.0;
minx = szuk_x-400.0;
miny = szuk_y-400.0;
}
else
{
var dlx=(maxx-minx)/2;
var dly=(maxy-miny)/2;
maxx = szuk_x+dlx;
maxy = szuk_y+dly;
minx = szuk_x-dlx;
miny = szuk_y-dly;
}
przerysuj(0);
}
function szukaj_adresu(){
if (document.mapserv.ulica.value==''){
alert('Określ nazwę ulicy i ewentualnie numer domu');
return;
}
ustaw_warstwy();
if (document.mapserv.nrdomu.value!='')
document.mapserv.scale.value = '1000';
document.mapserv.qstring.value="/"+document.mapserv.adrestmp.value+"/";
document.mapserv.qlayer.value="padr";
document.mapserv.qitem.value="MAPSER";
document.mapserv.mode.value="itemnquery";
document.mapserv.operacja2.value = 'adres';
document.mapserv.target="_parent";
kbsubmit(1);
loadmap();
}
function szukaj_obiektu(id){
ustaw_warstwy();
document.mapserv.scale.value = '1000';
document.mapserv.qstring.value=id;
document.mapserv.qlayer.value="obiektsel";
document.mapserv.qitem.value="ID";
document.mapserv.mode.value="itemnquery";
document.mapserv.operacja2.value = 'objlist2';
document.mapserv.target="_parent";
kbsubmit(1);
loadmap();
}
function szukaj_dzialki(){
if (document.mapserv.nrdz.value==''){
alert('Określ numer działki');
return;
}
ustaw_warstwy();
document.mapserv.qstring.value="/"+document.mapserv.nrdztmp.value+"/";
document.mapserv.qlayer.value="dzzaz";
document.mapserv.qitem.value="NUMER";
document.mapserv.mode.value="itemnquery";
document.mapserv.operacja2.value = 'dzialka';
document.mapserv.target="_parent";
kbsubmit(1);
loadmap();
}
function encode(str) {
var result = "";
for (i = 0; i < str.length; i++) {
if (str.charAt(i) == " ") result += "+";
else result += str.charAt(i);
}
return escape(result);
}
function dodaj_mark(){
if (document.mapserv.mark && document.mapserv.mark.value!='' ){
return('&mark='+encode(document.mapserv.mark.value))
}
else return('');
}
function dodaj_rozmiar_auto(){
if (document.mapserv.winw && document.mapserv.winh ){
return('&winw='+encode(document.mapserv.winw.value)+'&winh='+encode(document.mapserv.winh.value))
}
else return('');
}
function przerysuj(typ){
loadmap();
unormuj();
ustaw_warstwy();
myCanvas_clear();
MouseDownClickLeft = 0;
MouseDownClickTop = 0;
if(document.forms[0].AOI)
document.forms[0].AOI.selectedIndex=0;
var ss='/map/php/map.php?';
var s='map='+encode(document.mapserv.map.value)+'&imgext='+encode(minx+' '+miny+' '+maxx+' '+maxy)+'&mylayers='+encode(document.mapserv.mylayers.value)+'&rozmiar='+document.mapserv.rozmiar.value;
licznik_wyw++;
document.getElementsByName('mainmap')[0].src=ss+s+'&licznik='+licznik_wyw+'&mode=map'+'&adrestmp='+encode(document.mapserv.adrestmp.value)+'&nrdztmp='+encode(document.mapserv.nrdztmp.value)+'&obiekttmp='+encode(document.mapserv.obiekttmp.value)+dodaj_mark()+dodaj_rozmiar_auto();
if (document.getElementsByName('ref')[0]){
if (typ==0||typ==1||typ==3) document.getElementsByName('ref')[0].src=ss+s+'&mode=reference';
}
if (typ==0||typ==3) document.getElementsByName('scalebar')[0].src=ss+s+'&mode=scalebar';
document.mapserv.imgext.value=minx+' '+miny+' '+maxx+' '+maxy;
if (document.getElementById('legenda'))
if (przerysuj_legende){
var req = mint.Request();
req.method='GET';
req.OnSuccess =
function()
{
document.getElementById('legenda').innerHTML=this.responseText;
}
req.Send(ss+s+'&mode=legend');
przerysuj_legende=false;
}
if (typ<2) zoom_add();
}
function pokaz_wszystko(){
minx=mapminx;
miny=mapminy;
maxx=mapmaxx;
maxy=mapmaxy;
przerysuj(0);
}
function mapa_referencyjna(){
x=refminx+((mouse_x-RefMapLeft)/document.getElementsByName('ref')[0].width)*(refmaxx-refminx);
y=refminy+((document.getElementsByName('ref')[0].height-(mouse_y-RefMapTop))/document.getElementsByName('ref')[0].height)*(refmaxy-refminy);
minx = x-imgdx/2;
miny = y-imgdy/2;
maxx = x+imgdx/2;
maxy = y+imgdy/2;
przerysuj(0);
}
function setSize2() {
var
myWidth=800;
myHeight=600;
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
if (document.mapserv.winw) document.mapserv.winw.value=myWidth-odejmij_szerokosc;
if (document.mapserv.winh) document.mapserv.winh.value=myHeight-odejmij_wysokosc;
}
function kbsubmit(typ){ //0-pełny,1-bez ustal_wrstwy
if (typ==0) ustaw_warstwy();
jest_submit=1;
setSize2();
document.mapserv.submit();
}
function DL_GetElementLeft(eElement) {
var nLeftPos = eElement.offsetLeft;
var eParElement = eElement.offsetParent;
while (eParElement != null)
{
nLeftPos += eParElement.offsetLeft;
eParElement = eParElement.offsetParent;
}
return nLeftPos;
}
function DL_GetElementTop(eElement) {
var nTopPos = eElement.offsetTop;
var eParElement = eElement.offsetParent;
while (eParElement != null)
{
nTopPos += eParElement.offsetTop;
eParElement = eParElement.offsetParent;
}
return nTopPos;
}
function na_stopnie(x){
var	stopnie=x*180/Math.PI;
var	minuty=(stopnie-Math.floor(stopnie))*60;
var	sekundy=(minuty-Math.floor(minuty))*60;
return Math.floor(stopnie)+'° '+Math.floor(minuty)+"' "+Math.round(100*sekundy) / 100+'"';
}
function handle(delta) {
var zoom_x,zoom_y;
delta=-delta;
zoom_x= minx+(mouse_x-MainMapLeft)*cellsize;
zoom_y= miny+(MainMapHeight-(mouse_y-MainMapTop))*cellsize;
if (delta<0)
delta=1/(-delta*mnoznik);
else
delta=delta*mnoznik;
minx = zoom_x-(zoom_x-minx)*delta;
miny = zoom_y-(zoom_y-miny)*delta;
maxx = zoom_x+(maxx-zoom_x)*delta;
maxy = zoom_y+(maxy-zoom_y)*delta;
przerysuj(0);
}
function wheel(event){
if (jest_wewnatrz){
var delta = 0;
if (!event) event = window.event;
if (event.wheelDelta) {
delta = event.wheelDelta/120;
if (window.opera) delta = -delta;
} else if (event.detail) {
delta = -event.detail/3;
}
if (delta)
handle(delta);
if (event.preventDefault)
event.preventDefault();
event.returnValue = false;
}
}
function mouseMove(e) {
var cmd = getRadioButtonValue(document.mapserv.cmd);
jest_wewnatrz=false;
if ( (ns4) || (ns6) ) {mouse_x=e.pageX; mouse_y=e.pageY;}
if (ie4) {mouse_x=event.x; mouse_y=event.y;}
if (ie5) {mouse_x=eval('event.x+self.'+docRoot+'.scrollLeft') - 1; mouse_y=eval('event.y+self.'+docRoot+'.scrollTop');}
if ((MainMapLeft <= mouse_x) && (mouse_x <= MainMapLeft + MainMapWidth) && (MainMapTop <= mouse_y) && (mouse_y <= MainMapTop + MainMapHeight)) {
jest_wewnatrz=true;
CoordX = minx +  (imgdx/MainMapWidth) * (mouse_x - MainMapLeft);
CoordX = Math.round(100*CoordX) / 100;
CoordY = miny +  (imgdy/MainMapHeight) * (MainMapHeight - mouse_y + MainMapTop);
CoordY = Math.round(100*CoordY) / 100;
if (document.mapserv.coordx){
document.mapserv.coordx.value = CoordX;
document.mapserv.coordy.value = CoordY;
}
if (document.mapserv.coordn){
document.mapserv.coordn.value=na_stopnie(oblicz_n(CoordY,CoordX));
document.mapserv.coorde.value=na_stopnie(oblicz_e(CoordY,CoordX));
}
if (cmd == 'measure') {
document.getElementById(myCanvasSelect).style.visibility = 'visible';
document.getElementById(myCanvasSelect).style.cursor = 'crosshair';
}
else if (cmd == 'query_point') {
document.onmousedown = mouseDownQuery;
document.getElementById(myCanvasSelect).style.visibility = 'visible';
document.getElementById(myCanvasSelect).style.cursor = 'crosshair';
}
else if (cmd == 'zoom_out') {
document.onmousedown = mouseDownZoomOut;
document.getElementById(myCanvasSelect).style.visibility = 'visible';
document.getElementById(myCanvasSelect).style.cursor = 'crosshair';
}
else if (cmd == 'zoom_rect') {
document.getElementById(myCanvasSelect).style.visibility = 'visible';
document.getElementById(myCanvasSelect).style.cursor = 'crosshair';
document.onmousedown = mouseDownZoom
if (myCanvas_clicks == 1) {
zoom_rect_x[2] = mouse_x + 1;
zoom_rect_y[2] = mouse_y - 1;
document.getElementById("zoomrect").style.top = Math.min(zoom_rect_y[1],zoom_rect_y[2]);
document.getElementById("zoomrect").style.left = Math.min(zoom_rect_x[1],zoom_rect_x[2]);
if (ie5) {
document.getElementById("zoomrect").style.width = Math.abs(zoom_rect_x[2] - zoom_rect_x[1]) + 1;
document.getElementById("zoomrect").style.height = Math.abs(zoom_rect_y[2] - zoom_rect_y[1]) + 1;
}
else { // ns6
document.getElementById("zoomrect").style.width = Math.abs(zoom_rect_x[2] - zoom_rect_x[1]) - 1;
document.getElementById("zoomrect").style.height = Math.abs(zoom_rect_y[2] - zoom_rect_y[1]) - 1;
}
document.getElementById("zoomrect").style.visibility = 'visible';
}
document.onmouseup = mouseUpZoom
}
else if (cmd == 'move') {
if (ns6) {
document.getElementById(myCanvasSelect).style.visibility = 'hidden';
document.getElementsByName('mainmap')[0].style.cursor = 'move';
}
else {
document.getElementById(myCanvasSelect).style.visibility = 'hidden';
document.getElementsByName('mainmap')[0].style.cursor = 'move';
}
document.onmousedown = mouseDownMove
if (myCanvas_clicks >= 1) {
myCanvas_clicks = 1;
document.getElementsByName('mainmap')[0].style.left = mouse_x - MouseDownClickLeft + MainMapLeft;
document.getElementsByName('mainmap')[0].style.top = mouse_y - MouseDownClickTop + MainMapTop;
var t = MouseDownClickTop - mouse_y;
var r = MouseDownClickLeft - mouse_x + MainMapWidth;
var b = MouseDownClickTop - mouse_y + MainMapHeight;
var l = MouseDownClickLeft - mouse_x;
document.getElementsByName('mainmap')[0].style.clip = 'rect(' + t + ' ' +  r + ' ' + b + ' ' + l + ')';
}
document.onmouseup = mouseUpMove
}
else {
document.getElementsByName('mainmap')[0].style.cursor = 'crosshair';
document.getElementById(myCanvasSelect).style.cursor = 'crosshair';
document.onmousedown = MouseDownDefault
document.onmouseup = MouseUpDefault
if (myCanvas_clicks == 1) {
myCanvas_clear();
}
document.getElementById(myCanvasSelect).style.visibility = 'hidden';
}
} //poza obszarem
else {
if ((myCanvas_clicks >= 1) && (cmd == 'move')) {
myCanvas_clicks = 2;
MainMapMovedLeft = parseInt(document.getElementsByName('mainmap')[0].style.left);
MainMapMovedTop = parseInt(document.getElementsByName('mainmap')[0].style.top);
document.onmouseup = mouseUpMove
}
else if ((myCanvas_clicks == 1) && (cmd == 'zoom_rect')) {
document.onmouseup = mouseUpZoom
}
else {
document.onmouseup = MouseUpDefault
}
document.onmousedown = MouseDownDefault
}
}
var zoom_rect_x = new Array();
var zoom_rect_y = new Array();
var myCanvas_clicks = 0;
function mouseDownZoomOut(e) {
zoom_x= minx+(mouse_x-MainMapLeft)*cellsize;
zoom_y= miny+(MainMapHeight-(mouse_y-MainMapTop))*cellsize;
minx = zoom_x-imgdx*mnoznik/2;
miny = zoom_y-imgdy*mnoznik/2;
maxx = zoom_x+imgdx*mnoznik/2;
maxy = zoom_y+imgdy*mnoznik/2;
przerysuj(0);
}
function mouseDownQuery(e) {
ustaw_warstwy();
document.mapserv.imgxy.value=(mouse_x-MainMapLeft)+' '+(mouse_y-MainMapTop);
document.mapserv.mode.value='nquery';
if (!open_int('')) return;
loadmap();
document.mapserv.target="querywindow";
kbsubmit(1);
jest_submit=0;
}
function jest_objlist(){
return (document.mapserv.operacja2.value == 'objlist')?true:false;
}
function info_obj() {
if (document.forms[0].obiekt.selectedIndex != 0 &&
document.forms[0].obiekt.selectedIndex !=1) {
var s=document.mapserv.obiekt.value;
var poz=s.indexOf(',');
if (poz!=-1) s=s.substr(0,poz);
document.mapserv.imgxy.value="";
document.mapserv.qstring.value="/"+'^'+s+'_.*|^'+s+'[0-9]*$'+"/";
document.mapserv.qlayer.value="obiekty";
document.mapserv.qitem.value="ID";
document.mapserv.mode.value="itemnquery";
document.mapserv.operacja2.value = 'objlist';
if (!open_int('')) return;
loadmap();
document.mapserv.target="querywindow";
kbsubmit(1);
jest_submit=0;
}
}
function mouseDownZoom(e) {
myCanvas_clear();
myCanvas_clicks = 1;
zoom_rect_x[1] = mouse_x + 1;
zoom_rect_y[1] = mouse_y - 1;
zoom_rect_x[2] = -100;
zoom_rect_y[2] = -100;
jg.drawLine(zoom_rect_x[1] - 5 - MainMapLeft, zoom_rect_y[1] - MainMapTop, zoom_rect_x[1] + 5 - MainMapLeft, zoom_rect_y[1] - MainMapTop);
jg.drawLine(zoom_rect_x[1] - MainMapLeft, zoom_rect_y[1] - 5 - MainMapTop, zoom_rect_x[1] - MainMapLeft, zoom_rect_y[1] + 5 - MainMapTop);
jg.paint();
}
function mouseUpZoom() {
myCanvas_clicks = 2;
if (!zoom_rect_x[2] || zoom_rect_x[2]==-100)
zoom_rect_x[2] = mouse_x + 1;
if (!zoom_rect_y[2] || zoom_rect_y[2]==-100)
zoom_rect_y[2] = mouse_y - 1;
if (!zoom_rect_x[1])
zoom_rect_x[1] = mouse_x + 1;
if (!zoom_rect_y[1])
zoom_rect_y[1] = mouse_y - 1;
jg.drawLine(zoom_rect_x[2] - 5 - MainMapLeft, zoom_rect_y[2] - MainMapTop, zoom_rect_x[2] + 5 - MainMapLeft, zoom_rect_y[2] - MainMapTop);
jg.drawLine(zoom_rect_x[2] - MainMapLeft, zoom_rect_y[2] - 5 - MainMapTop, zoom_rect_x[2] - MainMapLeft, zoom_rect_y[2] + 5 - MainMapTop);
jg.paint();
if (Math.abs(zoom_rect_x[2]-zoom_rect_x[1])>2 || Math.abs(zoom_rect_y[2]-zoom_rect_y[1])>2) {
maxx = minx+(Math.max(zoom_rect_x[1], zoom_rect_x[2]) - MainMapLeft)*cellsize;
maxy = miny+(MainMapHeight-(Math.min(zoom_rect_y[1], zoom_rect_y[2]) - MainMapTop))*cellsize;
minx = minx+(Math.min(zoom_rect_x[1], zoom_rect_x[2]) - MainMapLeft)*cellsize;
miny = miny+(MainMapHeight-(Math.max(zoom_rect_y[1], zoom_rect_y[2]) - MainMapTop))*cellsize;
przerysuj(0);
}
else {
if (zoom_rect_x[2] != zoom_rect_x[1]) {
zoom_x = (Math.min(zoom_rect_x[1], zoom_rect_x[2]) + Math.abs(zoom_rect_x[2] - zoom_rect_x[1]) / 2) - MainMapLeft;
zoom_y = zoom_rect_y[1] - MainMapTop;
}
else if (zoom_rect_y[2] != zoom_rect_y[1]) {
zoom_x = zoom_rect_x[1] - MainMapLeft;
zoom_y = (Math.min(zoom_rect_y[1], zoom_rect_y[2]) + Math.abs(zoom_rect_y[2] - zoom_rect_y[1]) / 2) - MainMapTop;
}
else {
zoom_x = zoom_rect_x[1] - MainMapLeft;
zoom_y = zoom_rect_y[1] - MainMapTop;
}
zoom_x= minx+(zoom_x)*cellsize;
zoom_y= miny+(MainMapHeight-zoom_y)*cellsize;
minx = zoom_x-imgdx/mnoznik/2;
miny = zoom_y-imgdy/mnoznik/2;
maxx = zoom_x+imgdx/mnoznik/2;
maxy = zoom_y+imgdy/mnoznik/2;
przerysuj(0);
}
}
var MouseDownClickLeft = 0;
var MouseDownClickTop = 0;
function mouseDownMove() {
myCanvas_clicks = 1;
MouseDownClickLeft = mouse_x;
MouseDownClickTop = mouse_y;
}
function mouseUpMove() {
move_x=10000;
if (myCanvas_clicks == 1) {
move_x = (MainMapWidth / 2) + (MouseDownClickLeft - mouse_x);
move_y = (MainMapHeight / 2) + (MouseDownClickTop - mouse_y);
}
else if (myCanvas_clicks == 2) {
move_x = (MainMapWidth / 2) - MainMapMovedLeft + MainMapLeft;
move_y = (MainMapHeight / 2) - MainMapMovedTop + MainMapTop;
}
if (move_x!=10000){
move_x= minx+(move_x)*cellsize;
move_y= miny+(MainMapHeight-move_y)*cellsize;
minx = move_x-imgdx/2;
miny = move_y-imgdy/2;
maxx = move_x+imgdx/2;
maxy = move_y+imgdy/2;
przerysuj(1);
}
}
function load_mainmap_clear(){
document.getElementById("loadmap-img").style.visibility = 'hidden';
}
function load_mainmap(){
load_mainmap_clear();
if (MainMapLeft!=-1){
document.getElementsByName('mainmap')[0].style.left = MainMapLeft;
document.getElementsByName('mainmap')[0].style.top = MainMapTop;
document.getElementsByName('mainmap')[0].style.clip = 'rect(' + 0 + ' ' +  MainMapWidth + ' ' + MainMapHeight + ' ' + 0 + ')';
}
}
function myCanvas_clear() {
myCanvas_clicks = 0;
dist = 0;
pole = 0;
if (window.jg) jg.clear();
if (document.mapserv.distance) document.mapserv.distance.value = dist + ' m';
if (document.mapserv.area) document.mapserv.area.value = dist + ' m2';
document.getElementById("zoomrect").style.visibility = 'hidden';
document.getElementById("zoomrect").style.width = 1;
document.getElementById("zoomrect").style.height = 1;
return;
}
var draw_x = new Array();
var draw_y = new Array();
var dist = 0;
var pole = 0;
function myCanvas_is_clicked() {
var cmd = getRadioButtonValue(document.mapserv.cmd);
if (cmd == 'measure') {
myCanvas_clicks = myCanvas_clicks + 1;
draw_x[myCanvas_clicks] = mouse_x - MainMapLeft;
draw_y[myCanvas_clicks] = mouse_y - MainMapTop;
if (myCanvas_clicks == 1) {
jg.drawLine(draw_x[myCanvas_clicks] - 5, draw_y[myCanvas_clicks], draw_x[myCanvas_clicks] + 5, draw_y[myCanvas_clicks]);
jg.drawLine(draw_x[myCanvas_clicks], draw_y[myCanvas_clicks] - 5, draw_x[myCanvas_clicks], draw_y[myCanvas_clicks] + 5);
jg.paint();
}
else {
jg.drawLine(draw_x[myCanvas_clicks] - 5, draw_y[myCanvas_clicks], draw_x[myCanvas_clicks] + 5, draw_y[myCanvas_clicks]);
jg.drawLine(draw_x[myCanvas_clicks], draw_y[myCanvas_clicks] - 5, draw_x[myCanvas_clicks], draw_y[myCanvas_clicks] + 5);
jg.drawLine(draw_x[myCanvas_clicks - 1], draw_y[myCanvas_clicks - 1], draw_x[myCanvas_clicks], draw_y[myCanvas_clicks]);
jg.paint();
dist_x = draw_x[myCanvas_clicks] - draw_x[myCanvas_clicks - 1];
dist_y = draw_y[myCanvas_clicks] - draw_y[myCanvas_clicks - 1];
dist = dist + cellsize * Math.sqrt(dist_x * dist_x + dist_y * dist_y);
pole = pole + (draw_x[myCanvas_clicks] - draw_x[myCanvas_clicks - 1])*(draw_y[myCanvas_clicks] + draw_y[myCanvas_clicks - 1])*cellsize*cellsize;
var pole2=(draw_x[1] - draw_x[myCanvas_clicks])*(draw_y[1] + draw_y[myCanvas_clicks])*cellsize*cellsize;
if (document.mapserv.distance){
if(cellsize<1)
document.mapserv.distance.value = (Math.round(dist*100)/100) + ' m'
else
document.mapserv.distance.value = Math.round(dist) + ' m';
}
pole2=Math.abs((pole+pole2)/2);
if (document.mapserv.area){
if (pole2>10000)
document.mapserv.area.value = Math.round(pole2)/10000 + ' ha'
else
document.mapserv.area.value = Math.round(pole2) + ' m2'
}
}
}
}
var interfWin;
var interf_w=400;
var interf_h=200;
var interf_l=200;
var interf_t=50;
function interf_set(dx,dy,ddx,ddy){
interf_l+=dx;
interf_t+=dy;
interf_w+=ddx;
interf_h+=ddy;
}
function open_int(url) {
if (parseInt(navigator.appVersion) > 2) {
interfWin = window.open(url,"querywindow","directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0,width=" + interf_w + ",height=" + interf_h+",left="+interf_l+",top="+interf_t+",screenX="+interf_l+",screenY="+interf_t);
if (interfWin==null || typeof(interfWin)=="undefined"){
alert('Twoja przeglądarka ma zablokowane wyskakujące okienka. Odblokuj je, aby witryna polskiemiasta.pl działała poprawnie. Informacje o odblokowaniu znajdują się u góry strony.');
return false;
}
else return true;
}
}
function getRadioButtonValue(radio) {
return document.mapserv.operacja.value;
}
var clickimg = 0;
function is_clicked() {
clickimg = 1;
return;
}
var nwin = 0;
function getWindow() {
nwin = 1;
return;
}
function ChanceFunctionality() {
myCanvas_clear();
}
var currStep = 0;
var j = 0;
function loadmap() {
document.getElementById("loadmap-img").style.visibility = 'visible';
}
var showtippok;
var tipptext;
function showtipp(text) {
showtippok = true;
tipptext = text;
setTimeout("showtippexecute();", 1000);
}
function showtippexecute() {
if (showtippok && window.mouse_x && window.mouse_y) {
document.getElementById("tipp").style.top = mouse_y + 15;
document.getElementById("tipp").style.left = mouse_x;
document.getElementById("tipp").innerHTML = tipptext;
document.getElementById("tipp").style.visibility = 'visible';
}
}
function hidetipp() {
document.getElementById("tipp").style.visibility = 'hidden';
document.getElementById("tipp").innerHTML = '';
showtippok = false;
}
function AOISelected()
{
if (document.forms[0].AOI.selectedIndex != 0 &&
document.forms[0].AOI.selectedIndex !=1) {
wskazany_obszar(document.forms[0].AOI.value);
var i=document.forms[0].AOI.selectedIndex;
przerysuj(0);
document.forms[0].AOI.selectedIndex=i;
}
}
function obiektSelected()
{
if(document.mapserv.obiekt){
if (document.forms[0].obiekt.selectedIndex != 0 &&
document.forms[0].obiekt.selectedIndex !=1) {
if (!document.getElementsByName('checklayer')[0].checked) document.getElementsByName('checklayer')[0].click();
document.mapserv.obiektid.value=document.mapserv.obiekt.selectedIndex;
var s=document.mapserv.obiekt.value;
var poz=s.indexOf(',');
if (poz!=-1) wskazany_obszar(s.substr(poz+1));
przerysuj(0);
}
}
}
function MapSizeSelected()
{
document.mapserv.operacja2.value = 'rozdzielczosc';
document.mapserv.target="_parent";
kbsubmit(0);
loadmap();
}
function infolayer(nazwa,operacja){ //0-wyłącz,1-załącz,2-przełącz,3-zgodnie z checkiem
przerysuj_legende=true;
if (operacja==3){
for (i=0;i<document.getElementsByName('checklayer').length;i++){
if (document.getElementsByName('checklayer')[i].value==nazwa)
if (document.getElementsByName('checklayer')[i].checked) operacja=1; else operacja=0;
}
}
for (i=0;i<document.getElementsByName('qchecklayer').length;i++){
if (document.getElementsByName('qchecklayer')[i].id==nazwa)
{
if (operacja==0) document.getElementsByName('qchecklayer')[i].src=imgq.src;
else if (operacja==1) document.getElementsByName('qchecklayer')[i].src=imgq1.src;
else if (operacja==2) {
if (document.getElementsByName('qchecklayer')[i].src==imgq.src)
document.getElementsByName('qchecklayer')[i].src=imgq1.src
else
document.getElementsByName('qchecklayer')[i].src=imgq.src
}
}
}
}
function inimyqlayers(){
var s=' '+document.mapserv.myqlayers.value+' ';
for (i=0;i<document.getElementsByName('qchecklayer').length;i++){
if (s.indexOf(' '+document.getElementsByName('qchecklayer')[i].id+' ') !=-1)
document.getElementsByName('qchecklayer')[i].src=imgq1.src;
}
}
function unload(){
if (jest_submit=0)
if (interfWin)
interfWin.close();
}
function drukuj(){
ustaw_warstwy();
var s='/map/php/pdfmap.php?';
s+='map='+encode(document.mapserv.map.value)+'&mapext='+encode(minx+' '+miny+' '+maxx+' '+maxy)+'&layers='+encode(document.mapserv.mylayers.value);
s+='&adrestmp='+encode(document.mapserv.adrestmp.value)+'&nrdztmp='+encode(document.mapserv.nrdztmp.value)+'&obiekttmp='+encode(document.mapserv.obiekttmp.value)+dodaj_mark();
pdfWin = window.open(s,"pdfwindow","directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0");
}
function change_combolayer(){
if (icombolayer!=document.mapserv.combolayer.selectedIndex)
przerysuj(2);
}
function ramkag(){
document.write('<TR><TD><IMG SRC="/map/images/rog_lg.gif" WIDTH="4" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="4"></TD><TD><IMG SRC="/map/images/rog_pg.gif" WIDTH="4" HEIGHT="4"></TD></TR>');
}
function ramkad(){
document.write('<TR><TD><IMG SRC="/map/images/rog_ld.gif" WIDTH="4" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="4"></TD><TD><IMG SRC="/map/images/rog_pd.gif" WIDTH="4" HEIGHT="4"></TD></TR>');
}
function odstepn(ile){
document.write('<TR><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="'+ile+'"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="'+ile+'"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="'+ile+'"></TD></TR>');
}
function odstepb(ile){
document.write('<TR><TD BGCOLOR="#FFFFFF"><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="'+ile+'"></TD><TD BGCOLOR="#FFFFFF"><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="'+ile+'"></TD><TD BGCOLOR="#FFFFFF"><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="'+ile+'"></TD></TR>');
}
function warstwa_add(warstwa,check,opis,info){
document.write('<TR><TD ALIGN="CENTER" width="15"><INPUT TYPE="checkbox" NAME="checklayer" VALUE="'+warstwa+'" onClick="infolayer(this.value,3)" '+check+' > </TD> <TD ALIGN="CENTER" width="20">');
if (info)
document.write('<IMG ALIGN="middle" SRC="/map/images/nmeta.gif" WIDTH="15" HEIGHT="15" NAME="qchecklayer" ID="'+warstwa+'" onClick="infolayer(this.id,2)">');
document.write('</TD><TD>'+opis+'</TD></TR>');
}
function kopiuj(){
if (myCanvas_clicks>0)
oznacz_marker=(Math.round((minx+cellsize*draw_x[1])*100)/100)+'+'+(Math.round((miny+cellsize*(MainMapHeight-draw_y[1]))*100)/100);
else
oznacz_marker='';
url='/map/javascript/podglad.htm';
window.open(url,"mapa_podglad","directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0,width=" + (MainMapWidth+40) + ",height=" +(MainMapHeight+150));
}
function pomoc(url){
if (url)
url='/map/javascript/'+url;
else
url='/map/javascript/wwwinfo.htm';
var owin=window.open(url,"mapa_pomoc","directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=1,toolbar=0,width=700,height=600");
owin.focus();
}
function dl(s){
document.write(s);
}
function html_warstwy(mapwidth,mapheight){
dl('<div id=\'myCanvas\' OnClick=\'myCanvas_is_clicked()\'></div>');
dl('<div id=\'myCanvas-ie5\' OnClick=\'myCanvas_is_clicked()\'><img src=\'/map/images/pixel.gif\' border=\'0\' width=\''+mapwidth+'\' height=\''+mapheight+'\'></div>');
dl('<div id=\'zoomrect\'><img src=\'/map/images/pixel.gif\' border=\'0\' width=\'1\' height=\'1\'></div>');
dl('<div id=\'loadmap-img\'><img src=\'/map/images/load.gif\' border=\'0\'></div>');
dl('<div id=\'tipp\'></div>');
}
function html_form(){
dl('<form method=\'GET\' name=\'mapserv\' action=\'/map/php/map.php\' onsubmit=\'return false;\'>');
}
function html_tytul(nazwa,strona,rysunek,nazwa2,strona2,pomoc2){
ramkag();
dl('<TR><TD>&nbsp;</TD><TD><table border="0"><tr><td><img src="'+rysunek+'"></td><td>&nbsp;</td><td>');
dl('<a href="'+strona+'" target="_top">'+nazwa+'</a><br>');
if (nazwa2 && strona2)
dl('<a href="'+strona2+'" target="_top">'+nazwa2+'</a><br>');
else
dl('<a href="http://www.polskiemiasta.pl" target="_top">Strona główna</a><br>');
if (pomoc2)
dl('<a href="javascript:pomoc(\''+pomoc2+'\')" >POMOC</a>');
else
dl('<a href="javascript:pomoc()" >Pomoc</a>');
dl('</td></tr></table></TD><TD>&nbsp;</TD></TR>');
odstepn(2);
ramkad();
}
function html_raster1(){
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Mapa podkładowa</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><select name="combolayer" onclick="change_combolayer()"><option value="" >Brak</option>');
}
function html_raster2(){
dl('</select></TD><TD>&nbsp;</TD></TR>');
icombolayer=document.mapserv.combolayer.selectedIndex;
}
function html_obiekty(check){
dl('<TD ALIGN="CENTER" width="15"> <INPUT ID="checklayer1" TYPE="checkbox" NAME="checklayer" VALUE="obiekty" onClick="infolayer(this.value,3)" '+check+' >');
dl('</TD>  <TD ALIGN="CENTER" width="20"> <IMG ALIGN="middle" SRC="/map/images/nmeta.gif" WIDTH="15" HEIGHT="15" NAME="qchecklayer" ID="obiekty" onClick="infolayer(this.id,2)"> </TD>');
}
function html_przerysuj(){
dl('<TR><TD colspan="3" ALIGN="CENTER"><TABLE border="0">');
dl('<TR><TD ALIGN="RIGHT"><IMG SRC="/map/images/nreload.gif" STYLE="cursor: pointer"  NAME=\'redraw\' BORDER=\'0\' onClick=\'przerysuj(2)\' onmouseover=\'showtipp("Kliknij w celu odświeżenia mapy")\' onmouseout=\'hidetipp()\'></TD>');
dl('<TD><b>Odśwież</b></TD>');
dl('<TD ALIGN="RIGHT"><IMG SRC="/map/images/nreload1.gif" STYLE="cursor: pointer" NAME=\'redraw1\' BORDER=\'0\' onClick=\'MapSizeSelected()\' onmouseover=\'showtipp("Kliknij w celu odświeżenia strony")\' onmouseout=\'hidetipp()\'></TD>');
dl('</TR></TABLE></TD></TR>');
}
function html_rozmiar(auto){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Rozmiar mapy</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD>&nbsp;</TD><TD><SELECT NAME="rozmiar" onChange="MapSizeSelected()">');
dl('<OPTION VALUE="0"> 400 x 300</OPTION><OPTION VALUE="1"> 500 x 400</OPTION><OPTION VALUE="2"> 700 x 550</OPTION>');
if (auto) dl('<OPTION VALUE="3" selected> Auto</OPTION>');
dl('</SELECT></TD><TD>&nbsp;</TD></TR></TR>');
odstepn(8);
ramkad();
}
function html_mapa(miasto,mapwidth,mapheight,img){
dl('<TR ALIGN="CENTER"><TD>&nbsp;</TD><TD><B>'+miasto+'</B></TD><TD>&nbsp;</TD></TR>');
dl('<TR><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="'+mapwidth+'" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD></TR>');
dl('<TR><TD>&nbsp;</TD><TD><table border="0" cellpadding=\'0\' cellspacing=\'0\' border=\'0\' ><tr><td><img src=\'/map/images/pixel.gif\' width=\''+mapwidth+'\' height=\'2\' border=\'0\'></td></tr>');
dl('<tr><td height=\''+mapheight+'\'>');
if (opera || konqueror)
dl('<img src=\''+img+'\' border=\'0\' width=\''+mapwidth+'\' height=\''+mapheight+'\' name=\'mainmap\' onclick=\'is_clicked()\' onload=\'load_mainmap()\'>');
else
dl('<input type=\'image\' src=\''+img+'\' border=\'0\' width=\''+mapwidth+'\' height=\''+mapheight+'\' name=\'mainmap\' onclick=\'is_clicked()\' onload=\'load_mainmap()\'>');
dl('</td></tr></table></TD><TD>&nbsp;</TD></TR><TR>');
dl('<TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="'+mapwidth+'" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD></TR>');
}
function html_skala(mapwidth,scalebar){
dl('<TR><TD><img src="/map/images/pixel.gif" width=\'4\' height=\'2\' border=\'0\'></TD><TD ALIGN="RIGHT"><img src="'+scalebar+'" name="scalebar"></TD><TD><img src="/map/images/pixel.gif" width=\'4\' height=\'2\' border=\'0\'></TD></TR>');
dl('<TR><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="'+mapwidth+'" HEIGHT="4"></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD></TR>');
}
function html_wspol(jakie){
if (!jakie) jakie=1;
dl('<TR><TD>&nbsp;</TD><TD ALIGN="left"><table border=\'0\' cellspacing=\'0\' cellpadding=\'0\'><tr><td class=\'small\'>&nbsp;Współrzędne:&nbsp;</td>');
if (jakie==2 || jakie==3){
dl('<td class=\'small\'>&nbsp;N:&nbsp;</td><td class=\'small\'><input type=\'text\' size=\'10\' class=\'mapunits\' name=\'coordn\' value=\'\' readonly></td>');
dl('<td class=\'small\'>&nbsp;E:&nbsp;</td><td class=\'small\'><input type=\'text\' size=\'10\' class=\'mapunits\' name=\'coorde\' value=\'\' readonly>&nbsp;&nbsp;</td>');
}
if (jakie==1 || (jakie==3 & MainMapWidth>450)){
dl('<td class=\'small\'>&nbsp;X:&nbsp;</td><td class=\'small\'><input type=\'text\' size=\'9\' class=\'mapunits\' name=\'coordy\' value=\'\' readonly></td>');
dl('<td class=\'small\'>&nbsp;Y:&nbsp;</td><td class=\'small\'><input type=\'text\' size=\'9\' class=\'mapunits\' name=\'coordx\' value=\'\' readonly></td>');
}
dl('<td class=\'small\'>&nbsp;</td></tr></table></TD><TD>&nbsp;</TD></TR>');
}
function html_narzedzia(dlugosc,powierzchnia){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Narzędzia:</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="8"></TD><TD><table  border="0" cellpadding="0" cellspacing="0" ALIGN="LEFT"><tr><td>');
dl('<IMG NAME=\'zoominico\' SRC="/map/images/nzoomin.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="przyciski(\'zoom_rect\')"  onmouseover=\'showtipp("Powiększanie obrazu. Kliknij w celu powiększenia w punkcie")\' onmouseout=\'hidetipp()\'>');
dl('<IMG NAME=\'zoomoutico\' SRC="/map/images/nzoomout.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="przyciski(\'zoom_out\')" onmouseover=\'showtipp("Kliknij na mapie aby pomniejszyć")\' onmouseout=\'hidetipp()\'>');
dl('<IMG NAME=\'panico\' SRC="/map/images/npan.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="przyciski(\'move\')" onmouseover=\'showtipp("Kliknij i przesuń mapę")\' onmouseout=\'hidetipp()\'>');
dl('<IMG SRC="/map/images/nzoomall.gif"  NAME=\'zoomall\' WIDTH="26" HEIGHT="26" STYLE="cursor: pointer"  BORDER=\'0\' onClick="pokaz_wszystko()" onmouseover=\'showtipp("Pokaż wszystko")\' onmouseout=\'hidetipp()\'>');
dl('<IMG SRC="/map/images/nprev.gif"  NAME=\'prev_zoom\' WIDTH="26" HEIGHT="26" STYLE="cursor: pointer"  BORDER=\'0\' onClick="zoom_prev()" onmouseover=\'showtipp("Poprzednie powiększenie")\' onmouseout=\'hidetipp()\'>');
dl('<IMG SRC="/map/images/nnext.gif"  NAME=\'next_zoom\' WIDTH="26" HEIGHT="26" STYLE="cursor: pointer"  BORDER=\'0\' onClick="zoom_next()" onmouseover=\'showtipp("Następne powiększenie")\' onmouseout=\'hidetipp()\'>');
dl('<IMG NAME=\'infoico\' SRC="/map/images/ninfo.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="przyciski(\'query_point\')" onmouseover=\'showtipp("Kliknij na obiekcie w celu uzyskania informacji")\' onmouseout=\'hidetipp()\'>');
if (dlugosc || powierzchnia)
dl('<IMG NAME=\'miaraico\' SRC="/map/images/nmiara.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="przyciski(\'measure\')" onmouseover=\'showtipp("Kliknij na mapie w celu pomiaru. Kliknij ponownie aby wyczyścić")\' onmouseout=\'hidetipp()\'>');
dl('<IMG NAME=\'print\' SRC="/map/images/nprint.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="drukuj()" onmouseover=\'showtipp("Drukuj aktualny obraz (druk do PDF)")\' onmouseout=\'hidetipp()\'>');
dl('<IMG NAME=\'kopia\' SRC="/map/images/nmap.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer" onClick="kopiuj()" onmouseover=\'showtipp("Pokaż rysunek mapy w nowym oknie")\' onmouseout=\'hidetipp()\'>');
if (dlugosc || powierzchnia)
dl('<IMG ID="osrodek-btn" SRC="/map/images/nsave.gif" WIDTH="26" HEIGHT="26" STYLE="cursor: pointer; visibility: hidden" onClick="wyslij_obszar()" onmouseover=\'showtipp("Przenieś obszar do ośrodka dla wykonawcy")\' onmouseout=\'hidetipp()\'>');
dl('</td></tr>');
if (dlugosc || powierzchnia){
dl('<TR><TD><IMG SRC="/map/images/pixel.gif" WIDTH="4" HEIGHT="4"></TD></TR><tr>');
dl('<td class=\'small\'>');
if (dlugosc) dl('Długość:&nbsp;<input  type=\'text\' size=\'8\' class=\'measureunits\' name=\'distance\' value=\'0 m\' readonly>&nbsp;&nbsp;');
if (powierzchnia) dl('Powierzchnia:&nbsp;<input  type=\'text\' size=\'10\' class=\'measureunits\' name=\'area\' value=\'0 m2\' readonly>');
dl('</td></tr>');
}
dl('</table></TD><TD><IMG SRC="/map/images/pixel.gif" WIDTH="1" HEIGHT="8"></TD></TR>');
ramkad();
}
function html_ref(ref){
dl('<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" bgcolor="#6699CC">');
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Mapa referencyjna</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD>&nbsp;</TD><TD><img src=\''+ref+'\' border=\'0\' name=\'ref\' onClick="mapa_referencyjna()"  onmouseover=\'showtipp("Kliknij na mapie referencyjnej w celu przesunięcia obrazu")\' onmouseout=\'hidetipp()\'></TD><TD>&nbsp;</TD></TR>');
odstepn(8);
ramkad();
odstepb(8);
dl('</TABLE>');
}
function html_powiekszenie1(){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Powiększenie obszaru</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD>&nbsp;</TD><TD ALIGN="LEFT"><SELECT NAME="AOI"  onChange="AOISelected()">');
dl('<OPTION>Powiększ ...</OPTION><OPTION>- - - - - - - - - - - - - - -</OPTION>');
}
function html_powiekszenie2(){
dl('</SELECT></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
ramkad();
odstepb(8);
}
function html_ne(szerokosc,dlugosc){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Lokalizacja współrzędnej</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><span style="vertical-align:middle">Szerokość:</span>&nbsp;<input type="text"  size="12" name="szerokosc" value="'+szerokosc+'">');
dl('<IMG NAME=\'szukaj\' SRC="/map/images/kasmar.gif" style="vertical-align:middle;cursor: pointer;" WIDTH="26" HEIGHT="26" onClick="kasuj_ne()"  onmouseover=\'showtipp("Kliknij w celu wykasowania markera")\' onmouseout=\'hidetipp()\'>');odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><span style="vertical-align:middle">Długość:</span>&nbsp;<input type="text" style="vertical-align:middle;position:relative;left:15px;" size="12" name="dlugosc" value="'+dlugosc+'">');
dl('<IMG NAME=\'szukaj\' SRC="/map/images/nfind.gif" style="vertical-align:middle;cursor: pointer;position:relative;left:15px;" WIDTH="26" HEIGHT="26" onClick="szukaj_ne()"  onmouseover=\'showtipp("Kliknij w celu lokalizacji punktu")\' onmouseout=\'hidetipp()\'>');
dl('</TD><TD>&nbsp;</TD></TR>');
odstepn(4);
ramkad();
odstepb(8);
}
function html_adres(ulica,nrdomu){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Lokalizacja adresu</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD>Ulica:&nbsp;<input type="text" name="ulica" value="'+ulica+'"></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><span style="vertical-align:middle">Nr domu:</span>&nbsp;<input type="text" style="vertical-align:middle" size="6" name="nrdomu" value="'+nrdomu+'">');
dl('<IMG NAME=\'szukaj\' SRC="/map/images/nfind.gif" style="vertical-align:middle;cursor: pointer" WIDTH="26" HEIGHT="26" onClick="szukaj_adresu()"  onmouseover=\'showtipp("Kliknij w celu lokalizacji adresu")\' onmouseout=\'hidetipp()\'>');
dl('</TD><TD>&nbsp;</TD></TR>');
odstepn(4);
ramkad();
odstepb(8);
}
function html_dzialka(nrdz){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Lokalizacja działki</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><span style="vertical-align:middle">Nr działki:</span>&nbsp;<input style="vertical-align:middle" type="text" size="13" name="nrdz" value="'+nrdz+'">');
dl('<IMG NAME=\'szukaj\' SRC="/map/images/nfind.gif" style="vertical-align:middle;cursor: pointer" WIDTH="26" HEIGHT="26" onClick="szukaj_dzialki()"  onmouseover=\'showtipp("Kliknij w celu lokalizacji działki")\' onmouseout=\'hidetipp()\'>');
dl('</TD><TD>&nbsp;</TD></TR>');
odstepn(4);
ramkad();
odstepb(8);
}
function html_dzialka2(nrdz){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Lokalizacja działki</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD>&nbsp;</TD><TD ALIGN="LEFT"><SELECT NAME="sobreb">');
dl('<OPTION VALUE="">Wybierz miejscowość ...</OPTION><OPTION VALUE="">- - - - - - - - - - - - - - -</OPTION>');
for (i=0;i<obreby.length;i++)
dl ('<OPTION VALUE="'+obreby[i].split('=')[0]+'">'+obreby[i].split('=')[1]+'</OPTION>');
dl('</SELECT></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><span style="vertical-align:middle">Nr działki:</span>&nbsp;<input style="vertical-align:middle" type="text" size="13" name="nrdz" value="'+nrdz+'">');
dl('<IMG NAME=\'szukaj\' SRC="/map/images/nfind.gif" style="vertical-align:middle;cursor: pointer" WIDTH="26" HEIGHT="26" onClick="szukaj_dzialki()"  onmouseover=\'showtipp("Kliknij w celu lokalizacji działki")\' onmouseout=\'hidetipp()\'>');
dl('</TD><TD>&nbsp;</TD></TR>');
odstepn(4);
ramkad();
odstepb(8);
}
function html_legenda1(){
ramkag();
dl('<TR ALIGN="LEFT"><TD>&nbsp;</TD><TD><B>Legenda</B></TD><TD>&nbsp;</TD></TR>');
odstepn(4);
dl('<TR><TD>&nbsp;</TD><TD bgcolor="#808080"><TABLE border=\'0\' width="200"><tr><td>');
}
function html_legenda2(){
dl('</td></tr></TABLE></TD><TD>&nbsp;</TD></TR>');
odstepn(8);
ramkad();
odstepb(8);
}
function html_input(){
dl('<input type="hidden" name="operacja2" value="">');
dl('<input type="hidden" name="mylayers" value="">');
dl('<input type="hidden" name="adrestmp" value="">');
dl('<input type="hidden" name="nrdztmp" value="">');
dl('<input type="hidden" name="obiekttmp" value="">');
dl('<input type="hidden" name="mode" value="">');
dl('<input type="hidden" name="qlayer" value="">');
dl('<input type="hidden" name="qitem" value="">');
dl('<input type="hidden" name="qstring" value="">');
dl('<input type="hidden" name="scale" value="">');
dl('<input type="hidden" name="imgxy" value="">');
}

