//---------------------------------------------------------------------
// File: flyfotoarkivet.js  Date:17-10-2005
// (c) Copyright 2004, JO Informatik Aps, http://www.jo-informatik.dk/
//---------------------------------------------------------------------
var lastYear = 0;var adrs;var matrs;var map1;var resizeHandle;function onBodyLoad() {resize();document.getElementById('DDLVejnavn').onchange = vejnavnOnChange;map1 = new mapservice(document.getElementById('mapdiv'),'http://www.flyfotoarkivet.dk/wms/service.aspx?','1997','default','717000, 6160000,743000, 6180000','image/jpeg','EXCEPTIONS=application/vnd.ogc.se_inimage&BGCOLOR=0xFFFFFF&TRANSPARENT=false&servicename=taarnby_psmosaik&service=WMS&jpegquality=60'); map1.defaultBehaviour = new wmsBehaviour(2,2,0,false,true,false,false,40,10,50,5);selectMode(map1.operationMode);map1.progressElement = document.getElementById('busyDiv');map1.srs = 'EPSG:25832';map1.fractionDigits=2;map1.minResolution = 0.05;map1.bboxCalcMode=2;map1.OnRequestEnd = onRequestEnd;map1.OnClick = onClick;map1.SetBoxColor('#FCD12D');map1.borderSize = 2;map1.SetFullExtent(717000, 6160000,743000, 6180000);map1.SetView(717000, 6160000,743000, 6180000);}function onRequestEnd(sender) {document.getElementById('DDLYear').disabled = false;}function onClick(sender) {switch (sender.operationMode) {case 1: sender.Zoom(2,sender.worldX,sender.worldY);case 2: sender.Zoom(0.5,sender.worldX,sender.worldY);case 3: sender.SetCenter(sender.worldX,sender.worldY);}}function resize() {var width;var height;var mapdiv = document.getElementById('mapdiv');var navigationDiv = document.getElementById('navigationDiv');var navigationImg = document.getElementById('navigationImg');var copyrightDiv = document.getElementById('copyrightDiv');mapdiv.style.width = 0;mapdiv.style.height = 0;navigationDiv.style.visibility = 'hidden';navigationDiv.style.left = 0;navigationDiv.style.top = 0;navigationImg.style.visibility = 'hidden';navigationImg.style.left = 0;navigationImg.style.top = 0;copyrightDiv.style.visibility = 'hidden';document.getElementById('copyrightDiv').style.top = 0;if (isNav()) {width = window.innerWidth-2;height = window.innerHeight;} else {width = document.body.clientWidth;height = document.body.clientHeight+2;}width -= 0;height -= 92;width = Math.min(Math.max(width,600),1900);height = Math.min(Math.max(height,200),1900);mapdiv.style.width = width;mapdiv.style.height = height;mapdiv.style.visibility = 'visible';navigationDiv.style.top = 100;navigationDiv.style.left = width-82;navigationDiv.style.visibility = 'visible';navigationImg.style.top = 102;navigationImg.style.left = width-80;navigationImg.style.visibility = 'visible';document.getElementById('busyDiv').style.top = Math.floor(height/2) + 70;document.getElementById('busyDiv').style.left = Math.floor(width/2) - 60;copyrightDiv.style.top = isNav()?height+75:height+74;copyrightDiv.style.visibility = 'visible';if (map1) {map1.width = parseInt(width);map1.height = parseInt(height);map1.xyscale = parseInt(map1.width) / parseInt(map1.height);map1.bboxValidated = false;map1.nextBehaviour.scrollModeOnPan = 0;map1.nextBehaviour.scrollModeOnZoom = 0;map1.nextBehaviour.fadeInAfterPan = false;map1.nextBehaviour.fadeInAfterZoom = false;map1.nextBehaviour.fadeInAfterNoBBoxChange = false;map1.Show();}resizeHandle = 0;}function resizeTimeout() {if (resizeHandle!=0) {clearTimeout(resizeHandle);}resizeHandle = setTimeout("resize()",500);}function yearOnChange(ths) {document.getElementById('DDLYear').disabled = true;map1.services[0].layers[0] = ths.options[ths.selectedIndex].value;map1.nextBehaviour.fadeInAfterNoBBoxChange = true;map1.Show();}function vejnavnOnChange() {var dde = document.getElementById('DDLEjerlav');dde.selectedIndex = 0;document.getElementById('inputMatrnr').value = 'Matrnr.';var dd = document.getElementById('DDLVejnavn');var url = 'details.aspx?vejkode='+dd.options[dd.selectedIndex].value;document.body.style.cursor = 'wait';call(url,fillInfoHusnr);}function ejerlavOnChange() {var ddv = document.getElementById('DDLVejnavn');ddv.selectedIndex = 0;emptyList('DDLHusnr');fillList('DDLHusnr',0,'Husnr','0000');var ddh = document.getElementById('DDLHusnr');ddh.selectedIndex = 0;}function husnrOnChange(ths) {if (ths.options[ths.selectedIndex].text!='Husnr') {var offset = 50;var x = -adrs[ths.selectedIndex-1].x;var y = adrs[ths.selectedIndex-1].y;if ((x!=0) && (y!=0)) {map1.SetView(x-offset,y-offset,x+offset,y+offset);} else {alert('Adressen har ingen koordinater.\nDet er derfor ikke muligt at vise adressen.')}} else {alert('Vælg et vejnavn og et husnr');}}function matrnrKeyDown(ths,evt) {evt = (evt)?evt:(window.event)?window.event:"";if (evt.keyCode==13) {search();if (isNav()) { evt.returnValue = false; evt.cancel = true;evt.preventDefault(); }}return !(evt.keyCode == 13);}function search() {var dd = document.getElementById('DDLEjerlav');var ddValue = dd.options[dd.selectedIndex].value;var ipt = document.getElementById('inputMatrnr').value;if (ddValue>0) {if (ipt!='') {var url = 'details.aspx?matrnr='+ipt+'&ejerlav='+ddValue;call(url,fillInfoMatrnr);} else {alert('Udfyld matrikelnummer');}} else {alert('Vælg et ejerlav');}}function adr(nr,x,y) {this.nr = nr;this.x = x;this.y = y;}function matr(nr,elv) {this.nr = nr;this.ejerlav = elv;}function fillInfoHusnr(dynamicscript) {eval(dynamicscript);if (error) {alert('Uventet fejl ved opdatering af husnumre');} else {emptyList('DDLHusnr');fillList('DDLHusnr',0,'Husnr','0000');for (var ix=0;ix<adrs.length;ix++) {fillList('DDLHusnr',ix+1,adrs[ix].nr,'');}}document.body.style.cursor = 'auto';}function fillInfoEjerlav(dynamicscript) {eval(dynamicscript);emptyList('DDLMatrnr');fillList('DDLMatrnr',0,'Vælg...','0000');for (var ix=0;ix<1000;ix++) {fillList('DDLMatrnr',ix+1,matrs[ix].nr,matrs[ix].ejerlav);}}function fillInfoMatrnr(dynamicscript) {eval(dynamicscript);if (error) {alert('Uventet fejl ved opdatering af matrikelnummer');} else {if (xmin==0) {alert('Matrikelnummer ikke fundet');} else {map1.SetView(-xmin,ymin,-xmax,ymax);}}}function emptyList(listName) {var list = document.getElementById(listName);while (list.options.length) {list.options[0] = null; }}function fillList(listName,_id,optionText,optionValue) {with (document.getElementById(listName)) {options[_id] = new Option();options[_id].text = optionText;options[_id].value = optionValue; }}function selectMode(val) {map1.operationMode = val;document.getElementById('zoomin').src = 'images/zoomin2.gif';document.getElementById('zoomout').src = 'images/zoomout2.gif';document.getElementById('pan').src = 'images/pan2.gif';switch (val) {case 1:document.getElementById('zoomin').src = 'images/zoomin1.gif';break;case 2:document.getElementById('zoomout').src = 'images/zoomout1.gif';break;case 3:document.getElementById('pan').src = 'images/pan1.gif';break;}}function navPan(x,y,pct) {map1.Pan(pct*x,pct*y);}function matrnrFocus(ths) {if (ths.value=='Matrnr.') {ths.value='';}}function setArrowCursor(val) {document.getElementById('navigationImg').style.cursor = val;}
